/**
* Template7 1.2.5
* Mobile-first HTML template engine
*
* http://www.idangero.us/template7/
*
* Copyright 2017, Vladimir Kharlampidi
* The iDangero.us
* http://www.idangero.us/
*
* Licensed under MIT
*
* Released on: August 2, 2017
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Template7=t()}(this,function(){"use strict";function e(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.apply(e)}function t(e){return"function"==typeof e}function r(e){return(void 0!==f&&f.escape?f.escape(e):e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function n(e){var t,r,n,i=e.replace(/[{}#}]/g,"").split(" "),a=[];for(r=0;r=0){t=n,a.push(o);break}t&&(r=t)}else if(o.indexOf("=")>0){var c=o.split("="),u=c[0],h=c[1];if(l||(l=0===h.indexOf('"')?s:p,f=0===h.indexOf('"')?'"':"'"),2!==h.match(l).length){for(t=0,n=r+1;n=0){t=n;break}t&&(r=t)}var d=[u,h.replace(l,"")];a.push(d)}else a.push(o)}return a}function i(t){var r,i,a=[];if(!t)return[];var o=t.split(/({{[^{^}]*}})/);for(r=0;r=0)continue;if(l.indexOf("{#")<0&&l.indexOf(" ")<0&&l.indexOf("else")<0){a.push({type:"variable",contextName:l.replace(/[{}]/g,"")});continue}var f=n(l),p=f[0],s=">"===p,c=[],u={};for(i=1;i=0){var d="",v="",g=0,x=void 0,y=!1,O=!1,m=0;for(i=r+1;i=0&&(m+=1),o[i].indexOf("{{/")>=0&&(m-=1),o[i].indexOf("{{#"+p)>=0)d+=o[i],O&&(v+=o[i]),g+=1;else if(o[i].indexOf("{{/"+p)>=0){if(!(g>0)){x=i,y=!0;break}g-=1,d+=o[i],O&&(v+=o[i])}else o[i].indexOf("else")>=0&&0===m?O=!0:(O||(d+=o[i]),O&&(v+=o[i]));y&&(x&&(r=x),a.push({type:"helper",helperName:p,contextName:c,content:d,inverseContent:v,hash:u}))}else l.indexOf(" ")>0&&(s&&(p="_partial",c[0]&&(c[0]='"'+c[0].replace(/"|'/g,"")+'"')),a.push({type:"helper",helperName:p,contextName:c,hash:u}))}}return a}function a(e,t,r){return e.split(/([+ -*\/^])/g).map(function(e){if(e.indexOf(t)<0)return e;if(!r)return JSON.stringify("");var n=r;return e.indexOf(t+".")>=0&&e.split(t+".")[1].split(".").forEach(function(e){n=n[e]?n[e]:"undefined"}),JSON.stringify(n)}).join("")}function o(e,t){return e.split(/([+ -*^])/g).map(function(e){if(e.indexOf("../")<0)return e;if(!t||0===t.length)return JSON.stringify("");var r=e.split("../").length-1,n=r>t.length?t[t.length-1]:t[r-1],i=n;return e.replace(/..\//g,"").split(".").forEach(function(e){i=i[e]?i[e]:"undefined"}),JSON.stringify(i)}).join("")}function l(e,t){if(2===arguments.length){var r=new c(e),n=r.compile()(t);return r=null,n}return new c(e)}var f;f="undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;var p=new RegExp("'","g"),s=new RegExp('"',"g"),c=function(e){function t(e,t,r){void 0===r&&(r="data_1");var n,i,a=t,o=0;0===e.indexOf("../")?(o=e.split("../").length-1,i=a.split("_")[1]-o,a="ctx_"+(i>=1?i:1),n=e.split("../")[o].split(".")):0===e.indexOf("@global")?(a="Template7.global",n=e.split("@global.")[1].split(".")):0===e.indexOf("@root")?(a="root",n=e.split("@root.")[1].split(".")):n=e.split(".");for(var l=0;l0&&(p=i),l>0?a+="[(data_"+p+" && data_"+p+"."+f.replace("@","")+")]":a="(data_"+p+" && data_"+p+"."+f.replace("@","")+")"}else isFinite(f)?a+="["+f+"]":"this"===f||f.indexOf("this.")>=0||f.indexOf("this[")>=0||f.indexOf("this(")>=0?a=f.replace("this",t):a+="."+f}return a}function r(e,r,n){for(var i=[],a=0;a=1;b-=1)m+=", ctx_"+b;y="["+m+"]"}else y="["+c+"]";if(v.helperName in a.helpers)x=r(v.contextName,c,u),h+="r += (Template7.helpers."+v.helperName+").call("+c+", "+(x&&x+", ")+"{hash:"+JSON.stringify(v.hash)+", data: "+u+" || {}, fn: "+l(v,o+1)+", inverse: "+p(v,o+1)+", root: root, parents: "+y+"});";else{if(v.contextName.length>0)throw new Error('Template7: Missing helper: "'+v.helperName+'"');g=t(v.helperName,c,u),h+="if ("+g+") {",h+="if (isArray("+g+")) {",h+="r += (Template7.helpers.each).call("+c+", "+g+", {hash:"+JSON.stringify(v.hash)+", data: "+u+" || {}, fn: "+l(v,o+1)+", inverse: "+p(v,o+1)+", root: root, parents: "+y+"});",h+="}else {",h+="r += (Template7.helpers.with).call("+c+", "+g+", {hash:"+JSON.stringify(v.hash)+", data: "+u+" || {}, fn: "+l(v,o+1)+", inverse: "+p(v,o+1)+", root: root, parents: "+y+"});",h+="}}"}}}else h+="r +='"+v.content.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/'/g,"\\'")+"';"}return h+="\nreturn r;})",eval.call(f,h)}var a=this;a.template=e,a.compile=function(e){return a.compiled||(a.compiled=n(e)),a.compiled}};return c.prototype={options:{},partials:{},helpers:{_partial:function(e,t){var r=c.prototype.partials[e];if(!r||r&&!r.template)return"";r.compiled||(r.compiled=new c(r.template).compile());var n=this;for(var i in t.hash)n[i]=t.hash[i];return r.compiled(n,t.data,t.root)},escape:function(e,t){if("string"!=typeof e)throw new Error('Template7: Passed context to "escape" helper should be a string');return r(e)},if:function(e,r){var n=e;return t(n)&&(n=n.call(this)),n?r.fn(this,r.data):r.inverse(this,r.data)},unless:function(e,r){var n=e;return t(n)&&(n=n.call(this)),n?r.inverse(this,r.data):r.fn(this,r.data)},each:function(r,n){var i=r,a="",o=0;if(t(i)&&(i=i.call(this)),e(i)){for(n.hash.reverse&&(i=i.reverse()),o=0;o0?a:n.inverse(this)},with:function(e,r){var n=e;return t(n)&&(n=e.call(this)),r.fn(n)},join:function(e,r){var n=e;return t(n)&&(n=n.call(this)),n.join(r.hash.delimiter||r.hash.delimeter)},js:function(e,t){var r,n=t.data,i=e;return"index first last key".split(" ").forEach(function(e){if(void 0!==n[e]){var t=new RegExp("this.@"+e,"g"),r=new RegExp("@"+e,"g");i=i.replace(t,JSON.stringify(n[e])).replace(r,JSON.stringify(n[e]))}}),t.root&&i.indexOf("@root")>=0&&(i=a(i,"@root",t.root)),i.indexOf("@global")>=0&&(i=a(i,"@global",f.Template7.global)),i.indexOf("../")>=0&&(i=o(i,t.parents)),r=i.indexOf("return")>=0?"(function(){"+i+"})":"(function(){return ("+i+")})",eval.call(this,r).call(this)},js_if:function(e,t){var r,n=t.data,i=e;return"index first last key".split(" ").forEach(function(e){if(void 0!==n[e]){var t=new RegExp("this.@"+e,"g"),r=new RegExp("@"+e,"g");i=i.replace(t,JSON.stringify(n[e])).replace(r,JSON.stringify(n[e]))}}),t.root&&i.indexOf("@root")>=0&&(i=a(i,"@root",t.root)),i.indexOf("@global")>=0&&(i=a(i,"@global",c.global)),i.indexOf("../")>=0&&(i=o(i,t.parents)),r=i.indexOf("return")>=0?"(function(){"+i+"})":"(function(){return ("+i+")})",eval.call(this,r).call(this)?t.fn(this,t.data):t.inverse(this,t.data)}}},c.prototype.helpers.js_compare=c.prototype.helpers.js_if,l.registerHelper=function(e,t){c.prototype.helpers[e]=t},l.unregisterHelper=function(e){c.prototype.helpers[e]=void 0,delete c.prototype.helpers[e]},l.registerPartial=function(e,t){c.prototype.partials[e]={template:t}},l.unregisterPartial=function(e){c.prototype.partials[e]&&(c.prototype.partials[e]=void 0,delete c.prototype.partials[e])},l.compile=function(e,t){return new c(e,t).compile()},l.options=c.prototype.options,l.helpers=c.prototype.helpers,l.partials=c.prototype.partials,l});
//# sourceMappingURL=template7.min.js.map