Files
liquidjs/dist/liquid.min.js
T
2018-08-21 01:18:13 +08:00

3 lines
43 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Liquid=t()}(this,function(){"use strict";var M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Q=function(e){return function(){var u=e.apply(this,arguments);return new Promise(function(o,a){return function t(e,r){try{var n=u[e](r),i=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(i).then(function(e){t("next",e)},function(e){t("throw",e)});o(i)}("next")})}},f=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t};!function(e){var s,t=Object.prototype,c=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag",a="object"===("undefined"==typeof module?"undefined":M(module)),u=e.regeneratorRuntime;if(u)a&&(module.exports=u);else{(u=e.regeneratorRuntime=a?module.exports:{}).wrap=w;var l="suspendedStart",p="suspendedYield",h="executing",g="completed",d={},f={};f[i]=function(){return this};var v=Object.getPrototypeOf,m=v&&v(v(j([])));m&&m!==t&&c.call(m,i)&&(f=m);var y=E.prototype=b.prototype=Object.create(f);k.prototype=y.constructor=E,E.constructor=k,E[o]=k.displayName="GeneratorFunction",u.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===k||"GeneratorFunction"===(t.displayName||t.name))},u.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,o in e||(e[o]="GeneratorFunction")),e.prototype=Object.create(y),e},u.awrap=function(e){return{__await:e}},T(_.prototype),_.prototype[n]=function(){return this},u.AsyncIterator=_,u.async=function(e,t,r,n){var i=new _(w(e,t,r,n));return u.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},T(y),y[o]="Generator",y[i]=function(){return this},y.toString=function(){return"[object Generator]"},u.keys=function(r){var n=[];for(var e in r)n.push(e);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},u.values=j,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=s,this.done=!1,this.delegate=null,this.method="next",this.arg=s,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&c.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=s)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function e(e,t){return o.type="throw",o.arg=r,n.next=e,t&&(n.method="next",n.arg=s),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var i=this.tryEntries[t],o=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var a=c.call(i,"catchLoc"),u=c.call(i,"finallyLoc");if(a&&u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&c.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:j(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=s),d}}}function w(e,t,r,n){var o,a,u,s,i=t&&t.prototype instanceof b?t:b,c=Object.create(i.prototype),f=new L(n||[]);return c._invoke=(o=e,a=r,u=f,s=l,function(e,t){if(s===h)throw new Error("Generator is already running");if(s===g){if("throw"===e)throw t;return P()}for(u.method=e,u.arg=t;;){var r=u.delegate;if(r){var n=R(r,u);if(n){if(n===d)continue;return n}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if(s===l)throw s=g,u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);s=h;var i=x(o,a,u);if("normal"===i.type){if(s=u.done?g:p,i.arg===d)continue;return{value:i.arg,done:u.done}}"throw"===i.type&&(s=g,u.method="throw",u.arg=i.arg)}}),c}function x(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function b(){}function k(){}function E(){}function T(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function _(s){var t;this._invoke=function(r,n){function e(){return new Promise(function(e,t){!function t(e,r,n,i){var o=x(s[e],s,r);if("throw"!==o.type){var a=o.arg,u=a.value;return u&&"object"===(void 0===u?"undefined":M(u))&&c.call(u,"__await")?Promise.resolve(u.__await).then(function(e){t("next",e,n,i)},function(e){t("throw",e,n,i)}):Promise.resolve(u).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,i)})}i(o.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}}function R(e,t){var r=e.iterator[t.method];if(r===s){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=s,R(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=x(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,d;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=s),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function j(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(c.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=s,e.done=!0,e};return n.next=n}}return{next:P}}function P(){return{value:s,done:!0}}}(function(){return this||"object"===("undefined"==typeof self?"undefined":M(self))&&self}()||Function("return this")());var t=Object.prototype.toString;function Z(e){return"[object String]"===t.call(e)}function o(e){if(n(e))return String(e);if("function"==typeof e.to_liquid)return o(e.to_liquid());if("function"==typeof e.toLiquid)return o(e.toLiquid());if(Z(e))return e;var r=[];return JSON.stringify(e,function(e,t){if(te(t)){if(-1!==r.indexOf(t))return;r.push(t)}return t})}function ee(e){return Object.create(e)}function n(e){return null==e}function a(e){return"[object Array]"===t.call(e)}function m(t){return t=te(t)?t:{},Array.prototype.slice.call(arguments,1).forEach(function(e){return Object.assign(t,e)}),t}function y(e){return e[e.length-1]}function te(e){var t=void 0===e?"undefined":M(e);return null!=e&&("object"===t||"function"===t)}var e=new RegExp(/'[^']*'/.source+"|"+/"[^"]*"/.source),p=new RegExp("(?:"+e.source+"|[^'\"])*"),r=/-?\d+\.?\d*|\.?\d+/,u=/true|false/,re=/[\w-]+[?]?/,s=new RegExp("\\[(?:"+e.source+"|[\\w-\\.]+)\\]"),c=new RegExp("(?:"+e.source+"|"+u.source+"|"+r.source+")"),h=new RegExp(re.source+"(?:\\."+re.source+"|"+s.source+")*"),g=new RegExp("(?:"+h.source+"|"+r.source+")"),d=new RegExp("\\("+g.source+"\\.\\."+g.source+"\\)"),v=new RegExp("\\(("+g.source+")\\.\\.("+g.source+")\\)"),ne=new RegExp("(?:"+h.source+"|"+c.source+"|"+d.source+")"),ie=new RegExp("(?:"+re.source+")\\s*:\\s*(?:"+ne.source+")"),w=new RegExp("("+re.source+")\\s*:\\s*("+ne.source+")","g"),x=new RegExp("^\\s*("+re.source+")\\s*([\\s\\S]*)\\s*$"),b=new RegExp("^"+c.source+"$","i"),k=new RegExp("^"+h.source+"$"),E=new RegExp("^"+r.source+"$"),T=new RegExp("^"+u.source+"$","i"),oe=new RegExp("^"+e.source+"$"),_=new RegExp("^"+v.source+"$"),R=new RegExp("^"+/-?\d+/.source+"$"),S=new RegExp("(?:"+re.source+"\\s*:\\s*)?"+ne.source),O=new RegExp(S.source+"(\\s*,\\s*"+S.source+")*"),L=new RegExp(re.source+"(?:\\s*:\\s*"+O.source+")?","g"),j=new RegExp("("+re.source+")(?:\\s*:\\s*("+O.source+"))?"),P=new RegExp("^"+j.source+"$"),F=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/];var A=function(e){function r(e){f(this,r);var t=l(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));return t.name=t.constructor.name,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(t,t.constructor):t.stack=new Error(e).stack,t}return i(r,e),r}(Error),C=function(e){function c(e,t){f(this,c);var r=l(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));r.input=t.input,r.line=t.line,r.file=t.file,r.message=function(e,t){e=e||"",t.file&&(e+=", file:"+t.file);t.line&&(e+=", line:"+t.line);return e}(e.message,t);var n,i,o,a,u,s=(n=t.input,i=t.line,o=n.split("\n"),a=Math.max(i-2,1),u=Math.min(i+3,o.length),function(e,t,r){1===arguments.length&&(t=e,e=0),r=r||1;for(var n=[],i=e;i<t;i+=r)n.push(i);return n}(a,u+1).map(function(e){return[e===i?">> ":" ",(t=e,r=u,n=t+"",Array((r+"").length-n.length).join(" ")+n),"| ",o[e-1]].join("");var t,r,n}).join("\n"));return r.stack=s+"\n"+(r.stack||r.message)+(e.stack?"\nFrom "+e.stack:""),r}return i(c,A),c}(),D=function(e){function r(e,t){return f(this,r),l(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,{message:e},t))}return i(r,C),r}(),I=function(e){function n(e,t){f(this,n);var r=l(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return m(r,e),r.originalError=e,r}return i(n,C),n}(),q=function(e){function n(e,t){if(f(this,n),e instanceof n)return l(r,e);var r=l(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t.token));return m(r,e),r.originalError=e,r}return i(n,C),n}(),V=function(e){function t(e){return f(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e+""))}return i(t,A),t}(),$=function(e){function t(e){return f(this,t),l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e+""))}return i(t,A),t}();function ae(e,t){if(!e)throw new $(t=t||"expect "+e+" to be true")}var N={getAll:function(){return this.contexts.reduce(function(e,t){return m(e,t)},ee(null))},get:function(e){var r=this,t=this.propertyAccessSeq(e),n=this.findContextFor(t[0])||y(this.contexts);return t.reduce(function(e,t){return r.readProperty(e,t)},n)},set:function(e,r){var n=this.propertyAccessSeq(e),i=this.findContextFor(n[0])||y(this.contexts);n.some(function(e,t){return!te(i)||(t===n.length-1?(i[e]=r,!0):(void 0===i[e]&&(i[e]={}),void(i=i[e])))})},unshift:function(e){return this.contexts.unshift(e)},push:function(e){return this.contexts.push(e)},pop:function(t){if(!arguments.length)return this.contexts.pop();var e=this.contexts.findIndex(function(e){return e===t});if(-1===e)throw new TypeError("scope not found, cannot pop");return this.contexts.splice(e,1)[0]},findContextFor:function(e,t){t=t||function(){return!0};for(var r=this.contexts.length-1;0<=r;r--){var n=this.contexts[r];if(t(n)&&e in n)return n}return null},readProperty:function(e,t){var r=void 0;if(n(e)?r=void 0:("function"==typeof e.to_liquid?e=e.to_liquid():"function"==typeof e.toLiquid&&(e=e.toLiquid()),r="size"===t&&(a(e)||Z(e))?e.length:e[t]),n(r)&&this.opts.strict_variables)throw new TypeError("undefined variable: "+t);return r},propertyAccessSeq:function(e){e=String(e);for(var t,r=[],n="",i=void 0,o=0;o<e.length;)switch(e[o]){case"[":u();var a=e[o+1];/['"]/.test(a)?(ae(-1!==(i=e.indexOf(a,o+2)),"unbalanced "+a+": "+e),n=e.slice(o+2,i),u(),o=i+2):(ae(-1!==(i=Y(e,o+1)),"unbalanced []: "+e),n=e.slice(o+1,i),t=n,R.test(t)||(n=this.get(n)),u(),o=i+1);break;case".":u(),o++;break;default:n+=e[o],o++}if(u(),!r.length)throw new TypeError('invalid path:"'+e+'"');return r;function u(){n.length&&r.push(n),n=""}}};function Y(e,t){for(var r=1,n=t;n<e.length;n++)if("["===e[n]&&r++,"]"===e[n]&&0===--r)return n;return-1}function H(n){return new Promise(function(e,t){var r=new XMLHttpRequest;r.onload=function(){200<=r.status&&r.status<300?e(r.responseText):t(new Error(r.statusText))},r.onerror=function(){t(new Error("An error occurred whilst sending the response."))},r.open("GET",n),r.send()})}function G(o,a,e){ae(Z(o),"illegal input");for(var r,n,i,t,u,s,c,f=/({%-?([\s\S]*?)-?%})|({{-?([\s\S]*?)-?}})/g,l=0,p=(r=o,n=0,i=-1,{get:function(e){var t=r.slice(i+1,e).split("\n");return n+=t.length-1,i=e,n+1}}),h=0,g=[];t=f.exec(o);h=f.lastIndex)t.index>h&&g.push(v(h,t.index)),g.push(t[1]?d(t[1],t[2].trim(),t.index):(u=t[3],s=t[4].trim(),c=t.index,{type:"value",line:p.get(c),trim_left:"{{-"===u.slice(0,3),trim_right:"-}}"===u.slice(-3),raw:u,value:s,input:o,file:a}));return o.length>h&&g.push(v(h,o.length)),function(a,u){u=m({greedy:!0},u);var s=!1;a.forEach(function(e,t){var r,n,i,o;i=e,o=u,!s&&("tag"===i.type?i.trim_left||o.trim_tag_left:"value"===i.type?i.trim_left||o.trim_value_left:void 0)&&function(e,t){if(e&&"html"===e.type){var r=t?/\s+$/g:/[\t\r ]*$/g;e.value=e.value.replace(r,"")}}(a[t-1],u.greedy),"tag"===e.type&&"raw"===e.name&&(s=!0),"tag"===e.type&&"endraw"===e.name&&(s=!1),r=e,n=u,!s&&("tag"===r.type?r.trim_right||n.trim_tag_right:"value"===r.type?r.trim_right||n.trim_value_right:void 0)&&function(e,t){if(e&&"html"===e.type){var r=t?/^\s+/g:/^[\t\r ]*\n?/g;e.value=e.value.replace(r,"")}}(a[t+1],u.greedy)})}(g,e),g;function d(e,t,r){var n=t.match(x),i={type:"tag",indent:l,line:p.get(r),trim_left:"{%-"===e.slice(0,3),trim_right:"-%}"===e.slice(-3),raw:e,value:t,input:o,file:a};if(!n)throw new D("illegal tag syntax",i);return i.name=n[1],i.args=n[2],i}function v(e,t){var r=o.slice(e,t);return l=y(r.split("\n")).length,{type:"html",raw:r,value:r}}}var z={};function U(e){return new Promise(function(r,n){z.readFile(e,"utf8",function(e,t){e?n(e):r(t)})})}function B(e){return new Promise(function(r,n){z.stat(e,function(e,t){return e?n(e):r(t)})})}var W={},J=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/,X=/^(?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)\S*$/;function K(e,t){return a(e)&&(e=e[0]),e&&"/"!==y(e)&&(e+="/"),function(e,t){var r=document.createElement("base");r.href=e;var n=document.getElementsByTagName("head")[0];n.insertBefore(r,n.firstChild);var i=document.createElement("a");i.href=t;var o=i.href;return r.href=o,n.removeChild(r),o}(e,t)}var ue,se=(ue=le,{"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},">":function(e,t){return null!==e&&null!==t&&t<e},"<":function(e,t){return null!==e&&null!==t&&e<t},">=":function(e,t){return null!==e&&null!==t&&t<=e},"<=":function(e,t){return null!==e&&null!==t&&e<=t},contains:function(e,t){return!!e&&"function"==typeof e.indexOf&&-1<e.indexOf(t)},and:function(e,t){return ue(e)&&ue(t)},or:function(e,t){return ue(e)||ue(t)}});function ce(e,t){ae(t,"unable to evalExp: scope undefined");for(var r=F,n=void 0,i=0;i<r.length;i++){var o=r[i],a=new RegExp("^("+p.source+")("+o.source+")("+p.source+")$");if(n=e.match(a)){var u=ce(n[1],t);return(0,se[n[2].trim()])(u,ce(n[3],t))}}if(n=e.match(_)){for(var s=fe(n[1],t),c=fe(n[2],t),f=[],l=s;l<=c;l++)f.push(l);return f}return fe(e,t)}function fe(e,t){if(e=e&&e.trim()){if(r=e,b.test(r))return function(e){var t=e.match(E);if(t)return Number(e);if(t=e.match(T))return"true"===e.toLowerCase();if(t=e.match(oe))return e.slice(1,-1);throw new TypeError("cannot parse '"+e+"' as literal")}(e);var r,n;if(n=e,k.test(n))return t.get(e);throw new TypeError("cannot eval '"+e+"' as value")}}function le(e){return!pe(e)}function pe(e){return!1===e||null==e}var he,ge,de,ve={renderTemplates:(de=Q(regeneratorRuntime.mark(function e(t,n){var r,i,o,a,u,s,c,f,l=(r=Q(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("tag"!==t.type){e.next=5;break}return e.next=3,this.renderTag(t,n);case 3:return r=e.sent,e.abrupt("return",void 0===r?"":r);case 5:if("value"!==t.type){e.next=7;break}return e.abrupt("return",this.renderValue(t,n));case 7:return e.abrupt("return",t.value);case 8:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)});return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:ae(n,"unable to evalTemplates: scope undefined"),a=!(o=!(i="")),u=void 0,e.prev=5,s=t[Symbol.iterator]();case 7:if(o=(c=s.next()).done){e.next=24;break}return f=c.value,e.prev=9,e.next=12,l.call(this,f);case 12:i+=e.sent,e.next=21;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof V)){e.next=20;break}throw e.t0.resolvedHTML=i,e.t0;case 20:throw new q(e.t0,f);case 21:o=!0,e.next=7;break;case 24:e.next=30;break;case 26:e.prev=26,e.t1=e.catch(5),a=!0,u=e.t1;case 30:e.prev=30,e.prev=31,!o&&s.return&&s.return();case 33:if(e.prev=33,!a){e.next=36;break}throw u;case 36:return e.finish(33);case 37:return e.finish(30);case 38:return e.abrupt("return",i);case 39:case"end":return e.stop()}},e,this,[[5,26,30,38],[9,15],[31,,33,37]])})),function(e,t){return de.apply(this,arguments)}),renderTag:(ge=Q(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("continue"!==t.name){e.next=2;break}throw new V("continue");case 2:if("break"!==t.name){e.next=4;break}throw new V("break");case 4:return e.abrupt("return",t.render(r));case 5:case"end":return e.stop()}},e,this)})),function(e,t){return ge.apply(this,arguments)}),renderValue:(he=Q(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.evalValue(t,r),e.abrupt("return",void 0===n?"":o(n));case 2:case"end":return e.stop()}},e,this)})),function(e,t){return he.apply(this,arguments)}),evalValue:function(e,r){return ae(r,"unable to evalValue: scope undefined"),e.filters.reduce(function(e,t){return t.render(e,r)},ce(e.initial,r))}};function me(e,t){var r={},n=void 0;for(w.lastIndex=0;n=w.exec(e);){var i=n[1],o=n[2];r[i]=fe(o,t)}return r}var ye=new RegExp(""+ne.source,"g");function we(r,o){var t={init:function(e){return this.tokens=e,this.handlers={},this},on:function(e,t){return this.handlers[e]=t,this},trigger:function(e,t){var r=this.handlers[e];if("function"==typeof r)return r(t),!0},start:function(){this.trigger("start");for(var e=void 0;!this.stopRequested&&(e=this.tokens.shift());)if(!(this.trigger("token",e)||"tag"===e.type&&this.trigger("tag:"+e.name,e))){var t=n(e,this.tokens);this.trigger("template",t)}return this.stopRequested||this.trigger("end"),this},stop:function(){return this.stopRequested=!0,this}};function n(t,e){try{var r=null;return(r="tag"===t.type?i(t,e):"value"===t.type?a(t.value):t).token=t,r}catch(e){throw new I(e,t)}}function i(e,t){return"continue"===e.name||"break"===e.name?e:r.construct(e,t)}function a(e){var t,r=(t=e,ne.exec(t));ae(r,"illegal value string: "+e);var n=r[0];e=e.substr(r.index+r[0].length);for(var i=[];r=L.exec(e);)i.push([r[0].trim()]);return{type:"value",initial:n,filters:i.map(function(e){return o.construct(e)})}}return{parse:function(e){for(var t=void 0,r=[];t=e.shift();)r.push(n(t,e));return r},parseTag:i,parseStream:function(e){return ee(t).init(e)},parseValue:a}}function xe(r,n){var i=Promise.resolve("init"),o=[];return r.forEach(function(e,t){i=i.then(function(){return n(e,t,r)}).then(function(e){return o.push(e)})}),i.then(function(){return o})}var be=/[^\s,]+/;function ke(e,t){var r,n,i,o,a,u,s,c,f,l,p,h,g,d,v,m,y,w,x,b,k,E,T,_,R,S,O,L,j,P,M,F,A,C,D,I,q,V,$,N,Y,H,G,z,U,B,W,J,X,K;r=e,n=t,i=new RegExp("("+re.source+")\\s*=(.*)"),o=n.Types.AssignScope,r.registerTag("assign",{parse:function(e){var t=e.args.match(i);ae(t,"illegal token "+e.raw),this.key=t[1],this.value=t[2]},render:function(e){var t=ee(o);return t[this.key]=r.evalValue(this.value,e),e.push(t),Promise.resolve("")}}),a=e,u=t,c=new RegExp("("+re.source+")"),f=u.Types.CaptureScope,a.registerTag("capture",{parse:function(t,e){var r=this,n=t.args.match(c);ae(n,t.args+" not valid identifier"),this.variable=n[1],this.templates=[];var i=a.parser.parseStream(e);i.on("tag:endcapture",function(e){return i.stop()}).on("template",function(e){return r.templates.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")}),i.start()},render:(s=Q(regeneratorRuntime.mark(function e(t,r){var n,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.renderer.renderTemplates(this.templates,t);case 2:n=e.sent,(i=ee(f))[this.variable]=n,t.push(i);case 6:case"end":return e.stop()}},e,this)})),function(e,t){return s.apply(this,arguments)})}),p=t,(l=e).registerTag("case",{parse:function(t,e){var r=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var n=[],i=l.parser.parseStream(e).on("tag:when",function(e){r.cases.push({val:e.args,templates:n=[]})}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endcase",function(e){return i.stop()}).on("template",function(e){return n.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(e,t){for(var r=0;r<this.cases.length;r++){var n=this.cases[r];if(p.evalExp(n.val,e)===p.evalExp(this.cond,e))return l.renderer.renderTemplates(n.templates,e)}return l.renderer.renderTemplates(this.elseTemplates,e)}}),(h=e).registerTag("comment",{parse:function(t,e){var r=h.parser.parseStream(e);r.on("token",function(e){"endcomment"===e.name&&r.stop()}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")}),r.start()}}),g=e,d=t,v=new RegExp("^(?:("+ne.source+")\\s*:\\s*)?(.*)$"),m=new RegExp(ne.source,"g"),g.registerTag("cycle",{parse:function(e,t){var r=v.exec(e.args);ae(r,"illegal tag: "+e.raw),this.group=r[1]||"";var n=r[2];for(this.candidates=[];r=m.exec(n);)this.candidates.push(r[0]);ae(this.candidates.length,"empty candidates: "+e.raw)},render:function(e,t){var r="cycle:"+d.evalValue(this.group,e)+":"+this.candidates.join(","),n=e.opts.groups=e.opts.groups||{},i=n[r];void 0===i&&(i=n[r]=0);var o=this.candidates[i];return i=(i+1)%this.candidates.length,n[r]=i,d.evalValue(o,e)}}),y=e,w=t.Types,x=w.CaptureScope,b=w.AssignScope,k=w.DecrementScope,y.registerTag("decrement",{parse:function(e){var t=e.args.match(re);ae(t,"illegal identifier "+e.args),this.variable=t[0]},render:function(e,t){var r=e.findContextFor(this.variable,function(e){var t=Object.getPrototypeOf(e);return t!==x&&t!==b});return r||(r=ee(k),e.unshift(r)),"number"!=typeof r[this.variable]&&(r[this.variable]=0),--r[this.variable]}}),E=e,T=t,_=Q(regeneratorRuntime.mark(function e(r,t){var n,i,o,a,u,s,c=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=T.evalExp(this.collection,r),Array.isArray(n)||(Z(n)&&0<n.length?n=[n]:te(n)&&(n=Object.keys(n).map(function(e){return[e,n[e]]}))),Array.isArray(n)&&n.length){e.next=4;break}return e.abrupt("return",E.renderer.renderTemplates(this.elseTemplates,r));case 4:return i=t.offset||0,o=void 0===t.limit?n.length:t.limit,n=n.slice(i,i+o),this.reversed&&n.reverse(),a=n.map(function(e,t){var r={};return r[c.variable]=e,r.forloop={first:0===t,index:t+1,index0:t,last:t===n.length-1,length:n.length,rindex:n.length-t,rindex0:n.length-t-1},r}),u="",s=!1,e.next=13,xe(a,function(){var t=Q(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}return e.abrupt("return");case 2:return r.push(t),e.prev=3,e.next=6,E.renderer.renderTemplates(c.templates,r);case 6:u+=e.sent,e.next=17;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof S)){e.next=16;break}u+=e.t0.resolvedHTML,"break"===e.t0.message&&(s=!0),e.next=17;break;case 16:throw e.t0;case 17:r.pop(t);case 18:case"end":return e.stop()}},e,c,[[3,9]])}));return function(e){return t.apply(this,arguments)}}());case 13:return e.abrupt("return",u);case 14:case"end":return e.stop()}},e,this)})),R=function(e,t){return _.apply(this,arguments)},S=T.Types.RenderBreakError,O=new RegExp("^("+re.source+")\\s+in\\s+("+ne.source+")(?:\\s+"+ie.source+")*(?:\\s+(reversed))?(?:\\s+"+ie.source+")*$"),E.registerTag("for",{parse:function(e,t){var r=this,n=O.exec(e.args);ae(n,"illegal tag: "+e.raw),this.variable=n[1],this.collection=n[2],this.reversed=!!n[3],this.templates=[],this.elseTemplates=[];var i=void 0,o=E.parser.parseStream(t).on("start",function(){return i=r.templates}).on("tag:else",function(){return i=r.elseTemplates}).on("tag:endfor",function(){return o.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag "+e.raw+" not closed")});o.start()},render:R}),j=t,(L=e).registerTag("if",{parse:function(t,e){var r=this;this.branches=[],this.elseTemplates=[];var n=void 0,i=L.parser.parseStream(e).on("start",function(){return r.branches.push({cond:t.args,templates:n=[]})}).on("tag:elsif",function(e){r.branches.push({cond:e.args,templates:n=[]})}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endif",function(e){return i.stop()}).on("template",function(e){return n.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(e,t){var r=!0,n=!1,i=void 0;try{for(var o,a=this.branches[Symbol.iterator]();!(r=(o=a.next()).done);r=!0){var u=o.value,s=j.evalExp(u.cond,e);if(j.isTruthy(s))return L.renderer.renderTemplates(u.templates,e)}}catch(e){n=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}return L.renderer.renderTemplates(this.elseTemplates,e)}}),P=e,M=t,A=new RegExp("with\\s+("+ne.source+")"),P.registerTag("include",{parse:function(e){var t=be.exec(e.args);t&&(this.staticValue=t[0]),(t=ne.exec(e.args))&&(this.value=t[0]),(t=A.exec(e.args))&&(this.with=t[1])},render:(F=Q(regeneratorRuntime.mark(function e(t,r){var n,i,o,a,u,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=void 0,!t.opts.dynamicPartials){e.next=12;break}if(!oe.exec(this.value)){e.next=9;break}return i=this.value.slice(1,-1),e.next=6,P.parseAndRender(i,t.getAll(),t.opts);case 6:n=e.sent,e.next=10;break;case 9:n=M.evalValue(this.value,t);case 10:e.next=13;break;case 12:n=this.staticValue;case 13:return ae(n,"cannot include with empty filename"),o=t.opts.blocks,a=t.opts.blockMode,t.opts.blocks={},t.opts.blockMode="output",this.with&&(r[n]=M.evalValue(this.with,t)),e.next=21,P.getTemplate(n,t.opts.root);case 21:return u=e.sent,t.push(r),e.next=25,P.renderer.renderTemplates(u,t);case 25:return s=e.sent,t.pop(r),t.opts.blocks=o,t.opts.blockMode=a,e.abrupt("return",s);case 30:case"end":return e.stop()}},e,this)})),function(e,t){return F.apply(this,arguments)})}),C=e,D=t.Types,I=D.CaptureScope,q=D.AssignScope,V=D.IncrementScope,C.registerTag("increment",{parse:function(e){var t=e.args.match(re);ae(t,"illegal identifier "+e.args),this.variable=t[0]},render:function(e,t){var r=e.findContextFor(this.variable,function(e){var t=Object.getPrototypeOf(e);return t!==I&&t!==q});r||(r=ee(V),e.unshift(r)),"number"!=typeof r[this.variable]&&(r[this.variable]=0);var n=r[this.variable];return r[this.variable]++,n}}),N=t,G=/\S+/,($=e).registerTag("layout",{parse:function(e,t){var r=G.exec(e.args);r&&(this.staticLayout=r[0]),(r=ne.exec(e.args))&&(this.layout=r[0]),this.tpls=$.parser.parse(t)},render:(Y=Q(regeneratorRuntime.mark(function e(t,r){var n,i,o,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return ae(n=t.opts.dynamicPartials?N.evalValue(this.layout,t):this.staticLayout,"cannot apply layout with empty filename"),t.opts.blockMode="store",e.next=5,$.renderer.renderTemplates(this.tpls,t);case 5:return i=e.sent,void 0===t.opts.blocks[""]&&(t.opts.blocks[""]=i),e.next=9,$.getTemplate(n,t.opts.root);case 9:return o=e.sent,t.push(r),t.opts.blockMode="output",e.next=14,$.renderer.renderTemplates(o,t);case 14:return a=e.sent,t.pop(r),e.abrupt("return",a);case 17:case"end":return e.stop()}},e,this)})),function(e,t){return Y.apply(this,arguments)})}),$.registerTag("block",{parse:function(e,t){var r=this,n=/\w+/.exec(e.args);this.block=n?n[0]:"",this.tpls=[];var i=$.parser.parseStream(t).on("tag:endblock",function(){return i.stop()}).on("template",function(e){return r.tpls.push(e)}).on("end",function(){throw new Error("tag "+e.raw+" not closed")});i.start()},render:(H=Q(regeneratorRuntime.mark(function e(t){var r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===(r=t.opts.blocks[this.block])){e.next=5;break}e.t0=r,e.next=8;break;case 5:return e.next=7,$.renderer.renderTemplates(this.tpls,t);case 7:e.t0=e.sent;case 8:if(n=e.t0,"store"!==t.opts.blockMode){e.next=12;break}return t.opts.blocks[this.block]=n,e.abrupt("return","");case 12:return e.abrupt("return",n);case 13:case"end":return e.stop()}},e,this)})),function(e){return H.apply(this,arguments)})}),(z=e).registerTag("raw",{parse:function(e,t){var r=this;this.tokens=[];var n=z.parser.parseStream(t);n.on("token",function(e){"endraw"===e.name?n.stop():r.tokens.push(e)}).on("end",function(){throw new Error("tag "+e.raw+" not closed")}),n.start()},render:function(e,t){return this.tokens.map(function(e){return e.raw}).join("")}}),U=e,B=t,J=new RegExp("^("+re.source+")\\s+in\\s+("+ne.source+")(?:\\s+"+ie.source+")*$"),U.registerTag("tablerow",{parse:function(e,t){var r=this,n=J.exec(e.args);ae(n,"illegal tag: "+e.raw),this.variable=n[1],this.collection=n[2],this.templates=[];var i=void 0,o=U.parser.parseStream(t).on("start",function(){return i=r.templates}).on("tag:endtablerow",function(e){return o.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag "+e.raw+" not closed")});o.start()},render:(W=Q(regeneratorRuntime.mark(function e(i,t){var r,n,o,a,u,s,c,f=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=B.evalExp(this.collection,i)||[],n=t.offset||0,o=void 0===t.limit?r.length:t.limit,r=r.slice(n,n+o),a=t.cols||r.length,u=r.map(function(e,t){var r={};return r[f.variable]=e,r}),s=void 0,c="",e.next=10,xe(u,function(){var r=Q(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=Math.floor(r/a)+1,1==(n=r%a+1)&&(1!==s&&(c+="</tr>"),c+='<tr class="row'+s+'">'),c+='<td class="col'+n+'">',i.push(t),e.next=7,U.renderer.renderTemplates(f.templates,i);case 7:return c+=e.sent,c+="</td>",i.pop(t),e.abrupt("return",c);case 11:case"end":return e.stop()}},e,f)}));return function(e,t){return r.apply(this,arguments)}}());case 10:return 0<s&&(c+="</tr>"),e.abrupt("return",c);case 12:case"end":return e.stop()}},e,this)})),function(e,t){return W.apply(this,arguments)})}),K=t,(X=e).registerTag("unless",{parse:function(t,e){var r=this;this.templates=[],this.elseTemplates=[];var n=void 0,i=X.parser.parseStream(e).on("start",function(e){n=r.templates,r.cond=t.args}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endunless",function(e){return i.stop()}).on("template",function(e){return n.push(e)}).on("end",function(e){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(e,t){var r=K.evalExp(this.cond,e);return K.isFalsy(r)?X.renderer.renderTemplates(this.templates,e):X.renderer.renderTemplates(this.elseTemplates,e)}})}var Ee=["January","February","March","April","May","June","July","August","September","October","November","December"],Te=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],_e=Ee.map(Oe),Re=Te.map(Oe),Se={1:"st",2:"nd",3:"rd",default:"th"};function Oe(e){return e.slice(0,3)}var Le={daysInMonth:function(e){return[31,Le.isLeapYear(e)?29:28,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(e){for(var t=0,r=0;r<e.getMonth();++r)t+=Le.daysInMonth(e)[r];return t+e.getDate()},getWeekOfYear:function(e,t){var r=this.getDayOfYear(e)+(t-e.getDay()),n=7-new Date(e.getFullYear(),0,1).getDay()+t;return je.pad(Math.floor((r-n)/7)+1,2)},isLeapYear:function(e){var t=e.getFullYear();return!(0!=(3&t)||!(t%100||t%400==0&&t))},getSuffix:function(e){var t=e.getDate().toString(),r=parseInt(t.slice(-1));return Se[r]||Se.default},century:function(e){return parseInt(e.getFullYear().toString().substring(0,2),10)}},je={pad:function(e,t,r){r||(r="0");for(var n=e.toString(),i=t-n.length;0<i--;)n=r+n;return n}},Pe={a:function(e){return Re[e.getDay()]},A:function(e){return Te[e.getDay()]},b:function(e){return _e[e.getMonth()]},B:function(e){return Ee[e.getMonth()]},c:function(e){return e.toLocaleString()},C:function(e){return Le.century(e)},d:function(e){return je.pad(e.getDate(),2)},e:function(e){return je.pad(e.getDate(),2," ")},H:function(e){return je.pad(e.getHours(),2)},I:function(e){return je.pad(e.getHours()%12||12,2)},j:function(e){return je.pad(Le.getDayOfYear(e),3)},k:function(e){return je.pad(e.getHours(),2," ")},l:function(e){return je.pad(e.getHours()%12||12,2," ")},L:function(e){return je.pad(e.getMilliseconds(),3)},m:function(e){return je.pad(e.getMonth()+1,2)},M:function(e){return je.pad(e.getMinutes(),2)},p:function(e){return e.getHours()<12?"AM":"PM"},P:function(e){return e.getHours()<12?"am":"pm"},q:function(e){return Le.getSuffix(e)},s:function(e){return Math.round(e.valueOf()/1e3)},S:function(e){return je.pad(e.getSeconds(),2)},u:function(e){return e.getDay()||7},U:function(e){return Le.getWeekOfYear(e,0)},w:function(e){return e.getDay()},W:function(e){return Le.getWeekOfYear(e,1)},x:function(e){return e.toLocaleDateString()},X:function(e){return e.toLocaleTimeString()},y:function(e){return e.getFullYear().toString().substring(2,4)},Y:function(e){return e.getFullYear()},z:function(e){var t=e.getTimezoneOffset()/60*100;return(0<t?"-":"+")+je.pad(Math.abs(t),4)},"%":function(){return"%"}};Pe.h=Pe.b,Pe.N=Pe.L;var Me={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},Fe={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"},Ae={abs:function(e){return Math.abs(e)},append:function(e,t){return e+t},capitalize:function(e){return Ie(e).charAt(0).toUpperCase()+e.slice(1)},ceil:function(e){return Math.ceil(e)},concat:function(e,t){return Array.prototype.concat.call(e,t)},date:function(e,t){var r,n=e;return"now"===e?n=new Date:Z(e)&&(n=new Date(e)),(r=n)instanceof Date&&!isNaN(r.getTime())?function(e,t){for(var r="",n=t;;){var i=/%./g,o=i.exec(n);if(!o)return r+n;r+=n.slice(0,i.lastIndex-2),n=n.slice(i.lastIndex);var a=o[0].charAt(1),u=Pe[a];r+=u?u.call(this,e):"%"+a}}(n,t):e},default:function(e,t){return le(e)?e:t},divided_by:function(e,t){return e/t},downcase:function(e){return e.toLowerCase()},escape:Ce,escape_once:function(e){return Ce(Ie(e).replace(/&(amp|lt|gt|#34|#39);/g,function(e){return Fe[e]}))},first:function(e){return e[0]},floor:function(e){return Math.floor(e)},join:function(e,t){return e.join(t)},last:function(e){return y(e)},lstrip:function(e){return Ie(e).replace(/^\s+/,"")},map:function(e,t){return e.map(function(e){return e[t]})},minus:qe(function(e,t){return e-t}),modulo:qe(function(e,t){return e%t}),newline_to_br:function(e){return e.replace(/\n/g,"<br />")},plus:qe(function(e,t){return Number(e)+Number(t)}),prepend:function(e,t){return t+e},remove:function(e,t){return e.split(t).join("")},remove_first:function(e,t){return e.replace(t,"")},replace:function(e,t,r){return Ie(e).split(t).join(r)},replace_first:function(e,t,r){return Ie(e).replace(t,r)},reverse:function(e){return e.reverse()},round:function(e,t){var r=Math.pow(10,t||0);return Math.round(e*r,t)/r},rstrip:function(e){return Ie(e).replace(/\s+$/,"")},size:function(e){return e.length},slice:function(e,t,r){return e.substr(t,void 0===r?1:r)},sort:function(e,t){return e.sort(t)},split:function(e,t){return Ie(e).split(t)},strip:function(e){return Ie(e).trim()},strip_html:function(e){return Ie(e).replace(/<script.*?<\/script>|<!--.*?-->|<style.*?<\/style>|<.*?>/g,"")},strip_newlines:function(e){return Ie(e).replace(/\n/g,"")},times:function(e,t){return e*t},truncate:function(e,t,r){return r=void 0===r?"...":r,t=t||16,(e=Ie(e)).length<=t?e:e.substr(0,t-r.length)+r},truncatewords:function(e,t,r){void 0===r&&(r="...");var n=e.split(" "),i=n.slice(0,t).join(" ");return n.length>t&&(i+=r),i},uniq:function(e){var t={};return(e||[]).filter(function(e){return!t.hasOwnProperty(e)&&(t[e]=!0)})},upcase:function(e){return Ie(e).toUpperCase()},url_encode:encodeURIComponent};function Ce(e){return Ie(e).replace(/&|<|>|"|'/g,function(e){return Me[e]})}function De(e){var t=(e+"").split(".");return 1<t.length?t[1].length:0}function Ie(e){return e+""}function qe(o){return function(e,t){var r,n,i=(r=e,n=t,Math.max(De(r),De(n)));return o(e,t).toFixed(i)}}function Ve(r){return function(e,t){for(var r in e=e||{})if(e.hasOwnProperty(r)&&!1===t(e[r],r,e))break;return e}(Ae,function(e,t){return r.registerFilter(t,e)})}Ve.filters=Ae;var $e,Ne,Ye,He,Ge,ze={init:function(e,t,r){return r.cache&&(this.cache={}),this.options=r,this.tag=e,this.filter=t,this.parser=we(e,t),this.renderer=ee(ve),ke(this,Ue),Ve(this),this},parse:function(e,t){var r=G(e,t,this.options);return this.parser.parse(r)},render:function(e,t,r){r=m({},this.options,r);var n,i,o,a=(n=t,i=r,(o=ee(N)).opts=m({dynamicPartials:!0,strict_variables:!1,strict_filters:!1,blocks:{},root:[]},i),o.contexts=[n||{}],o);return this.renderer.renderTemplates(e,a)},parseAndRender:(Ge=Q(regeneratorRuntime.mark(function e(t,r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.parse(t);case 2:return i=e.sent,e.abrupt("return",this.render(i,r,n));case 4:case"end":return e.stop()}},e,this)})),function(e,t,r){return Ge.apply(this,arguments)}),renderFile:(He=Q(regeneratorRuntime.mark(function e(t,r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=m({},n),e.next=3,this.getTemplate(t,n.root);case 3:return i=e.sent,e.abrupt("return",this.render(i,r,n));case 5:case"end":return e.stop()}},e,this)})),function(e,t,r){return He.apply(this,arguments)}),evalValue:function(e,t){var r=this.parser.parseValue(e.trim());return this.renderer.evalValue(r,t)},registerFilter:function(e,t){return this.filter.register(e,t)},registerTag:function(e,t){return this.tag.register(e,t)},lookup:function(r,n){var i,o,e,t,a=this,u=(n=function(e){for(var t={},r=[],n=0,i=e.length;n<i;++n)t.hasOwnProperty(e[n])||(r.push(e[n]),t[e[n]]=1);return r}(n=this.options.root.concat(n||[]))).map(function(e){return W.resolve(e,r)});return i=u,t=Q(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,B(t);case 3:return e.abrupt("return",t);case 6:throw e.prev=6,e.t0=e.catch(0),e.t0.message=e.t0.code+": Failed to lookup "+r+" in: "+n,e.t0;case 10:case"end":return e.stop()}},e,a,[[0,6]])})),o=function(e){return t.apply(this,arguments)},e=Promise.reject(new Error("init")),i.forEach(function(t,r){e=e.catch(function(e){return o(t,r,i)})}),e},getTemplate:function(e,t){return"undefined"==typeof XMLHttpRequest?this.getTemplateFromFile(e,t):this.getTemplateFromUrl(e,t)},getTemplateFromFile:(Ye=Q(regeneratorRuntime.mark(function e(r,t){var n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return W.extname(r)||(r+=this.options.extname),e.next=3,this.lookup(r,t);case 3:return r=e.sent,e.abrupt("return",this.respectCache(r,Q(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,U(r);case 2:return t=e.sent,e.abrupt("return",n.parse(t,r));case 4:case"end":return e.stop()}},e,n)}))));case 5:case"end":return e.stop()}},e,this)})),function(e,t){return Ye.apply(this,arguments)}),getTemplateFromUrl:(Ne=Q(regeneratorRuntime.mark(function e(n,i){var o,a=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=void 0,r=n,X.test(r)?o=n:(t=n,J.exec(t).slice(1)[3]||(n+=this.options.extname),o=K(i||this.options.root,n)),e.abrupt("return",this.respectCache(n,Q(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=a,e.next=3,H(o);case 3:return e.t1=e.sent,e.abrupt("return",e.t0.parse.call(e.t0,e.t1));case 5:case"end":return e.stop()}},e,a)}))));case 3:case"end":return e.stop()}var t,r},e,this)})),function(e,t){return Ne.apply(this,arguments)}),respectCache:($e=Q(regeneratorRuntime.mark(function e(t,r){var n,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.options.cache)||!this.cache[t]){e.next=3;break}return e.abrupt("return",this.cache[t]);case 3:return e.next=5,r();case 5:return i=e.sent,n&&(this.cache[t]=i),e.abrupt("return",i);case 8:case"end":return e.stop()}},e,this)})),function(e,t){return $e.apply(this,arguments)}),express:function(n){n=n||{};var i=this;return function(e,t,r){ae(Array.isArray(this.root)||Z(this.root),"illegal views root, are you using express.js?"),n.root=this.root,i.renderFile(e,t,n).then(function(e){return r(null,e)},r)}}};function Ue(e){var t;(e=m({root:["."],cache:!1,extname:"",dynamicPartials:!0,trim_tag_right:!1,trim_tag_left:!1,trim_value_right:!1,trim_value_left:!1,greedy:!0,strict_filters:!1,strict_variables:!1},e)).root=(t=e.root,Array.isArray(t)?t:Z(t)?[t]:[]);var r,n,i,o=ee(ze);return o.init((n={},i={render:(r=Q(regeneratorRuntime.mark(function e(t){var r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=me(this.token.args,t),"function"==typeof(n=this.tagImpl).render){e.next=4;break}return e.abrupt("return","");case 4:return e.abrupt("return",n.render(t,r));case 5:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)}),parse:function(e,t){this.type="tag",this.token=e,this.name=e.name;var r=n[this.name];ae(r,"tag "+this.name+" not found"),this.tagImpl=ee(r),this.tagImpl.parse&&this.tagImpl.parse(e,t)}},{construct:function(e,t){var r=ee(i);return r.parse(e,t),r},register:function(e,t){n[e]=t},clear:function(){n={}}}),function(s){s=m({},s);var c={},t={render:function(e,t){var r=this.args.map(function(e){return fe(e,t)});return r.unshift(e),this.filter.apply(null,r)},parse:function(e){var t=P.exec(e);ae(t,"illegal filter: "+e);var r=t[1],n=t[2]||"",i=c[r];if("function"!=typeof i){if(s.strict_filters)throw new TypeError("undefined filter: "+r);return this.name=r,this.filter=function(e){return e},this.args=[],this}for(var o=[];t=ye.exec(n.trim());){var a=t[0],u=new RegExp(a+"\\s*:","g").exec(t.input);u&&u.index===t.index?o.push("'"+a+"'"):o.push(a)}return this.name=r,this.filter=i,this.args=o,this}};return{construct:function(e){return ee(t).parse(e)},register:function(e,t){c[e]=t},clear:function(){c={}}}}(e),e),o}return Ue.isTruthy=le,Ue.isFalsy=pe,Ue.evalExp=ce,Ue.evalValue=fe,Ue.Types={ParseError:I,TokenizationError:D,RenderBreakError:V,AssertionError:$,AssignScope:{},CaptureScope:{},IncrementScope:{},DecrementScope:{}},Ue});
//# sourceMappingURL=liquid.min.js.map