@orderingstack/front-components-product-configurator 1.4.0 → 1.4.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 (47) hide show
  1. package/dist/components/Counter/Counter.d.ts +1 -2
  2. package/dist/components/Counter/Counter.d.ts.map +1 -1
  3. package/dist/components/DisplayState/DisplayState.d.ts +1 -2
  4. package/dist/components/DisplayState/DisplayState.d.ts.map +1 -1
  5. package/dist/components/GroupStateInfo/GroupStateInfo.d.ts +1 -2
  6. package/dist/components/GroupStateInfo/GroupStateInfo.d.ts.map +1 -1
  7. package/dist/components/InfoLine/InfoLine.d.ts +1 -2
  8. package/dist/components/InfoLine/InfoLine.d.ts.map +1 -1
  9. package/dist/components/MenuItemsDispatcher/MenuItemsDispatcher.d.ts +2 -3
  10. package/dist/components/MenuItemsDispatcher/MenuItemsDispatcher.d.ts.map +1 -1
  11. package/dist/components/MenuOptions/MenuOptions.d.ts +1 -2
  12. package/dist/components/MenuOptions/MenuOptions.d.ts.map +1 -1
  13. package/dist/components/MenuOptions/MenuOptionsDefaultUI.d.ts +1 -2
  14. package/dist/components/MenuOptions/MenuOptionsDefaultUI.d.ts.map +1 -1
  15. package/dist/components/MenuProduct/MenuProduct.d.ts +2 -3
  16. package/dist/components/MenuProduct/MenuProduct.d.ts.map +1 -1
  17. package/dist/components/MenuProductRoot/MenuProductRoot.d.ts +1 -2
  18. package/dist/components/MenuProductRoot/MenuProductRoot.d.ts.map +1 -1
  19. package/dist/components/MenuProductRoot/MenuProductRootDefaultUI.d.ts +1 -2
  20. package/dist/components/MenuProductRoot/MenuProductRootDefaultUI.d.ts.map +1 -1
  21. package/dist/components/MenuProductRoot/MenuProductRootDefaultUIModal.d.ts +1 -2
  22. package/dist/components/MenuProductRoot/MenuProductRootDefaultUIModal.d.ts.map +1 -1
  23. package/dist/components/Price/Price.d.ts +1 -2
  24. package/dist/components/Price/Price.d.ts.map +1 -1
  25. package/dist/components/ProductConfigurator/ProductConfigurator.d.ts +1 -2
  26. package/dist/components/ProductConfigurator/ProductConfigurator.d.ts.map +1 -1
  27. package/dist/components/SimpleCheckbox/SimpleCheckbox.d.ts +1 -2
  28. package/dist/components/SimpleCheckbox/SimpleCheckbox.d.ts.map +1 -1
  29. package/dist/components/SimpleRadio/SimpleRadio.d.ts +1 -2
  30. package/dist/components/SimpleRadio/SimpleRadio.d.ts.map +1 -1
  31. package/dist/components/SubmitRow/SubmitRow.d.ts +1 -2
  32. package/dist/components/SubmitRow/SubmitRow.d.ts.map +1 -1
  33. package/dist/context/ProductData.d.ts +1 -1
  34. package/dist/context/ProductData.d.ts.map +1 -1
  35. package/dist/hooks/useEmitFilter.d.ts.map +1 -1
  36. package/dist/index.cjs.js +7 -10
  37. package/dist/index.cjs.js.map +1 -1
  38. package/dist/index.es.js +1723 -1299
  39. package/dist/index.es.js.map +1 -1
  40. package/dist/state/index.d.ts +1 -1
  41. package/dist/state/index.d.ts.map +1 -1
  42. package/dist/style.css +1 -1
  43. package/dist/types/index.d.ts +6 -7
  44. package/dist/types/index.d.ts.map +1 -1
  45. package/dist/utils/filter.d.ts.map +1 -1
  46. package/dist/utils/setSelected.d.ts.map +1 -1
  47. package/package.json +2 -2
package/dist/index.es.js CHANGED
@@ -1,148 +1,118 @@
1
- import React, { useReducer, useRef, useDebugValue, useEffect, useLayoutEffect, useState, useMemo, createContext, useContext, forwardRef, Fragment as Fragment$1, isValidElement, cloneElement, createElement, createRef } from "react";
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";
2
3
  import { useTransition, animated } from "react-spring";
3
4
  import { createPortal } from "react-dom";
4
5
  var tailwind = "";
5
6
  var main = "";
6
- function _typeof$1(obj) {
7
+ function _typeof$1(o2) {
7
8
  "@babel/helpers - typeof";
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)) {
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))
16
17
  throw new TypeError("Cannot call a class as a function");
17
- }
18
18
  }
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;
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;
27
27
  throw new TypeError("@@toPrimitive must return a primitive value.");
28
28
  }
29
- return (hint === "string" ? String : Number)(input);
29
+ return ("string" === r2 ? String : Number)(t2);
30
30
  }
31
- function _toPropertyKey(arg) {
32
- var key = _toPrimitive(arg, "string");
33
- return _typeof$1(key) === "symbol" ? key : String(key);
31
+ function toPropertyKey(t2) {
32
+ var i2 = toPrimitive(t2, "string");
33
+ return "symbol" == _typeof$1(i2) ? i2 : i2 + "";
34
34
  }
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);
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);
43
39
  }
44
40
  }
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", {
41
+ function _createClass(e2, r2, t2) {
42
+ return r2 && _defineProperties(e2.prototype, r2), t2 && _defineProperties(e2, t2), Object.defineProperty(e2, "prototype", {
51
43
  writable: false
52
- });
53
- return Constructor;
44
+ }), e2;
54
45
  }
55
- function _assertThisInitialized(self2) {
56
- if (self2 === void 0) {
46
+ function _assertThisInitialized(e2) {
47
+ if (void 0 === e2)
57
48
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
58
- }
59
- return self2;
49
+ return e2;
60
50
  }
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);
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);
67
55
  }
68
- function _inherits(subClass, superClass) {
69
- if (typeof superClass !== "function" && superClass !== null) {
56
+ function _inherits(t2, e2) {
57
+ if ("function" != typeof e2 && null !== e2)
70
58
  throw new TypeError("Super expression must either be null or a function");
71
- }
72
- subClass.prototype = Object.create(superClass && superClass.prototype, {
59
+ t2.prototype = Object.create(e2 && e2.prototype, {
73
60
  constructor: {
74
- value: subClass,
61
+ value: t2,
75
62
  writable: true,
76
63
  configurable: true
77
64
  }
78
- });
79
- Object.defineProperty(subClass, "prototype", {
65
+ }), Object.defineProperty(t2, "prototype", {
80
66
  writable: false
81
- });
82
- if (superClass)
83
- _setPrototypeOf(subClass, superClass);
67
+ }), e2 && _setPrototypeOf(t2, e2);
84
68
  }
85
- function _possibleConstructorReturn(self2, call) {
86
- if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
87
- return call;
88
- } else if (call !== void 0) {
69
+ function _possibleConstructorReturn(t2, e2) {
70
+ if (e2 && ("object" == _typeof$1(e2) || "function" == typeof e2))
71
+ return e2;
72
+ if (void 0 !== e2)
89
73
  throw new TypeError("Derived constructors may only return object or undefined");
90
- }
91
- return _assertThisInitialized(self2);
92
- }
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);
98
- }
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;
110
- }
111
- return obj;
112
- }
113
- function _arrayWithHoles$1(arr2) {
114
- if (Array.isArray(arr2))
115
- return arr2;
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;
116
92
  }
117
- function _iterableToArray$1(iter) {
118
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
119
- return Array.from(iter);
93
+ function _iterableToArray$1(r2) {
94
+ if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"])
95
+ return Array.from(r2);
120
96
  }
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;
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;
127
102
  }
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);
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;
109
+ }
140
110
  }
141
111
  function _nonIterableRest$1() {
142
112
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
143
113
  }
144
- function _toArray$1(arr2) {
145
- return _arrayWithHoles$1(arr2) || _iterableToArray$1(arr2) || _unsupportedIterableToArray$1(arr2) || _nonIterableRest$1();
114
+ function _toArray$1(r2) {
115
+ return _arrayWithHoles$1(r2) || _iterableToArray$1(r2) || _unsupportedIterableToArray$1(r2) || _nonIterableRest$1();
146
116
  }
147
117
  function ownKeys$2(object, enumerableOnly) {
148
118
  var keys2 = Object.keys(object);
@@ -434,13 +404,13 @@ var chars = [" ", ",", "?", "!", ";"];
434
404
  function looksLikeObjectPath(key, nsSeparator, keySeparator) {
435
405
  nsSeparator = nsSeparator || "";
436
406
  keySeparator = keySeparator || "";
437
- var possibleChars = chars.filter(function(c) {
438
- return nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0;
407
+ var possibleChars = chars.filter(function(c2) {
408
+ return nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0;
439
409
  });
440
410
  if (possibleChars.length === 0)
441
411
  return true;
442
- var r2 = new RegExp("(".concat(possibleChars.map(function(c) {
443
- return c === "?" ? "\\?" : c;
412
+ var r2 = new RegExp("(".concat(possibleChars.map(function(c2) {
413
+ return c2 === "?" ? "\\?" : c2;
444
414
  }).join("|"), ")"));
445
415
  var matched = !r2.test(key);
446
416
  if (!matched) {
@@ -1298,13 +1268,13 @@ var LanguageUtil = function() {
1298
1268
  var _this2 = this;
1299
1269
  var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
1300
1270
  var codes = [];
1301
- var addCode = function addCode2(c) {
1302
- if (!c)
1271
+ var addCode = function addCode2(c2) {
1272
+ if (!c2)
1303
1273
  return;
1304
- if (_this2.isSupportedCode(c)) {
1305
- codes.push(c);
1274
+ if (_this2.isSupportedCode(c2)) {
1275
+ codes.push(c2);
1306
1276
  } else {
1307
- _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c));
1277
+ _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c2));
1308
1278
  }
1309
1279
  };
1310
1280
  if (typeof code === "string" && code.indexOf("-") > -1) {
@@ -1801,9 +1771,9 @@ var Interpolator = function() {
1801
1771
  var sep = this.nestingOptionsSeparator;
1802
1772
  if (key.indexOf(sep) < 0)
1803
1773
  return key;
1804
- var c = key.split(new RegExp("".concat(sep, "[ ]*{")));
1805
- var optionsString = "{".concat(c[1]);
1806
- key = c[0];
1774
+ var c2 = key.split(new RegExp("".concat(sep, "[ ]*{")));
1775
+ var optionsString = "{".concat(c2[1]);
1776
+ key = c2[0];
1807
1777
  optionsString = this.interpolate(optionsString, clonedOptions);
1808
1778
  var matchedSingleQuotes = optionsString.match(/'/g);
1809
1779
  var matchedDoubleQuotes = optionsString.match(/"/g);
@@ -2651,7 +2621,7 @@ var I18n = function(_EventEmitter) {
2651
2621
  if (usedLng && usedLng.toLowerCase() === "cimode")
2652
2622
  return usedCallback();
2653
2623
  var toLoad = [];
2654
- var append2 = function append3(lng) {
2624
+ var append = function append2(lng) {
2655
2625
  if (!lng)
2656
2626
  return;
2657
2627
  var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
@@ -2663,14 +2633,14 @@ var I18n = function(_EventEmitter) {
2663
2633
  if (!usedLng) {
2664
2634
  var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2665
2635
  fallbacks.forEach(function(l2) {
2666
- return append2(l2);
2636
+ return append(l2);
2667
2637
  });
2668
2638
  } else {
2669
- append2(usedLng);
2639
+ append(usedLng);
2670
2640
  }
2671
2641
  if (this.options.preload) {
2672
2642
  this.options.preload.forEach(function(l2) {
2673
- return append2(l2);
2643
+ return append(l2);
2674
2644
  });
2675
2645
  }
2676
2646
  this.services.backendConnector.load(toLoad, this.options.ns, function(e2) {
@@ -3017,14 +2987,65 @@ var isObject$1 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) &
3017
2987
  var getEventValue = (event) => isObject$1(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
3018
2988
  var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
3019
2989
  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
+ }
3020
3018
  var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
3021
3019
  var isUndefined$2 = (val) => val === void 0;
3022
- var get = (obj, path2, defaultValue) => {
3023
- if (!path2 || !isObject$1(obj)) {
3020
+ var get = (object, path2, defaultValue) => {
3021
+ if (!path2 || !isObject$1(object)) {
3024
3022
  return defaultValue;
3025
3023
  }
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;
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;
3028
3049
  };
3029
3050
  const EVENTS = {
3030
3051
  BLUR: "blur",
@@ -3047,11 +3068,11 @@ const INPUT_VALIDATION_RULES = {
3047
3068
  required: "required",
3048
3069
  validate: "validate"
3049
3070
  };
3050
- const HookFormContext = React.createContext(null);
3051
- const useFormContext = () => React.useContext(HookFormContext);
3071
+ const HookFormContext = React__default.createContext(null);
3072
+ const useFormContext = () => React__default.useContext(HookFormContext);
3052
3073
  const FormProvider = (props) => {
3053
3074
  const { children, ...data } = props;
3054
- return React.createElement(HookFormContext.Provider, { value: data }, children);
3075
+ return React__default.createElement(HookFormContext.Provider, { value: data }, children);
3055
3076
  };
3056
3077
  var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
3057
3078
  const result = {
@@ -3072,17 +3093,18 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
3072
3093
  return result;
3073
3094
  };
3074
3095
  var isEmptyObject = (value) => isObject$1(value) && !Object.keys(value).length;
3075
- var shouldRenderFormState = (formStateData, _proxyFormState, isRoot) => {
3096
+ var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
3097
+ updateFormState(formStateData);
3076
3098
  const { name, ...formState } = formStateData;
3077
3099
  return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
3078
3100
  };
3079
3101
  var convertToArrayPayload = (value) => Array.isArray(value) ? value : [value];
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)));
3102
+ var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName)));
3081
3103
  function useSubscribe(props) {
3082
- const _props = React.useRef(props);
3104
+ const _props = React__default.useRef(props);
3083
3105
  _props.current = props;
3084
- React.useEffect(() => {
3085
- const subscription = !props.disabled && _props.current.subject.subscribe({
3106
+ React__default.useEffect(() => {
3107
+ const subscription = !props.disabled && _props.current.subject && _props.current.subject.subscribe({
3086
3108
  next: _props.current.next
3087
3109
  });
3088
3110
  return () => {
@@ -3093,36 +3115,31 @@ function useSubscribe(props) {
3093
3115
  function useFormState(props) {
3094
3116
  const methods = useFormContext();
3095
3117
  const { control = methods.control, disabled, name, exact } = props || {};
3096
- const [formState, updateFormState] = React.useState(control._formState);
3097
- const _mounted = React.useRef(true);
3098
- const _localProxyFormState = React.useRef({
3118
+ const [formState, updateFormState] = React__default.useState(control._formState);
3119
+ const _mounted = React__default.useRef(true);
3120
+ const _localProxyFormState = React__default.useRef({
3099
3121
  isDirty: false,
3100
3122
  isLoading: false,
3101
3123
  dirtyFields: false,
3102
3124
  touchedFields: false,
3125
+ validatingFields: false,
3103
3126
  isValidating: false,
3104
3127
  isValid: false,
3105
3128
  errors: false
3106
3129
  });
3107
- const _name = React.useRef(name);
3130
+ const _name = React__default.useRef(name);
3108
3131
  _name.current = name;
3109
3132
  useSubscribe({
3110
3133
  disabled,
3111
- next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current) && updateFormState({
3134
+ next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current, control._updateFormState) && updateFormState({
3112
3135
  ...control._formState,
3113
3136
  ...value
3114
3137
  }),
3115
3138
  subject: control._subjects.state
3116
3139
  });
3117
- React.useEffect(() => {
3140
+ React__default.useEffect(() => {
3118
3141
  _mounted.current = 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();
3142
+ _localProxyFormState.current.isValid && control._updateValid(true);
3126
3143
  return () => {
3127
3144
  _mounted.current = false;
3128
3145
  };
@@ -3141,53 +3158,27 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
3141
3158
  isGlobal && (_names.watchAll = true);
3142
3159
  return formValues;
3143
3160
  };
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
- }
3170
3161
  function useWatch(props) {
3171
3162
  const methods = useFormContext();
3172
3163
  const { control = methods.control, name, defaultValue, disabled, exact } = props || {};
3173
- const _name = React.useRef(name);
3164
+ const _name = React__default.useRef(name);
3174
3165
  _name.current = name;
3175
3166
  useSubscribe({
3176
3167
  disabled,
3177
- subject: control._subjects.watch,
3168
+ subject: control._subjects.values,
3178
3169
  next: (formState) => {
3179
3170
  if (shouldSubscribeByName(_name.current, formState.name, exact)) {
3180
3171
  updateValue(cloneObject(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, defaultValue)));
3181
3172
  }
3182
3173
  }
3183
3174
  });
3184
- const [value, updateValue] = React.useState(control._getWatch(name, defaultValue));
3185
- React.useEffect(() => control._removeUnmounted());
3175
+ const [value, updateValue] = React__default.useState(control._getWatch(name, defaultValue));
3176
+ React__default.useEffect(() => control._removeUnmounted());
3186
3177
  return value;
3187
3178
  }
3188
3179
  function useController(props) {
3189
3180
  const methods = useFormContext();
3190
- const { name, control = methods.control, shouldUnregister } = props;
3181
+ const { name, disabled, control = methods.control, shouldUnregister } = props;
3191
3182
  const isArrayField = isNameInFieldArray(control._names.array, name);
3192
3183
  const value = useWatch({
3193
3184
  control,
@@ -3199,35 +3190,54 @@ function useController(props) {
3199
3190
  control,
3200
3191
  name
3201
3192
  });
3202
- const _registerProps = React.useRef(control.register(name, {
3193
+ const _registerProps = React__default.useRef(control.register(name, {
3203
3194
  ...props.rules,
3204
- value
3195
+ value,
3196
+ ...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
3205
3197
  }));
3206
- React.useEffect(() => {
3198
+ React__default.useEffect(() => {
3199
+ const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
3207
3200
  const updateMounted = (name2, value2) => {
3208
3201
  const field = get(control._fields, name2);
3209
- if (field) {
3202
+ if (field && field._f) {
3210
3203
  field._f.mount = value2;
3211
3204
  }
3212
3205
  };
3213
3206
  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
- const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
3216
- (isArrayField ? _shouldUnregisterField && !control._stateFlags.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
3215
+ (isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
3217
3216
  };
3218
3217
  }, [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]);
3219
3228
  return {
3220
3229
  field: {
3221
3230
  name,
3222
3231
  value,
3223
- onChange: React.useCallback((event) => _registerProps.current.onChange({
3232
+ ...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
3233
+ onChange: React__default.useCallback((event) => _registerProps.current.onChange({
3224
3234
  target: {
3225
3235
  value: getEventValue(event),
3226
3236
  name
3227
3237
  },
3228
3238
  type: EVENTS.CHANGE
3229
3239
  }), [name]),
3230
- onBlur: React.useCallback(() => _registerProps.current.onBlur({
3240
+ onBlur: React__default.useCallback(() => _registerProps.current.onBlur({
3231
3241
  target: {
3232
3242
  value: get(control._formValues, name),
3233
3243
  name
@@ -3260,6 +3270,10 @@ function useController(props) {
3260
3270
  enumerable: true,
3261
3271
  get: () => !!get(formState.touchedFields, name)
3262
3272
  },
3273
+ isValidating: {
3274
+ enumerable: true,
3275
+ get: () => !!get(formState.validatingFields, name)
3276
+ },
3263
3277
  error: {
3264
3278
  enumerable: true,
3265
3279
  get: () => get(formState.errors, name)
@@ -3268,6 +3282,76 @@ function useController(props) {
3268
3282
  };
3269
3283
  }
3270
3284
  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
+ }
3271
3355
  var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria ? {
3272
3356
  ...errors[name],
3273
3357
  types: {
@@ -3275,49 +3359,11 @@ var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => va
3275
3359
  [type]: message || true
3276
3360
  }
3277
3361
  } : {};
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
- };
3316
3362
  var generateId = () => {
3317
3363
  const d2 = typeof performance === "undefined" ? Date.now() : performance.now() * 1e3;
3318
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
3364
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
3319
3365
  const r2 = (Math.random() * 16 + d2) % 16 | 0;
3320
- return (c == "x" ? r2 : r2 & 3 | 8).toString(16);
3366
+ return (c2 == "x" ? r2 : r2 & 3 | 8).toString(16);
3321
3367
  });
3322
3368
  };
3323
3369
  var getFocusFieldName = (name, index, options = {}) => options.shouldFocus || isUndefined$2(options.shouldFocus) ? options.focusName || `${name}.${isUndefined$2(options.focusIndex) ? index : options.focusIndex}.` : "";
@@ -3329,13 +3375,31 @@ var getValidationModes = (mode) => ({
3329
3375
  isOnTouch: mode === VALIDATION_MODE.onTouched
3330
3376
  });
3331
3377
  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
+ };
3332
3397
  var updateFieldArrayRootError = (errors, error2, name) => {
3333
- const fieldArrayErrors = compact(get(errors, name));
3398
+ const fieldArrayErrors = convertToArrayPayload(get(errors, name));
3334
3399
  set(fieldArrayErrors, "root", error2[name]);
3335
3400
  set(errors, name, fieldArrayErrors);
3336
3401
  return errors;
3337
3402
  };
3338
- var isBoolean = (value) => typeof value === "boolean";
3339
3403
  var isFileInput = (element) => element.type === "file";
3340
3404
  var isFunction$1 = (value) => typeof value === "function";
3341
3405
  var isHTMLElement = (value) => {
@@ -3345,7 +3409,7 @@ var isHTMLElement = (value) => {
3345
3409
  const owner = value ? value.ownerDocument : 0;
3346
3410
  return value instanceof (owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement);
3347
3411
  };
3348
- var isMessage = (value) => isString(value) || React.isValidElement(value);
3412
+ var isMessage = (value) => isString(value);
3349
3413
  var isRadioInput = (element) => element.type === "radio";
3350
3414
  var isRegex = (value) => value instanceof RegExp;
3351
3415
  const defaultResult = {
@@ -3384,8 +3448,9 @@ var getValueAndMessage = (validationData) => isObject$1(validationData) && !isRe
3384
3448
  value: validationData,
3385
3449
  message: ""
3386
3450
  };
3387
- var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
3451
+ var validateField = async (field, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
3388
3452
  const { ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, disabled } = field._f;
3453
+ const inputValue = get(formValues, name);
3389
3454
  if (!mount || disabled) {
3390
3455
  return {};
3391
3456
  }
@@ -3462,8 +3527,8 @@ var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUs
3462
3527
  if ((maxLength || minLength) && !isEmpty2 && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) {
3463
3528
  const maxLengthOutput = getValueAndMessage(maxLength);
3464
3529
  const minLengthOutput = getValueAndMessage(minLength);
3465
- const exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > maxLengthOutput.value;
3466
- const exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < minLengthOutput.value;
3530
+ const exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > +maxLengthOutput.value;
3531
+ const exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < +minLengthOutput.value;
3467
3532
  if (exceedMax || exceedMin) {
3468
3533
  getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
3469
3534
  if (!validateAllFieldCriteria) {
@@ -3489,7 +3554,7 @@ var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUs
3489
3554
  }
3490
3555
  if (validate) {
3491
3556
  if (isFunction$1(validate)) {
3492
- const result = await validate(inputValue);
3557
+ const result = await validate(inputValue, formValues);
3493
3558
  const validateError = getValidateError(result, inputRef);
3494
3559
  if (validateError) {
3495
3560
  error2[name] = {
@@ -3507,7 +3572,7 @@ var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUs
3507
3572
  if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
3508
3573
  break;
3509
3574
  }
3510
- const validateError = getValidateError(await validate[key](inputValue), inputRef, key);
3575
+ const validateError = getValidateError(await validate[key](inputValue, formValues), inputRef, key);
3511
3576
  if (validateError) {
3512
3577
  validationResult = {
3513
3578
  ...validateError,
@@ -3533,9 +3598,10 @@ var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUs
3533
3598
  setCustomValidity(true);
3534
3599
  return error2;
3535
3600
  };
3536
- function append(data, value) {
3537
- return [...data, ...convertToArrayPayload(value)];
3538
- }
3601
+ var appendAt = (data, value) => [
3602
+ ...data,
3603
+ ...convertToArrayPayload(value)
3604
+ ];
3539
3605
  var fillEmptyArray = (value) => Array.isArray(value) ? value.map(() => void 0) : void 0;
3540
3606
  function insert(data, index, value) {
3541
3607
  return [
@@ -3554,9 +3620,10 @@ var moveArrayAt = (data, from, to) => {
3554
3620
  data.splice(to, 0, data.splice(from, 1)[0]);
3555
3621
  return data;
3556
3622
  };
3557
- function prepend(data, value) {
3558
- return [...convertToArrayPayload(value), ...convertToArrayPayload(data)];
3559
- }
3623
+ var prependAt = (data, value) => [
3624
+ ...convertToArrayPayload(value),
3625
+ ...convertToArrayPayload(data)
3626
+ ];
3560
3627
  function removeAtIndexes(data, indexes) {
3561
3628
  let i2 = 0;
3562
3629
  const temp = [...data];
@@ -3566,9 +3633,9 @@ function removeAtIndexes(data, indexes) {
3566
3633
  }
3567
3634
  return compact(temp).length ? temp : [];
3568
3635
  }
3569
- var removeArrayAt = (data, index) => isUndefined$2(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort((a2, b) => a2 - b));
3636
+ var removeArrayAt = (data, index) => isUndefined$2(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort((a2, b2) => a2 - b2));
3570
3637
  var swapArrayAt = (data, indexA, indexB) => {
3571
- data[indexA] = [data[indexB], data[indexB] = data[indexA]][0];
3638
+ [data[indexA], data[indexB]] = [data[indexB], data[indexA]];
3572
3639
  };
3573
3640
  function baseGet(object, updatePath) {
3574
3641
  const length = updatePath.slice(0, -1).length;
@@ -3580,36 +3647,22 @@ function baseGet(object, updatePath) {
3580
3647
  }
3581
3648
  function isEmptyArray(obj) {
3582
3649
  for (const key in obj) {
3583
- if (!isUndefined$2(obj[key])) {
3650
+ if (obj.hasOwnProperty(key) && !isUndefined$2(obj[key])) {
3584
3651
  return false;
3585
3652
  }
3586
3653
  }
3587
3654
  return true;
3588
3655
  }
3589
3656
  function unset(object, path2) {
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;
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];
3594
3661
  if (childObject) {
3595
3662
  delete childObject[key];
3596
3663
  }
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
- }
3664
+ if (index !== 0 && (isObject$1(childObject) && isEmptyObject(childObject) || Array.isArray(childObject) && isEmptyArray(childObject))) {
3665
+ unset(object, paths.slice(0, -1));
3613
3666
  }
3614
3667
  return object;
3615
3668
  }
@@ -3620,11 +3673,11 @@ var updateAt = (fieldValues, index, value) => {
3620
3673
  function useFieldArray(props) {
3621
3674
  const methods = useFormContext();
3622
3675
  const { control = methods.control, name, keyName = "id", shouldUnregister } = props;
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);
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);
3628
3681
  _name.current = name;
3629
3682
  _fieldIds.current = fields;
3630
3683
  control._names.array.add(name);
@@ -3641,29 +3694,29 @@ function useFieldArray(props) {
3641
3694
  },
3642
3695
  subject: control._subjects.array
3643
3696
  });
3644
- const updateValues = React.useCallback((updatedFieldArrayValues) => {
3697
+ const updateValues = React__default.useCallback((updatedFieldArrayValues) => {
3645
3698
  _actioned.current = true;
3646
3699
  control._updateFieldArray(name, updatedFieldArrayValues);
3647
3700
  }, [control, name]);
3648
- const append$1 = (value, options) => {
3701
+ const append = (value, options) => {
3649
3702
  const appendValue = convertToArrayPayload(cloneObject(value));
3650
- const updatedFieldArrayValues = append(control._getFieldArray(name), appendValue);
3703
+ const updatedFieldArrayValues = appendAt(control._getFieldArray(name), appendValue);
3651
3704
  control._names.focus = getFocusFieldName(name, updatedFieldArrayValues.length - 1, options);
3652
- ids.current = append(ids.current, appendValue.map(generateId));
3705
+ ids.current = appendAt(ids.current, appendValue.map(generateId));
3653
3706
  updateValues(updatedFieldArrayValues);
3654
3707
  setFields(updatedFieldArrayValues);
3655
- control._updateFieldArray(name, updatedFieldArrayValues, append, {
3708
+ control._updateFieldArray(name, updatedFieldArrayValues, appendAt, {
3656
3709
  argA: fillEmptyArray(value)
3657
3710
  });
3658
3711
  };
3659
- const prepend$1 = (value, options) => {
3712
+ const prepend = (value, options) => {
3660
3713
  const prependValue = convertToArrayPayload(cloneObject(value));
3661
- const updatedFieldArrayValues = prepend(control._getFieldArray(name), prependValue);
3714
+ const updatedFieldArrayValues = prependAt(control._getFieldArray(name), prependValue);
3662
3715
  control._names.focus = getFocusFieldName(name, 0, options);
3663
- ids.current = prepend(ids.current, prependValue.map(generateId));
3716
+ ids.current = prependAt(ids.current, prependValue.map(generateId));
3664
3717
  updateValues(updatedFieldArrayValues);
3665
3718
  setFields(updatedFieldArrayValues);
3666
- control._updateFieldArray(name, updatedFieldArrayValues, prepend, {
3719
+ control._updateFieldArray(name, updatedFieldArrayValues, prependAt, {
3667
3720
  argA: fillEmptyArray(value)
3668
3721
  });
3669
3722
  };
@@ -3728,15 +3781,17 @@ function useFieldArray(props) {
3728
3781
  setFields([...updatedFieldArrayValues]);
3729
3782
  control._updateFieldArray(name, [...updatedFieldArrayValues], (data) => data, {}, true, false);
3730
3783
  };
3731
- React.useEffect(() => {
3732
- control._stateFlags.action = false;
3733
- isWatched(name, control._names) && control._subjects.state.next({});
3784
+ React__default.useEffect(() => {
3785
+ control._state.action = false;
3786
+ isWatched(name, control._names) && control._subjects.state.next({
3787
+ ...control._formState
3788
+ });
3734
3789
  if (_actioned.current && (!getValidationModes(control._options.mode).isOnSubmit || control._formState.isSubmitted)) {
3735
3790
  if (control._options.resolver) {
3736
3791
  control._executeSchema([name]).then((result) => {
3737
3792
  const error2 = get(result.errors, name);
3738
3793
  const existingError = get(control._formState.errors, name);
3739
- if (existingError ? !error2 && existingError.type : error2 && error2.type) {
3794
+ if (existingError ? !error2 && existingError.type || error2 && (existingError.type !== error2.type || existingError.message !== error2.message) : error2 && error2.type) {
3740
3795
  error2 ? set(control._formState.errors, name, error2) : unset(control._formState.errors, name);
3741
3796
  control._subjects.state.next({
3742
3797
  errors: control._formState.errors
@@ -3745,47 +3800,54 @@ function useFieldArray(props) {
3745
3800
  });
3746
3801
  } else {
3747
3802
  const field = get(control._fields, name);
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({
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({
3750
3805
  errors: updateFieldArrayRootError(control._formState.errors, error2, name)
3751
3806
  }));
3752
3807
  }
3753
3808
  }
3754
3809
  }
3755
- control._subjects.watch.next({
3810
+ control._subjects.values.next({
3756
3811
  name,
3757
- values: control._formValues
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;
3758
3820
  });
3759
- control._names.focus && focusFieldBy(control._fields, (key) => !!key && key.startsWith(control._names.focus || ""));
3760
3821
  control._names.focus = "";
3761
- control._proxyFormState.isValid && control._updateValid();
3822
+ control._updateValid();
3823
+ _actioned.current = false;
3762
3824
  }, [fields, name, control]);
3763
- React.useEffect(() => {
3825
+ React__default.useEffect(() => {
3764
3826
  !get(control._formValues, name) && control._updateFieldArray(name);
3765
3827
  return () => {
3766
3828
  (control._options.shouldUnregister || shouldUnregister) && control.unregister(name);
3767
3829
  };
3768
3830
  }, [name, control, keyName, shouldUnregister]);
3769
3831
  return {
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) => ({
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) => ({
3779
3841
  ...field,
3780
3842
  [keyName]: ids.current[index] || generateId()
3781
3843
  })), [fields, keyName])
3782
3844
  };
3783
3845
  }
3784
- function createSubject() {
3846
+ var createSubject = () => {
3785
3847
  let _observers = [];
3786
3848
  const next = (value) => {
3787
3849
  for (const observer of _observers) {
3788
- observer.next(value);
3850
+ observer.next && observer.next(value);
3789
3851
  }
3790
3852
  };
3791
3853
  const subscribe = (observer) => {
@@ -3807,7 +3869,7 @@ function createSubject() {
3807
3869
  subscribe,
3808
3870
  unsubscribe
3809
3871
  };
3810
- }
3872
+ };
3811
3873
  var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
3812
3874
  function deepEqual(object1, object2) {
3813
3875
  if (isPrimitive(object1) || isPrimitive(object2)) {
@@ -3871,7 +3933,7 @@ function getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues
3871
3933
  getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
3872
3934
  }
3873
3935
  } else {
3874
- deepEqual(data[key], formValues[key]) ? delete dirtyFieldsFromValues[key] : dirtyFieldsFromValues[key] = true;
3936
+ dirtyFieldsFromValues[key] = !deepEqual(data[key], formValues[key]);
3875
3937
  }
3876
3938
  }
3877
3939
  }
@@ -3959,16 +4021,15 @@ const defaultOptions$1 = {
3959
4021
  reValidateMode: VALIDATION_MODE.onChange,
3960
4022
  shouldFocusError: true
3961
4023
  };
3962
- function createFormControl(props = {}, flushRootRender) {
4024
+ function createFormControl(props = {}) {
3963
4025
  let _options = {
3964
4026
  ...defaultOptions$1,
3965
4027
  ...props
3966
4028
  };
3967
- const shouldCaptureDirtyFields = props.resetOptions && props.resetOptions.keepDirtyValues;
3968
4029
  let _formState = {
3969
4030
  submitCount: 0,
3970
4031
  isDirty: false,
3971
- isLoading: true,
4032
+ isLoading: isFunction$1(_options.defaultValues),
3972
4033
  isValidating: false,
3973
4034
  isSubmitted: false,
3974
4035
  isSubmitting: false,
@@ -3976,12 +4037,14 @@ function createFormControl(props = {}, flushRootRender) {
3976
4037
  isValid: false,
3977
4038
  touchedFields: {},
3978
4039
  dirtyFields: {},
3979
- errors: {}
4040
+ validatingFields: {},
4041
+ errors: _options.errors || {},
4042
+ disabled: _options.disabled || false
3980
4043
  };
3981
4044
  let _fields = {};
3982
- let _defaultValues = isObject$1(_options.defaultValues) ? cloneObject(_options.defaultValues) || {} : {};
4045
+ let _defaultValues = isObject$1(_options.defaultValues) || isObject$1(_options.values) ? cloneObject(_options.defaultValues || _options.values) || {} : {};
3983
4046
  let _formValues = _options.shouldUnregister ? {} : cloneObject(_defaultValues);
3984
- let _stateFlags = {
4047
+ let _state = {
3985
4048
  action: false,
3986
4049
  mount: false,
3987
4050
  watch: false
@@ -3997,13 +4060,14 @@ function createFormControl(props = {}, flushRootRender) {
3997
4060
  const _proxyFormState = {
3998
4061
  isDirty: false,
3999
4062
  dirtyFields: false,
4063
+ validatingFields: false,
4000
4064
  touchedFields: false,
4001
4065
  isValidating: false,
4002
4066
  isValid: false,
4003
4067
  errors: false
4004
4068
  };
4005
4069
  const _subjects = {
4006
- watch: createSubject(),
4070
+ values: createSubject(),
4007
4071
  array: createSubject(),
4008
4072
  state: createSubject()
4009
4073
  };
@@ -4012,25 +4076,34 @@ function createFormControl(props = {}, flushRootRender) {
4012
4076
  const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;
4013
4077
  const debounce = (callback) => (wait) => {
4014
4078
  clearTimeout(timer);
4015
- timer = window.setTimeout(callback, wait);
4079
+ timer = setTimeout(callback, wait);
4016
4080
  };
4017
- const _updateValid = async () => {
4018
- if (_proxyFormState.isValid) {
4081
+ const _updateValid = async (shouldUpdateValid) => {
4082
+ if (_proxyFormState.isValid || shouldUpdateValid) {
4019
4083
  const isValid = _options.resolver ? isEmptyObject((await _executeSchema()).errors) : await executeBuiltInValidation(_fields, true);
4020
4084
  if (isValid !== _formState.isValid) {
4021
- _formState.isValid = isValid;
4022
4085
  _subjects.state.next({
4023
4086
  isValid
4024
4087
  });
4025
4088
  }
4026
4089
  }
4027
4090
  };
4028
- const _updateIsValidating = (value) => _proxyFormState.isValidating && _subjects.state.next({
4029
- isValidating: value
4030
- });
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
+ };
4031
4104
  const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
4032
4105
  if (args && method) {
4033
- _stateFlags.action = true;
4106
+ _state.action = true;
4034
4107
  if (shouldUpdateFieldsAndState && Array.isArray(get(_fields, name))) {
4035
4108
  const fieldValues = method(get(_fields, name), args.argA, args.argB);
4036
4109
  shouldSetValues && set(_fields, name, fieldValues);
@@ -4064,12 +4137,19 @@ function createFormControl(props = {}, flushRootRender) {
4064
4137
  errors: _formState.errors
4065
4138
  });
4066
4139
  };
4140
+ const _setErrors = (errors) => {
4141
+ _formState.errors = errors;
4142
+ _subjects.state.next({
4143
+ errors: _formState.errors,
4144
+ isValid: false
4145
+ });
4146
+ };
4067
4147
  const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
4068
4148
  const field = get(_fields, name);
4069
4149
  if (field) {
4070
4150
  const defaultValue = get(_formValues, name, isUndefined$2(value) ? get(_defaultValues, name) : value);
4071
4151
  isUndefined$2(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
4072
- _stateFlags.mount && _updateValid();
4152
+ _state.mount && _updateValid();
4073
4153
  }
4074
4154
  };
4075
4155
  const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
@@ -4078,15 +4158,16 @@ function createFormControl(props = {}, flushRootRender) {
4078
4158
  const output2 = {
4079
4159
  name
4080
4160
  };
4161
+ const disabledField = !!(get(_fields, name) && get(_fields, name)._f && get(_fields, name)._f.disabled);
4081
4162
  if (!isBlurEvent || shouldDirty) {
4082
4163
  if (_proxyFormState.isDirty) {
4083
4164
  isPreviousDirty = _formState.isDirty;
4084
4165
  _formState.isDirty = output2.isDirty = _getDirty();
4085
4166
  shouldUpdateField = isPreviousDirty !== output2.isDirty;
4086
4167
  }
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);
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);
4090
4171
  output2.dirtyFields = _formState.dirtyFields;
4091
4172
  shouldUpdateField = shouldUpdateField || _proxyFormState.dirtyFields && isPreviousDirty !== !isCurrentFieldPristine;
4092
4173
  }
@@ -4125,11 +4206,15 @@ function createFormControl(props = {}, flushRootRender) {
4125
4206
  };
4126
4207
  _subjects.state.next(updatedFormState);
4127
4208
  }
4128
- _updateIsValidating(false);
4129
4209
  };
4130
- const _executeSchema = async (name) => await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
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
+ };
4131
4216
  const executeSchemaAndUpdateState = async (names) => {
4132
- const { errors } = await _executeSchema();
4217
+ const { errors } = await _executeSchema(names);
4133
4218
  if (names) {
4134
4219
  for (const name of names) {
4135
4220
  const error2 = get(errors, name);
@@ -4149,7 +4234,9 @@ function createFormControl(props = {}, flushRootRender) {
4149
4234
  const { _f, ...fieldValue } = field;
4150
4235
  if (_f) {
4151
4236
  const isFieldArrayRoot = _names.array.has(_f.name);
4152
- const fieldError = await validateField(field, get(_formValues, _f.name), shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation, isFieldArrayRoot);
4237
+ _updateIsValidating([name], true);
4238
+ const fieldError = await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
4239
+ _updateIsValidating([name]);
4153
4240
  if (fieldError[_f.name]) {
4154
4241
  context.valid = false;
4155
4242
  if (shouldOnlyCheckValid) {
@@ -4172,9 +4259,9 @@ function createFormControl(props = {}, flushRootRender) {
4172
4259
  };
4173
4260
  const _getDirty = (name, data) => (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
4174
4261
  const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
4175
- ..._stateFlags.mount ? _formValues : isUndefined$2(defaultValue) ? _defaultValues : isString(names) ? { [names]: defaultValue } : defaultValue
4262
+ ..._state.mount ? _formValues : isUndefined$2(defaultValue) ? _defaultValues : isString(names) ? { [names]: defaultValue } : defaultValue
4176
4263
  }, isGlobal, defaultValue);
4177
- const _getFieldArray = (name) => compact(get(_stateFlags.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get(_defaultValues, name, []) : []));
4264
+ const _getFieldArray = (name) => compact(get(_state.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get(_defaultValues, name, []) : []));
4178
4265
  const setFieldValue = (name, value, options = {}) => {
4179
4266
  const field = get(_fields, name);
4180
4267
  let fieldValue = value;
@@ -4196,8 +4283,9 @@ function createFormControl(props = {}, flushRootRender) {
4196
4283
  } else {
4197
4284
  fieldReference.ref.value = fieldValue;
4198
4285
  if (!fieldReference.ref.type) {
4199
- _subjects.watch.next({
4200
- name
4286
+ _subjects.values.next({
4287
+ name,
4288
+ values: { ..._formValues }
4201
4289
  });
4202
4290
  }
4203
4291
  }
@@ -4222,30 +4310,34 @@ function createFormControl(props = {}, flushRootRender) {
4222
4310
  if (isFieldArray) {
4223
4311
  _subjects.array.next({
4224
4312
  name,
4225
- values: _formValues
4313
+ values: { ..._formValues }
4226
4314
  });
4227
4315
  if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields) && options.shouldDirty) {
4228
- _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
4229
4316
  _subjects.state.next({
4230
4317
  name,
4231
- dirtyFields: _formState.dirtyFields,
4318
+ dirtyFields: getDirtyFields(_defaultValues, _formValues),
4232
4319
  isDirty: _getDirty(name, cloneValue)
4233
4320
  });
4234
4321
  }
4235
4322
  } else {
4236
4323
  field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options) : setFieldValue(name, cloneValue, options);
4237
4324
  }
4238
- isWatched(name, _names) && _subjects.state.next({});
4239
- _subjects.watch.next({
4240
- name
4325
+ isWatched(name, _names) && _subjects.state.next({ ..._formState });
4326
+ _subjects.values.next({
4327
+ name: _state.mount ? name : void 0,
4328
+ values: { ..._formValues }
4241
4329
  });
4242
- !_stateFlags.mount && flushRootRender();
4243
4330
  };
4244
4331
  const onChange = async (event) => {
4332
+ _state.mount = true;
4245
4333
  const target = event.target;
4246
4334
  let name = target.name;
4335
+ let isFieldValueUpdated = true;
4247
4336
  const field = get(_fields, name);
4248
4337
  const getCurrentFieldValue = () => target.type ? getFieldValue(field._f) : getEventValue(event);
4338
+ const _updateIsFieldValueUpdated = (fieldValue) => {
4339
+ isFieldValueUpdated = Number.isNaN(fieldValue) || fieldValue === get(_formValues, name, fieldValue);
4340
+ };
4249
4341
  if (field) {
4250
4342
  let error2;
4251
4343
  let isValid;
@@ -4262,40 +4354,56 @@ function createFormControl(props = {}, flushRootRender) {
4262
4354
  }
4263
4355
  const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent, false);
4264
4356
  const shouldRender = !isEmptyObject(fieldState) || watched;
4265
- !isBlurEvent && _subjects.watch.next({
4357
+ !isBlurEvent && _subjects.values.next({
4266
4358
  name,
4267
- type: event.type
4359
+ type: event.type,
4360
+ values: { ..._formValues }
4268
4361
  });
4269
4362
  if (shouldSkipValidation) {
4270
4363
  _proxyFormState.isValid && _updateValid();
4271
4364
  return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
4272
4365
  }
4273
- !isBlurEvent && watched && _subjects.state.next({});
4274
- _updateIsValidating(true);
4366
+ !isBlurEvent && watched && _subjects.state.next({ ..._formState });
4275
4367
  if (_options.resolver) {
4276
4368
  const { errors } = await _executeSchema([name]);
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);
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
+ }
4282
4377
  } else {
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);
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
+ }
4288
4388
  }
4289
4389
  }
4290
- field._f.deps && trigger(field._f.deps);
4291
- shouldRenderByError(name, isValid, error2, fieldState);
4390
+ if (isFieldValueUpdated) {
4391
+ field._f.deps && trigger(field._f.deps);
4392
+ shouldRenderByError(name, isValid, error2, fieldState);
4393
+ }
4394
+ }
4395
+ };
4396
+ const _focusInput = (ref, key) => {
4397
+ if (get(_formState.errors, key) && ref.focus) {
4398
+ ref.focus();
4399
+ return 1;
4292
4400
  }
4401
+ return;
4293
4402
  };
4294
4403
  const trigger = async (name, options = {}) => {
4295
4404
  let isValid;
4296
4405
  let validationResult;
4297
4406
  const fieldNames = convertToArrayPayload(name);
4298
- _updateIsValidating(true);
4299
4407
  if (_options.resolver) {
4300
4408
  const errors = await executeSchemaAndUpdateState(isUndefined$2(name) ? name : fieldNames);
4301
4409
  isValid = isEmptyObject(errors);
@@ -4312,34 +4420,36 @@ function createFormControl(props = {}, flushRootRender) {
4312
4420
  _subjects.state.next({
4313
4421
  ...!isString(name) || _proxyFormState.isValid && isValid !== _formState.isValid ? {} : { name },
4314
4422
  ..._options.resolver || !name ? { isValid } : {},
4315
- errors: _formState.errors,
4316
- isValidating: false
4423
+ errors: _formState.errors
4317
4424
  });
4318
- options.shouldFocus && !validationResult && focusFieldBy(_fields, (key) => key && get(_formState.errors, key), name ? fieldNames : _names.mount);
4425
+ options.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
4319
4426
  return validationResult;
4320
4427
  };
4321
4428
  const getValues = (fieldNames) => {
4322
4429
  const values = {
4323
- ..._defaultValues,
4324
- ..._stateFlags.mount ? _formValues : {}
4430
+ ..._state.mount ? _formValues : _defaultValues
4325
4431
  };
4326
4432
  return isUndefined$2(fieldNames) ? values : isString(fieldNames) ? get(values, fieldNames) : fieldNames.map((name) => get(values, name));
4327
4433
  };
4328
4434
  const getFieldState = (name, formState) => ({
4329
4435
  invalid: !!get((formState || _formState).errors, name),
4330
4436
  isDirty: !!get((formState || _formState).dirtyFields, name),
4331
- isTouched: !!get((formState || _formState).touchedFields, name),
4332
- error: get((formState || _formState).errors, name)
4437
+ error: get((formState || _formState).errors, name),
4438
+ isValidating: !!get(_formState.validatingFields, name),
4439
+ isTouched: !!get((formState || _formState).touchedFields, name)
4333
4440
  });
4334
4441
  const clearErrors = (name) => {
4335
- name ? convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName)) : _formState.errors = {};
4442
+ name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
4336
4443
  _subjects.state.next({
4337
- errors: _formState.errors
4444
+ errors: name ? _formState.errors : {}
4338
4445
  });
4339
4446
  };
4340
4447
  const setError = (name, error2, options) => {
4341
4448
  const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
4449
+ const currentError = get(_formState.errors, name) || {};
4450
+ const { ref: currentRef, message, type, ...restOfErrorTree } = currentError;
4342
4451
  set(_formState.errors, name, {
4452
+ ...restOfErrorTree,
4343
4453
  ...error2,
4344
4454
  ref
4345
4455
  });
@@ -4350,31 +4460,39 @@ function createFormControl(props = {}, flushRootRender) {
4350
4460
  });
4351
4461
  options && options.shouldFocus && ref && ref.focus && ref.focus();
4352
4462
  };
4353
- const watch = (name, defaultValue) => isFunction$1(name) ? _subjects.watch.subscribe({
4463
+ const watch = (name, defaultValue) => isFunction$1(name) ? _subjects.values.subscribe({
4354
4464
  next: (payload) => name(_getWatch(void 0, defaultValue), payload)
4355
4465
  }) : _getWatch(name, defaultValue, true);
4356
4466
  const unregister = (name, options = {}) => {
4357
4467
  for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
4358
4468
  _names.mount.delete(fieldName);
4359
4469
  _names.array.delete(fieldName);
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({});
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
+ });
4372
4483
  _subjects.state.next({
4373
4484
  ..._formState,
4374
4485
  ...!options.keepDirty ? {} : { isDirty: _getDirty() }
4375
4486
  });
4376
4487
  !options.keepIsValid && _updateValid();
4377
4488
  };
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
+ };
4378
4496
  const register = (name, options = {}) => {
4379
4497
  let field = get(_fields, name);
4380
4498
  const disabledIsDefined = isBoolean(options.disabled);
@@ -4388,10 +4506,19 @@ function createFormControl(props = {}, flushRootRender) {
4388
4506
  }
4389
4507
  });
4390
4508
  _names.mount.add(name);
4391
- field ? disabledIsDefined && set(_formValues, name, options.disabled ? void 0 : get(_formValues, name, getFieldValue(field._f))) : updateValidAndValue(name, true, options.value);
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
+ }
4392
4519
  return {
4393
4520
  ...disabledIsDefined ? { disabled: options.disabled } : {},
4394
- ..._options.shouldUseNativeValidation ? {
4521
+ ..._options.progressive ? {
4395
4522
  required: !!options.required,
4396
4523
  min: getRuleValue(options.min),
4397
4524
  max: getRuleValue(options.max),
@@ -4431,70 +4558,87 @@ function createFormControl(props = {}, flushRootRender) {
4431
4558
  if (field._f) {
4432
4559
  field._f.mount = false;
4433
4560
  }
4434
- (_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _stateFlags.action) && _names.unMount.add(name);
4561
+ (_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
4435
4562
  }
4436
4563
  }
4437
4564
  };
4438
4565
  };
4439
- const _focusError = () => _options.shouldFocusError && focusFieldBy(_fields, (key) => key && get(_formState.errors, key), _names.mount);
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
+ };
4440
4583
  const handleSubmit = (onValid, onInvalid) => async (e2) => {
4584
+ let onValidError = void 0;
4441
4585
  if (e2) {
4442
4586
  e2.preventDefault && e2.preventDefault();
4443
4587
  e2.persist && e2.persist();
4444
4588
  }
4445
- let hasNoPromiseError = true;
4446
4589
  let fieldValues = cloneObject(_formValues);
4447
4590
  _subjects.state.next({
4448
4591
  isSubmitting: true
4449
4592
  });
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);
4457
- }
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();
4469
- }
4470
- } catch (err) {
4471
- hasNoPromiseError = false;
4472
- throw err;
4473
- } finally {
4474
- _formState.isSubmitted = true;
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)) {
4475
4602
  _subjects.state.next({
4476
- isSubmitted: true,
4477
- isSubmitting: false,
4478
- isSubmitSuccessful: isEmptyObject(_formState.errors) && hasNoPromiseError,
4479
- submitCount: _formState.submitCount + 1,
4480
- errors: _formState.errors
4603
+ errors: {}
4481
4604
  });
4482
- }
4483
- };
4484
- const resetField = (name, options = {}) => {
4485
- if (get(_fields, name)) {
4605
+ try {
4606
+ await onValid(fieldValues, e2);
4607
+ } catch (error2) {
4608
+ onValidError = error2;
4609
+ }
4610
+ } else {
4611
+ if (onInvalid) {
4612
+ await onInvalid({ ..._formState.errors }, e2);
4613
+ }
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;
4626
+ }
4627
+ };
4628
+ const resetField = (name, options = {}) => {
4629
+ if (get(_fields, name)) {
4486
4630
  if (isUndefined$2(options.defaultValue)) {
4487
- setValue(name, get(_defaultValues, name));
4631
+ setValue(name, cloneObject(get(_defaultValues, name)));
4488
4632
  } else {
4489
4633
  setValue(name, options.defaultValue);
4490
- set(_defaultValues, name, options.defaultValue);
4634
+ set(_defaultValues, name, cloneObject(options.defaultValue));
4491
4635
  }
4492
4636
  if (!options.keepTouched) {
4493
4637
  unset(_formState.touchedFields, name);
4494
4638
  }
4495
4639
  if (!options.keepDirty) {
4496
4640
  unset(_formState.dirtyFields, name);
4497
- _formState.isDirty = options.defaultValue ? _getDirty(name, get(_defaultValues, name)) : _getDirty();
4641
+ _formState.isDirty = options.defaultValue ? _getDirty(name, cloneObject(get(_defaultValues, name))) : _getDirty();
4498
4642
  }
4499
4643
  if (!options.keepError) {
4500
4644
  unset(_formState.errors, name);
@@ -4504,14 +4648,15 @@ function createFormControl(props = {}, flushRootRender) {
4504
4648
  }
4505
4649
  };
4506
4650
  const _reset = (formValues, keepStateOptions = {}) => {
4507
- const updatedValues = formValues || _defaultValues;
4651
+ const updatedValues = formValues ? cloneObject(formValues) : _defaultValues;
4508
4652
  const cloneUpdatedValues = cloneObject(updatedValues);
4509
- const values = formValues && !isEmptyObject(formValues) ? cloneUpdatedValues : _defaultValues;
4653
+ const isEmptyResetValues = isEmptyObject(formValues);
4654
+ const values = isEmptyResetValues ? _defaultValues : cloneUpdatedValues;
4510
4655
  if (!keepStateOptions.keepDefaultValues) {
4511
4656
  _defaultValues = updatedValues;
4512
4657
  }
4513
4658
  if (!keepStateOptions.keepValues) {
4514
- if (keepStateOptions.keepDirtyValues || shouldCaptureDirtyFields) {
4659
+ if (keepStateOptions.keepDirtyValues) {
4515
4660
  for (const fieldName of _names.mount) {
4516
4661
  get(_formState.dirtyFields, fieldName) ? set(values, fieldName, get(_formValues, fieldName)) : setValue(fieldName, get(values, fieldName));
4517
4662
  }
@@ -4533,34 +4678,33 @@ function createFormControl(props = {}, flushRootRender) {
4533
4678
  }
4534
4679
  _fields = {};
4535
4680
  }
4536
- _formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} : cloneUpdatedValues;
4681
+ _formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} : cloneObject(values);
4537
4682
  _subjects.array.next({
4538
- values
4683
+ values: { ...values }
4539
4684
  });
4540
- _subjects.watch.next({
4541
- values
4685
+ _subjects.values.next({
4686
+ values: { ...values }
4542
4687
  });
4543
4688
  }
4544
4689
  _names = {
4545
- mount: /* @__PURE__ */ new Set(),
4690
+ mount: keepStateOptions.keepDirtyValues ? _names.mount : /* @__PURE__ */ new Set(),
4546
4691
  unMount: /* @__PURE__ */ new Set(),
4547
4692
  array: /* @__PURE__ */ new Set(),
4548
4693
  watch: /* @__PURE__ */ new Set(),
4549
4694
  watchAll: false,
4550
4695
  focus: ""
4551
4696
  };
4552
- !_stateFlags.mount && flushRootRender();
4553
- _stateFlags.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid;
4554
- _stateFlags.watch = !!props.shouldUnregister;
4697
+ _state.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid || !!keepStateOptions.keepDirtyValues;
4698
+ _state.watch = !!props.shouldUnregister;
4555
4699
  _subjects.state.next({
4556
4700
  submitCount: keepStateOptions.keepSubmitCount ? _formState.submitCount : 0,
4557
- isDirty: keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)),
4701
+ isDirty: isEmptyResetValues ? false : keepStateOptions.keepDirty ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)),
4558
4702
  isSubmitted: keepStateOptions.keepIsSubmitted ? _formState.isSubmitted : false,
4559
- dirtyFields: keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues ? _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues) : {},
4703
+ dirtyFields: isEmptyResetValues ? {} : keepStateOptions.keepDirtyValues ? keepStateOptions.keepDefaultValues && _formValues ? getDirtyFields(_defaultValues, _formValues) : _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues) : keepStateOptions.keepDirty ? _formState.dirtyFields : {},
4560
4704
  touchedFields: keepStateOptions.keepTouched ? _formState.touchedFields : {},
4561
4705
  errors: keepStateOptions.keepErrors ? _formState.errors : {},
4562
- isSubmitting: false,
4563
- isSubmitSuccessful: false
4706
+ isSubmitSuccessful: keepStateOptions.keepIsSubmitSuccessful ? _formState.isSubmitSuccessful : false,
4707
+ isSubmitting: false
4564
4708
  });
4565
4709
  };
4566
4710
  const reset = (formValues, keepStateOptions) => _reset(isFunction$1(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
@@ -4575,41 +4719,51 @@ function createFormControl(props = {}, flushRootRender) {
4575
4719
  }
4576
4720
  }
4577
4721
  };
4578
- if (isFunction$1(_options.defaultValues)) {
4579
- _options.defaultValues().then((values) => {
4580
- reset(values, _options.resetOptions);
4581
- _subjects.state.next({
4582
- isLoading: false
4583
- });
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
4584
4732
  });
4585
- }
4733
+ });
4586
4734
  return {
4587
4735
  control: {
4588
4736
  register,
4589
4737
  unregister,
4590
4738
  getFieldState,
4739
+ handleSubmit,
4740
+ setError,
4591
4741
  _executeSchema,
4592
- _focusError,
4593
4742
  _getWatch,
4594
4743
  _getDirty,
4595
4744
  _updateValid,
4596
4745
  _removeUnmounted,
4597
4746
  _updateFieldArray,
4747
+ _updateDisabledField,
4598
4748
  _getFieldArray,
4599
4749
  _reset,
4750
+ _resetDefaultValues,
4751
+ _updateFormState,
4752
+ _disableForm,
4600
4753
  _subjects,
4601
4754
  _proxyFormState,
4755
+ _setErrors,
4602
4756
  get _fields() {
4603
4757
  return _fields;
4604
4758
  },
4605
4759
  get _formValues() {
4606
4760
  return _formValues;
4607
4761
  },
4608
- get _stateFlags() {
4609
- return _stateFlags;
4762
+ get _state() {
4763
+ return _state;
4610
4764
  },
4611
- set _stateFlags(value) {
4612
- _stateFlags = value;
4765
+ set _state(value) {
4766
+ _state = value;
4613
4767
  },
4614
4768
  get _defaultValues() {
4615
4769
  return _defaultValues;
@@ -4652,11 +4806,12 @@ function createFormControl(props = {}, flushRootRender) {
4652
4806
  };
4653
4807
  }
4654
4808
  function useForm(props = {}) {
4655
- const _formControl = React.useRef();
4656
- const [formState, updateFormState] = React.useState({
4809
+ const _formControl = React__default.useRef();
4810
+ const _values = React__default.useRef();
4811
+ const [formState, updateFormState] = React__default.useState({
4657
4812
  isDirty: false,
4658
4813
  isValidating: false,
4659
- isLoading: true,
4814
+ isLoading: isFunction$1(props.defaultValues),
4660
4815
  isSubmitted: false,
4661
4816
  isSubmitting: false,
4662
4817
  isSubmitSuccessful: false,
@@ -4664,12 +4819,14 @@ function useForm(props = {}) {
4664
4819
  submitCount: 0,
4665
4820
  dirtyFields: {},
4666
4821
  touchedFields: {},
4667
- errors: {},
4822
+ validatingFields: {},
4823
+ errors: props.errors || {},
4824
+ disabled: props.disabled || false,
4668
4825
  defaultValues: isFunction$1(props.defaultValues) ? void 0 : props.defaultValues
4669
4826
  });
4670
4827
  if (!_formControl.current) {
4671
4828
  _formControl.current = {
4672
- ...createFormControl(props, () => updateFormState((formState2) => ({ ...formState2 }))),
4829
+ ...createFormControl(props),
4673
4830
  formState
4674
4831
  };
4675
4832
  }
@@ -4678,40 +4835,59 @@ function useForm(props = {}) {
4678
4835
  useSubscribe({
4679
4836
  subject: control._subjects.state,
4680
4837
  next: (value) => {
4681
- if (shouldRenderFormState(value, control._proxyFormState, true)) {
4682
- control._formState = {
4683
- ...control._formState,
4684
- ...value
4685
- };
4838
+ if (shouldRenderFormState(value, control._proxyFormState, control._updateFormState, true)) {
4686
4839
  updateFormState({ ...control._formState });
4687
4840
  }
4688
4841
  }
4689
4842
  });
4690
- React.useEffect(() => {
4691
- if (!control._stateFlags.mount) {
4692
- control._proxyFormState.isValid && control._updateValid();
4693
- control._stateFlags.mount = true;
4694
- }
4695
- if (control._stateFlags.watch) {
4696
- control._stateFlags.watch = false;
4697
- control._subjects.state.next({});
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
+ }
4698
4852
  }
4699
- control._removeUnmounted();
4700
- });
4701
- React.useEffect(() => {
4702
- if (props.values && !deepEqual(props.values, control._defaultValues)) {
4853
+ }, [control, formState.isDirty]);
4854
+ React__default.useEffect(() => {
4855
+ if (props.values && !deepEqual(props.values, _values.current)) {
4703
4856
  control._reset(props.values, control._options.resetOptions);
4857
+ _values.current = props.values;
4858
+ updateFormState((state) => ({ ...state }));
4859
+ } else {
4860
+ control._resetDefaultValues();
4704
4861
  }
4705
4862
  }, [props.values, control]);
4706
- React.useEffect(() => {
4707
- formState.submitCount && control._focusError();
4708
- }, [control, formState.submitCount]);
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 });
4876
+ }
4877
+ control._removeUnmounted();
4878
+ });
4879
+ React__default.useEffect(() => {
4880
+ props.shouldUnregister && control._subjects.values.next({
4881
+ values: control._getWatch()
4882
+ });
4883
+ }, [props.shouldUnregister, control]);
4709
4884
  _formControl.current.formState = getProxyFormState(formState, control);
4710
4885
  return _formControl.current;
4711
4886
  }
4712
4887
  var index_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4713
4888
  __proto__: null,
4714
4889
  Controller,
4890
+ Form,
4715
4891
  FormProvider,
4716
4892
  appendErrors,
4717
4893
  get,
@@ -4915,11 +5091,11 @@ var root$1 = root;
4915
5091
  var Symbol$1 = root$1.Symbol;
4916
5092
  var Symbol$2 = Symbol$1;
4917
5093
  var objectProto$f = Object.prototype;
4918
- var hasOwnProperty$d = objectProto$f.hasOwnProperty;
5094
+ var hasOwnProperty$c = objectProto$f.hasOwnProperty;
4919
5095
  var nativeObjectToString$1 = objectProto$f.toString;
4920
5096
  var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
4921
5097
  function getRawTag(value) {
4922
- var isOwn = hasOwnProperty$d.call(value, symToStringTag$1), tag = value[symToStringTag$1];
5098
+ var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
4923
5099
  try {
4924
5100
  value[symToStringTag$1] = void 0;
4925
5101
  var unmasked = true;
@@ -5043,9 +5219,9 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
5043
5219
  var reIsHostCtor = /^\[object .+?Constructor\]$/;
5044
5220
  var funcProto = Function.prototype, objectProto$d = Object.prototype;
5045
5221
  var funcToString = funcProto.toString;
5046
- var hasOwnProperty$c = objectProto$d.hasOwnProperty;
5222
+ var hasOwnProperty$b = objectProto$d.hasOwnProperty;
5047
5223
  var reIsNative = RegExp(
5048
- "^" + funcToString.call(hasOwnProperty$c).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
5224
+ "^" + funcToString.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
5049
5225
  );
5050
5226
  function baseIsNative(value) {
5051
5227
  if (!isObject(value) || isMasked(value)) {
@@ -5130,10 +5306,10 @@ function eq(value, other) {
5130
5306
  return value === other || value !== value && other !== other;
5131
5307
  }
5132
5308
  var objectProto$c = Object.prototype;
5133
- var hasOwnProperty$b = objectProto$c.hasOwnProperty;
5309
+ var hasOwnProperty$a = objectProto$c.hasOwnProperty;
5134
5310
  function assignValue(object, key, value) {
5135
5311
  var objValue = object[key];
5136
- if (!(hasOwnProperty$b.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
5312
+ if (!(hasOwnProperty$a.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
5137
5313
  baseAssignValue(object, key, value);
5138
5314
  }
5139
5315
  }
@@ -5179,12 +5355,12 @@ function baseIsArguments(value) {
5179
5355
  return isObjectLike(value) && baseGetTag(value) == argsTag$3;
5180
5356
  }
5181
5357
  var objectProto$a = Object.prototype;
5182
- var hasOwnProperty$a = objectProto$a.hasOwnProperty;
5358
+ var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
5183
5359
  var propertyIsEnumerable$1 = objectProto$a.propertyIsEnumerable;
5184
5360
  var isArguments = baseIsArguments(function() {
5185
5361
  return arguments;
5186
5362
  }()) ? baseIsArguments : function(value) {
5187
- return isObjectLike(value) && hasOwnProperty$a.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
5363
+ return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
5188
5364
  };
5189
5365
  var isArguments$1 = isArguments;
5190
5366
  function stubFalse() {
@@ -5229,11 +5405,11 @@ var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
5229
5405
  var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
5230
5406
  var isTypedArray$1 = isTypedArray;
5231
5407
  var objectProto$9 = Object.prototype;
5232
- var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
5408
+ var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
5233
5409
  function arrayLikeKeys(value, inherited) {
5234
5410
  var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
5235
5411
  for (var key in value) {
5236
- if ((inherited || hasOwnProperty$9.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
5412
+ if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
5237
5413
  result.push(key);
5238
5414
  }
5239
5415
  }
@@ -5247,14 +5423,14 @@ function overArg(func, transform) {
5247
5423
  var nativeKeys = overArg(Object.keys, Object);
5248
5424
  var nativeKeys$1 = nativeKeys;
5249
5425
  var objectProto$8 = Object.prototype;
5250
- var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
5426
+ var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
5251
5427
  function baseKeys(object) {
5252
5428
  if (!isPrototype(object)) {
5253
5429
  return nativeKeys$1(object);
5254
5430
  }
5255
5431
  var result = [];
5256
5432
  for (var key in Object(object)) {
5257
- if (hasOwnProperty$8.call(object, key) && key != "constructor") {
5433
+ if (hasOwnProperty$7.call(object, key) && key != "constructor") {
5258
5434
  result.push(key);
5259
5435
  }
5260
5436
  }
@@ -5273,14 +5449,14 @@ function nativeKeysIn(object) {
5273
5449
  return result;
5274
5450
  }
5275
5451
  var objectProto$7 = Object.prototype;
5276
- var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
5452
+ var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
5277
5453
  function baseKeysIn(object) {
5278
5454
  if (!isObject(object)) {
5279
5455
  return nativeKeysIn(object);
5280
5456
  }
5281
5457
  var isProto = isPrototype(object), result = [];
5282
5458
  for (var key in object) {
5283
- if (!(key == "constructor" && (isProto || !hasOwnProperty$7.call(object, key)))) {
5459
+ if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object, key)))) {
5284
5460
  result.push(key);
5285
5461
  }
5286
5462
  }
@@ -5302,20 +5478,20 @@ function hashDelete(key) {
5302
5478
  }
5303
5479
  var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
5304
5480
  var objectProto$6 = Object.prototype;
5305
- var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
5481
+ var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
5306
5482
  function hashGet(key) {
5307
5483
  var data = this.__data__;
5308
5484
  if (nativeCreate$1) {
5309
5485
  var result = data[key];
5310
5486
  return result === HASH_UNDEFINED$2 ? void 0 : result;
5311
5487
  }
5312
- return hasOwnProperty$6.call(data, key) ? data[key] : void 0;
5488
+ return hasOwnProperty$5.call(data, key) ? data[key] : void 0;
5313
5489
  }
5314
5490
  var objectProto$5 = Object.prototype;
5315
- var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
5491
+ var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
5316
5492
  function hashHas(key) {
5317
5493
  var data = this.__data__;
5318
- return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$5.call(data, key);
5494
+ return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$4.call(data, key);
5319
5495
  }
5320
5496
  var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
5321
5497
  function hashSet(key, value) {
@@ -5595,10 +5771,10 @@ if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 ||
5595
5771
  }
5596
5772
  var getTag$1 = getTag;
5597
5773
  var objectProto$3 = Object.prototype;
5598
- var hasOwnProperty$4 = objectProto$3.hasOwnProperty;
5774
+ var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
5599
5775
  function initCloneArray(array) {
5600
5776
  var length = array.length, result = new array.constructor(length);
5601
- if (length && typeof array[0] == "string" && hasOwnProperty$4.call(array, "index")) {
5777
+ if (length && typeof array[0] == "string" && hasOwnProperty$3.call(array, "index")) {
5602
5778
  result.index = array.index;
5603
5779
  result.input = array.input;
5604
5780
  }
@@ -5890,7 +6066,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
5890
6066
  }
5891
6067
  var COMPARE_PARTIAL_FLAG$1 = 1;
5892
6068
  var objectProto$2 = Object.prototype;
5893
- var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
6069
+ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
5894
6070
  function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
5895
6071
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
5896
6072
  if (objLength != othLength && !isPartial) {
@@ -5899,7 +6075,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
5899
6075
  var index = objLength;
5900
6076
  while (index--) {
5901
6077
  var key = objProps[index];
5902
- if (!(isPartial ? key in other : hasOwnProperty$3.call(other, key))) {
6078
+ if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
5903
6079
  return false;
5904
6080
  }
5905
6081
  }
@@ -5937,7 +6113,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
5937
6113
  var COMPARE_PARTIAL_FLAG = 1;
5938
6114
  var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
5939
6115
  var objectProto$1 = Object.prototype;
5940
- var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
6116
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
5941
6117
  function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
5942
6118
  var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
5943
6119
  objTag = objTag == argsTag ? objectTag : objTag;
@@ -5955,7 +6131,7 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
5955
6131
  return objIsArr || isTypedArray$1(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
5956
6132
  }
5957
6133
  if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
5958
- var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$2.call(other, "__wrapped__");
6134
+ var objIsWrapped = objIsObj && hasOwnProperty$1.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
5959
6135
  if (objIsWrapped || othIsWrapped) {
5960
6136
  var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
5961
6137
  stack || (stack = new Stack());
@@ -5994,7 +6170,7 @@ function inRange(number, start, end) {
5994
6170
  }
5995
6171
  var mapTag = "[object Map]", setTag = "[object Set]";
5996
6172
  var objectProto = Object.prototype;
5997
- var hasOwnProperty$1 = objectProto.hasOwnProperty;
6173
+ var hasOwnProperty = objectProto.hasOwnProperty;
5998
6174
  function isEmpty(value) {
5999
6175
  if (value == null) {
6000
6176
  return true;
@@ -6010,7 +6186,7 @@ function isEmpty(value) {
6010
6186
  return !baseKeys(value).length;
6011
6187
  }
6012
6188
  for (var key in value) {
6013
- if (hasOwnProperty$1.call(value, key)) {
6189
+ if (hasOwnProperty.call(value, key)) {
6014
6190
  return false;
6015
6191
  }
6016
6192
  }
@@ -6168,7 +6344,7 @@ const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
6168
6344
  function create(createState) {
6169
6345
  const api = typeof createState === "function" ? createStore(createState) : createState;
6170
6346
  const useStore2 = (selector = api.getState, equalityFn = Object.is) => {
6171
- const [, forceUpdate] = useReducer((c) => c + 1, 0);
6347
+ const [, forceUpdate] = useReducer((c2) => c2 + 1, 0);
6172
6348
  const state = api.getState();
6173
6349
  const stateRef = useRef(state);
6174
6350
  const selectorRef = useRef(selector);
@@ -6273,7 +6449,7 @@ const isInputCounterIncrementEnabled = (item, itemActualQty, validationMap) => {
6273
6449
  }
6274
6450
  };
6275
6451
  const isProductQtyCntAllowedToIncrement = (item, itemActualQty) => {
6276
- const { attrs: { qtyMax } = {} } = item;
6452
+ const { qtyMax } = item;
6277
6453
  return Number(itemActualQty) < Number(qtyMax || Number.MAX_SAFE_INTEGER);
6278
6454
  };
6279
6455
  const checkSelCtxParam = (item, validationMap, param) => {
@@ -6548,12 +6724,25 @@ var EProductKind;
6548
6724
  EProductKind2["STATIC"] = "3e/static";
6549
6725
  EProductKind2["REF"] = "3e/ref";
6550
6726
  EProductKind2["QUERY"] = "3e/query";
6727
+ EProductKind2["CMS"] = "3e/cms";
6551
6728
  })(EProductKind || (EProductKind = {}));
6552
6729
  var EProductKindBucket;
6553
6730
  (function(EProductKindBucket2) {
6554
6731
  EProductKindBucket2["GROUP"] = "group";
6555
6732
  EProductKindBucket2["PRODUCT"] = "product";
6556
6733
  })(EProductKindBucket || (EProductKindBucket = {}));
6734
+ var EOrderUserRole;
6735
+ (function(EOrderUserRole2) {
6736
+ EOrderUserRole2["CREATOR"] = "CREATOR";
6737
+ EOrderUserRole2["CUSTOMER"] = "CUSTOMER";
6738
+ EOrderUserRole2["COUPONS"] = "COUPON";
6739
+ EOrderUserRole2["KIOSK"] = "KIOSK";
6740
+ EOrderUserRole2["WAITER"] = "WAITER";
6741
+ EOrderUserRole2["MANAGER"] = "MANAGER";
6742
+ EOrderUserRole2["VIEWER"] = "VIEWER";
6743
+ EOrderUserRole2["DRIVER"] = "DRIVER";
6744
+ EOrderUserRole2["STAFF"] = "STAFF";
6745
+ })(EOrderUserRole || (EOrderUserRole = {}));
6557
6746
  var EOrderType;
6558
6747
  (function(EOrderType2) {
6559
6748
  EOrderType2["TAKE_AWAY"] = "TAKE_AWAY";
@@ -6567,12 +6756,45 @@ var EOrderType;
6567
6756
  EOrderType2["UBER_DELIVERY"] = "UBER_DELIVERY";
6568
6757
  EOrderType2["UBER_TAKE_AWAY"] = "UBER_TAKE_AWAY";
6569
6758
  EOrderType2["UBER_DINE_IN"] = "UBER_DINE_IN";
6570
- EOrderType2["BOLT_DELIVERY"] = "BOLT_DELIVERY";
6571
- EOrderType2["BOLT_TAKE_AWAY"] = "BOLT_TAKE_AWAY";
6572
6759
  EOrderType2["WOLT_DELIVERY"] = "WOLT_DELIVERY";
6573
6760
  EOrderType2["WOLT_TAKE_AWAY"] = "WOLT_TAKE_AWAY";
6574
6761
  EOrderType2["WOLT_DINE_IN"] = "WOLT_DINE_IN";
6762
+ EOrderType2["BOLT_DELIVERY"] = "BOLT_DELIVERY";
6763
+ EOrderType2["BOLT_TAKE_AWAY"] = "BOLT_TAKE_AWAY";
6764
+ EOrderType2["BOLT_DINE_IN"] = "BOLT_DINE_IN";
6765
+ EOrderType2["TAZZ_DELIVERY"] = "TAZZ_DELIVERY";
6766
+ EOrderType2["TAZZ_TAKE_AWAY"] = "TAZZ_TAKE_AWAY";
6767
+ EOrderType2["UPMENU_DELIVERY"] = "UPMENU_DELIVERY";
6768
+ EOrderType2["UPMENU_TAKE_AWAY"] = "UPMENU_TAKE_AWAY";
6769
+ EOrderType2["UPMENU_DINE_IN"] = "UPMENU_DINE_IN";
6575
6770
  })(EOrderType || (EOrderType = {}));
6771
+ var EOrderSource;
6772
+ (function(EOrderSource2) {
6773
+ EOrderSource2["KIOSK"] = "KIOSK";
6774
+ EOrderSource2["WEB"] = "WEB";
6775
+ EOrderSource2["JUST_EAT_TAKE_AWAY"] = "JUSTEATTAKEAWAY";
6776
+ EOrderSource2["GLOVO"] = "GLOVO";
6777
+ EOrderSource2["PYSZNE"] = "PYSZNE";
6778
+ EOrderSource2["WOLT"] = "WOLT";
6779
+ EOrderSource2["UBER"] = "UBER";
6780
+ EOrderSource2["BOLT"] = "BOLT";
6781
+ EOrderSource2["TAZZ"] = "TAZZ";
6782
+ EOrderSource2["POS"] = "POS";
6783
+ EOrderSource2["UPMENU"] = "UPMENU";
6784
+ })(EOrderSource || (EOrderSource = {}));
6785
+ var EChannelName;
6786
+ (function(EChannelName2) {
6787
+ EChannelName2["DINE_IN"] = "DINE_IN";
6788
+ EChannelName2["TAKE_AWAY"] = "TAKE_AWAY";
6789
+ EChannelName2["DELIVERY"] = "DELIVERY";
6790
+ EChannelName2["GLOVO"] = "GLOVO";
6791
+ EChannelName2["JUSTEAT"] = "JUSTEAT";
6792
+ EChannelName2["UBER"] = "UBER";
6793
+ EChannelName2["BOLT"] = "BOLT";
6794
+ EChannelName2["WOLT"] = "WOLT";
6795
+ EChannelName2["TAZZ"] = "TAZZ";
6796
+ EChannelName2["UPMENU"] = "UPMENU";
6797
+ })(EChannelName || (EChannelName = {}));
6576
6798
  var EOrderStatus;
6577
6799
  (function(EOrderStatus2) {
6578
6800
  EOrderStatus2["NEW"] = "NEW";
@@ -6598,17 +6820,14 @@ var EOrderPaymentType;
6598
6820
  EOrderPaymentType2["RETURN"] = "RETURN";
6599
6821
  EOrderPaymentType2["EXTERNAL"] = "EXTERNAL";
6600
6822
  })(EOrderPaymentType || (EOrderPaymentType = {}));
6601
- var EOrderSource;
6602
- (function(EOrderSource2) {
6603
- EOrderSource2["KIOSK"] = "KIOSK";
6604
- EOrderSource2["WEB"] = "WEB";
6605
- EOrderSource2["JUST_EAT_TAKE_AWAY"] = "JUSTEATTAKEAWAY";
6606
- EOrderSource2["GLOVO"] = "GLOVO";
6607
- EOrderSource2["PYSZNE"] = "PYSZNE";
6608
- EOrderSource2["WOLT"] = "WOLT";
6609
- EOrderSource2["UBER"] = "UBER";
6610
- EOrderSource2["BOLT"] = "BOLT";
6611
- })(EOrderSource || (EOrderSource = {}));
6823
+ var ERbiOrderExtra;
6824
+ (function(ERbiOrderExtra2) {
6825
+ ERbiOrderExtra2["POINTS_TOTAL"] = "x-rbi-loyalty-points";
6826
+ ERbiOrderExtra2["POINTS_EARNED"] = "x-rbi-points-earned";
6827
+ ERbiOrderExtra2["REWARDS"] = "x-rbi-rewards";
6828
+ ERbiOrderExtra2["OFFERS"] = "x-rbi-offers";
6829
+ ERbiOrderExtra2["CUSTOMER_NAME"] = "x-customer-name";
6830
+ })(ERbiOrderExtra || (ERbiOrderExtra = {}));
6612
6831
  var EOrderLineStatus;
6613
6832
  (function(EOrderLineStatus2) {
6614
6833
  EOrderLineStatus2["NEW"] = "NEW";
@@ -6624,17 +6843,6 @@ var EOrderProductKind;
6624
6843
  EOrderProductKind2["GROUP"] = "group";
6625
6844
  EOrderProductKind2["PRODUCT"] = "product";
6626
6845
  })(EOrderProductKind || (EOrderProductKind = {}));
6627
- var EChannelName;
6628
- (function(EChannelName2) {
6629
- EChannelName2["DINE_IN"] = "DINE_IN";
6630
- EChannelName2["TAKE_AWAY"] = "TAKE_AWAY";
6631
- EChannelName2["DELIVERY"] = "DELIVERY";
6632
- EChannelName2["GLOVO"] = "GLOVO";
6633
- EChannelName2["JUSTEAT"] = "JUSTEAT";
6634
- EChannelName2["UBER"] = "UBER";
6635
- EChannelName2["BOLT"] = "BOLT";
6636
- EChannelName2["WOLT"] = "WOLT";
6637
- })(EChannelName || (EChannelName = {}));
6638
6846
  var ENotificationType;
6639
6847
  (function(ENotificationType2) {
6640
6848
  ENotificationType2["ORDER_EVENT_ERROR"] = "OrderEventError";
@@ -6647,6 +6855,7 @@ const validateProductFilter = (product, stateFilter) => {
6647
6855
  const stateFiltersWithFltCtx = stateFilter[fltCtx];
6648
6856
  const hasProductFilters = !!Object.keys(productFilters).length;
6649
6857
  if (hasProductFilters && stateFiltersWithFltCtx) {
6858
+ console.log("12345", productFilters);
6650
6859
  const commonFilters = Object.keys(stateFiltersWithFltCtx).filter(
6651
6860
  (filterName) => Object.keys(productFilters).includes(filterName) && productFilters[filterName].includes(stateFiltersWithFltCtx[filterName])
6652
6861
  );
@@ -6737,75 +6946,8 @@ function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
6737
6946
  }
6738
6947
  var jsxRuntime = { exports: {} };
6739
6948
  var reactJsxRuntime_production_min = {};
6740
- /*
6741
- object-assign
6742
- (c) Sindre Sorhus
6743
- @license MIT
6744
- */
6745
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
6746
- var hasOwnProperty = Object.prototype.hasOwnProperty;
6747
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
6748
- function toObject(val) {
6749
- if (val === null || val === void 0) {
6750
- throw new TypeError("Object.assign cannot be called with null or undefined");
6751
- }
6752
- return Object(val);
6753
- }
6754
- function shouldUseNative() {
6755
- try {
6756
- if (!Object.assign) {
6757
- return false;
6758
- }
6759
- var test1 = new String("abc");
6760
- test1[5] = "de";
6761
- if (Object.getOwnPropertyNames(test1)[0] === "5") {
6762
- return false;
6763
- }
6764
- var test2 = {};
6765
- for (var i2 = 0; i2 < 10; i2++) {
6766
- test2["_" + String.fromCharCode(i2)] = i2;
6767
- }
6768
- var order2 = Object.getOwnPropertyNames(test2).map(function(n2) {
6769
- return test2[n2];
6770
- });
6771
- if (order2.join("") !== "0123456789") {
6772
- return false;
6773
- }
6774
- var test3 = {};
6775
- "abcdefghijklmnopqrst".split("").forEach(function(letter) {
6776
- test3[letter] = letter;
6777
- });
6778
- if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
6779
- return false;
6780
- }
6781
- return true;
6782
- } catch (err) {
6783
- return false;
6784
- }
6785
- }
6786
- shouldUseNative() ? Object.assign : function(target, source) {
6787
- var from;
6788
- var to = toObject(target);
6789
- var symbols;
6790
- for (var s2 = 1; s2 < arguments.length; s2++) {
6791
- from = Object(arguments[s2]);
6792
- for (var key in from) {
6793
- if (hasOwnProperty.call(from, key)) {
6794
- to[key] = from[key];
6795
- }
6796
- }
6797
- if (getOwnPropertySymbols) {
6798
- symbols = getOwnPropertySymbols(from);
6799
- for (var i2 = 0; i2 < symbols.length; i2++) {
6800
- if (propIsEnumerable.call(from, symbols[i2])) {
6801
- to[symbols[i2]] = from[symbols[i2]];
6802
- }
6803
- }
6804
- }
6805
- }
6806
- return to;
6807
- };
6808
- /** @license React v17.0.2
6949
+ /**
6950
+ * @license React
6809
6951
  * react-jsx-runtime.production.min.js
6810
6952
  *
6811
6953
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -6813,28 +6955,22 @@ shouldUseNative() ? Object.assign : function(target, source) {
6813
6955
  * This source code is licensed under the MIT license found in the
6814
6956
  * LICENSE file in the root directory of this source tree.
6815
6957
  */
6816
- var f$3 = React, g = 60103;
6817
- reactJsxRuntime_production_min.Fragment = 60107;
6818
- if ("function" === typeof Symbol && Symbol.for) {
6819
- var h$3 = Symbol.for;
6820
- g = h$3("react.element");
6821
- reactJsxRuntime_production_min.Fragment = h$3("react.fragment");
6822
- }
6823
- var m$3 = f$3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n$2 = Object.prototype.hasOwnProperty, p$3 = { key: true, ref: true, __self: true, __source: true };
6824
- function q(c, a2, k2) {
6825
- var b, d2 = {}, e2 = null, l2 = null;
6826
- void 0 !== k2 && (e2 = "" + k2);
6958
+ 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 };
6959
+ function q$1(c2, a2, g2) {
6960
+ var b2, d2 = {}, e2 = null, h2 = null;
6961
+ void 0 !== g2 && (e2 = "" + g2);
6827
6962
  void 0 !== a2.key && (e2 = "" + a2.key);
6828
- void 0 !== a2.ref && (l2 = a2.ref);
6829
- for (b in a2)
6830
- n$2.call(a2, b) && !p$3.hasOwnProperty(b) && (d2[b] = a2[b]);
6831
- if (c && c.defaultProps)
6832
- for (b in a2 = c.defaultProps, a2)
6833
- void 0 === d2[b] && (d2[b] = a2[b]);
6834
- return { $$typeof: g, type: c, key: e2, ref: l2, props: d2, _owner: m$3.current };
6835
- }
6836
- reactJsxRuntime_production_min.jsx = q;
6837
- reactJsxRuntime_production_min.jsxs = q;
6963
+ void 0 !== a2.ref && (h2 = a2.ref);
6964
+ for (b2 in a2)
6965
+ m$3.call(a2, b2) && !p$4.hasOwnProperty(b2) && (d2[b2] = a2[b2]);
6966
+ if (c2 && c2.defaultProps)
6967
+ for (b2 in a2 = c2.defaultProps, a2)
6968
+ void 0 === d2[b2] && (d2[b2] = a2[b2]);
6969
+ return { $$typeof: k$1, type: c2, key: e2, ref: h2, props: d2, _owner: n$4.current };
6970
+ }
6971
+ reactJsxRuntime_production_min.Fragment = l$6;
6972
+ reactJsxRuntime_production_min.jsx = q$1;
6973
+ reactJsxRuntime_production_min.jsxs = q$1;
6838
6974
  {
6839
6975
  jsxRuntime.exports = reactJsxRuntime_production_min;
6840
6976
  }
@@ -6943,8 +7079,8 @@ function _nonIterableRest() {
6943
7079
  }
6944
7080
  var Static = {
6945
7081
  normalizePrecision: function normalizePrecision(objects) {
6946
- var highestPrecision = objects.reduce(function(a2, b) {
6947
- return Math.max(a2.getPrecision(), b.getPrecision());
7082
+ var highestPrecision = objects.reduce(function(a2, b2) {
7083
+ return Math.max(a2.getPrecision(), b2.getPrecision());
6948
7084
  });
6949
7085
  return objects.map(function(object) {
6950
7086
  return object.getPrecision() !== highestPrecision ? object.convertPrecision(highestPrecision) : object;
@@ -7049,12 +7185,12 @@ function isThenable(value) {
7049
7185
  return Boolean(value) && (_typeof(value) === "object" || typeof value === "function") && typeof value.then === "function";
7050
7186
  }
7051
7187
  function Calculator() {
7052
- var floatMultiply = function floatMultiply2(a2, b) {
7188
+ var floatMultiply = function floatMultiply2(a2, b2) {
7053
7189
  var getFactor = function getFactor2(number) {
7054
7190
  return Math.pow(10, countFractionDigits(number));
7055
7191
  };
7056
- var factor = Math.max(getFactor(a2), getFactor(b));
7057
- return Math.round(a2 * factor) * Math.round(b * factor) / (factor * factor);
7192
+ var factor = Math.max(getFactor(a2), getFactor(b2));
7193
+ return Math.round(a2 * factor) * Math.round(b2 * factor) / (factor * factor);
7058
7194
  };
7059
7195
  var roundingModes = {
7060
7196
  HALF_ODD: function HALF_ODD(number) {
@@ -7082,20 +7218,20 @@ function Calculator() {
7082
7218
  }
7083
7219
  };
7084
7220
  return {
7085
- add: function add(a2, b) {
7086
- return a2 + b;
7221
+ add: function add(a2, b2) {
7222
+ return a2 + b2;
7087
7223
  },
7088
- subtract: function subtract(a2, b) {
7089
- return a2 - b;
7224
+ subtract: function subtract(a2, b2) {
7225
+ return a2 - b2;
7090
7226
  },
7091
- multiply: function multiply(a2, b) {
7092
- return isFloat(a2) || isFloat(b) ? floatMultiply(a2, b) : a2 * b;
7227
+ multiply: function multiply(a2, b2) {
7228
+ return isFloat(a2) || isFloat(b2) ? floatMultiply(a2, b2) : a2 * b2;
7093
7229
  },
7094
- divide: function divide(a2, b) {
7095
- return a2 / b;
7230
+ divide: function divide(a2, b2) {
7231
+ return a2 / b2;
7096
7232
  },
7097
- modulo: function modulo(a2, b) {
7098
- return a2 % b;
7233
+ modulo: function modulo(a2, b2) {
7234
+ return a2 % b2;
7099
7235
  },
7100
7236
  round: function round(number) {
7101
7237
  var roundingMode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "HALF_EVEN";
@@ -7277,8 +7413,8 @@ var Dinero = function Dinero2(options) {
7277
7413
  allocate: function allocate(ratios) {
7278
7414
  var _this = this;
7279
7415
  assertValidRatios(ratios);
7280
- var total = ratios.reduce(function(a2, b) {
7281
- return calculator$1.add(a2, b);
7416
+ var total = ratios.reduce(function(a2, b2) {
7417
+ return calculator$1.add(a2, b2);
7282
7418
  });
7283
7419
  var remainder = this.getAmount();
7284
7420
  var shares = ratios.map(function(ratio) {
@@ -7382,7 +7518,7 @@ var Dinero = function Dinero2(options) {
7382
7518
  var factor = Math.pow(10, digits);
7383
7519
  return calculator$1.divide(calculator$1.round(calculator$1.multiply(this.toUnit(), factor), roundingMode), factor);
7384
7520
  },
7385
- toObject: function toObject2() {
7521
+ toObject: function toObject() {
7386
7522
  return {
7387
7523
  amount,
7388
7524
  currency,
@@ -7652,34 +7788,34 @@ function hasLoadedNamespace(ns, i18n) {
7652
7788
  }
7653
7789
  });
7654
7790
  }
7655
- function _iterableToArrayLimit(arr2, i2) {
7656
- var _i = null == arr2 ? null : "undefined" != typeof Symbol && arr2[Symbol.iterator] || arr2["@@iterator"];
7657
- if (null != _i) {
7658
- var _s, _e2, _x, _r, _arr = [], _n = true, _d = false;
7791
+ function _iterableToArrayLimit(r2, l2) {
7792
+ var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"];
7793
+ if (null != t2) {
7794
+ var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false;
7659
7795
  try {
7660
- if (_x = (_i = _i.call(arr2)).next, 0 === i2) {
7661
- if (Object(_i) !== _i)
7796
+ if (i2 = (t2 = t2.call(r2)).next, 0 === l2) {
7797
+ if (Object(t2) !== t2)
7662
7798
  return;
7663
- _n = false;
7799
+ f2 = false;
7664
7800
  } else
7665
- for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true)
7801
+ for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true)
7666
7802
  ;
7667
- } catch (err) {
7668
- _d = true, _e2 = err;
7803
+ } catch (r3) {
7804
+ o2 = true, n2 = r3;
7669
7805
  } finally {
7670
7806
  try {
7671
- if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r))
7807
+ if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2))
7672
7808
  return;
7673
7809
  } finally {
7674
- if (_d)
7675
- throw _e2;
7810
+ if (o2)
7811
+ throw n2;
7676
7812
  }
7677
7813
  }
7678
- return _arr;
7814
+ return a2;
7679
7815
  }
7680
7816
  }
7681
- function _slicedToArray(arr2, i2) {
7682
- return _arrayWithHoles$1(arr2) || _iterableToArrayLimit(arr2, i2) || _unsupportedIterableToArray$1(arr2, i2) || _nonIterableRest$1();
7817
+ function _slicedToArray(r2, e2) {
7818
+ return _arrayWithHoles$1(r2) || _iterableToArrayLimit(r2, e2) || _unsupportedIterableToArray$1(r2, e2) || _nonIterableRest$1();
7683
7819
  }
7684
7820
  function ownKeys(object, enumerableOnly) {
7685
7821
  var keys2 = Object.keys(object);
@@ -7894,12 +8030,12 @@ var cookie = {
7894
8030
  var nameEQ = "".concat(name, "=");
7895
8031
  var ca = document.cookie.split(";");
7896
8032
  for (var i2 = 0; i2 < ca.length; i2++) {
7897
- var c = ca[i2];
7898
- while (c.charAt(0) === " ") {
7899
- c = c.substring(1, c.length);
8033
+ var c2 = ca[i2];
8034
+ while (c2.charAt(0) === " ") {
8035
+ c2 = c2.substring(1, c2.length);
7900
8036
  }
7901
- if (c.indexOf(nameEQ) === 0)
7902
- return c.substring(nameEQ.length, c.length);
8037
+ if (c2.indexOf(nameEQ) === 0)
8038
+ return c2.substring(nameEQ.length, c2.length);
7903
8039
  }
7904
8040
  return null;
7905
8041
  },
@@ -7912,9 +8048,9 @@ var cookie$1 = {
7912
8048
  lookup: function lookup(options) {
7913
8049
  var found;
7914
8050
  if (options.lookupCookie && typeof document !== "undefined") {
7915
- var c = cookie.read(options.lookupCookie);
7916
- if (c)
7917
- found = c;
8051
+ var c2 = cookie.read(options.lookupCookie);
8052
+ if (c2)
8053
+ found = c2;
7918
8054
  }
7919
8055
  return found;
7920
8056
  },
@@ -8405,7 +8541,7 @@ const MenuOptionsDefaultUI = (props) => {
8405
8541
  })]
8406
8542
  });
8407
8543
  };
8408
- const ComponentsContext = React.createContext(null);
8544
+ const ComponentsContext = React__default.createContext(null);
8409
8545
  function useComponents() {
8410
8546
  const context = useContext(ComponentsContext);
8411
8547
  if (!context) {
@@ -8664,6 +8800,9 @@ function useEmitFilter(product) {
8664
8800
  const setFilter = useStore((state) => state.setFilter);
8665
8801
  const { id, selCtx, emit = {}, fltCtx } = product;
8666
8802
  const value = watch(`selected.${selCtx}.${id}`);
8803
+ if (id === "MI1001001") {
8804
+ console.log("use emit filter", value, fltCtx, emit);
8805
+ }
8667
8806
  useEffect(() => {
8668
8807
  if (value && fltCtx && !isEmpty(emit)) {
8669
8808
  setFilter(fltCtx, emit);
@@ -8703,7 +8842,7 @@ const selectUnselectProduct = (setValue, getValues, items, isChecked, state) =>
8703
8842
  if (isChecked) {
8704
8843
  addProductToState(selected, setValue);
8705
8844
  const checkSubProducts = (items2) => {
8706
- if (!Array.isArray(items2))
8845
+ if (!Array.isArray(items2) || isEmpty(state == null ? void 0 : state.selected))
8707
8846
  return;
8708
8847
  items2.map((product) => {
8709
8848
  if (product.state && "selected" in product.state) {
@@ -9069,11 +9208,14 @@ const DisplayState = () => {
9069
9208
  const {
9070
9209
  watch
9071
9210
  } = useFormContext();
9211
+ const form = useFormContext();
9072
9212
  const selected = watch("selected");
9213
+ const filter = form.getValues("filter");
9073
9214
  const validationMap = useStore((state) => state.validationMap);
9074
9215
  console.log({
9075
9216
  selected,
9076
- validationMap
9217
+ validationMap,
9218
+ filter
9077
9219
  });
9078
9220
  return /* @__PURE__ */ jsxs("div", {
9079
9221
  className: "flex flex-col items-center py-4",
@@ -9085,7 +9227,7 @@ const DisplayState = () => {
9085
9227
  children: [/* @__PURE__ */ jsxs("p", {
9086
9228
  className: "text-lg font-semibold",
9087
9229
  children: [selCtx, ":"]
9088
- }), Object.keys(selected[selCtx]).map((id) => /* @__PURE__ */ jsx(React.Fragment, {
9230
+ }), Object.keys(selected[selCtx]).map((id) => /* @__PURE__ */ jsx(React__default.Fragment, {
9089
9231
  children: selected[selCtx][id] && /* @__PURE__ */ jsxs("p", {
9090
9232
  children: [id, ":", selected[selCtx][id].toString()]
9091
9233
  })
@@ -9241,24 +9383,62 @@ function clsx() {
9241
9383
  (e2 = arguments[f2++]) && (t2 = r$4(e2)) && (n2 && (n2 += " "), n2 += t2);
9242
9384
  return n2;
9243
9385
  }
9244
- const e$3 = typeof window == "undefined" || typeof document == "undefined";
9245
- let s$6 = e$3 ? useEffect : useLayoutEffect;
9246
- function s$5(e2) {
9386
+ var i$3 = Object.defineProperty;
9387
+ var d$5 = (t2, e2, n2) => e2 in t2 ? i$3(t2, e2, { enumerable: true, configurable: true, writable: true, value: n2 }) : t2[e2] = n2;
9388
+ var r$3 = (t2, e2, n2) => (d$5(t2, typeof e2 != "symbol" ? e2 + "" : e2, n2), n2);
9389
+ class o$5 {
9390
+ constructor() {
9391
+ r$3(this, "current", this.detect());
9392
+ r$3(this, "handoffState", "pending");
9393
+ r$3(this, "currentId", 0);
9394
+ }
9395
+ set(e2) {
9396
+ this.current !== e2 && (this.handoffState = "pending", this.currentId = 0, this.current = e2);
9397
+ }
9398
+ reset() {
9399
+ this.set(this.detect());
9400
+ }
9401
+ nextId() {
9402
+ return ++this.currentId;
9403
+ }
9404
+ get isServer() {
9405
+ return this.current === "server";
9406
+ }
9407
+ get isClient() {
9408
+ return this.current === "client";
9409
+ }
9410
+ detect() {
9411
+ return typeof window == "undefined" || typeof document == "undefined" ? "server" : "client";
9412
+ }
9413
+ handoff() {
9414
+ this.handoffState === "pending" && (this.handoffState = "complete");
9415
+ }
9416
+ get isHandoffComplete() {
9417
+ return this.handoffState === "complete";
9418
+ }
9419
+ }
9420
+ let s$8 = new o$5();
9421
+ let l$5 = (e2, f2) => {
9422
+ s$8.isServer ? useEffect(e2, f2) : useLayoutEffect(e2, f2);
9423
+ };
9424
+ function s$7(e2) {
9247
9425
  let r2 = useRef(e2);
9248
- return s$6(() => {
9426
+ return l$5(() => {
9249
9427
  r2.current = e2;
9250
9428
  }, [e2]), r2;
9251
9429
  }
9252
- function t(e2) {
9430
+ let o$4 = function(t2) {
9431
+ let e2 = s$7(t2);
9432
+ return React__default.useCallback((...r2) => e2.current(...r2), [e2]);
9433
+ };
9434
+ function t$6(e2) {
9253
9435
  typeof queueMicrotask == "function" ? queueMicrotask(e2) : Promise.resolve().then(e2).catch((o2) => setTimeout(() => {
9254
9436
  throw o2;
9255
9437
  }));
9256
9438
  }
9257
- function m$2() {
9258
- let n2 = [], i2 = [], r2 = { enqueue(e2) {
9259
- i2.push(e2);
9260
- }, addEventListener(e2, t2, a2, o2) {
9261
- return e2.addEventListener(t2, a2, o2), r2.add(() => e2.removeEventListener(t2, a2, o2));
9439
+ function o$3() {
9440
+ let n2 = [], r2 = { addEventListener(e2, t2, s2, a2) {
9441
+ return e2.addEventListener(t2, s2, a2), r2.add(() => e2.removeEventListener(t2, s2, a2));
9262
9442
  }, requestAnimationFrame(...e2) {
9263
9443
  let t2 = requestAnimationFrame(...e2);
9264
9444
  return r2.add(() => cancelAnimationFrame(t2));
@@ -9268,130 +9448,134 @@ function m$2() {
9268
9448
  let t2 = setTimeout(...e2);
9269
9449
  return r2.add(() => clearTimeout(t2));
9270
9450
  }, microTask(...e2) {
9271
- let t$1 = { current: true };
9272
- return t(() => {
9273
- t$1.current && e2[0]();
9451
+ let t2 = { current: true };
9452
+ return t$6(() => {
9453
+ t2.current && e2[0]();
9274
9454
  }), r2.add(() => {
9275
- t$1.current = false;
9455
+ t2.current = false;
9276
9456
  });
9457
+ }, style(e2, t2, s2) {
9458
+ let a2 = e2.style.getPropertyValue(t2);
9459
+ return Object.assign(e2.style, { [t2]: s2 }), this.add(() => {
9460
+ Object.assign(e2.style, { [t2]: a2 });
9461
+ });
9462
+ }, group(e2) {
9463
+ let t2 = o$3();
9464
+ return e2(t2), this.add(() => t2.dispose());
9277
9465
  }, add(e2) {
9278
9466
  return n2.push(e2), () => {
9279
9467
  let t2 = n2.indexOf(e2);
9280
- if (t2 >= 0) {
9281
- let [a2] = n2.splice(t2, 1);
9282
- a2();
9283
- }
9468
+ if (t2 >= 0)
9469
+ for (let s2 of n2.splice(t2, 1))
9470
+ s2();
9284
9471
  };
9285
9472
  }, dispose() {
9286
9473
  for (let e2 of n2.splice(0))
9287
9474
  e2();
9288
- }, async workQueue() {
9289
- for (let e2 of i2.splice(0))
9290
- await e2();
9291
9475
  } };
9292
9476
  return r2;
9293
9477
  }
9294
- function p$2() {
9295
- let [e2] = useState(m$2);
9478
+ function p$3() {
9479
+ let [e2] = useState(o$3);
9296
9480
  return useEffect(() => () => e2.dispose(), [e2]), e2;
9297
9481
  }
9298
- let o$3 = function(t2) {
9299
- let e2 = s$5(t2);
9300
- return React.useCallback((...r2) => e2.current(...r2), [e2]);
9301
- };
9302
- let r$3 = { serverHandoffComplete: false };
9303
- function a$2() {
9304
- let [e2, f2] = useState(r$3.serverHandoffComplete);
9305
- return useEffect(() => {
9306
- e2 !== true && f2(true);
9307
- }, [e2]), useEffect(() => {
9308
- r$3.serverHandoffComplete === false && (r$3.serverHandoffComplete = true);
9309
- }, []), e2;
9310
- }
9311
- var u$4;
9312
- let l$3 = 0;
9313
- function r$2() {
9314
- return ++l$3;
9315
- }
9316
- let I$2 = (u$4 = React.useId) != null ? u$4 : function() {
9317
- let n2 = a$2(), [e2, o2] = React.useState(n2 ? r$2 : null);
9318
- return s$6(() => {
9319
- e2 === null && o2(r$2());
9482
+ function s$6() {
9483
+ let r2 = typeof document == "undefined";
9484
+ return "useSyncExternalStore" in React ? ((o2) => o2.useSyncExternalStore)(React)(() => () => {
9485
+ }, () => false, () => !r2) : false;
9486
+ }
9487
+ function l$4() {
9488
+ let r2 = s$6(), [e2, n2] = React.useState(s$8.isHandoffComplete);
9489
+ return e2 && s$8.isHandoffComplete === false && n2(false), React.useEffect(() => {
9490
+ e2 !== true && n2(true);
9491
+ }, [e2]), React.useEffect(() => s$8.handoff(), []), r2 ? false : e2;
9492
+ }
9493
+ var o$2;
9494
+ let I$5 = (o$2 = React__default.useId) != null ? o$2 : function() {
9495
+ let n2 = l$4(), [e2, u2] = React__default.useState(n2 ? () => s$8.nextId() : null);
9496
+ return l$5(() => {
9497
+ e2 === null && u2(s$8.nextId());
9320
9498
  }, [e2]), e2 != null ? "" + e2 : void 0;
9321
9499
  };
9322
- function u$3(r2, n2, ...a2) {
9500
+ function u$5(r2, n2, ...a2) {
9323
9501
  if (r2 in n2) {
9324
9502
  let e2 = n2[r2];
9325
9503
  return typeof e2 == "function" ? e2(...a2) : e2;
9326
9504
  }
9327
9505
  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(", ")}.`);
9328
- throw Error.captureStackTrace && Error.captureStackTrace(t2, u$3), t2;
9506
+ throw Error.captureStackTrace && Error.captureStackTrace(t2, u$5), t2;
9329
9507
  }
9330
- function e$2(r2) {
9331
- return e$3 ? null : r2 instanceof Node ? r2.ownerDocument : r2 != null && r2.hasOwnProperty("current") && r2.current instanceof Node ? r2.current.ownerDocument : document;
9508
+ function o$1(r2) {
9509
+ return s$8.isServer ? null : r2 instanceof Node ? r2.ownerDocument : r2 != null && r2.hasOwnProperty("current") && r2.current instanceof Node ? r2.current.ownerDocument : document;
9332
9510
  }
9333
- 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(",");
9334
- 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 || {});
9335
- function E$1(e2 = document.body) {
9336
- 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)));
9511
+ 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(",");
9512
+ 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 || {});
9513
+ function f$4(e2 = document.body) {
9514
+ 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)));
9337
9515
  }
9338
- var F$4 = ((r2) => (r2[r2.Strict = 0] = "Strict", r2[r2.Loose = 1] = "Loose", r2))(F$4 || {});
9339
- function h$2(e2, t2 = 0) {
9340
- var r2;
9341
- return e2 === ((r2 = e$2(e2)) == null ? void 0 : r2.body) ? false : u$3(t2, { [0]() {
9342
- return e2.matches(f$2);
9516
+ var T$1 = ((t2) => (t2[t2.Strict = 0] = "Strict", t2[t2.Loose = 1] = "Loose", t2))(T$1 || {});
9517
+ function h$2(e2, r2 = 0) {
9518
+ var t2;
9519
+ return e2 === ((t2 = o$1(e2)) == null ? void 0 : t2.body) ? false : u$5(r2, { [0]() {
9520
+ return e2.matches(c$4);
9343
9521
  }, [1]() {
9344
9522
  let l2 = e2;
9345
9523
  for (; l2 !== null; ) {
9346
- if (l2.matches(f$2))
9524
+ if (l2.matches(c$4))
9347
9525
  return true;
9348
9526
  l2 = l2.parentElement;
9349
9527
  }
9350
9528
  return false;
9351
9529
  } });
9352
9530
  }
9353
- function S$2(e2) {
9531
+ var w$1 = ((t2) => (t2[t2.Keyboard = 0] = "Keyboard", t2[t2.Mouse = 1] = "Mouse", t2))(w$1 || {});
9532
+ typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("keydown", (e2) => {
9533
+ e2.metaKey || e2.altKey || e2.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
9534
+ }, true), document.addEventListener("click", (e2) => {
9535
+ e2.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e2.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
9536
+ }, true));
9537
+ function y$3(e2) {
9354
9538
  e2 == null || e2.focus({ preventScroll: true });
9355
9539
  }
9356
- let H$1 = ["textarea", "input"].join(",");
9357
- function w$1(e2) {
9358
- var t2, r2;
9359
- return (r2 = (t2 = e2 == null ? void 0 : e2.matches) == null ? void 0 : t2.call(e2, H$1)) != null ? r2 : false;
9540
+ let S$5 = ["textarea", "input"].join(",");
9541
+ function H(e2) {
9542
+ var r2, t2;
9543
+ return (t2 = (r2 = e2 == null ? void 0 : e2.matches) == null ? void 0 : r2.call(e2, S$5)) != null ? t2 : false;
9360
9544
  }
9361
- function A$3(e2, t2 = (r2) => r2) {
9362
- return e2.slice().sort((r2, l2) => {
9363
- let o2 = t2(r2), i2 = t2(l2);
9545
+ function I$4(e2, r2 = (t2) => t2) {
9546
+ return e2.slice().sort((t2, l2) => {
9547
+ let o2 = r2(t2), i2 = r2(l2);
9364
9548
  if (o2 === null || i2 === null)
9365
9549
  return 0;
9366
9550
  let n2 = o2.compareDocumentPosition(i2);
9367
9551
  return n2 & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n2 & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
9368
9552
  });
9369
9553
  }
9370
- function I$1(e2, t2, { sorted: r2 = true, relativeTo: l2 = null, skipElements: o2 = [] } = {}) {
9371
- 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);
9372
- o2.length > 0 && (n2 = n2.filter((s2) => !o2.includes(s2))), l2 = l2 != null ? l2 : i2.activeElement;
9373
- let d2 = (() => {
9374
- if (t2 & 5)
9554
+ function O$1(e2, r2, { sorted: t2 = true, relativeTo: l2 = null, skipElements: o2 = [] } = {}) {
9555
+ 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);
9556
+ o2.length > 0 && n2.length > 1 && (n2 = n2.filter((s2) => !o2.includes(s2))), l2 = l2 != null ? l2 : i2.activeElement;
9557
+ let E2 = (() => {
9558
+ if (r2 & 5)
9375
9559
  return 1;
9376
- if (t2 & 10)
9560
+ if (r2 & 10)
9377
9561
  return -1;
9378
9562
  throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
9379
9563
  })(), x2 = (() => {
9380
- if (t2 & 1)
9564
+ if (r2 & 1)
9381
9565
  return 0;
9382
- if (t2 & 2)
9566
+ if (r2 & 2)
9383
9567
  return Math.max(0, n2.indexOf(l2)) - 1;
9384
- if (t2 & 4)
9568
+ if (r2 & 4)
9385
9569
  return Math.max(0, n2.indexOf(l2)) + 1;
9386
- if (t2 & 8)
9570
+ if (r2 & 8)
9387
9571
  return n2.length - 1;
9388
9572
  throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
9389
- })(), p2 = t2 & 32 ? { preventScroll: true } : {}, c = 0, a2 = n2.length, u2;
9573
+ })(), p2 = r2 & 32 ? { preventScroll: true } : {}, d2 = 0, a2 = n2.length, u2;
9390
9574
  do {
9391
- if (c >= a2 || c + a2 <= 0)
9575
+ if (d2 >= a2 || d2 + a2 <= 0)
9392
9576
  return 0;
9393
- let s2 = x2 + c;
9394
- if (t2 & 16)
9577
+ let s2 = x2 + d2;
9578
+ if (r2 & 16)
9395
9579
  s2 = (s2 + a2) % a2;
9396
9580
  else {
9397
9581
  if (s2 < 0)
@@ -9399,12 +9583,21 @@ function I$1(e2, t2, { sorted: r2 = true, relativeTo: l2 = null, skipElements: o
9399
9583
  if (s2 >= a2)
9400
9584
  return 1;
9401
9585
  }
9402
- u2 = n2[s2], u2 == null || u2.focus(p2), c += d2;
9586
+ u2 = n2[s2], u2 == null || u2.focus(p2), d2 += E2;
9403
9587
  } while (u2 !== i2.activeElement);
9404
- return t2 & 6 && w$1(u2) && u2.select(), u2.hasAttribute("tabindex") || u2.setAttribute("tabindex", "0"), 2;
9588
+ return r2 & 6 && H(u2) && u2.select(), 2;
9589
+ }
9590
+ function t$5() {
9591
+ return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
9592
+ }
9593
+ function i$2() {
9594
+ return /Android/gi.test(window.navigator.userAgent);
9405
9595
  }
9406
- function d$1(e2, r2, n2) {
9407
- let o2 = s$5(r2);
9596
+ function n$3() {
9597
+ return t$5() || i$2();
9598
+ }
9599
+ function d$4(e2, r2, n2) {
9600
+ let o2 = s$7(r2);
9408
9601
  useEffect(() => {
9409
9602
  function t2(u2) {
9410
9603
  o2.current(u2);
@@ -9412,139 +9605,201 @@ function d$1(e2, r2, n2) {
9412
9605
  return document.addEventListener(e2, t2, n2), () => document.removeEventListener(e2, t2, n2);
9413
9606
  }, [e2, n2]);
9414
9607
  }
9415
- function L(m2, E2, c = true) {
9608
+ function s$5(e2, r2, n2) {
9609
+ let o2 = s$7(r2);
9610
+ useEffect(() => {
9611
+ function t2(i2) {
9612
+ o2.current(i2);
9613
+ }
9614
+ return window.addEventListener(e2, t2, n2), () => window.removeEventListener(e2, t2, n2);
9615
+ }, [e2, n2]);
9616
+ }
9617
+ function y$2(s2, m2, a2 = true) {
9416
9618
  let i2 = useRef(false);
9417
9619
  useEffect(() => {
9418
9620
  requestAnimationFrame(() => {
9419
- i2.current = c;
9621
+ i2.current = a2;
9420
9622
  });
9421
- }, [c]);
9422
- function f2(e2, o2) {
9623
+ }, [a2]);
9624
+ function c2(e2, r2) {
9423
9625
  if (!i2.current || e2.defaultPrevented)
9424
9626
  return;
9425
- let l2 = function r2(t2) {
9426
- return typeof t2 == "function" ? r2(t2()) : Array.isArray(t2) || t2 instanceof Set ? t2 : [t2];
9427
- }(m2), n2 = o2(e2);
9428
- if (n2 !== null && !!n2.getRootNode().contains(n2)) {
9429
- for (let r2 of l2) {
9430
- if (r2 === null)
9431
- continue;
9432
- let t2 = r2 instanceof HTMLElement ? r2 : r2.current;
9433
- if (t2 != null && t2.contains(n2) || e2.composed && e2.composedPath().includes(t2))
9434
- return;
9435
- }
9436
- return !h$2(n2, F$4.Loose) && n2.tabIndex !== -1 && e2.preventDefault(), E2(e2, n2);
9627
+ let t2 = r2(e2);
9628
+ if (t2 === null || !t2.getRootNode().contains(t2) || !t2.isConnected)
9629
+ return;
9630
+ let E2 = function u2(n2) {
9631
+ return typeof n2 == "function" ? u2(n2()) : Array.isArray(n2) || n2 instanceof Set ? n2 : [n2];
9632
+ }(s2);
9633
+ for (let u2 of E2) {
9634
+ if (u2 === null)
9635
+ continue;
9636
+ let n2 = u2 instanceof HTMLElement ? u2 : u2.current;
9637
+ if (n2 != null && n2.contains(t2) || e2.composed && e2.composedPath().includes(n2))
9638
+ return;
9437
9639
  }
9640
+ return !h$2(t2, T$1.Loose) && t2.tabIndex !== -1 && e2.preventDefault(), m2(e2, t2);
9438
9641
  }
9439
- let u2 = useRef(null);
9440
- d$1("mousedown", (e2) => {
9441
- var o2, l2;
9442
- i2.current && (u2.current = ((l2 = (o2 = e2.composedPath) == null ? void 0 : o2.call(e2)) == null ? void 0 : l2[0]) || e2.target);
9443
- }, true), d$1("click", (e2) => {
9444
- !u2.current || (f2(e2, () => u2.current), u2.current = null);
9445
- }, true), d$1("blur", (e2) => f2(e2, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), true);
9642
+ let o2 = useRef(null);
9643
+ d$4("pointerdown", (e2) => {
9644
+ var r2, t2;
9645
+ i2.current && (o2.current = ((t2 = (r2 = e2.composedPath) == null ? void 0 : r2.call(e2)) == null ? void 0 : t2[0]) || e2.target);
9646
+ }, true), d$4("mousedown", (e2) => {
9647
+ var r2, t2;
9648
+ i2.current && (o2.current = ((t2 = (r2 = e2.composedPath) == null ? void 0 : r2.call(e2)) == null ? void 0 : t2[0]) || e2.target);
9649
+ }, true), d$4("click", (e2) => {
9650
+ n$3() || o2.current && (c2(e2, () => o2.current), o2.current = null);
9651
+ }, 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);
9446
9652
  }
9447
- let u$2 = Symbol();
9448
- function T$1(t2, n2 = true) {
9449
- return Object.assign(t2, { [u$2]: n2 });
9653
+ function n$2(...e2) {
9654
+ return useMemo(() => o$1(...e2), [...e2]);
9450
9655
  }
9451
- function y(...t2) {
9656
+ let u$4 = Symbol();
9657
+ function T(t2, n2 = true) {
9658
+ return Object.assign(t2, { [u$4]: n2 });
9659
+ }
9660
+ function y$1(...t2) {
9452
9661
  let n2 = useRef(t2);
9453
9662
  useEffect(() => {
9454
9663
  n2.current = t2;
9455
9664
  }, [t2]);
9456
- let c = o$3((e2) => {
9665
+ let c2 = o$4((e2) => {
9457
9666
  for (let o2 of n2.current)
9458
9667
  o2 != null && (typeof o2 == "function" ? o2(e2) : o2.current = e2);
9459
9668
  });
9460
- return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$2])) ? void 0 : c;
9461
- }
9462
- 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 || {});
9463
- function $$1({ ourProps: r2, theirProps: t2, slot: e2, defaultTag: a2, features: o2, visible: n2 = true, name: l2 }) {
9464
- let s2 = T(t2, r2);
9465
- if (n2)
9466
- return p$1(s2, e2, a2, l2);
9467
- let u2 = o2 != null ? o2 : 0;
9468
- if (u2 & 2) {
9469
- let { static: i2 = false, ...d2 } = s2;
9470
- if (i2)
9471
- return p$1(d2, e2, a2, l2);
9472
- }
9473
- if (u2 & 1) {
9474
- let { unmount: i2 = true, ...d2 } = s2;
9475
- return u$3(i2 ? 0 : 1, { [0]() {
9669
+ return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$4])) ? void 0 : c2;
9670
+ }
9671
+ function m$2(u2, t2) {
9672
+ let e2 = useRef([]), r2 = o$4(u2);
9673
+ useEffect(() => {
9674
+ let o2 = [...e2.current];
9675
+ for (let [n2, a2] of t2.entries())
9676
+ if (e2.current[n2] !== a2) {
9677
+ let l2 = r2(t2, o2);
9678
+ return e2.current = t2, l2;
9679
+ }
9680
+ }, [r2, ...t2]);
9681
+ }
9682
+ function t$4(...r2) {
9683
+ return Array.from(new Set(r2.flatMap((n2) => typeof n2 == "string" ? n2.split(" ") : []))).filter(Boolean).join(" ");
9684
+ }
9685
+ 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 || {});
9686
+ function C({ ourProps: r2, theirProps: t2, slot: e2, defaultTag: n2, features: o2, visible: a2 = true, name: f2, mergeRefs: l2 }) {
9687
+ l2 = l2 != null ? l2 : k;
9688
+ let s2 = R(t2, r2);
9689
+ if (a2)
9690
+ return m$1(s2, e2, n2, f2, l2);
9691
+ let y2 = o2 != null ? o2 : 0;
9692
+ if (y2 & 2) {
9693
+ let { static: u2 = false, ...d2 } = s2;
9694
+ if (u2)
9695
+ return m$1(d2, e2, n2, f2, l2);
9696
+ }
9697
+ if (y2 & 1) {
9698
+ let { unmount: u2 = true, ...d2 } = s2;
9699
+ return u$5(u2 ? 0 : 1, { [0]() {
9476
9700
  return null;
9477
9701
  }, [1]() {
9478
- return p$1({ ...d2, hidden: true, style: { display: "none" } }, e2, a2, l2);
9702
+ return m$1({ ...d2, hidden: true, style: { display: "none" } }, e2, n2, f2, l2);
9479
9703
  } });
9480
9704
  }
9481
- return p$1(s2, e2, a2, l2);
9705
+ return m$1(s2, e2, n2, f2, l2);
9482
9706
  }
9483
- function p$1(r2, t2 = {}, e2, a2) {
9484
- 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;
9485
- s2.className && typeof s2.className == "function" && (s2.className = s2.className(t2));
9707
+ function m$1(r2, t2 = {}, e2, n2, o2) {
9708
+ 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;
9709
+ "className" in s2 && s2.className && typeof s2.className == "function" && (s2.className = s2.className(t2));
9486
9710
  let d2 = {};
9487
9711
  if (t2) {
9488
- let f2 = false, y2 = [];
9489
- for (let [h2, g2] of Object.entries(t2))
9490
- typeof g2 == "boolean" && (f2 = true), g2 === true && y2.push(h2);
9491
- f2 && (d2["data-headlessui-state"] = y2.join(" "));
9492
- }
9493
- if (o2 === Fragment$1 && Object.keys(F$3(s2)).length > 0) {
9494
- if (!isValidElement(i2) || Array.isArray(i2) && i2.length > 1)
9495
- 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(`
9496
- `), "", "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(`
9712
+ let i2 = false, c2 = [];
9713
+ for (let [T2, p2] of Object.entries(t2))
9714
+ typeof p2 == "boolean" && (i2 = true), p2 === true && c2.push(T2);
9715
+ i2 && (d2["data-headlessui-state"] = c2.join(" "));
9716
+ }
9717
+ if (a2 === Fragment$1 && Object.keys(x$1(s2)).length > 0) {
9718
+ if (!isValidElement(u2) || Array.isArray(u2) && u2.length > 1)
9719
+ 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(`
9720
+ `), "", "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(`
9497
9721
  `)].join(`
9498
9722
  `));
9499
- return cloneElement(i2, Object.assign({}, T(i2.props, F$3(m$1(s2, ["ref"]))), d2, u2, w(i2.ref, u2.ref)));
9723
+ 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 } : {};
9724
+ return cloneElement(u2, Object.assign({}, R(u2.props, x$1(F$1(s2, ["ref"]))), d2, y2, { ref: o2(u2.ref, y2.ref) }, T2));
9500
9725
  }
9501
- return createElement(o2, Object.assign({}, m$1(s2, ["ref"]), o2 !== Fragment$1 && u2, o2 !== Fragment$1 && d2), i2);
9726
+ return createElement(a2, Object.assign({}, F$1(s2, ["ref"]), a2 !== Fragment$1 && y2, a2 !== Fragment$1 && d2), u2);
9502
9727
  }
9503
- function w(...r2) {
9504
- return { ref: r2.every((t2) => t2 == null) ? void 0 : (t2) => {
9728
+ function k(...r2) {
9729
+ return r2.every((t2) => t2 == null) ? void 0 : (t2) => {
9505
9730
  for (let e2 of r2)
9506
9731
  e2 != null && (typeof e2 == "function" ? e2(t2) : e2.current = t2);
9507
- } };
9732
+ };
9508
9733
  }
9509
- function T(...r2) {
9734
+ function R(...r2) {
9510
9735
  if (r2.length === 0)
9511
9736
  return {};
9512
9737
  if (r2.length === 1)
9513
9738
  return r2[0];
9514
9739
  let t2 = {}, e2 = {};
9515
9740
  for (let o2 of r2)
9516
- for (let n2 in o2)
9517
- n2.startsWith("on") && typeof o2[n2] == "function" ? (e2[n2] != null || (e2[n2] = []), e2[n2].push(o2[n2])) : t2[n2] = o2[n2];
9741
+ for (let a2 in o2)
9742
+ a2.startsWith("on") && typeof o2[a2] == "function" ? (e2[a2] != null || (e2[a2] = []), e2[a2].push(o2[a2])) : t2[a2] = o2[a2];
9518
9743
  if (t2.disabled || t2["aria-disabled"])
9519
9744
  return Object.assign(t2, Object.fromEntries(Object.keys(e2).map((o2) => [o2, void 0])));
9520
9745
  for (let o2 in e2)
9521
- Object.assign(t2, { [o2](n2, ...l2) {
9522
- let s2 = e2[o2];
9523
- for (let u2 of s2) {
9524
- if ((n2 instanceof Event || (n2 == null ? void 0 : n2.nativeEvent) instanceof Event) && n2.defaultPrevented)
9746
+ Object.assign(t2, { [o2](a2, ...f2) {
9747
+ let l2 = e2[o2];
9748
+ for (let s2 of l2) {
9749
+ if ((a2 instanceof Event || (a2 == null ? void 0 : a2.nativeEvent) instanceof Event) && a2.defaultPrevented)
9525
9750
  return;
9526
- u2(n2, ...l2);
9751
+ s2(a2, ...f2);
9527
9752
  }
9528
9753
  } });
9529
9754
  return t2;
9530
9755
  }
9531
- function C$1(r2) {
9756
+ function U$2(r2) {
9532
9757
  var t2;
9533
9758
  return Object.assign(forwardRef(r2), { displayName: (t2 = r2.displayName) != null ? t2 : r2.name });
9534
9759
  }
9535
- function F$3(r2) {
9760
+ function x$1(r2) {
9536
9761
  let t2 = Object.assign({}, r2);
9537
9762
  for (let e2 in t2)
9538
9763
  t2[e2] === void 0 && delete t2[e2];
9539
9764
  return t2;
9540
9765
  }
9541
- function m$1(r2, t2 = []) {
9766
+ function F$1(r2, t2 = []) {
9542
9767
  let e2 = Object.assign({}, r2);
9543
- for (let a2 of t2)
9544
- a2 in e2 && delete e2[a2];
9768
+ for (let n2 of t2)
9769
+ n2 in e2 && delete e2[n2];
9545
9770
  return e2;
9546
9771
  }
9547
- function r$1(n2) {
9772
+ let p$2 = "div";
9773
+ var s$4 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$4 || {});
9774
+ function l$3(d2, o2) {
9775
+ var n2;
9776
+ 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" } } };
9777
+ return C({ ourProps: r2, theirProps: e2, slot: {}, defaultTag: p$2, name: "Hidden" });
9778
+ }
9779
+ let u$3 = U$2(l$3);
9780
+ let n$1 = createContext(null);
9781
+ n$1.displayName = "OpenClosedContext";
9782
+ 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 || {});
9783
+ function u$2() {
9784
+ return useContext(n$1);
9785
+ }
9786
+ function s$3({ value: o2, children: r2 }) {
9787
+ return React__default.createElement(n$1.Provider, { value: o2 }, r2);
9788
+ }
9789
+ function t$3(n2) {
9790
+ function e2() {
9791
+ document.readyState !== "loading" && (n2(), document.removeEventListener("DOMContentLoaded", e2));
9792
+ }
9793
+ typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("DOMContentLoaded", e2), e2());
9794
+ }
9795
+ let t$2 = [];
9796
+ t$3(() => {
9797
+ function e2(n2) {
9798
+ 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));
9799
+ }
9800
+ 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 });
9801
+ });
9802
+ function r$2(n2) {
9548
9803
  let e2 = n2.parentElement, l2 = null;
9549
9804
  for (; e2 && !(e2 instanceof HTMLFieldSetElement); )
9550
9805
  e2 instanceof HTMLLegendElement && (l2 = e2), e2 = e2.parentElement;
@@ -9562,60 +9817,9 @@ function i$1(n2) {
9562
9817
  }
9563
9818
  return true;
9564
9819
  }
9565
- let a$1 = "div";
9566
- var s$4 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$4 || {});
9567
- let h$1 = C$1(function(t2, o2) {
9568
- 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" } } };
9569
- return $$1({ ourProps: d2, theirProps: r2, slot: {}, defaultTag: a$1, name: "Hidden" });
9570
- });
9571
- let o$2 = createContext(null);
9572
- o$2.displayName = "OpenClosedContext";
9573
- var p = ((e2) => (e2[e2.Open = 0] = "Open", e2[e2.Closed = 1] = "Closed", e2))(p || {});
9574
- function s$3() {
9575
- return useContext(o$2);
9576
- }
9577
- function C({ value: t2, children: n2 }) {
9578
- return React.createElement(o$2.Provider, { value: t2 }, n2);
9579
- }
9580
- 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 || {});
9581
- function m(u2, t2) {
9582
- let e2 = useRef([]), r2 = o$3(u2);
9583
- useEffect(() => {
9584
- let o2 = [...e2.current];
9585
- for (let [n2, a2] of t2.entries())
9586
- if (e2.current[n2] !== a2) {
9587
- let l2 = r2(t2, o2);
9588
- return e2.current = t2, l2;
9589
- }
9590
- }, [r2, ...t2]);
9591
- }
9592
- function s$2(e2, r2, n2) {
9593
- let o2 = s$5(r2);
9594
- useEffect(() => {
9595
- function t2(i2) {
9596
- o2.current(i2);
9597
- }
9598
- return window.addEventListener(e2, t2, n2), () => window.removeEventListener(e2, t2, n2);
9599
- }, [e2, n2]);
9600
- }
9601
- var s$1 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(s$1 || {});
9602
- function n$1() {
9603
- let e2 = useRef(0);
9604
- return s$2("keydown", (o2) => {
9605
- o2.key === "Tab" && (e2.current = o2.shiftKey ? 1 : 0);
9606
- }, true), e2;
9607
- }
9608
- function f$1() {
9609
- let e2 = useRef(false);
9610
- return s$6(() => (e2.current = true, () => {
9611
- e2.current = false;
9612
- }), []), e2;
9613
- }
9614
- function n(...e2) {
9615
- return useMemo(() => e$2(...e2), [...e2]);
9616
- }
9820
+ 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 || {});
9617
9821
  function E(n2, e2, a2, t2) {
9618
- let i2 = s$5(a2);
9822
+ let i2 = s$7(a2);
9619
9823
  useEffect(() => {
9620
9824
  n2 = n2 != null ? n2 : window;
9621
9825
  function r2(o2) {
@@ -9624,203 +9828,372 @@ function E(n2, e2, a2, t2) {
9624
9828
  return n2.addEventListener(e2, r2, t2), () => n2.removeEventListener(e2, r2, t2);
9625
9829
  }, [n2, e2, t2]);
9626
9830
  }
9627
- let z = "div";
9628
- 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 || {});
9629
- let de = Object.assign(C$1(function(u2, e2) {
9630
- let l2 = useRef(null), a2 = y(l2, e2), { initialFocus: m2, containers: t2, features: n$22 = 30, ...E2 } = u2;
9631
- a$2() || (n$22 = 1);
9632
- let s2 = n(l2);
9633
- J$1({ ownerDocument: s2 }, Boolean(n$22 & 16));
9634
- let S2 = Q({ ownerDocument: s2, container: l2, initialFocus: m2 }, Boolean(n$22 & 2));
9635
- X({ ownerDocument: s2, container: l2, containers: t2, previousActiveElement: S2 }, Boolean(n$22 & 8));
9636
- let H2 = n$1(), R = o$3((o2) => {
9637
- let c = l2.current;
9638
- if (!c)
9831
+ function f$3() {
9832
+ let e2 = useRef(false);
9833
+ return l$5(() => (e2.current = true, () => {
9834
+ e2.current = false;
9835
+ }), []), e2;
9836
+ }
9837
+ function c$3(t2) {
9838
+ let r2 = o$4(t2), e2 = useRef(false);
9839
+ useEffect(() => (e2.current = false, () => {
9840
+ e2.current = true, t$6(() => {
9841
+ e2.current && r2();
9842
+ });
9843
+ }), [r2]);
9844
+ }
9845
+ var s$2 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(s$2 || {});
9846
+ function n() {
9847
+ let e2 = useRef(0);
9848
+ return s$5("keydown", (o2) => {
9849
+ o2.key === "Tab" && (e2.current = o2.shiftKey ? 1 : 0);
9850
+ }, true), e2;
9851
+ }
9852
+ function P(t2) {
9853
+ if (!t2)
9854
+ return /* @__PURE__ */ new Set();
9855
+ if (typeof t2 == "function")
9856
+ return new Set(t2());
9857
+ let n2 = /* @__PURE__ */ new Set();
9858
+ for (let e2 of t2.current)
9859
+ e2.current instanceof HTMLElement && n2.add(e2.current);
9860
+ return n2;
9861
+ }
9862
+ let X = "div";
9863
+ 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 || {});
9864
+ function z(t2, n$12) {
9865
+ let e2 = useRef(null), o2 = y$1(e2, n$12), { initialFocus: l2, containers: c2, features: r2 = 30, ...s2 } = t2;
9866
+ l$4() || (r2 = 1);
9867
+ let i2 = n$2(e2);
9868
+ Y({ ownerDocument: i2 }, Boolean(r2 & 16));
9869
+ let u2 = Z({ ownerDocument: i2, container: e2, initialFocus: l2 }, Boolean(r2 & 2));
9870
+ $({ ownerDocument: i2, container: e2, containers: c2, previousActiveElement: u2 }, Boolean(r2 & 8));
9871
+ let y2 = n(), R2 = o$4((a2) => {
9872
+ let m2 = e2.current;
9873
+ if (!m2)
9639
9874
  return;
9640
- ((_24) => _24())(() => {
9641
- 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] }) });
9875
+ ((B) => B())(() => {
9876
+ u$5(y2.current, { [s$2.Forwards]: () => {
9877
+ O$1(m2, M$2.First, { skipElements: [a2.relatedTarget] });
9878
+ }, [s$2.Backwards]: () => {
9879
+ O$1(m2, M$2.Last, { skipElements: [a2.relatedTarget] });
9880
+ } });
9642
9881
  });
9643
- }), B = p$2(), L2 = useRef(false), P2 = { ref: a2, onKeyDown(o2) {
9644
- o2.key == "Tab" && (L2.current = true, B.requestAnimationFrame(() => {
9645
- L2.current = false;
9882
+ }), h2 = p$3(), H2 = useRef(false), j2 = { ref: o2, onKeyDown(a2) {
9883
+ a2.key == "Tab" && (H2.current = true, h2.requestAnimationFrame(() => {
9884
+ H2.current = false;
9646
9885
  }));
9647
- }, onBlur(o2) {
9648
- let c = new Set(t2 == null ? void 0 : t2.current);
9649
- c.add(l2);
9650
- let p2 = o2.relatedTarget;
9651
- !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)));
9886
+ }, onBlur(a2) {
9887
+ let m2 = P(c2);
9888
+ e2.current instanceof HTMLElement && m2.add(e2.current);
9889
+ let T2 = a2.relatedTarget;
9890
+ 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)));
9652
9891
  } };
9653
- 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 }));
9654
- }), { features: A$2 });
9655
- function J$1({ ownerDocument: r2 }, u2) {
9656
- let e2 = useRef(null);
9657
- E(r2 == null ? void 0 : r2.defaultView, "focusout", (a2) => {
9658
- !u2 || e2.current || (e2.current = a2.target);
9659
- }, true), m(() => {
9660
- u2 || ((r2 == null ? void 0 : r2.activeElement) === (r2 == null ? void 0 : r2.body) && S$2(e2.current), e2.current = null);
9661
- }, [u2]);
9662
- let l2 = useRef(false);
9663
- useEffect(() => (l2.current = false, () => {
9664
- l2.current = true, t(() => {
9665
- !l2.current || (S$2(e2.current), e2.current = null);
9666
- });
9667
- }), []);
9892
+ 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 }));
9893
+ }
9894
+ let D$2 = U$2(z), de = Object.assign(D$2, { features: _$1 });
9895
+ function Q(t2 = true) {
9896
+ let n2 = useRef(t$2.slice());
9897
+ return m$2(([e2], [o2]) => {
9898
+ o2 === true && e2 === false && t$6(() => {
9899
+ n2.current.splice(0);
9900
+ }), o2 === false && e2 === true && (n2.current = t$2.slice());
9901
+ }, [t2, t$2, n2]), o$4(() => {
9902
+ var e2;
9903
+ return (e2 = n2.current.find((o2) => o2 != null && o2.isConnected)) != null ? e2 : null;
9904
+ });
9668
9905
  }
9669
- function Q({ ownerDocument: r2, container: u2, initialFocus: e2 }, l2) {
9670
- let a2 = useRef(null), m$12 = f$1();
9671
- return m(() => {
9672
- if (!l2)
9906
+ function Y({ ownerDocument: t2 }, n2) {
9907
+ let e2 = Q(n2);
9908
+ m$2(() => {
9909
+ n2 || (t2 == null ? void 0 : t2.activeElement) === (t2 == null ? void 0 : t2.body) && y$3(e2());
9910
+ }, [n2]), c$3(() => {
9911
+ n2 && y$3(e2());
9912
+ });
9913
+ }
9914
+ function Z({ ownerDocument: t2, container: n2, initialFocus: e2 }, o2) {
9915
+ let l2 = useRef(null), c2 = f$3();
9916
+ return m$2(() => {
9917
+ if (!o2)
9673
9918
  return;
9674
- let t$1 = u2.current;
9675
- !t$1 || t(() => {
9676
- if (!m$12.current)
9919
+ let r2 = n2.current;
9920
+ r2 && t$6(() => {
9921
+ if (!c2.current)
9677
9922
  return;
9678
- let n2 = r2 == null ? void 0 : r2.activeElement;
9923
+ let s2 = t2 == null ? void 0 : t2.activeElement;
9679
9924
  if (e2 != null && e2.current) {
9680
- if ((e2 == null ? void 0 : e2.current) === n2) {
9681
- a2.current = n2;
9925
+ if ((e2 == null ? void 0 : e2.current) === s2) {
9926
+ l2.current = s2;
9682
9927
  return;
9683
9928
  }
9684
- } else if (t$1.contains(n2)) {
9685
- a2.current = n2;
9929
+ } else if (r2.contains(s2)) {
9930
+ l2.current = s2;
9686
9931
  return;
9687
9932
  }
9688
- 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;
9933
+ 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;
9689
9934
  });
9690
- }, [l2]), a2;
9935
+ }, [o2]), l2;
9691
9936
  }
9692
- function X({ ownerDocument: r2, container: u2, containers: e2, previousActiveElement: l2 }, a2) {
9693
- let m2 = f$1();
9694
- E(r2 == null ? void 0 : r2.defaultView, "focus", (t2) => {
9695
- if (!a2 || !m2.current)
9937
+ function $({ ownerDocument: t2, container: n2, containers: e2, previousActiveElement: o2 }, l2) {
9938
+ let c2 = f$3();
9939
+ E(t2 == null ? void 0 : t2.defaultView, "focus", (r2) => {
9940
+ if (!l2 || !c2.current)
9696
9941
  return;
9697
- let n2 = new Set(e2 == null ? void 0 : e2.current);
9698
- n2.add(u2);
9699
- let E2 = l2.current;
9700
- if (!E2)
9942
+ let s2 = P(e2);
9943
+ n2.current instanceof HTMLElement && s2.add(n2.current);
9944
+ let i2 = o2.current;
9945
+ if (!i2)
9701
9946
  return;
9702
- let s2 = t2.target;
9703
- s2 && s2 instanceof HTMLElement ? h(n2, s2) ? (l2.current = s2, S$2(s2)) : (t2.preventDefault(), t2.stopPropagation(), S$2(E2)) : S$2(l2.current);
9947
+ let u2 = r2.target;
9948
+ 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);
9704
9949
  }, true);
9705
9950
  }
9706
- function h(r2, u2) {
9707
- var e2;
9708
- for (let l2 of r2)
9709
- if ((e2 = l2.current) != null && e2.contains(u2))
9951
+ function S$4(t2, n2) {
9952
+ for (let e2 of t2)
9953
+ if (e2.contains(n2))
9710
9954
  return true;
9711
9955
  return false;
9712
9956
  }
9713
- let i = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
9714
- function u$1(t2) {
9715
- t2.setAttribute("aria-hidden", "true"), t2.inert = true;
9716
- }
9717
- function l$2(t2) {
9718
- let n2 = r.get(t2);
9719
- !n2 || (n2["aria-hidden"] === null ? t2.removeAttribute("aria-hidden") : t2.setAttribute("aria-hidden", n2["aria-hidden"]), t2.inert = n2.inert);
9720
- }
9721
- function M$3(t2, n2 = true) {
9722
- s$6(() => {
9723
- if (!n2 || !t2.current)
9724
- return;
9725
- let o2 = t2.current, a2 = e$2(o2);
9726
- if (!!a2) {
9727
- i.add(o2);
9728
- for (let e2 of r.keys())
9729
- e2.contains(o2) && (l$2(e2), r.delete(e2));
9730
- return a2.querySelectorAll("body > *").forEach((e2) => {
9731
- if (e2 instanceof HTMLElement) {
9732
- for (let f2 of i)
9733
- if (e2.contains(f2))
9734
- return;
9735
- i.size === 1 && (r.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), u$1(e2));
9736
- }
9737
- }), () => {
9738
- if (i.delete(o2), i.size > 0)
9739
- a2.querySelectorAll("body > *").forEach((e2) => {
9740
- if (e2 instanceof HTMLElement && !r.has(e2)) {
9741
- for (let f2 of i)
9742
- if (e2.contains(f2))
9743
- return;
9744
- r.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), u$1(e2);
9745
- }
9746
- });
9747
- else
9748
- for (let e2 of r.keys())
9749
- l$2(e2), r.delete(e2);
9750
- };
9751
- }
9752
- }, [n2]);
9753
- }
9754
- let e$1 = createContext(false);
9755
- function l$1() {
9756
- return useContext(e$1);
9957
+ let e = createContext(false);
9958
+ function a$4() {
9959
+ return useContext(e);
9757
9960
  }
9758
- function P$1(o2) {
9759
- return React.createElement(e$1.Provider, { value: o2.force }, o2.children);
9961
+ function l$2(o2) {
9962
+ return React__default.createElement(e.Provider, { value: o2.force }, o2.children);
9760
9963
  }
9761
- function x$1(i2) {
9762
- let u2 = l$1(), o2 = useContext(A$1), e2 = n(i2), [r2, f2] = useState(() => {
9763
- if (!u2 && o2 !== null || e$3)
9964
+ function F(p2) {
9965
+ let n2 = a$4(), l2 = useContext(_23), e2 = n$2(p2), [a2, o2] = useState(() => {
9966
+ if (!n2 && l2 !== null || s$8.isServer)
9764
9967
  return null;
9765
- let n2 = e2 == null ? void 0 : e2.getElementById("headlessui-portal-root");
9766
- if (n2)
9767
- return n2;
9968
+ let t2 = e2 == null ? void 0 : e2.getElementById("headlessui-portal-root");
9969
+ if (t2)
9970
+ return t2;
9768
9971
  if (e2 === null)
9769
9972
  return null;
9770
- let t2 = e2.createElement("div");
9771
- return t2.setAttribute("id", "headlessui-portal-root"), e2.body.appendChild(t2);
9973
+ let r2 = e2.createElement("div");
9974
+ return r2.setAttribute("id", "headlessui-portal-root"), e2.body.appendChild(r2);
9772
9975
  });
9773
9976
  return useEffect(() => {
9774
- r2 !== null && (e2 != null && e2.body.contains(r2) || e2 == null || e2.body.appendChild(r2));
9775
- }, [r2, e2]), useEffect(() => {
9776
- u2 || o2 !== null && f2(o2.current);
9777
- }, [o2, f2, u2]), r2;
9778
- }
9779
- let _23 = Fragment$1, U = C$1(function(u2, o2) {
9780
- let e2 = u2, r2 = useRef(null), f2 = y(T$1((a2) => {
9781
- r2.current = a2;
9782
- }), o2), n$12 = n(r2), t$1 = x$1(r2), [l2] = useState(() => {
9783
- var a2;
9784
- return e$3 ? null : (a2 = n$12 == null ? void 0 : n$12.createElement("div")) != null ? a2 : null;
9785
- }), b = a$2(), p2 = useRef(false);
9786
- return s$6(() => {
9787
- if (p2.current = false, !(!t$1 || !l2))
9788
- return t$1.contains(l2) || (l2.setAttribute("data-headlessui-portal", ""), t$1.appendChild(l2)), () => {
9789
- p2.current = true, t(() => {
9790
- var a2;
9791
- !p2.current || !t$1 || !l2 || (t$1.removeChild(l2), t$1.childNodes.length <= 0 && ((a2 = t$1.parentElement) == null || a2.removeChild(t$1)));
9792
- });
9793
- };
9794
- }, [t$1, l2]), b ? !t$1 || !l2 ? null : createPortal($$1({ ourProps: { ref: f2 }, theirProps: e2, defaultTag: _23, name: "Portal" }), l2) : null;
9795
- }), j = Fragment$1, A$1 = createContext(null), F$2 = C$1(function(u2, o2) {
9796
- let { target: e2, ...r2 } = u2, n2 = { ref: y(o2) };
9797
- return React.createElement(A$1.Provider, { value: e2 }, $$1({ ourProps: n2, theirProps: r2, defaultTag: j, name: "Popover.Group" }));
9798
- }), $ = Object.assign(U, { Group: F$2 });
9799
- let d = createContext(null);
9800
- function u() {
9801
- let n2 = useContext(d);
9802
- if (n2 === null) {
9803
- let t2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
9804
- throw Error.captureStackTrace && Error.captureStackTrace(t2, u), t2;
9977
+ a2 !== null && (e2 != null && e2.body.contains(a2) || e2 == null || e2.body.appendChild(a2));
9978
+ }, [a2, e2]), useEffect(() => {
9979
+ n2 || l2 !== null && o2(l2.current);
9980
+ }, [l2, o2, n2]), a2;
9981
+ }
9982
+ let U$1 = Fragment$1;
9983
+ function N$1(p2, n2) {
9984
+ let l2 = p2, e2 = useRef(null), a2 = y$1(T((u2) => {
9985
+ e2.current = u2;
9986
+ }), n2), o2 = n$2(e2), t2 = F(e2), [r2] = useState(() => {
9987
+ var u2;
9988
+ return s$8.isServer ? null : (u2 = o2 == null ? void 0 : o2.createElement("div")) != null ? u2 : null;
9989
+ }), i2 = useContext(f$2), v2 = l$4();
9990
+ return l$5(() => {
9991
+ !t2 || !r2 || t2.contains(r2) || (r2.setAttribute("data-headlessui-portal", ""), t2.appendChild(r2));
9992
+ }, [t2, r2]), l$5(() => {
9993
+ if (r2 && i2)
9994
+ return i2.register(r2);
9995
+ }, [i2, r2]), c$3(() => {
9996
+ var u2;
9997
+ !t2 || !r2 || (r2 instanceof Node && t2.contains(r2) && t2.removeChild(r2), t2.childNodes.length <= 0 && ((u2 = t2.parentElement) == null || u2.removeChild(t2)));
9998
+ }), v2 ? !t2 || !r2 ? null : createPortal(C({ ourProps: { ref: a2 }, theirProps: l2, defaultTag: U$1, name: "Portal" }), r2) : null;
9999
+ }
10000
+ let S$3 = Fragment$1, _23 = createContext(null);
10001
+ function j(p2, n2) {
10002
+ let { target: l2, ...e2 } = p2, o2 = { ref: y$1(n2) };
10003
+ return React__default.createElement(_23.Provider, { value: l2 }, C({ ourProps: o2, theirProps: e2, defaultTag: S$3, name: "Popover.Group" }));
10004
+ }
10005
+ let f$2 = createContext(null);
10006
+ function ee() {
10007
+ 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) => {
10008
+ let t2 = n2.current.indexOf(o2);
10009
+ t2 !== -1 && n2.current.splice(t2, 1), p2 && p2.unregister(o2);
10010
+ }), a2 = useMemo(() => ({ register: l2, unregister: e2, portals: n2 }), [l2, e2, n2]);
10011
+ return [n2, useMemo(() => function({ children: t2 }) {
10012
+ return React__default.createElement(f$2.Provider, { value: a2 }, t2);
10013
+ }, [a2])];
10014
+ }
10015
+ let D$1 = U$2(N$1), I$3 = U$2(j), te = Object.assign(D$1, { Group: I$3 });
10016
+ function i(e2, t2) {
10017
+ return e2 === t2 && (e2 !== 0 || 1 / e2 === 1 / t2) || e2 !== e2 && t2 !== t2;
10018
+ }
10019
+ const d$2 = typeof Object.is == "function" ? Object.is : i, { useState: u$1, useEffect: h$1, useLayoutEffect: f$1, useDebugValue: p$1 } = React;
10020
+ function y(e2, t2, c2) {
10021
+ const a2 = t2(), [{ inst: n2 }, o2] = u$1({ inst: { value: a2, getSnapshot: t2 } });
10022
+ return f$1(() => {
10023
+ n2.value = a2, n2.getSnapshot = t2, r$1(n2) && o2({ inst: n2 });
10024
+ }, [e2, a2, t2]), h$1(() => (r$1(n2) && o2({ inst: n2 }), e2(() => {
10025
+ r$1(n2) && o2({ inst: n2 });
10026
+ })), [e2]), p$1(a2), a2;
10027
+ }
10028
+ function r$1(e2) {
10029
+ const t2 = e2.getSnapshot, c2 = e2.value;
10030
+ try {
10031
+ const a2 = t2();
10032
+ return !d$2(c2, a2);
10033
+ } catch {
10034
+ return true;
9805
10035
  }
9806
- return n2;
9807
10036
  }
9808
- function k$1() {
9809
- let [n2, t2] = useState([]);
9810
- return [n2.length > 0 ? n2.join(" ") : void 0, useMemo(() => function(e2) {
9811
- let i2 = o$3((r2) => (t2((o2) => [...o2, r2]), () => t2((o2) => {
9812
- let s2 = o2.slice(), p2 = s2.indexOf(r2);
9813
- return p2 !== -1 && s2.splice(p2, 1), s2;
9814
- }))), a2 = useMemo(() => ({ register: i2, slot: e2.slot, name: e2.name, props: e2.props }), [i2, e2.slot, e2.name, e2.props]);
9815
- return React.createElement(d.Provider, { value: a2 }, e2.children);
9816
- }, [t2])];
10037
+ function t$1(r2, e2, n2) {
10038
+ return e2();
9817
10039
  }
9818
- let S = "p", F$1 = C$1(function(t2, c) {
9819
- let e2 = I$2(), { id: i2 = `headlessui-description-${e2}`, ...a2 } = t2, r2 = u(), o2 = y(c);
9820
- s$6(() => r2.register(i2), [i2, r2.register]);
9821
- let s2 = { ref: o2, ...r2.props, id: i2 };
9822
- return $$1({ ourProps: s2, theirProps: a2, slot: r2.slot || {}, defaultTag: S, name: r2.name || "Description" });
10040
+ 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;
10041
+ function S$2(t2) {
10042
+ return a$3(t2.subscribe, t2.getSnapshot, t2.getSnapshot);
10043
+ }
10044
+ function a$2(o2, r2) {
10045
+ let t2 = o2(), n2 = /* @__PURE__ */ new Set();
10046
+ return { getSnapshot() {
10047
+ return t2;
10048
+ }, subscribe(e2) {
10049
+ return n2.add(e2), () => n2.delete(e2);
10050
+ }, dispatch(e2, ...s2) {
10051
+ let i2 = r2[e2].call(t2, ...s2);
10052
+ i2 && (t2 = i2, n2.forEach((c2) => c2()));
10053
+ } };
10054
+ }
10055
+ function c$1() {
10056
+ let o2;
10057
+ return { before({ doc: e2 }) {
10058
+ var l2;
10059
+ let n2 = e2.documentElement;
10060
+ o2 = ((l2 = e2.defaultView) != null ? l2 : window).innerWidth - n2.clientWidth;
10061
+ }, after({ doc: e2, d: n2 }) {
10062
+ let t2 = e2.documentElement, l2 = t2.clientWidth - t2.offsetWidth, r2 = o2 - l2;
10063
+ n2.style(t2, "paddingRight", `${r2}px`);
10064
+ } };
10065
+ }
10066
+ function d$1() {
10067
+ return t$5() ? { before({ doc: r2, d: l2, meta: c2 }) {
10068
+ function o2(a2) {
10069
+ return c2.containers.flatMap((n2) => n2()).some((n2) => n2.contains(a2));
10070
+ }
10071
+ l2.microTask(() => {
10072
+ var s2;
10073
+ if (window.getComputedStyle(r2.documentElement).scrollBehavior !== "auto") {
10074
+ let t2 = o$3();
10075
+ t2.style(r2.documentElement, "scrollBehavior", "auto"), l2.add(() => l2.microTask(() => t2.dispose()));
10076
+ }
10077
+ let a2 = (s2 = window.scrollY) != null ? s2 : window.pageYOffset, n2 = null;
10078
+ l2.addEventListener(r2, "click", (t2) => {
10079
+ if (t2.target instanceof HTMLElement)
10080
+ try {
10081
+ let e2 = t2.target.closest("a");
10082
+ if (!e2)
10083
+ return;
10084
+ let { hash: f2 } = new URL(e2.href), i2 = r2.querySelector(f2);
10085
+ i2 && !o2(i2) && (n2 = i2);
10086
+ } catch {
10087
+ }
10088
+ }, true), l2.addEventListener(r2, "touchstart", (t2) => {
10089
+ if (t2.target instanceof HTMLElement)
10090
+ if (o2(t2.target)) {
10091
+ let e2 = t2.target;
10092
+ for (; e2.parentElement && o2(e2.parentElement); )
10093
+ e2 = e2.parentElement;
10094
+ l2.style(e2, "overscrollBehavior", "contain");
10095
+ } else
10096
+ l2.style(t2.target, "touchAction", "none");
10097
+ }), l2.addEventListener(r2, "touchmove", (t2) => {
10098
+ if (t2.target instanceof HTMLElement)
10099
+ if (o2(t2.target)) {
10100
+ let e2 = t2.target;
10101
+ for (; e2.parentElement && e2.dataset.headlessuiPortal !== "" && !(e2.scrollHeight > e2.clientHeight || e2.scrollWidth > e2.clientWidth); )
10102
+ e2 = e2.parentElement;
10103
+ e2.dataset.headlessuiPortal === "" && t2.preventDefault();
10104
+ } else
10105
+ t2.preventDefault();
10106
+ }, { passive: false }), l2.add(() => {
10107
+ var e2;
10108
+ let t2 = (e2 = window.scrollY) != null ? e2 : window.pageYOffset;
10109
+ a2 !== t2 && window.scrollTo(0, a2), n2 && n2.isConnected && (n2.scrollIntoView({ block: "nearest" }), n2 = null);
10110
+ });
10111
+ });
10112
+ } } : {};
10113
+ }
10114
+ function l$1() {
10115
+ return { before({ doc: e2, d: o2 }) {
10116
+ o2.style(e2.documentElement, "overflow", "hidden");
10117
+ } };
10118
+ }
10119
+ function m(e2) {
10120
+ let n2 = {};
10121
+ for (let t2 of e2)
10122
+ Object.assign(n2, t2(n2));
10123
+ return n2;
10124
+ }
10125
+ let a$1 = a$2(() => /* @__PURE__ */ new Map(), { PUSH(e2, n2) {
10126
+ var o2;
10127
+ let t2 = (o2 = this.get(e2)) != null ? o2 : { doc: e2, count: 0, d: o$3(), meta: /* @__PURE__ */ new Set() };
10128
+ return t2.count++, t2.meta.add(n2), this.set(e2, t2), this;
10129
+ }, POP(e2, n2) {
10130
+ let t2 = this.get(e2);
10131
+ return t2 && (t2.count--, t2.meta.delete(n2)), this;
10132
+ }, SCROLL_PREVENT({ doc: e2, d: n2, meta: t2 }) {
10133
+ let o2 = { doc: e2, d: n2, meta: m(t2) }, c2 = [d$1(), c$1(), l$1()];
10134
+ c2.forEach(({ before: r2 }) => r2 == null ? void 0 : r2(o2)), c2.forEach(({ after: r2 }) => r2 == null ? void 0 : r2(o2));
10135
+ }, SCROLL_ALLOW({ d: e2 }) {
10136
+ e2.dispose();
10137
+ }, TEARDOWN({ doc: e2 }) {
10138
+ this.delete(e2);
10139
+ } });
10140
+ a$1.subscribe(() => {
10141
+ let e2 = a$1.getSnapshot(), n2 = /* @__PURE__ */ new Map();
10142
+ for (let [t2] of e2)
10143
+ n2.set(t2, t2.documentElement.style.overflow);
10144
+ for (let t2 of e2.values()) {
10145
+ let o2 = n2.get(t2.doc) === "hidden", c2 = t2.count !== 0;
10146
+ (c2 && !o2 || !c2 && o2) && a$1.dispatch(t2.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", t2), t2.count === 0 && a$1.dispatch("TEARDOWN", t2);
10147
+ }
9823
10148
  });
10149
+ function p(e2, r2, n2) {
10150
+ let f2 = S$2(a$1), o2 = e2 ? f2.get(e2) : void 0, i2 = o2 ? o2.count > 0 : false;
10151
+ return l$5(() => {
10152
+ if (!(!e2 || !r2))
10153
+ return a$1.dispatch("PUSH", e2, n2), () => a$1.dispatch("POP", e2, n2);
10154
+ }, [r2, e2]), i2;
10155
+ }
10156
+ let u = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
10157
+ function b$3(r2, l2 = true) {
10158
+ l$5(() => {
10159
+ var o2;
10160
+ if (!l2)
10161
+ return;
10162
+ let e2 = typeof r2 == "function" ? r2() : r2.current;
10163
+ if (!e2)
10164
+ return;
10165
+ function a2() {
10166
+ var d2;
10167
+ if (!e2)
10168
+ return;
10169
+ let i2 = (d2 = t.get(e2)) != null ? d2 : 1;
10170
+ if (i2 === 1 ? t.delete(e2) : t.set(e2, i2 - 1), i2 !== 1)
10171
+ return;
10172
+ let n2 = u.get(e2);
10173
+ n2 && (n2["aria-hidden"] === null ? e2.removeAttribute("aria-hidden") : e2.setAttribute("aria-hidden", n2["aria-hidden"]), e2.inert = n2.inert, u.delete(e2));
10174
+ }
10175
+ let f2 = (o2 = t.get(e2)) != null ? o2 : 0;
10176
+ 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;
10177
+ }, [r2, l2]);
10178
+ }
10179
+ function N({ defaultContainers: o2 = [], portals: r2, mainTreeNodeRef: u2 } = {}) {
10180
+ var f2;
10181
+ let t2 = useRef((f2 = u2 == null ? void 0 : u2.current) != null ? f2 : null), l2 = n$2(t2), c2 = o$4(() => {
10182
+ var i2, s2, a2;
10183
+ let n2 = [];
10184
+ for (let e2 of o2)
10185
+ e2 !== null && (e2 instanceof HTMLElement ? n2.push(e2) : "current" in e2 && e2.current instanceof HTMLElement && n2.push(e2.current));
10186
+ if (r2 != null && r2.current)
10187
+ for (let e2 of r2.current)
10188
+ n2.push(e2);
10189
+ for (let e2 of (i2 = l2 == null ? void 0 : l2.querySelectorAll("html > *, body > *")) != null ? i2 : [])
10190
+ 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));
10191
+ return n2;
10192
+ });
10193
+ return { resolveContainers: c2, contains: o$4((n2) => c2().some((i2) => i2.contains(n2))), mainTreeNodeRef: t2, MainTreeNode: useMemo(() => function() {
10194
+ return u2 != null ? null : React__default.createElement(u$3, { features: s$4.Hidden, ref: t2 });
10195
+ }, [t2, u2]) };
10196
+ }
9824
10197
  let a = createContext(() => {
9825
10198
  });
9826
10199
  a.displayName = "StackContext";
@@ -9828,142 +10201,169 @@ var s = ((e2) => (e2[e2.Add = 0] = "Add", e2[e2.Remove = 1] = "Remove", e2))(s |
9828
10201
  function x() {
9829
10202
  return useContext(a);
9830
10203
  }
9831
- function M$2({ children: i2, onUpdate: r2, type: e2, element: n2, enabled: u2 }) {
9832
- let l2 = x(), o2 = o$3((...t2) => {
10204
+ function b$2({ children: i2, onUpdate: r2, type: e2, element: n2, enabled: u2 }) {
10205
+ let l2 = x(), o2 = o$4((...t2) => {
9833
10206
  r2 == null || r2(...t2), l2(...t2);
9834
10207
  });
9835
- return s$6(() => {
10208
+ return l$5(() => {
9836
10209
  let t2 = u2 === void 0 || u2 === true;
9837
10210
  return t2 && o2(0, e2, n2), () => {
9838
10211
  t2 && o2(1, e2, n2);
9839
10212
  };
9840
- }, [o2, e2, n2, u2]), React.createElement(a.Provider, { value: o2 }, i2);
10213
+ }, [o2, e2, n2, u2]), React__default.createElement(a.Provider, { value: o2 }, i2);
9841
10214
  }
9842
- function o() {
9843
- return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
10215
+ let d = createContext(null);
10216
+ function f() {
10217
+ let r2 = useContext(d);
10218
+ if (r2 === null) {
10219
+ let t2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
10220
+ throw Error.captureStackTrace && Error.captureStackTrace(t2, f), t2;
10221
+ }
10222
+ return r2;
10223
+ }
10224
+ function w() {
10225
+ let [r2, t2] = useState([]);
10226
+ return [r2.length > 0 ? r2.join(" ") : void 0, useMemo(() => function(e2) {
10227
+ let i2 = o$4((s2) => (t2((o2) => [...o2, s2]), () => t2((o2) => {
10228
+ let p2 = o2.slice(), c2 = p2.indexOf(s2);
10229
+ return c2 !== -1 && p2.splice(c2, 1), p2;
10230
+ }))), n2 = useMemo(() => ({ register: i2, slot: e2.slot, name: e2.name, props: e2.props }), [i2, e2.slot, e2.name, e2.props]);
10231
+ return React__default.createElement(d.Provider, { value: n2 }, e2.children);
10232
+ }, [t2])];
9844
10233
  }
9845
- 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 || {});
9846
- let Ae = { [0](t2, e2) {
9847
- return t2.titleId === e2.id ? t2 : { ...t2, titleId: e2.id };
9848
- } }, H = createContext(null);
9849
- H.displayName = "DialogContext";
9850
- function k(t2) {
9851
- let e2 = useContext(H);
10234
+ let I$2 = "p";
10235
+ function S$1(r2, t2) {
10236
+ let a2 = I$5(), { id: e2 = `headlessui-description-${a2}`, ...i2 } = r2, n2 = f(), s2 = y$1(t2);
10237
+ l$5(() => n2.register(e2), [e2, n2.register]);
10238
+ let o2 = { ref: s2, ...n2.props, id: e2 };
10239
+ return C({ ourProps: o2, theirProps: i2, slot: n2.slot || {}, defaultTag: I$2, name: n2.name || "Description" });
10240
+ }
10241
+ let h = U$2(S$1), G = Object.assign(h, {});
10242
+ var Me = ((r2) => (r2[r2.Open = 0] = "Open", r2[r2.Closed = 1] = "Closed", r2))(Me || {}), we = ((e2) => (e2[e2.SetTitleId = 0] = "SetTitleId", e2))(we || {});
10243
+ let He$1 = { [0](o2, e2) {
10244
+ return o2.titleId === e2.id ? o2 : { ...o2, titleId: e2.id };
10245
+ } }, I$1 = createContext(null);
10246
+ I$1.displayName = "DialogContext";
10247
+ function b$1(o2) {
10248
+ let e2 = useContext(I$1);
9852
10249
  if (e2 === null) {
9853
- let r2 = new Error(`<${t2} /> is missing a parent <Dialog /> component.`);
9854
- throw Error.captureStackTrace && Error.captureStackTrace(r2, k), r2;
10250
+ let r2 = new Error(`<${o2} /> is missing a parent <Dialog /> component.`);
10251
+ throw Error.captureStackTrace && Error.captureStackTrace(r2, b$1), r2;
9855
10252
  }
9856
10253
  return e2;
9857
10254
  }
9858
- function Oe(t2, e2, r2 = () => [document.body]) {
9859
- useEffect(() => {
9860
- var c;
9861
- if (!e2 || !t2)
9862
- return;
9863
- let s2 = m$2(), d2 = window.pageYOffset;
9864
- function a2(n2, i2, l2) {
9865
- let P2 = n2.style.getPropertyValue(i2);
9866
- return Object.assign(n2.style, { [i2]: l2 }), s2.add(() => {
9867
- Object.assign(n2.style, { [i2]: P2 });
9868
- });
9869
- }
9870
- let o$12 = t2.documentElement, f2 = ((c = t2.defaultView) != null ? c : window).innerWidth - o$12.clientWidth;
9871
- if (a2(o$12, "overflow", "hidden"), f2 > 0) {
9872
- let n2 = o$12.clientWidth - o$12.offsetWidth, i2 = f2 - n2;
9873
- a2(o$12, "paddingRight", `${i2}px`);
9874
- }
9875
- if (o()) {
9876
- a2(t2.body, "marginTop", `-${d2}px`), window.scrollTo(0, 0);
9877
- let n2 = null;
9878
- s2.addEventListener(t2, "click", (i2) => {
9879
- if (i2.target instanceof HTMLElement)
9880
- try {
9881
- let l2 = i2.target.closest("a");
9882
- if (!l2)
9883
- return;
9884
- let { hash: P2 } = new URL(l2.href), u2 = t2.querySelector(P2);
9885
- u2 && !r2().some((_24) => _24.contains(u2)) && (n2 = u2);
9886
- } catch {
9887
- }
9888
- }, true), s2.addEventListener(t2, "touchmove", (i2) => {
9889
- i2.target instanceof HTMLElement && !r2().some((l2) => l2.contains(i2.target)) && i2.preventDefault();
9890
- }, { passive: false }), s2.add(() => {
9891
- window.scrollTo(0, window.pageYOffset + d2), n2 && n2.isConnected && (n2.scrollIntoView({ block: "nearest" }), n2 = null);
9892
- });
9893
- }
9894
- return s2.dispose;
9895
- }, [t2, e2]);
9896
- }
9897
- function Ce$1(t2, e2) {
9898
- return u$3(e2.type, Ae, t2, e2);
10255
+ function Be(o2, e2, r2 = () => [document.body]) {
10256
+ p(o2, e2, (i2) => {
10257
+ var n2;
10258
+ return { containers: [...(n2 = i2.containers) != null ? n2 : [], r2] };
10259
+ });
9899
10260
  }
9900
- let Se$1 = "div", Le = S$1.RenderStrategy | S$1.Static, Me = C$1(function(e2, r2) {
9901
- 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();
9902
- a2 === void 0 && l2 !== null && (a2 = u$3(l2, { [p.Open]: true, [p.Closed]: false }));
9903
- 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");
9904
- if (!$$2 && !Y)
10261
+ function Ge(o2, e2) {
10262
+ return u$5(e2.type, He$1, o2, e2);
10263
+ }
10264
+ let Ne$1 = "div", Ue = O.RenderStrategy | O.Static;
10265
+ function We(o$12, e2) {
10266
+ 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);
10267
+ a2 = function() {
10268
+ 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");
10269
+ }();
10270
+ let E$1 = u$2();
10271
+ n2 === void 0 && E$1 !== null && (n2 = (E$1 & d$3.Open) === d$3.Open);
10272
+ 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");
10273
+ if (!W && !$2)
9905
10274
  throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
9906
- if (!$$2)
10275
+ if (!W)
9907
10276
  throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
9908
- if (!Y)
10277
+ if (!$2)
9909
10278
  throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
9910
- if (typeof a2 != "boolean")
9911
- throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${a2}`);
9912
- if (typeof o2 != "function")
9913
- throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${o2}`);
9914
- let g2 = 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 : g2 === 0 : false, w2 = n$12 > 1, X2 = useContext(H) !== null, Z = w2 ? "parent" : "leaf";
9915
- M$3(u2, w2 ? x2 : false);
9916
- let N2 = o$3(() => {
9917
- var b, D2;
9918
- 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];
10279
+ if (typeof n2 != "boolean")
10280
+ throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n2}`);
10281
+ if (typeof l2 != "function")
10282
+ throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${l2}`);
10283
+ 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() {
10284
+ var t2;
10285
+ return (t2 = h2.panelRef.current) != null ? t2 : D2.current;
10286
+ } }, { 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(() => {
10287
+ var t2, c2;
10288
+ 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;
10289
+ }, [L]);
10290
+ b$3(se2, ie);
10291
+ let pe = (() => x2 ? true : S2)(), de$1 = useCallback(() => {
10292
+ var t2, c2;
10293
+ 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;
10294
+ }, [L]);
10295
+ b$3(de$1, pe);
10296
+ let ue2 = (() => !(!S2 || x2))();
10297
+ y$2(w$12, (t2) => {
10298
+ t2.preventDefault(), P2();
10299
+ }, ue2);
10300
+ let fe = (() => !(x2 || p2 !== 0))();
10301
+ E(g2 == null ? void 0 : g2.defaultView, "keydown", (t2) => {
10302
+ fe && (t2.defaultPrevented || t2.key === o.Escape && (t2.preventDefault(), t2.stopPropagation(), P2()));
9919
10303
  });
9920
- L(() => N2(), R, x2 && !w2), E(y$1 == null ? void 0 : y$1.defaultView, "keydown", (T2) => {
9921
- T2.defaultPrevented || T2.key === o$1.Escape && g2 === 0 && (w2 || (T2.preventDefault(), T2.stopPropagation(), R()));
9922
- }), Oe(y$1, g2 === 0 && !X2, N2), useEffect(() => {
9923
- if (g2 !== 0 || !u2.current)
10304
+ let ge = (() => !(J || p2 !== 0 || j2))();
10305
+ Be(g2, ge, w$12), useEffect(() => {
10306
+ if (p2 !== 0 || !D2.current)
9924
10307
  return;
9925
- let T2 = new IntersectionObserver((b) => {
9926
- for (let D2 of b)
9927
- D2.boundingClientRect.x === 0 && D2.boundingClientRect.y === 0 && D2.boundingClientRect.width === 0 && D2.boundingClientRect.height === 0 && R();
10308
+ let t2 = new ResizeObserver((c2) => {
10309
+ for (let d2 of c2) {
10310
+ let F2 = d2.target.getBoundingClientRect();
10311
+ F2.x === 0 && F2.y === 0 && F2.width === 0 && F2.height === 0 && P2();
10312
+ }
9928
10313
  });
9929
- return T2.observe(u2.current), () => T2.disconnect();
9930
- }, [g2, u2, R]);
9931
- let [ee, te] = k$1(), oe2 = useMemo(() => [{ dialogState: g2, close: R, setTitleId: j2 }, h2], [g2, h2, R, j2]), V = useMemo(() => ({ open: g2 === 0 }), [g2]), re2 = { ref: _24, id: d2, role: "dialog", "aria-modal": g2 === 0 ? true : void 0, "aria-labelledby": h2.titleId, "aria-describedby": ee };
9932
- return React.createElement(M$2, { type: "Dialog", enabled: g2 === 0, element: u2, onUpdate: o$3((T2, b, D2) => {
9933
- b === "Dialog" && u$3(T2, { [s.Add]() {
9934
- P2.current.add(D2), i2((E2) => E2 + 1);
9935
- }, [s.Remove]() {
9936
- P2.current.add(D2), i2((E2) => E2 - 1);
9937
- } });
9938
- }) }, 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: g2 === 0, name: "Dialog" })))))))), React.createElement(h$1, { features: s$4.Hidden, ref: U2 }));
9939
- }), ke = "div", we = C$1(function(e2, r2) {
9940
- 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) => {
9941
- if (l2.target === l2.currentTarget) {
9942
- if (r$1(l2.currentTarget))
9943
- return l2.preventDefault();
9944
- l2.preventDefault(), l2.stopPropagation(), p2();
9945
- }
9946
- }), n2 = useMemo(() => ({ open: o2 === 0 }), [o2]);
9947
- return $$1({ ourProps: { ref: f2, id: d2, "aria-hidden": true, onClick: c }, theirProps: a2, slot: n2, defaultTag: ke, name: "Dialog.Overlay" });
9948
- }), Fe = "div", Ie = C$1(function(e2, r2) {
9949
- let s2 = I$2(), { id: d2 = `headlessui-dialog-backdrop-${s2}`, ...a2 } = e2, [{ dialogState: o2 }, p2] = k("Dialog.Backdrop"), f2 = y(r2);
10314
+ return t2.observe(D2.current), () => t2.disconnect();
10315
+ }, [p2, D2, P2]);
10316
+ 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 };
10317
+ return React__default.createElement(b$2, { type: "Dialog", enabled: p2 === 0, element: D2, onUpdate: o$4((t2, c2) => {
10318
+ c2 === "Dialog" && u$5(t2, { [s.Add]: () => f2((d2) => d2 + 1), [s.Remove]: () => f2((d2) => d2 - 1) });
10319
+ }) }, 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));
10320
+ }
10321
+ let $e = "div";
10322
+ function Ye(o2, e2) {
10323
+ 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) => {
10324
+ if (f2.target === f2.currentTarget) {
10325
+ if (r$2(f2.currentTarget))
10326
+ return f2.preventDefault();
10327
+ f2.preventDefault(), f2.stopPropagation(), s2();
10328
+ }
10329
+ }), m2 = useMemo(() => ({ open: l2 === 0 }), [l2]);
10330
+ return C({ ourProps: { ref: a2, id: i2, "aria-hidden": true, onClick: T2 }, theirProps: n2, slot: m2, defaultTag: $e, name: "Dialog.Overlay" });
10331
+ }
10332
+ let je = "div";
10333
+ function Je(o2, e2) {
10334
+ let r2 = I$5(), { id: i2 = `headlessui-dialog-backdrop-${r2}`, ...n2 } = o2, [{ dialogState: l2 }, s2] = b$1("Dialog.Backdrop"), a2 = y$1(e2);
9950
10335
  useEffect(() => {
9951
- if (p2.panelRef.current === null)
10336
+ if (s2.panelRef.current === null)
9952
10337
  throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.");
9953
- }, [p2.panelRef]);
9954
- let c = useMemo(() => ({ open: o2 === 0 }), [o2]);
9955
- 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" })));
9956
- }), He = "div", _e = C$1(function(e2, r2) {
9957
- 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) => {
9958
- l2.stopPropagation();
10338
+ }, [s2.panelRef]);
10339
+ let T2 = useMemo(() => ({ open: l2 === 0 }), [l2]);
10340
+ 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" })));
10341
+ }
10342
+ let Xe = "div";
10343
+ function Ke(o2, e2) {
10344
+ 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) => {
10345
+ f2.stopPropagation();
9959
10346
  });
9960
- return $$1({ ourProps: { ref: f2, id: d2, onClick: n2 }, theirProps: a2, slot: c, defaultTag: He, name: "Dialog.Panel" });
9961
- }), xe$1 = "h2", We = C$1(function(e2, r2) {
9962
- let s2 = I$2(), { id: d2 = `headlessui-dialog-title-${s2}`, ...a2 } = e2, [{ dialogState: o2, setTitleId: p2 }] = k("Dialog.Title"), f2 = y(r2);
9963
- useEffect(() => (p2(d2), () => p2(null)), [d2, p2]);
9964
- let c = useMemo(() => ({ open: o2 === 0 }), [o2]);
9965
- return $$1({ ourProps: { ref: f2, id: d2 }, theirProps: a2, slot: c, defaultTag: xe$1, name: "Dialog.Title" });
9966
- }), mt = Object.assign(Me, { Backdrop: Ie, Panel: _e, Overlay: we, Title: We, Description: F$1 });
10347
+ return C({ ourProps: { ref: a2, id: i2, onClick: m2 }, theirProps: n2, slot: T2, defaultTag: Xe, name: "Dialog.Panel" });
10348
+ }
10349
+ let Ve = "h2";
10350
+ function qe$1(o2, e2) {
10351
+ let r2 = I$5(), { id: i2 = `headlessui-dialog-title-${r2}`, ...n2 } = o2, [{ dialogState: l2, setTitleId: s2 }] = b$1("Dialog.Title"), a2 = y$1(e2);
10352
+ useEffect(() => (s2(i2), () => s2(null)), [i2, s2]);
10353
+ let T2 = useMemo(() => ({ open: l2 === 0 }), [l2]);
10354
+ return C({ ourProps: { ref: a2, id: i2 }, theirProps: n2, slot: T2, defaultTag: Ve, name: "Dialog.Title" });
10355
+ }
10356
+ 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 });
10357
+ function c(a2 = 0) {
10358
+ let [l2, r2] = useState(a2), t2 = f$3(), o2 = useCallback((e2) => {
10359
+ t2.current && r2((u2) => u2 | e2);
10360
+ }, [l2, t2]), m2 = useCallback((e2) => Boolean(l2 & e2), [l2]), s2 = useCallback((e2) => {
10361
+ t2.current && r2((u2) => u2 & ~e2);
10362
+ }, [r2, t2]), g2 = useCallback((e2) => {
10363
+ t2.current && r2((u2) => u2 ^ e2);
10364
+ }, [r2]);
10365
+ return { flags: l2, addFlag: o2, hasFlag: m2, removeFlag: s2, toggleFlag: g2 };
10366
+ }
9967
10367
  function l(r2) {
9968
10368
  let e2 = { called: false };
9969
10369
  return (...t2) => {
@@ -9971,181 +10371,204 @@ function l(r2) {
9971
10371
  return e2.called = true, r2(...t2);
9972
10372
  };
9973
10373
  }
9974
- function v(t2, ...e2) {
10374
+ function g(t2, ...e2) {
9975
10375
  t2 && e2.length > 0 && t2.classList.add(...e2);
9976
10376
  }
9977
- function f(t2, ...e2) {
10377
+ function v(t2, ...e2) {
9978
10378
  t2 && e2.length > 0 && t2.classList.remove(...e2);
9979
10379
  }
9980
- function F(t2, e2) {
9981
- let n2 = m$2();
10380
+ function b(t2, e2) {
10381
+ let n2 = o$3();
9982
10382
  if (!t2)
9983
10383
  return n2.dispose;
9984
- let { transitionDuration: a2, transitionDelay: i2 } = getComputedStyle(t2), [m2, d2] = [a2, i2].map((o2) => {
9985
- let [r2 = 0] = o2.split(",").filter(Boolean).map((l2) => l2.includes("ms") ? parseFloat(l2) : parseFloat(l2) * 1e3).sort((l2, g2) => g2 - l2);
10384
+ let { transitionDuration: m2, transitionDelay: a2 } = getComputedStyle(t2), [u2, p2] = [m2, a2].map((l2) => {
10385
+ let [r2 = 0] = l2.split(",").filter(Boolean).map((i2) => i2.includes("ms") ? parseFloat(i2) : parseFloat(i2) * 1e3).sort((i2, T2) => T2 - i2);
9986
10386
  return r2;
9987
- });
9988
- if (m2 + d2 !== 0) {
9989
- let o2 = n2.addEventListener(t2, "transitionend", (r2) => {
9990
- r2.target === r2.currentTarget && (e2(), o2());
10387
+ }), o2 = u2 + p2;
10388
+ if (o2 !== 0) {
10389
+ n2.group((r2) => {
10390
+ r2.setTimeout(() => {
10391
+ e2(), r2.dispose();
10392
+ }, o2), r2.addEventListener(t2, "transitionrun", (i2) => {
10393
+ i2.target === i2.currentTarget && r2.dispose();
10394
+ });
10395
+ });
10396
+ let l2 = n2.addEventListener(t2, "transitionend", (r2) => {
10397
+ r2.target === r2.currentTarget && (e2(), l2());
9991
10398
  });
9992
10399
  } else
9993
10400
  e2();
9994
10401
  return n2.add(() => e2()), n2.dispose;
9995
10402
  }
9996
- function M$1(t2, e2, n2, a2) {
9997
- let i2 = n2 ? "enter" : "leave", m2 = m$2(), d2 = a2 !== void 0 ? l(a2) : () => {
10403
+ function M$1(t2, e2, n2, m2) {
10404
+ let a2 = n2 ? "enter" : "leave", u2 = o$3(), p2 = m2 !== void 0 ? l(m2) : () => {
9998
10405
  };
9999
- i2 === "enter" && (t2.removeAttribute("hidden"), t2.style.display = "");
10000
- 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 });
10001
- return f(t2, ...e2.enter, ...e2.enterTo, ...e2.enterFrom, ...e2.leave, ...e2.leaveFrom, ...e2.leaveTo, ...e2.entered), v(t2, ...u2, ...r2), m2.nextFrame(() => {
10002
- f(t2, ...r2), v(t2, ...o2), F(t2, () => (f(t2, ...u2), v(t2, ...e2.entered), d2()));
10003
- }), m2.dispose;
10004
- }
10005
- function D({ container: i2, direction: t2, classes: o2, onStart: s2, onStop: u2 }) {
10006
- let a2 = f$1(), c = p$2(), r2 = s$5(t2);
10007
- s$6(() => {
10008
- let e2 = m$2();
10009
- c.add(e2.dispose);
10010
- let n2 = i2.current;
10011
- if (!!n2 && r2.current !== "idle" && !!a2.current)
10012
- return e2.dispose(), s2.current(r2.current), e2.add(M$1(n2, o2.current, r2.current === "enter", () => {
10013
- e2.dispose(), u2.current(r2.current);
10014
- })), e2.dispose;
10015
- }, [t2]);
10016
- }
10017
- function e(...n2) {
10018
- return n2.filter(Boolean).join(" ");
10406
+ a2 === "enter" && (t2.removeAttribute("hidden"), t2.style.display = "");
10407
+ 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 });
10408
+ 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(() => {
10409
+ 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()));
10410
+ }), u2.dispose;
10411
+ }
10412
+ function D({ immediate: t2, container: s2, direction: n2, classes: u2, onStart: a2, onStop: c2 }) {
10413
+ let l2 = f$3(), d2 = p$3(), e2 = s$7(n2);
10414
+ l$5(() => {
10415
+ t2 && (e2.current = "enter");
10416
+ }, [t2]), l$5(() => {
10417
+ let r2 = o$3();
10418
+ d2.add(r2.dispose);
10419
+ let i2 = s2.current;
10420
+ if (i2 && e2.current !== "idle" && l2.current)
10421
+ return r2.dispose(), a2.current(e2.current), r2.add(M$1(i2, u2.current, e2.current === "enter", () => {
10422
+ r2.dispose(), c2.current(e2.current);
10423
+ })), r2.dispose;
10424
+ }, [n2]);
10019
10425
  }
10020
- function P(i2 = "") {
10021
- return i2.split(" ").filter((e2) => e2.trim().length > 1);
10426
+ function S(t2 = "") {
10427
+ return t2.split(/\s+/).filter((n2) => n2.length > 1);
10022
10428
  }
10023
- let A = createContext(null);
10024
- A.displayName = "TransitionContext";
10025
- var Ce = ((s2) => (s2.Visible = "visible", s2.Hidden = "hidden", s2))(Ce || {});
10026
- function ge() {
10027
- let i2 = useContext(A);
10028
- if (i2 === null)
10429
+ let I = createContext(null);
10430
+ I.displayName = "TransitionContext";
10431
+ var Se = ((r2) => (r2.Visible = "visible", r2.Hidden = "hidden", r2))(Se || {});
10432
+ function ye() {
10433
+ let t2 = useContext(I);
10434
+ if (t2 === null)
10029
10435
  throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
10030
- return i2;
10436
+ return t2;
10031
10437
  }
10032
- function be() {
10033
- let i2 = useContext(M);
10034
- if (i2 === null)
10438
+ function xe() {
10439
+ let t2 = useContext(M);
10440
+ if (t2 === null)
10035
10441
  throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
10036
- return i2;
10442
+ return t2;
10037
10443
  }
10038
10444
  let M = createContext(null);
10039
10445
  M.displayName = "NestingContext";
10040
- function I(i2) {
10041
- return "children" in i2 ? I(i2.children) : i2.current.filter(({ el: e2 }) => e2.current !== null).filter(({ state: e2 }) => e2 === "visible").length > 0;
10042
- }
10043
- function ne(i2, e2) {
10044
- let s2 = s$5(i2), n2 = useRef([]), m2 = f$1(), R = p$2(), b = o$3((l2, r2 = j$1.Hidden) => {
10045
- let t2 = n2.current.findIndex(({ el: o2 }) => o2 === l2);
10046
- t2 !== -1 && (u$3(r2, { [j$1.Unmount]() {
10047
- n2.current.splice(t2, 1);
10048
- }, [j$1.Hidden]() {
10049
- n2.current[t2].state = "hidden";
10050
- } }), R.microTask(() => {
10446
+ function U(t2) {
10447
+ return "children" in t2 ? U(t2.children) : t2.current.filter(({ el: n2 }) => n2.current !== null).filter(({ state: n2 }) => n2 === "visible").length > 0;
10448
+ }
10449
+ function se(t2, n2) {
10450
+ let r2 = s$7(t2), s2 = useRef([]), R2 = f$3(), D2 = p$3(), p2 = o$4((i2, e2 = v$1.Hidden) => {
10451
+ let a2 = s2.current.findIndex(({ el: o2 }) => o2 === i2);
10452
+ a2 !== -1 && (u$5(e2, { [v$1.Unmount]() {
10453
+ s2.current.splice(a2, 1);
10454
+ }, [v$1.Hidden]() {
10455
+ s2.current[a2].state = "hidden";
10456
+ } }), D2.microTask(() => {
10051
10457
  var o2;
10052
- !I(n2) && m2.current && ((o2 = s2.current) == null || o2.call(s2));
10458
+ !U(s2) && R2.current && ((o2 = r2.current) == null || o2.call(r2));
10053
10459
  }));
10054
- }), E2 = o$3((l2) => {
10055
- let r2 = n2.current.find(({ el: t2 }) => t2 === l2);
10056
- return r2 ? r2.state !== "visible" && (r2.state = "visible") : n2.current.push({ el: l2, state: "visible" }), () => b(l2, j$1.Unmount);
10057
- }), S2 = useRef([]), u2 = useRef(Promise.resolve()), p2 = useRef({ enter: [], leave: [], idle: [] }), d2 = o$3((l2, r2, t2) => {
10058
- 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) => {
10059
- S2.current.push(o2);
10060
- })]), e2 == null || e2.chains.current[r2].push([l2, new Promise((o2) => {
10061
- Promise.all(p2.current[r2].map(([f2, a2]) => a2)).then(() => o2());
10062
- })]), r2 === "enter" ? u2.current = u2.current.then(() => e2 == null ? void 0 : e2.wait.current).then(() => t2(r2)) : t2(r2);
10063
- }), v2 = o$3((l2, r2, t2) => {
10064
- Promise.all(p2.current[r2].splice(0).map(([o2, f2]) => f2)).then(() => {
10460
+ }), x2 = o$4((i2) => {
10461
+ let e2 = s2.current.find(({ el: a2 }) => a2 === i2);
10462
+ return e2 ? e2.state !== "visible" && (e2.state = "visible") : s2.current.push({ el: i2, state: "visible" }), () => p2(i2, v$1.Unmount);
10463
+ }), h2 = useRef([]), v2 = useRef(Promise.resolve()), u2 = useRef({ enter: [], leave: [], idle: [] }), g2 = o$4((i2, e2, a2) => {
10464
+ 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) => {
10465
+ h2.current.push(o2);
10466
+ })]), n2 == null || n2.chains.current[e2].push([i2, new Promise((o2) => {
10467
+ Promise.all(u2.current[e2].map(([f2, N2]) => N2)).then(() => o2());
10468
+ })]), e2 === "enter" ? v2.current = v2.current.then(() => n2 == null ? void 0 : n2.wait.current).then(() => a2(e2)) : a2(e2);
10469
+ }), d2 = o$4((i2, e2, a2) => {
10470
+ Promise.all(u2.current[e2].splice(0).map(([o2, f2]) => f2)).then(() => {
10065
10471
  var o2;
10066
- (o2 = S2.current.shift()) == null || o2();
10067
- }).then(() => t2(r2));
10472
+ (o2 = h2.current.shift()) == null || o2();
10473
+ }).then(() => a2(e2));
10068
10474
  });
10069
- return useMemo(() => ({ children: n2, register: E2, unregister: b, onStart: d2, onStop: v2, wait: u2, chains: p2 }), [E2, b, n2, d2, v2, p2, u2]);
10475
+ return useMemo(() => ({ children: s2, register: x2, unregister: p2, onStart: g2, onStop: d2, wait: v2, chains: u2 }), [x2, p2, s2, g2, d2, u2, v2]);
10070
10476
  }
10071
- function Ee() {
10477
+ function Ne() {
10072
10478
  }
10073
- let Se = ["beforeEnter", "afterEnter", "beforeLeave", "afterLeave"];
10074
- function re(i2) {
10075
- var s2;
10076
- let e2 = {};
10077
- for (let n2 of Se)
10078
- e2[n2] = (s2 = i2[n2]) != null ? s2 : Ee;
10079
- return e2;
10479
+ let Pe = ["beforeEnter", "afterEnter", "beforeLeave", "afterLeave"];
10480
+ function ae(t2) {
10481
+ var r2;
10482
+ let n2 = {};
10483
+ for (let s2 of Pe)
10484
+ n2[s2] = (r2 = t2[s2]) != null ? r2 : Ne;
10485
+ return n2;
10080
10486
  }
10081
- function xe(i2) {
10082
- let e2 = useRef(re(i2));
10487
+ function Re(t2) {
10488
+ let n2 = useRef(ae(t2));
10083
10489
  return useEffect(() => {
10084
- e2.current = re(i2);
10085
- }, [i2]), e2;
10086
- }
10087
- let Pe = "div", ie = S$1.RenderStrategy, oe = C$1(function(e$12, s2) {
10088
- 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);
10089
- useEffect(() => D$1(t2), [D$1, t2]), useEffect(() => {
10090
- if (f2 === j$1.Hidden && !!t2.current) {
10091
- if (a2 && h2 !== "visible") {
10092
- _24("visible");
10490
+ n2.current = ae(t2);
10491
+ }, [t2]), n2;
10492
+ }
10493
+ let De = "div", le = O.RenderStrategy;
10494
+ function He(t2, n2) {
10495
+ var Q2, Y2;
10496
+ 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;
10497
+ useEffect(() => L(e2), [L, e2]), useEffect(() => {
10498
+ if (o2 === v$1.Hidden && e2.current) {
10499
+ if (f2 && l2 !== "visible") {
10500
+ j2("visible");
10093
10501
  return;
10094
10502
  }
10095
- return u$3(h2, { ["hidden"]: () => V(t2), ["visible"]: () => D$1(t2) });
10503
+ return u$5(l2, { ["hidden"]: () => O2(e2), ["visible"]: () => L(e2) });
10096
10504
  }
10097
- }, [h2, t2, D$1, V, a2, f2]);
10098
- 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();
10505
+ }, [l2, e2, L, O2, f2, o2]);
10506
+ 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();
10099
10507
  useEffect(() => {
10100
- if (k2 && h2 === "visible" && t2.current === null)
10508
+ if (G2 && l2 === "visible" && e2.current === null)
10101
10509
  throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
10102
- }, [t2, h2, k2]);
10103
- 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: () => {
10104
- } })), ue = o$3((C2) => u$3(C2, { enter: () => w2.current.afterEnter(), leave: () => w2.current.afterLeave(), idle: () => {
10105
- } })), L2 = ne(() => {
10106
- _24("hidden"), V(t2);
10107
- }, K);
10108
- D({ container: t2, classes: U2, direction: le, onStart: s$5((C2) => {
10109
- L2.onStart(t2, C2, ae);
10110
- }), onStop: s$5((C2) => {
10111
- L2.onStop(t2, C2, ue), C2 === "leave" && !I(L2) && (_24("hidden"), V(t2));
10112
- }) }), useEffect(() => {
10113
- !G || (f2 === j$1.Hidden ? j2.current = null : j2.current = a2);
10114
- }, [a2, G, h2]);
10115
- let B = r2, de2 = { ref: o2 };
10116
- 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" })));
10117
- }), J = C$1(function(e2, s2) {
10118
- let { show: n2, appear: m2 = false, unmount: R, ...b } = e2, E2 = useRef(null), S2 = y(E2, s2);
10119
- a$2();
10120
- let u2 = s$3();
10121
- if (n2 === void 0 && u2 !== null && (n2 = u$3(u2, { [p.Open]: true, [p.Closed]: false })), ![true, false].includes(n2))
10510
+ }, [e2, l2, G2]);
10511
+ 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: () => {
10512
+ H2.addFlag(d$3.Opening), V.current.beforeEnter();
10513
+ }, leave: () => {
10514
+ H2.addFlag(d$3.Closing), V.current.beforeLeave();
10515
+ }, idle: () => {
10516
+ } })), me = o$4((C2) => u$5(C2, { enter: () => {
10517
+ H2.removeFlag(d$3.Opening), V.current.afterEnter();
10518
+ }, leave: () => {
10519
+ H2.removeFlag(d$3.Closing), V.current.afterLeave();
10520
+ }, idle: () => {
10521
+ } })), w2 = se(() => {
10522
+ j2("hidden"), O2(e2);
10523
+ }, z2), B = useRef(false);
10524
+ D({ immediate: K, container: e2, classes: k2, direction: de2, onStart: s$7((C2) => {
10525
+ B.current = true, w2.onStart(e2, C2, fe);
10526
+ }), onStop: s$7((C2) => {
10527
+ B.current = false, w2.onStop(e2, C2, me), C2 === "leave" && !U(w2) && (j2("hidden"), O2(e2));
10528
+ }) });
10529
+ let P2 = i2, ce = { ref: a2 };
10530
+ 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" })));
10531
+ }
10532
+ function Fe(t2, n2) {
10533
+ let { show: r2, appear: s2 = false, unmount: R2 = true, ...D2 } = t2, p2 = useRef(null), x2 = y$1(p2, n2);
10534
+ l$4();
10535
+ let h2 = u$2();
10536
+ if (r2 === void 0 && h2 !== null && (r2 = (h2 & d$3.Open) === d$3.Open), ![true, false].includes(r2))
10122
10537
  throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
10123
- let [p$12, d2] = useState(n2 ? "visible" : "hidden"), v2 = ne(() => {
10124
- d2("hidden");
10125
- }), [l2, r2] = useState(true), t2 = useRef([n2]);
10126
- s$6(() => {
10127
- l2 !== false && t2.current[t2.current.length - 1] !== n2 && (t2.current.push(n2), r2(false));
10128
- }, [t2, n2]);
10129
- let o2 = useMemo(() => ({ show: n2, appear: m2, initial: l2 }), [n2, m2, l2]);
10538
+ let [v2, u2] = useState(r2 ? "visible" : "hidden"), g2 = se(() => {
10539
+ u2("hidden");
10540
+ }), [d2, i2] = useState(true), e2 = useRef([r2]);
10541
+ l$5(() => {
10542
+ d2 !== false && e2.current[e2.current.length - 1] !== r2 && (e2.current.push(r2), i2(false));
10543
+ }, [e2, r2]);
10544
+ let a2 = useMemo(() => ({ show: r2, appear: s2, initial: d2 }), [r2, s2, d2]);
10130
10545
  useEffect(() => {
10131
- if (n2)
10132
- d2("visible");
10133
- else if (!I(v2))
10134
- d2("hidden");
10546
+ if (r2)
10547
+ u2("visible");
10548
+ else if (!U(g2))
10549
+ u2("hidden");
10135
10550
  else {
10136
- let a2 = E2.current;
10137
- if (!a2)
10551
+ let T2 = p2.current;
10552
+ if (!T2)
10138
10553
  return;
10139
- let x2 = a2.getBoundingClientRect();
10140
- x2.x === 0 && x2.y === 0 && x2.width === 0 && x2.height === 0 && d2("hidden");
10141
- }
10142
- }, [n2, v2]);
10143
- let f2 = { unmount: R };
10144
- 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" })));
10145
- }), ye = C$1(function(e2, s2) {
10146
- let n2 = useContext(A) !== null, m2 = s$3() !== null;
10147
- return React.createElement(React.Fragment, null, !n2 && m2 ? React.createElement(J, { ref: s2, ...e2 }) : React.createElement(oe, { ref: s2, ...e2 }));
10148
- }), Je = Object.assign(J, { Child: ye, Root: J });
10554
+ let l2 = T2.getBoundingClientRect();
10555
+ l2.x === 0 && l2.y === 0 && l2.width === 0 && l2.height === 0 && u2("hidden");
10556
+ }
10557
+ }, [r2, g2]);
10558
+ let o2 = { unmount: R2 }, f2 = o$4(() => {
10559
+ var T2;
10560
+ d2 && i2(false), (T2 = t2.beforeEnter) == null || T2.call(t2);
10561
+ }), N2 = o$4(() => {
10562
+ var T2;
10563
+ d2 && i2(false), (T2 = t2.beforeLeave) == null || T2.call(t2);
10564
+ });
10565
+ 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" })));
10566
+ }
10567
+ function _e(t2, n2) {
10568
+ let r2 = useContext(I) !== null, s2 = u$2() !== null;
10569
+ return React__default.createElement(React__default.Fragment, null, !r2 && s2 ? React__default.createElement(q, { ref: n2, ...t2 }) : React__default.createElement(ue, { ref: n2, ...t2 }));
10570
+ }
10571
+ let q = U$2(Fe), ue = U$2(He), Le = U$2(_e), qe = Object.assign(q, { Child: Le, Root: q });
10149
10572
  function Modal(props) {
10150
10573
  const {
10151
10574
  children,
@@ -10158,11 +10581,11 @@ function Modal(props) {
10158
10581
  isModal: true
10159
10582
  });
10160
10583
  return /* @__PURE__ */ jsx(Fragment, {
10161
- children: /* @__PURE__ */ jsx(Je, {
10584
+ children: /* @__PURE__ */ jsx(qe, {
10162
10585
  appear: true,
10163
10586
  show: isOpen,
10164
10587
  as: Fragment$1,
10165
- children: /* @__PURE__ */ jsx(mt, {
10588
+ children: /* @__PURE__ */ jsx(_t, {
10166
10589
  as: "div",
10167
10590
  className: "fixed inset-0 z-10 overflow-y-auto",
10168
10591
  style: {
@@ -10171,7 +10594,7 @@ function Modal(props) {
10171
10594
  onClose: handleClose,
10172
10595
  children: /* @__PURE__ */ jsxs("div", {
10173
10596
  className: "min-h-screen text-center sm:px-4",
10174
- children: [/* @__PURE__ */ jsx(Je.Child, {
10597
+ children: [/* @__PURE__ */ jsx(qe.Child, {
10175
10598
  as: Fragment$1,
10176
10599
  enter: "ease-out duration-300",
10177
10600
  enterFrom: "opacity-0",
@@ -10179,14 +10602,14 @@ function Modal(props) {
10179
10602
  leave: "ease-in duration-200",
10180
10603
  leaveFrom: "opacity-100",
10181
10604
  leaveTo: "opacity-0",
10182
- children: /* @__PURE__ */ jsx(mt.Overlay, {
10605
+ children: /* @__PURE__ */ jsx(_t.Overlay, {
10183
10606
  className: "fixed inset-0"
10184
10607
  })
10185
10608
  }), /* @__PURE__ */ jsx("span", {
10186
10609
  className: "inline-block h-screen align-middle",
10187
10610
  "aria-hidden": "true",
10188
10611
  children: "\u200B"
10189
- }), /* @__PURE__ */ jsx(Je.Child, {
10612
+ }), /* @__PURE__ */ jsx(qe.Child, {
10190
10613
  as: Fragment$1,
10191
10614
  enter: "ease-out duration-300",
10192
10615
  enterFrom: "opacity-0 scale-95",
@@ -10411,7 +10834,7 @@ const MenuProductRoot = (props) => {
10411
10834
  });
10412
10835
  };
10413
10836
  var style = "";
10414
- const ProductDataContext = React.createContext(null);
10837
+ const ProductDataContext = React__default.createContext(null);
10415
10838
  function ProductDataProvider({
10416
10839
  rootProduct,
10417
10840
  children
@@ -10489,6 +10912,7 @@ function ProductConfigurator(props) {
10489
10912
  });
10490
10913
  } else {
10491
10914
  console.log("selected", getValues("selected"));
10915
+ console.log("filter", getValues("filter"));
10492
10916
  const decodedCleanedSelected = decodeSelected(cleanSelected(getValues("selected")));
10493
10917
  console.log("decodedCleanedSelected: ", decodedCleanedSelected);
10494
10918
  handleAddToCart({