!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).liquidjs={})}(this,function(l){"use strict";var q=function(e,t){return(q=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}))(e,t)};function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}q(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var T=function(){return(T=Object.assign||function(e){for(var t,r=1,n=arguments.length;ra[0]&&t[1]=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ee(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||0> ":" ",r=$(String(e),String(o).length),t="".concat(t).concat(r,"| "),r=e===n?"\n"+$("^",i+t.length):"";return t+s[e-1]+r}).join("\n")),enumerable:!1}),this.message=(e=this.message,(t=this.token).file&&(e+=", file:".concat(t.file)),t=ee(t.getPosition(),2),r=t[0],t=t[1],e+=", line:".concat(r,", col:").concat(t)),this.stack=this.message+"\n"+this.context+"\n"+this.stack,this.originalError&&(this.stack+="\nFrom "+this.originalError.stack)},ae.is=function(e){return"LiquidError"===(null==e?void 0:e[se])},ae);function ae(e,t){var r=ie.call(this,"string"==typeof e?e:e.message)||this;return r.context="","string"!=typeof e&&Object.defineProperty(r,"originalError",{value:e,enumerable:!1}),Object.defineProperty(r,"token",{value:t,enumerable:!1}),Object.defineProperty(r,se,{value:"LiquidError",enumerable:!1}),r}s(le,ue=oe);var ue,ce=le;function le(e,t){e=ue.call(this,e,t)||this;return e.name="TokenizationError",ue.prototype.update.call(e),e}s(fe,he=oe);var he,pe=fe;function fe(e,t){t=he.call(this,e,t)||this;return t.name="ParseError",t.message=e.message,he.prototype.update.call(t),t}s(ve,de=oe),ve.is=function(e){return"RenderError"===e.name};var de,ye=ve;function ve(e,t){t=de.call(this,e,t.token)||this;return t.name="RenderError",t.message=e.message,de.prototype.update.call(t),t}s(be,ge=oe),be.is=function(e){return"LiquidErrors"===e.name};var ge,me=be;function be(e){var t=ge.call(this,e[0],e[0].token)||this,r=(t.errors=e,t.name="LiquidErrors",1":2,"<":2,">=":2,"<=":2,contains:2,not:1,and:0,or:0},Pt={"==":0,"!=":0,">":0,"<":0,">=":0,"<=":0,contains:0,not:1,and:0,or:0},Ct=(s(It,Dt=e),It.prototype.getPrecedence=function(){var e=this.getText();return e in Vt?Vt[e]:1},It);function It(e,t,r,n){var i=Dt.call(this,l.TokenKind.Operator,e,t,r,n)||this;return i.input=e,i.begin=t,i.end=r,i.file=n,i.operator=i.getText(),i}s(Ut,Bt=e);var Bt,Ht=Ut;function Ut(e,t,r,n,i,s){r=Bt.call(this,l.TokenKind.PropertyAccess,r,n,i,s)||this;return r.variable=e,r.props=t,r}s(Yt,Kt=e);var Kt,Wt=Yt;function Yt(e,t,r,n,i,s){r=Kt.call(this,l.TokenKind.Filter,r,n,i,s)||this;return r.name=e,r.args=t,r}s(Jt,$t=e);var $t,Zt=Jt;function Jt(e,t,r,n,i,s){var o=$t.call(this,l.TokenKind.Hash,e,t,r,s)||this;return o.input=e,o.begin=t,o.end=r,o.name=n,o.value=i,o.file=s,o}var Qt=/[\da-fA-F]/,Gt=/[0-7]/,Xt={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v"};function er(e){e=e.charCodeAt(0);return 97<=e?e-87:65<=e?e-55:e-48}s(nr,tr=e);var tr,rr=nr;function nr(e,t,r,n){var i=tr.call(this,l.TokenKind.Quoted,e,t,r,n)||this;return i.input=e,i.begin=t,i.end=r,i.file=n,i.content=function(e){for(var t="",r=1;rs.getPrecedence()?[4,r.pop()]:[3,5];case 4:return e.sent(),[3,3];case 5:return r.push(s),[3,8];case 6:return[4,s];case 7:e.sent(),e.label=8;case 8:return i=n.next(),[3,2];case 9:return[3,12];case 10:return o=e.sent(),o={error:o},[3,12];case 11:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(o)throw o.error}return[7];case 12:return r.length?[4,r.pop()]:[3,14];case 13:return e.sent(),[3,12];case 14:return[2]}})}(e)),!1)}function S(t,r,n){return void 0===n&&(n=!1),G(this,function(e){switch(e.label){case 0:return t?"content"in t?[2,t.content]:_n(t)?[4,function(t,r,n){var i,s,o,a,u,c,l,h,p;return G(this,function(e){switch(e.label){case 0:i=[],e.label=1;case 1:e.trys.push([1,6,7,8]),s=X(t.props),o=s.next(),e.label=2;case 2:return o.done?[3,5]:(c=o.value,u=(a=i).push,[4,S(c,r,!1)]);case 3:u.apply(a,[e.sent()]),e.label=4;case 4:return o=s.next(),[3,2];case 5:return[3,8];case 6:return c=e.sent(),h={error:c},[3,8];case 7:try{o&&!o.done&&(p=s.return)&&p.call(s)}finally{if(h)throw h.error}return[7];case 8:return(e.trys.push([8,14,,15]),t.variable)?[4,S(t.variable,r,n)]:[3,11];case 9:return l=e.sent(),[4,r._getFromScope(l,i)];case 10:return[2,e.sent()];case 11:return[4,r._get(i)];case 12:return[2,e.sent()];case 13:return[3,15];case 14:if(l=e.sent(),n&&"InternalUndefinedVariableError"===l.name)return[2,null];throw new ke(l,t);case 15:return[2]}})}(t,r,n)]:[3,2]:[2];case 1:return[2,e.sent()];case 2:return Rn(t)?[4,function(t,r){var n,i;return G(this,function(e){switch(e.label){case 0:return[4,S(t.lhs,r)];case 1:return n=e.sent(),[4,S(t.rhs,r)];case 2:return i=e.sent(),r.memoryLimit.use(i-n+1),[2,Y(+n,+i+1)]}})}(t,r)]:[3,4];case 3:return[2,e.sent()];case 4:return[2]}})}function br(e){return e.content}function wr(e,t){return!kr(e,t)}function kr(e,t){return e=g(e),t.opts.jsTruthy?!e:!1===e||null==e}Pe={"==":Tr,"!=":function(e,t){return!Tr(e,t)},">":function(e,t){return p(e)?e.gt(t):p(t)?t.lt(e):g(e)>g(t)},"<":function(e,t){return p(e)?e.lt(t):p(t)?t.gt(e):g(e)=":function(e,t){return p(e)?e.geq(t):p(t)?t.leq(e):g(e)>=g(t)},"<=":function(e,t){return p(e)?e.leq(t):p(t)?t.geq(e):g(e)<=g(t)},contains:function(e,t){return c(e=g(e))?e.some(function(e){return Tr(e,t)}):!!u(null==e?void 0:e.indexOf)&&-1this.limit&&this.remove(this.tail.prev.key)},Lr);function Lr(e,t){void 0===t&&(t=0),this.limit=e,this.size=t,this.cache={},this.head=new xr("HEAD",null,null,null),this.tail=new xr("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head}function Fr(e,t){var r=document.createElement("base"),e=(r.href=e,document.getElementsByTagName("head")[0]),n=(e.insertBefore(r,e.firstChild),document.createElement("a")),t=(n.href=t,n.href);return e.removeChild(r),t}r=Object.freeze({__proto__:null,resolve:function(e,t,i){return e.length&&"/"!==K(e)&&(e+="/"),Fr(e,t).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,function(e,t,r){var n=r.split("/").pop();return/\.\w+$/.test(n)?e:t+r+i})},readFile:function(n){return a(this,void 0,void 0,function(){return G(this,function(e){return[2,new Promise(function(e,t){var r=new XMLHttpRequest;r.onload=function(){200<=r.status&&r.status<300?e(r.responseText):t(new Error(r.statusText))},r.onerror=function(){t(new Error("An error occurred whilst receiving the response."))},r.open("GET",n),r.send()})]})})},readFileSync:function(e){var t=new XMLHttpRequest;if(t.open("GET",e,!1),t.send(),t.status<200||300<=t.status)throw new Error(t.statusText);return t.responseText},exists:function(e){return a(this,void 0,void 0,function(){return G(this,function(e){return[2,!0]})})},existsSync:function(e){return!0},dirname:function(e){return Fr(e,".")},sep:"/"});function Or(e,t){return void 0===t&&(t=0),JSON.stringify(e,null,t)}var _r={default:function(e,t){for(var r=[],n=2;n":">",'"':""","'":"'"},Rr={"&":"&","<":"<",">":">",""":'"',"'":"'"};function jr(e){return e=y(e),this.context.memoryLimit.use(e.length),e.replace(/&|<|>|"|'/g,function(e){return zr[e]})}var qr=Object.freeze({__proto__:null,escape:jr,xml_escape:function(e){return jr.call(this,e)},escape_once:function(e){return jr.call(this,function(e){return e=y(e),this.context.memoryLimit.use(e.length),e.replace(/&(amp|lt|gt|#34|#39);/g,function(e){return Rr[e]})}.call(this,e))},newline_to_br:function(e){return e=y(e),this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,"
\n")},strip_html:function(e){return e=y(e),this.context.memoryLimit.use(e.length),e.replace(/||<.*?>|/g,"")}}),Er=(Ar.prototype.exists=function(t){return a(this,void 0,void 0,function(){return G(this,function(e){return[2,this.existsSync(t)]})})},Ar.prototype.existsSync=function(e){return!o(this.mapping[e])},Ar.prototype.readFile=function(t){return a(this,void 0,void 0,function(){return G(this,function(e){return[2,this.readFileSync(t)]})})},Ar.prototype.readFileSync=function(e){var t=this.mapping[e];if(o(t))throw new Error("ENOENT: ".concat(e));return t},Ar.prototype.dirname=function(e){e=e.split(this.sep);return e.pop(),e.join(this.sep)},Ar.prototype.resolve=function(e,t,r){var n,i;if(t+=r,"."===e)return t;var s=e.split(/\/+/);try{for(var o=X(t.split(this.sep)),a=o.next();!a.done;a=o.next()){var u=a.value;"."!==u&&""!==u&&(".."===u?(1t?e.slice(0,t-3)+"...":e));var t},k.prototype.readWord=function(){return this.readIdentifier()},k.prototype.readIdentifier=function(){this.skipBlank();for(var e=this.p;!this.end()&&qe(this.peek());)++this.p;return new qt(this.input,e,this.p,this.file)},k.prototype.readNonEmptyIdentifier=function(){var e=this.readIdentifier();return e.size()?e:void 0},k.prototype.readTagName=function(){return this.skipBlank(),"#"===this.input[this.p]?this.input.slice(this.p,++this.p):this.readIdentifier().getText()},k.prototype.readHashes=function(e){for(var t=[];;){var r=this.readHash(e);if(!r)return t;t.push(r)}},k.prototype.readHash=function(e){this.skipBlank(),","===this.peek()&&++this.p;var t,r=this.p,n=this.readNonEmptyIdentifier();if(n)return this.skipBlank(),e=te(e)?e:e?"=":":",this.peek()===e&&(++this.p,t=this.readValue()),new Zt(this.input,r,this.p,n,t,this.file)},k.prototype.remaining=function(){return this.input.slice(this.p,this.N)},k.prototype.advance=function(e){this.p+=e=void 0===e?1:e},k.prototype.end=function(){return this.p>=this.N},k.prototype.read=function(){return this.input[this.p++]},k.prototype.readTo=function(e){for(;this.p=this.N?0:h[this.input.charCodeAt(this.p+e)]},k.prototype.peek=function(e){return this.p+(e=void 0===e?0:e)>=this.N?"":this.input[this.p+e]},k.prototype.skipBlank=function(){for(;this.peekType()ℜ)++this.p};var w=k;function k(e,t,r,n){void 0===t&&(t=Nr.operators),this.input=e,this.file=r,this.rawBeginAt=-1,this.p=n?n[0]:0,this.N=n?n[1]:e.length,this.opTrie=Ge(t),this.literalTrie=Ge(Qe)}Cr.prototype.on=function(e,t){return this.handlers[e]=t,this},Cr.prototype.trigger=function(e,t){e=this.handlers[e];return!!e&&(e.call(this,t),!0)},Cr.prototype.start=function(){var e,t;for(this.trigger("start");!this.stopRequested&&(e=this.tokens.shift());)this.trigger("token",e)||Ln(e)&&this.trigger("tag:".concat(e.name),e)||(t=this.parseToken(e,this.tokens),this.trigger("template",t));return this.stopRequested||this.trigger("end"),this},Cr.prototype.stop=function(){return this.stopRequested=!0,this};var Pr=Cr;function Cr(e,t){this.handlers={},this.stopRequested=!1,this.tokens=e,this.parseToken=t}function Ir(e){this.token=e}s(Hr,Br=Ir);var Br,L=Hr;function Hr(e,t,r){var n=Br.call(this,e)||this;return n.name=e.name,n.liquid=r,n.tokenizer=e.tokenizer,n}Kr.prototype.render=function(t){var r,n,i,s,o,a,u,c,l;return G(this,function(e){switch(e.label){case 0:r={},e.label=1;case 1:e.trys.push([1,8,9,10]),n=X(Object.keys(this.hash)),i=n.next(),e.label=2;case 2:return i.done?[3,7]:(s=i.value,o=r,a=s,void 0!==this.hash[s]?[3,3]:(u=!0,[3,5]));case 3:return[4,S(this.hash[s],t)];case 4:u=e.sent(),e.label=5;case 5:o[a]=u,e.label=6;case 6:return i=n.next(),[3,2];case 7:return[3,10];case 8:return c=e.sent(),c={error:c},[3,10];case 9:try{i&&!i.done&&(l=n.return)&&l.call(n)}finally{if(c)throw c.error}return[7];case 10:return[2,r]}})};var Ur=Kr;function Kr(e,t){this.hash={};var r,n,e=e instanceof w?e:new w(e,{});try{for(var i=X(e.readHashes(t)),s=i.next();!s.done;s=i.next()){var o=s.value;this.hash[o.name.content]=o.value}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}function Wr(e){return c(e)}$r.prototype.render=function(t,r){var n,i,s,o,a,u,c,l,h,p,f;return G(this,function(e){switch(e.label){case 0:n=[],e.label=1;case 1:e.trys.push([1,8,9,10]),i=X(this.args),s=i.next(),e.label=2;case 2:return s.done?[3,7]:Wr(o=s.value)?(u=(a=n).push,c=[o[0]],[4,S(o[1],r)]):[3,4];case 3:return u.apply(a,[c.concat([e.sent()])]),[3,6];case 4:return h=(l=n).push,[4,S(o,r)];case 5:h.apply(l,[e.sent()]),e.label=6;case 6:return s=i.next(),[3,2];case 7:return[3,10];case 8:return p=e.sent(),p={error:p},[3,10];case 9:try{s&&!s.done&&(f=i.return)&&f.call(i)}finally{if(p)throw p.error}return[7];case 10:return[4,this.handler.apply({context:r,token:this.token,liquid:this.liquid},d([t],ee(n),!1))];case 11:return[2,e.sent()]}})};var Yr=$r;function $r(e,t,r){this.token=e,this.name=e.name,this.handler=u(t)?t:u(null==t?void 0:t.handler)?t.handler:J,this.raw=!u(t)&&!(null==t||!t.raw),this.args=e.args,this.liquid=r}Zr.prototype.value=function(t,r){var n,i,s,o,a;return G(this,function(e){switch(e.label){case 0:return r=r||t.opts.lenientIf&&0=t&&(n+=r),n},normalize_whitespace:function(e){return e=y(e),this.context.memoryLimit.use(e.length),e.replace(/\s+/g," ")},number_of_words:function(e,t){var r=y(e);if(this.context.memoryLimit.use(r.length),!(e=r.trim()))return 0;switch(t){case"cjk":return(e.match(Gn)||[]).length+(e.match(Xn)||[]).length;case"auto":return Gn.test(e)?e.match(Gn).length+(e.match(Xn)||[]).length:e.split(/\s+/).length;default:return e.split(/\s+/).length}},array_to_sentence_string:function(e,t){switch(void 0===t&&(t="and"),this.context.memoryLimit.use(e.length),e.length){case 0:return"";case 1:return e[0];case 2:return"".concat(e[0]," ").concat(t," ").concat(e[1]);default:return"".concat(e.slice(0,-1).join(", "),", ").concat(t," ").concat(e[e.length-1])}}}),ti=T(T(T(T(T(T(T({},qr),En),Nn),Cn),In),An),_r),Mn=(s(ri,ei=L),ri.prototype.render=function(t){var r,n;return G(this,function(e){switch(e.label){case 0:return r=t.bottom(),n=this.key,[4,this.value.value(t,this.liquid.options.lenientIf)];case 1:return r[n]=e.sent(),[2]}})},ri.prototype.arguments=function(){return G(this,function(e){switch(e.label){case 0:return[4,this.value];case 1:return e.sent(),[2]}})},ri.prototype.localScope=function(){return G(this,function(e){switch(e.label){case 0:return[4,this.identifier];case 1:return e.sent(),[2]}})},ri);function ri(e,t,r){e=ei.call(this,e,t,r)||this;return e.identifier=e.tokenizer.readIdentifier(),e.key=e.identifier.content,e.tokenizer.assert(e.key,"expected variable name"),e.tokenizer.skipBlank(),e.tokenizer.assert("="===e.tokenizer.peek(),'expected "="'),e.tokenizer.advance(),e.value=new F(e.tokenizer.readFilteredValue(),e.liquid),e}var ni,ii=["offset","limit","reversed"],Dn=(s(si,ni=L),si.prototype.render=function(t,r){var n,i,s,o,a,u,c,l,h,p,f;return G(this,function(e){switch(e.label){case 0:return n=this.liquid.renderer,s=C,[4,S(this.collection,t)];case 1:return(i=s.apply(void 0,[e.sent()])).length?[3,3]:[4,n.renderTemplates(this.elseTemplates,t,r)];case 2:return e.sent(),[2];case 3:return o="continue-"+this.variable+"-"+this.collection.getText(),t.push({continue:t.getRegister(o)}),[4,this.hash.render(t)];case 4:a=e.sent(),t.pop(),u=this.liquid.options.orderedFilterParameters?Object.keys(a).filter(function(e){return ii.includes(e)}):ii.filter(function(e){return void 0!==a[e]}),i=u.reduce(function(e,t){var r;return"offset"===t?(r=a.offset,e.slice(r)):"limit"===t?(r=a.limit,e.slice(0,r)):d([],ee(e),!1).reverse()},i),t.setRegister(o,(a.offset||0)+i.length),u={forloop:new Be(i.length,this.collection.getText(),this.variable)},t.push(u),e.label=5;case 5:e.trys.push([5,10,11,12]),c=X(i),l=c.next(),e.label=6;case 6:return l.done?[3,9]:(h=l.value,u[this.variable]=h,t.continueCalled=t.breakCalled=!1,[4,n.renderTemplates(this.templates,t,r)]);case 7:if(e.sent(),t.breakCalled)return[3,9];u.forloop.next(),e.label=8;case 8:return l=c.next(),[3,6];case 9:return[3,12];case 10:return h=e.sent(),p={error:h},[3,12];case 11:try{l&&!l.done&&(f=c.return)&&f.call(c)}finally{if(p)throw p.error}return[7];case 12:return t.continueCalled=t.breakCalled=!1,t.pop(),[2]}})},si.prototype.children=function(){var t;return G(this,function(e){return t=this.templates.slice(),this.elseTemplates&&t.push.apply(t,d([],ee(this.elseTemplates),!1)),[2,t]})},si.prototype.arguments=function(){var t,r,n,i,s;return G(this,function(e){switch(e.label){case 0:return[4,this.collection];case 1:e.sent(),e.label=2;case 2:e.trys.push([2,7,8,9]),t=X(Object.values(this.hash.hash)),r=t.next(),e.label=3;case 3:return r.done?[3,6]:_(n=r.value)?[4,n]:[3,5];case 4:e.sent(),e.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return n=e.sent(),i={error:n},[3,9];case 8:try{r&&!r.done&&(s=t.return)&&s.call(t)}finally{if(i)throw i.error}return[7];case 9:return[2]}})},si.prototype.blockScope=function(){return[this.variable,"forloop"]},si);function si(e,t,r,n){var i,s=ni.call(this,e,t,r)||this,o=s.tokenizer.readIdentifier(),a=s.tokenizer.readIdentifier(),u=s.tokenizer.readValue();if(!o.size()||"in"!==a.content||!u)throw new Error("illegal tag: ".concat(e.getText()));s.variable=o.content,s.collection=u,s.hash=new Ur(s.tokenizer,r.options.keyValueSeparator),s.templates=[],s.elseTemplates=[];var c=n.parseStream(t).on("start",function(){return i=s.templates}).on("tag:else",function(e){Ee(e.args),i=s.elseTemplates}).on("tag:endfor",function(e){Ee(e.args),c.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag ".concat(e.getText()," not closed"))});return c.start(),s}s(ai,oi=L),ai.prototype.readVariable=function(){var e=this.tokenizer.readIdentifier();if(e.content)return e;if(e=this.tokenizer.readQuoted())return e;throw this.tokenizer.error("invalid capture name")},ai.prototype.render=function(t){var r;return G(this,function(e){switch(e.label){case 0:return[4,this.liquid.renderer.renderTemplates(this.templates,t)];case 1:return r=e.sent(),t.bottom()[this.variable]=r,[2]}})},ai.prototype.children=function(){return G(this,function(e){return[2,this.templates]})},ai.prototype.localScope=function(){return G(this,function(e){switch(e.label){case 0:return[4,this.identifier];case 1:return e.sent(),[2]}})};var oi,Vn=ai;function ai(e,t,r,n){var i=oi.call(this,e,t,r)||this;for(i.templates=[],i.identifier=i.readVariable(),i.variable=i.identifier.content;t.length;){var s=t.shift();if(Ln(s)&&"endcapture"===s.name)return i;i.templates.push(n.parseToken(s,t))}throw new Error("tag ".concat(e.getText()," not closed"))}s(ci,ui=L),ci.prototype.render=function(t,r){var n,i,s,o,a,u,c,l,h,p,f,d,y,v;return G(this,function(e){switch(e.label){case 0:return n=this.liquid.renderer,s=g,[4,this.value.value(t,t.opts.lenientIf)];case 1:i=s.apply(void 0,[e.sent()]),o=!1,e.label=2;case 2:e.trys.push([2,14,15,16]),a=X(this.branches),u=a.next(),e.label=3;case 3:if(u.done)return[3,13];c=u.value,e.label=4;case 4:e.trys.push([4,10,11,12]),y=void 0,l=X(c.values),h=l.next(),e.label=5;case 5:return h.done?[3,9]:[4,S(h.value,t,t.opts.lenientIf)];case 6:return(p=e.sent(),Tr(i,p))?[4,n.renderTemplates(c.templates,t,r)]:[3,8];case 7:return e.sent(),o=!0,[3,9];case 8:return h=l.next(),[3,5];case 9:return[3,12];case 10:return p=e.sent(),y={error:p},[3,12];case 11:try{h&&!h.done&&(v=l.return)&&v.call(l)}finally{if(y)throw y.error}return[7];case 12:return u=a.next(),[3,3];case 13:return[3,16];case 14:return f=e.sent(),f={error:f},[3,16];case 15:try{u&&!u.done&&(d=a.return)&&d.call(a)}finally{if(f)throw f.error}return[7];case 16:return o?[3,18]:[4,n.renderTemplates(this.elseTemplates,t,r)];case 17:e.sent(),e.label=18;case 18:return[2]}})},ci.prototype.arguments=function(){return G(this,function(e){switch(e.label){case 0:return[4,this.value];case 1:return e.sent(),[5,X(this.branches.flatMap(function(e){return e.values}))];case 2:return e.sent(),[2]}})},ci.prototype.children=function(){var t;return G(this,function(e){return t=this.branches.flatMap(function(e){return e.templates}),this.elseTemplates&&t.push.apply(t,d([],ee(this.elseTemplates),!1)),[2,t]})};var ui,Pn=ci;function ci(e,t,r,n){var i=ui.call(this,e,t,r)||this,s=(i.branches=[],i.elseTemplates=[],i.value=new F(i.tokenizer.readFilteredValue(),i.liquid),i.elseTemplates=[],[]),o=0,a=n.parseStream(t).on("tag:when",function(e){if(!(0"),r.write(''))),r.write('')),[4,s.renderTemplates(this.templates,t,r)]):[3,6];case 4:e.sent(),r.write(""),e.label=5;case 5:return u++,o.next(),[3,3];case 6:return n.length&&r.write(""),t.pop(),[2]}})},Bi.prototype.children=function(){return G(this,function(e){return[2,this.templates]})},Bi.prototype.arguments=function(){var t,r,n,i,s;return G(this,function(e){switch(e.label){case 0:return[4,this.collection];case 1:e.sent(),e.label=2;case 2:e.trys.push([2,7,8,9]),t=X(Object.values(this.args.hash)),r=t.next(),e.label=3;case 3:return r.done?[3,6]:_(n=r.value)?[4,n]:[3,5];case 4:e.sent(),e.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return n=e.sent(),i={error:n},[3,9];case 8:try{r&&!r.done&&(s=t.return)&&s.call(t)}finally{if(i)throw i.error}return[7];case 9:return[2]}})},Bi.prototype.blockScope=function(){return[this.variable,"tablerowloop"]};var Ci,Ii=Bi;function Bi(e,t,r,n){var i,s=Ci.call(this,e,t,r)||this,o=s.tokenizer.readIdentifier(),a=(s.tokenizer.skipBlank(),s.tokenizer.readIdentifier()),u=s.tokenizer.readValue();if("in"!==a.content||!u)throw new Error("illegal tag: ".concat(e.getText()));s.variable=o.content,s.collection=u,s.args=new Ur(s.tokenizer,r.options.keyValueSeparator),s.templates=[];var c=n.parseStream(t).on("start",function(){return i=s.templates}).on("tag:endtablerow",function(){return c.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag ".concat(e.getText()," not closed"))});return c.start(),s}s(Ki,Hi=L),Ki.prototype.render=function(t,r){var n,i,s,o,a,u,c,l;return G(this,function(e){switch(e.label){case 0:n=this.liquid.renderer,e.label=1;case 1:e.trys.push([1,7,8,9]),i=X(this.branches),s=i.next(),e.label=2;case 2:return s.done?[3,6]:(a=s.value,u=a.value,o=a.test,a=a.templates,[4,u.value(t,t.opts.lenientIf)]);case 3:return(u=e.sent(),o(u,t))?[4,n.renderTemplates(a,t,r)]:[3,5];case 4:return e.sent(),[2];case 5:return s=i.next(),[3,2];case 6:return[3,9];case 7:return c=e.sent(),c={error:c},[3,9];case 8:try{s&&!s.done&&(l=i.return)&&l.call(i)}finally{if(c)throw c.error}return[7];case 9:return[4,n.renderTemplates(this.elseTemplates,t,r)];case 10:return e.sent(),[2]}})},Ki.prototype.children=function(){var t;return G(this,function(e){return t=this.branches.flatMap(function(e){return e.templates}),this.elseTemplates&&t.push.apply(t,d([],ee(this.elseTemplates),!1)),[2,t]})},Ki.prototype.arguments=function(){return this.branches.map(function(e){return e.value})};var Hi,Ui=Ki;function Ki(e,t,r,n){var i=Hi.call(this,e,t,r)||this,s=(i.branches=[],i.elseTemplates=[],[]),o=0;return n.parseStream(t).on("start",function(){return i.branches.push({value:new F(e.tokenizer.readFilteredValue(),i.liquid),test:kr,templates:s=[]})}).on("tag:elsif",function(e){0