likec4 1.46.0 → 1.46.3

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) {
@@ -16819,7 +16824,7 @@ function requireJsesc() {
16819
16824
  }, fourHexEscape = (hex2) => "\\u" + ("0000" + hex2).slice(-4), hexadecimal = (code, lowercase2) => {
16820
16825
  let hexadecimal2 = code.toString(16);
16821
16826
  return lowercase2 ? hexadecimal2 : hexadecimal2.toUpperCase();
16822
- }, toString = object2.toString, isArray2 = Array.isArray, isBuffer = (value) => typeof Buffer == "function" && Buffer.isBuffer(value), isObject2 = (value) => toString.call(value) == "[object Object]", isString = (value) => typeof value == "string" || toString.call(value) == "[object String]", isNumber2 = (value) => typeof value == "number" || toString.call(value) == "[object Number]", isBigInt = (value) => typeof value == "bigint", isFunction2 = (value) => typeof value == "function", isMap2 = (value) => toString.call(value) == "[object Map]", isSet2 = (value) => toString.call(value) == "[object Set]", singleEscapes = {
16827
+ }, toString2 = object2.toString, isArray2 = Array.isArray, isBuffer = (value) => typeof Buffer == "function" && Buffer.isBuffer(value), isObject2 = (value) => toString2.call(value) == "[object Object]", isString = (value) => typeof value == "string" || toString2.call(value) == "[object String]", isNumber2 = (value) => typeof value == "number" || toString2.call(value) == "[object Number]", isBigInt = (value) => typeof value == "bigint", isFunction2 = (value) => typeof value == "function", isMap2 = (value) => toString2.call(value) == "[object Map]", isSet2 = (value) => toString2.call(value) == "[object Set]", singleEscapes = {
16823
16828
  "\\": "\\\\",
16824
16829
  "\b": "\\b",
16825
16830
  "\f": "\\f",
@@ -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,
@@ -24338,7 +24343,7 @@ function NodeToolbar({ nodeId, children: children2, className, style: style2, is
24338
24343
  };
24339
24344
  return jsx(NodeToolbarPortal, { children: jsx("div", { style: wrapperStyle2, className: cc(["react-flow__node-toolbar", className]), ...rest, "data-id": nodesArray.reduce((acc, node) => `${acc}${node.id} `, "").trim(), children: children2 }) });
24340
24345
  }
24341
- var getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols, hasOwnProperty = Object.prototype.hasOwnProperty;
24346
+ const { getOwnPropertyNames, getOwnPropertySymbols } = Object, { hasOwnProperty } = Object.prototype;
24342
24347
  function combineComparators(comparatorA, comparatorB) {
24343
24348
  return function(a2, b, state) {
24344
24349
  return comparatorA(a2, b, state) && comparatorB(a2, b, state);
@@ -24348,11 +24353,11 @@ function createIsCircular(areItemsEqual) {
24348
24353
  return function(a2, b, state) {
24349
24354
  if (!a2 || !b || typeof a2 != "object" || typeof b != "object")
24350
24355
  return areItemsEqual(a2, b, state);
24351
- var cache2 = state.cache, cachedA = cache2.get(a2), cachedB = cache2.get(b);
24356
+ const { cache: cache2 } = state, cachedA = cache2.get(a2), cachedB = cache2.get(b);
24352
24357
  if (cachedA && cachedB)
24353
24358
  return cachedA === b && cachedB === a2;
24354
24359
  cache2.set(a2, b), cache2.set(b, a2);
24355
- var result = areItemsEqual(a2, b, state);
24360
+ const result = areItemsEqual(a2, b, state);
24356
24361
  return cache2.delete(a2), cache2.delete(b), result;
24357
24362
  };
24358
24363
  }
@@ -24362,18 +24367,19 @@ function getShortTag(value) {
24362
24367
  function getStrictProperties(object2) {
24363
24368
  return getOwnPropertyNames(object2).concat(getOwnPropertySymbols(object2));
24364
24369
  }
24365
- var hasOwn = (
24370
+ const hasOwn = (
24366
24371
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
24367
- Object.hasOwn || (function(object2, property) {
24368
- return hasOwnProperty.call(object2, property);
24369
- })
24372
+ Object.hasOwn || ((object2, property) => hasOwnProperty.call(object2, property))
24370
24373
  );
24371
24374
  function sameValueZeroEqual(a2, b) {
24372
24375
  return a2 === b || !a2 && !b && a2 !== a2 && b !== b;
24373
24376
  }
24374
- var PREACT_VNODE = "__v", PREACT_OWNER = "__o", REACT_OWNER = "_owner", getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, keys = Object.keys;
24377
+ const PREACT_VNODE = "__v", PREACT_OWNER = "__o", REACT_OWNER = "_owner", { getOwnPropertyDescriptor, keys } = Object;
24378
+ function areArrayBuffersEqual(a2, b) {
24379
+ return a2.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a2), new Uint8Array(b));
24380
+ }
24375
24381
  function areArraysEqual(a2, b, state) {
24376
- var index2 = a2.length;
24382
+ let index2 = a2.length;
24377
24383
  if (b.length !== index2)
24378
24384
  return !1;
24379
24385
  for (; index2-- > 0; )
@@ -24381,6 +24387,9 @@ function areArraysEqual(a2, b, state) {
24381
24387
  return !1;
24382
24388
  return !0;
24383
24389
  }
24390
+ function areDataViewsEqual(a2, b) {
24391
+ return a2.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a2.buffer, a2.byteOffset, a2.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
24392
+ }
24384
24393
  function areDatesEqual(a2, b) {
24385
24394
  return sameValueZeroEqual(a2.getTime(), b.getTime());
24386
24395
  }
@@ -24391,18 +24400,22 @@ function areFunctionsEqual(a2, b) {
24391
24400
  return a2 === b;
24392
24401
  }
24393
24402
  function areMapsEqual(a2, b, state) {
24394
- var size2 = a2.size;
24403
+ const size2 = a2.size;
24395
24404
  if (size2 !== b.size)
24396
24405
  return !1;
24397
24406
  if (!size2)
24398
24407
  return !0;
24399
- for (var matchedIndices = new Array(size2), aIterable = a2.entries(), aResult, bResult, index2 = 0; (aResult = aIterable.next()) && !aResult.done; ) {
24400
- for (var bIterable = b.entries(), hasMatch = !1, matchIndex = 0; (bResult = bIterable.next()) && !bResult.done; ) {
24408
+ const matchedIndices = new Array(size2), aIterable = a2.entries();
24409
+ let aResult, bResult, index2 = 0;
24410
+ for (; (aResult = aIterable.next()) && !aResult.done; ) {
24411
+ const bIterable = b.entries();
24412
+ let hasMatch = !1, matchIndex = 0;
24413
+ for (; (bResult = bIterable.next()) && !bResult.done; ) {
24401
24414
  if (matchedIndices[matchIndex]) {
24402
24415
  matchIndex++;
24403
24416
  continue;
24404
24417
  }
24405
- var aEntry = aResult.value, bEntry = bResult.value;
24418
+ const aEntry = aResult.value, bEntry = bResult.value;
24406
24419
  if (state.equals(aEntry[0], bEntry[0], index2, matchIndex, a2, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a2, b, state)) {
24407
24420
  hasMatch = matchedIndices[matchIndex] = !0;
24408
24421
  break;
@@ -24415,9 +24428,10 @@ function areMapsEqual(a2, b, state) {
24415
24428
  }
24416
24429
  return !0;
24417
24430
  }
24418
- var areNumbersEqual = sameValueZeroEqual;
24431
+ const areNumbersEqual = sameValueZeroEqual;
24419
24432
  function areObjectsEqual(a2, b, state) {
24420
- var properties = keys(a2), index2 = properties.length;
24433
+ const properties = keys(a2);
24434
+ let index2 = properties.length;
24421
24435
  if (keys(b).length !== index2)
24422
24436
  return !1;
24423
24437
  for (; index2-- > 0; )
@@ -24426,10 +24440,12 @@ function areObjectsEqual(a2, b, state) {
24426
24440
  return !0;
24427
24441
  }
24428
24442
  function areObjectsEqualStrict(a2, b, state) {
24429
- var properties = getStrictProperties(a2), index2 = properties.length;
24443
+ const properties = getStrictProperties(a2);
24444
+ let index2 = properties.length;
24430
24445
  if (getStrictProperties(b).length !== index2)
24431
24446
  return !1;
24432
- for (var property, descriptorA, descriptorB; index2-- > 0; )
24447
+ let property, descriptorA, descriptorB;
24448
+ for (; index2-- > 0; )
24433
24449
  if (property = properties[index2], !isPropertyEqual(a2, b, state, property) || (descriptorA = getOwnPropertyDescriptor(a2, property), descriptorB = getOwnPropertyDescriptor(b, property), (descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)))
24434
24450
  return !1;
24435
24451
  return !0;
@@ -24441,13 +24457,17 @@ function areRegExpsEqual(a2, b) {
24441
24457
  return a2.source === b.source && a2.flags === b.flags;
24442
24458
  }
24443
24459
  function areSetsEqual(a2, b, state) {
24444
- var size2 = a2.size;
24460
+ const size2 = a2.size;
24445
24461
  if (size2 !== b.size)
24446
24462
  return !1;
24447
24463
  if (!size2)
24448
24464
  return !0;
24449
- for (var matchedIndices = new Array(size2), aIterable = a2.values(), aResult, bResult; (aResult = aIterable.next()) && !aResult.done; ) {
24450
- for (var bIterable = b.values(), hasMatch = !1, matchIndex = 0; (bResult = bIterable.next()) && !bResult.done; ) {
24465
+ const matchedIndices = new Array(size2), aIterable = a2.values();
24466
+ let aResult, bResult;
24467
+ for (; (aResult = aIterable.next()) && !aResult.done; ) {
24468
+ const bIterable = b.values();
24469
+ let hasMatch = !1, matchIndex = 0;
24470
+ for (; (bResult = bIterable.next()) && !bResult.done; ) {
24451
24471
  if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a2, b, state)) {
24452
24472
  hasMatch = matchedIndices[matchIndex] = !0;
24453
24473
  break;
@@ -24460,8 +24480,8 @@ function areSetsEqual(a2, b, state) {
24460
24480
  return !0;
24461
24481
  }
24462
24482
  function areTypedArraysEqual(a2, b) {
24463
- var index2 = a2.length;
24464
- if (b.length !== index2)
24483
+ let index2 = a2.byteLength;
24484
+ if (b.byteLength !== index2 || a2.byteOffset !== b.byteOffset)
24465
24485
  return !1;
24466
24486
  for (; index2-- > 0; )
24467
24487
  if (a2[index2] !== b[index2])
@@ -24474,28 +24494,38 @@ function areUrlsEqual(a2, b) {
24474
24494
  function isPropertyEqual(a2, b, state, property) {
24475
24495
  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
24496
  }
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);
24478
- function createEqualityComparator(_a) {
24479
- 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;
24497
+ const ARRAY_BUFFER_TAG = "[object ArrayBuffer]", ARGUMENTS_TAG = "[object Arguments]", BOOLEAN_TAG = "[object Boolean]", DATA_VIEW_TAG = "[object DataView]", 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]", TYPED_ARRAY_TAGS = {
24498
+ "[object Int8Array]": !0,
24499
+ "[object Uint8Array]": !0,
24500
+ "[object Uint8ClampedArray]": !0,
24501
+ "[object Int16Array]": !0,
24502
+ "[object Uint16Array]": !0,
24503
+ "[object Int32Array]": !0,
24504
+ "[object Uint32Array]": !0,
24505
+ "[object Float16Array]": !0,
24506
+ "[object Float32Array]": !0,
24507
+ "[object Float64Array]": !0,
24508
+ "[object BigInt64Array]": !0,
24509
+ "[object BigUint64Array]": !0
24510
+ }, URL_TAG = "[object URL]", toString = Object.prototype.toString;
24511
+ function createEqualityComparator({ areArrayBuffersEqual: areArrayBuffersEqual2, areArraysEqual: areArraysEqual2, areDataViewsEqual: areDataViewsEqual2, areDatesEqual: areDatesEqual2, areErrorsEqual: areErrorsEqual2, areFunctionsEqual: areFunctionsEqual2, areMapsEqual: areMapsEqual2, areNumbersEqual: areNumbersEqual2, areObjectsEqual: areObjectsEqual2, arePrimitiveWrappersEqual: arePrimitiveWrappersEqual2, areRegExpsEqual: areRegExpsEqual2, areSetsEqual: areSetsEqual2, areTypedArraysEqual: areTypedArraysEqual2, areUrlsEqual: areUrlsEqual2, unknownTagComparators }) {
24480
24512
  return function(a2, b, state) {
24481
24513
  if (a2 === b)
24482
24514
  return !0;
24483
24515
  if (a2 == null || b == null)
24484
24516
  return !1;
24485
- var type = typeof a2;
24517
+ const type = typeof a2;
24486
24518
  if (type !== typeof b)
24487
24519
  return !1;
24488
24520
  if (type !== "object")
24489
24521
  return type === "number" ? areNumbersEqual2(a2, b, state) : type === "function" ? areFunctionsEqual2(a2, b, state) : !1;
24490
- var constructor = a2.constructor;
24522
+ const constructor = a2.constructor;
24491
24523
  if (constructor !== b.constructor)
24492
24524
  return !1;
24493
24525
  if (constructor === Object)
24494
24526
  return areObjectsEqual2(a2, b, state);
24495
- if (isArray$1(a2))
24527
+ if (Array.isArray(a2))
24496
24528
  return areArraysEqual2(a2, b, state);
24497
- if (isTypedArray != null && isTypedArray(a2))
24498
- return areTypedArraysEqual2(a2, b, state);
24499
24529
  if (constructor === Date)
24500
24530
  return areDatesEqual2(a2, b, state);
24501
24531
  if (constructor === RegExp)
@@ -24504,7 +24534,7 @@ function createEqualityComparator(_a) {
24504
24534
  return areMapsEqual2(a2, b, state);
24505
24535
  if (constructor === Set)
24506
24536
  return areSetsEqual2(a2, b, state);
24507
- var tag = getTag(a2);
24537
+ const tag = toString.call(a2);
24508
24538
  if (tag === DATE_TAG)
24509
24539
  return areDatesEqual2(a2, b, state);
24510
24540
  if (tag === REG_EXP_TAG)
@@ -24521,12 +24551,18 @@ function createEqualityComparator(_a) {
24521
24551
  return areErrorsEqual2(a2, b, state);
24522
24552
  if (tag === ARGUMENTS_TAG)
24523
24553
  return areObjectsEqual2(a2, b, state);
24554
+ if (TYPED_ARRAY_TAGS[tag])
24555
+ return areTypedArraysEqual2(a2, b, state);
24556
+ if (tag === ARRAY_BUFFER_TAG)
24557
+ return areArrayBuffersEqual2(a2, b, state);
24558
+ if (tag === DATA_VIEW_TAG)
24559
+ return areDataViewsEqual2(a2, b, state);
24524
24560
  if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG)
24525
24561
  return arePrimitiveWrappersEqual2(a2, b, state);
24526
24562
  if (unknownTagComparators) {
24527
- var unknownTagComparator = unknownTagComparators[tag];
24563
+ let unknownTagComparator = unknownTagComparators[tag];
24528
24564
  if (!unknownTagComparator) {
24529
- var shortTag = getShortTag(a2);
24565
+ const shortTag = getShortTag(a2);
24530
24566
  shortTag && (unknownTagComparator = unknownTagComparators[shortTag]);
24531
24567
  }
24532
24568
  if (unknownTagComparator)
@@ -24535,9 +24571,11 @@ function createEqualityComparator(_a) {
24535
24571
  return !1;
24536
24572
  };
24537
24573
  }
24538
- function createEqualityComparatorConfig(_a) {
24539
- var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict, config2 = {
24574
+ function createEqualityComparatorConfig({ circular, createCustomConfig, strict }) {
24575
+ let config2 = {
24576
+ areArrayBuffersEqual,
24540
24577
  areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
24578
+ areDataViewsEqual,
24541
24579
  areDatesEqual,
24542
24580
  areErrorsEqual,
24543
24581
  areFunctionsEqual,
@@ -24547,17 +24585,17 @@ function createEqualityComparatorConfig(_a) {
24547
24585
  arePrimitiveWrappersEqual,
24548
24586
  areRegExpsEqual,
24549
24587
  areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
24550
- areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
24588
+ areTypedArraysEqual: strict ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
24551
24589
  areUrlsEqual,
24552
24590
  unknownTagComparators: void 0
24553
24591
  };
24554
- if (createCustomConfig && (config2 = assign$1({}, config2, createCustomConfig(config2))), circular) {
24555
- var areArraysEqual$1 = createIsCircular(config2.areArraysEqual), areMapsEqual$1 = createIsCircular(config2.areMapsEqual), areObjectsEqual$1 = createIsCircular(config2.areObjectsEqual), areSetsEqual$12 = createIsCircular(config2.areSetsEqual);
24556
- config2 = assign$1({}, config2, {
24557
- areArraysEqual: areArraysEqual$1,
24558
- areMapsEqual: areMapsEqual$1,
24559
- areObjectsEqual: areObjectsEqual$1,
24560
- areSetsEqual: areSetsEqual$12
24592
+ if (createCustomConfig && (config2 = Object.assign({}, config2, createCustomConfig(config2))), circular) {
24593
+ const areArraysEqual2 = createIsCircular(config2.areArraysEqual), areMapsEqual2 = createIsCircular(config2.areMapsEqual), areObjectsEqual2 = createIsCircular(config2.areObjectsEqual), areSetsEqual2 = createIsCircular(config2.areSetsEqual);
24594
+ config2 = Object.assign({}, config2, {
24595
+ areArraysEqual: areArraysEqual2,
24596
+ areMapsEqual: areMapsEqual2,
24597
+ areObjectsEqual: areObjectsEqual2,
24598
+ areSetsEqual: areSetsEqual2
24561
24599
  });
24562
24600
  }
24563
24601
  return config2;
@@ -24567,11 +24605,10 @@ function createInternalEqualityComparator(compare2) {
24567
24605
  return compare2(a2, b, state);
24568
24606
  };
24569
24607
  }
24570
- function createIsEqual(_a) {
24571
- var circular = _a.circular, comparator = _a.comparator, createState2 = _a.createState, equals = _a.equals, strict = _a.strict;
24608
+ function createIsEqual({ circular, comparator, createState: createState2, equals, strict }) {
24572
24609
  if (createState2)
24573
24610
  return function(a2, b) {
24574
- var _a2 = createState2(), _b = _a2.cache, cache2 = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
24611
+ const { cache: cache2 = circular ? /* @__PURE__ */ new WeakMap() : void 0, meta } = createState2();
24575
24612
  return comparator(a2, b, {
24576
24613
  cache: cache2,
24577
24614
  equals,
@@ -24588,7 +24625,7 @@ function createIsEqual(_a) {
24588
24625
  strict
24589
24626
  });
24590
24627
  };
24591
- var state = {
24628
+ const state = {
24592
24629
  cache: void 0,
24593
24630
  equals,
24594
24631
  meta: void 0,
@@ -24598,40 +24635,31 @@ function createIsEqual(_a) {
24598
24635
  return comparator(a2, b, state);
24599
24636
  };
24600
24637
  }
24601
- var deepEqual = createCustomEqual();
24638
+ const deepEqual = createCustomEqual();
24602
24639
  createCustomEqual({ strict: !0 });
24603
24640
  createCustomEqual({ circular: !0 });
24604
24641
  createCustomEqual({
24605
24642
  circular: !0,
24606
24643
  strict: !0
24607
24644
  });
24608
- var shallowEqual = createCustomEqual({
24609
- createInternalComparator: function() {
24610
- return sameValueZeroEqual;
24611
- }
24645
+ const shallowEqual = createCustomEqual({
24646
+ createInternalComparator: () => sameValueZeroEqual
24612
24647
  });
24613
24648
  createCustomEqual({
24614
24649
  strict: !0,
24615
- createInternalComparator: function() {
24616
- return sameValueZeroEqual;
24617
- }
24650
+ createInternalComparator: () => sameValueZeroEqual
24618
24651
  });
24619
24652
  createCustomEqual({
24620
24653
  circular: !0,
24621
- createInternalComparator: function() {
24622
- return sameValueZeroEqual;
24623
- }
24654
+ createInternalComparator: () => sameValueZeroEqual
24624
24655
  });
24625
24656
  createCustomEqual({
24626
24657
  circular: !0,
24627
- createInternalComparator: function() {
24628
- return sameValueZeroEqual;
24629
- },
24658
+ createInternalComparator: () => sameValueZeroEqual,
24630
24659
  strict: !0
24631
24660
  });
24632
- function createCustomEqual(options) {
24633
- options === void 0 && (options = {});
24634
- var _a = options.circular, circular = _a === void 0 ? !1 : _a, createCustomInternalComparator = options.createInternalComparator, createState2 = options.createState, _b = options.strict, strict = _b === void 0 ? !1 : _b, config2 = createEqualityComparatorConfig(options), comparator = createEqualityComparator(config2), equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
24661
+ function createCustomEqual(options = {}) {
24662
+ const { circular = !1, createInternalComparator: createCustomInternalComparator, createState: createState2, strict = !1 } = options, config2 = createEqualityComparatorConfig(options), comparator = createEqualityComparator(config2), equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
24635
24663
  return createIsEqual({ circular, comparator, createState: createState2, equals, strict });
24636
24664
  }
24637
24665
  const { abs: abs$1, cos: cos$1, sin: sin$1, acos: acos$1, atan2, sqrt: sqrt$1, pow } = Math;
@@ -26403,7 +26431,7 @@ class JSAnimation extends WithPromise {
26403
26431
  if (repeat) {
26404
26432
  const progress2 = Math.min(this.currentTime, totalDuration) / resolvedDuration;
26405
26433
  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;
26434
+ !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
26435
  }
26408
26436
  const state = isInDelayPhase ? { done: !1, value: keyframes2[0] } : frameGenerator.next(elapsed);
26409
26437
  mixKeyframes && (state.value = mixKeyframes(state.value));
@@ -27902,11 +27930,47 @@ function useCreateMotionContext(props2) {
27902
27930
  function variantLabelsAsDependency(prop) {
27903
27931
  return Array.isArray(prop) ? prop.join(" ") : prop;
27904
27932
  }
27905
- const scaleCorrectors = {};
27906
- function addScaleCorrector(correctors) {
27907
- for (const key in correctors)
27908
- scaleCorrectors[key] = correctors[key], isCSSVariableName(key) && (scaleCorrectors[key].isCSSVariable = !0);
27933
+ function pixelsToPercent(pixels, axis) {
27934
+ return axis.max === axis.min ? 0 : pixels / (axis.max - axis.min) * 100;
27909
27935
  }
27936
+ const correctBorderRadius = {
27937
+ correct: (latest2, node) => {
27938
+ if (!node.target)
27939
+ return latest2;
27940
+ if (typeof latest2 == "string")
27941
+ if (px$1.test(latest2))
27942
+ latest2 = parseFloat(latest2);
27943
+ else
27944
+ return latest2;
27945
+ const x2 = pixelsToPercent(latest2, node.target.x), y2 = pixelsToPercent(latest2, node.target.y);
27946
+ return `${x2}% ${y2}%`;
27947
+ }
27948
+ }, correctBoxShadow = {
27949
+ correct: (latest2, { treeScale, projectionDelta }) => {
27950
+ const original = latest2, shadow = complex.parse(latest2);
27951
+ if (shadow.length > 5)
27952
+ return original;
27953
+ const template = complex.createTransformer(latest2), offset2 = typeof shadow[0] != "number" ? 1 : 0, xScale = projectionDelta.x.scale * treeScale.x, yScale = projectionDelta.y.scale * treeScale.y;
27954
+ shadow[0 + offset2] /= xScale, shadow[1 + offset2] /= yScale;
27955
+ const averageScale = mixNumber$1(xScale, yScale, 0.5);
27956
+ return typeof shadow[2 + offset2] == "number" && (shadow[2 + offset2] /= averageScale), typeof shadow[3 + offset2] == "number" && (shadow[3 + offset2] /= averageScale), template(shadow);
27957
+ }
27958
+ }, scaleCorrectors = {
27959
+ borderRadius: {
27960
+ ...correctBorderRadius,
27961
+ applyTo: [
27962
+ "borderTopLeftRadius",
27963
+ "borderTopRightRadius",
27964
+ "borderBottomLeftRadius",
27965
+ "borderBottomRightRadius"
27966
+ ]
27967
+ },
27968
+ borderTopLeftRadius: correctBorderRadius,
27969
+ borderTopRightRadius: correctBorderRadius,
27970
+ borderBottomLeftRadius: correctBorderRadius,
27971
+ borderBottomRightRadius: correctBorderRadius,
27972
+ boxShadow: correctBoxShadow
27973
+ };
27910
27974
  function isForcedMotionValue(key, { layout: layout2, layoutId }) {
27911
27975
  return transformProps.has(key) || key.startsWith("origin") || (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key] || key === "opacity");
27912
27976
  }
@@ -28167,7 +28231,7 @@ function scrapeMotionValuesFromProps(props2, prevProps, visualElement) {
28167
28231
  const useSVGVisualState = /* @__PURE__ */ makeUseVisualState({
28168
28232
  scrapeMotionValuesFromProps,
28169
28233
  createRenderState: createSvgRenderState
28170
- }), motionComponentSymbol = Symbol.for("motionComponentSymbol");
28234
+ }), motionComponentSymbol = /* @__PURE__ */ Symbol.for("motionComponentSymbol");
28171
28235
  function isRefObject(ref) {
28172
28236
  return ref && typeof ref == "object" && Object.prototype.hasOwnProperty.call(ref, "current");
28173
28237
  }
@@ -29585,32 +29649,6 @@ const globalProjectionState = {
29585
29649
  */
29586
29650
  hasEverUpdated: !1
29587
29651
  };
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
29652
  let hasTakenAnySnapshot = !1;
29615
29653
  class MeasureLayoutWithContext extends Component {
29616
29654
  /**
@@ -29620,7 +29658,7 @@ class MeasureLayoutWithContext extends Component {
29620
29658
  */
29621
29659
  componentDidMount() {
29622
29660
  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", () => {
29661
+ projection && (layoutGroup.group && layoutGroup.group.add(projection), switchLayoutGroup && switchLayoutGroup.register && layoutId && switchLayoutGroup.register(projection), hasTakenAnySnapshot && projection.root.didUpdate(), projection.addEventListener("animationComplete", () => {
29624
29662
  this.safeToRemove();
29625
29663
  }), projection.setOptions({
29626
29664
  ...projection.options,
@@ -29656,22 +29694,6 @@ function MeasureLayout(props2) {
29656
29694
  const [isPresent, safeToRemove] = usePresence(), layoutGroup = useContext(LayoutGroupContext);
29657
29695
  return jsx(MeasureLayoutWithContext, { ...props2, layoutGroup, switchLayoutGroup: useContext(SwitchLayoutGroupContext), isPresent, safeToRemove });
29658
29696
  }
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
29697
  function animateSingleValue(value, keyframes2, options) {
29676
29698
  const motionValue$1 = isMotionValue(value) ? value : motionValue(value);
29677
29699
  return motionValue$1.start(animateMotionValue("", motionValue$1, keyframes2, options)), motionValue$1.animation;
@@ -31075,7 +31097,7 @@ function matchesState(parentStateId, childStateId) {
31075
31097
  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
31098
  }
31077
31099
  function toStatePath(stateId) {
31078
- if (isArray(stateId))
31100
+ if (isArray$1(stateId))
31079
31101
  return stateId;
31080
31102
  const result = [];
31081
31103
  let segment = "";
@@ -31125,7 +31147,7 @@ function mapValues(collection, iteratee) {
31125
31147
  return result;
31126
31148
  }
31127
31149
  function toArrayStrict(value) {
31128
- return isArray(value) ? value : [value];
31150
+ return isArray$1(value) ? value : [value];
31129
31151
  }
31130
31152
  function toArray$1(value) {
31131
31153
  return value === void 0 ? [] : toArrayStrict(value);
@@ -31137,7 +31159,7 @@ function resolveOutput(mapper, context, event, self2) {
31137
31159
  self: self2
31138
31160
  }) : mapper;
31139
31161
  }
31140
- function isArray(value) {
31162
+ function isArray$1(value) {
31141
31163
  return Array.isArray(value);
31142
31164
  }
31143
31165
  function isErrorActorEvent(event) {
@@ -36137,132 +36159,123 @@ const curveCatmullRomOpen = (function custom4(alpha2) {
36137
36159
  return custom4(+alpha3);
36138
36160
  }, catmullRom;
36139
36161
  })(0.5);
36140
- var NOTHING = Symbol.for("immer-nothing"), DRAFTABLE = Symbol.for("immer-draftable"), DRAFT_STATE = Symbol.for("immer-state");
36162
+ var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing"), DRAFTABLE = /* @__PURE__ */ Symbol.for("immer-draftable"), DRAFT_STATE = /* @__PURE__ */ Symbol.for("immer-state");
36141
36163
  function die(error, ...args) {
36142
36164
  throw new Error(
36143
36165
  `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
36144
36166
  );
36145
36167
  }
36146
- var getPrototypeOf = Object.getPrototypeOf;
36147
- function isDraft(value) {
36148
- return !!value && !!value[DRAFT_STATE];
36149
- }
36168
+ 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
36169
  function isDraftable(value) {
36151
- return value ? isPlainObject$1(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value) : !1;
36170
+ return value ? isPlainObject$1(value) || isArray(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value) : !1;
36152
36171
  }
36153
- var objectCtorString = Object.prototype.constructor.toString(), cachedCtorStrings = /* @__PURE__ */ new WeakMap();
36172
+ var objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString(), cachedCtorStrings = /* @__PURE__ */ new WeakMap();
36154
36173
  function isPlainObject$1(value) {
36155
- if (!value || typeof value != "object")
36174
+ if (!value || !isObjectish(value))
36156
36175
  return !1;
36157
- const proto = Object.getPrototypeOf(value);
36158
- if (proto === null || proto === Object.prototype)
36176
+ const proto = getPrototypeOf(value);
36177
+ if (proto === null || proto === O[PROTOTYPE])
36159
36178
  return !0;
36160
- const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
36179
+ const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
36161
36180
  if (Ctor === Object)
36162
36181
  return !0;
36163
- if (typeof Ctor != "function")
36182
+ if (!isFunction(Ctor))
36164
36183
  return !1;
36165
36184
  let ctorString = cachedCtorStrings.get(Ctor);
36166
36185
  return ctorString === void 0 && (ctorString = Function.toString.call(Ctor), cachedCtorStrings.set(Ctor, ctorString)), ctorString === objectCtorString;
36167
36186
  }
36168
36187
  function each(obj, iter, strict = !0) {
36169
- getArchtype(obj) === 0 ? (strict ? Reflect.ownKeys(obj) : Object.keys(obj)).forEach((key) => {
36188
+ getArchtype(obj) === 0 ? (strict ? Reflect.ownKeys(obj) : O.keys(obj)).forEach((key) => {
36170
36189
  iter(key, obj[key], obj);
36171
36190
  }) : obj.forEach((entry, index2) => iter(index2, entry, obj));
36172
36191
  }
36173
36192
  function getArchtype(thing) {
36174
36193
  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;
36194
+ return state ? state.type_ : isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
36183
36195
  }
36196
+ var has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop), get = (thing, prop, type = getArchtype(thing)) => (
36197
+ // @ts-ignore
36198
+ type === 2 ? thing.get(prop) : thing[prop]
36199
+ ), set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
36200
+ type === 2 ? thing.set(propOrOldValue, value) : type === 3 ? thing.add(value) : thing[propOrOldValue] = value;
36201
+ };
36184
36202
  function is(x2, y2) {
36185
36203
  return x2 === y2 ? x2 !== 0 || 1 / x2 === 1 / y2 : x2 !== x2 && y2 !== y2;
36186
36204
  }
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
- }
36205
+ 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
36206
  function shallowCopy(base, strict) {
36197
36207
  if (isMap(base))
36198
36208
  return new Map(base);
36199
36209
  if (isSet(base))
36200
36210
  return new Set(base);
36201
- if (Array.isArray(base))
36202
- return Array.prototype.slice.call(base);
36211
+ if (isArray(base))
36212
+ return Array[PROTOTYPE].slice.call(base);
36203
36213
  const isPlain = isPlainObject$1(base);
36204
36214
  if (strict === !0 || strict === "class_only" && !isPlain) {
36205
- const descriptors = Object.getOwnPropertyDescriptors(base);
36215
+ const descriptors = O.getOwnPropertyDescriptors(base);
36206
36216
  delete descriptors[DRAFT_STATE];
36207
36217
  let keys2 = Reflect.ownKeys(descriptors);
36208
36218
  for (let i2 = 0; i2 < keys2.length; i2++) {
36209
36219
  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,
36220
+ desc[WRITABLE] === !1 && (desc[WRITABLE] = !0, desc[CONFIGURABLE] = !0), (desc.get || desc.set) && (descriptors[key] = {
36221
+ [CONFIGURABLE]: !0,
36222
+ [WRITABLE]: !0,
36213
36223
  // could live with !!desc.set as well here...
36214
- enumerable: desc.enumerable,
36215
- value: base[key]
36224
+ [ENUMERABLE]: desc[ENUMERABLE],
36225
+ [VALUE]: base[key]
36216
36226
  });
36217
36227
  }
36218
- return Object.create(getPrototypeOf(base), descriptors);
36228
+ return O.create(getPrototypeOf(base), descriptors);
36219
36229
  } else {
36220
36230
  const proto = getPrototypeOf(base);
36221
36231
  if (proto !== null && isPlain)
36222
36232
  return { ...base };
36223
- const obj = Object.create(proto);
36224
- return Object.assign(obj, base);
36233
+ const obj = O.create(proto);
36234
+ return O.assign(obj, base);
36225
36235
  }
36226
36236
  }
36227
36237
  function freeze(obj, deep = !1) {
36228
- return isFrozen(obj) || isDraft(obj) || !isDraftable(obj) || (getArchtype(obj) > 1 && Object.defineProperties(obj, {
36238
+ return isFrozen(obj) || isDraft(obj) || !isDraftable(obj) || (getArchtype(obj) > 1 && O.defineProperties(obj, {
36229
36239
  set: dontMutateMethodOverride,
36230
36240
  add: dontMutateMethodOverride,
36231
36241
  clear: dontMutateMethodOverride,
36232
36242
  delete: dontMutateMethodOverride
36233
- }), Object.freeze(obj), deep && Object.values(obj).forEach((value) => freeze(value, !0))), obj;
36243
+ }), O.freeze(obj), deep && each(
36244
+ obj,
36245
+ (_key, value) => {
36246
+ freeze(value, !0);
36247
+ },
36248
+ !1
36249
+ )), obj;
36234
36250
  }
36235
36251
  function dontMutateFrozenCollections() {
36236
36252
  die(2);
36237
36253
  }
36238
36254
  var dontMutateMethodOverride = {
36239
- value: dontMutateFrozenCollections
36255
+ [VALUE]: dontMutateFrozenCollections
36240
36256
  };
36241
36257
  function isFrozen(obj) {
36242
- return obj === null || typeof obj != "object" ? !0 : Object.isFrozen(obj);
36258
+ return obj === null || !isObjectish(obj) ? !0 : O.isFrozen(obj);
36243
36259
  }
36244
- var plugins = {};
36260
+ var PluginMapSet = "MapSet", PluginPatches = "Patches", plugins = {};
36245
36261
  function getPlugin(pluginKey) {
36246
36262
  const plugin = plugins[pluginKey];
36247
36263
  return plugin || die(0, pluginKey), plugin;
36248
36264
  }
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
- }
36265
+ var isPluginLoaded = (pluginKey) => !!plugins[pluginKey], currentScope, getCurrentScope = () => currentScope, createScope = (parent_, immer_) => ({
36266
+ drafts_: [],
36267
+ parent_,
36268
+ immer_,
36269
+ // Whenever the modified draft contains a draft from another scope, we
36270
+ // need to prevent auto-freezing so the unowned draft can be finalized.
36271
+ canAutoFreeze_: !0,
36272
+ unfinalizedDrafts_: 0,
36273
+ handledSet_: /* @__PURE__ */ new Set(),
36274
+ processedForPatches_: /* @__PURE__ */ new Set(),
36275
+ mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0
36276
+ });
36264
36277
  function usePatchesInScope(scope, patchListener) {
36265
- patchListener && (getPlugin("Patches"), scope.patches_ = [], scope.inversePatches_ = [], scope.patchListener_ = patchListener);
36278
+ patchListener && (scope.patchPlugin_ = getPlugin(PluginPatches), scope.patches_ = [], scope.inversePatches_ = [], scope.patchListener_ = patchListener);
36266
36279
  }
36267
36280
  function revokeScope(scope) {
36268
36281
  leaveScope(scope), scope.drafts_.forEach(revokeDraft), scope.drafts_ = null;
@@ -36270,9 +36283,7 @@ function revokeScope(scope) {
36270
36283
  function leaveScope(scope) {
36271
36284
  scope === currentScope && (currentScope = scope.parent_);
36272
36285
  }
36273
- function enterScope(immer2) {
36274
- return currentScope = createScope(currentScope, immer2);
36275
- }
36286
+ var enterScope = (immer2) => currentScope = createScope(currentScope, immer2);
36276
36287
  function revokeDraft(draft) {
36277
36288
  const state = draft[DRAFT_STATE];
36278
36289
  state.type_ === 0 || state.type_ === 1 ? state.revoke_() : state.revoked_ = !0;
@@ -36280,78 +36291,115 @@ function revokeDraft(draft) {
36280
36291
  function processResult(result, scope) {
36281
36292
  scope.unfinalizedDrafts_ = scope.drafts_.length;
36282
36293
  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) {
36294
+ if (result !== void 0 && result !== baseDraft) {
36295
+ baseDraft[DRAFT_STATE].modified_ && (revokeScope(scope), die(4)), isDraftable(result) && (result = finalize(scope, result));
36296
+ const { patchPlugin_ } = scope;
36297
+ patchPlugin_ && patchPlugin_.generateReplacementPatches_(
36298
+ baseDraft[DRAFT_STATE].base_,
36299
+ result,
36300
+ scope
36301
+ );
36302
+ } else
36303
+ result = finalize(scope, baseDraft);
36304
+ return maybeFreeze(scope, result, !0), revokeScope(scope), scope.patches_ && scope.patchListener_(scope.patches_, scope.inversePatches_), result !== NOTHING ? result : void 0;
36305
+ }
36306
+ function finalize(rootScope, value) {
36291
36307
  if (isFrozen(value))
36292
36308
  return value;
36293
- const useStrictIteration = rootScope.immer_.shouldUseStrictIteration(), state = value[DRAFT_STATE];
36309
+ const state = value[DRAFT_STATE];
36294
36310
  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)
36311
+ return handleValue(value, rootScope.handledSet_, rootScope);
36312
+ if (!isSameScope(state, rootScope))
36301
36313
  return value;
36302
36314
  if (!state.modified_)
36303
- return maybeFreeze(rootScope, state.base_, !0), state.base_;
36315
+ return state.base_;
36304
36316
  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
- );
36317
+ const { callbacks_ } = state;
36318
+ if (callbacks_)
36319
+ for (; callbacks_.length > 0; )
36320
+ callbacks_.pop()(rootScope);
36321
+ generatePatchesAndFinalize(state, rootScope);
36326
36322
  }
36327
36323
  return state.copy_;
36328
36324
  }
36329
- function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
36330
- if (childValue == null || typeof childValue != "object" && !targetIsSet)
36325
+ function maybeFreeze(scope, value, deep = !1) {
36326
+ !scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_ && freeze(value, deep);
36327
+ }
36328
+ function markStateFinalized(state) {
36329
+ state.finalized_ = !0, state.scope_.unfinalizedDrafts_--;
36330
+ }
36331
+ var isSameScope = (state, rootScope) => state.scope_ === rootScope, EMPTY_LOCATIONS_RESULT = [];
36332
+ function updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {
36333
+ const parentCopy = latest(parent), parentType = parent.type_;
36334
+ if (originalKey !== void 0 && get(parentCopy, originalKey, parentType) === draftValue) {
36335
+ set(parentCopy, originalKey, finalizedValue, parentType);
36331
36336
  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);
36337
+ }
36338
+ if (!parent.draftLocations_) {
36339
+ const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();
36340
+ each(parentCopy, (key, value) => {
36341
+ if (isDraft(value)) {
36342
+ const keys2 = draftLocations.get(value) || [];
36343
+ keys2.push(key), draftLocations.set(value, keys2);
36344
+ }
36345
+ });
36346
+ }
36347
+ const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;
36348
+ for (const location of locations)
36349
+ set(parentCopy, location, finalizedValue, parentType);
36350
+ }
36351
+ function registerChildFinalizationCallback(parent, child, key) {
36352
+ parent.callbacks_.push(function(rootScope) {
36353
+ const state = child;
36354
+ if (!state || !isSameScope(state, rootScope))
36355
+ return;
36356
+ rootScope.mapSetPlugin_?.fixSetContents(state);
36357
+ const finalizedValue = getFinalValue(state);
36358
+ updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key), generatePatchesAndFinalize(state, rootScope);
36359
+ });
36360
+ }
36361
+ function generatePatchesAndFinalize(state, rootScope) {
36362
+ if (state.modified_ && !state.finalized_ && (state.type_ === 3 || (state.assigned_?.size ?? 0) > 0)) {
36363
+ const { patchPlugin_ } = rootScope;
36364
+ if (patchPlugin_) {
36365
+ const basePath = patchPlugin_.getPath(state);
36366
+ basePath && patchPlugin_.generatePatches_(state, basePath, rootScope);
36346
36367
  }
36368
+ markStateFinalized(state);
36347
36369
  }
36348
36370
  }
36349
- function maybeFreeze(scope, value, deep = !1) {
36350
- !scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_ && freeze(value, deep);
36371
+ function handleCrossReference(target, key, value) {
36372
+ const { scope_ } = target;
36373
+ if (isDraft(value)) {
36374
+ const state = value[DRAFT_STATE];
36375
+ isSameScope(state, scope_) && state.callbacks_.push(function() {
36376
+ prepareCopy(target);
36377
+ const finalizedValue = getFinalValue(state);
36378
+ updateDraftInParent(target, value, finalizedValue, key);
36379
+ });
36380
+ } else isDraftable(value) && target.callbacks_.push(function() {
36381
+ const targetCopy = latest(target);
36382
+ get(targetCopy, key, target.type_) === value && scope_.drafts_.length > 1 && (target.assigned_.get(key) ?? !1) === !0 && target.copy_ && handleValue(
36383
+ get(target.copy_, key, target.type_),
36384
+ scope_.handledSet_,
36385
+ scope_
36386
+ );
36387
+ });
36388
+ }
36389
+ function handleValue(target, handledSet, rootScope) {
36390
+ return !rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1 || isDraft(target) || handledSet.has(target) || !isDraftable(target) || isFrozen(target) || (handledSet.add(target), each(target, (key, value) => {
36391
+ if (isDraft(value)) {
36392
+ const state = value[DRAFT_STATE];
36393
+ if (isSameScope(state, rootScope)) {
36394
+ const updatedValue = getFinalValue(state);
36395
+ set(target, key, updatedValue, target.type_), markStateFinalized(state);
36396
+ }
36397
+ } else isDraftable(value) && handleValue(value, handledSet, rootScope);
36398
+ })), target;
36351
36399
  }
36352
36400
  function createProxyProxy(base, parent) {
36353
- const isArray2 = Array.isArray(base), state = {
36354
- type_: isArray2 ? 1 : 0,
36401
+ const baseIsArray = isArray(base), state = {
36402
+ type_: baseIsArray ? 1 : 0,
36355
36403
  // Track which produce call this is associated with.
36356
36404
  scope_: parent ? parent.scope_ : getCurrentScope(),
36357
36405
  // True for both shallow and deep changes.
@@ -36359,7 +36407,8 @@ function createProxyProxy(base, parent) {
36359
36407
  // Used during finalization.
36360
36408
  finalized_: !1,
36361
36409
  // Track which properties have been assigned (true) or deleted (false).
36362
- assigned_: {},
36410
+ // actually instantiated in `prepareCopy()`
36411
+ assigned_: void 0,
36363
36412
  // The parent draft state.
36364
36413
  parent_: parent,
36365
36414
  // The base state.
@@ -36371,22 +36420,31 @@ function createProxyProxy(base, parent) {
36371
36420
  copy_: null,
36372
36421
  // Called by the `produce` function.
36373
36422
  revoke_: null,
36374
- isManual_: !1
36423
+ isManual_: !1,
36424
+ // `callbacks` actually gets assigned in `createProxy`
36425
+ callbacks_: void 0
36375
36426
  };
36376
36427
  let target = state, traps = objectTraps;
36377
- isArray2 && (target = [state], traps = arrayTraps);
36428
+ baseIsArray && (target = [state], traps = arrayTraps);
36378
36429
  const { revoke, proxy } = Proxy.revocable(target, traps);
36379
- return state.draft_ = proxy, state.revoke_ = revoke, proxy;
36430
+ return state.draft_ = proxy, state.revoke_ = revoke, [proxy, state];
36380
36431
  }
36381
36432
  var objectTraps = {
36382
36433
  get(state, prop) {
36383
36434
  if (prop === DRAFT_STATE)
36384
36435
  return state;
36385
36436
  const source = latest(state);
36386
- if (!has(source, prop))
36437
+ if (!has(source, prop, state.type_))
36387
36438
  return readPropFromProto(state, source, prop);
36388
36439
  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;
36440
+ if (state.finalized_ || !isDraftable(value))
36441
+ return value;
36442
+ if (value === peek(state.base_, prop)) {
36443
+ prepareCopy(state);
36444
+ const childKey = state.type_ === 1 ? +prop : prop, childDraft = createProxy(state.scope_, value, state, childKey);
36445
+ return state.copy_[childKey] = childDraft;
36446
+ }
36447
+ return value;
36390
36448
  },
36391
36449
  has(state, prop) {
36392
36450
  return prop in latest(state);
@@ -36401,27 +36459,27 @@ var objectTraps = {
36401
36459
  if (!state.modified_) {
36402
36460
  const current2 = peek(latest(state), prop), currentState = current2?.[DRAFT_STATE];
36403
36461
  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)))
36462
+ return state.copy_[prop] = value, state.assigned_.set(prop, !1), !0;
36463
+ if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_)))
36406
36464
  return !0;
36407
36465
  prepareCopy(state), markChanged(state);
36408
36466
  }
36409
36467
  return state.copy_[prop] === value && // special case: handle new props with value 'undefined'
36410
36468
  (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;
36469
+ Number.isNaN(value) && Number.isNaN(state.copy_[prop]) || (state.copy_[prop] = value, state.assigned_.set(prop, !0), handleCrossReference(state, prop, value)), !0;
36412
36470
  },
36413
36471
  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;
36472
+ 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
36473
  },
36416
36474
  // Note: We never coerce `desc.value` into an Immer draft, because we can't make
36417
36475
  // the same guarantee in ES5 mode.
36418
36476
  getOwnPropertyDescriptor(state, prop) {
36419
36477
  const owner = latest(state), desc = Reflect.getOwnPropertyDescriptor(owner, prop);
36420
36478
  return desc && {
36421
- writable: !0,
36422
- configurable: state.type_ !== 1 || prop !== "length",
36423
- enumerable: desc.enumerable,
36424
- value: owner[prop]
36479
+ [WRITABLE]: !0,
36480
+ [CONFIGURABLE]: state.type_ !== 1 || prop !== "length",
36481
+ [ENUMERABLE]: desc[ENUMERABLE],
36482
+ [VALUE]: owner[prop]
36425
36483
  };
36426
36484
  },
36427
36485
  defineProperty() {
@@ -36436,7 +36494,8 @@ var objectTraps = {
36436
36494
  }, arrayTraps = {};
36437
36495
  each(objectTraps, (key, fn) => {
36438
36496
  arrayTraps[key] = function() {
36439
- return arguments[0] = arguments[0][0], fn.apply(this, arguments);
36497
+ const args = arguments;
36498
+ return args[0] = args[0][0], fn.apply(this, args);
36440
36499
  };
36441
36500
  });
36442
36501
  arrayTraps.deleteProperty = function(state, prop) {
@@ -36451,7 +36510,7 @@ function peek(draft, prop) {
36451
36510
  }
36452
36511
  function readPropFromProto(state, source, prop) {
36453
36512
  const desc = getDescriptorFromProto(source, prop);
36454
- return desc ? "value" in desc ? desc.value : (
36513
+ return desc ? VALUE in desc ? desc[VALUE] : (
36455
36514
  // This is a very special case, if the prop is a getter defined by the
36456
36515
  // prototype, we should invoke it with the draft as context!
36457
36516
  desc.get?.call(state.draft_)
@@ -36472,15 +36531,15 @@ function markChanged(state) {
36472
36531
  state.modified_ || (state.modified_ = !0, state.parent_ && markChanged(state.parent_));
36473
36532
  }
36474
36533
  function prepareCopy(state) {
36475
- state.copy_ || (state.copy_ = shallowCopy(
36534
+ state.copy_ || (state.assigned_ = /* @__PURE__ */ new Map(), state.copy_ = shallowCopy(
36476
36535
  state.base_,
36477
36536
  state.scope_.immer_.useStrictShallowCopy_
36478
36537
  ));
36479
36538
  }
36480
36539
  var Immer2 = class {
36481
36540
  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") {
36541
+ this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1, this.produce = (base, recipe, patchListener) => {
36542
+ if (isFunction(base) && !isFunction(recipe)) {
36484
36543
  const defaultBase = recipe;
36485
36544
  recipe = base;
36486
36545
  const self2 = this;
@@ -36488,10 +36547,10 @@ var Immer2 = class {
36488
36547
  return self2.produce(base2, (draft) => recipe.call(this, draft, ...args));
36489
36548
  };
36490
36549
  }
36491
- typeof recipe != "function" && die(6), patchListener !== void 0 && typeof patchListener != "function" && die(7);
36550
+ isFunction(recipe) || die(6), patchListener !== void 0 && !isFunction(patchListener) && die(7);
36492
36551
  let result;
36493
36552
  if (isDraftable(base)) {
36494
- const scope = enterScope(this), proxy = createProxy(base, void 0);
36553
+ const scope = enterScope(this), proxy = createProxy(scope, base, void 0);
36495
36554
  let hasError = !0;
36496
36555
  try {
36497
36556
  result = recipe(proxy), hasError = !1;
@@ -36499,26 +36558,29 @@ var Immer2 = class {
36499
36558
  hasError ? revokeScope(scope) : leaveScope(scope);
36500
36559
  }
36501
36560
  return usePatchesInScope(scope, patchListener), processResult(result, scope);
36502
- } else if (!base || typeof base != "object") {
36561
+ } else if (!base || !isObjectish(base)) {
36503
36562
  if (result = recipe(base), result === void 0 && (result = base), result === NOTHING && (result = void 0), this.autoFreeze_ && freeze(result, !0), patchListener) {
36504
36563
  const p = [], ip = [];
36505
- getPlugin("Patches").generateReplacementPatches_(base, result, p, ip), patchListener(p, ip);
36564
+ getPlugin(PluginPatches).generateReplacementPatches_(base, result, {
36565
+ patches_: p,
36566
+ inversePatches_: ip
36567
+ }), patchListener(p, ip);
36506
36568
  }
36507
36569
  return result;
36508
36570
  } else
36509
36571
  die(1, base);
36510
36572
  }, this.produceWithPatches = (base, recipe) => {
36511
- if (typeof base == "function")
36573
+ if (isFunction(base))
36512
36574
  return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
36513
36575
  let patches, inversePatches;
36514
36576
  return [this.produce(base, recipe, (p, ip) => {
36515
36577
  patches = p, inversePatches = ip;
36516
36578
  }), 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);
36579
+ }, isBoolean(config2?.autoFreeze) && this.setAutoFreeze(config2.autoFreeze), isBoolean(config2?.useStrictShallowCopy) && this.setUseStrictShallowCopy(config2.useStrictShallowCopy), isBoolean(config2?.useStrictIteration) && this.setUseStrictIteration(config2.useStrictIteration);
36518
36580
  }
36519
36581
  createDraft(base) {
36520
36582
  isDraftable(base) || die(8), isDraft(base) && (base = current(base));
36521
- const scope = enterScope(this), proxy = createProxy(base, void 0);
36583
+ const scope = enterScope(this), proxy = createProxy(scope, base, void 0);
36522
36584
  return proxy[DRAFT_STATE].isManual_ = !0, leaveScope(scope), proxy;
36523
36585
  }
36524
36586
  finishDraft(draft, patchListener) {
@@ -36565,16 +36627,20 @@ var Immer2 = class {
36565
36627
  }
36566
36628
  }
36567
36629
  i2 > -1 && (patches = patches.slice(i2 + 1));
36568
- const applyPatchesImpl = getPlugin("Patches").applyPatches_;
36630
+ const applyPatchesImpl = getPlugin(PluginPatches).applyPatches_;
36569
36631
  return isDraft(base) ? applyPatchesImpl(base, patches) : this.produce(
36570
36632
  base,
36571
36633
  (draft) => applyPatchesImpl(draft, patches)
36572
36634
  );
36573
36635
  }
36574
36636
  };
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;
36637
+ function createProxy(rootScope, value, parent, key) {
36638
+ const [draft, state] = isMap(value) ? getPlugin(PluginMapSet).proxyMap_(value, parent) : isSet(value) ? getPlugin(PluginMapSet).proxySet_(value, parent) : createProxyProxy(value, parent);
36639
+ 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) {
36640
+ rootScope2.mapSetPlugin_?.fixSetContents(state);
36641
+ const { patchPlugin_ } = rootScope2;
36642
+ state.modified_ && patchPlugin_ && patchPlugin_.generatePatches_(state, [], rootScope2);
36643
+ }), draft;
36578
36644
  }
36579
36645
  function current(value) {
36580
36646
  return isDraft(value) || die(10, value), currentImpl(value);
@@ -36598,10 +36664,7 @@ function currentImpl(value) {
36598
36664
  strict
36599
36665
  ), state && (state.finalized_ = !1), copy;
36600
36666
  }
36601
- var immer = new Immer2(), produce = immer.produce, setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer);
36602
- function castDraft(value) {
36603
- return value;
36604
- }
36667
+ var immer = new Immer2(), produce = immer.produce, setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer), castDraft = (value) => value;
36605
36668
  const Channel = {
36606
36669
  /* CLAMP */
36607
36670
  min: {
@@ -41177,8 +41240,8 @@ export {
41177
41240
  TabsPanel as bR,
41178
41241
  ScrollArea as bS,
41179
41242
  useCallbackRef as bT,
41180
- e$8 as bU,
41181
- animate as bV,
41243
+ animate as bU,
41244
+ e$8 as bV,
41182
41245
  VisuallyHidden as bW,
41183
41246
  n$p as bX,
41184
41247
  useWindowEvent as bY,