ember-template-compiler-source 1.0.0.pre4.3 → 1.0.0.pre4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,5 +12,4 @@
12
12
  // Last commit: 0582243 (2013-02-15 11:11:45 -0800)
13
13
 
14
14
 
15
- (function(){this.Handlebars={},function(e){e.VERSION="1.0.0-rc.3",e.COMPILER_REVISION=2,e.REVISION_CHANGES={1:"<= 1.0.rc.2",2:">= 1.0.0-rc.3"},e.helpers={},e.partials={},e.registerHelper=function(e,t,n){n&&(t.not=n),this.helpers[e]=t},e.registerPartial=function(e,t){this.partials[e]=t},e.registerHelper("helperMissing",function(e){if(arguments.length===2)return undefined;throw new Error("Could not find property '"+e+"'")});var t=Object.prototype.toString,n="[object Function]";e.registerHelper("blockHelperMissing",function(r,i){var s=i.inverse||function(){},o=i.fn,u="",a=t.call(r);return a===n&&(r=r.call(this)),r===!0?o(this):r===!1||r==null?s(this):a==="[object Array]"?r.length>0?e.helpers.each(r,i):s(this):o(r)}),e.K=function(){},e.createFrame=Object.create||function(t){e.K.prototype=t;var n=new e.K;return e.K.prototype=null,n},e.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{0:"debug",1:"info",2:"warn",3:"error"},log:function(t,n){if(e.logger.level<=t){var r=e.logger.methodMap[t];typeof console!="undefined"&&console[r]&&console[r].call(console,n)}}},e.log=function(t,n){e.logger.log(t,n)},e.registerHelper("each",function(t,n){var r=n.fn,i=n.inverse,s=0,o="",u;n.data&&(u=e.createFrame(n.data));if(t&&typeof t=="object")if(t instanceof Array)for(var a=t.length;s<a;s++)u&&(u.index=s),o+=r(t[s],{data:u});else for(var f in t)t.hasOwnProperty(f)&&(u&&(u.key=f),o+=r(t[f],{data:u}),s++);return s===0&&(o=i(this)),o}),e.registerHelper("if",function(r,i){var s=t.call(r);return s===n&&(r=r.call(this)),!r||e.Utils.isEmpty(r)?i.inverse(this):i.fn(this)}),e.registerHelper("unless",function(t,n){var r=n.fn,i=n.inverse;return n.fn=i,n.inverse=r,e.helpers["if"].call(this,t,n)}),e.registerHelper("with",function(e,t){return t.fn(e)}),e.registerHelper("log",function(t,n){var r=n.data&&n.data.level!=null?parseInt(n.data.level,10):1;e.log(r,t)})}(this.Handlebars);var e=function(){function n(){this.yy={}}var e={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,simpleInverse:6,statements:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,partialName:25,params:26,hash:27,DATA:28,param:29,STRING:30,INTEGER:31,BOOLEAN:32,hashSegments:33,hashSegment:34,ID:35,EQUALS:36,PARTIAL_NAME:37,pathSegments:38,SEP:39,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"DATA",30:"STRING",31:"INTEGER",32:"BOOLEAN",35:"ID",36:"EQUALS",37:"PARTIAL_NAME",39:"SEP"},productions_:[0,[3,2],[4,2],[4,3],[4,2],[4,1],[4,1],[4,0],[7,1],[7,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[6,2],[17,3],[17,2],[17,2],[17,1],[17,1],[26,2],[26,1],[29,1],[29,1],[29,1],[29,1],[29,1],[27,1],[33,2],[33,1],[34,3],[34,3],[34,3],[34,3],[34,3],[25,1],[21,1],[38,3],[38,1]],performAction:function(t,n,r,i,s,o,u){var a=o.length-1;switch(s){case 1:return o[a-1];case 2:this.$=new i.ProgramNode([],o[a]);break;case 3:this.$=new i.ProgramNode(o[a-2],o[a]);break;case 4:this.$=new i.ProgramNode(o[a-1],[]);break;case 5:this.$=new i.ProgramNode(o[a]);break;case 6:this.$=new i.ProgramNode([],[]);break;case 7:this.$=new i.ProgramNode([]);break;case 8:this.$=[o[a]];break;case 9:o[a-1].push(o[a]),this.$=o[a-1];break;case 10:this.$=new i.BlockNode(o[a-2],o[a-1].inverse,o[a-1],o[a]);break;case 11:this.$=new i.BlockNode(o[a-2],o[a-1],o[a-1].inverse,o[a]);break;case 12:this.$=o[a];break;case 13:this.$=o[a];break;case 14:this.$=new i.ContentNode(o[a]);break;case 15:this.$=new i.CommentNode(o[a]);break;case 16:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 17:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 18:this.$=o[a-1];break;case 19:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 20:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1],!0);break;case 21:this.$=new i.PartialNode(o[a-1]);break;case 22:this.$=new i.PartialNode(o[a-2],o[a-1]);break;case 23:break;case 24:this.$=[[o[a-2]].concat(o[a-1]),o[a]];break;case 25:this.$=[[o[a-1]].concat(o[a]),null];break;case 26:this.$=[[o[a-1]],o[a]];break;case 27:this.$=[[o[a]],null];break;case 28:this.$=[[new i.DataNode(o[a])],null];break;case 29:o[a-1].push(o[a]),this.$=o[a-1];break;case 30:this.$=[o[a]];break;case 31:this.$=o[a];break;case 32:this.$=new i.StringNode(o[a]);break;case 33:this.$=new i.IntegerNode(o[a]);break;case 34:this.$=new i.BooleanNode(o[a]);break;case 35:this.$=new i.DataNode(o[a]);break;case 36:this.$=new i.HashNode(o[a]);break;case 37:o[a-1].push(o[a]),this.$=o[a-1];break;case 38:this.$=[o[a]];break;case 39:this.$=[o[a-2],o[a]];break;case 40:this.$=[o[a-2],new i.StringNode(o[a])];break;case 41:this.$=[o[a-2],new i.IntegerNode(o[a])];break;case 42:this.$=[o[a-2],new i.BooleanNode(o[a])];break;case 43:this.$=[o[a-2],new i.DataNode(o[a])];break;case 44:this.$=new i.PartialNameNode(o[a]);break;case 45:this.$=new i.IdNode(o[a]);break;case 46:o[a-2].push(o[a]),this.$=o[a-2];break;case 47:this.$=[o[a]]}},table:[{3:1,4:2,5:[2,7],6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],22:[1,14],23:[1,15],24:[1,16]},{1:[3]},{5:[1,17]},{5:[2,6],7:18,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,6],22:[1,14],23:[1,15],24:[1,16]},{5:[2,5],6:20,8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,5],22:[1,14],23:[1,15],24:[1,16]},{17:23,18:[1,22],21:24,28:[1,25],35:[1,27],38:26},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{4:28,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],24:[1,16]},{4:29,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],24:[1,16]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{17:30,21:24,28:[1,25],35:[1,27],38:26},{17:31,21:24,28:[1,25],35:[1,27],38:26},{17:32,21:24,28:[1,25],35:[1,27],38:26},{25:33,37:[1,34]},{1:[2,1]},{5:[2,2],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,2],22:[1,14],23:[1,15],24:[1,16]},{17:23,21:24,28:[1,25],35:[1,27],38:26},{5:[2,4],7:35,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,4],22:[1,14],23:[1,15],24:[1,16]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,23],14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],24:[2,23]},{18:[1,36]},{18:[2,27],21:41,26:37,27:38,28:[1,45],29:39,30:[1,42],31:[1,43],32:[1,44],33:40,34:46,35:[1,47],38:26},{18:[2,28]},{18:[2,45],28:[2,45],30:[2,45],31:[2,45],32:[2,45],35:[2,45],39:[1,48]},{18:[2,47],28:[2,47],30:[2,47],31:[2,47],32:[2,47],35:[2,47],39:[2,47]},{10:49,20:[1,50]},{10:51,20:[1,50]},{18:[1,52]},{18:[1,53]},{18:[1,54]},{18:[1,55],21:56,35:[1,27],38:26},{18:[2,44],35:[2,44]},{5:[2,3],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,3],22:[1,14],23:[1,15],24:[1,16]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{18:[2,25],21:41,27:57,28:[1,45],29:58,30:[1,42],31:[1,43],32:[1,44],33:40,34:46,35:[1,47],38:26},{18:[2,26]},{18:[2,30],28:[2,30],30:[2,30],31:[2,30],32:[2,30],35:[2,30]},{18:[2,36],34:59,35:[1,60]},{18:[2,31],28:[2,31],30:[2,31],31:[2,31],32:[2,31],35:[2,31]},{18:[2,32],28:[2,32],30:[2,32],31:[2,32],32:[2,32],35:[2,32]},{18:[2,33],28:[2,33],30:[2,33],31:[2,33],32:[2,33],35:[2,33]},{18:[2,34],28:[2,34],30:[2,34],31:[2,34],32:[2,34],35:[2,34]},{18:[2,35],28:[2,35],30:[2,35],31:[2,35],32:[2,35],35:[2,35]},{18:[2,38],35:[2,38]},{18:[2,47],28:[2,47],30:[2,47],31:[2,47],32:[2,47],35:[2,47],36:[1,61],39:[2,47]},{35:[1,62]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{21:63,35:[1,27],38:26},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],24:[2,21]},{18:[1,64]},{18:[2,24]},{18:[2,29],28:[2,29],30:[2,29],31:[2,29],32:[2,29],35:[2,29]},{18:[2,37],35:[2,37]},{36:[1,61]},{21:65,28:[1,69],30:[1,66],31:[1,67],32:[1,68],35:[1,27],38:26},{18:[2,46],28:[2,46],30:[2,46],31:[2,46],32:[2,46],35:[2,46],39:[2,46]},{18:[1,70]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],24:[2,22]},{18:[2,39],35:[2,39]},{18:[2,40],35:[2,40]},{18:[2,41],35:[2,41]},{18:[2,42],35:[2,42]},{18:[2,43],35:[2,43]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]}],defaultActions:{17:[2,1],25:[2,28],38:[2,26],57:[2,24]},parseError:function(t,n){throw new Error(t)},parse:function(t){function v(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}function m(){var e;return e=n.lexer.lex()||1,typeof e!="number"&&(e=n.symbols_[e]||e),e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var p=this.lexer.yylloc;s.push(p);var d=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var g,y,b,w,E,S,x={},T,N,C,k;for(;;){b=r[r.length-1];if(this.defaultActions[b])w=this.defaultActions[b];else{if(g===null||typeof g=="undefined")g=m();w=o[b]&&o[b][g]}if(typeof w=="undefined"||!w.length||!w[0]){var L="";if(!l){k=[];for(T in o[b])this.terminals_[T]&&T>2&&k.push("'"+this.terminals_[T]+"'");this.lexer.showPosition?L="Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+k.join(", ")+", got '"+(this.terminals_[g]||g)+"'":L="Parse error on line "+(a+1)+": Unexpected "+(g==1?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(L,{text:this.lexer.match,token:this.terminals_[g]||g,line:this.lexer.yylineno,loc:p,expected:k})}}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(w[0]){case 1:r.push(g),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(w[1]),g=null,y?(g=y,y=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:N=this.productions_[w[1]][1],x.$=i[i.length-N],x._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column},d&&(x._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]),S=this.performAction.call(x,u,f,a,this.yy,w[1],i,s);if(typeof S!="undefined")return S;N&&(r=r.slice(0,-1*N*2),i=i.slice(0,-1*N),s=s.slice(0,-1*N)),r.push(this.productions_[w[1]][0]),i.push(x.$),s.push(x._$),C=o[r[r.length-2]][r[r.length-1]],r.push(C);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(t,n){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,n)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,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},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);return t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var r=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),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=(new Array(e.length+1)).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r,i,s;this._more||(this.yytext="",this.match="");var o=this._currentRules();for(var u=0;u<o.length;u++){n=this._input.match(this.rules[o[u]]);if(n&&(!t||n[0].length>t[0].length)){t=n,r=u;if(!this.options.flex)break}}if(t){s=t[0].match(/(?:\r\n?|\n).*/g),s&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1);if(e)return e;return}return this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return typeof t!="undefined"?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return e.options={},e.performAction=function(t,n,r,i){var s=i;switch(r){case 0:n.yytext.slice(-1)!=="\\"&&this.begin("mu"),n.yytext.slice(-1)==="\\"&&(n.yytext=n.yytext.substr(0,n.yyleng-1),this.begin("emu"));if(n.yytext)return 14;break;case 1:return 14;case 2:return n.yytext.slice(-1)!=="\\"&&this.popState(),n.yytext.slice(-1)==="\\"&&(n.yytext=n.yytext.substr(0,n.yyleng-1)),14;case 3:return n.yytext=n.yytext.substr(0,n.yyleng-4),this.popState(),15;case 4:return this.begin("par"),24;case 5:return 16;case 6:return 20;case 7:return 19;case 8:return 19;case 9:return 23;case 10:return 23;case 11:this.popState(),this.begin("com");break;case 12:return n.yytext=n.yytext.substr(3,n.yyleng-5),this.popState(),15;case 13:return 22;case 14:return 36;case 15:return 35;case 16:return 35;case 17:return 39;case 18:break;case 19:return this.popState(),18;case 20:return this.popState(),18;case 21:return n.yytext=n.yytext.substr(1,n.yyleng-2).replace(/\\"/g,'"'),30;case 22:return n.yytext=n.yytext.substr(1,n.yyleng-2).replace(/\\'/g,"'"),30;case 23:return n.yytext=n.yytext.substr(1),28;case 24:return 32;case 25:return 32;case 26:return 31;case 27:return 35;case 28:return n.yytext=n.yytext.substr(1,n.yyleng-2),35;case 29:return"INVALID";case 30:break;case 31:return this.popState(),37;case 32:return 5}},e.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:\s+)/,/^(?:[a-zA-Z0-9_$-/]+)/,/^(?:$)/],e.conditions={mu:{rules:[4,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,32],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[3],inclusive:!1},par:{rules:[30,31],inclusive:!1},INITIAL:{rules:[0,1,32],inclusive:!0}},e}();return e.lexer=t,n.prototype=e,e.Parser=n,new n}();Handlebars.Parser=e,Handlebars.parse=function(e){return e.constructor===Handlebars.AST.ProgramNode?e:(Handlebars.Parser.yy=Handlebars.AST,Handlebars.Parser.parse(e))},Handlebars.print=function(e){return(new Handlebars.PrintVisitor).accept(e)},function(){Handlebars.AST={},Handlebars.AST.ProgramNode=function(e,t){this.type="program",this.statements=e,t&&(this.inverse=new Handlebars.AST.ProgramNode(t))},Handlebars.AST.MustacheNode=function(e,t,n){this.type="mustache",this.escaped=!n,this.hash=t;var r=this.id=e[0],i=this.params=e.slice(1),s=this.eligibleHelper=r.isSimple;this.isHelper=s&&(i.length||t)},Handlebars.AST.PartialNode=function(e,t){this.type="partial",this.partialName=e,this.context=t};var e=function(e,t){if(e.original!==t.original)throw new Handlebars.Exception(e.original+" doesn't match "+t.original)};Handlebars.AST.BlockNode=function(t,n,r,i){e(t.id,i),this.type="block",this.mustache=t,this.program=n,this.inverse=r,this.inverse&&!this.program&&(this.isInverse=!0)},Handlebars.AST.ContentNode=function(e){this.type="content",this.string=e},Handlebars.AST.HashNode=function(e){this.type="hash",this.pairs=e},Handlebars.AST.IdNode=function(e){this.type="ID",this.original=e.join(".");var t=[],n=0;for(var r=0,i=e.length;r<i;r++){var s=e[r];if(s===".."||s==="."||s==="this"){if(t.length>0)throw new Handlebars.Exception("Invalid path: "+this.original);s===".."?n++:this.isScoped=!0}else t.push(s)}this.parts=t,this.string=t.join("."),this.depth=n,this.isSimple=e.length===1&&!this.isScoped&&n===0,this.stringModeValue=this.string},Handlebars.AST.PartialNameNode=function(e){this.type="PARTIAL_NAME",this.name=e},Handlebars.AST.DataNode=function(e){this.type="DATA",this.id=e},Handlebars.AST.StringNode=function(e){this.type="STRING",this.string=e,this.stringModeValue=e},Handlebars.AST.IntegerNode=function(e){this.type="INTEGER",this.integer=e,this.stringModeValue=Number(e)},Handlebars.AST.BooleanNode=function(e){this.type="BOOLEAN",this.bool=e,this.stringModeValue=e==="true"},Handlebars.AST.CommentNode=function(e){this.type="comment",this.comment=e}}();var t=["description","fileName","lineNumber","message","name","number","stack"];Handlebars.Exception=function(e){var n=Error.prototype.constructor.apply(this,arguments);for(var r=0;r<t.length;r++)this[t[r]]=n[t[r]]},Handlebars.Exception.prototype=new Error,Handlebars.SafeString=function(e){this.string=e},Handlebars.SafeString.prototype.toString=function(){return this.string.toString()},function(){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},t=/[&<>"'`]/g,n=/[&<>"'`]/,r=function(t){return e[t]||"&amp;"};Handlebars.Utils={escapeExpression:function(e){return e instanceof Handlebars.SafeString?e.toString():e==null||e===!1?"":n.test(e)?e.replace(t,r):e},isEmpty:function(e){return!e&&e!==0?!0:Object.prototype.toString.call(e)==="[object Array]"&&e.length===0?!0:!1}}}(),Handlebars.Compiler=function(){},Handlebars.JavaScriptCompiler=function(){},function(e,t){e.prototype={compiler:e,disassemble:function(){var e=this.opcodes,t,n=[],r,i;for(var s=0,o=e.length;s<o;s++){t=e[s];if(t.opcode==="DECLARE")n.push("DECLARE "+t.name+"="+t.value);else{r=[];for(var u=0;u<t.args.length;u++)i=t.args[u],typeof i=="string"&&(i='"'+i.replace("\n","\\n")+'"'),r.push(i);n.push(t.opcode+" "+r.join(" "))}}return n.join("\n")},equals:function(e){var t=this.opcodes.length;if(e.opcodes.length!==t)return!1;for(var n=0;n<t;n++){var r=this.opcodes[n],i=e.opcodes[n];if(r.opcode!==i.opcode||r.args.length!==i.args.length)return!1;for(var s=0;s<r.args.length;s++)if(r.args[s]!==i.args[s])return!1}return!0},guid:0,compile:function(e,t){this.children=[],this.depths={list:[]},this.options=t;var n=this.options.knownHelpers;this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0};if(n)for(var r in n)this.options.knownHelpers[r]=n[r];return this.program(e)},accept:function(e){return this[e.type](e)},program:function(e){var t=e.statements,n;this.opcodes=[];for(var r=0,i=t.length;r<i;r++)n=t[r],this[n.type](n);return this.isSimple=i===1,this.depths.list=this.depths.list.sort(function(e,t){return e-t}),this},compileProgram:function(e){var t=(new this.compiler).compile(e,this.options),n=this.guid++,r;this.usePartial=this.usePartial||t.usePartial,this.children[n]=t;for(var i=0,s=t.depths.list.length;i<s;i++){r=t.depths.list[i];if(r<2)continue;this.addDepth(r-1)}return n},block:function(e){var t=e.mustache,n=e.program,r=e.inverse;n&&(n=this.compileProgram(n)),r&&(r=this.compileProgram(r));var i=this.classifyMustache(t);i==="helper"?this.helperMustache(t,n,r):i==="simple"?(this.simpleMustache(t),this.opcode("pushProgram",n),this.opcode("pushProgram",r),this.opcode("emptyHash"),this.opcode("blockValue")):(this.ambiguousMustache(t,n,r),this.opcode("pushProgram",n),this.opcode("pushProgram",r),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(e){var t=e.pairs,n,r;this.opcode("pushHash");for(var i=0,s=t.length;i<s;i++)n=t[i],r=n[1],this.options.stringParams?this.opcode("pushStringParam",r.stringModeValue,r.type):this.accept(r),this.opcode("assignToHash",n[0]);this.opcode("popHash")},partial:function(e){var t=e.partialName;this.usePartial=!0,e.context?this.ID(e.context):this.opcode("push","depth0"),this.opcode("invokePartial",t.name),this.opcode("append")},content:function(e){this.opcode("appendContent",e.string)},mustache:function(e){var t=this.options,n=this.classifyMustache(e);n==="simple"?this.simpleMustache(e):n==="helper"?this.helperMustache(e):this.ambiguousMustache(e),e.escaped&&!t.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousMustache:function(e,t,n){var r=e.id,i=r.parts[0],s=t!=null||n!=null;this.opcode("getContext",r.depth),this.opcode("pushProgram",t),this.opcode("pushProgram",n),this.opcode("invokeAmbiguous",i,s)},simpleMustache:function(e){var t=e.id;t.type==="DATA"?this.DATA(t):t.parts.length?this.ID(t):(this.addDepth(t.depth),this.opcode("getContext",t.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperMustache:function(e,t,n){var r=this.setupFullMustacheParams(e,t,n),i=e.id.parts[0];if(this.options.knownHelpers[i])this.opcode("invokeKnownHelper",r.length,i);else{if(this.knownHelpersOnly)throw new Error("You specified knownHelpersOnly, but used the unknown helper "+i);this.opcode("invokeHelper",r.length,i)}},ID:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0];t?this.opcode("lookupOnContext",e.parts[0]):this.opcode("pushContext");for(var n=1,r=e.parts.length;n<r;n++)this.opcode("lookup",e.parts[n])},DATA:function(e){this.options.data=!0,this.opcode("lookupData",e.id)},STRING:function(e){this.opcode("pushString",e.string)},INTEGER:function(e){this.opcode("pushLiteral",e.integer)},BOOLEAN:function(e){this.opcode("pushLiteral",e.bool)},comment:function(){},opcode:function(e){this.opcodes.push({opcode:e,args:[].slice.call(arguments,1)})},declare:function(e,t){this.opcodes.push({opcode:"DECLARE",name:e,value:t})},addDepth:function(e){if(isNaN(e))throw new Error("EWOT");if(e===0)return;this.depths[e]||(this.depths[e]=!0,this.depths.list.push(e))},classifyMustache:function(e){var t=e.isHelper,n=e.eligibleHelper,r=this.options;if(n&&!t){var i=e.id.parts[0];r.knownHelpers[i]?t=!0:r.knownHelpersOnly&&(n=!1)}return t?"helper":n?"ambiguous":"simple"},pushParams:function(e){var t=e.length,n;while(t--)n=e[t],this.options.stringParams?(n.depth&&this.addDepth(n.depth),this.opcode("getContext",n.depth||0),this.opcode("pushStringParam",n.stringModeValue,n.type)):this[n.type](n)},setupMustacheParams:function(e){var t=e.params;return this.pushParams(t),e.hash?this.hash(e.hash):this.opcode("emptyHash"),t},setupFullMustacheParams:function(e,t,n){var r=e.params;return this.pushParams(r),this.opcode("pushProgram",t),this.opcode("pushProgram",n),e.hash?this.hash(e.hash):this.opcode("emptyHash"),r}};var n=function(e){this.value=e};t.prototype={nameLookup:function(e,n){return/^[0-9]+$/.test(n)?e+"["+n+"]":t.isValidJavaScriptVariableName(n)?e+"."+n:e+"['"+n+"']"},appendToBuffer:function(e){return this.environment.isSimple?"return "+e+";":{appendToBuffer:!0,content:e,toString:function(){return"buffer += "+e+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(e,t,n,r){this.environment=e,this.options=t||{},Handlebars.log(Handlebars.logger.DEBUG,this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!n,this.context=n||{programs:[],environments:[],aliases:{}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.registers={list:[]},this.compileStack=[],this.inlineStack=[],this.compileChildren(e,t);var i=e.opcodes,s;this.i=0;for(o=i.length;this.i<o;this.i++)s=i[this.i],s.opcode==="DECLARE"?this[s.name]=s.value:this[s.opcode].apply(this,s.args);return this.createFunctionContext(r)},nextOpcode:function(){var e=this.environment.opcodes;return e[this.i+1]},eat:function(){this.i=this.i+1},preamble:function(){var e=[];if(!this.isChild){var t=this.namespace,n="helpers = helpers || "+t+".helpers;";this.environment.usePartial&&(n=n+" partials = partials || "+t+".partials;"),this.options.data&&(n+=" data = data || {};"),e.push(n)}else e.push("");this.environment.isSimple?e.push(""):e.push(", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=e},createFunctionContext:function(e){var t=this.stackVars.concat(this.registers.list);t.length>0&&(this.source[1]=this.source[1]+", "+t.join(", "));if(!this.isChild)for(var n in this.context.aliases)this.source[1]=this.source[1]+", "+n+"="+this.context.aliases[n];this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.source.push("return buffer;");var r=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var i=0,s=this.environment.depths.list.length;i<s;i++)r.push("depth"+this.environment.depths.list[i]);var o=this.mergeSource();if(!this.isChild){var u=Handlebars.COMPILER_REVISION,a=Handlebars.REVISION_CHANGES[u];o="this.compilerInfo = ["+u+",'"+a+"'];\n"+o}if(e)return r.push(o),Function.apply(this,r);var f="function "+(this.name||"")+"("+r.join(",")+") {\n "+o+"}";return Handlebars.log(Handlebars.logger.DEBUG,f+"\n\n"),f},mergeSource:function(){var e="",t;for(var n=0,r=this.source.length;n<r;n++){var i=this.source[n];i.appendToBuffer?t?t=t+"\n + "+i.content:t=i.content:(t&&(e+="buffer += "+t+";\n ",t=undefined),e+=i+"\n ")}return e},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e),this.replaceStack(function(t){return e.splice(1,0,t),"blockHelperMissing.call("+e.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e);var t=this.topStack();e.splice(1,0,t),e[e.length-1]="options",this.source.push("if (!"+this.lastHelper+") { "+t+" = blockHelperMissing.call("+e.join(", ")+"); }")},appendContent:function(e){this.source.push(this.appendToBuffer(this.quotedString(e)))},append:function(){this.flushInline();var e=this.popStack();this.source.push("if("+e+" || "+e+" === 0) { "+this.appendToBuffer(e)+" }"),this.environment.isSimple&&this.source.push("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.context.aliases.escapeExpression="this.escapeExpression",this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(e){this.lastContext!==e&&(this.lastContext=e)},lookupOnContext:function(e){this.push(this.nameLookup("depth"+this.lastContext,e,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"',this.replaceStack(function(e){return"typeof "+e+" === functionType ? "+e+".apply(depth0) : "+e})},lookup:function(e){this.replaceStack(function(t){return t+" == null || "+t+" === false ? "+t+" : "+this.nameLookup(t,e,"context")})},lookupData:function(e){this.push(this.nameLookup("data",e,"data"))},pushStringParam:function(e,t){this.pushStackLiteral("depth"+this.lastContext),this.pushString(t),typeof e=="string"?this.pushString(e):this.pushStackLiteral(e)},emptyHash:function(){this.pushStackLiteral("{}"),this.options.stringParams&&this.register("hashTypes","{}")},pushHash:function(){this.hash={values:[],types:[]}},popHash:function(){var e=this.hash;this.hash=undefined,this.options.stringParams&&this.register("hashTypes","{"+e.types.join(",")+"}"),this.push("{\n "+e.values.join(",\n ")+"\n }")},pushString:function(e){this.pushStackLiteral(this.quotedString(e))},push:function(e){return this.inlineStack.push(e),e},pushLiteral:function(e){this.pushStackLiteral(e)},pushProgram:function(e){e!=null?this.pushStackLiteral(this.programExpression(e)):this.pushStackLiteral(null)},invokeHelper:function(e,t){this.context.aliases.helperMissing="helpers.helperMissing";var n=this.lastHelper=this.setupHelper(e,t,!0);this.push(n.name),this.replaceStack(function(e){return e+" ? "+e+".call("+n.callParams+") "+": helperMissing.call("+n.helperMissingParams+")"})},invokeKnownHelper:function(e,t){var n=this.setupHelper(e,t);this.push(n.name+".call("+n.callParams+")")},invokeAmbiguous:function(e,t){this.context.aliases.functionType='"function"',this.pushStackLiteral("{}");var n=this.setupHelper(0,e,t),r=this.lastHelper=this.nameLookup("helpers",e,"helper"),i=this.nameLookup("depth"+this.lastContext,e,"context"),s=this.nextStack();this.source.push("if ("+s+" = "+r+") { "+s+" = "+s+".call("+n.callParams+"); }"),this.source.push("else { "+s+" = "+i+"; "+s+" = typeof "+s+" === functionType ? "+s+".apply(depth0) : "+s+"; }")},invokePartial:function(e){var t=[this.nameLookup("partials",e,"partial"),"'"+e+"'",this.popStack(),"helpers","partials"];this.options.data&&t.push("data"),this.context.aliases.self="this",this.push("self.invokePartial("+t.join(", ")+")")},assignToHash:function(e){var t=this.popStack(),n;this.options.stringParams&&(n=this.popStack(),this.popStack());var r=this.hash;n&&r.types.push("'"+e+"': "+n),r.values.push("'"+e+"': ("+t+")")},compiler:t,compileChildren:function(e,t){var n=e.children,r,i;for(var s=0,o=n.length;s<o;s++){r=n[s],i=new this.compiler;var u=this.matchExistingProgram(r);u==null?(this.context.programs.push(""),u=this.context.programs.length,r.index=u,r.name="program"+u,this.context.programs[u]=i.compile(r,t,this.context),this.context.environments[u]=r):(r.index=u,r.name="program"+u)}},matchExistingProgram:function(e){for(var t=0,n=this.context.environments.length;t<n;t++){var r=this.context.environments[t];if(r&&r.equals(e))return t}},programExpression:function(e){this.context.aliases.self="this";if(e==null)return"self.noop";var t=this.environment.children[e],n=t.depths.list,r,i=[t.index,t.name,"data"];for(var s=0,o=n.length;s<o;s++)r=n[s],r===1?i.push("depth0"):i.push("depth"+(r-1));return n.length===0?"self.program("+i.join(", ")+")":(i.shift(),"self.programWithDepth("+i.join(", ")+")")},register:function(e,t){this.useRegister(e),this.source.push(e+" = "+t+";")},useRegister:function(e){this.registers[e]||(this.registers[e]=!0,this.registers.list.push(e))},pushStackLiteral:function(e){return this.push(new n(e))},pushStack:function(e){this.flushInline();var t=this.incrStack();return e&&this.source.push(t+" = "+e+";"),this.compileStack.push(t),t},replaceStack:function(e){var t="",r=this.isInline(),i;if(
16
- r){var s=this.popStack(!0);if(s instanceof n)i=s.value;else{var o=this.stackSlot?this.topStackName():this.incrStack();t="("+this.push(o)+" = "+s+"),",i=this.topStack()}}else i=this.topStack();var u=e.call(this,i);return r?((this.inlineStack.length||this.compileStack.length)&&this.popStack(),this.push("("+t+u+")")):(/^stack/.test(i)||(i=this.nextStack()),this.source.push(i+" = ("+t+u+");")),i},nextStack:function(){return this.pushStack()},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var e=this.inlineStack;if(e.length){this.inlineStack=[];for(var t=0,r=e.length;t<r;t++){var i=e[t];i instanceof n?this.compileStack.push(i):this.pushStack(i)}}},isInline:function(){return this.inlineStack.length},popStack:function(e){var t=this.isInline(),r=(t?this.inlineStack:this.compileStack).pop();return!e&&r instanceof n?r.value:(t||this.stackSlot--,r)},topStack:function(e){var t=this.isInline()?this.inlineStack:this.compileStack,r=t[t.length-1];return!e&&r instanceof n?r.value:r},quotedString:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'},setupHelper:function(e,t,n){var r=[];this.setupParams(e,r,n);var i=this.nameLookup("helpers",t,"helper");return{params:r,name:i,callParams:["depth0"].concat(r).join(", "),helperMissingParams:n&&["depth0",this.quotedString(t)].concat(r).join(", ")}},setupParams:function(e,t,n){var r=[],i=[],s=[],o,u,a;r.push("hash:"+this.popStack()),u=this.popStack(),a=this.popStack();if(a||u)a||(this.context.aliases.self="this",a="self.noop"),u||(this.context.aliases.self="this",u="self.noop"),r.push("inverse:"+u),r.push("fn:"+a);for(var f=0;f<e;f++)o=this.popStack(),t.push(o),this.options.stringParams&&(s.push(this.popStack()),i.push(this.popStack()));return this.options.stringParams&&(r.push("contexts:["+i.join(",")+"]"),r.push("types:["+s.join(",")+"]"),r.push("hashTypes:hashTypes")),this.options.data&&r.push("data:data"),r="{"+r.join(",")+"}",n?(this.register("options",r),t.push("options")):t.push(r),t.join(", ")}};var r="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),i=t.RESERVED_WORDS={};for(var s=0,o=r.length;s<o;s++)i[r[s]]=!0;t.isValidJavaScriptVariableName=function(e){return!t.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(e)?!0:!1}}(Handlebars.Compiler,Handlebars.JavaScriptCompiler),Handlebars.precompile=function(e,t){if(!e||typeof e!="string"&&e.constructor!==Handlebars.AST.ProgramNode)throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+e);t=t||{},"data"in t||(t.data=!0);var n=Handlebars.parse(e),r=(new Handlebars.Compiler).compile(n,t);return(new Handlebars.JavaScriptCompiler).compile(r,t)},Handlebars.compile=function(e,t){function r(){var n=Handlebars.parse(e),r=(new Handlebars.Compiler).compile(n,t),i=(new Handlebars.JavaScriptCompiler).compile(r,t,undefined,!0);return Handlebars.template(i)}if(!e||typeof e!="string"&&e.constructor!==Handlebars.AST.ProgramNode)throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+e);t=t||{},"data"in t||(t.data=!0);var n;return function(e,t){return n||(n=r()),n.call(this,e,t)}},Handlebars.VM={template:function(e){var t={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(e,t,n){var r=this.programs[e];return n?Handlebars.VM.program(t,n):r?r:(r=this.programs[e]=Handlebars.VM.program(t),r)},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop,compilerInfo:null};return function(n,r){r=r||{};var i=e.call(t,Handlebars,n,r.helpers,r.partials,r.data),s=t.compilerInfo||[],o=s[0]||1,u=Handlebars.COMPILER_REVISION;if(o!==u){if(o<u){var a=Handlebars.REVISION_CHANGES[u],f=Handlebars.REVISION_CHANGES[o];throw"Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+a+") or downgrade your runtime to an older version ("+f+")."}throw"Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+s[1]+")."}return i}},programWithDepth:function(e,t,n){var r=Array.prototype.slice.call(arguments,2);return function(n,i){return i=i||{},e.apply(this,[n,i.data||t].concat(r))}},program:function(e,t){return function(n,r){return r=r||{},e(n,r.data||t)}},noop:function(){return""},invokePartial:function(e,t,n,r,i,s){var o={helpers:r,partials:i,data:s};if(e===undefined)throw new Handlebars.Exception("The partial "+t+" could not be found");if(e instanceof Function)return e(n,o);if(!Handlebars.compile)throw new Handlebars.Exception("The partial "+t+" could not be compiled when running in runtime-only mode");return i[t]=Handlebars.compile(e,{data:s!==undefined}),i[t](n,o)}},Handlebars.template=Handlebars.VM.template})(),function(){var e=Object.create||function(e){function t(){}return t.prototype=e,new t},t=this.Handlebars||Ember.imports.Handlebars;Ember.Handlebars=e(t),Ember.Handlebars.helpers=e(t.helpers),Ember.Handlebars.Compiler=function(){},t.Compiler&&(Ember.Handlebars.Compiler.prototype=e(t.Compiler.prototype)),Ember.Handlebars.Compiler.prototype.compiler=Ember.Handlebars.Compiler,Ember.Handlebars.JavaScriptCompiler=function(){},t.JavaScriptCompiler&&(Ember.Handlebars.JavaScriptCompiler.prototype=e(t.JavaScriptCompiler.prototype),Ember.Handlebars.JavaScriptCompiler.prototype.compiler=Ember.Handlebars.JavaScriptCompiler),Ember.Handlebars.JavaScriptCompiler.prototype.namespace="Ember.Handlebars",Ember.Handlebars.JavaScriptCompiler.prototype.initializeBuffer=function(){return"''"},Ember.Handlebars.JavaScriptCompiler.prototype.appendToBuffer=function(e){return"data.buffer.push("+e+");"};var n="ember"+ +(new Date),r=1;Ember.Handlebars.Compiler.prototype.mustache=function(e){if(e.isHelper&&e.id.string==="control")e.hash=e.hash||new t.AST.HashNode([]),e.hash.pairs.push(["controlID",new t.AST.StringNode(n+r++)]);else if(!e.params.length&&!e.hash){var i=new t.AST.IdNode(["_triageMustache"]);e.escaped||(e.hash=e.hash||new t.AST.HashNode([]),e.hash.pairs.push(["unescaped",new t.AST.StringNode("true")])),e=new t.AST.MustacheNode([i].concat([e.id]),e.hash,!e.escaped)}return t.Compiler.prototype.mustache.call(this,e)},Ember.Handlebars.precompile=function(e){var n=t.parse(e),r={knownHelpers:{action:!0,unbound:!0,bindAttr:!0,template:!0,view:!0,_triageMustache:!0},data:!0,stringParams:!0},i=(new Ember.Handlebars.Compiler).compile(n,r);return(new Ember.Handlebars.JavaScriptCompiler).compile(i,r,undefined,!0)},t.compile&&(Ember.Handlebars.compile=function(e){var n=t.parse(e),r={data:!0,stringParams:!0},i=(new Ember.Handlebars.Compiler).compile(n,r),s=(new Ember.Handlebars.JavaScriptCompiler).compile(i,r,undefined,!0);return Ember.Handlebars.template(s)})}(),typeof location!="undefined"&&(location.hostname==="localhost"||location.hostname==="127.0.0.1")&&console.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. If you want full error messages please use the non-minified build provided on the Ember website.");
15
+ (function(){var e=Object.create||function(e){function t(){}return t.prototype=e,new t},t=this.Handlebars||Ember.imports&&Ember.imports.Handlebars;!t&&typeof require=="function"&&(t=require("handlebars")),Ember.Handlebars=e(t),Ember.Handlebars.helpers=e(t.helpers),Ember.Handlebars.Compiler=function(){},t.Compiler&&(Ember.Handlebars.Compiler.prototype=e(t.Compiler.prototype)),Ember.Handlebars.Compiler.prototype.compiler=Ember.Handlebars.Compiler,Ember.Handlebars.JavaScriptCompiler=function(){},t.JavaScriptCompiler&&(Ember.Handlebars.JavaScriptCompiler.prototype=e(t.JavaScriptCompiler.prototype),Ember.Handlebars.JavaScriptCompiler.prototype.compiler=Ember.Handlebars.JavaScriptCompiler),Ember.Handlebars.JavaScriptCompiler.prototype.namespace="Ember.Handlebars",Ember.Handlebars.JavaScriptCompiler.prototype.initializeBuffer=function(){return"''"},Ember.Handlebars.JavaScriptCompiler.prototype.appendToBuffer=function(e){return"data.buffer.push("+e+");"};var n="ember"+ +(new Date),r=1;Ember.Handlebars.Compiler.prototype.mustache=function(e){if(e.isHelper&&e.id.string==="control")e.hash=e.hash||new t.AST.HashNode([]),e.hash.pairs.push(["controlID",new t.AST.StringNode(n+r++)]);else if(!e.params.length&&!e.hash){var i=new t.AST.IdNode(["_triageMustache"]);e.escaped||(e.hash=e.hash||new t.AST.HashNode([]),e.hash.pairs.push(["unescaped",new t.AST.StringNode("true")])),e=new t.AST.MustacheNode([i].concat([e.id]),e.hash,!e.escaped)}return t.Compiler.prototype.mustache.call(this,e)},Ember.Handlebars.precompile=function(e){var n=t.parse(e),r={knownHelpers:{action:!0,unbound:!0,bindAttr:!0,template:!0,view:!0,_triageMustache:!0},data:!0,stringParams:!0},i=(new Ember.Handlebars.Compiler).compile(n,r);return(new Ember.Handlebars.JavaScriptCompiler).compile(i,r,undefined,!0)},t.compile&&(Ember.Handlebars.compile=function(e){var n=t.parse(e),r={data:!0,stringParams:!0},i=(new Ember.Handlebars.Compiler).compile(n,r),s=(new Ember.Handlebars.JavaScriptCompiler).compile(i,r,undefined,!0);return Ember.Handlebars.template(s)})})(),typeof location!="undefined"&&(location.hostname==="localhost"||location.hostname==="127.0.0.1")&&console.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. If you want full error messages please use the non-minified build provided on the Ember website.");
@@ -1,2208 +1,3 @@
1
- (function() {
2
- /*
3
-
4
- Copyright (C) 2011 by Yehuda Katz
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
23
-
24
- */
25
-
26
- // lib/handlebars/base.js
27
-
28
- /*jshint eqnull:true*/
29
- this.Handlebars = {};
30
-
31
- (function(Handlebars) {
32
-
33
- Handlebars.VERSION = "1.0.0-rc.3";
34
- Handlebars.COMPILER_REVISION = 2;
35
-
36
- Handlebars.REVISION_CHANGES = {
37
- 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
38
- 2: '>= 1.0.0-rc.3'
39
- };
40
-
41
- Handlebars.helpers = {};
42
- Handlebars.partials = {};
43
-
44
- Handlebars.registerHelper = function(name, fn, inverse) {
45
- if(inverse) { fn.not = inverse; }
46
- this.helpers[name] = fn;
47
- };
48
-
49
- Handlebars.registerPartial = function(name, str) {
50
- this.partials[name] = str;
51
- };
52
-
53
- Handlebars.registerHelper('helperMissing', function(arg) {
54
- if(arguments.length === 2) {
55
- return undefined;
56
- } else {
57
- throw new Error("Could not find property '" + arg + "'");
58
- }
59
- });
60
-
61
- var toString = Object.prototype.toString, functionType = "[object Function]";
62
-
63
- Handlebars.registerHelper('blockHelperMissing', function(context, options) {
64
- var inverse = options.inverse || function() {}, fn = options.fn;
65
-
66
-
67
- var ret = "";
68
- var type = toString.call(context);
69
-
70
- if(type === functionType) { context = context.call(this); }
71
-
72
- if(context === true) {
73
- return fn(this);
74
- } else if(context === false || context == null) {
75
- return inverse(this);
76
- } else if(type === "[object Array]") {
77
- if(context.length > 0) {
78
- return Handlebars.helpers.each(context, options);
79
- } else {
80
- return inverse(this);
81
- }
82
- } else {
83
- return fn(context);
84
- }
85
- });
86
-
87
- Handlebars.K = function() {};
88
-
89
- Handlebars.createFrame = Object.create || function(object) {
90
- Handlebars.K.prototype = object;
91
- var obj = new Handlebars.K();
92
- Handlebars.K.prototype = null;
93
- return obj;
94
- };
95
-
96
- Handlebars.logger = {
97
- DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
98
-
99
- methodMap: {0: 'debug', 1: 'info', 2: 'warn', 3: 'error'},
100
-
101
- // can be overridden in the host environment
102
- log: function(level, obj) {
103
- if (Handlebars.logger.level <= level) {
104
- var method = Handlebars.logger.methodMap[level];
105
- if (typeof console !== 'undefined' && console[method]) {
106
- console[method].call(console, obj);
107
- }
108
- }
109
- }
110
- };
111
-
112
- Handlebars.log = function(level, obj) { Handlebars.logger.log(level, obj); };
113
-
114
- Handlebars.registerHelper('each', function(context, options) {
115
- var fn = options.fn, inverse = options.inverse;
116
- var i = 0, ret = "", data;
117
-
118
- if (options.data) {
119
- data = Handlebars.createFrame(options.data);
120
- }
121
-
122
- if(context && typeof context === 'object') {
123
- if(context instanceof Array){
124
- for(var j = context.length; i<j; i++) {
125
- if (data) { data.index = i; }
126
- ret = ret + fn(context[i], { data: data });
127
- }
128
- } else {
129
- for(var key in context) {
130
- if(context.hasOwnProperty(key)) {
131
- if(data) { data.key = key; }
132
- ret = ret + fn(context[key], {data: data});
133
- i++;
134
- }
135
- }
136
- }
137
- }
138
-
139
- if(i === 0){
140
- ret = inverse(this);
141
- }
142
-
143
- return ret;
144
- });
145
-
146
- Handlebars.registerHelper('if', function(context, options) {
147
- var type = toString.call(context);
148
- if(type === functionType) { context = context.call(this); }
149
-
150
- if(!context || Handlebars.Utils.isEmpty(context)) {
151
- return options.inverse(this);
152
- } else {
153
- return options.fn(this);
154
- }
155
- });
156
-
157
- Handlebars.registerHelper('unless', function(context, options) {
158
- var fn = options.fn, inverse = options.inverse;
159
- options.fn = inverse;
160
- options.inverse = fn;
161
-
162
- return Handlebars.helpers['if'].call(this, context, options);
163
- });
164
-
165
- Handlebars.registerHelper('with', function(context, options) {
166
- return options.fn(context);
167
- });
168
-
169
- Handlebars.registerHelper('log', function(context, options) {
170
- var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
171
- Handlebars.log(level, context);
172
- });
173
-
174
- }(this.Handlebars));
175
- ;
176
- // lib/handlebars/compiler/parser.js
177
- /* Jison generated parser */
178
- var handlebars = (function(){
179
- var parser = {trace: function trace() { },
180
- yy: {},
181
- symbols_: {"error":2,"root":3,"program":4,"EOF":5,"simpleInverse":6,"statements":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"partialName":25,"params":26,"hash":27,"DATA":28,"param":29,"STRING":30,"INTEGER":31,"BOOLEAN":32,"hashSegments":33,"hashSegment":34,"ID":35,"EQUALS":36,"PARTIAL_NAME":37,"pathSegments":38,"SEP":39,"$accept":0,"$end":1},
182
- terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"DATA",30:"STRING",31:"INTEGER",32:"BOOLEAN",35:"ID",36:"EQUALS",37:"PARTIAL_NAME",39:"SEP"},
183
- productions_: [0,[3,2],[4,2],[4,3],[4,2],[4,1],[4,1],[4,0],[7,1],[7,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[6,2],[17,3],[17,2],[17,2],[17,1],[17,1],[26,2],[26,1],[29,1],[29,1],[29,1],[29,1],[29,1],[27,1],[33,2],[33,1],[34,3],[34,3],[34,3],[34,3],[34,3],[25,1],[21,1],[38,3],[38,1]],
184
- performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
185
-
186
- var $0 = $$.length - 1;
187
- switch (yystate) {
188
- case 1: return $$[$0-1];
189
- break;
190
- case 2: this.$ = new yy.ProgramNode([], $$[$0]);
191
- break;
192
- case 3: this.$ = new yy.ProgramNode($$[$0-2], $$[$0]);
193
- break;
194
- case 4: this.$ = new yy.ProgramNode($$[$0-1], []);
195
- break;
196
- case 5: this.$ = new yy.ProgramNode($$[$0]);
197
- break;
198
- case 6: this.$ = new yy.ProgramNode([], []);
199
- break;
200
- case 7: this.$ = new yy.ProgramNode([]);
201
- break;
202
- case 8: this.$ = [$$[$0]];
203
- break;
204
- case 9: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
205
- break;
206
- case 10: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]);
207
- break;
208
- case 11: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]);
209
- break;
210
- case 12: this.$ = $$[$0];
211
- break;
212
- case 13: this.$ = $$[$0];
213
- break;
214
- case 14: this.$ = new yy.ContentNode($$[$0]);
215
- break;
216
- case 15: this.$ = new yy.CommentNode($$[$0]);
217
- break;
218
- case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
219
- break;
220
- case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
221
- break;
222
- case 18: this.$ = $$[$0-1];
223
- break;
224
- case 19: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
225
- break;
226
- case 20: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true);
227
- break;
228
- case 21: this.$ = new yy.PartialNode($$[$0-1]);
229
- break;
230
- case 22: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1]);
231
- break;
232
- case 23:
233
- break;
234
- case 24: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]];
235
- break;
236
- case 25: this.$ = [[$$[$0-1]].concat($$[$0]), null];
237
- break;
238
- case 26: this.$ = [[$$[$0-1]], $$[$0]];
239
- break;
240
- case 27: this.$ = [[$$[$0]], null];
241
- break;
242
- case 28: this.$ = [[new yy.DataNode($$[$0])], null];
243
- break;
244
- case 29: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
245
- break;
246
- case 30: this.$ = [$$[$0]];
247
- break;
248
- case 31: this.$ = $$[$0];
249
- break;
250
- case 32: this.$ = new yy.StringNode($$[$0]);
251
- break;
252
- case 33: this.$ = new yy.IntegerNode($$[$0]);
253
- break;
254
- case 34: this.$ = new yy.BooleanNode($$[$0]);
255
- break;
256
- case 35: this.$ = new yy.DataNode($$[$0]);
257
- break;
258
- case 36: this.$ = new yy.HashNode($$[$0]);
259
- break;
260
- case 37: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
261
- break;
262
- case 38: this.$ = [$$[$0]];
263
- break;
264
- case 39: this.$ = [$$[$0-2], $$[$0]];
265
- break;
266
- case 40: this.$ = [$$[$0-2], new yy.StringNode($$[$0])];
267
- break;
268
- case 41: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])];
269
- break;
270
- case 42: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])];
271
- break;
272
- case 43: this.$ = [$$[$0-2], new yy.DataNode($$[$0])];
273
- break;
274
- case 44: this.$ = new yy.PartialNameNode($$[$0]);
275
- break;
276
- case 45: this.$ = new yy.IdNode($$[$0]);
277
- break;
278
- case 46: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];
279
- break;
280
- case 47: this.$ = [$$[$0]];
281
- break;
282
- }
283
- },
284
- table: [{3:1,4:2,5:[2,7],6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],22:[1,14],23:[1,15],24:[1,16]},{1:[3]},{5:[1,17]},{5:[2,6],7:18,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,6],22:[1,14],23:[1,15],24:[1,16]},{5:[2,5],6:20,8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,5],22:[1,14],23:[1,15],24:[1,16]},{17:23,18:[1,22],21:24,28:[1,25],35:[1,27],38:26},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{4:28,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],24:[1,16]},{4:29,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],24:[1,16]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{17:30,21:24,28:[1,25],35:[1,27],38:26},{17:31,21:24,28:[1,25],35:[1,27],38:26},{17:32,21:24,28:[1,25],35:[1,27],38:26},{25:33,37:[1,34]},{1:[2,1]},{5:[2,2],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,2],22:[1,14],23:[1,15],24:[1,16]},{17:23,21:24,28:[1,25],35:[1,27],38:26},{5:[2,4],7:35,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,4],22:[1,14],23:[1,15],24:[1,16]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,23],14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],24:[2,23]},{18:[1,36]},{18:[2,27],21:41,26:37,27:38,28:[1,45],29:39,30:[1,42],31:[1,43],32:[1,44],33:40,34:46,35:[1,47],38:26},{18:[2,28]},{18:[2,45],28:[2,45],30:[2,45],31:[2,45],32:[2,45],35:[2,45],39:[1,48]},{18:[2,47],28:[2,47],30:[2,47],31:[2,47],32:[2,47],35:[2,47],39:[2,47]},{10:49,20:[1,50]},{10:51,20:[1,50]},{18:[1,52]},{18:[1,53]},{18:[1,54]},{18:[1,55],21:56,35:[1,27],38:26},{18:[2,44],35:[2,44]},{5:[2,3],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,3],22:[1,14],23:[1,15],24:[1,16]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{18:[2,25],21:41,27:57,28:[1,45],29:58,30:[1,42],31:[1,43],32:[1,44],33:40,34:46,35:[1,47],38:26},{18:[2,26]},{18:[2,30],28:[2,30],30:[2,30],31:[2,30],32:[2,30],35:[2,30]},{18:[2,36],34:59,35:[1,60]},{18:[2,31],28:[2,31],30:[2,31],31:[2,31],32:[2,31],35:[2,31]},{18:[2,32],28:[2,32],30:[2,32],31:[2,32],32:[2,32],35:[2,32]},{18:[2,33],28:[2,33],30:[2,33],31:[2,33],32:[2,33],35:[2,33]},{18:[2,34],28:[2,34],30:[2,34],31:[2,34],32:[2,34],35:[2,34]},{18:[2,35],28:[2,35],30:[2,35],31:[2,35],32:[2,35],35:[2,35]},{18:[2,38],35:[2,38]},{18:[2,47],28:[2,47],30:[2,47],31:[2,47],32:[2,47],35:[2,47],36:[1,61],39:[2,47]},{35:[1,62]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{21:63,35:[1,27],38:26},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],24:[2,21]},{18:[1,64]},{18:[2,24]},{18:[2,29],28:[2,29],30:[2,29],31:[2,29],32:[2,29],35:[2,29]},{18:[2,37],35:[2,37]},{36:[1,61]},{21:65,28:[1,69],30:[1,66],31:[1,67],32:[1,68],35:[1,27],38:26},{18:[2,46],28:[2,46],30:[2,46],31:[2,46],32:[2,46],35:[2,46],39:[2,46]},{18:[1,70]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],24:[2,22]},{18:[2,39],35:[2,39]},{18:[2,40],35:[2,40]},{18:[2,41],35:[2,41]},{18:[2,42],35:[2,42]},{18:[2,43],35:[2,43]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]}],
285
- defaultActions: {17:[2,1],25:[2,28],38:[2,26],57:[2,24]},
286
- parseError: function parseError(str, hash) {
287
- throw new Error(str);
288
- },
289
- parse: function parse(input) {
290
- var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
291
- this.lexer.setInput(input);
292
- this.lexer.yy = this.yy;
293
- this.yy.lexer = this.lexer;
294
- this.yy.parser = this;
295
- if (typeof this.lexer.yylloc == "undefined")
296
- this.lexer.yylloc = {};
297
- var yyloc = this.lexer.yylloc;
298
- lstack.push(yyloc);
299
- var ranges = this.lexer.options && this.lexer.options.ranges;
300
- if (typeof this.yy.parseError === "function")
301
- this.parseError = this.yy.parseError;
302
- function popStack(n) {
303
- stack.length = stack.length - 2 * n;
304
- vstack.length = vstack.length - n;
305
- lstack.length = lstack.length - n;
306
- }
307
- function lex() {
308
- var token;
309
- token = self.lexer.lex() || 1;
310
- if (typeof token !== "number") {
311
- token = self.symbols_[token] || token;
312
- }
313
- return token;
314
- }
315
- var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
316
- while (true) {
317
- state = stack[stack.length - 1];
318
- if (this.defaultActions[state]) {
319
- action = this.defaultActions[state];
320
- } else {
321
- if (symbol === null || typeof symbol == "undefined") {
322
- symbol = lex();
323
- }
324
- action = table[state] && table[state][symbol];
325
- }
326
- if (typeof action === "undefined" || !action.length || !action[0]) {
327
- var errStr = "";
328
- if (!recovering) {
329
- expected = [];
330
- for (p in table[state])
331
- if (this.terminals_[p] && p > 2) {
332
- expected.push("'" + this.terminals_[p] + "'");
333
- }
334
- if (this.lexer.showPosition) {
335
- errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
336
- } else {
337
- errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
338
- }
339
- this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
340
- }
341
- }
342
- if (action[0] instanceof Array && action.length > 1) {
343
- throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
344
- }
345
- switch (action[0]) {
346
- case 1:
347
- stack.push(symbol);
348
- vstack.push(this.lexer.yytext);
349
- lstack.push(this.lexer.yylloc);
350
- stack.push(action[1]);
351
- symbol = null;
352
- if (!preErrorSymbol) {
353
- yyleng = this.lexer.yyleng;
354
- yytext = this.lexer.yytext;
355
- yylineno = this.lexer.yylineno;
356
- yyloc = this.lexer.yylloc;
357
- if (recovering > 0)
358
- recovering--;
359
- } else {
360
- symbol = preErrorSymbol;
361
- preErrorSymbol = null;
362
- }
363
- break;
364
- case 2:
365
- len = this.productions_[action[1]][1];
366
- yyval.$ = vstack[vstack.length - len];
367
- yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
368
- if (ranges) {
369
- yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
370
- }
371
- r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
372
- if (typeof r !== "undefined") {
373
- return r;
374
- }
375
- if (len) {
376
- stack = stack.slice(0, -1 * len * 2);
377
- vstack = vstack.slice(0, -1 * len);
378
- lstack = lstack.slice(0, -1 * len);
379
- }
380
- stack.push(this.productions_[action[1]][0]);
381
- vstack.push(yyval.$);
382
- lstack.push(yyval._$);
383
- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
384
- stack.push(newState);
385
- break;
386
- case 3:
387
- return true;
388
- }
389
- }
390
- return true;
391
- }
392
- };
393
- /* Jison generated lexer */
394
- var lexer = (function(){
395
- var lexer = ({EOF:1,
396
- parseError:function parseError(str, hash) {
397
- if (this.yy.parser) {
398
- this.yy.parser.parseError(str, hash);
399
- } else {
400
- throw new Error(str);
401
- }
402
- },
403
- setInput:function (input) {
404
- this._input = input;
405
- this._more = this._less = this.done = false;
406
- this.yylineno = this.yyleng = 0;
407
- this.yytext = this.matched = this.match = '';
408
- this.conditionStack = ['INITIAL'];
409
- this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
410
- if (this.options.ranges) this.yylloc.range = [0,0];
411
- this.offset = 0;
412
- return this;
413
- },
414
- input:function () {
415
- var ch = this._input[0];
416
- this.yytext += ch;
417
- this.yyleng++;
418
- this.offset++;
419
- this.match += ch;
420
- this.matched += ch;
421
- var lines = ch.match(/(?:\r\n?|\n).*/g);
422
- if (lines) {
423
- this.yylineno++;
424
- this.yylloc.last_line++;
425
- } else {
426
- this.yylloc.last_column++;
427
- }
428
- if (this.options.ranges) this.yylloc.range[1]++;
429
-
430
- this._input = this._input.slice(1);
431
- return ch;
432
- },
433
- unput:function (ch) {
434
- var len = ch.length;
435
- var lines = ch.split(/(?:\r\n?|\n)/g);
436
-
437
- this._input = ch + this._input;
438
- this.yytext = this.yytext.substr(0, this.yytext.length-len-1);
439
- //this.yyleng -= len;
440
- this.offset -= len;
441
- var oldLines = this.match.split(/(?:\r\n?|\n)/g);
442
- this.match = this.match.substr(0, this.match.length-1);
443
- this.matched = this.matched.substr(0, this.matched.length-1);
444
-
445
- if (lines.length-1) this.yylineno -= lines.length-1;
446
- var r = this.yylloc.range;
447
-
448
- this.yylloc = {first_line: this.yylloc.first_line,
449
- last_line: this.yylineno+1,
450
- first_column: this.yylloc.first_column,
451
- last_column: lines ?
452
- (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length:
453
- this.yylloc.first_column - len
454
- };
455
-
456
- if (this.options.ranges) {
457
- this.yylloc.range = [r[0], r[0] + this.yyleng - len];
458
- }
459
- return this;
460
- },
461
- more:function () {
462
- this._more = true;
463
- return this;
464
- },
465
- less:function (n) {
466
- this.unput(this.match.slice(n));
467
- },
468
- pastInput:function () {
469
- var past = this.matched.substr(0, this.matched.length - this.match.length);
470
- return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
471
- },
472
- upcomingInput:function () {
473
- var next = this.match;
474
- if (next.length < 20) {
475
- next += this._input.substr(0, 20-next.length);
476
- }
477
- return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
478
- },
479
- showPosition:function () {
480
- var pre = this.pastInput();
481
- var c = new Array(pre.length + 1).join("-");
482
- return pre + this.upcomingInput() + "\n" + c+"^";
483
- },
484
- next:function () {
485
- if (this.done) {
486
- return this.EOF;
487
- }
488
- if (!this._input) this.done = true;
489
-
490
- var token,
491
- match,
492
- tempMatch,
493
- index,
494
- col,
495
- lines;
496
- if (!this._more) {
497
- this.yytext = '';
498
- this.match = '';
499
- }
500
- var rules = this._currentRules();
501
- for (var i=0;i < rules.length; i++) {
502
- tempMatch = this._input.match(this.rules[rules[i]]);
503
- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
504
- match = tempMatch;
505
- index = i;
506
- if (!this.options.flex) break;
507
- }
508
- }
509
- if (match) {
510
- lines = match[0].match(/(?:\r\n?|\n).*/g);
511
- if (lines) this.yylineno += lines.length;
512
- this.yylloc = {first_line: this.yylloc.last_line,
513
- last_line: this.yylineno+1,
514
- first_column: this.yylloc.last_column,
515
- last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length};
516
- this.yytext += match[0];
517
- this.match += match[0];
518
- this.matches = match;
519
- this.yyleng = this.yytext.length;
520
- if (this.options.ranges) {
521
- this.yylloc.range = [this.offset, this.offset += this.yyleng];
522
- }
523
- this._more = false;
524
- this._input = this._input.slice(match[0].length);
525
- this.matched += match[0];
526
- token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
527
- if (this.done && this._input) this.done = false;
528
- if (token) return token;
529
- else return;
530
- }
531
- if (this._input === "") {
532
- return this.EOF;
533
- } else {
534
- return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
535
- {text: "", token: null, line: this.yylineno});
536
- }
537
- },
538
- lex:function lex() {
539
- var r = this.next();
540
- if (typeof r !== 'undefined') {
541
- return r;
542
- } else {
543
- return this.lex();
544
- }
545
- },
546
- begin:function begin(condition) {
547
- this.conditionStack.push(condition);
548
- },
549
- popState:function popState() {
550
- return this.conditionStack.pop();
551
- },
552
- _currentRules:function _currentRules() {
553
- return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
554
- },
555
- topState:function () {
556
- return this.conditionStack[this.conditionStack.length-2];
557
- },
558
- pushState:function begin(condition) {
559
- this.begin(condition);
560
- }});
561
- lexer.options = {};
562
- lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
563
-
564
- var YYSTATE=YY_START
565
- switch($avoiding_name_collisions) {
566
- case 0:
567
- if(yy_.yytext.slice(-1) !== "\\") this.begin("mu");
568
- if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin("emu");
569
- if(yy_.yytext) return 14;
570
-
571
- break;
572
- case 1: return 14;
573
- break;
574
- case 2:
575
- if(yy_.yytext.slice(-1) !== "\\") this.popState();
576
- if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1);
577
- return 14;
578
-
579
- break;
580
- case 3: yy_.yytext = yy_.yytext.substr(0, yy_.yyleng-4); this.popState(); return 15;
581
- break;
582
- case 4: this.begin("par"); return 24;
583
- break;
584
- case 5: return 16;
585
- break;
586
- case 6: return 20;
587
- break;
588
- case 7: return 19;
589
- break;
590
- case 8: return 19;
591
- break;
592
- case 9: return 23;
593
- break;
594
- case 10: return 23;
595
- break;
596
- case 11: this.popState(); this.begin('com');
597
- break;
598
- case 12: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15;
599
- break;
600
- case 13: return 22;
601
- break;
602
- case 14: return 36;
603
- break;
604
- case 15: return 35;
605
- break;
606
- case 16: return 35;
607
- break;
608
- case 17: return 39;
609
- break;
610
- case 18: /*ignore whitespace*/
611
- break;
612
- case 19: this.popState(); return 18;
613
- break;
614
- case 20: this.popState(); return 18;
615
- break;
616
- case 21: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 30;
617
- break;
618
- case 22: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\'/g,"'"); return 30;
619
- break;
620
- case 23: yy_.yytext = yy_.yytext.substr(1); return 28;
621
- break;
622
- case 24: return 32;
623
- break;
624
- case 25: return 32;
625
- break;
626
- case 26: return 31;
627
- break;
628
- case 27: return 35;
629
- break;
630
- case 28: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 35;
631
- break;
632
- case 29: return 'INVALID';
633
- break;
634
- case 30: /*ignore whitespace*/
635
- break;
636
- case 31: this.popState(); return 37;
637
- break;
638
- case 32: return 5;
639
- break;
640
- }
641
- };
642
- lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:\s+)/,/^(?:[a-zA-Z0-9_$-/]+)/,/^(?:$)/];
643
- lexer.conditions = {"mu":{"rules":[4,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,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"par":{"rules":[30,31],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}};
644
- return lexer;})()
645
- parser.lexer = lexer;
646
- function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
647
- return new Parser;
648
- })();;
649
- // lib/handlebars/compiler/base.js
650
- Handlebars.Parser = handlebars;
651
-
652
- Handlebars.parse = function(input) {
653
-
654
- // Just return if an already-compile AST was passed in.
655
- if(input.constructor === Handlebars.AST.ProgramNode) { return input; }
656
-
657
- Handlebars.Parser.yy = Handlebars.AST;
658
- return Handlebars.Parser.parse(input);
659
- };
660
-
661
- Handlebars.print = function(ast) {
662
- return new Handlebars.PrintVisitor().accept(ast);
663
- };;
664
- // lib/handlebars/compiler/ast.js
665
- (function() {
666
-
667
- Handlebars.AST = {};
668
-
669
- Handlebars.AST.ProgramNode = function(statements, inverse) {
670
- this.type = "program";
671
- this.statements = statements;
672
- if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); }
673
- };
674
-
675
- Handlebars.AST.MustacheNode = function(rawParams, hash, unescaped) {
676
- this.type = "mustache";
677
- this.escaped = !unescaped;
678
- this.hash = hash;
679
-
680
- var id = this.id = rawParams[0];
681
- var params = this.params = rawParams.slice(1);
682
-
683
- // a mustache is an eligible helper if:
684
- // * its id is simple (a single part, not `this` or `..`)
685
- var eligibleHelper = this.eligibleHelper = id.isSimple;
686
-
687
- // a mustache is definitely a helper if:
688
- // * it is an eligible helper, and
689
- // * it has at least one parameter or hash segment
690
- this.isHelper = eligibleHelper && (params.length || hash);
691
-
692
- // if a mustache is an eligible helper but not a definite
693
- // helper, it is ambiguous, and will be resolved in a later
694
- // pass or at runtime.
695
- };
696
-
697
- Handlebars.AST.PartialNode = function(partialName, context) {
698
- this.type = "partial";
699
- this.partialName = partialName;
700
- this.context = context;
701
- };
702
-
703
- var verifyMatch = function(open, close) {
704
- if(open.original !== close.original) {
705
- throw new Handlebars.Exception(open.original + " doesn't match " + close.original);
706
- }
707
- };
708
-
709
- Handlebars.AST.BlockNode = function(mustache, program, inverse, close) {
710
- verifyMatch(mustache.id, close);
711
- this.type = "block";
712
- this.mustache = mustache;
713
- this.program = program;
714
- this.inverse = inverse;
715
-
716
- if (this.inverse && !this.program) {
717
- this.isInverse = true;
718
- }
719
- };
720
-
721
- Handlebars.AST.ContentNode = function(string) {
722
- this.type = "content";
723
- this.string = string;
724
- };
725
-
726
- Handlebars.AST.HashNode = function(pairs) {
727
- this.type = "hash";
728
- this.pairs = pairs;
729
- };
730
-
731
- Handlebars.AST.IdNode = function(parts) {
732
- this.type = "ID";
733
- this.original = parts.join(".");
734
-
735
- var dig = [], depth = 0;
736
-
737
- for(var i=0,l=parts.length; i<l; i++) {
738
- var part = parts[i];
739
-
740
- if (part === ".." || part === "." || part === "this") {
741
- if (dig.length > 0) { throw new Handlebars.Exception("Invalid path: " + this.original); }
742
- else if (part === "..") { depth++; }
743
- else { this.isScoped = true; }
744
- }
745
- else { dig.push(part); }
746
- }
747
-
748
- this.parts = dig;
749
- this.string = dig.join('.');
750
- this.depth = depth;
751
-
752
- // an ID is simple if it only has one part, and that part is not
753
- // `..` or `this`.
754
- this.isSimple = parts.length === 1 && !this.isScoped && depth === 0;
755
-
756
- this.stringModeValue = this.string;
757
- };
758
-
759
- Handlebars.AST.PartialNameNode = function(name) {
760
- this.type = "PARTIAL_NAME";
761
- this.name = name;
762
- };
763
-
764
- Handlebars.AST.DataNode = function(id) {
765
- this.type = "DATA";
766
- this.id = id;
767
- };
768
-
769
- Handlebars.AST.StringNode = function(string) {
770
- this.type = "STRING";
771
- this.string = string;
772
- this.stringModeValue = string;
773
- };
774
-
775
- Handlebars.AST.IntegerNode = function(integer) {
776
- this.type = "INTEGER";
777
- this.integer = integer;
778
- this.stringModeValue = Number(integer);
779
- };
780
-
781
- Handlebars.AST.BooleanNode = function(bool) {
782
- this.type = "BOOLEAN";
783
- this.bool = bool;
784
- this.stringModeValue = bool === "true";
785
- };
786
-
787
- Handlebars.AST.CommentNode = function(comment) {
788
- this.type = "comment";
789
- this.comment = comment;
790
- };
791
-
792
- })();;
793
- // lib/handlebars/utils.js
794
-
795
- var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
796
-
797
- Handlebars.Exception = function(message) {
798
- var tmp = Error.prototype.constructor.apply(this, arguments);
799
-
800
- // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
801
- for (var idx = 0; idx < errorProps.length; idx++) {
802
- this[errorProps[idx]] = tmp[errorProps[idx]];
803
- }
804
- };
805
- Handlebars.Exception.prototype = new Error();
806
-
807
- // Build out our basic SafeString type
808
- Handlebars.SafeString = function(string) {
809
- this.string = string;
810
- };
811
- Handlebars.SafeString.prototype.toString = function() {
812
- return this.string.toString();
813
- };
814
-
815
- (function() {
816
- var escape = {
817
- "&": "&amp;",
818
- "<": "&lt;",
819
- ">": "&gt;",
820
- '"': "&quot;",
821
- "'": "&#x27;",
822
- "`": "&#x60;"
823
- };
824
-
825
- var badChars = /[&<>"'`]/g;
826
- var possible = /[&<>"'`]/;
827
-
828
- var escapeChar = function(chr) {
829
- return escape[chr] || "&amp;";
830
- };
831
-
832
- Handlebars.Utils = {
833
- escapeExpression: function(string) {
834
- // don't escape SafeStrings, since they're already safe
835
- if (string instanceof Handlebars.SafeString) {
836
- return string.toString();
837
- } else if (string == null || string === false) {
838
- return "";
839
- }
840
-
841
- if(!possible.test(string)) { return string; }
842
- return string.replace(badChars, escapeChar);
843
- },
844
-
845
- isEmpty: function(value) {
846
- if (!value && value !== 0) {
847
- return true;
848
- } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
849
- return true;
850
- } else {
851
- return false;
852
- }
853
- }
854
- };
855
- })();;
856
- // lib/handlebars/compiler/compiler.js
857
-
858
- /*jshint eqnull:true*/
859
- Handlebars.Compiler = function() {};
860
- Handlebars.JavaScriptCompiler = function() {};
861
-
862
- (function(Compiler, JavaScriptCompiler) {
863
- // the foundHelper register will disambiguate helper lookup from finding a
864
- // function in a context. This is necessary for mustache compatibility, which
865
- // requires that context functions in blocks are evaluated by blockHelperMissing,
866
- // and then proceed as if the resulting value was provided to blockHelperMissing.
867
-
868
- Compiler.prototype = {
869
- compiler: Compiler,
870
-
871
- disassemble: function() {
872
- var opcodes = this.opcodes, opcode, out = [], params, param;
873
-
874
- for (var i=0, l=opcodes.length; i<l; i++) {
875
- opcode = opcodes[i];
876
-
877
- if (opcode.opcode === 'DECLARE') {
878
- out.push("DECLARE " + opcode.name + "=" + opcode.value);
879
- } else {
880
- params = [];
881
- for (var j=0; j<opcode.args.length; j++) {
882
- param = opcode.args[j];
883
- if (typeof param === "string") {
884
- param = "\"" + param.replace("\n", "\\n") + "\"";
885
- }
886
- params.push(param);
887
- }
888
- out.push(opcode.opcode + " " + params.join(" "));
889
- }
890
- }
891
-
892
- return out.join("\n");
893
- },
894
- equals: function(other) {
895
- var len = this.opcodes.length;
896
- if (other.opcodes.length !== len) {
897
- return false;
898
- }
899
-
900
- for (var i = 0; i < len; i++) {
901
- var opcode = this.opcodes[i],
902
- otherOpcode = other.opcodes[i];
903
- if (opcode.opcode !== otherOpcode.opcode || opcode.args.length !== otherOpcode.args.length) {
904
- return false;
905
- }
906
- for (var j = 0; j < opcode.args.length; j++) {
907
- if (opcode.args[j] !== otherOpcode.args[j]) {
908
- return false;
909
- }
910
- }
911
- }
912
- return true;
913
- },
914
-
915
- guid: 0,
916
-
917
- compile: function(program, options) {
918
- this.children = [];
919
- this.depths = {list: []};
920
- this.options = options;
921
-
922
- // These changes will propagate to the other compiler components
923
- var knownHelpers = this.options.knownHelpers;
924
- this.options.knownHelpers = {
925
- 'helperMissing': true,
926
- 'blockHelperMissing': true,
927
- 'each': true,
928
- 'if': true,
929
- 'unless': true,
930
- 'with': true,
931
- 'log': true
932
- };
933
- if (knownHelpers) {
934
- for (var name in knownHelpers) {
935
- this.options.knownHelpers[name] = knownHelpers[name];
936
- }
937
- }
938
-
939
- return this.program(program);
940
- },
941
-
942
- accept: function(node) {
943
- return this[node.type](node);
944
- },
945
-
946
- program: function(program) {
947
- var statements = program.statements, statement;
948
- this.opcodes = [];
949
-
950
- for(var i=0, l=statements.length; i<l; i++) {
951
- statement = statements[i];
952
- this[statement.type](statement);
953
- }
954
- this.isSimple = l === 1;
955
-
956
- this.depths.list = this.depths.list.sort(function(a, b) {
957
- return a - b;
958
- });
959
-
960
- return this;
961
- },
962
-
963
- compileProgram: function(program) {
964
- var result = new this.compiler().compile(program, this.options);
965
- var guid = this.guid++, depth;
966
-
967
- this.usePartial = this.usePartial || result.usePartial;
968
-
969
- this.children[guid] = result;
970
-
971
- for(var i=0, l=result.depths.list.length; i<l; i++) {
972
- depth = result.depths.list[i];
973
-
974
- if(depth < 2) { continue; }
975
- else { this.addDepth(depth - 1); }
976
- }
977
-
978
- return guid;
979
- },
980
-
981
- block: function(block) {
982
- var mustache = block.mustache,
983
- program = block.program,
984
- inverse = block.inverse;
985
-
986
- if (program) {
987
- program = this.compileProgram(program);
988
- }
989
-
990
- if (inverse) {
991
- inverse = this.compileProgram(inverse);
992
- }
993
-
994
- var type = this.classifyMustache(mustache);
995
-
996
- if (type === "helper") {
997
- this.helperMustache(mustache, program, inverse);
998
- } else if (type === "simple") {
999
- this.simpleMustache(mustache);
1000
-
1001
- // now that the simple mustache is resolved, we need to
1002
- // evaluate it by executing `blockHelperMissing`
1003
- this.opcode('pushProgram', program);
1004
- this.opcode('pushProgram', inverse);
1005
- this.opcode('emptyHash');
1006
- this.opcode('blockValue');
1007
- } else {
1008
- this.ambiguousMustache(mustache, program, inverse);
1009
-
1010
- // now that the simple mustache is resolved, we need to
1011
- // evaluate it by executing `blockHelperMissing`
1012
- this.opcode('pushProgram', program);
1013
- this.opcode('pushProgram', inverse);
1014
- this.opcode('emptyHash');
1015
- this.opcode('ambiguousBlockValue');
1016
- }
1017
-
1018
- this.opcode('append');
1019
- },
1020
-
1021
- hash: function(hash) {
1022
- var pairs = hash.pairs, pair, val;
1023
-
1024
- this.opcode('pushHash');
1025
-
1026
- for(var i=0, l=pairs.length; i<l; i++) {
1027
- pair = pairs[i];
1028
- val = pair[1];
1029
-
1030
- if (this.options.stringParams) {
1031
- this.opcode('pushStringParam', val.stringModeValue, val.type);
1032
- } else {
1033
- this.accept(val);
1034
- }
1035
-
1036
- this.opcode('assignToHash', pair[0]);
1037
- }
1038
- this.opcode('popHash');
1039
- },
1040
-
1041
- partial: function(partial) {
1042
- var partialName = partial.partialName;
1043
- this.usePartial = true;
1044
-
1045
- if(partial.context) {
1046
- this.ID(partial.context);
1047
- } else {
1048
- this.opcode('push', 'depth0');
1049
- }
1050
-
1051
- this.opcode('invokePartial', partialName.name);
1052
- this.opcode('append');
1053
- },
1054
-
1055
- content: function(content) {
1056
- this.opcode('appendContent', content.string);
1057
- },
1058
-
1059
- mustache: function(mustache) {
1060
- var options = this.options;
1061
- var type = this.classifyMustache(mustache);
1062
-
1063
- if (type === "simple") {
1064
- this.simpleMustache(mustache);
1065
- } else if (type === "helper") {
1066
- this.helperMustache(mustache);
1067
- } else {
1068
- this.ambiguousMustache(mustache);
1069
- }
1070
-
1071
- if(mustache.escaped && !options.noEscape) {
1072
- this.opcode('appendEscaped');
1073
- } else {
1074
- this.opcode('append');
1075
- }
1076
- },
1077
-
1078
- ambiguousMustache: function(mustache, program, inverse) {
1079
- var id = mustache.id,
1080
- name = id.parts[0],
1081
- isBlock = program != null || inverse != null;
1082
-
1083
- this.opcode('getContext', id.depth);
1084
-
1085
- this.opcode('pushProgram', program);
1086
- this.opcode('pushProgram', inverse);
1087
-
1088
- this.opcode('invokeAmbiguous', name, isBlock);
1089
- },
1090
-
1091
- simpleMustache: function(mustache) {
1092
- var id = mustache.id;
1093
-
1094
- if (id.type === 'DATA') {
1095
- this.DATA(id);
1096
- } else if (id.parts.length) {
1097
- this.ID(id);
1098
- } else {
1099
- // Simplified ID for `this`
1100
- this.addDepth(id.depth);
1101
- this.opcode('getContext', id.depth);
1102
- this.opcode('pushContext');
1103
- }
1104
-
1105
- this.opcode('resolvePossibleLambda');
1106
- },
1107
-
1108
- helperMustache: function(mustache, program, inverse) {
1109
- var params = this.setupFullMustacheParams(mustache, program, inverse),
1110
- name = mustache.id.parts[0];
1111
-
1112
- if (this.options.knownHelpers[name]) {
1113
- this.opcode('invokeKnownHelper', params.length, name);
1114
- } else if (this.knownHelpersOnly) {
1115
- throw new Error("You specified knownHelpersOnly, but used the unknown helper " + name);
1116
- } else {
1117
- this.opcode('invokeHelper', params.length, name);
1118
- }
1119
- },
1120
-
1121
- ID: function(id) {
1122
- this.addDepth(id.depth);
1123
- this.opcode('getContext', id.depth);
1124
-
1125
- var name = id.parts[0];
1126
- if (!name) {
1127
- this.opcode('pushContext');
1128
- } else {
1129
- this.opcode('lookupOnContext', id.parts[0]);
1130
- }
1131
-
1132
- for(var i=1, l=id.parts.length; i<l; i++) {
1133
- this.opcode('lookup', id.parts[i]);
1134
- }
1135
- },
1136
-
1137
- DATA: function(data) {
1138
- this.options.data = true;
1139
- this.opcode('lookupData', data.id);
1140
- },
1141
-
1142
- STRING: function(string) {
1143
- this.opcode('pushString', string.string);
1144
- },
1145
-
1146
- INTEGER: function(integer) {
1147
- this.opcode('pushLiteral', integer.integer);
1148
- },
1149
-
1150
- BOOLEAN: function(bool) {
1151
- this.opcode('pushLiteral', bool.bool);
1152
- },
1153
-
1154
- comment: function() {},
1155
-
1156
- // HELPERS
1157
- opcode: function(name) {
1158
- this.opcodes.push({ opcode: name, args: [].slice.call(arguments, 1) });
1159
- },
1160
-
1161
- declare: function(name, value) {
1162
- this.opcodes.push({ opcode: 'DECLARE', name: name, value: value });
1163
- },
1164
-
1165
- addDepth: function(depth) {
1166
- if(isNaN(depth)) { throw new Error("EWOT"); }
1167
- if(depth === 0) { return; }
1168
-
1169
- if(!this.depths[depth]) {
1170
- this.depths[depth] = true;
1171
- this.depths.list.push(depth);
1172
- }
1173
- },
1174
-
1175
- classifyMustache: function(mustache) {
1176
- var isHelper = mustache.isHelper;
1177
- var isEligible = mustache.eligibleHelper;
1178
- var options = this.options;
1179
-
1180
- // if ambiguous, we can possibly resolve the ambiguity now
1181
- if (isEligible && !isHelper) {
1182
- var name = mustache.id.parts[0];
1183
-
1184
- if (options.knownHelpers[name]) {
1185
- isHelper = true;
1186
- } else if (options.knownHelpersOnly) {
1187
- isEligible = false;
1188
- }
1189
- }
1190
-
1191
- if (isHelper) { return "helper"; }
1192
- else if (isEligible) { return "ambiguous"; }
1193
- else { return "simple"; }
1194
- },
1195
-
1196
- pushParams: function(params) {
1197
- var i = params.length, param;
1198
-
1199
- while(i--) {
1200
- param = params[i];
1201
-
1202
- if(this.options.stringParams) {
1203
- if(param.depth) {
1204
- this.addDepth(param.depth);
1205
- }
1206
-
1207
- this.opcode('getContext', param.depth || 0);
1208
- this.opcode('pushStringParam', param.stringModeValue, param.type);
1209
- } else {
1210
- this[param.type](param);
1211
- }
1212
- }
1213
- },
1214
-
1215
- setupMustacheParams: function(mustache) {
1216
- var params = mustache.params;
1217
- this.pushParams(params);
1218
-
1219
- if(mustache.hash) {
1220
- this.hash(mustache.hash);
1221
- } else {
1222
- this.opcode('emptyHash');
1223
- }
1224
-
1225
- return params;
1226
- },
1227
-
1228
- // this will replace setupMustacheParams when we're done
1229
- setupFullMustacheParams: function(mustache, program, inverse) {
1230
- var params = mustache.params;
1231
- this.pushParams(params);
1232
-
1233
- this.opcode('pushProgram', program);
1234
- this.opcode('pushProgram', inverse);
1235
-
1236
- if(mustache.hash) {
1237
- this.hash(mustache.hash);
1238
- } else {
1239
- this.opcode('emptyHash');
1240
- }
1241
-
1242
- return params;
1243
- }
1244
- };
1245
-
1246
- var Literal = function(value) {
1247
- this.value = value;
1248
- };
1249
-
1250
- JavaScriptCompiler.prototype = {
1251
- // PUBLIC API: You can override these methods in a subclass to provide
1252
- // alternative compiled forms for name lookup and buffering semantics
1253
- nameLookup: function(parent, name /* , type*/) {
1254
- if (/^[0-9]+$/.test(name)) {
1255
- return parent + "[" + name + "]";
1256
- } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
1257
- return parent + "." + name;
1258
- }
1259
- else {
1260
- return parent + "['" + name + "']";
1261
- }
1262
- },
1263
-
1264
- appendToBuffer: function(string) {
1265
- if (this.environment.isSimple) {
1266
- return "return " + string + ";";
1267
- } else {
1268
- return {
1269
- appendToBuffer: true,
1270
- content: string,
1271
- toString: function() { return "buffer += " + string + ";"; }
1272
- };
1273
- }
1274
- },
1275
-
1276
- initializeBuffer: function() {
1277
- return this.quotedString("");
1278
- },
1279
-
1280
- namespace: "Handlebars",
1281
- // END PUBLIC API
1282
-
1283
- compile: function(environment, options, context, asObject) {
1284
- this.environment = environment;
1285
- this.options = options || {};
1286
-
1287
- Handlebars.log(Handlebars.logger.DEBUG, this.environment.disassemble() + "\n\n");
1288
-
1289
- this.name = this.environment.name;
1290
- this.isChild = !!context;
1291
- this.context = context || {
1292
- programs: [],
1293
- environments: [],
1294
- aliases: { }
1295
- };
1296
-
1297
- this.preamble();
1298
-
1299
- this.stackSlot = 0;
1300
- this.stackVars = [];
1301
- this.registers = { list: [] };
1302
- this.compileStack = [];
1303
- this.inlineStack = [];
1304
-
1305
- this.compileChildren(environment, options);
1306
-
1307
- var opcodes = environment.opcodes, opcode;
1308
-
1309
- this.i = 0;
1310
-
1311
- for(l=opcodes.length; this.i<l; this.i++) {
1312
- opcode = opcodes[this.i];
1313
-
1314
- if(opcode.opcode === 'DECLARE') {
1315
- this[opcode.name] = opcode.value;
1316
- } else {
1317
- this[opcode.opcode].apply(this, opcode.args);
1318
- }
1319
- }
1320
-
1321
- return this.createFunctionContext(asObject);
1322
- },
1323
-
1324
- nextOpcode: function() {
1325
- var opcodes = this.environment.opcodes;
1326
- return opcodes[this.i + 1];
1327
- },
1328
-
1329
- eat: function() {
1330
- this.i = this.i + 1;
1331
- },
1332
-
1333
- preamble: function() {
1334
- var out = [];
1335
-
1336
- if (!this.isChild) {
1337
- var namespace = this.namespace;
1338
- var copies = "helpers = helpers || " + namespace + ".helpers;";
1339
- if (this.environment.usePartial) { copies = copies + " partials = partials || " + namespace + ".partials;"; }
1340
- if (this.options.data) { copies = copies + " data = data || {};"; }
1341
- out.push(copies);
1342
- } else {
1343
- out.push('');
1344
- }
1345
-
1346
- if (!this.environment.isSimple) {
1347
- out.push(", buffer = " + this.initializeBuffer());
1348
- } else {
1349
- out.push("");
1350
- }
1351
-
1352
- // track the last context pushed into place to allow skipping the
1353
- // getContext opcode when it would be a noop
1354
- this.lastContext = 0;
1355
- this.source = out;
1356
- },
1357
-
1358
- createFunctionContext: function(asObject) {
1359
- var locals = this.stackVars.concat(this.registers.list);
1360
-
1361
- if(locals.length > 0) {
1362
- this.source[1] = this.source[1] + ", " + locals.join(", ");
1363
- }
1364
-
1365
- // Generate minimizer alias mappings
1366
- if (!this.isChild) {
1367
- for (var alias in this.context.aliases) {
1368
- this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];
1369
- }
1370
- }
1371
-
1372
- if (this.source[1]) {
1373
- this.source[1] = "var " + this.source[1].substring(2) + ";";
1374
- }
1375
-
1376
- // Merge children
1377
- if (!this.isChild) {
1378
- this.source[1] += '\n' + this.context.programs.join('\n') + '\n';
1379
- }
1380
-
1381
- if (!this.environment.isSimple) {
1382
- this.source.push("return buffer;");
1383
- }
1384
-
1385
- var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"];
1386
-
1387
- for(var i=0, l=this.environment.depths.list.length; i<l; i++) {
1388
- params.push("depth" + this.environment.depths.list[i]);
1389
- }
1390
-
1391
- // Perform a second pass over the output to merge content when possible
1392
- var source = this.mergeSource();
1393
-
1394
- if (!this.isChild) {
1395
- var revision = Handlebars.COMPILER_REVISION,
1396
- versions = Handlebars.REVISION_CHANGES[revision];
1397
- source = "this.compilerInfo = ["+revision+",'"+versions+"'];\n"+source;
1398
- }
1399
-
1400
- if (asObject) {
1401
- params.push(source);
1402
-
1403
- return Function.apply(this, params);
1404
- } else {
1405
- var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}';
1406
- Handlebars.log(Handlebars.logger.DEBUG, functionSource + "\n\n");
1407
- return functionSource;
1408
- }
1409
- },
1410
- mergeSource: function() {
1411
- // WARN: We are not handling the case where buffer is still populated as the source should
1412
- // not have buffer append operations as their final action.
1413
- var source = '',
1414
- buffer;
1415
- for (var i = 0, len = this.source.length; i < len; i++) {
1416
- var line = this.source[i];
1417
- if (line.appendToBuffer) {
1418
- if (buffer) {
1419
- buffer = buffer + '\n + ' + line.content;
1420
- } else {
1421
- buffer = line.content;
1422
- }
1423
- } else {
1424
- if (buffer) {
1425
- source += 'buffer += ' + buffer + ';\n ';
1426
- buffer = undefined;
1427
- }
1428
- source += line + '\n ';
1429
- }
1430
- }
1431
- return source;
1432
- },
1433
-
1434
- // [blockValue]
1435
- //
1436
- // On stack, before: hash, inverse, program, value
1437
- // On stack, after: return value of blockHelperMissing
1438
- //
1439
- // The purpose of this opcode is to take a block of the form
1440
- // `{{#foo}}...{{/foo}}`, resolve the value of `foo`, and
1441
- // replace it on the stack with the result of properly
1442
- // invoking blockHelperMissing.
1443
- blockValue: function() {
1444
- this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
1445
-
1446
- var params = ["depth0"];
1447
- this.setupParams(0, params);
1448
-
1449
- this.replaceStack(function(current) {
1450
- params.splice(1, 0, current);
1451
- return "blockHelperMissing.call(" + params.join(", ") + ")";
1452
- });
1453
- },
1454
-
1455
- // [ambiguousBlockValue]
1456
- //
1457
- // On stack, before: hash, inverse, program, value
1458
- // Compiler value, before: lastHelper=value of last found helper, if any
1459
- // On stack, after, if no lastHelper: same as [blockValue]
1460
- // On stack, after, if lastHelper: value
1461
- ambiguousBlockValue: function() {
1462
- this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
1463
-
1464
- var params = ["depth0"];
1465
- this.setupParams(0, params);
1466
-
1467
- var current = this.topStack();
1468
- params.splice(1, 0, current);
1469
-
1470
- // Use the options value generated from the invocation
1471
- params[params.length-1] = 'options';
1472
-
1473
- this.source.push("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }");
1474
- },
1475
-
1476
- // [appendContent]
1477
- //
1478
- // On stack, before: ...
1479
- // On stack, after: ...
1480
- //
1481
- // Appends the string value of `content` to the current buffer
1482
- appendContent: function(content) {
1483
- this.source.push(this.appendToBuffer(this.quotedString(content)));
1484
- },
1485
-
1486
- // [append]
1487
- //
1488
- // On stack, before: value, ...
1489
- // On stack, after: ...
1490
- //
1491
- // Coerces `value` to a String and appends it to the current buffer.
1492
- //
1493
- // If `value` is truthy, or 0, it is coerced into a string and appended
1494
- // Otherwise, the empty string is appended
1495
- append: function() {
1496
- // Force anything that is inlined onto the stack so we don't have duplication
1497
- // when we examine local
1498
- this.flushInline();
1499
- var local = this.popStack();
1500
- this.source.push("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }");
1501
- if (this.environment.isSimple) {
1502
- this.source.push("else { " + this.appendToBuffer("''") + " }");
1503
- }
1504
- },
1505
-
1506
- // [appendEscaped]
1507
- //
1508
- // On stack, before: value, ...
1509
- // On stack, after: ...
1510
- //
1511
- // Escape `value` and append it to the buffer
1512
- appendEscaped: function() {
1513
- this.context.aliases.escapeExpression = 'this.escapeExpression';
1514
-
1515
- this.source.push(this.appendToBuffer("escapeExpression(" + this.popStack() + ")"));
1516
- },
1517
-
1518
- // [getContext]
1519
- //
1520
- // On stack, before: ...
1521
- // On stack, after: ...
1522
- // Compiler value, after: lastContext=depth
1523
- //
1524
- // Set the value of the `lastContext` compiler value to the depth
1525
- getContext: function(depth) {
1526
- if(this.lastContext !== depth) {
1527
- this.lastContext = depth;
1528
- }
1529
- },
1530
-
1531
- // [lookupOnContext]
1532
- //
1533
- // On stack, before: ...
1534
- // On stack, after: currentContext[name], ...
1535
- //
1536
- // Looks up the value of `name` on the current context and pushes
1537
- // it onto the stack.
1538
- lookupOnContext: function(name) {
1539
- this.push(this.nameLookup('depth' + this.lastContext, name, 'context'));
1540
- },
1541
-
1542
- // [pushContext]
1543
- //
1544
- // On stack, before: ...
1545
- // On stack, after: currentContext, ...
1546
- //
1547
- // Pushes the value of the current context onto the stack.
1548
- pushContext: function() {
1549
- this.pushStackLiteral('depth' + this.lastContext);
1550
- },
1551
-
1552
- // [resolvePossibleLambda]
1553
- //
1554
- // On stack, before: value, ...
1555
- // On stack, after: resolved value, ...
1556
- //
1557
- // If the `value` is a lambda, replace it on the stack by
1558
- // the return value of the lambda
1559
- resolvePossibleLambda: function() {
1560
- this.context.aliases.functionType = '"function"';
1561
-
1562
- this.replaceStack(function(current) {
1563
- return "typeof " + current + " === functionType ? " + current + ".apply(depth0) : " + current;
1564
- });
1565
- },
1566
-
1567
- // [lookup]
1568
- //
1569
- // On stack, before: value, ...
1570
- // On stack, after: value[name], ...
1571
- //
1572
- // Replace the value on the stack with the result of looking
1573
- // up `name` on `value`
1574
- lookup: function(name) {
1575
- this.replaceStack(function(current) {
1576
- return current + " == null || " + current + " === false ? " + current + " : " + this.nameLookup(current, name, 'context');
1577
- });
1578
- },
1579
-
1580
- // [lookupData]
1581
- //
1582
- // On stack, before: ...
1583
- // On stack, after: data[id], ...
1584
- //
1585
- // Push the result of looking up `id` on the current data
1586
- lookupData: function(id) {
1587
- this.push(this.nameLookup('data', id, 'data'));
1588
- },
1589
-
1590
- // [pushStringParam]
1591
- //
1592
- // On stack, before: ...
1593
- // On stack, after: string, currentContext, ...
1594
- //
1595
- // This opcode is designed for use in string mode, which
1596
- // provides the string value of a parameter along with its
1597
- // depth rather than resolving it immediately.
1598
- pushStringParam: function(string, type) {
1599
- this.pushStackLiteral('depth' + this.lastContext);
1600
-
1601
- this.pushString(type);
1602
-
1603
- if (typeof string === 'string') {
1604
- this.pushString(string);
1605
- } else {
1606
- this.pushStackLiteral(string);
1607
- }
1608
- },
1609
-
1610
- emptyHash: function() {
1611
- this.pushStackLiteral('{}');
1612
-
1613
- if (this.options.stringParams) {
1614
- this.register('hashTypes', '{}');
1615
- }
1616
- },
1617
- pushHash: function() {
1618
- this.hash = {values: [], types: []};
1619
- },
1620
- popHash: function() {
1621
- var hash = this.hash;
1622
- this.hash = undefined;
1623
-
1624
- if (this.options.stringParams) {
1625
- this.register('hashTypes', '{' + hash.types.join(',') + '}');
1626
- }
1627
- this.push('{\n ' + hash.values.join(',\n ') + '\n }');
1628
- },
1629
-
1630
- // [pushString]
1631
- //
1632
- // On stack, before: ...
1633
- // On stack, after: quotedString(string), ...
1634
- //
1635
- // Push a quoted version of `string` onto the stack
1636
- pushString: function(string) {
1637
- this.pushStackLiteral(this.quotedString(string));
1638
- },
1639
-
1640
- // [push]
1641
- //
1642
- // On stack, before: ...
1643
- // On stack, after: expr, ...
1644
- //
1645
- // Push an expression onto the stack
1646
- push: function(expr) {
1647
- this.inlineStack.push(expr);
1648
- return expr;
1649
- },
1650
-
1651
- // [pushLiteral]
1652
- //
1653
- // On stack, before: ...
1654
- // On stack, after: value, ...
1655
- //
1656
- // Pushes a value onto the stack. This operation prevents
1657
- // the compiler from creating a temporary variable to hold
1658
- // it.
1659
- pushLiteral: function(value) {
1660
- this.pushStackLiteral(value);
1661
- },
1662
-
1663
- // [pushProgram]
1664
- //
1665
- // On stack, before: ...
1666
- // On stack, after: program(guid), ...
1667
- //
1668
- // Push a program expression onto the stack. This takes
1669
- // a compile-time guid and converts it into a runtime-accessible
1670
- // expression.
1671
- pushProgram: function(guid) {
1672
- if (guid != null) {
1673
- this.pushStackLiteral(this.programExpression(guid));
1674
- } else {
1675
- this.pushStackLiteral(null);
1676
- }
1677
- },
1678
-
1679
- // [invokeHelper]
1680
- //
1681
- // On stack, before: hash, inverse, program, params..., ...
1682
- // On stack, after: result of helper invocation
1683
- //
1684
- // Pops off the helper's parameters, invokes the helper,
1685
- // and pushes the helper's return value onto the stack.
1686
- //
1687
- // If the helper is not found, `helperMissing` is called.
1688
- invokeHelper: function(paramSize, name) {
1689
- this.context.aliases.helperMissing = 'helpers.helperMissing';
1690
-
1691
- var helper = this.lastHelper = this.setupHelper(paramSize, name, true);
1692
-
1693
- this.push(helper.name);
1694
- this.replaceStack(function(name) {
1695
- return name + ' ? ' + name + '.call(' +
1696
- helper.callParams + ") " + ": helperMissing.call(" +
1697
- helper.helperMissingParams + ")";
1698
- });
1699
- },
1700
-
1701
- // [invokeKnownHelper]
1702
- //
1703
- // On stack, before: hash, inverse, program, params..., ...
1704
- // On stack, after: result of helper invocation
1705
- //
1706
- // This operation is used when the helper is known to exist,
1707
- // so a `helperMissing` fallback is not required.
1708
- invokeKnownHelper: function(paramSize, name) {
1709
- var helper = this.setupHelper(paramSize, name);
1710
- this.push(helper.name + ".call(" + helper.callParams + ")");
1711
- },
1712
-
1713
- // [invokeAmbiguous]
1714
- //
1715
- // On stack, before: hash, inverse, program, params..., ...
1716
- // On stack, after: result of disambiguation
1717
- //
1718
- // This operation is used when an expression like `{{foo}}`
1719
- // is provided, but we don't know at compile-time whether it
1720
- // is a helper or a path.
1721
- //
1722
- // This operation emits more code than the other options,
1723
- // and can be avoided by passing the `knownHelpers` and
1724
- // `knownHelpersOnly` flags at compile-time.
1725
- invokeAmbiguous: function(name, helperCall) {
1726
- this.context.aliases.functionType = '"function"';
1727
-
1728
- this.pushStackLiteral('{}'); // Hash value
1729
- var helper = this.setupHelper(0, name, helperCall);
1730
-
1731
- var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
1732
-
1733
- var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context');
1734
- var nextStack = this.nextStack();
1735
-
1736
- this.source.push('if (' + nextStack + ' = ' + helperName + ') { ' + nextStack + ' = ' + nextStack + '.call(' + helper.callParams + '); }');
1737
- this.source.push('else { ' + nextStack + ' = ' + nonHelper + '; ' + nextStack + ' = typeof ' + nextStack + ' === functionType ? ' + nextStack + '.apply(depth0) : ' + nextStack + '; }');
1738
- },
1739
-
1740
- // [invokePartial]
1741
- //
1742
- // On stack, before: context, ...
1743
- // On stack after: result of partial invocation
1744
- //
1745
- // This operation pops off a context, invokes a partial with that context,
1746
- // and pushes the result of the invocation back.
1747
- invokePartial: function(name) {
1748
- var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), "helpers", "partials"];
1749
-
1750
- if (this.options.data) {
1751
- params.push("data");
1752
- }
1753
-
1754
- this.context.aliases.self = "this";
1755
- this.push("self.invokePartial(" + params.join(", ") + ")");
1756
- },
1757
-
1758
- // [assignToHash]
1759
- //
1760
- // On stack, before: value, hash, ...
1761
- // On stack, after: hash, ...
1762
- //
1763
- // Pops a value and hash off the stack, assigns `hash[key] = value`
1764
- // and pushes the hash back onto the stack.
1765
- assignToHash: function(key) {
1766
- var value = this.popStack(),
1767
- type;
1768
-
1769
- if (this.options.stringParams) {
1770
- type = this.popStack();
1771
- this.popStack();
1772
- }
1773
-
1774
- var hash = this.hash;
1775
- if (type) {
1776
- hash.types.push("'" + key + "': " + type);
1777
- }
1778
- hash.values.push("'" + key + "': (" + value + ")");
1779
- },
1780
-
1781
- // HELPERS
1782
-
1783
- compiler: JavaScriptCompiler,
1784
-
1785
- compileChildren: function(environment, options) {
1786
- var children = environment.children, child, compiler;
1787
-
1788
- for(var i=0, l=children.length; i<l; i++) {
1789
- child = children[i];
1790
- compiler = new this.compiler();
1791
-
1792
- var index = this.matchExistingProgram(child);
1793
-
1794
- if (index == null) {
1795
- this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
1796
- index = this.context.programs.length;
1797
- child.index = index;
1798
- child.name = 'program' + index;
1799
- this.context.programs[index] = compiler.compile(child, options, this.context);
1800
- this.context.environments[index] = child;
1801
- } else {
1802
- child.index = index;
1803
- child.name = 'program' + index;
1804
- }
1805
- }
1806
- },
1807
- matchExistingProgram: function(child) {
1808
- for (var i = 0, len = this.context.environments.length; i < len; i++) {
1809
- var environment = this.context.environments[i];
1810
- if (environment && environment.equals(child)) {
1811
- return i;
1812
- }
1813
- }
1814
- },
1815
-
1816
- programExpression: function(guid) {
1817
- this.context.aliases.self = "this";
1818
-
1819
- if(guid == null) {
1820
- return "self.noop";
1821
- }
1822
-
1823
- var child = this.environment.children[guid],
1824
- depths = child.depths.list, depth;
1825
-
1826
- var programParams = [child.index, child.name, "data"];
1827
-
1828
- for(var i=0, l = depths.length; i<l; i++) {
1829
- depth = depths[i];
1830
-
1831
- if(depth === 1) { programParams.push("depth0"); }
1832
- else { programParams.push("depth" + (depth - 1)); }
1833
- }
1834
-
1835
- if(depths.length === 0) {
1836
- return "self.program(" + programParams.join(", ") + ")";
1837
- } else {
1838
- programParams.shift();
1839
- return "self.programWithDepth(" + programParams.join(", ") + ")";
1840
- }
1841
- },
1842
-
1843
- register: function(name, val) {
1844
- this.useRegister(name);
1845
- this.source.push(name + " = " + val + ";");
1846
- },
1847
-
1848
- useRegister: function(name) {
1849
- if(!this.registers[name]) {
1850
- this.registers[name] = true;
1851
- this.registers.list.push(name);
1852
- }
1853
- },
1854
-
1855
- pushStackLiteral: function(item) {
1856
- return this.push(new Literal(item));
1857
- },
1858
-
1859
- pushStack: function(item) {
1860
- this.flushInline();
1861
-
1862
- var stack = this.incrStack();
1863
- if (item) {
1864
- this.source.push(stack + " = " + item + ";");
1865
- }
1866
- this.compileStack.push(stack);
1867
- return stack;
1868
- },
1869
-
1870
- replaceStack: function(callback) {
1871
- var prefix = '',
1872
- inline = this.isInline(),
1873
- stack;
1874
-
1875
- // If we are currently inline then we want to merge the inline statement into the
1876
- // replacement statement via ','
1877
- if (inline) {
1878
- var top = this.popStack(true);
1879
-
1880
- if (top instanceof Literal) {
1881
- // Literals do not need to be inlined
1882
- stack = top.value;
1883
- } else {
1884
- // Get or create the current stack name for use by the inline
1885
- var name = this.stackSlot ? this.topStackName() : this.incrStack();
1886
-
1887
- prefix = '(' + this.push(name) + ' = ' + top + '),';
1888
- stack = this.topStack();
1889
- }
1890
- } else {
1891
- stack = this.topStack();
1892
- }
1893
-
1894
- var item = callback.call(this, stack);
1895
-
1896
- if (inline) {
1897
- if (this.inlineStack.length || this.compileStack.length) {
1898
- this.popStack();
1899
- }
1900
- this.push('(' + prefix + item + ')');
1901
- } else {
1902
- // Prevent modification of the context depth variable. Through replaceStack
1903
- if (!/^stack/.test(stack)) {
1904
- stack = this.nextStack();
1905
- }
1906
-
1907
- this.source.push(stack + " = (" + prefix + item + ");");
1908
- }
1909
- return stack;
1910
- },
1911
-
1912
- nextStack: function() {
1913
- return this.pushStack();
1914
- },
1915
-
1916
- incrStack: function() {
1917
- this.stackSlot++;
1918
- if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
1919
- return this.topStackName();
1920
- },
1921
- topStackName: function() {
1922
- return "stack" + this.stackSlot;
1923
- },
1924
- flushInline: function() {
1925
- var inlineStack = this.inlineStack;
1926
- if (inlineStack.length) {
1927
- this.inlineStack = [];
1928
- for (var i = 0, len = inlineStack.length; i < len; i++) {
1929
- var entry = inlineStack[i];
1930
- if (entry instanceof Literal) {
1931
- this.compileStack.push(entry);
1932
- } else {
1933
- this.pushStack(entry);
1934
- }
1935
- }
1936
- }
1937
- },
1938
- isInline: function() {
1939
- return this.inlineStack.length;
1940
- },
1941
-
1942
- popStack: function(wrapped) {
1943
- var inline = this.isInline(),
1944
- item = (inline ? this.inlineStack : this.compileStack).pop();
1945
-
1946
- if (!wrapped && (item instanceof Literal)) {
1947
- return item.value;
1948
- } else {
1949
- if (!inline) {
1950
- this.stackSlot--;
1951
- }
1952
- return item;
1953
- }
1954
- },
1955
-
1956
- topStack: function(wrapped) {
1957
- var stack = (this.isInline() ? this.inlineStack : this.compileStack),
1958
- item = stack[stack.length - 1];
1959
-
1960
- if (!wrapped && (item instanceof Literal)) {
1961
- return item.value;
1962
- } else {
1963
- return item;
1964
- }
1965
- },
1966
-
1967
- quotedString: function(str) {
1968
- return '"' + str
1969
- .replace(/\\/g, '\\\\')
1970
- .replace(/"/g, '\\"')
1971
- .replace(/\n/g, '\\n')
1972
- .replace(/\r/g, '\\r') + '"';
1973
- },
1974
-
1975
- setupHelper: function(paramSize, name, missingParams) {
1976
- var params = [];
1977
- this.setupParams(paramSize, params, missingParams);
1978
- var foundHelper = this.nameLookup('helpers', name, 'helper');
1979
-
1980
- return {
1981
- params: params,
1982
- name: foundHelper,
1983
- callParams: ["depth0"].concat(params).join(", "),
1984
- helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ")
1985
- };
1986
- },
1987
-
1988
- // the params and contexts arguments are passed in arrays
1989
- // to fill in
1990
- setupParams: function(paramSize, params, useRegister) {
1991
- var options = [], contexts = [], types = [], param, inverse, program;
1992
-
1993
- options.push("hash:" + this.popStack());
1994
-
1995
- inverse = this.popStack();
1996
- program = this.popStack();
1997
-
1998
- // Avoid setting fn and inverse if neither are set. This allows
1999
- // helpers to do a check for `if (options.fn)`
2000
- if (program || inverse) {
2001
- if (!program) {
2002
- this.context.aliases.self = "this";
2003
- program = "self.noop";
2004
- }
2005
-
2006
- if (!inverse) {
2007
- this.context.aliases.self = "this";
2008
- inverse = "self.noop";
2009
- }
2010
-
2011
- options.push("inverse:" + inverse);
2012
- options.push("fn:" + program);
2013
- }
2014
-
2015
- for(var i=0; i<paramSize; i++) {
2016
- param = this.popStack();
2017
- params.push(param);
2018
-
2019
- if(this.options.stringParams) {
2020
- types.push(this.popStack());
2021
- contexts.push(this.popStack());
2022
- }
2023
- }
2024
-
2025
- if (this.options.stringParams) {
2026
- options.push("contexts:[" + contexts.join(",") + "]");
2027
- options.push("types:[" + types.join(",") + "]");
2028
- options.push("hashTypes:hashTypes");
2029
- }
2030
-
2031
- if(this.options.data) {
2032
- options.push("data:data");
2033
- }
2034
-
2035
- options = "{" + options.join(",") + "}";
2036
- if (useRegister) {
2037
- this.register('options', options);
2038
- params.push('options');
2039
- } else {
2040
- params.push(options);
2041
- }
2042
- return params.join(", ");
2043
- }
2044
- };
2045
-
2046
- var reservedWords = (
2047
- "break else new var" +
2048
- " case finally return void" +
2049
- " catch for switch while" +
2050
- " continue function this with" +
2051
- " default if throw" +
2052
- " delete in try" +
2053
- " do instanceof typeof" +
2054
- " abstract enum int short" +
2055
- " boolean export interface static" +
2056
- " byte extends long super" +
2057
- " char final native synchronized" +
2058
- " class float package throws" +
2059
- " const goto private transient" +
2060
- " debugger implements protected volatile" +
2061
- " double import public let yield"
2062
- ).split(" ");
2063
-
2064
- var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
2065
-
2066
- for(var i=0, l=reservedWords.length; i<l; i++) {
2067
- compilerWords[reservedWords[i]] = true;
2068
- }
2069
-
2070
- JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
2071
- if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {
2072
- return true;
2073
- }
2074
- return false;
2075
- };
2076
-
2077
- })(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
2078
-
2079
- Handlebars.precompile = function(input, options) {
2080
- if (!input || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
2081
- throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
2082
- }
2083
-
2084
- options = options || {};
2085
- if (!('data' in options)) {
2086
- options.data = true;
2087
- }
2088
- var ast = Handlebars.parse(input);
2089
- var environment = new Handlebars.Compiler().compile(ast, options);
2090
- return new Handlebars.JavaScriptCompiler().compile(environment, options);
2091
- };
2092
-
2093
- Handlebars.compile = function(input, options) {
2094
- if (!input || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
2095
- throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
2096
- }
2097
-
2098
- options = options || {};
2099
- if (!('data' in options)) {
2100
- options.data = true;
2101
- }
2102
- var compiled;
2103
- function compile() {
2104
- var ast = Handlebars.parse(input);
2105
- var environment = new Handlebars.Compiler().compile(ast, options);
2106
- var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
2107
- return Handlebars.template(templateSpec);
2108
- }
2109
-
2110
- // Template is only compiled on first use and cached after that point.
2111
- return function(context, options) {
2112
- if (!compiled) {
2113
- compiled = compile();
2114
- }
2115
- return compiled.call(this, context, options);
2116
- };
2117
- };
2118
- ;
2119
- // lib/handlebars/runtime.js
2120
- Handlebars.VM = {
2121
- template: function(templateSpec) {
2122
- // Just add water
2123
- var container = {
2124
- escapeExpression: Handlebars.Utils.escapeExpression,
2125
- invokePartial: Handlebars.VM.invokePartial,
2126
- programs: [],
2127
- program: function(i, fn, data) {
2128
- var programWrapper = this.programs[i];
2129
- if(data) {
2130
- return Handlebars.VM.program(fn, data);
2131
- } else if(programWrapper) {
2132
- return programWrapper;
2133
- } else {
2134
- programWrapper = this.programs[i] = Handlebars.VM.program(fn);
2135
- return programWrapper;
2136
- }
2137
- },
2138
- programWithDepth: Handlebars.VM.programWithDepth,
2139
- noop: Handlebars.VM.noop,
2140
- compilerInfo: null
2141
- };
2142
-
2143
- return function(context, options) {
2144
- options = options || {};
2145
- var result = templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);
2146
-
2147
- var compilerInfo = container.compilerInfo || [],
2148
- compilerRevision = compilerInfo[0] || 1,
2149
- currentRevision = Handlebars.COMPILER_REVISION;
2150
-
2151
- if (compilerRevision !== currentRevision) {
2152
- if (compilerRevision < currentRevision) {
2153
- var runtimeVersions = Handlebars.REVISION_CHANGES[currentRevision],
2154
- compilerVersions = Handlebars.REVISION_CHANGES[compilerRevision];
2155
- throw "Template was precompiled with an older version of Handlebars than the current runtime. "+
2156
- "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").";
2157
- } else {
2158
- // Use the embedded version info since the runtime doesn't know about this revision yet
2159
- throw "Template was precompiled with a newer version of Handlebars than the current runtime. "+
2160
- "Please update your runtime to a newer version ("+compilerInfo[1]+").";
2161
- }
2162
- }
2163
-
2164
- return result;
2165
- };
2166
- },
2167
-
2168
- programWithDepth: function(fn, data, $depth) {
2169
- var args = Array.prototype.slice.call(arguments, 2);
2170
-
2171
- return function(context, options) {
2172
- options = options || {};
2173
-
2174
- return fn.apply(this, [context, options.data || data].concat(args));
2175
- };
2176
- },
2177
- program: function(fn, data) {
2178
- return function(context, options) {
2179
- options = options || {};
2180
-
2181
- return fn(context, options.data || data);
2182
- };
2183
- },
2184
- noop: function() { return ""; },
2185
- invokePartial: function(partial, name, context, helpers, partials, data) {
2186
- var options = { helpers: helpers, partials: partials, data: data };
2187
-
2188
- if(partial === undefined) {
2189
- throw new Handlebars.Exception("The partial " + name + " could not be found");
2190
- } else if(partial instanceof Function) {
2191
- return partial(context, options);
2192
- } else if (!Handlebars.compile) {
2193
- throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
2194
- } else {
2195
- partials[name] = Handlebars.compile(partial, {data: data !== undefined});
2196
- return partials[name](context, options);
2197
- }
2198
- }
2199
- };
2200
-
2201
- Handlebars.template = Handlebars.VM.template;
2202
- ;
2203
-
2204
- })();
2205
-
2206
1
  (function() {
2207
2
  /**
2208
3
  @module ember
@@ -2216,7 +11,10 @@ var objectCreate = Object.create || function(parent) {
2216
11
  return new F();
2217
12
  };
2218
13
 
2219
- var Handlebars = this.Handlebars || Ember.imports.Handlebars;
14
+ var Handlebars = this.Handlebars || (Ember.imports && Ember.imports.Handlebars);
15
+ if(!Handlebars && typeof require === 'function') {
16
+ Handlebars = require('handlebars');
17
+ }
2220
18
 
2221
19
 
2222
20
  /**