!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Twig=t():e.Twig=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){/** * Twig.js * * @copyright 2011-2016 John Roepke and the Twig.js Contributors * @license Available under the BSD 2-Clause License * @link https://github.com/twigjs/twig.js */ var r={VERSION:"0.10.2"};n(1)(r),n(2)(r),n(3)(r),n(5)(r),n(6)(r),n(7)(r),n(17)(r),n(18)(r),n(22)(r),n(23)(r),n(24)(r),n(25)(r),n(26)(r),n(27)(r),n(28)(r),e.exports=r.exports},function(e,t){e.exports=function(e){"use strict";function t(e,t){var n=Object.prototype.toString.call(t).slice(8,-1);return void 0!==t&&null!==t&&n===e}return e.trace=!1,e.debug=!1,e.cache=!0,e.noop=function(){},e.placeholders={parent:"{{|PARENT|}}"},e.indexOf=function(e,t){if(Array.prototype.hasOwnProperty("indexOf"))return e.indexOf(t);if(void 0===e||null===e)throw new TypeError;var n=Object(e),r=n.length>>>0;if(0===r)return-1;var o=0;if(arguments.length>0&&(o=Number(arguments[1]),o!==o?o=0:0!==o&&o!==1/0&&o!==-(1/0)&&(o=(o>0||-1)*Math.floor(Math.abs(o)))),o>=r)return-1;for(var i=o>=0?o:Math.max(r-Math.abs(o),0);i>>0;if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(n&&(r=n),o=0;o=0&&r.open.length!==r.close.length&&i<0||(o>=0&&(null===s.position||o=0&&null!==s.position&&o===s.position&&(r.open.length>s.def.open.length?(s.position=o,s.def=r,s.close_position=i):r.open.length===s.def.open.length&&(r.close.length>s.def.close.length?i>=0&&i=0&&i=0))throw new e.Error("Unable to find closing bracket '"+n.close+"' opened near template position "+r);if(s=l,p=!0,n.type===e.token.type.comment)break;if(n.type===e.token.type.raw)break;for(i=e.token.strings.length,o=0;o0&&h0;)if(o=e.token.findStart(t),e.log.trace("Twig.tokenize: ","Found token: ",o),null!==o.position){if(o.position>0&&n.push({type:e.token.type.raw,value:t.substring(0,o.position)}),t=t.substr(o.position+o.def.open.length),r+=o.position+o.def.open.length,i=e.token.findEnd(t,o.def,r),e.log.trace("Twig.tokenize: ","Token ends at ",i),n.push({type:o.def.type,value:t.substring(0,i).trim()}),"\n"===t.substr(i+o.def.close.length,1))switch(o.def.type){case"logic_whitespace_pre":case"logic_whitespace_post":case"logic_whitespace_both":case"logic":i+=1}t=t.substr(i+o.def.close.length),r+=i+o.def.close.length}else n.push({type:e.token.type.raw,value:t}),t="";return n},e.compile=function(t){try{for(var n=[],r=[],o=[],i=null,s=null,p=null,a=null,c=null,u=null,l=null,f=null,h=null,y=null,d=null,g=null,m=function(t){e.expression.compile.apply(this,[t]),r.length>0?o.push(t):n.push(t)},x=function(t){if(s=e.logic.compile.apply(this,[t]),y=s.type,d=e.logic.handler[y].open,g=e.logic.handler[y].next,e.log.trace("Twig.compile: ","Compiled logic token to ",s," next is: ",g," open is : ",d),void 0!==d&&!d){if(a=r.pop(),l=e.logic.handler[a.type],e.indexOf(l.next,y)<0)throw new Error(y+" not expected after a "+a.type);a.output=a.output||[],a.output=a.output.concat(o),o=[],h={type:e.token.type.logic,token:a},r.length>0?o.push(h):n.push(h)}void 0!==g&&g.length>0?(e.log.trace("Twig.compile: ","Pushing ",s," to logic stack."),r.length>0&&(a=r.pop(),a.output=a.output||[],a.output=a.output.concat(o),r.push(a),o=[]),r.push(s)):void 0!==d&&d&&(h={type:e.token.type.logic,token:s},r.length>0?o.push(h):n.push(h))};t.length>0;){switch(i=t.shift(),c=n[n.length-1],u=o[o.length-1],f=t[0],e.log.trace("Compiling token ",i),i.type){case e.token.type.raw:r.length>0?o.push(i):n.push(i);break;case e.token.type.logic:x.call(this,i);break;case e.token.type.comment:break;case e.token.type.output:m.call(this,i);break;case e.token.type.logic_whitespace_pre:case e.token.type.logic_whitespace_post:case e.token.type.logic_whitespace_both:case e.token.type.output_whitespace_pre:case e.token.type.output_whitespace_post:case e.token.type.output_whitespace_both:switch(i.type!==e.token.type.output_whitespace_post&&i.type!==e.token.type.logic_whitespace_post&&(c&&c.type===e.token.type.raw&&(n.pop(),null===c.value.match(/^\s*$/)&&(c.value=c.value.trim(),n.push(c))),u&&u.type===e.token.type.raw&&(o.pop(),null===u.value.match(/^\s*$/)&&(u.value=u.value.trim(),o.push(u)))),i.type){case e.token.type.output_whitespace_pre:case e.token.type.output_whitespace_post:case e.token.type.output_whitespace_both:m.call(this,i);break;case e.token.type.logic_whitespace_pre:case e.token.type.logic_whitespace_post:case e.token.type.logic_whitespace_both:x.call(this,i)}i.type!==e.token.type.output_whitespace_pre&&i.type!==e.token.type.logic_whitespace_pre&&f&&f.type===e.token.type.raw&&(t.shift(),null===f.value.match(/^\s*$/)&&(f.value=f.value.trim(),t.unshift(f)))}e.log.trace("Twig.compile: "," Output: ",n," Logic Stack: ",r," Pending Output: ",o)}if(r.length>0)throw p=r.pop(),new Error("Unable to find an end tag for "+p.type+", expecting one of "+p.next);return n}catch(t){if(this.options.rethrow)throw"TwigException"!=t.type||t.file||(t.file=this.id),t;e.log.error("Error compiling twig template "+this.id+": "),t.stack?e.log.error(t.stack):e.log.error(t.toString())}},e.parse=function(t,n,r){function o(t){if(i.options.rethrow)throw"string"==typeof t&&(t=new e.Error(t)),"TwigException"!=t.type||t.file||(t.file=i.id),t;if(e.log.error("Error parsing twig template "+i.id+": "),t.stack?e.log.error(t.stack):e.log.error(t.toString()),e.debug)return t.toString()}var i=this,s=[],p=null,a=!0,c=null,u=!0;if(c=e.async.forEach(t,function(t){switch(e.log.debug("Twig.parse: ","Parsing token: ",t),t.type){case e.token.type.raw:s.push(e.filters.raw(t.value));break;case e.token.type.logic:var r=t.token;return e.logic.parseAsync.apply(i,[r,n,u]).then(function(e){void 0!==e.chain&&(u=e.chain),void 0!==e.context&&(n=e.context),void 0!==e.output&&s.push(e.output)});case e.token.type.comment:break;case e.token.type.output_whitespace_pre:case e.token.type.output_whitespace_post:case e.token.type.output_whitespace_both:case e.token.type.output:return e.log.debug("Twig.parse: ","Output token: ",t.stack),e.expression.parseAsync.apply(i,[t.stack,n]).then(function(e){s.push(e)})}}).then(function(){return s=e.output.apply(i,[s]),a=!1,s}).catch(function(e){r&&o(e),p=e}),r)return c;if(null!==p)return o(p);if(a)throw new e.Error("You are using Twig.js in sync mode in combination with async extensions.");return s},e.prepare=function(t){var n,r;return e.log.debug("Twig.prepare: ","Tokenizing ",t),r=e.tokenize.apply(this,[t]),e.log.debug("Twig.prepare: ","Compiling ",r),n=e.compile.apply(this,[r]),e.log.debug("Twig.prepare: ","Compiled ",n),n},e.output=function(t){if(!this.options.autoescape)return t.join("");var n="html";"string"==typeof this.options.autoescape&&(n=this.options.autoescape);var r=[];return e.forEach(t,function(t){t&&t.twig_markup!==!0&&t.twig_markup!=n&&(t=e.filters.escape(t,[n])),r.push(t)}),e.Markup(r.join(""))},e.Templates={loaders:{},parsers:{},registry:{}},e.validateId=function(t){if("prototype"===t)throw new e.Error(t+" is not a valid twig identifier");if(e.cache&&e.Templates.registry.hasOwnProperty(t))throw new e.Error("There is already a template with the ID "+t);return!0},e.Templates.registerLoader=function(t,n,r){if("function"!=typeof n)throw new e.Error("Unable to add loader for "+t+": Invalid function reference given.");r&&(n=n.bind(r)),this.loaders[t]=n},e.Templates.unRegisterLoader=function(e){this.isRegisteredLoader(e)&&delete this.loaders[e]},e.Templates.isRegisteredLoader=function(e){return this.loaders.hasOwnProperty(e)},e.Templates.registerParser=function(t,n,r){if("function"!=typeof n)throw new e.Error("Unable to add parser for "+t+": Invalid function regerence given.");r&&(n=n.bind(r)),this.parsers[t]=n},e.Templates.unRegisterParser=function(e){this.isRegisteredParser(e)&&delete this.parsers[e]},e.Templates.isRegisteredParser=function(e){return this.parsers.hasOwnProperty(e)},e.Templates.save=function(t){if(void 0===t.id)throw new e.Error("Unable to save template with no id");e.Templates.registry[t.id]=t},e.Templates.load=function(t){return e.Templates.registry.hasOwnProperty(t)?e.Templates.registry[t]:null},e.Templates.loadRemote=function(t,n,r,o){var i;return void 0===n.async&&(n.async=!0),void 0===n.id&&(n.id=t),e.cache&&e.Templates.registry.hasOwnProperty(n.id)?("function"==typeof r&&r(e.Templates.registry[n.id]),e.Templates.registry[n.id]):(n.parser=n.parser||"twig",i=this.loaders[n.method]||this.loaders.fs,i.apply(this,arguments))},e.Template=function(n){var r=n.data,o=n.id,i=n.blocks,s=n.macros||{},p=n.base,a=n.path,c=n.url,u=n.name,l=n.method,f=n.options;this.id=o,this.method=l,this.base=p,this.path=a,this.url=c,this.name=u,this.macros=s,this.options=f,this.reset(i),t("String",r)?this.tokens=e.prepare.apply(this,[r]):this.tokens=r,void 0!==o&&e.Templates.save(this)},e.Template.prototype.reset=function(t){e.log.debug("Twig.Template.reset","Reseting template "+this.id),this.blocks={},this.importedBlocks=[],this.originalBlockTokens={},this.child={blocks:t||{}},this.extend=null},e.Template.prototype.render=function(t,n,r){n=n||{};var o,i,s=this,p=null,a=!0,c=null;this.context=t||{},this.reset(),n.blocks&&(this.blocks=n.blocks),n.macros&&(this.macros=n.macros);var u=function(t){if(s.extend){var r;return s.options.allowInlineIncludes&&(r=e.Templates.load(s.extend),r&&(r.options=s.options)),r||(i=e.path.parsePath(s,s.extend),r=e.Templates.loadRemote(i,{method:s.getLoaderMethod(),base:s.base,async:!1,id:i,options:s.options})),s.parent=r,s.parent.renderAsync(s.context,{blocks:s.blocks})}return"blocks"==n.output?s.blocks:"macros"==n.output?s.macros:t};if(c=e.parseAsync.apply(this,[this.tokens,this.context]).then(u).then(function(e){return a=!1,o=e,e}).catch(function(e){if(r)throw e;p=e}),r)return c;if(null!==p)throw p;if(a)throw new e.Error("You are using Twig.js in sync mode in combination with async extensions.");return o},e.Template.prototype.importFile=function(t){var n,r;if(!this.url&&this.options.allowInlineIncludes){if(t=this.path?e.path.parsePath(this,t):t,r=e.Templates.load(t),!r&&(r=e.Templates.loadRemote(n,{id:t,method:this.getLoaderMethod(),async:!1,path:t,options:this.options}),!r))throw new e.Error("Unable to find the template "+t);return r.options=this.options,r}return n=e.path.parsePath(this,t),r=e.Templates.loadRemote(n,{method:this.getLoaderMethod(),base:this.base,async:!1,options:this.options,id:n})},e.Template.prototype.importBlocks=function(t,n){var r=this.importFile(t),o=this.context,i=this;n=n||!1,r.render(o),e.forEach(Object.keys(r.blocks),function(e){(n||void 0===i.blocks[e])&&(i.blocks[e]=r.blocks[e],i.importedBlocks.push(e))})},e.Template.prototype.importMacros=function(t){var n=e.path.parsePath(this,t),r=e.Templates.loadRemote(n,{method:this.getLoaderMethod(),async:!1,id:n});return r},e.Template.prototype.getLoaderMethod=function(){return this.path?"fs":this.url?"ajax":this.method||"fs"},e.Template.prototype.compile=function(t){return e.compiler.compile(this,t)},e.Markup=function(e,t){return"undefined"==typeof t&&(t=!0),"string"==typeof e&&e.length>0&&(e=new String(e),e.twig_markup=t),e},e}},function(e,t){e.exports=function(e){return e.compiler={module:{}},e.compiler.compile=function(t,n){var r,o=JSON.stringify(t.tokens),i=t.id;if(n.module){if(void 0===e.compiler.module[n.module])throw new e.Error("Unable to find module type "+n.module);r=e.compiler.module[n.module](i,o,n.twig)}else r=e.compiler.wrap(i,o);return r},e.compiler.module={amd:function(t,n,r){return'define(["'+r+'"], function (Twig) {\n\tvar twig, templates;\ntwig = Twig.twig;\ntemplates = '+e.compiler.wrap(t,n)+"\n\treturn templates;\n});"},node:function(t,n){return'var twig = require("twig").twig;\nexports.template = '+e.compiler.wrap(t,n)},cjs2:function(t,n,r){return'module.declare([{ twig: "'+r+'" }], function (require, exports, module) {\n\tvar twig = require("twig").twig;\n\texports.template = '+e.compiler.wrap(t,n)+"\n});"}},e.compiler.wrap=function(e,t){return'twig({id:"'+e.replace('"','\\"')+'", data:'+t+", precompiled: true});\n"},e}},function(e,t,n){e.exports=function(e){"use strict";function t(t,n,r){return n?e.expression.parseAsync.apply(t,[n,r]):e.Promise.resolve(!1)}e.expression={},n(4)(e),e.expression.reservedWords=["true","false","null","TRUE","FALSE","NULL","_context","and","b-and","or","b-or","b-xor","in","not in","if"],e.expression.type={comma:"Twig.expression.type.comma",operator:{unary:"Twig.expression.type.operator.unary",binary:"Twig.expression.type.operator.binary"},string:"Twig.expression.type.string",bool:"Twig.expression.type.bool",slice:"Twig.expression.type.slice",array:{start:"Twig.expression.type.array.start",end:"Twig.expression.type.array.end"},object:{start:"Twig.expression.type.object.start",end:"Twig.expression.type.object.end"},parameter:{start:"Twig.expression.type.parameter.start",end:"Twig.expression.type.parameter.end"},subexpression:{start:"Twig.expression.type.subexpression.start",end:"Twig.expression.type.subexpression.end"},key:{period:"Twig.expression.type.key.period",brackets:"Twig.expression.type.key.brackets"},filter:"Twig.expression.type.filter",_function:"Twig.expression.type._function",variable:"Twig.expression.type.variable",number:"Twig.expression.type.number",_null:"Twig.expression.type.null",context:"Twig.expression.type.context",test:"Twig.expression.type.test"},e.expression.set={operations:[e.expression.type.filter,e.expression.type.operator.unary,e.expression.type.operator.binary,e.expression.type.array.end,e.expression.type.object.end,e.expression.type.parameter.end,e.expression.type.subexpression.end,e.expression.type.comma,e.expression.type.test],expressions:[e.expression.type._function,e.expression.type.bool,e.expression.type.string,e.expression.type.variable,e.expression.type.number,e.expression.type._null,e.expression.type.context,e.expression.type.parameter.start,e.expression.type.array.start,e.expression.type.object.start,e.expression.type.subexpression.start,e.expression.type.operator.unary]},e.expression.set.operations_extended=e.expression.set.operations.concat([e.expression.type.key.period,e.expression.type.key.brackets,e.expression.type.slice]),e.expression.fn={compile:{push:function(e,t,n){n.push(e)},push_both:function(e,t,n){n.push(e),t.push(e)}},parse:{push:function(e,t,n){t.push(e)},push_value:function(e,t,n){t.push(e.value)}}},e.expression.definitions=[{type:e.expression.type.test,regex:/^is\s+(not)?\s*([a-zA-Z_][a-zA-Z0-9_]*(\s?as)?)/,next:e.expression.set.operations.concat([e.expression.type.parameter.start]),compile:function(e,t,n){e.filter=e.match[2],e.modifier=e.match[1],delete e.match,delete e.value,n.push(e)},parse:function(n,r,o){var i=r.pop();return t(this,n.params,o).then(function(t){var o=e.test(n.filter,i,t);"not"==n.modifier?r.push(!o):r.push(o)})}},{type:e.expression.type.comma,regex:/^,/,next:e.expression.set.expressions.concat([e.expression.type.array.end,e.expression.type.object.end]),compile:function(t,n,r){var o,i=n.length-1;for(delete t.match,delete t.value;i>=0;i--){if(o=n.pop(),o.type===e.expression.type.object.start||o.type===e.expression.type.parameter.start||o.type===e.expression.type.array.start){n.push(o);break}r.push(o)}r.push(t)}},{type:e.expression.type.number,regex:/^\-?\d+(\.\d+)?/,next:e.expression.set.operations,compile:function(e,t,n){e.value=Number(e.value),n.push(e)},parse:e.expression.fn.parse.push_value},{type:e.expression.type.operator.binary,regex:/(^\?\:|^(b\-and)|^(b\-or)|^(b\-xor)|^[\+\-~%\?]|^[\:](?!\d\])|^[!=]==?|^[!<>]=?|^\*\*?|^\/\/?|^(and)[\(|\s+]|^(or)[\(|\s+]|^(in)[\(|\s+]|^(not in)[\(|\s+]|^\.\.)/,next:e.expression.set.expressions,transform:function(e,t){switch(e[0]){case"and(":case"or(":case"in(":case"not in(":return t[t.length-1].value=e[2],e[0];default:return""}},compile:function(t,n,r){delete t.match,t.value=t.value.trim();var o=t.value,i=e.expression.operator.lookup(o,t);for(e.log.trace("Twig.expression.compile: ","Operator: ",i," from ",o);n.length>0&&(n[n.length-1].type==e.expression.type.operator.unary||n[n.length-1].type==e.expression.type.operator.binary)&&(i.associativity===e.expression.operator.leftToRight&&i.precidence>=n[n.length-1].precidence||i.associativity===e.expression.operator.rightToLeft&&i.precidence>n[n.length-1].precidence);){var s=n.pop();r.push(s)}if(":"===o){if(!n[n.length-1]||"?"!==n[n.length-1].value){var p=r.pop();if(p.type===e.expression.type.string||p.type===e.expression.type.variable)t.key=p.value;else if(p.type===e.expression.type.number)t.key=p.value.toString();else{if(!p.expression||p.type!==e.expression.type.parameter.end&&p.type!=e.expression.type.subexpression.end)throw new e.Error("Unexpected value before ':' of "+p.type+" = "+p.value);t.params=p.params}return void r.push(t)}}else n.push(i)},parse:function(t,n,r){if(t.key)n.push(t);else{if(t.params)return e.expression.parseAsync.apply(this,[t.params,r]).then(function(e){t.key=e,n.push(t),r.loop||delete t.params});e.expression.operator.parse(t.value,n)}}},{type:e.expression.type.operator.unary,regex:/(^not\s+)/,next:e.expression.set.expressions,compile:function(t,n,r){delete t.match,t.value=t.value.trim();var o=t.value,i=e.expression.operator.lookup(o,t);for(e.log.trace("Twig.expression.compile: ","Operator: ",i," from ",o);n.length>0&&(n[n.length-1].type==e.expression.type.operator.unary||n[n.length-1].type==e.expression.type.operator.binary)&&(i.associativity===e.expression.operator.leftToRight&&i.precidence>=n[n.length-1].precidence||i.associativity===e.expression.operator.rightToLeft&&i.precidence>n[n.length-1].precidence);){var s=n.pop();r.push(s)}n.push(i)},parse:function(t,n,r){e.expression.operator.parse(t.value,n)}},{type:e.expression.type.string,regex:/^(["'])(?:(?=(\\?))\2[\s\S])*?\1/,next:e.expression.set.operations_extended,compile:function(t,n,r){var o=t.value;delete t.match,o='"'===o.substring(0,1)?o.replace('\\"','"'):o.replace("\\'","'"),t.value=o.substring(1,o.length-1).replace(/\\n/g,"\n").replace(/\\r/g,"\r"),e.log.trace("Twig.expression.compile: ","String value: ",t.value),r.push(t)},parse:e.expression.fn.parse.push_value},{type:e.expression.type.subexpression.start,regex:/^\(/,next:e.expression.set.expressions.concat([e.expression.type.subexpression.end]),compile:function(e,t,n){e.value="(",n.push(e),t.push(e)},parse:e.expression.fn.parse.push},{type:e.expression.type.subexpression.end,regex:/^\)/,next:e.expression.set.operations_extended,validate:function(t,n){for(var r=n.length-1,o=!1,i=!1,s=0;!o&&r>=0;){var p=n[r];o=p.type===e.expression.type.subexpression.start,o&&i&&(i=!1,o=!1),p.type===e.expression.type.parameter.start?s++:p.type===e.expression.type.parameter.end?s--:p.type===e.expression.type.subexpression.end&&(i=!0),r--}return o&&0===s},compile:function(t,n,r){var o,i=t;for(o=n.pop();n.length>0&&o.type!=e.expression.type.subexpression.start;)r.push(o),o=n.pop();for(var s=[];t.type!==e.expression.type.subexpression.start;)s.unshift(t),t=r.pop();s.unshift(t);o=n[n.length-1],void 0===o||o.type!==e.expression.type._function&&o.type!==e.expression.type.filter&&o.type!==e.expression.type.test&&o.type!==e.expression.type.key.brackets?(i.expression=!0,s.pop(),s.shift(),i.params=s,r.push(i)):(i.expression=!1,o.params=s)},parse:function(t,n,r){if(t.expression)return e.expression.parseAsync.apply(this,[t.params,r]).then(function(e){n.push(e)});throw new e.Error("Unexpected subexpression end when token is not marked as an expression")}},{type:e.expression.type.parameter.start,regex:/^\(/,next:e.expression.set.expressions.concat([e.expression.type.parameter.end]),validate:function(t,n){var r=n[n.length-1];return r&&e.indexOf(e.expression.reservedWords,r.value.trim())<0},compile:e.expression.fn.compile.push_both,parse:e.expression.fn.parse.push},{type:e.expression.type.parameter.end,regex:/^\)/,next:e.expression.set.operations_extended,compile:function(t,n,r){var o,i=t;for(o=n.pop();n.length>0&&o.type!=e.expression.type.parameter.start;)r.push(o),o=n.pop();for(var s=[];t.type!==e.expression.type.parameter.start;)s.unshift(t),t=r.pop();s.unshift(t);t=r[r.length-1],void 0===t||t.type!==e.expression.type._function&&t.type!==e.expression.type.filter&&t.type!==e.expression.type.test&&t.type!==e.expression.type.key.brackets?(i.expression=!0,s.pop(),s.shift(),i.params=s,r.push(i)):(i.expression=!1,t.params=s)},parse:function(t,n,r){var o=[],i=!1,s=null;if(t.expression)return e.expression.parseAsync.apply(this,[t.params,r]).then(function(e){n.push(e)});for(;n.length>0;){if(s=n.pop(),s&&s.type&&s.type==e.expression.type.parameter.start){i=!0;break}o.unshift(s)}if(!i)throw new e.Error("Expected end of parameter set.");n.push(o)}},{type:e.expression.type.slice,regex:/^\[(\d*\:\d*)\]/,next:e.expression.set.operations_extended,compile:function(e,t,n){var r=e.match[1].split(":"),o=r[0]?parseInt(r[0]):void 0,i=r[1]?parseInt(r[1]):void 0;e.value="slice",e.params=[o,i],i||(e.params=[o]),n.push(e)},parse:function(t,n,r){var o=n.pop(),i=t.params;n.push(e.filter.apply(this,[t.value,o,i]))}},{type:e.expression.type.array.start,regex:/^\[/,next:e.expression.set.expressions.concat([e.expression.type.array.end]),compile:e.expression.fn.compile.push_both,parse:e.expression.fn.parse.push},{type:e.expression.type.array.end,regex:/^\]/,next:e.expression.set.operations_extended,compile:function(t,n,r){for(var o,i=n.length-1;i>=0&&(o=n.pop(),o.type!==e.expression.type.array.start);i--)r.push(o);r.push(t)},parse:function(t,n,r){for(var o=[],i=!1,s=null;n.length>0;){if(s=n.pop(),s.type&&s.type==e.expression.type.array.start){i=!0;break}o.unshift(s)}if(!i)throw new e.Error("Expected end of array.");n.push(o)}},{type:e.expression.type.object.start,regex:/^\{/,next:e.expression.set.expressions.concat([e.expression.type.object.end]),compile:e.expression.fn.compile.push_both,parse:e.expression.fn.parse.push},{type:e.expression.type.object.end,regex:/^\}/,next:e.expression.set.operations_extended,compile:function(t,n,r){for(var o,i=n.length-1;i>=0&&(o=n.pop(),!o||o.type!==e.expression.type.object.start);i--)r.push(o);r.push(t)},parse:function(t,n,r){for(var o={},i=!1,s=null,p=!1,a=null;n.length>0;){if(s=n.pop(),s&&s.type&&s.type===e.expression.type.object.start){i=!0;break}if(s&&s.type&&(s.type===e.expression.type.operator.binary||s.type===e.expression.type.operator.unary)&&s.key){if(!p)throw new e.Error("Missing value for key '"+s.key+"' in object definition.");o[s.key]=a,void 0===o._keys&&(o._keys=[]),o._keys.unshift(s.key),a=null,p=!1}else p=!0,a=s}if(!i)throw new e.Error("Unexpected end of object.");n.push(o)}},{type:e.expression.type.filter,regex:/^\|\s?([a-zA-Z_][a-zA-Z0-9_\-]*)/,next:e.expression.set.operations_extended.concat([e.expression.type.parameter.start]),compile:function(e,t,n){e.value=e.match[1],n.push(e)},parse:function(n,r,o){var i=this,s=r.pop();return t(this,n.params,o).then(function(t){return e.filter.apply(i,[n.value,s,t])}).then(function(e){r.push(e)})}},{type:e.expression.type._function,regex:/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\(/,next:e.expression.type.parameter.start,validate:function(t,n){return t[1]&&e.indexOf(e.expression.reservedWords,t[1])<0},transform:function(e,t){return"("},compile:function(e,t,n){var r=e.match[1];e.fn=r,delete e.match,delete e.value,n.push(e)},parse:function(n,r,o){var i,s=this,p=n.fn;return t(this,n.params,o).then(function(t){if(e.functions[p])i=e.functions[p].apply(s,t);else{if("function"!=typeof o[p])throw new e.Error(p+" function does not exist and is not defined in the context");i=o[p].apply(o,t)}return i}).then(function(e){r.push(e)})}},{type:e.expression.type.variable,regex:/^[a-zA-Z_][a-zA-Z0-9_]*/,next:e.expression.set.operations_extended.concat([e.expression.type.parameter.start]),compile:e.expression.fn.compile.push,validate:function(t,n){return e.indexOf(e.expression.reservedWords,t[0])<0},parse:function(t,n,r){return e.expression.resolveAsync.apply(this,[r[t.value],r]).then(function(e){n.push(e)})}},{type:e.expression.type.key.period,regex:/^\.([a-zA-Z0-9_]+)/,next:e.expression.set.operations_extended.concat([e.expression.type.parameter.start]),compile:function(e,t,n){e.key=e.match[1],delete e.match,delete e.value,n.push(e)},parse:function(n,r,o,i){var s,p=this,a=n.key,c=r.pop();return t(this,n.params,o).then(function(t){if(null===c||void 0===c){if(p.options.strict_variables)throw new e.Error("Can't access a key "+a+" on an null or undefined object.");s=void 0}else{var n=function(e){return e.substr(0,1).toUpperCase()+e.substr(1)};s="object"==typeof c&&a in c?c[a]:void 0!==c["get"+n(a)]?c["get"+n(a)]:void 0!==c["is"+n(a)]?c["is"+n(a)]:void 0}return e.expression.resolveAsync.apply(p,[s,o,t,i,c])}).then(function(e){r.push(e)})}},{type:e.expression.type.key.brackets,regex:/^\[([^\]\:]*)\]/,next:e.expression.set.operations_extended.concat([e.expression.type.parameter.start]),compile:function(t,n,r){var o=t.match[1];delete t.value,delete t.match,t.stack=e.expression.compile({value:o}).stack,r.push(t)},parse:function(n,r,o,i){var s,p,a=this,c=null;return t(this,n.params,o).then(function(t){return c=t,e.expression.parseAsync.apply(a,[n.stack,o])}).then(function(t){if(s=r.pop(),null===s||void 0===s){if(a.options.strict_variables)throw new e.Error("Can't access a key "+t+" on an null or undefined object.");return null}return p="object"==typeof s&&t in s?s[t]:null,e.expression.resolveAsync.apply(a,[p,s,c,i])}).then(function(e){r.push(e)})}},{type:e.expression.type._null,regex:/^(null|NULL|none|NONE)/,next:e.expression.set.operations,compile:function(e,t,n){delete e.match,e.value=null,n.push(e)},parse:e.expression.fn.parse.push_value},{type:e.expression.type.context,regex:/^_context/,next:e.expression.set.operations_extended.concat([e.expression.type.parameter.start]),compile:e.expression.fn.compile.push,parse:function(e,t,n){t.push(n)}},{type:e.expression.type.bool,regex:/^(true|TRUE|false|FALSE)/,next:e.expression.set.operations,compile:function(e,t,n){e.value="true"===e.match[0].toLowerCase(),delete e.match,n.push(e)},parse:e.expression.fn.parse.push_value}],e.expression.resolveAsync=function(t,n,r,o,i){if("function"==typeof t){var s=e.Promise.resolve(r);if(o&&o.type===e.expression.type.parameter.end){var p=!0;s=s.then(function(){return o.params&&e.expression.parseAsync.apply(this,[o.params,n,p])}).then(function(e){return o.cleanup=!0,e})}return s.then(function(e){return t.apply(i||n,e||[])})}return e.Promise.resolve(t)},e.expression.resolve=function(t,n,r,o,i){var s,p=!0;if(e.expression.resolveAsync.apply(this,[t,n,r,o,i]).then(function(e){p=!1,s=e}),p)throw new e.Error("You are using Twig.js in sync mode in combination with async extensions.");return s},e.expression.handler={},e.expression.extendType=function(t){e.expression.type[t]="Twig.expression.type."+t},e.expression.extend=function(t){if(!t.type)throw new e.Error("Unable to extend logic definition. No type provided for "+t);e.expression.handler[t.type]=t};for(;e.expression.definitions.length>0;)e.expression.extend(e.expression.definitions.shift());return e.expression.tokenize=function(t){var n,r,o,i,s,p,a=[],c=0,u=null,l=[];for(p=function(){var t=Array.prototype.slice.apply(arguments);t.pop(),t.pop();return e.log.trace("Twig.expression.tokenize","Matched a ",n," regular expression of ",t),u&&e.indexOf(u,n)<0?(l.push(n+" cannot follow a "+a[a.length-1].type+" at template:"+c+" near '"+t[0].substring(0,20)+"...'"),t[0]):e.expression.handler[n].validate&&!e.expression.handler[n].validate(t,a)?t[0]:(l=[],a.push({type:n,value:t[0],match:t}),s=!0,u=i,c+=t[0].length,e.expression.handler[n].transform?e.expression.handler[n].transform(t,a):"")},e.log.debug("Twig.expression.tokenize","Tokenizing expression ",t);t.length>0;){t=t.trim();for(n in e.expression.handler)if(e.expression.handler.hasOwnProperty(n)){for(i=e.expression.handler[n].next,r=e.expression.handler[n].regex,e.log.trace("Checking type ",n," on ",t),o=r instanceof Array?r:[r],s=!1;o.length>0;)r=o.pop(),t=t.replace(r,p);if(s)break}if(!s)throw l.length>0?new e.Error(l.join(" OR ")):new e.Error("Unable to parse '"+t+"' at template position"+c)}return e.log.trace("Twig.expression.tokenize","Tokenized to ",a),a},e.expression.compile=function(t){var n=t.value,r=e.expression.tokenize(n),o=null,i=[],s=[],p=null;for(e.log.trace("Twig.expression.compile: ","Compiling ",n);r.length>0;)o=r.shift(),p=e.expression.handler[o.type],e.log.trace("Twig.expression.compile: ","Compiling ",o),p.compile&&p.compile(o,s,i),e.log.trace("Twig.expression.compile: ","Stack is",s),e.log.trace("Twig.expression.compile: ","Output is",i);for(;s.length>0;)i.push(s.pop());return e.log.trace("Twig.expression.compile: ","Final output is",i),t.stack=i,delete t.value,t},e.expression.parse=function(t,n,r,o){var i=this;t instanceof Array||(t=[t]);var s,p=[],a=null,c=!0,u=null,l=[];if(a=e.async.forEach(t,function(r,o){if(!r.cleanup){var a=null;return t.length>o+1&&(s=t[o+1]),u=e.expression.handler[r.type],u.parse&&(a=u.parse.apply(i,[r,p,n,s])),n.loop&&r.type===e.expression.type.operator.binary&&l.push(r),a}}).then(function(){if(e.forEach(l,function(e){e.params&&e.key&&delete e.key}),r){for(var t=[];p.length>0;)t.unshift(p.pop());p.push(t)}if(o)return e.Promise.resolve(p.pop())}).then(function(e){return c=!1,e}),o)return a;if(c)throw new e.Error("You are using Twig.js in sync mode in combination with async extensions.");return p.pop()},e}},function(e,t){e.exports=function(e){ "use strict";e.expression.operator={leftToRight:"leftToRight",rightToLeft:"rightToLeft"};var t=function(e,t){if(void 0===t||null===t)return null;if(void 0!==t.indexOf)return e===t||""!==e&&t.indexOf(e)>-1;var n;for(n in t)if(t.hasOwnProperty(n)&&t[n]===e)return!0;return!1};return e.expression.operator.lookup=function(t,n){switch(t){case"..":n.precidence=20,n.associativity=e.expression.operator.leftToRight;break;case",":n.precidence=18,n.associativity=e.expression.operator.leftToRight;break;case"?:":case"?":case":":n.precidence=16,n.associativity=e.expression.operator.rightToLeft;break;case"or":n.precidence=14,n.associativity=e.expression.operator.leftToRight;break;case"and":n.precidence=13,n.associativity=e.expression.operator.leftToRight;break;case"b-or":n.precidence=12,n.associativity=e.expression.operator.leftToRight;break;case"b-xor":n.precidence=11,n.associativity=e.expression.operator.leftToRight;break;case"b-and":n.precidence=10,n.associativity=e.expression.operator.leftToRight;break;case"==":case"!=":n.precidence=9,n.associativity=e.expression.operator.leftToRight;break;case"<":case"<=":case">":case">=":case"not in":case"in":n.precidence=8,n.associativity=e.expression.operator.leftToRight;break;case"~":case"+":case"-":n.precidence=6,n.associativity=e.expression.operator.leftToRight;break;case"//":case"**":case"*":case"/":case"%":n.precidence=5,n.associativity=e.expression.operator.leftToRight;break;case"not":n.precidence=3,n.associativity=e.expression.operator.rightToLeft;break;default:throw new e.Error("Failed to lookup operator: "+t+" is an unknown operator.")}return n.operator=t,n},e.expression.operator.parse=function(n,r){e.log.trace("Twig.expression.operator.parse: ","Handling ",n);var o,i,s;switch("?"===n&&(s=r.pop()),i=r.pop(),"not"!==n&&(o=r.pop()),"in"!==n&&"not in"!==n&&(o&&Array.isArray(o)&&(o=o.length),i&&Array.isArray(i)&&(i=i.length)),n){case":":break;case"?:":e.lib.boolval(o)?r.push(o):r.push(i);break;case"?":void 0===o&&(o=i,i=s,s=void 0),e.lib.boolval(o)?r.push(i):r.push(s);break;case"+":i=parseFloat(i),o=parseFloat(o),r.push(o+i);break;case"-":i=parseFloat(i),o=parseFloat(o),r.push(o-i);break;case"*":i=parseFloat(i),o=parseFloat(o),r.push(o*i);break;case"/":i=parseFloat(i),o=parseFloat(o),r.push(o/i);break;case"//":i=parseFloat(i),o=parseFloat(o),r.push(Math.floor(o/i));break;case"%":i=parseFloat(i),o=parseFloat(o),r.push(o%i);break;case"~":r.push((null!=o?o.toString():"")+(null!=i?i.toString():""));break;case"not":case"!":r.push(!e.lib.boolval(i));break;case"<":r.push(o":r.push(o>i);break;case">=":r.push(o>=i);break;case"===":r.push(o===i);break;case"==":r.push(o==i);break;case"!==":r.push(o!==i);break;case"!=":r.push(o!=i);break;case"or":r.push(e.lib.boolval(o)||e.lib.boolval(i));break;case"b-or":r.push(o|i);break;case"b-xor":r.push(o^i);break;case"and":r.push(e.lib.boolval(o)&&e.lib.boolval(i));break;case"b-and":r.push(o&i);break;case"**":r.push(Math.pow(o,i));break;case"not in":r.push(!t(o,i));break;case"in":r.push(t(o,i));break;case"..":r.push(e.functions.range(o,i));break;default:throw new e.Error("Failed to parse operator: "+n+" is an unknown operator.")}},e}},function(e,t){e.exports=function(e){function t(e,t){var n=Object.prototype.toString.call(t).slice(8,-1);return void 0!==t&&null!==t&&n===e}return e.filters={upper:function(e){return"string"!=typeof e?e:e.toUpperCase()},lower:function(e){return"string"!=typeof e?e:e.toLowerCase()},capitalize:function(e){return"string"!=typeof e?e:e.substr(0,1).toUpperCase()+e.toLowerCase().substr(1)},title:function(e){return"string"!=typeof e?e:e.toLowerCase().replace(/(^|\s)([a-z])/g,function(e,t,n){return t+n.toUpperCase()})},length:function(t){return e.lib.is("Array",t)||"string"==typeof t?t.length:e.lib.is("Object",t)?void 0===t._keys?Object.keys(t).length:t._keys.length:0},reverse:function(e){if(t("Array",e))return e.reverse();if(t("String",e))return e.split("").reverse().join("");if(t("Object",e)){var n=e._keys||Object.keys(e).reverse();return e._keys=n,e}},sort:function(e){if(t("Array",e))return e.sort();if(t("Object",e)){delete e._keys;var n=Object.keys(e),r=n.sort(function(t,n){var r;return e[t]>e[n]==!(e[t]<=e[n])?e[t]>e[n]?1:e[t]e[n].toString()?1:e[t]e[n]?1:e[t].toString()b1?1:r1)throw new e.Error("default filter expects one argument");return void 0===t||null===t||""===t?void 0===n?"":n[0]:t},json_encode:function(n){if(void 0===n||null===n)return"null";if("object"==typeof n&&t("Array",n))return o=[],e.forEach(n,function(t){o.push(e.filters.json_encode(t))}),"["+o.join(",")+"]";if("object"==typeof n){var r=n._keys||Object.keys(n),o=[];return e.forEach(r,function(t){o.push(JSON.stringify(t)+":"+e.filters.json_encode(n[t]))}),"{"+o.join(",")+"}"}return JSON.stringify(n)},merge:function(n,r){var o=[],i=0,s=[];if(t("Array",n)?e.forEach(r,function(e){t("Array",e)||(o={})}):o={},t("Array",o)||(o._keys=[]),t("Array",n)?e.forEach(n,function(e){o._keys&&o._keys.push(i),o[i]=e,i++}):(s=n._keys||Object.keys(n),e.forEach(s,function(e){o[e]=n[e],o._keys.push(e);var t=parseInt(e,10);!isNaN(t)&&t>=i&&(i=t+1)})),e.forEach(r,function(n){t("Array",n)?e.forEach(n,function(e){o._keys&&o._keys.push(i),o[i]=e,i++}):(s=n._keys||Object.keys(n),e.forEach(s,function(e){o[e]||o._keys.push(e),o[e]=n[e];var t=parseInt(e,10);!isNaN(t)&&t>=i&&(i=t+1)}))}),0===r.length)throw new e.Error("Filter merge expects at least one parameter");return o},date:function(t,n){var r=e.functions.date(t),o=n&&n.length?n[0]:"F j, Y H:i";return e.lib.date(o,r)},date_modify:function(t,n){if(void 0!==t&&null!==t){if(void 0===n||1!==n.length)throw new e.Error("date_modify filter expects 1 argument");var r,o=n[0];return e.lib.is("Date",t)&&(r=e.lib.strtotime(o,t.getTime()/1e3)),e.lib.is("String",t)&&(r=e.lib.strtotime(o,e.lib.strtotime(t))),e.lib.is("Number",t)&&(r=e.lib.strtotime(o,t)),new Date(1e3*r)}},replace:function(t,n){if(void 0!==t&&null!==t){var r,o=n[0];for(r in o)o.hasOwnProperty(r)&&"_keys"!==r&&(t=e.lib.replaceAll(t,r,o[r]));return t}},format:function(t,n){if(void 0!==t&&null!==t)return e.lib.vsprintf(t,n)},striptags:function(t){if(void 0!==t&&null!==t)return e.lib.strip_tags(t)},escape:function(t,n){if(void 0!==t&&null!==t){var r="html";if(n&&n.length&&n[0]!==!0&&(r=n[0]),"html"==r){var o=t.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'");return e.Markup(o,"html")}if("js"==r){for(var o=t.toString(),i="",s=0;s"]$/))i+=o[s].replace(/&/g,"&").replace(//g,">").replace(/"/g,""");else{var p=o.charCodeAt(s);i+=p<=31&&9!=p&&10!=p&&13!=p?"�":p<128?e.lib.sprintf("&#x%02s;",p.toString(16).toUpperCase()):e.lib.sprintf("&#x%04s;",p.toString(16).toUpperCase())}return e.Markup(i,"html_attr")}throw new e.Error("escape strategy unsupported")}},e:function(t,n){return e.filters.escape(t,n)},nl2br:function(t){if(void 0!==t&&null!==t){var n="BACKSLASH_n_replace",r="
"+n;return t=e.filters.escape(t).replace(/\r\n/g,r).replace(/\r/g,r).replace(/\n/g,r),t=e.lib.replaceAll(t,n,"\n"),e.Markup(t)}},number_format:function(e,t){var n=e,r=t&&t[0]?t[0]:void 0,o=t&&void 0!==t[1]?t[1]:".",i=t&&void 0!==t[2]?t[2]:",";n=(n+"").replace(/[^0-9+\-Ee.]/g,"");var s=isFinite(+n)?+n:0,p=isFinite(+r)?Math.abs(r):0,a="",c=function(e,t){var n=Math.pow(10,t);return""+Math.round(e*n)/n};return a=(p?c(s,p):""+Math.round(s)).split("."),a[0].length>3&&(a[0]=a[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,i)),(a[1]||"").length=0;i--)if(r.indexOf(o.charAt(i))===-1){o=o.substring(0,i+1);break}return r.indexOf(o.charAt(0))===-1?o:""}},truncate:function(e,t){var n=30,r=!1,o="...";if(e+="",t&&(t[0]&&(n=t[0]),t[1]&&(r=t[1]),t[2]&&(o=t[2])),e.length>n){if(r&&(n=e.indexOf(" ",n),n===-1))return e;e=e.substr(0,n)+o}return e},slice:function(t,n){if(void 0!==t&&null!==t){if(void 0===n||n.length<1)throw new e.Error("slice filter expects at least 1 argument");var r=n[0]||0,o=n.length>1?n[1]:t.length,i=r>=0?r:Math.max(t.length+r,0);if(e.lib.is("Array",t)){for(var s=[],p=i;p2)throw new e.Error("split filter expects 1 or 2 argument");if(e.lib.is("String",t)){var r=n[0],o=n[1],i=t.split(r);if(void 0===o)return i;if(o<0)return t.split(r,i.length+o);var s=[];if(""==r)for(;i.length>0;){for(var p="",a=0;a0;a++)p+=i.shift();s.push(p)}else{for(var a=0;a0;a++)s.push(i.shift());i.length>0&&s.push(i.join(r))}return s}throw new e.Error("split filter expects value to be a string")}},last:function(t){if(e.lib.is("Object",t)){var n;return n=void 0===t._keys?Object.keys(t):t._keys,t[n[n.length-1]]}return t[t.length-1]},raw:function(t){return e.Markup(t)},batch:function(t,n){var r,o,i,s=n.shift(),p=n.shift();if(!e.lib.is("Array",t))throw new e.Error("batch filter expects items to be an array");if(!e.lib.is("Number",s))throw new e.Error("batch filter expects size to be a number");if(s=Math.ceil(s),r=e.lib.chunkArray(t,s),p&&t.length%s!=0){for(o=r.pop(),i=s-o.length;i--;)o.push(p);r.push(o)}return r},round:function(t,n){n=n||[];var r=n.length>0?n[0]:0,o=n.length>1?n[1]:"common";if(t=parseFloat(t),r&&!e.lib.is("Number",r))throw new e.Error("round filter expects precision to be a number");if("common"===o)return e.lib.round(t,r);if(!e.lib.is("Function",Math[o]))throw new e.Error("round filter expects method to be 'floor', 'ceil', or 'common'");return Math[o](t*Math.pow(10,r))/Math.pow(10,r)}},e.filter=function(t,n,r){if(!e.filters[t])throw"Unable to find filter "+t;return e.filters[t].apply(this,[n,r])},e.filter.extend=function(t,n){e.filters[t]=n},e}},function(e,t){e.exports=function(t){var n='Template "{name}" is not defined.';return t.functions={range:function(e,t,n){var r,o,i,s=[],p=n||1,a=!1;if(isNaN(e)||isNaN(t)?isNaN(e)&&isNaN(t)?(a=!0,r=e.charCodeAt(0),o=t.charCodeAt(0)):(r=isNaN(e)?0:e,o=isNaN(t)?0:t):(r=parseInt(e,10),o=parseInt(t,10)),i=!(r>o))for(;r<=o;)s.push(a?String.fromCharCode(r):r),r+=p;else for(;r>=o;)s.push(a?String.fromCharCode(r):r),r-=p;return s},cycle:function(e,t){var n=t%e.length;return e[n]},dump:function(){var e="\n",n=" ",r=0,o="",i=Array.prototype.slice.call(arguments),s=function(e){for(var t="";e>0;)e--,t+=n;return t},p=function(t){o+=s(r),"object"==typeof t?a(t):"function"==typeof t?o+="function()"+e:"string"==typeof t?o+="string("+t.length+') "'+t+'"'+e:"number"==typeof t?o+="number("+t+")"+e:"boolean"==typeof t&&(o+="bool("+t+")"+e)},a=function(t){var n;if(null===t)o+="NULL"+e;else if(void 0===t)o+="undefined"+e;else if("object"==typeof t){o+=s(r)+typeof t,r++,o+="("+function(e){var t,n=0;for(t in e)e.hasOwnProperty(t)&&n++;return n}(t)+") {"+e;for(n in t)o+=s(r)+"["+n+"]=> "+e,p(t[n]);r--,o+=s(r)+"}"+e}else p(t)};return 0==i.length&&i.push(this.context),t.forEach(i,function(e){a(e)}),o},date:function(e,n){var r;if(void 0===e||null===e||""===e)r=new Date;else if(t.lib.is("Date",e))r=e;else if(t.lib.is("String",e))r=e.match(/^[0-9]+$/)?new Date(1e3*e):new Date(1e3*t.lib.strtotime(e));else{if(!t.lib.is("Number",e))throw new t.Error("Unable to parse date "+e);r=new Date(1e3*e)}return r},block:function(e){return this.originalBlockTokens[e]?t.logic.parse.apply(this,[this.originalBlockTokens[e],this.context]).output:this.blocks[e]},parent:function(){return t.placeholders.parent},attribute:function(e,n,r){return t.lib.is("Object",e)&&e.hasOwnProperty(n)?"function"==typeof e[n]?e[n].apply(void 0,r):e[n]:e[n]||void 0},max:function(e){return t.lib.is("Object",e)?(delete e._keys,t.lib.max(e)):t.lib.max.apply(null,arguments)},min:function(e){return t.lib.is("Object",e)?(delete e._keys,t.lib.min(e)):t.lib.min.apply(null,arguments)},template_from_string:function(e){return void 0===e&&(e=""),t.Templates.parsers.twig({options:this.options,data:e})},random:function(e){function n(e){var t=Math.floor(Math.random()*r),n=[0,e],o=Math.min.apply(null,n),i=Math.max.apply(null,n);return o+Math.floor((i-o+1)*t/r)}var r=2147483648;if(t.lib.is("Number",e))return n(e);if(t.lib.is("String",e))return e.charAt(n(e.length-1));if(t.lib.is("Array",e))return e[n(e.length-1)];if(t.lib.is("Object",e)){var o=Object.keys(e);return e[o[n(o.length-1)]]}return n(r-1)},source:function(r,o){var i,s,p,a=!1,c="undefined"!=typeof e&&"undefined"!=typeof e.exports&&"undefined"==typeof window;c?(s="fs",p=__dirname+"/"+r):(s="ajax",p=r);var u={id:r,path:p,method:s,parser:"source",async:!1,fetchTemplateSource:!0};"undefined"==typeof o&&(o=!1);try{i=t.Templates.loadRemote(r,u),"undefined"==typeof i||null===i?i="":a=!0}catch(e){t.log.debug("Twig.functions.source: ","Problem loading template ",e)}return a||o?i:n.replace("{name}",r)}},t._function=function(e,n,r){if(!t.functions[e])throw"Unable to find function "+e;return t.functions[e](n,r)},t._function.extend=function(e,n){t.functions[e]=n},t}},function(e,t,n){e.exports=function(e){return e.lib={},e.lib.sprintf=n(8),e.lib.vsprintf=n(9),e.lib.round=n(10),e.lib.max=n(11),e.lib.min=n(12),e.lib.strip_tags=n(13),e.lib.strtotime=n(14),e.lib.date=n(15),e.lib.boolval=n(16),e.lib.is=function(e,t){var n=Object.prototype.toString.call(t).slice(8,-1);return void 0!==t&&null!==t&&n===e},e.lib.copy=function(e){var t,n={};for(t in e)n[t]=e[t];return n},e.lib.extend=function(e,t){var n,r=Object.keys(t);for(n=r.length;n--;)e[r[n]]=t[r[n]];return e},e.lib.replaceAll=function(e,t,n){return e.split(t).join(n)},e.lib.chunkArray=function(t,n){var r=[],o=0,i=t.length;if(n<1||!e.lib.is("Array",t))return[];for(;o=t?"":new Array(1+t-e.length>>>0).join(n);return r?e+o:o+e},i=function(e,t,n,r,i,s){var p=r-e.length;return p>0&&(e=n||!i?o(e,r,s,n):[e.slice(0,t.length),o("",p,"0",!0),e.slice(t.length)].join("")),e},s=function(e,t,n,r,s,p,a){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+o(c.toString(t),p||0,"0",!1),i(e,n,r,s,a)},p=function(e,t,n,r,o,s){return null!==r&&void 0!==r&&(e=e.slice(0,r)),i(e,"",t,n,o,s)},a=function(e,r,a,c,u,l){var f,h,y,d,g;if("%%"===e)return"%";var m,x=!1,v="",b=!1,w=!1,k=" ",_=a.length;for(m=0;m<_;m++)switch(a.charAt(m)){case" ":v=" ";break;case"+":v="+";break;case"-":x=!0;break;case"'":k=a.charAt(m+1);break;case"0":b=!0,k="0";break;case"#":w=!0}if(c=c?"*"===c?+t[n++]:"*"===c.charAt(0)?+t[c.slice(1,-1)]:+c:0,c<0&&(c=-c,x=!0),!isFinite(c))throw new Error("sprintf: (minimum-)width must be finite");switch(u=u?"*"===u?+t[n++]:"*"===u.charAt(0)?+t[u.slice(1,-1)]:+u:"fFeE".indexOf(l)>-1?6:"d"===l?0:void 0,g=r?t[r.slice(0,-1)]:t[n++],l){case"s":return p(g+"",x,c,u,b,k);case"c":return p(String.fromCharCode(+g),x,c,u,b);case"b":return s(g,2,w,x,c,u,b);case"o":return s(g,8,w,x,c,u,b);case"x":return s(g,16,w,x,c,u,b);case"X":return s(g,16,w,x,c,u,b).toUpperCase();case"u":return s(g,10,w,x,c,u,b);case"i":case"d":return f=+g||0,f=Math.round(f-f%1),h=f<0?"-":v,g=h+o(String(Math.abs(f)),u,"0",!1),i(g,h,x,c,b);case"e":case"E":case"f":case"F":case"g":case"G":return f=+g,h=f<0?"-":v,y=["toExponential","toFixed","toPrecision"]["efg".indexOf(l.toLowerCase())],d=["toString","toUpperCase"]["eEfFgG".indexOf(l)%2],g=h+Math.abs(f)[y](u),i(g,h,x,c,b)[d]();default:return e}};return r.replace(e,a)}},function(e,t,n){"use strict";e.exports=function(e,t){var r=n(8);return r.apply(this,[e].concat(t))}},function(e,t){"use strict";e.exports=function(e,t,n){var r,o,i,s;if(t|=0,r=Math.pow(10,t),e*=r,s=e>0|-(e<0),i=e%1===.5*s,o=Math.floor(e),i)switch(n){case"PHP_ROUND_HALF_DOWN":e=o+(s<0);break;case"PHP_ROUND_HALF_EVEN":e=o+o%2*s;break;case"PHP_ROUND_HALF_ODD":e=o+!(o%2);break;default:e=o+(s>0)}return(i?e:Math.round(e))/r}},function(e,t){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};e.exports=function(){var e,t,r=0,o=0,i=arguments,s=i.length,p=function(e){if("[object Array]"===Object.prototype.toString.call(e))return e;var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t},a=function e(t,r){var o=0,i=0,s=0,a=0,c=0;if(t===r)return 0;if("object"===("undefined"==typeof t?"undefined":n(t))){if("object"===("undefined"==typeof r?"undefined":n(r))){if(t=p(t),r=p(r),c=t.length,a=r.length,a>c)return 1;if(a0?1:-1:r===t?0:r>t?1:-1};if(0===s)throw new Error("At least one value should be passed to max()");if(1===s){if("object"!==n(i[0]))throw new Error("Wrong parameter count for max()");if(e=p(i[0]),0===e.length)throw new Error("Array must contain at least one element for max()")}else e=i;for(t=e[0],r=1,o=e.length;rc)return 1;if(a0?1:-1:r===t?0:r>t?1:-1};if(0===s)throw new Error("At least one value should be passed to min()");if(1===s){if("object"!==n(i[0]))throw new Error("Wrong parameter count for min()");if(e=p(i[0]),0===e.length)throw new Error("Array must contain at least one element for min()")}else e=i;for(t=e[0],r=1,o=e.length;r/g)||[]).join("");var n=/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,r=/|<\?(?:php)?[\s\S]*?\?>/gi;return e.replace(r,"").replace(n,function(e,n){return t.indexOf("<"+n.toLowerCase()+">")>-1?e:""})}},function(e,t){"use strict";e.exports=function(e,t){function n(e,t,n){var r,o=c[t];"undefined"!=typeof o&&(r=o-a.getDay(),0===r?r=7*n:r>0&&"last"===e?r-=7:r<0&&"next"===e&&(r+=7),a.setDate(a.getDate()+r))}function r(e){var t=e.split(" "),r=t[0],o=t[1].substring(0,3),i=/\d+/.test(r),s="ago"===t[2],p=("last"===r?-1:1)*(s?-1:1);if(i&&(p*=parseInt(r,10)),u.hasOwnProperty(o)&&!t[1].match(/^mon(day|\.)?$/i))return a["set"+u[o]](a["get"+u[o]]()+p);if("wee"===o)return a.setDate(a.getDate()+7*p);if("next"===r||"last"===r)n(r,o,p);else if(!i)return!1;return!0}var o,i,s,p,a,c,u,l,f,h,y,d=!1;if(!e)return d;e=e.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var g=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if(i=e.match(g),i&&i[2]===i[4])if(i[1]>1901)switch(i[2]){case"-":return i[3]>12||i[5]>31?d:new Date(i[1],parseInt(i[3],10)-1,i[5],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3;case".":return d;case"/":return i[3]>12||i[5]>31?d:new Date(i[1],parseInt(i[3],10)-1,i[5],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3}else if(i[5]>1901)switch(i[2]){case"-":return i[3]>12||i[1]>31?d:new Date(i[5],parseInt(i[3],10)-1,i[1],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3;case".":return i[3]>12||i[1]>31?d:new Date(i[5],parseInt(i[3],10)-1,i[1],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3;case"/":return i[1]>12||i[3]>31?d:new Date(i[5],parseInt(i[1],10)-1,i[3],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3}else switch(i[2]){case"-":return i[3]>12||i[5]>31||i[1]<70&&i[1]>38?d:(p=i[1]>=0&&i[1]<=38?+i[1]+2e3:i[1],new Date(p,parseInt(i[3],10)-1,i[5],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3);case".":return i[5]>=70?i[3]>12||i[1]>31?d:new Date(i[5],parseInt(i[3],10)-1,i[1],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3:i[5]<60&&!i[6]?i[1]>23||i[3]>59?d:(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),i[1]||0,i[3]||0,i[5]||0,i[9]||0)/1e3):d;case"/":return i[1]>12||i[3]>31||i[5]<70&&i[5]>38?d:(p=i[5]>=0&&i[5]<=38?+i[5]+2e3:i[5],new Date(p,parseInt(i[1],10)-1,i[3],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3);case":":return i[1]>23||i[3]>59||i[5]>59?d:(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),i[1]||0,i[3]||0,i[5]||0)/1e3)}if("now"===e)return null===t||isNaN(t)?(new Date).getTime()/1e3|0:0|t;if(!isNaN(o=Date.parse(e)))return o/1e3|0;if(g=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),i=e.match(g),i&&("z"===i[4]?i[4]="Z":i[4].match(/^([\+-][0-9]{2})$/)&&(i[4]=i[4]+":00"),!isNaN(o=Date.parse(i[1]+"T"+i[2]+i[4]))))return o/1e3|0;if(a=t?new Date(1e3*t):new Date,c={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},u={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},f="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)",h="([+-]?\\d+\\s"+f+"|(last|next)\\s"+f+")(\\sago)?",i=e.match(new RegExp(h,"gi")),!i)return d;for(y=0,l=i.length;y9?-1:0)},Y:function(){return n.getFullYear()},y:function(){return r.Y().toString().slice(-2)},a:function(){return n.getHours()>11?"pm":"am"},A:function(){return r.a().toUpperCase()},B:function(){var e=3600*n.getUTCHours(),t=60*n.getUTCMinutes(),r=n.getUTCSeconds();return p(Math.floor((e+t+r+3600)/86.4)%1e3,3)},g:function(){return r.G()%12||12},G:function(){return n.getHours()},h:function(){return p(r.g(),2)},H:function(){return p(r.G(),2)},i:function(){return p(n.getMinutes(),2)},s:function(){return p(n.getSeconds(),2)},u:function(){return p(1e3*n.getMilliseconds(),6)},e:function(){var e="Not supported (see source code of date() for timezone on how to add support)";throw new Error(e)},I:function(){var e=new Date(r.Y(),0),t=Date.UTC(r.Y(),0),n=new Date(r.Y(),6),o=Date.UTC(r.Y(),6);return e-t!==n-o?1:0},O:function(){var e=n.getTimezoneOffset(),t=Math.abs(e);return(e>0?"-":"+")+p(100*Math.floor(t/60)+t%60,4)},P:function(){var e=r.O();return e.substr(0,3)+":"+e.substr(3,2)},T:function(){return"UTC"},Z:function(){return 60*-n.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(i,s)},r:function(){return"D, d M Y H:i:s O".replace(i,s)},U:function(){return n/1e3|0}};var a=function(e,t){return n=void 0===t?new Date:t instanceof Date?new Date(t):new Date(1e3*t),e.replace(i,s)};return a(e,t)}},function(e,t){"use strict";e.exports=function(e){return e!==!1&&(0!==e&&0!==e&&(""!==e&&"0"!==e&&((!Array.isArray(e)||0!==e.length)&&(null!==e&&void 0!==e))))}},function(e,t){e.exports=function(e){"use strict";e.Templates.registerLoader("ajax",function(t,n,r,o){var i,s,p=n.precompiled,a=this.parsers[n.parser]||this.parser.twig;if("undefined"==typeof XMLHttpRequest)throw new e.Error('Unsupported platform: Unable to do ajax requests because there is no "XMLHTTPRequest" implementation');return s=new XMLHttpRequest,s.onreadystatechange=function(){var c=null;4===s.readyState&&(200===s.status||window.cordova&&0==s.status?(e.log.debug("Got template ",s.responseText),c=p===!0?JSON.parse(s.responseText):s.responseText,n.url=t,n.data=c,i=a.call(this,n),"function"==typeof r&&r(i)):"function"==typeof o&&o(s))},s.open("GET",t,!!n.async),s.send(),!!n.async||i})}},function(e,t,n){e.exports=function(e){"use strict";var t,r;try{t=n(19),r=n(20)}catch(e){}e.Templates.registerLoader("fs",function(n,o,i,s){var p,a=null,c=o.precompiled,u=this.parsers[o.parser]||this.parser.twig;if(!t||!r)throw new e.Error('Unsupported platform: Unable to load from file because there is no "fs" or "path" implementation');var l=function(e,t){return e?void("function"==typeof s&&s(e)):(c===!0&&(t=JSON.parse(t)),o.data=t,o.path=o.path||n,p=u.call(this,o),void("function"==typeof i&&i(p)))};if(o.path=o.path||n,o.async)return t.stat(o.path,function(n,r){return n||!r.isFile()?void("function"==typeof s&&s(new e.Error("Unable to find template file "+o.path))):void t.readFile(o.path,"utf8",l)}),!0;try{if(!t.statSync(o.path).isFile())throw new e.Error("Unable to find template file "+o.path)}catch(t){throw new e.Error("Unable to find template file "+o.path)}return a=t.readFileSync(o.path,"utf8"),l(void 0,a),p})}},function(e,t){},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var o=e[r];"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!o;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,o="/"===s.charAt(0))}return t=n(r(t.split("/"),function(e){return!!e}),!o).join("/"),(o?"/":"")+t||"."},t.normalize=function(e){var o=t.isAbsolute(e),i="/"===s(e,-1);return e=n(r(e.split("/"),function(e){return!!e}),!o).join("/"),e||o||(e="."),e&&i&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var o=r(e.split("/")),i=r(n.split("/")),s=Math.min(o.length,i.length),p=s,a=0;a1)for(var n=1;n=0){if(i=n.split(","),2!==i.length)throw new e.Error("Invalid expression in for loop: "+n);t.key_var=i[0].trim(),t.value_var=i[1].trim()}else t.value_var=n;return t.expression=e.expression.compile.apply(this,[{type:e.expression.type.expression,value:r}]).stack,o&&(t.conditional=e.expression.compile.apply(this,[{type:e.expression.type.expression,value:o}]).stack),delete t.match,t},parse:function(t,n,r){var o,i,s=[],p=0,a=this,c=t.conditional,u=function(e,t){var r=void 0!==c;return{index:e+1,index0:e,revindex:r?void 0:t-e,revindex0:r?void 0:t-e-1,first:0===e,last:r?void 0:e===t-1,length:r?void 0:t,parent:n}},l=function(r,i){var l=e.ChildContext(n);l[t.value_var]=i,t.key_var&&(l[t.key_var]=r),l.loop=u(p,o);var f=void 0===c?e.Promise.resolve(!0):e.expression.parseAsync.apply(a,[c,l]);f.then(function(n){if(n)return e.parseAsync.apply(a,[t.output,l]).then(function(e){s.push(e),p+=1})}).then(function(){delete l.loop,delete l[t.value_var],delete l[t.key_var],e.merge(n,l,!0)})};return e.expression.parseAsync.apply(this,[t.expression,n]).then(function(t){return e.lib.is("Array",t)?(o=t.length,e.async.forEach(t,function(e){var t=p;return l(t,e)})):e.lib.is("Object",t)&&(i=void 0!==t._keys?t._keys:Object.keys(t),o=i.length,e.forEach(i,function(e){"_keys"!==e&&l(e,t[e])})),r=0===s.length,{chain:r,output:e.output.apply(a,[s])}})}},{type:e.logic.type.endfor,regex:/^endfor$/,next:[],open:!1},{type:e.logic.type.set,regex:/^set\s+([a-zA-Z0-9_,\s]+)\s*=\s*([\s\S]+)$/,next:[],open:!0,compile:function(t){var n=t.match[1].trim(),r=t.match[2],o=e.expression.compile.apply(this,[{type:e.expression.type.expression,value:r}]).stack;return t.key=n,t.expression=o,delete t.match,t},parse:function(t,n,r){var o=t.key;return e.expression.parseAsync.apply(this,[t.expression,n]).then(function(t){return t===n&&(t=e.lib.copy(t)),n[o]=t,{chain:r,context:n}})}},{type:e.logic.type.setcapture,regex:/^set\s+([a-zA-Z0-9_,\s]+)$/,next:[e.logic.type.endset],open:!0,compile:function(e){var t=e.match[1].trim();return e.key=t,delete e.match,e},parse:function(t,n,r){var o=this,i=t.key;return e.parseAsync.apply(this,[t.output,n]).then(function(e){return o.context[i]=e,n[i]=e,{chain:r,context:n}})}},{type:e.logic.type.endset,regex:/^endset$/,next:[],open:!1},{type:e.logic.type.filter,regex:/^filter\s+(.+)$/,next:[e.logic.type.endfilter],open:!0,compile:function(t){var n="|"+t.match[1].trim();return t.stack=e.expression.compile.apply(this,[{type:e.expression.type.expression,value:n}]).stack,delete t.match,t},parse:function(t,n,r){return e.parseAsync.apply(this,[t.output,n]).then(function(r){var o=[{type:e.expression.type.string,value:r}].concat(t.stack);return e.expression.parseAsync.apply(that,[o,n])}).then(function(e){return{chain:r,output:e}})}},{type:e.logic.type.endfilter,regex:/^endfilter$/,next:[],open:!1},{type:e.logic.type.block,regex:/^block\s+([a-zA-Z0-9_]+)$/,next:[e.logic.type.endblock],open:!0,compile:function(e){return e.block=e.match[1].trim(),delete e.match,e},parse:function(t,n,r){var o,i=this,s=e.Promise.resolve(),p=e.indexOf(this.importedBlocks,t.block)>-1,a=this.blocks[t.block]&&e.indexOf(this.blocks[t.block],e.placeholders.parent)>-1;return(void 0===this.blocks[t.block]||p||a||n.loop||t.overwrite)&&(s=t.expression?e.expression.parseAsync.apply(this,[t.output,n]).then(function(t){return e.expression.parseAsync.apply(i,[{type:e.expression.type.string,value:t},n])}):e.parseAsync.apply(this,[t.output,n]).then(function(t){return e.expression.parseAsync.apply(i,[{type:e.expression.type.string,value:t},n])}),s=s.then(function(n){p&&i.importedBlocks.splice(i.importedBlocks.indexOf(t.block),1),a?i.blocks[t.block]=e.Markup(i.blocks[t.block].replace(e.placeholders.parent,n)):i.blocks[t.block]=n,i.originalBlockTokens[t.block]={type:t.type,block:t.block,output:t.output,overwrite:!0}})),s.then(function(){return o=i.child.blocks[t.block]?i.child.blocks[t.block]:i.blocks[t.block],{chain:r,output:o}})}},{type:e.logic.type.shortblock,regex:/^block\s+([a-zA-Z0-9_]+)\s+(.+)$/,next:[],open:!0,compile:function(t){return t.expression=t.match[2].trim(),t.output=e.expression.compile({type:e.expression.type.expression,value:t.expression}).stack,t.block=t.match[1].trim(),delete t.match,t},parse:function(t,n,r){return e.logic.handler[e.logic.type.block].parse.apply(this,arguments)}},{type:e.logic.type.endblock,regex:/^endblock(?:\s+([a-zA-Z0-9_]+))?$/,next:[],open:!1},{type:e.logic.type.extends_,regex:/^extends\s+(.+)$/,next:[],open:!0,compile:function(t){var n=t.match[1].trim();return delete t.match,t.stack=e.expression.compile.apply(this,[{type:e.expression.type.expression,value:n}]).stack,t},parse:function(t,n,r){var o,i=this,s=e.ChildContext(n);return e.expression.parseAsync.apply(this,[t.stack,n]).then(function(t){return i.extend=t,o=t instanceof e.Template?t:i.importFile(t),o.renderAsync(s)}).then(function(){return e.lib.extend(n,s),{chain:r,output:""}})}},{type:e.logic.type.use,regex:/^use\s+(.+)$/,next:[],open:!0,compile:function(t){var n=t.match[1].trim();return delete t.match,t.stack=e.expression.compile.apply(this,[{type:e.expression.type.expression,value:n}]).stack,t},parse:function(t,n,r){var o=this;return e.expression.parseAsync.apply(this,[t.stack,n]).then(function(e){return o.importBlocks(e),{chain:r,output:""}})}},{type:e.logic.type.include,regex:/^include\s+(.+?)(?:\s|$)(ignore missing(?:\s|$))?(?:with\s+([\S\s]+?))?(?:\s|$)(only)?$/,next:[],open:!0,compile:function(t){var n=t.match,r=n[1].trim(),o=void 0!==n[2],i=n[3],s=void 0!==n[4]&&n[4].length;return delete t.match,t.only=s,t.ignoreMissing=o,t.stack=e.expression.compile.apply(this,[{type:e.expression.type.expression,value:r}]).stack,void 0!==i&&(t.withStack=e.expression.compile.apply(this,[{type:e.expression.type.expression,value:i.trim()}]).stack),t},parse:function(t,n,r){var o,i,s={},p=this,a=e.Promise.resolve();return t.only||(s=e.ChildContext(n)),void 0!==t.withStack&&(a=e.expression.parseAsync.apply(this,[t.withStack,n]).then(function(e){for(o in e)e.hasOwnProperty(o)&&(s[o]=e[o])})),a.then(function(){return e.expression.parseAsync.apply(p,[t.stack,n])}).then(function(n){if(n instanceof e.Template)i=n;else try{i=p.importFile(n)}catch(e){if(t.ignoreMissing)return"";throw e}return i.renderAsync(s)}).then(function(e){return{chain:r,output:e}})}},{type:e.logic.type.spaceless,regex:/^spaceless$/,next:[e.logic.type.endspaceless],open:!0,parse:function(t,n,r){return e.parseAsync.apply(this,[t.output,n]).then(function(t){var n=/>\s+<").trim();return o=e.Markup(o),{chain:r,output:o}})}},{type:e.logic.type.endspaceless,regex:/^endspaceless$/,next:[],open:!1},{type:e.logic.type.macro,regex:/^macro\s+([a-zA-Z0-9_]+)\s*\(\s*((?:[a-zA-Z0-9_]+(?:,\s*)?)*)\s*\)$/,next:[e.logic.type.endmacro],open:!0,compile:function(t){for(var n=t.match[1],r=t.match[2].split(/[\s,]+/),o=0;o0;)e.logic.extend(e.logic.definitions.shift());return e.logic.compile=function(t){var n=t.value.trim(),r=e.logic.tokenize.apply(this,[n]),o=e.logic.handler[r.type];return o.compile&&(r=o.compile.apply(this,[r]),e.log.trace("Twig.logic.compile: ","Compiled logic token to ",r)),r},e.logic.tokenize=function(t){var n={},r=null,o=null,i=null,s=null,p=null,a=null;t=t.trim();for(r in e.logic.handler)if(e.logic.handler.hasOwnProperty(r))for(o=e.logic.handler[r].type,i=e.logic.handler[r].regex,s=[],i instanceof Array?s=i:s.push(i);s.length>0;)if(p=s.shift(),a=p.exec(t.trim()),null!==a)return n.type=o,n.match=a,e.log.trace("Twig.logic.tokenize: ","Matched a ",o," regular expression of ",a),n;throw new e.Error("Unable to parse '"+t.trim()+"'")},e.logic.parse=function(t,n,r,o){var i,s,p="",a=!0;if(n=n||{},e.log.debug("Twig.logic.parse: ","Parsing logic token ",t),s=e.logic.handler[t.type],s.parse&&(p=s.parse.apply(this,[t,n,r])),i=e.isPromise(p)?p:e.Promise.resolve(p),i.then(function(e){a=!1,p=e}),o)return i||e.Promise.resolve(p);if(a)throw new e.Error("You are using Twig.js in sync mode in combination with async extensions.");return p},e}},function(e,t){e.exports=function(e){"use strict";e.Templates.registerParser("source",function(e){return e.data||""})}},function(e,t){e.exports=function(e){"use strict";e.Templates.registerParser("twig",function(t){return new e.Template(t)})}},function(e,t,n){e.exports=function(e){"use strict";return e.path={},e.path.parsePath=function(t,n){var r=null,n=n||"";if("object"==typeof t&&"object"==typeof t.options&&(r=t.options.namespaces),"object"==typeof r&&n.indexOf("::")>0||n.indexOf("@")>=0){for(var o in r)r.hasOwnProperty(o)&&(n=n.replace(o+"::",r[o]),n=n.replace("@"+o,r[o]));return n}return e.path.relativePath(t,n)},e.path.relativePath=function(t,r){var o,i,s,p="/",a=[],r=r||"";if(t.url)o="undefined"!=typeof t.base?t.base+("/"===t.base.charAt(t.base.length-1)?"":"/"):t.url;else if(t.path){var c=n(20),u=c.sep||p,l=new RegExp("^\\.{1,2}"+u.replace("\\","\\\\"));r=r.replace(/\//g,u),void 0!==t.base&&null==r.match(l)?(r=r.replace(t.base,""),o=t.base+u):o=c.normalize(t.path),o=o.replace(u+u,u),p=u}else{if(!t.name&&!t.id||!t.method||"fs"===t.method||"ajax"===t.method)throw new e.Error("Cannot extend an inline template.");o=t.base||t.name||t.id}for(i=o.split(p),i.pop(),i=i.concat(r.split(p));i.length>0;)s=i.shift(),"."==s||(".."==s&&a.length>0&&".."!=a[a.length-1]?a.pop():a.push(s));return a.join(p)},e}},function(e,t){e.exports=function(e){"use strict";return e.tests={empty:function(e){if(null===e||void 0===e)return!0;if("number"==typeof e)return!1;if(e.length&&e.length>0)return!1;for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},odd:function(e){return e%2===1},even:function(e){return e%2===0},divisibleby:function(e,t){return e%t[0]===0},defined:function(e){return void 0!==e},none:function(e){return null===e},null:function(e){return this.none(e)},"same as":function(e,t){return e===t[0]},sameas:function(t,n){return console.warn("`sameas` is deprecated use `same as`"),e.tests["same as"](t,n)},iterable:function(t){return t&&(e.lib.is("Array",t)||e.lib.is("Object",t))}},e.test=function(t,n,r){if(!e.tests[t])throw"Test "+t+" is not defined.";return e.tests[t](n,r)},e.test.extend=function(t,n){e.tests[t]=n},e}},function(e,t){e.exports=function(e){"use strict";return e.parseAsync=function(t,n){return e.parse.apply(this,[t,n,!0])},e.expression.parseAsync=function(t,n,r){return e.expression.parse.apply(this,[t,n,r,!0])},e.logic.parseAsync=function(t,n,r){return e.logic.parse.apply(this,[t,n,r,!0])},e.Template.prototype.renderAsync=function(e,t){return this.render(e,t,!0)},e.async={},e.isPromise=function(e){return e&&"function"==typeof e.then},e.Promise=function(t){function n(e,t){c=e,u=t,i()}function r(e){n("resolve",e)}function o(e){n("reject",e)}function i(){l&&(e.forEach(l,function(e){s(e.resolve,e.reject)}),l=null)}function s(e,t){var n={resolve:e,reject:t};return"unknown"==c?(l=l||[],l.push(n)):void(n[c]&&n[c](u))}function p(e,t,n){var r=!1;try{e(function(e){r||(r=!0,t(e))},function(e){r||(r=!0,n(e))})}catch(e){r=!0,n(e)}}function a(t){try{if(!e.isPromise(t))return r(t);p(t.then.bind(t),a,o)}catch(e){o(e)}}var c="unknown",u=null,l=null;return p(t,a,o),{then:function(t,n){var r="function"==typeof t,o="function"==typeof n;return new e.Promise(function(e,i){s(function(n){if(r)try{e(t(n))}catch(e){i(e)}else e(n)},function(t){if(o)try{e(n(t))}catch(e){i(e)}else i(t)})})},catch:function(e){return this.then(null,e)}}},e.Promise.resolve=function(t){return new e.Promise(function(e){e(t)})},e.Promise.reject=function(t){return new e.Promise(function(e,n){n(t)})},e.Promise.all=function(t){var n=[];return e.async.forEach(t,function(t,r){return e.isPromise(t)?t.then(function(e){n[r]=e}):void(n[r]=t)}).then(function(){return n})},e.async.forEach=function(t,n){function r(e){p.reject(e)}function o(t){return e.isPromise(t)?void t.then(o,r):i()}function i(){var e=s++;return e==t.length?void p.resolve():void o(n(t[e],e))}var s=0,p={},a=new e.Promise(function(e,t){p={resolve:e,reject:t}});return i(),a},e}},function(e,t){e.exports=function(e){"use strict";return e.exports={VERSION:e.VERSION},e.exports.twig=function(t){var n=t.id,r={strict_variables:t.strict_variables||!1,autoescape:null!=t.autoescape&&t.autoescape||!1,allowInlineIncludes:t.allowInlineIncludes||!1,rethrow:t.rethrow||!1,namespaces:t.namespaces};if(e.cache&&n&&e.validateId(n),void 0!==t.debug&&(e.debug=t.debug),void 0!==t.trace&&(e.trace=t.trace),void 0!==t.data)return e.Templates.parsers.twig({data:t.data,path:t.hasOwnProperty("path")?t.path:void 0,module:t.module,id:n,options:r});if(void 0!==t.ref){if(void 0!==t.id)throw new e.Error("Both ref and id cannot be set on a twig.js template.");return e.Templates.load(t.ref)}if(void 0!==t.method){if(!e.Templates.isRegisteredLoader(t.method))throw new e.Error('Loader for "'+t.method+'" is not defined.');return e.Templates.loadRemote(t.name||t.href||t.path||n||void 0,{id:n,method:t.method,parser:t.parser||"twig",base:t.base,module:t.module,precompiled:t.precompiled,async:t.async,options:r},t.load,t.error)}return void 0!==t.href?e.Templates.loadRemote(t.href,{id:n,method:"ajax",parser:t.parser||"twig",base:t.base,module:t.module,precompiled:t.precompiled,async:t.async,options:r},t.load,t.error):void 0!==t.path?e.Templates.loadRemote(t.path,{id:n,method:"fs",parser:t.parser||"twig",base:t.base,module:t.module,precompiled:t.precompiled,async:t.async,options:r},t.load,t.error):void 0},e.exports.extendFilter=function(t,n){e.filter.extend(t,n)},e.exports.extendFunction=function(t,n){e._function.extend(t,n)},e.exports.extendTest=function(t,n){e.test.extend(t,n)},e.exports.extendTag=function(t){e.logic.extend(t)},e.exports.extend=function(t){t(e)},e.exports.compile=function(t,n){var r,o=n.filename,i=n.filename;return r=new e.Template({data:t,path:i,id:o,options:n.settings["twig options"]}),function(e){return r.render(e)}},e.exports.renderFile=function(t,n,r){"function"==typeof n&&(r=n,n={}),n=n||{};var o=n.settings||{},i={path:t,base:o.views,load:function(e){r(null,""+e.render(n))}},s=o["twig options"];if(s)for(var p in s)s.hasOwnProperty(p)&&(i[p]=s[p]);e.exports.twig(i)},e.exports.__express=e.exports.renderFile,e.exports.cache=function(t){e.cache=t},e.exports.path=e.path,e.exports.filters=e.filters,e}}])});