@orderingstack/front-components-product-configurator 1.5.1-beta.4 → 1.5.2-beta.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 (49) hide show
  1. package/dist/components/Counter/Counter.d.ts +2 -1
  2. package/dist/components/Counter/Counter.d.ts.map +1 -1
  3. package/dist/components/DisplayState/DisplayState.d.ts +2 -1
  4. package/dist/components/DisplayState/DisplayState.d.ts.map +1 -1
  5. package/dist/components/GroupStateInfo/GroupStateInfo.d.ts +2 -1
  6. package/dist/components/GroupStateInfo/GroupStateInfo.d.ts.map +1 -1
  7. package/dist/components/InfoLine/InfoLine.d.ts +2 -1
  8. package/dist/components/InfoLine/InfoLine.d.ts.map +1 -1
  9. package/dist/components/MenuItemsDispatcher/MenuItemsDispatcher.d.ts +3 -2
  10. package/dist/components/MenuItemsDispatcher/MenuItemsDispatcher.d.ts.map +1 -1
  11. package/dist/components/MenuOptions/MenuOptions.d.ts +2 -1
  12. package/dist/components/MenuOptions/MenuOptions.d.ts.map +1 -1
  13. package/dist/components/MenuOptions/MenuOptionsDefaultUI.d.ts +2 -1
  14. package/dist/components/MenuOptions/MenuOptionsDefaultUI.d.ts.map +1 -1
  15. package/dist/components/MenuProduct/MenuProduct.d.ts +3 -2
  16. package/dist/components/MenuProduct/MenuProduct.d.ts.map +1 -1
  17. package/dist/components/MenuProduct/useMenuProduct.d.ts.map +1 -1
  18. package/dist/components/MenuProductRoot/MenuProductRoot.d.ts +2 -1
  19. package/dist/components/MenuProductRoot/MenuProductRoot.d.ts.map +1 -1
  20. package/dist/components/MenuProductRoot/MenuProductRootDefaultUI.d.ts +2 -1
  21. package/dist/components/MenuProductRoot/MenuProductRootDefaultUI.d.ts.map +1 -1
  22. package/dist/components/MenuProductRoot/MenuProductRootDefaultUIModal.d.ts +2 -1
  23. package/dist/components/MenuProductRoot/MenuProductRootDefaultUIModal.d.ts.map +1 -1
  24. package/dist/components/Price/Price.d.ts +2 -1
  25. package/dist/components/Price/Price.d.ts.map +1 -1
  26. package/dist/components/ProductConfigurator/ProductConfigurator.d.ts +2 -1
  27. package/dist/components/ProductConfigurator/ProductConfigurator.d.ts.map +1 -1
  28. package/dist/components/SimpleCheckbox/SimpleCheckbox.d.ts +2 -1
  29. package/dist/components/SimpleCheckbox/SimpleCheckbox.d.ts.map +1 -1
  30. package/dist/components/SimpleRadio/SimpleRadio.d.ts +2 -1
  31. package/dist/components/SimpleRadio/SimpleRadio.d.ts.map +1 -1
  32. package/dist/components/SubmitRow/SubmitRow.d.ts +2 -1
  33. package/dist/components/SubmitRow/SubmitRow.d.ts.map +1 -1
  34. package/dist/context/GroupsValidation.d.ts +1 -1
  35. package/dist/context/GroupsValidation.d.ts.map +1 -1
  36. package/dist/context/ProductData.d.ts +1 -1
  37. package/dist/context/ProductData.d.ts.map +1 -1
  38. package/dist/index.cjs.js +6 -6
  39. package/dist/index.cjs.js.map +1 -1
  40. package/dist/index.es.js +1176 -1628
  41. package/dist/index.es.js.map +1 -1
  42. package/dist/state/index.d.ts +1 -1
  43. package/dist/state/index.d.ts.map +1 -1
  44. package/dist/style.css +1 -1
  45. package/dist/types/index.d.ts +8 -6
  46. package/dist/types/index.d.ts.map +1 -1
  47. package/dist/utils/filter.d.ts.map +1 -1
  48. package/dist/utils/setSelected.d.ts.map +1 -1
  49. package/package.json +91 -90
package/dist/index.es.js CHANGED
@@ -1,118 +1,148 @@
1
- import * as React from "react";
2
- import React__default, { useReducer, useRef, useDebugValue, useEffect, useLayoutEffect, useState, useMemo, createContext, useContext, forwardRef, Fragment as Fragment$1, isValidElement, cloneElement, createElement, createRef, useCallback } from "react";
1
+ import React, { useReducer, useRef, useDebugValue, useEffect, useLayoutEffect, useState, useMemo, createContext, useContext, forwardRef, Fragment as Fragment$1, isValidElement, cloneElement, createElement, createRef } from "react";
3
2
  import { useTransition, animated } from "react-spring";
4
3
  import { createPortal } from "react-dom";
5
4
  var tailwind = "";
6
5
  var main = "";
7
- function _typeof$1(o2) {
6
+ function _typeof$1(obj) {
8
7
  "@babel/helpers - typeof";
9
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
10
- return typeof o3;
11
- } : function(o3) {
12
- return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
13
- }, _typeof$1(o2);
14
- }
15
- function _classCallCheck(a2, n2) {
16
- if (!(a2 instanceof n2))
8
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
9
+ return typeof obj2;
10
+ } : function(obj2) {
11
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
12
+ }, _typeof$1(obj);
13
+ }
14
+ function _classCallCheck(instance2, Constructor) {
15
+ if (!(instance2 instanceof Constructor)) {
17
16
  throw new TypeError("Cannot call a class as a function");
17
+ }
18
18
  }
19
- function toPrimitive(t2, r2) {
20
- if ("object" != _typeof$1(t2) || !t2)
21
- return t2;
22
- var e2 = t2[Symbol.toPrimitive];
23
- if (void 0 !== e2) {
24
- var i2 = e2.call(t2, r2 || "default");
25
- if ("object" != _typeof$1(i2))
26
- return i2;
19
+ function _toPrimitive(input, hint) {
20
+ if (_typeof$1(input) !== "object" || input === null)
21
+ return input;
22
+ var prim = input[Symbol.toPrimitive];
23
+ if (prim !== void 0) {
24
+ var res = prim.call(input, hint || "default");
25
+ if (_typeof$1(res) !== "object")
26
+ return res;
27
27
  throw new TypeError("@@toPrimitive must return a primitive value.");
28
28
  }
29
- return ("string" === r2 ? String : Number)(t2);
29
+ return (hint === "string" ? String : Number)(input);
30
30
  }
31
- function toPropertyKey(t2) {
32
- var i2 = toPrimitive(t2, "string");
33
- return "symbol" == _typeof$1(i2) ? i2 : i2 + "";
31
+ function _toPropertyKey(arg) {
32
+ var key = _toPrimitive(arg, "string");
33
+ return _typeof$1(key) === "symbol" ? key : String(key);
34
34
  }
35
- function _defineProperties(e2, r2) {
36
- for (var t2 = 0; t2 < r2.length; t2++) {
37
- var o2 = r2[t2];
38
- o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, toPropertyKey(o2.key), o2);
35
+ function _defineProperties(target, props) {
36
+ for (var i2 = 0; i2 < props.length; i2++) {
37
+ var descriptor = props[i2];
38
+ descriptor.enumerable = descriptor.enumerable || false;
39
+ descriptor.configurable = true;
40
+ if ("value" in descriptor)
41
+ descriptor.writable = true;
42
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
39
43
  }
40
44
  }
41
- function _createClass(e2, r2, t2) {
42
- return r2 && _defineProperties(e2.prototype, r2), t2 && _defineProperties(e2, t2), Object.defineProperty(e2, "prototype", {
45
+ function _createClass(Constructor, protoProps, staticProps) {
46
+ if (protoProps)
47
+ _defineProperties(Constructor.prototype, protoProps);
48
+ if (staticProps)
49
+ _defineProperties(Constructor, staticProps);
50
+ Object.defineProperty(Constructor, "prototype", {
43
51
  writable: false
44
- }), e2;
52
+ });
53
+ return Constructor;
45
54
  }
46
- function _assertThisInitialized(e2) {
47
- if (void 0 === e2)
55
+ function _assertThisInitialized(self2) {
56
+ if (self2 === void 0) {
48
57
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
49
- return e2;
58
+ }
59
+ return self2;
50
60
  }
51
- function _setPrototypeOf(t2, e2) {
52
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t3, e3) {
53
- return t3.__proto__ = e3, t3;
54
- }, _setPrototypeOf(t2, e2);
61
+ function _setPrototypeOf(o2, p2) {
62
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
63
+ o3.__proto__ = p3;
64
+ return o3;
65
+ };
66
+ return _setPrototypeOf(o2, p2);
55
67
  }
56
- function _inherits(t2, e2) {
57
- if ("function" != typeof e2 && null !== e2)
68
+ function _inherits(subClass, superClass) {
69
+ if (typeof superClass !== "function" && superClass !== null) {
58
70
  throw new TypeError("Super expression must either be null or a function");
59
- t2.prototype = Object.create(e2 && e2.prototype, {
71
+ }
72
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
60
73
  constructor: {
61
- value: t2,
74
+ value: subClass,
62
75
  writable: true,
63
76
  configurable: true
64
77
  }
65
- }), Object.defineProperty(t2, "prototype", {
78
+ });
79
+ Object.defineProperty(subClass, "prototype", {
66
80
  writable: false
67
- }), e2 && _setPrototypeOf(t2, e2);
81
+ });
82
+ if (superClass)
83
+ _setPrototypeOf(subClass, superClass);
68
84
  }
69
- function _possibleConstructorReturn(t2, e2) {
70
- if (e2 && ("object" == _typeof$1(e2) || "function" == typeof e2))
71
- return e2;
72
- if (void 0 !== e2)
85
+ function _possibleConstructorReturn(self2, call) {
86
+ if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
87
+ return call;
88
+ } else if (call !== void 0) {
73
89
  throw new TypeError("Derived constructors may only return object or undefined");
74
- return _assertThisInitialized(t2);
75
- }
76
- function _getPrototypeOf(t2) {
77
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t3) {
78
- return t3.__proto__ || Object.getPrototypeOf(t3);
79
- }, _getPrototypeOf(t2);
80
- }
81
- function _defineProperty(e2, r2, t2) {
82
- return (r2 = toPropertyKey(r2)) in e2 ? Object.defineProperty(e2, r2, {
83
- value: t2,
84
- enumerable: true,
85
- configurable: true,
86
- writable: true
87
- }) : e2[r2] = t2, e2;
88
- }
89
- function _arrayWithHoles$1(r2) {
90
- if (Array.isArray(r2))
91
- return r2;
92
- }
93
- function _iterableToArray$1(r2) {
94
- if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"])
95
- return Array.from(r2);
90
+ }
91
+ return _assertThisInitialized(self2);
96
92
  }
97
- function _arrayLikeToArray$1(r2, a2) {
98
- (null == a2 || a2 > r2.length) && (a2 = r2.length);
99
- for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++)
100
- n2[e2] = r2[e2];
101
- return n2;
93
+ function _getPrototypeOf(o2) {
94
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
95
+ return o3.__proto__ || Object.getPrototypeOf(o3);
96
+ };
97
+ return _getPrototypeOf(o2);
102
98
  }
103
- function _unsupportedIterableToArray$1(r2, a2) {
104
- if (r2) {
105
- if ("string" == typeof r2)
106
- return _arrayLikeToArray$1(r2, a2);
107
- var t2 = {}.toString.call(r2).slice(8, -1);
108
- return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$1(r2, a2) : void 0;
99
+ function _defineProperty(obj, key, value) {
100
+ key = _toPropertyKey(key);
101
+ if (key in obj) {
102
+ Object.defineProperty(obj, key, {
103
+ value,
104
+ enumerable: true,
105
+ configurable: true,
106
+ writable: true
107
+ });
108
+ } else {
109
+ obj[key] = value;
109
110
  }
111
+ return obj;
112
+ }
113
+ function _arrayWithHoles$1(arr2) {
114
+ if (Array.isArray(arr2))
115
+ return arr2;
116
+ }
117
+ function _iterableToArray$1(iter) {
118
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
119
+ return Array.from(iter);
120
+ }
121
+ function _arrayLikeToArray$1(arr2, len) {
122
+ if (len == null || len > arr2.length)
123
+ len = arr2.length;
124
+ for (var i2 = 0, arr22 = new Array(len); i2 < len; i2++)
125
+ arr22[i2] = arr2[i2];
126
+ return arr22;
127
+ }
128
+ function _unsupportedIterableToArray$1(o2, minLen) {
129
+ if (!o2)
130
+ return;
131
+ if (typeof o2 === "string")
132
+ return _arrayLikeToArray$1(o2, minLen);
133
+ var n2 = Object.prototype.toString.call(o2).slice(8, -1);
134
+ if (n2 === "Object" && o2.constructor)
135
+ n2 = o2.constructor.name;
136
+ if (n2 === "Map" || n2 === "Set")
137
+ return Array.from(o2);
138
+ if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
139
+ return _arrayLikeToArray$1(o2, minLen);
110
140
  }
111
141
  function _nonIterableRest$1() {
112
142
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
113
143
  }
114
- function _toArray$1(r2) {
115
- return _arrayWithHoles$1(r2) || _iterableToArray$1(r2) || _unsupportedIterableToArray$1(r2) || _nonIterableRest$1();
144
+ function _toArray$1(arr2) {
145
+ return _arrayWithHoles$1(arr2) || _iterableToArray$1(arr2) || _unsupportedIterableToArray$1(arr2) || _nonIterableRest$1();
116
146
  }
117
147
  function ownKeys$2(object, enumerableOnly) {
118
148
  var keys2 = Object.keys(object);
@@ -404,13 +434,13 @@ var chars = [" ", ",", "?", "!", ";"];
404
434
  function looksLikeObjectPath(key, nsSeparator, keySeparator) {
405
435
  nsSeparator = nsSeparator || "";
406
436
  keySeparator = keySeparator || "";
407
- var possibleChars = chars.filter(function(c2) {
408
- return nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0;
437
+ var possibleChars = chars.filter(function(c) {
438
+ return nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0;
409
439
  });
410
440
  if (possibleChars.length === 0)
411
441
  return true;
412
- var r2 = new RegExp("(".concat(possibleChars.map(function(c2) {
413
- return c2 === "?" ? "\\?" : c2;
442
+ var r2 = new RegExp("(".concat(possibleChars.map(function(c) {
443
+ return c === "?" ? "\\?" : c;
414
444
  }).join("|"), ")"));
415
445
  var matched = !r2.test(key);
416
446
  if (!matched) {
@@ -1268,13 +1298,13 @@ var LanguageUtil = function() {
1268
1298
  var _this2 = this;
1269
1299
  var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
1270
1300
  var codes = [];
1271
- var addCode = function addCode2(c2) {
1272
- if (!c2)
1301
+ var addCode = function addCode2(c) {
1302
+ if (!c)
1273
1303
  return;
1274
- if (_this2.isSupportedCode(c2)) {
1275
- codes.push(c2);
1304
+ if (_this2.isSupportedCode(c)) {
1305
+ codes.push(c);
1276
1306
  } else {
1277
- _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c2));
1307
+ _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c));
1278
1308
  }
1279
1309
  };
1280
1310
  if (typeof code === "string" && code.indexOf("-") > -1) {
@@ -1771,9 +1801,9 @@ var Interpolator = function() {
1771
1801
  var sep = this.nestingOptionsSeparator;
1772
1802
  if (key.indexOf(sep) < 0)
1773
1803
  return key;
1774
- var c2 = key.split(new RegExp("".concat(sep, "[ ]*{")));
1775
- var optionsString = "{".concat(c2[1]);
1776
- key = c2[0];
1804
+ var c = key.split(new RegExp("".concat(sep, "[ ]*{")));
1805
+ var optionsString = "{".concat(c[1]);
1806
+ key = c[0];
1777
1807
  optionsString = this.interpolate(optionsString, clonedOptions);
1778
1808
  var matchedSingleQuotes = optionsString.match(/'/g);
1779
1809
  var matchedDoubleQuotes = optionsString.match(/"/g);
@@ -2621,7 +2651,7 @@ var I18n = function(_EventEmitter) {
2621
2651
  if (usedLng && usedLng.toLowerCase() === "cimode")
2622
2652
  return usedCallback();
2623
2653
  var toLoad = [];
2624
- var append = function append2(lng) {
2654
+ var append2 = function append3(lng) {
2625
2655
  if (!lng)
2626
2656
  return;
2627
2657
  var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
@@ -2633,14 +2663,14 @@ var I18n = function(_EventEmitter) {
2633
2663
  if (!usedLng) {
2634
2664
  var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2635
2665
  fallbacks.forEach(function(l2) {
2636
- return append(l2);
2666
+ return append2(l2);
2637
2667
  });
2638
2668
  } else {
2639
- append(usedLng);
2669
+ append2(usedLng);
2640
2670
  }
2641
2671
  if (this.options.preload) {
2642
2672
  this.options.preload.forEach(function(l2) {
2643
- return append(l2);
2673
+ return append2(l2);
2644
2674
  });
2645
2675
  }
2646
2676
  this.services.backendConnector.load(toLoad, this.options.ns, function(e2) {
@@ -2987,65 +3017,14 @@ var isObject$1 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) &
2987
3017
  var getEventValue = (event) => isObject$1(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
2988
3018
  var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
2989
3019
  var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
2990
- var isPlainObject = (tempObject) => {
2991
- const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
2992
- return isObject$1(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
2993
- };
2994
- var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
2995
- function cloneObject(data) {
2996
- let copy2;
2997
- const isArray2 = Array.isArray(data);
2998
- if (data instanceof Date) {
2999
- copy2 = new Date(data);
3000
- } else if (data instanceof Set) {
3001
- copy2 = new Set(data);
3002
- } else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray2 || isObject$1(data))) {
3003
- copy2 = isArray2 ? [] : {};
3004
- if (!isArray2 && !isPlainObject(data)) {
3005
- copy2 = data;
3006
- } else {
3007
- for (const key in data) {
3008
- if (data.hasOwnProperty(key)) {
3009
- copy2[key] = cloneObject(data[key]);
3010
- }
3011
- }
3012
- }
3013
- } else {
3014
- return data;
3015
- }
3016
- return copy2;
3017
- }
3018
3020
  var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
3019
3021
  var isUndefined$2 = (val) => val === void 0;
3020
- var get = (object, path2, defaultValue) => {
3021
- if (!path2 || !isObject$1(object)) {
3022
+ var get = (obj, path2, defaultValue) => {
3023
+ if (!path2 || !isObject$1(obj)) {
3022
3024
  return defaultValue;
3023
3025
  }
3024
- const result = compact(path2.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key], object);
3025
- return isUndefined$2(result) || result === object ? isUndefined$2(object[path2]) ? defaultValue : object[path2] : result;
3026
- };
3027
- var isBoolean = (value) => typeof value === "boolean";
3028
- var isKey = (value) => /^\w*$/.test(value);
3029
- var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
3030
- var set = (object, path2, value) => {
3031
- let index = -1;
3032
- const tempPath = isKey(path2) ? [path2] : stringToPath(path2);
3033
- const length = tempPath.length;
3034
- const lastIndex = length - 1;
3035
- while (++index < length) {
3036
- const key = tempPath[index];
3037
- let newValue = value;
3038
- if (index !== lastIndex) {
3039
- const objValue = object[key];
3040
- newValue = isObject$1(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
3041
- }
3042
- if (key === "__proto__") {
3043
- return;
3044
- }
3045
- object[key] = newValue;
3046
- object = object[key];
3047
- }
3048
- return object;
3026
+ const result = compact(path2.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key], obj);
3027
+ return isUndefined$2(result) || result === obj ? isUndefined$2(obj[path2]) ? defaultValue : obj[path2] : result;
3049
3028
  };
3050
3029
  const EVENTS = {
3051
3030
  BLUR: "blur",
@@ -3068,11 +3047,11 @@ const INPUT_VALIDATION_RULES = {
3068
3047
  required: "required",
3069
3048
  validate: "validate"
3070
3049
  };
3071
- const HookFormContext = React__default.createContext(null);
3072
- const useFormContext = () => React__default.useContext(HookFormContext);
3050
+ const HookFormContext = React.createContext(null);
3051
+ const useFormContext = () => React.useContext(HookFormContext);
3073
3052
  const FormProvider = (props) => {
3074
3053
  const { children, ...data } = props;
3075
- return React__default.createElement(HookFormContext.Provider, { value: data }, children);
3054
+ return React.createElement(HookFormContext.Provider, { value: data }, children);
3076
3055
  };
3077
3056
  var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
3078
3057
  const result = {
@@ -3093,18 +3072,17 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
3093
3072
  return result;
3094
3073
  };
3095
3074
  var isEmptyObject = (value) => isObject$1(value) && !Object.keys(value).length;
3096
- var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
3097
- updateFormState(formStateData);
3075
+ var shouldRenderFormState = (formStateData, _proxyFormState, isRoot) => {
3098
3076
  const { name, ...formState } = formStateData;
3099
3077
  return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
3100
3078
  };
3101
3079
  var convertToArrayPayload = (value) => Array.isArray(value) ? value : [value];
3102
- var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName)));
3080
+ var shouldSubscribeByName = (name, signalName, exact) => exact && signalName ? name === signalName : !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (currentName.startsWith(signalName) || signalName.startsWith(currentName)));
3103
3081
  function useSubscribe(props) {
3104
- const _props = React__default.useRef(props);
3082
+ const _props = React.useRef(props);
3105
3083
  _props.current = props;
3106
- React__default.useEffect(() => {
3107
- const subscription = !props.disabled && _props.current.subject && _props.current.subject.subscribe({
3084
+ React.useEffect(() => {
3085
+ const subscription = !props.disabled && _props.current.subject.subscribe({
3108
3086
  next: _props.current.next
3109
3087
  });
3110
3088
  return () => {
@@ -3115,31 +3093,36 @@ function useSubscribe(props) {
3115
3093
  function useFormState(props) {
3116
3094
  const methods = useFormContext();
3117
3095
  const { control = methods.control, disabled, name, exact } = props || {};
3118
- const [formState, updateFormState] = React__default.useState(control._formState);
3119
- const _mounted = React__default.useRef(true);
3120
- const _localProxyFormState = React__default.useRef({
3096
+ const [formState, updateFormState] = React.useState(control._formState);
3097
+ const _mounted = React.useRef(true);
3098
+ const _localProxyFormState = React.useRef({
3121
3099
  isDirty: false,
3122
3100
  isLoading: false,
3123
3101
  dirtyFields: false,
3124
3102
  touchedFields: false,
3125
- validatingFields: false,
3126
3103
  isValidating: false,
3127
3104
  isValid: false,
3128
3105
  errors: false
3129
3106
  });
3130
- const _name = React__default.useRef(name);
3107
+ const _name = React.useRef(name);
3131
3108
  _name.current = name;
3132
3109
  useSubscribe({
3133
3110
  disabled,
3134
- next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current, control._updateFormState) && updateFormState({
3111
+ next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current) && updateFormState({
3135
3112
  ...control._formState,
3136
3113
  ...value
3137
3114
  }),
3138
3115
  subject: control._subjects.state
3139
3116
  });
3140
- React__default.useEffect(() => {
3117
+ React.useEffect(() => {
3141
3118
  _mounted.current = true;
3142
- _localProxyFormState.current.isValid && control._updateValid(true);
3119
+ const isDirty = control._proxyFormState.isDirty && control._getDirty();
3120
+ if (isDirty !== control._formState.isDirty) {
3121
+ control._subjects.state.next({
3122
+ isDirty
3123
+ });
3124
+ }
3125
+ control._updateValid();
3143
3126
  return () => {
3144
3127
  _mounted.current = false;
3145
3128
  };
@@ -3158,27 +3141,53 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
3158
3141
  isGlobal && (_names.watchAll = true);
3159
3142
  return formValues;
3160
3143
  };
3144
+ var isPlainObject = (tempObject) => {
3145
+ const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
3146
+ return isObject$1(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
3147
+ };
3148
+ var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
3149
+ function cloneObject(data) {
3150
+ let copy2;
3151
+ const isArray2 = Array.isArray(data);
3152
+ if (data instanceof Date) {
3153
+ copy2 = new Date(data);
3154
+ } else if (data instanceof Set) {
3155
+ copy2 = new Set(data);
3156
+ } else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray2 || isObject$1(data))) {
3157
+ copy2 = isArray2 ? [] : {};
3158
+ if (!Array.isArray(data) && !isPlainObject(data)) {
3159
+ copy2 = data;
3160
+ } else {
3161
+ for (const key in data) {
3162
+ copy2[key] = cloneObject(data[key]);
3163
+ }
3164
+ }
3165
+ } else {
3166
+ return data;
3167
+ }
3168
+ return copy2;
3169
+ }
3161
3170
  function useWatch(props) {
3162
3171
  const methods = useFormContext();
3163
3172
  const { control = methods.control, name, defaultValue, disabled, exact } = props || {};
3164
- const _name = React__default.useRef(name);
3173
+ const _name = React.useRef(name);
3165
3174
  _name.current = name;
3166
3175
  useSubscribe({
3167
3176
  disabled,
3168
- subject: control._subjects.values,
3177
+ subject: control._subjects.watch,
3169
3178
  next: (formState) => {
3170
3179
  if (shouldSubscribeByName(_name.current, formState.name, exact)) {
3171
3180
  updateValue(cloneObject(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, defaultValue)));
3172
3181
  }
3173
3182
  }
3174
3183
  });
3175
- const [value, updateValue] = React__default.useState(control._getWatch(name, defaultValue));
3176
- React__default.useEffect(() => control._removeUnmounted());
3184
+ const [value, updateValue] = React.useState(control._getWatch(name, defaultValue));
3185
+ React.useEffect(() => control._removeUnmounted());
3177
3186
  return value;
3178
3187
  }
3179
3188
  function useController(props) {
3180
3189
  const methods = useFormContext();
3181
- const { name, disabled, control = methods.control, shouldUnregister } = props;
3190
+ const { name, control = methods.control, shouldUnregister } = props;
3182
3191
  const isArrayField = isNameInFieldArray(control._names.array, name);
3183
3192
  const value = useWatch({
3184
3193
  control,
@@ -3190,54 +3199,35 @@ function useController(props) {
3190
3199
  control,
3191
3200
  name
3192
3201
  });
3193
- const _registerProps = React__default.useRef(control.register(name, {
3202
+ const _registerProps = React.useRef(control.register(name, {
3194
3203
  ...props.rules,
3195
- value,
3196
- ...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
3204
+ value
3197
3205
  }));
3198
- React__default.useEffect(() => {
3199
- const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
3206
+ React.useEffect(() => {
3200
3207
  const updateMounted = (name2, value2) => {
3201
3208
  const field = get(control._fields, name2);
3202
- if (field && field._f) {
3209
+ if (field) {
3203
3210
  field._f.mount = value2;
3204
3211
  }
3205
3212
  };
3206
3213
  updateMounted(name, true);
3207
- if (_shouldUnregisterField) {
3208
- const value2 = cloneObject(get(control._options.defaultValues, name));
3209
- set(control._defaultValues, name, value2);
3210
- if (isUndefined$2(get(control._formValues, name))) {
3211
- set(control._formValues, name, value2);
3212
- }
3213
- }
3214
3214
  return () => {
3215
- (isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
3215
+ const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
3216
+ (isArrayField ? _shouldUnregisterField && !control._stateFlags.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
3216
3217
  };
3217
3218
  }, [name, control, isArrayField, shouldUnregister]);
3218
- React__default.useEffect(() => {
3219
- if (get(control._fields, name)) {
3220
- control._updateDisabledField({
3221
- disabled,
3222
- fields: control._fields,
3223
- name,
3224
- value: get(control._fields, name)._f.value
3225
- });
3226
- }
3227
- }, [disabled, name, control]);
3228
3219
  return {
3229
3220
  field: {
3230
3221
  name,
3231
3222
  value,
3232
- ...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
3233
- onChange: React__default.useCallback((event) => _registerProps.current.onChange({
3223
+ onChange: React.useCallback((event) => _registerProps.current.onChange({
3234
3224
  target: {
3235
3225
  value: getEventValue(event),
3236
3226
  name
3237
3227
  },
3238
3228
  type: EVENTS.CHANGE
3239
3229
  }), [name]),
3240
- onBlur: React__default.useCallback(() => _registerProps.current.onBlur({
3230
+ onBlur: React.useCallback(() => _registerProps.current.onBlur({
3241
3231
  target: {
3242
3232
  value: get(control._formValues, name),
3243
3233
  name
@@ -3270,10 +3260,6 @@ function useController(props) {
3270
3260
  enumerable: true,
3271
3261
  get: () => !!get(formState.touchedFields, name)
3272
3262
  },
3273
- isValidating: {
3274
- enumerable: true,
3275
- get: () => !!get(formState.validatingFields, name)
3276
- },
3277
3263
  error: {
3278
3264
  enumerable: true,
3279
3265
  get: () => get(formState.errors, name)
@@ -3282,76 +3268,6 @@ function useController(props) {
3282
3268
  };
3283
3269
  }
3284
3270
  const Controller = (props) => props.render(useController(props));
3285
- const POST_REQUEST = "post";
3286
- function Form(props) {
3287
- const methods = useFormContext();
3288
- const [mounted, setMounted] = React__default.useState(false);
3289
- const { control = methods.control, onSubmit, children, action, method = POST_REQUEST, headers, encType, onError, render, onSuccess, validateStatus, ...rest } = props;
3290
- const submit = async (event) => {
3291
- let hasError = false;
3292
- let type = "";
3293
- await control.handleSubmit(async (data) => {
3294
- const formData = new FormData();
3295
- let formDataJson = "";
3296
- try {
3297
- formDataJson = JSON.stringify(data);
3298
- } catch (_a) {
3299
- }
3300
- for (const name of control._names.mount) {
3301
- formData.append(name, get(data, name));
3302
- }
3303
- if (onSubmit) {
3304
- await onSubmit({
3305
- data,
3306
- event,
3307
- method,
3308
- formData,
3309
- formDataJson
3310
- });
3311
- }
3312
- if (action) {
3313
- try {
3314
- const shouldStringifySubmissionData = [
3315
- headers && headers["Content-Type"],
3316
- encType
3317
- ].some((value) => value && value.includes("json"));
3318
- const response = await fetch(action, {
3319
- method,
3320
- headers: {
3321
- ...headers,
3322
- ...encType ? { "Content-Type": encType } : {}
3323
- },
3324
- body: shouldStringifySubmissionData ? formDataJson : formData
3325
- });
3326
- if (response && (validateStatus ? !validateStatus(response.status) : response.status < 200 || response.status >= 300)) {
3327
- hasError = true;
3328
- onError && onError({ response });
3329
- type = String(response.status);
3330
- } else {
3331
- onSuccess && onSuccess({ response });
3332
- }
3333
- } catch (error2) {
3334
- hasError = true;
3335
- onError && onError({ error: error2 });
3336
- }
3337
- }
3338
- })(event);
3339
- if (hasError && props.control) {
3340
- props.control._subjects.state.next({
3341
- isSubmitSuccessful: false
3342
- });
3343
- props.control.setError("root.server", {
3344
- type
3345
- });
3346
- }
3347
- };
3348
- React__default.useEffect(() => {
3349
- setMounted(true);
3350
- }, []);
3351
- return render ? React__default.createElement(React__default.Fragment, null, render({
3352
- submit
3353
- })) : React__default.createElement("form", { noValidate: mounted, action, method, encType, onSubmit: submit, ...rest }, children);
3354
- }
3355
3271
  var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria ? {
3356
3272
  ...errors[name],
3357
3273
  types: {
@@ -3359,11 +3275,49 @@ var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => va
3359
3275
  [type]: message || true
3360
3276
  }
3361
3277
  } : {};
3278
+ var isKey = (value) => /^\w*$/.test(value);
3279
+ var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
3280
+ function set(object, path2, value) {
3281
+ let index = -1;
3282
+ const tempPath = isKey(path2) ? [path2] : stringToPath(path2);
3283
+ const length = tempPath.length;
3284
+ const lastIndex = length - 1;
3285
+ while (++index < length) {
3286
+ const key = tempPath[index];
3287
+ let newValue = value;
3288
+ if (index !== lastIndex) {
3289
+ const objValue = object[key];
3290
+ newValue = isObject$1(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
3291
+ }
3292
+ object[key] = newValue;
3293
+ object = object[key];
3294
+ }
3295
+ return object;
3296
+ }
3297
+ const focusFieldBy = (fields, callback, fieldsNames) => {
3298
+ for (const key of fieldsNames || Object.keys(fields)) {
3299
+ const field = get(fields, key);
3300
+ if (field) {
3301
+ const { _f, ...currentField } = field;
3302
+ if (_f && callback(_f.name)) {
3303
+ if (_f.ref.focus) {
3304
+ _f.ref.focus();
3305
+ break;
3306
+ } else if (_f.refs && _f.refs[0].focus) {
3307
+ _f.refs[0].focus();
3308
+ break;
3309
+ }
3310
+ } else if (isObject$1(currentField)) {
3311
+ focusFieldBy(currentField, callback);
3312
+ }
3313
+ }
3314
+ }
3315
+ };
3362
3316
  var generateId = () => {
3363
3317
  const d2 = typeof performance === "undefined" ? Date.now() : performance.now() * 1e3;
3364
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
3318
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
3365
3319
  const r2 = (Math.random() * 16 + d2) % 16 | 0;
3366
- return (c2 == "x" ? r2 : r2 & 3 | 8).toString(16);
3320
+ return (c == "x" ? r2 : r2 & 3 | 8).toString(16);
3367
3321
  });
3368
3322
  };
3369
3323
  var getFocusFieldName = (name, index, options = {}) => options.shouldFocus || isUndefined$2(options.shouldFocus) ? options.focusName || `${name}.${isUndefined$2(options.focusIndex) ? index : options.focusIndex}.` : "";
@@ -3375,31 +3329,13 @@ var getValidationModes = (mode) => ({
3375
3329
  isOnTouch: mode === VALIDATION_MODE.onTouched
3376
3330
  });
3377
3331
  var isWatched = (name, _names, isBlurEvent) => !isBlurEvent && (_names.watchAll || _names.watch.has(name) || [..._names.watch].some((watchName) => name.startsWith(watchName) && /^\.\w+/.test(name.slice(watchName.length))));
3378
- const iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
3379
- for (const key of fieldsNames || Object.keys(fields)) {
3380
- const field = get(fields, key);
3381
- if (field) {
3382
- const { _f, ...currentField } = field;
3383
- if (_f) {
3384
- if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) {
3385
- break;
3386
- } else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) {
3387
- break;
3388
- } else {
3389
- iterateFieldsByAction(currentField, action);
3390
- }
3391
- } else if (isObject$1(currentField)) {
3392
- iterateFieldsByAction(currentField, action);
3393
- }
3394
- }
3395
- }
3396
- };
3397
3332
  var updateFieldArrayRootError = (errors, error2, name) => {
3398
- const fieldArrayErrors = convertToArrayPayload(get(errors, name));
3333
+ const fieldArrayErrors = compact(get(errors, name));
3399
3334
  set(fieldArrayErrors, "root", error2[name]);
3400
3335
  set(errors, name, fieldArrayErrors);
3401
3336
  return errors;
3402
3337
  };
3338
+ var isBoolean = (value) => typeof value === "boolean";
3403
3339
  var isFileInput = (element) => element.type === "file";
3404
3340
  var isFunction$1 = (value) => typeof value === "function";
3405
3341
  var isHTMLElement = (value) => {
@@ -3409,7 +3345,7 @@ var isHTMLElement = (value) => {
3409
3345
  const owner = value ? value.ownerDocument : 0;
3410
3346
  return value instanceof (owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement);
3411
3347
  };
3412
- var isMessage = (value) => isString(value);
3348
+ var isMessage = (value) => isString(value) || React.isValidElement(value);
3413
3349
  var isRadioInput = (element) => element.type === "radio";
3414
3350
  var isRegex = (value) => value instanceof RegExp;
3415
3351
  const defaultResult = {
@@ -3448,9 +3384,8 @@ var getValueAndMessage = (validationData) => isObject$1(validationData) && !isRe
3448
3384
  value: validationData,
3449
3385
  message: ""
3450
3386
  };
3451
- var validateField = async (field, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
3387
+ var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
3452
3388
  const { ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, disabled } = field._f;
3453
- const inputValue = get(formValues, name);
3454
3389
  if (!mount || disabled) {
3455
3390
  return {};
3456
3391
  }
@@ -3527,8 +3462,8 @@ var validateField = async (field, formValues, validateAllFieldCriteria, shouldUs
3527
3462
  if ((maxLength || minLength) && !isEmpty2 && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) {
3528
3463
  const maxLengthOutput = getValueAndMessage(maxLength);
3529
3464
  const minLengthOutput = getValueAndMessage(minLength);
3530
- const exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > +maxLengthOutput.value;
3531
- const exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < +minLengthOutput.value;
3465
+ const exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > maxLengthOutput.value;
3466
+ const exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < minLengthOutput.value;
3532
3467
  if (exceedMax || exceedMin) {
3533
3468
  getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
3534
3469
  if (!validateAllFieldCriteria) {
@@ -3554,7 +3489,7 @@ var validateField = async (field, formValues, validateAllFieldCriteria, shouldUs
3554
3489
  }
3555
3490
  if (validate) {
3556
3491
  if (isFunction$1(validate)) {
3557
- const result = await validate(inputValue, formValues);
3492
+ const result = await validate(inputValue);
3558
3493
  const validateError = getValidateError(result, inputRef);
3559
3494
  if (validateError) {
3560
3495
  error2[name] = {
@@ -3572,7 +3507,7 @@ var validateField = async (field, formValues, validateAllFieldCriteria, shouldUs
3572
3507
  if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
3573
3508
  break;
3574
3509
  }
3575
- const validateError = getValidateError(await validate[key](inputValue, formValues), inputRef, key);
3510
+ const validateError = getValidateError(await validate[key](inputValue), inputRef, key);
3576
3511
  if (validateError) {
3577
3512
  validationResult = {
3578
3513
  ...validateError,
@@ -3598,10 +3533,9 @@ var validateField = async (field, formValues, validateAllFieldCriteria, shouldUs
3598
3533
  setCustomValidity(true);
3599
3534
  return error2;
3600
3535
  };
3601
- var appendAt = (data, value) => [
3602
- ...data,
3603
- ...convertToArrayPayload(value)
3604
- ];
3536
+ function append(data, value) {
3537
+ return [...data, ...convertToArrayPayload(value)];
3538
+ }
3605
3539
  var fillEmptyArray = (value) => Array.isArray(value) ? value.map(() => void 0) : void 0;
3606
3540
  function insert(data, index, value) {
3607
3541
  return [
@@ -3620,10 +3554,9 @@ var moveArrayAt = (data, from, to) => {
3620
3554
  data.splice(to, 0, data.splice(from, 1)[0]);
3621
3555
  return data;
3622
3556
  };
3623
- var prependAt = (data, value) => [
3624
- ...convertToArrayPayload(value),
3625
- ...convertToArrayPayload(data)
3626
- ];
3557
+ function prepend(data, value) {
3558
+ return [...convertToArrayPayload(value), ...convertToArrayPayload(data)];
3559
+ }
3627
3560
  function removeAtIndexes(data, indexes) {
3628
3561
  let i2 = 0;
3629
3562
  const temp = [...data];
@@ -3633,9 +3566,9 @@ function removeAtIndexes(data, indexes) {
3633
3566
  }
3634
3567
  return compact(temp).length ? temp : [];
3635
3568
  }
3636
- var removeArrayAt = (data, index) => isUndefined$2(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort((a2, b2) => a2 - b2));
3569
+ var removeArrayAt = (data, index) => isUndefined$2(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort((a2, b) => a2 - b));
3637
3570
  var swapArrayAt = (data, indexA, indexB) => {
3638
- [data[indexA], data[indexB]] = [data[indexB], data[indexA]];
3571
+ data[indexA] = [data[indexB], data[indexB] = data[indexA]][0];
3639
3572
  };
3640
3573
  function baseGet(object, updatePath) {
3641
3574
  const length = updatePath.slice(0, -1).length;
@@ -3647,22 +3580,36 @@ function baseGet(object, updatePath) {
3647
3580
  }
3648
3581
  function isEmptyArray(obj) {
3649
3582
  for (const key in obj) {
3650
- if (obj.hasOwnProperty(key) && !isUndefined$2(obj[key])) {
3583
+ if (!isUndefined$2(obj[key])) {
3651
3584
  return false;
3652
3585
  }
3653
3586
  }
3654
3587
  return true;
3655
3588
  }
3656
3589
  function unset(object, path2) {
3657
- const paths = Array.isArray(path2) ? path2 : isKey(path2) ? [path2] : stringToPath(path2);
3658
- const childObject = paths.length === 1 ? object : baseGet(object, paths);
3659
- const index = paths.length - 1;
3660
- const key = paths[index];
3590
+ const updatePath = isKey(path2) ? [path2] : stringToPath(path2);
3591
+ const childObject = updatePath.length == 1 ? object : baseGet(object, updatePath);
3592
+ const key = updatePath[updatePath.length - 1];
3593
+ let previousObjRef;
3661
3594
  if (childObject) {
3662
3595
  delete childObject[key];
3663
3596
  }
3664
- if (index !== 0 && (isObject$1(childObject) && isEmptyObject(childObject) || Array.isArray(childObject) && isEmptyArray(childObject))) {
3665
- unset(object, paths.slice(0, -1));
3597
+ for (let k2 = 0; k2 < updatePath.slice(0, -1).length; k2++) {
3598
+ let index = -1;
3599
+ let objectRef;
3600
+ const currentPaths = updatePath.slice(0, -(k2 + 1));
3601
+ const currentPathsLength = currentPaths.length - 1;
3602
+ if (k2 > 0) {
3603
+ previousObjRef = object;
3604
+ }
3605
+ while (++index < currentPaths.length) {
3606
+ const item = currentPaths[index];
3607
+ objectRef = objectRef ? objectRef[item] : object[item];
3608
+ if (currentPathsLength === index && (isObject$1(objectRef) && isEmptyObject(objectRef) || Array.isArray(objectRef) && isEmptyArray(objectRef))) {
3609
+ previousObjRef ? delete previousObjRef[item] : delete object[item];
3610
+ }
3611
+ previousObjRef = objectRef;
3612
+ }
3666
3613
  }
3667
3614
  return object;
3668
3615
  }
@@ -3673,11 +3620,11 @@ var updateAt = (fieldValues, index, value) => {
3673
3620
  function useFieldArray(props) {
3674
3621
  const methods = useFormContext();
3675
3622
  const { control = methods.control, name, keyName = "id", shouldUnregister } = props;
3676
- const [fields, setFields] = React__default.useState(control._getFieldArray(name));
3677
- const ids = React__default.useRef(control._getFieldArray(name).map(generateId));
3678
- const _fieldIds = React__default.useRef(fields);
3679
- const _name = React__default.useRef(name);
3680
- const _actioned = React__default.useRef(false);
3623
+ const [fields, setFields] = React.useState(control._getFieldArray(name));
3624
+ const ids = React.useRef(control._getFieldArray(name).map(generateId));
3625
+ const _fieldIds = React.useRef(fields);
3626
+ const _name = React.useRef(name);
3627
+ const _actioned = React.useRef(false);
3681
3628
  _name.current = name;
3682
3629
  _fieldIds.current = fields;
3683
3630
  control._names.array.add(name);
@@ -3694,29 +3641,29 @@ function useFieldArray(props) {
3694
3641
  },
3695
3642
  subject: control._subjects.array
3696
3643
  });
3697
- const updateValues = React__default.useCallback((updatedFieldArrayValues) => {
3644
+ const updateValues = React.useCallback((updatedFieldArrayValues) => {
3698
3645
  _actioned.current = true;
3699
3646
  control._updateFieldArray(name, updatedFieldArrayValues);
3700
3647
  }, [control, name]);
3701
- const append = (value, options) => {
3648
+ const append$1 = (value, options) => {
3702
3649
  const appendValue = convertToArrayPayload(cloneObject(value));
3703
- const updatedFieldArrayValues = appendAt(control._getFieldArray(name), appendValue);
3650
+ const updatedFieldArrayValues = append(control._getFieldArray(name), appendValue);
3704
3651
  control._names.focus = getFocusFieldName(name, updatedFieldArrayValues.length - 1, options);
3705
- ids.current = appendAt(ids.current, appendValue.map(generateId));
3652
+ ids.current = append(ids.current, appendValue.map(generateId));
3706
3653
  updateValues(updatedFieldArrayValues);
3707
3654
  setFields(updatedFieldArrayValues);
3708
- control._updateFieldArray(name, updatedFieldArrayValues, appendAt, {
3655
+ control._updateFieldArray(name, updatedFieldArrayValues, append, {
3709
3656
  argA: fillEmptyArray(value)
3710
3657
  });
3711
3658
  };
3712
- const prepend = (value, options) => {
3659
+ const prepend$1 = (value, options) => {
3713
3660
  const prependValue = convertToArrayPayload(cloneObject(value));
3714
- const updatedFieldArrayValues = prependAt(control._getFieldArray(name), prependValue);
3661
+ const updatedFieldArrayValues = prepend(control._getFieldArray(name), prependValue);
3715
3662
  control._names.focus = getFocusFieldName(name, 0, options);
3716
- ids.current = prependAt(ids.current, prependValue.map(generateId));
3663
+ ids.current = prepend(ids.current, prependValue.map(generateId));
3717
3664
  updateValues(updatedFieldArrayValues);
3718
3665
  setFields(updatedFieldArrayValues);
3719
- control._updateFieldArray(name, updatedFieldArrayValues, prependAt, {
3666
+ control._updateFieldArray(name, updatedFieldArrayValues, prepend, {
3720
3667
  argA: fillEmptyArray(value)
3721
3668
  });
3722
3669
  };
@@ -3781,17 +3728,15 @@ function useFieldArray(props) {
3781
3728
  setFields([...updatedFieldArrayValues]);
3782
3729
  control._updateFieldArray(name, [...updatedFieldArrayValues], (data) => data, {}, true, false);
3783
3730
  };
3784
- React__default.useEffect(() => {
3785
- control._state.action = false;
3786
- isWatched(name, control._names) && control._subjects.state.next({
3787
- ...control._formState
3788
- });
3731
+ React.useEffect(() => {
3732
+ control._stateFlags.action = false;
3733
+ isWatched(name, control._names) && control._subjects.state.next({});
3789
3734
  if (_actioned.current && (!getValidationModes(control._options.mode).isOnSubmit || control._formState.isSubmitted)) {
3790
3735
  if (control._options.resolver) {
3791
3736
  control._executeSchema([name]).then((result) => {
3792
3737
  const error2 = get(result.errors, name);
3793
3738
  const existingError = get(control._formState.errors, name);
3794
- if (existingError ? !error2 && existingError.type || error2 && (existingError.type !== error2.type || existingError.message !== error2.message) : error2 && error2.type) {
3739
+ if (existingError ? !error2 && existingError.type : error2 && error2.type) {
3795
3740
  error2 ? set(control._formState.errors, name, error2) : unset(control._formState.errors, name);
3796
3741
  control._subjects.state.next({
3797
3742
  errors: control._formState.errors
@@ -3800,54 +3745,47 @@ function useFieldArray(props) {
3800
3745
  });
3801
3746
  } else {
3802
3747
  const field = get(control._fields, name);
3803
- if (field && field._f && !(getValidationModes(control._options.reValidateMode).isOnSubmit && getValidationModes(control._options.mode).isOnSubmit)) {
3804
- validateField(field, control._formValues, control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then((error2) => !isEmptyObject(error2) && control._subjects.state.next({
3748
+ if (field && field._f) {
3749
+ validateField(field, get(control._formValues, name), control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then((error2) => !isEmptyObject(error2) && control._subjects.state.next({
3805
3750
  errors: updateFieldArrayRootError(control._formState.errors, error2, name)
3806
3751
  }));
3807
3752
  }
3808
3753
  }
3809
3754
  }
3810
- control._subjects.values.next({
3755
+ control._subjects.watch.next({
3811
3756
  name,
3812
- values: { ...control._formValues }
3813
- });
3814
- control._names.focus && iterateFieldsByAction(control._fields, (ref, key) => {
3815
- if (control._names.focus && key.startsWith(control._names.focus) && ref.focus) {
3816
- ref.focus();
3817
- return 1;
3818
- }
3819
- return;
3757
+ values: control._formValues
3820
3758
  });
3759
+ control._names.focus && focusFieldBy(control._fields, (key) => !!key && key.startsWith(control._names.focus || ""));
3821
3760
  control._names.focus = "";
3822
- control._updateValid();
3823
- _actioned.current = false;
3761
+ control._proxyFormState.isValid && control._updateValid();
3824
3762
  }, [fields, name, control]);
3825
- React__default.useEffect(() => {
3763
+ React.useEffect(() => {
3826
3764
  !get(control._formValues, name) && control._updateFieldArray(name);
3827
3765
  return () => {
3828
3766
  (control._options.shouldUnregister || shouldUnregister) && control.unregister(name);
3829
3767
  };
3830
3768
  }, [name, control, keyName, shouldUnregister]);
3831
3769
  return {
3832
- swap: React__default.useCallback(swap, [updateValues, name, control]),
3833
- move: React__default.useCallback(move, [updateValues, name, control]),
3834
- prepend: React__default.useCallback(prepend, [updateValues, name, control]),
3835
- append: React__default.useCallback(append, [updateValues, name, control]),
3836
- remove: React__default.useCallback(remove2, [updateValues, name, control]),
3837
- insert: React__default.useCallback(insert$1, [updateValues, name, control]),
3838
- update: React__default.useCallback(update, [updateValues, name, control]),
3839
- replace: React__default.useCallback(replace, [updateValues, name, control]),
3840
- fields: React__default.useMemo(() => fields.map((field, index) => ({
3770
+ swap: React.useCallback(swap, [updateValues, name, control]),
3771
+ move: React.useCallback(move, [updateValues, name, control]),
3772
+ prepend: React.useCallback(prepend$1, [updateValues, name, control]),
3773
+ append: React.useCallback(append$1, [updateValues, name, control]),
3774
+ remove: React.useCallback(remove2, [updateValues, name, control]),
3775
+ insert: React.useCallback(insert$1, [updateValues, name, control]),
3776
+ update: React.useCallback(update, [updateValues, name, control]),
3777
+ replace: React.useCallback(replace, [updateValues, name, control]),
3778
+ fields: React.useMemo(() => fields.map((field, index) => ({
3841
3779
  ...field,
3842
3780
  [keyName]: ids.current[index] || generateId()
3843
3781
  })), [fields, keyName])
3844
3782
  };
3845
3783
  }
3846
- var createSubject = () => {
3784
+ function createSubject() {
3847
3785
  let _observers = [];
3848
3786
  const next = (value) => {
3849
3787
  for (const observer of _observers) {
3850
- observer.next && observer.next(value);
3788
+ observer.next(value);
3851
3789
  }
3852
3790
  };
3853
3791
  const subscribe = (observer) => {
@@ -3869,7 +3807,7 @@ var createSubject = () => {
3869
3807
  subscribe,
3870
3808
  unsubscribe
3871
3809
  };
3872
- };
3810
+ }
3873
3811
  var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
3874
3812
  function deepEqual(object1, object2) {
3875
3813
  if (isPrimitive(object1) || isPrimitive(object2)) {
@@ -3933,7 +3871,7 @@ function getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues
3933
3871
  getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
3934
3872
  }
3935
3873
  } else {
3936
- dirtyFieldsFromValues[key] = !deepEqual(data[key], formValues[key]);
3874
+ deepEqual(data[key], formValues[key]) ? delete dirtyFieldsFromValues[key] : dirtyFieldsFromValues[key] = true;
3937
3875
  }
3938
3876
  }
3939
3877
  }
@@ -4021,15 +3959,16 @@ const defaultOptions$1 = {
4021
3959
  reValidateMode: VALIDATION_MODE.onChange,
4022
3960
  shouldFocusError: true
4023
3961
  };
4024
- function createFormControl(props = {}) {
3962
+ function createFormControl(props = {}, flushRootRender) {
4025
3963
  let _options = {
4026
3964
  ...defaultOptions$1,
4027
3965
  ...props
4028
3966
  };
3967
+ const shouldCaptureDirtyFields = props.resetOptions && props.resetOptions.keepDirtyValues;
4029
3968
  let _formState = {
4030
3969
  submitCount: 0,
4031
3970
  isDirty: false,
4032
- isLoading: isFunction$1(_options.defaultValues),
3971
+ isLoading: true,
4033
3972
  isValidating: false,
4034
3973
  isSubmitted: false,
4035
3974
  isSubmitting: false,
@@ -4037,14 +3976,12 @@ function createFormControl(props = {}) {
4037
3976
  isValid: false,
4038
3977
  touchedFields: {},
4039
3978
  dirtyFields: {},
4040
- validatingFields: {},
4041
- errors: _options.errors || {},
4042
- disabled: _options.disabled || false
3979
+ errors: {}
4043
3980
  };
4044
3981
  let _fields = {};
4045
- let _defaultValues = isObject$1(_options.defaultValues) || isObject$1(_options.values) ? cloneObject(_options.defaultValues || _options.values) || {} : {};
3982
+ let _defaultValues = isObject$1(_options.defaultValues) ? cloneObject(_options.defaultValues) || {} : {};
4046
3983
  let _formValues = _options.shouldUnregister ? {} : cloneObject(_defaultValues);
4047
- let _state = {
3984
+ let _stateFlags = {
4048
3985
  action: false,
4049
3986
  mount: false,
4050
3987
  watch: false
@@ -4060,14 +3997,13 @@ function createFormControl(props = {}) {
4060
3997
  const _proxyFormState = {
4061
3998
  isDirty: false,
4062
3999
  dirtyFields: false,
4063
- validatingFields: false,
4064
4000
  touchedFields: false,
4065
4001
  isValidating: false,
4066
4002
  isValid: false,
4067
4003
  errors: false
4068
4004
  };
4069
4005
  const _subjects = {
4070
- values: createSubject(),
4006
+ watch: createSubject(),
4071
4007
  array: createSubject(),
4072
4008
  state: createSubject()
4073
4009
  };
@@ -4076,34 +4012,25 @@ function createFormControl(props = {}) {
4076
4012
  const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;
4077
4013
  const debounce = (callback) => (wait) => {
4078
4014
  clearTimeout(timer);
4079
- timer = setTimeout(callback, wait);
4015
+ timer = window.setTimeout(callback, wait);
4080
4016
  };
4081
- const _updateValid = async (shouldUpdateValid) => {
4082
- if (_proxyFormState.isValid || shouldUpdateValid) {
4017
+ const _updateValid = async () => {
4018
+ if (_proxyFormState.isValid) {
4083
4019
  const isValid = _options.resolver ? isEmptyObject((await _executeSchema()).errors) : await executeBuiltInValidation(_fields, true);
4084
4020
  if (isValid !== _formState.isValid) {
4021
+ _formState.isValid = isValid;
4085
4022
  _subjects.state.next({
4086
4023
  isValid
4087
4024
  });
4088
4025
  }
4089
4026
  }
4090
4027
  };
4091
- const _updateIsValidating = (names, isValidating) => {
4092
- if (_proxyFormState.isValidating || _proxyFormState.validatingFields) {
4093
- (names || Array.from(_names.mount)).forEach((name) => {
4094
- if (name) {
4095
- isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name);
4096
- }
4097
- });
4098
- _subjects.state.next({
4099
- validatingFields: _formState.validatingFields,
4100
- isValidating: !isEmptyObject(_formState.validatingFields)
4101
- });
4102
- }
4103
- };
4028
+ const _updateIsValidating = (value) => _proxyFormState.isValidating && _subjects.state.next({
4029
+ isValidating: value
4030
+ });
4104
4031
  const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
4105
4032
  if (args && method) {
4106
- _state.action = true;
4033
+ _stateFlags.action = true;
4107
4034
  if (shouldUpdateFieldsAndState && Array.isArray(get(_fields, name))) {
4108
4035
  const fieldValues = method(get(_fields, name), args.argA, args.argB);
4109
4036
  shouldSetValues && set(_fields, name, fieldValues);
@@ -4137,19 +4064,12 @@ function createFormControl(props = {}) {
4137
4064
  errors: _formState.errors
4138
4065
  });
4139
4066
  };
4140
- const _setErrors = (errors) => {
4141
- _formState.errors = errors;
4142
- _subjects.state.next({
4143
- errors: _formState.errors,
4144
- isValid: false
4145
- });
4146
- };
4147
4067
  const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
4148
4068
  const field = get(_fields, name);
4149
4069
  if (field) {
4150
4070
  const defaultValue = get(_formValues, name, isUndefined$2(value) ? get(_defaultValues, name) : value);
4151
4071
  isUndefined$2(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
4152
- _state.mount && _updateValid();
4072
+ _stateFlags.mount && _updateValid();
4153
4073
  }
4154
4074
  };
4155
4075
  const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
@@ -4158,16 +4078,15 @@ function createFormControl(props = {}) {
4158
4078
  const output2 = {
4159
4079
  name
4160
4080
  };
4161
- const disabledField = !!(get(_fields, name) && get(_fields, name)._f && get(_fields, name)._f.disabled);
4162
4081
  if (!isBlurEvent || shouldDirty) {
4163
4082
  if (_proxyFormState.isDirty) {
4164
4083
  isPreviousDirty = _formState.isDirty;
4165
4084
  _formState.isDirty = output2.isDirty = _getDirty();
4166
4085
  shouldUpdateField = isPreviousDirty !== output2.isDirty;
4167
4086
  }
4168
- const isCurrentFieldPristine = disabledField || deepEqual(get(_defaultValues, name), fieldValue);
4169
- isPreviousDirty = !!(!disabledField && get(_formState.dirtyFields, name));
4170
- isCurrentFieldPristine || disabledField ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
4087
+ const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue);
4088
+ isPreviousDirty = get(_formState.dirtyFields, name);
4089
+ isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
4171
4090
  output2.dirtyFields = _formState.dirtyFields;
4172
4091
  shouldUpdateField = shouldUpdateField || _proxyFormState.dirtyFields && isPreviousDirty !== !isCurrentFieldPristine;
4173
4092
  }
@@ -4206,15 +4125,11 @@ function createFormControl(props = {}) {
4206
4125
  };
4207
4126
  _subjects.state.next(updatedFormState);
4208
4127
  }
4128
+ _updateIsValidating(false);
4209
4129
  };
4210
- const _executeSchema = async (name) => {
4211
- _updateIsValidating(name, true);
4212
- const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
4213
- _updateIsValidating(name);
4214
- return result;
4215
- };
4130
+ const _executeSchema = async (name) => await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
4216
4131
  const executeSchemaAndUpdateState = async (names) => {
4217
- const { errors } = await _executeSchema(names);
4132
+ const { errors } = await _executeSchema();
4218
4133
  if (names) {
4219
4134
  for (const name of names) {
4220
4135
  const error2 = get(errors, name);
@@ -4234,9 +4149,7 @@ function createFormControl(props = {}) {
4234
4149
  const { _f, ...fieldValue } = field;
4235
4150
  if (_f) {
4236
4151
  const isFieldArrayRoot = _names.array.has(_f.name);
4237
- _updateIsValidating([name], true);
4238
- const fieldError = await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
4239
- _updateIsValidating([name]);
4152
+ const fieldError = await validateField(field, get(_formValues, _f.name), shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation, isFieldArrayRoot);
4240
4153
  if (fieldError[_f.name]) {
4241
4154
  context.valid = false;
4242
4155
  if (shouldOnlyCheckValid) {
@@ -4259,9 +4172,9 @@ function createFormControl(props = {}) {
4259
4172
  };
4260
4173
  const _getDirty = (name, data) => (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
4261
4174
  const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
4262
- ..._state.mount ? _formValues : isUndefined$2(defaultValue) ? _defaultValues : isString(names) ? { [names]: defaultValue } : defaultValue
4175
+ ..._stateFlags.mount ? _formValues : isUndefined$2(defaultValue) ? _defaultValues : isString(names) ? { [names]: defaultValue } : defaultValue
4263
4176
  }, isGlobal, defaultValue);
4264
- const _getFieldArray = (name) => compact(get(_state.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get(_defaultValues, name, []) : []));
4177
+ const _getFieldArray = (name) => compact(get(_stateFlags.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get(_defaultValues, name, []) : []));
4265
4178
  const setFieldValue = (name, value, options = {}) => {
4266
4179
  const field = get(_fields, name);
4267
4180
  let fieldValue = value;
@@ -4283,9 +4196,8 @@ function createFormControl(props = {}) {
4283
4196
  } else {
4284
4197
  fieldReference.ref.value = fieldValue;
4285
4198
  if (!fieldReference.ref.type) {
4286
- _subjects.values.next({
4287
- name,
4288
- values: { ..._formValues }
4199
+ _subjects.watch.next({
4200
+ name
4289
4201
  });
4290
4202
  }
4291
4203
  }
@@ -4310,34 +4222,30 @@ function createFormControl(props = {}) {
4310
4222
  if (isFieldArray) {
4311
4223
  _subjects.array.next({
4312
4224
  name,
4313
- values: { ..._formValues }
4225
+ values: _formValues
4314
4226
  });
4315
4227
  if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields) && options.shouldDirty) {
4228
+ _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
4316
4229
  _subjects.state.next({
4317
4230
  name,
4318
- dirtyFields: getDirtyFields(_defaultValues, _formValues),
4231
+ dirtyFields: _formState.dirtyFields,
4319
4232
  isDirty: _getDirty(name, cloneValue)
4320
4233
  });
4321
4234
  }
4322
4235
  } else {
4323
4236
  field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options) : setFieldValue(name, cloneValue, options);
4324
4237
  }
4325
- isWatched(name, _names) && _subjects.state.next({ ..._formState });
4326
- _subjects.values.next({
4327
- name: _state.mount ? name : void 0,
4328
- values: { ..._formValues }
4238
+ isWatched(name, _names) && _subjects.state.next({});
4239
+ _subjects.watch.next({
4240
+ name
4329
4241
  });
4242
+ !_stateFlags.mount && flushRootRender();
4330
4243
  };
4331
4244
  const onChange = async (event) => {
4332
- _state.mount = true;
4333
4245
  const target = event.target;
4334
4246
  let name = target.name;
4335
- let isFieldValueUpdated = true;
4336
4247
  const field = get(_fields, name);
4337
4248
  const getCurrentFieldValue = () => target.type ? getFieldValue(field._f) : getEventValue(event);
4338
- const _updateIsFieldValueUpdated = (fieldValue) => {
4339
- isFieldValueUpdated = Number.isNaN(fieldValue) || fieldValue === get(_formValues, name, fieldValue);
4340
- };
4341
4249
  if (field) {
4342
4250
  let error2;
4343
4251
  let isValid;
@@ -4354,56 +4262,40 @@ function createFormControl(props = {}) {
4354
4262
  }
4355
4263
  const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent, false);
4356
4264
  const shouldRender = !isEmptyObject(fieldState) || watched;
4357
- !isBlurEvent && _subjects.values.next({
4265
+ !isBlurEvent && _subjects.watch.next({
4358
4266
  name,
4359
- type: event.type,
4360
- values: { ..._formValues }
4267
+ type: event.type
4361
4268
  });
4362
4269
  if (shouldSkipValidation) {
4363
4270
  _proxyFormState.isValid && _updateValid();
4364
4271
  return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
4365
4272
  }
4366
- !isBlurEvent && watched && _subjects.state.next({ ..._formState });
4273
+ !isBlurEvent && watched && _subjects.state.next({});
4274
+ _updateIsValidating(true);
4367
4275
  if (_options.resolver) {
4368
4276
  const { errors } = await _executeSchema([name]);
4369
- _updateIsFieldValueUpdated(fieldValue);
4370
- if (isFieldValueUpdated) {
4371
- const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
4372
- const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
4373
- error2 = errorLookupResult.error;
4374
- name = errorLookupResult.name;
4375
- isValid = isEmptyObject(errors);
4376
- }
4277
+ const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
4278
+ const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
4279
+ error2 = errorLookupResult.error;
4280
+ name = errorLookupResult.name;
4281
+ isValid = isEmptyObject(errors);
4377
4282
  } else {
4378
- _updateIsValidating([name], true);
4379
- error2 = (await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
4380
- _updateIsValidating([name]);
4381
- _updateIsFieldValueUpdated(fieldValue);
4382
- if (isFieldValueUpdated) {
4383
- if (error2) {
4384
- isValid = false;
4385
- } else if (_proxyFormState.isValid) {
4386
- isValid = await executeBuiltInValidation(_fields, true);
4387
- }
4283
+ error2 = (await validateField(field, get(_formValues, name), shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
4284
+ if (error2) {
4285
+ isValid = false;
4286
+ } else if (_proxyFormState.isValid) {
4287
+ isValid = await executeBuiltInValidation(_fields, true);
4388
4288
  }
4389
4289
  }
4390
- if (isFieldValueUpdated) {
4391
- field._f.deps && trigger(field._f.deps);
4392
- shouldRenderByError(name, isValid, error2, fieldState);
4393
- }
4290
+ field._f.deps && trigger(field._f.deps);
4291
+ shouldRenderByError(name, isValid, error2, fieldState);
4394
4292
  }
4395
4293
  };
4396
- const _focusInput = (ref, key) => {
4397
- if (get(_formState.errors, key) && ref.focus) {
4398
- ref.focus();
4399
- return 1;
4400
- }
4401
- return;
4402
- };
4403
4294
  const trigger = async (name, options = {}) => {
4404
4295
  let isValid;
4405
4296
  let validationResult;
4406
4297
  const fieldNames = convertToArrayPayload(name);
4298
+ _updateIsValidating(true);
4407
4299
  if (_options.resolver) {
4408
4300
  const errors = await executeSchemaAndUpdateState(isUndefined$2(name) ? name : fieldNames);
4409
4301
  isValid = isEmptyObject(errors);
@@ -4420,36 +4312,34 @@ function createFormControl(props = {}) {
4420
4312
  _subjects.state.next({
4421
4313
  ...!isString(name) || _proxyFormState.isValid && isValid !== _formState.isValid ? {} : { name },
4422
4314
  ..._options.resolver || !name ? { isValid } : {},
4423
- errors: _formState.errors
4315
+ errors: _formState.errors,
4316
+ isValidating: false
4424
4317
  });
4425
- options.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
4318
+ options.shouldFocus && !validationResult && focusFieldBy(_fields, (key) => key && get(_formState.errors, key), name ? fieldNames : _names.mount);
4426
4319
  return validationResult;
4427
4320
  };
4428
4321
  const getValues = (fieldNames) => {
4429
4322
  const values = {
4430
- ..._state.mount ? _formValues : _defaultValues
4323
+ ..._defaultValues,
4324
+ ..._stateFlags.mount ? _formValues : {}
4431
4325
  };
4432
4326
  return isUndefined$2(fieldNames) ? values : isString(fieldNames) ? get(values, fieldNames) : fieldNames.map((name) => get(values, name));
4433
4327
  };
4434
4328
  const getFieldState = (name, formState) => ({
4435
4329
  invalid: !!get((formState || _formState).errors, name),
4436
4330
  isDirty: !!get((formState || _formState).dirtyFields, name),
4437
- error: get((formState || _formState).errors, name),
4438
- isValidating: !!get(_formState.validatingFields, name),
4439
- isTouched: !!get((formState || _formState).touchedFields, name)
4331
+ isTouched: !!get((formState || _formState).touchedFields, name),
4332
+ error: get((formState || _formState).errors, name)
4440
4333
  });
4441
4334
  const clearErrors = (name) => {
4442
- name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
4335
+ name ? convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName)) : _formState.errors = {};
4443
4336
  _subjects.state.next({
4444
- errors: name ? _formState.errors : {}
4337
+ errors: _formState.errors
4445
4338
  });
4446
4339
  };
4447
4340
  const setError = (name, error2, options) => {
4448
4341
  const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
4449
- const currentError = get(_formState.errors, name) || {};
4450
- const { ref: currentRef, message, type, ...restOfErrorTree } = currentError;
4451
4342
  set(_formState.errors, name, {
4452
- ...restOfErrorTree,
4453
4343
  ...error2,
4454
4344
  ref
4455
4345
  });
@@ -4460,39 +4350,31 @@ function createFormControl(props = {}) {
4460
4350
  });
4461
4351
  options && options.shouldFocus && ref && ref.focus && ref.focus();
4462
4352
  };
4463
- const watch = (name, defaultValue) => isFunction$1(name) ? _subjects.values.subscribe({
4353
+ const watch = (name, defaultValue) => isFunction$1(name) ? _subjects.watch.subscribe({
4464
4354
  next: (payload) => name(_getWatch(void 0, defaultValue), payload)
4465
4355
  }) : _getWatch(name, defaultValue, true);
4466
4356
  const unregister = (name, options = {}) => {
4467
4357
  for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
4468
4358
  _names.mount.delete(fieldName);
4469
4359
  _names.array.delete(fieldName);
4470
- if (!options.keepValue) {
4471
- unset(_fields, fieldName);
4472
- unset(_formValues, fieldName);
4473
- }
4474
- !options.keepError && unset(_formState.errors, fieldName);
4475
- !options.keepDirty && unset(_formState.dirtyFields, fieldName);
4476
- !options.keepTouched && unset(_formState.touchedFields, fieldName);
4477
- !options.keepIsValidating && unset(_formState.validatingFields, fieldName);
4478
- !_options.shouldUnregister && !options.keepDefaultValue && unset(_defaultValues, fieldName);
4479
- }
4480
- _subjects.values.next({
4481
- values: { ..._formValues }
4482
- });
4360
+ if (get(_fields, fieldName)) {
4361
+ if (!options.keepValue) {
4362
+ unset(_fields, fieldName);
4363
+ unset(_formValues, fieldName);
4364
+ }
4365
+ !options.keepError && unset(_formState.errors, fieldName);
4366
+ !options.keepDirty && unset(_formState.dirtyFields, fieldName);
4367
+ !options.keepTouched && unset(_formState.touchedFields, fieldName);
4368
+ !_options.shouldUnregister && !options.keepDefaultValue && unset(_defaultValues, fieldName);
4369
+ }
4370
+ }
4371
+ _subjects.watch.next({});
4483
4372
  _subjects.state.next({
4484
4373
  ..._formState,
4485
4374
  ...!options.keepDirty ? {} : { isDirty: _getDirty() }
4486
4375
  });
4487
4376
  !options.keepIsValid && _updateValid();
4488
4377
  };
4489
- const _updateDisabledField = ({ disabled, name, field, fields, value }) => {
4490
- if (isBoolean(disabled) && _state.mount || !!disabled) {
4491
- const inputValue = disabled ? void 0 : isUndefined$2(value) ? getFieldValue(field ? field._f : get(fields, name)._f) : value;
4492
- set(_formValues, name, inputValue);
4493
- updateTouchAndDirty(name, inputValue, false, false, true);
4494
- }
4495
- };
4496
4378
  const register = (name, options = {}) => {
4497
4379
  let field = get(_fields, name);
4498
4380
  const disabledIsDefined = isBoolean(options.disabled);
@@ -4506,19 +4388,10 @@ function createFormControl(props = {}) {
4506
4388
  }
4507
4389
  });
4508
4390
  _names.mount.add(name);
4509
- if (field) {
4510
- _updateDisabledField({
4511
- field,
4512
- disabled: options.disabled,
4513
- name,
4514
- value: options.value
4515
- });
4516
- } else {
4517
- updateValidAndValue(name, true, options.value);
4518
- }
4391
+ field ? disabledIsDefined && set(_formValues, name, options.disabled ? void 0 : get(_formValues, name, getFieldValue(field._f))) : updateValidAndValue(name, true, options.value);
4519
4392
  return {
4520
4393
  ...disabledIsDefined ? { disabled: options.disabled } : {},
4521
- ..._options.progressive ? {
4394
+ ..._options.shouldUseNativeValidation ? {
4522
4395
  required: !!options.required,
4523
4396
  min: getRuleValue(options.min),
4524
4397
  max: getRuleValue(options.max),
@@ -4558,87 +4431,70 @@ function createFormControl(props = {}) {
4558
4431
  if (field._f) {
4559
4432
  field._f.mount = false;
4560
4433
  }
4561
- (_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
4434
+ (_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _stateFlags.action) && _names.unMount.add(name);
4562
4435
  }
4563
4436
  }
4564
4437
  };
4565
4438
  };
4566
- const _focusError = () => _options.shouldFocusError && iterateFieldsByAction(_fields, _focusInput, _names.mount);
4567
- const _disableForm = (disabled) => {
4568
- if (isBoolean(disabled)) {
4569
- _subjects.state.next({ disabled });
4570
- iterateFieldsByAction(_fields, (ref, name) => {
4571
- const currentField = get(_fields, name);
4572
- if (currentField) {
4573
- ref.disabled = currentField._f.disabled || disabled;
4574
- if (Array.isArray(currentField._f.refs)) {
4575
- currentField._f.refs.forEach((inputRef) => {
4576
- inputRef.disabled = currentField._f.disabled || disabled;
4577
- });
4578
- }
4579
- }
4580
- }, 0, false);
4581
- }
4582
- };
4439
+ const _focusError = () => _options.shouldFocusError && focusFieldBy(_fields, (key) => key && get(_formState.errors, key), _names.mount);
4583
4440
  const handleSubmit = (onValid, onInvalid) => async (e2) => {
4584
- let onValidError = void 0;
4585
4441
  if (e2) {
4586
4442
  e2.preventDefault && e2.preventDefault();
4587
4443
  e2.persist && e2.persist();
4588
4444
  }
4445
+ let hasNoPromiseError = true;
4589
4446
  let fieldValues = cloneObject(_formValues);
4590
4447
  _subjects.state.next({
4591
4448
  isSubmitting: true
4592
4449
  });
4593
- if (_options.resolver) {
4594
- const { errors, values } = await _executeSchema();
4595
- _formState.errors = errors;
4596
- fieldValues = values;
4597
- } else {
4598
- await executeBuiltInValidation(_fields);
4599
- }
4600
- unset(_formState.errors, "root");
4601
- if (isEmptyObject(_formState.errors)) {
4602
- _subjects.state.next({
4603
- errors: {}
4604
- });
4605
- try {
4606
- await onValid(fieldValues, e2);
4607
- } catch (error2) {
4608
- onValidError = error2;
4450
+ try {
4451
+ if (_options.resolver) {
4452
+ const { errors, values } = await _executeSchema();
4453
+ _formState.errors = errors;
4454
+ fieldValues = values;
4455
+ } else {
4456
+ await executeBuiltInValidation(_fields);
4609
4457
  }
4610
- } else {
4611
- if (onInvalid) {
4612
- await onInvalid({ ..._formState.errors }, e2);
4458
+ if (isEmptyObject(_formState.errors)) {
4459
+ _subjects.state.next({
4460
+ errors: {},
4461
+ isSubmitting: true
4462
+ });
4463
+ await onValid(fieldValues, e2);
4464
+ } else {
4465
+ if (onInvalid) {
4466
+ await onInvalid({ ..._formState.errors }, e2);
4467
+ }
4468
+ _focusError();
4613
4469
  }
4614
- _focusError();
4615
- setTimeout(_focusError);
4616
- }
4617
- _subjects.state.next({
4618
- isSubmitted: true,
4619
- isSubmitting: false,
4620
- isSubmitSuccessful: isEmptyObject(_formState.errors) && !onValidError,
4621
- submitCount: _formState.submitCount + 1,
4622
- errors: _formState.errors
4623
- });
4624
- if (onValidError) {
4625
- throw onValidError;
4470
+ } catch (err) {
4471
+ hasNoPromiseError = false;
4472
+ throw err;
4473
+ } finally {
4474
+ _formState.isSubmitted = true;
4475
+ _subjects.state.next({
4476
+ isSubmitted: true,
4477
+ isSubmitting: false,
4478
+ isSubmitSuccessful: isEmptyObject(_formState.errors) && hasNoPromiseError,
4479
+ submitCount: _formState.submitCount + 1,
4480
+ errors: _formState.errors
4481
+ });
4626
4482
  }
4627
4483
  };
4628
4484
  const resetField = (name, options = {}) => {
4629
4485
  if (get(_fields, name)) {
4630
4486
  if (isUndefined$2(options.defaultValue)) {
4631
- setValue(name, cloneObject(get(_defaultValues, name)));
4487
+ setValue(name, get(_defaultValues, name));
4632
4488
  } else {
4633
4489
  setValue(name, options.defaultValue);
4634
- set(_defaultValues, name, cloneObject(options.defaultValue));
4490
+ set(_defaultValues, name, options.defaultValue);
4635
4491
  }
4636
4492
  if (!options.keepTouched) {
4637
4493
  unset(_formState.touchedFields, name);
4638
4494
  }
4639
4495
  if (!options.keepDirty) {
4640
4496
  unset(_formState.dirtyFields, name);
4641
- _formState.isDirty = options.defaultValue ? _getDirty(name, cloneObject(get(_defaultValues, name))) : _getDirty();
4497
+ _formState.isDirty = options.defaultValue ? _getDirty(name, get(_defaultValues, name)) : _getDirty();
4642
4498
  }
4643
4499
  if (!options.keepError) {
4644
4500
  unset(_formState.errors, name);
@@ -4648,15 +4504,14 @@ function createFormControl(props = {}) {
4648
4504
  }
4649
4505
  };
4650
4506
  const _reset = (formValues, keepStateOptions = {}) => {
4651
- const updatedValues = formValues ? cloneObject(formValues) : _defaultValues;
4507
+ const updatedValues = formValues || _defaultValues;
4652
4508
  const cloneUpdatedValues = cloneObject(updatedValues);
4653
- const isEmptyResetValues = isEmptyObject(formValues);
4654
- const values = isEmptyResetValues ? _defaultValues : cloneUpdatedValues;
4509
+ const values = formValues && !isEmptyObject(formValues) ? cloneUpdatedValues : _defaultValues;
4655
4510
  if (!keepStateOptions.keepDefaultValues) {
4656
4511
  _defaultValues = updatedValues;
4657
4512
  }
4658
4513
  if (!keepStateOptions.keepValues) {
4659
- if (keepStateOptions.keepDirtyValues) {
4514
+ if (keepStateOptions.keepDirtyValues || shouldCaptureDirtyFields) {
4660
4515
  for (const fieldName of _names.mount) {
4661
4516
  get(_formState.dirtyFields, fieldName) ? set(values, fieldName, get(_formValues, fieldName)) : setValue(fieldName, get(values, fieldName));
4662
4517
  }
@@ -4678,33 +4533,34 @@ function createFormControl(props = {}) {
4678
4533
  }
4679
4534
  _fields = {};
4680
4535
  }
4681
- _formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} : cloneObject(values);
4536
+ _formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} : cloneUpdatedValues;
4682
4537
  _subjects.array.next({
4683
- values: { ...values }
4538
+ values
4684
4539
  });
4685
- _subjects.values.next({
4686
- values: { ...values }
4540
+ _subjects.watch.next({
4541
+ values
4687
4542
  });
4688
4543
  }
4689
4544
  _names = {
4690
- mount: keepStateOptions.keepDirtyValues ? _names.mount : /* @__PURE__ */ new Set(),
4545
+ mount: /* @__PURE__ */ new Set(),
4691
4546
  unMount: /* @__PURE__ */ new Set(),
4692
4547
  array: /* @__PURE__ */ new Set(),
4693
4548
  watch: /* @__PURE__ */ new Set(),
4694
4549
  watchAll: false,
4695
4550
  focus: ""
4696
4551
  };
4697
- _state.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid || !!keepStateOptions.keepDirtyValues;
4698
- _state.watch = !!props.shouldUnregister;
4552
+ !_stateFlags.mount && flushRootRender();
4553
+ _stateFlags.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid;
4554
+ _stateFlags.watch = !!props.shouldUnregister;
4699
4555
  _subjects.state.next({
4700
4556
  submitCount: keepStateOptions.keepSubmitCount ? _formState.submitCount : 0,
4701
- isDirty: isEmptyResetValues ? false : keepStateOptions.keepDirty ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)),
4557
+ isDirty: keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)),
4702
4558
  isSubmitted: keepStateOptions.keepIsSubmitted ? _formState.isSubmitted : false,
4703
- dirtyFields: isEmptyResetValues ? {} : keepStateOptions.keepDirtyValues ? keepStateOptions.keepDefaultValues && _formValues ? getDirtyFields(_defaultValues, _formValues) : _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues) : keepStateOptions.keepDirty ? _formState.dirtyFields : {},
4559
+ dirtyFields: keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues ? _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues) : {},
4704
4560
  touchedFields: keepStateOptions.keepTouched ? _formState.touchedFields : {},
4705
4561
  errors: keepStateOptions.keepErrors ? _formState.errors : {},
4706
- isSubmitSuccessful: keepStateOptions.keepIsSubmitSuccessful ? _formState.isSubmitSuccessful : false,
4707
- isSubmitting: false
4562
+ isSubmitting: false,
4563
+ isSubmitSuccessful: false
4708
4564
  });
4709
4565
  };
4710
4566
  const reset = (formValues, keepStateOptions) => _reset(isFunction$1(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
@@ -4719,51 +4575,41 @@ function createFormControl(props = {}) {
4719
4575
  }
4720
4576
  }
4721
4577
  };
4722
- const _updateFormState = (updatedFormState) => {
4723
- _formState = {
4724
- ..._formState,
4725
- ...updatedFormState
4726
- };
4727
- };
4728
- const _resetDefaultValues = () => isFunction$1(_options.defaultValues) && _options.defaultValues().then((values) => {
4729
- reset(values, _options.resetOptions);
4730
- _subjects.state.next({
4731
- isLoading: false
4578
+ if (isFunction$1(_options.defaultValues)) {
4579
+ _options.defaultValues().then((values) => {
4580
+ reset(values, _options.resetOptions);
4581
+ _subjects.state.next({
4582
+ isLoading: false
4583
+ });
4732
4584
  });
4733
- });
4585
+ }
4734
4586
  return {
4735
4587
  control: {
4736
4588
  register,
4737
4589
  unregister,
4738
4590
  getFieldState,
4739
- handleSubmit,
4740
- setError,
4741
4591
  _executeSchema,
4592
+ _focusError,
4742
4593
  _getWatch,
4743
4594
  _getDirty,
4744
4595
  _updateValid,
4745
4596
  _removeUnmounted,
4746
4597
  _updateFieldArray,
4747
- _updateDisabledField,
4748
4598
  _getFieldArray,
4749
4599
  _reset,
4750
- _resetDefaultValues,
4751
- _updateFormState,
4752
- _disableForm,
4753
4600
  _subjects,
4754
4601
  _proxyFormState,
4755
- _setErrors,
4756
4602
  get _fields() {
4757
4603
  return _fields;
4758
4604
  },
4759
4605
  get _formValues() {
4760
4606
  return _formValues;
4761
4607
  },
4762
- get _state() {
4763
- return _state;
4608
+ get _stateFlags() {
4609
+ return _stateFlags;
4764
4610
  },
4765
- set _state(value) {
4766
- _state = value;
4611
+ set _stateFlags(value) {
4612
+ _stateFlags = value;
4767
4613
  },
4768
4614
  get _defaultValues() {
4769
4615
  return _defaultValues;
@@ -4806,12 +4652,11 @@ function createFormControl(props = {}) {
4806
4652
  };
4807
4653
  }
4808
4654
  function useForm(props = {}) {
4809
- const _formControl = React__default.useRef();
4810
- const _values = React__default.useRef();
4811
- const [formState, updateFormState] = React__default.useState({
4655
+ const _formControl = React.useRef();
4656
+ const [formState, updateFormState] = React.useState({
4812
4657
  isDirty: false,
4813
4658
  isValidating: false,
4814
- isLoading: isFunction$1(props.defaultValues),
4659
+ isLoading: true,
4815
4660
  isSubmitted: false,
4816
4661
  isSubmitting: false,
4817
4662
  isSubmitSuccessful: false,
@@ -4819,14 +4664,12 @@ function useForm(props = {}) {
4819
4664
  submitCount: 0,
4820
4665
  dirtyFields: {},
4821
4666
  touchedFields: {},
4822
- validatingFields: {},
4823
- errors: props.errors || {},
4824
- disabled: props.disabled || false,
4667
+ errors: {},
4825
4668
  defaultValues: isFunction$1(props.defaultValues) ? void 0 : props.defaultValues
4826
4669
  });
4827
4670
  if (!_formControl.current) {
4828
4671
  _formControl.current = {
4829
- ...createFormControl(props),
4672
+ ...createFormControl(props, () => updateFormState((formState2) => ({ ...formState2 }))),
4830
4673
  formState
4831
4674
  };
4832
4675
  }
@@ -4835,59 +4678,40 @@ function useForm(props = {}) {
4835
4678
  useSubscribe({
4836
4679
  subject: control._subjects.state,
4837
4680
  next: (value) => {
4838
- if (shouldRenderFormState(value, control._proxyFormState, control._updateFormState, true)) {
4681
+ if (shouldRenderFormState(value, control._proxyFormState, true)) {
4682
+ control._formState = {
4683
+ ...control._formState,
4684
+ ...value
4685
+ };
4839
4686
  updateFormState({ ...control._formState });
4840
4687
  }
4841
4688
  }
4842
4689
  });
4843
- React__default.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
4844
- React__default.useEffect(() => {
4845
- if (control._proxyFormState.isDirty) {
4846
- const isDirty = control._getDirty();
4847
- if (isDirty !== formState.isDirty) {
4848
- control._subjects.state.next({
4849
- isDirty
4850
- });
4851
- }
4690
+ React.useEffect(() => {
4691
+ if (!control._stateFlags.mount) {
4692
+ control._proxyFormState.isValid && control._updateValid();
4693
+ control._stateFlags.mount = true;
4852
4694
  }
4853
- }, [control, formState.isDirty]);
4854
- React__default.useEffect(() => {
4855
- if (props.values && !deepEqual(props.values, _values.current)) {
4856
- control._reset(props.values, control._options.resetOptions);
4857
- _values.current = props.values;
4858
- updateFormState((state) => ({ ...state }));
4859
- } else {
4860
- control._resetDefaultValues();
4861
- }
4862
- }, [props.values, control]);
4863
- React__default.useEffect(() => {
4864
- if (props.errors) {
4865
- control._setErrors(props.errors);
4866
- }
4867
- }, [props.errors, control]);
4868
- React__default.useEffect(() => {
4869
- if (!control._state.mount) {
4870
- control._updateValid();
4871
- control._state.mount = true;
4872
- }
4873
- if (control._state.watch) {
4874
- control._state.watch = false;
4875
- control._subjects.state.next({ ...control._formState });
4695
+ if (control._stateFlags.watch) {
4696
+ control._stateFlags.watch = false;
4697
+ control._subjects.state.next({});
4876
4698
  }
4877
4699
  control._removeUnmounted();
4878
4700
  });
4879
- React__default.useEffect(() => {
4880
- props.shouldUnregister && control._subjects.values.next({
4881
- values: control._getWatch()
4882
- });
4883
- }, [props.shouldUnregister, control]);
4701
+ React.useEffect(() => {
4702
+ if (props.values && !deepEqual(props.values, control._defaultValues)) {
4703
+ control._reset(props.values, control._options.resetOptions);
4704
+ }
4705
+ }, [props.values, control]);
4706
+ React.useEffect(() => {
4707
+ formState.submitCount && control._focusError();
4708
+ }, [control, formState.submitCount]);
4884
4709
  _formControl.current.formState = getProxyFormState(formState, control);
4885
4710
  return _formControl.current;
4886
4711
  }
4887
4712
  var index_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4888
4713
  __proto__: null,
4889
4714
  Controller,
4890
- Form,
4891
4715
  FormProvider,
4892
4716
  appendErrors,
4893
4717
  get,
@@ -6360,6 +6184,7 @@ var EOrderSource;
6360
6184
  EOrderSource2["TAZZ"] = "TAZZ";
6361
6185
  EOrderSource2["POS"] = "POS";
6362
6186
  EOrderSource2["UPMENU"] = "UPMENU";
6187
+ EOrderSource2["APP"] = "APP";
6363
6188
  })(EOrderSource || (EOrderSource = {}));
6364
6189
  var EChannelName;
6365
6190
  (function(EChannelName2) {
@@ -6424,6 +6249,7 @@ var EOrderProductKind;
6424
6249
  })(EOrderProductKind || (EOrderProductKind = {}));
6425
6250
  var ENotificationType;
6426
6251
  (function(ENotificationType2) {
6252
+ ENotificationType2["ORDER_MESSAGE"] = "OrderMessage";
6427
6253
  ENotificationType2["ORDER_EVENT_ERROR"] = "OrderEventError";
6428
6254
  ENotificationType2["ORDER_APPLIED_EVENTS"] = "OrderAppliedEvents";
6429
6255
  ENotificationType2["ORDER_EVENT_FISCAL"] = "OrderEventFiscal";
@@ -6509,7 +6335,7 @@ const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
6509
6335
  function create(createState) {
6510
6336
  const api = typeof createState === "function" ? createStore(createState) : createState;
6511
6337
  const useStore2 = (selector = api.getState, equalityFn = Object.is) => {
6512
- const [, forceUpdate] = useReducer((c2) => c2 + 1, 0);
6338
+ const [, forceUpdate] = useReducer((c) => c + 1, 0);
6513
6339
  const state = api.getState();
6514
6340
  const stateRef = useRef(state);
6515
6341
  const selectorRef = useRef(selector);
@@ -6873,7 +6699,9 @@ const validateProductFilter = (product, stateFilter) => {
6873
6699
  const commonFilters = (_a = Object.keys(stateFiltersWithFltCtx)) == null ? void 0 : _a.filter(
6874
6700
  (filterName) => {
6875
6701
  var _a2;
6876
- const matchingFilters = (_a2 = Object.keys((productFilters == null ? void 0 : productFilters[filterName]) || {})) == null ? void 0 : _a2.filter((x2) => {
6702
+ const matchingFilters = (_a2 = Object.keys(
6703
+ (productFilters == null ? void 0 : productFilters[filterName]) || {}
6704
+ )) == null ? void 0 : _a2.filter((x2) => {
6877
6705
  var _a3;
6878
6706
  if (((_a3 = productFilters == null ? void 0 : productFilters[filterName]) == null ? void 0 : _a3[x2]) === (stateFiltersWithFltCtx == null ? void 0 : stateFiltersWithFltCtx[filterName])) {
6879
6707
  return true;
@@ -6907,13 +6735,11 @@ const getProductToChangeInForm = (product, isFilterValidated) => {
6907
6735
  return { productsToSelect, productsToUnselect };
6908
6736
  };
6909
6737
  const unselectProductsInForm = (productsToUnselect, setValueInForm) => {
6910
- console.log("LOG1 productsToUnselect", productsToUnselect);
6911
6738
  productsToUnselect.map(({ selCtx, id }) => {
6912
6739
  setValueInForm(`selected.${selCtx}.${id}`, false);
6913
6740
  });
6914
6741
  };
6915
6742
  const selectProductsInForm = (productToSelect, setValueInForm, initialSelectedState) => {
6916
- console.log("LOG1 productToSelect", productToSelect);
6917
6743
  productToSelect.map(({ selCtx, id }) => {
6918
6744
  var _a;
6919
6745
  const productInInitialState = (_a = initialSelectedState[selCtx]) == null ? void 0 : _a[id];
@@ -6976,22 +6802,22 @@ var reactJsxRuntime_production_min = {};
6976
6802
  * This source code is licensed under the MIT license found in the
6977
6803
  * LICENSE file in the root directory of this source tree.
6978
6804
  */
6979
- var f$5 = React__default, k$1 = Symbol.for("react.element"), l$6 = Symbol.for("react.fragment"), m$3 = Object.prototype.hasOwnProperty, n$4 = f$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p$4 = { key: true, ref: true, __self: true, __source: true };
6980
- function q$1(c2, a2, g2) {
6981
- var b2, d2 = {}, e2 = null, h2 = null;
6982
- void 0 !== g2 && (e2 = "" + g2);
6805
+ var f$3 = React, k$2 = Symbol.for("react.element"), l$4 = Symbol.for("react.fragment"), m$3 = Object.prototype.hasOwnProperty, n$2 = f$3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p$3 = { key: true, ref: true, __self: true, __source: true };
6806
+ function q(c, a2, g) {
6807
+ var b, d2 = {}, e2 = null, h2 = null;
6808
+ void 0 !== g && (e2 = "" + g);
6983
6809
  void 0 !== a2.key && (e2 = "" + a2.key);
6984
6810
  void 0 !== a2.ref && (h2 = a2.ref);
6985
- for (b2 in a2)
6986
- m$3.call(a2, b2) && !p$4.hasOwnProperty(b2) && (d2[b2] = a2[b2]);
6987
- if (c2 && c2.defaultProps)
6988
- for (b2 in a2 = c2.defaultProps, a2)
6989
- void 0 === d2[b2] && (d2[b2] = a2[b2]);
6990
- return { $$typeof: k$1, type: c2, key: e2, ref: h2, props: d2, _owner: n$4.current };
6991
- }
6992
- reactJsxRuntime_production_min.Fragment = l$6;
6993
- reactJsxRuntime_production_min.jsx = q$1;
6994
- reactJsxRuntime_production_min.jsxs = q$1;
6811
+ for (b in a2)
6812
+ m$3.call(a2, b) && !p$3.hasOwnProperty(b) && (d2[b] = a2[b]);
6813
+ if (c && c.defaultProps)
6814
+ for (b in a2 = c.defaultProps, a2)
6815
+ void 0 === d2[b] && (d2[b] = a2[b]);
6816
+ return { $$typeof: k$2, type: c, key: e2, ref: h2, props: d2, _owner: n$2.current };
6817
+ }
6818
+ reactJsxRuntime_production_min.Fragment = l$4;
6819
+ reactJsxRuntime_production_min.jsx = q;
6820
+ reactJsxRuntime_production_min.jsxs = q;
6995
6821
  {
6996
6822
  jsxRuntime.exports = reactJsxRuntime_production_min;
6997
6823
  }
@@ -7100,8 +6926,8 @@ function _nonIterableRest() {
7100
6926
  }
7101
6927
  var Static = {
7102
6928
  normalizePrecision: function normalizePrecision(objects) {
7103
- var highestPrecision = objects.reduce(function(a2, b2) {
7104
- return Math.max(a2.getPrecision(), b2.getPrecision());
6929
+ var highestPrecision = objects.reduce(function(a2, b) {
6930
+ return Math.max(a2.getPrecision(), b.getPrecision());
7105
6931
  });
7106
6932
  return objects.map(function(object) {
7107
6933
  return object.getPrecision() !== highestPrecision ? object.convertPrecision(highestPrecision) : object;
@@ -7206,12 +7032,12 @@ function isThenable(value) {
7206
7032
  return Boolean(value) && (_typeof(value) === "object" || typeof value === "function") && typeof value.then === "function";
7207
7033
  }
7208
7034
  function Calculator() {
7209
- var floatMultiply = function floatMultiply2(a2, b2) {
7035
+ var floatMultiply = function floatMultiply2(a2, b) {
7210
7036
  var getFactor = function getFactor2(number) {
7211
7037
  return Math.pow(10, countFractionDigits(number));
7212
7038
  };
7213
- var factor = Math.max(getFactor(a2), getFactor(b2));
7214
- return Math.round(a2 * factor) * Math.round(b2 * factor) / (factor * factor);
7039
+ var factor = Math.max(getFactor(a2), getFactor(b));
7040
+ return Math.round(a2 * factor) * Math.round(b * factor) / (factor * factor);
7215
7041
  };
7216
7042
  var roundingModes = {
7217
7043
  HALF_ODD: function HALF_ODD(number) {
@@ -7239,20 +7065,20 @@ function Calculator() {
7239
7065
  }
7240
7066
  };
7241
7067
  return {
7242
- add: function add(a2, b2) {
7243
- return a2 + b2;
7068
+ add: function add(a2, b) {
7069
+ return a2 + b;
7244
7070
  },
7245
- subtract: function subtract(a2, b2) {
7246
- return a2 - b2;
7071
+ subtract: function subtract(a2, b) {
7072
+ return a2 - b;
7247
7073
  },
7248
- multiply: function multiply(a2, b2) {
7249
- return isFloat(a2) || isFloat(b2) ? floatMultiply(a2, b2) : a2 * b2;
7074
+ multiply: function multiply(a2, b) {
7075
+ return isFloat(a2) || isFloat(b) ? floatMultiply(a2, b) : a2 * b;
7250
7076
  },
7251
- divide: function divide(a2, b2) {
7252
- return a2 / b2;
7077
+ divide: function divide(a2, b) {
7078
+ return a2 / b;
7253
7079
  },
7254
- modulo: function modulo(a2, b2) {
7255
- return a2 % b2;
7080
+ modulo: function modulo(a2, b) {
7081
+ return a2 % b;
7256
7082
  },
7257
7083
  round: function round(number) {
7258
7084
  var roundingMode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "HALF_EVEN";
@@ -7434,8 +7260,8 @@ var Dinero = function Dinero2(options) {
7434
7260
  allocate: function allocate(ratios) {
7435
7261
  var _this = this;
7436
7262
  assertValidRatios(ratios);
7437
- var total = ratios.reduce(function(a2, b2) {
7438
- return calculator$1.add(a2, b2);
7263
+ var total = ratios.reduce(function(a2, b) {
7264
+ return calculator$1.add(a2, b);
7439
7265
  });
7440
7266
  var remainder = this.getAmount();
7441
7267
  var shares = ratios.map(function(ratio) {
@@ -7809,34 +7635,34 @@ function hasLoadedNamespace(ns, i18n) {
7809
7635
  }
7810
7636
  });
7811
7637
  }
7812
- function _iterableToArrayLimit(r2, l2) {
7813
- var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"];
7814
- if (null != t2) {
7815
- var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false;
7638
+ function _iterableToArrayLimit(arr2, i2) {
7639
+ var _i = null == arr2 ? null : "undefined" != typeof Symbol && arr2[Symbol.iterator] || arr2["@@iterator"];
7640
+ if (null != _i) {
7641
+ var _s, _e2, _x, _r, _arr = [], _n = true, _d = false;
7816
7642
  try {
7817
- if (i2 = (t2 = t2.call(r2)).next, 0 === l2) {
7818
- if (Object(t2) !== t2)
7643
+ if (_x = (_i = _i.call(arr2)).next, 0 === i2) {
7644
+ if (Object(_i) !== _i)
7819
7645
  return;
7820
- f2 = false;
7646
+ _n = false;
7821
7647
  } else
7822
- for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true)
7648
+ for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true)
7823
7649
  ;
7824
- } catch (r3) {
7825
- o2 = true, n2 = r3;
7650
+ } catch (err) {
7651
+ _d = true, _e2 = err;
7826
7652
  } finally {
7827
7653
  try {
7828
- if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2))
7654
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r))
7829
7655
  return;
7830
7656
  } finally {
7831
- if (o2)
7832
- throw n2;
7657
+ if (_d)
7658
+ throw _e2;
7833
7659
  }
7834
7660
  }
7835
- return a2;
7661
+ return _arr;
7836
7662
  }
7837
7663
  }
7838
- function _slicedToArray(r2, e2) {
7839
- return _arrayWithHoles$1(r2) || _iterableToArrayLimit(r2, e2) || _unsupportedIterableToArray$1(r2, e2) || _nonIterableRest$1();
7664
+ function _slicedToArray(arr2, i2) {
7665
+ return _arrayWithHoles$1(arr2) || _iterableToArrayLimit(arr2, i2) || _unsupportedIterableToArray$1(arr2, i2) || _nonIterableRest$1();
7840
7666
  }
7841
7667
  function ownKeys(object, enumerableOnly) {
7842
7668
  var keys2 = Object.keys(object);
@@ -8051,12 +7877,12 @@ var cookie = {
8051
7877
  var nameEQ = "".concat(name, "=");
8052
7878
  var ca = document.cookie.split(";");
8053
7879
  for (var i2 = 0; i2 < ca.length; i2++) {
8054
- var c2 = ca[i2];
8055
- while (c2.charAt(0) === " ") {
8056
- c2 = c2.substring(1, c2.length);
7880
+ var c = ca[i2];
7881
+ while (c.charAt(0) === " ") {
7882
+ c = c.substring(1, c.length);
8057
7883
  }
8058
- if (c2.indexOf(nameEQ) === 0)
8059
- return c2.substring(nameEQ.length, c2.length);
7884
+ if (c.indexOf(nameEQ) === 0)
7885
+ return c.substring(nameEQ.length, c.length);
8060
7886
  }
8061
7887
  return null;
8062
7888
  },
@@ -8069,9 +7895,9 @@ var cookie$1 = {
8069
7895
  lookup: function lookup(options) {
8070
7896
  var found;
8071
7897
  if (options.lookupCookie && typeof document !== "undefined") {
8072
- var c2 = cookie.read(options.lookupCookie);
8073
- if (c2)
8074
- found = c2;
7898
+ var c = cookie.read(options.lookupCookie);
7899
+ if (c)
7900
+ found = c;
8075
7901
  }
8076
7902
  return found;
8077
7903
  },
@@ -8562,7 +8388,7 @@ const MenuOptionsDefaultUI = (props) => {
8562
8388
  })]
8563
8389
  });
8564
8390
  };
8565
- const ComponentsContext = React__default.createContext(null);
8391
+ const ComponentsContext = React.createContext(null);
8566
8392
  function useComponents() {
8567
8393
  const context = useContext(ComponentsContext);
8568
8394
  if (!context) {
@@ -8595,7 +8421,8 @@ const MenuOptions = (props) => {
8595
8421
  const MenuItemsDispatcherWrapper = /* @__PURE__ */ jsx(MenuItemsDispatcher, {
8596
8422
  productItems: optionsItem.items,
8597
8423
  parentProduct: optionsItem,
8598
- rootProduct
8424
+ rootProduct,
8425
+ nestedLvl: nestedLvl + 1
8599
8426
  });
8600
8427
  const menuOptionsProps = {
8601
8428
  optionsItem,
@@ -8604,8 +8431,10 @@ const MenuOptions = (props) => {
8604
8431
  isOnSubmitted,
8605
8432
  actualQtyCnt: qtyCnt,
8606
8433
  actualSelCnt: selCnt,
8607
- currency
8434
+ currency,
8435
+ nestedLvl
8608
8436
  };
8437
+ console.log("prod conf nestedLvl new", nestedLvl);
8609
8438
  if (MenuOptionsUI) {
8610
8439
  return /* @__PURE__ */ jsx(MenuOptionsUI, {
8611
8440
  ...menuOptionsProps,
@@ -9438,7 +9267,7 @@ const DisplayState = () => {
9438
9267
  children: [/* @__PURE__ */ jsxs("p", {
9439
9268
  className: "text-lg font-semibold",
9440
9269
  children: [selCtx, ":"]
9441
- }), Object.keys(selected[selCtx]).map((id) => /* @__PURE__ */ jsx(React__default.Fragment, {
9270
+ }), Object.keys(selected[selCtx]).map((id) => /* @__PURE__ */ jsx(React.Fragment, {
9442
9271
  children: selected[selCtx][id] && /* @__PURE__ */ jsxs("p", {
9443
9272
  children: [id, ":", selected[selCtx][id].toString()]
9444
9273
  })
@@ -9594,62 +9423,24 @@ function clsx() {
9594
9423
  (e2 = arguments[f2++]) && (t2 = r$4(e2)) && (n2 && (n2 += " "), n2 += t2);
9595
9424
  return n2;
9596
9425
  }
9597
- var i$3 = Object.defineProperty;
9598
- var d$5 = (t2, e2, n2) => e2 in t2 ? i$3(t2, e2, { enumerable: true, configurable: true, writable: true, value: n2 }) : t2[e2] = n2;
9599
- var r$3 = (t2, e2, n2) => (d$5(t2, typeof e2 != "symbol" ? e2 + "" : e2, n2), n2);
9600
- class o$5 {
9601
- constructor() {
9602
- r$3(this, "current", this.detect());
9603
- r$3(this, "handoffState", "pending");
9604
- r$3(this, "currentId", 0);
9605
- }
9606
- set(e2) {
9607
- this.current !== e2 && (this.handoffState = "pending", this.currentId = 0, this.current = e2);
9608
- }
9609
- reset() {
9610
- this.set(this.detect());
9611
- }
9612
- nextId() {
9613
- return ++this.currentId;
9614
- }
9615
- get isServer() {
9616
- return this.current === "server";
9617
- }
9618
- get isClient() {
9619
- return this.current === "client";
9620
- }
9621
- detect() {
9622
- return typeof window == "undefined" || typeof document == "undefined" ? "server" : "client";
9623
- }
9624
- handoff() {
9625
- this.handoffState === "pending" && (this.handoffState = "complete");
9626
- }
9627
- get isHandoffComplete() {
9628
- return this.handoffState === "complete";
9629
- }
9630
- }
9631
- let s$8 = new o$5();
9632
- let l$5 = (e2, f2) => {
9633
- s$8.isServer ? useEffect(e2, f2) : useLayoutEffect(e2, f2);
9634
- };
9635
- function s$7(e2) {
9426
+ const e$3 = typeof window == "undefined" || typeof document == "undefined";
9427
+ let s$6 = e$3 ? useEffect : useLayoutEffect;
9428
+ function s$5(e2) {
9636
9429
  let r2 = useRef(e2);
9637
- return l$5(() => {
9430
+ return s$6(() => {
9638
9431
  r2.current = e2;
9639
9432
  }, [e2]), r2;
9640
9433
  }
9641
- let o$4 = function(t2) {
9642
- let e2 = s$7(t2);
9643
- return React__default.useCallback((...r2) => e2.current(...r2), [e2]);
9644
- };
9645
- function t$6(e2) {
9434
+ function t(e2) {
9646
9435
  typeof queueMicrotask == "function" ? queueMicrotask(e2) : Promise.resolve().then(e2).catch((o2) => setTimeout(() => {
9647
9436
  throw o2;
9648
9437
  }));
9649
9438
  }
9650
- function o$3() {
9651
- let n2 = [], r2 = { addEventListener(e2, t2, s2, a2) {
9652
- return e2.addEventListener(t2, s2, a2), r2.add(() => e2.removeEventListener(t2, s2, a2));
9439
+ function m$2() {
9440
+ let n2 = [], i2 = [], r2 = { enqueue(e2) {
9441
+ i2.push(e2);
9442
+ }, addEventListener(e2, t2, a2, o2) {
9443
+ return e2.addEventListener(t2, a2, o2), r2.add(() => e2.removeEventListener(t2, a2, o2));
9653
9444
  }, requestAnimationFrame(...e2) {
9654
9445
  let t2 = requestAnimationFrame(...e2);
9655
9446
  return r2.add(() => cancelAnimationFrame(t2));
@@ -9659,134 +9450,130 @@ function o$3() {
9659
9450
  let t2 = setTimeout(...e2);
9660
9451
  return r2.add(() => clearTimeout(t2));
9661
9452
  }, microTask(...e2) {
9662
- let t2 = { current: true };
9663
- return t$6(() => {
9664
- t2.current && e2[0]();
9453
+ let t$1 = { current: true };
9454
+ return t(() => {
9455
+ t$1.current && e2[0]();
9665
9456
  }), r2.add(() => {
9666
- t2.current = false;
9457
+ t$1.current = false;
9667
9458
  });
9668
- }, style(e2, t2, s2) {
9669
- let a2 = e2.style.getPropertyValue(t2);
9670
- return Object.assign(e2.style, { [t2]: s2 }), this.add(() => {
9671
- Object.assign(e2.style, { [t2]: a2 });
9672
- });
9673
- }, group(e2) {
9674
- let t2 = o$3();
9675
- return e2(t2), this.add(() => t2.dispose());
9676
9459
  }, add(e2) {
9677
9460
  return n2.push(e2), () => {
9678
9461
  let t2 = n2.indexOf(e2);
9679
- if (t2 >= 0)
9680
- for (let s2 of n2.splice(t2, 1))
9681
- s2();
9462
+ if (t2 >= 0) {
9463
+ let [a2] = n2.splice(t2, 1);
9464
+ a2();
9465
+ }
9682
9466
  };
9683
9467
  }, dispose() {
9684
9468
  for (let e2 of n2.splice(0))
9685
9469
  e2();
9470
+ }, async workQueue() {
9471
+ for (let e2 of i2.splice(0))
9472
+ await e2();
9686
9473
  } };
9687
9474
  return r2;
9688
9475
  }
9689
- function p$3() {
9690
- let [e2] = useState(o$3);
9476
+ function p$2() {
9477
+ let [e2] = useState(m$2);
9691
9478
  return useEffect(() => () => e2.dispose(), [e2]), e2;
9692
9479
  }
9693
- function s$6() {
9694
- let r2 = typeof document == "undefined";
9695
- return "useSyncExternalStore" in React ? ((o2) => o2.useSyncExternalStore)(React)(() => () => {
9696
- }, () => false, () => !r2) : false;
9697
- }
9698
- function l$4() {
9699
- let r2 = s$6(), [e2, n2] = React.useState(s$8.isHandoffComplete);
9700
- return e2 && s$8.isHandoffComplete === false && n2(false), React.useEffect(() => {
9701
- e2 !== true && n2(true);
9702
- }, [e2]), React.useEffect(() => s$8.handoff(), []), r2 ? false : e2;
9703
- }
9704
- var o$2;
9705
- let I$5 = (o$2 = React__default.useId) != null ? o$2 : function() {
9706
- let n2 = l$4(), [e2, u2] = React__default.useState(n2 ? () => s$8.nextId() : null);
9707
- return l$5(() => {
9708
- e2 === null && u2(s$8.nextId());
9480
+ let o$3 = function(t2) {
9481
+ let e2 = s$5(t2);
9482
+ return React.useCallback((...r2) => e2.current(...r2), [e2]);
9483
+ };
9484
+ let r$3 = { serverHandoffComplete: false };
9485
+ function a$2() {
9486
+ let [e2, f2] = useState(r$3.serverHandoffComplete);
9487
+ return useEffect(() => {
9488
+ e2 !== true && f2(true);
9489
+ }, [e2]), useEffect(() => {
9490
+ r$3.serverHandoffComplete === false && (r$3.serverHandoffComplete = true);
9491
+ }, []), e2;
9492
+ }
9493
+ var u$4;
9494
+ let l$3 = 0;
9495
+ function r$2() {
9496
+ return ++l$3;
9497
+ }
9498
+ let I$2 = (u$4 = React.useId) != null ? u$4 : function() {
9499
+ let n2 = a$2(), [e2, o2] = React.useState(n2 ? r$2 : null);
9500
+ return s$6(() => {
9501
+ e2 === null && o2(r$2());
9709
9502
  }, [e2]), e2 != null ? "" + e2 : void 0;
9710
9503
  };
9711
- function u$5(r2, n2, ...a2) {
9504
+ function u$3(r2, n2, ...a2) {
9712
9505
  if (r2 in n2) {
9713
9506
  let e2 = n2[r2];
9714
9507
  return typeof e2 == "function" ? e2(...a2) : e2;
9715
9508
  }
9716
9509
  let t2 = new Error(`Tried to handle "${r2}" but there is no handler defined. Only defined handlers are: ${Object.keys(n2).map((e2) => `"${e2}"`).join(", ")}.`);
9717
- throw Error.captureStackTrace && Error.captureStackTrace(t2, u$5), t2;
9510
+ throw Error.captureStackTrace && Error.captureStackTrace(t2, u$3), t2;
9718
9511
  }
9719
- function o$1(r2) {
9720
- return s$8.isServer ? null : r2 instanceof Node ? r2.ownerDocument : r2 != null && r2.hasOwnProperty("current") && r2.current instanceof Node ? r2.current.ownerDocument : document;
9512
+ function e$2(r2) {
9513
+ return e$3 ? null : r2 instanceof Node ? r2.ownerDocument : r2 != null && r2.hasOwnProperty("current") && r2.current instanceof Node ? r2.current.ownerDocument : document;
9721
9514
  }
9722
- let c$4 = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e2) => `${e2}:not([tabindex='-1'])`).join(",");
9723
- var M$2 = ((n2) => (n2[n2.First = 1] = "First", n2[n2.Previous = 2] = "Previous", n2[n2.Next = 4] = "Next", n2[n2.Last = 8] = "Last", n2[n2.WrapAround = 16] = "WrapAround", n2[n2.NoScroll = 32] = "NoScroll", n2))(M$2 || {}), N$2 = ((o2) => (o2[o2.Error = 0] = "Error", o2[o2.Overflow = 1] = "Overflow", o2[o2.Success = 2] = "Success", o2[o2.Underflow = 3] = "Underflow", o2))(N$2 || {}), F$2 = ((t2) => (t2[t2.Previous = -1] = "Previous", t2[t2.Next = 1] = "Next", t2))(F$2 || {});
9724
- function f$4(e2 = document.body) {
9725
- return e2 == null ? [] : Array.from(e2.querySelectorAll(c$4)).sort((r2, t2) => Math.sign((r2.tabIndex || Number.MAX_SAFE_INTEGER) - (t2.tabIndex || Number.MAX_SAFE_INTEGER)));
9515
+ let f$2 = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e2) => `${e2}:not([tabindex='-1'])`).join(",");
9516
+ var L$1 = ((n2) => (n2[n2.First = 1] = "First", n2[n2.Previous = 2] = "Previous", n2[n2.Next = 4] = "Next", n2[n2.Last = 8] = "Last", n2[n2.WrapAround = 16] = "WrapAround", n2[n2.NoScroll = 32] = "NoScroll", n2))(L$1 || {}), N = ((o2) => (o2[o2.Error = 0] = "Error", o2[o2.Overflow = 1] = "Overflow", o2[o2.Success = 2] = "Success", o2[o2.Underflow = 3] = "Underflow", o2))(N || {}), T$2 = ((r2) => (r2[r2.Previous = -1] = "Previous", r2[r2.Next = 1] = "Next", r2))(T$2 || {});
9517
+ function E$1(e2 = document.body) {
9518
+ return e2 == null ? [] : Array.from(e2.querySelectorAll(f$2)).sort((t2, r2) => Math.sign((t2.tabIndex || Number.MAX_SAFE_INTEGER) - (r2.tabIndex || Number.MAX_SAFE_INTEGER)));
9726
9519
  }
9727
- var T$1 = ((t2) => (t2[t2.Strict = 0] = "Strict", t2[t2.Loose = 1] = "Loose", t2))(T$1 || {});
9728
- function h$2(e2, r2 = 0) {
9729
- var t2;
9730
- return e2 === ((t2 = o$1(e2)) == null ? void 0 : t2.body) ? false : u$5(r2, { [0]() {
9731
- return e2.matches(c$4);
9520
+ var F$4 = ((r2) => (r2[r2.Strict = 0] = "Strict", r2[r2.Loose = 1] = "Loose", r2))(F$4 || {});
9521
+ function h$2(e2, t2 = 0) {
9522
+ var r2;
9523
+ return e2 === ((r2 = e$2(e2)) == null ? void 0 : r2.body) ? false : u$3(t2, { [0]() {
9524
+ return e2.matches(f$2);
9732
9525
  }, [1]() {
9733
9526
  let l2 = e2;
9734
9527
  for (; l2 !== null; ) {
9735
- if (l2.matches(c$4))
9528
+ if (l2.matches(f$2))
9736
9529
  return true;
9737
9530
  l2 = l2.parentElement;
9738
9531
  }
9739
9532
  return false;
9740
9533
  } });
9741
9534
  }
9742
- var w$1 = ((t2) => (t2[t2.Keyboard = 0] = "Keyboard", t2[t2.Mouse = 1] = "Mouse", t2))(w$1 || {});
9743
- typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("keydown", (e2) => {
9744
- e2.metaKey || e2.altKey || e2.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
9745
- }, true), document.addEventListener("click", (e2) => {
9746
- e2.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e2.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
9747
- }, true));
9748
- function y$3(e2) {
9535
+ function S$2(e2) {
9749
9536
  e2 == null || e2.focus({ preventScroll: true });
9750
9537
  }
9751
- let S$5 = ["textarea", "input"].join(",");
9752
- function H(e2) {
9753
- var r2, t2;
9754
- return (t2 = (r2 = e2 == null ? void 0 : e2.matches) == null ? void 0 : r2.call(e2, S$5)) != null ? t2 : false;
9538
+ let H$1 = ["textarea", "input"].join(",");
9539
+ function w$1(e2) {
9540
+ var t2, r2;
9541
+ return (r2 = (t2 = e2 == null ? void 0 : e2.matches) == null ? void 0 : t2.call(e2, H$1)) != null ? r2 : false;
9755
9542
  }
9756
- function I$4(e2, r2 = (t2) => t2) {
9757
- return e2.slice().sort((t2, l2) => {
9758
- let o2 = r2(t2), i2 = r2(l2);
9543
+ function A$3(e2, t2 = (r2) => r2) {
9544
+ return e2.slice().sort((r2, l2) => {
9545
+ let o2 = t2(r2), i2 = t2(l2);
9759
9546
  if (o2 === null || i2 === null)
9760
9547
  return 0;
9761
9548
  let n2 = o2.compareDocumentPosition(i2);
9762
9549
  return n2 & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n2 & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
9763
9550
  });
9764
9551
  }
9765
- function O$1(e2, r2, { sorted: t2 = true, relativeTo: l2 = null, skipElements: o2 = [] } = {}) {
9766
- let i2 = Array.isArray(e2) ? e2.length > 0 ? e2[0].ownerDocument : document : e2.ownerDocument, n2 = Array.isArray(e2) ? t2 ? I$4(e2) : e2 : f$4(e2);
9767
- o2.length > 0 && n2.length > 1 && (n2 = n2.filter((s2) => !o2.includes(s2))), l2 = l2 != null ? l2 : i2.activeElement;
9768
- let E2 = (() => {
9769
- if (r2 & 5)
9552
+ function I$1(e2, t2, { sorted: r2 = true, relativeTo: l2 = null, skipElements: o2 = [] } = {}) {
9553
+ let i2 = Array.isArray(e2) ? e2.length > 0 ? e2[0].ownerDocument : document : e2.ownerDocument, n2 = Array.isArray(e2) ? r2 ? A$3(e2) : e2 : E$1(e2);
9554
+ o2.length > 0 && (n2 = n2.filter((s2) => !o2.includes(s2))), l2 = l2 != null ? l2 : i2.activeElement;
9555
+ let d2 = (() => {
9556
+ if (t2 & 5)
9770
9557
  return 1;
9771
- if (r2 & 10)
9558
+ if (t2 & 10)
9772
9559
  return -1;
9773
9560
  throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
9774
9561
  })(), x2 = (() => {
9775
- if (r2 & 1)
9562
+ if (t2 & 1)
9776
9563
  return 0;
9777
- if (r2 & 2)
9564
+ if (t2 & 2)
9778
9565
  return Math.max(0, n2.indexOf(l2)) - 1;
9779
- if (r2 & 4)
9566
+ if (t2 & 4)
9780
9567
  return Math.max(0, n2.indexOf(l2)) + 1;
9781
- if (r2 & 8)
9568
+ if (t2 & 8)
9782
9569
  return n2.length - 1;
9783
9570
  throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
9784
- })(), p2 = r2 & 32 ? { preventScroll: true } : {}, d2 = 0, a2 = n2.length, u2;
9571
+ })(), p2 = t2 & 32 ? { preventScroll: true } : {}, c = 0, a2 = n2.length, u2;
9785
9572
  do {
9786
- if (d2 >= a2 || d2 + a2 <= 0)
9573
+ if (c >= a2 || c + a2 <= 0)
9787
9574
  return 0;
9788
- let s2 = x2 + d2;
9789
- if (r2 & 16)
9575
+ let s2 = x2 + c;
9576
+ if (t2 & 16)
9790
9577
  s2 = (s2 + a2) % a2;
9791
9578
  else {
9792
9579
  if (s2 < 0)
@@ -9794,21 +9581,12 @@ function O$1(e2, r2, { sorted: t2 = true, relativeTo: l2 = null, skipElements: o
9794
9581
  if (s2 >= a2)
9795
9582
  return 1;
9796
9583
  }
9797
- u2 = n2[s2], u2 == null || u2.focus(p2), d2 += E2;
9584
+ u2 = n2[s2], u2 == null || u2.focus(p2), c += d2;
9798
9585
  } while (u2 !== i2.activeElement);
9799
- return r2 & 6 && H(u2) && u2.select(), 2;
9586
+ return t2 & 6 && w$1(u2) && u2.select(), u2.hasAttribute("tabindex") || u2.setAttribute("tabindex", "0"), 2;
9800
9587
  }
9801
- function t$5() {
9802
- return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
9803
- }
9804
- function i$2() {
9805
- return /Android/gi.test(window.navigator.userAgent);
9806
- }
9807
- function n$3() {
9808
- return t$5() || i$2();
9809
- }
9810
- function d$4(e2, r2, n2) {
9811
- let o2 = s$7(r2);
9588
+ function d$1(e2, r2, n2) {
9589
+ let o2 = s$5(r2);
9812
9590
  useEffect(() => {
9813
9591
  function t2(u2) {
9814
9592
  o2.current(u2);
@@ -9816,201 +9594,139 @@ function d$4(e2, r2, n2) {
9816
9594
  return document.addEventListener(e2, t2, n2), () => document.removeEventListener(e2, t2, n2);
9817
9595
  }, [e2, n2]);
9818
9596
  }
9819
- function s$5(e2, r2, n2) {
9820
- let o2 = s$7(r2);
9821
- useEffect(() => {
9822
- function t2(i2) {
9823
- o2.current(i2);
9824
- }
9825
- return window.addEventListener(e2, t2, n2), () => window.removeEventListener(e2, t2, n2);
9826
- }, [e2, n2]);
9827
- }
9828
- function y$2(s2, m2, a2 = true) {
9597
+ function L(m2, E2, c = true) {
9829
9598
  let i2 = useRef(false);
9830
9599
  useEffect(() => {
9831
9600
  requestAnimationFrame(() => {
9832
- i2.current = a2;
9601
+ i2.current = c;
9833
9602
  });
9834
- }, [a2]);
9835
- function c2(e2, r2) {
9603
+ }, [c]);
9604
+ function f2(e2, o2) {
9836
9605
  if (!i2.current || e2.defaultPrevented)
9837
9606
  return;
9838
- let t2 = r2(e2);
9839
- if (t2 === null || !t2.getRootNode().contains(t2) || !t2.isConnected)
9840
- return;
9841
- let E2 = function u2(n2) {
9842
- return typeof n2 == "function" ? u2(n2()) : Array.isArray(n2) || n2 instanceof Set ? n2 : [n2];
9843
- }(s2);
9844
- for (let u2 of E2) {
9845
- if (u2 === null)
9846
- continue;
9847
- let n2 = u2 instanceof HTMLElement ? u2 : u2.current;
9848
- if (n2 != null && n2.contains(t2) || e2.composed && e2.composedPath().includes(n2))
9849
- return;
9607
+ let l2 = function r2(t2) {
9608
+ return typeof t2 == "function" ? r2(t2()) : Array.isArray(t2) || t2 instanceof Set ? t2 : [t2];
9609
+ }(m2), n2 = o2(e2);
9610
+ if (n2 !== null && !!n2.getRootNode().contains(n2)) {
9611
+ for (let r2 of l2) {
9612
+ if (r2 === null)
9613
+ continue;
9614
+ let t2 = r2 instanceof HTMLElement ? r2 : r2.current;
9615
+ if (t2 != null && t2.contains(n2) || e2.composed && e2.composedPath().includes(t2))
9616
+ return;
9617
+ }
9618
+ return !h$2(n2, F$4.Loose) && n2.tabIndex !== -1 && e2.preventDefault(), E2(e2, n2);
9850
9619
  }
9851
- return !h$2(t2, T$1.Loose) && t2.tabIndex !== -1 && e2.preventDefault(), m2(e2, t2);
9852
9620
  }
9853
- let o2 = useRef(null);
9854
- d$4("pointerdown", (e2) => {
9855
- var r2, t2;
9856
- i2.current && (o2.current = ((t2 = (r2 = e2.composedPath) == null ? void 0 : r2.call(e2)) == null ? void 0 : t2[0]) || e2.target);
9857
- }, true), d$4("mousedown", (e2) => {
9858
- var r2, t2;
9859
- i2.current && (o2.current = ((t2 = (r2 = e2.composedPath) == null ? void 0 : r2.call(e2)) == null ? void 0 : t2[0]) || e2.target);
9860
- }, true), d$4("click", (e2) => {
9861
- n$3() || o2.current && (c2(e2, () => o2.current), o2.current = null);
9862
- }, true), d$4("touchend", (e2) => c2(e2, () => e2.target instanceof HTMLElement ? e2.target : null), true), s$5("blur", (e2) => c2(e2, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), true);
9621
+ let u2 = useRef(null);
9622
+ d$1("mousedown", (e2) => {
9623
+ var o2, l2;
9624
+ i2.current && (u2.current = ((l2 = (o2 = e2.composedPath) == null ? void 0 : o2.call(e2)) == null ? void 0 : l2[0]) || e2.target);
9625
+ }, true), d$1("click", (e2) => {
9626
+ !u2.current || (f2(e2, () => u2.current), u2.current = null);
9627
+ }, true), d$1("blur", (e2) => f2(e2, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), true);
9863
9628
  }
9864
- function n$2(...e2) {
9865
- return useMemo(() => o$1(...e2), [...e2]);
9629
+ let u$2 = Symbol();
9630
+ function T$1(t2, n2 = true) {
9631
+ return Object.assign(t2, { [u$2]: n2 });
9866
9632
  }
9867
- let u$4 = Symbol();
9868
- function T(t2, n2 = true) {
9869
- return Object.assign(t2, { [u$4]: n2 });
9870
- }
9871
- function y$1(...t2) {
9633
+ function y(...t2) {
9872
9634
  let n2 = useRef(t2);
9873
9635
  useEffect(() => {
9874
9636
  n2.current = t2;
9875
9637
  }, [t2]);
9876
- let c2 = o$4((e2) => {
9638
+ let c = o$3((e2) => {
9877
9639
  for (let o2 of n2.current)
9878
9640
  o2 != null && (typeof o2 == "function" ? o2(e2) : o2.current = e2);
9879
9641
  });
9880
- return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$4])) ? void 0 : c2;
9881
- }
9882
- function m$2(u2, t2) {
9883
- let e2 = useRef([]), r2 = o$4(u2);
9884
- useEffect(() => {
9885
- let o2 = [...e2.current];
9886
- for (let [n2, a2] of t2.entries())
9887
- if (e2.current[n2] !== a2) {
9888
- let l2 = r2(t2, o2);
9889
- return e2.current = t2, l2;
9890
- }
9891
- }, [r2, ...t2]);
9892
- }
9893
- function t$4(...r2) {
9894
- return Array.from(new Set(r2.flatMap((n2) => typeof n2 == "string" ? n2.split(" ") : []))).filter(Boolean).join(" ");
9895
- }
9896
- var O = ((n2) => (n2[n2.None = 0] = "None", n2[n2.RenderStrategy = 1] = "RenderStrategy", n2[n2.Static = 2] = "Static", n2))(O || {}), v$1 = ((e2) => (e2[e2.Unmount = 0] = "Unmount", e2[e2.Hidden = 1] = "Hidden", e2))(v$1 || {});
9897
- function C({ ourProps: r2, theirProps: t2, slot: e2, defaultTag: n2, features: o2, visible: a2 = true, name: f2, mergeRefs: l2 }) {
9898
- l2 = l2 != null ? l2 : k;
9899
- let s2 = R(t2, r2);
9900
- if (a2)
9901
- return m$1(s2, e2, n2, f2, l2);
9902
- let y2 = o2 != null ? o2 : 0;
9903
- if (y2 & 2) {
9904
- let { static: u2 = false, ...d2 } = s2;
9905
- if (u2)
9906
- return m$1(d2, e2, n2, f2, l2);
9907
- }
9908
- if (y2 & 1) {
9909
- let { unmount: u2 = true, ...d2 } = s2;
9910
- return u$5(u2 ? 0 : 1, { [0]() {
9642
+ return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$2])) ? void 0 : c;
9643
+ }
9644
+ var S$1 = ((a2) => (a2[a2.None = 0] = "None", a2[a2.RenderStrategy = 1] = "RenderStrategy", a2[a2.Static = 2] = "Static", a2))(S$1 || {}), j$1 = ((e2) => (e2[e2.Unmount = 0] = "Unmount", e2[e2.Hidden = 1] = "Hidden", e2))(j$1 || {});
9645
+ function $$1({ ourProps: r2, theirProps: t2, slot: e2, defaultTag: a2, features: o2, visible: n2 = true, name: l2 }) {
9646
+ let s2 = T(t2, r2);
9647
+ if (n2)
9648
+ return p$1(s2, e2, a2, l2);
9649
+ let u2 = o2 != null ? o2 : 0;
9650
+ if (u2 & 2) {
9651
+ let { static: i2 = false, ...d2 } = s2;
9652
+ if (i2)
9653
+ return p$1(d2, e2, a2, l2);
9654
+ }
9655
+ if (u2 & 1) {
9656
+ let { unmount: i2 = true, ...d2 } = s2;
9657
+ return u$3(i2 ? 0 : 1, { [0]() {
9911
9658
  return null;
9912
9659
  }, [1]() {
9913
- return m$1({ ...d2, hidden: true, style: { display: "none" } }, e2, n2, f2, l2);
9660
+ return p$1({ ...d2, hidden: true, style: { display: "none" } }, e2, a2, l2);
9914
9661
  } });
9915
9662
  }
9916
- return m$1(s2, e2, n2, f2, l2);
9663
+ return p$1(s2, e2, a2, l2);
9917
9664
  }
9918
- function m$1(r2, t2 = {}, e2, n2, o2) {
9919
- let { as: a2 = e2, children: f2, refName: l2 = "ref", ...s2 } = F$1(r2, ["unmount", "static"]), y2 = r2.ref !== void 0 ? { [l2]: r2.ref } : {}, u2 = typeof f2 == "function" ? f2(t2) : f2;
9920
- "className" in s2 && s2.className && typeof s2.className == "function" && (s2.className = s2.className(t2));
9665
+ function p$1(r2, t2 = {}, e2, a2) {
9666
+ let { as: o2 = e2, children: n2, refName: l2 = "ref", ...s2 } = m$1(r2, ["unmount", "static"]), u2 = r2.ref !== void 0 ? { [l2]: r2.ref } : {}, i2 = typeof n2 == "function" ? n2(t2) : n2;
9667
+ s2.className && typeof s2.className == "function" && (s2.className = s2.className(t2));
9921
9668
  let d2 = {};
9922
9669
  if (t2) {
9923
- let i2 = false, c2 = [];
9924
- for (let [T2, p2] of Object.entries(t2))
9925
- typeof p2 == "boolean" && (i2 = true), p2 === true && c2.push(T2);
9926
- i2 && (d2["data-headlessui-state"] = c2.join(" "));
9927
- }
9928
- if (a2 === Fragment$1 && Object.keys(x$1(s2)).length > 0) {
9929
- if (!isValidElement(u2) || Array.isArray(u2) && u2.length > 1)
9930
- throw new Error(['Passing props on "Fragment"!', "", `The current component <${n2} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(s2).map((p2) => ` - ${p2}`).join(`
9931
- `), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((p2) => ` - ${p2}`).join(`
9670
+ let f2 = false, y2 = [];
9671
+ for (let [h2, g] of Object.entries(t2))
9672
+ typeof g == "boolean" && (f2 = true), g === true && y2.push(h2);
9673
+ f2 && (d2["data-headlessui-state"] = y2.join(" "));
9674
+ }
9675
+ if (o2 === Fragment$1 && Object.keys(F$3(s2)).length > 0) {
9676
+ if (!isValidElement(i2) || Array.isArray(i2) && i2.length > 1)
9677
+ throw new Error(['Passing props on "Fragment"!', "", `The current component <${a2} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(s2).map((f2) => ` - ${f2}`).join(`
9678
+ `), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((f2) => ` - ${f2}`).join(`
9932
9679
  `)].join(`
9933
9680
  `));
9934
- let i2 = u2.props, c2 = typeof (i2 == null ? void 0 : i2.className) == "function" ? (...p2) => t$4(i2 == null ? void 0 : i2.className(...p2), s2.className) : t$4(i2 == null ? void 0 : i2.className, s2.className), T2 = c2 ? { className: c2 } : {};
9935
- return cloneElement(u2, Object.assign({}, R(u2.props, x$1(F$1(s2, ["ref"]))), d2, y2, { ref: o2(u2.ref, y2.ref) }, T2));
9681
+ return cloneElement(i2, Object.assign({}, T(i2.props, F$3(m$1(s2, ["ref"]))), d2, u2, w(i2.ref, u2.ref)));
9936
9682
  }
9937
- return createElement(a2, Object.assign({}, F$1(s2, ["ref"]), a2 !== Fragment$1 && y2, a2 !== Fragment$1 && d2), u2);
9683
+ return createElement(o2, Object.assign({}, m$1(s2, ["ref"]), o2 !== Fragment$1 && u2, o2 !== Fragment$1 && d2), i2);
9938
9684
  }
9939
- function k(...r2) {
9940
- return r2.every((t2) => t2 == null) ? void 0 : (t2) => {
9685
+ function w(...r2) {
9686
+ return { ref: r2.every((t2) => t2 == null) ? void 0 : (t2) => {
9941
9687
  for (let e2 of r2)
9942
9688
  e2 != null && (typeof e2 == "function" ? e2(t2) : e2.current = t2);
9943
- };
9689
+ } };
9944
9690
  }
9945
- function R(...r2) {
9691
+ function T(...r2) {
9946
9692
  if (r2.length === 0)
9947
9693
  return {};
9948
9694
  if (r2.length === 1)
9949
9695
  return r2[0];
9950
9696
  let t2 = {}, e2 = {};
9951
9697
  for (let o2 of r2)
9952
- for (let a2 in o2)
9953
- a2.startsWith("on") && typeof o2[a2] == "function" ? (e2[a2] != null || (e2[a2] = []), e2[a2].push(o2[a2])) : t2[a2] = o2[a2];
9698
+ for (let n2 in o2)
9699
+ n2.startsWith("on") && typeof o2[n2] == "function" ? (e2[n2] != null || (e2[n2] = []), e2[n2].push(o2[n2])) : t2[n2] = o2[n2];
9954
9700
  if (t2.disabled || t2["aria-disabled"])
9955
9701
  return Object.assign(t2, Object.fromEntries(Object.keys(e2).map((o2) => [o2, void 0])));
9956
9702
  for (let o2 in e2)
9957
- Object.assign(t2, { [o2](a2, ...f2) {
9958
- let l2 = e2[o2];
9959
- for (let s2 of l2) {
9960
- if ((a2 instanceof Event || (a2 == null ? void 0 : a2.nativeEvent) instanceof Event) && a2.defaultPrevented)
9703
+ Object.assign(t2, { [o2](n2, ...l2) {
9704
+ let s2 = e2[o2];
9705
+ for (let u2 of s2) {
9706
+ if ((n2 instanceof Event || (n2 == null ? void 0 : n2.nativeEvent) instanceof Event) && n2.defaultPrevented)
9961
9707
  return;
9962
- s2(a2, ...f2);
9708
+ u2(n2, ...l2);
9963
9709
  }
9964
9710
  } });
9965
9711
  return t2;
9966
9712
  }
9967
- function U$2(r2) {
9713
+ function C$1(r2) {
9968
9714
  var t2;
9969
9715
  return Object.assign(forwardRef(r2), { displayName: (t2 = r2.displayName) != null ? t2 : r2.name });
9970
9716
  }
9971
- function x$1(r2) {
9717
+ function F$3(r2) {
9972
9718
  let t2 = Object.assign({}, r2);
9973
9719
  for (let e2 in t2)
9974
9720
  t2[e2] === void 0 && delete t2[e2];
9975
9721
  return t2;
9976
9722
  }
9977
- function F$1(r2, t2 = []) {
9723
+ function m$1(r2, t2 = []) {
9978
9724
  let e2 = Object.assign({}, r2);
9979
- for (let n2 of t2)
9980
- n2 in e2 && delete e2[n2];
9725
+ for (let a2 of t2)
9726
+ a2 in e2 && delete e2[a2];
9981
9727
  return e2;
9982
9728
  }
9983
- let p$2 = "div";
9984
- var s$4 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$4 || {});
9985
- function l$3(d2, o2) {
9986
- var n2;
9987
- let { features: t2 = 1, ...e2 } = d2, r2 = { ref: o2, "aria-hidden": (t2 & 2) === 2 ? true : (n2 = e2["aria-hidden"]) != null ? n2 : void 0, hidden: (t2 & 4) === 4 ? true : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(t2 & 4) === 4 && (t2 & 2) !== 2 && { display: "none" } } };
9988
- return C({ ourProps: r2, theirProps: e2, slot: {}, defaultTag: p$2, name: "Hidden" });
9989
- }
9990
- let u$3 = U$2(l$3);
9991
- let n$1 = createContext(null);
9992
- n$1.displayName = "OpenClosedContext";
9993
- var d$3 = ((e2) => (e2[e2.Open = 1] = "Open", e2[e2.Closed = 2] = "Closed", e2[e2.Closing = 4] = "Closing", e2[e2.Opening = 8] = "Opening", e2))(d$3 || {});
9994
- function u$2() {
9995
- return useContext(n$1);
9996
- }
9997
- function s$3({ value: o2, children: r2 }) {
9998
- return React__default.createElement(n$1.Provider, { value: o2 }, r2);
9999
- }
10000
- function t$3(n2) {
10001
- function e2() {
10002
- document.readyState !== "loading" && (n2(), document.removeEventListener("DOMContentLoaded", e2));
10003
- }
10004
- typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("DOMContentLoaded", e2), e2());
10005
- }
10006
- let t$2 = [];
10007
- t$3(() => {
10008
- function e2(n2) {
10009
- n2.target instanceof HTMLElement && n2.target !== document.body && t$2[0] !== n2.target && (t$2.unshift(n2.target), t$2 = t$2.filter((r2) => r2 != null && r2.isConnected), t$2.splice(10));
10010
- }
10011
- window.addEventListener("click", e2, { capture: true }), window.addEventListener("mousedown", e2, { capture: true }), window.addEventListener("focus", e2, { capture: true }), document.body.addEventListener("click", e2, { capture: true }), document.body.addEventListener("mousedown", e2, { capture: true }), document.body.addEventListener("focus", e2, { capture: true });
10012
- });
10013
- function r$2(n2) {
9729
+ function r$1(n2) {
10014
9730
  let e2 = n2.parentElement, l2 = null;
10015
9731
  for (; e2 && !(e2 instanceof HTMLFieldSetElement); )
10016
9732
  e2 instanceof HTMLLegendElement && (l2 = e2), e2 = e2.parentElement;
@@ -10028,383 +9744,265 @@ function i$1(n2) {
10028
9744
  }
10029
9745
  return true;
10030
9746
  }
10031
- var o = ((r2) => (r2.Space = " ", r2.Enter = "Enter", r2.Escape = "Escape", r2.Backspace = "Backspace", r2.Delete = "Delete", r2.ArrowLeft = "ArrowLeft", r2.ArrowUp = "ArrowUp", r2.ArrowRight = "ArrowRight", r2.ArrowDown = "ArrowDown", r2.Home = "Home", r2.End = "End", r2.PageUp = "PageUp", r2.PageDown = "PageDown", r2.Tab = "Tab", r2))(o || {});
10032
- function E(n2, e2, a2, t2) {
10033
- let i2 = s$7(a2);
9747
+ let a$1 = "div";
9748
+ var s$4 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$4 || {});
9749
+ let h$1 = C$1(function(t2, o2) {
9750
+ let { features: e2 = 1, ...r2 } = t2, d2 = { ref: o2, "aria-hidden": (e2 & 2) === 2 ? true : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(e2 & 4) === 4 && (e2 & 2) !== 2 && { display: "none" } } };
9751
+ return $$1({ ourProps: d2, theirProps: r2, slot: {}, defaultTag: a$1, name: "Hidden" });
9752
+ });
9753
+ let o$2 = createContext(null);
9754
+ o$2.displayName = "OpenClosedContext";
9755
+ var p = ((e2) => (e2[e2.Open = 0] = "Open", e2[e2.Closed = 1] = "Closed", e2))(p || {});
9756
+ function s$3() {
9757
+ return useContext(o$2);
9758
+ }
9759
+ function C({ value: t2, children: n2 }) {
9760
+ return React.createElement(o$2.Provider, { value: t2 }, n2);
9761
+ }
9762
+ var o$1 = ((r2) => (r2.Space = " ", r2.Enter = "Enter", r2.Escape = "Escape", r2.Backspace = "Backspace", r2.Delete = "Delete", r2.ArrowLeft = "ArrowLeft", r2.ArrowUp = "ArrowUp", r2.ArrowRight = "ArrowRight", r2.ArrowDown = "ArrowDown", r2.Home = "Home", r2.End = "End", r2.PageUp = "PageUp", r2.PageDown = "PageDown", r2.Tab = "Tab", r2))(o$1 || {});
9763
+ function m(u2, t2) {
9764
+ let e2 = useRef([]), r2 = o$3(u2);
10034
9765
  useEffect(() => {
10035
- n2 = n2 != null ? n2 : window;
10036
- function r2(o2) {
10037
- i2.current(o2);
9766
+ let o2 = [...e2.current];
9767
+ for (let [n2, a2] of t2.entries())
9768
+ if (e2.current[n2] !== a2) {
9769
+ let l2 = r2(t2, o2);
9770
+ return e2.current = t2, l2;
9771
+ }
9772
+ }, [r2, ...t2]);
9773
+ }
9774
+ function s$2(e2, r2, n2) {
9775
+ let o2 = s$5(r2);
9776
+ useEffect(() => {
9777
+ function t2(i2) {
9778
+ o2.current(i2);
10038
9779
  }
10039
- return n2.addEventListener(e2, r2, t2), () => n2.removeEventListener(e2, r2, t2);
10040
- }, [n2, e2, t2]);
9780
+ return window.addEventListener(e2, t2, n2), () => window.removeEventListener(e2, t2, n2);
9781
+ }, [e2, n2]);
10041
9782
  }
10042
- function f$3() {
9783
+ var s$1 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(s$1 || {});
9784
+ function n$1() {
9785
+ let e2 = useRef(0);
9786
+ return s$2("keydown", (o2) => {
9787
+ o2.key === "Tab" && (e2.current = o2.shiftKey ? 1 : 0);
9788
+ }, true), e2;
9789
+ }
9790
+ function f$1() {
10043
9791
  let e2 = useRef(false);
10044
- return l$5(() => (e2.current = true, () => {
9792
+ return s$6(() => (e2.current = true, () => {
10045
9793
  e2.current = false;
10046
9794
  }), []), e2;
10047
9795
  }
10048
- function c$3(t2) {
10049
- let r2 = o$4(t2), e2 = useRef(false);
10050
- useEffect(() => (e2.current = false, () => {
10051
- e2.current = true, t$6(() => {
10052
- e2.current && r2();
10053
- });
10054
- }), [r2]);
10055
- }
10056
- var s$2 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(s$2 || {});
10057
- function n() {
10058
- let e2 = useRef(0);
10059
- return s$5("keydown", (o2) => {
10060
- o2.key === "Tab" && (e2.current = o2.shiftKey ? 1 : 0);
10061
- }, true), e2;
9796
+ function n(...e2) {
9797
+ return useMemo(() => e$2(...e2), [...e2]);
10062
9798
  }
10063
- function P(t2) {
10064
- if (!t2)
10065
- return /* @__PURE__ */ new Set();
10066
- if (typeof t2 == "function")
10067
- return new Set(t2());
10068
- let n2 = /* @__PURE__ */ new Set();
10069
- for (let e2 of t2.current)
10070
- e2.current instanceof HTMLElement && n2.add(e2.current);
10071
- return n2;
9799
+ function E(n2, e2, a2, t2) {
9800
+ let i2 = s$5(a2);
9801
+ useEffect(() => {
9802
+ n2 = n2 != null ? n2 : window;
9803
+ function r2(o2) {
9804
+ i2.current(o2);
9805
+ }
9806
+ return n2.addEventListener(e2, r2, t2), () => n2.removeEventListener(e2, r2, t2);
9807
+ }, [n2, e2, t2]);
10072
9808
  }
10073
- let X = "div";
10074
- var _$1 = ((r2) => (r2[r2.None = 1] = "None", r2[r2.InitialFocus = 2] = "InitialFocus", r2[r2.TabLock = 4] = "TabLock", r2[r2.FocusLock = 8] = "FocusLock", r2[r2.RestoreFocus = 16] = "RestoreFocus", r2[r2.All = 30] = "All", r2))(_$1 || {});
10075
- function z(t2, n$12) {
10076
- let e2 = useRef(null), o2 = y$1(e2, n$12), { initialFocus: l2, containers: c2, features: r2 = 30, ...s2 } = t2;
10077
- l$4() || (r2 = 1);
10078
- let i2 = n$2(e2);
10079
- Y({ ownerDocument: i2 }, Boolean(r2 & 16));
10080
- let u2 = Z({ ownerDocument: i2, container: e2, initialFocus: l2 }, Boolean(r2 & 2));
10081
- $({ ownerDocument: i2, container: e2, containers: c2, previousActiveElement: u2 }, Boolean(r2 & 8));
10082
- let y2 = n(), R2 = o$4((a2) => {
10083
- let m2 = e2.current;
10084
- if (!m2)
9809
+ let z = "div";
9810
+ var A$2 = ((t2) => (t2[t2.None = 1] = "None", t2[t2.InitialFocus = 2] = "InitialFocus", t2[t2.TabLock = 4] = "TabLock", t2[t2.FocusLock = 8] = "FocusLock", t2[t2.RestoreFocus = 16] = "RestoreFocus", t2[t2.All = 30] = "All", t2))(A$2 || {});
9811
+ let de = Object.assign(C$1(function(u2, e2) {
9812
+ let l2 = useRef(null), a2 = y(l2, e2), { initialFocus: m2, containers: t2, features: n$22 = 30, ...E2 } = u2;
9813
+ a$2() || (n$22 = 1);
9814
+ let s2 = n(l2);
9815
+ J$1({ ownerDocument: s2 }, Boolean(n$22 & 16));
9816
+ let S2 = Q({ ownerDocument: s2, container: l2, initialFocus: m2 }, Boolean(n$22 & 2));
9817
+ X({ ownerDocument: s2, container: l2, containers: t2, previousActiveElement: S2 }, Boolean(n$22 & 8));
9818
+ let H2 = n$1(), R = o$3((o2) => {
9819
+ let c = l2.current;
9820
+ if (!c)
10085
9821
  return;
10086
- ((B) => B())(() => {
10087
- u$5(y2.current, { [s$2.Forwards]: () => {
10088
- O$1(m2, M$2.First, { skipElements: [a2.relatedTarget] });
10089
- }, [s$2.Backwards]: () => {
10090
- O$1(m2, M$2.Last, { skipElements: [a2.relatedTarget] });
10091
- } });
9822
+ ((_24) => _24())(() => {
9823
+ u$3(H2.current, { [s$1.Forwards]: () => I$1(c, L$1.First, { skipElements: [o2.relatedTarget] }), [s$1.Backwards]: () => I$1(c, L$1.Last, { skipElements: [o2.relatedTarget] }) });
10092
9824
  });
10093
- }), h2 = p$3(), H2 = useRef(false), j2 = { ref: o2, onKeyDown(a2) {
10094
- a2.key == "Tab" && (H2.current = true, h2.requestAnimationFrame(() => {
10095
- H2.current = false;
9825
+ }), B = p$2(), L2 = useRef(false), P2 = { ref: a2, onKeyDown(o2) {
9826
+ o2.key == "Tab" && (L2.current = true, B.requestAnimationFrame(() => {
9827
+ L2.current = false;
10096
9828
  }));
10097
- }, onBlur(a2) {
10098
- let m2 = P(c2);
10099
- e2.current instanceof HTMLElement && m2.add(e2.current);
10100
- let T2 = a2.relatedTarget;
10101
- T2 instanceof HTMLElement && T2.dataset.headlessuiFocusGuard !== "true" && (S$4(m2, T2) || (H2.current ? O$1(e2.current, u$5(y2.current, { [s$2.Forwards]: () => M$2.Next, [s$2.Backwards]: () => M$2.Previous }) | M$2.WrapAround, { relativeTo: a2.target }) : a2.target instanceof HTMLElement && y$3(a2.target)));
9829
+ }, onBlur(o2) {
9830
+ let c = new Set(t2 == null ? void 0 : t2.current);
9831
+ c.add(l2);
9832
+ let p2 = o2.relatedTarget;
9833
+ !p2 || p2.dataset.headlessuiFocusGuard !== "true" && (h(c, p2) || (L2.current ? I$1(l2.current, u$3(H2.current, { [s$1.Forwards]: () => L$1.Next, [s$1.Backwards]: () => L$1.Previous }) | L$1.WrapAround, { relativeTo: o2.target }) : o2.target instanceof HTMLElement && S$2(o2.target)));
10102
9834
  } };
10103
- return React__default.createElement(React__default.Fragment, null, Boolean(r2 & 4) && React__default.createElement(u$3, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: R2, features: s$4.Focusable }), C({ ourProps: j2, theirProps: s2, defaultTag: X, name: "FocusTrap" }), Boolean(r2 & 4) && React__default.createElement(u$3, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: R2, features: s$4.Focusable }));
10104
- }
10105
- let D$2 = U$2(z), de = Object.assign(D$2, { features: _$1 });
10106
- function Q(t2 = true) {
10107
- let n2 = useRef(t$2.slice());
10108
- return m$2(([e2], [o2]) => {
10109
- o2 === true && e2 === false && t$6(() => {
10110
- n2.current.splice(0);
10111
- }), o2 === false && e2 === true && (n2.current = t$2.slice());
10112
- }, [t2, t$2, n2]), o$4(() => {
10113
- var e2;
10114
- return (e2 = n2.current.find((o2) => o2 != null && o2.isConnected)) != null ? e2 : null;
10115
- });
10116
- }
10117
- function Y({ ownerDocument: t2 }, n2) {
10118
- let e2 = Q(n2);
10119
- m$2(() => {
10120
- n2 || (t2 == null ? void 0 : t2.activeElement) === (t2 == null ? void 0 : t2.body) && y$3(e2());
10121
- }, [n2]), c$3(() => {
10122
- n2 && y$3(e2());
10123
- });
9835
+ return React.createElement(React.Fragment, null, Boolean(n$22 & 4) && React.createElement(h$1, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: R, features: s$4.Focusable }), $$1({ ourProps: P2, theirProps: E2, defaultTag: z, name: "FocusTrap" }), Boolean(n$22 & 4) && React.createElement(h$1, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: R, features: s$4.Focusable }));
9836
+ }), { features: A$2 });
9837
+ function J$1({ ownerDocument: r2 }, u2) {
9838
+ let e2 = useRef(null);
9839
+ E(r2 == null ? void 0 : r2.defaultView, "focusout", (a2) => {
9840
+ !u2 || e2.current || (e2.current = a2.target);
9841
+ }, true), m(() => {
9842
+ u2 || ((r2 == null ? void 0 : r2.activeElement) === (r2 == null ? void 0 : r2.body) && S$2(e2.current), e2.current = null);
9843
+ }, [u2]);
9844
+ let l2 = useRef(false);
9845
+ useEffect(() => (l2.current = false, () => {
9846
+ l2.current = true, t(() => {
9847
+ !l2.current || (S$2(e2.current), e2.current = null);
9848
+ });
9849
+ }), []);
10124
9850
  }
10125
- function Z({ ownerDocument: t2, container: n2, initialFocus: e2 }, o2) {
10126
- let l2 = useRef(null), c2 = f$3();
10127
- return m$2(() => {
10128
- if (!o2)
9851
+ function Q({ ownerDocument: r2, container: u2, initialFocus: e2 }, l2) {
9852
+ let a2 = useRef(null), m$12 = f$1();
9853
+ return m(() => {
9854
+ if (!l2)
10129
9855
  return;
10130
- let r2 = n2.current;
10131
- r2 && t$6(() => {
10132
- if (!c2.current)
9856
+ let t$1 = u2.current;
9857
+ !t$1 || t(() => {
9858
+ if (!m$12.current)
10133
9859
  return;
10134
- let s2 = t2 == null ? void 0 : t2.activeElement;
9860
+ let n2 = r2 == null ? void 0 : r2.activeElement;
10135
9861
  if (e2 != null && e2.current) {
10136
- if ((e2 == null ? void 0 : e2.current) === s2) {
10137
- l2.current = s2;
9862
+ if ((e2 == null ? void 0 : e2.current) === n2) {
9863
+ a2.current = n2;
10138
9864
  return;
10139
9865
  }
10140
- } else if (r2.contains(s2)) {
10141
- l2.current = s2;
9866
+ } else if (t$1.contains(n2)) {
9867
+ a2.current = n2;
10142
9868
  return;
10143
9869
  }
10144
- e2 != null && e2.current ? y$3(e2.current) : O$1(r2, M$2.First) === N$2.Error && console.warn("There are no focusable elements inside the <FocusTrap />"), l2.current = t2 == null ? void 0 : t2.activeElement;
9870
+ e2 != null && e2.current ? S$2(e2.current) : I$1(t$1, L$1.First) === N.Error && console.warn("There are no focusable elements inside the <FocusTrap />"), a2.current = r2 == null ? void 0 : r2.activeElement;
10145
9871
  });
10146
- }, [o2]), l2;
9872
+ }, [l2]), a2;
10147
9873
  }
10148
- function $({ ownerDocument: t2, container: n2, containers: e2, previousActiveElement: o2 }, l2) {
10149
- let c2 = f$3();
10150
- E(t2 == null ? void 0 : t2.defaultView, "focus", (r2) => {
10151
- if (!l2 || !c2.current)
9874
+ function X({ ownerDocument: r2, container: u2, containers: e2, previousActiveElement: l2 }, a2) {
9875
+ let m2 = f$1();
9876
+ E(r2 == null ? void 0 : r2.defaultView, "focus", (t2) => {
9877
+ if (!a2 || !m2.current)
10152
9878
  return;
10153
- let s2 = P(e2);
10154
- n2.current instanceof HTMLElement && s2.add(n2.current);
10155
- let i2 = o2.current;
10156
- if (!i2)
9879
+ let n2 = new Set(e2 == null ? void 0 : e2.current);
9880
+ n2.add(u2);
9881
+ let E2 = l2.current;
9882
+ if (!E2)
10157
9883
  return;
10158
- let u2 = r2.target;
10159
- u2 && u2 instanceof HTMLElement ? S$4(s2, u2) ? (o2.current = u2, y$3(u2)) : (r2.preventDefault(), r2.stopPropagation(), y$3(i2)) : y$3(o2.current);
9884
+ let s2 = t2.target;
9885
+ s2 && s2 instanceof HTMLElement ? h(n2, s2) ? (l2.current = s2, S$2(s2)) : (t2.preventDefault(), t2.stopPropagation(), S$2(E2)) : S$2(l2.current);
10160
9886
  }, true);
10161
9887
  }
10162
- function S$4(t2, n2) {
10163
- for (let e2 of t2)
10164
- if (e2.contains(n2))
9888
+ function h(r2, u2) {
9889
+ var e2;
9890
+ for (let l2 of r2)
9891
+ if ((e2 = l2.current) != null && e2.contains(u2))
10165
9892
  return true;
10166
9893
  return false;
10167
9894
  }
10168
- let e = createContext(false);
10169
- function a$4() {
10170
- return useContext(e);
9895
+ let i = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
9896
+ function u$1(t2) {
9897
+ t2.setAttribute("aria-hidden", "true"), t2.inert = true;
10171
9898
  }
10172
- function l$2(o2) {
10173
- return React__default.createElement(e.Provider, { value: o2.force }, o2.children);
9899
+ function l$2(t2) {
9900
+ let n2 = r.get(t2);
9901
+ !n2 || (n2["aria-hidden"] === null ? t2.removeAttribute("aria-hidden") : t2.setAttribute("aria-hidden", n2["aria-hidden"]), t2.inert = n2.inert);
10174
9902
  }
10175
- function F(p2) {
10176
- let n2 = a$4(), l2 = useContext(_23), e2 = n$2(p2), [a2, o2] = useState(() => {
10177
- if (!n2 && l2 !== null || s$8.isServer)
9903
+ function M$3(t2, n2 = true) {
9904
+ s$6(() => {
9905
+ if (!n2 || !t2.current)
9906
+ return;
9907
+ let o2 = t2.current, a2 = e$2(o2);
9908
+ if (!!a2) {
9909
+ i.add(o2);
9910
+ for (let e2 of r.keys())
9911
+ e2.contains(o2) && (l$2(e2), r.delete(e2));
9912
+ return a2.querySelectorAll("body > *").forEach((e2) => {
9913
+ if (e2 instanceof HTMLElement) {
9914
+ for (let f2 of i)
9915
+ if (e2.contains(f2))
9916
+ return;
9917
+ i.size === 1 && (r.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), u$1(e2));
9918
+ }
9919
+ }), () => {
9920
+ if (i.delete(o2), i.size > 0)
9921
+ a2.querySelectorAll("body > *").forEach((e2) => {
9922
+ if (e2 instanceof HTMLElement && !r.has(e2)) {
9923
+ for (let f2 of i)
9924
+ if (e2.contains(f2))
9925
+ return;
9926
+ r.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), u$1(e2);
9927
+ }
9928
+ });
9929
+ else
9930
+ for (let e2 of r.keys())
9931
+ l$2(e2), r.delete(e2);
9932
+ };
9933
+ }
9934
+ }, [n2]);
9935
+ }
9936
+ let e$1 = createContext(false);
9937
+ function l$1() {
9938
+ return useContext(e$1);
9939
+ }
9940
+ function P$1(o2) {
9941
+ return React.createElement(e$1.Provider, { value: o2.force }, o2.children);
9942
+ }
9943
+ function x$1(i2) {
9944
+ let u2 = l$1(), o2 = useContext(A$1), e2 = n(i2), [r2, f2] = useState(() => {
9945
+ if (!u2 && o2 !== null || e$3)
10178
9946
  return null;
10179
- let t2 = e2 == null ? void 0 : e2.getElementById("headlessui-portal-root");
10180
- if (t2)
10181
- return t2;
9947
+ let n2 = e2 == null ? void 0 : e2.getElementById("headlessui-portal-root");
9948
+ if (n2)
9949
+ return n2;
10182
9950
  if (e2 === null)
10183
9951
  return null;
10184
- let r2 = e2.createElement("div");
10185
- return r2.setAttribute("id", "headlessui-portal-root"), e2.body.appendChild(r2);
9952
+ let t2 = e2.createElement("div");
9953
+ return t2.setAttribute("id", "headlessui-portal-root"), e2.body.appendChild(t2);
10186
9954
  });
10187
9955
  return useEffect(() => {
10188
- a2 !== null && (e2 != null && e2.body.contains(a2) || e2 == null || e2.body.appendChild(a2));
10189
- }, [a2, e2]), useEffect(() => {
10190
- n2 || l2 !== null && o2(l2.current);
10191
- }, [l2, o2, n2]), a2;
10192
- }
10193
- let U$1 = Fragment$1;
10194
- function N$1(p2, n2) {
10195
- let l2 = p2, e2 = useRef(null), a2 = y$1(T((u2) => {
10196
- e2.current = u2;
10197
- }), n2), o2 = n$2(e2), t2 = F(e2), [r2] = useState(() => {
10198
- var u2;
10199
- return s$8.isServer ? null : (u2 = o2 == null ? void 0 : o2.createElement("div")) != null ? u2 : null;
10200
- }), i2 = useContext(f$2), v2 = l$4();
10201
- return l$5(() => {
10202
- !t2 || !r2 || t2.contains(r2) || (r2.setAttribute("data-headlessui-portal", ""), t2.appendChild(r2));
10203
- }, [t2, r2]), l$5(() => {
10204
- if (r2 && i2)
10205
- return i2.register(r2);
10206
- }, [i2, r2]), c$3(() => {
10207
- var u2;
10208
- !t2 || !r2 || (r2 instanceof Node && t2.contains(r2) && t2.removeChild(r2), t2.childNodes.length <= 0 && ((u2 = t2.parentElement) == null || u2.removeChild(t2)));
10209
- }), v2 ? !t2 || !r2 ? null : createPortal(C({ ourProps: { ref: a2 }, theirProps: l2, defaultTag: U$1, name: "Portal" }), r2) : null;
10210
- }
10211
- let S$3 = Fragment$1, _23 = createContext(null);
10212
- function j(p2, n2) {
10213
- let { target: l2, ...e2 } = p2, o2 = { ref: y$1(n2) };
10214
- return React__default.createElement(_23.Provider, { value: l2 }, C({ ourProps: o2, theirProps: e2, defaultTag: S$3, name: "Popover.Group" }));
10215
- }
10216
- let f$2 = createContext(null);
10217
- function ee() {
10218
- let p2 = useContext(f$2), n2 = useRef([]), l2 = o$4((o2) => (n2.current.push(o2), p2 && p2.register(o2), () => e2(o2))), e2 = o$4((o2) => {
10219
- let t2 = n2.current.indexOf(o2);
10220
- t2 !== -1 && n2.current.splice(t2, 1), p2 && p2.unregister(o2);
10221
- }), a2 = useMemo(() => ({ register: l2, unregister: e2, portals: n2 }), [l2, e2, n2]);
10222
- return [n2, useMemo(() => function({ children: t2 }) {
10223
- return React__default.createElement(f$2.Provider, { value: a2 }, t2);
10224
- }, [a2])];
10225
- }
10226
- let D$1 = U$2(N$1), I$3 = U$2(j), te = Object.assign(D$1, { Group: I$3 });
10227
- function i(e2, t2) {
10228
- return e2 === t2 && (e2 !== 0 || 1 / e2 === 1 / t2) || e2 !== e2 && t2 !== t2;
10229
- }
10230
- const d$2 = typeof Object.is == "function" ? Object.is : i, { useState: u$1, useEffect: h$1, useLayoutEffect: f$1, useDebugValue: p$1 } = React;
10231
- function y(e2, t2, c2) {
10232
- const a2 = t2(), [{ inst: n2 }, o2] = u$1({ inst: { value: a2, getSnapshot: t2 } });
10233
- return f$1(() => {
10234
- n2.value = a2, n2.getSnapshot = t2, r$1(n2) && o2({ inst: n2 });
10235
- }, [e2, a2, t2]), h$1(() => (r$1(n2) && o2({ inst: n2 }), e2(() => {
10236
- r$1(n2) && o2({ inst: n2 });
10237
- })), [e2]), p$1(a2), a2;
10238
- }
10239
- function r$1(e2) {
10240
- const t2 = e2.getSnapshot, c2 = e2.value;
10241
- try {
10242
- const a2 = t2();
10243
- return !d$2(c2, a2);
10244
- } catch {
10245
- return true;
9956
+ r2 !== null && (e2 != null && e2.body.contains(r2) || e2 == null || e2.body.appendChild(r2));
9957
+ }, [r2, e2]), useEffect(() => {
9958
+ u2 || o2 !== null && f2(o2.current);
9959
+ }, [o2, f2, u2]), r2;
9960
+ }
9961
+ let _23 = Fragment$1, U = C$1(function(u2, o2) {
9962
+ let e2 = u2, r2 = useRef(null), f2 = y(T$1((a2) => {
9963
+ r2.current = a2;
9964
+ }), o2), n$12 = n(r2), t$1 = x$1(r2), [l2] = useState(() => {
9965
+ var a2;
9966
+ return e$3 ? null : (a2 = n$12 == null ? void 0 : n$12.createElement("div")) != null ? a2 : null;
9967
+ }), b = a$2(), p2 = useRef(false);
9968
+ return s$6(() => {
9969
+ if (p2.current = false, !(!t$1 || !l2))
9970
+ return t$1.contains(l2) || (l2.setAttribute("data-headlessui-portal", ""), t$1.appendChild(l2)), () => {
9971
+ p2.current = true, t(() => {
9972
+ var a2;
9973
+ !p2.current || !t$1 || !l2 || (t$1.removeChild(l2), t$1.childNodes.length <= 0 && ((a2 = t$1.parentElement) == null || a2.removeChild(t$1)));
9974
+ });
9975
+ };
9976
+ }, [t$1, l2]), b ? !t$1 || !l2 ? null : createPortal($$1({ ourProps: { ref: f2 }, theirProps: e2, defaultTag: _23, name: "Portal" }), l2) : null;
9977
+ }), j = Fragment$1, A$1 = createContext(null), F$2 = C$1(function(u2, o2) {
9978
+ let { target: e2, ...r2 } = u2, n2 = { ref: y(o2) };
9979
+ return React.createElement(A$1.Provider, { value: e2 }, $$1({ ourProps: n2, theirProps: r2, defaultTag: j, name: "Popover.Group" }));
9980
+ }), $ = Object.assign(U, { Group: F$2 });
9981
+ let d = createContext(null);
9982
+ function u() {
9983
+ let n2 = useContext(d);
9984
+ if (n2 === null) {
9985
+ let t2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
9986
+ throw Error.captureStackTrace && Error.captureStackTrace(t2, u), t2;
10246
9987
  }
10247
- }
10248
- function t$1(r2, e2, n2) {
10249
- return e2();
10250
- }
10251
- const r = typeof window != "undefined" && typeof window.document != "undefined" && typeof window.document.createElement != "undefined", s$1 = !r, c$2 = s$1 ? t$1 : y, a$3 = "useSyncExternalStore" in React ? ((n2) => n2.useSyncExternalStore)(React) : c$2;
10252
- function S$2(t2) {
10253
- return a$3(t2.subscribe, t2.getSnapshot, t2.getSnapshot);
10254
- }
10255
- function a$2(o2, r2) {
10256
- let t2 = o2(), n2 = /* @__PURE__ */ new Set();
10257
- return { getSnapshot() {
10258
- return t2;
10259
- }, subscribe(e2) {
10260
- return n2.add(e2), () => n2.delete(e2);
10261
- }, dispatch(e2, ...s2) {
10262
- let i2 = r2[e2].call(t2, ...s2);
10263
- i2 && (t2 = i2, n2.forEach((c2) => c2()));
10264
- } };
10265
- }
10266
- function c$1() {
10267
- let o2;
10268
- return { before({ doc: e2 }) {
10269
- var l2;
10270
- let n2 = e2.documentElement;
10271
- o2 = ((l2 = e2.defaultView) != null ? l2 : window).innerWidth - n2.clientWidth;
10272
- }, after({ doc: e2, d: n2 }) {
10273
- let t2 = e2.documentElement, l2 = t2.clientWidth - t2.offsetWidth, r2 = o2 - l2;
10274
- n2.style(t2, "paddingRight", `${r2}px`);
10275
- } };
10276
- }
10277
- function d$1() {
10278
- return t$5() ? { before({ doc: r2, d: l2, meta: c2 }) {
10279
- function o2(a2) {
10280
- return c2.containers.flatMap((n2) => n2()).some((n2) => n2.contains(a2));
10281
- }
10282
- l2.microTask(() => {
10283
- var s2;
10284
- if (window.getComputedStyle(r2.documentElement).scrollBehavior !== "auto") {
10285
- let t2 = o$3();
10286
- t2.style(r2.documentElement, "scrollBehavior", "auto"), l2.add(() => l2.microTask(() => t2.dispose()));
10287
- }
10288
- let a2 = (s2 = window.scrollY) != null ? s2 : window.pageYOffset, n2 = null;
10289
- l2.addEventListener(r2, "click", (t2) => {
10290
- if (t2.target instanceof HTMLElement)
10291
- try {
10292
- let e2 = t2.target.closest("a");
10293
- if (!e2)
10294
- return;
10295
- let { hash: f2 } = new URL(e2.href), i2 = r2.querySelector(f2);
10296
- i2 && !o2(i2) && (n2 = i2);
10297
- } catch {
10298
- }
10299
- }, true), l2.addEventListener(r2, "touchstart", (t2) => {
10300
- if (t2.target instanceof HTMLElement)
10301
- if (o2(t2.target)) {
10302
- let e2 = t2.target;
10303
- for (; e2.parentElement && o2(e2.parentElement); )
10304
- e2 = e2.parentElement;
10305
- l2.style(e2, "overscrollBehavior", "contain");
10306
- } else
10307
- l2.style(t2.target, "touchAction", "none");
10308
- }), l2.addEventListener(r2, "touchmove", (t2) => {
10309
- if (t2.target instanceof HTMLElement)
10310
- if (o2(t2.target)) {
10311
- let e2 = t2.target;
10312
- for (; e2.parentElement && e2.dataset.headlessuiPortal !== "" && !(e2.scrollHeight > e2.clientHeight || e2.scrollWidth > e2.clientWidth); )
10313
- e2 = e2.parentElement;
10314
- e2.dataset.headlessuiPortal === "" && t2.preventDefault();
10315
- } else
10316
- t2.preventDefault();
10317
- }, { passive: false }), l2.add(() => {
10318
- var e2;
10319
- let t2 = (e2 = window.scrollY) != null ? e2 : window.pageYOffset;
10320
- a2 !== t2 && window.scrollTo(0, a2), n2 && n2.isConnected && (n2.scrollIntoView({ block: "nearest" }), n2 = null);
10321
- });
10322
- });
10323
- } } : {};
10324
- }
10325
- function l$1() {
10326
- return { before({ doc: e2, d: o2 }) {
10327
- o2.style(e2.documentElement, "overflow", "hidden");
10328
- } };
10329
- }
10330
- function m(e2) {
10331
- let n2 = {};
10332
- for (let t2 of e2)
10333
- Object.assign(n2, t2(n2));
10334
9988
  return n2;
10335
9989
  }
10336
- let a$1 = a$2(() => /* @__PURE__ */ new Map(), { PUSH(e2, n2) {
10337
- var o2;
10338
- let t2 = (o2 = this.get(e2)) != null ? o2 : { doc: e2, count: 0, d: o$3(), meta: /* @__PURE__ */ new Set() };
10339
- return t2.count++, t2.meta.add(n2), this.set(e2, t2), this;
10340
- }, POP(e2, n2) {
10341
- let t2 = this.get(e2);
10342
- return t2 && (t2.count--, t2.meta.delete(n2)), this;
10343
- }, SCROLL_PREVENT({ doc: e2, d: n2, meta: t2 }) {
10344
- let o2 = { doc: e2, d: n2, meta: m(t2) }, c2 = [d$1(), c$1(), l$1()];
10345
- c2.forEach(({ before: r2 }) => r2 == null ? void 0 : r2(o2)), c2.forEach(({ after: r2 }) => r2 == null ? void 0 : r2(o2));
10346
- }, SCROLL_ALLOW({ d: e2 }) {
10347
- e2.dispose();
10348
- }, TEARDOWN({ doc: e2 }) {
10349
- this.delete(e2);
10350
- } });
10351
- a$1.subscribe(() => {
10352
- let e2 = a$1.getSnapshot(), n2 = /* @__PURE__ */ new Map();
10353
- for (let [t2] of e2)
10354
- n2.set(t2, t2.documentElement.style.overflow);
10355
- for (let t2 of e2.values()) {
10356
- let o2 = n2.get(t2.doc) === "hidden", c2 = t2.count !== 0;
10357
- (c2 && !o2 || !c2 && o2) && a$1.dispatch(t2.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", t2), t2.count === 0 && a$1.dispatch("TEARDOWN", t2);
10358
- }
10359
- });
10360
- function p(e2, r2, n2) {
10361
- let f2 = S$2(a$1), o2 = e2 ? f2.get(e2) : void 0, i2 = o2 ? o2.count > 0 : false;
10362
- return l$5(() => {
10363
- if (!(!e2 || !r2))
10364
- return a$1.dispatch("PUSH", e2, n2), () => a$1.dispatch("POP", e2, n2);
10365
- }, [r2, e2]), i2;
10366
- }
10367
- let u = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
10368
- function b$3(r2, l2 = true) {
10369
- l$5(() => {
10370
- var o2;
10371
- if (!l2)
10372
- return;
10373
- let e2 = typeof r2 == "function" ? r2() : r2.current;
10374
- if (!e2)
10375
- return;
10376
- function a2() {
10377
- var d2;
10378
- if (!e2)
10379
- return;
10380
- let i2 = (d2 = t.get(e2)) != null ? d2 : 1;
10381
- if (i2 === 1 ? t.delete(e2) : t.set(e2, i2 - 1), i2 !== 1)
10382
- return;
10383
- let n2 = u.get(e2);
10384
- n2 && (n2["aria-hidden"] === null ? e2.removeAttribute("aria-hidden") : e2.setAttribute("aria-hidden", n2["aria-hidden"]), e2.inert = n2.inert, u.delete(e2));
10385
- }
10386
- let f2 = (o2 = t.get(e2)) != null ? o2 : 0;
10387
- return t.set(e2, f2 + 1), f2 !== 0 || (u.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), e2.setAttribute("aria-hidden", "true"), e2.inert = true), a2;
10388
- }, [r2, l2]);
10389
- }
10390
- function N({ defaultContainers: o2 = [], portals: r2, mainTreeNodeRef: u2 } = {}) {
10391
- var f2;
10392
- let t2 = useRef((f2 = u2 == null ? void 0 : u2.current) != null ? f2 : null), l2 = n$2(t2), c2 = o$4(() => {
10393
- var i2, s2, a2;
10394
- let n2 = [];
10395
- for (let e2 of o2)
10396
- e2 !== null && (e2 instanceof HTMLElement ? n2.push(e2) : "current" in e2 && e2.current instanceof HTMLElement && n2.push(e2.current));
10397
- if (r2 != null && r2.current)
10398
- for (let e2 of r2.current)
10399
- n2.push(e2);
10400
- for (let e2 of (i2 = l2 == null ? void 0 : l2.querySelectorAll("html > *, body > *")) != null ? i2 : [])
10401
- e2 !== document.body && e2 !== document.head && e2 instanceof HTMLElement && e2.id !== "headlessui-portal-root" && (e2.contains(t2.current) || e2.contains((a2 = (s2 = t2.current) == null ? void 0 : s2.getRootNode()) == null ? void 0 : a2.host) || n2.some((L) => e2.contains(L)) || n2.push(e2));
10402
- return n2;
10403
- });
10404
- return { resolveContainers: c2, contains: o$4((n2) => c2().some((i2) => i2.contains(n2))), mainTreeNodeRef: t2, MainTreeNode: useMemo(() => function() {
10405
- return u2 != null ? null : React__default.createElement(u$3, { features: s$4.Hidden, ref: t2 });
10406
- }, [t2, u2]) };
9990
+ function k$1() {
9991
+ let [n2, t2] = useState([]);
9992
+ return [n2.length > 0 ? n2.join(" ") : void 0, useMemo(() => function(e2) {
9993
+ let i2 = o$3((r2) => (t2((o2) => [...o2, r2]), () => t2((o2) => {
9994
+ let s2 = o2.slice(), p2 = s2.indexOf(r2);
9995
+ return p2 !== -1 && s2.splice(p2, 1), s2;
9996
+ }))), a2 = useMemo(() => ({ register: i2, slot: e2.slot, name: e2.name, props: e2.props }), [i2, e2.slot, e2.name, e2.props]);
9997
+ return React.createElement(d.Provider, { value: a2 }, e2.children);
9998
+ }, [t2])];
10407
9999
  }
10000
+ let S = "p", F$1 = C$1(function(t2, c) {
10001
+ let e2 = I$2(), { id: i2 = `headlessui-description-${e2}`, ...a2 } = t2, r2 = u(), o2 = y(c);
10002
+ s$6(() => r2.register(i2), [i2, r2.register]);
10003
+ let s2 = { ref: o2, ...r2.props, id: i2 };
10004
+ return $$1({ ourProps: s2, theirProps: a2, slot: r2.slot || {}, defaultTag: S, name: r2.name || "Description" });
10005
+ });
10408
10006
  let a = createContext(() => {
10409
10007
  });
10410
10008
  a.displayName = "StackContext";
@@ -10412,169 +10010,142 @@ var s = ((e2) => (e2[e2.Add = 0] = "Add", e2[e2.Remove = 1] = "Remove", e2))(s |
10412
10010
  function x() {
10413
10011
  return useContext(a);
10414
10012
  }
10415
- function b$2({ children: i2, onUpdate: r2, type: e2, element: n2, enabled: u2 }) {
10416
- let l2 = x(), o2 = o$4((...t2) => {
10013
+ function M$2({ children: i2, onUpdate: r2, type: e2, element: n2, enabled: u2 }) {
10014
+ let l2 = x(), o2 = o$3((...t2) => {
10417
10015
  r2 == null || r2(...t2), l2(...t2);
10418
10016
  });
10419
- return l$5(() => {
10017
+ return s$6(() => {
10420
10018
  let t2 = u2 === void 0 || u2 === true;
10421
10019
  return t2 && o2(0, e2, n2), () => {
10422
10020
  t2 && o2(1, e2, n2);
10423
10021
  };
10424
- }, [o2, e2, n2, u2]), React__default.createElement(a.Provider, { value: o2 }, i2);
10022
+ }, [o2, e2, n2, u2]), React.createElement(a.Provider, { value: o2 }, i2);
10425
10023
  }
10426
- let d = createContext(null);
10427
- function f() {
10428
- let r2 = useContext(d);
10429
- if (r2 === null) {
10430
- let t2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
10431
- throw Error.captureStackTrace && Error.captureStackTrace(t2, f), t2;
10432
- }
10433
- return r2;
10434
- }
10435
- function w() {
10436
- let [r2, t2] = useState([]);
10437
- return [r2.length > 0 ? r2.join(" ") : void 0, useMemo(() => function(e2) {
10438
- let i2 = o$4((s2) => (t2((o2) => [...o2, s2]), () => t2((o2) => {
10439
- let p2 = o2.slice(), c2 = p2.indexOf(s2);
10440
- return c2 !== -1 && p2.splice(c2, 1), p2;
10441
- }))), n2 = useMemo(() => ({ register: i2, slot: e2.slot, name: e2.name, props: e2.props }), [i2, e2.slot, e2.name, e2.props]);
10442
- return React__default.createElement(d.Provider, { value: n2 }, e2.children);
10443
- }, [t2])];
10024
+ function o() {
10025
+ return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
10444
10026
  }
10445
- let I$2 = "p";
10446
- function S$1(r2, t2) {
10447
- let a2 = I$5(), { id: e2 = `headlessui-description-${a2}`, ...i2 } = r2, n2 = f(), s2 = y$1(t2);
10448
- l$5(() => n2.register(e2), [e2, n2.register]);
10449
- let o2 = { ref: s2, ...n2.props, id: e2 };
10450
- return C({ ourProps: o2, theirProps: i2, slot: n2.slot || {}, defaultTag: I$2, name: n2.name || "Description" });
10451
- }
10452
- let h = U$2(S$1), G = Object.assign(h, {});
10453
- var Me = ((r2) => (r2[r2.Open = 0] = "Open", r2[r2.Closed = 1] = "Closed", r2))(Me || {}), we = ((e2) => (e2[e2.SetTitleId = 0] = "SetTitleId", e2))(we || {});
10454
- let He$1 = { [0](o2, e2) {
10455
- return o2.titleId === e2.id ? o2 : { ...o2, titleId: e2.id };
10456
- } }, I$1 = createContext(null);
10457
- I$1.displayName = "DialogContext";
10458
- function b$1(o2) {
10459
- let e2 = useContext(I$1);
10027
+ var be$1 = ((r2) => (r2[r2.Open = 0] = "Open", r2[r2.Closed = 1] = "Closed", r2))(be$1 || {}), ve = ((e2) => (e2[e2.SetTitleId = 0] = "SetTitleId", e2))(ve || {});
10028
+ let Ae = { [0](t2, e2) {
10029
+ return t2.titleId === e2.id ? t2 : { ...t2, titleId: e2.id };
10030
+ } }, H = createContext(null);
10031
+ H.displayName = "DialogContext";
10032
+ function k(t2) {
10033
+ let e2 = useContext(H);
10460
10034
  if (e2 === null) {
10461
- let r2 = new Error(`<${o2} /> is missing a parent <Dialog /> component.`);
10462
- throw Error.captureStackTrace && Error.captureStackTrace(r2, b$1), r2;
10035
+ let r2 = new Error(`<${t2} /> is missing a parent <Dialog /> component.`);
10036
+ throw Error.captureStackTrace && Error.captureStackTrace(r2, k), r2;
10463
10037
  }
10464
10038
  return e2;
10465
10039
  }
10466
- function Be(o2, e2, r2 = () => [document.body]) {
10467
- p(o2, e2, (i2) => {
10468
- var n2;
10469
- return { containers: [...(n2 = i2.containers) != null ? n2 : [], r2] };
10470
- });
10040
+ function Oe(t2, e2, r2 = () => [document.body]) {
10041
+ useEffect(() => {
10042
+ var c;
10043
+ if (!e2 || !t2)
10044
+ return;
10045
+ let s2 = m$2(), d2 = window.pageYOffset;
10046
+ function a2(n2, i2, l2) {
10047
+ let P2 = n2.style.getPropertyValue(i2);
10048
+ return Object.assign(n2.style, { [i2]: l2 }), s2.add(() => {
10049
+ Object.assign(n2.style, { [i2]: P2 });
10050
+ });
10051
+ }
10052
+ let o$12 = t2.documentElement, f2 = ((c = t2.defaultView) != null ? c : window).innerWidth - o$12.clientWidth;
10053
+ if (a2(o$12, "overflow", "hidden"), f2 > 0) {
10054
+ let n2 = o$12.clientWidth - o$12.offsetWidth, i2 = f2 - n2;
10055
+ a2(o$12, "paddingRight", `${i2}px`);
10056
+ }
10057
+ if (o()) {
10058
+ a2(t2.body, "marginTop", `-${d2}px`), window.scrollTo(0, 0);
10059
+ let n2 = null;
10060
+ s2.addEventListener(t2, "click", (i2) => {
10061
+ if (i2.target instanceof HTMLElement)
10062
+ try {
10063
+ let l2 = i2.target.closest("a");
10064
+ if (!l2)
10065
+ return;
10066
+ let { hash: P2 } = new URL(l2.href), u2 = t2.querySelector(P2);
10067
+ u2 && !r2().some((_24) => _24.contains(u2)) && (n2 = u2);
10068
+ } catch {
10069
+ }
10070
+ }, true), s2.addEventListener(t2, "touchmove", (i2) => {
10071
+ i2.target instanceof HTMLElement && !r2().some((l2) => l2.contains(i2.target)) && i2.preventDefault();
10072
+ }, { passive: false }), s2.add(() => {
10073
+ window.scrollTo(0, window.pageYOffset + d2), n2 && n2.isConnected && (n2.scrollIntoView({ block: "nearest" }), n2 = null);
10074
+ });
10075
+ }
10076
+ return s2.dispose;
10077
+ }, [t2, e2]);
10078
+ }
10079
+ function Ce$1(t2, e2) {
10080
+ return u$3(e2.type, Ae, t2, e2);
10471
10081
  }
10472
- function Ge(o2, e2) {
10473
- return u$5(e2.type, He$1, o2, e2);
10474
- }
10475
- let Ne$1 = "div", Ue = O.RenderStrategy | O.Static;
10476
- function We(o$12, e2) {
10477
- let r2 = I$5(), { id: i2 = `headlessui-dialog-${r2}`, open: n2, onClose: l2, initialFocus: s$12, role: a2 = "dialog", __demoMode: T2 = false, ...m2 } = o$12, [M2, f2] = useState(0), U2 = useRef(false);
10478
- a2 = function() {
10479
- return a2 === "dialog" || a2 === "alertdialog" ? a2 : (U2.current || (U2.current = true, console.warn(`Invalid role [${a2}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog");
10480
- }();
10481
- let E$1 = u$2();
10482
- n2 === void 0 && E$1 !== null && (n2 = (E$1 & d$3.Open) === d$3.Open);
10483
- let D2 = useRef(null), ee$1 = y$1(D2, e2), g2 = n$2(D2), W = o$12.hasOwnProperty("open") || E$1 !== null, $2 = o$12.hasOwnProperty("onClose");
10484
- if (!W && !$2)
10082
+ let Se$1 = "div", Le = S$1.RenderStrategy | S$1.Static, Me = C$1(function(e2, r2) {
10083
+ let s$12 = I$2(), { id: d2 = `headlessui-dialog-${s$12}`, open: a2, onClose: o2, initialFocus: p$12, __demoMode: f2 = false, ...c } = e2, [n$12, i2] = useState(0), l2 = s$3();
10084
+ a2 === void 0 && l2 !== null && (a2 = u$3(l2, { [p.Open]: true, [p.Closed]: false }));
10085
+ let P2 = useRef(/* @__PURE__ */ new Set()), u2 = useRef(null), _24 = y(u2, r2), U2 = useRef(null), y$1 = n(u2), $$2 = e2.hasOwnProperty("open") || l2 !== null, Y = e2.hasOwnProperty("onClose");
10086
+ if (!$$2 && !Y)
10485
10087
  throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
10486
- if (!W)
10088
+ if (!$$2)
10487
10089
  throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
10488
- if (!$2)
10090
+ if (!Y)
10489
10091
  throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
10490
- if (typeof n2 != "boolean")
10491
- throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n2}`);
10492
- if (typeof l2 != "function")
10493
- throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${l2}`);
10494
- let p2 = n2 ? 0 : 1, [h2, te$1] = useReducer(Ge, { titleId: null, descriptionId: null, panelRef: createRef() }), P2 = o$4(() => l2(false)), Y2 = o$4((t2) => te$1({ type: 0, id: t2 })), S2 = l$4() ? T2 ? false : p2 === 0 : false, x2 = M2 > 1, j2 = useContext(I$1) !== null, [oe, re] = ee(), ne = { get current() {
10495
- var t2;
10496
- return (t2 = h2.panelRef.current) != null ? t2 : D2.current;
10497
- } }, { resolveContainers: w$12, mainTreeNodeRef: L, MainTreeNode: le2 } = N({ portals: oe, defaultContainers: [ne] }), ae2 = x2 ? "parent" : "leaf", J = E$1 !== null ? (E$1 & d$3.Closing) === d$3.Closing : false, ie = (() => j2 || J ? false : S2)(), se2 = useCallback(() => {
10498
- var t2, c2;
10499
- return (c2 = Array.from((t2 = g2 == null ? void 0 : g2.querySelectorAll("body > *")) != null ? t2 : []).find((d2) => d2.id === "headlessui-portal-root" ? false : d2.contains(L.current) && d2 instanceof HTMLElement)) != null ? c2 : null;
10500
- }, [L]);
10501
- b$3(se2, ie);
10502
- let pe = (() => x2 ? true : S2)(), de$1 = useCallback(() => {
10503
- var t2, c2;
10504
- return (c2 = Array.from((t2 = g2 == null ? void 0 : g2.querySelectorAll("[data-headlessui-portal]")) != null ? t2 : []).find((d2) => d2.contains(L.current) && d2 instanceof HTMLElement)) != null ? c2 : null;
10505
- }, [L]);
10506
- b$3(de$1, pe);
10507
- let ue2 = (() => !(!S2 || x2))();
10508
- y$2(w$12, (t2) => {
10509
- t2.preventDefault(), P2();
10510
- }, ue2);
10511
- let fe = (() => !(x2 || p2 !== 0))();
10512
- E(g2 == null ? void 0 : g2.defaultView, "keydown", (t2) => {
10513
- fe && (t2.defaultPrevented || t2.key === o.Escape && (t2.preventDefault(), t2.stopPropagation(), P2()));
10092
+ if (typeof a2 != "boolean")
10093
+ throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${a2}`);
10094
+ if (typeof o2 != "function")
10095
+ throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${o2}`);
10096
+ let g = a2 ? 0 : 1, [h2, Q2] = useReducer(Ce$1, { titleId: null, descriptionId: null, panelRef: createRef() }), R = o$3(() => o2(false)), j2 = o$3((T2) => Q2({ type: 0, id: T2 })), x2 = a$2() ? f2 ? false : g === 0 : false, w2 = n$12 > 1, X2 = useContext(H) !== null, Z = w2 ? "parent" : "leaf";
10097
+ M$3(u2, w2 ? x2 : false);
10098
+ let N2 = o$3(() => {
10099
+ var b, D2;
10100
+ return [...Array.from((b = y$1 == null ? void 0 : y$1.querySelectorAll("body > *, [data-headlessui-portal]")) != null ? b : []).filter((E2) => !(!(E2 instanceof HTMLElement) || E2.contains(U2.current) || h2.panelRef.current && E2.contains(h2.panelRef.current))), (D2 = h2.panelRef.current) != null ? D2 : u2.current];
10514
10101
  });
10515
- let ge = (() => !(J || p2 !== 0 || j2))();
10516
- Be(g2, ge, w$12), useEffect(() => {
10517
- if (p2 !== 0 || !D2.current)
10102
+ L(() => N2(), R, x2 && !w2), E(y$1 == null ? void 0 : y$1.defaultView, "keydown", (T2) => {
10103
+ T2.defaultPrevented || T2.key === o$1.Escape && g === 0 && (w2 || (T2.preventDefault(), T2.stopPropagation(), R()));
10104
+ }), Oe(y$1, g === 0 && !X2, N2), useEffect(() => {
10105
+ if (g !== 0 || !u2.current)
10518
10106
  return;
10519
- let t2 = new ResizeObserver((c2) => {
10520
- for (let d2 of c2) {
10521
- let F2 = d2.target.getBoundingClientRect();
10522
- F2.x === 0 && F2.y === 0 && F2.width === 0 && F2.height === 0 && P2();
10523
- }
10107
+ let T2 = new IntersectionObserver((b) => {
10108
+ for (let D2 of b)
10109
+ D2.boundingClientRect.x === 0 && D2.boundingClientRect.y === 0 && D2.boundingClientRect.width === 0 && D2.boundingClientRect.height === 0 && R();
10524
10110
  });
10525
- return t2.observe(D2.current), () => t2.disconnect();
10526
- }, [p2, D2, P2]);
10527
- let [Te, ce] = w(), De2 = useMemo(() => [{ dialogState: p2, close: P2, setTitleId: Y2 }, h2], [p2, h2, P2, Y2]), X2 = useMemo(() => ({ open: p2 === 0 }), [p2]), me = { ref: ee$1, id: i2, role: a2, "aria-modal": p2 === 0 ? true : void 0, "aria-labelledby": h2.titleId, "aria-describedby": Te };
10528
- return React__default.createElement(b$2, { type: "Dialog", enabled: p2 === 0, element: D2, onUpdate: o$4((t2, c2) => {
10529
- c2 === "Dialog" && u$5(t2, { [s.Add]: () => f2((d2) => d2 + 1), [s.Remove]: () => f2((d2) => d2 - 1) });
10530
- }) }, React__default.createElement(l$2, { force: true }, React__default.createElement(te, null, React__default.createElement(I$1.Provider, { value: De2 }, React__default.createElement(te.Group, { target: D2 }, React__default.createElement(l$2, { force: false }, React__default.createElement(ce, { slot: X2, name: "Dialog.Description" }, React__default.createElement(de, { initialFocus: s$12, containers: w$12, features: S2 ? u$5(ae2, { parent: de.features.RestoreFocus, leaf: de.features.All & ~de.features.FocusLock }) : de.features.None }, React__default.createElement(re, null, C({ ourProps: me, theirProps: m2, slot: X2, defaultTag: Ne$1, features: Ue, visible: p2 === 0, name: "Dialog" }))))))))), React__default.createElement(le2, null));
10531
- }
10532
- let $e = "div";
10533
- function Ye(o2, e2) {
10534
- let r2 = I$5(), { id: i2 = `headlessui-dialog-overlay-${r2}`, ...n2 } = o2, [{ dialogState: l2, close: s2 }] = b$1("Dialog.Overlay"), a2 = y$1(e2), T2 = o$4((f2) => {
10535
- if (f2.target === f2.currentTarget) {
10536
- if (r$2(f2.currentTarget))
10537
- return f2.preventDefault();
10538
- f2.preventDefault(), f2.stopPropagation(), s2();
10539
- }
10540
- }), m2 = useMemo(() => ({ open: l2 === 0 }), [l2]);
10541
- return C({ ourProps: { ref: a2, id: i2, "aria-hidden": true, onClick: T2 }, theirProps: n2, slot: m2, defaultTag: $e, name: "Dialog.Overlay" });
10542
- }
10543
- let je = "div";
10544
- function Je(o2, e2) {
10545
- let r2 = I$5(), { id: i2 = `headlessui-dialog-backdrop-${r2}`, ...n2 } = o2, [{ dialogState: l2 }, s2] = b$1("Dialog.Backdrop"), a2 = y$1(e2);
10111
+ return T2.observe(u2.current), () => T2.disconnect();
10112
+ }, [g, u2, R]);
10113
+ let [ee, te] = k$1(), oe2 = useMemo(() => [{ dialogState: g, close: R, setTitleId: j2 }, h2], [g, h2, R, j2]), V = useMemo(() => ({ open: g === 0 }), [g]), re2 = { ref: _24, id: d2, role: "dialog", "aria-modal": g === 0 ? true : void 0, "aria-labelledby": h2.titleId, "aria-describedby": ee };
10114
+ return React.createElement(M$2, { type: "Dialog", enabled: g === 0, element: u2, onUpdate: o$3((T2, b, D2) => {
10115
+ b === "Dialog" && u$3(T2, { [s.Add]() {
10116
+ P2.current.add(D2), i2((E2) => E2 + 1);
10117
+ }, [s.Remove]() {
10118
+ P2.current.add(D2), i2((E2) => E2 - 1);
10119
+ } });
10120
+ }) }, React.createElement(P$1, { force: true }, React.createElement($, null, React.createElement(H.Provider, { value: oe2 }, React.createElement($.Group, { target: u2 }, React.createElement(P$1, { force: false }, React.createElement(te, { slot: V, name: "Dialog.Description" }, React.createElement(de, { initialFocus: p$12, containers: P2, features: x2 ? u$3(Z, { parent: de.features.RestoreFocus, leaf: de.features.All & ~de.features.FocusLock }) : de.features.None }, $$1({ ourProps: re2, theirProps: c, slot: V, defaultTag: Se$1, features: Le, visible: g === 0, name: "Dialog" })))))))), React.createElement(h$1, { features: s$4.Hidden, ref: U2 }));
10121
+ }), ke = "div", we = C$1(function(e2, r2) {
10122
+ let s2 = I$2(), { id: d2 = `headlessui-dialog-overlay-${s2}`, ...a2 } = e2, [{ dialogState: o2, close: p2 }] = k("Dialog.Overlay"), f2 = y(r2), c = o$3((l2) => {
10123
+ if (l2.target === l2.currentTarget) {
10124
+ if (r$1(l2.currentTarget))
10125
+ return l2.preventDefault();
10126
+ l2.preventDefault(), l2.stopPropagation(), p2();
10127
+ }
10128
+ }), n2 = useMemo(() => ({ open: o2 === 0 }), [o2]);
10129
+ return $$1({ ourProps: { ref: f2, id: d2, "aria-hidden": true, onClick: c }, theirProps: a2, slot: n2, defaultTag: ke, name: "Dialog.Overlay" });
10130
+ }), Fe = "div", Ie = C$1(function(e2, r2) {
10131
+ let s2 = I$2(), { id: d2 = `headlessui-dialog-backdrop-${s2}`, ...a2 } = e2, [{ dialogState: o2 }, p2] = k("Dialog.Backdrop"), f2 = y(r2);
10546
10132
  useEffect(() => {
10547
- if (s2.panelRef.current === null)
10133
+ if (p2.panelRef.current === null)
10548
10134
  throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.");
10549
- }, [s2.panelRef]);
10550
- let T2 = useMemo(() => ({ open: l2 === 0 }), [l2]);
10551
- return React__default.createElement(l$2, { force: true }, React__default.createElement(te, null, C({ ourProps: { ref: a2, id: i2, "aria-hidden": true }, theirProps: n2, slot: T2, defaultTag: je, name: "Dialog.Backdrop" })));
10552
- }
10553
- let Xe = "div";
10554
- function Ke(o2, e2) {
10555
- let r2 = I$5(), { id: i2 = `headlessui-dialog-panel-${r2}`, ...n2 } = o2, [{ dialogState: l2 }, s2] = b$1("Dialog.Panel"), a2 = y$1(e2, s2.panelRef), T2 = useMemo(() => ({ open: l2 === 0 }), [l2]), m2 = o$4((f2) => {
10556
- f2.stopPropagation();
10135
+ }, [p2.panelRef]);
10136
+ let c = useMemo(() => ({ open: o2 === 0 }), [o2]);
10137
+ return React.createElement(P$1, { force: true }, React.createElement($, null, $$1({ ourProps: { ref: f2, id: d2, "aria-hidden": true }, theirProps: a2, slot: c, defaultTag: Fe, name: "Dialog.Backdrop" })));
10138
+ }), He = "div", _e = C$1(function(e2, r2) {
10139
+ let s2 = I$2(), { id: d2 = `headlessui-dialog-panel-${s2}`, ...a2 } = e2, [{ dialogState: o2 }, p2] = k("Dialog.Panel"), f2 = y(r2, p2.panelRef), c = useMemo(() => ({ open: o2 === 0 }), [o2]), n2 = o$3((l2) => {
10140
+ l2.stopPropagation();
10557
10141
  });
10558
- return C({ ourProps: { ref: a2, id: i2, onClick: m2 }, theirProps: n2, slot: T2, defaultTag: Xe, name: "Dialog.Panel" });
10559
- }
10560
- let Ve = "h2";
10561
- function qe$1(o2, e2) {
10562
- let r2 = I$5(), { id: i2 = `headlessui-dialog-title-${r2}`, ...n2 } = o2, [{ dialogState: l2, setTitleId: s2 }] = b$1("Dialog.Title"), a2 = y$1(e2);
10563
- useEffect(() => (s2(i2), () => s2(null)), [i2, s2]);
10564
- let T2 = useMemo(() => ({ open: l2 === 0 }), [l2]);
10565
- return C({ ourProps: { ref: a2, id: i2 }, theirProps: n2, slot: T2, defaultTag: Ve, name: "Dialog.Title" });
10566
- }
10567
- let ze = U$2(We), Qe = U$2(Je), Ze = U$2(Ke), et = U$2(Ye), tt = U$2(qe$1), _t = Object.assign(ze, { Backdrop: Qe, Panel: Ze, Overlay: et, Title: tt, Description: G });
10568
- function c(a2 = 0) {
10569
- let [l2, r2] = useState(a2), t2 = f$3(), o2 = useCallback((e2) => {
10570
- t2.current && r2((u2) => u2 | e2);
10571
- }, [l2, t2]), m2 = useCallback((e2) => Boolean(l2 & e2), [l2]), s2 = useCallback((e2) => {
10572
- t2.current && r2((u2) => u2 & ~e2);
10573
- }, [r2, t2]), g2 = useCallback((e2) => {
10574
- t2.current && r2((u2) => u2 ^ e2);
10575
- }, [r2]);
10576
- return { flags: l2, addFlag: o2, hasFlag: m2, removeFlag: s2, toggleFlag: g2 };
10577
- }
10142
+ return $$1({ ourProps: { ref: f2, id: d2, onClick: n2 }, theirProps: a2, slot: c, defaultTag: He, name: "Dialog.Panel" });
10143
+ }), xe$1 = "h2", We = C$1(function(e2, r2) {
10144
+ let s2 = I$2(), { id: d2 = `headlessui-dialog-title-${s2}`, ...a2 } = e2, [{ dialogState: o2, setTitleId: p2 }] = k("Dialog.Title"), f2 = y(r2);
10145
+ useEffect(() => (p2(d2), () => p2(null)), [d2, p2]);
10146
+ let c = useMemo(() => ({ open: o2 === 0 }), [o2]);
10147
+ return $$1({ ourProps: { ref: f2, id: d2 }, theirProps: a2, slot: c, defaultTag: xe$1, name: "Dialog.Title" });
10148
+ }), mt = Object.assign(Me, { Backdrop: Ie, Panel: _e, Overlay: we, Title: We, Description: F$1 });
10578
10149
  function l(r2) {
10579
10150
  let e2 = { called: false };
10580
10151
  return (...t2) => {
@@ -10582,204 +10153,181 @@ function l(r2) {
10582
10153
  return e2.called = true, r2(...t2);
10583
10154
  };
10584
10155
  }
10585
- function g(t2, ...e2) {
10156
+ function v(t2, ...e2) {
10586
10157
  t2 && e2.length > 0 && t2.classList.add(...e2);
10587
10158
  }
10588
- function v(t2, ...e2) {
10159
+ function f(t2, ...e2) {
10589
10160
  t2 && e2.length > 0 && t2.classList.remove(...e2);
10590
10161
  }
10591
- function b(t2, e2) {
10592
- let n2 = o$3();
10162
+ function F(t2, e2) {
10163
+ let n2 = m$2();
10593
10164
  if (!t2)
10594
10165
  return n2.dispose;
10595
- let { transitionDuration: m2, transitionDelay: a2 } = getComputedStyle(t2), [u2, p2] = [m2, a2].map((l2) => {
10596
- let [r2 = 0] = l2.split(",").filter(Boolean).map((i2) => i2.includes("ms") ? parseFloat(i2) : parseFloat(i2) * 1e3).sort((i2, T2) => T2 - i2);
10166
+ let { transitionDuration: a2, transitionDelay: i2 } = getComputedStyle(t2), [m2, d2] = [a2, i2].map((o2) => {
10167
+ let [r2 = 0] = o2.split(",").filter(Boolean).map((l2) => l2.includes("ms") ? parseFloat(l2) : parseFloat(l2) * 1e3).sort((l2, g) => g - l2);
10597
10168
  return r2;
10598
- }), o2 = u2 + p2;
10599
- if (o2 !== 0) {
10600
- n2.group((r2) => {
10601
- r2.setTimeout(() => {
10602
- e2(), r2.dispose();
10603
- }, o2), r2.addEventListener(t2, "transitionrun", (i2) => {
10604
- i2.target === i2.currentTarget && r2.dispose();
10605
- });
10606
- });
10607
- let l2 = n2.addEventListener(t2, "transitionend", (r2) => {
10608
- r2.target === r2.currentTarget && (e2(), l2());
10169
+ });
10170
+ if (m2 + d2 !== 0) {
10171
+ let o2 = n2.addEventListener(t2, "transitionend", (r2) => {
10172
+ r2.target === r2.currentTarget && (e2(), o2());
10609
10173
  });
10610
10174
  } else
10611
10175
  e2();
10612
10176
  return n2.add(() => e2()), n2.dispose;
10613
10177
  }
10614
- function M$1(t2, e2, n2, m2) {
10615
- let a2 = n2 ? "enter" : "leave", u2 = o$3(), p2 = m2 !== void 0 ? l(m2) : () => {
10178
+ function M$1(t2, e2, n2, a2) {
10179
+ let i2 = n2 ? "enter" : "leave", m2 = m$2(), d2 = a2 !== void 0 ? l(a2) : () => {
10616
10180
  };
10617
- a2 === "enter" && (t2.removeAttribute("hidden"), t2.style.display = "");
10618
- let o2 = u$5(a2, { enter: () => e2.enter, leave: () => e2.leave }), l$12 = u$5(a2, { enter: () => e2.enterTo, leave: () => e2.leaveTo }), r2 = u$5(a2, { enter: () => e2.enterFrom, leave: () => e2.leaveFrom });
10619
- return v(t2, ...e2.base, ...e2.enter, ...e2.enterTo, ...e2.enterFrom, ...e2.leave, ...e2.leaveFrom, ...e2.leaveTo, ...e2.entered), g(t2, ...e2.base, ...o2, ...r2), u2.nextFrame(() => {
10620
- v(t2, ...e2.base, ...o2, ...r2), g(t2, ...e2.base, ...o2, ...l$12), b(t2, () => (v(t2, ...e2.base, ...o2), g(t2, ...e2.base, ...e2.entered), p2()));
10621
- }), u2.dispose;
10622
- }
10623
- function D({ immediate: t2, container: s2, direction: n2, classes: u2, onStart: a2, onStop: c2 }) {
10624
- let l2 = f$3(), d2 = p$3(), e2 = s$7(n2);
10625
- l$5(() => {
10626
- t2 && (e2.current = "enter");
10627
- }, [t2]), l$5(() => {
10628
- let r2 = o$3();
10629
- d2.add(r2.dispose);
10630
- let i2 = s2.current;
10631
- if (i2 && e2.current !== "idle" && l2.current)
10632
- return r2.dispose(), a2.current(e2.current), r2.add(M$1(i2, u2.current, e2.current === "enter", () => {
10633
- r2.dispose(), c2.current(e2.current);
10634
- })), r2.dispose;
10635
- }, [n2]);
10181
+ i2 === "enter" && (t2.removeAttribute("hidden"), t2.style.display = "");
10182
+ let u2 = u$3(i2, { enter: () => e2.enter, leave: () => e2.leave }), o2 = u$3(i2, { enter: () => e2.enterTo, leave: () => e2.leaveTo }), r2 = u$3(i2, { enter: () => e2.enterFrom, leave: () => e2.leaveFrom });
10183
+ return f(t2, ...e2.enter, ...e2.enterTo, ...e2.enterFrom, ...e2.leave, ...e2.leaveFrom, ...e2.leaveTo, ...e2.entered), v(t2, ...u2, ...r2), m2.nextFrame(() => {
10184
+ f(t2, ...r2), v(t2, ...o2), F(t2, () => (f(t2, ...u2), v(t2, ...e2.entered), d2()));
10185
+ }), m2.dispose;
10186
+ }
10187
+ function D({ container: i2, direction: t2, classes: o2, onStart: s2, onStop: u2 }) {
10188
+ let a2 = f$1(), c = p$2(), r2 = s$5(t2);
10189
+ s$6(() => {
10190
+ let e2 = m$2();
10191
+ c.add(e2.dispose);
10192
+ let n2 = i2.current;
10193
+ if (!!n2 && r2.current !== "idle" && !!a2.current)
10194
+ return e2.dispose(), s2.current(r2.current), e2.add(M$1(n2, o2.current, r2.current === "enter", () => {
10195
+ e2.dispose(), u2.current(r2.current);
10196
+ })), e2.dispose;
10197
+ }, [t2]);
10198
+ }
10199
+ function e(...n2) {
10200
+ return n2.filter(Boolean).join(" ");
10636
10201
  }
10637
- function S(t2 = "") {
10638
- return t2.split(/\s+/).filter((n2) => n2.length > 1);
10202
+ function P(i2 = "") {
10203
+ return i2.split(" ").filter((e2) => e2.trim().length > 1);
10639
10204
  }
10640
- let I = createContext(null);
10641
- I.displayName = "TransitionContext";
10642
- var Se = ((r2) => (r2.Visible = "visible", r2.Hidden = "hidden", r2))(Se || {});
10643
- function ye() {
10644
- let t2 = useContext(I);
10645
- if (t2 === null)
10205
+ let A = createContext(null);
10206
+ A.displayName = "TransitionContext";
10207
+ var Ce = ((s2) => (s2.Visible = "visible", s2.Hidden = "hidden", s2))(Ce || {});
10208
+ function ge() {
10209
+ let i2 = useContext(A);
10210
+ if (i2 === null)
10646
10211
  throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
10647
- return t2;
10212
+ return i2;
10648
10213
  }
10649
- function xe() {
10650
- let t2 = useContext(M);
10651
- if (t2 === null)
10214
+ function be() {
10215
+ let i2 = useContext(M);
10216
+ if (i2 === null)
10652
10217
  throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
10653
- return t2;
10218
+ return i2;
10654
10219
  }
10655
10220
  let M = createContext(null);
10656
10221
  M.displayName = "NestingContext";
10657
- function U(t2) {
10658
- return "children" in t2 ? U(t2.children) : t2.current.filter(({ el: n2 }) => n2.current !== null).filter(({ state: n2 }) => n2 === "visible").length > 0;
10659
- }
10660
- function se(t2, n2) {
10661
- let r2 = s$7(t2), s2 = useRef([]), R2 = f$3(), D2 = p$3(), p2 = o$4((i2, e2 = v$1.Hidden) => {
10662
- let a2 = s2.current.findIndex(({ el: o2 }) => o2 === i2);
10663
- a2 !== -1 && (u$5(e2, { [v$1.Unmount]() {
10664
- s2.current.splice(a2, 1);
10665
- }, [v$1.Hidden]() {
10666
- s2.current[a2].state = "hidden";
10667
- } }), D2.microTask(() => {
10222
+ function I(i2) {
10223
+ return "children" in i2 ? I(i2.children) : i2.current.filter(({ el: e2 }) => e2.current !== null).filter(({ state: e2 }) => e2 === "visible").length > 0;
10224
+ }
10225
+ function ne(i2, e2) {
10226
+ let s2 = s$5(i2), n2 = useRef([]), m2 = f$1(), R = p$2(), b = o$3((l2, r2 = j$1.Hidden) => {
10227
+ let t2 = n2.current.findIndex(({ el: o2 }) => o2 === l2);
10228
+ t2 !== -1 && (u$3(r2, { [j$1.Unmount]() {
10229
+ n2.current.splice(t2, 1);
10230
+ }, [j$1.Hidden]() {
10231
+ n2.current[t2].state = "hidden";
10232
+ } }), R.microTask(() => {
10668
10233
  var o2;
10669
- !U(s2) && R2.current && ((o2 = r2.current) == null || o2.call(r2));
10234
+ !I(n2) && m2.current && ((o2 = s2.current) == null || o2.call(s2));
10670
10235
  }));
10671
- }), x2 = o$4((i2) => {
10672
- let e2 = s2.current.find(({ el: a2 }) => a2 === i2);
10673
- return e2 ? e2.state !== "visible" && (e2.state = "visible") : s2.current.push({ el: i2, state: "visible" }), () => p2(i2, v$1.Unmount);
10674
- }), h2 = useRef([]), v2 = useRef(Promise.resolve()), u2 = useRef({ enter: [], leave: [], idle: [] }), g2 = o$4((i2, e2, a2) => {
10675
- h2.current.splice(0), n2 && (n2.chains.current[e2] = n2.chains.current[e2].filter(([o2]) => o2 !== i2)), n2 == null || n2.chains.current[e2].push([i2, new Promise((o2) => {
10676
- h2.current.push(o2);
10677
- })]), n2 == null || n2.chains.current[e2].push([i2, new Promise((o2) => {
10678
- Promise.all(u2.current[e2].map(([f2, N2]) => N2)).then(() => o2());
10679
- })]), e2 === "enter" ? v2.current = v2.current.then(() => n2 == null ? void 0 : n2.wait.current).then(() => a2(e2)) : a2(e2);
10680
- }), d2 = o$4((i2, e2, a2) => {
10681
- Promise.all(u2.current[e2].splice(0).map(([o2, f2]) => f2)).then(() => {
10236
+ }), E2 = o$3((l2) => {
10237
+ let r2 = n2.current.find(({ el: t2 }) => t2 === l2);
10238
+ return r2 ? r2.state !== "visible" && (r2.state = "visible") : n2.current.push({ el: l2, state: "visible" }), () => b(l2, j$1.Unmount);
10239
+ }), S2 = useRef([]), u2 = useRef(Promise.resolve()), p2 = useRef({ enter: [], leave: [], idle: [] }), d2 = o$3((l2, r2, t2) => {
10240
+ S2.current.splice(0), e2 && (e2.chains.current[r2] = e2.chains.current[r2].filter(([o2]) => o2 !== l2)), e2 == null || e2.chains.current[r2].push([l2, new Promise((o2) => {
10241
+ S2.current.push(o2);
10242
+ })]), e2 == null || e2.chains.current[r2].push([l2, new Promise((o2) => {
10243
+ Promise.all(p2.current[r2].map(([f2, a2]) => a2)).then(() => o2());
10244
+ })]), r2 === "enter" ? u2.current = u2.current.then(() => e2 == null ? void 0 : e2.wait.current).then(() => t2(r2)) : t2(r2);
10245
+ }), v2 = o$3((l2, r2, t2) => {
10246
+ Promise.all(p2.current[r2].splice(0).map(([o2, f2]) => f2)).then(() => {
10682
10247
  var o2;
10683
- (o2 = h2.current.shift()) == null || o2();
10684
- }).then(() => a2(e2));
10248
+ (o2 = S2.current.shift()) == null || o2();
10249
+ }).then(() => t2(r2));
10685
10250
  });
10686
- return useMemo(() => ({ children: s2, register: x2, unregister: p2, onStart: g2, onStop: d2, wait: v2, chains: u2 }), [x2, p2, s2, g2, d2, u2, v2]);
10251
+ return useMemo(() => ({ children: n2, register: E2, unregister: b, onStart: d2, onStop: v2, wait: u2, chains: p2 }), [E2, b, n2, d2, v2, p2, u2]);
10687
10252
  }
10688
- function Ne() {
10253
+ function Ee() {
10689
10254
  }
10690
- let Pe = ["beforeEnter", "afterEnter", "beforeLeave", "afterLeave"];
10691
- function ae(t2) {
10692
- var r2;
10693
- let n2 = {};
10694
- for (let s2 of Pe)
10695
- n2[s2] = (r2 = t2[s2]) != null ? r2 : Ne;
10696
- return n2;
10255
+ let Se = ["beforeEnter", "afterEnter", "beforeLeave", "afterLeave"];
10256
+ function re(i2) {
10257
+ var s2;
10258
+ let e2 = {};
10259
+ for (let n2 of Se)
10260
+ e2[n2] = (s2 = i2[n2]) != null ? s2 : Ee;
10261
+ return e2;
10697
10262
  }
10698
- function Re(t2) {
10699
- let n2 = useRef(ae(t2));
10263
+ function xe(i2) {
10264
+ let e2 = useRef(re(i2));
10700
10265
  return useEffect(() => {
10701
- n2.current = ae(t2);
10702
- }, [t2]), n2;
10703
- }
10704
- let De = "div", le = O.RenderStrategy;
10705
- function He(t2, n2) {
10706
- var Q2, Y2;
10707
- let { beforeEnter: r2, afterEnter: s2, beforeLeave: R2, afterLeave: D$12, enter: p2, enterFrom: x2, enterTo: h2, entered: v2, leave: u2, leaveFrom: g2, leaveTo: d2, ...i2 } = t2, e2 = useRef(null), a2 = y$1(e2, n2), o2 = (Q2 = i2.unmount) == null || Q2 ? v$1.Unmount : v$1.Hidden, { show: f2, appear: N2, initial: T2 } = ye(), [l2, j2] = useState(f2 ? "visible" : "hidden"), z2 = xe(), { register: L, unregister: O2 } = z2;
10708
- useEffect(() => L(e2), [L, e2]), useEffect(() => {
10709
- if (o2 === v$1.Hidden && e2.current) {
10710
- if (f2 && l2 !== "visible") {
10711
- j2("visible");
10266
+ e2.current = re(i2);
10267
+ }, [i2]), e2;
10268
+ }
10269
+ let Pe = "div", ie = S$1.RenderStrategy, oe = C$1(function(e$12, s2) {
10270
+ let { beforeEnter: n2, afterEnter: m2, beforeLeave: R, afterLeave: b, enter: E2, enterFrom: S2, enterTo: u2, entered: p$12, leave: d2, leaveFrom: v2, leaveTo: l2, ...r2 } = e$12, t2 = useRef(null), o2 = y(t2, s2), f2 = r2.unmount ? j$1.Unmount : j$1.Hidden, { show: a2, appear: x2, initial: se } = ge(), [h2, _24] = useState(a2 ? "visible" : "hidden"), K = be(), { register: D$1, unregister: V } = K, j2 = useRef(null);
10271
+ useEffect(() => D$1(t2), [D$1, t2]), useEffect(() => {
10272
+ if (f2 === j$1.Hidden && !!t2.current) {
10273
+ if (a2 && h2 !== "visible") {
10274
+ _24("visible");
10712
10275
  return;
10713
10276
  }
10714
- return u$5(l2, { ["hidden"]: () => O2(e2), ["visible"]: () => L(e2) });
10277
+ return u$3(h2, { ["hidden"]: () => V(t2), ["visible"]: () => D$1(t2) });
10715
10278
  }
10716
- }, [l2, e2, L, O2, f2, o2]);
10717
- let k2 = s$7({ base: S(i2.className), enter: S(p2), enterFrom: S(x2), enterTo: S(h2), entered: S(v2), leave: S(u2), leaveFrom: S(g2), leaveTo: S(d2) }), V = Re({ beforeEnter: r2, afterEnter: s2, beforeLeave: R2, afterLeave: D$12 }), G2 = l$4();
10279
+ }, [h2, t2, D$1, V, a2, f2]);
10280
+ let U2 = s$5({ enter: P(E2), enterFrom: P(S2), enterTo: P(u2), entered: P(p$12), leave: P(d2), leaveFrom: P(v2), leaveTo: P(l2) }), w2 = xe({ beforeEnter: n2, afterEnter: m2, beforeLeave: R, afterLeave: b }), k2 = a$2();
10718
10281
  useEffect(() => {
10719
- if (G2 && l2 === "visible" && e2.current === null)
10282
+ if (k2 && h2 === "visible" && t2.current === null)
10720
10283
  throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
10721
- }, [e2, l2, G2]);
10722
- let Te = T2 && !N2, K = N2 && f2 && T2, de2 = (() => !G2 || Te ? "idle" : f2 ? "enter" : "leave")(), H2 = c(0), fe = o$4((C2) => u$5(C2, { enter: () => {
10723
- H2.addFlag(d$3.Opening), V.current.beforeEnter();
10724
- }, leave: () => {
10725
- H2.addFlag(d$3.Closing), V.current.beforeLeave();
10726
- }, idle: () => {
10727
- } })), me = o$4((C2) => u$5(C2, { enter: () => {
10728
- H2.removeFlag(d$3.Opening), V.current.afterEnter();
10729
- }, leave: () => {
10730
- H2.removeFlag(d$3.Closing), V.current.afterLeave();
10731
- }, idle: () => {
10732
- } })), w2 = se(() => {
10733
- j2("hidden"), O2(e2);
10734
- }, z2), B = useRef(false);
10735
- D({ immediate: K, container: e2, classes: k2, direction: de2, onStart: s$7((C2) => {
10736
- B.current = true, w2.onStart(e2, C2, fe);
10737
- }), onStop: s$7((C2) => {
10738
- B.current = false, w2.onStop(e2, C2, me), C2 === "leave" && !U(w2) && (j2("hidden"), O2(e2));
10739
- }) });
10740
- let P2 = i2, ce = { ref: a2 };
10741
- return K ? P2 = { ...P2, className: t$4(i2.className, ...k2.current.enter, ...k2.current.enterFrom) } : B.current && (P2.className = t$4(i2.className, (Y2 = e2.current) == null ? void 0 : Y2.className), P2.className === "" && delete P2.className), React__default.createElement(M.Provider, { value: w2 }, React__default.createElement(s$3, { value: u$5(l2, { ["visible"]: d$3.Open, ["hidden"]: d$3.Closed }) | H2.flags }, C({ ourProps: ce, theirProps: P2, defaultTag: De, features: le, visible: l2 === "visible", name: "Transition.Child" })));
10742
- }
10743
- function Fe(t2, n2) {
10744
- let { show: r2, appear: s2 = false, unmount: R2 = true, ...D2 } = t2, p2 = useRef(null), x2 = y$1(p2, n2);
10745
- l$4();
10746
- let h2 = u$2();
10747
- if (r2 === void 0 && h2 !== null && (r2 = (h2 & d$3.Open) === d$3.Open), ![true, false].includes(r2))
10284
+ }, [t2, h2, k2]);
10285
+ let G = se && !x2, le = (() => !k2 || G || j2.current === a2 ? "idle" : a2 ? "enter" : "leave")(), ae = o$3((C2) => u$3(C2, { enter: () => w2.current.beforeEnter(), leave: () => w2.current.beforeLeave(), idle: () => {
10286
+ } })), ue = o$3((C2) => u$3(C2, { enter: () => w2.current.afterEnter(), leave: () => w2.current.afterLeave(), idle: () => {
10287
+ } })), L2 = ne(() => {
10288
+ _24("hidden"), V(t2);
10289
+ }, K);
10290
+ D({ container: t2, classes: U2, direction: le, onStart: s$5((C2) => {
10291
+ L2.onStart(t2, C2, ae);
10292
+ }), onStop: s$5((C2) => {
10293
+ L2.onStop(t2, C2, ue), C2 === "leave" && !I(L2) && (_24("hidden"), V(t2));
10294
+ }) }), useEffect(() => {
10295
+ !G || (f2 === j$1.Hidden ? j2.current = null : j2.current = a2);
10296
+ }, [a2, G, h2]);
10297
+ let B = r2, de2 = { ref: o2 };
10298
+ return x2 && a2 && (typeof window == "undefined" || typeof document == "undefined") && (B = { ...B, className: e(r2.className, ...U2.current.enter, ...U2.current.enterFrom) }), React.createElement(M.Provider, { value: L2 }, React.createElement(C, { value: u$3(h2, { ["visible"]: p.Open, ["hidden"]: p.Closed }) }, $$1({ ourProps: de2, theirProps: B, defaultTag: Pe, features: ie, visible: h2 === "visible", name: "Transition.Child" })));
10299
+ }), J = C$1(function(e2, s2) {
10300
+ let { show: n2, appear: m2 = false, unmount: R, ...b } = e2, E2 = useRef(null), S2 = y(E2, s2);
10301
+ a$2();
10302
+ let u2 = s$3();
10303
+ if (n2 === void 0 && u2 !== null && (n2 = u$3(u2, { [p.Open]: true, [p.Closed]: false })), ![true, false].includes(n2))
10748
10304
  throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
10749
- let [v2, u2] = useState(r2 ? "visible" : "hidden"), g2 = se(() => {
10750
- u2("hidden");
10751
- }), [d2, i2] = useState(true), e2 = useRef([r2]);
10752
- l$5(() => {
10753
- d2 !== false && e2.current[e2.current.length - 1] !== r2 && (e2.current.push(r2), i2(false));
10754
- }, [e2, r2]);
10755
- let a2 = useMemo(() => ({ show: r2, appear: s2, initial: d2 }), [r2, s2, d2]);
10305
+ let [p$12, d2] = useState(n2 ? "visible" : "hidden"), v2 = ne(() => {
10306
+ d2("hidden");
10307
+ }), [l2, r2] = useState(true), t2 = useRef([n2]);
10308
+ s$6(() => {
10309
+ l2 !== false && t2.current[t2.current.length - 1] !== n2 && (t2.current.push(n2), r2(false));
10310
+ }, [t2, n2]);
10311
+ let o2 = useMemo(() => ({ show: n2, appear: m2, initial: l2 }), [n2, m2, l2]);
10756
10312
  useEffect(() => {
10757
- if (r2)
10758
- u2("visible");
10759
- else if (!U(g2))
10760
- u2("hidden");
10313
+ if (n2)
10314
+ d2("visible");
10315
+ else if (!I(v2))
10316
+ d2("hidden");
10761
10317
  else {
10762
- let T2 = p2.current;
10763
- if (!T2)
10318
+ let a2 = E2.current;
10319
+ if (!a2)
10764
10320
  return;
10765
- let l2 = T2.getBoundingClientRect();
10766
- l2.x === 0 && l2.y === 0 && l2.width === 0 && l2.height === 0 && u2("hidden");
10767
- }
10768
- }, [r2, g2]);
10769
- let o2 = { unmount: R2 }, f2 = o$4(() => {
10770
- var T2;
10771
- d2 && i2(false), (T2 = t2.beforeEnter) == null || T2.call(t2);
10772
- }), N2 = o$4(() => {
10773
- var T2;
10774
- d2 && i2(false), (T2 = t2.beforeLeave) == null || T2.call(t2);
10775
- });
10776
- return React__default.createElement(M.Provider, { value: g2 }, React__default.createElement(I.Provider, { value: a2 }, C({ ourProps: { ...o2, as: Fragment$1, children: React__default.createElement(ue, { ref: x2, ...o2, ...D2, beforeEnter: f2, beforeLeave: N2 }) }, theirProps: {}, defaultTag: Fragment$1, features: le, visible: v2 === "visible", name: "Transition" })));
10777
- }
10778
- function _e(t2, n2) {
10779
- let r2 = useContext(I) !== null, s2 = u$2() !== null;
10780
- return React__default.createElement(React__default.Fragment, null, !r2 && s2 ? React__default.createElement(q, { ref: n2, ...t2 }) : React__default.createElement(ue, { ref: n2, ...t2 }));
10781
- }
10782
- let q = U$2(Fe), ue = U$2(He), Le = U$2(_e), qe = Object.assign(q, { Child: Le, Root: q });
10321
+ let x2 = a2.getBoundingClientRect();
10322
+ x2.x === 0 && x2.y === 0 && x2.width === 0 && x2.height === 0 && d2("hidden");
10323
+ }
10324
+ }, [n2, v2]);
10325
+ let f2 = { unmount: R };
10326
+ return React.createElement(M.Provider, { value: v2 }, React.createElement(A.Provider, { value: o2 }, $$1({ ourProps: { ...f2, as: Fragment$1, children: React.createElement(oe, { ref: S2, ...f2, ...b }) }, theirProps: {}, defaultTag: Fragment$1, features: ie, visible: p$12 === "visible", name: "Transition" })));
10327
+ }), ye = C$1(function(e2, s2) {
10328
+ let n2 = useContext(A) !== null, m2 = s$3() !== null;
10329
+ return React.createElement(React.Fragment, null, !n2 && m2 ? React.createElement(J, { ref: s2, ...e2 }) : React.createElement(oe, { ref: s2, ...e2 }));
10330
+ }), Je = Object.assign(J, { Child: ye, Root: J });
10783
10331
  function Modal(props) {
10784
10332
  const {
10785
10333
  children,
@@ -10792,11 +10340,11 @@ function Modal(props) {
10792
10340
  isModal: true
10793
10341
  });
10794
10342
  return /* @__PURE__ */ jsx(Fragment, {
10795
- children: /* @__PURE__ */ jsx(qe, {
10343
+ children: /* @__PURE__ */ jsx(Je, {
10796
10344
  appear: true,
10797
10345
  show: isOpen,
10798
10346
  as: Fragment$1,
10799
- children: /* @__PURE__ */ jsx(_t, {
10347
+ children: /* @__PURE__ */ jsx(mt, {
10800
10348
  as: "div",
10801
10349
  className: "fixed inset-0 z-10 overflow-y-auto",
10802
10350
  style: {
@@ -10805,7 +10353,7 @@ function Modal(props) {
10805
10353
  onClose: handleClose,
10806
10354
  children: /* @__PURE__ */ jsxs("div", {
10807
10355
  className: "min-h-screen text-center sm:px-4",
10808
- children: [/* @__PURE__ */ jsx(qe.Child, {
10356
+ children: [/* @__PURE__ */ jsx(Je.Child, {
10809
10357
  as: Fragment$1,
10810
10358
  enter: "ease-out duration-300",
10811
10359
  enterFrom: "opacity-0",
@@ -10813,14 +10361,14 @@ function Modal(props) {
10813
10361
  leave: "ease-in duration-200",
10814
10362
  leaveFrom: "opacity-100",
10815
10363
  leaveTo: "opacity-0",
10816
- children: /* @__PURE__ */ jsx(_t.Overlay, {
10364
+ children: /* @__PURE__ */ jsx(mt.Overlay, {
10817
10365
  className: "fixed inset-0"
10818
10366
  })
10819
10367
  }), /* @__PURE__ */ jsx("span", {
10820
10368
  className: "inline-block h-screen align-middle",
10821
10369
  "aria-hidden": "true",
10822
10370
  children: "\u200B"
10823
- }), /* @__PURE__ */ jsx(qe.Child, {
10371
+ }), /* @__PURE__ */ jsx(Je.Child, {
10824
10372
  as: Fragment$1,
10825
10373
  enter: "ease-out duration-300",
10826
10374
  enterFrom: "opacity-0 scale-95",
@@ -11059,7 +10607,7 @@ const getValidationMap2 = (product, selected = {}, filter, map, nestedLvl = 0) =
11059
10607
  }
11060
10608
  return res;
11061
10609
  };
11062
- const GroupsValidationContext = React__default.createContext(null);
10610
+ const GroupsValidationContext = React.createContext(null);
11063
10611
  function GroupsValidationProvivider({
11064
10612
  rootProduct,
11065
10613
  children
@@ -11125,7 +10673,7 @@ const MenuProductRoot = (props) => {
11125
10673
  });
11126
10674
  };
11127
10675
  var style = "";
11128
- const ProductDataContext = React__default.createContext(null);
10676
+ const ProductDataContext = React.createContext(null);
11129
10677
  function ProductDataProvider({
11130
10678
  rootProduct,
11131
10679
  children