import{h as O,L as $,g as a,a as e,p as i,j as r,b as n,s as t,i as Q,f as o,t as l,k as s,l as p,E as c}from"./index-BiV-b1K2.js";const P=new c((O=>{let $=O.pos;for(;;){let{next:a}=O;if(a<0)break;if(123==a){let a=O.peek(1);if(123==a){if(O.pos>$)break;return void O.acceptToken(1,2)}if(37==a){if(O.pos>$)break;let a=2,e=2;for(;;){let $=O.peek(a);if(32==$||10==$)++a;else if(35==$)for(++a;;){let $=O.peek(a);if($<0||10==$)break;a++}else{if(45!=$||2!=e){let i=101==$&&110==O.peek(a+1)&&100==O.peek(a+2);return void O.acceptToken(i?3:2,e)}e=++a}}}}if(O.advance(),10==a)break}O.pos>$&&O.acceptToken(180)}));function m(O,$,a){return new c((e=>{let i=e.pos;for(;;){let{next:$}=e;if(123==$&&37==e.peek(1)){let $=2;for(;;$++){let O=e.peek($);if(32!=O&&10!=O)break}let n="";for(;;$++){let O=e.peek($);if(!((r=O)>=65&&r<=90||r>=97&&r<=122))break;n+=String.fromCharCode(O)}if(n==O){if(e.pos>i)break;e.acceptToken(a,2);break}}else if($<0)break;if(e.advance(),10==$)break}var r;e.pos>i&&e.acceptToken($)}))}const q=m("endcomment",182,5),d=m("endraw",181,4),f={__proto__:null,contains:32,or:36,and:36,true:50,false:50,empty:52,forloop:54,tablerowloop:56,continue:58,in:128,with:194,for:196,as:198,if:234,endif:238,unless:244,endunless:248,elsif:252,else:256,case:262,endcase:266,when:270,endfor:278,tablerow:284,endtablerow:288,break:292,cycle:298,echo:302,render:306,include:312,assign:316,capture:322,endcapture:326,increment:330,decrement:334},W={__proto__:null,if:82,endif:86,elsif:90,else:94,unless:100,endunless:104,case:110,endcase:114,when:118,for:126,endfor:136,tablerow:142,endtablerow:146,break:150,continue:154,cycle:158,comment:164,endcomment:170,raw:176,endraw:182,echo:186,render:190,include:202,assign:206,capture:212,endcapture:216,increment:220,decrement:224,liquid:228},g=n.deserialize({version:14,states:"GYQYOPOOOOOP'#F{'#F{OeOXO'#CdOsQWO'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uO2xQWO'#EsO3PQWO'#ExO3WQWO'#FRO3_QWO'#FYO3fQWO'#F^O3mQWO'#FqOOQO'#Ga'#GaOOQO'#GT'#GTO3tQWO1G0wOsQWO'#EtOsQWO'#EyOsQWO'#E}OOQO'#FP'#FPOsQWO'#FSOsQWO'#FWO!]QWO'#FZO!]QWO'#F_OOQO'#Fc'#FcOOQO'#Fe'#FeO3{QWO'#FfOsQWO'#FhOsQWO'#FjOsQWO'#FmOsQWO'#FoOsQWO'#FrOsQWO'#FvOsQWO'#FxOOOP1G0w1G0wOOOP1G/Z1G/ZO4QQWO,59rOOOP1G/d1G/dO4VQWO,59{OOOP1G/i1G/iO4[QWO,5:QOOOP1G/q1G/qO4aQWO,5:]OOOP1G/y1G/yO4fQWO,5:bOOOS-E:O-E:OOOOP1G0U1G0UO4kQ`O'#ESOOOQ-E:P-E:POOOP1G0[1G0[O4pQ`O'#EYOOOP1G0n1G0nO4uQWO,5;VOOQO1G.n1G.nOOQO1G.q1G.qO7ZQpO1G.qOOQO'#DO'#DOO7eQWO,59hOOQO-E9z-E9zOOOP7+$W7+$WO9_QpO1G.qO9iQpO1G.uOsQWO1G.yOOOP7+$r7+$rOOOP7+$v7+$vOOOP7+$z7+$zOOOP7+%P7+%POOOP7+%U7+%UOsQWO'#F}OkQpO,5;eO@UQpO,5;iOBRQpO,5;nOClQpO,5;rOE_QWO,5;uOEdQWO,5;yOEiQWO,5dOOOPAN>dAN>dO!5aQWOAN>lOOOPAN>lAN>lO!5iQWOAN>tOOOPAN>tAN>tOsQWO1G0fO!]QWO1G0fO!5qQpO7+&{O!7QQpO7+'PO!8aQWO7+'WO!:TQWO,5f[O]||-1},{term:37,get:O=>W[O]||-1}],tokenPrec:0});function u(O,$){return O.split(" ").map((O=>({label:O,type:$})))}const y=u("abs append at_least at_most capitalize ceil compact concat date default divided_by downcase escape escape_once first floor join last lstrip map minus modulo newline_to_br plus prepend remove remove_first replace replace_first reverse round rstrip size slice sort sort_natural split strip strip_html strip_newlines sum times truncate truncatewords uniq upcase url_decode url_encode where","function"),b=u("cycle comment endcomment raw endraw echo increment decrement liquid if elsif else endif unless endunless case endcase for endfor tablerow endtablerow break continue assign capture endcapture render include","keyword"),v=u("empty forloop tablerowloop in with as contains","keyword"),T=u("first index index0 last length rindex","property"),k=u("col col0 col_first col_last first index index0 last length rindex rindex0 row","property");function _(O={}){let $=O.filters?O.filters.concat(y):y,a=O.tags?O.tags.concat(b):b,e=O.variables?O.variables.concat(v):v,{properties:i}=O;return O=>{var r;let n=function(O){var $;let{state:a,pos:e}=O,i=p(a).resolveInner(e,-1).enterUnfinishedNodesBefore(e),r=(null===($=i.childBefore(e))||void 0===$?void 0:$.name)||i.name;if("FilterName"==i.name)return{type:"filter",node:i};if(O.explicit&&"|"==r)return{type:"filter"};if("TagName"==i.name)return{type:"tag",node:i};if(O.explicit&&"{%"==r)return{type:"tag"};if("PropertyName"==i.name&&"MemberExpression"==i.parent.name)return{type:"property",node:i,target:i.parent};if("."==i.name&&"MemberExpression"==i.parent.name)return{type:"property",target:i.parent};if("MemberExpression"==i.name&&"."==r)return{type:"property",target:i};if("VariableName"==i.name)return{type:"expression",from:i.from};let n=O.matchBefore(/[\w\u00c0-\uffff]+$/);return n?{type:"expression",from:n.from}:O.explicit&&"CommentText"!=i.name&&"StringLiteral"!=i.name&&"NumberLiteral"!=i.name&&"InlineComment"!=i.name?{type:"expression"}:null}(O);if(!n)return null;let t,Q=null!==(r=n.from)&&void 0!==r?r:n.node?n.node.from:O.pos;return t="filter"==n.type?$:"tag"==n.type?a:"expression"==n.type?e:function(O,$,a,e){let i=[];for(;;){let a=$.getChild("Expression");if(!a)return[];if("forloop"==a.name)return i.length?[]:T;if("tablerowloop"==a.name)return i.length?[]:k;if("VariableName"==a.name){i.unshift(O.sliceDoc(a.from,a.to));break}if("MemberExpression"!=a.name)return[];{let e=a.getChild("PropertyName");e&&i.unshift(O.sliceDoc(e.from,e.to)),$=a}}return e?e(i,O,a):[]}(O.state,n.target,O,i),t.length?{options:t,from:Q,validFor:/^[\w\u00c0-\uffff]*$/}:null}}const R=a.inputHandler.of(((O,$,a,e)=>"%"==e&&$==a&&"{}"==O.state.doc.sliceString($-1,a+1)&&(O.dispatch(O.state.changeByRange((O=>({changes:{from:O.from,to:O.to,insert:"%%"},range:r.cursor(O.from+1)}))),{scrollIntoView:!0,userEvent:"input.type"}),!0)));function Y(O){return $=>{let a=O.test($.textAfter);return $.lineIndent($.node.from)+(a?0:$.unit)}}const U=e.define({name:"liquid",parser:g.configure({props:[t({"cycle comment endcomment raw endraw echo increment decrement liquid in with as":l.keyword,"empty forloop tablerowloop":l.atom,"if elsif else endif unless endunless case endcase for endfor tablerow endtablerow break continue":l.controlKeyword,"assign capture endcapture":l.definitionKeyword,contains:l.operatorKeyword,"render include":l.moduleKeyword,VariableName:l.variableName,TagName:l.tagName,FilterName:l.function(l.variableName),PropertyName:l.propertyName,CompareOp:l.compareOperator,AssignOp:l.definitionOperator,LogicOp:l.logicOperator,NumberLiteral:l.number,StringLiteral:l.string,BooleanLiteral:l.bool,InlineComment:l.lineComment,CommentText:l.blockComment,"{% %} {{ }}":l.brace,"( )":l.paren,".":l.derefOperator,", .. : |":l.punctuation}),Q.add({Tag:s({closing:"%}"}),"UnlessDirective ForDirective TablerowDirective CaptureDirective":Y(/^\s*(\{%-?\s*)?end\w/),IfDirective:Y(/^\s*(\{%-?\s*)?(endif|else|elsif)\b/),CaseDirective:Y(/^\s*(\{%-?\s*)?(endcase|when)\b/)}),o.add({"UnlessDirective ForDirective TablerowDirective CaptureDirective IfDirective CaseDirective RawDirective Comment"(O){let $=O.firstChild,a=O.lastChild;return $&&"Tag"==$.name?{from:$.to,to:"EndTag"==a.name?a.from:O.to}:null}})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*{%-?\s*(?:end|elsif|else|when|)$/}}),G=O();function X(O){return U.configure({wrap:i(($=>$.type.isTop?{parser:O.parser,overlay:O=>"Text"==O.name||"RawText"==O.name}:null))},"liquid")}const w=X(G.language);function S(O={}){let a=O.base||G,e=a.language==G.language?w:X(a.language);return new $(e,[a.support,e.data.of({autocomplete:_(O)}),a.language.data.of({closeBrackets:{brackets:["{"]}}),R])}export{R as closePercentBrace,S as liquid,_ as liquidCompletionSource,w as liquidLanguage};