Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

liquidjs

Package Overview
Dependencies
Maintainers
1
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liquidjs - npm Package Compare versions

Comparing version 7.5.0 to 7.5.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [7.5.1](https://github.com/harttle/liquidjs/compare/v7.5.0...v7.5.1) (2019-03-05)
### Bug Fixes
* named params for filters, working on [#113](https://github.com/harttle/liquidjs/issues/113) ([5ffc904](https://github.com/harttle/liquidjs/commit/5ffc904))
# [7.5.0](https://github.com/harttle/liquidjs/compare/v7.4.0...v7.5.0) (2019-03-01)

@@ -2,0 +9,0 @@

2

dist/liquid.min.js

@@ -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 r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return(v=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function c(o,s,u,a){return new(u||(u=Promise))(function(t,e){function n(t){try{i(a.next(t))}catch(t){e(t)}}function r(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(n,r)}i((a=a.apply(o,s||[])).next())})}function h(n,r){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=r.call(n,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 n={};function s(t,e){n[t]||(console.warn(t+" See: https://github.com/harttle/liquidjs/issues/"+e),n[t]=!0)}var e=Object.prototype.toString;function d(t){return"[object String]"===e.call(t)}function o(t){return"function"==typeof t}function a(t){return l(t)?"":o((t=u(t)).to_s)?(s("to_s is deprecated, use toString instead.",109),t.to_s()):String(t)}function u(t){return o(t.to_liquid)?(s("to_liquid is deprecated, use toLiquid instead.",109),u(t.to_liquid())):o(t.toLiquid)?u(t.toLiquid()):t}function l(t){return null==t}function g(t){return"[object Array]"===e.call(t)}function f(t,e){for(var n in t=t||{})if(t.hasOwnProperty(n)&&!1===e(t[n],n,t))break;return t}function p(t){return t[t.length-1]}function m(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function y(t,e,n){void 0===n&&(n=1);for(var r=[],i=t;i<e;i+=n)r.push(i);return r}function w(t,e,n){void 0===n&&(n=" ");for(var r=e-(t=String(t)).length;0<r--;)t=n+t;return t}var b=function(){function t(){}return t.prototype.valueOf=function(){},t.prototype.liquidMethodMissing=function(t){},t}(),t=function(r){function t(t,e){var n=r.call(this,t.message)||this;return n.originalError=t,n.token=e,n}return i(t,r),t.prototype.update=function(){var i,o,t,s,e=this.originalError,n=(i=this.token,o=i.input.split("\n"),t=Math.max(i.line-2,1),s=Math.min(i.line+3,o.length),y(t,s+1).map(function(t){var e=t===i.line?">> ":" ",n=w(String(t),String(s).length),r=o[t-1];return""+e+n+"| "+r}).join("\n"));this.message=function(t,e){e.file&&(t+=", file:"+e.file);return t+=", line:"+e.line+", col:"+e.col}(e.message,this.token),this.stack=this.message+"\n"+n+"\n"+this.stack+"\nFrom "+e.stack},t}(Error),T=function(r){function t(t,e){var n=r.call(this,new Error(t),e)||this;return n.name="TokenizationError",r.prototype.update.call(n),n}return i(t,r),t}(t),E=function(r){function t(t,e){var n=r.call(this,t,e)||this;return n.name="ParseError",n.message=t.message,r.prototype.update.call(n),n}return i(t,r),t}(t),x=function(r){function t(t,e){var n=r.call(this,t,e.token)||this;return n.name="RenderError",n.message=t.message,r.prototype.update.call(n),n}return i(t,r),t}(t),k=function(n){function t(t){var e=n.call(this,t)||this;return e.resolvedHTML="",e.name="RenderBreakError",e.message=t+"",e}return i(t,n),t}(Error),q=function(n){function t(t){var e=n.call(this,t)||this;return e.name="AssertionError",e.message=t+"",e}return i(t,n),t}(Error);function R(t,e){if(!t)throw new q(e=e||"expect "+t+" to be true")}var S,O,M={root:["."],cache:!1,extname:"",dynamicPartials:!0,trimTagRight:!1,trimTagLeft:!1,trimOutputRight:!1,trimOutputLeft:!1,greedy:!0,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",strictFilters:!1,strictVariables:!1};function L(t){var e;(t=t||{}).hasOwnProperty("root")&&(t.root=g(e=t.root)?e:d(e)?[e]:[]);for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];if(-1<i.indexOf("_")){var o=i.replace(/_([a-z])/g,function(t,e){return e.toUpperCase()});s(i+" is deprecated, use "+o+" instead.",109),t[o]=t[i]}}return t}function _(t){return v({},M,t)}(O=S||(S={}))[O.OUTPUT=0]="OUTPUT",O[O.STORE=1]="STORE";var F=S,A=function(){function t(t,e){void 0===t&&(t={}),this.blocks={},this.groups={},this.blockMode=F.OUTPUT,this.opts=_(e),this.contexts=[t||{}]}return t.prototype.getAll=function(){return this.contexts.reduce(function(t,e){return v(t,e)},{})},t.prototype.get=function(t){var r=this,e=this.propertyAccessSeq(t),n=this.findContextFor(e[0])||p(this.contexts);return e.reduce(function(t,e){var n=r.readProperty(t,e);if(l(n)&&r.opts.strictVariables)throw new TypeError("undefined variable: "+e);return n},n)},t.prototype.set=function(t,n){var r=this.propertyAccessSeq(t),i=this.findContextFor(r[0])||p(this.contexts);r.some(function(t,e){return!m(i)||(e===r.length-1?(i[t]=n,!0):(void 0===i[t]&&(i[t]={}),i=i[t],!1))})},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 n=this.contexts.length-1;0<=n;n--){var r=this.contexts[n];if(e(r)&&t in r)return r}return null},t.prototype.readProperty=function(t,e){return l(t)?t:(t=u(t))instanceof b?o(t[e])?t[e]():t.hasOwnProperty(e)?t[e]:t.liquidMethodMissing(e):"size"===e?l((n=t).size)&&(g(n)||d(n))?n.length:n.size:t[e];var n},t.prototype.propertyAccessSeq=function(t){t=String(t);for(var e,n=[],r="",i=0;i<t.length;)switch(t[i]){case"[":s();var o=t[i+1];i=/['"]/.test(o)?(R(-1!==(e=t.indexOf(o,i+2)),"unbalanced "+o+": "+t),r=t.slice(i+2,e),s(),e+2):(R(-1!==(e=I(t,i+1)),"unbalanced []: "+t),r=t.slice(i+1,e),/^[+-]?\d+$/.test(r)||(r=String(this.get(r))),s(),e+1);break;case".":s(),i++;break;default:r+=t[i],i++}if(s(),!n.length)throw new TypeError('invalid path:"'+t+'"');return n;function s(){r.length&&n.push(r),r=""}},t}();function I(t,e){for(var n=1,r=e;r<t.length;r++)if("["===t[r]&&n++,"]"===t[r]&&0===--n)return r;return-1}var D=function(){},N=function(){},P=function(){},j=function(){},U=Object.freeze({AssignScope:N,CaptureScope:D,IncrementScope:P,DecrementScope:j,ParseError:E,TokenizationError:T,RenderBreakError:k,AssertionError:q,Drop:b});var H={readFile:function(r){return c(this,void 0,void 0,function(){return h(this,function(t){return[2,new Promise(function(t,e){var n=new XMLHttpRequest;n.onload=function(){200<=n.status&&n.status<300?t(n.responseText):e(new Error(n.statusText))},n.onerror=function(){e(new Error("An error occurred whilst receiving the response."))},n.open("GET",r),n.send()})]})})},resolve:function(t,e,i){return t.length&&"/"!==p(t)&&(t+="/"),function(t,e){var n=document.createElement("base");n.href=t;var r=document.getElementsByTagName("head")[0];r.insertBefore(n,r.firstChild);var i=document.createElement("a");i.href=e;var o=i.href;return r.removeChild(n),o}(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,function(t,e,n){var r=n.split("/").pop();return/\.\w+$/.test(r)?t:e+n+i})},exists:function(){return c(this,void 0,void 0,function(){return h(this,function(t){return[2,!0]})})}};var z,C,Y=function(t,e,n,r,i){this.type="notset",this.col=r,this.line=n,this.raw=t,this.value=t,this.input=e,this.file=i},$=function(s){function t(t,e,n,r,i){var o=s.call(this,t,e,n,r,i)||this;return o.type="html",o.value=t,o}return i(t,s),t}(Y),G=function(u){function t(t,e,n,r,i,o){var s=u.call(this,t,n,r,i,o)||this;return s.trimLeft="-"===e[0],s.trimRight="-"===p(e),s.value=e.slice(s.trimLeft?1:0,s.trimRight?-1:e.length).trim(),s}return i(t,u),t}(Y),B=new RegExp(/'[^']*'/.source+"|"+/"[^"]*"/.source),V=new RegExp("(?:"+B.source+"|[^'\"])*"),W=/[+-]?(?:\d+\.?\d*|\.?\d+)/,J=/[\w-]+[?]?/,X=new RegExp("\\[(?:"+B.source+"|[\\w-\\.]+)\\]"),K=new RegExp("(?:"+B.source+"|"+/true|false/.source+"|"+W.source+")"),Q=new RegExp(J.source+"(?:\\."+J.source+"|"+X.source+")*"),Z=new RegExp("(?:"+Q.source+"|"+W.source+")"),tt=new RegExp("\\("+Z.source+"\\.\\."+Z.source+"\\)"),et=new RegExp("\\(("+Z.source+")\\.\\.("+Z.source+")\\)"),nt=new RegExp("(?:"+Q.source+"|"+K.source+"|"+tt.source+")"),rt=new RegExp("(?:"+J.source+")\\s*:\\s*(?:"+nt.source+")"),it=new RegExp("("+J.source+")\\s*:\\s*("+nt.source+")","g"),ot=new RegExp("^\\s*("+J.source+")\\s*([\\s\\S]*?)\\s*$"),st=new RegExp("^"+B.source+"$"),ut=new RegExp("^"+et.source+"$"),at=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/],ct=function(a){function t(t,e,n,r,i,o){var s=a.call(this,t,e,n,r,i,o)||this;s.type="tag";var u=s.value.match(ot);if(!u)throw new T("illegal tag syntax",s);return s.name=u[1],s.args=u[2],s}return i(t,a),t}(G),lt=function(u){function t(t,e,n,r,i,o){var s=u.call(this,t,e,n,r,i,o)||this;return s.type="output",s}return i(t,u),t}(G);(C=z||(z={}))[C.HTML=0]="HTML",C[C.OUTPUT=1]="OUTPUT",C[C.TAG=2]="TAG";var ft=function(){function t(t){this.options=_(t)}return t.prototype.tokenize=function(t,e){for(var n=[],r=this.options.tagDelimiterLeft,i=this.options.tagDelimiterRight,o=this.options.outputDelimiterLeft,s=this.options.outputDelimiterRight,u=0,a=1,c=z.HTML,l="",f=0,p=1,h=1;u<t.length;){if("\n"===t[u]&&(a++,f=u+1),c===z.HTML){if(t.substr(u,o.length)===o){l&&n.push(new $(l,t,p,h,e)),p=a,h=u-f+1,u+=(l=o).length,c=z.OUTPUT;continue}if(t.substr(u,r.length)===r){l&&n.push(new $(l,t,p,h,e)),p=a,h=u-f+1,u+=(l=r).length,c=z.TAG;continue}}else{if(c===z.OUTPUT&&t.substr(u,s.length)===s){l+=s,n.push(new lt(l,l.slice(o.length,-s.length),t,p,h,e)),l="",p=a,h=(u+=s.length)-f+1,c=z.HTML;continue}if(t.substr(u,i.length)===i){l+=i,n.push(new ct(l,l.slice(r.length,-i.length),t,p,h,e)),l="",p=a,h=(u+=i.length)-f+1,c=z.HTML;continue}}l+=t[u++]}if(c===z.HTML)return l&&n.push(new $(l,t,p,h,e)),function(s,u){u=v({greedy:!0},u);var a=!1;s.forEach(function(t,e){var n,r,i,o;i=t,o=u,!a&&("tag"===i.type?i.trimLeft||o.trimTagLeft:"output"===i.type?i.trimLeft||o.trimOutputLeft:void 0)&&function(t,e){if(t&&"html"===t.type){var n=e?/\s+$/g:/[\t\r ]*$/g;t.value=t.value.replace(n,"")}}(s[e-1],u.greedy),"tag"===t.type&&"raw"===t.name&&(a=!0),"tag"===t.type&&"endraw"===t.name&&(a=!1),n=t,r=u,!a&&("tag"===n.type?n.trimRight||r.trimTagRight:"output"===n.type?n.trimRight||r.trimOutputRight:void 0)&&function(t,e){if(t&&"html"===t.type){var n=e?/^\s+/g:/^[\t\r ]*\n?/g;t.value=t.value.replace(n,"")}}(s[e+1],u.greedy)})}(n,this.options),n;var d=c===z.OUTPUT?"output":"tag",g=16<l.length?l.slice(0,13)+"...":l;throw new T(d+' "'+g+'" not closed',new Y(l,t,p,h,e))},t}(),pt=function(){function t(){}return t.prototype.renderTemplates=function(u,a){return c(this,void 0,void 0,function(){var e,n,r,i,o,s;return h(this,function(t){switch(t.label){case 0:R(a,"unable to evalTemplates: scope undefined"),e="",n=0,r=u,t.label=1;case 1:if(!(n<r.length))return[3,6];i=r[n],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("RenderBreakError"===(s=t.sent()).name)throw s.resolvedHTML=e,s;throw"RenderError"===s.name?s:new x(s,i);case 5:return n++,[3,1];case 6:return[2,e]}})})},t}();function ht(t){return t&&o(t.equals)}var dt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.equals=function(t){return d(t)||g(t)?0===t.length:!!m(t)&&0===Object.keys(t).length},e.prototype.gt=function(){return!1},e.prototype.geq=function(){return!1},e.prototype.lt=function(){return!1},e.prototype.leq=function(){return!1},e.prototype.valueOf=function(){return""},e}(b),gt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.equals=function(t){return!1===t||(!!l(t instanceof b?t.valueOf():t)||(d(t)?/^\s*$/.test(t):e.prototype.equals.call(this,t)))},t}(dt),vt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.equals=function(t){return l(t instanceof b?t.valueOf():t)||t instanceof gt},e.prototype.gt=function(){return!1},e.prototype.geq=function(){return!1},e.prototype.lt=function(){return!1},e.prototype.leq=function(){return!1},e.prototype.valueOf=function(){return null},e}(b),mt={"==":function(t,e){return ht(t)?t.equals(e):ht(e)?e.equals(t):t===e},"!=":function(t,e){return ht(t)?!t.equals(e):ht(e)?!e.equals(t):t!==e},">":function(t,e){return ht(t)?t.gt(e):ht(e)?e.lt(t):e<t},"<":function(t,e){return ht(t)?t.lt(e):ht(e)?e.gt(t):t<e},">=":function(t,e){return ht(t)?t.geq(e):ht(e)?e.leq(t):e<=t},"<=":function(t,e){return ht(t)?t.leq(e):ht(e)?e.geq(t):t<=e},contains:function(t,e){return!!t&&("function"==typeof t.indexOf&&-1<t.indexOf(e))},and:function(t,e){return Tt(t)&&Tt(e)},or:function(t,e){return Tt(t)||Tt(e)}};function yt(t,e){var n=function t(e,n){R(n,"unable to parseExp: scope undefined");for(var r,i=at,o=0;o<i.length;o++){var s=i[o],u=new RegExp("^("+V.source+")("+s.source+")("+V.source+")$");if(r=e.match(u)){var a=t(r[1],n);return(0,mt[r[2].trim()])(a,t(r[3],n))}}return(r=e.match(ut))?y(bt(r[1],n),bt(r[2],n)+1):wt(e,n)}(t,e);return n instanceof b?n.valueOf():n}function wt(t,e){return t?"true"===(t=t.trim())||"false"!==t&&("nil"===t||"null"===t?new vt:"empty"===t?new dt:"blank"===t?new gt:isNaN(Number(t))?'"'!==t[0]&&"'"!==t[0]||t[0]!==p(t)?e.get(t):t.slice(1,-1):Number(t)):null}function bt(t,e){var n=wt(t,e);return n instanceof b?n.valueOf():n}function Tt(t){return!Et(t)}function Et(t){return!1===t||null==t}var xt,kt,qt=function(t,e){var n;for(it.lastIndex=0;n=it.exec(t);){var r=n[1],i=n[2];this[r]=bt(i,e)}},Rt=function(t){this.token=t},St=function(s){function u(t,e,n){var r=s.call(this,t)||this;r.name=t.name;var i,o=u.impls[t.name];return R(o,"tag "+t.name+" not found"),r.impl=(i=o,Object.create(i)),r.impl.liquid=n,r.impl.parse&&r.impl.parse(t,e),r}return i(u,s),u.prototype.render=function(r){return c(this,void 0,void 0,function(){var e,n;return h(this,function(t){switch(t.label){case 0:return e=new qt(this.token.args,r),"function"!=typeof(n=this.impl).render?[2,""]:[4,n.render(r,e)];case 1:return[2,a(t.sent())]}})})},u.register=function(t,e){u.impls[t]=e},u.clear=function(){u.impls={}},u.impls={},u}(Rt),Ot=function(){function i(t,e,n){var r=i.impls[t];if(!r&&n)throw new TypeError("undefined filter: "+t);this.name=t,this.impl=r||function(t){return t},this.args=e}return i.prototype.render=function(t,e){var n=this.args.map(function(t){return bt(t,e)});return this.impl.apply(null,[t].concat(n))},i.register=function(t,e){i.impls[t]=e},i.clear=function(){i.impls={}},i.impls={},i}(),Mt=function(){function t(t,e){this.handlers={},this.stopRequested=!1,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 n=this.handlers[t];return"function"==typeof n&&(n(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}();(kt=xt||(xt={}))[kt.INIT=0]="INIT",kt[kt.FILTER_NAME=1]="FILTER_NAME",kt[kt.FILTER_ARG=2]="FILTER_ARG";var Lt=function(){function t(t,e){this.filters=[];for(var n="",r="",i=xt.INIT,o=!1,s="",u=[],a=0;a<t.length;a++)if(r)t[a]===r&&(o=!(r="")),n+=t[a];else if(/\s/.test(t[a])){if(!n)continue;o=!0}else if("|"===t[a])i===xt.INIT?this.initial=n:(i===xt.FILTER_NAME?s=n:u.push(n),this.filters.push(new Ot(s,u,e)),s="",u=[]),i=xt.FILTER_NAME,n="",o=!1;else if(i===xt.FILTER_NAME&&":"===t[a])s=n,i=xt.FILTER_ARG,n="",o=!1;else if(i===xt.FILTER_ARG&&","===t[a])u.push(n),n="",o=!1;else{if(o)continue;'"'!==t[a]&&"'"!==t[a]||r||(r=t[a]),n+=t[a]}n&&(i===xt.INIT?this.initial=n:i===xt.FILTER_NAME?this.filters.push(new Ot(n,[],e)):(u.push(n),this.filters.push(new Ot(s,u,e))))}return t.prototype.value=function(n){return this.filters.reduce(function(t,e){return e.render(t,n)},yt(this.initial,n))},t}(),_t=function(r){function t(t,e){var n=r.call(this,t)||this;return n.value=new Lt(t.value,e),n}return i(t,r),t.prototype.render=function(e){return c(this,void 0,void 0,function(){return h(this,function(t){switch(t.label){case 0:return[4,this.value.value(e)];case 1:return[2,a(t.sent())]}})})},t}(Rt),Ft=function(n){function t(t){var e=n.call(this,t)||this;return e.str=t.value,e}return i(t,n),t.prototype.render=function(){return c(this,void 0,void 0,function(){return h(this,function(t){return[2,this.str]})})},t}(Rt),At=function(){function t(t){this.liquid=t}return t.prototype.parse=function(t){for(var e,n=[];e=t.shift();)n.push(this.parseToken(e,t));return n},t.prototype.parseToken=function(e,t){try{return"tag"===e.type?new St(e,t,this.liquid):"output"===e.type?new _t(e,this.liquid.options.strictFilters):new Ft(e)}catch(t){throw new E(t,e)}},t.prototype.parseStream=function(t){var n=this;return new Mt(t,function(t,e){return n.parseToken(t,e)})},t}(),It=new RegExp("("+J.source+")\\s*=([^]*)"),Dt={parse:function(t){var e=t.args.match(It);R(e,"illegal token "+t.raw),this.key=e[1],this.value=e[2]},render:function(t){var e=new N;return e[this.key]=this.liquid.evalValue(this.value,t),t.push(e),Promise.resolve("")}},Nt=function(n){function t(t){var e=n.call(this)||this;return e.i=0,e.length=t,e}return i(t,n),t.prototype.next=function(){this.i++},t.prototype.index0=function(){return this.i},t.prototype.index=function(){return this.i+1},t.prototype.first=function(){return 0===this.i},t.prototype.last=function(){return this.i===this.length-1},t.prototype.rindex=function(){return this.length-this.i},t.prototype.rindex0=function(){return this.length-this.i-1},t.prototype.valueOf=function(){return JSON.stringify(this)},t}(b),Pt=new RegExp("^("+J.source+")\\s+in\\s+("+nt.source+")(?:\\s+"+rt.source+")*(?:\\s+(reversed))?(?:\\s+"+rt.source+")*$"),jt={type:"block",parse:function(t,e){var n,r=this,i=Pt.exec(t.args);R(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 n=r.templates}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endfor",function(){return o.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(f,p){return c(this,void 0,void 0,function(){var e,n,r,i,o,s,u,a,c,l;return h(this,function(t){switch(t.label){case 0:if(g(e=yt(this.collection,f))||(d(e)&&0<e.length?e=[e]:m(e)&&(e=Object.keys(e).map(function(t){return[t,e[t]]}))),!g(e)||!e.length)return[2,this.liquid.renderer.renderTemplates(this.elseTemplates,f)];n=p.offset||0,r=void 0===p.limit?e.length:p.limit,e=e.slice(n,n+r),this.reversed&&e.reverse(),i={forloop:new Nt(e.length)},f.push(i),o="",s=0,u=e,t.label=1;case 1:if(!(s<u.length))return[3,7];a=u[s],i[this.variable]=a,t.label=2;case 2:return t.trys.push([2,4,,5]),c=o,[4,this.liquid.renderer.renderTemplates(this.templates,f)];case 3:return o=c+t.sent(),[3,5];case 4:if("RenderBreakError"!==(l=t.sent()).name)throw l;return o+=l.resolvedHTML,"break"===l.message?[3,7]:[3,5];case 5:i.forloop.next(),t.label=6;case 6:return s++,[3,1];case 7:return f.pop(),[2,o]}})})}},Ut=new RegExp("("+J.source+")"),Ht={parse:function(t,e){var n=this,r=t.args.match(Ut);R(r,t.args+" not valid identifier"),this.variable=r[1],this.templates=[];var i=this.liquid.parser.parseStream(e);i.on("tag:endcapture",function(){return i.stop()}).on("template",function(t){return n.templates.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),i.start()},render:function(r){return c(this,void 0,void 0,function(){var e,n;return h(this,function(t){switch(t.label){case 0:return[4,this.liquid.renderer.renderTemplates(this.templates,r)];case 1:return e=t.sent(),(n=new D)[this.variable]=e,r.push(n),[2]}})})}},zt={parse:function(t,e){var n=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var r=[],i=this.liquid.parser.parseStream(e).on("tag:when",function(t){n.cases.push({val:t.args,templates:r=[]})}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endcase",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;e<this.cases.length;e++){var n=this.cases[e];if(yt(n.val,t)===yt(this.cond,t))return this.liquid.renderer.renderTemplates(n.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},Ct={parse:function(t,e){var n=this.liquid.parser.parseStream(e);n.on("token",function(t){"endcomment"===t.name&&n.stop()}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),n.start()}},Yt=/[^\s,]+/,$t=new RegExp("with\\s+("+nt.source+")"),Gt={parse:function(t){var e=Yt.exec(t.args);e&&(this.staticValue=e[0]),(e=nt.exec(t.args))&&(this.value=e[0]),(e=$t.exec(t.args))&&(this.with=e[1])},render:function(u,a){return c(this,void 0,void 0,function(){var e,n,r,i,o,s;return h(this,function(t){switch(t.label){case 0:return u.opts.dynamicPartials?st.exec(this.value)?(n=this.value.slice(1,-1),[4,this.liquid.parseAndRender(n,u.getAll(),u.opts)]):[3,2]:[3,4];case 1:return e=t.sent(),[3,3];case 2:e=bt(this.value,u),t.label=3;case 3:return[3,5];case 4:e=this.staticValue,t.label=5;case 5:return R(e,"cannot include with empty filename"),r=u.blocks,i=u.blockMode,u.blocks={},u.blockMode=F.OUTPUT,this.with&&(a[e]=bt(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=r,u.blockMode=i,[2,s]}})})}},Bt={parse:function(t){var e=t.args.match(J);R(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof D||t instanceof N)});return e||(e=new j,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0),--e[this.variable]}},Vt=new RegExp("^(?:("+nt.source+")\\s*:\\s*)?(.*)$"),Wt=new RegExp(nt.source,"g"),Jt={parse:function(t){var e=Vt.exec(t.args);R(e,"illegal tag: "+t.raw),this.group=e[1]||"";var n=e[2];for(this.candidates=[];e=Wt.exec(n);)this.candidates.push(e[0]);R(this.candidates.length,"empty candidates: "+t.raw)},render:function(t){var e="cycle:"+bt(this.group,t)+":"+this.candidates.join(","),n=t.groups,r=n[e];void 0===r&&(r=n[e]=0);var i=this.candidates[r];return r=(r+1)%this.candidates.length,n[e]=r,bt(i,t)}},Xt={parse:function(t,e){var n,r=this;this.branches=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){return r.branches.push({cond:t.args,templates:n=[]})}).on("tag:elsif",function(t){r.branches.push({cond:t.args,templates:n=[]})}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endif",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,n=this.branches;e<n.length;e++){var r=n[e];if(Tt(yt(r.cond,t)))return this.liquid.renderer.renderTemplates(r.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},Kt={parse:function(t){var e=t.args.match(J);R(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof D||t instanceof N)});e||(e=new P,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0);var n=e[this.variable];return e[this.variable]++,n}},Qt=/\S+/,Zt={parse:function(t,e){var n=Qt.exec(t.args);n&&(this.staticLayout=n[0]),(n=nt.exec(t.args))&&(this.layout=n[0]),this.tpls=this.liquid.parser.parse(e)},render:function(o,s){return c(this,void 0,void 0,function(){var e,n,r,i;return h(this,function(t){switch(t.label){case 0:return R(e=o.opts.dynamicPartials?bt(this.layout,o):this.staticLayout,"cannot apply layout with empty filename"),o.blockMode=F.STORE,[4,this.liquid.renderer.renderTemplates(this.tpls,o)];case 1:return n=t.sent(),void 0===o.blocks[""]&&(o.blocks[""]=n),[4,this.liquid.getTemplate(e,o.opts)];case 2:return r=t.sent(),o.push(s),o.blockMode=F.OUTPUT,[4,this.liquid.renderer.renderTemplates(r,o)];case 3:return i=t.sent(),o.pop(s),[2,i]}})})}},te={parse:function(t,e){var n=this,r=/\w+/.exec(t.args);this.block=r?r[0]:"",this.tpls=[];var i=this.liquid.parser.parseStream(e).on("tag:endblock",function(){return i.stop()}).on("template",function(t){return n.tpls.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(i){return c(this,void 0,void 0,function(){var e,n,r;return h(this,function(t){switch(t.label){case 0:return void 0===(e=i.blocks[this.block])?[3,1]:(r=e,[3,3]);case 1:return[4,this.liquid.renderer.renderTemplates(this.tpls,i)];case 2:r=t.sent(),t.label=3;case 3:return n=r,i.blockMode===F.STORE?(i.blocks[this.block]=n,[2,""]):[2,n]}})})}},ee={parse:function(t,e){var n=this;this.tokens=[];var r=this.liquid.parser.parseStream(e);r.on("token",function(t){"endraw"===t.name?r.stop():n.tokens.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),r.start()},render:function(){return this.tokens.map(function(t){return t.raw}).join("")}},ne=function(r){function t(t,e){var n=r.call(this,t)||this;return n.length=t,n.cols=e,n}return i(t,r),t.prototype.row=function(){return Math.floor(this.i/this.cols)+1},t.prototype.col0=function(){return this.i%this.cols},t.prototype.col=function(){return this.col0()+1},t.prototype.col_first=function(){return 0===this.col0()},t.prototype.col_last=function(){return this.col()===this.cols},t}(Nt),re=new RegExp("^("+J.source+")\\s+in\\s+("+nt.source+")(?:\\s+"+rt.source+")*$"),ie={assign:Dt,for:jt,capture:Ht,case:zt,comment:Ct,include:Gt,decrement:Bt,increment:Kt,cycle:Jt,if:Xt,layout:Zt,block:te,raw:ee,tablerow:{parse:function(t,e){var n,r=this,i=re.exec(t.args);R(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 n=r.templates}).on("tag:endtablerow",function(){return o.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(l,f){return c(this,void 0,void 0,function(){var e,n,r,i,o,s,u,a,c;return h(this,function(t){switch(t.label){case 0:e=yt(this.collection,l)||[],n=f.offset||0,r=void 0===f.limit?e.length:f.limit,e=e.slice(n,n+r),i=f.cols||e.length,o=new ne(e.length,i),s={tablerowloop:o},l.push(s),u="",a=0,t.label=1;case 1:return a<e.length?(s[this.variable]=e[a],0===o.col0()&&(1!==o.row()&&(u+="</tr>"),u+='<tr class="row'+o.row()+'">'),u+='<td class="col'+o.col()+'">',c=u,[4,this.liquid.renderer.renderTemplates(this.templates,l)]):[3,4];case 2:u=c+t.sent(),u+="</td>",t.label=3;case 3:return a++,o.next(),[3,1];case 4:return e.length&&(u+="</tr>"),l.pop(s),[2,u]}})})}},unless:{parse:function(t,e){var n,r=this;this.templates=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){n=r.templates,r.cond=t.args}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endunless",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){return Et(yt(this.cond,t))?this.liquid.renderer.renderTemplates(this.templates,t):this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},break:{render:function(){return c(this,void 0,void 0,function(){return h(this,function(t){throw new k("break")})})}},continue:{render:function(){return c(this,void 0,void 0,function(){return h(this,function(t){throw new k("continue")})})}}},oe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},se={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"};function ue(t){return String(t).replace(/&|<|>|"|'/g,function(t){return oe[t]})}var ae={escape:ue,escape_once:function(t){return ue(String(t).replace(/&(amp|lt|gt|#34|#39);/g,function(t){return se[t]}))},newline_to_br:function(t){return t.replace(/\n/g,"<br />")},strip_html:function(t){return t.replace(/<script.*?<\/script>|<!--.*?-->|<style.*?<\/style>|<.*?>/g,"")}},ce={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)},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,n){return String(t).split(e).join(n)},replace_first:function(t,e,n){return String(t).replace(e,n)},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,n){return void 0===e&&(e=50),void 0===n&&(n="..."),(t=String(t)).length<=e?t:t.substr(0,e-n.length)+n},truncatewords:function(t,e,n){void 0===e&&(e=15),void 0===n&&(n="...");var r=t.split(/\s+/),i=r.slice(0,e).join(" ");return r.length>=e&&(i+=n),i}},le={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:function(t,e){return t-e},modulo:function(t,e){return t%e},round:function(t,e){void 0===e&&(e=0);var n=Math.pow(10,e);return Math.round(t*n)/n},plus:function(t,e){return Number(t)+Number(e)},times:function(t,e){return t*e}},fe={url_decode:function(t){return t.split("+").map(decodeURIComponent).join(" ")},url_encode:function(t){return t.split(" ").map(encodeURIComponent).join("+")}},pe={join:function(t,e){return t.join(void 0===e?" ":e)},last:function(t){return p(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},concat:function(t,e){return Array.prototype.concat.call(t,e)},slice:function(t,e,n){return void 0===n&&(n=1),t.slice(e,e+n)},uniq:function(t){var e={};return(t||[]).filter(function(t){return!e.hasOwnProperty(String(t))&&(e[String(t)]=!0)})}},he=["January","February","March","April","May","June","July","August","September","October","November","December"],de=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ge=he.map(ye),ve=de.map(ye),me={1:"st",2:"nd",3:"rd",default:"th"};function ye(t){return t.slice(0,3)}var we={daysInMonth:function(t){return[31,we.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(t){for(var e=0,n=0;n<t.getMonth();++n)e+=we.daysInMonth(t)[n];return e+t.getDate()},getWeekOfYear:function(t,e){var n=this.getDayOfYear(t)+(e-t.getDay()),r=7-new Date(t.getFullYear(),0,1).getDay()+e;return w(String(Math.floor((n-r)/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(),n=parseInt(e.slice(-1));return me[n]||me.default},century:function(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}},be={a:function(t){return ve[t.getDay()]},A:function(t){return de[t.getDay()]},b:function(t){return ge[t.getMonth()]},B:function(t){return he[t.getMonth()]},c:function(t){return t.toLocaleString()},C:function(t){return we.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(we.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 we.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 we.getWeekOfYear(t,0)},w:function(t){return t.getDay()},W:function(t){return we.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"%"}};be.h=be.b,be.N=be.L;var Te=v({},ae,ce,le,fe,{date:function(t,e){var n,r=t;return"now"===t?r=new Date:d(t)&&(r=new Date(t)),(n=r)instanceof Date&&!isNaN(n.getTime())?function(t,e){for(var n="",r=e;;){var i=/%./g,o=i.exec(r);if(!o)return n+r;n+=r.slice(0,i.lastIndex-2),r=r.slice(i.lastIndex);var s=o[0].charAt(1),u=be[s];n+=u?u(t):"%"+s}}(r,e):t}},{default:function(t,e){return Tt(t)?t:e}},pe);return function(){function e(t){void 0===t&&(t={});var n=this;this.cache={},this.options=_(L(t)),this.parser=new At(this),this.renderer=new pt,this.tokenizer=new ft(this.options),f(ie,function(t,e){return n.registerTag(e,t)}),f(Te,function(t,e){return n.registerFilter(e,t)})}return e.prototype.parse=function(t,e){var n=this.tokenizer.tokenize(t,e);return this.parser.parse(n)},e.prototype.render=function(t,e,n){var r=v({},this.options,L(n)),i=new A(e,r);return this.renderer.renderTemplates(t,i)},e.prototype.parseAndRender=function(n,r,i){return c(this,void 0,void 0,function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,this.parse(n)];case 1:return e=t.sent(),[2,this.render(e,r,i)]}})})},e.prototype.getTemplate=function(f,p){return c(this,void 0,void 0,function(){var e,n,r,i,o,s,u,a,c,l=this;return h(this,function(t){switch(t.label){case 0:e=L(p),n=e.root?e.root.concat(this.options.root):this.options.root,r=n.map(function(t){return H.resolve(t,f,l.options.extname)}),i=0,o=r,t.label=1;case 1:return i<o.length?(s=o[i],[4,H.exists(s)]):[3,5];case 2:return t.sent()?this.options.cache&&this.cache[s]?[2,this.cache[s]]:(a=this.parse,[4,H.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 "'+n+'"',c.code="ENOENT",c}})})},e.prototype.renderFile=function(r,i,o){return c(this,void 0,void 0,function(){var e,n;return h(this,function(t){switch(t.label){case 0:return e=L(o),[4,this.getTemplate(r,e)];case 1:return n=t.sent(),[2,this.render(n,i,o)]}})})},e.prototype.evalValue=function(t,e){return new Lt(t,this.options.strictFilters).value(e)},e.prototype.registerFilter=function(t,e){return Ot.register(t,e)},e.prototype.registerTag=function(t,e){return St.register(t,e)},e.prototype.plugin=function(t){return t.call(this,e)},e.prototype.express=function(){var i=this;return function(t,e,n){var r={root:this.root};i.renderFile(t,e,r).then(function(t){return n(null,t)},n)}},(e.default=e).isTruthy=Tt,e.isFalsy=Et,e.evalExp=yt,e.evalValue=bt,e.Types=U,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 r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return(v=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function c(o,s,u,a){return new(u||(u=Promise))(function(t,e){function n(t){try{i(a.next(t))}catch(t){e(t)}}function r(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(n,r)}i((a=a.apply(o,s||[])).next())})}function h(n,r){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=r.call(n,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 n={};function s(t,e){n[t]||(console.warn(t+" See: https://github.com/harttle/liquidjs/issues/"+e),n[t]=!0)}var e=Object.prototype.toString;function d(t){return"[object String]"===e.call(t)}function o(t){return"function"==typeof t}function a(t){return l(t)?"":o((t=u(t)).to_s)?(s("to_s is deprecated, use toString instead.",109),t.to_s()):String(t)}function u(t){return o(t.to_liquid)?(s("to_liquid is deprecated, use toLiquid instead.",109),u(t.to_liquid())):o(t.toLiquid)?u(t.toLiquid()):t}function l(t){return null==t}function g(t){return"[object Array]"===e.call(t)}function f(t,e){for(var n in t=t||{})if(t.hasOwnProperty(n)&&!1===e(t[n],n,t))break;return t}function p(t){return t[t.length-1]}function m(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function y(t,e,n){void 0===n&&(n=1);for(var r=[],i=t;i<e;i+=n)r.push(i);return r}function w(t,e,n){void 0===n&&(n=" ");for(var r=e-(t=String(t)).length;0<r--;)t=n+t;return t}var b=function(){function t(){}return t.prototype.valueOf=function(){},t.prototype.liquidMethodMissing=function(t){},t}(),t=function(r){function t(t,e){var n=r.call(this,t.message)||this;return n.originalError=t,n.token=e,n}return i(t,r),t.prototype.update=function(){var i,o,t,s,e=this.originalError,n=(i=this.token,o=i.input.split("\n"),t=Math.max(i.line-2,1),s=Math.min(i.line+3,o.length),y(t,s+1).map(function(t){var e=t===i.line?">> ":" ",n=w(String(t),String(s).length),r=o[t-1];return""+e+n+"| "+r}).join("\n"));this.message=function(t,e){e.file&&(t+=", file:"+e.file);return t+=", line:"+e.line+", col:"+e.col}(e.message,this.token),this.stack=this.message+"\n"+n+"\n"+this.stack+"\nFrom "+e.stack},t}(Error),T=function(r){function t(t,e){var n=r.call(this,new Error(t),e)||this;return n.name="TokenizationError",r.prototype.update.call(n),n}return i(t,r),t}(t),x=function(r){function t(t,e){var n=r.call(this,t,e)||this;return n.name="ParseError",n.message=t.message,r.prototype.update.call(n),n}return i(t,r),t}(t),k=function(r){function t(t,e){var n=r.call(this,t,e.token)||this;return n.name="RenderError",n.message=t.message,r.prototype.update.call(n),n}return i(t,r),t}(t),E=function(n){function t(t){var e=n.call(this,t)||this;return e.resolvedHTML="",e.name="RenderBreakError",e.message=t+"",e}return i(t,n),t}(Error),q=function(n){function t(t){var e=n.call(this,t)||this;return e.name="AssertionError",e.message=t+"",e}return i(t,n),t}(Error);function S(t,e){if(!t)throw new q(e=e||"expect "+t+" to be true")}var O,R,M={root:["."],cache:!1,extname:"",dynamicPartials:!0,trimTagRight:!1,trimTagLeft:!1,trimOutputRight:!1,trimOutputLeft:!1,greedy:!0,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",strictFilters:!1,strictVariables:!1};function L(t){var e;(t=t||{}).hasOwnProperty("root")&&(t.root=g(e=t.root)?e:d(e)?[e]:[]);for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];if(-1<i.indexOf("_")){var o=i.replace(/_([a-z])/g,function(t,e){return e.toUpperCase()});s(i+" is deprecated, use "+o+" instead.",109),t[o]=t[i]}}return t}function F(t){return v({},M,t)}(R=O||(O={}))[R.OUTPUT=0]="OUTPUT",R[R.STORE=1]="STORE";var D=O,P=function(){function t(t,e){void 0===t&&(t={}),this.blocks={},this.groups={},this.blockMode=D.OUTPUT,this.opts=F(e),this.contexts=[t||{}]}return t.prototype.getAll=function(){return this.contexts.reduce(function(t,e){return v(t,e)},{})},t.prototype.get=function(t){var r=this,e=this.propertyAccessSeq(t),n=this.findContextFor(e[0])||p(this.contexts);return e.reduce(function(t,e){var n=r.readProperty(t,e);if(l(n)&&r.opts.strictVariables)throw new TypeError("undefined variable: "+e);return n},n)},t.prototype.set=function(t,n){var r=this.propertyAccessSeq(t),i=this.findContextFor(r[0])||p(this.contexts);r.some(function(t,e){return!m(i)||(e===r.length-1?(i[t]=n,!0):(void 0===i[t]&&(i[t]={}),i=i[t],!1))})},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 n=this.contexts.length-1;0<=n;n--){var r=this.contexts[n];if(e(r)&&t in r)return r}return null},t.prototype.readProperty=function(t,e){return l(t)?t:(t=u(t))instanceof b?o(t[e])?t[e]():t.hasOwnProperty(e)?t[e]:t.liquidMethodMissing(e):"size"===e?l((n=t).size)&&(g(n)||d(n))?n.length:n.size:t[e];var n},t.prototype.propertyAccessSeq=function(t){t=String(t);for(var e,n=[],r="",i=0;i<t.length;)switch(t[i]){case"[":s();var o=t[i+1];i=/['"]/.test(o)?(S(-1!==(e=t.indexOf(o,i+2)),"unbalanced "+o+": "+t),r=t.slice(i+2,e),s(),e+2):(S(-1!==(e=_(t,i+1)),"unbalanced []: "+t),r=t.slice(i+1,e),/^[+-]?\d+$/.test(r)||(r=String(this.get(r))),s(),e+1);break;case".":s(),i++;break;default:r+=t[i],i++}if(s(),!n.length)throw new TypeError('invalid path:"'+t+'"');return n;function s(){r.length&&n.push(r),r=""}},t}();function _(t,e){for(var n=1,r=e;r<t.length;r++)if("["===t[r]&&n++,"]"===t[r]&&0===--n)return r;return-1}var j=function(){},U=function(){},A=function(){},H=function(){},N=Object.freeze({AssignScope:U,CaptureScope:j,IncrementScope:A,DecrementScope:H,ParseError:x,TokenizationError:T,RenderBreakError:E,AssertionError:q,Drop:b});var z={readFile:function(r){return c(this,void 0,void 0,function(){return h(this,function(t){return[2,new Promise(function(t,e){var n=new XMLHttpRequest;n.onload=function(){200<=n.status&&n.status<300?t(n.responseText):e(new Error(n.statusText))},n.onerror=function(){e(new Error("An error occurred whilst receiving the response."))},n.open("GET",r),n.send()})]})})},resolve:function(t,e,i){return t.length&&"/"!==p(t)&&(t+="/"),function(t,e){var n=document.createElement("base");n.href=t;var r=document.getElementsByTagName("head")[0];r.insertBefore(n,r.firstChild);var i=document.createElement("a");i.href=e;var o=i.href;return r.removeChild(n),o}(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,function(t,e,n){var r=n.split("/").pop();return/\.\w+$/.test(r)?t:e+n+i})},exists:function(){return c(this,void 0,void 0,function(){return h(this,function(t){return[2,!0]})})}};var C,Y,$=function(t,e,n,r,i){this.type="notset",this.col=r,this.line=n,this.raw=t,this.value=t,this.input=e,this.file=i},I=function(s){function t(t,e,n,r,i){var o=s.call(this,t,e,n,r,i)||this;return o.type="html",o.value=t,o}return i(t,s),t}($),B=function(u){function t(t,e,n,r,i,o){var s=u.call(this,t,n,r,i,o)||this;return s.trimLeft="-"===e[0],s.trimRight="-"===p(e),s.value=e.slice(s.trimLeft?1:0,s.trimRight?-1:e.length).trim(),s}return i(t,u),t}($),V=new RegExp(/'[^']*'/.source+"|"+/"[^"]*"/.source),G=new RegExp("(?:"+V.source+"|[^'\"])*"),W=/[+-]?(?:\d+\.?\d*|\.?\d+)/,J=/[\w-]+[?]?/,X=new RegExp("\\[(?:"+V.source+"|[\\w-\\.]+)\\]"),K=new RegExp("(?:"+V.source+"|"+/true|false/.source+"|"+W.source+")"),Q=new RegExp(J.source+"(?:\\."+J.source+"|"+X.source+")*"),Z=new RegExp("(?:"+Q.source+"|"+W.source+")"),tt=new RegExp("\\("+Z.source+"\\.\\."+Z.source+"\\)"),et=new RegExp("\\(("+Z.source+")\\.\\.("+Z.source+")\\)"),nt=new RegExp("(?:"+Q.source+"|"+K.source+"|"+tt.source+")"),rt=new RegExp("(?:"+J.source+")\\s*:\\s*(?:"+nt.source+")"),it=new RegExp("("+J.source+")\\s*:\\s*("+nt.source+")","g"),ot=new RegExp("^\\s*("+J.source+")\\s*([\\s\\S]*?)\\s*$"),st=new RegExp("^"+V.source+"$"),ut=new RegExp("^"+et.source+"$"),at=[/\s+or\s+/,/\s+and\s+/,/==|!=|<=|>=|<|>|\s+contains\s+/],ct=function(a){function t(t,e,n,r,i,o){var s=a.call(this,t,e,n,r,i,o)||this;s.type="tag";var u=s.value.match(ot);if(!u)throw new T("illegal tag syntax",s);return s.name=u[1],s.args=u[2],s}return i(t,a),t}(B),lt=function(u){function t(t,e,n,r,i,o){var s=u.call(this,t,e,n,r,i,o)||this;return s.type="output",s}return i(t,u),t}(B);(Y=C||(C={}))[Y.HTML=0]="HTML",Y[Y.OUTPUT=1]="OUTPUT",Y[Y.TAG=2]="TAG";var ft=function(){function t(t){this.options=F(t)}return t.prototype.tokenize=function(t,e){for(var n=[],r=this.options.tagDelimiterLeft,i=this.options.tagDelimiterRight,o=this.options.outputDelimiterLeft,s=this.options.outputDelimiterRight,u=0,a=1,c=C.HTML,l="",f=0,p=1,h=1;u<t.length;){if("\n"===t[u]&&(a++,f=u+1),c===C.HTML){if(t.substr(u,o.length)===o){l&&n.push(new I(l,t,p,h,e)),p=a,h=u-f+1,u+=(l=o).length,c=C.OUTPUT;continue}if(t.substr(u,r.length)===r){l&&n.push(new I(l,t,p,h,e)),p=a,h=u-f+1,u+=(l=r).length,c=C.TAG;continue}}else{if(c===C.OUTPUT&&t.substr(u,s.length)===s){l+=s,n.push(new lt(l,l.slice(o.length,-s.length),t,p,h,e)),l="",p=a,h=(u+=s.length)-f+1,c=C.HTML;continue}if(t.substr(u,i.length)===i){l+=i,n.push(new ct(l,l.slice(r.length,-i.length),t,p,h,e)),l="",p=a,h=(u+=i.length)-f+1,c=C.HTML;continue}}l+=t[u++]}if(c===C.HTML)return l&&n.push(new I(l,t,p,h,e)),function(s,u){u=v({greedy:!0},u);var a=!1;s.forEach(function(t,e){var n,r,i,o;i=t,o=u,!a&&("tag"===i.type?i.trimLeft||o.trimTagLeft:"output"===i.type?i.trimLeft||o.trimOutputLeft:void 0)&&function(t,e){if(t&&"html"===t.type){var n=e?/\s+$/g:/[\t\r ]*$/g;t.value=t.value.replace(n,"")}}(s[e-1],u.greedy),"tag"===t.type&&"raw"===t.name&&(a=!0),"tag"===t.type&&"endraw"===t.name&&(a=!1),n=t,r=u,!a&&("tag"===n.type?n.trimRight||r.trimTagRight:"output"===n.type?n.trimRight||r.trimOutputRight:void 0)&&function(t,e){if(t&&"html"===t.type){var n=e?/^\s+/g:/^[\t\r ]*\n?/g;t.value=t.value.replace(n,"")}}(s[e+1],u.greedy)})}(n,this.options),n;var d=c===C.OUTPUT?"output":"tag",g=16<l.length?l.slice(0,13)+"...":l;throw new T(d+' "'+g+'" not closed',new $(l,t,p,h,e))},t}(),pt=function(){function t(){}return t.prototype.renderTemplates=function(u,a){return c(this,void 0,void 0,function(){var e,n,r,i,o,s;return h(this,function(t){switch(t.label){case 0:S(a,"unable to evalTemplates: scope undefined"),e="",n=0,r=u,t.label=1;case 1:if(!(n<r.length))return[3,6];i=r[n],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("RenderBreakError"===(s=t.sent()).name)throw s.resolvedHTML=e,s;throw"RenderError"===s.name?s:new k(s,i);case 5:return n++,[3,1];case 6:return[2,e]}})})},t}();function ht(t){return t&&o(t.equals)}var dt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.equals=function(t){return d(t)||g(t)?0===t.length:!!m(t)&&0===Object.keys(t).length},e.prototype.gt=function(){return!1},e.prototype.geq=function(){return!1},e.prototype.lt=function(){return!1},e.prototype.leq=function(){return!1},e.prototype.valueOf=function(){return""},e}(b),gt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.equals=function(t){return!1===t||(!!l(t instanceof b?t.valueOf():t)||(d(t)?/^\s*$/.test(t):e.prototype.equals.call(this,t)))},t}(dt),vt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.equals=function(t){return l(t instanceof b?t.valueOf():t)||t instanceof gt},e.prototype.gt=function(){return!1},e.prototype.geq=function(){return!1},e.prototype.lt=function(){return!1},e.prototype.leq=function(){return!1},e.prototype.valueOf=function(){return null},e}(b),mt={"==":function(t,e){return ht(t)?t.equals(e):ht(e)?e.equals(t):t===e},"!=":function(t,e){return ht(t)?!t.equals(e):ht(e)?!e.equals(t):t!==e},">":function(t,e){return ht(t)?t.gt(e):ht(e)?e.lt(t):e<t},"<":function(t,e){return ht(t)?t.lt(e):ht(e)?e.gt(t):t<e},">=":function(t,e){return ht(t)?t.geq(e):ht(e)?e.leq(t):e<=t},"<=":function(t,e){return ht(t)?t.leq(e):ht(e)?e.geq(t):t<=e},contains:function(t,e){return!!t&&("function"==typeof t.indexOf&&-1<t.indexOf(e))},and:function(t,e){return Tt(t)&&Tt(e)},or:function(t,e){return Tt(t)||Tt(e)}};function yt(t,e){var n=function t(e,n){S(n,"unable to parseExp: scope undefined");for(var r,i=at,o=0;o<i.length;o++){var s=i[o],u=new RegExp("^("+G.source+")("+s.source+")("+G.source+")$");if(r=e.match(u)){var a=t(r[1],n);return(0,mt[r[2].trim()])(a,t(r[3],n))}}return(r=e.match(ut))?y(bt(r[1],n),bt(r[2],n)+1):wt(e,n)}(t,e);return n instanceof b?n.valueOf():n}function wt(t,e){return t?"true"===(t=t.trim())||"false"!==t&&("nil"===t||"null"===t?new vt:"empty"===t?new dt:"blank"===t?new gt:isNaN(Number(t))?'"'!==t[0]&&"'"!==t[0]||t[0]!==p(t)?e.get(t):t.slice(1,-1):Number(t)):null}function bt(t,e){var n=wt(t,e);return n instanceof b?n.valueOf():n}function Tt(t){return!xt(t)}function xt(t){return!1===t||null==t}var kt=function(t,e){var n;for(it.lastIndex=0;n=it.exec(t);){var r=n[1],i=n[2];this[r]=bt(i,e)}},Et=function(t){this.token=t},qt=function(s){function u(t,e,n){var r=s.call(this,t)||this;r.name=t.name;var i,o=u.impls[t.name];return S(o,"tag "+t.name+" not found"),r.impl=(i=o,Object.create(i)),r.impl.liquid=n,r.impl.parse&&r.impl.parse(t,e),r}return i(u,s),u.prototype.render=function(r){return c(this,void 0,void 0,function(){var e,n;return h(this,function(t){switch(t.label){case 0:return e=new kt(this.token.args,r),"function"!=typeof(n=this.impl).render?[2,""]:[4,n.render(r,e)];case 1:return[2,a(t.sent())]}})})},u.register=function(t,e){u.impls[t]=e},u.clear=function(){u.impls={}},u.impls={},u}(Et),St=function(){function i(t,e,n){var r=i.impls[t];if(!r&&n)throw new TypeError("undefined filter: "+t);this.name=t,this.impl=r||function(t){return t},this.args=e}return i.prototype.render=function(t,e){var n=this.args.map(function(t){return g(t)?[t[0],bt(t[1],e)]:bt(t,e)});return this.impl.apply(null,[t].concat(n))},i.register=function(t,e){i.impls[t]=e},i.clear=function(){i.impls={}},i.impls={},i}(),Ot=function(){function t(t,e){this.handlers={},this.stopRequested=!1,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 n=this.handlers[t];return"function"==typeof n&&(n(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}(),Rt=function(){function r(t,e){this.filters=[];var n=r.tokenize(t);this.strictFilters=e,this.initial=n[0],this.parseFilters(n,1)}return r.prototype.parseFilters=function(t,e){for(var n=e;n<t.length;)if("|"===t[n]){for(var r=++n;n<t.length&&"|"!==t[n];)n++;this.parseFilter(t,r,n)}else n++},r.prototype.parseFilter=function(t,e,n){for(var r,i,o=t[e],s=[],u=e+1;u<n+1;u++)u===n||","===t[u]?((r||i)&&s.push(r?[r,i]:i),i=r=void 0):":"===t[u]?(r=i,i=void 0):void 0===i&&(i=t[u]);this.filters.push(new St(o,s,this.strictFilters))},r.prototype.value=function(n){return this.filters.reduce(function(t,e){return e.render(t,n)},yt(this.initial,n))},r.tokenize=function(t){for(var e=[],n=0;n<t.length;){var r=t[n];if('"'===r||"'"===r){var i=n;for(n+=2;n<t.length&&t[n-1]!==r;++n);e.push(t.slice(i,n))}else if(/\s/.test(r))n++;else if(/[|,:]/.test(r))e.push(t[n++]);else{for(i=n++;n<t.length&&!/[|,:\s]/.test(t[n]);++n);e.push(t.slice(i,n))}}return e},r}(),Mt=function(r){function t(t,e){var n=r.call(this,t)||this;return n.value=new Rt(t.value,e),n}return i(t,r),t.prototype.render=function(e){return c(this,void 0,void 0,function(){return h(this,function(t){switch(t.label){case 0:return[4,this.value.value(e)];case 1:return[2,a(t.sent())]}})})},t}(Et),Lt=function(n){function t(t){var e=n.call(this,t)||this;return e.str=t.value,e}return i(t,n),t.prototype.render=function(){return c(this,void 0,void 0,function(){return h(this,function(t){return[2,this.str]})})},t}(Et),Ft=function(){function t(t){this.liquid=t}return t.prototype.parse=function(t){for(var e,n=[];e=t.shift();)n.push(this.parseToken(e,t));return n},t.prototype.parseToken=function(e,t){try{return"tag"===e.type?new qt(e,t,this.liquid):"output"===e.type?new Mt(e,this.liquid.options.strictFilters):new Lt(e)}catch(t){throw new x(t,e)}},t.prototype.parseStream=function(t){var n=this;return new Ot(t,function(t,e){return n.parseToken(t,e)})},t}(),Dt=new RegExp("("+J.source+")\\s*=([^]*)"),Pt={parse:function(t){var e=t.args.match(Dt);S(e,"illegal token "+t.raw),this.key=e[1],this.value=e[2]},render:function(t){var e=new U;return e[this.key]=this.liquid.evalValue(this.value,t),t.push(e),Promise.resolve("")}},_t=function(n){function t(t){var e=n.call(this)||this;return e.i=0,e.length=t,e}return i(t,n),t.prototype.next=function(){this.i++},t.prototype.index0=function(){return this.i},t.prototype.index=function(){return this.i+1},t.prototype.first=function(){return 0===this.i},t.prototype.last=function(){return this.i===this.length-1},t.prototype.rindex=function(){return this.length-this.i},t.prototype.rindex0=function(){return this.length-this.i-1},t.prototype.valueOf=function(){return JSON.stringify(this)},t}(b),jt=new RegExp("^("+J.source+")\\s+in\\s+("+nt.source+")(?:\\s+"+rt.source+")*(?:\\s+(reversed))?(?:\\s+"+rt.source+")*$"),Ut={type:"block",parse:function(t,e){var n,r=this,i=jt.exec(t.args);S(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 n=r.templates}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endfor",function(){return o.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(f,p){return c(this,void 0,void 0,function(){var e,n,r,i,o,s,u,a,c,l;return h(this,function(t){switch(t.label){case 0:if(g(e=yt(this.collection,f))||(d(e)&&0<e.length?e=[e]:m(e)&&(e=Object.keys(e).map(function(t){return[t,e[t]]}))),!g(e)||!e.length)return[2,this.liquid.renderer.renderTemplates(this.elseTemplates,f)];n=p.offset||0,r=void 0===p.limit?e.length:p.limit,e=e.slice(n,n+r),this.reversed&&e.reverse(),i={forloop:new _t(e.length)},f.push(i),o="",s=0,u=e,t.label=1;case 1:if(!(s<u.length))return[3,7];a=u[s],i[this.variable]=a,t.label=2;case 2:return t.trys.push([2,4,,5]),c=o,[4,this.liquid.renderer.renderTemplates(this.templates,f)];case 3:return o=c+t.sent(),[3,5];case 4:if("RenderBreakError"!==(l=t.sent()).name)throw l;return o+=l.resolvedHTML,"break"===l.message?[3,7]:[3,5];case 5:i.forloop.next(),t.label=6;case 6:return s++,[3,1];case 7:return f.pop(),[2,o]}})})}},At=new RegExp("("+J.source+")"),Ht={parse:function(t,e){var n=this,r=t.args.match(At);S(r,t.args+" not valid identifier"),this.variable=r[1],this.templates=[];var i=this.liquid.parser.parseStream(e);i.on("tag:endcapture",function(){return i.stop()}).on("template",function(t){return n.templates.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),i.start()},render:function(r){return c(this,void 0,void 0,function(){var e,n;return h(this,function(t){switch(t.label){case 0:return[4,this.liquid.renderer.renderTemplates(this.templates,r)];case 1:return e=t.sent(),(n=new j)[this.variable]=e,r.push(n),[2]}})})}},Nt={parse:function(t,e){var n=this;this.cond=t.args,this.cases=[],this.elseTemplates=[];var r=[],i=this.liquid.parser.parseStream(e).on("tag:when",function(t){n.cases.push({val:t.args,templates:r=[]})}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endcase",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;e<this.cases.length;e++){var n=this.cases[e];if(yt(n.val,t)===yt(this.cond,t))return this.liquid.renderer.renderTemplates(n.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},zt={parse:function(t,e){var n=this.liquid.parser.parseStream(e);n.on("token",function(t){"endcomment"===t.name&&n.stop()}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),n.start()}},Ct=/[^\s,]+/,Yt=new RegExp("with\\s+("+nt.source+")"),$t={parse:function(t){var e=Ct.exec(t.args);e&&(this.staticValue=e[0]),(e=nt.exec(t.args))&&(this.value=e[0]),(e=Yt.exec(t.args))&&(this.with=e[1])},render:function(u,a){return c(this,void 0,void 0,function(){var e,n,r,i,o,s;return h(this,function(t){switch(t.label){case 0:return u.opts.dynamicPartials?st.exec(this.value)?(n=this.value.slice(1,-1),[4,this.liquid.parseAndRender(n,u.getAll(),u.opts)]):[3,2]:[3,4];case 1:return e=t.sent(),[3,3];case 2:e=bt(this.value,u),t.label=3;case 3:return[3,5];case 4:e=this.staticValue,t.label=5;case 5:return S(e,"cannot include with empty filename"),r=u.blocks,i=u.blockMode,u.blocks={},u.blockMode=D.OUTPUT,this.with&&(a[e]=bt(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=r,u.blockMode=i,[2,s]}})})}},It={parse:function(t){var e=t.args.match(J);S(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof j||t instanceof U)});return e||(e=new H,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0),--e[this.variable]}},Bt=new RegExp("^(?:("+nt.source+")\\s*:\\s*)?(.*)$"),Vt=new RegExp(nt.source,"g"),Gt={parse:function(t){var e=Bt.exec(t.args);S(e,"illegal tag: "+t.raw),this.group=e[1]||"";var n=e[2];for(this.candidates=[];e=Vt.exec(n);)this.candidates.push(e[0]);S(this.candidates.length,"empty candidates: "+t.raw)},render:function(t){var e="cycle:"+bt(this.group,t)+":"+this.candidates.join(","),n=t.groups,r=n[e];void 0===r&&(r=n[e]=0);var i=this.candidates[r];return r=(r+1)%this.candidates.length,n[e]=r,bt(i,t)}},Wt={parse:function(t,e){var n,r=this;this.branches=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){return r.branches.push({cond:t.args,templates:n=[]})}).on("tag:elsif",function(t){r.branches.push({cond:t.args,templates:n=[]})}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endif",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,n=this.branches;e<n.length;e++){var r=n[e];if(Tt(yt(r.cond,t)))return this.liquid.renderer.renderTemplates(r.templates,t)}return this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},Jt={parse:function(t){var e=t.args.match(J);S(e,"illegal identifier "+t.args),this.variable=e[0]},render:function(t){var e=t.findContextFor(this.variable,function(t){return!(t instanceof j||t instanceof U)});e||(e=new A,t.unshift(e)),"number"!=typeof e[this.variable]&&(e[this.variable]=0);var n=e[this.variable];return e[this.variable]++,n}},Xt=/\S+/,Kt={parse:function(t,e){var n=Xt.exec(t.args);n&&(this.staticLayout=n[0]),(n=nt.exec(t.args))&&(this.layout=n[0]),this.tpls=this.liquid.parser.parse(e)},render:function(o,s){return c(this,void 0,void 0,function(){var e,n,r,i;return h(this,function(t){switch(t.label){case 0:return S(e=o.opts.dynamicPartials?bt(this.layout,o):this.staticLayout,"cannot apply layout with empty filename"),o.blockMode=D.STORE,[4,this.liquid.renderer.renderTemplates(this.tpls,o)];case 1:return n=t.sent(),void 0===o.blocks[""]&&(o.blocks[""]=n),[4,this.liquid.getTemplate(e,o.opts)];case 2:return r=t.sent(),o.push(s),o.blockMode=D.OUTPUT,[4,this.liquid.renderer.renderTemplates(r,o)];case 3:return i=t.sent(),o.pop(s),[2,i]}})})}},Qt={parse:function(t,e){var n=this,r=/\w+/.exec(t.args);this.block=r?r[0]:"",this.tpls=[];var i=this.liquid.parser.parseStream(e).on("tag:endblock",function(){return i.stop()}).on("template",function(t){return n.tpls.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});i.start()},render:function(i){return c(this,void 0,void 0,function(){var e,n,r;return h(this,function(t){switch(t.label){case 0:return void 0===(e=i.blocks[this.block])?[3,1]:(r=e,[3,3]);case 1:return[4,this.liquid.renderer.renderTemplates(this.tpls,i)];case 2:r=t.sent(),t.label=3;case 3:return n=r,i.blockMode===D.STORE?(i.blocks[this.block]=n,[2,""]):[2,n]}})})}},Zt={parse:function(t,e){var n=this;this.tokens=[];var r=this.liquid.parser.parseStream(e);r.on("token",function(t){"endraw"===t.name?r.stop():n.tokens.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")}),r.start()},render:function(){return this.tokens.map(function(t){return t.raw}).join("")}},te=function(r){function t(t,e){var n=r.call(this,t)||this;return n.length=t,n.cols=e,n}return i(t,r),t.prototype.row=function(){return Math.floor(this.i/this.cols)+1},t.prototype.col0=function(){return this.i%this.cols},t.prototype.col=function(){return this.col0()+1},t.prototype.col_first=function(){return 0===this.col0()},t.prototype.col_last=function(){return this.col()===this.cols},t}(_t),ee=new RegExp("^("+J.source+")\\s+in\\s+("+nt.source+")(?:\\s+"+rt.source+")*$"),ne={assign:Pt,for:Ut,capture:Ht,case:Nt,comment:zt,include:$t,decrement:It,increment:Jt,cycle:Gt,if:Wt,layout:Kt,block:Qt,raw:Zt,tablerow:{parse:function(t,e){var n,r=this,i=ee.exec(t.args);S(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 n=r.templates}).on("tag:endtablerow",function(){return o.stop()}).on("template",function(t){return n.push(t)}).on("end",function(){throw new Error("tag "+t.raw+" not closed")});o.start()},render:function(l,f){return c(this,void 0,void 0,function(){var e,n,r,i,o,s,u,a,c;return h(this,function(t){switch(t.label){case 0:e=yt(this.collection,l)||[],n=f.offset||0,r=void 0===f.limit?e.length:f.limit,e=e.slice(n,n+r),i=f.cols||e.length,o=new te(e.length,i),s={tablerowloop:o},l.push(s),u="",a=0,t.label=1;case 1:return a<e.length?(s[this.variable]=e[a],0===o.col0()&&(1!==o.row()&&(u+="</tr>"),u+='<tr class="row'+o.row()+'">'),u+='<td class="col'+o.col()+'">',c=u,[4,this.liquid.renderer.renderTemplates(this.templates,l)]):[3,4];case 2:u=c+t.sent(),u+="</td>",t.label=3;case 3:return a++,o.next(),[3,1];case 4:return e.length&&(u+="</tr>"),l.pop(s),[2,u]}})})}},unless:{parse:function(t,e){var n,r=this;this.templates=[],this.elseTemplates=[];var i=this.liquid.parser.parseStream(e).on("start",function(){n=r.templates,r.cond=t.args}).on("tag:else",function(){return n=r.elseTemplates}).on("tag:endunless",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){return xt(yt(this.cond,t))?this.liquid.renderer.renderTemplates(this.templates,t):this.liquid.renderer.renderTemplates(this.elseTemplates,t)}},break:{render:function(){return c(this,void 0,void 0,function(){return h(this,function(t){throw new E("break")})})}},continue:{render:function(){return c(this,void 0,void 0,function(){return h(this,function(t){throw new E("continue")})})}}},re={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},ie={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"};function oe(t){return String(t).replace(/&|<|>|"|'/g,function(t){return re[t]})}var se={escape:oe,escape_once:function(t){return oe(String(t).replace(/&(amp|lt|gt|#34|#39);/g,function(t){return ie[t]}))},newline_to_br:function(t){return t.replace(/\n/g,"<br />")},strip_html:function(t){return t.replace(/<script.*?<\/script>|<!--.*?-->|<style.*?<\/style>|<.*?>/g,"")}},ue={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)},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,n){return String(t).split(e).join(n)},replace_first:function(t,e,n){return String(t).replace(e,n)},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,n){return void 0===e&&(e=50),void 0===n&&(n="..."),(t=String(t)).length<=e?t:t.substr(0,e-n.length)+n},truncatewords:function(t,e,n){void 0===e&&(e=15),void 0===n&&(n="...");var r=t.split(/\s+/),i=r.slice(0,e).join(" ");return r.length>=e&&(i+=n),i}},ae={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:function(t,e){return t-e},modulo:function(t,e){return t%e},round:function(t,e){void 0===e&&(e=0);var n=Math.pow(10,e);return Math.round(t*n)/n},plus:function(t,e){return Number(t)+Number(e)},times:function(t,e){return t*e}},ce={url_decode:function(t){return t.split("+").map(decodeURIComponent).join(" ")},url_encode:function(t){return t.split(" ").map(encodeURIComponent).join("+")}},le={join:function(t,e){return t.join(void 0===e?" ":e)},last:function(t){return p(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},concat:function(t,e){return Array.prototype.concat.call(t,e)},slice:function(t,e,n){return void 0===n&&(n=1),t.slice(e,e+n)},uniq:function(t){var e={};return(t||[]).filter(function(t){return!e.hasOwnProperty(String(t))&&(e[String(t)]=!0)})}},fe=["January","February","March","April","May","June","July","August","September","October","November","December"],pe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],he=fe.map(ve),de=pe.map(ve),ge={1:"st",2:"nd",3:"rd",default:"th"};function ve(t){return t.slice(0,3)}var me={daysInMonth:function(t){return[31,me.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31]},getDayOfYear:function(t){for(var e=0,n=0;n<t.getMonth();++n)e+=me.daysInMonth(t)[n];return e+t.getDate()},getWeekOfYear:function(t,e){var n=this.getDayOfYear(t)+(e-t.getDay()),r=7-new Date(t.getFullYear(),0,1).getDay()+e;return w(String(Math.floor((n-r)/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(),n=parseInt(e.slice(-1));return ge[n]||ge.default},century:function(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}},ye={a:function(t){return de[t.getDay()]},A:function(t){return pe[t.getDay()]},b:function(t){return he[t.getMonth()]},B:function(t){return fe[t.getMonth()]},c:function(t){return t.toLocaleString()},C:function(t){return me.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(me.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 me.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 me.getWeekOfYear(t,0)},w:function(t){return t.getDay()},W:function(t){return me.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"%"}};ye.h=ye.b,ye.N=ye.L;var we=v({},se,ue,ae,ce,{date:function(t,e){var n,r=t;return"now"===t?r=new Date:d(t)&&(r=new Date(t)),(n=r)instanceof Date&&!isNaN(n.getTime())?function(t,e){for(var n="",r=e;;){var i=/%./g,o=i.exec(r);if(!o)return n+r;n+=r.slice(0,i.lastIndex-2),r=r.slice(i.lastIndex);var s=o[0].charAt(1),u=ye[s];n+=u?u(t):"%"+s}}(r,e):t}},{default:function(t,e){return Tt(t)?t:e}},le);return function(){function e(t){void 0===t&&(t={});var n=this;this.cache={},this.options=F(L(t)),this.parser=new Ft(this),this.renderer=new pt,this.tokenizer=new ft(this.options),f(ne,function(t,e){return n.registerTag(e,t)}),f(we,function(t,e){return n.registerFilter(e,t)})}return e.prototype.parse=function(t,e){var n=this.tokenizer.tokenize(t,e);return this.parser.parse(n)},e.prototype.render=function(t,e,n){var r=v({},this.options,L(n)),i=new P(e,r);return this.renderer.renderTemplates(t,i)},e.prototype.parseAndRender=function(n,r,i){return c(this,void 0,void 0,function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,this.parse(n)];case 1:return e=t.sent(),[2,this.render(e,r,i)]}})})},e.prototype.getTemplate=function(f,p){return c(this,void 0,void 0,function(){var e,n,r,i,o,s,u,a,c,l=this;return h(this,function(t){switch(t.label){case 0:e=L(p),n=e.root?e.root.concat(this.options.root):this.options.root,r=n.map(function(t){return z.resolve(t,f,l.options.extname)}),i=0,o=r,t.label=1;case 1:return i<o.length?(s=o[i],[4,z.exists(s)]):[3,5];case 2:return t.sent()?this.options.cache&&this.cache[s]?[2,this.cache[s]]:(a=this.parse,[4,z.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 "'+n+'"',c.code="ENOENT",c}})})},e.prototype.renderFile=function(r,i,o){return c(this,void 0,void 0,function(){var e,n;return h(this,function(t){switch(t.label){case 0:return e=L(o),[4,this.getTemplate(r,e)];case 1:return n=t.sent(),[2,this.render(n,i,o)]}})})},e.prototype.evalValue=function(t,e){return new Rt(t,this.options.strictFilters).value(e)},e.prototype.registerFilter=function(t,e){return St.register(t,e)},e.prototype.registerTag=function(t,e){return qt.register(t,e)},e.prototype.plugin=function(t){return t.call(this,e)},e.prototype.express=function(){var i=this;return function(t,e,n){var r={root:this.root};i.renderFile(t,e,r).then(function(t){return n(null,t)},n)}},(e.default=e).isTruthy=Tt,e.isFalsy=xt,e.evalExp=yt,e.evalValue=bt,e.Types=N,e}()});
//# sourceMappingURL=liquid.min.js.map
import Scope from '../scope/scope';
export declare function parseExp(exp: string, scope: Scope): any;
export declare function evalExp(str: string, scope: Scope): any;
export declare function evalValue(str: string, scope: Scope): any;
export declare function evalValue(str: string | undefined, scope: Scope): any;
export declare function isTruthy(val: any): boolean;
export declare function isFalsy(val: any): boolean;
import Scope from '../../scope/scope';
import { FilterImpl } from './filter-impl';
export default class Filter {
export declare type FilterArgs = Array<string | [string?, string?]>;
export declare class Filter {
name: string;
impl: FilterImpl;
args: string[];
args: FilterArgs;
private static impls;
constructor(name: string, args: string[], strictFilters: boolean);
constructor(name: string, args: FilterArgs, strictFilters: boolean);
render(value: any, scope: Scope): any;

@@ -10,0 +11,0 @@ static register(name: string, filter: FilterImpl): void;

@@ -1,5 +0,6 @@

import Filter from './filter/filter';
import { Filter } from './filter/filter';
import Scope from '../scope/scope';
export default class {
initial: any;
export default class Value {
private strictFilters;
initial: string;
filters: Array<Filter>;

@@ -10,3 +11,6 @@ /**

constructor(str: string, strictFilters: boolean);
private parseFilters;
private parseFilter;
value(scope: Scope): any;
static tokenize(str: string): Array<'|' | ',' | ':' | string>;
}
{
"name": "liquidjs",
"version": "7.5.0",
"version": "7.5.1",
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",

@@ -5,0 +5,0 @@ "main": "dist/liquid.common.js",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc