@layers-app/shared 0.1.1 → 0.1.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.
@@ -14,7 +14,7 @@ import queryString from "query-string";
14
14
  import { useForm, useField } from "@mantine/form";
15
15
  import { Dropzone, IMAGE_MIME_TYPE } from "@mantine/dropzone";
16
16
  import { showNotification } from "@mantine/notifications";
17
- import { isFunction as isFunction$4, isObject as isObject$3, isString as isString$1, isNil, groupBy, isNumber as isNumber$1, clamp, assignWith, get as get$2, round as round$6, chunk, set as set$1, isArray as isArray$1, xor, mergeWith, isEqual as isEqual$1 } from "lodash-es";
17
+ import { isFunction as isFunction$5, isObject as isObject$3, isString as isString$1, isNil, groupBy, isNumber as isNumber$1, clamp, assignWith, get as get$2, round as round$6, chunk, set as set$1, isArray as isArray$2, xor, mergeWith, isEqual as isEqual$1 } from "lodash-es";
18
18
  import * as ReactDOM from "react-dom";
19
19
  import ReactDOM__default, { flushSync, createPortal, unstable_batchedUpdates } from "react-dom";
20
20
  import { useEvent as useEvent$2, useDraggable as useDraggable$1 } from "draggable-ui";
@@ -625,7 +625,7 @@ const showRequestNotifications = (request, options = {}) => {
625
625
  const { successMsg, errorMsg } = options;
626
626
  return request.then((res) => {
627
627
  if (successMsg) {
628
- const message2 = isFunction$4(successMsg) ? successMsg(res) : successMsg;
628
+ const message2 = isFunction$5(successMsg) ? successMsg(res) : successMsg;
629
629
  const notifyOpts = {
630
630
  id: options.notifyId,
631
631
  ...isObject$3(message2) ? message2 : { message: message2 }
@@ -635,7 +635,7 @@ const showRequestNotifications = (request, options = {}) => {
635
635
  return res;
636
636
  }).catch((err) => {
637
637
  if (errorMsg) {
638
- const message2 = isFunction$4(errorMsg) ? errorMsg(err) : errorMsg;
638
+ const message2 = isFunction$5(errorMsg) ? errorMsg(err) : errorMsg;
639
639
  const notifyOpts = {
640
640
  id: options.notifyId,
641
641
  ...isObject$3(message2) ? message2 : { message: message2 }
@@ -766,6 +766,7 @@ const FilePicker = ({
766
766
  popoverProps,
767
767
  dropZoneProps,
768
768
  targetProps,
769
+ onOpenedChange,
769
770
  locales = {
770
771
  gallery: "Gallery",
771
772
  link: "Link",
@@ -876,6 +877,10 @@ const FilePicker = ({
876
877
  }
877
878
  );
878
879
  }, [locales, isMobile2]);
880
+ const handleOpenedChange = (newOpened) => {
881
+ setOpened(newOpened);
882
+ onOpenedChange == null ? void 0 : onOpenedChange(newOpened);
883
+ };
879
884
  return /* @__PURE__ */ jsxs(
880
885
  Popover,
881
886
  {
@@ -883,11 +888,11 @@ const FilePicker = ({
883
888
  position: position2,
884
889
  shadow: "md",
885
890
  opened,
886
- onChange: setOpened,
891
+ onChange: handleOpenedChange,
887
892
  withinPortal: true,
888
893
  ...popoverProps || {},
889
894
  children: [
890
- /* @__PURE__ */ jsx$1(Popover.Target, { children: /* @__PURE__ */ jsx$1(Flex, { onClick: () => setOpened((o) => !o), ...targetProps, children: children ?? targetButton }) }),
895
+ /* @__PURE__ */ jsx$1(Popover.Target, { children: /* @__PURE__ */ jsx$1(Flex, { onClick: () => handleOpenedChange(!opened), ...targetProps, children: children ?? targetButton }) }),
891
896
  /* @__PURE__ */ jsxs(Popover.Dropdown, { children: [
892
897
  /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", mb: 12, children: [
893
898
  /* @__PURE__ */ jsx$1(
@@ -1416,7 +1421,7 @@ const getFirstChar = (value) => {
1416
1421
  var _a;
1417
1422
  return String.fromCodePoint(((_a = value == null ? void 0 : value.trim()) == null ? void 0 : _a.codePointAt(0)) ?? 1);
1418
1423
  };
1419
- function isArray(value) {
1424
+ function isArray$1(value) {
1420
1425
  return !Array.isArray ? getTag(value) === "[object Array]" : Array.isArray(value);
1421
1426
  }
1422
1427
  function baseToString(value) {
@@ -1435,7 +1440,7 @@ function isString(value) {
1435
1440
  function isNumber(value) {
1436
1441
  return typeof value === "number";
1437
1442
  }
1438
- function isBoolean(value) {
1443
+ function isBoolean$1(value) {
1439
1444
  return value === true || value === false || isObjectLike(value) && getTag(value) == "[object Boolean]";
1440
1445
  }
1441
1446
  function isObject$2(value) {
@@ -1490,7 +1495,7 @@ function createKey(key2) {
1490
1495
  let src = null;
1491
1496
  let weight = 1;
1492
1497
  let getFn = null;
1493
- if (isString(key2) || isArray(key2)) {
1498
+ if (isString(key2) || isArray$1(key2)) {
1494
1499
  src = key2;
1495
1500
  path = createKeyPath(key2);
1496
1501
  id = createKeyId(key2);
@@ -1513,10 +1518,10 @@ function createKey(key2) {
1513
1518
  return { path, id, weight, src, getFn };
1514
1519
  }
1515
1520
  function createKeyPath(key2) {
1516
- return isArray(key2) ? key2 : key2.split(".");
1521
+ return isArray$1(key2) ? key2 : key2.split(".");
1517
1522
  }
1518
1523
  function createKeyId(key2) {
1519
- return isArray(key2) ? key2.join(".") : key2;
1524
+ return isArray$1(key2) ? key2.join(".") : key2;
1520
1525
  }
1521
1526
  function get$1(obj, path) {
1522
1527
  let list = [];
@@ -1533,9 +1538,9 @@ function get$1(obj, path) {
1533
1538
  if (!isDefined(value)) {
1534
1539
  return;
1535
1540
  }
1536
- if (index2 === path2.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) {
1541
+ if (index2 === path2.length - 1 && (isString(value) || isNumber(value) || isBoolean$1(value))) {
1537
1542
  list.push(toString(value));
1538
- } else if (isArray(value)) {
1543
+ } else if (isArray$1(value)) {
1539
1544
  arr = true;
1540
1545
  for (let i = 0, len = value.length; i < len; i += 1) {
1541
1546
  deepGet(value[i], path2, index2 + 1);
@@ -1709,7 +1714,7 @@ class FuseIndex {
1709
1714
  if (!isDefined(value)) {
1710
1715
  return;
1711
1716
  }
1712
- if (isArray(value)) {
1717
+ if (isArray$1(value)) {
1713
1718
  let subRecords = [];
1714
1719
  const stack = [{ nestedArrIndex: -1, value }];
1715
1720
  while (stack.length) {
@@ -1724,7 +1729,7 @@ class FuseIndex {
1724
1729
  n: this.norm.get(value2)
1725
1730
  };
1726
1731
  subRecords.push(subRecord);
1727
- } else if (isArray(value2)) {
1732
+ } else if (isArray$1(value2)) {
1728
1733
  value2.forEach((item2, k2) => {
1729
1734
  stack.push({
1730
1735
  nestedArrIndex: k2,
@@ -2416,7 +2421,7 @@ const KeyType = {
2416
2421
  };
2417
2422
  const isExpression = (query) => !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);
2418
2423
  const isPath = (query) => !!query[KeyType.PATH];
2419
- const isLeaf = (query) => !isArray(query) && isObject$2(query) && !isExpression(query);
2424
+ const isLeaf = (query) => !isArray$1(query) && isObject$2(query) && !isExpression(query);
2420
2425
  const convertToExplicit = (query) => ({
2421
2426
  [LogicalOperator.AND]: Object.keys(query).map((key2) => ({
2422
2427
  [key2]: query[key2]
@@ -2450,7 +2455,7 @@ function parse$2(query, options, { auto = true } = {}) {
2450
2455
  };
2451
2456
  keys.forEach((key2) => {
2452
2457
  const value = query2[key2];
2453
- if (isArray(value)) {
2458
+ if (isArray$1(value)) {
2454
2459
  value.forEach((item2) => {
2455
2460
  node2.children.push(next2(item2));
2456
2461
  });
@@ -2693,7 +2698,7 @@ class Fuse {
2693
2698
  return [];
2694
2699
  }
2695
2700
  let matches2 = [];
2696
- if (isArray(value)) {
2701
+ if (isArray$1(value)) {
2697
2702
  value.forEach(({ v: text, i: idx, n: norm2 }) => {
2698
2703
  if (!isDefined(text)) {
2699
2704
  return;
@@ -27011,35 +27016,40 @@ var errors = process.env.NODE_ENV !== "production" ? [
27011
27016
  function die(error, ...args) {
27012
27017
  if (process.env.NODE_ENV !== "production") {
27013
27018
  const e = errors[error];
27014
- const msg = typeof e === "function" ? e.apply(null, args) : e;
27019
+ const msg = isFunction$4(e) ? e.apply(null, args) : e;
27015
27020
  throw new Error(`[Immer] ${msg}`);
27016
27021
  }
27017
27022
  throw new Error(
27018
27023
  `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
27019
27024
  );
27020
27025
  }
27021
- var getPrototypeOf = Object.getPrototypeOf;
27022
- function isDraft(value) {
27023
- return !!value && !!value[DRAFT_STATE];
27024
- }
27026
+ var O$1 = Object;
27027
+ var getPrototypeOf = O$1.getPrototypeOf;
27028
+ var CONSTRUCTOR = "constructor";
27029
+ var PROTOTYPE = "prototype";
27030
+ var CONFIGURABLE = "configurable";
27031
+ var ENUMERABLE = "enumerable";
27032
+ var WRITABLE = "writable";
27033
+ var VALUE = "value";
27034
+ var isDraft = (value) => !!value && !!value[DRAFT_STATE];
27025
27035
  function isDraftable(value) {
27026
27036
  var _a;
27027
27037
  if (!value)
27028
27038
  return false;
27029
- return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!((_a = value.constructor) == null ? void 0 : _a[DRAFTABLE]) || isMap(value) || isSet(value);
27039
+ return isPlainObject(value) || isArray(value) || !!value[DRAFTABLE] || !!((_a = value[CONSTRUCTOR]) == null ? void 0 : _a[DRAFTABLE]) || isMap(value) || isSet(value);
27030
27040
  }
27031
- var objectCtorString = Object.prototype.constructor.toString();
27041
+ var objectCtorString = O$1[PROTOTYPE][CONSTRUCTOR].toString();
27032
27042
  var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
27033
27043
  function isPlainObject(value) {
27034
- if (!value || typeof value !== "object")
27044
+ if (!value || !isObjectish(value))
27035
27045
  return false;
27036
- const proto = Object.getPrototypeOf(value);
27037
- if (proto === null || proto === Object.prototype)
27046
+ const proto = getPrototypeOf(value);
27047
+ if (proto === null || proto === O$1[PROTOTYPE])
27038
27048
  return true;
27039
- const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
27049
+ const Ctor = O$1.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
27040
27050
  if (Ctor === Object)
27041
27051
  return true;
27042
- if (typeof Ctor !== "function")
27052
+ if (!isFunction$4(Ctor))
27043
27053
  return false;
27044
27054
  let ctorString = cachedCtorStrings.get(Ctor);
27045
27055
  if (ctorString === void 0) {
@@ -27055,7 +27065,7 @@ function original(value) {
27055
27065
  }
27056
27066
  function each$1(obj, iter, strict = true) {
27057
27067
  if (getArchtype(obj) === 0) {
27058
- const keys = strict ? Reflect.ownKeys(obj) : Object.keys(obj);
27068
+ const keys = strict ? Reflect.ownKeys(obj) : O$1.keys(obj);
27059
27069
  keys.forEach((key2) => {
27060
27070
  iter(key2, obj[key2], obj);
27061
27071
  });
@@ -27065,23 +27075,21 @@ function each$1(obj, iter, strict = true) {
27065
27075
  }
27066
27076
  function getArchtype(thing) {
27067
27077
  const state = thing[DRAFT_STATE];
27068
- return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
27069
- }
27070
- function has$1(thing, prop) {
27071
- return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
27072
- }
27073
- function get(thing, prop) {
27074
- return getArchtype(thing) === 2 ? thing.get(prop) : thing[prop];
27078
+ return state ? state.type_ : isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
27075
27079
  }
27076
- function set(thing, propOrOldValue, value) {
27077
- const t = getArchtype(thing);
27078
- if (t === 2)
27080
+ var has$1 = (thing, prop, type2 = getArchtype(thing)) => type2 === 2 ? thing.has(prop) : O$1[PROTOTYPE].hasOwnProperty.call(thing, prop);
27081
+ var get = (thing, prop, type2 = getArchtype(thing)) => (
27082
+ // @ts-ignore
27083
+ type2 === 2 ? thing.get(prop) : thing[prop]
27084
+ );
27085
+ var set = (thing, propOrOldValue, value, type2 = getArchtype(thing)) => {
27086
+ if (type2 === 2)
27079
27087
  thing.set(propOrOldValue, value);
27080
- else if (t === 3) {
27088
+ else if (type2 === 3) {
27081
27089
  thing.add(value);
27082
27090
  } else
27083
27091
  thing[propOrOldValue] = value;
27084
- }
27092
+ };
27085
27093
  function is$2(x2, y2) {
27086
27094
  if (x2 === y2) {
27087
27095
  return x2 !== 0 || 1 / x2 === 1 / y2;
@@ -27089,15 +27097,19 @@ function is$2(x2, y2) {
27089
27097
  return x2 !== x2 && y2 !== y2;
27090
27098
  }
27091
27099
  }
27092
- function isMap(target) {
27093
- return target instanceof Map;
27094
- }
27095
- function isSet(target) {
27096
- return target instanceof Set;
27097
- }
27098
- function latest(state) {
27099
- return state.copy_ || state.base_;
27100
- }
27100
+ var isArray = Array.isArray;
27101
+ var isMap = (target) => target instanceof Map;
27102
+ var isSet = (target) => target instanceof Set;
27103
+ var isObjectish = (target) => typeof target === "object";
27104
+ var isFunction$4 = (target) => typeof target === "function";
27105
+ var isBoolean = (target) => typeof target === "boolean";
27106
+ var getProxyDraft = (value) => {
27107
+ if (!isObjectish(value))
27108
+ return null;
27109
+ return value == null ? void 0 : value[DRAFT_STATE];
27110
+ };
27111
+ var latest = (state) => state.copy_ || state.base_;
27112
+ var getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;
27101
27113
  function shallowCopy(base, strict) {
27102
27114
  if (isMap(base)) {
27103
27115
  return new Map(base);
@@ -27105,66 +27117,74 @@ function shallowCopy(base, strict) {
27105
27117
  if (isSet(base)) {
27106
27118
  return new Set(base);
27107
27119
  }
27108
- if (Array.isArray(base))
27109
- return Array.prototype.slice.call(base);
27120
+ if (isArray(base))
27121
+ return Array[PROTOTYPE].slice.call(base);
27110
27122
  const isPlain = isPlainObject(base);
27111
27123
  if (strict === true || strict === "class_only" && !isPlain) {
27112
- const descriptors = Object.getOwnPropertyDescriptors(base);
27124
+ const descriptors = O$1.getOwnPropertyDescriptors(base);
27113
27125
  delete descriptors[DRAFT_STATE];
27114
27126
  let keys = Reflect.ownKeys(descriptors);
27115
27127
  for (let i = 0; i < keys.length; i++) {
27116
27128
  const key2 = keys[i];
27117
27129
  const desc = descriptors[key2];
27118
- if (desc.writable === false) {
27119
- desc.writable = true;
27120
- desc.configurable = true;
27130
+ if (desc[WRITABLE] === false) {
27131
+ desc[WRITABLE] = true;
27132
+ desc[CONFIGURABLE] = true;
27121
27133
  }
27122
27134
  if (desc.get || desc.set)
27123
27135
  descriptors[key2] = {
27124
- configurable: true,
27125
- writable: true,
27136
+ [CONFIGURABLE]: true,
27137
+ [WRITABLE]: true,
27126
27138
  // could live with !!desc.set as well here...
27127
- enumerable: desc.enumerable,
27128
- value: base[key2]
27139
+ [ENUMERABLE]: desc[ENUMERABLE],
27140
+ [VALUE]: base[key2]
27129
27141
  };
27130
27142
  }
27131
- return Object.create(getPrototypeOf(base), descriptors);
27143
+ return O$1.create(getPrototypeOf(base), descriptors);
27132
27144
  } else {
27133
27145
  const proto = getPrototypeOf(base);
27134
27146
  if (proto !== null && isPlain) {
27135
27147
  return { ...base };
27136
27148
  }
27137
- const obj = Object.create(proto);
27138
- return Object.assign(obj, base);
27149
+ const obj = O$1.create(proto);
27150
+ return O$1.assign(obj, base);
27139
27151
  }
27140
27152
  }
27141
27153
  function freeze(obj, deep = false) {
27142
- if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))
27154
+ if (isFrozen(obj) || isDraft(obj))
27143
27155
  return obj;
27144
27156
  if (getArchtype(obj) > 1) {
27145
- Object.defineProperties(obj, {
27157
+ O$1.defineProperties(obj, {
27146
27158
  set: dontMutateMethodOverride,
27147
27159
  add: dontMutateMethodOverride,
27148
27160
  clear: dontMutateMethodOverride,
27149
27161
  delete: dontMutateMethodOverride
27150
27162
  });
27151
27163
  }
27152
- Object.freeze(obj);
27164
+ O$1.freeze(obj);
27153
27165
  if (deep)
27154
- Object.values(obj).forEach((value) => freeze(value, true));
27166
+ each$1(
27167
+ obj,
27168
+ (_key, value) => {
27169
+ freeze(value, true);
27170
+ },
27171
+ false
27172
+ );
27155
27173
  return obj;
27156
27174
  }
27157
27175
  function dontMutateFrozenCollections() {
27158
27176
  die(2);
27159
27177
  }
27160
27178
  var dontMutateMethodOverride = {
27161
- value: dontMutateFrozenCollections
27179
+ [VALUE]: dontMutateFrozenCollections
27162
27180
  };
27163
27181
  function isFrozen(obj) {
27164
- if (obj === null || typeof obj !== "object")
27182
+ if (obj === null || !isObjectish(obj))
27165
27183
  return true;
27166
- return Object.isFrozen(obj);
27184
+ return O$1.isFrozen(obj);
27167
27185
  }
27186
+ var PluginMapSet = "MapSet";
27187
+ var PluginPatches = "Patches";
27168
27188
  var plugins = {};
27169
27189
  function getPlugin(pluginKey) {
27170
27190
  const plugin = plugins[pluginKey];
@@ -27173,28 +27193,28 @@ function getPlugin(pluginKey) {
27173
27193
  }
27174
27194
  return plugin;
27175
27195
  }
27196
+ var isPluginLoaded = (pluginKey) => !!plugins[pluginKey];
27176
27197
  function loadPlugin(pluginKey, implementation) {
27177
27198
  if (!plugins[pluginKey])
27178
27199
  plugins[pluginKey] = implementation;
27179
27200
  }
27180
27201
  var currentScope;
27181
- function getCurrentScope() {
27182
- return currentScope;
27183
- }
27184
- function createScope(parent_, immer_) {
27185
- return {
27186
- drafts_: [],
27187
- parent_,
27188
- immer_,
27189
- // Whenever the modified draft contains a draft from another scope, we
27190
- // need to prevent auto-freezing so the unowned draft can be finalized.
27191
- canAutoFreeze_: true,
27192
- unfinalizedDrafts_: 0
27193
- };
27194
- }
27202
+ var getCurrentScope = () => currentScope;
27203
+ var createScope = (parent_, immer_) => ({
27204
+ drafts_: [],
27205
+ parent_,
27206
+ immer_,
27207
+ // Whenever the modified draft contains a draft from another scope, we
27208
+ // need to prevent auto-freezing so the unowned draft can be finalized.
27209
+ canAutoFreeze_: true,
27210
+ unfinalizedDrafts_: 0,
27211
+ handledSet_: /* @__PURE__ */ new Set(),
27212
+ processedForPatches_: /* @__PURE__ */ new Set(),
27213
+ mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0
27214
+ });
27195
27215
  function usePatchesInScope(scope, patchListener) {
27196
27216
  if (patchListener) {
27197
- getPlugin("Patches");
27217
+ scope.patchPlugin_ = getPlugin(PluginPatches);
27198
27218
  scope.patches_ = [];
27199
27219
  scope.inversePatches_ = [];
27200
27220
  scope.patchListener_ = patchListener;
@@ -27210,9 +27230,7 @@ function leaveScope(scope) {
27210
27230
  currentScope = scope.parent_;
27211
27231
  }
27212
27232
  }
27213
- function enterScope(immer2) {
27214
- return currentScope = createScope(currentScope, immer2);
27215
- }
27233
+ var enterScope = (immer2) => currentScope = createScope(currentScope, immer2);
27216
27234
  function revokeDraft(draft) {
27217
27235
  const state = draft[DRAFT_STATE];
27218
27236
  if (state.type_ === 0 || state.type_ === 1)
@@ -27231,127 +27249,166 @@ function processResult(result, scope) {
27231
27249
  }
27232
27250
  if (isDraftable(result)) {
27233
27251
  result = finalize(scope, result);
27234
- if (!scope.parent_)
27235
- maybeFreeze(scope, result);
27236
27252
  }
27237
- if (scope.patches_) {
27238
- getPlugin("Patches").generateReplacementPatches_(
27253
+ const { patchPlugin_ } = scope;
27254
+ if (patchPlugin_) {
27255
+ patchPlugin_.generateReplacementPatches_(
27239
27256
  baseDraft[DRAFT_STATE].base_,
27240
27257
  result,
27241
- scope.patches_,
27242
- scope.inversePatches_
27258
+ scope
27243
27259
  );
27244
27260
  }
27245
27261
  } else {
27246
- result = finalize(scope, baseDraft, []);
27262
+ result = finalize(scope, baseDraft);
27247
27263
  }
27264
+ maybeFreeze(scope, result, true);
27248
27265
  revokeScope(scope);
27249
27266
  if (scope.patches_) {
27250
27267
  scope.patchListener_(scope.patches_, scope.inversePatches_);
27251
27268
  }
27252
27269
  return result !== NOTHING ? result : void 0;
27253
27270
  }
27254
- function finalize(rootScope, value, path) {
27271
+ function finalize(rootScope, value) {
27255
27272
  if (isFrozen(value))
27256
27273
  return value;
27257
- const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
27258
27274
  const state = value[DRAFT_STATE];
27259
27275
  if (!state) {
27260
- each$1(
27261
- value,
27262
- (key2, childValue) => finalizeProperty(rootScope, state, value, key2, childValue, path),
27263
- useStrictIteration
27264
- );
27265
- return value;
27276
+ const finalValue = handleValue(value, rootScope.handledSet_, rootScope);
27277
+ return finalValue;
27266
27278
  }
27267
- if (state.scope_ !== rootScope)
27279
+ if (!isSameScope(state, rootScope)) {
27268
27280
  return value;
27281
+ }
27269
27282
  if (!state.modified_) {
27270
- maybeFreeze(rootScope, state.base_, true);
27271
27283
  return state.base_;
27272
27284
  }
27273
27285
  if (!state.finalized_) {
27274
- state.finalized_ = true;
27275
- state.scope_.unfinalizedDrafts_--;
27276
- const result = state.copy_;
27277
- let resultEach = result;
27278
- let isSet2 = false;
27279
- if (state.type_ === 3) {
27280
- resultEach = new Set(result);
27281
- result.clear();
27282
- isSet2 = true;
27283
- }
27284
- each$1(
27285
- resultEach,
27286
- (key2, childValue) => finalizeProperty(
27287
- rootScope,
27288
- state,
27289
- result,
27290
- key2,
27291
- childValue,
27292
- path,
27293
- isSet2
27294
- ),
27295
- useStrictIteration
27296
- );
27297
- maybeFreeze(rootScope, result, false);
27298
- if (path && rootScope.patches_) {
27299
- getPlugin("Patches").generatePatches_(
27300
- state,
27301
- path,
27302
- rootScope.patches_,
27303
- rootScope.inversePatches_
27304
- );
27286
+ const { callbacks_ } = state;
27287
+ if (callbacks_) {
27288
+ while (callbacks_.length > 0) {
27289
+ const callback = callbacks_.pop();
27290
+ callback(rootScope);
27291
+ }
27305
27292
  }
27293
+ generatePatchesAndFinalize(state, rootScope);
27306
27294
  }
27307
27295
  return state.copy_;
27308
27296
  }
27309
- function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
27310
- if (childValue == null) {
27311
- return;
27297
+ function maybeFreeze(scope, value, deep = false) {
27298
+ if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
27299
+ freeze(value, deep);
27312
27300
  }
27313
- if (typeof childValue !== "object" && !targetIsSet) {
27314
- return;
27301
+ }
27302
+ function markStateFinalized(state) {
27303
+ state.finalized_ = true;
27304
+ state.scope_.unfinalizedDrafts_--;
27305
+ }
27306
+ var isSameScope = (state, rootScope) => state.scope_ === rootScope;
27307
+ var EMPTY_LOCATIONS_RESULT = [];
27308
+ function updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {
27309
+ const parentCopy = latest(parent);
27310
+ const parentType = parent.type_;
27311
+ if (originalKey !== void 0) {
27312
+ const currentValue = get(parentCopy, originalKey, parentType);
27313
+ if (currentValue === draftValue) {
27314
+ set(parentCopy, originalKey, finalizedValue, parentType);
27315
+ return;
27316
+ }
27315
27317
  }
27316
- const childIsFrozen = isFrozen(childValue);
27317
- if (childIsFrozen && !targetIsSet) {
27318
- return;
27318
+ if (!parent.draftLocations_) {
27319
+ const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();
27320
+ each$1(parentCopy, (key2, value) => {
27321
+ if (isDraft(value)) {
27322
+ const keys = draftLocations.get(value) || [];
27323
+ keys.push(key2);
27324
+ draftLocations.set(value, keys);
27325
+ }
27326
+ });
27319
27327
  }
27320
- if (process.env.NODE_ENV !== "production" && childValue === targetObject)
27321
- die(5);
27322
- if (isDraft(childValue)) {
27323
- const path = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
27324
- !has$1(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
27325
- const res = finalize(rootScope, childValue, path);
27326
- set(targetObject, prop, res);
27327
- if (isDraft(res)) {
27328
- rootScope.canAutoFreeze_ = false;
27329
- } else
27330
- return;
27331
- } else if (targetIsSet) {
27332
- targetObject.add(childValue);
27328
+ const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;
27329
+ for (const location2 of locations) {
27330
+ set(parentCopy, location2, finalizedValue, parentType);
27333
27331
  }
27334
- if (isDraftable(childValue) && !childIsFrozen) {
27335
- if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
27332
+ }
27333
+ function registerChildFinalizationCallback(parent, child, key2) {
27334
+ parent.callbacks_.push(function childCleanup(rootScope) {
27335
+ var _a;
27336
+ const state = child;
27337
+ if (!state || !isSameScope(state, rootScope)) {
27336
27338
  return;
27337
27339
  }
27338
- if (parentState && parentState.base_ && parentState.base_[prop] === childValue && childIsFrozen) {
27339
- return;
27340
+ (_a = rootScope.mapSetPlugin_) == null ? void 0 : _a.fixSetContents(state);
27341
+ const finalizedValue = getFinalValue(state);
27342
+ updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key2);
27343
+ generatePatchesAndFinalize(state, rootScope);
27344
+ });
27345
+ }
27346
+ function generatePatchesAndFinalize(state, rootScope) {
27347
+ var _a;
27348
+ const shouldFinalize = state.modified_ && !state.finalized_ && (state.type_ === 3 || (((_a = state.assigned_) == null ? void 0 : _a.size) ?? 0) > 0);
27349
+ if (shouldFinalize) {
27350
+ const { patchPlugin_ } = rootScope;
27351
+ if (patchPlugin_) {
27352
+ const basePath = patchPlugin_.getPath(state);
27353
+ if (basePath) {
27354
+ patchPlugin_.generatePatches_(state, basePath, rootScope);
27355
+ }
27356
+ }
27357
+ markStateFinalized(state);
27358
+ }
27359
+ }
27360
+ function handleCrossReference(target, key2, value) {
27361
+ const { scope_ } = target;
27362
+ if (isDraft(value)) {
27363
+ const state = value[DRAFT_STATE];
27364
+ if (isSameScope(state, scope_)) {
27365
+ state.callbacks_.push(function crossReferenceCleanup() {
27366
+ prepareCopy(target);
27367
+ const finalizedValue = getFinalValue(state);
27368
+ updateDraftInParent(target, value, finalizedValue, key2);
27369
+ });
27340
27370
  }
27341
- finalize(rootScope, childValue);
27342
- if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && (isMap(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop)))
27343
- maybeFreeze(rootScope, childValue);
27371
+ } else if (isDraftable(value)) {
27372
+ target.callbacks_.push(function nestedDraftCleanup() {
27373
+ const targetCopy = latest(target);
27374
+ if (get(targetCopy, key2, target.type_) === value) {
27375
+ if (scope_.drafts_.length > 1 && (target.assigned_.get(key2) ?? false) === true && target.copy_) {
27376
+ handleValue(
27377
+ get(target.copy_, key2, target.type_),
27378
+ scope_.handledSet_,
27379
+ scope_
27380
+ );
27381
+ }
27382
+ }
27383
+ });
27344
27384
  }
27345
27385
  }
27346
- function maybeFreeze(scope, value, deep = false) {
27347
- if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
27348
- freeze(value, deep);
27386
+ function handleValue(target, handledSet, rootScope) {
27387
+ if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
27388
+ return target;
27349
27389
  }
27390
+ if (isDraft(target) || handledSet.has(target) || !isDraftable(target) || isFrozen(target)) {
27391
+ return target;
27392
+ }
27393
+ handledSet.add(target);
27394
+ each$1(target, (key2, value) => {
27395
+ if (isDraft(value)) {
27396
+ const state = value[DRAFT_STATE];
27397
+ if (isSameScope(state, rootScope)) {
27398
+ const updatedValue = getFinalValue(state);
27399
+ set(target, key2, updatedValue, target.type_);
27400
+ markStateFinalized(state);
27401
+ }
27402
+ } else if (isDraftable(value)) {
27403
+ handleValue(value, handledSet, rootScope);
27404
+ }
27405
+ });
27406
+ return target;
27350
27407
  }
27351
27408
  function createProxyProxy(base, parent) {
27352
- const isArray2 = Array.isArray(base);
27409
+ const baseIsArray = isArray(base);
27353
27410
  const state = {
27354
- type_: isArray2 ? 1 : 0,
27411
+ type_: baseIsArray ? 1 : 0,
27355
27412
  // Track which produce call this is associated with.
27356
27413
  scope_: parent ? parent.scope_ : getCurrentScope(),
27357
27414
  // True for both shallow and deep changes.
@@ -27359,7 +27416,8 @@ function createProxyProxy(base, parent) {
27359
27416
  // Used during finalization.
27360
27417
  finalized_: false,
27361
27418
  // Track which properties have been assigned (true) or deleted (false).
27362
- assigned_: {},
27419
+ // actually instantiated in `prepareCopy()`
27420
+ assigned_: void 0,
27363
27421
  // The parent draft state.
27364
27422
  parent_: parent,
27365
27423
  // The base state.
@@ -27371,25 +27429,27 @@ function createProxyProxy(base, parent) {
27371
27429
  copy_: null,
27372
27430
  // Called by the `produce` function.
27373
27431
  revoke_: null,
27374
- isManual_: false
27432
+ isManual_: false,
27433
+ // `callbacks` actually gets assigned in `createProxy`
27434
+ callbacks_: void 0
27375
27435
  };
27376
27436
  let target = state;
27377
27437
  let traps = objectTraps;
27378
- if (isArray2) {
27438
+ if (baseIsArray) {
27379
27439
  target = [state];
27380
27440
  traps = arrayTraps;
27381
27441
  }
27382
27442
  const { revoke, proxy } = Proxy.revocable(target, traps);
27383
27443
  state.draft_ = proxy;
27384
27444
  state.revoke_ = revoke;
27385
- return proxy;
27445
+ return [proxy, state];
27386
27446
  }
27387
27447
  var objectTraps = {
27388
27448
  get(state, prop) {
27389
27449
  if (prop === DRAFT_STATE)
27390
27450
  return state;
27391
27451
  const source = latest(state);
27392
- if (!has$1(source, prop)) {
27452
+ if (!has$1(source, prop, state.type_)) {
27393
27453
  return readPropFromProto(state, source, prop);
27394
27454
  }
27395
27455
  const value = source[prop];
@@ -27398,7 +27458,9 @@ var objectTraps = {
27398
27458
  }
27399
27459
  if (value === peek$2(state.base_, prop)) {
27400
27460
  prepareCopy(state);
27401
- return state.copy_[prop] = createProxy(value, state);
27461
+ const childKey = state.type_ === 1 ? +prop : prop;
27462
+ const childDraft = createProxy(state.scope_, value, state, childKey);
27463
+ return state.copy_[childKey] = childDraft;
27402
27464
  }
27403
27465
  return value;
27404
27466
  },
@@ -27419,10 +27481,10 @@ var objectTraps = {
27419
27481
  const currentState = current2 == null ? void 0 : current2[DRAFT_STATE];
27420
27482
  if (currentState && currentState.base_ === value) {
27421
27483
  state.copy_[prop] = value;
27422
- state.assigned_[prop] = false;
27484
+ state.assigned_.set(prop, false);
27423
27485
  return true;
27424
27486
  }
27425
- if (is$2(value, current2) && (value !== void 0 || has$1(state.base_, prop)))
27487
+ if (is$2(value, current2) && (value !== void 0 || has$1(state.base_, prop, state.type_)))
27426
27488
  return true;
27427
27489
  prepareCopy(state);
27428
27490
  markChanged(state);
@@ -27432,16 +27494,17 @@ var objectTraps = {
27432
27494
  Number.isNaN(value) && Number.isNaN(state.copy_[prop]))
27433
27495
  return true;
27434
27496
  state.copy_[prop] = value;
27435
- state.assigned_[prop] = true;
27497
+ state.assigned_.set(prop, true);
27498
+ handleCrossReference(state, prop, value);
27436
27499
  return true;
27437
27500
  },
27438
27501
  deleteProperty(state, prop) {
27502
+ prepareCopy(state);
27439
27503
  if (peek$2(state.base_, prop) !== void 0 || prop in state.base_) {
27440
- state.assigned_[prop] = false;
27441
- prepareCopy(state);
27504
+ state.assigned_.set(prop, false);
27442
27505
  markChanged(state);
27443
27506
  } else {
27444
- delete state.assigned_[prop];
27507
+ state.assigned_.delete(prop);
27445
27508
  }
27446
27509
  if (state.copy_) {
27447
27510
  delete state.copy_[prop];
@@ -27456,10 +27519,10 @@ var objectTraps = {
27456
27519
  if (!desc)
27457
27520
  return desc;
27458
27521
  return {
27459
- writable: true,
27460
- configurable: state.type_ !== 1 || prop !== "length",
27461
- enumerable: desc.enumerable,
27462
- value: owner[prop]
27522
+ [WRITABLE]: true,
27523
+ [CONFIGURABLE]: state.type_ !== 1 || prop !== "length",
27524
+ [ENUMERABLE]: desc[ENUMERABLE],
27525
+ [VALUE]: owner[prop]
27463
27526
  };
27464
27527
  },
27465
27528
  defineProperty() {
@@ -27475,8 +27538,9 @@ var objectTraps = {
27475
27538
  var arrayTraps = {};
27476
27539
  each$1(objectTraps, (key2, fn) => {
27477
27540
  arrayTraps[key2] = function() {
27478
- arguments[0] = arguments[0][0];
27479
- return fn.apply(this, arguments);
27541
+ const args = arguments;
27542
+ args[0] = args[0][0];
27543
+ return fn.apply(this, args);
27480
27544
  };
27481
27545
  });
27482
27546
  arrayTraps.deleteProperty = function(state, prop) {
@@ -27497,7 +27561,7 @@ function peek$2(draft, prop) {
27497
27561
  function readPropFromProto(state, source, prop) {
27498
27562
  var _a;
27499
27563
  const desc = getDescriptorFromProto(source, prop);
27500
- return desc ? `value` in desc ? desc.value : (
27564
+ return desc ? VALUE in desc ? desc[VALUE] : (
27501
27565
  // This is a very special case, if the prop is a getter defined by the
27502
27566
  // prototype, we should invoke it with the draft as context!
27503
27567
  (_a = desc.get) == null ? void 0 : _a.call(state.draft_)
@@ -27525,6 +27589,7 @@ function markChanged(state) {
27525
27589
  }
27526
27590
  function prepareCopy(state) {
27527
27591
  if (!state.copy_) {
27592
+ state.assigned_ = /* @__PURE__ */ new Map();
27528
27593
  state.copy_ = shallowCopy(
27529
27594
  state.base_,
27530
27595
  state.scope_.immer_.useStrictShallowCopy_
@@ -27535,9 +27600,9 @@ var Immer2 = class {
27535
27600
  constructor(config) {
27536
27601
  this.autoFreeze_ = true;
27537
27602
  this.useStrictShallowCopy_ = false;
27538
- this.useStrictIteration_ = true;
27603
+ this.useStrictIteration_ = false;
27539
27604
  this.produce = (base, recipe, patchListener) => {
27540
- if (typeof base === "function" && typeof recipe !== "function") {
27605
+ if (isFunction$4(base) && !isFunction$4(recipe)) {
27541
27606
  const defaultBase = recipe;
27542
27607
  recipe = base;
27543
27608
  const self2 = this;
@@ -27545,14 +27610,14 @@ var Immer2 = class {
27545
27610
  return self2.produce(base2, (draft) => recipe.call(this, draft, ...args));
27546
27611
  };
27547
27612
  }
27548
- if (typeof recipe !== "function")
27613
+ if (!isFunction$4(recipe))
27549
27614
  die(6);
27550
- if (patchListener !== void 0 && typeof patchListener !== "function")
27615
+ if (patchListener !== void 0 && !isFunction$4(patchListener))
27551
27616
  die(7);
27552
27617
  let result;
27553
27618
  if (isDraftable(base)) {
27554
27619
  const scope = enterScope(this);
27555
- const proxy = createProxy(base, void 0);
27620
+ const proxy = createProxy(scope, base, void 0);
27556
27621
  let hasError = true;
27557
27622
  try {
27558
27623
  result = recipe(proxy);
@@ -27565,7 +27630,7 @@ var Immer2 = class {
27565
27630
  }
27566
27631
  usePatchesInScope(scope, patchListener);
27567
27632
  return processResult(result, scope);
27568
- } else if (!base || typeof base !== "object") {
27633
+ } else if (!base || !isObjectish(base)) {
27569
27634
  result = recipe(base);
27570
27635
  if (result === void 0)
27571
27636
  result = base;
@@ -27576,7 +27641,10 @@ var Immer2 = class {
27576
27641
  if (patchListener) {
27577
27642
  const p = [];
27578
27643
  const ip = [];
27579
- getPlugin("Patches").generateReplacementPatches_(base, result, p, ip);
27644
+ getPlugin(PluginPatches).generateReplacementPatches_(base, result, {
27645
+ patches_: p,
27646
+ inversePatches_: ip
27647
+ });
27580
27648
  patchListener(p, ip);
27581
27649
  }
27582
27650
  return result;
@@ -27584,7 +27652,7 @@ var Immer2 = class {
27584
27652
  die(1, base);
27585
27653
  };
27586
27654
  this.produceWithPatches = (base, recipe) => {
27587
- if (typeof base === "function") {
27655
+ if (isFunction$4(base)) {
27588
27656
  return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
27589
27657
  }
27590
27658
  let patches, inversePatches;
@@ -27594,11 +27662,11 @@ var Immer2 = class {
27594
27662
  });
27595
27663
  return [result, patches, inversePatches];
27596
27664
  };
27597
- if (typeof (config == null ? void 0 : config.autoFreeze) === "boolean")
27665
+ if (isBoolean(config == null ? void 0 : config.autoFreeze))
27598
27666
  this.setAutoFreeze(config.autoFreeze);
27599
- if (typeof (config == null ? void 0 : config.useStrictShallowCopy) === "boolean")
27667
+ if (isBoolean(config == null ? void 0 : config.useStrictShallowCopy))
27600
27668
  this.setUseStrictShallowCopy(config.useStrictShallowCopy);
27601
- if (typeof (config == null ? void 0 : config.useStrictIteration) === "boolean")
27669
+ if (isBoolean(config == null ? void 0 : config.useStrictIteration))
27602
27670
  this.setUseStrictIteration(config.useStrictIteration);
27603
27671
  }
27604
27672
  createDraft(base) {
@@ -27607,7 +27675,7 @@ var Immer2 = class {
27607
27675
  if (isDraft(base))
27608
27676
  base = current(base);
27609
27677
  const scope = enterScope(this);
27610
- const proxy = createProxy(base, void 0);
27678
+ const proxy = createProxy(scope, base, void 0);
27611
27679
  proxy[DRAFT_STATE].isManual_ = true;
27612
27680
  leaveScope(scope);
27613
27681
  return proxy;
@@ -27660,7 +27728,7 @@ var Immer2 = class {
27660
27728
  if (i > -1) {
27661
27729
  patches = patches.slice(i + 1);
27662
27730
  }
27663
- const applyPatchesImpl = getPlugin("Patches").applyPatches_;
27731
+ const applyPatchesImpl = getPlugin(PluginPatches).applyPatches_;
27664
27732
  if (isDraft(base)) {
27665
27733
  return applyPatchesImpl(base, patches);
27666
27734
  }
@@ -27670,10 +27738,24 @@ var Immer2 = class {
27670
27738
  );
27671
27739
  }
27672
27740
  };
27673
- function createProxy(value, parent) {
27674
- const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
27675
- const scope = parent ? parent.scope_ : getCurrentScope();
27741
+ function createProxy(rootScope, value, parent, key2) {
27742
+ const [draft, state] = isMap(value) ? getPlugin(PluginMapSet).proxyMap_(value, parent) : isSet(value) ? getPlugin(PluginMapSet).proxySet_(value, parent) : createProxyProxy(value, parent);
27743
+ const scope = (parent == null ? void 0 : parent.scope_) ?? getCurrentScope();
27676
27744
  scope.drafts_.push(draft);
27745
+ state.callbacks_ = (parent == null ? void 0 : parent.callbacks_) ?? [];
27746
+ state.key_ = key2;
27747
+ if (parent && key2 !== void 0) {
27748
+ registerChildFinalizationCallback(parent, state, key2);
27749
+ } else {
27750
+ state.callbacks_.push(function rootDraftCleanup(rootScope2) {
27751
+ var _a;
27752
+ (_a = rootScope2.mapSetPlugin_) == null ? void 0 : _a.fixSetContents(state);
27753
+ const { patchPlugin_ } = rootScope2;
27754
+ if (state.modified_ && patchPlugin_) {
27755
+ patchPlugin_.generatePatches_(state, [], rootScope2);
27756
+ }
27757
+ });
27758
+ }
27677
27759
  return draft;
27678
27760
  }
27679
27761
  function current(value) {
@@ -27722,27 +27804,86 @@ function enablePatches() {
27722
27804
  "Patching reserved attributes like __proto__, prototype and constructor is not allowed"
27723
27805
  );
27724
27806
  }
27807
+ function getPath(state, path = []) {
27808
+ if ("key_" in state && state.key_ !== void 0) {
27809
+ const parentCopy = state.parent_.copy_ ?? state.parent_.base_;
27810
+ const proxyDraft = getProxyDraft(get(parentCopy, state.key_));
27811
+ const valueAtKey = get(parentCopy, state.key_);
27812
+ if (valueAtKey === void 0) {
27813
+ return null;
27814
+ }
27815
+ if (valueAtKey !== state.draft_ && valueAtKey !== state.base_ && valueAtKey !== state.copy_) {
27816
+ return null;
27817
+ }
27818
+ if (proxyDraft != null && proxyDraft.base_ !== state.base_) {
27819
+ return null;
27820
+ }
27821
+ const isSet2 = state.parent_.type_ === 3;
27822
+ let key2;
27823
+ if (isSet2) {
27824
+ const setParent = state.parent_;
27825
+ key2 = Array.from(setParent.drafts_.keys()).indexOf(state.key_);
27826
+ } else {
27827
+ key2 = state.key_;
27828
+ }
27829
+ if (!(isSet2 && parentCopy.size > key2 || has$1(parentCopy, key2))) {
27830
+ return null;
27831
+ }
27832
+ path.push(key2);
27833
+ }
27834
+ if (state.parent_) {
27835
+ return getPath(state.parent_, path);
27836
+ }
27837
+ path.reverse();
27838
+ try {
27839
+ resolvePath(state.copy_, path);
27840
+ } catch (e) {
27841
+ return null;
27842
+ }
27843
+ return path;
27844
+ }
27845
+ function resolvePath(base, path) {
27846
+ let current2 = base;
27847
+ for (let i = 0; i < path.length - 1; i++) {
27848
+ const key2 = path[i];
27849
+ current2 = get(current2, key2);
27850
+ if (!isObjectish(current2) || current2 === null) {
27851
+ throw new Error(`Cannot resolve path at '${path.join("/")}'`);
27852
+ }
27853
+ }
27854
+ return current2;
27855
+ }
27725
27856
  const REPLACE = "replace";
27726
27857
  const ADD = "add";
27727
27858
  const REMOVE = "remove";
27728
- function generatePatches_(state, basePath, patches, inversePatches) {
27859
+ function generatePatches_(state, basePath, scope) {
27860
+ if (state.scope_.processedForPatches_.has(state)) {
27861
+ return;
27862
+ }
27863
+ state.scope_.processedForPatches_.add(state);
27864
+ const { patches_, inversePatches_ } = scope;
27729
27865
  switch (state.type_) {
27730
27866
  case 0:
27731
27867
  case 2:
27732
27868
  return generatePatchesFromAssigned(
27733
27869
  state,
27734
27870
  basePath,
27735
- patches,
27736
- inversePatches
27871
+ patches_,
27872
+ inversePatches_
27737
27873
  );
27738
27874
  case 1:
27739
- return generateArrayPatches(state, basePath, patches, inversePatches);
27875
+ return generateArrayPatches(
27876
+ state,
27877
+ basePath,
27878
+ patches_,
27879
+ inversePatches_
27880
+ );
27740
27881
  case 3:
27741
27882
  return generateSetPatches(
27742
27883
  state,
27743
27884
  basePath,
27744
- patches,
27745
- inversePatches
27885
+ patches_,
27886
+ inversePatches_
27746
27887
  );
27747
27888
  }
27748
27889
  }
@@ -27754,19 +27895,25 @@ function enablePatches() {
27754
27895
  [patches, inversePatches] = [inversePatches, patches];
27755
27896
  }
27756
27897
  for (let i = 0; i < base_.length; i++) {
27757
- if (assigned_[i] && copy_[i] !== base_[i]) {
27898
+ const copiedItem = copy_[i];
27899
+ const baseItem = base_[i];
27900
+ if ((assigned_ == null ? void 0 : assigned_.get(i.toString())) && copiedItem !== baseItem) {
27901
+ const childState = copiedItem == null ? void 0 : copiedItem[DRAFT_STATE];
27902
+ if (childState && childState.modified_) {
27903
+ continue;
27904
+ }
27758
27905
  const path = basePath.concat([i]);
27759
27906
  patches.push({
27760
27907
  op: REPLACE,
27761
27908
  path,
27762
27909
  // Need to maybe clone it, as it can in fact be the original value
27763
27910
  // due to the base/copy inversion at the start of this function
27764
- value: clonePatchValueIfNeeded(copy_[i])
27911
+ value: clonePatchValueIfNeeded(copiedItem)
27765
27912
  });
27766
27913
  inversePatches.push({
27767
27914
  op: REPLACE,
27768
27915
  path,
27769
- value: clonePatchValueIfNeeded(base_[i])
27916
+ value: clonePatchValueIfNeeded(baseItem)
27770
27917
  });
27771
27918
  }
27772
27919
  }
@@ -27789,15 +27936,17 @@ function enablePatches() {
27789
27936
  }
27790
27937
  }
27791
27938
  function generatePatchesFromAssigned(state, basePath, patches, inversePatches) {
27792
- const { base_, copy_ } = state;
27939
+ const { base_, copy_, type_ } = state;
27793
27940
  each$1(state.assigned_, (key2, assignedValue) => {
27794
- const origValue = get(base_, key2);
27795
- const value = get(copy_, key2);
27941
+ const origValue = get(base_, key2, type_);
27942
+ const value = get(copy_, key2, type_);
27796
27943
  const op = !assignedValue ? REMOVE : has$1(base_, key2) ? REPLACE : ADD;
27797
27944
  if (origValue === value && op === REPLACE)
27798
27945
  return;
27799
27946
  const path = basePath.concat(key2);
27800
- patches.push(op === REMOVE ? { op, path } : { op, path, value });
27947
+ patches.push(
27948
+ op === REMOVE ? { op, path } : { op, path, value: clonePatchValueIfNeeded(value) }
27949
+ );
27801
27950
  inversePatches.push(
27802
27951
  op === ADD ? { op: REMOVE, path } : op === REMOVE ? { op: ADD, path, value: clonePatchValueIfNeeded(origValue) } : { op: REPLACE, path, value: clonePatchValueIfNeeded(origValue) }
27803
27952
  );
@@ -27840,13 +27989,14 @@ function enablePatches() {
27840
27989
  i++;
27841
27990
  });
27842
27991
  }
27843
- function generateReplacementPatches_(baseValue, replacement, patches, inversePatches) {
27844
- patches.push({
27992
+ function generateReplacementPatches_(baseValue, replacement, scope) {
27993
+ const { patches_, inversePatches_ } = scope;
27994
+ patches_.push({
27845
27995
  op: REPLACE,
27846
27996
  path: [],
27847
27997
  value: replacement === NOTHING ? void 0 : replacement
27848
27998
  });
27849
- inversePatches.push({
27999
+ inversePatches_.push({
27850
28000
  op: REPLACE,
27851
28001
  path: [],
27852
28002
  value: baseValue
@@ -27862,12 +28012,12 @@ function enablePatches() {
27862
28012
  if (typeof p !== "string" && typeof p !== "number") {
27863
28013
  p = "" + p;
27864
28014
  }
27865
- if ((parentType === 0 || parentType === 1) && (p === "__proto__" || p === "constructor"))
28015
+ if ((parentType === 0 || parentType === 1) && (p === "__proto__" || p === CONSTRUCTOR))
27866
28016
  die(errorOffset + 3);
27867
- if (typeof base === "function" && p === "prototype")
28017
+ if (isFunction$4(base) && p === PROTOTYPE)
27868
28018
  die(errorOffset + 3);
27869
28019
  base = get(base, p);
27870
- if (typeof base !== "object")
28020
+ if (!isObjectish(base))
27871
28021
  die(errorOffset + 2, path.join("/"));
27872
28022
  }
27873
28023
  const type2 = getArchtype(base);
@@ -27914,7 +28064,7 @@ function enablePatches() {
27914
28064
  function deepClonePatchValue(obj) {
27915
28065
  if (!isDraftable(obj))
27916
28066
  return obj;
27917
- if (Array.isArray(obj))
28067
+ if (isArray(obj))
27918
28068
  return obj.map(deepClonePatchValue);
27919
28069
  if (isMap(obj))
27920
28070
  return new Map(
@@ -27935,10 +28085,11 @@ function enablePatches() {
27935
28085
  } else
27936
28086
  return obj;
27937
28087
  }
27938
- loadPlugin("Patches", {
28088
+ loadPlugin(PluginPatches, {
27939
28089
  applyPatches_,
27940
28090
  generatePatches_,
27941
- generateReplacementPatches_
28091
+ generateReplacementPatches_,
28092
+ getPath
27942
28093
  });
27943
28094
  }
27944
28095
  var immer = new Immer2();
@@ -27946,9 +28097,6 @@ var produce = immer.produce;
27946
28097
  var produceWithPatches = /* @__PURE__ */ immer.produceWithPatches.bind(
27947
28098
  immer
27948
28099
  );
27949
- var setUseStrictIteration = /* @__PURE__ */ immer.setUseStrictIteration.bind(
27950
- immer
27951
- );
27952
28100
  var applyPatches = /* @__PURE__ */ immer.applyPatches.bind(immer);
27953
28101
  var runIdentityFunctionCheck = (resultFunc, inputSelectorsResults, outputSelectorResult) => {
27954
28102
  if (inputSelectorsResults.length === 1 && inputSelectorsResults[0] === outputSelectorResult) {
@@ -28369,7 +28517,6 @@ function executeReducerBuilderCallback(builderCallback) {
28369
28517
  builderCallback(builder);
28370
28518
  return [actionsMap, actionMatchers, defaultCaseReducer];
28371
28519
  }
28372
- setUseStrictIteration(false);
28373
28520
  function isStateFunction(x2) {
28374
28521
  return typeof x2 === "function";
28375
28522
  }
@@ -29206,14 +29353,16 @@ You must add the middleware for RTK-Query to function correctly!`);
29206
29353
  } else {
29207
29354
  const {
29208
29355
  direction,
29209
- initialPageParam
29356
+ initialPageParam,
29357
+ refetchCachedPages
29210
29358
  } = rest;
29211
29359
  thunk = infiniteQueryThunk({
29212
29360
  ...commonThunkArgs,
29213
29361
  // Supply these even if undefined. This helps with a field existence
29214
29362
  // check over in `buildSlice.ts`
29215
29363
  direction,
29216
- initialPageParam
29364
+ initialPageParam,
29365
+ refetchCachedPages
29217
29366
  });
29218
29367
  }
29219
29368
  const selector = api.endpoints[endpointName].select(arg);
@@ -29252,9 +29401,10 @@ You must add the middleware for RTK-Query to function correctly!`);
29252
29401
  }
29253
29402
  return result.data;
29254
29403
  },
29255
- refetch: () => dispatch(queryAction(arg, {
29404
+ refetch: (options) => dispatch(queryAction(arg, {
29256
29405
  subscribe: false,
29257
- forceRefetch: true
29406
+ forceRefetch: true,
29407
+ ...options
29258
29408
  })),
29259
29409
  unsubscribe() {
29260
29410
  if (subscribe) dispatch(unsubscribeQueryResult({
@@ -29595,6 +29745,7 @@ function buildThunks({
29595
29745
  const {
29596
29746
  maxPages = Infinity
29597
29747
  } = infiniteQueryOptions;
29748
+ const refetchCachedPages = arg.refetchCachedPages ?? infiniteQueryOptions.refetchCachedPages ?? true;
29598
29749
  let result;
29599
29750
  const blankData = {
29600
29751
  pages: [],
@@ -29624,9 +29775,11 @@ function buildThunks({
29624
29775
  data: result.data.pages[0]
29625
29776
  };
29626
29777
  }
29627
- for (let i = 1; i < totalPages; i++) {
29628
- const param = getNextPageParam(infiniteQueryOptions, result.data, arg.originalArgs);
29629
- result = await fetchPage(result.data, param, maxPages);
29778
+ if (refetchCachedPages) {
29779
+ for (let i = 1; i < totalPages; i++) {
29780
+ const param = getNextPageParam(infiniteQueryOptions, result.data, arg.originalArgs);
29781
+ result = await fetchPage(result.data, param, maxPages);
29782
+ }
29630
29783
  }
29631
29784
  }
29632
29785
  finalQueryReturnValue = result;
@@ -31660,6 +31813,13 @@ function constructFrom(date, value) {
31660
31813
  function toDate$1(argument, context) {
31661
31814
  return constructFrom(context || argument, argument);
31662
31815
  }
31816
+ function addDays(date, amount, options) {
31817
+ const _date = toDate$1(date, options == null ? void 0 : options.in);
31818
+ if (isNaN(amount)) return constructFrom(date, NaN);
31819
+ if (!amount) return _date;
31820
+ _date.setDate(_date.getDate() + amount);
31821
+ return _date;
31822
+ }
31663
31823
  let defaultOptions$4 = {};
31664
31824
  function getDefaultOptions$1() {
31665
31825
  return defaultOptions$4;
@@ -33341,6 +33501,9 @@ function isSameWeek(laterDate, earlierDate, options) {
33341
33501
  );
33342
33502
  return +startOfWeek(laterDate_, options) === +startOfWeek(earlierDate_, options);
33343
33503
  }
33504
+ function subDays(date, amount, options) {
33505
+ return addDays(date, -amount, options);
33506
+ }
33344
33507
  function setDefaultOptions(options) {
33345
33508
  const result = {};
33346
33509
  const defaultOptions2 = getDefaultOptions$1();
@@ -43803,7 +43966,7 @@ const StatusesListBoard = () => {
43803
43966
  }
43804
43967
  ) });
43805
43968
  };
43806
- const KanbanLayout = lazy(() => import("./KanbanLayout-CV5xReRW.js"));
43969
+ const KanbanLayout = lazy(() => import("./KanbanLayout-BnHAvyHl.js"));
43807
43970
  const DifferentLayoutsBoard = () => {
43808
43971
  const { layoutView } = useOnboardingState();
43809
43972
  switch (layoutView) {
@@ -45701,291 +45864,6 @@ const AnimationWrapper = ({
45701
45864
  }) => {
45702
45865
  return /* @__PURE__ */ jsx$1(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx$1(motion.div, { ...animationProps, style: styles2, children }) });
45703
45866
  };
45704
- var dayjs_min$1 = { exports: {} };
45705
- var dayjs_min = dayjs_min$1.exports;
45706
- var hasRequiredDayjs_min;
45707
- function requireDayjs_min() {
45708
- if (hasRequiredDayjs_min) return dayjs_min$1.exports;
45709
- hasRequiredDayjs_min = 1;
45710
- (function(module, exports$1) {
45711
- !(function(t, e) {
45712
- module.exports = e();
45713
- })(dayjs_min, (function() {
45714
- var t = 1e3, e = 6e4, n = 36e5, r2 = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f2 = "quarter", h = "year", d = "date", l = "Invalid Date", $2 = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
45715
- var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
45716
- return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
45717
- } }, m2 = function(t2, e2, n2) {
45718
- var r3 = String(t2);
45719
- return !r3 || r3.length >= e2 ? t2 : "" + Array(e2 + 1 - r3.length).join(n2) + t2;
45720
- }, v2 = { s: m2, z: function(t2) {
45721
- var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r3 = Math.floor(n2 / 60), i2 = n2 % 60;
45722
- return (e2 <= 0 ? "+" : "-") + m2(r3, 2, "0") + ":" + m2(i2, 2, "0");
45723
- }, m: function t2(e2, n2) {
45724
- if (e2.date() < n2.date()) return -t2(n2, e2);
45725
- var r3 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r3, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r3 + (s2 ? -1 : 1), c);
45726
- return +(-(r3 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
45727
- }, a: function(t2) {
45728
- return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
45729
- }, p: function(t2) {
45730
- return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r2, Q: f2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
45731
- }, u: function(t2) {
45732
- return void 0 === t2;
45733
- } }, g2 = "en", D2 = {};
45734
- D2[g2] = M2;
45735
- var p = "$isDayjsObject", S2 = function(t2) {
45736
- return t2 instanceof _2 || !(!t2 || !t2[p]);
45737
- }, w2 = function t2(e2, n2, r3) {
45738
- var i2;
45739
- if (!e2) return g2;
45740
- if ("string" == typeof e2) {
45741
- var s2 = e2.toLowerCase();
45742
- D2[s2] && (i2 = s2), n2 && (D2[s2] = n2, i2 = s2);
45743
- var u2 = e2.split("-");
45744
- if (!i2 && u2.length > 1) return t2(u2[0]);
45745
- } else {
45746
- var a2 = e2.name;
45747
- D2[a2] = e2, i2 = a2;
45748
- }
45749
- return !r3 && i2 && (g2 = i2), i2 || !r3 && g2;
45750
- }, O2 = function(t2, e2) {
45751
- if (S2(t2)) return t2.clone();
45752
- var n2 = "object" == typeof e2 ? e2 : {};
45753
- return n2.date = t2, n2.args = arguments, new _2(n2);
45754
- }, b = v2;
45755
- b.l = w2, b.i = S2, b.w = function(t2, e2) {
45756
- return O2(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
45757
- };
45758
- var _2 = (function() {
45759
- function M3(t2) {
45760
- this.$L = w2(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
45761
- }
45762
- var m3 = M3.prototype;
45763
- return m3.parse = function(t2) {
45764
- this.$d = (function(t3) {
45765
- var e2 = t3.date, n2 = t3.utc;
45766
- if (null === e2) return /* @__PURE__ */ new Date(NaN);
45767
- if (b.u(e2)) return /* @__PURE__ */ new Date();
45768
- if (e2 instanceof Date) return new Date(e2);
45769
- if ("string" == typeof e2 && !/Z$/i.test(e2)) {
45770
- var r3 = e2.match($2);
45771
- if (r3) {
45772
- var i2 = r3[2] - 1 || 0, s2 = (r3[7] || "0").substring(0, 3);
45773
- return n2 ? new Date(Date.UTC(r3[1], i2, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s2)) : new Date(r3[1], i2, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s2);
45774
- }
45775
- }
45776
- return new Date(e2);
45777
- })(t2), this.init();
45778
- }, m3.init = function() {
45779
- var t2 = this.$d;
45780
- this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
45781
- }, m3.$utils = function() {
45782
- return b;
45783
- }, m3.isValid = function() {
45784
- return !(this.$d.toString() === l);
45785
- }, m3.isSame = function(t2, e2) {
45786
- var n2 = O2(t2);
45787
- return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
45788
- }, m3.isAfter = function(t2, e2) {
45789
- return O2(t2) < this.startOf(e2);
45790
- }, m3.isBefore = function(t2, e2) {
45791
- return this.endOf(e2) < O2(t2);
45792
- }, m3.$g = function(t2, e2, n2) {
45793
- return b.u(t2) ? this[e2] : this.set(n2, t2);
45794
- }, m3.unix = function() {
45795
- return Math.floor(this.valueOf() / 1e3);
45796
- }, m3.valueOf = function() {
45797
- return this.$d.getTime();
45798
- }, m3.startOf = function(t2, e2) {
45799
- var n2 = this, r3 = !!b.u(e2) || e2, f3 = b.p(t2), l2 = function(t3, e3) {
45800
- var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
45801
- return r3 ? i2 : i2.endOf(a);
45802
- }, $3 = function(t3, e3) {
45803
- return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
45804
- }, y3 = this.$W, M4 = this.$M, m4 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
45805
- switch (f3) {
45806
- case h:
45807
- return r3 ? l2(1, 0) : l2(31, 11);
45808
- case c:
45809
- return r3 ? l2(1, M4) : l2(0, M4 + 1);
45810
- case o:
45811
- var g3 = this.$locale().weekStart || 0, D3 = (y3 < g3 ? y3 + 7 : y3) - g3;
45812
- return l2(r3 ? m4 - D3 : m4 + (6 - D3), M4);
45813
- case a:
45814
- case d:
45815
- return $3(v3 + "Hours", 0);
45816
- case u:
45817
- return $3(v3 + "Minutes", 1);
45818
- case s:
45819
- return $3(v3 + "Seconds", 2);
45820
- case i:
45821
- return $3(v3 + "Milliseconds", 3);
45822
- default:
45823
- return this.clone();
45824
- }
45825
- }, m3.endOf = function(t2) {
45826
- return this.startOf(t2, false);
45827
- }, m3.$set = function(t2, e2) {
45828
- var n2, o2 = b.p(t2), f3 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f3 + "Date", n2[d] = f3 + "Date", n2[c] = f3 + "Month", n2[h] = f3 + "FullYear", n2[u] = f3 + "Hours", n2[s] = f3 + "Minutes", n2[i] = f3 + "Seconds", n2[r2] = f3 + "Milliseconds", n2)[o2], $3 = o2 === a ? this.$D + (e2 - this.$W) : e2;
45829
- if (o2 === c || o2 === h) {
45830
- var y3 = this.clone().set(d, 1);
45831
- y3.$d[l2]($3), y3.init(), this.$d = y3.set(d, Math.min(this.$D, y3.daysInMonth())).$d;
45832
- } else l2 && this.$d[l2]($3);
45833
- return this.init(), this;
45834
- }, m3.set = function(t2, e2) {
45835
- return this.clone().$set(t2, e2);
45836
- }, m3.get = function(t2) {
45837
- return this[b.p(t2)]();
45838
- }, m3.add = function(r3, f3) {
45839
- var d2, l2 = this;
45840
- r3 = Number(r3);
45841
- var $3 = b.p(f3), y3 = function(t2) {
45842
- var e2 = O2(l2);
45843
- return b.w(e2.date(e2.date() + Math.round(t2 * r3)), l2);
45844
- };
45845
- if ($3 === c) return this.set(c, this.$M + r3);
45846
- if ($3 === h) return this.set(h, this.$y + r3);
45847
- if ($3 === a) return y3(1);
45848
- if ($3 === o) return y3(7);
45849
- var M4 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$3] || 1, m4 = this.$d.getTime() + r3 * M4;
45850
- return b.w(m4, this);
45851
- }, m3.subtract = function(t2, e2) {
45852
- return this.add(-1 * t2, e2);
45853
- }, m3.format = function(t2) {
45854
- var e2 = this, n2 = this.$locale();
45855
- if (!this.isValid()) return n2.invalidDate || l;
45856
- var r3 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f3 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
45857
- return t3 && (t3[n3] || t3(e2, r3)) || i3[n3].slice(0, s3);
45858
- }, d2 = function(t3) {
45859
- return b.s(s2 % 12 || 12, t3, "0");
45860
- }, $3 = f3 || function(t3, e3, n3) {
45861
- var r4 = t3 < 12 ? "AM" : "PM";
45862
- return n3 ? r4.toLowerCase() : r4;
45863
- };
45864
- return r3.replace(y2, (function(t3, r4) {
45865
- return r4 || (function(t4) {
45866
- switch (t4) {
45867
- case "YY":
45868
- return String(e2.$y).slice(-2);
45869
- case "YYYY":
45870
- return b.s(e2.$y, 4, "0");
45871
- case "M":
45872
- return a2 + 1;
45873
- case "MM":
45874
- return b.s(a2 + 1, 2, "0");
45875
- case "MMM":
45876
- return h2(n2.monthsShort, a2, c2, 3);
45877
- case "MMMM":
45878
- return h2(c2, a2);
45879
- case "D":
45880
- return e2.$D;
45881
- case "DD":
45882
- return b.s(e2.$D, 2, "0");
45883
- case "d":
45884
- return String(e2.$W);
45885
- case "dd":
45886
- return h2(n2.weekdaysMin, e2.$W, o2, 2);
45887
- case "ddd":
45888
- return h2(n2.weekdaysShort, e2.$W, o2, 3);
45889
- case "dddd":
45890
- return o2[e2.$W];
45891
- case "H":
45892
- return String(s2);
45893
- case "HH":
45894
- return b.s(s2, 2, "0");
45895
- case "h":
45896
- return d2(1);
45897
- case "hh":
45898
- return d2(2);
45899
- case "a":
45900
- return $3(s2, u2, true);
45901
- case "A":
45902
- return $3(s2, u2, false);
45903
- case "m":
45904
- return String(u2);
45905
- case "mm":
45906
- return b.s(u2, 2, "0");
45907
- case "s":
45908
- return String(e2.$s);
45909
- case "ss":
45910
- return b.s(e2.$s, 2, "0");
45911
- case "SSS":
45912
- return b.s(e2.$ms, 3, "0");
45913
- case "Z":
45914
- return i2;
45915
- }
45916
- return null;
45917
- })(t3) || i2.replace(":", "");
45918
- }));
45919
- }, m3.utcOffset = function() {
45920
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
45921
- }, m3.diff = function(r3, d2, l2) {
45922
- var $3, y3 = this, M4 = b.p(d2), m4 = O2(r3), v3 = (m4.utcOffset() - this.utcOffset()) * e, g3 = this - m4, D3 = function() {
45923
- return b.m(y3, m4);
45924
- };
45925
- switch (M4) {
45926
- case h:
45927
- $3 = D3() / 12;
45928
- break;
45929
- case c:
45930
- $3 = D3();
45931
- break;
45932
- case f2:
45933
- $3 = D3() / 3;
45934
- break;
45935
- case o:
45936
- $3 = (g3 - v3) / 6048e5;
45937
- break;
45938
- case a:
45939
- $3 = (g3 - v3) / 864e5;
45940
- break;
45941
- case u:
45942
- $3 = g3 / n;
45943
- break;
45944
- case s:
45945
- $3 = g3 / e;
45946
- break;
45947
- case i:
45948
- $3 = g3 / t;
45949
- break;
45950
- default:
45951
- $3 = g3;
45952
- }
45953
- return l2 ? $3 : b.a($3);
45954
- }, m3.daysInMonth = function() {
45955
- return this.endOf(c).$D;
45956
- }, m3.$locale = function() {
45957
- return D2[this.$L];
45958
- }, m3.locale = function(t2, e2) {
45959
- if (!t2) return this.$L;
45960
- var n2 = this.clone(), r3 = w2(t2, e2, true);
45961
- return r3 && (n2.$L = r3), n2;
45962
- }, m3.clone = function() {
45963
- return b.w(this.$d, this);
45964
- }, m3.toDate = function() {
45965
- return new Date(this.valueOf());
45966
- }, m3.toJSON = function() {
45967
- return this.isValid() ? this.toISOString() : null;
45968
- }, m3.toISOString = function() {
45969
- return this.$d.toISOString();
45970
- }, m3.toString = function() {
45971
- return this.$d.toUTCString();
45972
- }, M3;
45973
- })(), k2 = _2.prototype;
45974
- return O2.prototype = k2, [["$ms", r2], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach((function(t2) {
45975
- k2[t2[1]] = function(e2) {
45976
- return this.$g(e2, t2[0], t2[1]);
45977
- };
45978
- })), O2.extend = function(t2, e2) {
45979
- return t2.$i || (t2(e2, _2, O2), t2.$i = true), O2;
45980
- }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t2) {
45981
- return O2(1e3 * t2);
45982
- }, O2.en = D2[g2], O2.Ls = D2, O2.p = {}, O2;
45983
- }));
45984
- })(dayjs_min$1);
45985
- return dayjs_min$1.exports;
45986
- }
45987
- var dayjs_minExports = requireDayjs_min();
45988
- const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
45989
45867
  const filterPill = "_filterPill_cfyaq_1";
45990
45868
  const filterPillLabel = "_filterPillLabel_cfyaq_9";
45991
45869
  const styles$f = {
@@ -46050,24 +45928,24 @@ const DateFilter = ({ setSelectedFilter, selectedFilter }) => {
46050
45928
  icon: /* @__PURE__ */ jsx$1(IconCalendarEvent, {}),
46051
45929
  text: t("searchModal.filters.date.today"),
46052
45930
  range: {
46053
- createdAtFrom: dayjs().startOf("day").valueOf(),
46054
- createdAtTo: dayjs().endOf("day").valueOf()
45931
+ createdAtFrom: startOfDay(/* @__PURE__ */ new Date()).getTime(),
45932
+ createdAtTo: endOfDay(/* @__PURE__ */ new Date()).getTime()
46055
45933
  }
46056
45934
  },
46057
45935
  {
46058
45936
  icon: /* @__PURE__ */ jsx$1(IconCalendarEvent, {}),
46059
45937
  text: t("searchModal.filters.date.last7day"),
46060
45938
  range: {
46061
- createdAtFrom: dayjs().subtract(7, "days").startOf("day").valueOf(),
46062
- createdAtTo: dayjs().endOf("day").valueOf()
45939
+ createdAtFrom: startOfDay(subDays(/* @__PURE__ */ new Date(), 7)).getTime(),
45940
+ createdAtTo: endOfDay(/* @__PURE__ */ new Date()).getTime()
46063
45941
  }
46064
45942
  },
46065
45943
  {
46066
45944
  icon: /* @__PURE__ */ jsx$1(IconCalendarEvent, {}),
46067
45945
  text: t("searchModal.filters.date.last30day"),
46068
45946
  range: {
46069
- createdAtFrom: dayjs().subtract(30, "days").startOf("day").valueOf(),
46070
- createdAtTo: dayjs().endOf("day").valueOf()
45947
+ createdAtFrom: startOfDay(subDays(/* @__PURE__ */ new Date(), 30)).getTime(),
45948
+ createdAtTo: endOfDay(/* @__PURE__ */ new Date()).getTime()
46071
45949
  }
46072
45950
  }
46073
45951
  ];
@@ -46094,7 +45972,7 @@ const DateFilter = ({ setSelectedFilter, selectedFilter }) => {
46094
45972
  radius: "lg",
46095
45973
  children: [
46096
45974
  /* @__PURE__ */ jsx$1(IconCalendarEvent, { size: 16 }),
46097
- dateValue[0] && dateValue[1] ? `${dayjs(dateValue[0]).format("DD MMM YYYY")} — ${dayjs(dateValue[1]).format("DD MMM YYYY")}` : t("searchModal.filters.date.title"),
45975
+ dateValue[0] && dateValue[1] ? `${format$1(dateValue[0], "dd MMM yyyy")} — ${format$1(dateValue[1], "dd MMM yyyy")}` : t("searchModal.filters.date.title"),
46098
45976
  /* @__PURE__ */ jsx$1(IconChevronDown, { size: 16 })
46099
45977
  ]
46100
45978
  }
@@ -83613,7 +83491,7 @@ const prepareColumns = (columns) => {
83613
83491
  };
83614
83492
  return [exportColumn];
83615
83493
  }
83616
- const exportColumns = isArray$1(exportSettings) ? exportSettings : [exportSettings];
83494
+ const exportColumns = isArray$2(exportSettings) ? exportSettings : [exportSettings];
83617
83495
  return exportColumns.map((exportCol, index2) => {
83618
83496
  const header2 = exportCol.header ?? (typeof col.header === "string" ? col.header : "");
83619
83497
  return {