datajunction-ui
Version:
DataJunction UI
1,365 lines • 198 kB
JavaScript
import { jsx as I, jsxs as pe, Fragment as He } from "react/jsx-runtime";
import * as J from "react";
import { useMemo as ke, useCallback as We, useRef as cn, useState as Ge, useEffect as ze, createContext as Fn, useContext as un, forwardRef as Bn, Fragment as Mn } from "react";
import { ac as hn, bw as mt, D as jn, N as Un, aa as ma, aP as Hn, i as qn } from "./index-n79cxNwC.js";
/* empty css */
const Qn = {
hljs: {
display: "block",
overflowX: "auto",
padding: "0.5em",
background: "#002b36",
color: "#839496"
},
"hljs-comment": {
color: "#586e75"
},
"hljs-quote": {
color: "#586e75"
},
"hljs-keyword": {
color: "#859900"
},
"hljs-selector-tag": {
color: "#859900"
},
"hljs-addition": {
color: "#859900"
},
"hljs-number": {
color: "#2aa198"
},
"hljs-string": {
color: "#2aa198"
},
"hljs-meta .hljs-meta-string": {
color: "#2aa198"
},
"hljs-literal": {
color: "#2aa198"
},
"hljs-doctag": {
color: "#2aa198"
},
"hljs-regexp": {
color: "#2aa198"
},
"hljs-title": {
color: "#268bd2"
},
"hljs-section": {
color: "#268bd2"
},
"hljs-name": {
color: "#268bd2"
},
"hljs-selector-id": {
color: "#268bd2"
},
"hljs-selector-class": {
color: "#268bd2"
},
"hljs-attribute": {
color: "#b58900"
},
"hljs-attr": {
color: "#b58900"
},
"hljs-variable": {
color: "#b58900"
},
"hljs-template-variable": {
color: "#b58900"
},
"hljs-class .hljs-title": {
color: "#b58900"
},
"hljs-type": {
color: "#b58900"
},
"hljs-symbol": {
color: "#cb4b16"
},
"hljs-bullet": {
color: "#cb4b16"
},
"hljs-subst": {
color: "#cb4b16"
},
"hljs-meta": {
color: "#cb4b16"
},
"hljs-meta .hljs-keyword": {
color: "#cb4b16"
},
"hljs-selector-attr": {
color: "#cb4b16"
},
"hljs-selector-pseudo": {
color: "#cb4b16"
},
"hljs-link": {
color: "#cb4b16"
},
"hljs-built_in": {
color: "#dc322f"
},
"hljs-deletion": {
color: "#dc322f"
},
"hljs-formula": {
background: "#073642"
},
"hljs-emphasis": {
fontStyle: "italic"
},
"hljs-strong": {
fontWeight: "bold"
}
};
function Wn({
id: e,
state: t,
engine_name: a,
engine_version: s,
errors: o,
links: l,
output_table: h,
scheduled: i,
started: d,
finished: u,
numRows: p,
isList: v = !1
}) {
return v === !1 ? /* @__PURE__ */ I("div", { className: "table-responsive", children: /* @__PURE__ */ pe("table", { className: "card-inner-table table", children: [
/* @__PURE__ */ I("thead", { className: "fs-7 fw-bold text-gray-400 border-bottom-0", children: /* @__PURE__ */ pe("tr", { children: [
/* @__PURE__ */ I("th", { children: "Query ID" }),
/* @__PURE__ */ I("th", { children: "Engine" }),
/* @__PURE__ */ I("th", { children: "State" }),
/* @__PURE__ */ I("th", { children: "Scheduled" }),
/* @__PURE__ */ I("th", { children: "Started" }),
/* @__PURE__ */ I("th", { children: "Errors" }),
/* @__PURE__ */ I("th", { children: "Links" }),
/* @__PURE__ */ I("th", { children: "Output Table" }),
/* @__PURE__ */ I("th", { children: "Number of Rows" })
] }) }),
/* @__PURE__ */ I("tbody", { children: /* @__PURE__ */ pe("tr", { children: [
/* @__PURE__ */ I("td", { children: /* @__PURE__ */ I("span", { className: "rounded-pill badge bg-secondary-soft", children: e }) }),
/* @__PURE__ */ I("td", { children: /* @__PURE__ */ pe("span", { className: "rounded-pill badge bg-secondary-soft", children: [
a,
" - ",
s
] }) }),
/* @__PURE__ */ I("td", { children: t }),
/* @__PURE__ */ I("td", { children: i }),
/* @__PURE__ */ I("td", { children: d }),
/* @__PURE__ */ I("td", { children: o != null && o.length ? o.map((N, _) => /* @__PURE__ */ I("p", { children: /* @__PURE__ */ I("span", { className: "rounded-pill badge bg-secondary-error", children: N }) }, `error-${_}`)) : /* @__PURE__ */ I(He, {}) }),
/* @__PURE__ */ I("td", { children: l != null && l.length ? l.map((N, _) => /* @__PURE__ */ I("p", { children: /* @__PURE__ */ I("a", { href: N, target: "_blank", rel: "noreferrer", children: N }) }, _)) : /* @__PURE__ */ I(He, {}) }),
/* @__PURE__ */ I("td", { children: h }),
/* @__PURE__ */ I("td", { children: p })
] }) })
] }) }) : /* @__PURE__ */ I("div", { className: "rightbottom", children: /* @__PURE__ */ pe("ul", { style: { padding: "20px" }, children: [
/* @__PURE__ */ pe("li", { className: "query-info", children: [
/* @__PURE__ */ I("label", { children: "Query ID" }),
" ",
/* @__PURE__ */ I("span", { className: "tag_value rounded-pill badge", children: l != null && l.length ? /* @__PURE__ */ I(
"a",
{
href: l[l.length - 1],
target: "_blank",
rel: "noreferrer",
children: e
}
) : e })
] }),
/* @__PURE__ */ pe("li", { className: "query-info", children: [
/* @__PURE__ */ I("label", { children: "State" }),
/* @__PURE__ */ I("span", { className: "tag_value rounded-pill badge", children: t })
] }),
/* @__PURE__ */ pe("li", { className: "query-info", children: [
/* @__PURE__ */ I("label", { children: "Engine" }),
" ",
/* @__PURE__ */ pe("span", { className: "tag_value rounded-pill badge", children: [
a,
" - ",
s
] })
] }),
/* @__PURE__ */ pe("li", { className: "query-info", children: [
/* @__PURE__ */ I("label", { children: "Scheduled" }),
" ",
i
] }),
/* @__PURE__ */ pe("li", { className: "query-info", children: [
/* @__PURE__ */ I("label", { children: "Started" }),
" ",
d
] }),
/* @__PURE__ */ pe("li", { className: "query-info", children: [
/* @__PURE__ */ I("label", { children: "Finished" }),
" ",
u
] }),
/* @__PURE__ */ pe("li", { className: "query-info", children: [
/* @__PURE__ */ I("label", { children: "Logs" }),
" ",
o != null && o.length ? o.map((N, _) => /* @__PURE__ */ I(
"div",
{
style: {
height: "800px",
width: "80%",
overflow: "scroll",
borderRadius: "0",
border: "1px solid #ccc"
},
className: "queryrunner-query",
children: /* @__PURE__ */ I(
hn,
{
language: "javascript",
style: Qn,
wrapLines: !0,
children: N
}
)
},
`error-${_}`
)) : /* @__PURE__ */ I(He, {})
] }),
/* @__PURE__ */ pe("li", { className: "query-info", children: [
/* @__PURE__ */ I("label", { children: "Links:" }),
" ",
l != null && l.length ? l.map((N, _) => /* @__PURE__ */ I("p", { children: /* @__PURE__ */ I("a", { href: N, target: "_blank", rel: "noreferrer", children: N }) }, _)) : /* @__PURE__ */ I(He, {})
] }),
/* @__PURE__ */ pe("li", { className: "query-info", children: [
/* @__PURE__ */ I("label", { children: "Output Table:" }),
" ",
h
] }),
/* @__PURE__ */ pe("li", { className: "query-info", children: [
/* @__PURE__ */ I("label", { children: "Rows:" }),
" ",
p
] })
] }) });
}
function dn(e) {
var t, a, s = "";
if (typeof e == "string" || typeof e == "number") s += e;
else if (typeof e == "object") if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (a = dn(e[t])) && (s && (s += " "), s += a);
else for (t in e) e[t] && (s && (s += " "), s += t);
return s;
}
function Ee() {
for (var e, t, a = 0, s = ""; a < arguments.length; ) (e = arguments[a++]) && (t = dn(e)) && (s && (s += " "), s += t);
return s;
}
var $n = Object.defineProperty, Jn = (e, t) => {
for (var a in t)
$n(e, a, { get: t[a], enumerable: !0 });
}, at = ({
className: e,
handleOnClick: t,
label: a,
title: s,
disabled: o,
disabledTranslation: l,
testID: h
}) => /* @__PURE__ */ J.createElement(
"button",
{
type: "button",
"data-testid": h,
disabled: o && !l,
className: e,
title: l && o ? l.title : s,
onClick: (i) => t(i)
},
l && o ? l.label : a
);
at.displayName = "ActionElement";
var pn = Bn(
({ className: e, label: t, title: a, testID: s }, o) => /* @__PURE__ */ J.createElement("span", { "data-testid": s, ref: o, className: e, title: a }, t)
);
pn.displayName = "DragHandle";
var mn = "~", Qt = "------", ga = mn, Yn = Qt, Xn = Qt, va = mn, zn = Qt, Kn = Qt, Ca = ",", Ra = {
fields: {
title: "Fields",
placeholderName: ga,
placeholderLabel: Yn,
placeholderGroupLabel: Xn
},
operators: {
title: "Operators",
placeholderName: va,
placeholderLabel: zn,
placeholderGroupLabel: Kn
},
value: {
title: "Value"
},
removeRule: {
label: "x",
title: "Remove rule"
},
removeGroup: {
label: "x",
title: "Remove group"
},
addRule: {
label: "+Rule",
title: "Add rule"
},
addGroup: {
label: "+Group",
title: "Add group"
},
combinators: {
title: "Combinators"
},
notToggle: {
label: "Not",
title: "Invert this group"
},
cloneRule: {
label: "⧉",
title: "Clone rule"
},
cloneRuleGroup: {
label: "⧉",
title: "Clone group"
},
dragHandle: {
label: "⁞⁞",
title: "Drag handle"
},
lockRule: {
label: "🔓",
title: "Lock rule"
},
lockGroup: {
label: "🔓",
title: "Lock group"
},
lockRuleDisabled: {
label: "🔒",
title: "Unlock rule"
},
lockGroupDisabled: {
label: "🔒",
title: "Unlock group"
},
valueSourceSelector: {
title: "Value source"
}
}, Zn = [
{ name: "=", label: "=" },
{ name: "!=", label: "!=" },
{ name: "<", label: "<" },
{ name: ">", label: ">" },
{ name: "<=", label: "<=" },
{ name: ">=", label: ">=" },
{ name: "contains", label: "contains" },
{ name: "beginsWith", label: "begins with" },
{ name: "endsWith", label: "ends with" },
{ name: "doesNotContain", label: "does not contain" },
{ name: "doesNotBeginWith", label: "does not begin with" },
{ name: "doesNotEndWith", label: "does not end with" },
{ name: "null", label: "is null" },
{ name: "notNull", label: "is not null" },
{ name: "in", label: "in" },
{ name: "notIn", label: "not in" },
{ name: "between", label: "between" },
{ name: "notBetween", label: "not between" }
], Wt = [
{ name: "and", label: "AND" },
{ name: "or", label: "OR" }
];
[
...Wt
];
var ie = {
queryBuilder: "queryBuilder",
ruleGroup: "ruleGroup",
header: "ruleGroup-header",
body: "ruleGroup-body",
combinators: "ruleGroup-combinators",
addRule: "ruleGroup-addRule",
addGroup: "ruleGroup-addGroup",
cloneRule: "rule-cloneRule",
cloneGroup: "ruleGroup-cloneGroup",
removeGroup: "ruleGroup-remove",
notToggle: "ruleGroup-notToggle",
rule: "rule",
fields: "rule-fields",
operators: "rule-operators",
value: "rule-value",
removeRule: "rule-remove",
betweenRules: "betweenRules",
valid: "queryBuilder-valid",
invalid: "queryBuilder-invalid",
dndDragging: "dndDragging",
dndOver: "dndOver",
dragHandle: "queryBuilder-dragHandle",
disabled: "queryBuilder-disabled",
lockRule: "rule-lock",
lockGroup: "ruleGroup-lock",
valueSource: "rule-valueSource",
valueListItem: "rule-value-list-item"
}, e1 = {
queryBuilder: "",
ruleGroup: "",
header: "",
body: "",
combinators: "",
addRule: "",
addGroup: "",
cloneRule: "",
cloneGroup: "",
removeGroup: "",
notToggle: "",
rule: "",
fields: "",
operators: "",
value: "",
removeRule: "",
dragHandle: "",
lockRule: "",
lockGroup: "",
valueSource: ""
}, Oe = {
rule: "rule",
ruleGroup: "rule-group",
inlineCombinator: "inline-combinator",
addGroup: "add-group",
removeGroup: "remove-group",
cloneGroup: "clone-group",
cloneRule: "clone-rule",
addRule: "add-rule",
removeRule: "remove-rule",
combinators: "combinators",
fields: "fields",
operators: "operators",
valueEditor: "value-editor",
notToggle: "not-toggle",
dragHandle: "drag-handle",
lockRule: "lock-rule",
lockGroup: "lock-group",
valueSourceSelector: "value-source-selector"
}, Ue = {
parentPathDisabled: "action aborted: parent path disabled",
pathDisabled: "action aborted: path is disabled",
onAddRuleFalse: "onAddRule callback returned false",
onAddGroupFalse: "onAddGroup callback returned false",
onRemoveFalse: "onRemove callback returned false",
add: "rule or group added",
remove: "rule or group removed",
update: "rule or group updated",
move: "rule or group moved"
}, fn = ({
component: e,
independentCombinators: t,
...a
}) => /* @__PURE__ */ J.createElement("div", { className: ie.betweenRules, "data-testid": Oe.inlineCombinator }, /* @__PURE__ */ J.createElement(e, { ...a, testID: Oe.combinators }));
fn.displayName = "InlineCombinator";
var bn = ({
className: e,
handleOnChange: t,
title: a,
label: s,
checked: o,
disabled: l,
testID: h
}) => /* @__PURE__ */ J.createElement("label", { "data-testid": h, className: e, title: a }, /* @__PURE__ */ J.createElement(
"input",
{
type: "checkbox",
onChange: (i) => t(i.target.checked),
checked: !!o,
disabled: l
}
), s);
bn.displayName = "NotToggle";
var t1 = (e, t = Ca) => typeof e == "string" ? e.split(`\\${t}`).map((a) => a.split(t)).reduce((a, s, o) => o === 0 ? s : [
...a.slice(0, a.length - 1),
`${a[a.length - 1]}${t}${s[0]}`,
...s.slice(1)
], []) : [], xa = (e, t = Ca) => e.map((a) => `${a ?? ""}`.replaceAll(t, `\\${t}`)).join(t), Le = (e) => typeof e == "string" ? e.trim() : e, Pe = (e) => Array.isArray(e) ? e.map(Le) : typeof e == "string" ? t1(e, Ca).filter((t) => !/^\s*$/.test(t)).map((t) => t.trim()) : typeof e == "number" ? [e] : [], Ka = (e) => typeof e == "object" && "rules" in e ? yn(e) : e, yn = (e) => {
const t = [], a = (o) => t.push(Ka(o));
let s = 0;
for (let o = 0; o < e.rules.length; o += 2)
if (e.rules.length === 1)
a(e.rules[0]);
else if (e.rules[o + 1] === "and") {
s = o;
let l = 1;
for (; e.rules[s + l] === "and"; )
o += 2, l += 2;
t.push({
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error TS can't keep track of odd/even indexes here
rules: e.rules.slice(s, o + 1).map(Ka)
}), o -= 2;
} else e.rules[o + 1] === "or" && (o === 0 || o === e.rules.length - 3 ? ((o === 0 || e.rules[o - 1] === "or") && a(e.rules[o]), a(e.rules[o + 1]), o === e.rules.length - 3 && a(e.rules[o + 2])) : (e.rules[o - 1] === "and" || a(e.rules[o]), a(e.rules[o + 1])));
return (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error TS still thinks returnArray has length 0
t.length === 1 && typeof t[0] == "object" && "rules" in t[0] ? { ...e, ...t[0] } : { ...e, rules: t }
);
}, Ea = (e) => {
const t = yn(e), a = t.rules.map(
(l) => typeof l == "string" || !("rules" in l) ? l : Ea(l)
), s = a.length < 2 ? "and" : a[1], o = a.filter((l) => typeof l != "string");
return { ...t, combinator: s, rules: o };
}, nt = (e) => Array.isArray(e) && e.length > 0 && "options" in e[0], gn = (e, t) => (nt(e) ? e.flatMap((a) => a.options) : e).find((a) => a.name === t), Xe = (e) => !Array.isArray(e) || e.length === 0 ? null : nt(e) ? e[0].options[0].name : e[0].name, vn = (e, t, a) => {
if (!e.comparator) {
const o = (l) => l.name !== e.name;
return nt(t) ? t.map((l) => ({
...l,
options: l.options.filter(o)
})) : t.filter(o);
}
const s = (o) => e.name === o.name ? !1 : typeof e.comparator == "string" ? e[e.comparator] === o[e.comparator] : e.comparator(o, a);
return nt(t) ? t.map((o) => ({ ...o, options: o.options.filter(s) })).filter((o) => o.options.length > 0) : t.filter(s);
}, Rn = /^\s*[+-]?(\d+|\d*\.\d+|\d+\.\d*)([Ee][+-]?\d+)?\s*$/, It = (e) => e === null || typeof e != "object" ? !1 : Object.getPrototypeOf(e) === Object.prototype, Oa = (e, { parseNumbers: t }) => typeof e == "bigint" || typeof e == "number" ? e : t && (t === "native" || Rn.test(e)) ? parseFloat(e) : e, En = (e) => {
switch (e.toLowerCase()) {
case "null":
return "is null";
case "notnull":
return "is not null";
case "notin":
return "not in";
case "notbetween":
return "not between";
case "contains":
case "beginswith":
case "endswith":
return "like";
case "doesnotcontain":
case "doesnotbeginwith":
case "doesnotendwith":
return "not like";
default:
return e;
}
}, Za = {
"=": "$eq",
"!=": "$ne",
"<": "$lt",
"<=": "$lte",
">": "$gt",
">=": "$gte",
in: "$in",
notIn: "$nin"
}, en = {
and: "&&",
or: "||"
}, _n = (e) => ({
...e,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error TS doesn't keep track of odd/even indexes here
rules: e.rules.map((t) => {
if (typeof t == "string")
return t;
if ("rules" in t)
return _n(t);
let { value: a } = t;
return typeof a == "string" && (a = Oa(a, { parseNumbers: !0 })), { ...t, value: a };
})
}), Rt = (e) => typeof e == "string" && e.length > 0 || typeof e == "number" && !isNaN(e) || typeof e != "string" && typeof e != "number", Ne = (e, t) => t && (typeof e == "number" || typeof e == "bigint" || typeof e == "string" && Rn.test(e)), a1 = (e) => e.length >= 3, Ia = (e = ["", ""]) => Array.isArray(e) ? e : typeof e == "string" ? [e, e] : e ?? ["", ""], jt = (e) => /^(does)?not/i.test(e), ht = (e, t) => typeof e != "string" || !t ? e : e.replaceAll('"', '\\"'), tn = ({ field: e, operator: t, value: a, valueSource: s }, { escapeQuotes: o, parseNumbers: l } = {}) => {
const h = s === "field", i = t.replace(/^=$/, "=="), d = typeof a == "number" || typeof a == "boolean" || typeof a == "bigint" || Ne(a, l);
switch (i) {
case "<":
case "<=":
case "==":
case "!=":
case ">":
case ">=":
return `${e} ${i} ${h || d ? Le(a) : `"${ht(a, o)}"`}`;
case "contains":
case "doesNotContain":
return `${jt(i) ? "!" : ""}${e}.contains(${h ? Le(a) : `"${ht(a, o)}"`})`;
case "beginsWith":
case "doesNotBeginWith":
return `${jt(i) ? "!" : ""}${e}.startsWith(${h ? Le(a) : `"${ht(a, o)}"`})`;
case "endsWith":
case "doesNotEndWith":
return `${jt(i) ? "!" : ""}${e}.endsWith(${h ? Le(a) : `"${ht(a, o)}"`})`;
case "null":
return `${e} == null`;
case "notNull":
return `${e} != null`;
case "in":
case "notIn": {
const u = jt(i), p = Pe(a);
return p.length > 0 ? `${u ? "!(" : ""}${e} in [${p.map(
(v) => h || Ne(v, l) ? `${Le(v)}` : `"${ht(v, o)}"`
).join(", ")}]${u ? ")" : ""}` : "";
}
case "between":
case "notBetween": {
const u = Pe(a);
if (u.length >= 2 && u[0] && u[1]) {
const [p, v] = u, N = Ne(p, !0) ? parseFloat(p) : NaN, _ = Ne(v, !0) ? parseFloat(v) : NaN;
let M = isNaN(N) ? h ? `${p}` : `"${ht(p, o)}"` : N, z = isNaN(_) ? h ? `${v}` : `"${ht(v, o)}"` : _;
if (M === N && z === _ && _ < N) {
const te = _;
z = N, M = te;
}
return t === "between" ? `(${e} >= ${M} && ${e} <= ${z})` : `(${e} < ${M} || ${e} > ${z})`;
} else
return "";
}
}
return "";
}, Ye = (e) => typeof e != "string" ? e : e.replaceAll("\\", "\\\\").replaceAll('"', '\\"'), an = ({ field: e, operator: t, value: a, valueSource: s }, { parseNumbers: o } = {}) => {
const l = s === "field", h = typeof a == "number" || typeof a == "boolean" || typeof a == "bigint" || Ne(a, o);
if (t === "=" && !l)
return `{"${e}":${h ? Le(a) : `"${Ye(a)}"`}}`;
switch (t) {
case "<":
case "<=":
case "=":
case "!=":
case ">":
case ">=": {
const i = Za[t];
return l ? `{"$expr":{"${i}":["$${e}","$${a}"]}}` : `{"${e}":{"${i}":${h ? Le(a) : `"${Ye(a)}"`}}}`;
}
case "contains":
return l ? `{"$where":"this.${e}.includes(this.${a})"}` : `{"${e}":{"$regex":"${Ye(a)}"}}`;
case "beginsWith":
return l ? `{"$where":"this.${e}.startsWith(this.${a})"}` : `{"${e}":{"$regex":"^${Ye(a)}"}}`;
case "endsWith":
return l ? `{"$where":"this.${e}.endsWith(this.${a})"}` : `{"${e}":{"$regex":"${Ye(a)}$"}}`;
case "doesNotContain":
return l ? `{"$where":"!this.${e}.includes(this.${a})"}` : `{"${e}":{"$not":{"$regex":"${Ye(a)}"}}}`;
case "doesNotBeginWith":
return l ? `{"$where":"!this.${e}.startsWith(this.${a})"}` : `{"${e}":{"$not":{"$regex":"^${Ye(a)}"}}}`;
case "doesNotEndWith":
return l ? `{"$where":"!this.${e}.endsWith(this.${a})"}` : `{"${e}":{"$not":{"$regex":"${Ye(a)}$"}}}`;
case "null":
return `{"${e}":null}`;
case "notNull":
return `{"${e}":{"$ne":null}}`;
case "in":
case "notIn": {
const i = Pe(a);
return i.length > 0 ? l ? `{"$where":"${t === "notIn" ? "!" : ""}[${i.map((d) => `this.${d}`).join(",")}].includes(this.${e})"}` : `{"${e}":{"${Za[t]}":[${i.map(
(d) => Ne(d, o) ? `${Le(d)}` : `"${Ye(d)}"`
).join(",")}]}}` : "";
}
case "between":
case "notBetween": {
const i = Pe(a);
if (i.length >= 2 && Rt(i[0]) && Rt(i[1])) {
const [d, u] = i, p = Ne(d, !0) ? parseFloat(d) : NaN, v = Ne(u, !0) ? parseFloat(u) : NaN, N = l || !isNaN(p) ? `${d}` : `"${Ye(d)}"`, _ = l || !isNaN(v) ? `${u}` : `"${Ye(u)}"`;
return t === "between" ? l ? `{"$and":[{"$expr":{"$gte":["$${e}","$${N}"]}},{"$expr":{"$lte":["$${e}","$${_}"]}}]}` : `{"${e}":{"$gte":${N},"$lte":${_}}}` : l ? `{"$or":[{"$expr":{"$lt":["$${e}","$${N}"]}},{"$expr":{"$gt":["$${e}","$${_}"]}}]}` : `{"$or":[{"${e}":{"$lt":${N}}},{"${e}":{"$gt":${_}}}]}`;
} else
return "";
}
}
return "";
}, Ut = (e) => /^(does)?not/i.test(e), fa = (e, t) => t ? `!(${e})` : `${e}`, dt = (e, t) => typeof e != "string" || !t ? e : e.replaceAll("'", "\\'"), nn = ({ field: e, operator: t, value: a, valueSource: s }, { escapeQuotes: o, parseNumbers: l } = {}) => {
const h = s === "field", i = t.replace(/^=$/, "=="), d = typeof a == "number" || typeof a == "boolean" || typeof a == "bigint" || Ne(a, l);
switch (i) {
case "<":
case "<=":
case "==":
case "!=":
case ">":
case ">=":
return `${e} ${i} ${h || d ? Le(a) : `'${dt(a, o)}'`}`;
case "contains":
case "doesNotContain":
return fa(
`${e} matches ${h || d ? Le(a) : `'${dt(a, o)}'`}`,
Ut(i)
);
case "beginsWith":
case "doesNotBeginWith": {
const u = h ? `'^'.concat(${Le(a)})` : `'${typeof a == "string" && !a.startsWith("^") || d ? "^" : ""}${dt(a, o)}'`;
return fa(`${e} matches ${u}`, Ut(i));
}
case "endsWith":
case "doesNotEndWith": {
const u = h ? `${Le(a)}.concat('$')` : `'${dt(a, o)}${typeof a == "string" && !a.endsWith("$") || d ? "$" : ""}'`;
return fa(`${e} matches ${u}`, Ut(i));
}
case "null":
return `${e} == null`;
case "notNull":
return `${e} != null`;
case "in":
case "notIn": {
const u = Ut(i) ? "!" : "", p = Pe(a);
return p.length > 0 ? `${u}(${p.map(
(v) => `${e} == ${h || Ne(v, l) ? `${Le(v)}` : `'${dt(v, o)}'`}`
).join(" or ")})` : "";
}
case "between":
case "notBetween": {
const u = Pe(a);
if (u.length >= 2 && u[0] && u[1]) {
const [p, v] = u, N = Ne(p, !0) ? parseFloat(p) : NaN, _ = Ne(v, !0) ? parseFloat(v) : NaN;
let M = isNaN(N) ? h ? `${p}` : `'${dt(p, o)}'` : N, z = isNaN(_) ? h ? `${v}` : `'${dt(v, o)}'` : _;
if (M === N && z === _ && _ < N) {
const te = _;
z = N, M = te;
}
return t === "between" ? `(${e} >= ${M} and ${e} <= ${z})` : `(${e} < ${M} or ${e} > ${z})`;
} else
return "";
}
}
return "";
}, pt = (e, t) => t && typeof e == "string" ? e.replaceAll("'", "''") : e, _a = ({ operator: e, value: t, valueSource: a }, { escapeQuotes: s, parseNumbers: o, quoteFieldNamesWith: l } = {}) => {
const h = a === "field", [i, d] = Ia(l), u = e.toLowerCase(), p = (v) => `${i}${v}${d}`;
switch (u) {
case "null":
case "notnull":
return "";
case "in":
case "notin": {
const v = Pe(t);
return v.length > 0 ? `(${v.map(
(N) => h ? p(N) : Ne(N, o) ? `${Le(N)}` : `'${pt(N, s)}'`
).join(", ")})` : "";
}
case "between":
case "notbetween": {
const v = Pe(t);
if (v.length >= 2 && Rt(v[0]) && Rt(v[1])) {
const [N, _] = v;
return h ? `${p(N)} and ${p(_)}` : Ne(N, o) && Ne(_, o) ? `${Le(N)} and ${Le(_)}` : `'${pt(N, s)}' and '${pt(
_,
s
)}'`;
}
return "";
}
case "contains":
case "doesnotcontain":
return h ? `'%' || ${p(t)} || '%'` : `'%${pt(t, s)}%'`;
case "beginswith":
case "doesnotbeginwith":
return h ? `${p(t)} || '%'` : `'${pt(t, s)}%'`;
case "endswith":
case "doesnotendwith":
return h ? `'%' || ${p(t)}` : `'%${pt(t, s)}'`;
}
return typeof t == "boolean" ? t ? "TRUE" : "FALSE" : h ? p(t) : Ne(t, o) ? `${Le(t)}` : `'${pt(t, s)}'`;
}, n1 = (e) => e.replace(/^(=)$/, "$1=").replace(/^notNull$/i, "!=").replace(/^null$/i, "=="), Ct = (e, t) => /^(does)?not/i.test(e) ? { "!": t } : t, rn = ({ field: e, operator: t, value: a, valueSource: s }, { parseNumbers: o } = {}) => {
const l = s === "field", h = { var: e }, i = (d) => l ? { var: `${d}` } : Ne(d, o) ? parseFloat(d) : d;
switch (t) {
case "<":
case "<=":
case "=":
case "!=":
case ">":
case ">=":
return {
[n1(t)]: [h, i(a)]
};
case "null":
case "notNull":
return {
[`${t === "notNull" ? "!" : "="}=`]: [h, null]
};
case "in":
case "notIn": {
const d = Pe(a).map(i);
return d.length > 0 ? Ct(t, { in: [h, d] }) : !1;
}
case "between":
case "notBetween": {
const d = Pe(a);
if (d.length >= 2 && Rt(d[0]) && Rt(d[1])) {
let [u, p] = d;
if (!l && Ne(u, !0) && Ne(p, !0)) {
const N = parseFloat(u), _ = parseFloat(p);
if (_ < N) {
const M = _;
p = N, u = M;
} else
u = N, p = _;
} else l && (u = { var: u }, p = { var: p });
return Ct(t, { "<=": [u, h, p] });
}
return !1;
}
case "contains":
case "doesNotContain": {
const d = {
in: [i(a), h]
};
return Ct(t, d);
}
case "beginsWith":
case "doesNotBeginWith": {
const d = {
startsWith: [h, i(a)]
};
return Ct(t, d);
}
case "endsWith":
case "doesNotEndWith": {
const d = {
endsWith: [h, i(a)]
};
return Ct(t, d);
}
}
return !1;
}, r1 = (e, {
parseNumbers: t,
escapeQuotes: a,
quoteFieldNamesWith: s = ["", ""],
valueProcessor: o = _a
} = {}) => {
const l = o(e, { parseNumbers: t, escapeQuotes: a, quoteFieldNamesWith: s }), h = En(e.operator), i = h.toLowerCase();
if ((i === "in" || i === "not in" || i === "between" || i === "not between") && !l)
return "";
const [d, u] = Ia(s);
return `${d}${e.field}${u} ${h} ${l}`.trim();
}, sn = (e) => It(e) && typeof e.valid == "boolean", Qe = (e, t, a) => {
if (typeof t == "boolean")
return t;
if (sn(t))
return t.valid;
if (typeof a == "function" && !("rules" in e)) {
const s = a(e);
if (typeof s == "boolean")
return s;
if (sn(s))
return s.valid;
}
return !0;
}, Ht = (e) => {
const t = /* @__PURE__ */ new Set(), a = [];
return e.forEach((s) => {
t.has(s.name) || (t.add(s.name), a.push(s));
}), a;
}, ba = (e) => {
const t = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = [];
return e.forEach((o) => {
if (!t.has(o.label)) {
t.add(o.label);
const l = [];
o.options.forEach((h) => {
a.has(h.name) || (a.add(h.name), l.push(h));
}), s.push({ ...o, options: l });
}
}), s;
};
function on(e, t = {}) {
let a = "json", s = _a, o = null, l = ["", ""], h = () => !0, i = [], d = {}, u = "", p = ":", v = !1, N = ga, _ = va;
if (typeof t == "string")
a = t.toLowerCase(), a === "mongodb" ? o = an : a === "cel" ? o = tn : a === "spel" ? o = nn : a === "jsonlogic" && (o = rn);
else {
a = (t.format ?? "json").toLowerCase();
const { valueProcessor: V = null, ruleProcessor: T = null } = t;
typeof T == "function" && (o = T), s = typeof V == "function" ? (m, c) => a1(V) ? V(m.field, m.operator, m.value, m.valueSource) : V(m, c) : a === "mongodb" ? o ?? an : a === "cel" ? o ?? tn : a === "spel" ? o ?? nn : a === "jsonlogic" ? o ?? rn : _a, l = Ia(t.quoteFieldNamesWith), h = t.validator ?? (() => !0), i = t.fields ?? [], u = t.fallbackExpression ?? "", p = t.paramPrefix ?? ":", v = !!t.parseNumbers, N = t.placeholderFieldName ?? ga, _ = t.placeholderOperatorName ?? va;
}
if (u || (u = a === "mongodb" ? '"$and":[{"$expr":true}]' : a === "cel" || a === "spel" ? "1 == 1" : "(1 = 1)"), a === "json" || a === "json_without_ids") {
const V = v ? _n(e) : e;
return a === "json" ? JSON.stringify(V, null, 2) : JSON.stringify(V, [
"rules",
"field",
"value",
"operator",
"combinator",
"not",
"valueSource"
]);
}
if (typeof h == "function") {
const V = h(e);
if (typeof V == "boolean") {
if (V === !1)
return a === "parameterized" ? { sql: u, params: [] } : a === "parameterized_named" ? { sql: u, params: {} } : a === "mongodb" ? `{${u}}` : a === "jsonlogic" ? !1 : u;
} else
d = V;
}
const M = {};
Ht(i).forEach((V) => {
typeof V.validator == "function" && (M[V.name] = V.validator);
});
const te = (V) => {
let T, m;
if (V.id && (T = d[V.id]), i.length) {
const c = i.filter((f) => f.name === V.field);
if (c.length) {
const f = c[0];
typeof f.validator == "function" && (m = f.validator);
}
}
return [T, m];
};
if (a === "sql") {
const V = (T, m) => {
if (!Qe(T, d[T.id ?? /* istanbul ignore next */
""]))
return m ? u : "";
const c = T.rules.map((f) => {
if (typeof f == "string")
return f;
if ("rules" in f)
return V(f);
const [y, g] = te(f);
if (!Qe(f, y, g) || f.field === N || f.operator === _)
return "";
const b = (f.valueSource ?? "value") === "value";
return typeof o == "function" ? o(f, { parseNumbers: v, escapeQuotes: b, quoteFieldNamesWith: l }) : r1(f, {
parseNumbers: v,
escapeQuotes: b,
valueProcessor: s,
quoteFieldNamesWith: l
});
});
return c.length === 0 ? u : `${T.not ? "NOT " : ""}(${c.filter(Boolean).join("combinator" in T ? ` ${T.combinator} ` : " ")})`;
};
return V(e, !0);
}
if (a === "parameterized" || a === "parameterized_named") {
const V = a === "parameterized", T = [], m = {}, c = {}, f = (b) => (c[b] = (c[b] ?? 0) + 1, `${b}_${c[b]}`), y = (b) => {
const [L, j] = te(b);
if (!Qe(b, L, j) || b.field === N || b.operator === _)
return "";
const R = s(b, { parseNumbers: v, quoteFieldNamesWith: l }), O = En(b.operator);
if ((b.valueSource ?? "value") === "value") {
if (O.toLowerCase() === "is null" || O.toLowerCase() === "is not null")
return `${l[0]}${b.field}${l[1]} ${O}`;
if (O.toLowerCase() === "in" || O.toLowerCase() === "not in")
if (R) {
const B = Pe(b.value);
if (V)
return B.forEach(
(k) => T.push(Ne(k, v) ? parseFloat(k) : k)
), `${l[0]}${b.field}${l[1]} ${O} (${B.map(() => "?").join(", ")})`;
const D = [];
return B.forEach((k) => {
const q = f(b.field);
D.push(`${p}${q}`), m[q] = Ne(k, v) ? parseFloat(k) : k;
}), `${l[0]}${b.field}${l[1]} ${O} (${D.join(", ")})`;
} else
return "";
else if (O.toLowerCase() === "between" || O.toLowerCase() === "not between")
if (R) {
const B = Pe(b.value), [D, k] = B.slice(0, 2).map((U) => Ne(U, v) ? parseFloat(U) : U);
if (V)
return T.push(D), T.push(k), `${l[0]}${b.field}${l[1]} ${O} ? and ?`;
const q = f(b.field), H = f(b.field);
return m[q] = D, m[H] = k, `${l[0]}${b.field}${l[1]} ${O} ${p}${q} and ${p}${H}`;
} else
return "";
let P = b.value;
typeof b.value == "string" && (Ne(b.value, v) ? P = parseFloat(b.value) : P = /^'.*'$/g.test(R) ? R.replace(/(^'|'$)/g, "") : (
/* istanbul ignore next */
R
));
let F = "";
return V ? T.push(P) : (F = f(b.field), m[F] = P), `${l[0]}${b.field}${l[1]} ${O} ${V ? "?" : `${p}${F}`}`.trim();
} else {
const P = O.toLowerCase();
if ((P === "in" || P === "not in" || P === "between" || P === "not between") && !R)
return "";
}
return `${l[0]}${b.field}${l[1]} ${O} ${R}`.trim();
}, g = (b, L) => {
if (!Qe(b, d[b.id ?? /* istanbul ignore next */
""]))
return L ? u : "";
const j = b.rules.map((R) => typeof R == "string" ? R : "rules" in R ? g(R) : y(R));
return j.length === 0 ? u : `${b.not ? "NOT " : ""}(${j.filter(Boolean).join("combinator" in b ? ` ${b.combinator} ` : " ")})`;
};
return V ? { sql: g(e, !0), params: T } : { sql: g(e, !0), params: m };
}
if (a === "mongodb") {
const V = (c, f) => {
if (!Qe(c, d[c.id ?? /* istanbul ignore next */
""]))
return f ? u : "";
const y = `"$${c.combinator.toLowerCase()}"`;
let g = !1;
const b = c.rules.map((L) => {
if ("rules" in L) {
const O = V(L);
return O ? (g = !0, /^\{.+\}$/.test(O) ? O : `{${O}}`) : "";
}
const [j, R] = te(L);
return !Qe(L, j, R) || L.field === N || L.operator === _ ? "" : (o ?? s)(L, { parseNumbers: v });
}).filter(Boolean);
return b.length > 0 ? b.length === 1 && !g ? b[0] : `${y}:[${b.join(",")}]` : u;
}, T = "combinator" in e ? e : Ea(e), m = V(T, !0);
return /^\{.+\}$/.test(m) ? m : `{${m}}`;
}
if (a === "cel") {
const V = (T, m) => {
if (!Qe(T, d[T.id ?? /* istanbul ignore next */
""]))
return m ? u : "";
const c = T.rules.map((g) => {
if (typeof g == "string")
return en[g];
if ("rules" in g)
return V(g);
const [b, L] = te(g);
return !Qe(g, b, L) || g.field === N || g.operator === _ ? "" : (o ?? s)(g, {
parseNumbers: v,
escapeQuotes: (g.valueSource ?? "value") === "value"
});
}).filter(Boolean).join(
"combinator" in T ? ` ${en[T.combinator]} ` : " "
), [f, y] = T.not || !m ? [`${T.not ? "!" : ""}(`, ")"] : ["", ""];
return c ? `${f}${c}${y}` : u;
};
return V(e, !0);
}
if (a === "spel") {
const V = (T, m) => {
if (!Qe(T, d[T.id ?? /* istanbul ignore next */
""]))
return m ? u : "";
const c = T.rules.map((g) => {
if (typeof g == "string")
return g;
if ("rules" in g)
return V(g);
const [b, L] = te(g);
return !Qe(g, b, L) || g.field === N || g.operator === _ ? "" : (o ?? s)(g, {
parseNumbers: v,
escapeQuotes: (g.valueSource ?? "value") === "value"
});
}).filter(Boolean).join("combinator" in T ? ` ${T.combinator} ` : " "), [f, y] = T.not || !m ? [`${T.not ? "!" : ""}(`, ")"] : ["", ""];
return c ? `${f}${c}${y}` : u;
};
return V(e, !0);
}
if (a === "jsonlogic") {
const V = "combinator" in e ? e : Ea(e), T = (m) => {
if (!Qe(m, d[m.id ?? /* istanbul ignore next */
""]))
return !1;
const c = m.rules.map((y) => {
if ("rules" in y)
return T(y);
const [g, b] = te(y);
return !Qe(y, g, b) || y.field === N || y.operator === _ ? !1 : (o ?? s)(y, { parseNumbers: v });
}).filter(Boolean);
if (c.length === 0)
return !1;
const f = c.length === 1 ? c[0] : {
[m.combinator]: c
};
return m.not ? { "!": f } : f;
};
return T(V);
}
return "";
}
var xt = globalThis.crypto, Ze = () => "00-0-4-2-000".replace(
/[^-]/g,
(e) => ((Math.random() + ~~e) * 65536 >> e).toString(16).padStart(4, "0")
);
if (xt) {
if (typeof xt.randomUUID == "function")
Ze = () => xt.randomUUID();
else if (typeof xt.getRandomValues == "function") {
const e = [
"".padEnd(8, "x"),
"".padEnd(4, "x"),
// third section starts with the UUID version
"4".padEnd(4, "x"),
// First character of fourth section is limited to four specific characters
"y".padEnd(4, "x"),
"".padEnd(12, "x")
].join("-"), t = ["8", "9", "a", "b"], a = /[xy]/g, s = new Uint32Array(32);
Ze = () => {
xt.getRandomValues(s);
let o = -1;
return e.replaceAll(a, (l) => (o++, l === "y" ? t[s[o] % 4] : (s[o] % 16).toString(16)));
};
}
}
var s1 = (...e) => {
const t = (a) => Ee(e.filter(Boolean).map((s) => Ee(s[a])));
return {
queryBuilder: t("queryBuilder"),
ruleGroup: t("ruleGroup"),
header: t("header"),
body: t("body"),
combinators: t("combinators"),
addRule: t("addRule"),
addGroup: t("addGroup"),
cloneRule: t("cloneRule"),
cloneGroup: t("cloneGroup"),
removeGroup: t("removeGroup"),
rule: t("rule"),
fields: t("fields"),
operators: t("operators"),
value: t("value"),
removeRule: t("removeRule"),
notToggle: t("notToggle"),
dragHandle: t("dragHandle"),
lockRule: t("lockRule"),
lockGroup: t("lockGroup"),
valueSource: t("valueSource")
};
}, Nn = (e) => {
const t = typeof e == "boolean" ? e : typeof e == "object" && e !== null ? e.valid : null;
return typeof t == "boolean" ? t ? ie.valid : ie.invalid : "";
}, o1 = (e, t, a) => {
const s = e ?? /* istanbul ignore else */
{};
if (s.valueSources)
return typeof s.valueSources == "function" ? s.valueSources(t) : s.valueSources;
if (a) {
const o = a(s.name, t);
if (o)
return o;
}
return ["value"];
}, l1 = {};
Jn(l1, {
errorBothQueryDefaultQuery: () => u1,
errorControlledToUncontrolled: () => d1,
errorDeprecatedRuleGroupProps: () => i1,
errorDeprecatedRuleProps: () => c1,
errorEnabledDndWithoutReactDnD: () => p1,
errorUncontrolledToControlled: () => h1
});
var i1 = "A custom RuleGroup component has rendered a standard RuleGroup component with deprecated props. The combinator, not, and rules props should not be used. Instead, the full group object should be passed as the ruleGroup prop.", c1 = "A custom RuleGroup component has rendered a standard Rule component with deprecated props. The field, operator, value, and valueSource props should not be used. Instead, the full rule object should be passed as the rule prop.", u1 = "QueryBuilder was rendered with both query and defaultQuery props. QueryBuilder must be either controlled or uncontrolled (specify either the query prop, or the defaultQuery prop, but not both). Decide between using a controlled or uncontrolled query builder and remove one of these props. More info: https://reactjs.org/link/controlled-components", h1 = "QueryBuilder is changing from an uncontrolled component to be controlled. This is likely caused by the query changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled query builder for the lifetime of the component. More info: https://reactjs.org/link/controlled-components", d1 = "QueryBuilder is changing from a controlled component to be uncontrolled. This is likely caused by the query changing from defined to undefined, which should not happen. Decide between using a controlled or uncontrolled query builder for the lifetime of the component. More info: https://reactjs.org/link/controlled-components", p1 = "QueryBuilder was rendered with the enableDragAndDrop prop set to true, but either react-dnd or react-dnd-html5-backend (or both) was not installed. To enable drag-and-drop functionality, install both packages and wrap QueryBuilder in QueryBuilderDnD from @react-querybuilder/dnd.", m1 = (e) => {
const t = cn(null);
return ze(() => {
t.current = e;
}, [e]), t.current;
}, f1 = ({
defaultQuery: e,
queryProp: t,
isFirstRender: a
}) => {
const s = m1(!!t);
ze(() => {
}, [e, s, t, a]);
}, kn = (e, t) => {
ze(() => {
}, [t, e]);
}, Na = Object.keys, b1 = Object.entries, y1 = (e, t) => e === !1 ? !1 : e ? !0 : t !== !1, g1 = (e, t) => e ? !0 : e === !1 ? !1 : !!t, v1 = (e, t, a) => e ? y1(t, a) : g1(t, a), ya = (e, t, a) => ke(() => v1(e, t, a), [a, e, t]), R1 = (e) => {
const t = un(Aa), a = ya(
!0,
e.enableMountQueryChange,
t.enableMountQueryChange
), s = ya(!1, e.enableDragAndDrop, t.enableDragAndDrop) && t.enableDragAndDrop !== !1, o = ya(!1, e.debugMode, t.debugMode), l = ke(
() => s1(
e1,
t.controlClassnames,
e.controlClassnames
),
[t.controlClassnames, e.controlClassnames]
), h = ke(
() => ({
...P1,
...t.controlElements,
...e.controlElements
}),
[e.controlElements, t.controlElements]
), i = ke(() => {
const z = {};
return Na(e.translations).forEach((te) => {
const V = t.translations;
z[te] = {
...Ra[te],
...V,
...e.translations[te]
};
}), { ...Ra, ...z };
}, [t.translations, e.translations]), {
controlClassnames: d,
controlElements: u,
debugMode: p,
enableDragAndDrop: v,
enableMountQueryChange: N,
translations: _,
...M
} = t;
return {
controlClassnames: l,
controlElements: h,
debugMode: o,
enableDragAndDrop: s,
enableMountQueryChange: a,
translations: i,
...M
};
}, Sn = (e, t) => {
ze(() => {
}, []);
};
(function() {
var e = function(A, C, x, G) {
for (x = x || {}, G = A.length; G--; x[A[G]] = C)
;
return x;
}, t = [1, 27], a = [1, 31], s = [1, 32], o = [1, 28], l = [1, 29], h = [1, 30], i = [1, 33], d = [1, 34], u = [1, 18], p = [1, 26], v = [1, 12], N = [1, 13], _ = [1, 19], M = [1, 20], z = [1, 40], te = [1, 39], V = [1, 41], T = [1, 42], m = [1, 43], c = [1, 36], f = [1, 37], y = [1, 38], g = [5, 37, 43, 45, 49, 50, 53, 54, 55, 56, 60, 61, 62, 63], b = [1, 44], L = [1, 45], j = [1, 46], R = [5, 23, 24, 25, 26, 27, 28, 31, 37, 40, 43, 44, 45, 46, 49, 50, 53, 54, 55, 56, 60, 61, 62, 63], O = [7, 9, 10, 12, 13, 14, 16, 18, 21, 35, 40, 41, 44, 46], P = [2, 36], F = [1, 85], B = [43, 45, 50], D = [5, 37, 43, 45, 49, 50, 53, 61, 62, 63], k = [5, 37, 43, 45, 49, 50, 53, 54, 55, 56, 61, 62, 63], q = [2, 37], H = [49, 50], U = {
trace: function() {
},
yy: {},
symbols_: { error: 2, main: 3, expr: 4, EOF: 5, string_literal: 6, STRING_LIT: 7, bytes_literal: 8, b: 9, B: 10, number_literal: 11, INT_LIT: 12, UINT_LIT: 13, FLOAT_LIT: 14, boolean_literal: 15, BOOL_LIT: 16, null_literal: 17, NULL_LIT: 18, literal: 19, ident: 20, IDENT: 21, relop: 22, "==": 23, ">=": 24, ">": 25, "<=": 26, "<": 27, "!=": 28, relation: 29, member: 30, in: 31, list: 32, map: 33, negation: 34, "!": 35, negative: 36, "-": 37, unary: 38, primary: 39, DOT: 40, "(": 41, expr_list: 42, ")": 43, "[": 44, "]": 45, "{": 46, field_inits: 47, trailing_comma: 48, "}": 49, ",": 50, map_inits: 51, math_operation: 52, "+": 53, "*": 54, "/": 55, "%": 56, conditional_expr: 57, conditional_and: 58, conditional_or: 59, "?": 60, ":": 61, "&&": 62, "||": 63, $accept: 0, $end: 1 },
terminals_: { 2: "error", 5: "EOF", 7: "STRING_LIT", 9: "b", 10: "B", 12: "INT_LIT", 13: "UINT_LIT", 14: "FLOAT_LIT", 16: "BOOL_LIT", 18: "NULL_LIT", 21: "IDENT", 23: "==", 24: ">=", 25: ">", 26: "<=", 27: "<", 28: "!=", 31: "in", 35: "!", 37: "-", 40: "DOT", 41: "(", 43: ")", 44: "[", 45: "]", 46: "{", 49: "}", 50: ",", 53: "+", 54: "*", 55: "/", 56: "%", 60: "?", 61: ":", 62: "&&", 63: "||" },
productions_: [0, [3, 2], [6, 1], [8, 2], [8, 2], [11, 1], [11, 1], [11, 1], [15, 1], [17, 1], [19, 1], [19, 1], [19, 1], [19, 1], [19, 1], [20, 1], [22, 1], [22, 1], [22, 1], [22, 1], [22, 1], [22, 1], [29, 3], [29, 3], [29, 3], [34, 1], [34, 2], [36, 1], [36, 2], [38, 2], [30, 1], [30, 1], [30, 3], [30, 6], [30, 4], [30, 5], [48, 0], [48, 1], [39, 1], [39, 2], [39, 5], [39, 6], [39, 3], [39, 1], [39, 1], [39, 1], [32, 4], [33, 4], [52, 3], [52, 3], [52, 3], [52, 3], [52, 3], [4, 1], [4, 1], [4, 1], [4, 1], [4, 1], [4, 1], [57, 5], [58, 3], [59, 3], [42, 1], [42, 3], [47, 3], [47, 5], [51, 3], [51, 5]],
performAction: function(C, x, G, Y, K, S, Z) {
var E = S.length - 1;
switch (K) {
case 1:
return { nodeType: "Main", value: S[E - 1] };
case 2:
this.$ = { type: "StringLiteral", value: S[E] };
break;
case 3:
case 4:
this.$ = { type: "BytesLiteral", value: S[E] };
break;
case 5:
this.$ = { type: "IntegerLiteral", value: parseInt(S[E], /x/.test(S[E]) ? 16 : 10) };
break;
case 6:
this.$ = { type: "UnsignedIntegerLiteral", value: parseInt(S[E].replace(/u$/i, ""), /^0x/.test(S[E]) ? 16 : 10) };
break;
case 7:
this.$ = { type: "FloatLiteral", value: parseFloat(S[E]) };
break;
case 8:
this.$ = { type: "BooleanLiteral", value: S[E] === "true" };
break;
case 9:
this.$ = { type: "NullLiteral", value: null };
break;
case 10:
case 11:
case 12:
case 13:
case 14:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 38:
case 43:
case 44:
case 45:
case 53:
case 54:
case 55:
case 56:
case 57:
case 58:
this.$ = S[E];
break;
case 15:
this.$ = { type: "Identifier", value: S[E] };
break;
case 22:
case 23:
case 24:
this.$ = { type: "Relation", left: S[E - 2], operator: S[E - 1], right: S[E] };
break;
case 25:
case 27:
this.$ = 1;
break;
case 26:
case 28:
this.$ = this.$ += 1;
break;
case 29:
this.$ = { type: "Negation", negations: S[E - 1], value: S[E] };
break;
case 30:
case 31:
this.$ = S[E];
break;
case 32:
this.$ = { type: "Member", left: S[E - 2], right: S[E] };
break;
case 33:
this.$ = { type: "Member", left: S[E - 5], right: S[E - 3], list: S[E - 1] };
break;
case 34:
this.$ = { type: "DynamicPropertyAccessor", left: S[E - 3], right: S[E - 1] };
break;
case 35:
this.$ = { type: "FieldsObject", left: S[E - 4], list: S[E - 2], trailingComma: S[E - 1] };
break;
case 36:
this.$ = !1;
break;
case 37:
this.$ = !0;
break;
case 39:
this.$ = { type: "Property", value: S[E] };
break;
case 40:
this.$ = { type: "FunctionCall", name: S[E - 4], args: S[E - 2], trailingComma: S[E - 1] };
break;
case 41:
this.$ = { type: "Property", value: S[E - 4], args: S[E - 2], trailingComma: S[E - 1] };
break;
case 42:
this.$ = { type: "ExpressionGroup", value: S[E - 1] };
break;
case 46:
this.$ = { type: "List", value: S[E - 2], trailingComma: S[E - 1] };
break;
case 47:
this.$ = { type: "Map", value: S[E - 2], trailingComma: S[E - 1] };
break;
case 48:
this.$ = { type: "Addition", left: S[E - 2], right: S[E] };
break;
case 49:
this.$ = { type: "Subtraction", left: S[E - 2], right: S[E] };
break;
case 50:
this.$ = { type: "Multiplication", left: S[E - 2], right: S[E] };
break;
case 51:
this.$ = { type: "Division", left: S[E - 2], right: S[E] };
break;
case 52:
this.$ = { type: "Modulo", left: S[E - 2], right: S[E] };
break;
case 59:
this.$ = { type: "ConditionalExpr", condition: S[E - 4], valueIfTrue: S[E - 2], valueIfFalse: S[E] };
break;
case 60:
this.$ = { type: "ConditionalAnd", left: S[E - 2], right: S[E] };
break;
case 61:
this.$ = { type: "ConditionalOr", left: S[E - 2], right: S[E] };
break;
case 62:
this.$ = { type: "ExpressionList", value: [S[E]] };
break;
case 63:
this.$ = S[E - 2], this.$.value.push(S[E]);
break;
case 64:
this.$ = { type: "FieldInits", value: [{ type: "FieldInit", left: S[E - 2], right: S[E] }] };
break;
case 65:
this.$ = S[E - 4], this.$.value.push({ type: "FieldInit", left: S[E - 2], right: S[E] });
break;
case 66:
this.$ = { type: "MapInits", value: [{ type: "MapInit", left: S[E - 2], right: S[E] }] };
break;
case 67:
this.$ = S[E - 4], this.$.value.push({ type: "MapInit", left: S[E - 2], right: S[E] });
break;
}
},
table: [{ 3: 1, 4: 2, 6: 21, 7: t, 8: 23, 9: a, 10: s, 11: 22, 12: o, 13: l, 14: h, 15: 24, 16: i