Comparing version 7.1.0 to 7.2.0
@@ -0,1 +1,8 @@ | ||
# [7.2.0](https://github.com/harttle/liquidjs/compare/v7.1.0...v7.2.0) (2019-02-20) | ||
### Features | ||
* override output/tag delimiter, fixes [#54](https://github.com/harttle/liquidjs/issues/54) ([d20a043](https://github.com/harttle/liquidjs/commit/d20a043)) | ||
# [7.1.0](https://github.com/harttle/liquidjs/compare/v7.0.2...v7.1.0) (2019-02-20) | ||
@@ -2,0 +9,0 @@ |
@@ -18,6 +18,12 @@ export interface LiquidOptions { | ||
trim_tag_left?: boolean; | ||
/** ``trim_value_right` is used to strip blank characters (including ` `, `\t`, and `\r`) from the right of values (`{{ }}`) until `\n` (inclusive). Defaults to `false`. */ | ||
trim_value_right?: boolean; | ||
/** `trim_value_left` is similar to `trim_value_right`, whereas the `\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */ | ||
trim_value_left?: boolean; | ||
/** ``trim_output_right` is used to strip blank characters (including ` `, `\t`, and `\r`) from the right of values (`{{ }}`) until `\n` (inclusive). Defaults to `false`. */ | ||
trim_output_right?: boolean; | ||
/** `trim_output_left` is similar to `trim_output_right`, whereas the `\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */ | ||
trim_output_left?: boolean; | ||
/** `tag_delimiter_left` and `tag_delimiter_right` are used to override the delimiter for liquid tags **/ | ||
tag_delimiter_left?: string; | ||
tag_delimiter_right?: string; | ||
/** `output_delimiter_left` and `output_delimiter_right` are used to override the delimiter for liquid outputs **/ | ||
output_delimiter_left?: string; | ||
output_delimiter_right?: string; | ||
/** `greedy` is used to specify whether `trim_left`/`trim_right` is greedy. When set to `true`, all consecutive blank characters including `\n` will be trimed regardless of line breaks. Defaults to `true`. */ | ||
@@ -29,3 +35,16 @@ greedy?: boolean; | ||
} | ||
export declare const defaultOptions: NormalizedOptions; | ||
export interface NormalizedFullOptions extends NormalizedOptions { | ||
root: string[]; | ||
extname: string; | ||
cache: boolean; | ||
dynamicPartials: boolean; | ||
strict_filters: boolean; | ||
strict_variables: boolean; | ||
trim_tag_right: boolean; | ||
trim_tag_left: boolean; | ||
trim_output_right: boolean; | ||
trim_output_left: boolean; | ||
greedy: boolean; | ||
} | ||
export declare function normalize(options: LiquidOptions): NormalizedOptions; | ||
export declare function applyDefault(options: NormalizedOptions): NormalizedFullOptions; |
@@ -6,5 +6,5 @@ import Scope from './scope/scope'; | ||
import { isTruthy, isFalsy, evalExp, evalValue } from './render/syntax'; | ||
import { LiquidOptions, NormalizedOptions } from './liquid-options'; | ||
import { LiquidOptions, NormalizedFullOptions } from './liquid-options'; | ||
export default class Liquid { | ||
options: NormalizedOptions; | ||
options: NormalizedFullOptions; | ||
private cache; | ||
@@ -11,0 +11,0 @@ private parser; |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Liquid=e()}(this,function(){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function e(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var h=function(){return(h=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function d(o,s,u,a){return new(u||(u=Promise))(function(t,e){function r(t){try{i(a.next(t))}catch(t){e(t)}}function n(t){try{i(a.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new u(function(t){t(e.value)}).then(r,n)}i((a=a.apply(o,s||[])).next())})}function g(r,n){var i,o,s,t,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,o=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){u.label=e[1];break}if(6===e[0]&&u.label<s[1]){u.label=s[1],s=e;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(e);break}s[2]&&u.ops.pop(),u.trys.pop();continue}e=n.call(r,u)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var i=Object.prototype.toString,o=Array.prototype.toString;function l(t){return"[object String]"===i.call(t)}function s(t){return"function"==typeof t}function u(t){return c(t)?"":s(t.to_liquid)?u(t.to_liquid()):s(t.toLiquid)?u(t.toLiquid()):s(t.to_s)?t.to_s():-1<[i,o].indexOf(t.toString)?(e=t,r=[],JSON.stringify(e,function(t,e){if(m(e)){if(-1!==r.indexOf(e))return;r.push(e)}return e})):s(t.toString)?t.toString():i.call(t);var e,r}function a(t){return Object.create(t)}function c(t){return null==t}function f(t){return"[object Array]"===i.call(t)}function p(t,e){for(var r in t=t||{})if(t.hasOwnProperty(r)&&!1===e(t[r],r,t))break;return t}function v(t){return t[t.length-1]}function m(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function w(t,e,r){void 0===r&&(r=" ");for(var n=e-(t=String(t)).length;0<n--;)t=r+t;return t}var t=new RegExp(/'[^']*'/.source+"|"+/"[^"]*"/.source),y=new RegExp("(?:"+t.source+"|[^'\"])*"),r=/-?\d+\.?\d*|\.?\d+/,b=/true|false/,x=/[\w-]+[?]?/,T=new RegExp("\\[(?:"+t.source+"|[\\w-\\.]+)\\]"),E=new RegExp("(?:"+t.source+"|"+b.source+"|"+r.source+")"),k=new RegExp(x.source+"(?:\\."+x.source+"|"+T.source+")*"),S=new RegExp("(?:"+k.source+"|"+r.source+")"),q=new RegExp("\\("+S.source+"\\.\\."+S.source+"\\)"),R=new RegExp("\\(("+S.source+")\\.\\.("+S.source+")\\)"),_=new RegExp("(?:"+k.source+"|"+E.source+"|"+q.source+")"),O=new RegExp("(?:"+x.source+")\\s*:\\s*(?:"+_.source+")"),M=new RegExp("("+x.source+")\\s*:\\s*("+_.source+")","g"),L=new RegExp("^\\s*("+x.source+")\\s*([\\s\\S]*?)\\s*$"),P=new RegExp("^"+E.source+"$","i"),A=new RegExp("^"+k.source+"$"),U=new RegExp("^"+r.source+"$"),j=new RegExp("^"+b.source+"$","i"),F=new RegExp("^"+t.source+"$"),D=new RegExp("^"+R.source+"$"),H=new RegExp("^"+/-?\d+/.source+"$"),$=new RegExp("(?:"+x.source+"\\s*:\\s*)?"+_.source),C=new RegExp($.source+"(\\s*,\\s*"+$.source+")*"),N=new RegExp(x.source+"(?:\\s*:\\s*"+C.source+")?","g"),Y=new RegExp("("+x.source+")(?:\\s*:\\s*("+C.source+"))?"),z=new RegExp("^"+Y.source+"$"),I=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/];function G(){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}var V=function(){function t(t,e){this.input=e.input,this.file=e.file,this.originalError=t,this.token=e}return t.prototype.captureStackTrace=function(t){this.name=t.constructor.name,G.call(t);var e,i,o,r,s,n=this.originalError,u=(e=this.input,i=this.token.line,o=e.split("\n"),r=Math.max(i-2,1),s=Math.min(i+3,o.length),function(t,e,r){1===arguments.length&&(e=t,t=0),r=r||1;for(var n=[],i=t;i<e;i+=r)n.push(i);return n}(r,s+1).map(function(t){var e=t===i?">> ":" ",r=w(String(t),String(s).length),n=o[t-1];return""+e+r+"| "+n}).join("\n"));this.message=function(t,e){t=t||"",e.file&&(t+=", file:"+e.file);e.line&&(t+=", line:"+e.line+", col:"+e.col);return t}(n.message,this.token),this.stack=this.message+"\n"+u+"\n"+(this.stack||this.message)+(n.stack?"\nFrom "+n.stack:"")},t}(),W=function(n){function t(t,e){var r=n.call(this,{message:t},e)||this;return n.prototype.captureStackTrace.call(r,r),r}return e(t,n),t}(V);W.prototype=a(Error.prototype),W.prototype.constructor=W;var B=function(n){function t(t,e){var r=n.call(this,t,e)||this;return r.message=t.message,n.prototype.captureStackTrace.call(r,r),r}return e(t,n),t}(V);B.prototype=a(Error.prototype),B.prototype.constructor=B;var J=function(n){function t(t,e){var r=n.call(this,t,e.token)||this;return r.message=t.message,n.prototype.captureStackTrace.call(r,r),r}return e(t,n),t}(V);J.prototype=a(Error.prototype),J.prototype.constructor=J;var X=function(t){G.call(this),this.message=t+""};X.prototype=a(Error.prototype),X.prototype.constructor=X;var K=function(t){G.call(this),this.message=t+""};function Q(t,e){if(!t)throw new K(e=e||"expect "+t+" to be true")}K.prototype=a(Error.prototype),K.prototype.constructor=K;var Z,tt,et={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};function rt(t){var e;return(t=t||{}).hasOwnProperty("root")&&(t.root=f(e=t.root)?e:l(e)?[e]:[]),t}(tt=Z||(Z={}))[tt.OUTPUT=0]="OUTPUT",tt[tt.STORE=1]="STORE";var nt=Z,it=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=et),this.blocks={},this.blockMode=nt.OUTPUT,this.opts=h({},et,e),this.contexts=[t||{}]}return t.prototype.getAll=function(){return this.contexts.reduce(function(t,e){return function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return e=m(e)?e:{},t.forEach(function(t){return function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}(e,t)}),e}(t,e)},a(null))},t.prototype.get=function(t){var r=this,e=this.propertyAccessSeq(t),n=this.findContextFor(e[0])||v(this.contexts);return e.reduce(function(t,e){return r.readProperty(t,e)},n)},t.prototype.set=function(t,r){var n=this.propertyAccessSeq(t),i=this.findContextFor(n[0])||v(this.contexts);n.some(function(t,e){return!m(i)||(e===n.length-1?(i[t]=r,!0):(void 0===i[t]&&(i[t]={}),void(i=i[t])))})},t.prototype.unshift=function(t){return this.contexts.unshift(t)},t.prototype.push=function(t){return this.contexts.push(t)},t.prototype.pop=function(e){if(!arguments.length)return this.contexts.pop();var t=this.contexts.findIndex(function(t){return t===e});if(-1===t)throw new TypeError("scope not found, cannot pop");return this.contexts.splice(t,1)[0]},t.prototype.findContextFor=function(t,e){void 0===e&&(e=function(){return!0});for(var r=this.contexts.length-1;0<=r;r--){var n=this.contexts[r];if(e(n)&&t in n)return n}return null},t.prototype.readProperty=function(t,e){var r,n;if(c(t)?r=void 0:(t=function(t){if(s(t.to_liquid))return t.to_liquid();if(s(t.toLiquid))return t.toLiquid();return t}(t),r="size"===e?c((n=t).size)&&(f(n)||l(n))?n.length:n.size:t[e],s(t.liquid_method_missing)&&(r=t.liquid_method_missing(e))),c(r)&&this.opts.strict_variables)throw new TypeError("undefined variable: "+e);return r},t.prototype.propertyAccessSeq=function(t){t=String(t);for(var e,r,n=[],i="",o=0;o<t.length;)switch(t[o]){case"[":u();var s=t[o+1];o=/['"]/.test(s)?(Q(-1!==(e=t.indexOf(s,o+2)),"unbalanced "+s+": "+t),i=t.slice(o+2,e),u(),e+2):(Q(-1!==(e=ot(t,o+1)),"unbalanced []: "+t),i=t.slice(o+1,e),r=i,H.test(r)||(i=String(this.get(i))),u(),e+1);break;case".":u(),o++;break;default:i+=t[o],o++}if(u(),!n.length)throw new TypeError('invalid path:"'+t+'"');return n;function u(){i.length&&n.push(i),i=""}},t}();function ot(t,e){for(var r=1,n=e;n<t.length;n++)if("["===t[n]&&r++,"]"===t[n]&&0===--r)return n;return-1}var st=function(){},ut=function(){},at=function(){},ct=function(){},lt=Object.freeze({AssignScope:ut,CaptureScope:st,IncrementScope:at,DecrementScope:ct,ParseError:B,TokenizationError:W,RenderBreakError:X,AssertionError:K});var ft={readFile:function(n){return d(this,void 0,void 0,function(){return g(this,function(t){return[2,new Promise(function(t,e){var r=new XMLHttpRequest;r.onload=function(){200<=r.status&&r.status<300?t(r.responseText):e(new Error(r.statusText))},r.onerror=function(){e(new Error("An error occurred whilst receiving the response."))},r.open("GET",n),r.send()})]})})},resolve:function(t,e,i){return t.length&&"/"!==v(t)&&(t+="/"),function(t,e){var r=document.createElement("base");r.href=t;var n=document.getElementsByTagName("head")[0];n.insertBefore(r,n.firstChild);var i=document.createElement("a");i.href=e;var o=i.href;return n.removeChild(r),o}(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,function(t,e,r){var n=r.split("/").pop();return/\.\w+$/.test(n)?t:e+r+i})},exists:function(){return d(this,void 0,void 0,function(){return g(this,function(t){return[2,!0]})})}};var pt,ht,dt=function(t,e,r,n,i){this.col=e,this.line=i,this.raw=t,this.input=r,this.file=n},gt=function(s){function t(t,e,r,n,i){var o=s.call(this,t,e,r,n,i)||this;return o.type="html",o.value=t,o}return e(t,s),t}(dt),vt=function(s){function t(t,e,r,n,i){var o=s.call(this,t,e,r,n,i)||this;return o.trimLeft="-"===t[2],o.trimRight="-"===t[t.length-3],o.value=t.slice(o.trimLeft?3:2,o.trimRight?-3:-2).trim(),o}return e(t,s),t}(dt),mt=function(u){function t(t,e,r,n,i){var o=u.call(this,t,e,r,n,i)||this;o.type="tag";var s=o.value.match(L);if(!s)throw new W("illegal tag syntax",o);return o.name=s[1],o.args=s[2],o}return e(t,u),t}(vt),wt=function(s){function t(t,e,r,n,i){var o=s.call(this,t,e,r,n,i)||this;return o.type="output",o}return e(t,s),t}(vt);(ht=pt||(pt={}))[ht.HTML=0]="HTML",ht[ht.OUTPUT=1]="OUTPUT",ht[ht.TAG=2]="TAG";var yt=function(){function t(t){void 0===t&&(t=et),this.options=t}return t.prototype.tokenize=function(t,e){for(var r=[],n=0,i=1,o=pt.HTML,s="",u=0,a=1,c=1;n<t.length;){"\n"===t[n]&&(i++,u=n+1);var l=t.substr(n,2);if(o===pt.HTML){if("{{"===l||"{%"===l){s&&r.push(new gt(s,c,t,e,a)),a=i,c=n-u+1,n+=2,o="{{"===(s=l)?pt.OUTPUT:pt.TAG;continue}}else{if(o===pt.OUTPUT&&"}}"===l){s+="}}",r.push(new wt(s,c,t,e,a)),s="",a=i,c=(n+=2)-u+1,o=pt.HTML;continue}if("%}"===l){s+="%}",r.push(new mt(s,c,t,e,a)),s="",a=i,c=(n+=2)-u+1,o=pt.HTML;continue}}s+=t[n++]}if(o===pt.HTML)return s&&r.push(new gt(s,c,t,e,a)),function(s,u){u=h({greedy:!0},u);var a=!1;s.forEach(function(t,e){var r,n,i,o;i=t,o=u,!a&&("tag"===i.type?i.trimLeft||o.trim_tag_left:"output"===i.type?i.trimLeft||o.trim_value_left:void 0)&&function(t,e){if(t&&"html"===t.type){var r=e?/\s+$/g:/[\t\r ]*$/g;t.value=t.value.replace(r,"")}}(s[e-1],u.greedy),"tag"===t.type&&"raw"===t.name&&(a=!0),"tag"===t.type&&"endraw"===t.name&&(a=!1),r=t,n=u,!a&&("tag"===r.type?r.trimRight||n.trim_tag_right:"output"===r.type?r.trimRight||n.trim_value_right:void 0)&&function(t,e){if(t&&"html"===t.type){var r=e?/^\s+/g:/^[\t\r ]*\n?/g;t.value=t.value.replace(r,"")}}(s[e+1],u.greedy)})}(r,this.options),r;var f=o===pt.OUTPUT?"output":"tag",p=16<s.length?s.slice(0,13)+"...":s;throw new W(new Error(f+' "'+p+'" not closed'),new dt(s,c,t,e,a))},t}(),bt=function(){function t(){}return t.prototype.renderTemplates=function(u,a){return d(this,void 0,void 0,function(){var e,r,n,i,o,s;return g(this,function(t){switch(t.label){case 0:Q(a,"unable to evalTemplates: scope undefined"),e="",r=0,n=u,t.label=1;case 1:if(!(r<n.length))return[3,6];i=n[r],t.label=2;case 2:return t.trys.push([2,4,,5]),o=e,[4,i.render(a)];case 3:return e=o+t.sent(),[3,5];case 4:if((s=t.sent())instanceof X)throw s.resolvedHTML=e,s;throw s instanceof J?s:new J(s,i);case 5:return r++,[3,1];case 6:return[2,e]}})})},t}(),xt={"==":function(t,e){return t===e},"!=":function(t,e){return t!==e},">":function(t,e){return null!==t&&null!==e&&e<t},"<":function(t,e){return null!==t&&null!==e&&t<e},">=":function(t,e){return null!==t&&null!==e&&e<=t},"<=":function(t,e){return null!==t&&null!==e&&t<=e},contains:function(t,e){return!!t&&("function"==typeof t.indexOf&&-1<t.indexOf(e))},and:function(t,e){return kt(t)&&kt(e)},or:function(t,e){return kt(t)||kt(e)}};function Tt(t,e){Q(e,"unable to evalExp: scope undefined");for(var r,n=I,i=0;i<n.length;i++){var o=n[i],s=new RegExp("^("+y.source+")("+o.source+")("+y.source+")$");if(r=t.match(s)){var u=Tt(r[1],e);return(0,xt[r[2].trim()])(u,Tt(r[3],e))}}if(r=t.match(D)){for(var a=Et(r[1],e),c=Et(r[2],e),l=[],f=a;f<=c;f++)l.push(f);return l}return Et(t,e)}function Et(t,e){if(t=t&&t.trim()){if(r=t,P.test(r))return function(t){var e=t.match(U);if(e)return Number(t);if(e=t.match(j))return"true"===t.toLowerCase();if(e=t.match(F))return t.slice(1,-1);throw new TypeError("cannot parse '"+t+"' as literal")}(t);var r,n;if(n=t,A.test(n))return e.get(t);throw new TypeError("cannot eval '"+t+"' as value")}}function kt(t){return!St(t)}function St(t){return!1===t||null==t}var qt=function(t,e){var r;for(M.lastIndex=0;r=M.exec(t);){var n=r[1],i=r[2];this[n]=Et(i,e)}},Rt=function(t){this.token=t},_t=function(o){function s(t,e,r){var n=o.call(this,t)||this;n.name=t.name;var i=s.impls[t.name];return Q(i,"tag "+t.name+" not found"),n.impl=a(i),n.impl.liquid=r,n.impl.parse&&n.impl.parse(t,e),n}return e(s,o),s.prototype.render=function(n){return d(this,void 0,void 0,function(){var e,r;return g(this,function(t){switch(t.label){case 0:return e=new qt(this.token.args,n),"function"!=typeof(r=this.impl).render?[2,""]:[4,r.render(n,e)];case 1:return[2,u(t.sent())]}})})},s.register=function(t,e){s.impls[t]=e},s.clear=function(){s.impls={}},s.impls={},s}(Rt),Ot=new RegExp(""+_.source,"g"),Mt=function(){function s(t,e){void 0===e&&(e=!1);var r=z.exec(t);Q(r,"illegal filter: "+t);var n=r[1],i=r[2]||"",o=s.impls[n];if(!o&&e)throw new TypeError("undefined filter: "+n);this.name=n,this.impl=o||function(t){return t},this.args=this.parseArgs(i)}return s.prototype.parseArgs=function(t){for(var e,r=[];e=Ot.exec(t.trim());){var n=e[0],i=new RegExp(n+"\\s*:","g").exec(e.input);i&&i.index===e.index?r.push("'"+n+"'"):r.push(n)}return r},s.prototype.render=function(t,e){var r=this.args.map(function(t){return Et(t,e)});return r.unshift(t),this.impl.apply(null,r)},s.register=function(t,e){s.impls[t]=e},s.clear=function(){s.impls={}},s.impls={},s}(),Lt=function(){function t(t,e){this.handlers={},this.tokens=t,this.parseToken=e}return t.prototype.on=function(t,e){return this.handlers[t]=e,this},t.prototype.trigger=function(t,e){var r=this.handlers[t];if("function"==typeof r)return r(e),!0},t.prototype.start=function(){var t;for(this.trigger("start");!this.stopRequested&&(t=this.tokens.shift());)if(!(this.trigger("token",t)||"tag"===t.type&&this.trigger("tag:"+t.name,t))){var e=this.parseToken(t,this.tokens);this.trigger("template",e)}return this.stopRequested||this.trigger("end"),this},t.prototype.stop=function(){return this.stopRequested=!0,this},t}(),Pt=function(){function t(t,e){var r,n=(r=t,_.exec(r));Q(n,"illegal value string: "+t);var i=n[0];t=t.substr(n.index+n[0].length);for(var o=[];n=N.exec(t);)o.push([n[0].trim()]);this.initial=i,this.filters=o.map(function(t){return new Mt(t,e)})}return t.prototype.value=function(r){return this.filters.reduce(function(t,e){return e.render(t,r)},Tt(this.initial,r))},t}(),At=function(n){function t(t,e){var r=n.call(this,t)||this;return r.value=new Pt(t.value,e),r}return e(t,n),t.prototype.render=function(e){return d(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.value.value(e)];case 1:return[2,u(t.sent())]}})})},t}(Rt),Ut=function(r){function t(t){var e=r.call(this,t)||this;return e.str=t.value,e}return e(t,r),t.prototype.render=function(){return d(this,void 0,void 0,function(){return g(this,function(t){return[2,this.str]})})},t}(Rt),jt=function(){function t(t){this.liquid=t}return t.prototype.parse=function(t){for(var e,r=[];e=t.shift();)r.push(this.parseToken(e,t));return r},t.prototype.parseToken=function(e,t){try{return"tag"===e.type?new _t(e,t,this.liquid):"output"===e.type?new At(e,this.liquid.options.strict_filters):new Ut(e)}catch(t){throw new B(t,e)}},t.prototype.parseStream=function(t){var r=this;return new Lt(t,function(t,e){return r.parseToken(t,e)})},t}(),Ft=new RegExp("("+x.source+")\\s*=([^]*)"),Dt={parse:function(t){var e=t.args.match(Ft);Q(e,"illegal token "+t.raw),this.key=e[1],this.value=e[2]},render:function(t){var e=new ut;return e[this.key]=this.liquid.evalValue(this.value,t),t.push(e),Promise.resolve("")}};function Ht(r,n){var i=Promise.resolve("init"),o=[];return r.forEach(function(t,e){i=i.then(function(){return n(t,e,r)}).then(function(t){return o.push(t)})}),i.then(function(){return o})}var $t=new RegExp("^("+x.source+")\\s+in\\s+("+_.source+")(?:\\s+"+O.source+")*(?:\\s+(reversed))?(?:\\s+"+O.source+")*$");var Ct={parse:function(t,e){var r,n=this,i=$t.exec(t.args);Q(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.reversed=!!i[3],this.templates=[],this.elseTemplates=[];var o=this.liquid.parser.parseStream(e).on("start",function(){return r=n.templates}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endfor",function(){return o.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(a,c){return d(this,void 0,void 0,function(){var n,e,r,i,o,s,u=this;return g(this,function(t){switch(t.label){case 0:return f(n=Tt(this.collection,a))||(l(n)&&0<n.length?n=[n]:m(n)&&(n=Object.keys(n).map(function(t){return[t,n[t]]}))),f(n)&&n.length?(e=c.offset||0,r=void 0===c.limit?n.length:c.limit,n=n.slice(e,e+r),this.reversed&&n.reverse(),i=n.map(function(t,e){var r={};return r[u.variable]=t,r.forloop={first:0===e,index:e+1,index0:e,last:e===n.length-1,length:n.length,rindex:n.length-e,rindex0:n.length-e-1},r}),o="",s=!1,[4,Ht(i,function(n){return d(u,void 0,void 0,function(){var e,r;return g(this,function(t){switch(t.label){case 0:if(s)return[2];a.push(n),t.label=1;case 1:return t.trys.push([1,3,,4]),e=o,[4,this.liquid.renderer.renderTemplates(this.templates,a)];case 2:return o=e+t.sent(),[3,4];case 3:if(!((r=t.sent())instanceof X))throw r;return o+=r.resolvedHTML,"break"===r.message&&(s=!0),[3,4];case 4:return a.pop(n),[2]}})})})]):[2,this.liquid.renderer.renderTemplates(this.elseTemplates,a)];case 1:return t.sent(),[2,o]}})})}},Nt=new RegExp("("+x.source+")"),Yt={parse:function(t,e){var r=this,n=t.args.match(Nt);Q(n,t.args+" not valid identifier"),this.variable=n[1],this.templates=[];var i=this.liquid.parser.parseStream(e);i.on("tag:endcapture",function(){return i.stop()}).on("template",function(t){return r.templates.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),i.start()},render:function(n){return d(this,void 0,void 0,function(){var e,r;return g(this,function(t){switch(t.label){case 0:return[4,this.liquid.renderer.renderTemplates(this.templates,n)];case 1:return e=t.sent(),(r=new st)[this.variable]=e,n.push(r),[2]}})})}},zt={parse:function(t,e){var r=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var n=[],i=this.liquid.parser.parseStream(e).on("tag:when",function(t){r.cases.push({val:t.args,templates:n=[]})}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endcase",function(){return i.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){for(var e=0;e<this.cases.length;e++){var r=this.cases[e];if(Tt(r.val,t)===Tt(this.cond,t))return this.liquid.renderer.renderTemplates(r.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},It={parse:function(t,e){var r=this.liquid.parser.parseStream(e);r.on("token",function(t){"endcomment"===t.name&&r.stop()}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),r.start()}},Gt=/[^\s,]+/,Vt=new RegExp("with\\s+("+_.source+")"),Wt={parse:function(t){var e=Gt.exec(t.args);e&&(this.staticValue=e[0]),(e=_.exec(t.args))&&(this.value=e[0]),(e=Vt.exec(t.args))&&(this.with=e[1])},render:function(u,a){return d(this,void 0,void 0,function(){var e,r,n,i,o,s;return g(this,function(t){switch(t.label){case 0:return u.opts.dynamicPartials?F.exec(this.value)?(r=this.value.slice(1,-1),[4,this.liquid.parseAndRender(r,u.getAll(),u.opts)]):[3,2]:[3,4];case 1:return e=t.sent(),[3,3];case 2:e=Et(this.value,u),t.label=3;case 3:return[3,5];case 4:e=this.staticValue,t.label=5;case 5:return Q(e,"cannot include with empty filename"),n=u.blocks,i=u.blockMode,u.blocks={},u.blockMode=nt.OUTPUT,this.with&&(a[e]=Et(this.with,u)),[4,this.liquid.getTemplate(e,u.opts)];case 6:return o=t.sent(),u.push(a),[4,this.liquid.renderer.renderTemplates(o,u)];case 7:return s=t.sent(),u.pop(a),u.blocks=n,u.blockMode=i,[2,s]}})})}},Bt={parse:function(t){var e=t.args.match(x);Q(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof st||t instanceof ut)});return e||(e=new ct,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0),--e[this.variable]}},Jt=new RegExp("^(?:("+_.source+")\\s*:\\s*)?(.*)$"),Xt=new RegExp(_.source,"g"),Kt={parse:function(t){var e=Jt.exec(t.args);Q(e,"illegal tag: "+t.raw),this.group=e[1]||"";var r=e[2];for(this.candidates=[];e=Xt.exec(r);)this.candidates.push(e[0]);Q(this.candidates.length,"empty candidates: "+t.raw)},render:function(t){var e="cycle:"+Et(this.group,t)+":"+this.candidates.join(","),r=t.opts.groups=t.opts.groups||{},n=r[e];void 0===n&&(n=r[e]=0);var i=this.candidates[n];return n=(n+1)%this.candidates.length,r[e]=n,Et(i,t)}},Qt={parse:function(t,e){var r,n=this;this.branches=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){return n.branches.push({cond:t.args,templates:r=[]})}).on("tag:elsif",function(t){n.branches.push({cond:t.args,templates:r=[]})}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endif",function(){return i.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){for(var e=0,r=this.branches;e<r.length;e++){var n=r[e];if(kt(Tt(n.cond,t)))return this.liquid.renderer.renderTemplates(n.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},Zt={parse:function(t){var e=t.args.match(x);Q(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof st||t instanceof ut)});e||(e=new at,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0);var r=e[this.variable];return e[this.variable]++,r}},te=/\S+/,ee={parse:function(t,e){var r=te.exec(t.args);r&&(this.staticLayout=r[0]),(r=_.exec(t.args))&&(this.layout=r[0]),this.tpls=this.liquid.parser.parse(e)},render:function(o,s){return d(this,void 0,void 0,function(){var e,r,n,i;return g(this,function(t){switch(t.label){case 0:return Q(e=o.opts.dynamicPartials?Et(this.layout,o):this.staticLayout,"cannot apply layout with empty filename"),o.blockMode=nt.STORE,[4,this.liquid.renderer.renderTemplates(this.tpls,o)];case 1:return r=t.sent(),void 0===o.blocks[""]&&(o.blocks[""]=r),[4,this.liquid.getTemplate(e,o.opts)];case 2:return n=t.sent(),o.push(s),o.blockMode=nt.OUTPUT,[4,this.liquid.renderer.renderTemplates(n,o)];case 3:return i=t.sent(),o.pop(s),[2,i]}})})}},re={parse:function(t,e){var r=this,n=/\w+/.exec(t.args);this.block=n?n[0]:"",this.tpls=[];var i=this.liquid.parser.parseStream(e).on("tag:endblock",function(){return i.stop()}).on("template",function(t){return r.tpls.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(i){return d(this,void 0,void 0,function(){var e,r,n;return g(this,function(t){switch(t.label){case 0:return void 0===(e=i.blocks[this.block])?[3,1]:(n=e,[3,3]);case 1:return[4,this.liquid.renderer.renderTemplates(this.tpls,i)];case 2:n=t.sent(),t.label=3;case 3:return r=n,i.blockMode===nt.STORE?(i.blocks[this.block]=r,[2,""]):[2,r]}})})}},ne={parse:function(t,e){var r=this;this.tokens=[];var n=this.liquid.parser.parseStream(e);n.on("token",function(t){"endraw"===t.name?n.stop():r.tokens.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),n.start()},render:function(){return this.tokens.map(function(t){return t.raw}).join("")}},ie=new RegExp("^("+x.source+")\\s+in\\s+("+_.source+")(?:\\s+"+O.source+")*$"),oe={assign:Dt,for:Ct,capture:Yt,case:zt,comment:It,include:Wt,decrement:Bt,increment:Zt,cycle:Kt,if:Qt,layout:ee,block:re,raw:ne,tablerow:{parse:function(t,e){var r,n=this,i=ie.exec(t.args);Q(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.templates=[];var o=this.liquid.parser.parseStream(e).on("start",function(){return r=n.templates}).on("tag:endtablerow",function(){return o.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(c,l){return d(this,void 0,void 0,function(){var e,r,n,o,i,s,u,a=this;return g(this,function(t){switch(t.label){case 0:return e=Tt(this.collection,c)||[],r=l.offset||0,n=void 0===l.limit?e.length:l.limit,e=e.slice(r,r+n),o=l.cols||e.length,i=e.map(function(t){var e={};return e[a.variable]=t,e}),u="",[4,Ht(i,function(n,i){return d(a,void 0,void 0,function(){var e,r;return g(this,function(t){switch(t.label){case 0:return s=Math.floor(i/o)+1,1===(e=i%o+1)&&(1!==s&&(u+="</tr>"),u+='<tr class="row'+s+'">'),u+='<td class="col'+e+'">',c.push(n),r=u,[4,this.liquid.renderer.renderTemplates(this.templates,c)];case 1:return u=r+t.sent(),u+="</td>",c.pop(n),[2,u]}})})})];case 1:return t.sent(),0<s&&(u+="</tr>"),[2,u]}})})}},unless:{parse:function(t,e){var r,n=this;this.templates=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){r=n.templates,n.cond=t.args}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endunless",function(){return i.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){return St(Tt(this.cond,t))?this.liquid.renderer.renderTemplates(this.templates,t):this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},break:{render:function(){return d(this,void 0,void 0,function(){return g(this,function(t){throw new X("break")})})}},continue:{render:function(){return d(this,void 0,void 0,function(){return g(this,function(t){throw new X("continue")})})}}},se={"&":"&","<":"<",">":">",'"':""","'":"'"},ue={"&":"&","<":"<",">":">",""":'"',"'":"'"};function ae(t){return String(t).replace(/&|<|>|"|'/g,function(t){return se[t]})}var ce={escape:ae,escape_once:function(t){return ae(String(t).replace(/&(amp|lt|gt|#34|#39);/g,function(t){return ue[t]}))},newline_to_br:function(t){return t.replace(/\n/g,"<br />")},strip_html:function(t){return String(t).replace(/<script.*?<\/script>|<!--.*?-->|<style.*?<\/style>|<.*?>/g,"")}},le={append:function(t,e){return t+e},prepend:function(t,e){return e+t},capitalize:function(t){return String(t).charAt(0).toUpperCase()+t.slice(1)},concat:function(t,e){return Array.prototype.concat.call(t,e)},lstrip:function(t){return String(t).replace(/^\s+/,"")},downcase:function(t){return t.toLowerCase()},upcase:function(t){return String(t).toUpperCase()},remove:function(t,e){return t.split(e).join("")},remove_first:function(t,e){return t.replace(e,"")},replace:function(t,e,r){return String(t).split(e).join(r)},replace_first:function(t,e,r){return String(t).replace(e,r)},rstrip:function(t){return String(t).replace(/\s+$/,"")},split:function(t,e){return String(t).split(e)},strip:function(t){return String(t).trim()},strip_newlines:function(t){return String(t).replace(/\n/g,"")},truncate:function(t,e,r){return r=void 0===r?"...":r,e=e||16,(t=String(t)).length<=e?t:t.substr(0,e-r.length)+r},truncatewords:function(t,e,r){void 0===r&&(r="...");var n=t.split(" "),i=n.slice(0,e).join(" ");return n.length>e&&(i+=r),i}},fe={abs:function(t){return Math.abs(t)},ceil:function(t){return Math.ceil(t)},divided_by:function(t,e){return t/e},floor:function(t){return Math.floor(t)},minus:he(function(t,e){return t-e}),modulo:he(function(t,e){return t%e}),round:function(t,e){var r=Math.pow(10,e||0);return Math.round(t*r)/r},plus:he(function(t,e){return Number(t)+Number(e)}),times:function(t,e){return t*e}};function pe(t){var e=String(t).split(".");return 1<e.length?e[1].length:0}function he(n){return function(t,e){var r=Math.max(pe(t),pe(e));return n(t,e).toFixed(r)}}var de={url_decode:function(t){return t.split("+").map(decodeURIComponent).join(" ")},url_encode:function(t){return t.split(" ").map(encodeURIComponent).join("+")}},ge={join:function(t,e){return t.join(void 0===e?" ":e)},last:function(t){return v(t)},first:function(t){return t[0]},map:function(t,e){return t.map(function(t){return t[e]})},reverse:function(t){return t.reverse()},sort:function(t,e){return t.sort(e)},size:function(t){return t.length},slice:function(t,e,r){return void 0===r&&(r=1),t.slice(e,e+r)},uniq:function(t){var e={};return(t||[]).filter(function(t){return!e.hasOwnProperty(t)&&(e[t]=!0)})}},ve=["January","February","March","April","May","June","July","August","September","October","November","December"],me=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],we=ve.map(xe),ye=me.map(xe),be={1:"st",2:"nd",3:"rd",default:"th"};function xe(t){return t.slice(0,3)}var Te={daysInMonth:function(t){return[31,Te.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(t){for(var e=0,r=0;r<t.getMonth();++r)e+=Te.daysInMonth(t)[r];return e+t.getDate()},getWeekOfYear:function(t,e){var r=this.getDayOfYear(t)+(e-t.getDay()),n=7-new Date(t.getFullYear(),0,1).getDay()+e;return w(String(Math.floor((r-n)/7)+1),2,"0")},isLeapYear:function(t){var e=t.getFullYear();return!(0!=(3&e)||!(e%100||e%400==0&&e))},getSuffix:function(t){var e=t.getDate().toString(),r=parseInt(e.slice(-1));return be[r]||be.default},century:function(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}},Ee={a:function(t){return ye[t.getDay()]},A:function(t){return me[t.getDay()]},b:function(t){return we[t.getMonth()]},B:function(t){return ve[t.getMonth()]},c:function(t){return t.toLocaleString()},C:function(t){return Te.century(t)},d:function(t){return w(t.getDate(),2,"0")},e:function(t){return w(t.getDate(),2)},H:function(t){return w(t.getHours(),2,"0")},I:function(t){return w(String(t.getHours()%12||12),2,"0")},j:function(t){return w(Te.getDayOfYear(t),3,"0")},k:function(t){return w(t.getHours(),2)},l:function(t){return w(String(t.getHours()%12||12),2)},L:function(t){return w(t.getMilliseconds(),3,"0")},m:function(t){return w(t.getMonth()+1,2,"0")},M:function(t){return w(t.getMinutes(),2,"0")},p:function(t){return t.getHours()<12?"AM":"PM"},P:function(t){return t.getHours()<12?"am":"pm"},q:function(t){return Te.getSuffix(t)},s:function(t){return Math.round(t.valueOf()/1e3)},S:function(t){return w(t.getSeconds(),2,"0")},u:function(t){return t.getDay()||7},U:function(t){return Te.getWeekOfYear(t,0)},w:function(t){return t.getDay()},W:function(t){return Te.getWeekOfYear(t,1)},x:function(t){return t.toLocaleDateString()},X:function(t){return t.toLocaleTimeString()},y:function(t){return t.getFullYear().toString().substring(2,4)},Y:function(t){return t.getFullYear()},z:function(t){var e=t.getTimezoneOffset()/60*100;return(0<e?"-":"+")+w(String(Math.abs(e)),4,"0")},"%":function(){return"%"}};Ee.h=Ee.b,Ee.N=Ee.L;var ke=h({},ce,le,fe,de,{date:function(t,e){var r,n=t;return"now"===t?n=new Date:l(t)&&(n=new Date(t)),(r=n)instanceof Date&&!isNaN(r.getTime())?function(t,e){for(var r="",n=e;;){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 s=o[0].charAt(1),u=Ee[s];r+=u?u.call(this,t):"%"+s}}(n,e):t}},{default:function(t,e){return kt(t)?t:e}},ge);return function(){function e(t){void 0===t&&(t={});var r=this,e=h({},et,rt(t));e.cache&&(this.cache={}),this.options=e,this.parser=new jt(this),this.renderer=new bt,this.tokenizer=new yt(this.options),p(oe,function(t,e){return r.registerTag(e,t)}),p(ke,function(t,e){return r.registerFilter(e,t)})}return e.prototype.parse=function(t,e){var r=this.tokenizer.tokenize(t,e);return this.parser.parse(r)},e.prototype.render=function(t,e,r){var n=h({},this.options,rt(r)),i=new it(e,n);return this.renderer.renderTemplates(t,i)},e.prototype.parseAndRender=function(r,n,i){return d(this,void 0,void 0,function(){var e;return g(this,function(t){switch(t.label){case 0:return[4,this.parse(r)];case 1:return e=t.sent(),[2,this.render(e,n,i)]}})})},e.prototype.getTemplate=function(f,p){return d(this,void 0,void 0,function(){var e,r,n,i,o,s,u,a,c,l=this;return g(this,function(t){switch(t.label){case 0:e=rt(p),r=e.root?e.root.concat(this.options.root):this.options.root,n=r.map(function(t){return ft.resolve(t,f,l.options.extname)}),i=0,o=n,t.label=1;case 1:return i<o.length?(s=o[i],[4,ft.exists(s)]):[3,5];case 2:return t.sent()?this.options.cache&&this.cache[s]?[2,this.cache[s]]:(a=this.parse,[4,ft.readFile(s)]):[3,4];case 3:return u=a.apply(this,[t.sent(),s]),this.options.cache&&(this.cache[s]=u),[2,u];case 4:return i++,[3,1];case 5:throw(c=new Error("ENOENT")).message='ENOENT: Failed to lookup "'+f+'" in "'+r+'"',c.code="ENOENT",c}})})},e.prototype.renderFile=function(n,i,o){return d(this,void 0,void 0,function(){var e,r;return g(this,function(t){switch(t.label){case 0:return e=rt(o),[4,this.getTemplate(n,e)];case 1:return r=t.sent(),[2,this.render(r,i,o)]}})})},e.prototype.evalValue=function(t,e){return new Pt(t,this.options.strict_filters).value(e)},e.prototype.registerFilter=function(t,e){return Mt.register(t,e)},e.prototype.registerTag=function(t,e){return _t.register(t,e)},e.prototype.plugin=function(t){return t.call(this,e)},e.prototype.express=function(){var i=this;return function(t,e,r){var n={root:this.root};i.renderFile(t,e,n).then(function(t){return r(null,t)},r)}},(e.default=e).isTruthy=kt,e.isFalsy=St,e.evalExp=Tt,e.evalValue=Et,e.Types=lt,e}()}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Liquid=e()}(this,function(){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function e(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var v=function(){return(v=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function h(o,s,u,a){return new(u||(u=Promise))(function(t,e){function r(t){try{i(a.next(t))}catch(t){e(t)}}function n(t){try{i(a.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new u(function(t){t(e.value)}).then(r,n)}i((a=a.apply(o,s||[])).next())})}function d(r,n){var i,o,s,t,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,o=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){u.label=e[1];break}if(6===e[0]&&u.label<s[1]){u.label=s[1],s=e;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(e);break}s[2]&&u.ops.pop(),u.trys.pop();continue}e=n.call(r,u)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var i=Object.prototype.toString,o=Array.prototype.toString;function l(t){return"[object String]"===i.call(t)}function s(t){return"function"==typeof t}function u(t){return c(t)?"":s(t.to_liquid)?u(t.to_liquid()):s(t.toLiquid)?u(t.toLiquid()):s(t.to_s)?t.to_s():-1<[i,o].indexOf(t.toString)?(e=t,r=[],JSON.stringify(e,function(t,e){if(m(e)){if(-1!==r.indexOf(e))return;r.push(e)}return e})):s(t.toString)?t.toString():i.call(t);var e,r}function a(t){return Object.create(t)}function c(t){return null==t}function f(t){return"[object Array]"===i.call(t)}function p(t,e){for(var r in t=t||{})if(t.hasOwnProperty(r)&&!1===e(t[r],r,t))break;return t}function g(t){return t[t.length-1]}function m(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function w(t,e,r){void 0===r&&(r=" ");for(var n=e-(t=String(t)).length;0<n--;)t=r+t;return t}var t=new RegExp(/'[^']*'/.source+"|"+/"[^"]*"/.source),y=new RegExp("(?:"+t.source+"|[^'\"])*"),r=/-?\d+\.?\d*|\.?\d+/,b=/true|false/,x=/[\w-]+[?]?/,T=new RegExp("\\[(?:"+t.source+"|[\\w-\\.]+)\\]"),E=new RegExp("(?:"+t.source+"|"+b.source+"|"+r.source+")"),k=new RegExp(x.source+"(?:\\."+x.source+"|"+T.source+")*"),S=new RegExp("(?:"+k.source+"|"+r.source+")"),_=new RegExp("\\("+S.source+"\\.\\."+S.source+"\\)"),q=new RegExp("\\(("+S.source+")\\.\\.("+S.source+")\\)"),R=new RegExp("(?:"+k.source+"|"+E.source+"|"+_.source+")"),O=new RegExp("(?:"+x.source+")\\s*:\\s*(?:"+R.source+")"),M=new RegExp("("+x.source+")\\s*:\\s*("+R.source+")","g"),L=new RegExp("^\\s*("+x.source+")\\s*([\\s\\S]*?)\\s*$"),P=new RegExp("^"+E.source+"$","i"),A=new RegExp("^"+k.source+"$"),U=new RegExp("^"+r.source+"$"),j=new RegExp("^"+b.source+"$","i"),F=new RegExp("^"+t.source+"$"),D=new RegExp("^"+q.source+"$"),H=new RegExp("^"+/-?\d+/.source+"$"),$=new RegExp("(?:"+x.source+"\\s*:\\s*)?"+R.source),C=new RegExp($.source+"(\\s*,\\s*"+$.source+")*"),N=new RegExp(x.source+"(?:\\s*:\\s*"+C.source+")?","g"),Y=new RegExp("("+x.source+")(?:\\s*:\\s*("+C.source+"))?"),z=new RegExp("^"+Y.source+"$"),I=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/];function G(){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}var V=function(){function t(t,e){this.input=e.input,this.file=e.file,this.originalError=t,this.token=e}return t.prototype.captureStackTrace=function(t){this.name=t.constructor.name,G.call(t);var e,i,o,r,s,n=this.originalError,u=(e=this.input,i=this.token.line,o=e.split("\n"),r=Math.max(i-2,1),s=Math.min(i+3,o.length),function(t,e,r){1===arguments.length&&(e=t,t=0),r=r||1;for(var n=[],i=t;i<e;i+=r)n.push(i);return n}(r,s+1).map(function(t){var e=t===i?">> ":" ",r=w(String(t),String(s).length),n=o[t-1];return""+e+r+"| "+n}).join("\n"));this.message=function(t,e){t=t||"",e.file&&(t+=", file:"+e.file);e.line&&(t+=", line:"+e.line+", col:"+e.col);return t}(n.message,this.token),this.stack=this.message+"\n"+u+"\n"+(this.stack||this.message)+(n.stack?"\nFrom "+n.stack:"")},t}(),W=function(n){function t(t,e){var r=n.call(this,{message:t},e)||this;return n.prototype.captureStackTrace.call(r,r),r}return e(t,n),t}(V);W.prototype=a(Error.prototype),W.prototype.constructor=W;var B=function(n){function t(t,e){var r=n.call(this,t,e)||this;return r.message=t.message,n.prototype.captureStackTrace.call(r,r),r}return e(t,n),t}(V);B.prototype=a(Error.prototype),B.prototype.constructor=B;var J=function(n){function t(t,e){var r=n.call(this,t,e.token)||this;return r.message=t.message,n.prototype.captureStackTrace.call(r,r),r}return e(t,n),t}(V);J.prototype=a(Error.prototype),J.prototype.constructor=J;var X=function(t){G.call(this),this.message=t+""};X.prototype=a(Error.prototype),X.prototype.constructor=X;var K=function(t){G.call(this),this.message=t+""};function Q(t,e){if(!t)throw new K(e=e||"expect "+t+" to be true")}K.prototype=a(Error.prototype),K.prototype.constructor=K;var Z,tt,et={root:["."],cache:!1,extname:"",dynamicPartials:!0,trim_tag_right:!1,trim_tag_left:!1,trim_output_right:!1,trim_output_left:!1,greedy:!0,tag_delimiter_left:"{%",tag_delimiter_right:"%}",output_delimiter_left:"{{",output_delimiter_right:"}}",strict_filters:!1,strict_variables:!1};function rt(t){var e;return(t=t||{}).hasOwnProperty("root")&&(t.root=f(e=t.root)?e:l(e)?[e]:[]),t}function nt(t){return v({},et,t)}(tt=Z||(Z={}))[tt.OUTPUT=0]="OUTPUT",tt[tt.STORE=1]="STORE";var it=Z,ot=function(){function t(t,e){void 0===t&&(t={}),this.blocks={},this.blockMode=it.OUTPUT,this.opts=nt(e),this.contexts=[t||{}]}return t.prototype.getAll=function(){return this.contexts.reduce(function(t,e){return function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return e=m(e)?e:{},t.forEach(function(t){return function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}(e,t)}),e}(t,e)},a(null))},t.prototype.get=function(t){var r=this,e=this.propertyAccessSeq(t),n=this.findContextFor(e[0])||g(this.contexts);return e.reduce(function(t,e){return r.readProperty(t,e)},n)},t.prototype.set=function(t,r){var n=this.propertyAccessSeq(t),i=this.findContextFor(n[0])||g(this.contexts);n.some(function(t,e){return!m(i)||(e===n.length-1?(i[t]=r,!0):(void 0===i[t]&&(i[t]={}),void(i=i[t])))})},t.prototype.unshift=function(t){return this.contexts.unshift(t)},t.prototype.push=function(t){return this.contexts.push(t)},t.prototype.pop=function(e){if(!arguments.length)return this.contexts.pop();var t=this.contexts.findIndex(function(t){return t===e});if(-1===t)throw new TypeError("scope not found, cannot pop");return this.contexts.splice(t,1)[0]},t.prototype.findContextFor=function(t,e){void 0===e&&(e=function(){return!0});for(var r=this.contexts.length-1;0<=r;r--){var n=this.contexts[r];if(e(n)&&t in n)return n}return null},t.prototype.readProperty=function(t,e){var r,n;if(c(t)?r=void 0:(t=function(t){if(s(t.to_liquid))return t.to_liquid();if(s(t.toLiquid))return t.toLiquid();return t}(t),r="size"===e?c((n=t).size)&&(f(n)||l(n))?n.length:n.size:t[e],s(t.liquid_method_missing)&&(r=t.liquid_method_missing(e))),c(r)&&this.opts.strict_variables)throw new TypeError("undefined variable: "+e);return r},t.prototype.propertyAccessSeq=function(t){t=String(t);for(var e,r,n=[],i="",o=0;o<t.length;)switch(t[o]){case"[":u();var s=t[o+1];o=/['"]/.test(s)?(Q(-1!==(e=t.indexOf(s,o+2)),"unbalanced "+s+": "+t),i=t.slice(o+2,e),u(),e+2):(Q(-1!==(e=st(t,o+1)),"unbalanced []: "+t),i=t.slice(o+1,e),r=i,H.test(r)||(i=String(this.get(i))),u(),e+1);break;case".":u(),o++;break;default:i+=t[o],o++}if(u(),!n.length)throw new TypeError('invalid path:"'+t+'"');return n;function u(){i.length&&n.push(i),i=""}},t}();function st(t,e){for(var r=1,n=e;n<t.length;n++)if("["===t[n]&&r++,"]"===t[n]&&0===--r)return n;return-1}var ut=function(){},at=function(){},ct=function(){},lt=function(){},ft=Object.freeze({AssignScope:at,CaptureScope:ut,IncrementScope:ct,DecrementScope:lt,ParseError:B,TokenizationError:W,RenderBreakError:X,AssertionError:K});var pt={readFile:function(n){return h(this,void 0,void 0,function(){return d(this,function(t){return[2,new Promise(function(t,e){var r=new XMLHttpRequest;r.onload=function(){200<=r.status&&r.status<300?t(r.responseText):e(new Error(r.statusText))},r.onerror=function(){e(new Error("An error occurred whilst receiving the response."))},r.open("GET",n),r.send()})]})})},resolve:function(t,e,i){return t.length&&"/"!==g(t)&&(t+="/"),function(t,e){var r=document.createElement("base");r.href=t;var n=document.getElementsByTagName("head")[0];n.insertBefore(r,n.firstChild);var i=document.createElement("a");i.href=e;var o=i.href;return n.removeChild(r),o}(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,function(t,e,r){var n=r.split("/").pop();return/\.\w+$/.test(n)?t:e+r+i})},exists:function(){return h(this,void 0,void 0,function(){return d(this,function(t){return[2,!0]})})}};var ht,dt,gt=function(t,e,r,n,i){this.col=e,this.line=i,this.raw=t,this.input=r,this.file=n},vt=function(s){function t(t,e,r,n,i){var o=s.call(this,t,e,r,n,i)||this;return o.type="html",o.value=t,o}return e(t,s),t}(gt),mt=function(u){function t(t,e,r,n,i,o){var s=u.call(this,t,r,n,i,o)||this;return s.trimLeft="-"===e[0],s.trimRight="-"===e[e.length-1],s.value=e.slice(s.trimLeft?1:0,s.trimRight?-1:e.length).trim(),s}return e(t,u),t}(gt),wt=function(a){function t(t,e,r,n,i,o){var s=a.call(this,t,e,r,n,i,o)||this;s.type="tag";var u=s.value.match(L);if(!u)throw new W("illegal tag syntax",s);return s.name=u[1],s.args=u[2],s}return e(t,a),t}(mt),yt=function(u){function t(t,e,r,n,i,o){var s=u.call(this,t,e,r,n,i,o)||this;return s.type="output",s}return e(t,u),t}(mt);(dt=ht||(ht={}))[dt.HTML=0]="HTML",dt[dt.OUTPUT=1]="OUTPUT",dt[dt.TAG=2]="TAG";var bt=function(){function t(t){this.options=nt(t)}return t.prototype.tokenize=function(t,e){for(var r=[],n=this.options.tag_delimiter_left,i=this.options.tag_delimiter_right,o=this.options.output_delimiter_left,s=this.options.output_delimiter_right,u=0,a=1,c=ht.HTML,l="",f=0,p=1,h=1;u<t.length;){if("\n"===t[u]&&(a++,f=u+1),c===ht.HTML){if(t.substr(u,o.length)===o){l&&r.push(new vt(l,h,t,e,p)),p=a,h=u-f+1,u+=(l=o).length,c=ht.OUTPUT;continue}if(t.substr(u,n.length)===n){l&&r.push(new vt(l,h,t,e,p)),p=a,h=u-f+1,u+=(l=n).length,c=ht.TAG;continue}}else{if(c===ht.OUTPUT&&t.substr(u,s.length)===s){l+=s,r.push(new yt(l,l.slice(o.length,-s.length),h,t,e,p)),l="",p=a,h=(u+=s.length)-f+1,c=ht.HTML;continue}if(t.substr(u,i.length)===i){l+=i,r.push(new wt(l,l.slice(n.length,-i.length),h,t,e,p)),l="",p=a,h=(u+=i.length)-f+1,c=ht.HTML;continue}}l+=t[u++]}if(c===ht.HTML)return l&&r.push(new vt(l,h,t,e,p)),function(s,u){u=v({greedy:!0},u);var a=!1;s.forEach(function(t,e){var r,n,i,o;i=t,o=u,!a&&("tag"===i.type?i.trimLeft||o.trim_tag_left:"output"===i.type?i.trimLeft||o.trim_output_left:void 0)&&function(t,e){if(t&&"html"===t.type){var r=e?/\s+$/g:/[\t\r ]*$/g;t.value=t.value.replace(r,"")}}(s[e-1],u.greedy),"tag"===t.type&&"raw"===t.name&&(a=!0),"tag"===t.type&&"endraw"===t.name&&(a=!1),r=t,n=u,!a&&("tag"===r.type?r.trimRight||n.trim_tag_right:"output"===r.type?r.trimRight||n.trim_output_right:void 0)&&function(t,e){if(t&&"html"===t.type){var r=e?/^\s+/g:/^[\t\r ]*\n?/g;t.value=t.value.replace(r,"")}}(s[e+1],u.greedy)})}(r,this.options),r;var d=c===ht.OUTPUT?"output":"tag",g=16<l.length?l.slice(0,13)+"...":l;throw new W(new Error(d+' "'+g+'" not closed'),new gt(l,h,t,e,p))},t}(),xt=function(){function t(){}return t.prototype.renderTemplates=function(u,a){return h(this,void 0,void 0,function(){var e,r,n,i,o,s;return d(this,function(t){switch(t.label){case 0:Q(a,"unable to evalTemplates: scope undefined"),e="",r=0,n=u,t.label=1;case 1:if(!(r<n.length))return[3,6];i=n[r],t.label=2;case 2:return t.trys.push([2,4,,5]),o=e,[4,i.render(a)];case 3:return e=o+t.sent(),[3,5];case 4:if((s=t.sent())instanceof X)throw s.resolvedHTML=e,s;throw s instanceof J?s:new J(s,i);case 5:return r++,[3,1];case 6:return[2,e]}})})},t}(),Tt={"==":function(t,e){return t===e},"!=":function(t,e){return t!==e},">":function(t,e){return null!==t&&null!==e&&e<t},"<":function(t,e){return null!==t&&null!==e&&t<e},">=":function(t,e){return null!==t&&null!==e&&e<=t},"<=":function(t,e){return null!==t&&null!==e&&t<=e},contains:function(t,e){return!!t&&("function"==typeof t.indexOf&&-1<t.indexOf(e))},and:function(t,e){return St(t)&&St(e)},or:function(t,e){return St(t)||St(e)}};function Et(t,e){Q(e,"unable to evalExp: scope undefined");for(var r,n=I,i=0;i<n.length;i++){var o=n[i],s=new RegExp("^("+y.source+")("+o.source+")("+y.source+")$");if(r=t.match(s)){var u=Et(r[1],e);return(0,Tt[r[2].trim()])(u,Et(r[3],e))}}if(r=t.match(D)){for(var a=kt(r[1],e),c=kt(r[2],e),l=[],f=a;f<=c;f++)l.push(f);return l}return kt(t,e)}function kt(t,e){if(t=t&&t.trim()){if(r=t,P.test(r))return function(t){var e=t.match(U);if(e)return Number(t);if(e=t.match(j))return"true"===t.toLowerCase();if(e=t.match(F))return t.slice(1,-1);throw new TypeError("cannot parse '"+t+"' as literal")}(t);var r,n;if(n=t,A.test(n))return e.get(t);throw new TypeError("cannot eval '"+t+"' as value")}}function St(t){return!_t(t)}function _t(t){return!1===t||null==t}var qt=function(t,e){var r;for(M.lastIndex=0;r=M.exec(t);){var n=r[1],i=r[2];this[n]=kt(i,e)}},Rt=function(t){this.token=t},Ot=function(o){function s(t,e,r){var n=o.call(this,t)||this;n.name=t.name;var i=s.impls[t.name];return Q(i,"tag "+t.name+" not found"),n.impl=a(i),n.impl.liquid=r,n.impl.parse&&n.impl.parse(t,e),n}return e(s,o),s.prototype.render=function(n){return h(this,void 0,void 0,function(){var e,r;return d(this,function(t){switch(t.label){case 0:return e=new qt(this.token.args,n),"function"!=typeof(r=this.impl).render?[2,""]:[4,r.render(n,e)];case 1:return[2,u(t.sent())]}})})},s.register=function(t,e){s.impls[t]=e},s.clear=function(){s.impls={}},s.impls={},s}(Rt),Mt=new RegExp(""+R.source,"g"),Lt=function(){function s(t,e){void 0===e&&(e=!1);var r=z.exec(t);Q(r,"illegal filter: "+t);var n=r[1],i=r[2]||"",o=s.impls[n];if(!o&&e)throw new TypeError("undefined filter: "+n);this.name=n,this.impl=o||function(t){return t},this.args=this.parseArgs(i)}return s.prototype.parseArgs=function(t){for(var e,r=[];e=Mt.exec(t.trim());){var n=e[0],i=new RegExp(n+"\\s*:","g").exec(e.input);i&&i.index===e.index?r.push("'"+n+"'"):r.push(n)}return r},s.prototype.render=function(t,e){var r=this.args.map(function(t){return kt(t,e)});return r.unshift(t),this.impl.apply(null,r)},s.register=function(t,e){s.impls[t]=e},s.clear=function(){s.impls={}},s.impls={},s}(),Pt=function(){function t(t,e){this.handlers={},this.tokens=t,this.parseToken=e}return t.prototype.on=function(t,e){return this.handlers[t]=e,this},t.prototype.trigger=function(t,e){var r=this.handlers[t];if("function"==typeof r)return r(e),!0},t.prototype.start=function(){var t;for(this.trigger("start");!this.stopRequested&&(t=this.tokens.shift());)if(!(this.trigger("token",t)||"tag"===t.type&&this.trigger("tag:"+t.name,t))){var e=this.parseToken(t,this.tokens);this.trigger("template",e)}return this.stopRequested||this.trigger("end"),this},t.prototype.stop=function(){return this.stopRequested=!0,this},t}(),At=function(){function t(t,e){var r,n=(r=t,R.exec(r));Q(n,"illegal value string: "+t);var i=n[0];t=t.substr(n.index+n[0].length);for(var o=[];n=N.exec(t);)o.push([n[0].trim()]);this.initial=i,this.filters=o.map(function(t){return new Lt(t,e)})}return t.prototype.value=function(r){return this.filters.reduce(function(t,e){return e.render(t,r)},Et(this.initial,r))},t}(),Ut=function(n){function t(t,e){var r=n.call(this,t)||this;return r.value=new At(t.value,e),r}return e(t,n),t.prototype.render=function(e){return h(this,void 0,void 0,function(){return d(this,function(t){switch(t.label){case 0:return[4,this.value.value(e)];case 1:return[2,u(t.sent())]}})})},t}(Rt),jt=function(r){function t(t){var e=r.call(this,t)||this;return e.str=t.value,e}return e(t,r),t.prototype.render=function(){return h(this,void 0,void 0,function(){return d(this,function(t){return[2,this.str]})})},t}(Rt),Ft=function(){function t(t){this.liquid=t}return t.prototype.parse=function(t){for(var e,r=[];e=t.shift();)r.push(this.parseToken(e,t));return r},t.prototype.parseToken=function(e,t){try{return"tag"===e.type?new Ot(e,t,this.liquid):"output"===e.type?new Ut(e,this.liquid.options.strict_filters):new jt(e)}catch(t){throw new B(t,e)}},t.prototype.parseStream=function(t){var r=this;return new Pt(t,function(t,e){return r.parseToken(t,e)})},t}(),Dt=new RegExp("("+x.source+")\\s*=([^]*)"),Ht={parse:function(t){var e=t.args.match(Dt);Q(e,"illegal token "+t.raw),this.key=e[1],this.value=e[2]},render:function(t){var e=new at;return e[this.key]=this.liquid.evalValue(this.value,t),t.push(e),Promise.resolve("")}};function $t(r,n){var i=Promise.resolve("init"),o=[];return r.forEach(function(t,e){i=i.then(function(){return n(t,e,r)}).then(function(t){return o.push(t)})}),i.then(function(){return o})}var Ct=new RegExp("^("+x.source+")\\s+in\\s+("+R.source+")(?:\\s+"+O.source+")*(?:\\s+(reversed))?(?:\\s+"+O.source+")*$");var Nt={parse:function(t,e){var r,n=this,i=Ct.exec(t.args);Q(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.reversed=!!i[3],this.templates=[],this.elseTemplates=[];var o=this.liquid.parser.parseStream(e).on("start",function(){return r=n.templates}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endfor",function(){return o.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(a,c){return h(this,void 0,void 0,function(){var n,e,r,i,o,s,u=this;return d(this,function(t){switch(t.label){case 0:return f(n=Et(this.collection,a))||(l(n)&&0<n.length?n=[n]:m(n)&&(n=Object.keys(n).map(function(t){return[t,n[t]]}))),f(n)&&n.length?(e=c.offset||0,r=void 0===c.limit?n.length:c.limit,n=n.slice(e,e+r),this.reversed&&n.reverse(),i=n.map(function(t,e){var r={};return r[u.variable]=t,r.forloop={first:0===e,index:e+1,index0:e,last:e===n.length-1,length:n.length,rindex:n.length-e,rindex0:n.length-e-1},r}),o="",s=!1,[4,$t(i,function(n){return h(u,void 0,void 0,function(){var e,r;return d(this,function(t){switch(t.label){case 0:if(s)return[2];a.push(n),t.label=1;case 1:return t.trys.push([1,3,,4]),e=o,[4,this.liquid.renderer.renderTemplates(this.templates,a)];case 2:return o=e+t.sent(),[3,4];case 3:if(!((r=t.sent())instanceof X))throw r;return o+=r.resolvedHTML,"break"===r.message&&(s=!0),[3,4];case 4:return a.pop(n),[2]}})})})]):[2,this.liquid.renderer.renderTemplates(this.elseTemplates,a)];case 1:return t.sent(),[2,o]}})})}},Yt=new RegExp("("+x.source+")"),zt={parse:function(t,e){var r=this,n=t.args.match(Yt);Q(n,t.args+" not valid identifier"),this.variable=n[1],this.templates=[];var i=this.liquid.parser.parseStream(e);i.on("tag:endcapture",function(){return i.stop()}).on("template",function(t){return r.templates.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),i.start()},render:function(n){return h(this,void 0,void 0,function(){var e,r;return d(this,function(t){switch(t.label){case 0:return[4,this.liquid.renderer.renderTemplates(this.templates,n)];case 1:return e=t.sent(),(r=new ut)[this.variable]=e,n.push(r),[2]}})})}},It={parse:function(t,e){var r=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var n=[],i=this.liquid.parser.parseStream(e).on("tag:when",function(t){r.cases.push({val:t.args,templates:n=[]})}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endcase",function(){return i.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){for(var e=0;e<this.cases.length;e++){var r=this.cases[e];if(Et(r.val,t)===Et(this.cond,t))return this.liquid.renderer.renderTemplates(r.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},Gt={parse:function(t,e){var r=this.liquid.parser.parseStream(e);r.on("token",function(t){"endcomment"===t.name&&r.stop()}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),r.start()}},Vt=/[^\s,]+/,Wt=new RegExp("with\\s+("+R.source+")"),Bt={parse:function(t){var e=Vt.exec(t.args);e&&(this.staticValue=e[0]),(e=R.exec(t.args))&&(this.value=e[0]),(e=Wt.exec(t.args))&&(this.with=e[1])},render:function(u,a){return h(this,void 0,void 0,function(){var e,r,n,i,o,s;return d(this,function(t){switch(t.label){case 0:return u.opts.dynamicPartials?F.exec(this.value)?(r=this.value.slice(1,-1),[4,this.liquid.parseAndRender(r,u.getAll(),u.opts)]):[3,2]:[3,4];case 1:return e=t.sent(),[3,3];case 2:e=kt(this.value,u),t.label=3;case 3:return[3,5];case 4:e=this.staticValue,t.label=5;case 5:return Q(e,"cannot include with empty filename"),n=u.blocks,i=u.blockMode,u.blocks={},u.blockMode=it.OUTPUT,this.with&&(a[e]=kt(this.with,u)),[4,this.liquid.getTemplate(e,u.opts)];case 6:return o=t.sent(),u.push(a),[4,this.liquid.renderer.renderTemplates(o,u)];case 7:return s=t.sent(),u.pop(a),u.blocks=n,u.blockMode=i,[2,s]}})})}},Jt={parse:function(t){var e=t.args.match(x);Q(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof ut||t instanceof at)});return e||(e=new lt,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0),--e[this.variable]}},Xt=new RegExp("^(?:("+R.source+")\\s*:\\s*)?(.*)$"),Kt=new RegExp(R.source,"g"),Qt={parse:function(t){var e=Xt.exec(t.args);Q(e,"illegal tag: "+t.raw),this.group=e[1]||"";var r=e[2];for(this.candidates=[];e=Kt.exec(r);)this.candidates.push(e[0]);Q(this.candidates.length,"empty candidates: "+t.raw)},render:function(t){var e="cycle:"+kt(this.group,t)+":"+this.candidates.join(","),r=t.opts.groups=t.opts.groups||{},n=r[e];void 0===n&&(n=r[e]=0);var i=this.candidates[n];return n=(n+1)%this.candidates.length,r[e]=n,kt(i,t)}},Zt={parse:function(t,e){var r,n=this;this.branches=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){return n.branches.push({cond:t.args,templates:r=[]})}).on("tag:elsif",function(t){n.branches.push({cond:t.args,templates:r=[]})}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endif",function(){return i.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){for(var e=0,r=this.branches;e<r.length;e++){var n=r[e];if(St(Et(n.cond,t)))return this.liquid.renderer.renderTemplates(n.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},te={parse:function(t){var e=t.args.match(x);Q(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof ut||t instanceof at)});e||(e=new ct,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0);var r=e[this.variable];return e[this.variable]++,r}},ee=/\S+/,re={parse:function(t,e){var r=ee.exec(t.args);r&&(this.staticLayout=r[0]),(r=R.exec(t.args))&&(this.layout=r[0]),this.tpls=this.liquid.parser.parse(e)},render:function(o,s){return h(this,void 0,void 0,function(){var e,r,n,i;return d(this,function(t){switch(t.label){case 0:return Q(e=o.opts.dynamicPartials?kt(this.layout,o):this.staticLayout,"cannot apply layout with empty filename"),o.blockMode=it.STORE,[4,this.liquid.renderer.renderTemplates(this.tpls,o)];case 1:return r=t.sent(),void 0===o.blocks[""]&&(o.blocks[""]=r),[4,this.liquid.getTemplate(e,o.opts)];case 2:return n=t.sent(),o.push(s),o.blockMode=it.OUTPUT,[4,this.liquid.renderer.renderTemplates(n,o)];case 3:return i=t.sent(),o.pop(s),[2,i]}})})}},ne={parse:function(t,e){var r=this,n=/\w+/.exec(t.args);this.block=n?n[0]:"",this.tpls=[];var i=this.liquid.parser.parseStream(e).on("tag:endblock",function(){return i.stop()}).on("template",function(t){return r.tpls.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(i){return h(this,void 0,void 0,function(){var e,r,n;return d(this,function(t){switch(t.label){case 0:return void 0===(e=i.blocks[this.block])?[3,1]:(n=e,[3,3]);case 1:return[4,this.liquid.renderer.renderTemplates(this.tpls,i)];case 2:n=t.sent(),t.label=3;case 3:return r=n,i.blockMode===it.STORE?(i.blocks[this.block]=r,[2,""]):[2,r]}})})}},ie={parse:function(t,e){var r=this;this.tokens=[];var n=this.liquid.parser.parseStream(e);n.on("token",function(t){"endraw"===t.name?n.stop():r.tokens.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),n.start()},render:function(){return this.tokens.map(function(t){return t.raw}).join("")}},oe=new RegExp("^("+x.source+")\\s+in\\s+("+R.source+")(?:\\s+"+O.source+")*$"),se={assign:Ht,for:Nt,capture:zt,case:It,comment:Gt,include:Bt,decrement:Jt,increment:te,cycle:Qt,if:Zt,layout:re,block:ne,raw:ie,tablerow:{parse:function(t,e){var r,n=this,i=oe.exec(t.args);Q(i,"illegal tag: "+t.raw),this.variable=i[1],this.collection=i[2],this.templates=[];var o=this.liquid.parser.parseStream(e).on("start",function(){return r=n.templates}).on("tag:endtablerow",function(){return o.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(c,l){return h(this,void 0,void 0,function(){var e,r,n,o,i,s,u,a=this;return d(this,function(t){switch(t.label){case 0:return e=Et(this.collection,c)||[],r=l.offset||0,n=void 0===l.limit?e.length:l.limit,e=e.slice(r,r+n),o=l.cols||e.length,i=e.map(function(t){var e={};return e[a.variable]=t,e}),u="",[4,$t(i,function(n,i){return h(a,void 0,void 0,function(){var e,r;return d(this,function(t){switch(t.label){case 0:return s=Math.floor(i/o)+1,1===(e=i%o+1)&&(1!==s&&(u+="</tr>"),u+='<tr class="row'+s+'">'),u+='<td class="col'+e+'">',c.push(n),r=u,[4,this.liquid.renderer.renderTemplates(this.templates,c)];case 1:return u=r+t.sent(),u+="</td>",c.pop(n),[2,u]}})})})];case 1:return t.sent(),0<s&&(u+="</tr>"),[2,u]}})})}},unless:{parse:function(t,e){var r,n=this;this.templates=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){r=n.templates,n.cond=t.args}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endunless",function(){return i.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(t){return _t(Et(this.cond,t))?this.liquid.renderer.renderTemplates(this.templates,t):this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},break:{render:function(){return h(this,void 0,void 0,function(){return d(this,function(t){throw new X("break")})})}},continue:{render:function(){return h(this,void 0,void 0,function(){return d(this,function(t){throw new X("continue")})})}}},ue={"&":"&","<":"<",">":">",'"':""","'":"'"},ae={"&":"&","<":"<",">":">",""":'"',"'":"'"};function ce(t){return String(t).replace(/&|<|>|"|'/g,function(t){return ue[t]})}var le={escape:ce,escape_once:function(t){return ce(String(t).replace(/&(amp|lt|gt|#34|#39);/g,function(t){return ae[t]}))},newline_to_br:function(t){return t.replace(/\n/g,"<br />")},strip_html:function(t){return String(t).replace(/<script.*?<\/script>|<!--.*?-->|<style.*?<\/style>|<.*?>/g,"")}},fe={append:function(t,e){return t+e},prepend:function(t,e){return e+t},capitalize:function(t){return String(t).charAt(0).toUpperCase()+t.slice(1)},concat:function(t,e){return Array.prototype.concat.call(t,e)},lstrip:function(t){return String(t).replace(/^\s+/,"")},downcase:function(t){return t.toLowerCase()},upcase:function(t){return String(t).toUpperCase()},remove:function(t,e){return t.split(e).join("")},remove_first:function(t,e){return t.replace(e,"")},replace:function(t,e,r){return String(t).split(e).join(r)},replace_first:function(t,e,r){return String(t).replace(e,r)},rstrip:function(t){return String(t).replace(/\s+$/,"")},split:function(t,e){return String(t).split(e)},strip:function(t){return String(t).trim()},strip_newlines:function(t){return String(t).replace(/\n/g,"")},truncate:function(t,e,r){return r=void 0===r?"...":r,e=e||16,(t=String(t)).length<=e?t:t.substr(0,e-r.length)+r},truncatewords:function(t,e,r){void 0===r&&(r="...");var n=t.split(" "),i=n.slice(0,e).join(" ");return n.length>e&&(i+=r),i}},pe={abs:function(t){return Math.abs(t)},ceil:function(t){return Math.ceil(t)},divided_by:function(t,e){return t/e},floor:function(t){return Math.floor(t)},minus:de(function(t,e){return t-e}),modulo:de(function(t,e){return t%e}),round:function(t,e){var r=Math.pow(10,e||0);return Math.round(t*r)/r},plus:de(function(t,e){return Number(t)+Number(e)}),times:function(t,e){return t*e}};function he(t){var e=String(t).split(".");return 1<e.length?e[1].length:0}function de(n){return function(t,e){var r=Math.max(he(t),he(e));return n(t,e).toFixed(r)}}var ge={url_decode:function(t){return t.split("+").map(decodeURIComponent).join(" ")},url_encode:function(t){return t.split(" ").map(encodeURIComponent).join("+")}},ve={join:function(t,e){return t.join(void 0===e?" ":e)},last:function(t){return g(t)},first:function(t){return t[0]},map:function(t,e){return t.map(function(t){return t[e]})},reverse:function(t){return t.reverse()},sort:function(t,e){return t.sort(e)},size:function(t){return t.length},slice:function(t,e,r){return void 0===r&&(r=1),t.slice(e,e+r)},uniq:function(t){var e={};return(t||[]).filter(function(t){return!e.hasOwnProperty(t)&&(e[t]=!0)})}},me=["January","February","March","April","May","June","July","August","September","October","November","December"],we=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ye=me.map(Te),be=we.map(Te),xe={1:"st",2:"nd",3:"rd",default:"th"};function Te(t){return t.slice(0,3)}var Ee={daysInMonth:function(t){return[31,Ee.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(t){for(var e=0,r=0;r<t.getMonth();++r)e+=Ee.daysInMonth(t)[r];return e+t.getDate()},getWeekOfYear:function(t,e){var r=this.getDayOfYear(t)+(e-t.getDay()),n=7-new Date(t.getFullYear(),0,1).getDay()+e;return w(String(Math.floor((r-n)/7)+1),2,"0")},isLeapYear:function(t){var e=t.getFullYear();return!(0!=(3&e)||!(e%100||e%400==0&&e))},getSuffix:function(t){var e=t.getDate().toString(),r=parseInt(e.slice(-1));return xe[r]||xe.default},century:function(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}},ke={a:function(t){return be[t.getDay()]},A:function(t){return we[t.getDay()]},b:function(t){return ye[t.getMonth()]},B:function(t){return me[t.getMonth()]},c:function(t){return t.toLocaleString()},C:function(t){return Ee.century(t)},d:function(t){return w(t.getDate(),2,"0")},e:function(t){return w(t.getDate(),2)},H:function(t){return w(t.getHours(),2,"0")},I:function(t){return w(String(t.getHours()%12||12),2,"0")},j:function(t){return w(Ee.getDayOfYear(t),3,"0")},k:function(t){return w(t.getHours(),2)},l:function(t){return w(String(t.getHours()%12||12),2)},L:function(t){return w(t.getMilliseconds(),3,"0")},m:function(t){return w(t.getMonth()+1,2,"0")},M:function(t){return w(t.getMinutes(),2,"0")},p:function(t){return t.getHours()<12?"AM":"PM"},P:function(t){return t.getHours()<12?"am":"pm"},q:function(t){return Ee.getSuffix(t)},s:function(t){return Math.round(t.valueOf()/1e3)},S:function(t){return w(t.getSeconds(),2,"0")},u:function(t){return t.getDay()||7},U:function(t){return Ee.getWeekOfYear(t,0)},w:function(t){return t.getDay()},W:function(t){return Ee.getWeekOfYear(t,1)},x:function(t){return t.toLocaleDateString()},X:function(t){return t.toLocaleTimeString()},y:function(t){return t.getFullYear().toString().substring(2,4)},Y:function(t){return t.getFullYear()},z:function(t){var e=t.getTimezoneOffset()/60*100;return(0<e?"-":"+")+w(String(Math.abs(e)),4,"0")},"%":function(){return"%"}};ke.h=ke.b,ke.N=ke.L;var Se=v({},le,fe,pe,ge,{date:function(t,e){var r,n=t;return"now"===t?n=new Date:l(t)&&(n=new Date(t)),(r=n)instanceof Date&&!isNaN(r.getTime())?function(t,e){for(var r="",n=e;;){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 s=o[0].charAt(1),u=ke[s];r+=u?u.call(this,t):"%"+s}}(n,e):t}},{default:function(t,e){return St(t)?t:e}},ve);return function(){function e(t){void 0===t&&(t={});var r=this;this.options=nt(rt(t)),this.options.cache&&(this.cache={}),this.parser=new Ft(this),this.renderer=new xt,this.tokenizer=new bt(this.options),p(se,function(t,e){return r.registerTag(e,t)}),p(Se,function(t,e){return r.registerFilter(e,t)})}return e.prototype.parse=function(t,e){var r=this.tokenizer.tokenize(t,e);return this.parser.parse(r)},e.prototype.render=function(t,e,r){var n=v({},this.options,rt(r)),i=new ot(e,n);return this.renderer.renderTemplates(t,i)},e.prototype.parseAndRender=function(r,n,i){return h(this,void 0,void 0,function(){var e;return d(this,function(t){switch(t.label){case 0:return[4,this.parse(r)];case 1:return e=t.sent(),[2,this.render(e,n,i)]}})})},e.prototype.getTemplate=function(f,p){return h(this,void 0,void 0,function(){var e,r,n,i,o,s,u,a,c,l=this;return d(this,function(t){switch(t.label){case 0:e=rt(p),r=e.root?e.root.concat(this.options.root):this.options.root,n=r.map(function(t){return pt.resolve(t,f,l.options.extname)}),i=0,o=n,t.label=1;case 1:return i<o.length?(s=o[i],[4,pt.exists(s)]):[3,5];case 2:return t.sent()?this.options.cache&&this.cache[s]?[2,this.cache[s]]:(a=this.parse,[4,pt.readFile(s)]):[3,4];case 3:return u=a.apply(this,[t.sent(),s]),this.options.cache&&(this.cache[s]=u),[2,u];case 4:return i++,[3,1];case 5:throw(c=new Error("ENOENT")).message='ENOENT: Failed to lookup "'+f+'" in "'+r+'"',c.code="ENOENT",c}})})},e.prototype.renderFile=function(n,i,o){return h(this,void 0,void 0,function(){var e,r;return d(this,function(t){switch(t.label){case 0:return e=rt(o),[4,this.getTemplate(n,e)];case 1:return r=t.sent(),[2,this.render(r,i,o)]}})})},e.prototype.evalValue=function(t,e){return new At(t,this.options.strict_filters).value(e)},e.prototype.registerFilter=function(t,e){return Lt.register(t,e)},e.prototype.registerTag=function(t,e){return Ot.register(t,e)},e.prototype.plugin=function(t){return t.call(this,e)},e.prototype.express=function(){var i=this;return function(t,e,r){var n={root:this.root};i.renderFile(t,e,n).then(function(t){return r(null,t)},r)}},(e.default=e).isTruthy=St,e.isFalsy=_t,e.evalExp=Et,e.evalValue=kt,e.Types=ft,e}()}); | ||
//# sourceMappingURL=liquid.min.js.map |
@@ -5,3 +5,3 @@ import Token from './token'; | ||
trimRight: boolean; | ||
constructor(raw: any, pos: any, input: any, file: any, line: any); | ||
constructor(raw: any, value: any, pos: any, input: any, file: any, line: any); | ||
} |
import DelimitedToken from './delimited-token'; | ||
export default class OutputToken extends DelimitedToken { | ||
constructor(raw: any, pos: any, input: any, file: any, line: any); | ||
constructor(raw: any, value: any, pos: any, input: any, file: any, line: any); | ||
} |
@@ -5,3 +5,3 @@ import DelimitedToken from './delimited-token'; | ||
args: string; | ||
constructor(raw: any, pos: any, input: any, file: any, line: any); | ||
constructor(raw: any, value: any, pos: any, input: any, file: any, line: any); | ||
} |
@@ -1,6 +0,6 @@ | ||
import { LiquidOptions } from 'src/liquid-options'; | ||
import { NormalizedFullOptions } from '../liquid-options'; | ||
export default class Tokenizer { | ||
options: LiquidOptions; | ||
constructor(options?: LiquidOptions); | ||
options: NormalizedFullOptions; | ||
constructor(options?: NormalizedFullOptions); | ||
tokenize(input: string, file?: string): any[]; | ||
} |
import Token from 'src/parser/token'; | ||
import { LiquidOptions } from 'src/liquid-options'; | ||
export default function whiteSpaceCtrl(tokens: Token[], options: LiquidOptions): void; | ||
import { NormalizedFullOptions } from 'src/liquid-options'; | ||
export default function whiteSpaceCtrl(tokens: Token[], options: NormalizedFullOptions): void; |
@@ -1,9 +0,9 @@ | ||
import { NormalizedOptions } from '../liquid-options'; | ||
import { NormalizedFullOptions } from '../liquid-options'; | ||
import BlockMode from './block-mode'; | ||
export default class Scope { | ||
opts: NormalizedOptions; | ||
opts: NormalizedFullOptions; | ||
contexts: Array<object>; | ||
blocks: object; | ||
blockMode: BlockMode; | ||
constructor(ctx?: object, opts?: NormalizedOptions); | ||
constructor(ctx?: object, opts?: NormalizedFullOptions); | ||
getAll(): object; | ||
@@ -10,0 +10,0 @@ get(path: string): any; |
{ | ||
"name": "liquidjs", | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.", | ||
@@ -5,0 +5,0 @@ "main": "dist/liquid.common.js", |
@@ -195,6 +195,10 @@ # liquidjs | ||
* `trim_value_right` is used to strip blank characters (including ` `, `\t`, and `\r`) from the right of values (`{{ }}`) until `\n` (inclusive). Defaults to `false`. | ||
* `trim_output_right` is used to strip blank characters (including ` `, `\t`, and `\r`) from the right of values (`{{ }}`) until `\n` (inclusive). Defaults to `false`. | ||
* `trim_value_left` is similiar to `trim_value_right`, whereas the `\n` is exclusive. Defaults to `false`. See [Whitespace Control][whitespace control] for details. | ||
* `trim_output_left` is similiar to `trim_output_right`, whereas the `\n` is exclusive. Defaults to `false`. See [Whitespace Control][whitespace control] for details. | ||
* `tag_delimiter_left` and `tag_delimiter_right` are used to override the delimiter for liquid tags. | ||
* `output_delimiter_left` and `output_delimiter_right` are used to override the delimiter for liquid outputs. | ||
* `greedy` is used to specify whether `trim_left`/`trim_right` is greedy. When set to `true`, all consecutive blank characters including `\n` will be trimed regardless of line breaks. Defaults to `true`. | ||
@@ -201,0 +205,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
652876
5186
281