@react-querybuilder/core 8.14.4 → 8.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +201 -8
  2. package/dist/cjs/react-querybuilder_core.cjs.development.js +394 -58
  3. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  4. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +201 -8
  5. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  6. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  7. package/dist/{convertQuery-CeJSNn37.mjs → convertQuery-BeJJH9BI.mjs} +2 -2
  8. package/dist/convertQuery-BeJJH9BI.mjs.map +1 -0
  9. package/dist/{convertQuery-J8LpTG-7.js → convertQuery-Lx2HQa0m.js} +2 -2
  10. package/dist/convertQuery-Lx2HQa0m.js.map +1 -0
  11. package/dist/formatQuery.d.mts +24 -2
  12. package/dist/formatQuery.d.ts +24 -2
  13. package/dist/formatQuery.js +373 -47
  14. package/dist/formatQuery.js.map +1 -1
  15. package/dist/formatQuery.mjs +373 -48
  16. package/dist/formatQuery.mjs.map +1 -1
  17. package/dist/{import-BwQqExpO.d.mts → import-0wp72lLT.d.mts} +2 -2
  18. package/dist/{import-CrJf23Nf.d.ts → import-yRVJh7E1.d.ts} +2 -2
  19. package/dist/{index-CYT4Saz-.d.mts → index-D5TXNIzF.d.ts} +149 -5
  20. package/dist/{index-DBlQeLax.d.ts → index-Lht_Wq3V.d.mts} +149 -5
  21. package/dist/{objectUtils-ButT0Mng.js → objectUtils-Bzug_QfX.js} +2 -2
  22. package/dist/objectUtils-Bzug_QfX.js.map +1 -0
  23. package/dist/{objectUtils-C0WB-8ex.mjs → objectUtils-D96eEEzL.mjs} +2 -2
  24. package/dist/objectUtils-D96eEEzL.mjs.map +1 -0
  25. package/dist/parseCEL.d.mts +2 -2
  26. package/dist/parseCEL.d.ts +2 -2
  27. package/dist/parseCEL.js +35 -35
  28. package/dist/parseCEL.js.map +1 -1
  29. package/dist/parseCEL.mjs +35 -35
  30. package/dist/parseCEL.mjs.map +1 -1
  31. package/dist/parseJSONata.d.mts +2 -2
  32. package/dist/parseJSONata.d.ts +2 -2
  33. package/dist/parseJSONata.js +11 -11
  34. package/dist/parseJSONata.js.map +1 -1
  35. package/dist/parseJSONata.mjs +11 -11
  36. package/dist/parseJSONata.mjs.map +1 -1
  37. package/dist/parseJsonLogic.d.mts +2 -2
  38. package/dist/parseJsonLogic.d.ts +2 -2
  39. package/dist/parseJsonLogic.js +6 -6
  40. package/dist/parseJsonLogic.js.map +1 -1
  41. package/dist/parseJsonLogic.mjs +6 -6
  42. package/dist/parseJsonLogic.mjs.map +1 -1
  43. package/dist/parseMongoDB.d.mts +2 -2
  44. package/dist/parseMongoDB.d.ts +2 -2
  45. package/dist/parseMongoDB.js +6 -6
  46. package/dist/parseMongoDB.js.map +1 -1
  47. package/dist/parseMongoDB.mjs +6 -6
  48. package/dist/parseMongoDB.mjs.map +1 -1
  49. package/dist/parseSQL.d.mts +2 -2
  50. package/dist/parseSQL.d.ts +2 -2
  51. package/dist/parseSQL.js +16 -16
  52. package/dist/parseSQL.js.map +1 -1
  53. package/dist/parseSQL.mjs +16 -16
  54. package/dist/parseSQL.mjs.map +1 -1
  55. package/dist/parseSpEL.d.mts +2 -2
  56. package/dist/parseSpEL.d.ts +2 -2
  57. package/dist/parseSpEL.js +10 -10
  58. package/dist/parseSpEL.js.map +1 -1
  59. package/dist/parseSpEL.mjs +10 -10
  60. package/dist/parseSpEL.mjs.map +1 -1
  61. package/dist/{prepareQueryObjects-DO3qXriW.js → prepareQueryObjects-BoG5Rt8z.js} +6 -6
  62. package/dist/prepareQueryObjects-BoG5Rt8z.js.map +1 -0
  63. package/dist/{prepareQueryObjects-BfMlS4ql.mjs → prepareQueryObjects-uA10ZpZX.mjs} +6 -6
  64. package/dist/prepareQueryObjects-uA10ZpZX.mjs.map +1 -0
  65. package/dist/query-builder.css +1 -1
  66. package/dist/query-builder.css.map +1 -1
  67. package/dist/react-querybuilder_core.d.mts +201 -8
  68. package/dist/react-querybuilder_core.legacy-esm.d.ts +201 -8
  69. package/dist/react-querybuilder_core.legacy-esm.js +433 -89
  70. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  71. package/dist/react-querybuilder_core.mjs +393 -59
  72. package/dist/react-querybuilder_core.mjs.map +1 -1
  73. package/dist/react-querybuilder_core.production.d.mts +201 -8
  74. package/dist/react-querybuilder_core.production.mjs +1 -1
  75. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  76. package/dist/styles/_main.scss +4 -0
  77. package/dist/transformQuery.d.mts +1 -1
  78. package/dist/transformQuery.d.ts +1 -1
  79. package/dist/transformQuery.js +1 -1
  80. package/dist/transformQuery.mjs +1 -1
  81. package/dist/{utils-BlMGIhvx.mjs → utils-ChLG90DP.mjs} +3 -3
  82. package/dist/utils-ChLG90DP.mjs.map +1 -0
  83. package/dist/{utils-CZRhzje-.js → utils-Qwkq2Q0F.js} +3 -3
  84. package/dist/utils-Qwkq2Q0F.js.map +1 -0
  85. package/package.json +9 -14
  86. package/dist/convertQuery-CeJSNn37.mjs.map +0 -1
  87. package/dist/convertQuery-J8LpTG-7.js.map +0 -1
  88. package/dist/objectUtils-ButT0Mng.js.map +0 -1
  89. package/dist/objectUtils-C0WB-8ex.mjs.map +0 -1
  90. package/dist/prepareQueryObjects-BfMlS4ql.mjs.map +0 -1
  91. package/dist/prepareQueryObjects-DO3qXriW.js.map +0 -1
  92. package/dist/utils-BlMGIhvx.mjs.map +0 -1
  93. package/dist/utils-CZRhzje-.js.map +0 -1
@@ -412,6 +412,8 @@ const standardClassnames = {
412
412
  dndCopy: "dndCopy",
413
413
  dndGroup: "dndGroup",
414
414
  dndDropNotAllowed: "dndDropNotAllowed",
415
+ dndPreviewPosition: "dndPreviewPosition",
416
+ dndHidden: "dndHidden",
415
417
  dragHandle: "queryBuilder-dragHandle",
416
418
  disabled: "queryBuilder-disabled",
417
419
  muted: "queryBuilder-muted",
@@ -468,6 +470,8 @@ const defaultControlClassnames = {
468
470
  dndGroup: "",
469
471
  dndCopy: "",
470
472
  dndDropNotAllowed: "",
473
+ dndPreviewPosition: "",
474
+ dndHidden: "",
471
475
  disabled: "",
472
476
  valueListItem: "",
473
477
  branches: "",
@@ -612,7 +616,7 @@ const toArray = (a, { retainEmptyStrings } = {}) => Array.isArray(a) ? a.map((v)
612
616
  const nullFreeArray = (arr) => arr.every((el) => el === false || (el !== null && el !== void 0 ? el : false) !== false);
613
617
  //#endregion
614
618
  //#region src/utils/clsx.ts
615
- // istanbul ignore next
619
+ /* v8 ignore start -- @preserve */
616
620
  function toVal(mix) {
617
621
  let k;
618
622
  let y;
@@ -632,12 +636,13 @@ function toVal(mix) {
632
636
  }
633
637
  return str;
634
638
  }
639
+ /* v8 ignore stop -- @preserve */
635
640
  /**
636
641
  * Vendored/adapted version of the `clsx` package.
637
642
  *
638
643
  * **NOTE:** Prefer the official package from npm outside the context of React Query Builder.
639
644
  */
640
- // istanbul ignore next
645
+ // v8 ignore next
641
646
  function clsx(...args) {
642
647
  let i = 0;
643
648
  let tmp;
@@ -655,7 +660,7 @@ function clsx(...args) {
655
660
  /**
656
661
  * Converts a value to lowercase if it's a string, otherwise returns the value as is.
657
662
  */
658
- // istanbul ignore next
663
+ // v8 ignore next
659
664
  const lc = (v) => typeof v === "string" ? v.toLowerCase() : v;
660
665
  /**
661
666
  * Regex matching numeric strings. Passes for positive/negative integers, decimals,
@@ -689,7 +694,7 @@ const isRuleGroupType = (rg) => isRuleGroup(rg) && typeof rg.combinator === "str
689
694
  */
690
695
  const isRuleGroupTypeIC = (rg) => isRuleGroup(rg) && rg.combinator === void 0;
691
696
  //#endregion
692
- //#region \0@oxc-project+runtime@0.122.0/helpers/typeof.js
697
+ //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
693
698
  function _typeof(o) {
694
699
  "@babel/helpers - typeof";
695
700
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -699,7 +704,7 @@ function _typeof(o) {
699
704
  }, _typeof(o);
700
705
  }
701
706
  //#endregion
702
- //#region \0@oxc-project+runtime@0.122.0/helpers/toPrimitive.js
707
+ //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
703
708
  function toPrimitive(t, r) {
704
709
  if ("object" != _typeof(t) || !t) return t;
705
710
  var e = t[Symbol.toPrimitive];
@@ -711,13 +716,13 @@ function toPrimitive(t, r) {
711
716
  return ("string" === r ? String : Number)(t);
712
717
  }
713
718
  //#endregion
714
- //#region \0@oxc-project+runtime@0.122.0/helpers/toPropertyKey.js
719
+ //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
715
720
  function toPropertyKey(t) {
716
721
  var i = toPrimitive(t, "string");
717
722
  return "symbol" == _typeof(i) ? i : i + "";
718
723
  }
719
724
  //#endregion
720
- //#region \0@oxc-project+runtime@0.122.0/helpers/defineProperty.js
725
+ //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
721
726
  function _defineProperty(e, r, t) {
722
727
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
723
728
  value: t,
@@ -727,7 +732,7 @@ function _defineProperty(e, r, t) {
727
732
  }) : e[r] = t, e;
728
733
  }
729
734
  //#endregion
730
- //#region \0@oxc-project+runtime@0.122.0/helpers/objectSpread2.js
735
+ //#region \0@oxc-project+runtime@0.124.0/helpers/objectSpread2.js
731
736
  function ownKeys(e, r) {
732
737
  var t = Object.keys(e);
733
738
  if (Object.getOwnPropertySymbols) {
@@ -750,7 +755,7 @@ function _objectSpread2(e) {
750
755
  return e;
751
756
  }
752
757
  //#endregion
753
- //#region \0@oxc-project+runtime@0.122.0/helpers/objectWithoutPropertiesLoose.js
758
+ //#region \0@oxc-project+runtime@0.124.0/helpers/objectWithoutPropertiesLoose.js
754
759
  function _objectWithoutPropertiesLoose(r, e) {
755
760
  if (null == r) return {};
756
761
  var t = {};
@@ -761,7 +766,7 @@ function _objectWithoutPropertiesLoose(r, e) {
761
766
  return t;
762
767
  }
763
768
  //#endregion
764
- //#region \0@oxc-project+runtime@0.122.0/helpers/objectWithoutProperties.js
769
+ //#region \0@oxc-project+runtime@0.124.0/helpers/objectWithoutProperties.js
765
770
  function _objectWithoutProperties(e, t) {
766
771
  if (null == e) return {};
767
772
  var o, r, i = _objectWithoutPropertiesLoose(e, t);
@@ -860,8 +865,9 @@ const defaultValidator = (query) => {
860
865
  * Replace this with your custom rule validator.
861
866
  */
862
867
  const validateRule = (rule) => {
863
- // istanbul ignore else
868
+ /* v8 ignore start -- @preserve */
864
869
  if (rule.id) result[rule.id];
870
+ /* v8 ignore stop -- @preserve */
865
871
  };
866
872
  const validateGroup = (rg) => {
867
873
  const reasons = [];
@@ -872,7 +878,7 @@ const defaultValidator = (query) => {
872
878
  if (invalidICs) reasons.push(groupInvalidReasons.invalidIndependentCombinators);
873
879
  }
874
880
  if (isRuleGroupType(rg) && !defaultCombinators.map((c) => c.name).includes(rg.combinator) && rg.rules.length > 1) reasons.push(groupInvalidReasons.invalidCombinator);
875
- /* istanbul ignore else */
881
+ /* v8 ignore else -- @preserve */
876
882
  if (rg.id) result[rg.id] = reasons.length > 0 ? {
877
883
  valid: false,
878
884
  reasons
@@ -1040,7 +1046,7 @@ function getFirstOption(arr) {
1040
1046
  var _og$options$0$value;
1041
1047
  return (_og$options$0$value = og.options[0].value) !== null && _og$options$0$value !== void 0 ? _og$options$0$value : og.options[0].name;
1042
1048
  }
1043
- // istanbul ignore next
1049
+ // v8 ignore next
1044
1050
  return null;
1045
1051
  }
1046
1052
  return (_arr$0$value = arr[0].value) !== null && _arr$0$value !== void 0 ? _arr$0$value : arr[0].name;
@@ -1088,7 +1094,7 @@ const uniqOptList = (originalArray) => {
1088
1094
  return uniqByIdentifier(originalArray.map((o) => toFullOption(o)));
1089
1095
  };
1090
1096
  const prepareOptionList = (props) => {
1091
- // istanbul ignore next
1097
+ // v8 ignore next
1092
1098
  const { optionList: optionListPropOriginal, baseOption = {}, labelMap = {}, placeholder: { placeholderName = "~", placeholderLabel = defaultPlaceholderLabel, placeholderGroupLabel = defaultPlaceholderLabel } = {}, autoSelectOption = true } = props;
1093
1099
  const defaultOption = {
1094
1100
  id: placeholderName,
@@ -1113,11 +1119,13 @@ const prepareOptionList = (props) => {
1113
1119
  optionsMap = autoSelectOption ? op : _objectSpread2(_objectSpread2({}, op), {}, { [placeholderName]: defaultOption });
1114
1120
  } else if (isFlexibleOptionGroupArray(optionList)) for (const og of optionList) for (const opt of og.options) {
1115
1121
  var _opt$value3;
1116
- optionsMap[(_opt$value3 = opt.value) !== null && _opt$value3 !== void 0 ? _opt$value3 : opt.name] = toFullOption(opt, baseOption);
1122
+ optionsMap[(_opt$value3 = opt.value) !== null && _opt$value3 !== void 0 ? _opt$value3 :
1123
+ /* v8 ignore start -- @preserve */ opt.name] = toFullOption(opt, baseOption);
1117
1124
  }
1118
1125
  else for (const opt of optionList) {
1119
1126
  var _opt$value4;
1120
- optionsMap[(_opt$value4 = opt.value) !== null && _opt$value4 !== void 0 ? _opt$value4 : opt.name] = toFullOption(opt, baseOption);
1127
+ optionsMap[(_opt$value4 = opt.value) !== null && _opt$value4 !== void 0 ? _opt$value4 :
1128
+ /* v8 ignore start -- @preserve */ opt.name] = toFullOption(opt, baseOption);
1121
1129
  }
1122
1130
  return {
1123
1131
  defaultOption,
@@ -1133,7 +1141,8 @@ const filterByComparator = (field, operator, fieldToCompare) => {
1133
1141
  const fullFieldToCompare = toFullOption(fieldToCompare);
1134
1142
  if (fullField.value === fullFieldToCompare.value) return false;
1135
1143
  if (typeof fullField.comparator === "string") return fullField[fullField.comparator] === fullFieldToCompare[fullField.comparator];
1136
- return (_fullField$comparator = (_fullField$comparator2 = fullField.comparator) === null || _fullField$comparator2 === void 0 ? void 0 : _fullField$comparator2.call(fullField, fullFieldToCompare, operator)) !== null && _fullField$comparator !== void 0 ? _fullField$comparator : false;
1144
+ return (_fullField$comparator = (_fullField$comparator2 = fullField.comparator) === null || _fullField$comparator2 === void 0 ? void 0 : _fullField$comparator2.call(fullField, fullFieldToCompare, operator)) !== null && _fullField$comparator !== void 0 ? _fullField$comparator :
1145
+ /* v8 ignore start -- @preserve */ false;
1137
1146
  };
1138
1147
  /**
1139
1148
  * For a given {@link FullField}, returns the `fields` list filtered for
@@ -1150,7 +1159,8 @@ const filterFieldsByComparator = (field, fields, operator) => {
1150
1159
  if (!field.comparator) {
1151
1160
  const filterOutSameField = (f) => {
1152
1161
  var _f$value, _field$value;
1153
- return ((_f$value = f.value) !== null && _f$value !== void 0 ? _f$value : f.name) !== ((_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : field.name);
1162
+ return ((_f$value = f.value) !== null && _f$value !== void 0 ? _f$value : /* v8 ignore start -- @preserve */ f.name) !== ((_field$value = field.value) !== null && _field$value !== void 0 ? _field$value :
1163
+ /* v8 ignore start -- @preserve */ field.name);
1154
1164
  };
1155
1165
  if (isFlexibleOptionGroupArray(fields)) return fields.map((og) => _objectSpread2(_objectSpread2({}, og), {}, { options: og.options.filter((v) => filterOutSameField(v)) }));
1156
1166
  return fields.filter((v) => filterOutSameField(v));
@@ -1226,7 +1236,7 @@ const isRuleOrGroupValid = (rg, validationResult, validator) => {
1226
1236
  if (typeof validator === "function" && !isRuleGroup(rg)) {
1227
1237
  const vr = validator(rg);
1228
1238
  if (typeof vr === "boolean") return vr;
1229
- // istanbul ignore else
1239
+ // v8 ignore else
1230
1240
  if (isValidationResult(vr)) return vr.valid;
1231
1241
  }
1232
1242
  return true;
@@ -1340,7 +1350,7 @@ const numerifyValues = (rg, options) => _objectSpread2(_objectSpread2({}, rg), {
1340
1350
  if (Array.isArray(r.value)) return _objectSpread2(_objectSpread2({}, r), {}, { value: r.value.map((v) => parseNumber(v, { parseNumbers })) });
1341
1351
  const valAsArray = toArray(r.value, { retainEmptyStrings: true }).map((v) => parseNumber(v, { parseNumbers }));
1342
1352
  if (valAsArray.every((v) => typeof v === "number")) {
1343
- // istanbul ignore else
1353
+ // v8 ignore else
1344
1354
  if (valAsArray.length > 1) return _objectSpread2(_objectSpread2({}, r), {}, { value: valAsArray });
1345
1355
  else if (valAsArray.length === 1) return _objectSpread2(_objectSpread2({}, r), {}, { value: valAsArray[0] });
1346
1356
  }
@@ -1441,7 +1451,9 @@ const translationMatchFilter = (key, keyToTest, conditions) => keyToTest.startsW
1441
1451
  */
1442
1452
  const getNLTranslataion = (key, translations, conditions = []) => {
1443
1453
  var _ref, _translations$key, _ref2, _ref3, _Object$entries$find$, _Object$entries$find, _Object$entries$find2;
1444
- return conditions.length === 0 ? (_ref = (_translations$key = translations[key]) !== null && _translations$key !== void 0 ? _translations$key : defaultNLTranslations[key]) !== null && _ref !== void 0 ? _ref : "" : (_ref2 = (_ref3 = (_Object$entries$find$ = (_Object$entries$find = Object.entries(translations).find(([keyToTest]) => translationMatchFilter(key, keyToTest, conditions))) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[1]) !== null && _Object$entries$find$ !== void 0 ? _Object$entries$find$ : (_Object$entries$find2 = Object.entries(defaultNLTranslations).find(([keyToTest]) => translationMatchFilter(key, keyToTest, conditions))) === null || _Object$entries$find2 === void 0 ? void 0 : _Object$entries$find2[1]) !== null && _ref3 !== void 0 ? _ref3 : defaultNLTranslations[key]) !== null && _ref2 !== void 0 ? _ref2 : "";
1454
+ return conditions.length === 0 ? (_ref = (_translations$key = translations[key]) !== null && _translations$key !== void 0 ? _translations$key : defaultNLTranslations[key]) !== null && _ref !== void 0 ? _ref :
1455
+ /* v8 ignore start -- @preserve */ "" : (_ref2 = (_ref3 = (_Object$entries$find$ = (_Object$entries$find = Object.entries(translations).find(([keyToTest]) => translationMatchFilter(key, keyToTest, conditions))) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[1]) !== null && _Object$entries$find$ !== void 0 ? _Object$entries$find$ : (_Object$entries$find2 = Object.entries(defaultNLTranslations).find(([keyToTest]) => translationMatchFilter(key, keyToTest, conditions))) === null || _Object$entries$find2 === void 0 ? void 0 : _Object$entries$find2[1]) !== null && _ref3 !== void 0 ? _ref3 : defaultNLTranslations[key]) !== null && _ref2 !== void 0 ? _ref2 :
1456
+ /* v8 ignore next -- @preserve */ "";
1445
1457
  };
1446
1458
  /**
1447
1459
  * Transforms
@@ -1498,7 +1510,7 @@ const defaultRuleGroupProcessorCEL = (ruleGroup, options) => {
1498
1510
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1499
1511
  const processRuleGroup = (rg, outermost) => {
1500
1512
  var _rg$id;
1501
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
1513
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
1502
1514
  const processedRules = [];
1503
1515
  let precedingCombinator = "";
1504
1516
  let firstRule = true;
@@ -1638,7 +1650,7 @@ const defaultRuleGroupProcessorMongoDBQuery = (ruleGroup, options, meta) => {
1638
1650
  const { inExpressionContext } = context !== null && context !== void 0 ? context : {};
1639
1651
  const processRuleGroup = (rg, outermost) => {
1640
1652
  var _rg$id;
1641
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? mongoDbFallback : false;
1653
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return outermost ? mongoDbFallback : false;
1642
1654
  const combinator = `$${lc(rg.combinator)}`;
1643
1655
  let hasChildRules = false;
1644
1656
  const expressions = rg.rules.map((rule) => {
@@ -1804,7 +1816,7 @@ const defaultRuleGroupProcessorSpEL = (ruleGroup, options) => {
1804
1816
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1805
1817
  const processRuleGroup = (rg, outermost) => {
1806
1818
  var _rg$id;
1807
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
1819
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
1808
1820
  const processedRules = [];
1809
1821
  let precedingCombinator = "";
1810
1822
  let firstRule = true;
@@ -1991,22 +2003,22 @@ const defaultValueProcessorByRule = ({ operator, value, valueSource }, { escapeQ
1991
2003
  * @group Export
1992
2004
  */
1993
2005
  const defaultRuleProcessorDrizzle = (rule, _options) => {
1994
- const opts = _options !== null && _options !== void 0 ? _options : ( /* istanbul ignore next */ {});
1995
- // istanbul ignore next
2006
+ const opts = _options !== null && _options !== void 0 ? _options : /* v8 ignore start -- @preserve */ {};
2007
+ // v8 ignore next
1996
2008
  const { parseNumbers, preserveValueOrder, context = {} } = opts;
1997
2009
  const { columns, drizzleOperators, useRawFields } = context;
1998
- if (!columns || !drizzleOperators) return;
2010
+ if (!columns || !drizzleOperators) return void 0;
1999
2011
  const { between, eq, gt, gte, inArray, isNotNull, isNull, like, lt, lte, ne, notBetween, notInArray, notLike, sql } = drizzleOperators;
2000
2012
  const { field, operator, value, valueSource } = rule;
2001
2013
  const column = useRawFields && /[a-z][a-z0-9]*/i.test(field) ? sql.raw(field) : columns[field];
2002
2014
  const operatorLC = lc(operator);
2003
2015
  const valueIsField = valueSource === "field";
2004
2016
  const asFieldOrValue = (v) => valueIsField ? columns[v] : v;
2005
- if (!column) return;
2017
+ if (!column) return void 0;
2006
2018
  const matchEval = processMatchMode(rule);
2007
2019
  if (matchEval === false) return;
2008
2020
  else if (matchEval) {
2009
- if (opts.preset !== "postgresql") return;
2021
+ if (opts.preset !== "postgresql") return void 0;
2010
2022
  const { mode, threshold } = matchEval;
2011
2023
  const arrayElementAlias = "elem_alias";
2012
2024
  const nestedArrayFilter = defaultRuleGroupProcessorDrizzle(transformQuery(rule.value, { ruleProcessor: (r) => _objectSpread2(_objectSpread2({}, r), {}, { field: arrayElementAlias }) }), _objectSpread2(_objectSpread2({}, opts), {}, { context: _objectSpread2(_objectSpread2({}, opts.context), {}, { useRawFields: true }) }));
@@ -2086,12 +2098,12 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
2086
2098
  */
2087
2099
  const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns, drizzleOperators) => {
2088
2100
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, validateRule, validationMap } = options;
2089
- if (!columns || !drizzleOperators) return;
2101
+ if (!columns || !drizzleOperators) return void 0;
2090
2102
  const { and, not, or } = drizzleOperators;
2091
2103
  const ruleProcessor = defaultRuleProcessorDrizzle;
2092
2104
  const processRuleGroup = (rg, _outermost) => {
2093
2105
  var _rg$id;
2094
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return;
2106
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return;
2095
2107
  const processedRules = rg.rules.map((rule) => {
2096
2108
  if (isRuleGroup(rule)) return processRuleGroup(rule);
2097
2109
  const [validationResult, fieldValidator] = validateRule(rule);
@@ -2123,7 +2135,7 @@ const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
2123
2135
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2124
2136
  const processRuleGroup = (rg) => {
2125
2137
  var _rg$id;
2126
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return false;
2138
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return false;
2127
2139
  const processedRules = rg.rules.map((rule) => {
2128
2140
  if (isRuleGroup(rule)) return processRuleGroup(rule);
2129
2141
  const [validationResult, fieldValidator] = validateRule(rule);
@@ -2151,7 +2163,7 @@ const defaultRuleGroupProcessorJSONata = (ruleGroup, options) => {
2151
2163
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2152
2164
  const processRuleGroup = (rg, outermost) => {
2153
2165
  var _rg$id;
2154
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
2166
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
2155
2167
  const processedRules = [];
2156
2168
  let precedingCombinator = "";
2157
2169
  let firstRule = true;
@@ -2208,7 +2220,7 @@ const defaultRuleGroupProcessorJsonLogic = (ruleGroup, options) => {
2208
2220
  const query = convertFromIC(ruleGroup);
2209
2221
  const processRuleGroup = (rg, _outermost) => {
2210
2222
  var _rg$id;
2211
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return false;
2223
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return false;
2212
2224
  const processedRules = rg.rules.map((rule) => {
2213
2225
  if (isRuleGroup(rule)) return processRuleGroup(rule);
2214
2226
  const [validationResult, fieldValidator] = validateRule(rule);
@@ -2236,7 +2248,7 @@ const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
2236
2248
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2237
2249
  const processRuleGroup = (rg, outermost) => {
2238
2250
  var _rg$id;
2239
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
2251
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
2240
2252
  const rules = rg.rules.map((rule) => {
2241
2253
  var _rule$valueSource;
2242
2254
  if (isRuleGroup(rule)) return processRuleGroup(rule);
@@ -2270,7 +2282,7 @@ const defaultRuleGroupProcessorMongoDB = (ruleGroup, options, meta) => {
2270
2282
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2271
2283
  const processRuleGroup = (rg, outermost) => {
2272
2284
  var _rg$id;
2273
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
2285
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
2274
2286
  const combinator = `"$${lc(rg.combinator)}"`;
2275
2287
  let hasChildRules = false;
2276
2288
  const expressions = rg.rules.map((rule) => {
@@ -2307,7 +2319,7 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
2307
2319
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, translations, validateRule, validationMap } = options;
2308
2320
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2309
2321
  var _rg$id, _rg2$combinator2, _translations2;
2310
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
2322
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return outermostOrLonelyInGroup ? fallbackExpression : /* v8 ignore next -- @preserve */ "";
2311
2323
  const rg2 = isRuleGroupTypeIC(rg) && rg.rules.some((r) => typeof r === "string" && lc(r) === "xor") ? convertFromIC(rg) : rg;
2312
2324
  const processedRules = [];
2313
2325
  let precedingCombinator = "";
@@ -2321,8 +2333,9 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
2321
2333
  }
2322
2334
  if (isRuleGroup(rule)) {
2323
2335
  var _rg2$combinator;
2324
- const processedGroup = processRuleGroup(rule, rg2.rules.length === 1 && !(rg2.not || /^xor$/i.test((_rg2$combinator = rg2.combinator) !== null && _rg2$combinator !== void 0 ? _rg2$combinator : "")));
2325
- // istanbul ignore else
2336
+ const processedGroup = processRuleGroup(rule, rg2.rules.length === 1 && !(rg2.not || /^xor$/i.test((_rg2$combinator = rg2.combinator) !== null && _rg2$combinator !== void 0 ? _rg2$combinator :
2337
+ /* v8 ignore start -- @preserve */ "")));
2338
+ // v8 ignore else
2326
2339
  if (processedGroup) {
2327
2340
  if (!firstRule && precedingCombinator) {
2328
2341
  processedRules.push(precedingCombinator);
@@ -2396,7 +2409,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
2396
2409
  if (!isPojo(processedRule)) return "";
2397
2410
  const { sql, params: customParams } = processedRule;
2398
2411
  if (typeof sql !== "string" || !sql) return "";
2399
- // istanbul ignore else
2412
+ // v8 ignore else
2400
2413
  if (format === "parameterized" && Array.isArray(customParams)) params.push(...customParams);
2401
2414
  else if (format === "parameterized_named" && isPojo(customParams)) {
2402
2415
  var _fieldParams$get;
@@ -2407,7 +2420,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
2407
2420
  };
2408
2421
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2409
2422
  var _rg$id;
2410
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
2423
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return outermostOrLonelyInGroup ? fallbackExpression : /* v8 ignore next -- @preserve */ "";
2411
2424
  const processedRules = [];
2412
2425
  let precedingCombinator = "";
2413
2426
  let firstRule = true;
@@ -2418,7 +2431,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
2418
2431
  }
2419
2432
  if (isRuleGroup(rule)) {
2420
2433
  const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
2421
- // istanbul ignore else
2434
+ // v8 ignore else
2422
2435
  if (processedGroup) {
2423
2436
  if (!firstRule && precedingCombinator) {
2424
2437
  processedRules.push(precedingCombinator);
@@ -2468,7 +2481,7 @@ const defaultRuleGroupProcessorPrisma = (ruleGroup, options) => {
2468
2481
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2469
2482
  const processRuleGroup = (rg, outermost) => {
2470
2483
  var _rg$id;
2471
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? prismaFallback : void 0;
2484
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return outermost ? prismaFallback : void 0;
2472
2485
  const combinator = rg.combinator.toUpperCase();
2473
2486
  let hasChildRules = false;
2474
2487
  const expressions = rg.rules.map((rule) => {
@@ -2501,13 +2514,13 @@ const defaultRuleGroupProcessorPrisma = (ruleGroup, options) => {
2501
2514
  * @group Export
2502
2515
  */
2503
2516
  const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
2504
- // istanbul ignore next
2517
+ // v8 ignore next
2505
2518
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap, context = {} } = options;
2506
2519
  const { sequelizeOperators: Op } = context;
2507
- if (!Op) return;
2520
+ if (!Op) return void 0;
2508
2521
  const processRuleGroup = (rg, _outermost) => {
2509
2522
  var _rg$id;
2510
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return;
2523
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return;
2511
2524
  const combinator = rg.combinator.toUpperCase();
2512
2525
  let hasChildRules = false;
2513
2526
  const expressions = rg.rules.map((rule) => {
@@ -2527,7 +2540,7 @@ const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
2527
2540
  fieldData
2528
2541
  }));
2529
2542
  }).filter(Boolean);
2530
- if (expressions.length === 0) return;
2543
+ if (expressions.length === 0) return void 0;
2531
2544
  const result = expressions.length === 1 && !hasChildRules ? expressions[0] : { [lc(combinator) === "or" ? Op.or : Op.and]: expressions };
2532
2545
  return rg.not ? { [Op.not]: result } : result;
2533
2546
  };
@@ -2544,7 +2557,7 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
2544
2557
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2545
2558
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2546
2559
  var _rg$id;
2547
- if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
2560
+ if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : /* v8 ignore start -- @preserve */ ""])) return outermostOrLonelyInGroup ? fallbackExpression : /* v8 ignore next -- @preserve */ "";
2548
2561
  const processedRules = [];
2549
2562
  let precedingCombinator = "";
2550
2563
  let firstRule = true;
@@ -2556,7 +2569,7 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
2556
2569
  }
2557
2570
  if (isRuleGroup(rule)) {
2558
2571
  const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
2559
- // istanbul ignore else
2572
+ // v8 ignore else
2560
2573
  if (processedGroup) {
2561
2574
  if (!firstRule && precedingCombinator) {
2562
2575
  processedRules.push(precedingCombinator);
@@ -2591,6 +2604,324 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
2591
2604
  return processRuleGroup(ruleGroup, true);
2592
2605
  };
2593
2606
  //#endregion
2607
+ //#region src/utils/formatQuery/defaultRuleGroupProcessorDiagnostics.ts
2608
+ const numericInputTypes = new Set([
2609
+ "number",
2610
+ "range",
2611
+ "bigint"
2612
+ ]);
2613
+ const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
2614
+ const timeRegex = /^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;
2615
+ const monthRegex = /^\d{4}-\d{2}$/;
2616
+ const weekRegex = /^\d{4}-W\d{2}$/;
2617
+ const colorRegex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
2618
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
2619
+ const isValidDateComponents = (y, m, d) => {
2620
+ const date = new Date(Date.UTC(y, m - 1, d));
2621
+ return date.getUTCFullYear() === y && date.getUTCMonth() === m - 1 && date.getUTCDate() === d;
2622
+ };
2623
+ const isValidTimeComponents = (s) => {
2624
+ const parts = s.split(":");
2625
+ const h = Number(parts[0]);
2626
+ const m = Number(parts[1]);
2627
+ const sec = parts[2] ? Number.parseFloat(parts[2]) : 0;
2628
+ return h >= 0 && h <= 23 && m >= 0 && m <= 59 && sec >= 0 && sec < 60;
2629
+ };
2630
+ /**
2631
+ * Checks whether a value is compatible with the given {@link FullField.inputType}.
2632
+ * Returns a diagnostic code string if there is a mismatch, or `undefined` if OK.
2633
+ */
2634
+ const checkValueTypeMismatch = (value, inputType) => {
2635
+ if (value === null || value === void 0 || value === "") return void 0;
2636
+ if (numericInputTypes.has(inputType)) {
2637
+ const v = typeof value === "string" ? value.trim() : value;
2638
+ if (typeof v === "number" || typeof v === "bigint") return void 0;
2639
+ if (typeof v === "string" && numericRegex.test(v)) return void 0;
2640
+ return "VALUE_TYPE_MISMATCH";
2641
+ }
2642
+ if (inputType === "date") {
2643
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2644
+ const v = value.trim();
2645
+ if (!dateRegex.test(v)) return "VALUE_TYPE_MISMATCH";
2646
+ const [y, m, d] = v.split("-").map(Number);
2647
+ return isValidDateComponents(y, m, d) ? void 0 : "VALUE_TYPE_MISMATCH";
2648
+ }
2649
+ if (inputType === "datetime-local") {
2650
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2651
+ const base = value.trim().replace(/(Z|[+-]\d{2}:?\d{2}|[+-]\d{2})$/, "");
2652
+ const tIndex = base.indexOf("T");
2653
+ if (tIndex === -1) return "VALUE_TYPE_MISMATCH";
2654
+ const datePart = base.slice(0, tIndex);
2655
+ const timePart = base.slice(tIndex + 1);
2656
+ if (!dateRegex.test(datePart) || !timeRegex.test(timePart)) return "VALUE_TYPE_MISMATCH";
2657
+ const [y, m, d] = datePart.split("-").map(Number);
2658
+ if (!isValidDateComponents(y, m, d)) return "VALUE_TYPE_MISMATCH";
2659
+ return isValidTimeComponents(timePart) ? void 0 : "VALUE_TYPE_MISMATCH";
2660
+ }
2661
+ if (inputType === "time") {
2662
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2663
+ const v = value.trim();
2664
+ if (!timeRegex.test(v)) return "VALUE_TYPE_MISMATCH";
2665
+ return isValidTimeComponents(v) ? void 0 : "VALUE_TYPE_MISMATCH";
2666
+ }
2667
+ if (inputType === "month") {
2668
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2669
+ const v = value.trim();
2670
+ if (!monthRegex.test(v)) return "VALUE_TYPE_MISMATCH";
2671
+ const m = Number(v.slice(5));
2672
+ return m >= 1 && m <= 12 ? void 0 : "VALUE_TYPE_MISMATCH";
2673
+ }
2674
+ if (inputType === "week") {
2675
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2676
+ const v = value.trim();
2677
+ if (!weekRegex.test(v)) return "VALUE_TYPE_MISMATCH";
2678
+ const w = Number(v.slice(6));
2679
+ return w >= 1 && w <= 53 ? void 0 : "VALUE_TYPE_MISMATCH";
2680
+ }
2681
+ if (inputType === "color") {
2682
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2683
+ return colorRegex.test(value.trim()) ? void 0 : "VALUE_TYPE_MISMATCH";
2684
+ }
2685
+ if (inputType === "url") {
2686
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2687
+ try {
2688
+ new URL(value.trim());
2689
+ return;
2690
+ } catch (_unused) {
2691
+ return "VALUE_TYPE_MISMATCH";
2692
+ }
2693
+ }
2694
+ if (inputType === "email") {
2695
+ if (typeof value !== "string") return "VALUE_TYPE_MISMATCH";
2696
+ return emailRegex.test(value.trim()) ? void 0 : "VALUE_TYPE_MISMATCH";
2697
+ }
2698
+ };
2699
+ /**
2700
+ * Rule group processor used by {@link formatQuery} for "diagnostics" format.
2701
+ *
2702
+ * Produces a {@link DiagnosticsResult} containing an annotated copy of the query
2703
+ * tree (`query`) with `valid`, `reasons`, `path`, and `level` properties on every
2704
+ * rule and group; a flat `diagnostics` array; aggregate `stats`; and a per-field
2705
+ * `fieldSummary`.
2706
+ *
2707
+ * @group Export
2708
+ */
2709
+ const defaultRuleGroupProcessorDiagnostics = (ruleGroup, options) => {
2710
+ const { fields: fieldsOption, placeholderFieldName, placeholderOperatorName, placeholderValueName, validateRule, validationMap } = options;
2711
+ const diagnostics = [];
2712
+ const stats = {
2713
+ totalRules: 0,
2714
+ totalGroups: 0,
2715
+ validRules: 0,
2716
+ invalidRules: 0,
2717
+ validGroups: 0,
2718
+ invalidGroups: 0
2719
+ };
2720
+ const fieldSummary = {};
2721
+ const uniqueFields = toFlatOptionArray(fieldsOption);
2722
+ const fieldsByName = /* @__PURE__ */ new Map();
2723
+ for (const f of uniqueFields) fieldsByName.set(f.name, f);
2724
+ const hasFieldsConfig = fieldsByName.size > 0;
2725
+ const processRuleGroup = (rg, path) => {
2726
+ var _rg$id;
2727
+ stats.totalGroups++;
2728
+ const level = path.length;
2729
+ const groupValidationEntry = validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""];
2730
+ const groupSelfValid = isRuleOrGroupValid(rg, groupValidationEntry);
2731
+ const groupReasons = getReasons(groupValidationEntry);
2732
+ if (rg.muted) {
2733
+ var _rg$id2;
2734
+ diagnostics.push({
2735
+ id: (_rg$id2 = rg.id) !== null && _rg$id2 !== void 0 ? _rg$id2 : "",
2736
+ path,
2737
+ code: "MUTED",
2738
+ message: "Group is muted",
2739
+ source: "muted"
2740
+ });
2741
+ } else if (!groupSelfValid && groupValidationEntry !== void 0) {
2742
+ var _rg$id3;
2743
+ diagnostics.push({
2744
+ id: (_rg$id3 = rg.id) !== null && _rg$id3 !== void 0 ? _rg$id3 : "",
2745
+ path,
2746
+ code: "CUSTOM_VALIDATOR",
2747
+ message: groupReasons ? `Invalid: ${groupReasons.join(", ")}` : "Group failed validation",
2748
+ source: "query-validator"
2749
+ });
2750
+ }
2751
+ let allChildrenValid = true;
2752
+ let ruleIndex = 0;
2753
+ const annotatedRules = [];
2754
+ for (const rule of rg.rules) {
2755
+ var _getReasons;
2756
+ if (typeof rule === "string") {
2757
+ annotatedRules.push(rule);
2758
+ ruleIndex++;
2759
+ continue;
2760
+ }
2761
+ const childPath = [...path, ruleIndex];
2762
+ if (isRuleGroup(rule)) {
2763
+ const annotatedGroup = processRuleGroup(rule, childPath);
2764
+ if (!annotatedGroup.valid) allChildrenValid = false;
2765
+ annotatedRules.push(annotatedGroup);
2766
+ ruleIndex++;
2767
+ continue;
2768
+ }
2769
+ stats.totalRules++;
2770
+ const childLevel = childPath.length;
2771
+ const [validationResult, fieldValidator] = validateRule(rule);
2772
+ const ruleValid = isRuleOrGroupValid(rule, validationResult, fieldValidator) && rule.field !== placeholderFieldName && rule.operator !== placeholderOperatorName && !(placeholderValueName !== void 0 && rule.value === placeholderValueName);
2773
+ collectRuleDiagnostics(rule, childPath, validationResult, fieldValidator, ruleValid, diagnostics, placeholderFieldName, placeholderOperatorName, placeholderValueName, hasFieldsConfig, fieldsByName);
2774
+ if (!ruleValid) {
2775
+ allChildrenValid = false;
2776
+ stats.invalidRules++;
2777
+ } else stats.validRules++;
2778
+ const fieldName = rule.field;
2779
+ if (!fieldSummary[fieldName]) fieldSummary[fieldName] = {
2780
+ ruleCount: 0,
2781
+ invalidCount: 0
2782
+ };
2783
+ fieldSummary[fieldName].ruleCount++;
2784
+ if (!ruleValid) fieldSummary[fieldName].invalidCount++;
2785
+ const ruleReasons = (_getReasons = getReasons(validationResult)) !== null && _getReasons !== void 0 ? _getReasons : getFieldValidatorReasons(rule, fieldValidator);
2786
+ const annotatedRule = _objectSpread2(_objectSpread2(_objectSpread2({}, rule), {}, { valid: ruleValid }, ruleReasons ? { reasons: ruleReasons } : null), {}, {
2787
+ path: childPath,
2788
+ level: childLevel
2789
+ });
2790
+ annotatedRules.push(annotatedRule);
2791
+ ruleIndex++;
2792
+ }
2793
+ const groupValid = groupSelfValid && allChildrenValid;
2794
+ if (groupValid) stats.validGroups++;
2795
+ else stats.invalidGroups++;
2796
+ if (isRuleGroupType(rg)) return _objectSpread2(_objectSpread2(_objectSpread2({}, rg), {}, { valid: groupValid }, groupReasons ? { reasons: groupReasons } : null), {}, {
2797
+ path,
2798
+ level,
2799
+ rules: annotatedRules
2800
+ });
2801
+ return _objectSpread2(_objectSpread2(_objectSpread2({}, rg), {}, { valid: groupValid }, groupReasons ? { reasons: groupReasons } : null), {}, {
2802
+ path,
2803
+ level,
2804
+ rules: annotatedRules
2805
+ });
2806
+ };
2807
+ const query = processRuleGroup(ruleGroup, []);
2808
+ if (hasFieldsConfig) {
2809
+ const referencedFields = new Set(Object.keys(fieldSummary));
2810
+ for (const [fieldName] of fieldsByName) if (!referencedFields.has(fieldName)) diagnostics.push({
2811
+ id: "",
2812
+ path: [],
2813
+ code: "UNREFERENCED_FIELD",
2814
+ message: `Field "${fieldName}" is defined in the fields config but not used in the query`,
2815
+ source: "field-check"
2816
+ });
2817
+ }
2818
+ return {
2819
+ query,
2820
+ diagnostics,
2821
+ stats,
2822
+ fieldSummary
2823
+ };
2824
+ };
2825
+ /**
2826
+ * Collects diagnostic entries for a single rule.
2827
+ */
2828
+ const collectRuleDiagnostics = (rule, path, validationResult, fieldValidator, ruleValid, diagnostics, placeholderFieldName, placeholderOperatorName, placeholderValueName, hasFieldsConfig, fieldsByName) => {
2829
+ var _rule$id;
2830
+ const id = (_rule$id = rule.id) !== null && _rule$id !== void 0 ? _rule$id : "";
2831
+ if (rule.muted) diagnostics.push({
2832
+ id,
2833
+ path,
2834
+ code: "MUTED",
2835
+ message: "Rule is muted",
2836
+ source: "muted"
2837
+ });
2838
+ if (rule.field === placeholderFieldName) diagnostics.push({
2839
+ id,
2840
+ path,
2841
+ code: "PLACEHOLDER_FIELD",
2842
+ message: "Rule has a placeholder field",
2843
+ source: "placeholder"
2844
+ });
2845
+ if (rule.operator === placeholderOperatorName) diagnostics.push({
2846
+ id,
2847
+ path,
2848
+ code: "PLACEHOLDER_OPERATOR",
2849
+ message: "Rule has a placeholder operator",
2850
+ source: "placeholder"
2851
+ });
2852
+ if (placeholderValueName !== void 0 && rule.value === placeholderValueName) diagnostics.push({
2853
+ id,
2854
+ path,
2855
+ code: "PLACEHOLDER_VALUE",
2856
+ message: "Rule has a placeholder value",
2857
+ source: "placeholder"
2858
+ });
2859
+ if (!rule.muted && rule.field !== placeholderFieldName && rule.operator !== placeholderOperatorName && !(placeholderValueName !== void 0 && rule.value === placeholderValueName)) {
2860
+ if (typeof validationResult === "boolean" && !validationResult) diagnostics.push({
2861
+ id,
2862
+ path,
2863
+ code: "CUSTOM_VALIDATOR",
2864
+ message: "Rule failed validation",
2865
+ source: "query-validator"
2866
+ });
2867
+ else if (typeof validationResult !== "boolean" && isValidationResult(validationResult) && !validationResult.valid) {
2868
+ const reasons = validationResult.reasons;
2869
+ diagnostics.push({
2870
+ id,
2871
+ path,
2872
+ code: "CUSTOM_VALIDATOR",
2873
+ message: reasons ? `Invalid: ${reasons.join(", ")}` : "Rule failed validation",
2874
+ source: "query-validator"
2875
+ });
2876
+ } else if (!ruleValid && typeof fieldValidator === "function") {
2877
+ const vr = fieldValidator(rule);
2878
+ const reasons = typeof vr !== "boolean" && isValidationResult(vr) && !vr.valid ? vr.reasons : void 0;
2879
+ diagnostics.push({
2880
+ id,
2881
+ path,
2882
+ code: "CUSTOM_VALIDATOR",
2883
+ message: reasons ? `Invalid: ${reasons.join(", ")}` : "Rule failed field validation",
2884
+ source: "field-validator"
2885
+ });
2886
+ }
2887
+ }
2888
+ if (hasFieldsConfig && !fieldsByName.has(rule.field) && rule.field !== placeholderFieldName) diagnostics.push({
2889
+ id,
2890
+ path,
2891
+ code: "UNDEFINED_FIELD",
2892
+ message: `Field "${rule.field}" is not defined in the fields config`,
2893
+ source: "field-check"
2894
+ });
2895
+ if (hasFieldsConfig) {
2896
+ const fieldDef = fieldsByName.get(rule.field);
2897
+ if (fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.inputType) {
2898
+ const mismatchCode = checkValueTypeMismatch(rule.value, fieldDef.inputType);
2899
+ if (mismatchCode) diagnostics.push({
2900
+ id,
2901
+ path,
2902
+ code: mismatchCode,
2903
+ message: `Value "${rule.value}" is not compatible with input type "${fieldDef.inputType}"`,
2904
+ source: "type-check"
2905
+ });
2906
+ }
2907
+ }
2908
+ };
2909
+ /**
2910
+ * Extracts `reasons` from a validation result, if present.
2911
+ */
2912
+ const getReasons = (validationResult) => {
2913
+ if (typeof validationResult !== "boolean" && isValidationResult(validationResult) && !validationResult.valid && validationResult.reasons) return validationResult.reasons;
2914
+ };
2915
+ /**
2916
+ * Runs a field-level validator and extracts `reasons` if present.
2917
+ */
2918
+ const getFieldValidatorReasons = (rule, fieldValidator) => {
2919
+ if (typeof fieldValidator === "function") {
2920
+ const vr = fieldValidator(rule);
2921
+ if (typeof vr !== "boolean" && isValidationResult(vr) && !vr.valid && vr.reasons) return vr.reasons;
2922
+ }
2923
+ };
2924
+ //#endregion
2594
2925
  //#region src/utils/formatQuery/defaultRuleProcessorElasticSearch.ts
2595
2926
  const rangeOperatorMap = {
2596
2927
  "<": "lt",
@@ -2964,12 +3295,12 @@ const defaultRuleProcessorLDAP = (rule, options = {}) => {
2964
3295
  return negateIf(`(&(${field}>=${ldapEscape(firstValue)})(${field}<=${ldapEscape(secondValue)}))`, operatorLC === "notbetween");
2965
3296
  }
2966
3297
  }
2967
- // istanbul ignore next
3298
+ // v8 ignore next
2968
3299
  return "";
2969
3300
  };
2970
3301
  //#endregion
2971
3302
  //#region src/utils/formatQuery/defaultValueProcessorNL.ts
2972
- const escapeStringValueQuotes = (v, quoteChar, escapeQuotes) => escapeQuotes && typeof v === "string" ? v.replaceAll(`${quoteChar}`, `${quoteChar}${quoteChar}`) : v;
3303
+ const escapeStringValueQuotes = (v, quoteChar, escapeQuotes) => escapeQuotes && typeof v === "string" ? v.replaceAll(`${quoteChar}`, `${quoteChar}${quoteChar}`) : /* v8 ignore next -- @preserve */ v;
2973
3304
  /**
2974
3305
  * Default value processor used by {@link formatQuery} for "natural_language" format.
2975
3306
  *
@@ -2988,7 +3319,7 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
2988
3319
  quoteFieldNamesWith,
2989
3320
  fieldIdentifierSeparator
2990
3321
  });
2991
- const t = translations !== null && translations !== void 0 ? translations : ( /* istanbul ignore next */ {});
3322
+ const t = translations !== null && translations !== void 0 ? translations : /* v8 ignore start -- @preserve */ {};
2992
3323
  const orTL = (_t$or = t.or) !== null && _t$or !== void 0 ? _t$or : "or";
2993
3324
  const trueTL = (_t$true = t.true) !== null && _t$true !== void 0 ? _t$true : "true";
2994
3325
  const falseTL = (_t$false = t.false) !== null && _t$false !== void 0 ? _t$false : "false";
@@ -3000,7 +3331,8 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
3000
3331
  if (!valueIsField) return defaultValueProcessorByRule(rule, opts);
3001
3332
  const valueAsArray = toArray(rule.value, { retainEmptyStrings: true }).slice(0, 2).map((v) => {
3002
3333
  var _getOption$label, _getOption, _ref;
3003
- return wrapFieldName((_getOption$label = (_getOption = getOption((_ref = fields) !== null && _ref !== void 0 ? _ref : [], v)) === null || _getOption === void 0 ? void 0 : _getOption.label) !== null && _getOption$label !== void 0 ? _getOption$label : v);
3334
+ return wrapFieldName((_getOption$label = (_getOption = getOption((_ref = fields) !== null && _ref !== void 0 ? _ref :
3335
+ /* v8 ignore start -- @preserve */ [], v)) === null || _getOption === void 0 ? void 0 : _getOption.label) !== null && _getOption$label !== void 0 ? _getOption$label : v);
3004
3336
  });
3005
3337
  if (valueAsArray.length < 2 || !isValidValue(valueAsArray[0]) || !isValidValue(valueAsArray[1])) return "";
3006
3338
  return defaultValueProcessorByRule(_objectSpread2(_objectSpread2({}, rule), {}, { value: valueAsArray }), opts);
@@ -3011,14 +3343,16 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
3011
3343
  if (valueAsArray.length === 0) return "";
3012
3344
  const valStringArray = valueAsArray.map((v) => {
3013
3345
  var _getOption$label2, _getOption2, _ref2;
3014
- return valueIsField ? wrapFieldName((_getOption$label2 = (_getOption2 = getOption((_ref2 = fields) !== null && _ref2 !== void 0 ? _ref2 : [], v)) === null || _getOption2 === void 0 ? void 0 : _getOption2.label) !== null && _getOption$label2 !== void 0 ? _getOption$label2 : v) : shouldRenderAsNumber(v, parseNumbers) ? `${trimIfString(v)}` : `${wrapAndEscape(v)}`;
3346
+ return valueIsField ? wrapFieldName((_getOption$label2 = (_getOption2 = getOption((_ref2 = fields) !== null && _ref2 !== void 0 ? _ref2 :
3347
+ /* v8 ignore start -- @preserve */ [], v)) === null || _getOption2 === void 0 ? void 0 : _getOption2.label) !== null && _getOption$label2 !== void 0 ? _getOption$label2 : v) : shouldRenderAsNumber(v, parseNumbers) ? `${trimIfString(v)}` : `${wrapAndEscape(v)}`;
3015
3348
  });
3016
3349
  if (valStringArray.length === 1) return valStringArray[0];
3017
3350
  return `(${`${valStringArray.slice(0, -1).join(", ")}${valStringArray.length > 2 ? "," : ""} ${orTL} ${valStringArray.at(-1)}`})`;
3018
3351
  }
3019
3352
  }
3020
3353
  if (typeof rule.value === "boolean") return rule.value ? trueTL : falseTL;
3021
- return valueIsField ? wrapFieldName((_getOption$label3 = (_getOption3 = getOption((_ref3 = fields) !== null && _ref3 !== void 0 ? _ref3 : [], rule.value)) === null || _getOption3 === void 0 ? void 0 : _getOption3.label) !== null && _getOption$label3 !== void 0 ? _getOption$label3 : rule.value) : shouldRenderAsNumber(rule.value, parseNumbers) ? `${trimIfString(rule.value)}` : `${wrapAndEscape(rule.value)}`;
3354
+ return valueIsField ? wrapFieldName((_getOption$label3 = (_getOption3 = getOption((_ref3 = fields) !== null && _ref3 !== void 0 ? _ref3 :
3355
+ /* v8 ignore start -- @preserve */ [], rule.value)) === null || _getOption3 === void 0 ? void 0 : _getOption3.label) !== null && _getOption$label3 !== void 0 ? _getOption$label3 : rule.value) : shouldRenderAsNumber(rule.value, parseNumbers) ? `${trimIfString(rule.value)}` : `${wrapAndEscape(rule.value)}`;
3022
3356
  };
3023
3357
  //#endregion
3024
3358
  //#region src/utils/formatQuery/defaultRuleProcessorNL.ts
@@ -3047,7 +3381,7 @@ const defaultExportOperatorMap = {
3047
3381
  between: ["is between", "is between the values in"],
3048
3382
  notbetween: ["is not between", "is not between the values in"]
3049
3383
  };
3050
- /* istanbul ignore next */
3384
+ /* v8 ignore next -- @preserve */
3051
3385
  const defaultGetOperators = () => [];
3052
3386
  /**
3053
3387
  * Default operator processor used by {@link formatQuery} for "natural_language" format.
@@ -3057,7 +3391,7 @@ const defaultGetOperators = () => [];
3057
3391
  const defaultOperatorProcessorNL = (rule, opts = {}) => {
3058
3392
  var _getOption, _getOperators, _opts$fieldData, _ref, _operatorMap;
3059
3393
  const { field, operator, valueSource = "value" } = rule;
3060
- // istanbul ignore next
3394
+ // v8 ignore next
3061
3395
  const { getOperators = defaultGetOperators, operatorMap: operatorMapParam = defaultExportOperatorMap } = opts;
3062
3396
  const mergedOperatorMap = new Map(Object.entries(defaultExportOperatorMap));
3063
3397
  for (const [key, value] of Object.entries(operatorMapParam)) mergedOperatorMap.set(lc(key), value);
@@ -3071,7 +3405,7 @@ const defaultOperatorProcessorNL = (rule, opts = {}) => {
3071
3405
  name: field,
3072
3406
  value: field,
3073
3407
  label: field
3074
- } })) !== null && _getOperators !== void 0 ? _getOperators : []), normalizedOperator)) !== null && _getOption !== void 0 ? _getOption : {
3408
+ } })) !== null && _getOperators !== void 0 ? _getOperators : /* v8 ignore start -- @preserve */ []), normalizedOperator)) !== null && _getOption !== void 0 ? _getOption : {
3075
3409
  name: normalizedOperator,
3076
3410
  value: normalizedOperator,
3077
3411
  label: normalizedOperator
@@ -3087,8 +3421,8 @@ const defaultOperatorProcessorNL = (rule, opts = {}) => {
3087
3421
  const defaultRuleProcessorNL = (rule, opts) => {
3088
3422
  var _fieldData$label;
3089
3423
  const { field, operator } = rule;
3090
- // istanbul ignore next
3091
- const { fieldData, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "", quoteValuesWith = `'`, operatorProcessor = defaultOperatorProcessorNL, valueProcessor = defaultValueProcessorNL, concatOperator = "||", wordOrder = "SVO" } = opts !== null && opts !== void 0 ? opts : ( /* istanbul ignore next */ {});
3424
+ // v8 ignore next
3425
+ const { fieldData, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "", quoteValuesWith = `'`, operatorProcessor = defaultOperatorProcessorNL, valueProcessor = defaultValueProcessorNL, concatOperator = "||", wordOrder = "SVO" } = opts !== null && opts !== void 0 ? opts : /* v8 ignore start -- @preserve */ {};
3092
3426
  const processedField = getQuotedFieldName((_fieldData$label = fieldData === null || fieldData === void 0 ? void 0 : fieldData.label) !== null && _fieldData$label !== void 0 ? _fieldData$label : field, {
3093
3427
  quoteFieldNamesWith,
3094
3428
  fieldIdentifierSeparator
@@ -3187,7 +3521,7 @@ const defaultRuleProcessorSQL = (rule, opts = {}) => {
3187
3521
  * @group Export
3188
3522
  */
3189
3523
  const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3190
- // istanbul ignore next
3524
+ // v8 ignore next
3191
3525
  const { fieldData, format, getNextNamedParam, parseNumbers, paramPrefix, paramsKeepPrefix, numberedParams, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator, concatOperator, operatorProcessor = defaultOperatorProcessorSQL, valueProcessor = defaultValueProcessorByRule } = opts !== null && opts !== void 0 ? opts : {};
3192
3526
  const { processedParams = [] } = meta !== null && meta !== void 0 ? meta : {};
3193
3527
  const parameterized = format === "parameterized";
@@ -3206,13 +3540,13 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3206
3540
  });
3207
3541
  const ruleField = wrapFieldName(rule.field);
3208
3542
  const matchEval = processMatchMode(rule);
3543
+ /* v8 ignore start -- @preserve */
3209
3544
  if (matchEval === false) return;
3210
3545
  else if (matchEval) {
3211
3546
  if ((opts === null || opts === void 0 ? void 0 : opts.preset) !== "postgresql") return finalize("");
3212
3547
  const { mode, threshold } = matchEval;
3213
3548
  const arrayElementAlias = "elem_alias";
3214
3549
  const { sql: nestedSQL, params: nestedParams } = defaultRuleGroupProcessorParameterized(transformQuery(rule.value, { ruleProcessor: (r) => _objectSpread2(_objectSpread2({}, r), {}, { field: arrayElementAlias }) }), _objectSpread2(_objectSpread2({}, opts), {}, { fields: [] }));
3215
- // istanbul ignore else
3216
3550
  if (Array.isArray(nestedParams)) params.push(...nestedParams);
3217
3551
  else Object.assign(paramsNamed, nestedParams);
3218
3552
  switch (mode) {
@@ -3227,6 +3561,7 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3227
3561
  }
3228
3562
  }
3229
3563
  }
3564
+ /* v8 ignore stop -- @preserve */
3230
3565
  const value = valueProcessor(rule, {
3231
3566
  parseNumbers,
3232
3567
  quoteFieldNamesWith,
@@ -3267,7 +3602,7 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3267
3602
  }
3268
3603
  let paramValue = rule.value;
3269
3604
  if (typeof rule.value === "string") if (shouldRenderAsNumber(rule.value, parseNumbers)) paramValue = parseNumber(rule.value, { parseNumbers });
3270
- else paramValue = /^'.*'$/g.test(value) ? value.replaceAll(/(^'|'$)/g, "") : value;
3605
+ else paramValue = /^'.*'$/g.test(value) ? value.replaceAll(/(^'|'$)/g, "") : /* v8 ignore next -- @preserve */ value;
3271
3606
  let paramName = "";
3272
3607
  if (parameterized) params.push(paramValue);
3273
3608
  else {
@@ -3286,9 +3621,9 @@ const processNumber = (value, fallback, parseNumbers) => shouldRenderAsNumber(va
3286
3621
  */
3287
3622
  const defaultRuleProcessorPrisma = (rule, options = {}) => {
3288
3623
  const { field, operator, value, valueSource } = rule;
3289
- // istanbul ignore next
3624
+ // v8 ignore next
3290
3625
  const { parseNumbers, preserveValueOrder } = options;
3291
- if (valueSource === "field" || processMatchMode(rule)) return;
3626
+ if (valueSource === "field" || processMatchMode(rule)) return void 0;
3292
3627
  const operatorLC = lc(operator);
3293
3628
  switch (operatorLC) {
3294
3629
  case "=": return { [field]: processNumber(value, value, parseNumbers) };
@@ -3346,7 +3681,7 @@ const defaultRuleProcessorPrisma = (rule, options = {}) => {
3346
3681
  */
3347
3682
  const defaultRuleProcessorSequelize = (rule, { parseNumbers, preserveValueOrder, context = {} } = {}) => {
3348
3683
  const { sequelizeOperators: Op, sequelizeCol: col, sequelizeFn: fn } = context;
3349
- if (processMatchMode(rule)) return;
3684
+ if (processMatchMode(rule)) return void 0;
3350
3685
  const { field, operator, value, valueSource } = rule;
3351
3686
  const valueIsField = valueSource === "field";
3352
3687
  const operatorLC = lc(operator);
@@ -3450,9 +3785,10 @@ const defaultRuleProcessors = {
3450
3785
  prisma: defaultRuleProcessorPrisma,
3451
3786
  sequelize: defaultRuleProcessorSequelize,
3452
3787
  spel: defaultRuleProcessorSpEL,
3453
- sql: defaultRuleProcessorSQL
3788
+ sql: defaultRuleProcessorSQL,
3789
+ diagnostics: defaultRuleProcessorSQL
3454
3790
  };
3455
- /* istanbul ignore next */
3791
+ /* v8 ignore next -- @preserve */
3456
3792
  const defaultOperatorProcessor = (r) => r.operator;
3457
3793
  const defaultOperatorProcessors = {
3458
3794
  cel: defaultOperatorProcessor,
@@ -3471,7 +3807,8 @@ const defaultOperatorProcessors = {
3471
3807
  prisma: defaultOperatorProcessor,
3472
3808
  sequelize: defaultOperatorProcessor,
3473
3809
  spel: defaultOperatorProcessor,
3474
- sql: defaultOperatorProcessorSQL
3810
+ sql: defaultOperatorProcessorSQL,
3811
+ diagnostics: defaultOperatorProcessor
3475
3812
  };
3476
3813
  const defaultFallbackExpressions = {
3477
3814
  cel: "1 == 1",
@@ -3540,31 +3877,34 @@ function formatQuery(ruleGroup, optionParam = {}) {
3540
3877
  const fields = toFullOptionList(optObj.fields);
3541
3878
  const getOperators = (f, m) => {
3542
3879
  var _getOperators_option;
3543
- return toFullOptionList((_getOperators_option = getOperators_option(f, m)) !== null && _getOperators_option !== void 0 ? _getOperators_option : []);
3880
+ return toFullOptionList((_getOperators_option = getOperators_option(f, m)) !== null && _getOperators_option !== void 0 ? _getOperators_option :
3881
+ /* v8 ignore start -- @preserve */ []);
3544
3882
  };
3545
3883
  const fallbackExpression = (_ref4 = fallbackExpression_option !== null && fallbackExpression_option !== void 0 ? fallbackExpression_option : defaultFallbackExpressions[format]) !== null && _ref4 !== void 0 ? _ref4 : defaultFallbackExpressions.sql;
3546
3884
  let validationMap = {};
3547
- // istanbul ignore else
3885
+ // v8 ignore else
3548
3886
  if (typeof validator === "function") {
3549
3887
  const validationResult = validator(ruleGroup);
3550
3888
  if (typeof validationResult === "boolean") {
3551
- // istanbul ignore else
3552
- if (!validationResult) return format === "parameterized" ? {
3553
- sql: fallbackExpression,
3554
- params: []
3555
- } : format === "parameterized_named" ? {
3556
- sql: fallbackExpression,
3557
- params: {}
3558
- } : format === "mongodb" ? `{${fallbackExpression}}` : format === "mongodb_query" ? mongoDbFallback : format === "prisma" ? prismaFallback : format === "jsonlogic" ? false : format === "elasticsearch" ? {} : format === "drizzle" || format === "sequelize" ? void 0 : fallbackExpression;
3889
+ // v8 ignore else
3890
+ if (!validationResult) {
3891
+ if (format !== "diagnostics") return format === "parameterized" ? {
3892
+ sql: fallbackExpression,
3893
+ params: []
3894
+ } : format === "parameterized_named" ? {
3895
+ sql: fallbackExpression,
3896
+ params: {}
3897
+ } : format === "mongodb" ? `{${fallbackExpression}}` : format === "mongodb_query" ? mongoDbFallback : format === "prisma" ? prismaFallback : format === "jsonlogic" ? false : format === "elasticsearch" ? {} : format === "drizzle" || format === "sequelize" ? void 0 : fallbackExpression;
3898
+ }
3559
3899
  } else validationMap = validationResult;
3560
3900
  }
3561
3901
  const validatorMap = {};
3562
3902
  const uniqueFields = toFlatOptionArray(fields);
3563
3903
  for (const f of uniqueFields)
3564
- // istanbul ignore else
3904
+ // v8 ignore else
3565
3905
  if (typeof f.validator === "function") {
3566
3906
  var _f$value;
3567
- validatorMap[(_f$value = f.value) !== null && _f$value !== void 0 ? _f$value : f.name] = f.validator;
3907
+ validatorMap[(_f$value = f.value) !== null && _f$value !== void 0 ? _f$value : /* v8 ignore start -- @preserve */ f.name] = f.validator;
3568
3908
  }
3569
3909
  const validateRule = (rule) => {
3570
3910
  let validationResult;
@@ -3574,7 +3914,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
3574
3914
  const fieldArr = uniqueFields.filter((f) => f.name === rule.field);
3575
3915
  if (fieldArr.length > 0) {
3576
3916
  const field = fieldArr[0];
3577
- // istanbul ignore else
3917
+ // v8 ignore else
3578
3918
  if (typeof field.validator === "function") fieldValidator = field.validator;
3579
3919
  }
3580
3920
  }
@@ -3617,6 +3957,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
3617
3957
  case "prisma": return defaultRuleGroupProcessorPrisma(ruleGroup, finalOptions);
3618
3958
  case "drizzle": return defaultRuleGroupProcessorDrizzle(ruleGroup, finalOptions);
3619
3959
  case "sequelize": return defaultRuleGroupProcessorSequelize(ruleGroup, finalOptions);
3960
+ case "diagnostics": return defaultRuleGroupProcessorDiagnostics(ruleGroup, finalOptions);
3620
3961
  default: return "";
3621
3962
  }
3622
3963
  }
@@ -3767,6 +4108,7 @@ const generateAccessibleDescription = (params) => pathsAreEqual([], params.path)
3767
4108
  //#endregion
3768
4109
  //#region src/utils/generateID.ts
3769
4110
  const cryptoModule = globalThis.crypto;
4111
+ const uuidV4regex = /^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i;
3770
4112
  /**
3771
4113
  * Default `id` generator. Generates a valid v4 UUID. Uses `crypto.randomUUID()`
3772
4114
  * when available, otherwise uses an alternate method based on `getRandomValues`.
@@ -3776,11 +4118,11 @@ const cryptoModule = globalThis.crypto;
3776
4118
  * ```
3777
4119
  * @returns Valid v4 UUID
3778
4120
  */
3779
- // istanbul ignore next
4121
+ // v8 ignore next
3780
4122
  let generateID = () => "00-0-4-2-000".replaceAll(/[^-]/g, (s) => ((Math.random() + Math.trunc(s)) * 65536 >> Number.parseInt(s)).toString(16).padStart(4, "0"));
3781
- // istanbul ignore else
4123
+ // v8 ignore else
3782
4124
  if (cryptoModule) {
3783
- // istanbul ignore else
4125
+ // v8 ignore else
3784
4126
  if (typeof cryptoModule.randomUUID === "function") generateID = () => cryptoModule.randomUUID();
3785
4127
  else if (typeof cryptoModule.getRandomValues === "function") {
3786
4128
  const position19vals = "89ab";
@@ -3814,7 +4156,7 @@ const dummyFD$1 = {
3814
4156
  */
3815
4157
  const getMatchModesUtil = (fieldData, getMatchModes) => {
3816
4158
  var _fd$matchModes, _matchModes$map;
3817
- const fd = fieldData ? toFullOption(fieldData) : dummyFD$1;
4159
+ const fd = fieldData ? toFullOption(fieldData) : /* v8 ignore next -- @preserve */ dummyFD$1;
3818
4160
  let matchModes = (_fd$matchModes = fd.matchModes) !== null && _fd$matchModes !== void 0 ? _fd$matchModes : false;
3819
4161
  if (!matchModes && getMatchModes) matchModes = getMatchModes(fd.value, { fieldData: fd });
3820
4162
  if (matchModes === true) return defaultMatchModes;
@@ -3883,7 +4225,7 @@ const getValueSourcesUtil = (fieldData, operator, getValueSources) => {
3883
4225
  const mergeAnyTranslations = (base, ...otherTranslations) => {
3884
4226
  const result = _objectSpread2({}, base);
3885
4227
  for (const translations of otherTranslations)
3886
- // istanbul ignore else
4228
+ // v8 ignore else
3887
4229
  if (translations) for (const key of objectKeys(translations)) {
3888
4230
  if (isUnsafeKey(key)) continue;
3889
4231
  if (result[key]) result[key] = _objectSpread2(_objectSpread2({}, result[key]), translations[key]);
@@ -3945,6 +4287,8 @@ const mergeClassnames = (...args) => ({
3945
4287
  dndCopy: joinClassnamesByName("dndCopy", args),
3946
4288
  dndGroup: joinClassnamesByName("dndGroup", args),
3947
4289
  dndDropNotAllowed: joinClassnamesByName("dndDropNotAllowed", args),
4290
+ dndPreviewPosition: joinClassnamesByName("dndPreviewPosition", args),
4291
+ dndHidden: joinClassnamesByName("dndHidden", args),
3948
4292
  disabled: joinClassnamesByName("disabled", args),
3949
4293
  valueListItem: joinClassnamesByName("valueListItem", args),
3950
4294
  matchMode: joinClassnamesByName("matchMode", args),
@@ -4023,7 +4367,7 @@ const regenerateIDs = (subject, { idGenerator = generateID } = {}) => {
4023
4367
  if (!isPojo(subject)) return subject;
4024
4368
  if (!isRuleGroup(subject)) return structuredClone(_objectSpread2(_objectSpread2({}, subject), {}, { id: idGenerator() }));
4025
4369
  const newGroup = _objectSpread2(_objectSpread2({}, subject), {}, { id: idGenerator() });
4026
- // istanbul ignore else
4370
+ // v8 ignore else
4027
4371
  if (Array.isArray(newGroup.rules)) newGroup.rules = subject.rules.map((r) => typeof r === "string" ? r : isRuleGroup(r) ? regenerateIDs(r, { idGenerator }) : regenerateID(r, { idGenerator }));
4028
4372
  return newGroup;
4029
4373
  };
@@ -4332,6 +4676,6 @@ const groupInPlace = (query, sourcePathOrID, targetPathOrID, options = {}) => {
4332
4676
  return query;
4333
4677
  };
4334
4678
  //#endregion
4335
- export { LogType, TestID, add, addInPlace, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, convertFromIC, convertQuery, convertToIC, defaultCELValueProcessor, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleProcessorCEL, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFirstOption, getMatchModesUtil, getNLTranslataion, getOption, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getValidationClassNames, getValueSourcesUtil, group, groupInPlace, groupInvalidReasons, insert, insertInPlace, isAncestor, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isUnsafeKey, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, moveInPlace, normalizeConstituentWordOrder, nullFreeArray, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, remove, removeInPlace, rootPath, shouldRenderAsNumber, splitBy, sqlDialectPresets, standardClassnames, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update, updateInPlace };
4679
+ export { LogType, TestID, add, addInPlace, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, convertFromIC, convertQuery, convertToIC, defaultCELValueProcessor, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleProcessorCEL, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFirstOption, getMatchModesUtil, getNLTranslataion, getOption, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getValidationClassNames, getValueSourcesUtil, group, groupInPlace, groupInvalidReasons, insert, insertInPlace, isAncestor, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isUnsafeKey, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, moveInPlace, normalizeConstituentWordOrder, nullFreeArray, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, remove, removeInPlace, rootPath, shouldRenderAsNumber, splitBy, sqlDialectPresets, standardClassnames, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update, updateInPlace, uuidV4regex };
4336
4680
 
4337
4681
  //# sourceMappingURL=react-querybuilder_core.legacy-esm.js.map