'use client';
import { aa as EditorView, ab as EditorSelection, W as LRLanguage, U as styleTags, V as tags, Q as indentNodeProp, a4 as delimitedIndent, T as foldNodeProp, X as LanguageSupport, Z as LRParser, a1 as syntaxTree, ac as html, ad as parseMixed, Y as ExternalTokenizer } from './index-gafqmUmi.js';
import './protobuf-OcbVtxg1.js';
import './logger-Bqy1nuLj.js';
import './depth-DiD1V2Sg.js';
import './comlink-jf8bdrAf.js';
import 'react';
import 'zustand';
import 'react-mosaic-component';
import '@mui/material';
import './isArrayLikeObject-n9ytTioB.js';
import './utils-DmlHZWuo.js';
import './FoxgloveServer-Da9kV1cr.js';
import 'ms';
import './foxglove-protocol-BtLMVx24.js';
import 'react-dnd';
import 'react-dnd-html5-backend';
import './i18next-17tp0Ngf.js';
import '@emotion/react';
import '@mui/system/colorManipulator';
import 'object-assign';
import 'react/jsx-runtime';
import 'react-dom';
import 'react-icons';
import 'extend';
import 'react-syntax-highlighter';
import 'react-syntax-highlighter/dist/esm/styles/prism';
import '@pandacss/dev';

// This file was generated by lezer-generator. You probably shouldn't edit it.
const interpolationStart = 1,
  tagStart = 2,
  endTagStart = 3,
  text = 180,
  endrawTagStart = 4,
  rawText = 181,
  endcommentTagStart = 5,
  commentText = 182,
  InlineComment = 6;

function wordChar(code) {
    return code >= 65 && code <= 90 || code >= 97 && code <= 122;
}
const base = /*@__PURE__*/new ExternalTokenizer(input => {
    let start = input.pos;
    for (;;) {
        let { next } = input;
        if (next < 0)
            break;
        if (next == 123 /* Ch.BraceL */) {
            let after = input.peek(1);
            if (after == 123 /* Ch.BraceL */) {
                if (input.pos > start)
                    break;
                input.acceptToken(interpolationStart, 2);
                return;
            }
            else if (after == 37 /* Ch.Percent */) {
                if (input.pos > start)
                    break;
                let scan = 2, size = 2;
                for (;;) {
                    let next = input.peek(scan);
                    if (next == 32 /* Ch.Space */ || next == 10 /* Ch.Newline */) {
                        ++scan;
                    }
                    else if (next == 35 /* Ch.Hash */) {
                        ++scan;
                        for (;;) {
                            let comment = input.peek(scan);
                            if (comment < 0 || comment == 10 /* Ch.Newline */)
                                break;
                            scan++;
                        }
                    }
                    else if (next == 45 /* Ch.Dash */ && size == 2) {
                        size = ++scan;
                    }
                    else {
                        let end = next == 101 /* Ch.e */ && input.peek(scan + 1) == 110 /* Ch.n */ && input.peek(scan + 2) == 100 /* Ch.d */;
                        input.acceptToken(end ? endTagStart : tagStart, size);
                        return;
                    }
                }
            }
        }
        input.advance();
        if (next == 10 /* Ch.Newline */)
            break;
    }
    if (input.pos > start)
        input.acceptToken(text);
});
function rawTokenizer(endTag, text, tagStart) {
    return new ExternalTokenizer(input => {
        let start = input.pos;
        for (;;) {
            let { next } = input;
            if (next == 123 /* Ch.BraceL */ && input.peek(1) == 37 /* Ch.Percent */) {
                let scan = 2;
                for (;; scan++) {
                    let ch = input.peek(scan);
                    if (ch != 32 /* Ch.Space */ && ch != 10 /* Ch.Newline */)
                        break;
                }
                let word = "";
                for (;; scan++) {
                    let next = input.peek(scan);
                    if (!wordChar(next))
                        break;
                    word += String.fromCharCode(next);
                }
                if (word == endTag) {
                    if (input.pos > start)
                        break;
                    input.acceptToken(tagStart, 2);
                    break;
                }
            }
            else if (next < 0) {
                break;
            }
            input.advance();
            if (next == 10 /* Ch.Newline */)
                break;
        }
        if (input.pos > start)
            input.acceptToken(text);
    });
}
const comment = /*@__PURE__*/rawTokenizer("endcomment", commentText, endcommentTagStart);
const raw = /*@__PURE__*/rawTokenizer("endraw", rawText, endrawTagStart);
const inlineComment = /*@__PURE__*/new ExternalTokenizer(input => {
    if (input.next != 35 /* Ch.Hash */)
        return;
    input.advance();
    for (;;) {
        if (input.next == 10 /* Ch.Newline */ || input.next < 0)
            break;
        if ((input.next == 37 /* Ch.Percent */ || input.next == 125 /* Ch.BraceR */) && input.peek(1) == 125 /* Ch.BraceR */)
            break;
        input.advance();
    }
    input.acceptToken(InlineComment);
});

// This file was generated by lezer-generator. You probably shouldn't edit it.
const spec_identifier = {__proto__:null,contains:34, or:38, and:38, true:52, false:52, empty:54, forloop:56, tablerowloop:58, continue:60, in:130, with:196, for:198, as:200, if:236, endif:240, unless:246, endunless:250, elsif:254, else:258, case:264, endcase:268, when:272, endfor:280, tablerow:286, endtablerow:290, break:294, cycle:300, echo:304, render:308, include:312, assign:316, capture:322, endcapture:326, increment:330, decrement:334};
const spec_TagName = {__proto__:null,if:86, endif:90, elsif:94, else:98, unless:104, endunless:108, case:114, endcase:118, when:122, for:128, endfor:138, tablerow:144, endtablerow:148, break:152, continue:156, cycle:160, comment:166, endcomment:172, raw:178, endraw:184, echo:188, render:192, include:204, assign:208, capture:214, endcapture:218, increment:222, decrement:226, liquid:230};
const parser = /*@__PURE__*/LRParser.deserialize({
  version: 14,
  states: "HOQYOPOOOOOP'#F{'#F{OeOaO'#CdOsQhO'#CfO!bQxO'#DSO#{OPO'#DVO$ZOPO'#D`O$iOPO'#DeO$wOPO'#DlO%VOPO'#DtO%eOSO'#EPO%jOQO'#EVO%oOPO'#EiOOOP'#Gb'#GbOOOP'#G]'#G]OOOP'#Fz'#FzQYOPOOOOOP-E9y-E9yOOQW'#Cg'#CgO&cQ!jO,59QO&jQ!jO'#G^OsQhO'#CtOOQW'#G^'#G^OOOP,59n,59nO)YQhO,59nOsQhO,59rOsQhO,59vO)dQhO,59xOsQhO,59{OsQhO,5:QOsQhO,5:UO!]QhO,5:XO!]QhO,5:aO)iQhO,5:eO)nQhO,5:gO)sQhO,5:iO)xQhO,5:lO)}QhO,5:rOsQhO,5:wOsQhO,5:yOsQhO,5;POsQhO,5;ROsQhO,5;UOsQhO,5;YOsQhO,5;[O+^QhO,5;^O+eOPO'#CdOOOP,59q,59qO#{OPO,59qO+sQxO'#DYOOOP,59z,59zO$ZOPO,59zO+xQxO'#DcOOOP,5:P,5:PO$iOPO,5:PO+}QxO'#DhOOOP,5:W,5:WO$wOPO,5:WO,SQxO'#DrOOOP,5:`,5:`O%VOPO,5:`O,XQxO'#DwOOOS'#GQ'#GQO,^OSO'#ESO,fOSO,5:k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ertyName SubscriptExpression BinaryExpression contains CompareOp LogicOp AssignmentExpression AssignOp ) ( RangeExpression .. BooleanLiteral empty forloop tablerowloop continue StringLiteral NumberLiteral Filter | FilterName : , Tag TagName %} IfDirective Tag if EndTag endif Tag elsif Tag else UnlessDirective Tag unless EndTag endunless CaseDirective Tag case EndTag endcase Tag when ForDirective Tag for in Parameter ParameterName EndTag endfor TableDirective Tag tablerow EndTag endtablerow Tag break Tag continue Tag cycle Comment Tag comment CommentText EndTag endcomment RawDirective Tag raw RawText EndTag endraw Tag echo Tag render RenderParameter with for as Tag include Tag assign CaptureDirective Tag capture EndTag endcapture Tag increment Tag decrement Tag liquid IfDirective Tag if EndTag endif UnlessDirective Tag unless EndTag endunless Tag elsif Tag else CaseDirective Tag case EndTag endcase Tag when ForDirective Tag EndTag endfor TableDirective Tag tablerow EndTag endtablerow Tag break Tag Tag cycle Tag echo Tag render Tag include Tag assign CaptureDirective Tag capture EndTag endcapture Tag increment Tag decrement",
  maxTerm: 191,
  nodeProps: [
    ["closedBy", 1,"}}",-4,2,3,4,5,"%}",23,")"],
    ["openedBy", 9,"{{",22,"(",40,"{%"],
    ["group", -13,11,12,15,16,20,24,26,27,28,29,30,31,32,"Expression"]
  ],
  skippedNodes: [0,6],
  repeatNodeCount: 11,
  tokenData: ")e~RmXY!|YZ!|]^!|pq!|qr#_rs#juv$[wx$gxy%Syz%X{|%^|}&x}!O&}!O!P'Z!Q![&g![!]'k!^!_'p!_!`'x!`!a'p!c!}(Q!}#O(y#P#Q)O#R#S(Q#T#o(Q#p#q)T#q#r)Y%W;'S(Q;'S;:j(s<%lO(Q~#RS%O~XY!|YZ!|]^!|pq!|~#bP!_!`#e~#jOb~~#mUOY#jZr#jrs$Ps;'S#j;'S;=`$U<%lO#j~$UOo~~$XP;=`<%l#j~$_P#q#r$b~$gOx~~$jUOY$gZw$gwx$Px;'S$g;'S;=`$|<%lO$g~%PP;=`<%l$g~%XOg~~%^Of~P%aQ!O!P%g!Q![&gP%jP!Q![%mP%rRpP!Q![%m!g!h%{#X#Y%{P&OR{|&X}!O&X!Q![&_P&[P!Q![&_P&dPpP!Q![&_P&lSpP!O!P%g!Q![&g!g!h%{#X#Y%{~&}Ou~~'QRuv$[!O!P%g!Q![&g~'`Q]S!O!P'f!Q![%m~'kOi~~'pOt~~'uPb~!_!`#e~'}Pe~!_!`#e_(ZW^WwQ%RT}!O(Q!Q![(Q!c!}(Q#R#S(Q#T#o(Q%W;'S(Q;'S;:j(s<%lO(Q_(vP;=`<%l(Q~)OO%T~~)TO%S~~)YOr~~)]P#q#r)`~)eOX~",
  tokenizers: [base, raw, comment, inlineComment, 0, 1, 2, 3],
  topRules: {"Template":[0,7]},
  specialized: [{term: 187, get: (value) => spec_identifier[value] || -1},{term: 39, get: (value) => spec_TagName[value] || -1}],
  tokenPrec: 0
});

function completions(words, type) {
    return words.split(" ").map(label => ({ label, type }));
}
const Filters = /*@__PURE__*/completions("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");
const Tags = /*@__PURE__*/completions("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");
const Expressions = /*@__PURE__*/completions("empty forloop tablerowloop in with as", "keyword");
const forloop = /*@__PURE__*/completions("first index index0 last length rindex", "property");
const tablerowloop = /*@__PURE__*/completions("col col0 col_first col_last first index index0 last length rindex rindex0 row", "property");
function findContext(context) {
    var _a;
    let { state, pos } = context;
    let node = syntaxTree(state).resolveInner(pos, -1).enterUnfinishedNodesBefore(pos);
    let before = ((_a = node.childBefore(pos)) === null || _a === void 0 ? void 0 : _a.name) || node.name;
    if (node.name == "FilterName")
        return { type: "filter", node };
    if (context.explicit && before == "|")
        return { type: "filter" };
    if (node.name == "TagName")
        return { type: "tag", node };
    if (context.explicit && before == "{%")
        return { type: "tag" };
    if (node.name == "PropertyName" && node.parent.name == "MemberExpression")
        return { type: "property", node, target: node.parent };
    if (node.name == "." && node.parent.name == "MemberExpression")
        return { type: "property", target: node.parent };
    if (node.name == "MemberExpression" && before == ".")
        return { type: "property", target: node };
    if (node.name == "VariableName")
        return { type: "expression", from: node.from };
    let word = context.matchBefore(/[\w\u00c0-\uffff]+$/);
    if (word)
        return { type: "expression", from: word.from };
    if (context.explicit && node.name != "CommentText" && node.name != "StringLiteral" &&
        node.name != "NumberLiteral" && node.name != "InlineComment")
        return { type: "expression" };
    return null;
}
function resolveProperties(state, node, context, properties) {
    let path = [];
    for (;;) {
        let obj = node.getChild("Expression");
        if (!obj)
            return [];
        if (obj.name == "forloop") {
            return path.length ? [] : forloop;
        }
        else if (obj.name == "tablerowloop") {
            return path.length ? [] : tablerowloop;
        }
        else if (obj.name == "VariableName") {
            path.unshift(state.sliceDoc(obj.from, obj.to));
            break;
        }
        else if (obj.name == "MemberExpression") {
            let name = obj.getChild("PropertyName");
            if (name)
                path.unshift(state.sliceDoc(name.from, name.to));
            node = obj;
        }
        else {
            return [];
        }
    }
    return properties ? properties(path, state, context) : [];
}
/**
Returns a completion source for liquid templates. Optionally takes
a configuration that adds additional custom completions.
*/
function liquidCompletionSource(config = {}) {
    let filters = config.filters ? config.filters.concat(Filters) : Filters;
    let tags = config.tags ? config.tags.concat(Tags) : Tags;
    let exprs = config.variables ? config.variables.concat(Expressions) : Expressions;
    let { properties } = config;
    return (context) => {
        var _a;
        let cx = findContext(context);
        if (!cx)
            return null;
        let from = (_a = cx.from) !== null && _a !== void 0 ? _a : (cx.node ? cx.node.from : context.pos);
        let options;
        if (cx.type == "filter")
            options = filters;
        else if (cx.type == "tag")
            options = tags;
        else if (cx.type == "expression")
            options = exprs;
        else /* property */
            options = resolveProperties(context.state, cx.target, context, properties);
        return options.length ? { options, from, validFor: /^[\w\u00c0-\uffff]*$/ } : null;
    };
}
/**
This extension will, when the user types a `%` between two
matching braces, insert two percent signs instead and put the
cursor between them.
*/
const closePercentBrace = /*@__PURE__*/EditorView.inputHandler.of((view, from, to, text) => {
    if (text != "%" || from != to || view.state.doc.sliceString(from - 1, to + 1) != "{}")
        return false;
    view.dispatch(view.state.changeByRange(range => ({
        changes: { from: range.from, to: range.to, insert: "%%" },
        range: EditorSelection.cursor(range.from + 1)
    })), {
        scrollIntoView: true,
        userEvent: "input.type"
    });
    return true;
});

function directiveIndent(except) {
    return (context) => {
        let back = except.test(context.textAfter);
        return context.lineIndent(context.node.from) + (back ? 0 : context.unit);
    };
}
const tagLanguage = /*@__PURE__*/LRLanguage.define({
    name: "liquid",
    parser: /*@__PURE__*/parser.configure({
        props: [
            /*@__PURE__*/styleTags({
                "cycle comment endcomment raw endraw echo increment decrement liquid in with as": tags.keyword,
                "empty forloop tablerowloop": tags.atom,
                "if elsif else endif unless endunless case endcase for endfor tablerow endtablerow break continue": tags.controlKeyword,
                "assign capture endcapture": tags.definitionKeyword,
                "contains": tags.operatorKeyword,
                "render include": tags.moduleKeyword,
                VariableName: tags.variableName,
                TagName: tags.tagName,
                FilterName: /*@__PURE__*/tags.function(tags.variableName),
                PropertyName: tags.propertyName,
                CompareOp: tags.compareOperator,
                AssignOp: tags.definitionOperator,
                LogicOp: tags.logicOperator,
                NumberLiteral: tags.number,
                StringLiteral: tags.string,
                BooleanLiteral: tags.bool,
                InlineComment: tags.lineComment,
                CommentText: tags.blockComment,
                "{% %} {{ }}": tags.brace,
                "[ ]": tags.bracket,
                "( )": tags.paren,
                ".": tags.derefOperator,
                ", .. : |": tags.punctuation
            }),
            /*@__PURE__*/indentNodeProp.add({
                Tag: /*@__PURE__*/delimitedIndent({ closing: "%}" }),
                "UnlessDirective ForDirective TablerowDirective CaptureDirective": /*@__PURE__*/directiveIndent(/^\s*(\{%-?\s*)?end\w/),
                IfDirective: /*@__PURE__*/directiveIndent(/^\s*(\{%-?\s*)?(endif|else|elsif)\b/),
                CaseDirective: /*@__PURE__*/directiveIndent(/^\s*(\{%-?\s*)?(endcase|when)\b/),
            }),
            /*@__PURE__*/foldNodeProp.add({
                "UnlessDirective ForDirective TablerowDirective CaptureDirective IfDirective CaseDirective RawDirective Comment"(tree) {
                    let first = tree.firstChild, last = tree.lastChild;
                    if (!first || first.name != "Tag")
                        return null;
                    return { from: first.to, to: last.name == "EndTag" ? last.from : tree.to };
                }
            })
        ]
    }),
    languageData: {
        commentTokens: { line: "#" },
        indentOnInput: /^\s*{%-?\s*(?:end|elsif|else|when|)$/
    }
});
const baseHTML = /*@__PURE__*/html();
function makeLiquid(base) {
    return tagLanguage.configure({
        wrap: parseMixed(node => node.type.isTop ? {
            parser: base.parser,
            overlay: n => n.name == "Text" || n.name == "RawText"
        } : null)
    }, "liquid");
}
/**
A language provider for Liquid templates.
*/
const liquidLanguage = /*@__PURE__*/makeLiquid(baseHTML.language);
/**
Liquid template support.
*/
function liquid(config = {}) {
    let base = config.base || baseHTML;
    let lang = base.language == baseHTML.language ? liquidLanguage : makeLiquid(base.language);
    return new LanguageSupport(lang, [
        base.support,
        lang.data.of({ autocomplete: liquidCompletionSource(config) }),
        base.language.data.of({ closeBrackets: { brackets: ["{"] } }),
        closePercentBrace
    ]);
}

export { closePercentBrace, liquid, liquidCompletionSource, liquidLanguage };
