import { af as EditorView, ag as EditorSelection, $ as LRLanguage, Y as styleTags, Z as tags, U as indentNodeProp, a7 as delimitedIndent, X as foldNodeProp, a0 as LanguageSupport, a2 as LRParser, a5 as syntaxTree, ah as html, ai as parseMixed, a1 as ExternalTokenizer } from './index-BIIHWu1p.js';
import './depth-CFY2W_Vf.js';
import './comlink-CsH1ih07.js';
import 'react';
import 'zustand';
import 'react-mosaic-component';
import './protobuf-BFCtaU7c.js';
import 'protobufjs/minimal';
import '@mui/material';
import './isArrayLikeObject-Bytw9p-q.js';
import './utils-Hzt3wxhG.js';
import './FoxgloveServer-h5m-pXp3.js';
import 'ms';
import './foxglove-protocol-BSYuI-q2.js';
import 'react-dnd';
import 'react-dnd-html5-backend';
import './i18next-IYI3-Nuv.js';
import '@emotion/react';
import 'object-assign';
import 'react/jsx-runtime';
import 'react-dom';
import 'react-syntax-highlighter/dist/esm/styles/prism';
import 'react-syntax-highlighter';
import 'extend';
import 'react-icons';
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;

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);

// This file was generated by lezer-generator. You probably shouldn't edit it.
const spec_identifier = {__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};
const spec_TagName = {__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};
const parser = /*@__PURE__*/LRParser.deserialize({
  version: 14,
  states: "HOQYOPOOOOOP'#F{'#F{OeOXO'#CdOsQWO'#CfO!bQ`O'#DQO#{OPO'#DTO$ZOPO'#D^O$iOPO'#DcO$wOPO'#DkO%VOPO'#DsO%eOSO'#EOO%jOQO'#EUO%oOPO'#EhOOOP'#G`'#G`OOOP'#G]'#G]OOOP'#Fz'#FzQYOPOOOOOP-E9y-E9yOOQO'#Cg'#CgO&`QpO,59QO&gQpO'#G^OsQWO'#CsOOQO'#G^'#G^OOOP,59l,59lO)PQWO,59lOsQWO,59pOsQWO,59tO)ZQWO,59vOsQWO,59yOsQWO,5:OOsQWO,5:SO!]QWO,5:WO!]QWO,5:`O)`QWO,5:dO)eQWO,5:fO)jQWO,5:hO)oQWO,5:kO)tQWO,5:qOsQWO,5:vOsQWO,5:xOsQWO,5;OOsQWO,5;QOsQWO,5;TOsQWO,5;XOsQWO,5;ZO+TQWO,5;]O+[OPO'#CdOOOP,59o,59oO#{OPO,59oO+jQ`O'#DWOOOP,59x,59xO$ZOPO,59xO+oQ`O'#DaOOOP,59},59}O$iOPO,59}O+tQ`O'#DfOOOP,5:V,5:VO$wOPO,5:VO+yQ`O'#DqOOOP,5:_,5:_O%VOPO,5:_O,OQ`O'#DvOOOS'#GQ'#GQO,TOSO'#ERO,]OSO,5:jOOOQ'#GR'#GRO,bOQO'#EXO,jOQO,5:pOOOP,5;S,5;SO%oOPO,5;SO,oQ`O'#EkOOOP-E9x-E9xO,tQ!bO,59SOsQWO,59VOsQWO,59VO,yQWO'#C|OOQO'#F|'#F|O-OQWO1G.lOOOP1G.l1G.lOsQWO,59VOsQWO,59ZO-WQpO,59_O-iQpO1G/WO-pQWO1G/WOOOP1G/W1G/WO-xQpO1G/[O.ZQpO1G/`OOOP1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VWX[!Q!T!W!Z!^!gQ!ocQ!uh^$b!o!u$g$v%O&o&sQ$g!tQ$v#UQ%O#XQ&o%qR&s%tQ$n!|S&U$n&jR&j%mQ&{&WQ&}&XW'Z&{&}'a'bQ'a'TR'b'UQ$s#RW&Z$s&m'P'cQ&m%pQ'P&]R'c'VQ!aYR$T!aQ!dZR$W!dQ$z#VR&`$zQ#e}Q%U#]Q%X#^Q%[#_Q%_#`Q%b#aQ%e#b_%g#e%U%X%[%_%b%eQ&r%rR'X&rm_OTUVWX[`!Q!T!W!Z!^!gQcRQ!seQ!thQ!wiQ!xjQ!zlQ!{mQ!|nQ#UvQ#VwQ#WxQ#XyQ#YzQ#Z{Q#[|Q$^!kQ$_!lQ$d!qQ$e!rQ%i#fQ%j#gQ%k#hQ%l#jQ%m#kQ%q#qQ%r#rQ%s#sQ%t#tQ%u#uQ%v#vQ%w#wQ&R$fQ&T$mQ&W$pQ&X$qQ&b${Q&v&QQ'T&kQ'U&lQ'_'RQ'e'YR'f'dm#d}#]#^#_#`#a#b#e%U%X%[%_%b%e",
  nodeNames: "⚠ {{ {% {% {% {% InlineComment Template Text }} Interpolation VariableName MemberExpression . PropertyName 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 RenderParameter Tag include Tag assign CaptureDirective Tag capture EndTag endcapture Tag increment Tag decrement",
  maxTerm: 189,
  nodeProps: [
    ["closedBy", 1,"}}",-4,2,3,4,5,"%}",22,")"],
    ["openedBy", 9,"{{",21,"(",38,"{%"],
    ["group", -12,11,12,15,19,23,25,26,27,28,29,30,31,"Expression"]
  ],
  skippedNodes: [0,6],
  repeatNodeCount: 11,
  tokenData: ")l~RlXY!yYZ!y]^!ypq!yqr#[rs#gst$Xuv$pwx${xy%hyz%m{|%r|}'^}!O'c!O!P'o!Q![&{![!](P!^!_(U!_!`(^!`!a(U!c!}(f#R#S(f#T#o(f#p#q)[#q#r)a%W;'S(f;'S;:j)U<%lO(f~#OS%O~XY!yYZ!y]^!ypq!y~#_P!_!`#b~#gOa~~#jUOY#gZr#grs#|s;'S#g;'S;=`$R<%lO#g~$ROn~~$UP;=`<%l#g~$^SU~OY$XZ;'S$X;'S;=`$j<%lO$X~$mP;=`<%l$X~$sP#q#r$v~${Ov~~%OUOY${Zw${wx#|x;'S${;'S;=`%b<%lO${~%eP;=`<%l${~%mOf~~%rOe~P%uQ!O!P%{!Q![&{P&OP!Q![&RP&WRoP!Q![&R!g!h&a#X#Y&aP&dR{|&m}!O&m!Q![&sP&pP!Q![&sP&xPoP!Q![&sP'QSoP!O!P%{!Q![&{!g!h&a#X#Y&a~'cO!^~~'fRuv$p!O!P%{!Q![&{~'tQ]S!O!P'z!Q![&R~(POh~~(UOs~~(ZPa~!_!`#b~(cPd~!_!`#b_(oV^WuQ%RT!Q![(f!c!}(f#R#S(f#T#o(f%W;'S(f;'S;:j)U<%lO(f_)XP;=`<%l(f~)aOq~~)dP#q#r)g~)lOX~",
  tokenizers: [base, raw, comment, 0, 1, 2, 3],
  topRules: {"Template":[0,7]},
  specialized: [{term: 187, get: (value) => spec_identifier[value] || -1},{term: 37, 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 contains", "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.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 };
