UNPKG

@nosto/autocomplete

Version:

Library designed to simplify the implementation of search autocomplete functionality

13 lines 94.4 kB
class R{constructor(e,n,s,i,r){this.kind=e,this.input=n,this.begin=s,this.end=i,this.file=r}getText(){return this.input.slice(this.begin,this.end)}getPosition(){let[e,n]=[1,1];for(let s=0;s<this.begin;s++)this.input[s]===` `?(e++,n=1):n++;return[e,n]}size(){return this.end-this.begin}}class G{liquidMethodMissing(e){}}const jn=Object.prototype.toString,ut=String.prototype.toLowerCase,De=Object.hasOwnProperty;function p(t){return typeof t=="string"}function T(t){return typeof t=="function"}function In(t){return t&&T(t.then)}function fe(t){return t&&T(t.next)&&T(t.throw)&&T(t.return)}function $n(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function d(t){return t=g(t),p(t)?t:N(t)?"":x(t)?t.map(e=>d(e)).join(""):String(t)}function ue(t){return t=g(t),x(t)?t:p(t)&&t.length>0?[t]:Hn(t)?Array.from(t):ge(t)?Object.keys(t).map(e=>[e,t[e]]):[]}function _(t){return t=g(t),N(t)?[]:x(t)?t:[t]}function g(t){return t instanceof G&&T(t.valueOf)?t.valueOf():t}function ht(t){return t=Number(t),isNaN(t)?0:t}function pe(t){return typeof t=="number"}function dt(t){return t&&T(t.toLiquid)?dt(t.toLiquid()):t}function N(t){return t==null}function Vn(t){return t===void 0}function x(t){return jn.call(t)==="[object Array]"}function ft(t){return t&&pe(t.length)}function Hn(t){return ge(t)&&Symbol.iterator in t}function pt(t,e){t=t||{};for(const n in t)if(De.call(t,n)&&e(t[n],n,t)===!1)break;return t}function gt(t){return t[t.length-1]}function ge(t){const e=typeof t;return t!==null&&(e==="object"||e==="function")}function mt(t,e,n=1){const s=[];for(let i=t;i<e;i+=n)s.push(i);return s}function he(t,e,n=" "){return yt(t,e,n,(s,i)=>i+s)}function Un(t,e,n=" "){return yt(t,e,n,(s,i)=>s+i)}function yt(t,e,n,s){t=String(t);let i=e-t.length;for(;i-- >0;)t=s(t,n);return t}function wt(t){return t}function Bn(t){return[...t].some(n=>n>="a"&&n<="z")?t.toUpperCase():t.toLowerCase()}function Jn(t,e){return t.length>e?t.slice(0,e-3)+"...":t}function bt(t,e){return t==null&&e==null?0:t==null?1:e==null||(t=ut.call(t),e=ut.call(e),t<e)?-1:t>e?1:0}function E(t){return function(...e){return t.call(this,...e.map(g))}}function Pe(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function*me(t){const e=new Set;for(const n of t){const s=JSON.stringify(n);e.has(s)||(e.add(s),yield n)}}const vt="__liquidClass__";class Z extends Error{constructor(e,n){super(typeof e=="string"?e:e.message),this.context="",typeof e!="string"&&Object.defineProperty(this,"originalError",{value:e,enumerable:!1}),Object.defineProperty(this,"token",{value:n,enumerable:!1}),Object.defineProperty(this,vt,{value:"LiquidError",enumerable:!1})}update(){Object.defineProperty(this,"context",{value:Kn(this.token),enumerable:!1}),this.message=es(this.message,this.token),this.stack=this.message+` `+this.context+` `+this.stack,this.originalError&&(this.stack+=` From `+this.originalError.stack)}static is(e){return e?.[vt]==="LiquidError"}}class Wn extends Z{constructor(e,n){super(e,n),this.name="TokenizationError",super.update()}}class Yn extends Z{constructor(e,n){super(e,n),this.name="ParseError",this.message=e.message,super.update()}}class Qn extends Z{constructor(e,n){super(e,n.token),this.name="RenderError",this.message=e.message,super.update()}static is(e){return e.name==="RenderError"}}class kt extends Z{constructor(e){super(e[0],e[0].token),this.errors=e,this.name="LiquidErrors";const n=e.length>1?"s":"";this.message=`${e.length} error${n} found`,super.update()}static is(e){return e.name==="LiquidErrors"}}class Gn extends Z{constructor(e,n){super(e,n),this.name="UndefinedVariableError",this.message=e.message,super.update()}}class Zn extends Error{constructor(e){super(`undefined variable: ${e}`),this.name="InternalUndefinedVariableError",this.variableName=e}}class Xn extends Error{constructor(e){super(e),this.name="AssertionError",this.message=e+""}}function Kn(t){const[e,n]=t.getPosition(),s=t.input.split(` `),i=Math.max(e-2,1),r=Math.min(e+3,s.length);return mt(i,r+1).map(a=>{const u=a===e?">> ":" ",c=he(String(a),String(r).length);let l=`${u}${c}| `;const h=a===e?` `+he("^",n+l.length):"";return l+=s[a-1],l+=h,l}).join(` `)}function es(t,e){e.file&&(t+=`, file:${e.file}`);const[n,s]=e.getPosition();return t+=`, line:${n}, col:${s}`,t}const w=[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],ts=1,re=4,Tt=8,St=16,ns=32,ss=64,is=128;function ye(t){const e=t.charCodeAt(0);return e>=128?!w[e]:!!(w[e]&ts)}w[160]=w[5760]=w[6158]=w[8192]=w[8193]=w[8194]=w[8195]=w[8196]=w[8197]=w[8198]=w[8199]=w[8200]=w[8201]=w[8202]=w[8232]=w[8233]=w[8239]=w[8287]=w[12288]=re,w[8220]=w[8221]=is;function L(t,e){if(!t){const n=typeof e=="function"?e():e||`expect ${t} to be true`;throw new Xn(n)}}function we(t,e=`unexpected ${JSON.stringify(t)}`){L(!t,e)}class rs extends G{equals(e){return N(g(e))}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return null}}class ce extends G{equals(e){return e instanceof ce?!1:(e=g(e),p(e)||x(e)?e.length===0:ge(e)?Object.keys(e).length===0:!1)}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return""}static is(e){return e instanceof ce}}class ot extends ce{equals(e){return e===!1||N(g(e))?!0:p(e)?/^\s*$/.test(e):super.equals(e)}static is(e){return e instanceof ot}}class Ce extends G{constructor(e,n,s){super(),this.i=0,this.length=e,this.name=`${s}-${n}`}next(){this.i++}index0(){return this.i}index(){return this.i+1}first(){return this.i===0}last(){return this.i===this.length-1}rindex(){return this.length-this.i}rindex0(){return this.length-this.i-1}valueOf(){return JSON.stringify(this)}}class _t{constructor(){this.buffer=""}write(e){this.buffer+=d(e)}}class os{constructor(){throw this.buffer="",this.stream=null,new Error("streaming not supported in browser")}}class as{constructor(){this.buffer=""}write(e){e=g(e),typeof e!="string"&&this.buffer===""?this.buffer=e:this.buffer=d(this.buffer)+d(e)}}class xt extends G{constructor(e=()=>""){super(),this.superBlockRender=e}*super(){const e=new _t;return yield this.superBlockRender(e),e.buffer}}function j(t){return t&&T(t.equals)&&T(t.gt)&&T(t.geq)&&T(t.lt)&&T(t.leq)}const Lt=new rs,Ot={true:!0,false:!1,nil:Lt,null:Lt,empty:new ce,blank:new ot};function Ft(t){const e={};for(const[n,s]of Object.entries(t)){let i=e;for(let r=0;r<n.length;r++){const o=n[r];i[o]=i[o]||{},r===n.length-1&&ye(n[r])&&(i[o].needBoundary=!0),i=i[o]}i.data=s,i.end=!0}return e}var be=function(){return be=Object.assign||function(e){for(var n,s=1,i=arguments.length;s<i;s++){n=arguments[s];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},be.apply(this,arguments)};function S(t,e,n,s){function i(r){return r instanceof n?r:new n(function(o){o(r)})}return new(n||(n=Promise))(function(r,o){function a(l){try{c(s.next(l))}catch(h){o(h)}}function u(l){try{c(s.throw(l))}catch(h){o(h)}}function c(l){l.done?r(l.value):i(l.value).then(a,u)}c((s=s.apply(t,[])).next())})}function V(t){return S(this,void 0,void 0,function*(){if(!fe(t))return t;let e,n=!1,s="next";do{const i=t[s](e);n=i.done,e=i.value,s="next";try{fe(e)&&(e=V(e)),In(e)&&(e=yield e)}catch(r){s="throw",e=r}}while(!n);return e})}function H(t){if(!fe(t))return t;let e,n=!1,s="next";do{const i=t[s](e);if(n=i.done,e=i.value,s="next",fe(e))try{e=H(e)}catch(r){s="throw",e=r}}while(!n);return e}const ls=/%([-_0^#:]+)?(\d+)?([EO])?(.)/;function cs(t){return[31,us(t)?29:28,31,30,31,30,31,31,30,31,30,31]}function Et(t){let e=0;for(let n=0;n<t.getMonth();++n)e+=cs(t)[n];return e+t.getDate()}function At(t,e){const n=Et(t)+(e-t.getDay()),i=7-new Date(t.getFullYear(),0,1).getDay()+e;return String(Math.floor((n-i)/7)+1)}function us(t){const e=t.getFullYear();return!!((e&3)===0&&(e%100||e%400===0&&e))}function hs(t){const e=t.getDate();if([11,12,13].includes(e))return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function ds(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}const fs={d:2,e:2,H:2,I:2,j:3,k:2,l:2,L:3,m:2,M:2,S:2,U:2,W:2},ps=new Set("aAbBceklpP");function zt(t,e){const n=Math.abs(t.getTimezoneOffset()),s=Math.floor(n/60),i=n%60;return(t.getTimezoneOffset()>0?"-":"+")+he(s,2,"0")+(e.flags[":"]?":":"")+he(i,2,"0")}const qe={a:t=>t.getShortWeekdayName(),A:t=>t.getLongWeekdayName(),b:t=>t.getShortMonthName(),B:t=>t.getLongMonthName(),c:t=>t.toLocaleString(),C:t=>ds(t),d:t=>t.getDate(),e:t=>t.getDate(),H:t=>t.getHours(),I:t=>String(t.getHours()%12||12),j:t=>Et(t),k:t=>t.getHours(),l:t=>String(t.getHours()%12||12),L:t=>t.getMilliseconds(),m:t=>t.getMonth()+1,M:t=>t.getMinutes(),N:(t,e)=>{const n=Number(e.width)||9,s=String(t.getMilliseconds()).slice(0,n);return Un(s,n,"0")},p:t=>t.getHours()<12?"AM":"PM",P:t=>t.getHours()<12?"am":"pm",q:t=>hs(t),s:t=>Math.round(t.getTime()/1e3),S:t=>t.getSeconds(),u:t=>t.getDay()||7,U:t=>At(t,0),w:t=>t.getDay(),W:t=>At(t,1),x:t=>t.toLocaleDateString(),X:t=>t.toLocaleTimeString(),y:t=>t.getFullYear().toString().slice(2,4),Y:t=>t.getFullYear(),z:zt,Z:(t,e)=>t.getTimeZoneName()||zt(t,e),t:()=>" ",n:()=>` `,"%":()=>"%"};qe.h=qe.b;function ve(t,e){let n="",s=e,i;for(;i=ls.exec(s);)n+=s.slice(0,i.index),s=s.slice(i.index+i[0].length),n+=gs(t,i);return n+s}function gs(t,e){const[n,s="",i,r,o]=e,a=qe[o];if(!a)return n;const u={};for(const f of s)u[f]=!0;let c=String(a(t,{flags:u,width:i,modifier:r})),l=ps.has(o)?" ":"0",h=i||fs[o]||0;return u["^"]?c=c.toUpperCase():u["#"]&&(c=Bn(c)),u._?l=" ":u[0]&&(l="0"),u["-"]&&(h=0),he(c,h,l)}function Rt(){return typeof Intl<"u"?Intl.DateTimeFormat:void 0}const ms=6e4,ys=/([zZ]|([+-])(\d{2}):?(\d{2}))$/,Nt=["January","February","March","April","May","June","July","August","September","October","November","December"],ws=Nt.map(t=>t.slice(0,3)),Dt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],bs=Dt.map(t=>t.slice(0,3));class q{constructor(e,n,s){this.locale=n,this.DateTimeFormat=Rt(),this.date=new Date(e),this.timezoneFixed=s!==void 0,s===void 0&&(s=this.date.getTimezoneOffset()),this.timezoneOffset=p(s)?q.getTimezoneOffset(s,this.date):s,this.timezoneName=p(s)?s:"";const i=(this.date.getTimezoneOffset()-this.timezoneOffset)*ms,r=this.date.getTime()+i;this.displayDate=new Date(r)}getTime(){return this.displayDate.getTime()}getMilliseconds(){return this.displayDate.getMilliseconds()}getSeconds(){return this.displayDate.getSeconds()}getMinutes(){return this.displayDate.getMinutes()}getHours(){return this.displayDate.getHours()}getDay(){return this.displayDate.getDay()}getDate(){return this.displayDate.getDate()}getMonth(){return this.displayDate.getMonth()}getFullYear(){return this.displayDate.getFullYear()}toLocaleString(e,n){return n?.timeZone?this.date.toLocaleString(e,n):this.displayDate.toLocaleString(e,n)}toLocaleTimeString(e){return this.displayDate.toLocaleTimeString(e)}toLocaleDateString(e){return this.displayDate.toLocaleDateString(e)}getTimezoneOffset(){return this.timezoneOffset}getTimeZoneName(){if(this.timezoneFixed)return this.timezoneName;if(this.DateTimeFormat)return this.DateTimeFormat().resolvedOptions().timeZone}getLongMonthName(){var e;return(e=this.format({month:"long"}))!==null&&e!==void 0?e:Nt[this.getMonth()]}getShortMonthName(){var e;return(e=this.format({month:"short"}))!==null&&e!==void 0?e:ws[this.getMonth()]}getLongWeekdayName(){var e;return(e=this.format({weekday:"long"}))!==null&&e!==void 0?e:Dt[this.displayDate.getDay()]}getShortWeekdayName(){var e;return(e=this.format({weekday:"short"}))!==null&&e!==void 0?e:bs[this.displayDate.getDay()]}valid(){return!isNaN(this.getTime())}format(e){return this.DateTimeFormat&&this.DateTimeFormat(this.locale,e).format(this.displayDate)}static createDateFixedToTimezone(e,n){const s=e.match(ys);if(s&&s[1]==="Z")return new q(+new Date(e),n,0);if(s&&s[2]&&s[3]&&s[4]){const[,,i,r,o]=s,a=(i==="+"?-1:1)*(parseInt(r,10)*60+parseInt(o,10));return new q(+new Date(e),n,a)}return new q(e,n)}static getTimezoneOffset(e,n){const s=n.toLocaleString("en-US",{timeZone:e}),i=n.toLocaleString("en-US",{timeZone:"UTC"}),r=new Date(s);return(+new Date(i)-+r)/(60*1e3)}}class Me{constructor(e,n){this.base=0,this.message=`${e} limit exceeded`,this.limit=n}use(e){e=ht(e),L(this.base+e<=this.limit,this.message),this.base+=e}check(e){e=ht(e),L(e<=this.limit,this.message)}}class je extends R{constructor(e,[n,s],i,r,o,a,u,c){super(e,i,r,o,c),this.trimLeft=!1,this.trimRight=!1;const l=i[n]==="-",h=i[s-1]==="-";let f=l?n+1:n,m=h?s-1:s;for(;f<m&&w[i.charCodeAt(f)]&re;)f++;for(;m>f&&w[i.charCodeAt(m-1)]&re;)m--;this.contentRange=[f,m],this.trimLeft=l||a,this.trimRight=h||u}get content(){return this.input.slice(this.contentRange[0],this.contentRange[1])}}class Pt extends je{constructor(e,n,s,i,r){const{trimTagLeft:o,trimTagRight:a,tagDelimiterLeft:u,tagDelimiterRight:c}=i,[l,h]=[n+u.length,s-c.length];super(b.Tag,[l,h],e,n,s,o,a,r),this.tokenizer=new I(e,i.operators,r,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal tag syntax, tag name expected"),this.tokenizer.skipBlank(),this.args=this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1])}}class vs extends je{constructor(e,n,s,i,r){const{trimOutputLeft:o,trimOutputRight:a,outputDelimiterLeft:u,outputDelimiterRight:c}=i,l=[n+u.length,s-c.length];super(b.Output,l,e,n,s,o,a,r)}}class Ct extends R{constructor(e,n,s,i){super(b.HTML,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.trimLeft=0,this.trimRight=0}getContent(){return this.input.slice(this.begin+this.trimLeft,this.end-this.trimRight)}}class ks extends R{constructor(e,n,s,i){super(b.Number,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.content=Number(this.getText())}}class Ie extends R{constructor(e,n,s,i){super(b.Word,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.content=this.getText()}}class Ts extends R{constructor(e,n,s,i){super(b.Literal,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.literal=this.getText(),this.content=Ot[this.literal]}}const qt={"==":2,"!=":2,">":2,"<":2,">=":2,"<=":2,contains:2,not:1,and:0,or:0},Ss={"==":0,"!=":0,">":0,"<":0,">=":0,"<=":0,contains:0,not:1,and:0,or:0};class _s extends R{constructor(e,n,s,i){super(b.Operator,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.operator=this.getText()}getPrecedence(){const e=this.getText();return e in qt?qt[e]:1}}class Mt extends R{constructor(e,n,s,i,r,o){super(b.PropertyAccess,s,i,r,o),this.variable=e,this.props=n}}class jt extends R{constructor(e,n,s,i,r,o){super(b.Filter,s,i,r,o),this.name=e,this.args=n}}class xs extends R{constructor(e,n,s,i,r,o){super(b.Hash,e,n,s,o),this.input=e,this.begin=n,this.end=s,this.name=i,this.value=r,this.file=o}}const Ls=/[\da-fA-F]/,It=/[0-7]/,$t={b:"\b",f:"\f",n:` `,r:"\r",t:" ",v:"\v"};function Vt(t){const e=t.charCodeAt(0);return e>=97?e-87:e>=65?e-55:e-48}function Os(t){let e="";for(let n=1;n<t.length-1;n++){if(t[n]!=="\\"){e+=t[n];continue}if($t[t[n+1]]!==void 0)e+=$t[t[++n]];else if(t[n+1]==="u"){let s=0,i=n+2;for(;i<=n+5&&Ls.test(t[i]);)s=s*16+Vt(t[i++]);n=i-1,e+=String.fromCharCode(s)}else if(!It.test(t[n+1]))e+=t[++n];else{let s=n+1,i=0;for(;s<=n+3&&It.test(t[s]);)i=i*8+Vt(t[s++]);n=s-1,e+=String.fromCharCode(i)}}return e}class Fs extends R{constructor(e,n,s,i){super(b.Quoted,e,n,s,i),this.input=e,this.begin=n,this.end=s,this.file=i,this.content=Os(this.getText())}}class Es extends R{constructor(e,n,s,i,r,o){super(b.Range,e,n,s,o),this.input=e,this.begin=n,this.end=s,this.lhs=i,this.rhs=r,this.file=o}}class As extends je{constructor(e,n,s,i,r){super(b.Tag,[n,s],e,n,s,!1,!1,r),this.tokenizer=new I(e,i.operators,r,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal liquid tag syntax"),this.tokenizer.skipBlank()}get args(){return this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1])}}class zs extends R{constructor(e,n,s,i,r,o){super(b.FilteredValue,s,i,r,o),this.initial=e,this.filters=n,this.input=s,this.begin=i,this.end=r,this.file=o}}const Rs={now:()=>Date.now()};function Ht(){return typeof global=="object"&&global.performance||typeof window=="object"&&window.performance||Rs}class Ns{renderTemplatesToNodeStream(e,n){const s=new os;return Promise.resolve().then(()=>V(this.renderTemplates(e,n,s))).then(()=>s.end(),i=>s.error(i)),s.stream}*renderTemplates(e,n,s){s||(s=n.opts.keepOutputType?new as:new _t);const i=[];for(const r of e){n.renderLimit.check(Ht().now());try{const o=yield r.render(n,s);if(o&&s.write(o),n.breakCalled||n.continueCalled)break}catch(o){const a=Z.is(o)?o:new Qn(o,r);if(n.opts.catchAllErrors)i.push(a);else throw a}}if(i.length)throw new kt(i);return s.buffer}}class Ds{constructor(e){this.postfix=[...Ms(e)]}*evaluate(e,n){L(e,"unable to evaluate: context not defined");const s=[];for(const i of this.postfix)if(tn(i)){const r=s.pop();let o;if(Ss[i.operator]===1)o=yield e.opts.operators[i.operator](r,e);else{const a=s.pop();o=yield e.opts.operators[i.operator](a,r,e)}s.push(o)}else s.push(yield k(i,e,n));return s[0]}valid(){return!!this.postfix.length}}function*k(t,e,n=!1){if(t){if("content"in t)return t.content;if(xe(t))return yield Ps(t,e,n);if(rn(t))return yield qs(t,e)}}function*Ps(t,e,n){const s=[];for(const i of t.props)s.push(yield k(i,e,!1));try{if(t.variable){const i=yield k(t.variable,e,n);return yield e._getFromScope(i,s)}else return yield e._get(s)}catch(i){if(n&&i.name==="InternalUndefinedVariableError")return null;throw new Gn(i,t)}}function Cs(t){return t.content}function*qs(t,e){const n=yield k(t.lhs,e),s=yield k(t.rhs,e);return e.memoryLimit.use(s-n+1),mt(+n,+s+1)}function*Ms(t){const e=[];for(const n of t)if(tn(n)){for(;e.length&&e[e.length-1].getPrecedence()>n.getPrecedence();)yield e.pop();e.push(n)}else yield n;for(;e.length;)yield e.pop()}function X(t,e){return!ke(t,e)}function ke(t,e){return t=g(t),e.opts.jsTruthy?!t:t===!1||t===void 0||t===null}const js={"==":U,"!=":(t,e)=>!U(t,e),">":(t,e)=>j(t)?t.gt(e):j(e)?e.lt(t):g(t)>g(e),"<":(t,e)=>j(t)?t.lt(e):j(e)?e.gt(t):g(t)<g(e),">=":(t,e)=>j(t)?t.geq(e):j(e)?e.leq(t):g(t)>=g(e),"<=":(t,e)=>j(t)?t.leq(e):j(e)?e.geq(t):g(t)<=g(e),contains:(t,e)=>(t=g(t),x(t)?t.some(n=>U(n,e)):T(t?.indexOf)?t.indexOf(g(e))>-1:!1),not:(t,e)=>ke(g(t),e),and:(t,e,n)=>X(g(t),n)&&X(g(e),n),or:(t,e,n)=>X(g(t),n)||X(g(e),n)};function U(t,e){return j(t)?t.equals(e):j(e)?e.equals(t):(t=g(t),e=g(e),x(t)?x(e)&&Is(t,e):t===e)}function Is(t,e){return t.length!==e.length?!1:!t.some((n,s)=>!U(n,e[s]))}function $s(t,e){return t.some(n=>U(n,e))}class $e{constructor(e,n,s,i){this.key=e,this.value=n,this.next=s,this.prev=i}}class Ut{constructor(e,n=0){this.limit=e,this.size=n,this.cache={},this.head=new $e("HEAD",null,null,null),this.tail=new $e("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head}write(e,n){if(this.cache[e])this.cache[e].value=n;else{const s=new $e(e,n,this.head.next,this.head);this.head.next.prev=s,this.head.next=s,this.cache[e]=s,this.size++,this.ensureLimit()}}read(e){if(!this.cache[e])return;const{value:n}=this.cache[e];return this.remove(e),this.write(e,n),n}remove(e){const n=this.cache[e];n.prev.next=n.next,n.next.prev=n.prev,delete this.cache[e],this.size--}clear(){this.head.next=this.tail,this.tail.prev=this.head,this.size=0,this.cache={}}ensureLimit(){this.size>this.limit&&this.remove(this.tail.prev.key)}}function Bt(t,e){const n=document.createElement("base");n.href=t;const s=document.getElementsByTagName("head")[0];s.insertBefore(n,s.firstChild);const i=document.createElement("a");i.href=e;const r=i.href;return s.removeChild(n),r}function Vs(t,e,n){return t.length&&gt(t)!=="/"&&(t+="/"),Bt(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,(i,r,o)=>{const a=o.split("/").pop();return/\.\w+$/.test(a)?i:r+o+n})}function Hs(t){return S(this,void 0,void 0,function*(){return new Promise((e,n)=>{const s=new XMLHttpRequest;s.onload=()=>{s.status>=200&&s.status<300?e(s.responseText):n(new Error(s.statusText))},s.onerror=()=>{n(new Error("An error occurred whilst receiving the response."))},s.open("GET",t),s.send()})})}function Us(t){const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),e.status<200||e.status>=300)throw new Error(e.statusText);return e.responseText}function Bs(t){return S(this,void 0,void 0,function*(){return!0})}function Js(t){return!0}function Ws(t){return Bt(t,".")}const Ys="/";var Qs=Object.freeze({__proto__:null,resolve:Vs,readFile:Hs,readFileSync:Us,exists:Bs,existsSync:Js,dirname:Ws,sep:Ys});function Gs(t,e,...n){return t=g(t),x(t)||p(t)?t.length?t:e:t===!1&&new Map(n).get("allow_false")?!1:ke(t,this.context)?e:t}function Jt(t,e=0){return JSON.stringify(t,null,e)}function Zs(t,e=0){const n=[];return JSON.stringify(t,function(s,i){if(typeof i!="object"||i===null)return i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(i)?"[Circular]":(n.push(i),i)},e)}function Xs(t){return Number(t)}const Ks={raw:!0,handler:wt};var Wt={default:Gs,raw:Ks,jsonify:Jt,to_integer:Xs,json:Jt,inspect:Zs};const ei={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},ti={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"};function Te(t){return t=d(t),this.context.memoryLimit.use(t.length),t.replace(/&|<|>|"|'/g,e=>ei[e])}function ni(t){return Te.call(this,t)}function si(t){return t=d(t),this.context.memoryLimit.use(t.length),t.replace(/&(amp|lt|gt|#34|#39);/g,e=>ti[e])}function ii(t){return Te.call(this,si.call(this,t))}function ri(t){const e=d(t);return this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,`<br /> `)}function oi(t){const e=d(t);return this.context.memoryLimit.use(e.length),e.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g,"")}var ai=Object.freeze({__proto__:null,escape:Te,xml_escape:ni,escape_once:ii,newline_to_br:ri,strip_html:oi});class li{constructor(e){this.mapping=e,this.sep="/"}exists(e){return S(this,void 0,void 0,function*(){return this.existsSync(e)})}existsSync(e){return!N(this.mapping[e])}readFile(e){return S(this,void 0,void 0,function*(){return this.readFileSync(e)})}readFileSync(e){const n=this.mapping[e];if(N(n))throw new Error(`ENOENT: ${e}`);return n}dirname(e){const n=e.split(this.sep);return n.pop(),n.join(this.sep)}resolve(e,n,s){if(n+=s,e===".")return n;const i=e.split(/\/+/);for(const r of n.split(this.sep))r==="."||r===""||(r===".."?(i.length>1||i[0]!=="")&&i.pop():i.push(r));return i.join(this.sep)}}const oe={root:["."],layouts:["."],partials:["."],relativeReference:!0,jekyllInclude:!1,keyValueSeparator:":",cache:void 0,extname:"",fs:Qs,dynamicPartials:!0,jsTruthy:!1,dateFormat:"%A, %B %-e, %Y at %-l:%M %P %z",locale:"",trimTagRight:!1,trimTagLeft:!1,trimOutputRight:!1,trimOutputLeft:!1,greedy:!0,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",preserveTimezones:!1,strictFilters:!1,strictVariables:!1,ownPropertyOnly:!0,lenientIf:!1,globals:{},keepOutputType:!1,operators:js,memoryLimit:1/0,parseLimit:1/0,renderLimit:1/0};function ci(t){var e,n;if(t.hasOwnProperty("root")&&(t.hasOwnProperty("partials")||(t.partials=t.root),t.hasOwnProperty("layouts")||(t.layouts=t.root)),t.hasOwnProperty("cache")){let s;typeof t.cache=="number"?s=t.cache>0?new Ut(t.cache):void 0:typeof t.cache=="object"?s=t.cache:s=t.cache?new Ut(1024):void 0,t.cache=s}return t=Object.assign(Object.assign(Object.assign({},oe),t.jekyllInclude?{dynamicPartials:!1}:{}),t),(!t.fs.dirname||!t.fs.sep)&&t.relativeReference&&(console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning"),t.relativeReference=!1),t.root=Se(t.root),t.partials=Se(t.partials),t.layouts=Se(t.layouts),t.outputEscape=t.outputEscape&&ui(t.outputEscape),t.locale||(t.locale=(n=(e=Rt())===null||e===void 0?void 0:e().resolvedOptions().locale)!==null&&n!==void 0?n:"en-US"),t.templates&&(t.fs=new li(t.templates),t.relativeReference=!0,t.root=t.partials=t.layouts="."),t}function ui(t){return t==="escape"?Te:t==="json"?Wt.json:(L(T(t),"`outputEscape` need to be of type string or function"),t)}function Se(t){let e=[];return x(t)&&(e=t),p(t)&&(e=[t]),e}function hi(t,e){let n=!1;for(let s=0;s<t.length;s++){const i=t[s];vi(i)&&(!n&&i.trimLeft&&di(t[s-1],e.greedy),te(i)&&(i.name==="raw"?n=!0:i.name==="endraw"&&(n=!1)),!n&&i.trimRight&&fi(t[s+1],e.greedy))}}function di(t,e){if(!t||!Be(t))return;const n=e?re:St;for(;w[t.input.charCodeAt(t.end-1-t.trimRight)]&n;)t.trimRight++}function fi(t,e){if(!t||!Be(t))return;const n=e?re:St;for(;w[t.input.charCodeAt(t.begin+t.trimLeft)]&n;)t.trimLeft++;t.input.charAt(t.begin+t.trimLeft)===` `&&t.trimLeft++}class I{constructor(e,n=oe.operators,s,i){this.input=e,this.file=s,this.rawBeginAt=-1,this.p=i?i[0]:0,this.N=i?i[1]:e.length,this.opTrie=Ft(n),this.literalTrie=Ft(Ot)}readExpression(){return new Ds(this.readExpressionTokens())}*readExpressionTokens(){for(;this.p<this.N;){const e=this.readOperator();if(e){yield e;continue}const n=this.readValue();if(n){yield n;continue}return}}readOperator(){this.skipBlank();const e=this.matchTrie(this.opTrie);if(e!==-1)return new _s(this.input,this.p,this.p=e,this.file)}matchTrie(e){let n=e,s=this.p,i;for(;n[this.input[s]]&&s<this.N;)n=n[this.input[s++]],n.end&&(i=n);return!i||i.needBoundary&&ye(this.peek(s-this.p))?-1:s}readFilteredValue(){const e=this.p,n=this.readExpression();this.assert(n.valid(),`invalid value expression: ${this.snapshot()}`);const s=this.readFilters();return new zs(n,s,this.input,e,this.p,this.file)}readFilters(){const e=[];for(;;){const n=this.readFilter();if(!n)return e;e.push(n)}}readFilter(){if(this.skipBlank(),this.end())return null;this.assert(this.read()==="|",'expected "|" before filter');const e=this.readIdentifier();if(!e.size())return this.assert(this.end(),"expected filter name"),null;const n=[];if(this.skipBlank(),this.peek()===":")do{++this.p;const s=this.readFilterArg();s&&n.push(s),this.skipBlank(),this.assert(this.end()||this.peek()===","||this.peek()==="|",()=>`unexpected character ${this.snapshot()}`)}while(this.peek()===",");else if(!(this.peek()==="|"||this.end()))throw this.error('expected ":" after filter name');return new jt(e.getText(),n,this.input,e.begin,this.p,this.file)}readFilterArg(){const e=this.readValue();if(!e)return;if(this.skipBlank(),this.peek()!==":")return e;++this.p;const n=this.readValue();return[e.getText(),n]}readTopLevelTokens(e=oe){const n=[];for(;this.p<this.N;){const s=this.readTopLevelToken(e);n.push(s)}return hi(n,e),n}readTopLevelToken(e){const{tagDelimiterLeft:n,outputDelimiterLeft:s}=e;return this.rawBeginAt>-1?this.readEndrawOrRawContent(e):this.match(n)?this.readTagToken(e):this.match(s)?this.readOutputToken(e):this.readHTMLToken([n,s])}readHTMLToken(e){const n=this.p;for(;this.p<this.N&&!e.some(s=>this.match(s));)++this.p;return new Ct(this.input,n,this.p,this.file)}readTagToken(e){const{file:n,input:s}=this,i=this.p;if(this.readToDelimiter(e.tagDelimiterRight)===-1)throw this.error(`tag ${this.snapshot(i)} not closed`,i);const r=new Pt(s,i,this.p,e,n);return r.name==="raw"&&(this.rawBeginAt=i),r}readToDelimiter(e,n=!1){for(this.skipBlank();this.p<this.N;){if(n&&this.peekType()&Tt){this.readQuoted();continue}if(++this.p,this.rmatch(e))return this.p}return-1}readOutputToken(e=oe){const{file:n,input:s}=this,{outputDelimiterRight:i}=e,r=this.p;if(this.readToDelimiter(i,!0)===-1)throw this.error(`output ${this.snapshot(r)} not closed`,r);return new vs(s,r,this.p,e,n)}readEndrawOrRawContent(e){const{tagDelimiterLeft:n,tagDelimiterRight:s}=e,i=this.p;let r=this.readTo(n)-n.length;for(;this.p<this.N;){if(this.readIdentifier().getText()!=="endraw"){r=this.readTo(n)-n.length;continue}for(;this.p<=this.N;){if(this.rmatch(s)){const o=this.p;return i===r?(this.rawBeginAt=-1,new Pt(this.input,i,o,e,this.file)):(this.p=r,new Ct(this.input,i,r,this.file))}if(this.rmatch(n))break;this.p++}}throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`,i)}readLiquidTagTokens(e=oe){const n=[];for(;this.p<this.N;){const s=this.readLiquidTagToken(e);s&&n.push(s)}return n}readLiquidTagToken(e){if(this.skipBlank(),this.end())return;const n=this.p;this.readToDelimiter(` `);const s=this.p;return new As(this.input,n,s,e,this.file)}error(e,n=this.p){return new Wn(e,new Ie(this.input,n,this.N,this.file))}assert(e,n,s){if(!e)throw this.error(typeof n=="function"?n():n,s)}snapshot(e=this.p){return JSON.stringify(Jn(this.input.slice(e,this.N),32))}readWord(){return this.readIdentifier()}readIdentifier(){this.skipBlank();const e=this.p;for(;!this.end()&&ye(this.peek());)++this.p;return new Ie(this.input,e,this.p,this.file)}readNonEmptyIdentifier(){const e=this.readIdentifier();return e.size()?e:void 0}readTagName(){return this.skipBlank(),this.input[this.p]==="#"?this.input.slice(this.p,++this.p):this.readIdentifier().getText()}readHashes(e){const n=[];for(;;){const s=this.readHash(e);if(!s)return n;n.push(s)}}readHash(e){this.skipBlank(),this.peek()===","&&++this.p;const n=this.p,s=this.readNonEmptyIdentifier();if(!s)return;let i;this.skipBlank();const r=p(e)?e:e?"=":":";return this.peek()===r&&(++this.p,i=this.readValue()),new xs(this.input,n,this.p,s,i,this.file)}remaining(){return this.input.slice(this.p,this.N)}advance(e=1){this.p+=e}end(){return this.p>=this.N}read(){return this.input[this.p++]}readTo(e){for(;this.p<this.N;)if(++this.p,this.rmatch(e))return this.p;return-1}readValue(){this.skipBlank();const e=this.p,n=this.readLiteral()||this.readQuoted()||this.readRange()||this.readNumber(),s=this.readProperties(!n);return s.length?new Mt(n,s,this.input,e,this.p):n}readScopeValue(){this.skipBlank();const e=this.p,n=this.readProperties();if(n.length)return new Mt(void 0,n,this.input,e,this.p)}readProperties(e=!0){const n=[];for(;;){if(this.peek()==="["){this.p++;const s=this.readValue()||new Ie(this.input,this.p,this.p,this.file);this.assert(this.readTo("]")!==-1,"[ not closed"),n.push(s);continue}if(e&&!n.length){const s=this.readNonEmptyIdentifier();if(s){n.push(s);continue}}if(this.peek()==="."&&this.peek(1)!=="."){this.p++;const s=this.readNonEmptyIdentifier();if(!s)break;n.push(s);continue}break}return n}readNumber(){this.skipBlank();let e=!1,n=!1,s=0;for(this.peekType()&ss&&s++;this.p+s<=this.N;)if(this.peekType(s)&ns)n=!0,s++;else if(this.peek(s)==="."&&this.peek(s+1)!=="."){if(e||!n)return;e=!0,s++}else break;if(n&&!ye(this.peek(s))){const i=new ks(this.input,this.p,this.p+s,this.file);return this.advance(s),i}}readLiteral(){this.skipBlank();const e=this.matchTrie(this.literalTrie);if(e===-1)return;const n=new Ts(this.input,this.p,e,this.file);return this.p=e,n}readRange(){this.skipBlank();const e=this.p;if(this.peek()!=="(")return;++this.p;const n=this.readValueOrThrow();this.skipBlank(),this.assert(this.read()==="."&&this.read()===".","invalid range syntax");const s=this.readValueOrThrow();return this.skipBlank(),this.assert(this.read()===")","invalid range syntax"),new Es(this.input,e,this.p,n,s,this.file)}readValueOrThrow(){const e=this.readValue();return this.assert(e,()=>`unexpected token ${this.snapshot()}, value expected`),e}readQuoted(){this.skipBlank();const e=this.p;if(!(this.peekType()&Tt))return;++this.p;let n=!1;for(;this.p<this.N&&(++this.p,!(this.input[this.p-1]===this.input[e]&&!n));)n?n=!1:this.input[this.p-1]==="\\"&&(n=!0);return new Fs(this.input,e,this.p,this.file)}*readFileNameTemplate(e){const{outputDelimiterLeft:n}=e,s=[","," ",n],i=new Set(s);for(;this.p<this.N&&!i.has(this.peek());)yield this.match(n)?this.readOutputToken(e):this.readHTMLToken(s)}match(e){for(let n=0;n<e.length;n++)if(e[n]!==this.input[this.p+n])return!1;return!0}rmatch(e){for(let n=0;n<e.length;n++)if(e[e.length-1-n]!==this.input[this.p-1-n])return!1;return!0}peekType(e=0){return this.p+e>=this.N?0:w[this.input.charCodeAt(this.p+e)]}peek(e=0){return this.p+e>=this.N?"":this.input[this.p+e]}skipBlank(){for(;this.peekType()&re;)++this.p}}class pi{constructor(e,n){this.handlers={},this.stopRequested=!1,this.tokens=e,this.parseToken=n}on(e,n){return this.handlers[e]=n,this}trigger(e,n){const s=this.handlers[e];return s?(s.call(this,n),!0):!1}start(){this.trigger("start");let e;for(;!this.stopRequested&&(e=this.tokens.shift());){if(this.trigger("token",e)||te(e)&&this.trigger(`tag:${e.name}`,e))continue;const n=this.parseToken(e,this.tokens);this.trigger("template",n)}return this.stopRequested||this.trigger("end"),this}stop(){return this.stopRequested=!0,this}}class Ve{constructor(e){this.token=e}}class v extends Ve{constructor(e,n,s){super(e),this.name=e.name,this.liquid=s,this.tokenizer=e.tokenizer}}class ae{constructor(e,n){this.hash={};const s=e instanceof I?e:new I(e,{});for(const i of s.readHashes(n))this.hash[i.name.content]=i.value}*render(e){const n={};for(const s of Object.keys(this.hash))n[s]=this.hash[s]===void 0?!0:yield k(this.hash[s],e);return n}}function gi(t){return class extends v{constructor(e,n,s){super(e,n,s),T(t.parse)&&t.parse.call(this,e,n)}*render(e,n){const s=yield new ae(this.token.args,e.opts.keyValueSeparator).render(e);return yield t.render.call(this,e,n,s)}}}function Yt(t){return x(t)}class Qt{constructor(e,n,s){this.token=e,this.name=e.name,this.handler=T(n)?n:T(n?.handler)?n.handler:wt,this.raw=!T(n)&&!!n?.raw,this.args=e.args,this.liquid=s}*render(e,n){const s=[];for(const i of this.args)Yt(i)?s.push([i[0],yield k(i[1],n)]):s.push(yield k(i,n));return yield this.handler.apply({context:n,token:this.token,liquid:this.liquid},[e,...s])}}class A{constructor(e,n){this.filters=[];const s=typeof e=="string"?new I(e,n.options.operators).readFilteredValue():e;this.initial=s.initial,this.filters=s.filters.map(i=>new Qt(i,this.getFilter(n,i.name),n))}*value(e,n){n=n||e.opts.lenientIf&&this.filters.length>0&&this.filters[0].name==="default";let s=yield this.initial.evaluate(e,n);for(const i of this.filters)s=yield i.render(s,e);return s}getFilter(e,n){const s=e.filters[n];return L(s||!e.options.strictFilters,()=>`undefined filter: ${n}`),s}}class mi extends Ve{constructor(e,n){var s;super(e);const i=new I(e.input,n.options.operators,e.file,e.contentRange);this.value=new A(i.readFilteredValue(),n);const r=this.value.filters,o=n.options.outputEscape;if(!(!((s=r[r.length-1])===null||s===void 0)&&s.raw)&&o){const a=new jt(toString.call(o),[],"",0,0);r.push(new Qt(a,o,n))}}*render(e,n){const s=yield this.value.value(e,!1);n.write(s)}*arguments(){yield this.value}}class yi extends Ve{constructor(e){super(e),this.str=e.getContent()}*render(e,n){n.write(this.str)}}class se{constructor(e,n){this.segments=e,this.location=n}toString(){return _e(this.segments,!0)}toArray(){function*e(...n){for(const s of n)s instanceof se?yield Array.from(e(...s.segments)):yield s}return Array.from(e(...this.segments))}}class He{constructor(){this.map=new Map}get(e){const n=_e([e.segments[0]]);return this.map.has(n)||this.map.set(n,[]),this.map.get(n)}has(e){return this.map.has(_e([e.segments[0]]))}push(e){this.get(e).push(e)}asObject(){return Object.fromEntries(this.map)}}const Gt={partials:!0};function*Zt(t,e,n){const s=new He,i=new He,r=new He,o=new Xt(new Set),a=new Set;function u(l,h){s.push(l);const f=h.alias(l);if(f!==void 0){const m=f.segments[0];p(m)&&!o.has(m)&&i.push(f)}else{const m=l.segments[0];p(m)&&!h.has(m)&&i.push(l)}for(const m of l.segments)m instanceof se&&u(m,h)}function*c(l,h){if(l.arguments)for(const f of l.arguments())for(const m of Kt(f))u(m,h);if(l.localScope)for(const f of l.localScope()){h.add(f.content),h.deleteAlias(f.content);const[m,M]=f.getPosition();r.push(new se([f.content],{row:m,col:M,file:f.file}))}if(l.children)if(l.partialScope){const f=l.partialScope();if(f===void 0){for(const F of yield l.children(e,n))yield c(F,h);return}if(a.has(f.name))return;const m=new Set,M=f.isolated?new Xt(m):h.push(m);for(const F of f.scope)if(p(F))m.add(F);else{const[B,Q]=F;m.add(B);const J=Array.from(Kt(Q));J.length&&M.setAlias(B,J[0].segments)}for(const F of yield l.children(e,n))yield c(F,M),a.add(f.name);M.pop()}else{l.blockScope&&h.push(new Set(l.blockScope()));for(const f of yield l.children(e,n))yield c(f,h);l.blockScope&&h.pop()}}for(const l of t)yield c(l,o);return{variables:s.asObject(),globals:i.asObject(),locals:r.asObject()}}function W(t,e={}){const n=Object.assign(Object.assign({},Gt),e);return V(Zt(t,n.partials,!1))}function Y(t,e={}){const n=Object.assign(Object.assign({},Gt),e);return H(Zt(t,n.partials,!0))}class Xt{constructor(e){this.stack=[{names:e,aliases:new Map}]}has(e){for(const n of this.stack)if(n.names.has(e))return!0;return!1}push(e){return this.stack.push({names:e,aliases:new Map}),this}pop(){var e;return(e=this.stack.pop())===null||e===void 0?void 0:e.names}add(e){this.stack[0].names.add(e)}alias(e){const n=e.segments[0];if(!p(n))return;const s=this.getAlias(n);if(s!==void 0)return new se([...s,...e.segments.slice(1)],e.location)}setAlias(e,n){this.stack[this.stack.length-1].aliases.set(e,n)}deleteAlias(e){this.stack[this.stack.length-1].aliases.delete(e)}getAlias(e){for(const n of this.stack){if(n.aliases.has(e))return n.aliases.get(e);if(n.names.has(e))return}}}function*Kt(t){z(t)?yield*le(t):t instanceof A&&(yield*wi(t))}function*wi(t){for(const e of t.initial.postfix)z(e)&&(yield*le(e));for(const e of t.filters)for(const n of e.args)Yt(n)&&n[1]?yield*le(n[1]):z(n)&&(yield*le(n))}function*le(t){rn(t)?(yield*le(t.lhs),yield*le(t.rhs)):xe(t)&&(yield Ue(t))}function Ue(t){const e=[];let n=t.file;const s=t.props[0];n=n||s.file,Je(s)||nn(s)||sn(s)?e.push(s.content):xe(s)&&e.push(...Ue(s).segments);for(const o of t.props.slice(1))n=n||o.file,Je(o)||nn(o)||sn(o)?e.push(o.content):xe(o)&&e.push(Ue(o));const[i,r]=t.getPosition();return new se(e,{row:i,col:r,file:n})}const en=/^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/;function _e(t,e=!1){const n=[],s=t[0];p(s)&&(!e||s.match(en)?n.push(`${s}`):n.push(`['${s}']`));for(const i of t.slice(1))i instanceof se?n.push(`[${_e(i.segments)}]`):p(i)?i.match(en)?n.push(`.${i}`):n.push(`['${i}']`):n.push(`[${i}]`);return n.join("")}var K;(function(t){t.Partials="partials",t.Layouts="layouts",t.Root="root"})(K||(K={}));class bi{constructor(e){if(this.options=e,e.relativeReference){const n=e.fs.sep;L(n,"`fs.sep` is required for relative reference");const s=new RegExp(["."+n,".."+n,"./","../"].map(i=>$n(i)).join("|"));this.shouldLoadRelative=i=>s.test(i)}else this.shouldLoadRelative=n=>!1;this.contains=this.options.fs.contains||(()=>!0)}*lookup(e,n,s,i){const{fs:r}=this.options,o=this.options[n];for(const a of this.candidates(e,o,i,n!==K.Root))if(s?r.existsSync(a):yield r.exists(a))return a;throw this.lookupError(e,o)}*candidates(e,n,s,i){const{fs:r,extname:o}=this.options;if(this.shouldLoadRelative(e)&&s){const a=r.resolve(this.dirname(s),e,o);for(const u of n)if(!i||this.contains(u,a)){yield a;break}}for(const a of n){const u=r.resolve(a,e,o);(!i||this.contains(a,u))&&(yield u)}if(r.fallback!==void 0){const a=r.fallback(e);a!==void 0&&(yield a)}}dirname(e){const n=this.options.fs;return L(n.dirname,"`fs.dirname` is required for relative reference"),n.dirname(e)}lookupError(e,n){const s=new Error("ENOENT");return s.message=`ENOENT: Failed to lookup "${e}" in "${n}"`,s.code="ENOENT",s}}class ee{constructor(e){this.liquid=e,this.cache=this.liquid.options.cache,this.fs=this.liquid.options.fs,this.parseFile=this.cache?this._parseFileCached:this._parseFile,this.loader=new bi(this.liquid.options),this.parseLimit=new Me("parse length",e.options.parseLimit)}parse(e,n){e=String(e),this.parseLimit.use(e.length);const i=new I(e,this.liquid.options.operators,n).readTopLevelTokens(this.liquid.options);return this.parseTokens(i)}parseTokens(e){let n;const s=[],i=[];for(;n=e.shift();)try{s.push(this.parseToken(n,e))}catch(r){if(this.liquid.options.catchAllErrors)i.push(r);else throw r}if(i.length)throw new kt(i);return s}parseToken(e,n){try{if(te(e)){const s=this.liquid.tags[e.name];return L(s,`tag "${e.name}" not found`),new s(e,n,this.liquid,this)}return ki(e)?new mi(e,this.liquid):new yi(e)}catch(s){throw Z.is(s)?s:new Yn(s,e)}}parseStream(e){return new pi(e,(n,s)=>this.parseToken(n,s))}*_parseFileCached(e,n,s=K.Root,i){const r=this.cache,o=this.loader.shouldLoadRelative(e)?i+","+e:s+":"+e,a=yield r.read(o);if(a)return a;const u=this._parseFile(e,n,s,i),c=n?yield u:V(u);r.write(o,c);try{return yield c}catch(l){throw r.remove(o),l}}*_parseFile(e,n,s=K.Root,i){const r=yield this.loader.lookup(e,s,n,i);return this.parse(n?this.fs.readFileSync(r):yield this.fs.readFile(r),r)}}var b;(function(t){t[t.Number=1]="Number",t[t.Literal=2]="Literal",t[t.Tag=4]="Tag",t[t.Output=8]="Output",t[t.HTML=16]="HTML",t[t.Filter=32]="Filter",t[t.Hash=64]="Hash",t[t.PropertyAccess=128]="PropertyAccess",t[t.Word=256]="Word",t[t.Range=512]="Range",t[t.Quoted=1024]="Quoted",t[t.Operator=2048]="Operator",t[t.FilteredValue=4096]="FilteredValue",t[t.Delimited=12]="Delimited"})(b||(b={}));function vi(t){return!!(P(t)&b.Delimited)}function tn(t){return P(t)===b.Operator}function Be(t){return P(t)===b.HTML}function ki(t){return P(t)===b.Output}function te(t){return P(t)===b.Tag}function Je(t){return P(t)===b.Quoted}function nn(t){return P(t)===b.Number}function xe(t){return P(t)===b.PropertyAccess}function sn(t){return P(t)===b.Word}function rn(t){return P(t)===b.Range}function z(t){return(P(t)&1667)>0}function P(t){return t?t.kind:-1}class ie{constructor(e={},n=oe,s={},{memoryLimit:i,renderLimit:r}={}){var o,a,u,c,l;this.scopes=[{}],this.registers={},this.breakCalled=!1,this.continueCalled=!1,this.sync=!!s.sync,this.opts=n,this.globals=(o=s.globals)!==null&&o!==void 0?o:n.globals,this.environments=ge(e)?e:Object(e),this.strictVariables=(a=s.strictVariables)!==null&&a!==void 0?a:this.opts.strictVariables,this.ownPropertyOnly=(u=s.ownPropertyOnly)!==null&&u!==void 0?u:n.ownPropertyOnly,this.memoryLimit=i??new Me("memory alloc",(c=s.memoryLimit)!==null&&c!==void 0?c:n.memoryLimit),this.renderLimit=r??new Me("template render",Ht().now()+((l=s.renderLimit)!==null&&l!==void 0?l:n.renderLimit))}getRegister(e){return this.registers[e]=this.registers[e]||{}}setRegister(e,n){return this.registers[e]=n}saveRegister(...e){return e.map(n=>[n,this.getRegister(n)])}restoreRegister(e){return e.forEach(([n,s])=>this.setRegister(n,s))}getAll(){return[this.globals,this.environments,...this.scopes].reduce((e,n)=>be(e,n),{})}get(e){return this.getSync(e)}getSync(e){return H(this._get(e))}*_get(e){const n=this.findScope(e[0]);return yield this._getFromScope(n,e)}getFromScope(e,n){return H(this._getFromScope(e,n))}*_getFromScope(e,n,s=this.strictVariables){p(n)&&(n=n.split("."));for(let i=0;i<n.length;i++)if(e=yield Ti(e,n[i],this.ownPropertyOnly),s&&Vn(e))throw new Zn(n.slice(0,i+1).join("."));return e}push(e){return this.scopes.push(e)}pop(){return this.scopes.pop()}bottom(){return this.scopes[0]}spawn(e={}){return new ie(e,this.opts,{sync:this.sync,globals:this.globals,strictVariables:this.strictVariables},{renderLimit:this.renderLimit,memoryLimit:this.memoryLimit})}findScope(e){for(let n=this.scopes.length-1;n>=0;n--){const s=this.scopes[n];if(e in s)return s}return e in this.environments?this.environments:this.globals}}function Ti(t,e,n){if(t=dt(t),e=g(e),N(t))return t;if(x(t)&&e<0)return t[t.length+ +e];const s=Si(t,e,n);return s===void 0&&t instanceof G?t.liquidMethodMissing(e):T(s)?s.call(t):e==="size"?Li(t):e==="first"?_i(t):e==="last"?xi(t):s}function Si(t,e,n){if(!(n&&!De.call(t,e)&&!(t instanceof G)))return t[e]}function _i(t){return x(t)?t[0]:t.first}function xi(t){return x(t)?t[t.length-1]:t.last}function Li(t){if(De.call(t,"size")||t.size!==void 0)return t.size;if(x(t)||p(t))return t.length;if(typeof t=="object")return Object.keys(t).length}var ne;(function(t){t[t.OUTPUT=0]="OUTPUT",t[t.STORE=1]="STORE"})(ne||(ne={}));const Oi=E(Math.abs),Fi=E(Math.max),Ei=E(Math.min),Ai=E(Math.ceil),zi=E((t,e,n=!1)=>n?Math.floor(t/e):t/e),Ri=E(Math.floor),Ni=E((t,e)=>t-e),Di=E((t,e)=>t%e),Pi=E((t,e)=>t*e);function Ci(t,e=0){t=g(t),e=g(e);const n=Math.pow(10,e);return Math.round(t*n)/n}function qi(t,e){return t=g(t),e=g(e),Number(t)+Number(e)}var Mi=Object.freeze({__proto__:null,abs:Oi,at_least:Fi,at_most:Ei,ceil:Ai,divided_by:zi,floor:Ri,minus:Ni,modulo:Di,times:Pi,round:Ci,plus:qi});const ji=t=>decodeURIComponent(d(t)).replace(/\+/g," "),Ii=t=>encodeURIComponent(d(t)).replace(/%20/g,"+"),$i=t=>encodeURIComponent(d(t)).replace(/%20/g,"+").replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase()),Vi=t=>encodeURI(d(t)).replace(/%5B/g,"[").replace(/%5D/g,"]"),on=/[^\p{M}\p{L}\p{Nd}]+/ug,Hi={raw:/\s+/g,default:on,pretty:/[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/ug,ascii:/[^A-Za-z0-9]+/g,latin:on,none:null};function Ui(t,e="default",n=!1){t=d(t);const s=Hi[e];return s&&(e==="latin"&&(t=Bi(t)),t=t.replace(s,"-").replace(/^-|-$/g,"")),n?t:t.toLowerCase()}function Bi(t){return t.replace(/[àáâãäå]/g,"a").replace(/[æ]/g,"ae").replace(/[ç]/g,"c").replace(/[èéêë]/g,"e").replace(/[ìíîï]/g,"i").replace(/[ð]/g,"d").replace(/[ñ]/g,"n").replace(/[òóôõöø]/g,"o").replace(/[ùúûü]/g,"u").replace(/[ýÿ]/g,"y").replace(/[ß]/g,"ss").replace(/[œ]/g,"oe").replace(/[þ]/g,"th").replace(/[ẞ]/g,"SS").replace(/[Œ]/g,"OE").replace(/[Þ]/g,"TH")}var Ji=Object.freeze({__proto__:null,url_decode:ji,url_encode:Ii,cgi_escape:$i,uri_escape:Vi,slugify:Ui});const Wi=E(function(t,e){const n=_(t),s=N(e)?" ":d(e),i=n.length*(1+s.length);return this.context.memoryLimit.use(i),n.join(s)}),Yi=E(t=>ft(t)?gt(t):""),Qi=E(t=>ft(t)?t[0]:""),Gi=E(function(t){const e=_(t);return this.context.memoryLimit.use(e.length),[...e].reverse()});function*Zi(t,e){const n=[],s=_(t);this.context.memoryLimit.use(s.length);for(const i of s)n.push([i,e?yield this.context._getFromScope(i,d(e).split("."),!1):i]);return n.sort((i,r)=>{const o=i[1],a=r[1];return o<a?-1:o>a?1:0}).map(i=>i[0])}function Xi(t,e){const n=d(e),s=e===void 0?bt:(r,o)=>bt(r[n],o[n]),i=_(t);return this.context.memoryLimit.use(i.length),[...i].sort(s)}const Ki=t=>t&&t.length||0;function*er(t,e){const n=[],s=_(t);this.context.memoryLimit.use(s.length);for(const i of s)n.push(yield this.context._getFromScope(i,d(e),!1));return n}function*tr(t,e){let n=0;const s=_(t);for(const i of s){const r=Number(e?yield this.context._getFromScope(i,d(e),!1):i);n+=Number.isNaN(r)?0:r}return n}function nr(t){const e=_(t);return this.context.memoryLimit.use(e.length),e.filter(n=>!N(g(n)))}function an(t,e=[]){const n=_(t),s=_(e);return this.context.memoryLimit.use(n.length+s.length),n.concat(s)}function sr(t,e){return an.call(this,t,[e])}function ir(t,e){const n=_(t);this.context.memoryLimit.use(n.length);const s=[...n];return s.unshift(e),s}function rr(t){const e=[..._(t)];return e.pop(),e}function or(t){const e=_(t);this.context.memoryLimit.use(e.length);const n=[...e];return n.shift(),n}function ar(t,e,n=1){return t=g(t),N(t)?[]:(x(t)||(t=d(t)),e=e<0?t.length+e:e,this.context.memoryLimit.use(n),t.slice(e,e+n))}function ln(t){return this.context.opts.jekyllWhere?e=>ce.is(t)?U(e,t):x(e)?$s(e,t):U(e,t):t===void 0?e=>X(e,this.context):e=>U(e,t)}function*cn(t,e,n,s){const i=[];e=_(e),this.context.memoryLimit.use(e.length);const r=new I(d(n)).readScopeValue();for(const a of e)i.push(yield k(r,this.context.spawn(a)));const o=ln.call(this,s);return e.filter((a,u)=>o(i[u])===t)}function*un(t,e,n,s){const i=[],r=new A(d(s),this.liquid),o=_(e);this.context.memoryLimit.use(o.length);for(const a of o){this.context.push({[n]:a});const u=yield r.value(this.context);this.context.pop(),u===t&&i.push(a)}return i}function*lr(t,e,n){return yield*cn.call(this,!0,t,e,n)}function*cr(t,e,n){return yield*cn.call(this,!1,t,e,n)}function*ur(t,e,n){return yield*un.call(this,!0,t,e,n)}function*hr(t,e,n){return yield*un.call(this,!1,t,e,n)}function*dr(t,e){const n=new Map;t=ue(t);const s=new I(d(e)).readScopeValue();this.context.memoryLimit.use(t.length);for(const i of t){const r=yield k(s,this.context.spawn(i));n.has(r)||n.set(r,[]),n.get(r).push(i)}return[...n.entries()].map(([i,r])=>({name:i,items:r}))}function*fr(t,e,n){const s=new Map,i=new A(d(n),this.liquid);t=ue(t),this.context.memoryLimit.use(t.length);for(const r of t){this.context.push({[e]:r});const o=yield i.value(this.context);this.context.pop(),s.has(o)||s.set(o,[]),s.get(o).push(r)}return[...s.entries()].map(([r,o])=>({name:r,items:o}))}function*We(t,e,n){const s=new I(d(e)).readScopeValue(),i=_(t),r=ln.call(this,n);for(let o=0;o<i.length;o++){const a=yield k(s,this.context.spawn(i[o]));if(r(a))return[o,i[o]]}}function*Ye(t,e,n){const s=new A(d(n),this.liquid),i=_(t);for(let r=0;r<i.length;r++){this.context.push({[e]:i[r]});const o=yield s.value(this.context);if(this.context.pop(),o)return[r,i[r]]}}function*pr(t,e,n){return!!(yield*We.call(this,t,e,n))}function*gr(t,e,n){return!!(yield*Ye.call(this,t,e,n))}function*mr(t,e,n){const s=yield*We.call(this,t,e,n);return s?s[0]:void 0}function*yr(t,e,n){const s=yield*Ye.call(this,t,e,n);return s?s[0]:void 0}function*wr(t,e,n){const s=yield*We.call(this,t,e,n);return s?s[1]:void 0}function*br(t,e,n){const s=yield*Ye.call(this,t,e,n);return s?s[1]:void 0}function vr(t){return t=_(t),this.context.memoryLimit.use(t.length),[...new Set(t)]}function kr(t,e=1){if(t=g(t),N(t))return[];x(t)||(t=d(t)),this.context.memoryLimit.use(e);const n=[...t].sort(()=>Math.random()-.5);return e===1?n[0]:n.slice(0,e)}var Tr=Object.freeze({__proto__:null,join:Wi,last:Yi,first:Qi,reverse:Gi,sort:Zi,sort_natural:Xi,size:Ki,map:er,sum:tr,compact:nr,concat:an,push:sr,unshift:ir,pop:rr,shift:or,slice:ar,where:lr,reject:cr,where_exp:ur,reject_exp:hr,group_by:dr,group_by_exp:fr,has:pr,has_exp:gr,find_index:mr,find_index_exp:yr,find:wr,find_exp:br,uniq:vr,sample:kr});function Qe(t,e,n){var s,i,r;const o=((s=t?.length)!==null&&s!==void 0?s:0)+((i=e?.length)!==null&&i!==void 0?i:0)+((r=n?.length)!==null&&r!==void 0?r:0);this.context.memoryLimit.use(o);const a=