liquidjs
Version:
A simple, expressive and safe Shopify / Github Pages compatible template engine in pure JavaScript.
1 lines • 68.5 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).liquidjs={})}(this,function(p){"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)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function t(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var x=function(){return(x=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 o(t,s,a,u){return new(a=a||Promise)(function(e,r){function n(t){try{o(u.next(t))}catch(t){r(t)}}function i(t){try{o(u.throw(t))}catch(t){r(t)}}function o(t){t.done?e(t.value):function(e){return e instanceof a?e:new a(function(t){t(e)})}(t.value).then(n,i)}o((u=u.apply(t,s||[])).next())})}function q(r,n){var i,o,s,t,a={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(;a;)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 a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){a.label=e[1];break}if(6===e[0]&&a.label<s[1]){a.label=s[1],s=e;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(e);break}s[2]&&a.ops.pop(),a.trys.pop();continue}e=n.call(r,a)}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])}}}function O(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function w(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||((n=n||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}var i=(e.prototype.valueOf=function(){},e.prototype.liquidMethodMissing=function(t){},e);function e(){}var r=Object.prototype.toString,s=String.prototype.toLowerCase;function a(t){return"string"==typeof t}function u(t){return"function"==typeof t}function c(t){return a(t=f(t))?t:h(t)?"":String(t)}function f(t){return t instanceof i?t.valueOf():t}function l(t){return"number"==typeof t}function h(t){return null==t}function d(t){return"[object Array]"===r.call(t)}function v(t,e){for(var r in t=t||{})if(Object.hasOwnProperty.call(t,r)&&!1===e(t[r],r,t))break;return t}function g(t){return t[t.length-1]}function y(t){var e=typeof t;return null!==t&&("object"==e||"function"==e)}function b(t,e,r){void 0===r&&(r=1);for(var n=[],i=t;i<e;i+=r)n.push(i);return n}function T(t,e,r){return void 0===r&&(r=" "),k(t,e,r,function(t,e){return e+t})}function k(t,e,r,n){for(var i=e-(t=String(t)).length;0<i--;)t=n(t,r);return t}function S(t){return t}function F(t){return t.replace(/(\w?)([A-Z])/g,function(t,e,r){return(e?e+"_":"")+r.toLowerCase()})}function R(t,e){return null==t&&null==e?0:null==t?1:null==e?-1:(t=s.call(t))<(e=s.call(e))?-1:e<t?1:0}var L=function(t,e,r,n){this.key=t,this.value=e,this.next=r,this.prev=n},E=(P.prototype.write=function(t,e){if(this.cache[t])this.cache[t].value=e;else{var r=new L(t,e,this.head.next,this.head);this.head.next.prev=r,this.head.next=r,this.cache[t]=r,this.size++,this.ensureLimit()}},P.prototype.read=function(t){if(this.cache[t]){var e=this.cache[t].value;return this.remove(t),this.write(t,e),e}},P.prototype.remove=function(t){var e=this.cache[t];e.prev.next=e.next,e.next.prev=e.prev,delete this.cache[t],this.size--},P.prototype.clear=function(){this.head.next=this.tail,this.tail.prev=this.head,this.size=0,this.cache={}},P.prototype.ensureLimit=function(){this.size>this.limit&&this.remove(this.tail.prev.key)},P);function P(t,e){void 0===e&&(e=0),this.limit=t,this.size=e,this.cache={},this.head=new L("HEAD",null,null,null),this.tail=new L("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head}function D(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}var M=Object.freeze({__proto__:null,resolve:function(t,e,i){return t.length&&"/"!==g(t)&&(t+="/"),D(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,function(t,e,r){var n=r.split("/").pop();return/\.\w+$/.test(n)?t:e+r+i})},readFile:function(n){return o(this,void 0,void 0,function(){return q(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()})]})})},readFileSync:function(t){var e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),e.status<200||300<=e.status)throw new Error(e.statusText);return e.responseText},exists:function(t){return o(this,void 0,void 0,function(){return q(this,function(t){return[2,!0]})})},existsSync:function(t){return!0},dirname:function(t){return D(t,".")},sep:"/"});function N(t){return t&&u(t.equals)}function _(t,e){return!A(t,e)}function A(t,e){return e.opts.jsTruthy?!t:!1===t||null==t}var j={"==":function(t,e){return N(t)?t.equals(e):N(e)?e.equals(t):t===e},"!=":function(t,e){return N(t)?!t.equals(e):N(e)?!e.equals(t):t!==e},">":function(t,e){return N(t)?t.gt(e):N(e)?e.lt(t):e<t},"<":function(t,e){return N(t)?t.lt(e):N(e)?e.gt(t):t<e},">=":function(t,e){return N(t)?t.geq(e):N(e)?e.leq(t):e<=t},"<=":function(t,e){return N(t)?t.leq(e):N(e)?e.geq(t):t<=e},contains:function(t,e){return!(!t||!u(t.indexOf))&&-1<t.indexOf(e)},and:function(t,e,r){return _(t,r)&&_(e,r)},or:function(t,e,r){return _(t,r)||_(e,r)}},I=[0,0,0,0,0,0,0,0,0,20,4,4,4,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,2,8,0,0,0,0,8,0,0,0,64,0,65,0,0,33,33,33,33,33,33,33,33,33,33,0,0,2,2,2,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0],V=1,z=4,B=16;function C(t){var e,r,n={};try{for(var i=O(Object.entries(t)),o=i.next();!o.done;o=i.next()){for(var s=m(o.value,2),a=s[0],u=s[1],c=n,l=0;l<a.length;l++){var h=a[l];c[h]=c[h]||{},l===a.length-1&&I[a.charCodeAt(l)]&V&&(c[h].needBoundary=!0),c=c[h]}c.handler=u,c.end=!0}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n}I[160]=I[5760]=I[6158]=I[8192]=I[8193]=I[8194]=I[8195]=I[8196]=I[8197]=I[8198]=I[8199]=I[8200]=I[8201]=I[8202]=I[8232]=I[8233]=I[8239]=I[8287]=I[12288]=z;var H={root:["."],layouts:["."],partials:["."],relativeReference:!0,jekyllInclude:!1,cache:void 0,extname:"",fs:M,dynamicPartials:!0,jsTruthy:!1,trimTagRight:!1,trimTagLeft:!1,trimOutputRight:!1,trimOutputLeft:!1,greedy:!0,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",preserveTimezones:!1,strictFilters:!1,strictVariables:!1,lenientIf:!1,globals:{},keepOutputType:!1,operators:j,operatorsTrie:C(j)};function K(t){var e=[];return d(t)&&(e=t),a(t)&&(e=[t]),e}var U,Q=(t(W,U=Error),W.prototype.update=function(){var t=this.originalError;this.context=function(t){var i=m(t.getPosition(),1)[0],o=t.input.split("\n"),e=Math.max(i-2,1),s=Math.min(i+3,o.length);return b(e,s+1).map(function(t){var e=t===i?">> ":" ",r=T(String(t),String(s).length),n=o[t-1];return"".concat(e).concat(r,"| ").concat(n)}).join("\n")}(this.token),this.message=function(t,e){e.file&&(t+=", file:".concat(e.file));var r=m(e.getPosition(),2),n=r[0],i=r[1];return t+=", line:".concat(n,", col:").concat(i)}(t.message,this.token),this.stack=this.message+"\n"+this.context+"\n"+this.stack+"\nFrom "+t.stack},W);function W(t,e){var r=U.call(this,t.message)||this;return r.originalError=t,r.token=e,r.context="",r}var Y,J=(t($,Y=Q),$);function $(t,e){var r=Y.call(this,new Error(t),e)||this;return r.name="TokenizationError",Y.prototype.update.call(r),r}var G,X=(t(Z,G=Q),Z);function Z(t,e){var r=G.call(this,t,e)||this;return r.name="ParseError",r.message=t.message,G.prototype.update.call(r),r}var tt,et=(t(rt,tt=Q),rt.is=function(t){return"RenderError"===t.name},rt);function rt(t,e){var r=tt.call(this,t,e.token)||this;return r.name="RenderError",r.message=t.message,tt.prototype.update.call(r),r}var nt,it=(t(ot,nt=Q),ot);function ot(t,e){var r=nt.call(this,t,e)||this;return r.name="UndefinedVariableError",r.message=t.message,nt.prototype.update.call(r),r}var st,at=(t(ut,st=Error),ut);function ut(t){var e=st.call(this,"undefined variable: ".concat(t))||this;return e.name="InternalUndefinedVariableError",e.variableName=t,e}var ct,lt=(t(ht,ct=Error),ht);function ht(t){var e=ct.call(this,t)||this;return e.name="AssertionError",e.message=t+"",e}var pt,ft,dt=(vt.prototype.getRegister=function(t){return this.registers[t]=this.registers[t]||{}},vt.prototype.setRegister=function(t,e){return this.registers[t]=e},vt.prototype.saveRegister=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.map(function(t){return[t,e.getRegister(t)]})},vt.prototype.restoreRegister=function(t){var i=this;return t.forEach(function(t){var e=m(t,2),r=e[0],n=e[1];return i.setRegister(r,n)})},vt.prototype.getAll=function(){return w([this.globals,this.environments],m(this.scopes),!1).reduce(function(t,e){return x(t,e)},{})},vt.prototype.get=function(t){var e=this.findScope(t[0]);return this.getFromScope(e,t)},vt.prototype.getFromScope=function(t,e){var r=this;return"string"==typeof e&&(e=e.split(".")),e.reduce(function(t,e){if(h(t=function(t,e){return h(t)?t:u((t=function t(e){return e&&u(e.toLiquid)?t(e.toLiquid()):e}(t))[e])?t[e]():t instanceof i?t.hasOwnProperty(e)?t[e]:t.liquidMethodMissing(e):"size"===e?function(t){return t.hasOwnProperty("size")||void 0!==t.size?t.size:d(t)||a(t)?t.length:"object"==typeof t?Object.keys(t).length:void 0}(t):"first"===e?function(t){return d(t)?t[0]:t.first}(t):"last"===e?function(t){return d(t)?t[t.length-1]:t.last}(t):t[e]}(t,e))&&r.strictVariables)throw new at(e);return t},t)},vt.prototype.push=function(t){return this.scopes.push(t)},vt.prototype.pop=function(){return this.scopes.pop()},vt.prototype.bottom=function(){return this.scopes[0]},vt.prototype.findScope=function(t){for(var e=this.scopes.length-1;0<=e;e--){var r=this.scopes[e];if(t in r)return r}return t in this.environments?this.environments:this.globals},vt);function vt(t,e,r){var n,i;void 0===t&&(t={}),void 0===e&&(e=H),void 0===r&&(r={}),this.scopes=[{}],this.registers={},this.sync=!!r.sync,this.opts=e,this.globals=null!==(n=r.globals)&&void 0!==n?n:e.globals,this.environments=t,this.strictVariables=null!==(i=r.strictVariables)&&void 0!==i?i:this.opts.strictVariables}function gt(t,e){if(!t){var r="function"==typeof e?e():e||"expect ".concat(t," to be true");throw new lt(r)}}(ft=pt=pt||{}).Partials="partials",ft.Layouts="layouts",ft.Root="root";var yt=(mt.prototype.lookup=function(e,r,n,i){var o,s,a,u,c,l,h,p,f;return q(this,function(t){switch(t.label){case 0:o=this.options.fs,s=this.options[r],t.label=1;case 1:t.trys.push([1,8,9,10]),a=O(this.candidates(e,s,i,r!==pt.Root)),u=a.next(),t.label=2;case 2:return u.done?[3,7]:(c=u.value,n?(l=o.existsSync(c),[3,5]):[3,3]);case 3:return[4,o.exists(c)];case 4:l=t.sent(),t.label=5;case 5:if(l)return[2,c];t.label=6;case 6:return u=a.next(),[3,2];case 7:return[3,10];case 8:return h=t.sent(),p={error:h},[3,10];case 9:try{u&&!u.done&&(f=a.return)&&f.call(a)}finally{if(p)throw p.error}return[7];case 10:throw this.lookupError(e,s)}})},mt.prototype.candidates=function(e,r,n,i){var o,s,a,u,c,l,h,p,f,d,v,g,y,m,w,b;return q(this,function(t){switch(t.label){case 0:if(o=this.options,s=o.fs,a=o.extname,!this.shouldLoadRelative(e)||!n)return[3,8];d=s.resolve(this.dirname(n),e,a),t.label=1;case 1:t.trys.push([1,6,7,8]),u=O(r),c=u.next(),t.label=2;case 2:return c.done?[3,5]:(f=c.value,i&&!this.contains(f,d)?[3,4]:[4,d]);case 3:return t.sent(),[3,5];case 4:return c=u.next(),[3,2];case 5:return[3,8];case 6:return l=t.sent(),y={error:l},[3,8];case 7:try{c&&!c.done&&(m=u.return)&&m.call(u)}finally{if(y)throw y.error}return[7];case 8:t.trys.push([8,13,14,15]),h=O(r),p=h.next(),t.label=9;case 9:return p.done?[3,12]:(f=p.value,d=s.resolve(f,e,a),i&&!this.contains(f,d)?[3,11]:[4,d]);case 10:t.sent(),t.label=11;case 11:return p=h.next(),[3,9];case 12:return[3,15];case 13:return v=t.sent(),w={error:v},[3,15];case 14:try{p&&!p.done&&(b=h.return)&&b.call(h)}finally{if(w)throw w.error}return[7];case 15:return void 0===s.fallback?[3,17]:void 0===(g=s.fallback(e))?[3,17]:[4,g];case 16:t.sent(),t.label=17;case 17:return[2]}})},mt.prototype.dirname=function(t){var e=this.options.fs;return gt(e.dirname,"`fs.dirname` is required for relative reference"),e.dirname(t)},mt.prototype.lookupError=function(t,e){var r=new Error("ENOENT");return r.message='ENOENT: Failed to lookup "'.concat(t,'" in "').concat(e,'"'),r.code="ENOENT",r},mt);function mt(t){if((this.options=t).relativeReference){var e=t.fs.sep;gt(e,"`fs.sep` is required for relative reference");var r=new RegExp(["."+e,".."+e,"./","../"].map(function(t){return function(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}(t)}).join("|"));this.shouldLoadRelative=function(t){return r.test(t)}}else this.shouldLoadRelative=function(t){return!1};this.contains=this.options.fs.contains||function(){return!0}}var wt=(bt.prototype.write=function(t){this.buffer+=c(t)},bt);function bt(){this.buffer=""}var Tt=function(){throw this.buffer="",this.stream=null,new Error("streaming not supported in browser")};function kt(e){var t={then:function(t){return t(e)},catch:function(){return t}};return t}function xt(r){var n={then:function(t,e){return e?e(r):n},catch:function(t){return t(r)}};return n}function qt(n){return function(t){return t&&u(t.then)}(n)?n:function(t){return t&&u(t.next)&&u(t.throw)&&u(t.return)}(n)?function r(t){var e;try{e=n.next(t)}catch(t){return xt(t)}if(e.done)return kt(e.value);return qt(e.value).then(r,function(t){var e;try{e=n.throw(t)}catch(t){return xt(t)}return e.done?kt(e.value):r(e.value)})}():kt(n)}function Ot(t){return Promise.resolve(qt(t))}function St(t){var e;return qt(t).then(function(t){return kt(e=t)}).catch(function(t){throw t}),e}var Ft=(Rt.prototype.write=function(t){"string"!=typeof(t=f(t))&&""===this.buffer?this.buffer=t:this.buffer=c(this.buffer)+c(t)},Rt);function Rt(){this.buffer=""}var Lt,Et=(Pt.prototype.renderTemplatesToNodeStream=function(t,e){var r=this,n=new Tt;return Promise.resolve().then(function(){return qt(r.renderTemplates(t,e,n))}).then(function(){return n.end()},function(t){return n.error(t)}),n.stream},Pt.prototype.renderTemplates=function(e,r,n){var i,o,s,a,u,c,l,h;return q(this,function(t){switch(t.label){case 0:n=n||(r.opts.keepOutputType?new Ft:new wt),t.label=1;case 1:t.trys.push([1,8,9,10]),i=O(e),o=i.next(),t.label=2;case 2:if(o.done)return[3,7];s=o.value,t.label=3;case 3:return t.trys.push([3,5,,6]),[4,s.render(r,n)];case 4:return(a=t.sent())&&n.write(a),n.break||n.continue?[3,7]:[3,6];case 5:throw u=t.sent(),et.is(u)?u:new et(u,s);case 6:return o=i.next(),[3,2];case 7:return[3,10];case 8:return c=t.sent(),l={error:c},[3,10];case 9:try{o&&!o.done&&(h=i.return)&&h.call(i)}finally{if(l)throw l.error}return[7];case 10:return[2,n.buffer]}})},Pt);function Pt(){}function Dt(t){return!!(Ht(t)&p.TokenKind.Delimited)}function Mt(t){return Ht(t)===p.TokenKind.Operator}function Nt(t){return Ht(t)===p.TokenKind.HTML}function _t(t){return Ht(t)===p.TokenKind.Output}function At(t){return Ht(t)===p.TokenKind.Tag}function jt(t){return Ht(t)===p.TokenKind.Quoted}function It(t){return Ht(t)===p.TokenKind.Literal}function Vt(t){return Ht(t)===p.TokenKind.Number}function zt(t){return Ht(t)===p.TokenKind.PropertyAccess}function Bt(t){return Ht(t)===p.TokenKind.Word}function Ct(t){return Ht(t)===p.TokenKind.Range}function Ht(t){return t?t.kind:-1}p.TokenKind=void 0,(Lt=p.TokenKind||(p.TokenKind={}))[Lt.Number=1]="Number",Lt[Lt.Literal=2]="Literal",Lt[Lt.Tag=4]="Tag",Lt[Lt.Output=8]="Output",Lt[Lt.HTML=16]="HTML",Lt[Lt.Filter=32]="Filter",Lt[Lt.Hash=64]="Hash",Lt[Lt.PropertyAccess=128]="PropertyAccess",Lt[Lt.Word=256]="Word",Lt[Lt.Range=512]="Range",Lt[Lt.Quoted=1024]="Quoted",Lt[Lt.Operator=2048]="Operator",Lt[Lt.Delimited=12]="Delimited";var Kt=Object.freeze({__proto__:null,isDelimitedToken:Dt,isOperatorToken:Mt,isHTMLToken:Nt,isOutputToken:_t,isTagToken:At,isQuotedToken:jt,isLiteralToken:It,isNumberToken:Vt,isPropertyAccessToken:zt,isWordToken:Bt,isRangeToken:Ct}),Ut=(Qt.prototype.on=function(t,e){return this.handlers[t]=e,this},Qt.prototype.trigger=function(t,e){var r=this.handlers[t];return!!r&&(r.call(this,e),!0)},Qt.prototype.start=function(){var t;for(this.trigger("start");!this.stopRequested&&(t=this.tokens.shift());)if(!(this.trigger("token",t)||At(t)&&this.trigger("tag:".concat(t.name),t))){var e=this.parseToken(t,this.tokens);this.trigger("template",e)}return this.stopRequested||this.trigger("end"),this},Qt.prototype.stop=function(){return this.stopRequested=!0,this},Qt);function Qt(t,e){this.handlers={},this.stopRequested=!1,this.tokens=t,this.parseToken=e}function Wt(t){this.token=t}var Yt,Jt=(t($t,Yt=i),$t.prototype.equals=function(t){return h(f(t))},$t.prototype.gt=function(){return!1},$t.prototype.geq=function(){return!1},$t.prototype.lt=function(){return!1},$t.prototype.leq=function(){return!1},$t.prototype.valueOf=function(){return null},$t);function $t(){return null!==Yt&&Yt.apply(this,arguments)||this}var Gt,Xt=(t(Zt,Gt=i),Zt.prototype.equals=function(t){return!(t instanceof Zt||(a(t=f(t))||d(t)?0!==t.length:!y(t)||0!==Object.keys(t).length))},Zt.prototype.gt=function(){return!1},Zt.prototype.geq=function(){return!1},Zt.prototype.lt=function(){return!1},Zt.prototype.leq=function(){return!1},Zt.prototype.valueOf=function(){return""},Zt);function Zt(){return null!==Gt&&Gt.apply(this,arguments)||this}var te,ee=(t(re,te=Xt),re.prototype.equals=function(t){return!1===t||!!h(f(t))||(a(t)?/^\s*$/.test(t):te.prototype.equals.call(this,t))},re);function re(){return null!==te&&te.apply(this,arguments)||this}var ne=new Jt,ie={true:!0,false:!1,nil:ne,null:ne,empty:new Xt,blank:new ee},oe=/[\da-fA-F]/,se=/[0-7]/,ae={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v"};function ue(t){var e=t.charCodeAt(0);return 97<=e?e-87:65<=e?e-55:e-48}function ce(t){for(var e="",r=1;r<t.length-1;r++)if("\\"===t[r])if(void 0!==ae[t[r+1]])e+=ae[t[++r]];else if("u"===t[r+1]){for(var n=0,i=r+2;i<=r+5&&oe.test(t[i]);)n=16*n+ue(t[i++]);r=i-1,e+=String.fromCharCode(n)}else if(se.test(t[r+1])){for(i=r+1,n=0;i<=r+3&&se.test(t[i]);)n=8*n+ue(t[i++]);r=i-1,e+=String.fromCharCode(n)}else e+=t[++r];else e+=t[r];return e}var le=(he.prototype.evaluate=function(e,r){var n,i,o,s,a,u,c,l,h,p,f,d;return q(this,function(t){switch(t.label){case 0:gt(e,"unable to evaluate: context not defined"),n=[],t.label=1;case 1:t.trys.push([1,9,10,11]),i=O(this.postfix),o=i.next(),t.label=2;case 2:return o.done?[3,8]:Mt(s=o.value)?[4,n.pop()]:[3,5];case 3:return a=t.sent(),[4,n.pop()];case 4:return u=t.sent(),c=function(t,e,r,n,i){return(0,t[e.operator])(r,n,i)}(e.opts.operators,s,u,a,e),n.push(c),[3,7];case 5:return h=(l=n).push,[4,pe(s,e,r&&1===this.postfix.length)];case 6:h.apply(l,[t.sent()]),t.label=7;case 7:return o=i.next(),[3,2];case 8:return[3,11];case 9:return p=t.sent(),f={error:p},[3,11];case 10:try{o&&!o.done&&(d=i.return)&&d.call(i)}finally{if(f)throw f.error}return[7];case 11:return[2,n[0]]}})},he);function he(t){this.postfix=w([],m(function(e){var r,n,i,o,s,a,u;return q(this,function(t){switch(t.label){case 0:r=[],t.label=1;case 1:t.trys.push([1,10,11,12]),n=O(e),i=n.next(),t.label=2;case 2:if(i.done)return[3,9];if(!Mt(o=i.value))return[3,6];t.label=3;case 3:return r.length&&r[r.length-1].getPrecedence()>o.getPrecedence()?[4,r.pop()]:[3,5];case 4:return t.sent(),[3,3];case 5:return r.push(o),[3,8];case 6:return[4,o];case 7:t.sent(),t.label=8;case 8:return i=n.next(),[3,2];case 9:return[3,12];case 10:return s=t.sent(),a={error:s},[3,12];case 11:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(a)throw a.error}return[7];case 12:return r.length?[4,r.pop()]:[3,14];case 13:return t.sent(),[3,12];case 14:return[2]}})}(t)),!1)}function pe(t,e,r){return void 0===r&&(r=!1),zt(t)?function(e,r,n){var t=e.props.map(function(t){return pe(t,r,!1)});try{return r.get(w([e.propertyName],m(t),!1))}catch(t){if(n&&"InternalUndefinedVariableError"===t.name)return null;throw new it(t,e)}}(t,e,r):Ct(t)?function(t,e){var r=pe(t.lhs,e),n=pe(t.rhs,e);return b(+r,+n+1)}(t,e):It(t)?function(t){return ie[t.literal]}(t):Vt(t)?function(t){var e=t.whole.content+"."+(t.decimal?t.decimal.content:"");return Number(e)}(t):Bt(t)?t.getText():jt(t)?fe(t):void 0}function fe(t){return ce(t.getText())}var de=(ve.prototype.getText=function(){return this.input.slice(this.begin,this.end)},ve.prototype.getPosition=function(){for(var t=m([1,1],2),e=t[0],r=t[1],n=0;n<this.begin;n++)"\n"===this.input[n]?(e++,r=1):r++;return[e,r]},ve.prototype.size=function(){return this.end-this.begin},ve);function ve(t,e,r,n,i){this.kind=t,this.input=e,this.begin=r,this.end=n,this.file=i}var ge,ye=(t(me,ge=de),me);function me(t,e,r,n,i,o,s,a){var u=ge.call(this,t,r,n,i,a)||this;u.trimLeft=!1,u.trimRight=!1,u.content=u.getText();var c="-"===e[0],l="-"===g(e);return u.content=e.slice(c?1:0,l?-1:e.length).trim(),u.trimLeft=c||o,u.trimRight=l||s,u}function we(t,e){if(t&&Nt(t))for(var r=e?z:B;I[t.input.charCodeAt(t.end-1-t.trimRight)]&r;)t.trimRight++}function be(t,e){if(t&&Nt(t)){for(var r=e?z:B;I[t.input.charCodeAt(t.begin+t.trimLeft)]&r;)t.trimLeft++;"\n"===t.input.charAt(t.begin+t.trimLeft)&&t.trimLeft++}}var Te,ke=(t(xe,Te=de),xe);function xe(t,e){var r=Te.call(this,p.TokenKind.Number,t.input,t.begin,e?e.end:t.end,t.file)||this;return r.whole=t,r.decimal=e,r}var qe,Oe=(t(Se,qe=de),Se.prototype.isNumber=function(t){void 0===t&&(t=!1);for(var e=t&&64&I[this.input.charCodeAt(this.begin)]?this.begin+1:this.begin;e<this.end;e++)if(!(32&I[this.input.charCodeAt(e)]))return!1;return!0},Se);function Se(t,e,r,n){var i=qe.call(this,p.TokenKind.Word,t,e,r,n)||this;return i.input=t,i.begin=e,i.end=r,i.file=n,i.content=i.getText(),i}var Fe,Re=(t(Le,Fe=de),Le);function Le(t,e,r,n){var i=Fe.call(this,p.TokenKind.Literal,t,e,r,n)||this;return i.input=t,i.begin=e,i.end=r,i.file=n,i.literal=i.getText(),i}var Ee,Pe={"==":1,"!=":1,">":1,"<":1,">=":1,"<=":1,contains:1,and:0,or:0},De=(t(Me,Ee=de),Me.prototype.getPrecedence=function(){var t=this.getText();return t in Pe?Pe[t]:1},Me);function Me(t,e,r,n){var i=Ee.call(this,p.TokenKind.Operator,t,e,r,n)||this;return i.input=t,i.begin=e,i.end=r,i.file=n,i.operator=i.getText(),i}var Ne,_e=(t(Ae,Ne=de),Ae);function Ae(t,e,r){var n=Ne.call(this,p.TokenKind.PropertyAccess,t.input,t.begin,r,t.file)||this;return n.variable=t,n.props=e,n.propertyName=n.variable instanceof Oe?n.variable.getText():ce(n.variable.getText()),n}var je,Ie=(t(Ve,je=de),Ve);function Ve(t,e,r,n,i,o){var s=je.call(this,p.TokenKind.Filter,r,n,i,o)||this;return s.name=t,s.args=e,s}var ze,Be=(t(Ce,ze=de),Ce);function Ce(t,e,r,n,i,o){var s=ze.call(this,p.TokenKind.Hash,t,e,r,o)||this;return s.input=t,s.begin=e,s.end=r,s.name=n,s.value=i,s.file=o,s}var He,Ke=(t(Ue,He=de),Ue);function Ue(t,e,r,n){var i=He.call(this,p.TokenKind.Quoted,t,e,r,n)||this;return i.input=t,i.begin=e,i.end=r,i.file=n,i}var Qe,We=(t(Ye,Qe=de),Ye.prototype.getContent=function(){return this.input.slice(this.begin+this.trimLeft,this.end-this.trimRight)},Ye);function Ye(t,e,r,n){var i=Qe.call(this,p.TokenKind.HTML,t,e,r,n)||this;return i.input=t,i.begin=e,i.end=r,i.file=n,i.trimLeft=0,i.trimRight=0,i}var Je,$e=(t(Ge,Je=de),Ge);function Ge(t,e,r,n,i,o){var s=Je.call(this,p.TokenKind.Range,t,e,r,o)||this;return s.input=t,s.begin=e,s.end=r,s.lhs=n,s.rhs=i,s.file=o,s}var Xe,Ze=(t(tr,Xe=ye),tr);function tr(t,e,r,n,i){var o=n.trimOutputLeft,s=n.trimOutputRight,a=n.outputDelimiterLeft,u=n.outputDelimiterRight,c=t.slice(e+a.length,r-u.length);return Xe.call(this,p.TokenKind.Output,c,t,e,r,o,s,i)||this}var er,rr=(t(nr,er=ye),nr);function nr(t,e,r,n,i){var o=this,s=t.slice(e,r);if(o=er.call(this,p.TokenKind.Tag,s,t,e,r,!1,!1,i)||this,/\S/.test(s)){var a=new ir(o.content,n.operatorsTrie);if(o.name=a.readIdentifier().getText(),!o.name)throw new J("illegal liquid tag syntax",o);a.skipBlank(),o.args=a.remaining()}else o.name="",o.args="";return o}var ir=(or.prototype.readExpression=function(){return new le(this.readExpressionTokens())},or.prototype.readExpressionTokens=function(){var e,r,n;return q(this,function(t){switch(t.label){case 0:return(e=this.readValue())?[4,e]:[2];case 1:t.sent(),t.label=2;case 2:return this.p<this.N?(r=this.readOperator())&&(n=this.readValue())?[4,r]:[2]:[3,5];case 3:return t.sent(),[4,n];case 4:return t.sent(),[3,2];case 5:return[2]}})},or.prototype.readOperator=function(){this.skipBlank();var t=function(t,e,r,n){void 0===n&&(n=t.length);for(var i,o=r,s=e;o[t[s]]&&s<n;)(o=o[t[s++]]).end&&(i=o);return i?i.needBoundary&&I[t.charCodeAt(s)]&V?-1:s:-1}(this.input,this.p,this.trie);if(-1!==t)return new De(this.input,this.p,this.p=t,this.file)},or.prototype.readFilters=function(){for(var t=[];;){var e=this.readFilter();if(!e)return t;t.push(e)}},or.prototype.readFilter=function(){var t=this;if(this.skipBlank(),this.end())return null;gt("|"===this.peek(),function(){return"unexpected token at ".concat(t.snapshot())}),this.p++;var e=this.p,r=this.readIdentifier();if(!r.size())return null;var n=[];if(this.skipBlank(),":"===this.peek())do{++this.p;var i=this.readFilterArg();for(i&&n.push(i);this.p<this.N&&","!==this.peek()&&"|"!==this.peek();)++this.p}while(","===this.peek());return new Ie(r.getText(),n,this.input,e,this.p,this.file)},or.prototype.readFilterArg=function(){var t=this.readValue();if(t){if(this.skipBlank(),":"!==this.peek())return t;++this.p;var e=this.readValue();return[t.getText(),e]}},or.prototype.readTopLevelTokens=function(t){void 0===t&&(t=H);for(var e=[];this.p<this.N;){var r=this.readTopLevelToken(t);e.push(r)}return function(t,e){for(var r=!1,n=0;n<t.length;n++){var i=t[n];Dt(i)&&(!r&&i.trimLeft&&we(t[n-1],e.greedy),At(i)&&("raw"===i.name?r=!0:"endraw"===i.name&&(r=!1)),!r&&i.trimRight&&be(t[n+1],e.greedy))}}(e,t),e},or.prototype.readTopLevelToken=function(t){var e=t.tagDelimiterLeft,r=t.outputDelimiterLeft;return-1<this.rawBeginAt?this.readEndrawOrRawContent(t):this.match(e)?this.readTagToken(t):this.match(r)?this.readOutputToken(t):this.readHTMLToken([e,r])},or.prototype.readHTMLToken=function(t){for(var e=this,r=this.p;this.p<this.N&&!t.some(function(t){return e.match(t)});)++this.p;return new We(this.input,r,this.p,this.file)},or.prototype.readTagToken=function(t){void 0===t&&(t=H);var e=this.file,r=this.input,n=this.p;if(-1===this.readToDelimiter(t.tagDelimiterRight))throw this.mkError("tag ".concat(this.snapshot(n)," not closed"),n);var i=new ar(r,n,this.p,t,e);return"raw"===i.name&&(this.rawBeginAt=n),i},or.prototype.readToDelimiter=function(t){for(;this.p<this.N;)if(8&this.peekType())this.readQuoted();else if(++this.p,this.rmatch(t))return this.p;return-1},or.prototype.readOutputToken=function(t){void 0===t&&(t=H);var e=this.file,r=this.input,n=t.outputDelimiterRight,i=this.p;if(-1===this.readToDelimiter(n))throw this.mkError("output ".concat(this.snapshot(i)," not closed"),i);return new Ze(r,i,this.p,t,e)},or.prototype.readEndrawOrRawContent=function(t){for(var e=t.tagDelimiterLeft,r=t.tagDelimiterRight,n=this.p,i=this.readTo(e)-e.length;this.p<this.N;)if("endraw"===this.readIdentifier().getText())for(;this.p<=this.N;){if(this.rmatch(r)){var o=this.p;return n===i?(this.rawBeginAt=-1,new ar(this.input,n,o,t,this.file)):(this.p=i,new We(this.input,n,i,this.file))}if(this.rmatch(e))break;this.p++}else i=this.readTo(e)-e.length;throw this.mkError("raw ".concat(this.snapshot(this.rawBeginAt)," not closed"),n)},or.prototype.readLiquidTagTokens=function(t){void 0===t&&(t=H);for(var e=[];this.p<this.N;){var r=this.readLiquidTagToken(t);r.name&&e.push(r)}return e},or.prototype.readLiquidTagToken=function(t){var e=this.file,r=this.input,n=this.p,i=this.N;return-1!==this.readToDelimiter("\n")&&(i=this.p),new rr(r,n,i,t,e)},or.prototype.mkError=function(t,e){return new J(t,new Oe(this.input,e,this.N,this.file))},or.prototype.snapshot=function(t){return void 0===t&&(t=this.p),JSON.stringify(function(t,e){return t.length>e?t.substr(0,e-3)+"...":t}(this.input.slice(t),16))},or.prototype.readWord=function(){return console.warn("Tokenizer#readWord() will be removed, use #readIdentifier instead"),this.readIdentifier()},or.prototype.readIdentifier=function(){this.skipBlank();for(var t=this.p;this.peekType()&V;)++this.p;return new Oe(this.input,t,this.p,this.file)},or.prototype.readHashes=function(t){for(var e=[];;){var r=this.readHash(t);if(!r)return e;e.push(r)}},or.prototype.readHash=function(t){this.skipBlank(),","===this.peek()&&++this.p;var e=this.p,r=this.readIdentifier();if(r.size()){var n;this.skipBlank();var i=t?"=":":";return this.peek()===i&&(++this.p,n=this.readValue()),new Be(this.input,e,this.p,r,n,this.file)}},or.prototype.remaining=function(){return this.input.slice(this.p)},or.prototype.advance=function(t){void 0===t&&(t=1),this.p+=t},or.prototype.end=function(){return this.p>=this.N},or.prototype.readTo=function(t){for(;this.p<this.N;)if(++this.p,this.rmatch(t))return this.p;return-1},or.prototype.readValue=function(){var t=this.readQuoted()||this.readRange();if(t)return t;if("["===this.peek()){if(this.p++,!(i=this.readQuoted()))return;if("]"!==this.peek())return;return this.p++,new _e(i,[],this.p)}var e=this.readIdentifier();if(e.size()){for(var r=e.isNumber(!0),n=[];;)if("["===this.peek()){r=!1,this.p++;var i=this.readValue()||new Oe(this.input,this.p,this.p,this.file);this.readTo("]"),n.push(i)}else{if("."!==this.peek()||"."===this.peek(1))break;if(this.p++,!(i=this.readIdentifier()).size())break;i.isNumber()||(r=!1),n.push(i)}return!n.length&&ie.hasOwnProperty(e.content)?new Re(this.input,e.begin,e.end,this.file):r?new ke(e,n[0]):new _e(e,n,this.p)}},or.prototype.readRange=function(){this.skipBlank();var t=this.p;if("("===this.peek()){++this.p;var e=this.readValueOrThrow();this.p+=2;var r=this.readValueOrThrow();return++this.p,new $e(this.input,t,this.p,e,r,this.file)}},or.prototype.readValueOrThrow=function(){var t=this,e=this.readValue();return gt(e,function(){return"unexpected token ".concat(t.snapshot(),", value expected")}),e},or.prototype.readQuoted=function(){this.skipBlank();var t=this.p;if(8&this.peekType()){++this.p;for(var e=!1;this.p<this.N&&(++this.p,this.input[this.p-1]!==this.input[t]||e);)e?e=!1:"\\"===this.input[this.p-1]&&(e=!0);return new Ke(this.input,t,this.p,this.file)}},or.prototype.readFileNameTemplate=function(e){var r,n,i;return q(this,function(t){switch(t.label){case 0:r=e.outputDelimiterLeft,n=[","," ",r],i=new Set(n),t.label=1;case 1:return this.p<this.N&&!i.has(this.peek())?[4,this.match(r)?this.readOutputToken(e):this.readHTMLToken(n)]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}})},or.prototype.match=function(t){for(var e=0;e<t.length;e++)if(t[e]!==this.input[this.p+e])return!1;return!0},or.prototype.rmatch=function(t){for(var e=0;e<t.length;e++)if(t[t.length-1-e]!==this.input[this.p-1-e])return!1;return!0},or.prototype.peekType=function(t){return void 0===t&&(t=0),I[this.input.charCodeAt(this.p+t)]},or.prototype.peek=function(t){return void 0===t&&(t=0),this.input[this.p+t]},or.prototype.skipBlank=function(){for(;this.peekType()&z;)++this.p},or);function or(t,e,r){void 0===r&&(r=""),this.input=t,this.trie=e,this.file=r,this.p=0,this.rawBeginAt=-1,this.N=t.length}var sr,ar=(t(ur,sr=ye),ur);function ur(t,e,r,n,i){var o=this,s=n.trimTagLeft,a=n.trimTagRight,u=n.tagDelimiterLeft,c=n.tagDelimiterRight,l=t.slice(e+u.length,r-c.length);o=sr.call(this,p.TokenKind.Tag,l,t,e,r,s,a,i)||this;var h=new ir(o.content,n.operatorsTrie);if(o.name=h.readIdentifier().getText(),!o.name)throw new J("illegal tag syntax",o);return h.skipBlank(),o.args=h.remaining(),o}var cr=(lr.prototype.render=function(e){var r,n,i,o,s,a,u,c,l,h;return q(this,function(t){switch(t.label){case 0:r={},t.label=1;case 1:t.trys.push([1,8,9,10]),n=O(Object.keys(this.hash)),i=n.next(),t.label=2;case 2:return i.done?[3,7]:(o=i.value,s=r,a=o,void 0!==this.hash[o]?[3,3]:(u=!0,[3,5]));case 3:return[4,pe(this.hash[o],e)];case 4:u=t.sent(),t.label=5;case 5:s[a]=u,t.label=6;case 6:return i=n.next(),[3,2];case 7:return[3,10];case 8:return c=t.sent(),l={error:c},[3,10];case 9:try{i&&!i.done&&(h=n.return)&&h.call(n)}finally{if(l)throw l.error}return[7];case 10:return[2,r]}})},lr);function lr(t,e){var r,n;this.hash={};var i=new ir(t,{});try{for(var o=O(i.readHashes(e)),s=o.next();!s.done;s=o.next()){var a=s.value;this.hash[a.name.content]=a.value}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}var hr=(pr.prototype.render=function(t,e){var r,n,i=[];try{for(var o=O(this.args),s=o.next();!s.done;s=o.next()){var a=s.value;d(a)?i.push([a[0],pe(a[1],e)]):i.push(pe(a,e))}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return this.impl.apply({context:e,liquid:this.liquid},w([t],m(i),!1))},pr);function pr(t,e,r,n){this.name=t,this.impl=e||S,this.args=r,this.liquid=n}var fr=(dr.prototype.value=function(e,r){var n,i,o,s,a,u;return q(this,function(t){switch(t.label){case 0:return r=r||e.opts.lenientIf&&0<this.filters.length&&"default"===this.filters[0].name,[4,this.initial.evaluate(e,r)];case 1:n=t.sent(),t.label=2;case 2:t.trys.push([2,7,8,9]),i=O(this.filters),o=i.next(),t.label=3;case 3:return o.done?[3,6]:[4,o.value.render(n,e)];case 4:n=t.sent(),t.label=5;case 5:return o=i.next(),[3,3];case 6:return[3,9];case 7:return s=t.sent(),a={error:s},[3,9];case 8:try{o&&!o.done&&(u=i.return)&&u.call(i)}finally{if(a)throw a.error}return[7];case 9:return[2,n]}})},dr);function dr(t,n){this.filters=[];var e=new ir(t,n.options.operatorsTrie);this.initial=e.readExpression(),this.filters=e.readFilters().map(function(t){var e=t.name,r=t.args;return new hr(e,n.filters.get(e),r,n)})}var vr,gr=(t(yr,vr=Wt),yr.prototype.render=function(e,r){var n,i;return q(this,function(t){switch(t.label){case 0:return[4,new cr(this.token.args).render(e)];case 1:return n=t.sent(),u((i=this.impl).render)?[4,i.render(e,r,n)]:[3,3];case 2:return[2,t.sent()];case 3:return[2]}})},yr);function yr(t,e,r){var n=vr.call(this,t)||this;n.name=t.name;var i=r.tags.get(t.name);return n.impl=Object.create(i),n.impl.liquid=r,n.impl.parse&&n.impl.parse(t,e),n}var mr,wr=(t(br,mr=Wt),br.prototype.render=function(e,r){var n;return q(this,function(t){switch(t.label){case 0:return[4,this.value.value(e,!1)];case 1:return n=t.sent(),r.write(n),[2]}})},br);function br(t,e){var r=mr.call(this,t)||this;return r.value=new fr(t.content,e),r}var Tr,kr=(t(xr,Tr=Wt),xr.prototype.render=function(t,e){return q(this,function(t){return e.write(this.str),[2]})},xr);function xr(t){var e=Tr.call(this,t)||this;return e.str=t.getContent(),e}var qr=(Or.prototype.parse=function(t,e){var r=new ir(t,this.liquid.options.operatorsTrie,e).readTopLevelTokens(this.liquid.options);return this.parseTokens(r)},Or.prototype.parseTokens=function(t){for(var e,r=[];e=t.shift();)r.push(this.parseToken(e,t));return r},Or.prototype.parseToken=function(e,t){try{return At(e)?new gr(e,t,this.liquid):_t(e)?new wr(e,this.liquid):new kr(e)}catch(t){throw new X(t,e)}},Or.prototype.parseStream=function(t){var r=this;return new Ut(t,function(t,e){return r.parseToken(t,e)})},Or.prototype._parseFileCached=function(e,r,n,i){var o,s,a;return void 0===n&&(n=pt.Root),q(this,function(t){switch(t.label){case 0:return o=this.loader.shouldLoadRelative(e)?i+","+e:n+":"+e,[4,this.cache.read(o)];case 1:if(s=t.sent())return[2,s];a=qt(this._parseFile(e,r,n,i)),this.cache.write(o,a),t.label=2;case 2:return t.trys.push([2,4,,5]),[4,a];case 3:return[2,t.sent()];case 4:return t.sent(),this.cache.remove(o),[3,5];case 5:return[2,[]]}})},Or.prototype._parseFile=function(e,r,n,i){var o,s,a,u;return void 0===n&&(n=pt.Root),q(this,function(t){switch(t.label){case 0:return[4,this.loader.lookup(e,n,r,i)];case 1:return o=t.sent(),a=(s=this.liquid).parse,r?(u=this.fs.readFileSync(o),[3,4]):[3,2];case 2:return[4,this.fs.readFile(o)];case 3:u=t.sent(),t.label=4;case 4:return[2,a.apply(s,[u,o])]}})},Or);function Or(t){this.liquid=t,this.cache=this.liquid.options.cache,this.fs=this.liquid.options.fs,this.parseFile=this.cache?this._parseFileCached:this._parseFile,this.loader=new yt(this.liquid.options)}var Sr={parse:function(t){var e=new ir(t.args,this.liquid.options.operatorsTrie);this.key=e.readIdentifier().content,e.skipBlank(),gt("="===e.peek(),function(){return"illegal token ".concat(t.getText())}),e.advance(),this.value=e.remaining()},render:function(e){var r,n;return q(this,function(t){switch(t.label){case 0:return r=e.bottom(),n=this.key,[4,this.liquid._evalValue(this.value,e)];case 1:return r[n]=t.sent(),[2]}})}};function Fr(e){return d(e)?e:a(e)&&0<e.length?[e]:y(e)?Object.keys(e).map(function(t){return[t,e[t]]}):[]}function Rr(t){return d(t)?t:[t]}var Lr,Er=(t(Pr,Lr=i),Pr.prototype.next=function(){this.i++},Pr.prototype.index0=function(){return this.i},Pr.prototype.index=function(){return this.i+1},Pr.prototype.first=function(){return 0===this.i},Pr.prototype.last=function(){return this.i===this.length-1},Pr.prototype.rindex=function(){return this.length-this.i},Pr.prototype.rindex0=function(){return this.length-this.i-1},Pr.prototype.valueOf=function(){return JSON.stringify(this)},Pr);function Pr(t,e,r){var n=Lr.call(this)||this;return n.i=0,n.length=t,n.name="".concat(r,"-").concat(e),n}var Dr=["offset","limit","reversed"],Mr={type:"block",parse:function(t,e){var r,n=this,i=new ir(t.args,this.liquid.options.operatorsTrie),o=i.readIdentifier(),s=i.readIdentifier(),a=i.readValue();gt(o.size()&&"in"===s.content&&a,function(){return"illegal tag: ".concat(t.getText())}),this.variable=o.content,this.collection=a,this.hash=new cr(i.remaining()),this.templates=[],this.elseTemplates=[];var u=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 u.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag ".concat(t.getText()," not closed"))});u.start()},render:function(e,r){var n,i,o,s,a,u,c,l,h,p,f,d,v;return q(this,function(t){switch(t.label){case 0:return n=this.liquid.renderer,o=Fr,[4,pe(this.collection,e)];case 1:return(i=o.apply(void 0,[t.sent()])).length?[3,3]:[4,n.renderTemplates(this.elseTemplates,e,r)];case 2:return t.sent(),[2];case 3:return s="continue-"+this.variable+"-"+this.collection.getText(),e.push({continue:e.getRegister(s)}),[4,this.hash.render(e)];case 4:a=t.sent(),e.pop(),u=this.liquid.options.orderedFilterParameters?Object.keys(a).filter(function(t){return Dr.includes(t)}):Dr.filter(function(t){return void 0!==a[t]}),i=u.reduce(function(t,e){return"offset"===e?function(t,e){return t.slice(e)}(t,a.offset):"limit"===e?function(t,e){return t.slice(0,e)}(t,a.limit):function(t){return w([],m(t),!1).reverse()}(t)},i),e.setRegister(s,(a.offset||0)+i.length),c={forloop:new Er(i.length,this.collection.getText(),this.variable)},e.push(c),t.label=5;case 5:t.trys.push([5,10,11,12]),l=O(i),h=l.next(),t.label=6;case 6:return h.done?[3,9]:(p=h.value,c[this.variable]=p,[4,n.renderTemplates(this.templates,e,r)]);case 7:if(t.sent(),r.break)return r.break=!1,[3,9];r.continue=!1,c.forloop.next(),t.label=8;case 8:return h=l.next(),[3,6];case 9:return[3,12];case 10:return f=t.sent(),d={error:f},[3,12];case 11:try{h&&!h.done&&(v=l.return)&&v.call(l)}finally{if(d)throw d.error}return[7];case 12:return e.pop(),[2]}})}};var Nr={parse:function(t,e){var r=this,n=new ir(t.args,this.liquid.options.operatorsTrie);this.variable=function(t){var e=t.readIdentifier().content;if(e)return e;var r=t.readQuoted();if(r)return fe(r)}(n),gt(this.variable,function(){return"".concat(t.args," not valid identifier")}),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 ".concat(t.getText()," not closed"))}),i.start()},render:function(e){var r;return q(this,function(t){switch(t.label){case 0:return[4,this.liquid.renderer.renderTemplates(this.templates,e)];case 1:return r=t.sent(),e.bottom()[this.variable]=r,[2]}})}};var _r,Ar,jr={parse:function(t,e){var n=this;this.cond=new fr(t.args,this.liquid),this.cases=[],this.elseTemplates=[];var i=[],r=this.liquid.parser.parseStream(e).on("tag:when",function(t){i=[];for(var e=new ir(t.args,n.liquid.options.operatorsTrie);!e.end();){var r=e.readValue();n.cases.push({val:r,templates:i}),e.readTo(",")}}).on("tag:else",function(){return i=n.elseTemplates}).on("tag:endcase",function(){return r.stop()}).on("template",function(t){return i.push(t)}).on("end",function(){throw new Error("tag ".concat(t.getText()," not closed"))});r.start()},render:function(e,r){var n,i,o,s,a,u,c,l,h;return q(this,function(t){switch(t.label){case 0:return n=this.liquid.renderer,o=f,[4,this.cond.value(e,e.opts.lenientIf)];case 1:i=o.apply(void 0,[t.sent()]),t.label=2;case 2:t.trys.push([2,7,8,9]),s=O(this.cases),a=s.next(),t.label=3;case 3:return a.done?[3,6]:(u=a.value,pe(u.val,e,e.opts.lenientIf)!==i?[3,5]:[4,n.renderTemplates(u.templates,e,r)]);case 4:return t.sent(),[2];case 5:return a=s.next(),[3,3];case 6:return[3,9];case 7:return c=t.sent(),l={error:c},[3,9];case 8:try{a&&!a.done&&(h=s.return)&&h.call(s)}finally{if(l)throw l.error}return[7];case 9:return[4,n.renderTemplates(this.elseTemplates,e,r)];case 10:return t.sent(),[2]}})}},Ir={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 ".concat(t.getText()," not closed"))}),r.start()}};(Ar=_r=_r||{})[Ar.OUTPUT=0]="OUTPUT",Ar[Ar.STORE=1]="STORE";var Vr=_r,zr={parseFilePath:Br,renderFilePath:Hr,parse:function(t){var e=t.args,r=new ir(e,this.liquid.options.operatorsTrie);for(this.file=this.parseFilePath(r,this.liquid),this.currentFile=t.file;!r.end();){r.skipBlank();var n=r.p,i=r.readIdentifier();if(("with"===i.content||"for"===i.content)&&(r.skipBlank(),":"!==r.peek())){var o=r.readValue();if(o){var s=r.p,a=void 0;"as"===r.readIdentifier().content?a=r.readIdentifier():r.p=s,this[i.content]={value:o,alias:a&&a.content},r.skipBlank(),","===r.peek()&&r.advance();continue}}r.p=n;break}this.hash=new cr(r.remaining())},render:function(e,r){var n,i,o,s,a,u,c,l,h,p,f,d,v,g,y,m,w,b,T,k;return q(this,function(t){switch(t.label){case 0:return i=(n=this).liquid,o=n.hash,[4,this.renderFilePath(this.file,e,i)];case 1:return gt(s=t.sent(),function(){return'illegal filename "'.concat(s,'"')}),a=new dt({},e.opts,{sync:e.sync,globals:e.globals,strictVariables:e.strictVariables}),u=a.bottom(),c=x,l=[u],[4,o.render(e)];case 2:if(c.apply(void 0,l.concat([t.sent()])),this.with&&(h=this.with,f=h.value,d=h.alias,u[d||s]=pe(f,e)),!this.for)return[3,12];p=this.for,f=p.value,d=p.alias,v=Fr(v=pe(f,e)),u.forloop=new Er(v.length,f.getText(),d),t.label=3;case 3:t.trys.push([3,9,10,11]),g=O(v),y=g.next(),t.label=4;case 4:return y.done?[3,8]:(m=y.value,u[d]=m,[4,i._parsePartialFile(s,a.sync,this.currentFile)]);case 5:return b=t.sent(),[4,i.renderer.renderTemplates(b,a,r)];case 6:t.sent(),u.forloop.next(),t.label=7;case 7:return y=g.next(),[3,4];case 8:return[3,11];case 9:return w=t.sent(),T={error:w},[3,11];case 10:try{y&&!y.done&&(k=g.return)&&k.call(g)}finally{if(T)throw T.error}return[7];case 11:return[3,15];case 12:return[4,i._parsePartialFile(s,a.sync,this.currentFile)];case 13:return b=t.sent(),[4,i.renderer.renderTemplates(b,a,r)];case 14:t.sent(),t.label=15;case 15:return[2]}})}};function Br(t,e){if(e.options.dynamicPartials){var r=t.readValue();if(void 0===r)throw new TypeError('illegal argument "'.concat(t.input,'"'));return"none"===r.getText()?null:jt(r)?Cr(e.parse(fe(r))):r}var n=w([],m(t.readFileNameTemplate(e.options)),!1),i=Cr(e.parser.parseTokens(n));return"none"===i?null:i}function Cr(t){return 1===t.length&&Nt(t[0].token)?t[0].token.getContent():t}function Hr(t,e,r){return"string"==typeof t?t:Array.isArray(t)?r.renderer.renderTemplates(t,e):pe(t,e)}var Kr,Ur={parseFilePath:Br,renderFilePath:Hr,parse:function(t){var e=t.args,r=new ir(e,this.liquid.options.operatorsTrie);this.file=this.parseFilePath(r,this.liquid),this.currentFile=t.file;var n=r.p;"with"===r.readIdentifier().content?(r.skipBlank(),":"!==r.peek()?this.withVar=r.readValue():r.p=n):r.p=n,this.hash=new cr(r.remaining(),this.liquid.options.jekyllInclude)},render:function(e,r){var n,i,o,s,a,u,c,l,h;return q(this,function(t){switch(t.label){case 0:return i=(n=this).liquid,o=n.hash,s=n.withVar,a=i.renderer,[4,this.renderFilePath(this.file,e,i)];case 1:return gt(u=t.sent(),function(){return'illegal filename "'.concat(u,'"')}),c=e.saveRegister("blocks","blockMode"),e.setRegister("blocks",{}),e.setRegister("blockMode",Vr.OUTPUT),[4,o.render(e)];case 2:return l=t.sent(),s&&(l[u]=pe(s,e)),[4,i._parsePartialFile(u,e.sync,this.currentFile)];case 3:return h=t.sent(),e.push(e.opts.jekyllInclude?{include:l}:l),[4,a.renderTemplates(h,e,r)];case 4:return t.sent(),e.pop(),e.restoreRegister(c),[2]}})}},Qr={parse:function(t){var e=new ir(t.args,this.liquid.options.operatorsTrie);this.variable=e.readIdentifier().content},render:function(t,e){var r=t.environments;l(r[this.variable])||(r[this.variable]=0),e.write(c(--r[this.variable]))}},Wr={parse:function(t){var e=new ir(t.args,this.liquid.options.operatorsTrie),r=e.readValue();for(e.skipBlank(),this.candidates=[],r&&(":"===e.peek()?(this.group=r,e.advance()):this.candidates.push(r));!e.end();){var n=e.readValue();n&&this.candidates.push(n),e.readTo(",")}gt(this.candidates.length,function(){return"empty candidates: ".concat(t.getText())})},render:function(t,e){var r=pe(this.group,t),n="cycle:".concat(r,":")+this.candidates.join(","),i=t.getRegister("cycle"),o=i[n];void 0===o&&(o=i[n]=0);var s=this.candidates[o];o=(o+1)%this.candidates.length,i[n]=o;var a=pe(s,t);e.write(a)}},Yr={parse:function(t,e){var r,n=this;this.branches=[],this.elseTemplates=[],this.liquid.parser.parseStream(e).on("start",function(){return n.branches.push({predicate:new fr(t.args,n.liquid),templates:r=[]})}).on("tag:elsif",function(t){return n.branches.push({predicate:new fr(t.args,n.liquid),templates:r=[]})}).on("tag:else",function(){return r=n.elseTemplates}).on("tag:endif",function(){this.stop()}).on("template",function(t){return r.push(t)}).on("end",function(){throw new Error("tag ".concat(t.getText()," not closed"))}).start()},render:function(e,r){var n,i,o,s,a,u,c,l,h;return q(this,function(t){switch(t.label){case 0:n=this.liquid.renderer,t.label=1;case 1:t.trys.push([1,7,8,9]),i=O(this.branches),o=i.next(),t.label=2;case 2:return o.done?[3,6]:(s=o.value,a=s.predicate,u=s.templates,[4,a.value(e,e.opts.lenientIf)]);case 3:return _(t.sent(),e)?[4,n.renderTemplates(u,e,r)]:[3,5];case 4:return t.sent(),[2];case 5:return o=i.next(),[3,2];case 6:return[3,9];case 7:return c=t.sent(),l={error:c},[3,9];case 8:try{o&&!o.done&&(h=i.return)&&h.call(i)}finally{if(l)throw l.error}return[7];case 9:return[4,n.renderTemplates(this.elseTemplates,e,r)];case 10:return t.sent(),[2]}})}},Jr={parse:function(t){var e=new ir(t.args,this.liquid.options.operatorsTrie);this.variable=e.readIdentifier().content},render:function(t,e){var r=t.environments;l(r[this.variable])||(r[this.variable]=0);var n=r[this.variable];r[this.variable]++,e.write(c(n))}},$r={parseFilePath:Br,renderFilePath:Hr,parse:function(t,e){var r=new ir(t.args,this.liquid.options.operatorsTrie);this.file=this.parseFilePath(r,this.liquid),this.currentFile=t.file,this.hash=new cr(r.remaining()),this.tpls=this.liquid.parser.parseTokens(e)},render:function(e,r){var n,i,o,s,a,u,c,l,h,p,f;return q(this,function(t){switch(t.label){case 0:return i=(n=this).liquid,o=n.hash,s=n.file,a=i.renderer,null!==s?[3,2]:(e.setRegister("blockMode",Vr.OUTPUT),[4,a.renderTemplates(this.tpls,e,r)]);case 1:return t.sent(),[2];case 2:return[4,this.renderFilePath(this.file,e,i)];case 3:return gt(u=t.sent(),function(){return'illegal filename "'.concat(u,'"')}),[4,i._parseLayoutFile(u,e.sync,this.currentFile)];case 4:return c=t.sent(),e.setRegister("blockMode",Vr.STORE),[4,a.renderTemplates(this.tpls,e)];case 5:return l=t.sent(),void 0===(h=e.getRegister("blocks"))[""]&&(h[""]=function(t,e){return e.write(l)}),e.setRegister("blockMode",Vr.OUTPUT),f=(p=e).push,[4,o.render(e)];case 6:return f.apply(p,[t.sent()]),[4,a.renderTemplates(c,e,r)];case 7:return t.sent(),e.pop(),[2]}})}},Gr=(t(Xr,Kr=i),Xr.prototype.super=function(){return this.superBlockRender()},