function render(a,b){if("string"!=typeof a)throw new TypeError('Invalid template! Template should be a "string" but "'+Object.prototype.toString.call(a)+'" was given as the first argument for #render(template, view)');a=a.replace(/\n[^\S\n]*{{\s*(\^|#|\/)\s*(.+?)\s*}}[^\S\n]*(?=\n)/g,function(a,b,c,d,e){return"{{"+b+c+"}}"});for(var f,c=/{{(\^|#)(.+?)}}([^]+?){{\/\2}}/g,d=c.lastIndex=0,e="";f=c.exec(a);){var g=f[2],h=f[1],i=f[3],j=a.substring(d,f.index);e+=renderSingleSection(j,b);var k=evalProp(b,g);if("#"===h&&k){var l=Object.prototype.toString.call(k);"[object Array]"===l?k.forEach(function(a){e+=render(i,a)}):"[object Object]"===l?(k.parent=b,e+=render(i,k)):e+="[object Function]"===l?k.call(b,i,function(a){return renderSingleSection(a,b)}):render(i,b)}else"^"!==h||k||(e+=render(i,b));d=c.lastIndex}return e+=renderSingleSection(a.substring(d),b)}function renderSingleSection(a,b){var f,c=/{{{\s*(.+?)\s*}}}|{{&\s*(.+?)\s*}}|{{\s*(.+?)\s*}}/g,d=c.lastIndex=0,e="";for(a=a;f=c.exec(a);){e+=a.substring(d,f.index);var g=f[1]||f[2]||f[3],h=f[3],i=evalProp(b,g);void 0!==i&&null!==i&&(e+=h?escapeHtml(""+i):i),d=c.lastIndex}return e+=a.substring(d)}function evalProp(a,b){for(var e,c=a,d=!1;e=c;){if("."!==(b=b.trim()))for(var f=b.split("."),g=0;g<f.length;++g){var h=f[g].trim();if(g===f.length-1&&(d="object"==typeof e&&h in e),void 0===(e=e[h])||null===e)break}else d=!0;if(d)break;c=c.parent}return"function"==typeof e?e.call(a):e}function escapeHtml(a){return String(a).replace(/[&<>"'`=\/]/g,function(b){return entityMap[b]})}var entityMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};
function render(a,b){if("string"!=typeof a)throw new TypeError('Invalid template! Template should be a "string" but "'+Object.prototype.toString.call(a)+'" was given as the first argument for #render(template, view)');a=a.replace(/\n[^\S\n]*{{\s*(!|\^|#|\/)\s*(.+?)\s*}}[^\S\n]*(?=\n)/g,function(a,b,c,d,e){return"{{"+b+c+"}}"});for(var f,c=/{{(\^|#)(.+?)}}([^]+?){{\/\2}}/g,d=c.lastIndex=0,e="";f=c.exec(a);){var g=f[2],h=f[1],i=f[3],j=a.substring(d,f.index);e+=renderSingleSection(j,b);var k=evalProp(b,g);if("#"===h&&k){var l=Object.prototype.toString.call(k);"[object Array]"===l?k.forEach(function(a){e+=render(i,a)}):"[object Object]"===l?(k.parent=b,e+=render(i,k)):e+="[object Function]"===l?k.call(b,i,function(a){return renderSingleSection(a,b)}):render(i,b)}else"^"!==h||k||(e+=render(i,b));d=c.lastIndex}return e+=renderSingleSection(a.substring(d),b)}function renderSingleSection(a,b){var f,c=/{{{%(.+?)%}}}|{{{\s*(.+?)\s*}}}|{{&\s*(.+?)\s*}}|{{%(.+?)%}}|{{\s*(.+?)\s*}}/g,d=c.lastIndex=0,e="";for(a=a;f=c.exec(a);){e+=a.substring(d,f.index);var g=f[1]||f[2]||f[3]||f[4]||f[5],h=f[5]||f[4],i=f[1]||f[4]||evalProp(b,g);void 0!==i&&null!==i&&(e+=h?escapeHtml(""+i):i),d=c.lastIndex}return e+=a.substring(d)}function evalProp(a,b){for(var e,c=a,d=!1;e=c;){if("."!==(b=b.trim()))for(var f=b.split("."),g=0;g<f.length;++g){var h=f[g].trim();if(g===f.length-1&&(d="object"==typeof e&&h in e),void 0===(e=e[h])||null===e)break}else d=!0;if(d)break;c=c.parent}return"function"==typeof e?e.call(a):e}function escapeHtml(a){return String(a).replace(/[&<>"'`=\/]/g,function(b){return entityMap[b]})}var entityMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};
update minified version