wcz-test 6.24.3 → 6.24.5

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 (43) hide show
  1. package/dist/chunks/{DialogsHooks-DOT0O_b4.js → DialogsHooks-DVnj8xmz.js} +178 -3
  2. package/dist/chunks/DialogsHooks-DVnj8xmz.js.map +1 -0
  3. package/dist/chunks/FileHooks-GprjzNKW.js +3554 -0
  4. package/dist/chunks/FileHooks-GprjzNKW.js.map +1 -0
  5. package/dist/chunks/RouterListItemButton-BvsZysDL.js +959 -0
  6. package/dist/chunks/RouterListItemButton-BvsZysDL.js.map +1 -0
  7. package/dist/chunks/_commonjsHelpers-BGn2FbsY.js +35 -0
  8. package/dist/chunks/_commonjsHelpers-BGn2FbsY.js.map +1 -0
  9. package/dist/chunks/env-Di2sjb5X.js +104 -0
  10. package/dist/chunks/env-Di2sjb5X.js.map +1 -0
  11. package/dist/chunks/i18next-Dx0Bahhj.js +2203 -0
  12. package/dist/chunks/i18next-Dx0Bahhj.js.map +1 -0
  13. package/dist/chunks/index-BrFiyyyk.js +327 -0
  14. package/dist/chunks/index-BrFiyyyk.js.map +1 -0
  15. package/dist/chunks/session-CPSUX_HJ.js +12970 -0
  16. package/dist/chunks/session-CPSUX_HJ.js.map +1 -0
  17. package/dist/chunks/useTranslation-D7I_DXWv.js +406 -0
  18. package/dist/chunks/useTranslation-D7I_DXWv.js.map +1 -0
  19. package/dist/chunks/utils-DtlCJSvY.js +2582 -0
  20. package/dist/chunks/utils-DtlCJSvY.js.map +1 -0
  21. package/dist/client.js +4 -4
  22. package/dist/components.js +2418 -7
  23. package/dist/components.js.map +1 -1
  24. package/dist/hooks.js +1011 -5
  25. package/dist/hooks.js.map +1 -1
  26. package/dist/index.js +448 -951
  27. package/dist/index.js.map +1 -1
  28. package/dist/queries.js +3 -3
  29. package/dist/server.js +5213 -4
  30. package/dist/server.js.map +1 -1
  31. package/dist/utils.js +5 -5
  32. package/package.json +1 -1
  33. package/dist/chunks/DialogsHooks-DOT0O_b4.js.map +0 -1
  34. package/dist/chunks/FileHooks-CF1bPDoe.js +0 -493
  35. package/dist/chunks/FileHooks-CF1bPDoe.js.map +0 -1
  36. package/dist/chunks/RouterListItemButton-DTYXk1kh.js +0 -35
  37. package/dist/chunks/RouterListItemButton-DTYXk1kh.js.map +0 -1
  38. package/dist/chunks/env-gsqZ6zZD.js +0 -30
  39. package/dist/chunks/env-gsqZ6zZD.js.map +0 -1
  40. package/dist/chunks/session-vW7WZadj.js +0 -91
  41. package/dist/chunks/session-vW7WZadj.js.map +0 -1
  42. package/dist/chunks/utils-MD9YwOtu.js +0 -91
  43. package/dist/chunks/utils-MD9YwOtu.js.map +0 -1
package/dist/hooks.js CHANGED
@@ -2,11 +2,10 @@ import { createFormHookContexts, createFormHook } from "@tanstack/react-form";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { c } from "react/compiler-runtime";
4
4
  import { Autocomplete, TextField, Checkbox, FormControlLabel, FormHelperText, FormControl, RadioGroup, Radio, FormLabel, Slider, Button, Switch } from "@mui/material";
5
- import { g as getFieldStatus } from "./chunks/utils-MD9YwOtu.js";
5
+ import { g as getFieldStatus } from "./chunks/utils-DtlCJSvY.js";
6
6
  import { DatePicker, DateRangePicker, TimePicker, TimeRangePicker, DateTimePicker, DateTimeRangePicker } from "@mui/x-date-pickers-pro";
7
- import { NumericFormat } from "react-number-format";
8
- import { u } from "./chunks/DialogsHooks-DOT0O_b4.js";
9
- import { useInView } from "react-intersection-observer";
7
+ import React__default, { useRef, useState, useEffect, useLayoutEffect, useMemo } from "react";
8
+ import { u, a } from "./chunks/DialogsHooks-DVnj8xmz.js";
10
9
  const FormAutocomplete = (t0) => {
11
10
  const $ = c(23);
12
11
  let autocompleteProps;
@@ -558,6 +557,1013 @@ const FormDateTimeRangePicker = (props) => {
558
557
  }
559
558
  return t6;
560
559
  };
560
+ function __rest(s, e) {
561
+ var t = {};
562
+ for (var p in s) {
563
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) {
564
+ t[p] = s[p];
565
+ }
566
+ }
567
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") {
568
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
569
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) {
570
+ t[p[i]] = s[p[i]];
571
+ }
572
+ }
573
+ }
574
+ return t;
575
+ }
576
+ var SourceType;
577
+ (function(SourceType2) {
578
+ SourceType2["event"] = "event";
579
+ SourceType2["props"] = "prop";
580
+ })(SourceType || (SourceType = {}));
581
+ function noop() {
582
+ }
583
+ function memoizeOnce(cb) {
584
+ var lastArgs;
585
+ var lastValue = void 0;
586
+ return function() {
587
+ var args = [], len = arguments.length;
588
+ while (len--) args[len] = arguments[len];
589
+ if (lastArgs && args.length === lastArgs.length && args.every(function(value, index) {
590
+ return value === lastArgs[index];
591
+ })) {
592
+ return lastValue;
593
+ }
594
+ lastArgs = args;
595
+ lastValue = cb.apply(void 0, args);
596
+ return lastValue;
597
+ };
598
+ }
599
+ function charIsNumber(char) {
600
+ return !!(char || "").match(/\d/);
601
+ }
602
+ function isNil(val) {
603
+ return val === null || val === void 0;
604
+ }
605
+ function isNanValue(val) {
606
+ return typeof val === "number" && isNaN(val);
607
+ }
608
+ function isNotValidValue(val) {
609
+ return isNil(val) || isNanValue(val) || typeof val === "number" && !isFinite(val);
610
+ }
611
+ function escapeRegExp(str) {
612
+ return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
613
+ }
614
+ function getThousandsGroupRegex(thousandsGroupStyle) {
615
+ switch (thousandsGroupStyle) {
616
+ case "lakh":
617
+ return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
618
+ case "wan":
619
+ return /(\d)(?=(\d{4})+(?!\d))/g;
620
+ case "thousand":
621
+ default:
622
+ return /(\d)(?=(\d{3})+(?!\d))/g;
623
+ }
624
+ }
625
+ function applyThousandSeparator(str, thousandSeparator, thousandsGroupStyle) {
626
+ var thousandsGroupRegex = getThousandsGroupRegex(thousandsGroupStyle);
627
+ var index = str.search(/[1-9]/);
628
+ index = index === -1 ? str.length : index;
629
+ return str.substring(0, index) + str.substring(index, str.length).replace(thousandsGroupRegex, "$1" + thousandSeparator);
630
+ }
631
+ function usePersistentCallback(cb) {
632
+ var callbackRef = useRef(cb);
633
+ callbackRef.current = cb;
634
+ var persistentCbRef = useRef(function() {
635
+ var args = [], len = arguments.length;
636
+ while (len--) args[len] = arguments[len];
637
+ return callbackRef.current.apply(callbackRef, args);
638
+ });
639
+ return persistentCbRef.current;
640
+ }
641
+ function splitDecimal(numStr, allowNegative) {
642
+ if (allowNegative === void 0) allowNegative = true;
643
+ var hasNegation = numStr[0] === "-";
644
+ var addNegation = hasNegation && allowNegative;
645
+ numStr = numStr.replace("-", "");
646
+ var parts = numStr.split(".");
647
+ var beforeDecimal = parts[0];
648
+ var afterDecimal = parts[1] || "";
649
+ return {
650
+ beforeDecimal,
651
+ afterDecimal,
652
+ hasNegation,
653
+ addNegation
654
+ };
655
+ }
656
+ function fixLeadingZero(numStr) {
657
+ if (!numStr) {
658
+ return numStr;
659
+ }
660
+ var isNegative = numStr[0] === "-";
661
+ if (isNegative) {
662
+ numStr = numStr.substring(1, numStr.length);
663
+ }
664
+ var parts = numStr.split(".");
665
+ var beforeDecimal = parts[0].replace(/^0+/, "") || "0";
666
+ var afterDecimal = parts[1] || "";
667
+ return (isNegative ? "-" : "") + beforeDecimal + (afterDecimal ? "." + afterDecimal : "");
668
+ }
669
+ function limitToScale(numStr, scale, fixedDecimalScale) {
670
+ var str = "";
671
+ var filler = fixedDecimalScale ? "0" : "";
672
+ for (var i = 0; i <= scale - 1; i++) {
673
+ str += numStr[i] || filler;
674
+ }
675
+ return str;
676
+ }
677
+ function repeat(str, count) {
678
+ return Array(count + 1).join(str);
679
+ }
680
+ function toNumericString(num) {
681
+ var _num = num + "";
682
+ var sign = _num[0] === "-" ? "-" : "";
683
+ if (sign) {
684
+ _num = _num.substring(1);
685
+ }
686
+ var ref = _num.split(/[eE]/g);
687
+ var coefficient = ref[0];
688
+ var exponent = ref[1];
689
+ exponent = Number(exponent);
690
+ if (!exponent) {
691
+ return sign + coefficient;
692
+ }
693
+ coefficient = coefficient.replace(".", "");
694
+ var decimalIndex = 1 + exponent;
695
+ var coffiecientLn = coefficient.length;
696
+ if (decimalIndex < 0) {
697
+ coefficient = "0." + repeat("0", Math.abs(decimalIndex)) + coefficient;
698
+ } else if (decimalIndex >= coffiecientLn) {
699
+ coefficient = coefficient + repeat("0", decimalIndex - coffiecientLn);
700
+ } else {
701
+ coefficient = (coefficient.substring(0, decimalIndex) || "0") + "." + coefficient.substring(decimalIndex);
702
+ }
703
+ return sign + coefficient;
704
+ }
705
+ function roundToPrecision(numStr, scale, fixedDecimalScale) {
706
+ if (["", "-"].indexOf(numStr) !== -1) {
707
+ return numStr;
708
+ }
709
+ var shouldHaveDecimalSeparator = (numStr.indexOf(".") !== -1 || fixedDecimalScale) && scale;
710
+ var ref = splitDecimal(numStr);
711
+ var beforeDecimal = ref.beforeDecimal;
712
+ var afterDecimal = ref.afterDecimal;
713
+ var hasNegation = ref.hasNegation;
714
+ var floatValue = parseFloat("0." + (afterDecimal || "0"));
715
+ var floatValueStr = afterDecimal.length <= scale ? "0." + afterDecimal : floatValue.toFixed(scale);
716
+ var roundedDecimalParts = floatValueStr.split(".");
717
+ var intPart = beforeDecimal;
718
+ if (beforeDecimal && Number(roundedDecimalParts[0])) {
719
+ intPart = beforeDecimal.split("").reverse().reduce(function(roundedStr, current, idx) {
720
+ if (roundedStr.length > idx) {
721
+ return (Number(roundedStr[0]) + Number(current)).toString() + roundedStr.substring(1, roundedStr.length);
722
+ }
723
+ return current + roundedStr;
724
+ }, roundedDecimalParts[0]);
725
+ }
726
+ var decimalPart = limitToScale(roundedDecimalParts[1] || "", scale, fixedDecimalScale);
727
+ var negation = hasNegation ? "-" : "";
728
+ var decimalSeparator = shouldHaveDecimalSeparator ? "." : "";
729
+ return "" + negation + intPart + decimalSeparator + decimalPart;
730
+ }
731
+ function setCaretPosition(el, caretPos) {
732
+ el.value = el.value;
733
+ if (el !== null) {
734
+ if (el.createTextRange) {
735
+ var range = el.createTextRange();
736
+ range.move("character", caretPos);
737
+ range.select();
738
+ return true;
739
+ }
740
+ if (el.selectionStart || el.selectionStart === 0) {
741
+ el.focus();
742
+ el.setSelectionRange(caretPos, caretPos);
743
+ return true;
744
+ }
745
+ el.focus();
746
+ return false;
747
+ }
748
+ }
749
+ var findChangeRange = memoizeOnce(function(prevValue, newValue) {
750
+ var i = 0, j = 0;
751
+ var prevLength = prevValue.length;
752
+ var newLength = newValue.length;
753
+ while (prevValue[i] === newValue[i] && i < prevLength) {
754
+ i++;
755
+ }
756
+ while (prevValue[prevLength - 1 - j] === newValue[newLength - 1 - j] && newLength - j > i && prevLength - j > i) {
757
+ j++;
758
+ }
759
+ return {
760
+ from: { start: i, end: prevLength - j },
761
+ to: { start: i, end: newLength - j }
762
+ };
763
+ });
764
+ var findChangedRangeFromCaretPositions = function(lastCaretPositions, currentCaretPosition) {
765
+ var startPosition = Math.min(lastCaretPositions.selectionStart, currentCaretPosition);
766
+ return {
767
+ from: { start: startPosition, end: lastCaretPositions.selectionEnd },
768
+ to: { start: startPosition, end: currentCaretPosition }
769
+ };
770
+ };
771
+ function clamp(num, min, max) {
772
+ return Math.min(Math.max(num, min), max);
773
+ }
774
+ function geInputCaretPosition(el) {
775
+ return Math.max(el.selectionStart, el.selectionEnd);
776
+ }
777
+ function addInputMode() {
778
+ return typeof navigator !== "undefined" && !(navigator.platform && /iPhone|iPod/.test(navigator.platform));
779
+ }
780
+ function getDefaultChangeMeta(value) {
781
+ return {
782
+ from: {
783
+ start: 0,
784
+ end: 0
785
+ },
786
+ to: {
787
+ start: 0,
788
+ end: value.length
789
+ },
790
+ lastValue: ""
791
+ };
792
+ }
793
+ function defaultIsCharacterSame(ref) {
794
+ var currentValue = ref.currentValue;
795
+ var formattedValue = ref.formattedValue;
796
+ var currentValueIndex = ref.currentValueIndex;
797
+ var formattedValueIndex = ref.formattedValueIndex;
798
+ return currentValue[currentValueIndex] === formattedValue[formattedValueIndex];
799
+ }
800
+ function getCaretPosition(newFormattedValue, lastFormattedValue, curValue, curCaretPos, boundary, isValidInputCharacter, isCharacterSame) {
801
+ if (isCharacterSame === void 0) isCharacterSame = defaultIsCharacterSame;
802
+ var firstAllowedPosition = boundary.findIndex(function(b) {
803
+ return b;
804
+ });
805
+ var prefixFormat = newFormattedValue.slice(0, firstAllowedPosition);
806
+ if (!lastFormattedValue && !curValue.startsWith(prefixFormat)) {
807
+ lastFormattedValue = prefixFormat;
808
+ curValue = prefixFormat + curValue;
809
+ curCaretPos = curCaretPos + prefixFormat.length;
810
+ }
811
+ var curValLn = curValue.length;
812
+ var formattedValueLn = newFormattedValue.length;
813
+ var addedIndexMap = {};
814
+ var indexMap = new Array(curValLn);
815
+ for (var i = 0; i < curValLn; i++) {
816
+ indexMap[i] = -1;
817
+ for (var j = 0, jLn = formattedValueLn; j < jLn; j++) {
818
+ var isCharSame = isCharacterSame({
819
+ currentValue: curValue,
820
+ lastValue: lastFormattedValue,
821
+ formattedValue: newFormattedValue,
822
+ currentValueIndex: i,
823
+ formattedValueIndex: j
824
+ });
825
+ if (isCharSame && addedIndexMap[j] !== true) {
826
+ indexMap[i] = j;
827
+ addedIndexMap[j] = true;
828
+ break;
829
+ }
830
+ }
831
+ }
832
+ var pos = curCaretPos;
833
+ while (pos < curValLn && (indexMap[pos] === -1 || !isValidInputCharacter(curValue[pos]))) {
834
+ pos++;
835
+ }
836
+ var endIndex = pos === curValLn || indexMap[pos] === -1 ? formattedValueLn : indexMap[pos];
837
+ pos = curCaretPos - 1;
838
+ while (pos > 0 && indexMap[pos] === -1) {
839
+ pos--;
840
+ }
841
+ var startIndex = pos === -1 || indexMap[pos] === -1 ? 0 : indexMap[pos] + 1;
842
+ if (startIndex > endIndex) {
843
+ return endIndex;
844
+ }
845
+ return curCaretPos - startIndex < endIndex - curCaretPos ? startIndex : endIndex;
846
+ }
847
+ function getCaretPosInBoundary(value, caretPos, boundary, direction) {
848
+ var valLn = value.length;
849
+ caretPos = clamp(caretPos, 0, valLn);
850
+ if (direction === "left") {
851
+ while (caretPos >= 0 && !boundary[caretPos]) {
852
+ caretPos--;
853
+ }
854
+ if (caretPos === -1) {
855
+ caretPos = boundary.indexOf(true);
856
+ }
857
+ } else {
858
+ while (caretPos <= valLn && !boundary[caretPos]) {
859
+ caretPos++;
860
+ }
861
+ if (caretPos > valLn) {
862
+ caretPos = boundary.lastIndexOf(true);
863
+ }
864
+ }
865
+ if (caretPos === -1) {
866
+ caretPos = valLn;
867
+ }
868
+ return caretPos;
869
+ }
870
+ function caretUnknownFormatBoundary(formattedValue) {
871
+ var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function() {
872
+ return true;
873
+ });
874
+ for (var i = 0, ln = boundaryAry.length; i < ln; i++) {
875
+ boundaryAry[i] = Boolean(charIsNumber(formattedValue[i]) || charIsNumber(formattedValue[i - 1]));
876
+ }
877
+ return boundaryAry;
878
+ }
879
+ function useInternalValues(value, defaultValue, valueIsNumericString, format2, removeFormatting2, onValueChange) {
880
+ if (onValueChange === void 0) onValueChange = noop;
881
+ var getValues = usePersistentCallback(function(value2, valueIsNumericString2) {
882
+ var formattedValue, numAsString;
883
+ if (isNotValidValue(value2)) {
884
+ numAsString = "";
885
+ formattedValue = "";
886
+ } else if (typeof value2 === "number" || valueIsNumericString2) {
887
+ numAsString = typeof value2 === "number" ? toNumericString(value2) : value2;
888
+ formattedValue = format2(numAsString);
889
+ } else {
890
+ numAsString = removeFormatting2(value2, void 0);
891
+ formattedValue = format2(numAsString);
892
+ }
893
+ return { formattedValue, numAsString };
894
+ });
895
+ var ref = useState(function() {
896
+ return getValues(isNil(value) ? defaultValue : value, valueIsNumericString);
897
+ });
898
+ var values = ref[0];
899
+ var setValues = ref[1];
900
+ var _onValueChange = function(newValues2, sourceInfo) {
901
+ if (newValues2.formattedValue !== values.formattedValue) {
902
+ setValues({
903
+ formattedValue: newValues2.formattedValue,
904
+ numAsString: newValues2.value
905
+ });
906
+ }
907
+ onValueChange(newValues2, sourceInfo);
908
+ };
909
+ var _value = value;
910
+ var _valueIsNumericString = valueIsNumericString;
911
+ if (isNil(value)) {
912
+ _value = values.numAsString;
913
+ _valueIsNumericString = true;
914
+ }
915
+ var newValues = getValues(_value, _valueIsNumericString);
916
+ useMemo(function() {
917
+ setValues(newValues);
918
+ }, [newValues.formattedValue]);
919
+ return [values, _onValueChange];
920
+ }
921
+ function defaultRemoveFormatting(value) {
922
+ return value.replace(/[^0-9]/g, "");
923
+ }
924
+ function defaultFormat(value) {
925
+ return value;
926
+ }
927
+ function NumberFormatBase(props) {
928
+ var type = props.type;
929
+ if (type === void 0) type = "text";
930
+ var displayType = props.displayType;
931
+ if (displayType === void 0) displayType = "input";
932
+ var customInput = props.customInput;
933
+ var renderText = props.renderText;
934
+ var getInputRef = props.getInputRef;
935
+ var format2 = props.format;
936
+ if (format2 === void 0) format2 = defaultFormat;
937
+ var removeFormatting2 = props.removeFormatting;
938
+ if (removeFormatting2 === void 0) removeFormatting2 = defaultRemoveFormatting;
939
+ var defaultValue = props.defaultValue;
940
+ var valueIsNumericString = props.valueIsNumericString;
941
+ var onValueChange = props.onValueChange;
942
+ var isAllowed = props.isAllowed;
943
+ var onChange = props.onChange;
944
+ if (onChange === void 0) onChange = noop;
945
+ var onKeyDown = props.onKeyDown;
946
+ if (onKeyDown === void 0) onKeyDown = noop;
947
+ var onMouseUp = props.onMouseUp;
948
+ if (onMouseUp === void 0) onMouseUp = noop;
949
+ var onFocus = props.onFocus;
950
+ if (onFocus === void 0) onFocus = noop;
951
+ var onBlur = props.onBlur;
952
+ if (onBlur === void 0) onBlur = noop;
953
+ var propValue = props.value;
954
+ var getCaretBoundary2 = props.getCaretBoundary;
955
+ if (getCaretBoundary2 === void 0) getCaretBoundary2 = caretUnknownFormatBoundary;
956
+ var isValidInputCharacter = props.isValidInputCharacter;
957
+ if (isValidInputCharacter === void 0) isValidInputCharacter = charIsNumber;
958
+ var isCharacterSame = props.isCharacterSame;
959
+ var otherProps = __rest(props, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter", "isCharacterSame"]);
960
+ var ref = useInternalValues(propValue, defaultValue, Boolean(valueIsNumericString), format2, removeFormatting2, onValueChange);
961
+ var ref_0 = ref[0];
962
+ var formattedValue = ref_0.formattedValue;
963
+ var numAsString = ref_0.numAsString;
964
+ var onFormattedValueChange = ref[1];
965
+ var caretPositionBeforeChange = useRef();
966
+ var lastUpdatedValue = useRef({ formattedValue, numAsString });
967
+ var _onValueChange = function(values, source) {
968
+ lastUpdatedValue.current = { formattedValue: values.formattedValue, numAsString: values.value };
969
+ onFormattedValueChange(values, source);
970
+ };
971
+ var ref$1 = useState(false);
972
+ var mounted = ref$1[0];
973
+ var setMounted = ref$1[1];
974
+ var focusedElm = useRef(null);
975
+ var timeout = useRef({
976
+ setCaretTimeout: null,
977
+ focusTimeout: null
978
+ });
979
+ useEffect(function() {
980
+ setMounted(true);
981
+ return function() {
982
+ clearTimeout(timeout.current.setCaretTimeout);
983
+ clearTimeout(timeout.current.focusTimeout);
984
+ };
985
+ }, []);
986
+ var _format = format2;
987
+ var getValueObject = function(formattedValue2, numAsString2) {
988
+ var floatValue = parseFloat(numAsString2);
989
+ return {
990
+ formattedValue: formattedValue2,
991
+ value: numAsString2,
992
+ floatValue: isNaN(floatValue) ? void 0 : floatValue
993
+ };
994
+ };
995
+ var setPatchedCaretPosition = function(el, caretPos, currentValue) {
996
+ if (el.selectionStart === 0 && el.selectionEnd === el.value.length) {
997
+ return;
998
+ }
999
+ setCaretPosition(el, caretPos);
1000
+ timeout.current.setCaretTimeout = setTimeout(function() {
1001
+ if (el.value === currentValue && el.selectionStart !== caretPos) {
1002
+ setCaretPosition(el, caretPos);
1003
+ }
1004
+ }, 0);
1005
+ };
1006
+ var correctCaretPosition = function(value, caretPos, direction) {
1007
+ return getCaretPosInBoundary(value, caretPos, getCaretBoundary2(value), direction);
1008
+ };
1009
+ var getNewCaretPosition = function(inputValue, newFormattedValue, caretPos) {
1010
+ var caretBoundary = getCaretBoundary2(newFormattedValue);
1011
+ var updatedCaretPos = getCaretPosition(newFormattedValue, formattedValue, inputValue, caretPos, caretBoundary, isValidInputCharacter, isCharacterSame);
1012
+ updatedCaretPos = getCaretPosInBoundary(newFormattedValue, updatedCaretPos, caretBoundary);
1013
+ return updatedCaretPos;
1014
+ };
1015
+ var updateValueAndCaretPosition = function(params) {
1016
+ var newFormattedValue = params.formattedValue;
1017
+ if (newFormattedValue === void 0) newFormattedValue = "";
1018
+ var input = params.input;
1019
+ var source = params.source;
1020
+ var event = params.event;
1021
+ var numAsString2 = params.numAsString;
1022
+ var caretPos;
1023
+ if (input) {
1024
+ var inputValue = params.inputValue || input.value;
1025
+ var currentCaretPosition2 = geInputCaretPosition(input);
1026
+ input.value = newFormattedValue;
1027
+ caretPos = getNewCaretPosition(inputValue, newFormattedValue, currentCaretPosition2);
1028
+ if (caretPos !== void 0) {
1029
+ setPatchedCaretPosition(input, caretPos, newFormattedValue);
1030
+ }
1031
+ }
1032
+ if (newFormattedValue !== formattedValue) {
1033
+ _onValueChange(getValueObject(newFormattedValue, numAsString2), { event, source });
1034
+ }
1035
+ };
1036
+ useEffect(function() {
1037
+ var ref2 = lastUpdatedValue.current;
1038
+ var lastFormattedValue = ref2.formattedValue;
1039
+ var lastNumAsString = ref2.numAsString;
1040
+ if (formattedValue !== lastFormattedValue || numAsString !== lastNumAsString) {
1041
+ _onValueChange(getValueObject(formattedValue, numAsString), {
1042
+ event: void 0,
1043
+ source: SourceType.props
1044
+ });
1045
+ }
1046
+ }, [formattedValue, numAsString]);
1047
+ var currentCaretPosition = focusedElm.current ? geInputCaretPosition(focusedElm.current) : void 0;
1048
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
1049
+ useIsomorphicLayoutEffect(function() {
1050
+ var input = focusedElm.current;
1051
+ if (formattedValue !== lastUpdatedValue.current.formattedValue && input) {
1052
+ var caretPos = getNewCaretPosition(lastUpdatedValue.current.formattedValue, formattedValue, currentCaretPosition);
1053
+ input.value = formattedValue;
1054
+ setPatchedCaretPosition(input, caretPos, formattedValue);
1055
+ }
1056
+ }, [formattedValue]);
1057
+ var formatInputValue = function(inputValue, event, source) {
1058
+ var input = event.target;
1059
+ var changeRange = caretPositionBeforeChange.current ? findChangedRangeFromCaretPositions(caretPositionBeforeChange.current, input.selectionEnd) : findChangeRange(formattedValue, inputValue);
1060
+ var changeMeta = Object.assign(Object.assign({}, changeRange), { lastValue: formattedValue });
1061
+ var _numAsString = removeFormatting2(inputValue, changeMeta);
1062
+ var _formattedValue = _format(_numAsString);
1063
+ _numAsString = removeFormatting2(_formattedValue, void 0);
1064
+ if (isAllowed && !isAllowed(getValueObject(_formattedValue, _numAsString))) {
1065
+ var input$1 = event.target;
1066
+ var currentCaretPosition2 = geInputCaretPosition(input$1);
1067
+ var caretPos = getNewCaretPosition(inputValue, formattedValue, currentCaretPosition2);
1068
+ input$1.value = formattedValue;
1069
+ setPatchedCaretPosition(input$1, caretPos, formattedValue);
1070
+ return false;
1071
+ }
1072
+ updateValueAndCaretPosition({
1073
+ formattedValue: _formattedValue,
1074
+ numAsString: _numAsString,
1075
+ inputValue,
1076
+ event,
1077
+ source,
1078
+ input: event.target
1079
+ });
1080
+ return true;
1081
+ };
1082
+ var setCaretPositionInfoBeforeChange = function(el, endOffset) {
1083
+ if (endOffset === void 0) endOffset = 0;
1084
+ var selectionStart = el.selectionStart;
1085
+ var selectionEnd = el.selectionEnd;
1086
+ caretPositionBeforeChange.current = { selectionStart, selectionEnd: selectionEnd + endOffset };
1087
+ };
1088
+ var _onChange = function(e) {
1089
+ var el = e.target;
1090
+ var inputValue = el.value;
1091
+ var changed = formatInputValue(inputValue, e, SourceType.event);
1092
+ if (changed) {
1093
+ onChange(e);
1094
+ }
1095
+ caretPositionBeforeChange.current = void 0;
1096
+ };
1097
+ var _onKeyDown = function(e) {
1098
+ var el = e.target;
1099
+ var key = e.key;
1100
+ var selectionStart = el.selectionStart;
1101
+ var selectionEnd = el.selectionEnd;
1102
+ var value = el.value;
1103
+ if (value === void 0) value = "";
1104
+ var expectedCaretPosition;
1105
+ if (key === "ArrowLeft" || key === "Backspace") {
1106
+ expectedCaretPosition = Math.max(selectionStart - 1, 0);
1107
+ } else if (key === "ArrowRight") {
1108
+ expectedCaretPosition = Math.min(selectionStart + 1, value.length);
1109
+ } else if (key === "Delete") {
1110
+ expectedCaretPosition = selectionStart;
1111
+ }
1112
+ var endOffset = 0;
1113
+ if (key === "Delete" && selectionStart === selectionEnd) {
1114
+ endOffset = 1;
1115
+ }
1116
+ var isArrowKey = key === "ArrowLeft" || key === "ArrowRight";
1117
+ if (expectedCaretPosition === void 0 || selectionStart !== selectionEnd && !isArrowKey) {
1118
+ onKeyDown(e);
1119
+ setCaretPositionInfoBeforeChange(el, endOffset);
1120
+ return;
1121
+ }
1122
+ var newCaretPosition = expectedCaretPosition;
1123
+ if (isArrowKey) {
1124
+ var direction = key === "ArrowLeft" ? "left" : "right";
1125
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, direction);
1126
+ if (newCaretPosition !== expectedCaretPosition) {
1127
+ e.preventDefault();
1128
+ }
1129
+ } else if (key === "Delete" && !isValidInputCharacter(value[expectedCaretPosition])) {
1130
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, "right");
1131
+ } else if (key === "Backspace" && !isValidInputCharacter(value[expectedCaretPosition])) {
1132
+ newCaretPosition = correctCaretPosition(value, expectedCaretPosition, "left");
1133
+ }
1134
+ if (newCaretPosition !== expectedCaretPosition) {
1135
+ setPatchedCaretPosition(el, newCaretPosition, value);
1136
+ }
1137
+ onKeyDown(e);
1138
+ setCaretPositionInfoBeforeChange(el, endOffset);
1139
+ };
1140
+ var _onMouseUp = function(e) {
1141
+ var el = e.target;
1142
+ var correctCaretPositionIfRequired = function() {
1143
+ var selectionStart = el.selectionStart;
1144
+ var selectionEnd = el.selectionEnd;
1145
+ var value = el.value;
1146
+ if (value === void 0) value = "";
1147
+ if (selectionStart === selectionEnd) {
1148
+ var caretPosition = correctCaretPosition(value, selectionStart);
1149
+ if (caretPosition !== selectionStart) {
1150
+ setPatchedCaretPosition(el, caretPosition, value);
1151
+ }
1152
+ }
1153
+ };
1154
+ correctCaretPositionIfRequired();
1155
+ requestAnimationFrame(function() {
1156
+ correctCaretPositionIfRequired();
1157
+ });
1158
+ onMouseUp(e);
1159
+ setCaretPositionInfoBeforeChange(el);
1160
+ };
1161
+ var _onFocus = function(e) {
1162
+ if (e.persist) {
1163
+ e.persist();
1164
+ }
1165
+ var el = e.target;
1166
+ var currentTarget = e.currentTarget;
1167
+ focusedElm.current = el;
1168
+ timeout.current.focusTimeout = setTimeout(function() {
1169
+ var selectionStart = el.selectionStart;
1170
+ var selectionEnd = el.selectionEnd;
1171
+ var value = el.value;
1172
+ if (value === void 0) value = "";
1173
+ var caretPosition = correctCaretPosition(value, selectionStart);
1174
+ if (caretPosition !== selectionStart && !(selectionStart === 0 && selectionEnd === value.length)) {
1175
+ setPatchedCaretPosition(el, caretPosition, value);
1176
+ }
1177
+ onFocus(Object.assign(Object.assign({}, e), { currentTarget }));
1178
+ }, 0);
1179
+ };
1180
+ var _onBlur = function(e) {
1181
+ focusedElm.current = null;
1182
+ clearTimeout(timeout.current.focusTimeout);
1183
+ clearTimeout(timeout.current.setCaretTimeout);
1184
+ onBlur(e);
1185
+ };
1186
+ var inputMode = mounted && addInputMode() ? "numeric" : void 0;
1187
+ var inputProps = Object.assign({ inputMode }, otherProps, {
1188
+ type,
1189
+ value: formattedValue,
1190
+ onChange: _onChange,
1191
+ onKeyDown: _onKeyDown,
1192
+ onMouseUp: _onMouseUp,
1193
+ onFocus: _onFocus,
1194
+ onBlur: _onBlur
1195
+ });
1196
+ if (displayType === "text") {
1197
+ return renderText ? React__default.createElement(React__default.Fragment, null, renderText(formattedValue, otherProps) || null) : React__default.createElement("span", Object.assign({}, otherProps, { ref: getInputRef }), formattedValue);
1198
+ } else if (customInput) {
1199
+ var CustomInput = customInput;
1200
+ return React__default.createElement(CustomInput, Object.assign({}, inputProps, { ref: getInputRef }));
1201
+ }
1202
+ return React__default.createElement("input", Object.assign({}, inputProps, { ref: getInputRef }));
1203
+ }
1204
+ function format(numStr, props) {
1205
+ var decimalScale = props.decimalScale;
1206
+ var fixedDecimalScale = props.fixedDecimalScale;
1207
+ var prefix = props.prefix;
1208
+ if (prefix === void 0) prefix = "";
1209
+ var suffix = props.suffix;
1210
+ if (suffix === void 0) suffix = "";
1211
+ var allowNegative = props.allowNegative;
1212
+ var thousandsGroupStyle = props.thousandsGroupStyle;
1213
+ if (thousandsGroupStyle === void 0) thousandsGroupStyle = "thousand";
1214
+ if (numStr === "" || numStr === "-") {
1215
+ return numStr;
1216
+ }
1217
+ var ref = getSeparators(props);
1218
+ var thousandSeparator = ref.thousandSeparator;
1219
+ var decimalSeparator = ref.decimalSeparator;
1220
+ var hasDecimalSeparator = decimalScale !== 0 && numStr.indexOf(".") !== -1 || decimalScale && fixedDecimalScale;
1221
+ var ref$1 = splitDecimal(numStr, allowNegative);
1222
+ var beforeDecimal = ref$1.beforeDecimal;
1223
+ var afterDecimal = ref$1.afterDecimal;
1224
+ var addNegation = ref$1.addNegation;
1225
+ if (decimalScale !== void 0) {
1226
+ afterDecimal = limitToScale(afterDecimal, decimalScale, !!fixedDecimalScale);
1227
+ }
1228
+ if (thousandSeparator) {
1229
+ beforeDecimal = applyThousandSeparator(beforeDecimal, thousandSeparator, thousandsGroupStyle);
1230
+ }
1231
+ if (prefix) {
1232
+ beforeDecimal = prefix + beforeDecimal;
1233
+ }
1234
+ if (suffix) {
1235
+ afterDecimal = afterDecimal + suffix;
1236
+ }
1237
+ if (addNegation) {
1238
+ beforeDecimal = "-" + beforeDecimal;
1239
+ }
1240
+ numStr = beforeDecimal + (hasDecimalSeparator && decimalSeparator || "") + afterDecimal;
1241
+ return numStr;
1242
+ }
1243
+ function getSeparators(props) {
1244
+ var decimalSeparator = props.decimalSeparator;
1245
+ if (decimalSeparator === void 0) decimalSeparator = ".";
1246
+ var thousandSeparator = props.thousandSeparator;
1247
+ var allowedDecimalSeparators = props.allowedDecimalSeparators;
1248
+ if (thousandSeparator === true) {
1249
+ thousandSeparator = ",";
1250
+ }
1251
+ if (!allowedDecimalSeparators) {
1252
+ allowedDecimalSeparators = [decimalSeparator, "."];
1253
+ }
1254
+ return {
1255
+ decimalSeparator,
1256
+ thousandSeparator,
1257
+ allowedDecimalSeparators
1258
+ };
1259
+ }
1260
+ function handleNegation(value, allowNegative) {
1261
+ if (value === void 0) value = "";
1262
+ var negationRegex = new RegExp("(-)");
1263
+ var doubleNegationRegex = new RegExp("(-)(.)*(-)");
1264
+ var hasNegation = negationRegex.test(value);
1265
+ var removeNegation = doubleNegationRegex.test(value);
1266
+ value = value.replace(/-/g, "");
1267
+ if (hasNegation && !removeNegation && allowNegative) {
1268
+ value = "-" + value;
1269
+ }
1270
+ return value;
1271
+ }
1272
+ function getNumberRegex(decimalSeparator, global) {
1273
+ return new RegExp("(^-)|[0-9]|" + escapeRegExp(decimalSeparator), "g");
1274
+ }
1275
+ function isNumericString(val, prefix, suffix) {
1276
+ if (val === "") {
1277
+ return true;
1278
+ }
1279
+ return !(prefix === null || prefix === void 0 ? void 0 : prefix.match(/\d/)) && !(suffix === null || suffix === void 0 ? void 0 : suffix.match(/\d/)) && typeof val === "string" && !isNaN(Number(val));
1280
+ }
1281
+ function removeFormatting(value, changeMeta, props) {
1282
+ var assign;
1283
+ if (changeMeta === void 0) changeMeta = getDefaultChangeMeta(value);
1284
+ var allowNegative = props.allowNegative;
1285
+ var prefix = props.prefix;
1286
+ if (prefix === void 0) prefix = "";
1287
+ var suffix = props.suffix;
1288
+ if (suffix === void 0) suffix = "";
1289
+ var decimalScale = props.decimalScale;
1290
+ var from = changeMeta.from;
1291
+ var to = changeMeta.to;
1292
+ var start = to.start;
1293
+ var end = to.end;
1294
+ var ref = getSeparators(props);
1295
+ var allowedDecimalSeparators = ref.allowedDecimalSeparators;
1296
+ var decimalSeparator = ref.decimalSeparator;
1297
+ var isBeforeDecimalSeparator = value[end] === decimalSeparator;
1298
+ if (charIsNumber(value) && (value === prefix || value === suffix) && changeMeta.lastValue === "") {
1299
+ return value;
1300
+ }
1301
+ if (end - start === 1 && allowedDecimalSeparators.indexOf(value[start]) !== -1) {
1302
+ var separator = decimalScale === 0 ? "" : decimalSeparator;
1303
+ value = value.substring(0, start) + separator + value.substring(start + 1, value.length);
1304
+ }
1305
+ var stripNegation = function(value2, start2, end2) {
1306
+ var hasNegation2 = false;
1307
+ var hasDoubleNegation = false;
1308
+ if (prefix.startsWith("-")) {
1309
+ hasNegation2 = false;
1310
+ } else if (value2.startsWith("--")) {
1311
+ hasNegation2 = false;
1312
+ hasDoubleNegation = true;
1313
+ } else if (suffix.startsWith("-") && value2.length === suffix.length) {
1314
+ hasNegation2 = false;
1315
+ } else if (value2[0] === "-") {
1316
+ hasNegation2 = true;
1317
+ }
1318
+ var charsToRemove = hasNegation2 ? 1 : 0;
1319
+ if (hasDoubleNegation) {
1320
+ charsToRemove = 2;
1321
+ }
1322
+ if (charsToRemove) {
1323
+ value2 = value2.substring(charsToRemove);
1324
+ start2 -= charsToRemove;
1325
+ end2 -= charsToRemove;
1326
+ }
1327
+ return { value: value2, start: start2, end: end2, hasNegation: hasNegation2 };
1328
+ };
1329
+ var toMetadata = stripNegation(value, start, end);
1330
+ var hasNegation = toMetadata.hasNegation;
1331
+ assign = toMetadata, value = assign.value, start = assign.start, end = assign.end;
1332
+ var ref$1 = stripNegation(changeMeta.lastValue, from.start, from.end);
1333
+ var fromStart = ref$1.start;
1334
+ var fromEnd = ref$1.end;
1335
+ var lastValue = ref$1.value;
1336
+ var updatedSuffixPart = value.substring(start, end);
1337
+ if (value.length && lastValue.length && (fromStart > lastValue.length - suffix.length || fromEnd < prefix.length) && !(updatedSuffixPart && suffix.startsWith(updatedSuffixPart))) {
1338
+ value = lastValue;
1339
+ }
1340
+ var startIndex = 0;
1341
+ if (value.startsWith(prefix)) {
1342
+ startIndex += prefix.length;
1343
+ } else if (start < prefix.length) {
1344
+ startIndex = start;
1345
+ }
1346
+ value = value.substring(startIndex);
1347
+ end -= startIndex;
1348
+ var endIndex = value.length;
1349
+ var suffixStartIndex = value.length - suffix.length;
1350
+ if (value.endsWith(suffix)) {
1351
+ endIndex = suffixStartIndex;
1352
+ } else if (end > suffixStartIndex) {
1353
+ endIndex = end;
1354
+ } else if (end > value.length - suffix.length) {
1355
+ endIndex = end;
1356
+ }
1357
+ value = value.substring(0, endIndex);
1358
+ value = handleNegation(hasNegation ? "-" + value : value, allowNegative);
1359
+ value = (value.match(getNumberRegex(decimalSeparator)) || []).join("");
1360
+ var firstIndex = value.indexOf(decimalSeparator);
1361
+ value = value.replace(new RegExp(escapeRegExp(decimalSeparator), "g"), function(match, index) {
1362
+ return index === firstIndex ? "." : "";
1363
+ });
1364
+ var ref$2 = splitDecimal(value, allowNegative);
1365
+ var beforeDecimal = ref$2.beforeDecimal;
1366
+ var afterDecimal = ref$2.afterDecimal;
1367
+ var addNegation = ref$2.addNegation;
1368
+ if (to.end - to.start < from.end - from.start && beforeDecimal === "" && isBeforeDecimalSeparator && !parseFloat(afterDecimal)) {
1369
+ value = addNegation ? "-" : "";
1370
+ }
1371
+ return value;
1372
+ }
1373
+ function getCaretBoundary(formattedValue, props) {
1374
+ var prefix = props.prefix;
1375
+ if (prefix === void 0) prefix = "";
1376
+ var suffix = props.suffix;
1377
+ if (suffix === void 0) suffix = "";
1378
+ var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function() {
1379
+ return true;
1380
+ });
1381
+ var hasNegation = formattedValue[0] === "-";
1382
+ boundaryAry.fill(false, 0, prefix.length + (hasNegation ? 1 : 0));
1383
+ var valLn = formattedValue.length;
1384
+ boundaryAry.fill(false, valLn - suffix.length + 1, valLn + 1);
1385
+ return boundaryAry;
1386
+ }
1387
+ function validateAndUpdateProps(props) {
1388
+ var ref = getSeparators(props);
1389
+ var thousandSeparator = ref.thousandSeparator;
1390
+ var decimalSeparator = ref.decimalSeparator;
1391
+ var prefix = props.prefix;
1392
+ if (prefix === void 0) prefix = "";
1393
+ var allowNegative = props.allowNegative;
1394
+ if (allowNegative === void 0) allowNegative = true;
1395
+ if (thousandSeparator === decimalSeparator) {
1396
+ throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: " + thousandSeparator + ' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: ' + decimalSeparator + " (default value for decimalSeparator is .)\n ");
1397
+ }
1398
+ if (prefix.startsWith("-") && allowNegative) {
1399
+ console.error("\n Prefix can't start with '-' when allowNegative is true.\n prefix: " + prefix + "\n allowNegative: " + allowNegative + "\n ");
1400
+ allowNegative = false;
1401
+ }
1402
+ return Object.assign(Object.assign({}, props), { allowNegative });
1403
+ }
1404
+ function useNumericFormat(props) {
1405
+ props = validateAndUpdateProps(props);
1406
+ props.decimalSeparator;
1407
+ props.allowedDecimalSeparators;
1408
+ props.thousandsGroupStyle;
1409
+ var suffix = props.suffix;
1410
+ var allowNegative = props.allowNegative;
1411
+ var allowLeadingZeros = props.allowLeadingZeros;
1412
+ var onKeyDown = props.onKeyDown;
1413
+ if (onKeyDown === void 0) onKeyDown = noop;
1414
+ var onBlur = props.onBlur;
1415
+ if (onBlur === void 0) onBlur = noop;
1416
+ var thousandSeparator = props.thousandSeparator;
1417
+ var decimalScale = props.decimalScale;
1418
+ var fixedDecimalScale = props.fixedDecimalScale;
1419
+ var prefix = props.prefix;
1420
+ if (prefix === void 0) prefix = "";
1421
+ var defaultValue = props.defaultValue;
1422
+ var value = props.value;
1423
+ var valueIsNumericString = props.valueIsNumericString;
1424
+ var onValueChange = props.onValueChange;
1425
+ var restProps = __rest(props, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]);
1426
+ var ref = getSeparators(props);
1427
+ var decimalSeparator = ref.decimalSeparator;
1428
+ var allowedDecimalSeparators = ref.allowedDecimalSeparators;
1429
+ var _format = function(numStr) {
1430
+ return format(numStr, props);
1431
+ };
1432
+ var _removeFormatting = function(inputValue, changeMeta) {
1433
+ return removeFormatting(inputValue, changeMeta, props);
1434
+ };
1435
+ var _value = isNil(value) ? defaultValue : value;
1436
+ var _valueIsNumericString = valueIsNumericString !== null && valueIsNumericString !== void 0 ? valueIsNumericString : isNumericString(_value, prefix, suffix);
1437
+ if (!isNil(value)) {
1438
+ _valueIsNumericString = _valueIsNumericString || typeof value === "number";
1439
+ } else if (!isNil(defaultValue)) {
1440
+ _valueIsNumericString = _valueIsNumericString || typeof defaultValue === "number";
1441
+ }
1442
+ var roundIncomingValueToPrecision = function(value2) {
1443
+ if (isNotValidValue(value2)) {
1444
+ return value2;
1445
+ }
1446
+ if (typeof value2 === "number") {
1447
+ value2 = toNumericString(value2);
1448
+ }
1449
+ if (_valueIsNumericString && typeof decimalScale === "number") {
1450
+ return roundToPrecision(value2, decimalScale, Boolean(fixedDecimalScale));
1451
+ }
1452
+ return value2;
1453
+ };
1454
+ var ref$1 = useInternalValues(roundIncomingValueToPrecision(value), roundIncomingValueToPrecision(defaultValue), Boolean(_valueIsNumericString), _format, _removeFormatting, onValueChange);
1455
+ var ref$1_0 = ref$1[0];
1456
+ var numAsString = ref$1_0.numAsString;
1457
+ var formattedValue = ref$1_0.formattedValue;
1458
+ var _onValueChange = ref$1[1];
1459
+ var _onKeyDown = function(e) {
1460
+ var el = e.target;
1461
+ var key = e.key;
1462
+ var selectionStart = el.selectionStart;
1463
+ var selectionEnd = el.selectionEnd;
1464
+ var value2 = el.value;
1465
+ if (value2 === void 0) value2 = "";
1466
+ if ((key === "Backspace" || key === "Delete") && selectionEnd < prefix.length) {
1467
+ e.preventDefault();
1468
+ return;
1469
+ }
1470
+ if (selectionStart !== selectionEnd) {
1471
+ onKeyDown(e);
1472
+ return;
1473
+ }
1474
+ if (key === "Backspace" && value2[0] === "-" && selectionStart === prefix.length + 1 && allowNegative) {
1475
+ setCaretPosition(el, 1);
1476
+ }
1477
+ if (decimalScale && fixedDecimalScale) {
1478
+ if (key === "Backspace" && value2[selectionStart - 1] === decimalSeparator) {
1479
+ setCaretPosition(el, selectionStart - 1);
1480
+ e.preventDefault();
1481
+ } else if (key === "Delete" && value2[selectionStart] === decimalSeparator) {
1482
+ e.preventDefault();
1483
+ }
1484
+ }
1485
+ if ((allowedDecimalSeparators === null || allowedDecimalSeparators === void 0 ? void 0 : allowedDecimalSeparators.includes(key)) && value2[selectionStart] === decimalSeparator) {
1486
+ setCaretPosition(el, selectionStart + 1);
1487
+ }
1488
+ var _thousandSeparator = thousandSeparator === true ? "," : thousandSeparator;
1489
+ if (key === "Backspace" && value2[selectionStart - 1] === _thousandSeparator) {
1490
+ setCaretPosition(el, selectionStart - 1);
1491
+ }
1492
+ if (key === "Delete" && value2[selectionStart] === _thousandSeparator) {
1493
+ setCaretPosition(el, selectionStart + 1);
1494
+ }
1495
+ onKeyDown(e);
1496
+ };
1497
+ var _onBlur = function(e) {
1498
+ var _value2 = numAsString;
1499
+ if (!_value2.match(/\d/g)) {
1500
+ _value2 = "";
1501
+ }
1502
+ if (!allowLeadingZeros) {
1503
+ _value2 = fixLeadingZero(_value2);
1504
+ }
1505
+ if (fixedDecimalScale && decimalScale) {
1506
+ _value2 = roundToPrecision(_value2, decimalScale, fixedDecimalScale);
1507
+ }
1508
+ if (_value2 !== numAsString) {
1509
+ var formattedValue2 = format(_value2, props);
1510
+ _onValueChange({
1511
+ formattedValue: formattedValue2,
1512
+ value: _value2,
1513
+ floatValue: parseFloat(_value2)
1514
+ }, {
1515
+ event: e,
1516
+ source: SourceType.event
1517
+ });
1518
+ }
1519
+ onBlur(e);
1520
+ };
1521
+ var isValidInputCharacter = function(inputChar) {
1522
+ if (inputChar === decimalSeparator) {
1523
+ return true;
1524
+ }
1525
+ return charIsNumber(inputChar);
1526
+ };
1527
+ var isCharacterSame = function(ref2) {
1528
+ var currentValue = ref2.currentValue;
1529
+ var lastValue = ref2.lastValue;
1530
+ var formattedValue2 = ref2.formattedValue;
1531
+ var currentValueIndex = ref2.currentValueIndex;
1532
+ var formattedValueIndex = ref2.formattedValueIndex;
1533
+ var curChar = currentValue[currentValueIndex];
1534
+ var newChar = formattedValue2[formattedValueIndex];
1535
+ var typedRange = findChangeRange(lastValue, currentValue);
1536
+ var to = typedRange.to;
1537
+ var getDecimalSeparatorIndex = function(value2) {
1538
+ return _removeFormatting(value2).indexOf(".") + prefix.length;
1539
+ };
1540
+ if (value === 0 && fixedDecimalScale && decimalScale && currentValue[to.start] === decimalSeparator && getDecimalSeparatorIndex(currentValue) < currentValueIndex && getDecimalSeparatorIndex(formattedValue2) > formattedValueIndex) {
1541
+ return false;
1542
+ }
1543
+ if (currentValueIndex >= to.start && currentValueIndex < to.end && allowedDecimalSeparators && allowedDecimalSeparators.includes(curChar) && newChar === decimalSeparator) {
1544
+ return true;
1545
+ }
1546
+ return curChar === newChar;
1547
+ };
1548
+ return Object.assign(Object.assign({}, restProps), {
1549
+ value: formattedValue,
1550
+ valueIsNumericString: false,
1551
+ isValidInputCharacter,
1552
+ isCharacterSame,
1553
+ onValueChange: _onValueChange,
1554
+ format: _format,
1555
+ removeFormatting: _removeFormatting,
1556
+ getCaretBoundary: function(formattedValue2) {
1557
+ return getCaretBoundary(formattedValue2, props);
1558
+ },
1559
+ onKeyDown: _onKeyDown,
1560
+ onBlur: _onBlur
1561
+ });
1562
+ }
1563
+ function NumericFormat(props) {
1564
+ var numericFormatProps = useNumericFormat(props);
1565
+ return React__default.createElement(NumberFormatBase, Object.assign({}, numericFormatProps));
1566
+ }
561
1567
  const FormNumberField = (t0) => {
562
1568
  const $ = c(16);
563
1569
  let options;
@@ -1002,7 +2008,7 @@ export {
1002
2008
  u as useDialogs,
1003
2009
  useFieldContext,
1004
2010
  useFormContext,
1005
- useInView,
2011
+ a as useInView,
1006
2012
  useLayoutForm,
1007
2013
  withLayoutForm
1008
2014
  };