@measured/puck 0.21.0-canary.6c44fdb9 → 0.21.0-canary.73b98fb4

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.
@@ -25,7 +25,7 @@ import {
25
25
  walkAppState,
26
26
  walkField,
27
27
  walkTree
28
- } from "./chunk-VBJEDLUM.mjs";
28
+ } from "./chunk-JA7SEUEH.mjs";
29
29
 
30
30
  // ../../node_modules/classnames/index.js
31
31
  var require_classnames = __commonJS({
@@ -1071,29 +1071,37 @@ var flattenData = (state, config) => {
1071
1071
 
1072
1072
  // store/slices/permissions.ts
1073
1073
  var createPermissionsSlice = (set, get) => {
1074
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
1074
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
1075
1075
  const { state, permissions, config } = get();
1076
1076
  const { cache, globalPermissions } = permissions;
1077
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
1078
- var _a, _b, _c;
1077
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
1078
+ var _a, _b;
1079
1079
  const { config: config2, state: appState, setComponentLoading } = get();
1080
+ const itemCache = cache[item2.props.id];
1081
+ const nodes = appState.indexes.nodes;
1082
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
1083
+ const parentNode = parentId ? nodes[parentId] : null;
1084
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
1080
1085
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
1081
1086
  if (!componentConfig) {
1082
1087
  return;
1083
1088
  }
1084
1089
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
1085
1090
  if (componentConfig.resolvePermissions) {
1086
- const changed = getChanged(item2, (_a = cache[item2.props.id]) == null ? void 0 : _a.lastData);
1087
- if (Object.values(changed).some((el) => el === true) || force2) {
1091
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
1092
+ const propsChanged = Object.values(changed).some((el) => el === true);
1093
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
1094
+ if (propsChanged || parentChanged || force2) {
1088
1095
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
1089
1096
  const resolvedPermissions = yield componentConfig.resolvePermissions(
1090
1097
  item2,
1091
1098
  {
1092
1099
  changed,
1093
- lastPermissions: ((_b = cache[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
1100
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
1094
1101
  permissions: initialPermissions,
1095
1102
  appState: makeStatePublic(appState),
1096
- lastData: ((_c = cache[item2.props.id]) == null ? void 0 : _c.lastData) || null
1103
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
1104
+ parent: parentData
1097
1105
  }
1098
1106
  );
1099
1107
  const latest = get().permissions;
@@ -1101,6 +1109,7 @@ var createPermissionsSlice = (set, get) => {
1101
1109
  permissions: __spreadProps(__spreadValues({}, latest), {
1102
1110
  cache: __spreadProps(__spreadValues({}, latest.cache), {
1103
1111
  [item2.props.id]: {
1112
+ lastParentId: parentId,
1104
1113
  lastData: item2,
1105
1114
  lastPermissions: resolvedPermissions
1106
1115
  }
@@ -1114,9 +1123,9 @@ var createPermissionsSlice = (set, get) => {
1114
1123
  }
1115
1124
  }
1116
1125
  });
1117
- const resolveDataForRoot = (force2 = false) => {
1126
+ const resolvePermissionsForRoot = (force2 = false) => {
1118
1127
  const { state: appState } = get();
1119
- resolveDataForItem(
1128
+ resolvePermissionsForItem(
1120
1129
  // Shim the root data in by conforming to component data shape
1121
1130
  {
1122
1131
  type: "root",
@@ -1127,16 +1136,16 @@ var createPermissionsSlice = (set, get) => {
1127
1136
  };
1128
1137
  const { item, type, root } = params;
1129
1138
  if (item) {
1130
- yield resolveDataForItem(item, force);
1139
+ yield resolvePermissionsForItem(item, force);
1131
1140
  } else if (type) {
1132
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
1133
- yield resolveDataForItem(item2, force);
1141
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
1142
+ yield resolvePermissionsForItem(item2, force);
1134
1143
  }));
1135
1144
  } else if (root) {
1136
- resolveDataForRoot(force);
1145
+ resolvePermissionsForRoot(force);
1137
1146
  } else {
1138
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
1139
- yield resolveDataForItem(item2, force);
1147
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
1148
+ yield resolvePermissionsForItem(item2, force);
1140
1149
  }));
1141
1150
  }
1142
1151
  });
@@ -1216,7 +1225,7 @@ var createFieldsSlice = (_set, _get) => {
1216
1225
  };
1217
1226
  var useRegisterFieldsSlice = (appStore, id) => {
1218
1227
  const resolveFields = useCallback(
1219
- (reset) => __async(void 0, null, function* () {
1228
+ (reset) => __async(null, null, function* () {
1220
1229
  var _a, _b;
1221
1230
  const { fields, lastResolvedData } = appStore.getState().fields;
1222
1231
  const metadata = appStore.getState().metadata;
@@ -1416,7 +1425,7 @@ var createAppStore = (initialAppStore) => create2()(
1416
1425
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
1417
1426
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1418
1427
  }),
1419
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
1428
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
1420
1429
  const { config, metadata, setComponentLoading, permissions } = get();
1421
1430
  const timeouts = {};
1422
1431
  return yield resolveComponentData(
@@ -1427,7 +1436,7 @@ var createAppStore = (initialAppStore) => create2()(
1427
1436
  const id = "id" in item.props ? item.props.id : "root";
1428
1437
  timeouts[id] = setComponentLoading(id, true, 50);
1429
1438
  },
1430
- (item) => __async(void 0, null, function* () {
1439
+ (item) => __async(null, null, function* () {
1431
1440
  const id = "id" in item.props ? item.props.id : "root";
1432
1441
  if ("type" in item) {
1433
1442
  yield permissions.refreshPermissions({ item });
@@ -1439,7 +1448,7 @@ var createAppStore = (initialAppStore) => create2()(
1439
1448
  trigger
1440
1449
  );
1441
1450
  }),
1442
- resolveAndCommitData: () => __async(void 0, null, function* () {
1451
+ resolveAndCommitData: () => __async(null, null, function* () {
1443
1452
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
1444
1453
  walkAppState(
1445
1454
  state,
@@ -2460,7 +2469,7 @@ var collisionStore = createStore(() => ({
2460
2469
 
2461
2470
  // lib/dnd/collision/dynamic/index.ts
2462
2471
  var flushNext = "";
2463
- var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
2472
+ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((input) => {
2464
2473
  var _a, _b, _c, _d, _e;
2465
2474
  const { dragOperation, droppable } = input;
2466
2475
  const { position } = dragOperation;
@@ -2553,7 +2562,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2553
2562
  }
2554
2563
  collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "hotpink");
2555
2564
  return null;
2556
- };
2565
+ });
2557
2566
 
2558
2567
  // components/Sortable/index.tsx
2559
2568
  import { useSortable } from "@dnd-kit/react/sortable";
@@ -3192,7 +3201,7 @@ var ExternalInput = ({
3192
3201
  }, [mappedData]);
3193
3202
  const [searchQuery, setSearchQuery] = useState6(field.initialQuery || "");
3194
3203
  const search = useCallback3(
3195
- (query, filters2) => __async(void 0, null, function* () {
3204
+ (query, filters2) => __async(null, null, function* () {
3196
3205
  setIsLoading(true);
3197
3206
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
3198
3207
  let listData;
@@ -3418,7 +3427,7 @@ var ExternalField = ({
3418
3427
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
3419
3428
  mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
3420
3429
  mapRow: validField.mapRow,
3421
- fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
3430
+ fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(null, null, function* () {
3422
3431
  return yield deprecatedField.adaptor.fetchList(
3423
3432
  deprecatedField.adaptorParams
3424
3433
  );
@@ -3794,6 +3803,7 @@ function AutoFieldInternal(props) {
3794
3803
  }
3795
3804
  return (_props) => null;
3796
3805
  }, [field.type]);
3806
+ const fieldKey = field.type === "custom" ? field.key : void 0;
3797
3807
  let FieldComponent = useMemo3(() => {
3798
3808
  if (field.type === "custom") {
3799
3809
  if (!field.render) {
@@ -3803,7 +3813,7 @@ function AutoFieldInternal(props) {
3803
3813
  } else if (field.type !== "slot") {
3804
3814
  return render[field.type];
3805
3815
  }
3806
- }, [field.type, render]);
3816
+ }, [field.type, fieldKey, render]);
3807
3817
  const { visible = true } = props.field;
3808
3818
  if (!visible) {
3809
3819
  return null;
@@ -4843,7 +4853,20 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
4843
4853
 
4844
4854
  // lib/insert-component.ts
4845
4855
  init_react_import();
4846
- var insertComponent = (componentType, zone, index, appStore) => __async(void 0, null, function* () {
4856
+
4857
+ // lib/get-selector-for-id.ts
4858
+ init_react_import();
4859
+ var getSelectorForId = (state, id) => {
4860
+ const node = state.indexes.nodes[id];
4861
+ if (!node) return;
4862
+ const zoneCompound = `${node.parentId}:${node.zone}`;
4863
+ const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
4864
+ return { zone: zoneCompound, index };
4865
+ };
4866
+
4867
+ // lib/insert-component.ts
4868
+ var insertComponent = (componentType, zone, index, appStore) => __async(null, null, function* () {
4869
+ const { getState } = appStore;
4847
4870
  const id = generateId(componentType);
4848
4871
  const insertActionData = {
4849
4872
  type: "insert",
@@ -4852,8 +4875,9 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
4852
4875
  destinationZone: zone,
4853
4876
  id
4854
4877
  };
4855
- const { state, dispatch, resolveComponentData: resolveComponentData2 } = appStore;
4856
- const insertedState = insertAction(state, insertActionData, appStore);
4878
+ const stateBefore = getState().state;
4879
+ const insertedState = insertAction(stateBefore, insertActionData, getState());
4880
+ const dispatch = getState().dispatch;
4857
4881
  dispatch(__spreadProps(__spreadValues({}, insertActionData), {
4858
4882
  // Dispatch insert rather set, as user's may rely on this via onAction
4859
4883
  // We must always record history here so the insert is added to user history
@@ -4861,23 +4885,21 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
4861
4885
  // entries on insert - one for the initial insert, and one when the data resolves
4862
4886
  recordHistory: true
4863
4887
  }));
4864
- const itemSelector = {
4865
- index,
4866
- zone
4867
- };
4888
+ const itemSelector = { index, zone };
4868
4889
  dispatch({ type: "setUi", ui: { itemSelector } });
4869
4890
  const itemData = getItem(itemSelector, insertedState);
4870
- if (itemData) {
4871
- const resolved = yield resolveComponentData2(itemData, "insert");
4872
- if (resolved.didChange) {
4873
- dispatch({
4874
- type: "replace",
4875
- destinationZone: itemSelector.zone,
4876
- destinationIndex: itemSelector.index,
4877
- data: resolved.node
4878
- });
4879
- }
4880
- }
4891
+ if (!itemData) return;
4892
+ const resolveComponentData2 = getState().resolveComponentData;
4893
+ const resolved = yield resolveComponentData2(itemData, "insert");
4894
+ if (!resolved.didChange) return;
4895
+ const latestItemSelector = getSelectorForId(getState().state, id);
4896
+ if (!latestItemSelector) return;
4897
+ dispatch({
4898
+ type: "replace",
4899
+ destinationZone: latestItemSelector.zone,
4900
+ destinationIndex: latestItemSelector.index,
4901
+ data: resolved.node
4902
+ });
4881
4903
  });
4882
4904
 
4883
4905
  // components/DragDropContext/index.tsx
@@ -5114,7 +5136,7 @@ var DragDropContextClient = ({
5114
5136
  thisPreview.componentType,
5115
5137
  thisPreview.zone,
5116
5138
  thisPreview.index,
5117
- appStore.getState()
5139
+ appStore
5118
5140
  );
5119
5141
  } else if (initialSelector.current) {
5120
5142
  dispatch({
@@ -5527,7 +5549,7 @@ import { useCallback as useCallback9 } from "react";
5527
5549
  function useRenderedCallback(callback, deps) {
5528
5550
  const manager = useDragDropManager();
5529
5551
  return useCallback9(
5530
- (...args) => __async(this, null, function* () {
5552
+ (...args) => __async(null, null, function* () {
5531
5553
  yield manager == null ? void 0 : manager.renderer.rendering;
5532
5554
  return callback(...args);
5533
5555
  }),
@@ -5756,16 +5778,6 @@ function setDeep(node, path, newVal) {
5756
5778
  return __spreadValues(__spreadValues({}, node), newNode);
5757
5779
  }
5758
5780
 
5759
- // lib/get-selector-for-id.ts
5760
- init_react_import();
5761
- var getSelectorForId = (state, id) => {
5762
- const node = state.indexes.nodes[id];
5763
- if (!node) return;
5764
- const zoneCompound = `${node.parentId}:${node.zone}`;
5765
- const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
5766
- return { zone: zoneCompound, index };
5767
- };
5768
-
5769
5781
  // components/InlineTextField/index.tsx
5770
5782
  import { jsx as jsx24 } from "react/jsx-runtime";
5771
5783
  var getClassName18 = get_class_name_factory_default("InlineTextField", styles_module_default13);
@@ -5794,7 +5806,7 @@ var InlineTextFieldInternal = ({
5794
5806
  ref.current.replaceChildren(value);
5795
5807
  }
5796
5808
  const cleanupPortal = registerOverlayPortal(ref.current);
5797
- const handleInput = (e) => __async(void 0, null, function* () {
5809
+ const handleInput = (e) => __async(null, null, function* () {
5798
5810
  var _a2;
5799
5811
  const appStore2 = appStoreApi.getState();
5800
5812
  const node = appStore2.state.indexes.nodes[componentId];
@@ -6086,7 +6098,8 @@ var DropZoneEdit = forwardRef3(
6086
6098
  style,
6087
6099
  className,
6088
6100
  minEmptyHeight: userMinEmptyHeight = 128,
6089
- collisionAxis
6101
+ collisionAxis,
6102
+ as
6090
6103
  }, userRef) {
6091
6104
  const ctx = useContext8(dropZoneContext);
6092
6105
  const appStoreApi = useAppStoreApi();
@@ -6229,8 +6242,9 @@ var DropZoneEdit = forwardRef3(
6229
6242
  userMinEmptyHeight,
6230
6243
  ref
6231
6244
  });
6245
+ const El = as != null ? as : "div";
6232
6246
  return /* @__PURE__ */ jsx26(
6233
- "div",
6247
+ El,
6234
6248
  {
6235
6249
  className: `${getClassName19({
6236
6250
  isRootZone,
@@ -6293,7 +6307,7 @@ var DropZoneRenderItem = ({
6293
6307
  };
6294
6308
  var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx26(DropZoneRender, __spreadValues({}, props));
6295
6309
  var DropZoneRender = forwardRef3(
6296
- function DropZoneRenderInternal({ className, style, zone }, ref) {
6310
+ function DropZoneRenderInternal({ className, style, zone, as }, ref) {
6297
6311
  const ctx = useContext8(dropZoneContext);
6298
6312
  const { areaId = "root" } = ctx || {};
6299
6313
  const { config, data, metadata } = useContext8(renderContext);
@@ -6306,13 +6320,14 @@ var DropZoneRender = forwardRef3(
6306
6320
  }
6307
6321
  }
6308
6322
  }, [content]);
6323
+ const El = as != null ? as : "div";
6309
6324
  if (!data || !config) {
6310
6325
  return null;
6311
6326
  }
6312
6327
  if (zoneCompound !== rootDroppableId) {
6313
6328
  content = setupZone(data, zoneCompound).zones[zoneCompound];
6314
6329
  }
6315
- return /* @__PURE__ */ jsx26("div", { className, style, ref, children: content.map((item) => {
6330
+ return /* @__PURE__ */ jsx26(El, { className, style, ref, children: content.map((item) => {
6316
6331
  const Component = config.components[item.type];
6317
6332
  if (Component) {
6318
6333
  return /* @__PURE__ */ jsx26(
@@ -6455,7 +6470,7 @@ function createUsePuck() {
6455
6470
  }
6456
6471
  const result = useStore3(
6457
6472
  usePuckApi,
6458
- selector != null ? selector : (s) => s
6473
+ selector != null ? selector : ((s) => s)
6459
6474
  );
6460
6475
  return result;
6461
6476
  };
@@ -6602,49 +6617,48 @@ var DefaultFields = ({
6602
6617
  }) => {
6603
6618
  return /* @__PURE__ */ jsx29(Fragment8, { children });
6604
6619
  };
6605
- var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
6606
- let currentProps;
6620
+ var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
6607
6621
  const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
6608
6622
  const { data, ui } = state;
6609
6623
  const { itemSelector } = ui;
6610
6624
  const rootProps = data.root.props || data.root;
6611
- if (selectedItem) {
6612
- currentProps = selectedItem.props;
6613
- } else {
6614
- currentProps = rootProps;
6615
- }
6616
- const newProps = __spreadProps(__spreadValues({}, currentProps), {
6617
- [fieldName]: value
6618
- });
6625
+ const currentProps = selectedItem ? selectedItem.props : rootProps;
6626
+ const newProps = __spreadProps(__spreadValues({}, currentProps), { [fieldName]: value });
6619
6627
  if (selectedItem && itemSelector) {
6628
+ const resolved = yield resolveComponentData2(
6629
+ __spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
6630
+ "replace"
6631
+ );
6632
+ const latestSelector = getSelectorForId(
6633
+ appStore.getState().state,
6634
+ selectedItem.props.id
6635
+ );
6636
+ if (!latestSelector) return;
6620
6637
  dispatch({
6621
6638
  type: "replace",
6622
- destinationIndex: itemSelector.index,
6623
- destinationZone: itemSelector.zone || rootDroppableId,
6624
- data: (yield resolveComponentData2(
6625
- __spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
6639
+ destinationIndex: latestSelector.index,
6640
+ destinationZone: latestSelector.zone || rootDroppableId,
6641
+ data: resolved.node,
6642
+ ui: updatedUi
6643
+ });
6644
+ return;
6645
+ }
6646
+ if (data.root.props) {
6647
+ dispatch({
6648
+ type: "replaceRoot",
6649
+ root: (yield resolveComponentData2(
6650
+ __spreadProps(__spreadValues({}, data.root), { props: newProps }),
6626
6651
  "replace"
6627
6652
  )).node,
6628
- ui: updatedUi
6653
+ ui: __spreadValues(__spreadValues({}, ui), updatedUi),
6654
+ recordHistory: true
6629
6655
  });
6630
- } else {
6631
- if (data.root.props) {
6632
- dispatch({
6633
- type: "replaceRoot",
6634
- root: (yield resolveComponentData2(
6635
- __spreadProps(__spreadValues({}, data.root), { props: newProps }),
6636
- "replace"
6637
- )).node,
6638
- ui: __spreadValues(__spreadValues({}, ui), updatedUi),
6639
- recordHistory: true
6640
- });
6641
- } else {
6642
- dispatch({
6643
- type: "setData",
6644
- data: { root: newProps }
6645
- });
6646
- }
6656
+ return;
6647
6657
  }
6658
+ dispatch({
6659
+ type: "setData",
6660
+ data: { root: newProps }
6661
+ });
6648
6662
  });
6649
6663
  var FieldsChild = ({ fieldName }) => {
6650
6664
  const field = useAppStore((s) => s.fields.fields[fieldName]);
@@ -6976,7 +6990,7 @@ var CopyHostStyles = ({
6976
6990
  let elements = [];
6977
6991
  const hashes = {};
6978
6992
  const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
6979
- const mirrorEl = (el, inlineStyles = false) => __async(void 0, null, function* () {
6993
+ const mirrorEl = (el, inlineStyles = false) => __async(null, null, function* () {
6980
6994
  let mirror;
6981
6995
  if (el.nodeName === "LINK" && inlineStyles) {
6982
6996
  mirror = document.createElement("style");
@@ -7008,7 +7022,7 @@ var CopyHostStyles = ({
7008
7022
  }
7009
7023
  return mirror;
7010
7024
  });
7011
- const addEl = (el) => __async(void 0, null, function* () {
7025
+ const addEl = (el) => __async(null, null, function* () {
7012
7026
  const index = lookupEl(el);
7013
7027
  if (index > -1) {
7014
7028
  if (debug)
@@ -7081,7 +7095,7 @@ var CopyHostStyles = ({
7081
7095
  const parentBody = parentDocument.getElementsByTagName("body")[0];
7082
7096
  syncAttributes(parentBody, doc.body);
7083
7097
  Promise.all(
7084
- collectedStyles.map((styleNode, i) => __async(void 0, null, function* () {
7098
+ collectedStyles.map((styleNode, i) => __async(null, null, function* () {
7085
7099
  if (styleNode.nodeName === "LINK") {
7086
7100
  const linkHref = styleNode.href;
7087
7101
  if (hrefs.indexOf(linkHref) > -1) {
@@ -8649,7 +8663,12 @@ function PuckProvider({ children }) {
8649
8663
  });
8650
8664
  })
8651
8665
  );
8652
- const initialHistoryIndex = (_initialHistory == null ? void 0 : _initialHistory.index) || blendedHistories.length - 1;
8666
+ const initialHistoryIndex = useMemo20(() => {
8667
+ if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
8668
+ return _initialHistory == null ? void 0 : _initialHistory.index;
8669
+ }
8670
+ return blendedHistories.length - 1;
8671
+ }, []);
8653
8672
  const initialAppState = blendedHistories[initialHistoryIndex].state;
8654
8673
  const loadedOverrides = useLoadedOverrides({
8655
8674
  overrides,
@@ -8934,269 +8953,38 @@ classnames/index.js:
8934
8953
  *)
8935
8954
 
8936
8955
  lucide-react/dist/esm/shared/src/utils.js:
8937
- (**
8938
- * @license lucide-react v0.468.0 - ISC
8939
- *
8940
- * This source code is licensed under the ISC license.
8941
- * See the LICENSE file in the root directory of this source tree.
8942
- *)
8943
-
8944
8956
  lucide-react/dist/esm/defaultAttributes.js:
8945
- (**
8946
- * @license lucide-react v0.468.0 - ISC
8947
- *
8948
- * This source code is licensed under the ISC license.
8949
- * See the LICENSE file in the root directory of this source tree.
8950
- *)
8951
-
8952
8957
  lucide-react/dist/esm/Icon.js:
8953
- (**
8954
- * @license lucide-react v0.468.0 - ISC
8955
- *
8956
- * This source code is licensed under the ISC license.
8957
- * See the LICENSE file in the root directory of this source tree.
8958
- *)
8959
-
8960
8958
  lucide-react/dist/esm/createLucideIcon.js:
8961
- (**
8962
- * @license lucide-react v0.468.0 - ISC
8963
- *
8964
- * This source code is licensed under the ISC license.
8965
- * See the LICENSE file in the root directory of this source tree.
8966
- *)
8967
-
8968
8959
  lucide-react/dist/esm/icons/chevron-down.js:
8969
- (**
8970
- * @license lucide-react v0.468.0 - ISC
8971
- *
8972
- * This source code is licensed under the ISC license.
8973
- * See the LICENSE file in the root directory of this source tree.
8974
- *)
8975
-
8976
8960
  lucide-react/dist/esm/icons/chevron-right.js:
8977
- (**
8978
- * @license lucide-react v0.468.0 - ISC
8979
- *
8980
- * This source code is licensed under the ISC license.
8981
- * See the LICENSE file in the root directory of this source tree.
8982
- *)
8983
-
8984
8961
  lucide-react/dist/esm/icons/chevron-up.js:
8985
- (**
8986
- * @license lucide-react v0.468.0 - ISC
8987
- *
8988
- * This source code is licensed under the ISC license.
8989
- * See the LICENSE file in the root directory of this source tree.
8990
- *)
8991
-
8992
8962
  lucide-react/dist/esm/icons/circle-check-big.js:
8993
- (**
8994
- * @license lucide-react v0.468.0 - ISC
8995
- *
8996
- * This source code is licensed under the ISC license.
8997
- * See the LICENSE file in the root directory of this source tree.
8998
- *)
8999
-
9000
8963
  lucide-react/dist/esm/icons/copy.js:
9001
- (**
9002
- * @license lucide-react v0.468.0 - ISC
9003
- *
9004
- * This source code is licensed under the ISC license.
9005
- * See the LICENSE file in the root directory of this source tree.
9006
- *)
9007
-
9008
8964
  lucide-react/dist/esm/icons/corner-left-up.js:
9009
- (**
9010
- * @license lucide-react v0.468.0 - ISC
9011
- *
9012
- * This source code is licensed under the ISC license.
9013
- * See the LICENSE file in the root directory of this source tree.
9014
- *)
9015
-
9016
8965
  lucide-react/dist/esm/icons/ellipsis-vertical.js:
9017
- (**
9018
- * @license lucide-react v0.468.0 - ISC
9019
- *
9020
- * This source code is licensed under the ISC license.
9021
- * See the LICENSE file in the root directory of this source tree.
9022
- *)
9023
-
9024
8966
  lucide-react/dist/esm/icons/globe.js:
9025
- (**
9026
- * @license lucide-react v0.468.0 - ISC
9027
- *
9028
- * This source code is licensed under the ISC license.
9029
- * See the LICENSE file in the root directory of this source tree.
9030
- *)
9031
-
9032
8967
  lucide-react/dist/esm/icons/hash.js:
9033
- (**
9034
- * @license lucide-react v0.468.0 - ISC
9035
- *
9036
- * This source code is licensed under the ISC license.
9037
- * See the LICENSE file in the root directory of this source tree.
9038
- *)
9039
-
9040
8968
  lucide-react/dist/esm/icons/layers.js:
9041
- (**
9042
- * @license lucide-react v0.468.0 - ISC
9043
- *
9044
- * This source code is licensed under the ISC license.
9045
- * See the LICENSE file in the root directory of this source tree.
9046
- *)
9047
-
9048
8969
  lucide-react/dist/esm/icons/layout-grid.js:
9049
- (**
9050
- * @license lucide-react v0.468.0 - ISC
9051
- *
9052
- * This source code is licensed under the ISC license.
9053
- * See the LICENSE file in the root directory of this source tree.
9054
- *)
9055
-
9056
8970
  lucide-react/dist/esm/icons/link.js:
9057
- (**
9058
- * @license lucide-react v0.468.0 - ISC
9059
- *
9060
- * This source code is licensed under the ISC license.
9061
- * See the LICENSE file in the root directory of this source tree.
9062
- *)
9063
-
9064
8971
  lucide-react/dist/esm/icons/list.js:
9065
- (**
9066
- * @license lucide-react v0.468.0 - ISC
9067
- *
9068
- * This source code is licensed under the ISC license.
9069
- * See the LICENSE file in the root directory of this source tree.
9070
- *)
9071
-
9072
8972
  lucide-react/dist/esm/icons/lock-open.js:
9073
- (**
9074
- * @license lucide-react v0.468.0 - ISC
9075
- *
9076
- * This source code is licensed under the ISC license.
9077
- * See the LICENSE file in the root directory of this source tree.
9078
- *)
9079
-
9080
8973
  lucide-react/dist/esm/icons/lock.js:
9081
- (**
9082
- * @license lucide-react v0.468.0 - ISC
9083
- *
9084
- * This source code is licensed under the ISC license.
9085
- * See the LICENSE file in the root directory of this source tree.
9086
- *)
9087
-
9088
8974
  lucide-react/dist/esm/icons/monitor.js:
9089
- (**
9090
- * @license lucide-react v0.468.0 - ISC
9091
- *
9092
- * This source code is licensed under the ISC license.
9093
- * See the LICENSE file in the root directory of this source tree.
9094
- *)
9095
-
9096
8975
  lucide-react/dist/esm/icons/panel-left.js:
9097
- (**
9098
- * @license lucide-react v0.468.0 - ISC
9099
- *
9100
- * This source code is licensed under the ISC license.
9101
- * See the LICENSE file in the root directory of this source tree.
9102
- *)
9103
-
9104
8976
  lucide-react/dist/esm/icons/panel-right.js:
9105
- (**
9106
- * @license lucide-react v0.468.0 - ISC
9107
- *
9108
- * This source code is licensed under the ISC license.
9109
- * See the LICENSE file in the root directory of this source tree.
9110
- *)
9111
-
9112
8977
  lucide-react/dist/esm/icons/plus.js:
9113
- (**
9114
- * @license lucide-react v0.468.0 - ISC
9115
- *
9116
- * This source code is licensed under the ISC license.
9117
- * See the LICENSE file in the root directory of this source tree.
9118
- *)
9119
-
9120
8978
  lucide-react/dist/esm/icons/redo-2.js:
9121
- (**
9122
- * @license lucide-react v0.468.0 - ISC
9123
- *
9124
- * This source code is licensed under the ISC license.
9125
- * See the LICENSE file in the root directory of this source tree.
9126
- *)
9127
-
9128
8979
  lucide-react/dist/esm/icons/search.js:
9129
- (**
9130
- * @license lucide-react v0.468.0 - ISC
9131
- *
9132
- * This source code is licensed under the ISC license.
9133
- * See the LICENSE file in the root directory of this source tree.
9134
- *)
9135
-
9136
8980
  lucide-react/dist/esm/icons/sliders-horizontal.js:
9137
- (**
9138
- * @license lucide-react v0.468.0 - ISC
9139
- *
9140
- * This source code is licensed under the ISC license.
9141
- * See the LICENSE file in the root directory of this source tree.
9142
- *)
9143
-
9144
8981
  lucide-react/dist/esm/icons/smartphone.js:
9145
- (**
9146
- * @license lucide-react v0.468.0 - ISC
9147
- *
9148
- * This source code is licensed under the ISC license.
9149
- * See the LICENSE file in the root directory of this source tree.
9150
- *)
9151
-
9152
8982
  lucide-react/dist/esm/icons/tablet.js:
9153
- (**
9154
- * @license lucide-react v0.468.0 - ISC
9155
- *
9156
- * This source code is licensed under the ISC license.
9157
- * See the LICENSE file in the root directory of this source tree.
9158
- *)
9159
-
9160
8983
  lucide-react/dist/esm/icons/trash.js:
9161
- (**
9162
- * @license lucide-react v0.468.0 - ISC
9163
- *
9164
- * This source code is licensed under the ISC license.
9165
- * See the LICENSE file in the root directory of this source tree.
9166
- *)
9167
-
9168
8984
  lucide-react/dist/esm/icons/type.js:
9169
- (**
9170
- * @license lucide-react v0.468.0 - ISC
9171
- *
9172
- * This source code is licensed under the ISC license.
9173
- * See the LICENSE file in the root directory of this source tree.
9174
- *)
9175
-
9176
8985
  lucide-react/dist/esm/icons/undo-2.js:
9177
- (**
9178
- * @license lucide-react v0.468.0 - ISC
9179
- *
9180
- * This source code is licensed under the ISC license.
9181
- * See the LICENSE file in the root directory of this source tree.
9182
- *)
9183
-
9184
8986
  lucide-react/dist/esm/icons/zoom-in.js:
9185
- (**
9186
- * @license lucide-react v0.468.0 - ISC
9187
- *
9188
- * This source code is licensed under the ISC license.
9189
- * See the LICENSE file in the root directory of this source tree.
9190
- *)
9191
-
9192
8987
  lucide-react/dist/esm/icons/zoom-out.js:
9193
- (**
9194
- * @license lucide-react v0.468.0 - ISC
9195
- *
9196
- * This source code is licensed under the ISC license.
9197
- * See the LICENSE file in the root directory of this source tree.
9198
- *)
9199
-
9200
8988
  lucide-react/dist/esm/lucide-react.js:
9201
8989
  (**
9202
8990
  * @license lucide-react v0.468.0 - ISC