likec4 1.46.0 → 1.46.2

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.
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import React__default, { useState, Fragment, createContext, useContext, useRef, useEffect, useMemo, useCallback, useLayoutEffect as useLayoutEffect$1, useId as useId$3, forwardRef, cloneElement, Children, createElement, memo as memo$2, useSyncExternalStore, useInsertionEffect as useInsertionEffect$1, isValidElement, Component, useImperativeHandle } from "react";
2
+ import React__default, { useState, Fragment, createContext, useContext, useRef, useEffect, useMemo, useCallback, useLayoutEffect as useLayoutEffect$1, Children, useId as useId$3, forwardRef, cloneElement, createElement, memo as memo$2, useSyncExternalStore, useInsertionEffect as useInsertionEffect$1, isValidElement, Component, useImperativeHandle } from "react";
3
3
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
4
4
  import * as ReactDOM from "react-dom";
5
5
  import ReactDOM__default, { flushSync, createPortal } from "react-dom";
@@ -1326,7 +1326,7 @@ function useFocusWithin({
1326
1326
  [onBlur]
1327
1327
  ), callbackRef = useCallback(
1328
1328
  (node) => {
1329
- node && (previousNode.current && (previousNode.current.removeEventListener("focusin", handleFocusIn), previousNode.current.removeEventListener("focusout", handleFocusOut)), node.addEventListener("focusin", handleFocusIn), node.addEventListener("focusout", handleFocusOut));
1329
+ node && (previousNode.current && (previousNode.current.removeEventListener("focusin", handleFocusIn), previousNode.current.removeEventListener("focusout", handleFocusOut)), node.addEventListener("focusin", handleFocusIn), node.addEventListener("focusout", handleFocusOut), previousNode.current = node);
1330
1330
  },
1331
1331
  [handleFocusIn, handleFocusOut]
1332
1332
  );
@@ -1359,9 +1359,10 @@ function usePrevious$1(value) {
1359
1359
  function useInViewport() {
1360
1360
  const observer = useRef(null), [inViewport, setInViewport] = useState(!1);
1361
1361
  return { ref: useCallback((node) => {
1362
- typeof IntersectionObserver < "u" && (node && !observer.current ? observer.current = new IntersectionObserver(
1363
- (entries) => setInViewport(entries.some((entry) => entry.isIntersecting))
1364
- ) : observer.current?.disconnect(), node ? observer.current?.observe(node) : setInViewport(!1));
1362
+ typeof IntersectionObserver < "u" && (node && !observer.current ? observer.current = new IntersectionObserver((entries) => {
1363
+ const lastEntry = entries[entries.length - 1];
1364
+ setInViewport(lastEntry.isIntersecting);
1365
+ }) : observer.current?.disconnect(), node ? observer.current?.observe(node) : setInViewport(!1));
1365
1366
  }, []), inViewport };
1366
1367
  }
1367
1368
  function useMutationObserver(callback, options, target) {
@@ -1484,6 +1485,10 @@ function getRootElement(targetElement) {
1484
1485
  const root2 = targetElement.getRootNode();
1485
1486
  return root2 instanceof ShadowRoot || root2 instanceof Document ? root2 : document;
1486
1487
  }
1488
+ function getSingleElementChild(children2) {
1489
+ const _children = Children.toArray(children2);
1490
+ return _children.length !== 1 || !isElement$1(_children[0]) ? null : _children[0];
1491
+ }
1487
1492
  function r$f(e2) {
1488
1493
  var t2, f, n2 = "";
1489
1494
  if (typeof e2 == "string" || typeof e2 == "number") n2 += e2;
@@ -2216,11 +2221,10 @@ function MantineClasses() {
2216
2221
  function cssVariablesObjectToString(variables) {
2217
2222
  return Object.entries(variables).map(([name, value]) => `${name}: ${value};`).join("");
2218
2223
  }
2219
- function wrapWithSelector(selectors, code) {
2220
- return (Array.isArray(selectors) ? selectors : [selectors]).reduce((acc, selector2) => `${selector2}{${acc}}`, code);
2221
- }
2222
- function convertCssVariables(input, selector2) {
2223
- const sharedVariables = cssVariablesObjectToString(input.variables), shared = sharedVariables ? wrapWithSelector(selector2, sharedVariables) : "", dark = cssVariablesObjectToString(input.dark), light = cssVariablesObjectToString(input.light), darkForced = dark ? wrapWithSelector(selector2 === ":host" ? `${selector2}([data-mantine-color-scheme="dark"])` : `${selector2}[data-mantine-color-scheme="dark"]`, dark) : "", lightForced = light ? wrapWithSelector(selector2 === ":host" ? `${selector2}([data-mantine-color-scheme="light"])` : `${selector2}[data-mantine-color-scheme="light"]`, light) : "";
2224
+ function convertCssVariables(input, selectorOverride) {
2225
+ const selectors = selectorOverride ? [selectorOverride] : [":root", ":host"], sharedVariables = cssVariablesObjectToString(input.variables), shared = sharedVariables ? `${selectors.join(", ")}{${sharedVariables}}` : "", dark = cssVariablesObjectToString(input.dark), light = cssVariablesObjectToString(input.light), selectorsWithScheme = (scheme) => selectors.map(
2226
+ (selector2) => selector2 === ":host" ? `${selector2}([data-mantine-color-scheme="${scheme}"])` : `${selector2}[data-mantine-color-scheme="${scheme}"]`
2227
+ ).join(", "), darkForced = dark ? `${selectorsWithScheme("dark")}{${dark}}` : "", lightForced = light ? `${selectorsWithScheme("light")}{${light}}` : "";
2224
2228
  return `${shared}
2225
2229
 
2226
2230
  ${darkForced}
@@ -2447,17 +2451,21 @@ function removeDefaultVariables(input) {
2447
2451
  defaultCssVariables.dark[key] !== input.dark[key] && (cleaned.dark[key] = input.dark[key]);
2448
2452
  }), cleaned;
2449
2453
  }
2450
- function getColorSchemeCssVariables(selector2) {
2451
- return `
2452
- ${selector2}[data-mantine-color-scheme="dark"] { --mantine-color-scheme: dark; }
2453
- ${selector2}[data-mantine-color-scheme="light"] { --mantine-color-scheme: light; }
2454
- `;
2454
+ function getColorSchemeCssVariables(selectorOverride) {
2455
+ return convertCssVariables(
2456
+ {
2457
+ variables: {},
2458
+ dark: { "--mantine-color-scheme": "dark" },
2459
+ light: { "--mantine-color-scheme": "light" }
2460
+ },
2461
+ selectorOverride
2462
+ );
2455
2463
  }
2456
2464
  function MantineCssVariables({
2457
2465
  cssVariablesSelector,
2458
2466
  deduplicateCssVariables
2459
2467
  }) {
2460
- const theme = useMantineTheme(), nonce = useMantineStyleNonce(), generator = useMantineCssVariablesResolver(), mergedVariables = getMergedVariables({ theme, generator }), shouldCleanVariables = cssVariablesSelector === ":root" && deduplicateCssVariables, cleanedVariables = shouldCleanVariables ? removeDefaultVariables(mergedVariables) : mergedVariables, css = convertCssVariables(cleanedVariables, cssVariablesSelector);
2468
+ const theme = useMantineTheme(), nonce = useMantineStyleNonce(), generator = useMantineCssVariablesResolver(), mergedVariables = getMergedVariables({ theme, generator }), shouldCleanVariables = (cssVariablesSelector === void 0 || cssVariablesSelector === ":root" || cssVariablesSelector === ":host") && deduplicateCssVariables, cleanedVariables = shouldCleanVariables ? removeDefaultVariables(mergedVariables) : mergedVariables, css = convertCssVariables(cleanedVariables, cssVariablesSelector);
2461
2469
  return css ? /* @__PURE__ */ jsx(
2462
2470
  "style",
2463
2471
  {
@@ -2517,7 +2525,7 @@ function MantineProvider({
2517
2525
  withGlobalClasses = !0,
2518
2526
  deduplicateCssVariables = !0,
2519
2527
  withCssVariables = !0,
2520
- cssVariablesSelector = ":root",
2528
+ cssVariablesSelector,
2521
2529
  classNamesPrefix = "mantine",
2522
2530
  colorSchemeManager = localStorageColorSchemeManager(),
2523
2531
  defaultColorScheme = "light",
@@ -2547,7 +2555,7 @@ function MantineProvider({
2547
2555
  classNamesPrefix,
2548
2556
  getStyleNonce,
2549
2557
  cssVariablesResolver,
2550
- cssVariablesSelector,
2558
+ cssVariablesSelector: cssVariablesSelector ?? ":root",
2551
2559
  withStaticClasses,
2552
2560
  stylesTransform,
2553
2561
  env
@@ -5187,7 +5195,7 @@ function useHover(context, props2) {
5187
5195
  };
5188
5196
  return;
5189
5197
  }
5190
- (pointerTypeRef.current === "touch" ? !contains(elements.floating, event.relatedTarget) : !0) && closeWithDelay(event);
5198
+ (pointerTypeRef.current !== "touch" || !contains(elements.floating, event.relatedTarget)) && closeWithDelay(event);
5191
5199
  }
5192
5200
  function onScrollMouseLeave(event) {
5193
5201
  isClickLikeOpenEvent() || dataRef.current.floatingContext && (handleCloseRef.current == null || handleCloseRef.current({
@@ -7014,8 +7022,8 @@ function FocusTrap({
7014
7022
  refProp = "ref",
7015
7023
  innerRef
7016
7024
  }) {
7017
- const focusTrapRef = useFocusTrap(active), ref = useMergedRef(focusTrapRef, innerRef);
7018
- return isElement$1(children2) ? cloneElement(children2, { [refProp]: ref }) : children2;
7025
+ const focusTrapRef = useFocusTrap(active), ref = useMergedRef(focusTrapRef, innerRef), child = getSingleElementChild(children2);
7026
+ return child ? cloneElement(child, { [refProp]: ref }) : children2;
7019
7027
  }
7020
7028
  function FocusTrapInitialFocus(props2) {
7021
7029
  return /* @__PURE__ */ jsx(VisuallyHidden, { tabIndex: -1, "data-autofocus": !0, ...props2 });
@@ -7127,30 +7135,26 @@ const defaultProps$M = {
7127
7135
  "PopoverTarget",
7128
7136
  defaultProps$M,
7129
7137
  props2
7130
- );
7131
- if (!isElement$1(children2))
7138
+ ), child = getSingleElementChild(children2);
7139
+ if (!child)
7132
7140
  throw new Error(
7133
7141
  "Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
7134
7142
  );
7135
- const forwardedProps = others, ctx = usePopoverContext(), targetRef = useMergedRef(ctx.reference, getRefProp(children2), ref), accessibleProps = ctx.withRoles ? {
7143
+ const forwardedProps = others, ctx = usePopoverContext(), targetRef = useMergedRef(ctx.reference, getRefProp(child), ref), accessibleProps = ctx.withRoles ? {
7136
7144
  "aria-haspopup": popupType,
7137
7145
  "aria-expanded": ctx.opened,
7138
7146
  "aria-controls": ctx.getDropdownId(),
7139
7147
  id: ctx.getTargetId()
7140
- } : {};
7141
- return cloneElement(children2, {
7148
+ } : {}, childProps = child.props;
7149
+ return cloneElement(child, {
7142
7150
  ...forwardedProps,
7143
7151
  ...accessibleProps,
7144
7152
  ...ctx.targetProps,
7145
- className: clsx(
7146
- ctx.targetProps.className,
7147
- forwardedProps.className,
7148
- children2.props.className
7149
- ),
7153
+ className: clsx(ctx.targetProps.className, forwardedProps.className, childProps.className),
7150
7154
  [refProp]: targetRef,
7151
7155
  ...ctx.controlled ? null : {
7152
7156
  onClick: () => {
7153
- ctx.onToggle(), children2.props.onClick?.();
7157
+ ctx.onToggle(), childProps.onClick?.();
7154
7158
  }
7155
7159
  }
7156
7160
  });
@@ -7214,7 +7218,7 @@ function usePopover(options) {
7214
7218
  options.onPositionChange?.(floating.placement), options.positionRef.current = floating.placement;
7215
7219
  }, [floating.placement, options.preventPositionChangeWhenVisible]), useDidUpdate(() => {
7216
7220
  _opened !== previouslyOpened.current && (_opened ? options.onOpen?.() : options.onClose?.()), previouslyOpened.current = _opened;
7217
- }, [_opened, options.onClose, options.onOpen]), useDidUpdate(() => {
7221
+ }, [_opened, options.onClose, options.onOpen]), useIsomorphicEffect(() => {
7218
7222
  let timeout2 = -1;
7219
7223
  return _opened && (timeout2 = window.setTimeout(() => options.setDropdownVisible(!0), 4)), () => {
7220
7224
  window.clearTimeout(timeout2);
@@ -9297,8 +9301,8 @@ const defaultProps$y = {
9297
9301
  targetType,
9298
9302
  autoComplete,
9299
9303
  ...others
9300
- } = useProps("ComboboxEventsTarget", defaultProps$y, props2);
9301
- if (!isElement$1(children2))
9304
+ } = useProps("ComboboxEventsTarget", defaultProps$y, props2), child = getSingleElementChild(children2);
9305
+ if (!child)
9302
9306
  throw new Error(
9303
9307
  "Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
9304
9308
  );
@@ -9307,13 +9311,13 @@ const defaultProps$y = {
9307
9311
  withAriaAttributes,
9308
9312
  withKeyboardNavigation,
9309
9313
  withExpandedAttribute,
9310
- onKeyDown: children2.props.onKeyDown,
9314
+ onKeyDown: child.props.onKeyDown,
9311
9315
  autoComplete
9312
9316
  });
9313
- return cloneElement(children2, {
9317
+ return cloneElement(child, {
9314
9318
  ...targetProps,
9315
9319
  ...others,
9316
- [refProp]: useMergedRef(ref, ctx.store.targetRef, getRefProp(children2))
9320
+ [refProp]: useMergedRef(ref, ctx.store.targetRef, getRefProp(child))
9317
9321
  });
9318
9322
  });
9319
9323
  ComboboxEventsTarget.displayName = "@mantine/core/ComboboxEventsTarget";
@@ -9514,8 +9518,8 @@ const defaultProps$w = {
9514
9518
  targetType,
9515
9519
  autoComplete,
9516
9520
  ...others
9517
- } = useProps("ComboboxTarget", defaultProps$w, props2);
9518
- if (!isElement$1(children2))
9521
+ } = useProps("ComboboxTarget", defaultProps$w, props2), child = getSingleElementChild(children2);
9522
+ if (!child)
9519
9523
  throw new Error(
9520
9524
  "Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
9521
9525
  );
@@ -9524,9 +9528,9 @@ const defaultProps$w = {
9524
9528
  withAriaAttributes,
9525
9529
  withKeyboardNavigation,
9526
9530
  withExpandedAttribute,
9527
- onKeyDown: children2.props.onKeyDown,
9531
+ onKeyDown: child.props.onKeyDown,
9528
9532
  autoComplete
9529
- }), clonedElement = cloneElement(children2, {
9533
+ }), clonedElement = cloneElement(child, {
9530
9534
  ...targetProps,
9531
9535
  ...others
9532
9536
  });
@@ -11110,8 +11114,8 @@ const defaultProps$j = {
11110
11114
  "HoverCardTarget",
11111
11115
  defaultProps$j,
11112
11116
  props2
11113
- );
11114
- if (!isElement$1(children2))
11117
+ ), child = getSingleElementChild(children2);
11118
+ if (!child)
11115
11119
  throw new Error(
11116
11120
  "HoverCard.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
11117
11121
  );
@@ -11119,13 +11123,13 @@ const defaultProps$j = {
11119
11123
  if (useHoverCardGroupContext() && ctx.getReferenceProps && ctx.reference) {
11120
11124
  const referenceProps = ctx.getReferenceProps();
11121
11125
  return /* @__PURE__ */ jsx(Popover.Target, { refProp, ref, ...others, children: cloneElement(
11122
- children2,
11126
+ child,
11123
11127
  eventPropsWrapperName ? { [eventPropsWrapperName]: { ...referenceProps, ref: ctx.reference } } : { ...referenceProps, ref: ctx.reference }
11124
11128
  ) });
11125
11129
  }
11126
- const onMouseEnter = createEventHandler(children2.props.onMouseEnter, ctx.openDropdown), onMouseLeave = createEventHandler(children2.props.onMouseLeave, ctx.closeDropdown), eventListeners = { onMouseEnter, onMouseLeave };
11130
+ const onMouseEnter = createEventHandler(child.props.onMouseEnter, ctx.openDropdown), onMouseLeave = createEventHandler(child.props.onMouseLeave, ctx.closeDropdown), eventListeners = { onMouseEnter, onMouseLeave };
11127
11131
  return /* @__PURE__ */ jsx(Popover.Target, { refProp, ref, ...others, children: cloneElement(
11128
- children2,
11132
+ child,
11129
11133
  eventPropsWrapperName ? { [eventPropsWrapperName]: eventListeners } : eventListeners
11130
11134
  ) });
11131
11135
  });
@@ -11560,20 +11564,20 @@ MenuSub.Item = MenuSubItem;
11560
11564
  const defaultProps$f = {
11561
11565
  refProp: "ref"
11562
11566
  }, MenuTarget = forwardRef((props2, ref) => {
11563
- const { children: children2, refProp, ...others } = useProps("MenuTarget", defaultProps$f, props2);
11564
- if (!isElement$1(children2))
11567
+ const { children: children2, refProp, ...others } = useProps("MenuTarget", defaultProps$f, props2), child = getSingleElementChild(children2);
11568
+ if (!child)
11565
11569
  throw new Error(
11566
11570
  "Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
11567
11571
  );
11568
- const ctx = useMenuContext(), _childrenProps = children2.props, onClick = createEventHandler(_childrenProps.onClick, () => {
11572
+ const ctx = useMenuContext(), _childProps = child.props, onClick = createEventHandler(_childProps.onClick, () => {
11569
11573
  ctx.trigger === "click" ? ctx.toggleDropdown() : ctx.trigger === "click-hover" && (ctx.setOpenedViaClick(!0), ctx.opened || ctx.openDropdown());
11570
11574
  }), onMouseEnter = createEventHandler(
11571
- _childrenProps.onMouseEnter,
11575
+ _childProps.onMouseEnter,
11572
11576
  () => (ctx.trigger === "hover" || ctx.trigger === "click-hover") && ctx.openDropdown()
11573
- ), onMouseLeave = createEventHandler(_childrenProps.onMouseLeave, () => {
11577
+ ), onMouseLeave = createEventHandler(_childProps.onMouseLeave, () => {
11574
11578
  (ctx.trigger === "hover" || ctx.trigger === "click-hover" && !ctx.openedViaClick) && ctx.closeDropdown();
11575
11579
  });
11576
- return /* @__PURE__ */ jsx(Popover.Target, { refProp, popupType: "menu", ref, ...others, children: cloneElement(children2, {
11580
+ return /* @__PURE__ */ jsx(Popover.Target, { refProp, popupType: "menu", ref, ...others, children: cloneElement(child, {
11577
11581
  onClick,
11578
11582
  onMouseEnter,
11579
11583
  onMouseLeave,
@@ -11664,6 +11668,7 @@ function Menu(_props) {
11664
11668
  children: /* @__PURE__ */ jsx(
11665
11669
  Popover,
11666
11670
  {
11671
+ returnFocus: !0,
11667
11672
  ...others,
11668
11673
  opened: _opened,
11669
11674
  onChange: toggleDropdown,
@@ -12222,15 +12227,15 @@ const defaultProps$a = {
12222
12227
  offset: offset2,
12223
12228
  position,
12224
12229
  defaultOpened
12225
- });
12226
- if (!isElement$1(children2))
12230
+ }), child = getSingleElementChild(children2);
12231
+ if (!child)
12227
12232
  throw new Error(
12228
12233
  "[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported"
12229
12234
  );
12230
- const targetRef = useMergedRef(boundaryRef, getRefProp(children2), ref), _childrenProps = children2.props, onMouseEnter = (event) => {
12231
- _childrenProps.onMouseEnter?.(event), handleMouseMove(event), setOpened(!0);
12235
+ const targetRef = useMergedRef(boundaryRef, getRefProp(child), ref), childProps = child.props, onMouseEnter = (event) => {
12236
+ childProps.onMouseEnter?.(event), handleMouseMove(event), setOpened(!0);
12232
12237
  }, onMouseLeave = (event) => {
12233
- _childrenProps.onMouseLeave?.(event), setOpened(!1);
12238
+ childProps.onMouseLeave?.(event), setOpened(!1);
12234
12239
  };
12235
12240
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
12236
12241
  /* @__PURE__ */ jsx(OptionalPortal, { ...portalProps, withinPortal, children: /* @__PURE__ */ jsx(
@@ -12252,8 +12257,8 @@ const defaultProps$a = {
12252
12257
  children: label
12253
12258
  }
12254
12259
  ) }),
12255
- cloneElement(children2, {
12256
- ..._childrenProps,
12260
+ cloneElement(child, {
12261
+ ...childProps,
12257
12262
  [refProp]: targetRef,
12258
12263
  onMouseEnter,
12259
12264
  onMouseLeave
@@ -12448,8 +12453,8 @@ const defaultProps$8 = {
12448
12453
  rootSelector: "tooltip",
12449
12454
  vars,
12450
12455
  varsResolver: varsResolver$7
12451
- });
12452
- if (!target && !isElement$1(children2))
12456
+ }), child = getSingleElementChild(children2);
12457
+ if (!target && !child)
12453
12458
  return null;
12454
12459
  if (target) {
12455
12460
  const transition2 = getTransitionProps(transitionProps, { duration: 100, transition: "fade" });
@@ -12501,7 +12506,7 @@ const defaultProps$8 = {
12501
12506
  }
12502
12507
  ) }) });
12503
12508
  }
12504
- const _children = children2, _childrenProps = _children.props, targetRef = useMergedRef(tooltip.reference, getRefProp(_children), ref), transition = getTransitionProps(transitionProps, { duration: 100, transition: "fade" });
12509
+ const childProps = child.props, targetRef = useMergedRef(tooltip.reference, getRefProp(child), ref), transition = getTransitionProps(transitionProps, { duration: 100, transition: "fade" });
12505
12510
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
12506
12511
  /* @__PURE__ */ jsx(OptionalPortal, { ...portalProps, withinPortal, children: /* @__PURE__ */ jsx(
12507
12512
  Transition$1,
@@ -12551,7 +12556,7 @@ const defaultProps$8 = {
12551
12556
  }
12552
12557
  ) }),
12553
12558
  cloneElement(
12554
- _children,
12559
+ child,
12555
12560
  tooltip.getReferenceProps({
12556
12561
  onClick,
12557
12562
  onMouseEnter,
@@ -12559,8 +12564,8 @@ const defaultProps$8 = {
12559
12564
  onMouseMove: props2.onMouseMove,
12560
12565
  onPointerDown: props2.onPointerDown,
12561
12566
  onPointerEnter: props2.onPointerEnter,
12562
- className: clsx(className, _childrenProps.className),
12563
- ..._childrenProps,
12567
+ ...childProps,
12568
+ className: clsx(className, childProps.className),
12564
12569
  [refProp]: targetRef
12565
12570
  })
12566
12571
  )
@@ -14660,11 +14665,11 @@ function createRandomKey() {
14660
14665
  function last(arr) {
14661
14666
  return arr[arr.length - 1];
14662
14667
  }
14663
- function isFunction(d) {
14668
+ function isFunction$1(d) {
14664
14669
  return typeof d == "function";
14665
14670
  }
14666
14671
  function functionalUpdate(updater, previous) {
14667
- return isFunction(updater) ? updater(previous) : updater;
14672
+ return isFunction$1(updater) ? updater(previous) : updater;
14668
14673
  }
14669
14674
  function pick$1(parent, keys2) {
14670
14675
  return keys2.reduce((obj, key) => (obj[key] = parent[key], obj), {});
@@ -16718,7 +16723,7 @@ class Route extends BaseRoute {
16718
16723
  select: opts?.select,
16719
16724
  structuralSharing: opts?.structuralSharing,
16720
16725
  from: this.id
16721
- }), this.useLoaderDeps = (opts) => useLoaderDeps({ ...opts, from: this.id }), this.useLoaderData = (opts) => useLoaderData({ ...opts, from: this.id }), this.useNavigate = () => useNavigate({ from: this.fullPath }), this.$$typeof = Symbol.for("react.memo");
16726
+ }), this.useLoaderDeps = (opts) => useLoaderDeps({ ...opts, from: this.id }), this.useLoaderData = (opts) => useLoaderData({ ...opts, from: this.id }), this.useNavigate = () => useNavigate({ from: this.fullPath }), this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
16722
16727
  }
16723
16728
  }
16724
16729
  function createRoute(options) {
@@ -18107,7 +18112,7 @@ Dispatch.prototype = dispatch.prototype = {
18107
18112
  on: function(typename, callback) {
18108
18113
  var _ = this._, T = parseTypenames$1(typename + "", _), t2, i2 = -1, n2 = T.length;
18109
18114
  if (arguments.length < 2) {
18110
- for (; ++i2 < n2; ) if ((t2 = (typename = T[i2]).type) && (t2 = get$1(_[t2], typename.name))) return t2;
18115
+ for (; ++i2 < n2; ) if ((t2 = (typename = T[i2]).type) && (t2 = get$2(_[t2], typename.name))) return t2;
18111
18116
  return;
18112
18117
  }
18113
18118
  if (callback != null && typeof callback != "function") throw new Error("invalid callback: " + callback);
@@ -18131,7 +18136,7 @@ Dispatch.prototype = dispatch.prototype = {
18131
18136
  for (var t2 = this._[type], i2 = 0, n2 = t2.length; i2 < n2; ++i2) t2[i2].value.apply(that, args);
18132
18137
  }
18133
18138
  };
18134
- function get$1(type, name) {
18139
+ function get$2(type, name) {
18135
18140
  for (var i2 = 0, n2 = type.length, c; i2 < n2; ++i2)
18136
18141
  if ((c = type[i2]).name === name)
18137
18142
  return c.value;
@@ -19473,16 +19478,16 @@ function schedule(node, name, id2, index2, group, timing) {
19473
19478
  });
19474
19479
  }
19475
19480
  function init(node, id2) {
19476
- var schedule2 = get(node, id2);
19481
+ var schedule2 = get$1(node, id2);
19477
19482
  if (schedule2.state > CREATED) throw new Error("too late; already scheduled");
19478
19483
  return schedule2;
19479
19484
  }
19480
19485
  function set$1(node, id2) {
19481
- var schedule2 = get(node, id2);
19486
+ var schedule2 = get$1(node, id2);
19482
19487
  if (schedule2.state > STARTED) throw new Error("too late; already running");
19483
19488
  return schedule2;
19484
19489
  }
19485
- function get(node, id2) {
19490
+ function get$1(node, id2) {
19486
19491
  var schedule2 = node.__transition;
19487
19492
  if (!schedule2 || !(schedule2 = schedule2[id2])) throw new Error("transition not found");
19488
19493
  return schedule2;
@@ -19574,7 +19579,7 @@ function tweenFunction(id2, name, value) {
19574
19579
  function transition_tween(name, value) {
19575
19580
  var id2 = this._id;
19576
19581
  if (name += "", arguments.length < 2) {
19577
- for (var tween = get(this.node(), id2).tween, i2 = 0, n2 = tween.length, t2; i2 < n2; ++i2)
19582
+ for (var tween = get$1(this.node(), id2).tween, i2 = 0, n2 = tween.length, t2; i2 < n2; ++i2)
19578
19583
  if ((t2 = tween[i2]).name === name)
19579
19584
  return t2.value;
19580
19585
  return null;
@@ -19587,7 +19592,7 @@ function tweenValue(transition, name, value) {
19587
19592
  var schedule2 = set$1(this, id2);
19588
19593
  (schedule2.value || (schedule2.value = {}))[name] = value.apply(this, arguments);
19589
19594
  }), function(node) {
19590
- return get(node, id2).value[name];
19595
+ return get$1(node, id2).value[name];
19591
19596
  };
19592
19597
  }
19593
19598
  function interpolate$1(a2, b) {
@@ -19682,7 +19687,7 @@ function delayConstant(id2, value) {
19682
19687
  }
19683
19688
  function transition_delay(value) {
19684
19689
  var id2 = this._id;
19685
- return arguments.length ? this.each((typeof value == "function" ? delayFunction : delayConstant)(id2, value)) : get(this.node(), id2).delay;
19690
+ return arguments.length ? this.each((typeof value == "function" ? delayFunction : delayConstant)(id2, value)) : get$1(this.node(), id2).delay;
19686
19691
  }
19687
19692
  function durationFunction(id2, value) {
19688
19693
  return function() {
@@ -19696,7 +19701,7 @@ function durationConstant(id2, value) {
19696
19701
  }
19697
19702
  function transition_duration(value) {
19698
19703
  var id2 = this._id;
19699
- return arguments.length ? this.each((typeof value == "function" ? durationFunction : durationConstant)(id2, value)) : get(this.node(), id2).duration;
19704
+ return arguments.length ? this.each((typeof value == "function" ? durationFunction : durationConstant)(id2, value)) : get$1(this.node(), id2).duration;
19700
19705
  }
19701
19706
  function easeConstant(id2, value) {
19702
19707
  if (typeof value != "function") throw new Error();
@@ -19706,7 +19711,7 @@ function easeConstant(id2, value) {
19706
19711
  }
19707
19712
  function transition_ease(value) {
19708
19713
  var id2 = this._id;
19709
- return arguments.length ? this.each(easeConstant(id2, value)) : get(this.node(), id2).ease;
19714
+ return arguments.length ? this.each(easeConstant(id2, value)) : get$1(this.node(), id2).ease;
19710
19715
  }
19711
19716
  function easeVarying(id2, value) {
19712
19717
  return function() {
@@ -19750,7 +19755,7 @@ function onFunction(id2, name, listener) {
19750
19755
  }
19751
19756
  function transition_on(name, listener) {
19752
19757
  var id2 = this._id;
19753
- return arguments.length < 2 ? get(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
19758
+ return arguments.length < 2 ? get$1(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
19754
19759
  }
19755
19760
  function removeFunction(id2) {
19756
19761
  return function() {
@@ -19767,7 +19772,7 @@ function transition_select(select2) {
19767
19772
  typeof select2 != "function" && (select2 = selector$4(select2));
19768
19773
  for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j = 0; j < m2; ++j)
19769
19774
  for (var group = groups[j], n2 = group.length, subgroup = subgroups[j] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2)
19770
- (node = group[i2]) && (subnode = select2.call(node, node.__data__, i2, group)) && ("__data__" in node && (subnode.__data__ = node.__data__), subgroup[i2] = subnode, schedule(subgroup[i2], name, id2, i2, subgroup, get(node, id2)));
19775
+ (node = group[i2]) && (subnode = select2.call(node, node.__data__, i2, group)) && ("__data__" in node && (subnode.__data__ = node.__data__), subgroup[i2] = subnode, schedule(subgroup[i2], name, id2, i2, subgroup, get$1(node, id2)));
19771
19776
  return new Transition(subgroups, this._parents, name, id2);
19772
19777
  }
19773
19778
  function transition_selectAll(select2) {
@@ -19776,7 +19781,7 @@ function transition_selectAll(select2) {
19776
19781
  for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j = 0; j < m2; ++j)
19777
19782
  for (var group = groups[j], n2 = group.length, node, i2 = 0; i2 < n2; ++i2)
19778
19783
  if (node = group[i2]) {
19779
- for (var children2 = select2.call(node, node.__data__, i2, group), child, inherit2 = get(node, id2), k = 0, l = children2.length; k < l; ++k)
19784
+ for (var children2 = select2.call(node, node.__data__, i2, group), child, inherit2 = get$1(node, id2), k = 0, l = children2.length; k < l; ++k)
19780
19785
  (child = children2[k]) && schedule(child, name, id2, k, children2, inherit2);
19781
19786
  subgroups.push(children2), parents.push(node);
19782
19787
  }
@@ -19881,7 +19886,7 @@ function transition_transition() {
19881
19886
  for (var name = this._name, id0 = this._id, id1 = newId(), groups = this._groups, m2 = groups.length, j = 0; j < m2; ++j)
19882
19887
  for (var group = groups[j], n2 = group.length, node, i2 = 0; i2 < n2; ++i2)
19883
19888
  if (node = group[i2]) {
19884
- var inherit2 = get(node, id0);
19889
+ var inherit2 = get$1(node, id0);
19885
19890
  schedule(node, name, id1, i2, group, {
19886
19891
  time: inherit2.time + inherit2.delay + inherit2.duration,
19887
19892
  delay: 0,
@@ -24474,7 +24479,7 @@ function areUrlsEqual(a2, b) {
24474
24479
  function isPropertyEqual(a2, b, state, property) {
24475
24480
  return (property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a2.$$typeof || b.$$typeof) ? !0 : hasOwn(b, property) && state.equals(a2[property], b[property], property, property, a2, b, state);
24476
24481
  }
24477
- var ARGUMENTS_TAG = "[object Arguments]", BOOLEAN_TAG = "[object Boolean]", DATE_TAG = "[object Date]", ERROR_TAG = "[object Error]", MAP_TAG = "[object Map]", NUMBER_TAG = "[object Number]", OBJECT_TAG = "[object Object]", REG_EXP_TAG = "[object RegExp]", SET_TAG = "[object Set]", STRING_TAG = "[object String]", URL_TAG = "[object URL]", isArray$1 = Array.isArray, isTypedArray = typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView : null, assign$1 = Object.assign, getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
24482
+ var ARGUMENTS_TAG = "[object Arguments]", BOOLEAN_TAG = "[object Boolean]", DATE_TAG = "[object Date]", ERROR_TAG = "[object Error]", MAP_TAG = "[object Map]", NUMBER_TAG = "[object Number]", OBJECT_TAG = "[object Object]", REG_EXP_TAG = "[object RegExp]", SET_TAG = "[object Set]", STRING_TAG = "[object String]", URL_TAG = "[object URL]", isArray$2 = Array.isArray, isTypedArray = typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView : null, assign$1 = Object.assign, getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
24478
24483
  function createEqualityComparator(_a) {
24479
24484
  var areArraysEqual2 = _a.areArraysEqual, areDatesEqual2 = _a.areDatesEqual, areErrorsEqual2 = _a.areErrorsEqual, areFunctionsEqual2 = _a.areFunctionsEqual, areMapsEqual2 = _a.areMapsEqual, areNumbersEqual2 = _a.areNumbersEqual, areObjectsEqual2 = _a.areObjectsEqual, arePrimitiveWrappersEqual2 = _a.arePrimitiveWrappersEqual, areRegExpsEqual2 = _a.areRegExpsEqual, areSetsEqual2 = _a.areSetsEqual, areTypedArraysEqual2 = _a.areTypedArraysEqual, areUrlsEqual2 = _a.areUrlsEqual, unknownTagComparators = _a.unknownTagComparators;
24480
24485
  return function(a2, b, state) {
@@ -24492,7 +24497,7 @@ function createEqualityComparator(_a) {
24492
24497
  return !1;
24493
24498
  if (constructor === Object)
24494
24499
  return areObjectsEqual2(a2, b, state);
24495
- if (isArray$1(a2))
24500
+ if (isArray$2(a2))
24496
24501
  return areArraysEqual2(a2, b, state);
24497
24502
  if (isTypedArray != null && isTypedArray(a2))
24498
24503
  return areTypedArraysEqual2(a2, b, state);
@@ -26403,7 +26408,7 @@ class JSAnimation extends WithPromise {
26403
26408
  if (repeat) {
26404
26409
  const progress2 = Math.min(this.currentTime, totalDuration) / resolvedDuration;
26405
26410
  let currentIteration = Math.floor(progress2), iterationProgress = progress2 % 1;
26406
- !iterationProgress && progress2 >= 1 && (iterationProgress = 1), iterationProgress === 1 && currentIteration--, currentIteration = Math.min(currentIteration, repeat + 1), !!(currentIteration % 2) && (repeatType === "reverse" ? (iterationProgress = 1 - iterationProgress, repeatDelay && (iterationProgress -= repeatDelay / resolvedDuration)) : repeatType === "mirror" && (frameGenerator = mirroredGenerator)), elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;
26411
+ !iterationProgress && progress2 >= 1 && (iterationProgress = 1), iterationProgress === 1 && currentIteration--, currentIteration = Math.min(currentIteration, repeat + 1), currentIteration % 2 && (repeatType === "reverse" ? (iterationProgress = 1 - iterationProgress, repeatDelay && (iterationProgress -= repeatDelay / resolvedDuration)) : repeatType === "mirror" && (frameGenerator = mirroredGenerator)), elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;
26407
26412
  }
26408
26413
  const state = isInDelayPhase ? { done: !1, value: keyframes2[0] } : frameGenerator.next(elapsed);
26409
26414
  mixKeyframes && (state.value = mixKeyframes(state.value));
@@ -27902,11 +27907,47 @@ function useCreateMotionContext(props2) {
27902
27907
  function variantLabelsAsDependency(prop) {
27903
27908
  return Array.isArray(prop) ? prop.join(" ") : prop;
27904
27909
  }
27905
- const scaleCorrectors = {};
27906
- function addScaleCorrector(correctors) {
27907
- for (const key in correctors)
27908
- scaleCorrectors[key] = correctors[key], isCSSVariableName(key) && (scaleCorrectors[key].isCSSVariable = !0);
27910
+ function pixelsToPercent(pixels, axis) {
27911
+ return axis.max === axis.min ? 0 : pixels / (axis.max - axis.min) * 100;
27909
27912
  }
27913
+ const correctBorderRadius = {
27914
+ correct: (latest2, node) => {
27915
+ if (!node.target)
27916
+ return latest2;
27917
+ if (typeof latest2 == "string")
27918
+ if (px$1.test(latest2))
27919
+ latest2 = parseFloat(latest2);
27920
+ else
27921
+ return latest2;
27922
+ const x2 = pixelsToPercent(latest2, node.target.x), y2 = pixelsToPercent(latest2, node.target.y);
27923
+ return `${x2}% ${y2}%`;
27924
+ }
27925
+ }, correctBoxShadow = {
27926
+ correct: (latest2, { treeScale, projectionDelta }) => {
27927
+ const original = latest2, shadow = complex.parse(latest2);
27928
+ if (shadow.length > 5)
27929
+ return original;
27930
+ const template = complex.createTransformer(latest2), offset2 = typeof shadow[0] != "number" ? 1 : 0, xScale = projectionDelta.x.scale * treeScale.x, yScale = projectionDelta.y.scale * treeScale.y;
27931
+ shadow[0 + offset2] /= xScale, shadow[1 + offset2] /= yScale;
27932
+ const averageScale = mixNumber$1(xScale, yScale, 0.5);
27933
+ return typeof shadow[2 + offset2] == "number" && (shadow[2 + offset2] /= averageScale), typeof shadow[3 + offset2] == "number" && (shadow[3 + offset2] /= averageScale), template(shadow);
27934
+ }
27935
+ }, scaleCorrectors = {
27936
+ borderRadius: {
27937
+ ...correctBorderRadius,
27938
+ applyTo: [
27939
+ "borderTopLeftRadius",
27940
+ "borderTopRightRadius",
27941
+ "borderBottomLeftRadius",
27942
+ "borderBottomRightRadius"
27943
+ ]
27944
+ },
27945
+ borderTopLeftRadius: correctBorderRadius,
27946
+ borderTopRightRadius: correctBorderRadius,
27947
+ borderBottomLeftRadius: correctBorderRadius,
27948
+ borderBottomRightRadius: correctBorderRadius,
27949
+ boxShadow: correctBoxShadow
27950
+ };
27910
27951
  function isForcedMotionValue(key, { layout: layout2, layoutId }) {
27911
27952
  return transformProps.has(key) || key.startsWith("origin") || (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key] || key === "opacity");
27912
27953
  }
@@ -28167,7 +28208,7 @@ function scrapeMotionValuesFromProps(props2, prevProps, visualElement) {
28167
28208
  const useSVGVisualState = /* @__PURE__ */ makeUseVisualState({
28168
28209
  scrapeMotionValuesFromProps,
28169
28210
  createRenderState: createSvgRenderState
28170
- }), motionComponentSymbol = Symbol.for("motionComponentSymbol");
28211
+ }), motionComponentSymbol = /* @__PURE__ */ Symbol.for("motionComponentSymbol");
28171
28212
  function isRefObject(ref) {
28172
28213
  return ref && typeof ref == "object" && Object.prototype.hasOwnProperty.call(ref, "current");
28173
28214
  }
@@ -29585,32 +29626,6 @@ const globalProjectionState = {
29585
29626
  */
29586
29627
  hasEverUpdated: !1
29587
29628
  };
29588
- function pixelsToPercent(pixels, axis) {
29589
- return axis.max === axis.min ? 0 : pixels / (axis.max - axis.min) * 100;
29590
- }
29591
- const correctBorderRadius = {
29592
- correct: (latest2, node) => {
29593
- if (!node.target)
29594
- return latest2;
29595
- if (typeof latest2 == "string")
29596
- if (px$1.test(latest2))
29597
- latest2 = parseFloat(latest2);
29598
- else
29599
- return latest2;
29600
- const x2 = pixelsToPercent(latest2, node.target.x), y2 = pixelsToPercent(latest2, node.target.y);
29601
- return `${x2}% ${y2}%`;
29602
- }
29603
- }, correctBoxShadow = {
29604
- correct: (latest2, { treeScale, projectionDelta }) => {
29605
- const original = latest2, shadow = complex.parse(latest2);
29606
- if (shadow.length > 5)
29607
- return original;
29608
- const template = complex.createTransformer(latest2), offset2 = typeof shadow[0] != "number" ? 1 : 0, xScale = projectionDelta.x.scale * treeScale.x, yScale = projectionDelta.y.scale * treeScale.y;
29609
- shadow[0 + offset2] /= xScale, shadow[1 + offset2] /= yScale;
29610
- const averageScale = mixNumber$1(xScale, yScale, 0.5);
29611
- return typeof shadow[2 + offset2] == "number" && (shadow[2 + offset2] /= averageScale), typeof shadow[3 + offset2] == "number" && (shadow[3 + offset2] /= averageScale), template(shadow);
29612
- }
29613
- };
29614
29629
  let hasTakenAnySnapshot = !1;
29615
29630
  class MeasureLayoutWithContext extends Component {
29616
29631
  /**
@@ -29620,7 +29635,7 @@ class MeasureLayoutWithContext extends Component {
29620
29635
  */
29621
29636
  componentDidMount() {
29622
29637
  const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props, { projection } = visualElement;
29623
- addScaleCorrector(defaultScaleCorrectors), projection && (layoutGroup.group && layoutGroup.group.add(projection), switchLayoutGroup && switchLayoutGroup.register && layoutId && switchLayoutGroup.register(projection), hasTakenAnySnapshot && projection.root.didUpdate(), projection.addEventListener("animationComplete", () => {
29638
+ projection && (layoutGroup.group && layoutGroup.group.add(projection), switchLayoutGroup && switchLayoutGroup.register && layoutId && switchLayoutGroup.register(projection), hasTakenAnySnapshot && projection.root.didUpdate(), projection.addEventListener("animationComplete", () => {
29624
29639
  this.safeToRemove();
29625
29640
  }), projection.setOptions({
29626
29641
  ...projection.options,
@@ -29656,22 +29671,6 @@ function MeasureLayout(props2) {
29656
29671
  const [isPresent, safeToRemove] = usePresence(), layoutGroup = useContext(LayoutGroupContext);
29657
29672
  return jsx(MeasureLayoutWithContext, { ...props2, layoutGroup, switchLayoutGroup: useContext(SwitchLayoutGroupContext), isPresent, safeToRemove });
29658
29673
  }
29659
- const defaultScaleCorrectors = {
29660
- borderRadius: {
29661
- ...correctBorderRadius,
29662
- applyTo: [
29663
- "borderTopLeftRadius",
29664
- "borderTopRightRadius",
29665
- "borderBottomLeftRadius",
29666
- "borderBottomRightRadius"
29667
- ]
29668
- },
29669
- borderTopLeftRadius: correctBorderRadius,
29670
- borderTopRightRadius: correctBorderRadius,
29671
- borderBottomLeftRadius: correctBorderRadius,
29672
- borderBottomRightRadius: correctBorderRadius,
29673
- boxShadow: correctBoxShadow
29674
- };
29675
29674
  function animateSingleValue(value, keyframes2, options) {
29676
29675
  const motionValue$1 = isMotionValue(value) ? value : motionValue(value);
29677
29676
  return motionValue$1.start(animateMotionValue("", motionValue$1, keyframes2, options)), motionValue$1.animation;
@@ -31075,7 +31074,7 @@ function matchesState(parentStateId, childStateId) {
31075
31074
  return typeof childStateValue == "string" ? typeof parentStateValue == "string" ? childStateValue === parentStateValue : !1 : typeof parentStateValue == "string" ? parentStateValue in childStateValue : Object.keys(parentStateValue).every((key) => key in childStateValue ? matchesState(parentStateValue[key], childStateValue[key]) : !1);
31076
31075
  }
31077
31076
  function toStatePath(stateId) {
31078
- if (isArray(stateId))
31077
+ if (isArray$1(stateId))
31079
31078
  return stateId;
31080
31079
  const result = [];
31081
31080
  let segment = "";
@@ -31125,7 +31124,7 @@ function mapValues(collection, iteratee) {
31125
31124
  return result;
31126
31125
  }
31127
31126
  function toArrayStrict(value) {
31128
- return isArray(value) ? value : [value];
31127
+ return isArray$1(value) ? value : [value];
31129
31128
  }
31130
31129
  function toArray$1(value) {
31131
31130
  return value === void 0 ? [] : toArrayStrict(value);
@@ -31137,7 +31136,7 @@ function resolveOutput(mapper, context, event, self2) {
31137
31136
  self: self2
31138
31137
  }) : mapper;
31139
31138
  }
31140
- function isArray(value) {
31139
+ function isArray$1(value) {
31141
31140
  return Array.isArray(value);
31142
31141
  }
31143
31142
  function isErrorActorEvent(event) {
@@ -36137,132 +36136,123 @@ const curveCatmullRomOpen = (function custom4(alpha2) {
36137
36136
  return custom4(+alpha3);
36138
36137
  }, catmullRom;
36139
36138
  })(0.5);
36140
- var NOTHING = Symbol.for("immer-nothing"), DRAFTABLE = Symbol.for("immer-draftable"), DRAFT_STATE = Symbol.for("immer-state");
36139
+ var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing"), DRAFTABLE = /* @__PURE__ */ Symbol.for("immer-draftable"), DRAFT_STATE = /* @__PURE__ */ Symbol.for("immer-state");
36141
36140
  function die(error, ...args) {
36142
36141
  throw new Error(
36143
36142
  `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
36144
36143
  );
36145
36144
  }
36146
- var getPrototypeOf = Object.getPrototypeOf;
36147
- function isDraft(value) {
36148
- return !!value && !!value[DRAFT_STATE];
36149
- }
36145
+ var O = Object, getPrototypeOf = O.getPrototypeOf, CONSTRUCTOR = "constructor", PROTOTYPE = "prototype", CONFIGURABLE = "configurable", ENUMERABLE = "enumerable", WRITABLE = "writable", VALUE = "value", isDraft = (value) => !!value && !!value[DRAFT_STATE];
36150
36146
  function isDraftable(value) {
36151
- return value ? isPlainObject$1(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value) : !1;
36147
+ return value ? isPlainObject$1(value) || isArray(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value) : !1;
36152
36148
  }
36153
- var objectCtorString = Object.prototype.constructor.toString(), cachedCtorStrings = /* @__PURE__ */ new WeakMap();
36149
+ var objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString(), cachedCtorStrings = /* @__PURE__ */ new WeakMap();
36154
36150
  function isPlainObject$1(value) {
36155
- if (!value || typeof value != "object")
36151
+ if (!value || !isObjectish(value))
36156
36152
  return !1;
36157
- const proto = Object.getPrototypeOf(value);
36158
- if (proto === null || proto === Object.prototype)
36153
+ const proto = getPrototypeOf(value);
36154
+ if (proto === null || proto === O[PROTOTYPE])
36159
36155
  return !0;
36160
- const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
36156
+ const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
36161
36157
  if (Ctor === Object)
36162
36158
  return !0;
36163
- if (typeof Ctor != "function")
36159
+ if (!isFunction(Ctor))
36164
36160
  return !1;
36165
36161
  let ctorString = cachedCtorStrings.get(Ctor);
36166
36162
  return ctorString === void 0 && (ctorString = Function.toString.call(Ctor), cachedCtorStrings.set(Ctor, ctorString)), ctorString === objectCtorString;
36167
36163
  }
36168
36164
  function each(obj, iter, strict = !0) {
36169
- getArchtype(obj) === 0 ? (strict ? Reflect.ownKeys(obj) : Object.keys(obj)).forEach((key) => {
36165
+ getArchtype(obj) === 0 ? (strict ? Reflect.ownKeys(obj) : O.keys(obj)).forEach((key) => {
36170
36166
  iter(key, obj[key], obj);
36171
36167
  }) : obj.forEach((entry, index2) => iter(index2, entry, obj));
36172
36168
  }
36173
36169
  function getArchtype(thing) {
36174
36170
  const state = thing[DRAFT_STATE];
36175
- return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
36176
- }
36177
- function has(thing, prop) {
36178
- return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
36179
- }
36180
- function set(thing, propOrOldValue, value) {
36181
- const t2 = getArchtype(thing);
36182
- t2 === 2 ? thing.set(propOrOldValue, value) : t2 === 3 ? thing.add(value) : thing[propOrOldValue] = value;
36171
+ return state ? state.type_ : isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
36183
36172
  }
36173
+ var has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop), get = (thing, prop, type = getArchtype(thing)) => (
36174
+ // @ts-ignore
36175
+ type === 2 ? thing.get(prop) : thing[prop]
36176
+ ), set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
36177
+ type === 2 ? thing.set(propOrOldValue, value) : type === 3 ? thing.add(value) : thing[propOrOldValue] = value;
36178
+ };
36184
36179
  function is(x2, y2) {
36185
36180
  return x2 === y2 ? x2 !== 0 || 1 / x2 === 1 / y2 : x2 !== x2 && y2 !== y2;
36186
36181
  }
36187
- function isMap(target) {
36188
- return target instanceof Map;
36189
- }
36190
- function isSet(target) {
36191
- return target instanceof Set;
36192
- }
36193
- function latest(state) {
36194
- return state.copy_ || state.base_;
36195
- }
36182
+ var isArray = Array.isArray, isMap = (target) => target instanceof Map, isSet = (target) => target instanceof Set, isObjectish = (target) => typeof target == "object", isFunction = (target) => typeof target == "function", isBoolean = (target) => typeof target == "boolean", latest = (state) => state.copy_ || state.base_, getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;
36196
36183
  function shallowCopy(base, strict) {
36197
36184
  if (isMap(base))
36198
36185
  return new Map(base);
36199
36186
  if (isSet(base))
36200
36187
  return new Set(base);
36201
- if (Array.isArray(base))
36202
- return Array.prototype.slice.call(base);
36188
+ if (isArray(base))
36189
+ return Array[PROTOTYPE].slice.call(base);
36203
36190
  const isPlain = isPlainObject$1(base);
36204
36191
  if (strict === !0 || strict === "class_only" && !isPlain) {
36205
- const descriptors = Object.getOwnPropertyDescriptors(base);
36192
+ const descriptors = O.getOwnPropertyDescriptors(base);
36206
36193
  delete descriptors[DRAFT_STATE];
36207
36194
  let keys2 = Reflect.ownKeys(descriptors);
36208
36195
  for (let i2 = 0; i2 < keys2.length; i2++) {
36209
36196
  const key = keys2[i2], desc = descriptors[key];
36210
- desc.writable === !1 && (desc.writable = !0, desc.configurable = !0), (desc.get || desc.set) && (descriptors[key] = {
36211
- configurable: !0,
36212
- writable: !0,
36197
+ desc[WRITABLE] === !1 && (desc[WRITABLE] = !0, desc[CONFIGURABLE] = !0), (desc.get || desc.set) && (descriptors[key] = {
36198
+ [CONFIGURABLE]: !0,
36199
+ [WRITABLE]: !0,
36213
36200
  // could live with !!desc.set as well here...
36214
- enumerable: desc.enumerable,
36215
- value: base[key]
36201
+ [ENUMERABLE]: desc[ENUMERABLE],
36202
+ [VALUE]: base[key]
36216
36203
  });
36217
36204
  }
36218
- return Object.create(getPrototypeOf(base), descriptors);
36205
+ return O.create(getPrototypeOf(base), descriptors);
36219
36206
  } else {
36220
36207
  const proto = getPrototypeOf(base);
36221
36208
  if (proto !== null && isPlain)
36222
36209
  return { ...base };
36223
- const obj = Object.create(proto);
36224
- return Object.assign(obj, base);
36210
+ const obj = O.create(proto);
36211
+ return O.assign(obj, base);
36225
36212
  }
36226
36213
  }
36227
36214
  function freeze(obj, deep = !1) {
36228
- return isFrozen(obj) || isDraft(obj) || !isDraftable(obj) || (getArchtype(obj) > 1 && Object.defineProperties(obj, {
36215
+ return isFrozen(obj) || isDraft(obj) || !isDraftable(obj) || (getArchtype(obj) > 1 && O.defineProperties(obj, {
36229
36216
  set: dontMutateMethodOverride,
36230
36217
  add: dontMutateMethodOverride,
36231
36218
  clear: dontMutateMethodOverride,
36232
36219
  delete: dontMutateMethodOverride
36233
- }), Object.freeze(obj), deep && Object.values(obj).forEach((value) => freeze(value, !0))), obj;
36220
+ }), O.freeze(obj), deep && each(
36221
+ obj,
36222
+ (_key, value) => {
36223
+ freeze(value, !0);
36224
+ },
36225
+ !1
36226
+ )), obj;
36234
36227
  }
36235
36228
  function dontMutateFrozenCollections() {
36236
36229
  die(2);
36237
36230
  }
36238
36231
  var dontMutateMethodOverride = {
36239
- value: dontMutateFrozenCollections
36232
+ [VALUE]: dontMutateFrozenCollections
36240
36233
  };
36241
36234
  function isFrozen(obj) {
36242
- return obj === null || typeof obj != "object" ? !0 : Object.isFrozen(obj);
36235
+ return obj === null || !isObjectish(obj) ? !0 : O.isFrozen(obj);
36243
36236
  }
36244
- var plugins = {};
36237
+ var PluginMapSet = "MapSet", PluginPatches = "Patches", plugins = {};
36245
36238
  function getPlugin(pluginKey) {
36246
36239
  const plugin = plugins[pluginKey];
36247
36240
  return plugin || die(0, pluginKey), plugin;
36248
36241
  }
36249
- var currentScope;
36250
- function getCurrentScope() {
36251
- return currentScope;
36252
- }
36253
- function createScope(parent_, immer_) {
36254
- return {
36255
- drafts_: [],
36256
- parent_,
36257
- immer_,
36258
- // Whenever the modified draft contains a draft from another scope, we
36259
- // need to prevent auto-freezing so the unowned draft can be finalized.
36260
- canAutoFreeze_: !0,
36261
- unfinalizedDrafts_: 0
36262
- };
36263
- }
36242
+ var isPluginLoaded = (pluginKey) => !!plugins[pluginKey], currentScope, getCurrentScope = () => currentScope, createScope = (parent_, immer_) => ({
36243
+ drafts_: [],
36244
+ parent_,
36245
+ immer_,
36246
+ // Whenever the modified draft contains a draft from another scope, we
36247
+ // need to prevent auto-freezing so the unowned draft can be finalized.
36248
+ canAutoFreeze_: !0,
36249
+ unfinalizedDrafts_: 0,
36250
+ handledSet_: /* @__PURE__ */ new Set(),
36251
+ processedForPatches_: /* @__PURE__ */ new Set(),
36252
+ mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0
36253
+ });
36264
36254
  function usePatchesInScope(scope, patchListener) {
36265
- patchListener && (getPlugin("Patches"), scope.patches_ = [], scope.inversePatches_ = [], scope.patchListener_ = patchListener);
36255
+ patchListener && (scope.patchPlugin_ = getPlugin(PluginPatches), scope.patches_ = [], scope.inversePatches_ = [], scope.patchListener_ = patchListener);
36266
36256
  }
36267
36257
  function revokeScope(scope) {
36268
36258
  leaveScope(scope), scope.drafts_.forEach(revokeDraft), scope.drafts_ = null;
@@ -36270,9 +36260,7 @@ function revokeScope(scope) {
36270
36260
  function leaveScope(scope) {
36271
36261
  scope === currentScope && (currentScope = scope.parent_);
36272
36262
  }
36273
- function enterScope(immer2) {
36274
- return currentScope = createScope(currentScope, immer2);
36275
- }
36263
+ var enterScope = (immer2) => currentScope = createScope(currentScope, immer2);
36276
36264
  function revokeDraft(draft) {
36277
36265
  const state = draft[DRAFT_STATE];
36278
36266
  state.type_ === 0 || state.type_ === 1 ? state.revoke_() : state.revoked_ = !0;
@@ -36280,78 +36268,115 @@ function revokeDraft(draft) {
36280
36268
  function processResult(result, scope) {
36281
36269
  scope.unfinalizedDrafts_ = scope.drafts_.length;
36282
36270
  const baseDraft = scope.drafts_[0];
36283
- return result !== void 0 && result !== baseDraft ? (baseDraft[DRAFT_STATE].modified_ && (revokeScope(scope), die(4)), isDraftable(result) && (result = finalize(scope, result), scope.parent_ || maybeFreeze(scope, result)), scope.patches_ && getPlugin("Patches").generateReplacementPatches_(
36284
- baseDraft[DRAFT_STATE].base_,
36285
- result,
36286
- scope.patches_,
36287
- scope.inversePatches_
36288
- )) : result = finalize(scope, baseDraft, []), revokeScope(scope), scope.patches_ && scope.patchListener_(scope.patches_, scope.inversePatches_), result !== NOTHING ? result : void 0;
36289
- }
36290
- function finalize(rootScope, value, path) {
36271
+ if (result !== void 0 && result !== baseDraft) {
36272
+ baseDraft[DRAFT_STATE].modified_ && (revokeScope(scope), die(4)), isDraftable(result) && (result = finalize(scope, result));
36273
+ const { patchPlugin_ } = scope;
36274
+ patchPlugin_ && patchPlugin_.generateReplacementPatches_(
36275
+ baseDraft[DRAFT_STATE].base_,
36276
+ result,
36277
+ scope
36278
+ );
36279
+ } else
36280
+ result = finalize(scope, baseDraft);
36281
+ return maybeFreeze(scope, result, !0), revokeScope(scope), scope.patches_ && scope.patchListener_(scope.patches_, scope.inversePatches_), result !== NOTHING ? result : void 0;
36282
+ }
36283
+ function finalize(rootScope, value) {
36291
36284
  if (isFrozen(value))
36292
36285
  return value;
36293
- const useStrictIteration = rootScope.immer_.shouldUseStrictIteration(), state = value[DRAFT_STATE];
36286
+ const state = value[DRAFT_STATE];
36294
36287
  if (!state)
36295
- return each(
36296
- value,
36297
- (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path),
36298
- useStrictIteration
36299
- ), value;
36300
- if (state.scope_ !== rootScope)
36288
+ return handleValue(value, rootScope.handledSet_, rootScope);
36289
+ if (!isSameScope(state, rootScope))
36301
36290
  return value;
36302
36291
  if (!state.modified_)
36303
- return maybeFreeze(rootScope, state.base_, !0), state.base_;
36292
+ return state.base_;
36304
36293
  if (!state.finalized_) {
36305
- state.finalized_ = !0, state.scope_.unfinalizedDrafts_--;
36306
- const result = state.copy_;
36307
- let resultEach = result, isSet2 = !1;
36308
- state.type_ === 3 && (resultEach = new Set(result), result.clear(), isSet2 = !0), each(
36309
- resultEach,
36310
- (key, childValue) => finalizeProperty(
36311
- rootScope,
36312
- state,
36313
- result,
36314
- key,
36315
- childValue,
36316
- path,
36317
- isSet2
36318
- ),
36319
- useStrictIteration
36320
- ), maybeFreeze(rootScope, result, !1), path && rootScope.patches_ && getPlugin("Patches").generatePatches_(
36321
- state,
36322
- path,
36323
- rootScope.patches_,
36324
- rootScope.inversePatches_
36325
- );
36294
+ const { callbacks_ } = state;
36295
+ if (callbacks_)
36296
+ for (; callbacks_.length > 0; )
36297
+ callbacks_.pop()(rootScope);
36298
+ generatePatchesAndFinalize(state, rootScope);
36326
36299
  }
36327
36300
  return state.copy_;
36328
36301
  }
36329
- function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
36330
- if (childValue == null || typeof childValue != "object" && !targetIsSet)
36302
+ function maybeFreeze(scope, value, deep = !1) {
36303
+ !scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_ && freeze(value, deep);
36304
+ }
36305
+ function markStateFinalized(state) {
36306
+ state.finalized_ = !0, state.scope_.unfinalizedDrafts_--;
36307
+ }
36308
+ var isSameScope = (state, rootScope) => state.scope_ === rootScope, EMPTY_LOCATIONS_RESULT = [];
36309
+ function updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {
36310
+ const parentCopy = latest(parent), parentType = parent.type_;
36311
+ if (originalKey !== void 0 && get(parentCopy, originalKey, parentType) === draftValue) {
36312
+ set(parentCopy, originalKey, finalizedValue, parentType);
36331
36313
  return;
36332
- const childIsFrozen = isFrozen(childValue);
36333
- if (!(childIsFrozen && !targetIsSet)) {
36334
- if (isDraft(childValue)) {
36335
- const path = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
36336
- !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0, res = finalize(rootScope, childValue, path);
36337
- if (set(targetObject, prop, res), isDraft(res))
36338
- rootScope.canAutoFreeze_ = !1;
36339
- else
36340
- return;
36341
- } else targetIsSet && targetObject.add(childValue);
36342
- if (isDraftable(childValue) && !childIsFrozen) {
36343
- if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1 || parentState && parentState.base_ && parentState.base_[prop] === childValue && childIsFrozen)
36344
- return;
36345
- finalize(rootScope, childValue), (!parentState || !parentState.scope_.parent_) && typeof prop != "symbol" && (isMap(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop)) && maybeFreeze(rootScope, childValue);
36314
+ }
36315
+ if (!parent.draftLocations_) {
36316
+ const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();
36317
+ each(parentCopy, (key, value) => {
36318
+ if (isDraft(value)) {
36319
+ const keys2 = draftLocations.get(value) || [];
36320
+ keys2.push(key), draftLocations.set(value, keys2);
36321
+ }
36322
+ });
36323
+ }
36324
+ const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;
36325
+ for (const location of locations)
36326
+ set(parentCopy, location, finalizedValue, parentType);
36327
+ }
36328
+ function registerChildFinalizationCallback(parent, child, key) {
36329
+ parent.callbacks_.push(function(rootScope) {
36330
+ const state = child;
36331
+ if (!state || !isSameScope(state, rootScope))
36332
+ return;
36333
+ rootScope.mapSetPlugin_?.fixSetContents(state);
36334
+ const finalizedValue = getFinalValue(state);
36335
+ updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key), generatePatchesAndFinalize(state, rootScope);
36336
+ });
36337
+ }
36338
+ function generatePatchesAndFinalize(state, rootScope) {
36339
+ if (state.modified_ && !state.finalized_ && (state.type_ === 3 || (state.assigned_?.size ?? 0) > 0)) {
36340
+ const { patchPlugin_ } = rootScope;
36341
+ if (patchPlugin_) {
36342
+ const basePath = patchPlugin_.getPath(state);
36343
+ basePath && patchPlugin_.generatePatches_(state, basePath, rootScope);
36346
36344
  }
36345
+ markStateFinalized(state);
36347
36346
  }
36348
36347
  }
36349
- function maybeFreeze(scope, value, deep = !1) {
36350
- !scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_ && freeze(value, deep);
36348
+ function handleCrossReference(target, key, value) {
36349
+ const { scope_ } = target;
36350
+ if (isDraft(value)) {
36351
+ const state = value[DRAFT_STATE];
36352
+ isSameScope(state, scope_) && state.callbacks_.push(function() {
36353
+ prepareCopy(target);
36354
+ const finalizedValue = getFinalValue(state);
36355
+ updateDraftInParent(target, value, finalizedValue, key);
36356
+ });
36357
+ } else isDraftable(value) && target.callbacks_.push(function() {
36358
+ const targetCopy = latest(target);
36359
+ get(targetCopy, key, target.type_) === value && scope_.drafts_.length > 1 && (target.assigned_.get(key) ?? !1) === !0 && target.copy_ && handleValue(
36360
+ get(target.copy_, key, target.type_),
36361
+ scope_.handledSet_,
36362
+ scope_
36363
+ );
36364
+ });
36365
+ }
36366
+ function handleValue(target, handledSet, rootScope) {
36367
+ return !rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1 || isDraft(target) || handledSet.has(target) || !isDraftable(target) || isFrozen(target) || (handledSet.add(target), each(target, (key, value) => {
36368
+ if (isDraft(value)) {
36369
+ const state = value[DRAFT_STATE];
36370
+ if (isSameScope(state, rootScope)) {
36371
+ const updatedValue = getFinalValue(state);
36372
+ set(target, key, updatedValue, target.type_), markStateFinalized(state);
36373
+ }
36374
+ } else isDraftable(value) && handleValue(value, handledSet, rootScope);
36375
+ })), target;
36351
36376
  }
36352
36377
  function createProxyProxy(base, parent) {
36353
- const isArray2 = Array.isArray(base), state = {
36354
- type_: isArray2 ? 1 : 0,
36378
+ const baseIsArray = isArray(base), state = {
36379
+ type_: baseIsArray ? 1 : 0,
36355
36380
  // Track which produce call this is associated with.
36356
36381
  scope_: parent ? parent.scope_ : getCurrentScope(),
36357
36382
  // True for both shallow and deep changes.
@@ -36359,7 +36384,8 @@ function createProxyProxy(base, parent) {
36359
36384
  // Used during finalization.
36360
36385
  finalized_: !1,
36361
36386
  // Track which properties have been assigned (true) or deleted (false).
36362
- assigned_: {},
36387
+ // actually instantiated in `prepareCopy()`
36388
+ assigned_: void 0,
36363
36389
  // The parent draft state.
36364
36390
  parent_: parent,
36365
36391
  // The base state.
@@ -36371,22 +36397,31 @@ function createProxyProxy(base, parent) {
36371
36397
  copy_: null,
36372
36398
  // Called by the `produce` function.
36373
36399
  revoke_: null,
36374
- isManual_: !1
36400
+ isManual_: !1,
36401
+ // `callbacks` actually gets assigned in `createProxy`
36402
+ callbacks_: void 0
36375
36403
  };
36376
36404
  let target = state, traps = objectTraps;
36377
- isArray2 && (target = [state], traps = arrayTraps);
36405
+ baseIsArray && (target = [state], traps = arrayTraps);
36378
36406
  const { revoke, proxy } = Proxy.revocable(target, traps);
36379
- return state.draft_ = proxy, state.revoke_ = revoke, proxy;
36407
+ return state.draft_ = proxy, state.revoke_ = revoke, [proxy, state];
36380
36408
  }
36381
36409
  var objectTraps = {
36382
36410
  get(state, prop) {
36383
36411
  if (prop === DRAFT_STATE)
36384
36412
  return state;
36385
36413
  const source = latest(state);
36386
- if (!has(source, prop))
36414
+ if (!has(source, prop, state.type_))
36387
36415
  return readPropFromProto(state, source, prop);
36388
36416
  const value = source[prop];
36389
- return state.finalized_ || !isDraftable(value) ? value : value === peek(state.base_, prop) ? (prepareCopy(state), state.copy_[prop] = createProxy(value, state)) : value;
36417
+ if (state.finalized_ || !isDraftable(value))
36418
+ return value;
36419
+ if (value === peek(state.base_, prop)) {
36420
+ prepareCopy(state);
36421
+ const childKey = state.type_ === 1 ? +prop : prop, childDraft = createProxy(state.scope_, value, state, childKey);
36422
+ return state.copy_[childKey] = childDraft;
36423
+ }
36424
+ return value;
36390
36425
  },
36391
36426
  has(state, prop) {
36392
36427
  return prop in latest(state);
@@ -36401,27 +36436,27 @@ var objectTraps = {
36401
36436
  if (!state.modified_) {
36402
36437
  const current2 = peek(latest(state), prop), currentState = current2?.[DRAFT_STATE];
36403
36438
  if (currentState && currentState.base_ === value)
36404
- return state.copy_[prop] = value, state.assigned_[prop] = !1, !0;
36405
- if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))
36439
+ return state.copy_[prop] = value, state.assigned_.set(prop, !1), !0;
36440
+ if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_)))
36406
36441
  return !0;
36407
36442
  prepareCopy(state), markChanged(state);
36408
36443
  }
36409
36444
  return state.copy_[prop] === value && // special case: handle new props with value 'undefined'
36410
36445
  (value !== void 0 || prop in state.copy_) || // special case: NaN
36411
- Number.isNaN(value) && Number.isNaN(state.copy_[prop]) || (state.copy_[prop] = value, state.assigned_[prop] = !0), !0;
36446
+ Number.isNaN(value) && Number.isNaN(state.copy_[prop]) || (state.copy_[prop] = value, state.assigned_.set(prop, !0), handleCrossReference(state, prop, value)), !0;
36412
36447
  },
36413
36448
  deleteProperty(state, prop) {
36414
- return peek(state.base_, prop) !== void 0 || prop in state.base_ ? (state.assigned_[prop] = !1, prepareCopy(state), markChanged(state)) : delete state.assigned_[prop], state.copy_ && delete state.copy_[prop], !0;
36449
+ return prepareCopy(state), peek(state.base_, prop) !== void 0 || prop in state.base_ ? (state.assigned_.set(prop, !1), markChanged(state)) : state.assigned_.delete(prop), state.copy_ && delete state.copy_[prop], !0;
36415
36450
  },
36416
36451
  // Note: We never coerce `desc.value` into an Immer draft, because we can't make
36417
36452
  // the same guarantee in ES5 mode.
36418
36453
  getOwnPropertyDescriptor(state, prop) {
36419
36454
  const owner = latest(state), desc = Reflect.getOwnPropertyDescriptor(owner, prop);
36420
36455
  return desc && {
36421
- writable: !0,
36422
- configurable: state.type_ !== 1 || prop !== "length",
36423
- enumerable: desc.enumerable,
36424
- value: owner[prop]
36456
+ [WRITABLE]: !0,
36457
+ [CONFIGURABLE]: state.type_ !== 1 || prop !== "length",
36458
+ [ENUMERABLE]: desc[ENUMERABLE],
36459
+ [VALUE]: owner[prop]
36425
36460
  };
36426
36461
  },
36427
36462
  defineProperty() {
@@ -36436,7 +36471,8 @@ var objectTraps = {
36436
36471
  }, arrayTraps = {};
36437
36472
  each(objectTraps, (key, fn) => {
36438
36473
  arrayTraps[key] = function() {
36439
- return arguments[0] = arguments[0][0], fn.apply(this, arguments);
36474
+ const args = arguments;
36475
+ return args[0] = args[0][0], fn.apply(this, args);
36440
36476
  };
36441
36477
  });
36442
36478
  arrayTraps.deleteProperty = function(state, prop) {
@@ -36451,7 +36487,7 @@ function peek(draft, prop) {
36451
36487
  }
36452
36488
  function readPropFromProto(state, source, prop) {
36453
36489
  const desc = getDescriptorFromProto(source, prop);
36454
- return desc ? "value" in desc ? desc.value : (
36490
+ return desc ? VALUE in desc ? desc[VALUE] : (
36455
36491
  // This is a very special case, if the prop is a getter defined by the
36456
36492
  // prototype, we should invoke it with the draft as context!
36457
36493
  desc.get?.call(state.draft_)
@@ -36472,15 +36508,15 @@ function markChanged(state) {
36472
36508
  state.modified_ || (state.modified_ = !0, state.parent_ && markChanged(state.parent_));
36473
36509
  }
36474
36510
  function prepareCopy(state) {
36475
- state.copy_ || (state.copy_ = shallowCopy(
36511
+ state.copy_ || (state.assigned_ = /* @__PURE__ */ new Map(), state.copy_ = shallowCopy(
36476
36512
  state.base_,
36477
36513
  state.scope_.immer_.useStrictShallowCopy_
36478
36514
  ));
36479
36515
  }
36480
36516
  var Immer2 = class {
36481
36517
  constructor(config2) {
36482
- this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !0, this.produce = (base, recipe, patchListener) => {
36483
- if (typeof base == "function" && typeof recipe != "function") {
36518
+ this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1, this.produce = (base, recipe, patchListener) => {
36519
+ if (isFunction(base) && !isFunction(recipe)) {
36484
36520
  const defaultBase = recipe;
36485
36521
  recipe = base;
36486
36522
  const self2 = this;
@@ -36488,10 +36524,10 @@ var Immer2 = class {
36488
36524
  return self2.produce(base2, (draft) => recipe.call(this, draft, ...args));
36489
36525
  };
36490
36526
  }
36491
- typeof recipe != "function" && die(6), patchListener !== void 0 && typeof patchListener != "function" && die(7);
36527
+ isFunction(recipe) || die(6), patchListener !== void 0 && !isFunction(patchListener) && die(7);
36492
36528
  let result;
36493
36529
  if (isDraftable(base)) {
36494
- const scope = enterScope(this), proxy = createProxy(base, void 0);
36530
+ const scope = enterScope(this), proxy = createProxy(scope, base, void 0);
36495
36531
  let hasError = !0;
36496
36532
  try {
36497
36533
  result = recipe(proxy), hasError = !1;
@@ -36499,26 +36535,29 @@ var Immer2 = class {
36499
36535
  hasError ? revokeScope(scope) : leaveScope(scope);
36500
36536
  }
36501
36537
  return usePatchesInScope(scope, patchListener), processResult(result, scope);
36502
- } else if (!base || typeof base != "object") {
36538
+ } else if (!base || !isObjectish(base)) {
36503
36539
  if (result = recipe(base), result === void 0 && (result = base), result === NOTHING && (result = void 0), this.autoFreeze_ && freeze(result, !0), patchListener) {
36504
36540
  const p = [], ip = [];
36505
- getPlugin("Patches").generateReplacementPatches_(base, result, p, ip), patchListener(p, ip);
36541
+ getPlugin(PluginPatches).generateReplacementPatches_(base, result, {
36542
+ patches_: p,
36543
+ inversePatches_: ip
36544
+ }), patchListener(p, ip);
36506
36545
  }
36507
36546
  return result;
36508
36547
  } else
36509
36548
  die(1, base);
36510
36549
  }, this.produceWithPatches = (base, recipe) => {
36511
- if (typeof base == "function")
36550
+ if (isFunction(base))
36512
36551
  return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
36513
36552
  let patches, inversePatches;
36514
36553
  return [this.produce(base, recipe, (p, ip) => {
36515
36554
  patches = p, inversePatches = ip;
36516
36555
  }), patches, inversePatches];
36517
- }, typeof config2?.autoFreeze == "boolean" && this.setAutoFreeze(config2.autoFreeze), typeof config2?.useStrictShallowCopy == "boolean" && this.setUseStrictShallowCopy(config2.useStrictShallowCopy), typeof config2?.useStrictIteration == "boolean" && this.setUseStrictIteration(config2.useStrictIteration);
36556
+ }, isBoolean(config2?.autoFreeze) && this.setAutoFreeze(config2.autoFreeze), isBoolean(config2?.useStrictShallowCopy) && this.setUseStrictShallowCopy(config2.useStrictShallowCopy), isBoolean(config2?.useStrictIteration) && this.setUseStrictIteration(config2.useStrictIteration);
36518
36557
  }
36519
36558
  createDraft(base) {
36520
36559
  isDraftable(base) || die(8), isDraft(base) && (base = current(base));
36521
- const scope = enterScope(this), proxy = createProxy(base, void 0);
36560
+ const scope = enterScope(this), proxy = createProxy(scope, base, void 0);
36522
36561
  return proxy[DRAFT_STATE].isManual_ = !0, leaveScope(scope), proxy;
36523
36562
  }
36524
36563
  finishDraft(draft, patchListener) {
@@ -36565,16 +36604,20 @@ var Immer2 = class {
36565
36604
  }
36566
36605
  }
36567
36606
  i2 > -1 && (patches = patches.slice(i2 + 1));
36568
- const applyPatchesImpl = getPlugin("Patches").applyPatches_;
36607
+ const applyPatchesImpl = getPlugin(PluginPatches).applyPatches_;
36569
36608
  return isDraft(base) ? applyPatchesImpl(base, patches) : this.produce(
36570
36609
  base,
36571
36610
  (draft) => applyPatchesImpl(draft, patches)
36572
36611
  );
36573
36612
  }
36574
36613
  };
36575
- function createProxy(value, parent) {
36576
- const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
36577
- return (parent ? parent.scope_ : getCurrentScope()).drafts_.push(draft), draft;
36614
+ function createProxy(rootScope, value, parent, key) {
36615
+ const [draft, state] = isMap(value) ? getPlugin(PluginMapSet).proxyMap_(value, parent) : isSet(value) ? getPlugin(PluginMapSet).proxySet_(value, parent) : createProxyProxy(value, parent);
36616
+ return (parent?.scope_ ?? getCurrentScope()).drafts_.push(draft), state.callbacks_ = parent?.callbacks_ ?? [], state.key_ = key, parent && key !== void 0 ? registerChildFinalizationCallback(parent, state, key) : state.callbacks_.push(function(rootScope2) {
36617
+ rootScope2.mapSetPlugin_?.fixSetContents(state);
36618
+ const { patchPlugin_ } = rootScope2;
36619
+ state.modified_ && patchPlugin_ && patchPlugin_.generatePatches_(state, [], rootScope2);
36620
+ }), draft;
36578
36621
  }
36579
36622
  function current(value) {
36580
36623
  return isDraft(value) || die(10, value), currentImpl(value);
@@ -36598,10 +36641,7 @@ function currentImpl(value) {
36598
36641
  strict
36599
36642
  ), state && (state.finalized_ = !1), copy;
36600
36643
  }
36601
- var immer = new Immer2(), produce = immer.produce, setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer);
36602
- function castDraft(value) {
36603
- return value;
36604
- }
36644
+ var immer = new Immer2(), produce = immer.produce, setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer), castDraft = (value) => value;
36605
36645
  const Channel = {
36606
36646
  /* CLAMP */
36607
36647
  min: {
@@ -41177,8 +41217,8 @@ export {
41177
41217
  TabsPanel as bR,
41178
41218
  ScrollArea as bS,
41179
41219
  useCallbackRef as bT,
41180
- e$8 as bU,
41181
- animate as bV,
41220
+ animate as bU,
41221
+ e$8 as bV,
41182
41222
  VisuallyHidden as bW,
41183
41223
  n$p as bX,
41184
41224
  useWindowEvent as bY,