!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;nu[0]&&e[1]> ":" ",n=w(String(t),String(u).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),b=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),n=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),T=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),E=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 x(t,e){if(!t)throw new E(e=e||"expect "+t+" to be true")}var k,_,q={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 S(t){var e;return(t=t||{}).hasOwnProperty("root")&&(t.root=f(e=t.root)?e:l(e)?[e]:[]),t}function R(t){return v({},q,t)}(_=k||(k={}))[_.OUTPUT=0]="OUTPUT",_[_.STORE=1]="STORE";var M=k,O=function(){function t(t,e){void 0===t&&(t={}),this.blocks={},this.groups={},this.blockMode=M.OUTPUT,this.opts=R(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 n=this,e=this.propertyAccessSeq(t),r=this.findContextFor(e[0])||g(this.contexts);return e.reduce(function(t,e){return n.readProperty(t,e)},r)},t.prototype.set=function(t,n){var r=this.propertyAccessSeq(t),i=this.findContextFor(r[0])||g(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){var n,r;if(c(t)?n=t:(t=function(t){if(s(t.to_liquid))return t.to_liquid();if(s(t.toLiquid))return t.toLiquid();return t}(t),n="size"===e?c((r=t).size)&&(f(r)||l(r))?r.length:r.size:t[e],s(t.liquid_method_missing)&&(n=t.liquid_method_missing(e))),c(n)&&this.opts.strict_variables)throw new TypeError("undefined variable: "+e);return n},t.prototype.propertyAccessSeq=function(t){t=String(t);for(var e,n=[],r="",i=0;i=|<|>|\s+contains\s+/],ut=function(a){function t(t,e,n,r,i,o){var u=a.call(this,t,e,n,r,i,o)||this;u.type="tag";var s=u.value.match(nt);if(!s)throw new b("illegal tag syntax",u);return u.name=s[1],u.args=s[2],u}return i(t,a),t}(C),st=function(s){function t(t,e,n,r,i,o){var u=s.call(this,t,e,n,r,i,o)||this;return u.type="output",u}return i(t,s),t}(C);(D=j||(j={}))[D.HTML=0]="HTML",D[D.OUTPUT=1]="OUTPUT",D[D.TAG=2]="TAG";var at=function(){function t(t){this.options=R(t)}return t.prototype.tokenize=function(t,e){for(var n=[],r=this.options.tag_delimiter_left,i=this.options.tag_delimiter_right,o=this.options.output_delimiter_left,u=this.options.output_delimiter_right,s=0,a=1,c=j.HTML,l="",f=0,p=1,h=1;s":function(t,e){return lt(t)?t.gt(e):lt(e)?e.lt(t):e=":function(t,e){return lt(t)?t.geq(e):lt(e)?e.leq(t):e<=t},"<=":function(t,e){return lt(t)?t.leq(e):lt(e)?e.geq(t):t<=e},contains:function(t,e){return!!t&&("function"==typeof t.indexOf&&-1"),s+=''),s+='',c.push(r),n=s,[4,this.liquid.renderer.renderTemplates(this.templates,c)];case 1:return s=n+t.sent(),s+="",c.pop(r),[2,s]}})})})];case 1:return t.sent(),0"),[2,s]}})})}},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 Tt(mt(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 e("break")})})}},continue:{render:function(){return h(this,void 0,void 0,function(){return d(this,function(t){throw new e("continue")})})}}},re={"&":"&","<":"<",">":">",'"':""","'":"'"},ie={"&":"&","<":"<",">":">",""":'"',"'":"'"};function oe(t){return String(t).replace(/&|<|>|"|'/g,function(t){return re[t]})}var ue={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,"
")},strip_html:function(t){return t.replace(/|||<.*?>/g,"")}},se={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:le(function(t,e){return t-e}),modulo:le(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:le(function(t,e){return Number(t)+Number(e)}),times:function(t,e){return t*e}};function ce(t){var e=String(t).split(".");return 1