@react-querybuilder/core 8.14.3 → 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 (95) 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 +400 -62
  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 -3
  12. package/dist/formatQuery.d.ts +24 -3
  13. package/dist/formatQuery.js +379 -51
  14. package/dist/formatQuery.js.map +1 -1
  15. package/dist/formatQuery.mjs +379 -52
  16. package/dist/formatQuery.mjs.map +1 -1
  17. package/dist/{import-Bltb2mT4.d.mts → import-0wp72lLT.d.mts} +2 -2
  18. package/dist/{import-B5Iq8XmL.d.ts → import-yRVJh7E1.d.ts} +2 -2
  19. package/dist/{basic-BXJVfD0P.d.ts → index-D5TXNIzF.d.ts} +595 -3
  20. package/dist/{basic-CNIjb6rI.d.mts → index-Lht_Wq3V.d.mts} +595 -3
  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 -3
  38. package/dist/parseJsonLogic.d.ts +2 -3
  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 +441 -93
  70. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  71. package/dist/react-querybuilder_core.mjs +399 -63
  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 +12 -16
  86. package/dist/convertQuery-CeJSNn37.mjs.map +0 -1
  87. package/dist/convertQuery-J8LpTG-7.js.map +0 -1
  88. package/dist/export-6x7MilFR.d.mts +0 -451
  89. package/dist/export-CpJOQuZv.d.ts +0 -451
  90. package/dist/objectUtils-ButT0Mng.js.map +0 -1
  91. package/dist/objectUtils-C0WB-8ex.mjs.map +0 -1
  92. package/dist/prepareQueryObjects-BfMlS4ql.mjs.map +0 -1
  93. package/dist/prepareQueryObjects-DO3qXriW.js.map +0 -1
  94. package/dist/utils-BlMGIhvx.mjs.map +0 -1
  95. 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.121.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.121.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.121.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.121.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.121.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.121.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.121.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;
@@ -1634,10 +1646,11 @@ const mongoDbFallback = { $and: [{ $expr: true }] };
1634
1646
  * @group Export
1635
1647
  */
1636
1648
  const defaultRuleGroupProcessorMongoDBQuery = (ruleGroup, options, meta) => {
1637
- const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1649
+ const { context, fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1650
+ const { inExpressionContext } = context !== null && context !== void 0 ? context : {};
1638
1651
  const processRuleGroup = (rg, outermost) => {
1639
1652
  var _rg$id;
1640
- 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;
1641
1654
  const combinator = `$${lc(rg.combinator)}`;
1642
1655
  let hasChildRules = false;
1643
1656
  const expressions = rg.rules.map((rule) => {
@@ -1658,7 +1671,7 @@ const defaultRuleGroupProcessorMongoDBQuery = (ruleGroup, options, meta) => {
1658
1671
  }), meta);
1659
1672
  }).filter(Boolean);
1660
1673
  const result = expressions.length > 0 ? expressions.length === 1 && !hasChildRules ? expressions[0] : { [combinator]: expressions } : mongoDbFallback;
1661
- return rg.not ? { $not: result } : result;
1674
+ return rg.not ? inExpressionContext ? { $not: result } : { $nor: [result] } : result;
1662
1675
  };
1663
1676
  return processRuleGroup(convertFromIC(ruleGroup), true);
1664
1677
  };
@@ -1686,7 +1699,10 @@ const defaultRuleProcessorMongoDBQuery = (rule, options = {}) => {
1686
1699
  }));
1687
1700
  const subQueryWithAggCtx = defaultRuleGroupProcessorMongoDBQuery(transformQuery(value, { ruleProcessor: (r) => _objectSpread2(_objectSpread2({}, r), {}, { field: r.field ? `$item.${r.field}` : "$item" }) }), _objectSpread2(_objectSpread2({}, options), {}, {
1688
1701
  ruleProcessor: defaultRuleProcessorMongoDBQuery,
1689
- context: _objectSpread2(_objectSpread2({}, options.context), {}, { avoidFieldsAsKeys: true })
1702
+ context: _objectSpread2(_objectSpread2({}, options.context), {}, {
1703
+ avoidFieldsAsKeys: true,
1704
+ inExpressionContext: true
1705
+ })
1690
1706
  }));
1691
1707
  const filteredCount = { $size: { $ifNull: [{ $filter: {
1692
1708
  input: `$${field}`,
@@ -1800,7 +1816,7 @@ const defaultRuleGroupProcessorSpEL = (ruleGroup, options) => {
1800
1816
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1801
1817
  const processRuleGroup = (rg, outermost) => {
1802
1818
  var _rg$id;
1803
- 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 : "";
1804
1820
  const processedRules = [];
1805
1821
  let precedingCombinator = "";
1806
1822
  let firstRule = true;
@@ -1987,22 +2003,22 @@ const defaultValueProcessorByRule = ({ operator, value, valueSource }, { escapeQ
1987
2003
  * @group Export
1988
2004
  */
1989
2005
  const defaultRuleProcessorDrizzle = (rule, _options) => {
1990
- const opts = _options !== null && _options !== void 0 ? _options : ( /* istanbul ignore next */ {});
1991
- // istanbul ignore next
2006
+ const opts = _options !== null && _options !== void 0 ? _options : /* v8 ignore start -- @preserve */ {};
2007
+ // v8 ignore next
1992
2008
  const { parseNumbers, preserveValueOrder, context = {} } = opts;
1993
2009
  const { columns, drizzleOperators, useRawFields } = context;
1994
- if (!columns || !drizzleOperators) return;
2010
+ if (!columns || !drizzleOperators) return void 0;
1995
2011
  const { between, eq, gt, gte, inArray, isNotNull, isNull, like, lt, lte, ne, notBetween, notInArray, notLike, sql } = drizzleOperators;
1996
2012
  const { field, operator, value, valueSource } = rule;
1997
2013
  const column = useRawFields && /[a-z][a-z0-9]*/i.test(field) ? sql.raw(field) : columns[field];
1998
2014
  const operatorLC = lc(operator);
1999
2015
  const valueIsField = valueSource === "field";
2000
2016
  const asFieldOrValue = (v) => valueIsField ? columns[v] : v;
2001
- if (!column) return;
2017
+ if (!column) return void 0;
2002
2018
  const matchEval = processMatchMode(rule);
2003
2019
  if (matchEval === false) return;
2004
2020
  else if (matchEval) {
2005
- if (opts.preset !== "postgresql") return;
2021
+ if (opts.preset !== "postgresql") return void 0;
2006
2022
  const { mode, threshold } = matchEval;
2007
2023
  const arrayElementAlias = "elem_alias";
2008
2024
  const nestedArrayFilter = defaultRuleGroupProcessorDrizzle(transformQuery(rule.value, { ruleProcessor: (r) => _objectSpread2(_objectSpread2({}, r), {}, { field: arrayElementAlias }) }), _objectSpread2(_objectSpread2({}, opts), {}, { context: _objectSpread2(_objectSpread2({}, opts.context), {}, { useRawFields: true }) }));
@@ -2082,12 +2098,12 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
2082
2098
  */
2083
2099
  const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns, drizzleOperators) => {
2084
2100
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, validateRule, validationMap } = options;
2085
- if (!columns || !drizzleOperators) return;
2101
+ if (!columns || !drizzleOperators) return void 0;
2086
2102
  const { and, not, or } = drizzleOperators;
2087
2103
  const ruleProcessor = defaultRuleProcessorDrizzle;
2088
2104
  const processRuleGroup = (rg, _outermost) => {
2089
2105
  var _rg$id;
2090
- 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;
2091
2107
  const processedRules = rg.rules.map((rule) => {
2092
2108
  if (isRuleGroup(rule)) return processRuleGroup(rule);
2093
2109
  const [validationResult, fieldValidator] = validateRule(rule);
@@ -2119,7 +2135,7 @@ const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
2119
2135
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2120
2136
  const processRuleGroup = (rg) => {
2121
2137
  var _rg$id;
2122
- 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;
2123
2139
  const processedRules = rg.rules.map((rule) => {
2124
2140
  if (isRuleGroup(rule)) return processRuleGroup(rule);
2125
2141
  const [validationResult, fieldValidator] = validateRule(rule);
@@ -2147,7 +2163,7 @@ const defaultRuleGroupProcessorJSONata = (ruleGroup, options) => {
2147
2163
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2148
2164
  const processRuleGroup = (rg, outermost) => {
2149
2165
  var _rg$id;
2150
- 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 : "";
2151
2167
  const processedRules = [];
2152
2168
  let precedingCombinator = "";
2153
2169
  let firstRule = true;
@@ -2204,7 +2220,7 @@ const defaultRuleGroupProcessorJsonLogic = (ruleGroup, options) => {
2204
2220
  const query = convertFromIC(ruleGroup);
2205
2221
  const processRuleGroup = (rg, _outermost) => {
2206
2222
  var _rg$id;
2207
- 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;
2208
2224
  const processedRules = rg.rules.map((rule) => {
2209
2225
  if (isRuleGroup(rule)) return processRuleGroup(rule);
2210
2226
  const [validationResult, fieldValidator] = validateRule(rule);
@@ -2232,7 +2248,7 @@ const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
2232
2248
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2233
2249
  const processRuleGroup = (rg, outermost) => {
2234
2250
  var _rg$id;
2235
- 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 : "";
2236
2252
  const rules = rg.rules.map((rule) => {
2237
2253
  var _rule$valueSource;
2238
2254
  if (isRuleGroup(rule)) return processRuleGroup(rule);
@@ -2266,7 +2282,7 @@ const defaultRuleGroupProcessorMongoDB = (ruleGroup, options, meta) => {
2266
2282
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2267
2283
  const processRuleGroup = (rg, outermost) => {
2268
2284
  var _rg$id;
2269
- 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 : "";
2270
2286
  const combinator = `"$${lc(rg.combinator)}"`;
2271
2287
  let hasChildRules = false;
2272
2288
  const expressions = rg.rules.map((rule) => {
@@ -2287,7 +2303,7 @@ const defaultRuleGroupProcessorMongoDB = (ruleGroup, options, meta) => {
2287
2303
  }), meta);
2288
2304
  }).filter(Boolean);
2289
2305
  const result = expressions.length > 0 ? expressions.length === 1 && !hasChildRules ? expressions[0] : `${combinator}:[${expressions.join(",")}]` : fallbackExpression;
2290
- return rg.not ? `"$not":${isBracketed(result) ? result : `{${result}}`}` : result;
2306
+ return rg.not ? `"$nor":[${isBracketed(result) ? result : `{${result}}`}]` : result;
2291
2307
  };
2292
2308
  const processedQuery = processRuleGroup(convertFromIC(ruleGroup), true);
2293
2309
  return isBracketed(processedQuery) ? processedQuery : `{${processedQuery}}`;
@@ -2303,7 +2319,7 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
2303
2319
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, translations, validateRule, validationMap } = options;
2304
2320
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2305
2321
  var _rg$id, _rg2$combinator2, _translations2;
2306
- 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 */ "";
2307
2323
  const rg2 = isRuleGroupTypeIC(rg) && rg.rules.some((r) => typeof r === "string" && lc(r) === "xor") ? convertFromIC(rg) : rg;
2308
2324
  const processedRules = [];
2309
2325
  let precedingCombinator = "";
@@ -2317,8 +2333,9 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
2317
2333
  }
2318
2334
  if (isRuleGroup(rule)) {
2319
2335
  var _rg2$combinator;
2320
- const processedGroup = processRuleGroup(rule, rg2.rules.length === 1 && !(rg2.not || /^xor$/i.test((_rg2$combinator = rg2.combinator) !== null && _rg2$combinator !== void 0 ? _rg2$combinator : "")));
2321
- // 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
2322
2339
  if (processedGroup) {
2323
2340
  if (!firstRule && precedingCombinator) {
2324
2341
  processedRules.push(precedingCombinator);
@@ -2392,7 +2409,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
2392
2409
  if (!isPojo(processedRule)) return "";
2393
2410
  const { sql, params: customParams } = processedRule;
2394
2411
  if (typeof sql !== "string" || !sql) return "";
2395
- // istanbul ignore else
2412
+ // v8 ignore else
2396
2413
  if (format === "parameterized" && Array.isArray(customParams)) params.push(...customParams);
2397
2414
  else if (format === "parameterized_named" && isPojo(customParams)) {
2398
2415
  var _fieldParams$get;
@@ -2403,7 +2420,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
2403
2420
  };
2404
2421
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2405
2422
  var _rg$id;
2406
- 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 */ "";
2407
2424
  const processedRules = [];
2408
2425
  let precedingCombinator = "";
2409
2426
  let firstRule = true;
@@ -2414,7 +2431,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
2414
2431
  }
2415
2432
  if (isRuleGroup(rule)) {
2416
2433
  const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
2417
- // istanbul ignore else
2434
+ // v8 ignore else
2418
2435
  if (processedGroup) {
2419
2436
  if (!firstRule && precedingCombinator) {
2420
2437
  processedRules.push(precedingCombinator);
@@ -2464,7 +2481,7 @@ const defaultRuleGroupProcessorPrisma = (ruleGroup, options) => {
2464
2481
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2465
2482
  const processRuleGroup = (rg, outermost) => {
2466
2483
  var _rg$id;
2467
- 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;
2468
2485
  const combinator = rg.combinator.toUpperCase();
2469
2486
  let hasChildRules = false;
2470
2487
  const expressions = rg.rules.map((rule) => {
@@ -2497,13 +2514,13 @@ const defaultRuleGroupProcessorPrisma = (ruleGroup, options) => {
2497
2514
  * @group Export
2498
2515
  */
2499
2516
  const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
2500
- // istanbul ignore next
2517
+ // v8 ignore next
2501
2518
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap, context = {} } = options;
2502
2519
  const { sequelizeOperators: Op } = context;
2503
- if (!Op) return;
2520
+ if (!Op) return void 0;
2504
2521
  const processRuleGroup = (rg, _outermost) => {
2505
2522
  var _rg$id;
2506
- 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;
2507
2524
  const combinator = rg.combinator.toUpperCase();
2508
2525
  let hasChildRules = false;
2509
2526
  const expressions = rg.rules.map((rule) => {
@@ -2523,7 +2540,7 @@ const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
2523
2540
  fieldData
2524
2541
  }));
2525
2542
  }).filter(Boolean);
2526
- if (expressions.length === 0) return;
2543
+ if (expressions.length === 0) return void 0;
2527
2544
  const result = expressions.length === 1 && !hasChildRules ? expressions[0] : { [lc(combinator) === "or" ? Op.or : Op.and]: expressions };
2528
2545
  return rg.not ? { [Op.not]: result } : result;
2529
2546
  };
@@ -2540,7 +2557,7 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
2540
2557
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2541
2558
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2542
2559
  var _rg$id;
2543
- 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 */ "";
2544
2561
  const processedRules = [];
2545
2562
  let precedingCombinator = "";
2546
2563
  let firstRule = true;
@@ -2552,7 +2569,7 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
2552
2569
  }
2553
2570
  if (isRuleGroup(rule)) {
2554
2571
  const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
2555
- // istanbul ignore else
2572
+ // v8 ignore else
2556
2573
  if (processedGroup) {
2557
2574
  if (!firstRule && precedingCombinator) {
2558
2575
  processedRules.push(precedingCombinator);
@@ -2587,6 +2604,324 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
2587
2604
  return processRuleGroup(ruleGroup, true);
2588
2605
  };
2589
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
2590
2925
  //#region src/utils/formatQuery/defaultRuleProcessorElasticSearch.ts
2591
2926
  const rangeOperatorMap = {
2592
2927
  "<": "lt",
@@ -2960,12 +3295,12 @@ const defaultRuleProcessorLDAP = (rule, options = {}) => {
2960
3295
  return negateIf(`(&(${field}>=${ldapEscape(firstValue)})(${field}<=${ldapEscape(secondValue)}))`, operatorLC === "notbetween");
2961
3296
  }
2962
3297
  }
2963
- // istanbul ignore next
3298
+ // v8 ignore next
2964
3299
  return "";
2965
3300
  };
2966
3301
  //#endregion
2967
3302
  //#region src/utils/formatQuery/defaultValueProcessorNL.ts
2968
- 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;
2969
3304
  /**
2970
3305
  * Default value processor used by {@link formatQuery} for "natural_language" format.
2971
3306
  *
@@ -2984,7 +3319,7 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
2984
3319
  quoteFieldNamesWith,
2985
3320
  fieldIdentifierSeparator
2986
3321
  });
2987
- const t = translations !== null && translations !== void 0 ? translations : ( /* istanbul ignore next */ {});
3322
+ const t = translations !== null && translations !== void 0 ? translations : /* v8 ignore start -- @preserve */ {};
2988
3323
  const orTL = (_t$or = t.or) !== null && _t$or !== void 0 ? _t$or : "or";
2989
3324
  const trueTL = (_t$true = t.true) !== null && _t$true !== void 0 ? _t$true : "true";
2990
3325
  const falseTL = (_t$false = t.false) !== null && _t$false !== void 0 ? _t$false : "false";
@@ -2996,7 +3331,8 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
2996
3331
  if (!valueIsField) return defaultValueProcessorByRule(rule, opts);
2997
3332
  const valueAsArray = toArray(rule.value, { retainEmptyStrings: true }).slice(0, 2).map((v) => {
2998
3333
  var _getOption$label, _getOption, _ref;
2999
- 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);
3000
3336
  });
3001
3337
  if (valueAsArray.length < 2 || !isValidValue(valueAsArray[0]) || !isValidValue(valueAsArray[1])) return "";
3002
3338
  return defaultValueProcessorByRule(_objectSpread2(_objectSpread2({}, rule), {}, { value: valueAsArray }), opts);
@@ -3007,14 +3343,16 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
3007
3343
  if (valueAsArray.length === 0) return "";
3008
3344
  const valStringArray = valueAsArray.map((v) => {
3009
3345
  var _getOption$label2, _getOption2, _ref2;
3010
- 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)}`;
3011
3348
  });
3012
3349
  if (valStringArray.length === 1) return valStringArray[0];
3013
3350
  return `(${`${valStringArray.slice(0, -1).join(", ")}${valStringArray.length > 2 ? "," : ""} ${orTL} ${valStringArray.at(-1)}`})`;
3014
3351
  }
3015
3352
  }
3016
3353
  if (typeof rule.value === "boolean") return rule.value ? trueTL : falseTL;
3017
- 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)}`;
3018
3356
  };
3019
3357
  //#endregion
3020
3358
  //#region src/utils/formatQuery/defaultRuleProcessorNL.ts
@@ -3043,7 +3381,7 @@ const defaultExportOperatorMap = {
3043
3381
  between: ["is between", "is between the values in"],
3044
3382
  notbetween: ["is not between", "is not between the values in"]
3045
3383
  };
3046
- /* istanbul ignore next */
3384
+ /* v8 ignore next -- @preserve */
3047
3385
  const defaultGetOperators = () => [];
3048
3386
  /**
3049
3387
  * Default operator processor used by {@link formatQuery} for "natural_language" format.
@@ -3053,7 +3391,7 @@ const defaultGetOperators = () => [];
3053
3391
  const defaultOperatorProcessorNL = (rule, opts = {}) => {
3054
3392
  var _getOption, _getOperators, _opts$fieldData, _ref, _operatorMap;
3055
3393
  const { field, operator, valueSource = "value" } = rule;
3056
- // istanbul ignore next
3394
+ // v8 ignore next
3057
3395
  const { getOperators = defaultGetOperators, operatorMap: operatorMapParam = defaultExportOperatorMap } = opts;
3058
3396
  const mergedOperatorMap = new Map(Object.entries(defaultExportOperatorMap));
3059
3397
  for (const [key, value] of Object.entries(operatorMapParam)) mergedOperatorMap.set(lc(key), value);
@@ -3067,7 +3405,7 @@ const defaultOperatorProcessorNL = (rule, opts = {}) => {
3067
3405
  name: field,
3068
3406
  value: field,
3069
3407
  label: field
3070
- } })) !== 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 : {
3071
3409
  name: normalizedOperator,
3072
3410
  value: normalizedOperator,
3073
3411
  label: normalizedOperator
@@ -3083,8 +3421,8 @@ const defaultOperatorProcessorNL = (rule, opts = {}) => {
3083
3421
  const defaultRuleProcessorNL = (rule, opts) => {
3084
3422
  var _fieldData$label;
3085
3423
  const { field, operator } = rule;
3086
- // istanbul ignore next
3087
- 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 */ {};
3088
3426
  const processedField = getQuotedFieldName((_fieldData$label = fieldData === null || fieldData === void 0 ? void 0 : fieldData.label) !== null && _fieldData$label !== void 0 ? _fieldData$label : field, {
3089
3427
  quoteFieldNamesWith,
3090
3428
  fieldIdentifierSeparator
@@ -3183,7 +3521,7 @@ const defaultRuleProcessorSQL = (rule, opts = {}) => {
3183
3521
  * @group Export
3184
3522
  */
3185
3523
  const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3186
- // istanbul ignore next
3524
+ // v8 ignore next
3187
3525
  const { fieldData, format, getNextNamedParam, parseNumbers, paramPrefix, paramsKeepPrefix, numberedParams, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator, concatOperator, operatorProcessor = defaultOperatorProcessorSQL, valueProcessor = defaultValueProcessorByRule } = opts !== null && opts !== void 0 ? opts : {};
3188
3526
  const { processedParams = [] } = meta !== null && meta !== void 0 ? meta : {};
3189
3527
  const parameterized = format === "parameterized";
@@ -3202,13 +3540,13 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3202
3540
  });
3203
3541
  const ruleField = wrapFieldName(rule.field);
3204
3542
  const matchEval = processMatchMode(rule);
3543
+ /* v8 ignore start -- @preserve */
3205
3544
  if (matchEval === false) return;
3206
3545
  else if (matchEval) {
3207
3546
  if ((opts === null || opts === void 0 ? void 0 : opts.preset) !== "postgresql") return finalize("");
3208
3547
  const { mode, threshold } = matchEval;
3209
3548
  const arrayElementAlias = "elem_alias";
3210
3549
  const { sql: nestedSQL, params: nestedParams } = defaultRuleGroupProcessorParameterized(transformQuery(rule.value, { ruleProcessor: (r) => _objectSpread2(_objectSpread2({}, r), {}, { field: arrayElementAlias }) }), _objectSpread2(_objectSpread2({}, opts), {}, { fields: [] }));
3211
- // istanbul ignore else
3212
3550
  if (Array.isArray(nestedParams)) params.push(...nestedParams);
3213
3551
  else Object.assign(paramsNamed, nestedParams);
3214
3552
  switch (mode) {
@@ -3223,6 +3561,7 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3223
3561
  }
3224
3562
  }
3225
3563
  }
3564
+ /* v8 ignore stop -- @preserve */
3226
3565
  const value = valueProcessor(rule, {
3227
3566
  parseNumbers,
3228
3567
  quoteFieldNamesWith,
@@ -3263,7 +3602,7 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
3263
3602
  }
3264
3603
  let paramValue = rule.value;
3265
3604
  if (typeof rule.value === "string") if (shouldRenderAsNumber(rule.value, parseNumbers)) paramValue = parseNumber(rule.value, { parseNumbers });
3266
- else paramValue = /^'.*'$/g.test(value) ? value.replaceAll(/(^'|'$)/g, "") : value;
3605
+ else paramValue = /^'.*'$/g.test(value) ? value.replaceAll(/(^'|'$)/g, "") : /* v8 ignore next -- @preserve */ value;
3267
3606
  let paramName = "";
3268
3607
  if (parameterized) params.push(paramValue);
3269
3608
  else {
@@ -3282,9 +3621,9 @@ const processNumber = (value, fallback, parseNumbers) => shouldRenderAsNumber(va
3282
3621
  */
3283
3622
  const defaultRuleProcessorPrisma = (rule, options = {}) => {
3284
3623
  const { field, operator, value, valueSource } = rule;
3285
- // istanbul ignore next
3624
+ // v8 ignore next
3286
3625
  const { parseNumbers, preserveValueOrder } = options;
3287
- if (valueSource === "field" || processMatchMode(rule)) return;
3626
+ if (valueSource === "field" || processMatchMode(rule)) return void 0;
3288
3627
  const operatorLC = lc(operator);
3289
3628
  switch (operatorLC) {
3290
3629
  case "=": return { [field]: processNumber(value, value, parseNumbers) };
@@ -3342,7 +3681,7 @@ const defaultRuleProcessorPrisma = (rule, options = {}) => {
3342
3681
  */
3343
3682
  const defaultRuleProcessorSequelize = (rule, { parseNumbers, preserveValueOrder, context = {} } = {}) => {
3344
3683
  const { sequelizeOperators: Op, sequelizeCol: col, sequelizeFn: fn } = context;
3345
- if (processMatchMode(rule)) return;
3684
+ if (processMatchMode(rule)) return void 0;
3346
3685
  const { field, operator, value, valueSource } = rule;
3347
3686
  const valueIsField = valueSource === "field";
3348
3687
  const operatorLC = lc(operator);
@@ -3446,9 +3785,10 @@ const defaultRuleProcessors = {
3446
3785
  prisma: defaultRuleProcessorPrisma,
3447
3786
  sequelize: defaultRuleProcessorSequelize,
3448
3787
  spel: defaultRuleProcessorSpEL,
3449
- sql: defaultRuleProcessorSQL
3788
+ sql: defaultRuleProcessorSQL,
3789
+ diagnostics: defaultRuleProcessorSQL
3450
3790
  };
3451
- /* istanbul ignore next */
3791
+ /* v8 ignore next -- @preserve */
3452
3792
  const defaultOperatorProcessor = (r) => r.operator;
3453
3793
  const defaultOperatorProcessors = {
3454
3794
  cel: defaultOperatorProcessor,
@@ -3467,7 +3807,8 @@ const defaultOperatorProcessors = {
3467
3807
  prisma: defaultOperatorProcessor,
3468
3808
  sequelize: defaultOperatorProcessor,
3469
3809
  spel: defaultOperatorProcessor,
3470
- sql: defaultOperatorProcessorSQL
3810
+ sql: defaultOperatorProcessorSQL,
3811
+ diagnostics: defaultOperatorProcessor
3471
3812
  };
3472
3813
  const defaultFallbackExpressions = {
3473
3814
  cel: "1 == 1",
@@ -3536,31 +3877,34 @@ function formatQuery(ruleGroup, optionParam = {}) {
3536
3877
  const fields = toFullOptionList(optObj.fields);
3537
3878
  const getOperators = (f, m) => {
3538
3879
  var _getOperators_option;
3539
- 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 */ []);
3540
3882
  };
3541
3883
  const fallbackExpression = (_ref4 = fallbackExpression_option !== null && fallbackExpression_option !== void 0 ? fallbackExpression_option : defaultFallbackExpressions[format]) !== null && _ref4 !== void 0 ? _ref4 : defaultFallbackExpressions.sql;
3542
3884
  let validationMap = {};
3543
- // istanbul ignore else
3885
+ // v8 ignore else
3544
3886
  if (typeof validator === "function") {
3545
3887
  const validationResult = validator(ruleGroup);
3546
3888
  if (typeof validationResult === "boolean") {
3547
- // istanbul ignore else
3548
- if (!validationResult) return format === "parameterized" ? {
3549
- sql: fallbackExpression,
3550
- params: []
3551
- } : format === "parameterized_named" ? {
3552
- sql: fallbackExpression,
3553
- params: {}
3554
- } : 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
+ }
3555
3899
  } else validationMap = validationResult;
3556
3900
  }
3557
3901
  const validatorMap = {};
3558
3902
  const uniqueFields = toFlatOptionArray(fields);
3559
3903
  for (const f of uniqueFields)
3560
- // istanbul ignore else
3904
+ // v8 ignore else
3561
3905
  if (typeof f.validator === "function") {
3562
3906
  var _f$value;
3563
- 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;
3564
3908
  }
3565
3909
  const validateRule = (rule) => {
3566
3910
  let validationResult;
@@ -3570,7 +3914,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
3570
3914
  const fieldArr = uniqueFields.filter((f) => f.name === rule.field);
3571
3915
  if (fieldArr.length > 0) {
3572
3916
  const field = fieldArr[0];
3573
- // istanbul ignore else
3917
+ // v8 ignore else
3574
3918
  if (typeof field.validator === "function") fieldValidator = field.validator;
3575
3919
  }
3576
3920
  }
@@ -3613,6 +3957,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
3613
3957
  case "prisma": return defaultRuleGroupProcessorPrisma(ruleGroup, finalOptions);
3614
3958
  case "drizzle": return defaultRuleGroupProcessorDrizzle(ruleGroup, finalOptions);
3615
3959
  case "sequelize": return defaultRuleGroupProcessorSequelize(ruleGroup, finalOptions);
3960
+ case "diagnostics": return defaultRuleGroupProcessorDiagnostics(ruleGroup, finalOptions);
3616
3961
  default: return "";
3617
3962
  }
3618
3963
  }
@@ -3763,6 +4108,7 @@ const generateAccessibleDescription = (params) => pathsAreEqual([], params.path)
3763
4108
  //#endregion
3764
4109
  //#region src/utils/generateID.ts
3765
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;
3766
4112
  /**
3767
4113
  * Default `id` generator. Generates a valid v4 UUID. Uses `crypto.randomUUID()`
3768
4114
  * when available, otherwise uses an alternate method based on `getRandomValues`.
@@ -3772,11 +4118,11 @@ const cryptoModule = globalThis.crypto;
3772
4118
  * ```
3773
4119
  * @returns Valid v4 UUID
3774
4120
  */
3775
- // istanbul ignore next
4121
+ // v8 ignore next
3776
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"));
3777
- // istanbul ignore else
4123
+ // v8 ignore else
3778
4124
  if (cryptoModule) {
3779
- // istanbul ignore else
4125
+ // v8 ignore else
3780
4126
  if (typeof cryptoModule.randomUUID === "function") generateID = () => cryptoModule.randomUUID();
3781
4127
  else if (typeof cryptoModule.getRandomValues === "function") {
3782
4128
  const position19vals = "89ab";
@@ -3810,7 +4156,7 @@ const dummyFD$1 = {
3810
4156
  */
3811
4157
  const getMatchModesUtil = (fieldData, getMatchModes) => {
3812
4158
  var _fd$matchModes, _matchModes$map;
3813
- const fd = fieldData ? toFullOption(fieldData) : dummyFD$1;
4159
+ const fd = fieldData ? toFullOption(fieldData) : /* v8 ignore next -- @preserve */ dummyFD$1;
3814
4160
  let matchModes = (_fd$matchModes = fd.matchModes) !== null && _fd$matchModes !== void 0 ? _fd$matchModes : false;
3815
4161
  if (!matchModes && getMatchModes) matchModes = getMatchModes(fd.value, { fieldData: fd });
3816
4162
  if (matchModes === true) return defaultMatchModes;
@@ -3879,7 +4225,7 @@ const getValueSourcesUtil = (fieldData, operator, getValueSources) => {
3879
4225
  const mergeAnyTranslations = (base, ...otherTranslations) => {
3880
4226
  const result = _objectSpread2({}, base);
3881
4227
  for (const translations of otherTranslations)
3882
- // istanbul ignore else
4228
+ // v8 ignore else
3883
4229
  if (translations) for (const key of objectKeys(translations)) {
3884
4230
  if (isUnsafeKey(key)) continue;
3885
4231
  if (result[key]) result[key] = _objectSpread2(_objectSpread2({}, result[key]), translations[key]);
@@ -3941,6 +4287,8 @@ const mergeClassnames = (...args) => ({
3941
4287
  dndCopy: joinClassnamesByName("dndCopy", args),
3942
4288
  dndGroup: joinClassnamesByName("dndGroup", args),
3943
4289
  dndDropNotAllowed: joinClassnamesByName("dndDropNotAllowed", args),
4290
+ dndPreviewPosition: joinClassnamesByName("dndPreviewPosition", args),
4291
+ dndHidden: joinClassnamesByName("dndHidden", args),
3944
4292
  disabled: joinClassnamesByName("disabled", args),
3945
4293
  valueListItem: joinClassnamesByName("valueListItem", args),
3946
4294
  matchMode: joinClassnamesByName("matchMode", args),
@@ -4019,7 +4367,7 @@ const regenerateIDs = (subject, { idGenerator = generateID } = {}) => {
4019
4367
  if (!isPojo(subject)) return subject;
4020
4368
  if (!isRuleGroup(subject)) return structuredClone(_objectSpread2(_objectSpread2({}, subject), {}, { id: idGenerator() }));
4021
4369
  const newGroup = _objectSpread2(_objectSpread2({}, subject), {}, { id: idGenerator() });
4022
- // istanbul ignore else
4370
+ // v8 ignore else
4023
4371
  if (Array.isArray(newGroup.rules)) newGroup.rules = subject.rules.map((r) => typeof r === "string" ? r : isRuleGroup(r) ? regenerateIDs(r, { idGenerator }) : regenerateID(r, { idGenerator }));
4024
4372
  return newGroup;
4025
4373
  };
@@ -4328,6 +4676,6 @@ const groupInPlace = (query, sourcePathOrID, targetPathOrID, options = {}) => {
4328
4676
  return query;
4329
4677
  };
4330
4678
  //#endregion
4331
- 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 };
4332
4680
 
4333
4681
  //# sourceMappingURL=react-querybuilder_core.legacy-esm.js.map