@measured/puck 0.19.4-canary.fde74e8a → 0.20.0-canary.2b50fb19

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.
package/dist/index.js CHANGED
@@ -153,9 +153,9 @@ var require_classnames = __commonJS({
153
153
  }
154
154
  });
155
155
 
156
- // index.ts
157
- var core_exports = {};
158
- __export(core_exports, {
156
+ // bundle/index.ts
157
+ var bundle_exports = {};
158
+ __export(bundle_exports, {
159
159
  Action: () => Action,
160
160
  ActionBar: () => ActionBar,
161
161
  AutoField: () => AutoField,
@@ -167,7 +167,7 @@ __export(core_exports, {
167
167
  IconButton: () => IconButton,
168
168
  Label: () => Label,
169
169
  Puck: () => Puck,
170
- Render: () => Render2,
170
+ Render: () => Render,
171
171
  createUsePuck: () => createUsePuck,
172
172
  migrate: () => migrate,
173
173
  overrideKeys: () => overrideKeys,
@@ -178,7 +178,10 @@ __export(core_exports, {
178
178
  usePuck: () => usePuck,
179
179
  walkTree: () => walkTree
180
180
  });
181
- module.exports = __toCommonJS(core_exports);
181
+ module.exports = __toCommonJS(bundle_exports);
182
+ init_react_import();
183
+
184
+ // bundle/core.ts
182
185
  init_react_import();
183
186
 
184
187
  // types/API/index.ts
@@ -306,7 +309,7 @@ init_react_import();
306
309
  var styles_module_default2 = { "InputWrapper": "_InputWrapper_py9hf_1", "Input-label": "_Input-label_py9hf_5", "Input-labelIcon": "_Input-labelIcon_py9hf_14", "Input-disabledIcon": "_Input-disabledIcon_py9hf_21", "Input-input": "_Input-input_py9hf_26", "Input": "_Input_py9hf_1", "Input--readOnly": "_Input--readOnly_py9hf_76", "Input-radioGroupItems": "_Input-radioGroupItems_py9hf_87", "Input-radio": "_Input-radio_py9hf_87", "Input-radioInner": "_Input-radioInner_py9hf_104", "Input-radioInput": "_Input-radioInput_py9hf_149" };
307
310
 
308
311
  // components/AutoField/index.tsx
309
- var import_react24 = require("react");
312
+ var import_react22 = require("react");
310
313
 
311
314
  // components/AutoField/fields/index.tsx
312
315
  init_react_import();
@@ -766,7 +769,7 @@ var IconButton = ({
766
769
  };
767
770
 
768
771
  // components/AutoField/fields/ArrayField/index.tsx
769
- var import_react16 = require("react");
772
+ var import_react14 = require("react");
770
773
 
771
774
  // components/DragIcon/index.tsx
772
775
  init_react_import();
@@ -1253,442 +1256,6 @@ function insertAction(state, action, appStore) {
1253
1256
 
1254
1257
  // reducer/actions/replace.ts
1255
1258
  init_react_import();
1256
-
1257
- // rsc.tsx
1258
- init_react_import();
1259
-
1260
- // components/ServerRender/index.tsx
1261
- init_react_import();
1262
-
1263
- // lib/data/setup-zone.ts
1264
- init_react_import();
1265
- var setupZone = (data, zoneKey) => {
1266
- if (zoneKey === rootDroppableId) {
1267
- return data;
1268
- }
1269
- const newData = __spreadProps(__spreadValues({}, data), {
1270
- zones: data.zones ? __spreadValues({}, data.zones) : {}
1271
- });
1272
- newData.zones[zoneKey] = newData.zones[zoneKey] || [];
1273
- return newData;
1274
- };
1275
-
1276
- // lib/use-slots.tsx
1277
- init_react_import();
1278
- var import_react5 = require("react");
1279
- function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
1280
- const slotProps = (0, import_react5.useMemo)(() => {
1281
- const mapped = mapSlots(
1282
- item,
1283
- (content, _parentId, propName, field, propPath) => {
1284
- const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
1285
- const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
1286
- const render = isReadOnly ? renderSlotRender : renderSlotEdit;
1287
- const Slot = (dzProps) => render(__spreadProps(__spreadValues({
1288
- allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
1289
- disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
1290
- }, dzProps), {
1291
- zone: propName,
1292
- content
1293
- }));
1294
- return Slot;
1295
- },
1296
- config
1297
- ).props;
1298
- return mapped;
1299
- }, [config, item, readOnly, forceReadOnly]);
1300
- const mergedProps = (0, import_react5.useMemo)(
1301
- () => __spreadValues(__spreadValues({}, item.props), slotProps),
1302
- [item.props, slotProps]
1303
- );
1304
- return mergedProps;
1305
- }
1306
-
1307
- // components/SlotRender/server.tsx
1308
- init_react_import();
1309
- var import_react6 = require("react");
1310
- var import_jsx_runtime5 = require("react/jsx-runtime");
1311
- var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SlotRender, __spreadValues({}, props));
1312
- var Item = ({
1313
- config,
1314
- item,
1315
- metadata
1316
- }) => {
1317
- const Component = config.components[item.type];
1318
- const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
1319
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1320
- Component.render,
1321
- __spreadProps(__spreadValues({}, props), {
1322
- puck: __spreadProps(__spreadValues({}, props.puck), {
1323
- renderDropZone: DropZoneRender,
1324
- metadata: metadata || {}
1325
- })
1326
- })
1327
- );
1328
- };
1329
- var SlotRender = (0, import_react6.forwardRef)(
1330
- function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
1331
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className, style, ref, children: content.map((item) => {
1332
- if (!config.components[item.type]) {
1333
- return null;
1334
- }
1335
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1336
- Item,
1337
- {
1338
- config,
1339
- item,
1340
- metadata
1341
- },
1342
- item.props.id
1343
- );
1344
- }) });
1345
- }
1346
- );
1347
-
1348
- // components/ServerRender/index.tsx
1349
- var import_jsx_runtime6 = require("react/jsx-runtime");
1350
- function DropZoneRender({
1351
- zone,
1352
- data,
1353
- areaId = "root",
1354
- config,
1355
- metadata = {}
1356
- }) {
1357
- let zoneCompound = rootDroppableId;
1358
- let content = (data == null ? void 0 : data.content) || [];
1359
- if (!data || !config) {
1360
- return null;
1361
- }
1362
- if (areaId !== rootAreaId && zone !== rootZone) {
1363
- zoneCompound = `${areaId}:${zone}`;
1364
- content = setupZone(data, zoneCompound).zones[zoneCompound];
1365
- }
1366
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: content.map((item) => {
1367
- const Component = config.components[item.type];
1368
- const props = __spreadProps(__spreadValues({}, item.props), {
1369
- puck: {
1370
- renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1371
- DropZoneRender,
1372
- {
1373
- zone: zone2,
1374
- data,
1375
- areaId: item.props.id,
1376
- config,
1377
- metadata
1378
- }
1379
- ),
1380
- metadata,
1381
- dragRef: null,
1382
- isEditing: false
1383
- }
1384
- });
1385
- const renderItem = __spreadProps(__spreadValues({}, item), { props });
1386
- const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
1387
- if (Component) {
1388
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
1389
- }
1390
- return null;
1391
- }) });
1392
- }
1393
-
1394
- // lib/resolve-all-data.ts
1395
- init_react_import();
1396
-
1397
- // lib/resolve-component-data.ts
1398
- init_react_import();
1399
-
1400
- // lib/get-changed.ts
1401
- init_react_import();
1402
- var import_fast_deep_equal = __toESM(require("fast-deep-equal"));
1403
- var getChanged = (newItem, oldItem) => {
1404
- return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1405
- const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1406
- const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1407
- return __spreadProps(__spreadValues({}, acc), {
1408
- [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1409
- });
1410
- }, {}) : {};
1411
- };
1412
-
1413
- // lib/resolve-component-data.ts
1414
- var import_fast_deep_equal2 = __toESM(require("fast-deep-equal"));
1415
- var cache = { lastChange: {} };
1416
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1417
- const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1418
- const resolvedItem = __spreadValues({}, item);
1419
- const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1420
- const id = "id" in item.props ? item.props.id : "root";
1421
- if (shouldRunResolver) {
1422
- const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1423
- if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
1424
- return { node: resolved, didChange: false };
1425
- }
1426
- const changed = getChanged(item, oldItem);
1427
- if (onResolveStart) {
1428
- onResolveStart(item);
1429
- }
1430
- const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
1431
- changed,
1432
- lastData: oldItem,
1433
- metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
1434
- trigger
1435
- });
1436
- resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
1437
- if (Object.keys(readOnly).length) {
1438
- resolvedItem.readOnly = readOnly;
1439
- }
1440
- }
1441
- let itemWithResolvedChildren = yield mapSlots(
1442
- resolvedItem,
1443
- (content) => __async(void 0, null, function* () {
1444
- return yield Promise.all(
1445
- content.map(
1446
- (childItem) => __async(void 0, null, function* () {
1447
- return (yield resolveComponentData(
1448
- childItem,
1449
- config,
1450
- metadata,
1451
- onResolveStart,
1452
- onResolveEnd,
1453
- trigger
1454
- )).node;
1455
- })
1456
- )
1457
- );
1458
- }),
1459
- config
1460
- );
1461
- if (shouldRunResolver && onResolveEnd) {
1462
- onResolveEnd(resolvedItem);
1463
- }
1464
- cache.lastChange[id] = {
1465
- item,
1466
- resolved: itemWithResolvedChildren
1467
- };
1468
- return {
1469
- node: itemWithResolvedChildren,
1470
- didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
1471
- };
1472
- });
1473
-
1474
- // lib/data/default-data.ts
1475
- init_react_import();
1476
- var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
1477
- root: data.root || {},
1478
- content: data.content || []
1479
- });
1480
-
1481
- // lib/data/to-component.ts
1482
- init_react_import();
1483
- var toComponent = (item) => {
1484
- return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
1485
- props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
1486
- type: "root"
1487
- });
1488
- };
1489
-
1490
- // lib/resolve-all-data.ts
1491
- function resolveAllData(_0, _1) {
1492
- return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
1493
- var _a;
1494
- const defaultedData = defaultData(data);
1495
- const resolveNode = (_node) => __async(this, null, function* () {
1496
- const node = toComponent(_node);
1497
- onResolveStart == null ? void 0 : onResolveStart(node);
1498
- const resolved = (yield resolveComponentData(
1499
- node,
1500
- config,
1501
- metadata,
1502
- () => {
1503
- },
1504
- () => {
1505
- },
1506
- "force"
1507
- )).node;
1508
- const resolvedDeep = yield mapSlots(
1509
- resolved,
1510
- processContent,
1511
- config
1512
- );
1513
- onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
1514
- return resolvedDeep;
1515
- });
1516
- const processContent = (content) => __async(this, null, function* () {
1517
- return Promise.all(content.map(resolveNode));
1518
- });
1519
- const processZones = () => __async(this, null, function* () {
1520
- var _a2;
1521
- const zones = (_a2 = data.zones) != null ? _a2 : {};
1522
- Object.entries(zones).forEach((_02) => __async(this, [_02], function* ([zoneKey, content]) {
1523
- zones[zoneKey] = yield Promise.all(content.map(resolveNode));
1524
- }));
1525
- return zones;
1526
- });
1527
- const dynamic = {
1528
- root: yield resolveNode(defaultedData.root),
1529
- content: yield processContent(defaultedData.content),
1530
- zones: yield processZones()
1531
- };
1532
- Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(this, null, function* () {
1533
- const content = defaultedData.zones[zoneKey];
1534
- dynamic.zones[zoneKey] = yield processContent(content);
1535
- }), {});
1536
- return dynamic;
1537
- });
1538
- }
1539
-
1540
- // lib/transform-props.ts
1541
- init_react_import();
1542
- function transformProps(data, propTransforms, config = { components: {} }) {
1543
- const mapItem = (item) => {
1544
- if (propTransforms[item.type]) {
1545
- return __spreadProps(__spreadValues({}, item), {
1546
- props: __spreadValues({
1547
- id: item.props.id
1548
- }, propTransforms[item.type](item.props))
1549
- });
1550
- }
1551
- return item;
1552
- };
1553
- const defaultedData = defaultData(data);
1554
- const rootProps = defaultedData.root.props || defaultedData.root;
1555
- let newRoot = __spreadValues({}, defaultedData.root);
1556
- if (propTransforms["root"]) {
1557
- newRoot.props = propTransforms["root"](rootProps);
1558
- }
1559
- const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
1560
- const updatedData = walkTree(
1561
- dataWithUpdatedRoot,
1562
- config,
1563
- (content) => content.map(mapItem)
1564
- );
1565
- if (!defaultedData.root.props) {
1566
- updatedData.root = updatedData.root.props;
1567
- }
1568
- return updatedData;
1569
- }
1570
-
1571
- // lib/migrate.ts
1572
- init_react_import();
1573
-
1574
- // store/default-app-state.ts
1575
- init_react_import();
1576
-
1577
- // components/ViewportControls/default-viewports.ts
1578
- init_react_import();
1579
- var defaultViewports = [
1580
- { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1581
- { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1582
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1583
- ];
1584
-
1585
- // store/default-app-state.ts
1586
- var defaultAppState = {
1587
- data: { content: [], root: {}, zones: {} },
1588
- ui: {
1589
- leftSideBarVisible: true,
1590
- rightSideBarVisible: true,
1591
- arrayState: {},
1592
- itemSelector: null,
1593
- componentList: {},
1594
- isDragging: false,
1595
- previewMode: "edit",
1596
- viewports: {
1597
- current: {
1598
- width: defaultViewports[0].width,
1599
- height: defaultViewports[0].height || "auto"
1600
- },
1601
- options: [],
1602
- controlsVisible: true
1603
- },
1604
- field: { focus: null }
1605
- },
1606
- indexes: {
1607
- nodes: {},
1608
- zones: {}
1609
- }
1610
- };
1611
-
1612
- // lib/migrate.ts
1613
- var migrations = [
1614
- // Migrate root to root.props
1615
- (data) => {
1616
- const rootProps = data.root.props || data.root;
1617
- if (Object.keys(data.root).length > 0 && !data.root.props) {
1618
- console.warn(
1619
- "Migration applied: Root props moved from `root` to `root.props`."
1620
- );
1621
- return __spreadProps(__spreadValues({}, data), {
1622
- root: {
1623
- props: __spreadValues({}, rootProps)
1624
- }
1625
- });
1626
- }
1627
- return data;
1628
- },
1629
- // Migrate zones to slots
1630
- (data, config) => {
1631
- var _a;
1632
- if (!config) return data;
1633
- console.log("Migrating DropZones to slots...");
1634
- const updatedItems = {};
1635
- const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
1636
- const { indexes } = walkAppState(appState, config);
1637
- const deletedCompounds = [];
1638
- walkAppState(appState, config, (content, zoneCompound, zoneType) => {
1639
- var _a2, _b, _c;
1640
- if (zoneType === "dropzone") {
1641
- const [id, slotName] = zoneCompound.split(":");
1642
- const nodeData = indexes.nodes[id].data;
1643
- const componentType = nodeData.type;
1644
- const configForComponent = id === "root" ? config.root : config.components[componentType];
1645
- if (((_b = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b.type) === "slot") {
1646
- updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
1647
- props: __spreadProps(__spreadValues(__spreadValues({}, nodeData.props), (_c = updatedItems[id]) == null ? void 0 : _c.props), {
1648
- [slotName]: content
1649
- })
1650
- });
1651
- deletedCompounds.push(zoneCompound);
1652
- }
1653
- return content;
1654
- }
1655
- return content;
1656
- });
1657
- const updated = walkAppState(
1658
- appState,
1659
- config,
1660
- (content) => content,
1661
- (item) => {
1662
- var _a2;
1663
- return (_a2 = updatedItems[item.props.id]) != null ? _a2 : item;
1664
- }
1665
- );
1666
- deletedCompounds.forEach((zoneCompound) => {
1667
- var _a2;
1668
- const [_, propName] = zoneCompound.split(":");
1669
- console.log(
1670
- `\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
1671
- );
1672
- (_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
1673
- });
1674
- Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
1675
- const [_, propName] = zoneCompound.split(":");
1676
- throw new Error(
1677
- `Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
1678
- );
1679
- });
1680
- delete updated.data.zones;
1681
- return updated.data;
1682
- }
1683
- ];
1684
- function migrate(data, config) {
1685
- return migrations == null ? void 0 : migrations.reduce(
1686
- (acc, migration) => migration(acc, config),
1687
- data
1688
- );
1689
- }
1690
-
1691
- // reducer/actions/replace.ts
1692
1259
  var replaceAction = (state, action, appStore) => {
1693
1260
  const [parentId] = action.destinationZone.split(":");
1694
1261
  const idsInPath = getIdsForParent(action.destinationZone, state);
@@ -1939,6 +1506,21 @@ var removeAction = (state, action, appStore) => {
1939
1506
 
1940
1507
  // reducer/actions/register-zone.ts
1941
1508
  init_react_import();
1509
+
1510
+ // lib/data/setup-zone.ts
1511
+ init_react_import();
1512
+ var setupZone = (data, zoneKey) => {
1513
+ if (zoneKey === rootDroppableId) {
1514
+ return data;
1515
+ }
1516
+ const newData = __spreadProps(__spreadValues({}, data), {
1517
+ zones: data.zones ? __spreadValues({}, data.zones) : {}
1518
+ });
1519
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
1520
+ return newData;
1521
+ };
1522
+
1523
+ // reducer/actions/register-zone.ts
1942
1524
  var zoneCache = {};
1943
1525
  function registerZoneAction(state, action) {
1944
1526
  if (zoneCache[action.zone]) {
@@ -2091,18 +1673,26 @@ function createReducer({
2091
1673
  );
2092
1674
  }
2093
1675
 
1676
+ // components/ViewportControls/default-viewports.ts
1677
+ init_react_import();
1678
+ var defaultViewports = [
1679
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1680
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1681
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1682
+ ];
1683
+
2094
1684
  // store/index.ts
2095
1685
  var import_zustand2 = require("zustand");
2096
1686
  var import_middleware2 = require("zustand/middleware");
2097
- var import_react11 = require("react");
1687
+ var import_react9 = require("react");
2098
1688
 
2099
1689
  // store/slices/history.ts
2100
1690
  init_react_import();
2101
- var import_react8 = require("react");
1691
+ var import_react6 = require("react");
2102
1692
 
2103
1693
  // lib/use-hotkey.ts
2104
1694
  init_react_import();
2105
- var import_react7 = require("react");
1695
+ var import_react5 = require("react");
2106
1696
  var import_zustand = require("zustand");
2107
1697
  var import_middleware = require("zustand/middleware");
2108
1698
  var keyCodeMap = {
@@ -2195,10 +1785,10 @@ var monitorHotkeys = (doc) => {
2195
1785
  };
2196
1786
  };
2197
1787
  var useMonitorHotkeys = () => {
2198
- (0, import_react7.useEffect)(() => monitorHotkeys(document), []);
1788
+ (0, import_react5.useEffect)(() => monitorHotkeys(document), []);
2199
1789
  };
2200
1790
  var useHotkey = (combo, cb) => {
2201
- (0, import_react7.useEffect)(
1791
+ (0, import_react5.useEffect)(
2202
1792
  () => useHotkeyStore.setState((s) => ({
2203
1793
  triggers: __spreadProps(__spreadValues({}, s.triggers), {
2204
1794
  [`${Object.keys(combo).join("+")}`]: { combo, cb }
@@ -2307,7 +1897,7 @@ function useRegisterHistorySlice(appStore, {
2307
1897
  index,
2308
1898
  initialAppState
2309
1899
  }) {
2310
- (0, import_react8.useEffect)(
1900
+ (0, import_react6.useEffect)(
2311
1901
  () => appStore.setState({
2312
1902
  history: __spreadProps(__spreadValues({}, appStore.getState().history), {
2313
1903
  histories,
@@ -2374,7 +1964,7 @@ var createNodesSlice = (set, get) => ({
2374
1964
 
2375
1965
  // store/slices/permissions.ts
2376
1966
  init_react_import();
2377
- var import_react9 = require("react");
1967
+ var import_react7 = require("react");
2378
1968
 
2379
1969
  // lib/data/flatten-data.ts
2380
1970
  init_react_import();
@@ -2392,6 +1982,19 @@ var flattenData = (state, config) => {
2392
1982
  return data;
2393
1983
  };
2394
1984
 
1985
+ // lib/get-changed.ts
1986
+ init_react_import();
1987
+ var import_fast_deep_equal = __toESM(require("fast-deep-equal"));
1988
+ var getChanged = (newItem, oldItem) => {
1989
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1990
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1991
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1992
+ return __spreadProps(__spreadValues({}, acc), {
1993
+ [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
1994
+ });
1995
+ }, {}) : {};
1996
+ };
1997
+
2395
1998
  // store/slices/permissions.ts
2396
1999
  var createPermissionsSlice = (set, get) => {
2397
2000
  const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
@@ -2498,7 +2101,7 @@ var createPermissionsSlice = (set, get) => {
2498
2101
  };
2499
2102
  };
2500
2103
  var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
2501
- (0, import_react9.useEffect)(() => {
2104
+ (0, import_react7.useEffect)(() => {
2502
2105
  const { permissions } = appStore.getState();
2503
2106
  const { globalPermissions: existingGlobalPermissions } = permissions;
2504
2107
  appStore.setState({
@@ -2508,7 +2111,7 @@ var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
2508
2111
  });
2509
2112
  permissions.resolvePermissions();
2510
2113
  }, [globalPermissions]);
2511
- (0, import_react9.useEffect)(() => {
2114
+ (0, import_react7.useEffect)(() => {
2512
2115
  return appStore.subscribe(
2513
2116
  (s) => s.state.data,
2514
2117
  () => {
@@ -2516,7 +2119,7 @@ var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
2516
2119
  }
2517
2120
  );
2518
2121
  }, []);
2519
- (0, import_react9.useEffect)(() => {
2122
+ (0, import_react7.useEffect)(() => {
2520
2123
  return appStore.subscribe(
2521
2124
  (s) => s.config,
2522
2125
  () => {
@@ -2528,7 +2131,7 @@ var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
2528
2131
 
2529
2132
  // store/slices/fields.ts
2530
2133
  init_react_import();
2531
- var import_react10 = require("react");
2134
+ var import_react8 = require("react");
2532
2135
  var createFieldsSlice = (_set, _get) => {
2533
2136
  return {
2534
2137
  fields: {},
@@ -2538,7 +2141,7 @@ var createFieldsSlice = (_set, _get) => {
2538
2141
  };
2539
2142
  };
2540
2143
  var useRegisterFieldsSlice = (appStore, id) => {
2541
- const resolveFields = (0, import_react10.useCallback)(
2144
+ const resolveFields = (0, import_react8.useCallback)(
2542
2145
  (reset) => __async(void 0, null, function* () {
2543
2146
  var _a, _b;
2544
2147
  const { fields, lastResolvedData } = appStore.getState().fields;
@@ -2595,7 +2198,7 @@ var useRegisterFieldsSlice = (appStore, id) => {
2595
2198
  }),
2596
2199
  [id]
2597
2200
  );
2598
- (0, import_react10.useEffect)(() => {
2201
+ (0, import_react8.useEffect)(() => {
2599
2202
  resolveFields(true);
2600
2203
  return appStore.subscribe(
2601
2204
  (s) => s.state.indexes.nodes[id || "root"],
@@ -2604,6 +2207,68 @@ var useRegisterFieldsSlice = (appStore, id) => {
2604
2207
  }, [id]);
2605
2208
  };
2606
2209
 
2210
+ // lib/resolve-component-data.ts
2211
+ init_react_import();
2212
+ var import_fast_deep_equal2 = __toESM(require("fast-deep-equal"));
2213
+ var cache = { lastChange: {} };
2214
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2215
+ const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
2216
+ const resolvedItem = __spreadValues({}, item);
2217
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
2218
+ const id = "id" in item.props ? item.props.id : "root";
2219
+ if (shouldRunResolver) {
2220
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
2221
+ if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
2222
+ return { node: resolved, didChange: false };
2223
+ }
2224
+ const changed = getChanged(item, oldItem);
2225
+ if (onResolveStart) {
2226
+ onResolveStart(item);
2227
+ }
2228
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
2229
+ changed,
2230
+ lastData: oldItem,
2231
+ metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
2232
+ trigger
2233
+ });
2234
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
2235
+ if (Object.keys(readOnly).length) {
2236
+ resolvedItem.readOnly = readOnly;
2237
+ }
2238
+ }
2239
+ let itemWithResolvedChildren = yield mapSlots(
2240
+ resolvedItem,
2241
+ (content) => __async(void 0, null, function* () {
2242
+ return yield Promise.all(
2243
+ content.map(
2244
+ (childItem) => __async(void 0, null, function* () {
2245
+ return (yield resolveComponentData(
2246
+ childItem,
2247
+ config,
2248
+ metadata,
2249
+ onResolveStart,
2250
+ onResolveEnd,
2251
+ trigger
2252
+ )).node;
2253
+ })
2254
+ )
2255
+ );
2256
+ }),
2257
+ config
2258
+ );
2259
+ if (shouldRunResolver && onResolveEnd) {
2260
+ onResolveEnd(resolvedItem);
2261
+ }
2262
+ cache.lastChange[id] = {
2263
+ item,
2264
+ resolved: itemWithResolvedChildren
2265
+ };
2266
+ return {
2267
+ node: itemWithResolvedChildren,
2268
+ didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
2269
+ };
2270
+ });
2271
+
2607
2272
  // lib/data/to-root.ts
2608
2273
  init_react_import();
2609
2274
  var toRoot = (item) => {
@@ -2621,6 +2286,34 @@ var toRoot = (item) => {
2621
2286
  return { props: {}, readOnly };
2622
2287
  };
2623
2288
 
2289
+ // store/default-app-state.ts
2290
+ init_react_import();
2291
+ var defaultAppState = {
2292
+ data: { content: [], root: {}, zones: {} },
2293
+ ui: {
2294
+ leftSideBarVisible: true,
2295
+ rightSideBarVisible: true,
2296
+ arrayState: {},
2297
+ itemSelector: null,
2298
+ componentList: {},
2299
+ isDragging: false,
2300
+ previewMode: "edit",
2301
+ viewports: {
2302
+ current: {
2303
+ width: defaultViewports[0].width,
2304
+ height: defaultViewports[0].height || "auto"
2305
+ },
2306
+ options: [],
2307
+ controlsVisible: true
2308
+ },
2309
+ field: { focus: null }
2310
+ },
2311
+ indexes: {
2312
+ nodes: {},
2313
+ zones: {}
2314
+ }
2315
+ };
2316
+
2624
2317
  // store/index.ts
2625
2318
  var defaultPageFields = {
2626
2319
  title: { type: "text" }
@@ -2797,23 +2490,23 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
2797
2490
  });
2798
2491
  })
2799
2492
  );
2800
- var appStoreContext = (0, import_react11.createContext)(createAppStore());
2493
+ var appStoreContext = (0, import_react9.createContext)(createAppStore());
2801
2494
  function useAppStore(selector) {
2802
- const context = (0, import_react11.useContext)(appStoreContext);
2495
+ const context = (0, import_react9.useContext)(appStoreContext);
2803
2496
  return (0, import_zustand2.useStore)(context, selector);
2804
2497
  }
2805
2498
  function useAppStoreApi() {
2806
- return (0, import_react11.useContext)(appStoreContext);
2499
+ return (0, import_react9.useContext)(appStoreContext);
2807
2500
  }
2808
2501
 
2809
2502
  // components/Sortable/index.tsx
2810
2503
  init_react_import();
2811
- var import_react14 = require("@dnd-kit/react");
2504
+ var import_react12 = require("@dnd-kit/react");
2812
2505
 
2813
2506
  // lib/dnd/use-sensors.ts
2814
2507
  init_react_import();
2815
- var import_react12 = require("react");
2816
- var import_react13 = require("@dnd-kit/react");
2508
+ var import_react10 = require("react");
2509
+ var import_react11 = require("@dnd-kit/react");
2817
2510
  var import_utilities = require("@dnd-kit/dom/utilities");
2818
2511
  var touchDefault = { delay: { value: 200, tolerance: 10 } };
2819
2512
  var otherDefault = {
@@ -2828,8 +2521,8 @@ var useSensors = ({
2828
2521
  touch: touchDefault,
2829
2522
  other: otherDefault
2830
2523
  }) => {
2831
- const [sensors] = (0, import_react12.useState)(() => [
2832
- import_react13.PointerSensor.configure({
2524
+ const [sensors] = (0, import_react10.useState)(() => [
2525
+ import_react11.PointerSensor.configure({
2833
2526
  activationConstraints(event, source) {
2834
2527
  var _a;
2835
2528
  const { pointerType, target } = event;
@@ -3164,7 +2857,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
3164
2857
 
3165
2858
  // components/Sortable/index.tsx
3166
2859
  var import_sortable = require("@dnd-kit/react/sortable");
3167
- var import_jsx_runtime7 = require("react/jsx-runtime");
2860
+ var import_jsx_runtime5 = require("react/jsx-runtime");
3168
2861
  var SortableProvider = ({
3169
2862
  children,
3170
2863
  onDragStart,
@@ -3174,8 +2867,8 @@ var SortableProvider = ({
3174
2867
  const sensors = useSensors({
3175
2868
  mouse: { distance: { value: 5 } }
3176
2869
  });
3177
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3178
- import_react14.DragDropProvider,
2870
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2871
+ import_react12.DragDropProvider,
3179
2872
  {
3180
2873
  sensors,
3181
2874
  onDragStart: (event) => {
@@ -3239,11 +2932,11 @@ var Sortable = ({
3239
2932
 
3240
2933
  // components/AutoField/context.tsx
3241
2934
  init_react_import();
3242
- var import_react15 = require("react");
3243
- var import_jsx_runtime8 = require("react/jsx-runtime");
3244
- var NestedFieldContext = (0, import_react15.createContext)({});
2935
+ var import_react13 = require("react");
2936
+ var import_jsx_runtime6 = require("react/jsx-runtime");
2937
+ var NestedFieldContext = (0, import_react13.createContext)({});
3245
2938
  var useNestedFieldContext = () => {
3246
- const context = (0, import_react15.useContext)(NestedFieldContext);
2939
+ const context = (0, import_react13.useContext)(NestedFieldContext);
3247
2940
  return __spreadProps(__spreadValues({}, context), {
3248
2941
  readOnlyFields: context.readOnlyFields || {}
3249
2942
  });
@@ -3257,7 +2950,7 @@ var NestedFieldProvider = ({
3257
2950
  }) => {
3258
2951
  const subPath = `${name}.${subName}`;
3259
2952
  const wildcardSubPath = `${wildcardName}.${subName}`;
3260
- const subReadOnlyFields = (0, import_react15.useMemo)(
2953
+ const subReadOnlyFields = (0, import_react13.useMemo)(
3261
2954
  () => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
3262
2955
  const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
3263
2956
  if (isLocal) {
@@ -3273,7 +2966,7 @@ var NestedFieldProvider = ({
3273
2966
  }, {}),
3274
2967
  [name, subName, wildcardName, readOnlyFields]
3275
2968
  );
3276
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2969
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3277
2970
  NestedFieldContext.Provider,
3278
2971
  {
3279
2972
  value: { readOnlyFields: subReadOnlyFields, localName: subName },
@@ -3283,7 +2976,7 @@ var NestedFieldProvider = ({
3283
2976
  };
3284
2977
 
3285
2978
  // components/AutoField/fields/ArrayField/index.tsx
3286
- var import_jsx_runtime9 = require("react/jsx-runtime");
2979
+ var import_jsx_runtime7 = require("react/jsx-runtime");
3287
2980
  var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
3288
2981
  var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
3289
2982
  var ArrayField = ({
@@ -3295,7 +2988,7 @@ var ArrayField = ({
3295
2988
  labelIcon,
3296
2989
  readOnly,
3297
2990
  id,
3298
- Label: Label2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", __spreadValues({}, props))
2991
+ Label: Label2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", __spreadValues({}, props))
3299
2992
  }) => {
3300
2993
  const thisArrayState = useAppStore((s) => s.state.ui.arrayState[id]);
3301
2994
  const setUi = useAppStore((s) => s.setUi);
@@ -3310,14 +3003,14 @@ var ArrayField = ({
3310
3003
  }),
3311
3004
  openId: ""
3312
3005
  };
3313
- const [localState, setLocalState] = (0, import_react16.useState)({ arrayState, value });
3314
- (0, import_react16.useEffect)(() => {
3006
+ const [localState, setLocalState] = (0, import_react14.useState)({ arrayState, value });
3007
+ (0, import_react14.useEffect)(() => {
3315
3008
  var _a;
3316
3009
  const _arrayState = (_a = appStore.getState().state.ui.arrayState[id]) != null ? _a : arrayState;
3317
3010
  setLocalState({ arrayState: _arrayState, value });
3318
3011
  }, [value]);
3319
3012
  const appStore = useAppStoreApi();
3320
- const mapArrayStateToUi = (0, import_react16.useCallback)(
3013
+ const mapArrayStateToUi = (0, import_react14.useCallback)(
3321
3014
  (partialArrayState) => {
3322
3015
  const state = appStore.getState().state;
3323
3016
  return {
@@ -3328,13 +3021,13 @@ var ArrayField = ({
3328
3021
  },
3329
3022
  [arrayState, appStore]
3330
3023
  );
3331
- const getHighestIndex = (0, import_react16.useCallback)(() => {
3024
+ const getHighestIndex = (0, import_react14.useCallback)(() => {
3332
3025
  return arrayState.items.reduce(
3333
3026
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
3334
3027
  -1
3335
3028
  );
3336
3029
  }, [arrayState]);
3337
- const regenerateArrayState = (0, import_react16.useCallback)(
3030
+ const regenerateArrayState = (0, import_react14.useCallback)(
3338
3031
  (value2) => {
3339
3032
  let highestIndex = getHighestIndex();
3340
3033
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -3353,19 +3046,19 @@ var ArrayField = ({
3353
3046
  },
3354
3047
  [arrayState]
3355
3048
  );
3356
- (0, import_react16.useEffect)(() => {
3049
+ (0, import_react14.useEffect)(() => {
3357
3050
  if (arrayState.items.length > 0) {
3358
3051
  setUi(mapArrayStateToUi(arrayState));
3359
3052
  }
3360
3053
  }, []);
3361
- const [draggedItem, setDraggedItem] = (0, import_react16.useState)("");
3054
+ const [draggedItem, setDraggedItem] = (0, import_react14.useState)("");
3362
3055
  const isDraggingAny = !!draggedItem;
3363
3056
  const canEdit = useAppStore(
3364
3057
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
3365
3058
  );
3366
3059
  const forceReadOnly = !canEdit;
3367
- const valueRef = (0, import_react16.useRef)(value);
3368
- const uniqifyItem = (0, import_react16.useCallback)(
3060
+ const valueRef = (0, import_react14.useRef)(value);
3061
+ const uniqifyItem = (0, import_react14.useCallback)(
3369
3062
  (val) => {
3370
3063
  if (field.type !== "array" || !field.arrayFields) return;
3371
3064
  const config = appStore.getState().config;
@@ -3382,14 +3075,14 @@ var ArrayField = ({
3382
3075
  return null;
3383
3076
  }
3384
3077
  const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
3385
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3078
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3386
3079
  Label2,
3387
3080
  {
3388
3081
  label: label || name,
3389
- icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(List, { size: 16 }),
3082
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(List, { size: 16 }),
3390
3083
  el: "div",
3391
3084
  readOnly,
3392
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3085
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3393
3086
  SortableProvider,
3394
3087
  {
3395
3088
  onDragStart: (id2) => setDraggedItem(id2),
@@ -3420,7 +3113,7 @@ var ArrayField = ({
3420
3113
  });
3421
3114
  valueRef.current = newValue;
3422
3115
  },
3423
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3116
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3424
3117
  "div",
3425
3118
  {
3426
3119
  className: getClassName5({
@@ -3428,16 +3121,16 @@ var ArrayField = ({
3428
3121
  addDisabled
3429
3122
  }),
3430
3123
  children: [
3431
- localState.arrayState.items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
3124
+ localState.arrayState.items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
3432
3125
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
3433
3126
  const data = Array.from(localState.value || [])[i] || {};
3434
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3127
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3435
3128
  Sortable,
3436
3129
  {
3437
3130
  id: _arrayId,
3438
3131
  index: i,
3439
3132
  disabled: readOnly,
3440
- children: ({ isDragging, ref, handleRef }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3133
+ children: ({ isDragging, ref, handleRef }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3441
3134
  "div",
3442
3135
  {
3443
3136
  ref,
@@ -3447,7 +3140,7 @@ var ArrayField = ({
3447
3140
  readOnly
3448
3141
  }),
3449
3142
  children: [
3450
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3143
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3451
3144
  "div",
3452
3145
  {
3453
3146
  ref: handleRef,
@@ -3472,9 +3165,9 @@ var ArrayField = ({
3472
3165
  className: getClassNameItem("summary"),
3473
3166
  children: [
3474
3167
  field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
3475
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("rhs"), children: [
3476
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("actions"), children: [
3477
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3168
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassNameItem("rhs"), children: [
3169
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassNameItem("actions"), children: [
3170
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3478
3171
  IconButton,
3479
3172
  {
3480
3173
  type: "button",
@@ -3493,10 +3186,10 @@ var ArrayField = ({
3493
3186
  onChange(existingValue);
3494
3187
  },
3495
3188
  title: "Duplicate",
3496
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Copy, { size: 16 })
3189
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 })
3497
3190
  }
3498
3191
  ) }),
3499
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3192
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3500
3193
  IconButton,
3501
3194
  {
3502
3195
  type: "button",
@@ -3518,16 +3211,16 @@ var ArrayField = ({
3518
3211
  onChange(existingValue);
3519
3212
  },
3520
3213
  title: "Delete",
3521
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Trash, { size: 16 })
3214
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 })
3522
3215
  }
3523
3216
  ) })
3524
3217
  ] }),
3525
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DragIcon, {}) })
3218
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DragIcon, {}) })
3526
3219
  ] })
3527
3220
  ]
3528
3221
  }
3529
3222
  ),
3530
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
3223
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
3531
3224
  const subField = field.arrayFields[subName];
3532
3225
  const indexName = `${name}[${i}]`;
3533
3226
  const subPath = `${indexName}.${subName}`;
@@ -3537,14 +3230,14 @@ var ArrayField = ({
3537
3230
  const localWildcardSubPath = `${localWildcardName}.${subName}`;
3538
3231
  const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
3539
3232
  const label2 = subField.label || subName;
3540
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3233
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3541
3234
  NestedFieldProvider,
3542
3235
  {
3543
3236
  name: localIndexName,
3544
3237
  wildcardName: localWildcardName,
3545
3238
  subName,
3546
3239
  readOnlyFields,
3547
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3240
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3548
3241
  AutoFieldPrivate,
3549
3242
  {
3550
3243
  name: subPath,
@@ -3577,7 +3270,7 @@ var ArrayField = ({
3577
3270
  _arrayId
3578
3271
  );
3579
3272
  }) }),
3580
- !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3273
+ !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3581
3274
  "button",
3582
3275
  {
3583
3276
  type: "button",
@@ -3595,7 +3288,7 @@ var ArrayField = ({
3595
3288
  setUi(mapArrayStateToUi(newArrayState), false);
3596
3289
  onChange(newValue);
3597
3290
  },
3598
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Plus, { size: 21 })
3291
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Plus, { size: 21 })
3599
3292
  }
3600
3293
  )
3601
3294
  ]
@@ -3609,7 +3302,7 @@ var ArrayField = ({
3609
3302
 
3610
3303
  // components/AutoField/fields/DefaultField/index.tsx
3611
3304
  init_react_import();
3612
- var import_jsx_runtime10 = require("react/jsx-runtime");
3305
+ var import_jsx_runtime8 = require("react/jsx-runtime");
3613
3306
  var getClassName6 = get_class_name_factory_default("Input", styles_module_default2);
3614
3307
  var DefaultField = ({
3615
3308
  field,
@@ -3623,16 +3316,16 @@ var DefaultField = ({
3623
3316
  id
3624
3317
  }) => {
3625
3318
  const value = _value;
3626
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3319
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3627
3320
  Label2,
3628
3321
  {
3629
3322
  label: label || name,
3630
- icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
3631
- field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Type, { size: 16 }),
3632
- field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Hash, { size: 16 })
3323
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
3324
+ field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Type, { size: 16 }),
3325
+ field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Hash, { size: 16 })
3633
3326
  ] }),
3634
3327
  readOnly,
3635
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3328
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3636
3329
  "input",
3637
3330
  {
3638
3331
  className: getClassName6("input"),
@@ -3670,11 +3363,11 @@ var DefaultField = ({
3670
3363
 
3671
3364
  // components/AutoField/fields/ExternalField/index.tsx
3672
3365
  init_react_import();
3673
- var import_react20 = require("react");
3366
+ var import_react18 = require("react");
3674
3367
 
3675
3368
  // components/ExternalInput/index.tsx
3676
3369
  init_react_import();
3677
- var import_react19 = require("react");
3370
+ var import_react17 = require("react");
3678
3371
 
3679
3372
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
3680
3373
  init_react_import();
@@ -3682,7 +3375,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
3682
3375
 
3683
3376
  // components/Modal/index.tsx
3684
3377
  init_react_import();
3685
- var import_react17 = require("react");
3378
+ var import_react15 = require("react");
3686
3379
 
3687
3380
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
3688
3381
  init_react_import();
@@ -3690,22 +3383,22 @@ var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Mod
3690
3383
 
3691
3384
  // components/Modal/index.tsx
3692
3385
  var import_react_dom = require("react-dom");
3693
- var import_jsx_runtime11 = require("react/jsx-runtime");
3386
+ var import_jsx_runtime9 = require("react/jsx-runtime");
3694
3387
  var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
3695
3388
  var Modal = ({
3696
3389
  children,
3697
3390
  onClose,
3698
3391
  isOpen
3699
3392
  }) => {
3700
- const [rootEl, setRootEl] = (0, import_react17.useState)(null);
3701
- (0, import_react17.useEffect)(() => {
3393
+ const [rootEl, setRootEl] = (0, import_react15.useState)(null);
3394
+ (0, import_react15.useEffect)(() => {
3702
3395
  setRootEl(document.getElementById("puck-portal-root"));
3703
3396
  }, []);
3704
3397
  if (!rootEl) {
3705
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", {});
3398
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", {});
3706
3399
  }
3707
3400
  return (0, import_react_dom.createPortal)(
3708
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3401
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3709
3402
  "div",
3710
3403
  {
3711
3404
  className: getClassName7("inner"),
@@ -3725,11 +3418,11 @@ init_react_import();
3725
3418
  var styles_module_default8 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
3726
3419
 
3727
3420
  // components/Heading/index.tsx
3728
- var import_jsx_runtime12 = require("react/jsx-runtime");
3421
+ var import_jsx_runtime10 = require("react/jsx-runtime");
3729
3422
  var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
3730
3423
  var Heading = ({ children, rank, size = "m" }) => {
3731
3424
  const Tag = rank ? `h${rank}` : "span";
3732
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3425
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3733
3426
  Tag,
3734
3427
  {
3735
3428
  className: getClassName8({
@@ -3745,7 +3438,7 @@ init_react_import();
3745
3438
 
3746
3439
  // components/Button/Button.tsx
3747
3440
  init_react_import();
3748
- var import_react18 = require("react");
3441
+ var import_react16 = require("react");
3749
3442
 
3750
3443
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
3751
3444
  init_react_import();
@@ -3765,7 +3458,7 @@ var filterDataAttrs = (props) => {
3765
3458
  };
3766
3459
 
3767
3460
  // components/Button/Button.tsx
3768
- var import_jsx_runtime13 = require("react/jsx-runtime");
3461
+ var import_jsx_runtime11 = require("react/jsx-runtime");
3769
3462
  var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
3770
3463
  var Button = (_a) => {
3771
3464
  var _b = _a, {
@@ -3795,11 +3488,11 @@ var Button = (_a) => {
3795
3488
  "size",
3796
3489
  "loading"
3797
3490
  ]);
3798
- const [loading, setLoading] = (0, import_react18.useState)(loadingProp);
3799
- (0, import_react18.useEffect)(() => setLoading(loadingProp), [loadingProp]);
3491
+ const [loading, setLoading] = (0, import_react16.useState)(loadingProp);
3492
+ (0, import_react16.useEffect)(() => setLoading(loadingProp), [loadingProp]);
3800
3493
  const ElementType = href ? "a" : type ? "button" : "span";
3801
3494
  const dataAttrs = filterDataAttrs(props);
3802
- const el = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3495
+ const el = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3803
3496
  ElementType,
3804
3497
  __spreadProps(__spreadValues({
3805
3498
  className: getClassName9({
@@ -3824,9 +3517,9 @@ var Button = (_a) => {
3824
3517
  href
3825
3518
  }, dataAttrs), {
3826
3519
  children: [
3827
- icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("icon"), children: icon }),
3520
+ icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("icon"), children: icon }),
3828
3521
  children,
3829
- loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader, { size: 14 }) })
3522
+ loading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Loader, { size: 14 }) })
3830
3523
  ]
3831
3524
  })
3832
3525
  );
@@ -3834,7 +3527,7 @@ var Button = (_a) => {
3834
3527
  };
3835
3528
 
3836
3529
  // components/ExternalInput/index.tsx
3837
- var import_jsx_runtime14 = require("react/jsx-runtime");
3530
+ var import_jsx_runtime12 = require("react/jsx-runtime");
3838
3531
  var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
3839
3532
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
3840
3533
  var dataCache = {};
@@ -3851,28 +3544,28 @@ var ExternalInput = ({
3851
3544
  mapRow = (val) => val,
3852
3545
  filterFields
3853
3546
  } = field || {};
3854
- const [data, setData] = (0, import_react19.useState)([]);
3855
- const [isOpen, setOpen] = (0, import_react19.useState)(false);
3856
- const [isLoading, setIsLoading] = (0, import_react19.useState)(true);
3547
+ const [data, setData] = (0, import_react17.useState)([]);
3548
+ const [isOpen, setOpen] = (0, import_react17.useState)(false);
3549
+ const [isLoading, setIsLoading] = (0, import_react17.useState)(true);
3857
3550
  const hasFilterFields = !!filterFields;
3858
- const [filters, setFilters] = (0, import_react19.useState)(field.initialFilters || {});
3859
- const [filtersToggled, setFiltersToggled] = (0, import_react19.useState)(hasFilterFields);
3860
- const mappedData = (0, import_react19.useMemo)(() => {
3551
+ const [filters, setFilters] = (0, import_react17.useState)(field.initialFilters || {});
3552
+ const [filtersToggled, setFiltersToggled] = (0, import_react17.useState)(hasFilterFields);
3553
+ const mappedData = (0, import_react17.useMemo)(() => {
3861
3554
  return data.map(mapRow);
3862
3555
  }, [data]);
3863
- const keys = (0, import_react19.useMemo)(() => {
3556
+ const keys = (0, import_react17.useMemo)(() => {
3864
3557
  const validKeys = /* @__PURE__ */ new Set();
3865
3558
  for (const item of mappedData) {
3866
3559
  for (const key of Object.keys(item)) {
3867
- if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react19.isValidElement)(item[key])) {
3560
+ if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react17.isValidElement)(item[key])) {
3868
3561
  validKeys.add(key);
3869
3562
  }
3870
3563
  }
3871
3564
  }
3872
3565
  return Array.from(validKeys);
3873
3566
  }, [mappedData]);
3874
- const [searchQuery, setSearchQuery] = (0, import_react19.useState)(field.initialQuery || "");
3875
- const search = (0, import_react19.useCallback)(
3567
+ const [searchQuery, setSearchQuery] = (0, import_react17.useState)(field.initialQuery || "");
3568
+ const search = (0, import_react17.useCallback)(
3876
3569
  (query, filters2) => __async(void 0, null, function* () {
3877
3570
  setIsLoading(true);
3878
3571
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
@@ -3885,18 +3578,18 @@ var ExternalInput = ({
3885
3578
  }),
3886
3579
  [id, field]
3887
3580
  );
3888
- const Footer = (0, import_react19.useCallback)(
3889
- (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: getClassNameModal("footer"), children: [
3581
+ const Footer = (0, import_react17.useCallback)(
3582
+ (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: getClassNameModal("footer"), children: [
3890
3583
  props.items.length,
3891
3584
  " result",
3892
3585
  props.items.length === 1 ? "" : "s"
3893
3586
  ] }),
3894
3587
  [field.renderFooter]
3895
3588
  );
3896
- (0, import_react19.useEffect)(() => {
3589
+ (0, import_react17.useEffect)(() => {
3897
3590
  search(searchQuery, filters);
3898
3591
  }, []);
3899
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3592
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3900
3593
  "div",
3901
3594
  {
3902
3595
  className: getClassName10({
@@ -3906,21 +3599,21 @@ var ExternalInput = ({
3906
3599
  }),
3907
3600
  id,
3908
3601
  children: [
3909
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName10("actions"), children: [
3910
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3602
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName10("actions"), children: [
3603
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3911
3604
  "button",
3912
3605
  {
3913
3606
  type: "button",
3914
3607
  onClick: () => setOpen(true),
3915
3608
  className: getClassName10("button"),
3916
3609
  disabled: readOnly,
3917
- children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
3918
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Link, { size: "16" }),
3919
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: field.placeholder })
3610
+ children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3611
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Link, { size: "16" }),
3612
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: field.placeholder })
3920
3613
  ] })
3921
3614
  }
3922
3615
  ),
3923
- value && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3616
+ value && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3924
3617
  "button",
3925
3618
  {
3926
3619
  type: "button",
@@ -3929,11 +3622,11 @@ var ExternalInput = ({
3929
3622
  onChange(null);
3930
3623
  },
3931
3624
  disabled: readOnly,
3932
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LockOpen, { size: 16 })
3625
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LockOpen, { size: 16 })
3933
3626
  }
3934
3627
  )
3935
3628
  ] }),
3936
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3629
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3937
3630
  "form",
3938
3631
  {
3939
3632
  className: getClassNameModal({
@@ -3947,11 +3640,11 @@ var ExternalInput = ({
3947
3640
  search(searchQuery, filters);
3948
3641
  },
3949
3642
  children: [
3950
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
3951
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: getClassNameModal("search"), children: [
3952
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
3953
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Search, { size: "18" }) }),
3954
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3643
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
3644
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: getClassNameModal("search"), children: [
3645
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
3646
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Search, { size: "18" }) }),
3647
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3955
3648
  "input",
3956
3649
  {
3957
3650
  className: getClassNameModal("searchInput"),
@@ -3966,9 +3659,9 @@ var ExternalInput = ({
3966
3659
  }
3967
3660
  )
3968
3661
  ] }),
3969
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
3970
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
3971
- hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3662
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
3663
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
3664
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3972
3665
  IconButton,
3973
3666
  {
3974
3667
  type: "button",
@@ -3978,19 +3671,19 @@ var ExternalInput = ({
3978
3671
  e.stopPropagation();
3979
3672
  setFiltersToggled(!filtersToggled);
3980
3673
  },
3981
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlidersHorizontal, { size: 20 })
3674
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SlidersHorizontal, { size: 20 })
3982
3675
  }
3983
3676
  ) })
3984
3677
  ] })
3985
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
3986
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("grid"), children: [
3987
- hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
3678
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
3679
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("grid"), children: [
3680
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
3988
3681
  const filterField = filterFields[fieldName];
3989
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3682
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3990
3683
  "div",
3991
3684
  {
3992
3685
  className: getClassNameModal("field"),
3993
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3686
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3994
3687
  AutoFieldPrivate,
3995
3688
  {
3996
3689
  field: filterField,
@@ -4011,9 +3704,9 @@ var ExternalInput = ({
4011
3704
  fieldName
4012
3705
  );
4013
3706
  }) }),
4014
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
4015
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: getClassNameModal("table"), children: [
4016
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3707
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
3708
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: getClassNameModal("table"), children: [
3709
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4017
3710
  "th",
4018
3711
  {
4019
3712
  className: getClassNameModal("th"),
@@ -4022,8 +3715,8 @@ var ExternalInput = ({
4022
3715
  },
4023
3716
  key
4024
3717
  )) }) }),
4025
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
4026
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3718
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
3719
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4027
3720
  "tr",
4028
3721
  {
4029
3722
  style: { whiteSpace: "nowrap" },
@@ -4032,16 +3725,16 @@ var ExternalInput = ({
4032
3725
  onChange(mapProp(data[i]));
4033
3726
  setOpen(false);
4034
3727
  },
4035
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
3728
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
4036
3729
  },
4037
3730
  i
4038
3731
  );
4039
3732
  }) })
4040
3733
  ] }),
4041
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Loader, { size: 24 }) })
3734
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Loader, { size: 24 }) })
4042
3735
  ] })
4043
3736
  ] }),
4044
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Footer, { items: mappedData }) })
3737
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Footer, { items: mappedData }) })
4045
3738
  ]
4046
3739
  }
4047
3740
  ) })
@@ -4051,7 +3744,7 @@ var ExternalInput = ({
4051
3744
  };
4052
3745
 
4053
3746
  // components/AutoField/fields/ExternalField/index.tsx
4054
- var import_jsx_runtime15 = require("react/jsx-runtime");
3747
+ var import_jsx_runtime13 = require("react/jsx-runtime");
4055
3748
  var ExternalField = ({
4056
3749
  field,
4057
3750
  onChange,
@@ -4066,7 +3759,7 @@ var ExternalField = ({
4066
3759
  var _a, _b, _c;
4067
3760
  const validField = field;
4068
3761
  const deprecatedField = field;
4069
- (0, import_react20.useEffect)(() => {
3762
+ (0, import_react18.useEffect)(() => {
4070
3763
  if (deprecatedField.adaptor) {
4071
3764
  console.error(
4072
3765
  "Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
@@ -4076,13 +3769,13 @@ var ExternalField = ({
4076
3769
  if (field.type !== "external") {
4077
3770
  return null;
4078
3771
  }
4079
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3772
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4080
3773
  Label2,
4081
3774
  {
4082
3775
  label: label || name,
4083
- icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: 16 }),
3776
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link, { size: 16 }),
4084
3777
  el: "div",
4085
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3778
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4086
3779
  ExternalInput,
4087
3780
  {
4088
3781
  name,
@@ -4109,7 +3802,7 @@ var ExternalField = ({
4109
3802
 
4110
3803
  // components/AutoField/fields/RadioField/index.tsx
4111
3804
  init_react_import();
4112
- var import_react21 = require("react");
3805
+ var import_react19 = require("react");
4113
3806
 
4114
3807
  // lib/safe-json-parse.ts
4115
3808
  init_react_import();
@@ -4123,7 +3816,7 @@ var safeJsonParse = (str) => {
4123
3816
  };
4124
3817
 
4125
3818
  // components/AutoField/fields/RadioField/index.tsx
4126
- var import_jsx_runtime16 = require("react/jsx-runtime");
3819
+ var import_jsx_runtime14 = require("react/jsx-runtime");
4127
3820
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
4128
3821
  var RadioField = ({
4129
3822
  field,
@@ -4136,26 +3829,26 @@ var RadioField = ({
4136
3829
  labelIcon,
4137
3830
  Label: Label2
4138
3831
  }) => {
4139
- const flatOptions = (0, import_react21.useMemo)(
3832
+ const flatOptions = (0, import_react19.useMemo)(
4140
3833
  () => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
4141
3834
  [field]
4142
3835
  );
4143
3836
  if (field.type !== "radio" || !field.options) {
4144
3837
  return null;
4145
3838
  }
4146
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3839
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4147
3840
  Label2,
4148
3841
  {
4149
- icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CircleCheckBig, { size: 16 }),
3842
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CircleCheckBig, { size: 16 }),
4150
3843
  label: label || name,
4151
3844
  readOnly,
4152
3845
  el: "div",
4153
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3846
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4154
3847
  "label",
4155
3848
  {
4156
3849
  className: getClassName11("radio"),
4157
3850
  children: [
4158
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3851
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4159
3852
  "input",
4160
3853
  {
4161
3854
  type: "radio",
@@ -4175,7 +3868,7 @@ var RadioField = ({
4175
3868
  checked: value === option.value
4176
3869
  }
4177
3870
  ),
4178
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
3871
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
4179
3872
  ]
4180
3873
  },
4181
3874
  option.label + option.value
@@ -4186,8 +3879,8 @@ var RadioField = ({
4186
3879
 
4187
3880
  // components/AutoField/fields/SelectField/index.tsx
4188
3881
  init_react_import();
4189
- var import_react22 = require("react");
4190
- var import_jsx_runtime17 = require("react/jsx-runtime");
3882
+ var import_react20 = require("react");
3883
+ var import_jsx_runtime15 = require("react/jsx-runtime");
4191
3884
  var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
4192
3885
  var SelectField = ({
4193
3886
  field,
@@ -4200,20 +3893,20 @@ var SelectField = ({
4200
3893
  readOnly,
4201
3894
  id
4202
3895
  }) => {
4203
- const flatOptions = (0, import_react22.useMemo)(
3896
+ const flatOptions = (0, import_react20.useMemo)(
4204
3897
  () => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
4205
3898
  [field]
4206
3899
  );
4207
3900
  if (field.type !== "select" || !field.options) {
4208
3901
  return null;
4209
3902
  }
4210
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3903
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4211
3904
  Label2,
4212
3905
  {
4213
3906
  label: label || name,
4214
- icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDown, { size: 16 }),
3907
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDown, { size: 16 }),
4215
3908
  readOnly,
4216
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3909
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4217
3910
  "select",
4218
3911
  {
4219
3912
  id,
@@ -4230,7 +3923,7 @@ var SelectField = ({
4230
3923
  }
4231
3924
  },
4232
3925
  value,
4233
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3926
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4234
3927
  "option",
4235
3928
  {
4236
3929
  label: option.label,
@@ -4246,7 +3939,7 @@ var SelectField = ({
4246
3939
 
4247
3940
  // components/AutoField/fields/TextareaField/index.tsx
4248
3941
  init_react_import();
4249
- var import_jsx_runtime18 = require("react/jsx-runtime");
3942
+ var import_jsx_runtime16 = require("react/jsx-runtime");
4250
3943
  var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
4251
3944
  var TextareaField = ({
4252
3945
  field,
@@ -4259,13 +3952,13 @@ var TextareaField = ({
4259
3952
  Label: Label2,
4260
3953
  id
4261
3954
  }) => {
4262
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3955
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4263
3956
  Label2,
4264
3957
  {
4265
3958
  label: label || name,
4266
- icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Type, { size: 16 }),
3959
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }),
4267
3960
  readOnly,
4268
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3961
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4269
3962
  "textarea",
4270
3963
  {
4271
3964
  id,
@@ -4292,7 +3985,7 @@ init_react_import();
4292
3985
  var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
4293
3986
 
4294
3987
  // components/AutoField/fields/ObjectField/index.tsx
4295
- var import_jsx_runtime19 = require("react/jsx-runtime");
3988
+ var import_jsx_runtime17 = require("react/jsx-runtime");
4296
3989
  var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
4297
3990
  var ObjectField = ({
4298
3991
  field,
@@ -4310,26 +4003,25 @@ var ObjectField = ({
4310
4003
  return null;
4311
4004
  }
4312
4005
  const data = value || {};
4313
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4006
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4314
4007
  Label2,
4315
4008
  {
4316
4009
  label: label || name,
4317
- icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EllipsisVertical, { size: 16 }),
4010
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EllipsisVertical, { size: 16 }),
4318
4011
  el: "div",
4319
4012
  readOnly,
4320
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
4013
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
4321
4014
  const subField = field.objectFields[subName];
4322
- const subPath = `${name}.${subName}`;
4323
- const localSubPath = `${localName || name}.${subName}`;
4324
- const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
4015
+ const subPath = `${localName}.${subName}`;
4016
+ const subReadOnly = readOnly ? readOnly : readOnlyFields[subPath];
4325
4017
  const label2 = subField.label || subName;
4326
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4018
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4327
4019
  NestedFieldProvider,
4328
4020
  {
4329
4021
  name: localName || id,
4330
4022
  subName,
4331
4023
  readOnlyFields,
4332
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4024
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4333
4025
  AutoFieldPrivate,
4334
4026
  {
4335
4027
  name: subPath,
@@ -4361,17 +4053,17 @@ var ObjectField = ({
4361
4053
 
4362
4054
  // lib/use-safe-id.ts
4363
4055
  init_react_import();
4364
- var import_react23 = __toESM(require("react"));
4056
+ var import_react21 = __toESM(require("react"));
4365
4057
  var useSafeId = () => {
4366
- if (typeof import_react23.default.useId !== "undefined") {
4367
- return import_react23.default.useId();
4058
+ if (typeof import_react21.default.useId !== "undefined") {
4059
+ return import_react21.default.useId();
4368
4060
  }
4369
- const [id] = (0, import_react23.useState)(generateId());
4061
+ const [id] = (0, import_react21.useState)(generateId());
4370
4062
  return id;
4371
4063
  };
4372
4064
 
4373
4065
  // components/AutoField/index.tsx
4374
- var import_jsx_runtime20 = require("react/jsx-runtime");
4066
+ var import_jsx_runtime18 = require("react/jsx-runtime");
4375
4067
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
4376
4068
  var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
4377
4069
  var FieldLabel = ({
@@ -4383,11 +4075,11 @@ var FieldLabel = ({
4383
4075
  className
4384
4076
  }) => {
4385
4077
  const El = el;
4386
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(El, { className, children: [
4387
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName15("label"), children: [
4388
- icon ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, {}),
4078
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(El, { className, children: [
4079
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName15("label"), children: [
4080
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, {}),
4389
4081
  label,
4390
- readOnly && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Lock, { size: "12" }) })
4082
+ readOnly && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Lock, { size: "12" }) })
4391
4083
  ] }),
4392
4084
  children
4393
4085
  ] });
@@ -4400,14 +4092,14 @@ var FieldLabelInternal = ({
4400
4092
  readOnly
4401
4093
  }) => {
4402
4094
  const overrides = useAppStore((s) => s.overrides);
4403
- const Wrapper = (0, import_react24.useMemo)(
4095
+ const Wrapper = (0, import_react22.useMemo)(
4404
4096
  () => overrides.fieldLabel || FieldLabel,
4405
4097
  [overrides]
4406
4098
  );
4407
4099
  if (!label) {
4408
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
4100
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children });
4409
4101
  }
4410
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4102
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4411
4103
  Wrapper,
4412
4104
  {
4413
4105
  label,
@@ -4420,14 +4112,14 @@ var FieldLabelInternal = ({
4420
4112
  );
4421
4113
  };
4422
4114
  function AutoFieldInternal(props) {
4423
- var _a, _b, _c, _d, _e, _f, _g, _h;
4115
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4424
4116
  const dispatch = useAppStore((s) => s.dispatch);
4425
4117
  const overrides = useAppStore((s) => s.overrides);
4426
4118
  const readOnly = useAppStore((s) => {
4427
4119
  var _a2;
4428
4120
  return (_a2 = s.selectedItem) == null ? void 0 : _a2.readOnly;
4429
4121
  });
4430
- const nestedFieldContext = (0, import_react24.useContext)(NestedFieldContext);
4122
+ const nestedFieldContext = (0, import_react22.useContext)(NestedFieldContext);
4431
4123
  const { id, Label: Label2 = FieldLabelInternal } = props;
4432
4124
  const field = props.field;
4433
4125
  const label = field.label;
@@ -4461,7 +4153,7 @@ function AutoFieldInternal(props) {
4461
4153
  Label: Label2,
4462
4154
  id: resolvedId
4463
4155
  });
4464
- const onFocus = (0, import_react24.useCallback)(
4156
+ const onFocus = (0, import_react22.useCallback)(
4465
4157
  (e) => {
4466
4158
  if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
4467
4159
  e.stopPropagation();
@@ -4475,7 +4167,7 @@ function AutoFieldInternal(props) {
4475
4167
  },
4476
4168
  [mergedProps.name]
4477
4169
  );
4478
- const onBlur = (0, import_react24.useCallback)((e) => {
4170
+ const onBlur = (0, import_react22.useCallback)((e) => {
4479
4171
  if ("name" in e.target) {
4480
4172
  dispatch({
4481
4173
  type: "setUi",
@@ -4492,23 +4184,25 @@ function AutoFieldInternal(props) {
4492
4184
  if (field.type === "slot") {
4493
4185
  return null;
4494
4186
  }
4187
+ let children = null;
4188
+ let FieldComponent;
4495
4189
  if (field.type === "custom") {
4496
4190
  if (!field.render) {
4497
4191
  return null;
4498
4192
  }
4499
- const CustomField = field.render;
4500
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CustomField, __spreadValues({}, mergedProps)) }) });
4193
+ FieldComponent = field.render;
4194
+ } else {
4195
+ children = defaultFields[field.type](mergedProps);
4196
+ FieldComponent = render[field.type];
4501
4197
  }
4502
- const children = defaultFields[field.type](mergedProps);
4503
- const Render3 = render[field.type];
4504
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4198
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4505
4199
  NestedFieldContext.Provider,
4506
4200
  {
4507
4201
  value: {
4508
4202
  readOnlyFields: nestedFieldContext.readOnlyFields || readOnly || {},
4509
- localName: nestedFieldContext.localName
4203
+ localName: (_i = nestedFieldContext.localName) != null ? _i : mergedProps.name
4510
4204
  },
4511
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4205
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4512
4206
  "div",
4513
4207
  {
4514
4208
  className: getClassNameWrapper(),
@@ -4517,7 +4211,7 @@ function AutoFieldInternal(props) {
4517
4211
  onClick: (e) => {
4518
4212
  e.stopPropagation();
4519
4213
  },
4520
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Render3, __spreadProps(__spreadValues({}, mergedProps), { children }))
4214
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FieldComponent, __spreadProps(__spreadValues({}, mergedProps), { children }))
4521
4215
  }
4522
4216
  )
4523
4217
  }
@@ -4526,20 +4220,20 @@ function AutoFieldInternal(props) {
4526
4220
  function AutoFieldPrivate(props) {
4527
4221
  const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
4528
4222
  const { value, onChange } = props;
4529
- const [localValue, setLocalValue] = (0, import_react24.useState)(value);
4530
- const onChangeLocal = (0, import_react24.useCallback)(
4223
+ const [localValue, setLocalValue] = (0, import_react22.useState)(value);
4224
+ const onChangeLocal = (0, import_react22.useCallback)(
4531
4225
  (val, ui) => {
4532
4226
  setLocalValue(val);
4533
4227
  onChange(val, ui);
4534
4228
  },
4535
4229
  [onChange]
4536
4230
  );
4537
- (0, import_react24.useEffect)(() => {
4231
+ (0, import_react22.useEffect)(() => {
4538
4232
  if (!isFocused) {
4539
4233
  setLocalValue(value);
4540
4234
  }
4541
4235
  }, [value]);
4542
- (0, import_react24.useEffect)(() => {
4236
+ (0, import_react22.useEffect)(() => {
4543
4237
  if (!isFocused) {
4544
4238
  if (value !== localValue) {
4545
4239
  setLocalValue(value);
@@ -4550,11 +4244,11 @@ function AutoFieldPrivate(props) {
4550
4244
  value: localValue,
4551
4245
  onChange: onChangeLocal
4552
4246
  };
4553
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
4247
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
4554
4248
  }
4555
4249
  function AutoField(props) {
4556
- const DefaultLabel = (0, import_react24.useMemo)(() => {
4557
- const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4250
+ const DefaultLabel = (0, import_react22.useMemo)(() => {
4251
+ const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4558
4252
  "div",
4559
4253
  __spreadProps(__spreadValues({}, labelProps), {
4560
4254
  className: getClassName15({ readOnly: props.readOnly })
@@ -4565,7 +4259,7 @@ function AutoField(props) {
4565
4259
  if (props.field.type === "slot") {
4566
4260
  return null;
4567
4261
  }
4568
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
4262
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
4569
4263
  }
4570
4264
 
4571
4265
  // components/Drawer/index.tsx
@@ -4590,7 +4284,7 @@ var import_react35 = require("react");
4590
4284
 
4591
4285
  // components/DraggableComponent/index.tsx
4592
4286
  init_react_import();
4593
- var import_react28 = require("react");
4287
+ var import_react26 = require("react");
4594
4288
 
4595
4289
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
4596
4290
  init_react_import();
@@ -4620,11 +4314,11 @@ function getDeepScrollPosition(element) {
4620
4314
 
4621
4315
  // components/DropZone/context.tsx
4622
4316
  init_react_import();
4623
- var import_react25 = require("react");
4317
+ var import_react23 = require("react");
4624
4318
  var import_zustand3 = require("zustand");
4625
- var import_jsx_runtime21 = require("react/jsx-runtime");
4626
- var dropZoneContext = (0, import_react25.createContext)(null);
4627
- var ZoneStoreContext = (0, import_react25.createContext)(
4319
+ var import_jsx_runtime19 = require("react/jsx-runtime");
4320
+ var dropZoneContext = (0, import_react23.createContext)(null);
4321
+ var ZoneStoreContext = (0, import_react23.createContext)(
4628
4322
  (0, import_zustand3.createStore)(() => ({
4629
4323
  zoneDepthIndex: {},
4630
4324
  nextZoneDepthIndex: {},
@@ -4640,14 +4334,14 @@ var ZoneStoreProvider = ({
4640
4334
  children,
4641
4335
  store
4642
4336
  }) => {
4643
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ZoneStoreContext.Provider, { value: store, children });
4337
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ZoneStoreContext.Provider, { value: store, children });
4644
4338
  };
4645
4339
  var DropZoneProvider = ({
4646
4340
  children,
4647
4341
  value
4648
4342
  }) => {
4649
4343
  const dispatch = useAppStore((s) => s.dispatch);
4650
- const registerZone = (0, import_react25.useCallback)(
4344
+ const registerZone = (0, import_react23.useCallback)(
4651
4345
  (zoneCompound) => {
4652
4346
  dispatch({
4653
4347
  type: "registerZone",
@@ -4656,7 +4350,7 @@ var DropZoneProvider = ({
4656
4350
  },
4657
4351
  [dispatch]
4658
4352
  );
4659
- const unregisterZone = (0, import_react25.useCallback)(
4353
+ const unregisterZone = (0, import_react23.useCallback)(
4660
4354
  (zoneCompound) => {
4661
4355
  dispatch({
4662
4356
  type: "unregisterZone",
@@ -4665,14 +4359,14 @@ var DropZoneProvider = ({
4665
4359
  },
4666
4360
  [dispatch]
4667
4361
  );
4668
- const memoValue = (0, import_react25.useMemo)(
4362
+ const memoValue = (0, import_react23.useMemo)(
4669
4363
  () => __spreadValues({
4670
4364
  registerZone,
4671
4365
  unregisterZone
4672
4366
  }, value),
4673
4367
  [value]
4674
4368
  );
4675
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
4369
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
4676
4370
  };
4677
4371
 
4678
4372
  // components/DraggableComponent/index.tsx
@@ -4696,11 +4390,11 @@ function accumulateTransform(el) {
4696
4390
 
4697
4391
  // lib/use-context-store.ts
4698
4392
  init_react_import();
4699
- var import_react26 = require("react");
4393
+ var import_react24 = require("react");
4700
4394
  var import_zustand4 = require("zustand");
4701
4395
  var import_shallow = require("zustand/react/shallow");
4702
4396
  function useContextStore(context, selector) {
4703
- const store = (0, import_react26.useContext)(context);
4397
+ const store = (0, import_react24.useContext)(context);
4704
4398
  if (!store) {
4705
4399
  throw new Error("useContextStore must be used inside context");
4706
4400
  }
@@ -4709,10 +4403,10 @@ function useContextStore(context, selector) {
4709
4403
 
4710
4404
  // lib/dnd/use-on-drag-finished.ts
4711
4405
  init_react_import();
4712
- var import_react27 = require("react");
4406
+ var import_react25 = require("react");
4713
4407
  var useOnDragFinished = (cb, deps = []) => {
4714
4408
  const appStore = useAppStoreApi();
4715
- return (0, import_react27.useCallback)(() => {
4409
+ return (0, import_react25.useCallback)(() => {
4716
4410
  let dispose = () => {
4717
4411
  };
4718
4412
  const processDragging = (isDragging2) => {
@@ -4740,7 +4434,7 @@ var useOnDragFinished = (cb, deps = []) => {
4740
4434
  };
4741
4435
 
4742
4436
  // components/DraggableComponent/index.tsx
4743
- var import_jsx_runtime22 = require("react/jsx-runtime");
4437
+ var import_jsx_runtime20 = require("react/jsx-runtime");
4744
4438
  var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
4745
4439
  var DEBUG2 = false;
4746
4440
  var space = 8;
@@ -4751,12 +4445,12 @@ var DefaultActionBar = ({
4751
4445
  label,
4752
4446
  children,
4753
4447
  parentAction
4754
- }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ActionBar, { children: [
4755
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ActionBar.Group, { children: [
4448
+ }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(ActionBar, { children: [
4449
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(ActionBar.Group, { children: [
4756
4450
  parentAction,
4757
- label && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ActionBar.Label, { label })
4451
+ label && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Label, { label })
4758
4452
  ] }),
4759
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ActionBar.Group, { children })
4453
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Group, { children })
4760
4454
  ] });
4761
4455
  var DraggableComponent = ({
4762
4456
  children,
@@ -4782,9 +4476,9 @@ var DraggableComponent = ({
4782
4476
  const overrides = useAppStore((s) => s.overrides);
4783
4477
  const dispatch = useAppStore((s) => s.dispatch);
4784
4478
  const iframe = useAppStore((s) => s.iframe);
4785
- const ctx = (0, import_react28.useContext)(dropZoneContext);
4786
- const [localZones, setLocalZones] = (0, import_react28.useState)({});
4787
- const registerLocalZone = (0, import_react28.useCallback)(
4479
+ const ctx = (0, import_react26.useContext)(dropZoneContext);
4480
+ const [localZones, setLocalZones] = (0, import_react26.useState)({});
4481
+ const registerLocalZone = (0, import_react26.useCallback)(
4788
4482
  (zoneCompound2, active) => {
4789
4483
  var _a;
4790
4484
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -4794,7 +4488,7 @@ var DraggableComponent = ({
4794
4488
  },
4795
4489
  [setLocalZones]
4796
4490
  );
4797
- const unregisterLocalZone = (0, import_react28.useCallback)(
4491
+ const unregisterLocalZone = (0, import_react26.useCallback)(
4798
4492
  (zoneCompound2) => {
4799
4493
  var _a;
4800
4494
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -4817,9 +4511,9 @@ var DraggableComponent = ({
4817
4511
  return s.permissions.getPermissions({ item });
4818
4512
  })
4819
4513
  );
4820
- const zoneStore = (0, import_react28.useContext)(ZoneStoreContext);
4821
- const [dragAxis, setDragAxis] = (0, import_react28.useState)(userDragAxis || autoDragAxis);
4822
- const dynamicCollisionDetector = (0, import_react28.useMemo)(
4514
+ const zoneStore = (0, import_react26.useContext)(ZoneStoreContext);
4515
+ const [dragAxis, setDragAxis] = (0, import_react26.useState)(userDragAxis || autoDragAxis);
4516
+ const dynamicCollisionDetector = (0, import_react26.useMemo)(
4823
4517
  () => createDynamicCollisionDetector(dragAxis),
4824
4518
  [dragAxis]
4825
4519
  );
@@ -4851,7 +4545,7 @@ var DraggableComponent = ({
4851
4545
  },
4852
4546
  feedback: "clone"
4853
4547
  });
4854
- (0, import_react28.useEffect)(() => {
4548
+ (0, import_react26.useEffect)(() => {
4855
4549
  const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
4856
4550
  sortable.droppable.disabled = !isEnabled;
4857
4551
  sortable.draggable.disabled = !permissions.drag;
@@ -4868,8 +4562,8 @@ var DraggableComponent = ({
4868
4562
  }
4869
4563
  return cleanup;
4870
4564
  }, [permissions.drag, zoneCompound]);
4871
- const ref = (0, import_react28.useRef)(null);
4872
- const refSetter = (0, import_react28.useCallback)(
4565
+ const ref = (0, import_react26.useRef)(null);
4566
+ const refSetter = (0, import_react26.useCallback)(
4873
4567
  (el) => {
4874
4568
  sortableRef(el);
4875
4569
  if (el) {
@@ -4878,14 +4572,14 @@ var DraggableComponent = ({
4878
4572
  },
4879
4573
  [sortableRef]
4880
4574
  );
4881
- const [portalEl, setPortalEl] = (0, import_react28.useState)();
4882
- (0, import_react28.useEffect)(() => {
4575
+ const [portalEl, setPortalEl] = (0, import_react26.useState)();
4576
+ (0, import_react26.useEffect)(() => {
4883
4577
  var _a, _b, _c;
4884
4578
  setPortalEl(
4885
4579
  iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
4886
4580
  );
4887
4581
  }, [iframe.enabled, ref.current]);
4888
- const getStyle = (0, import_react28.useCallback)(() => {
4582
+ const getStyle = (0, import_react26.useCallback)(() => {
4889
4583
  var _a, _b, _c;
4890
4584
  if (!ref.current) return;
4891
4585
  const rect = ref.current.getBoundingClientRect();
@@ -4910,11 +4604,11 @@ var DraggableComponent = ({
4910
4604
  };
4911
4605
  return style2;
4912
4606
  }, [ref.current]);
4913
- const [style, setStyle] = (0, import_react28.useState)();
4914
- const sync = (0, import_react28.useCallback)(() => {
4607
+ const [style, setStyle] = (0, import_react26.useState)();
4608
+ const sync = (0, import_react26.useCallback)(() => {
4915
4609
  setStyle(getStyle());
4916
4610
  }, [ref.current, iframe]);
4917
- (0, import_react28.useEffect)(() => {
4611
+ (0, import_react26.useEffect)(() => {
4918
4612
  if (ref.current) {
4919
4613
  const observer = new ResizeObserver(sync);
4920
4614
  observer.observe(ref.current);
@@ -4924,13 +4618,13 @@ var DraggableComponent = ({
4924
4618
  }
4925
4619
  }, [ref.current]);
4926
4620
  const registerNode = useAppStore((s) => s.nodes.registerNode);
4927
- const hideOverlay = (0, import_react28.useCallback)(() => {
4621
+ const hideOverlay = (0, import_react26.useCallback)(() => {
4928
4622
  setIsVisible(false);
4929
4623
  }, []);
4930
- const showOverlay = (0, import_react28.useCallback)(() => {
4624
+ const showOverlay = (0, import_react26.useCallback)(() => {
4931
4625
  setIsVisible(true);
4932
4626
  }, []);
4933
- (0, import_react28.useEffect)(() => {
4627
+ (0, import_react26.useEffect)(() => {
4934
4628
  var _a;
4935
4629
  registerNode(id, {
4936
4630
  methods: { sync, showOverlay, hideOverlay },
@@ -4947,11 +4641,11 @@ var DraggableComponent = ({
4947
4641
  });
4948
4642
  };
4949
4643
  }, [id, zoneCompound, index, componentType, sync]);
4950
- const CustomActionBar = (0, import_react28.useMemo)(
4644
+ const CustomActionBar = (0, import_react26.useMemo)(
4951
4645
  () => overrides.actionBar || DefaultActionBar,
4952
4646
  [overrides.actionBar]
4953
4647
  );
4954
- const onClick = (0, import_react28.useCallback)(
4648
+ const onClick = (0, import_react26.useCallback)(
4955
4649
  (e) => {
4956
4650
  e.stopPropagation();
4957
4651
  dispatch({
@@ -4964,7 +4658,7 @@ var DraggableComponent = ({
4964
4658
  [index, zoneCompound, id]
4965
4659
  );
4966
4660
  const appStore = useAppStoreApi();
4967
- const onSelectParent = (0, import_react28.useCallback)(() => {
4661
+ const onSelectParent = (0, import_react26.useCallback)(() => {
4968
4662
  const { nodes, zones } = appStore.getState().state.indexes;
4969
4663
  const node = nodes[id];
4970
4664
  const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
@@ -4985,26 +4679,26 @@ var DraggableComponent = ({
4985
4679
  }
4986
4680
  });
4987
4681
  }, [ctx, path]);
4988
- const onDuplicate = (0, import_react28.useCallback)(() => {
4682
+ const onDuplicate = (0, import_react26.useCallback)(() => {
4989
4683
  dispatch({
4990
4684
  type: "duplicate",
4991
4685
  sourceIndex: index,
4992
4686
  sourceZone: zoneCompound
4993
4687
  });
4994
4688
  }, [index, zoneCompound]);
4995
- const onDelete = (0, import_react28.useCallback)(() => {
4689
+ const onDelete = (0, import_react26.useCallback)(() => {
4996
4690
  dispatch({
4997
4691
  type: "remove",
4998
4692
  index,
4999
4693
  zone: zoneCompound
5000
4694
  });
5001
4695
  }, [index, zoneCompound]);
5002
- const [hover, setHover] = (0, import_react28.useState)(false);
4696
+ const [hover, setHover] = (0, import_react26.useState)(false);
5003
4697
  const indicativeHover = useContextStore(
5004
4698
  ZoneStoreContext,
5005
4699
  (s) => s.hoveringComponent === id
5006
4700
  );
5007
- (0, import_react28.useEffect)(() => {
4701
+ (0, import_react26.useEffect)(() => {
5008
4702
  if (!ref.current) {
5009
4703
  return;
5010
4704
  }
@@ -5048,10 +4742,10 @@ var DraggableComponent = ({
5048
4742
  thisIsDragging,
5049
4743
  inDroppableZone
5050
4744
  ]);
5051
- const [isVisible, setIsVisible] = (0, import_react28.useState)(false);
5052
- const [dragFinished, setDragFinished] = (0, import_react28.useState)(true);
5053
- const [_, startTransition] = (0, import_react28.useTransition)();
5054
- (0, import_react28.useEffect)(() => {
4745
+ const [isVisible, setIsVisible] = (0, import_react26.useState)(false);
4746
+ const [dragFinished, setDragFinished] = (0, import_react26.useState)(true);
4747
+ const [_, startTransition] = (0, import_react26.useTransition)();
4748
+ (0, import_react26.useEffect)(() => {
5055
4749
  startTransition(() => {
5056
4750
  if (hover || indicativeHover || isSelected) {
5057
4751
  sync();
@@ -5062,7 +4756,7 @@ var DraggableComponent = ({
5062
4756
  }
5063
4757
  });
5064
4758
  }, [hover, indicativeHover, isSelected, iframe]);
5065
- const [thisWasDragging, setThisWasDragging] = (0, import_react28.useState)(false);
4759
+ const [thisWasDragging, setThisWasDragging] = (0, import_react26.useState)(false);
5066
4760
  const onDragFinished = useOnDragFinished((finished) => {
5067
4761
  if (finished) {
5068
4762
  startTransition(() => {
@@ -5073,15 +4767,15 @@ var DraggableComponent = ({
5073
4767
  setDragFinished(false);
5074
4768
  }
5075
4769
  });
5076
- (0, import_react28.useEffect)(() => {
4770
+ (0, import_react26.useEffect)(() => {
5077
4771
  if (thisIsDragging) {
5078
4772
  setThisWasDragging(true);
5079
4773
  }
5080
4774
  }, [thisIsDragging]);
5081
- (0, import_react28.useEffect)(() => {
4775
+ (0, import_react26.useEffect)(() => {
5082
4776
  if (thisWasDragging) return onDragFinished();
5083
4777
  }, [thisWasDragging, onDragFinished]);
5084
- const syncActionsPosition = (0, import_react28.useCallback)(
4778
+ const syncActionsPosition = (0, import_react26.useCallback)(
5085
4779
  (el) => {
5086
4780
  if (el) {
5087
4781
  const view = el.ownerDocument.defaultView;
@@ -5106,7 +4800,7 @@ var DraggableComponent = ({
5106
4800
  },
5107
4801
  [zoom]
5108
4802
  );
5109
- (0, import_react28.useEffect)(() => {
4803
+ (0, import_react26.useEffect)(() => {
5110
4804
  if (userDragAxis) {
5111
4805
  setDragAxis(userDragAxis);
5112
4806
  return;
@@ -5120,11 +4814,11 @@ var DraggableComponent = ({
5120
4814
  }
5121
4815
  setDragAxis(autoDragAxis);
5122
4816
  }, [ref, userDragAxis, autoDragAxis]);
5123
- const parentAction = (0, import_react28.useMemo)(
5124
- () => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CornerLeftUp, { size: 16 }) }),
4817
+ const parentAction = (0, import_react26.useMemo)(
4818
+ () => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CornerLeftUp, { size: 16 }) }),
5125
4819
  [ctx == null ? void 0 : ctx.areaId]
5126
4820
  );
5127
- const nextContextValue = (0, import_react28.useMemo)(
4821
+ const nextContextValue = (0, import_react26.useMemo)(
5128
4822
  () => __spreadProps(__spreadValues({}, ctx), {
5129
4823
  areaId: id,
5130
4824
  zoneCompound,
@@ -5143,9 +4837,9 @@ var DraggableComponent = ({
5143
4837
  unregisterLocalZone
5144
4838
  ]
5145
4839
  );
5146
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropZoneProvider, { value: nextContextValue, children: [
4840
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropZoneProvider, { value: nextContextValue, children: [
5147
4841
  dragFinished && isVisible && (0, import_react_dom2.createPortal)(
5148
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4842
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
5149
4843
  "div",
5150
4844
  {
5151
4845
  className: getClassName16({
@@ -5157,15 +4851,15 @@ var DraggableComponent = ({
5157
4851
  "data-puck-overlay": true,
5158
4852
  children: [
5159
4853
  debug,
5160
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Loader, {}) }),
5161
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4854
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Loader, {}) }),
4855
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5162
4856
  "div",
5163
4857
  {
5164
4858
  className: getClassName16("actionsOverlay"),
5165
4859
  style: {
5166
4860
  top: actionsOverlayTop / zoom
5167
4861
  },
5168
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4862
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5169
4863
  "div",
5170
4864
  {
5171
4865
  className: getClassName16("actions"),
@@ -5177,14 +4871,14 @@ var DraggableComponent = ({
5177
4871
  paddingRight: actionsSide
5178
4872
  },
5179
4873
  ref: syncActionsPosition,
5180
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4874
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
5181
4875
  CustomActionBar,
5182
4876
  {
5183
4877
  parentAction,
5184
4878
  label: DEBUG2 ? id : label,
5185
4879
  children: [
5186
- permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Copy, { size: 16 }) }),
5187
- permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Trash, { size: 16 }) })
4880
+ permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Copy, { size: 16 }) }),
4881
+ permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Trash, { size: 16 }) })
5188
4882
  ]
5189
4883
  }
5190
4884
  )
@@ -5192,7 +4886,7 @@ var DraggableComponent = ({
5192
4886
  )
5193
4887
  }
5194
4888
  ),
5195
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName16("overlay") })
4889
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName16("overlay") })
5196
4890
  ]
5197
4891
  }
5198
4892
  ),
@@ -5211,7 +4905,7 @@ var import_react36 = require("@dnd-kit/react");
5211
4905
 
5212
4906
  // components/DropZone/lib/use-min-empty-height.ts
5213
4907
  init_react_import();
5214
- var import_react29 = require("react");
4908
+ var import_react27 = require("react");
5215
4909
  var getNumItems = (appStore, zoneCompound) => appStore.getState().state.indexes.zones[zoneCompound].contentIds.length;
5216
4910
  var useMinEmptyHeight = ({
5217
4911
  zoneCompound,
@@ -5219,8 +4913,8 @@ var useMinEmptyHeight = ({
5219
4913
  ref
5220
4914
  }) => {
5221
4915
  const appStore = useAppStoreApi();
5222
- const [prevHeight, setPrevHeight] = (0, import_react29.useState)(0);
5223
- const [isAnimating, setIsAnimating] = (0, import_react29.useState)(false);
4916
+ const [prevHeight, setPrevHeight] = (0, import_react27.useState)(0);
4917
+ const [isAnimating, setIsAnimating] = (0, import_react27.useState)(false);
5224
4918
  const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
5225
4919
  var _a, _b;
5226
4920
  return {
@@ -5228,7 +4922,7 @@ var useMinEmptyHeight = ({
5228
4922
  isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
5229
4923
  };
5230
4924
  });
5231
- const numItems = (0, import_react29.useRef)(0);
4925
+ const numItems = (0, import_react27.useRef)(0);
5232
4926
  const onDragFinished = useOnDragFinished(
5233
4927
  (finished) => {
5234
4928
  var _a;
@@ -5263,7 +4957,7 @@ var useMinEmptyHeight = ({
5263
4957
  },
5264
4958
  [appStore, prevHeight, zoneCompound]
5265
4959
  );
5266
- (0, import_react29.useEffect)(() => {
4960
+ (0, import_react27.useEffect)(() => {
5267
4961
  if (draggedItem && ref.current) {
5268
4962
  if (isZone) {
5269
4963
  const rect = ref.current.getBoundingClientRect();
@@ -5294,15 +4988,15 @@ function assignRefs(refs, node) {
5294
4988
 
5295
4989
  // components/DropZone/lib/use-content-with-preview.ts
5296
4990
  init_react_import();
5297
- var import_react32 = require("react");
4991
+ var import_react30 = require("react");
5298
4992
 
5299
4993
  // lib/dnd/use-rendered-callback.ts
5300
4994
  init_react_import();
5301
- var import_react30 = require("@dnd-kit/react");
5302
- var import_react31 = require("react");
4995
+ var import_react28 = require("@dnd-kit/react");
4996
+ var import_react29 = require("react");
5303
4997
  function useRenderedCallback(callback, deps) {
5304
- const manager = (0, import_react30.useDragDropManager)();
5305
- return (0, import_react31.useCallback)(
4998
+ const manager = (0, import_react28.useDragDropManager)();
4999
+ return (0, import_react29.useCallback)(
5306
5000
  (...args) => __async(this, null, function* () {
5307
5001
  yield manager == null ? void 0 : manager.renderer.rendering;
5308
5002
  return callback(...args);
@@ -5313,14 +5007,14 @@ function useRenderedCallback(callback, deps) {
5313
5007
 
5314
5008
  // components/DropZone/lib/use-content-with-preview.ts
5315
5009
  var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5316
- const zoneStore = (0, import_react32.useContext)(ZoneStoreContext);
5010
+ const zoneStore = (0, import_react30.useContext)(ZoneStoreContext);
5317
5011
  const preview = useContextStore(
5318
5012
  ZoneStoreContext,
5319
5013
  (s) => s.previewIndex[zoneCompound]
5320
5014
  );
5321
5015
  const isDragging = useAppStore((s) => s.state.ui.isDragging);
5322
- const [contentIdsWithPreview, setContentIdsWithPreview] = (0, import_react32.useState)(contentIds);
5323
- const [localPreview, setLocalPreview] = (0, import_react32.useState)(
5016
+ const [contentIdsWithPreview, setContentIdsWithPreview] = (0, import_react30.useState)(contentIds);
5017
+ const [localPreview, setLocalPreview] = (0, import_react30.useState)(
5324
5018
  preview
5325
5019
  );
5326
5020
  const updateContent = useRenderedCallback(
@@ -5355,7 +5049,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5355
5049
  },
5356
5050
  []
5357
5051
  );
5358
- (0, import_react32.useEffect)(() => {
5052
+ (0, import_react30.useEffect)(() => {
5359
5053
  var _a;
5360
5054
  const s = zoneStore.getState();
5361
5055
  const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
@@ -5373,16 +5067,16 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5373
5067
 
5374
5068
  // components/DropZone/lib/use-drag-axis.ts
5375
5069
  init_react_import();
5376
- var import_react33 = require("react");
5070
+ var import_react31 = require("react");
5377
5071
  var GRID_DRAG_AXIS = "dynamic";
5378
5072
  var FLEX_ROW_DRAG_AXIS = "x";
5379
5073
  var DEFAULT_DRAG_AXIS = "y";
5380
5074
  var useDragAxis = (ref, collisionAxis) => {
5381
5075
  const status = useAppStore((s) => s.status);
5382
- const [dragAxis, setDragAxis] = (0, import_react33.useState)(
5076
+ const [dragAxis, setDragAxis] = (0, import_react31.useState)(
5383
5077
  collisionAxis || DEFAULT_DRAG_AXIS
5384
5078
  );
5385
- const calculateDragAxis = (0, import_react33.useCallback)(() => {
5079
+ const calculateDragAxis = (0, import_react31.useCallback)(() => {
5386
5080
  if (ref.current) {
5387
5081
  const computedStyle = window.getComputedStyle(ref.current);
5388
5082
  if (computedStyle.display === "grid") {
@@ -5393,30 +5087,155 @@ var useDragAxis = (ref, collisionAxis) => {
5393
5087
  setDragAxis(DEFAULT_DRAG_AXIS);
5394
5088
  }
5395
5089
  }
5396
- }, [ref.current]);
5397
- (0, import_react33.useEffect)(() => {
5398
- const onViewportChange = () => {
5399
- calculateDragAxis();
5400
- };
5401
- window.addEventListener("viewportchange", onViewportChange);
5402
- return () => {
5403
- window.removeEventListener("viewportchange", onViewportChange);
5404
- };
5405
- }, []);
5406
- (0, import_react33.useEffect)(calculateDragAxis, [status, collisionAxis]);
5407
- return [dragAxis, calculateDragAxis];
5408
- };
5409
-
5410
- // components/DropZone/index.tsx
5411
- var import_shallow4 = require("zustand/react/shallow");
5090
+ }, [ref.current]);
5091
+ (0, import_react31.useEffect)(() => {
5092
+ const onViewportChange = () => {
5093
+ calculateDragAxis();
5094
+ };
5095
+ window.addEventListener("viewportchange", onViewportChange);
5096
+ return () => {
5097
+ window.removeEventListener("viewportchange", onViewportChange);
5098
+ };
5099
+ }, []);
5100
+ (0, import_react31.useEffect)(calculateDragAxis, [status, collisionAxis]);
5101
+ return [dragAxis, calculateDragAxis];
5102
+ };
5103
+
5104
+ // components/DropZone/index.tsx
5105
+ var import_shallow4 = require("zustand/react/shallow");
5106
+
5107
+ // components/Render/index.tsx
5108
+ init_react_import();
5109
+
5110
+ // lib/use-slots.tsx
5111
+ init_react_import();
5112
+ var import_react32 = require("react");
5113
+ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
5114
+ const slotProps = (0, import_react32.useMemo)(() => {
5115
+ const mapped = mapSlots(
5116
+ item,
5117
+ (content, _parentId, propName, field, propPath) => {
5118
+ const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
5119
+ const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
5120
+ const render = isReadOnly ? renderSlotRender : renderSlotEdit;
5121
+ const Slot = (dzProps) => render(__spreadProps(__spreadValues({
5122
+ allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
5123
+ disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
5124
+ }, dzProps), {
5125
+ zone: propName,
5126
+ content
5127
+ }));
5128
+ return Slot;
5129
+ },
5130
+ config
5131
+ ).props;
5132
+ return mapped;
5133
+ }, [config, item, readOnly, forceReadOnly]);
5134
+ const mergedProps = (0, import_react32.useMemo)(
5135
+ () => __spreadValues(__spreadValues({}, item.props), slotProps),
5136
+ [item.props, slotProps]
5137
+ );
5138
+ return mergedProps;
5139
+ }
5140
+
5141
+ // components/Render/index.tsx
5142
+ var import_react34 = __toESM(require("react"));
5143
+
5144
+ // components/SlotRender/index.tsx
5145
+ init_react_import();
5146
+ var import_shallow3 = require("zustand/react/shallow");
5147
+
5148
+ // components/SlotRender/server.tsx
5149
+ init_react_import();
5150
+ var import_react33 = require("react");
5151
+
5152
+ // components/ServerRender/index.tsx
5153
+ init_react_import();
5154
+ var import_jsx_runtime21 = require("react/jsx-runtime");
5155
+ function DropZoneRender({
5156
+ zone,
5157
+ data,
5158
+ areaId = "root",
5159
+ config,
5160
+ metadata = {}
5161
+ }) {
5162
+ let zoneCompound = rootDroppableId;
5163
+ let content = (data == null ? void 0 : data.content) || [];
5164
+ if (!data || !config) {
5165
+ return null;
5166
+ }
5167
+ if (areaId !== rootAreaId && zone !== rootZone) {
5168
+ zoneCompound = `${areaId}:${zone}`;
5169
+ content = setupZone(data, zoneCompound).zones[zoneCompound];
5170
+ }
5171
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: content.map((item) => {
5172
+ const Component = config.components[item.type];
5173
+ const props = __spreadProps(__spreadValues({}, item.props), {
5174
+ puck: {
5175
+ renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5176
+ DropZoneRender,
5177
+ {
5178
+ zone: zone2,
5179
+ data,
5180
+ areaId: item.props.id,
5181
+ config,
5182
+ metadata
5183
+ }
5184
+ ),
5185
+ metadata,
5186
+ dragRef: null,
5187
+ isEditing: false
5188
+ }
5189
+ });
5190
+ const renderItem = __spreadProps(__spreadValues({}, item), { props });
5191
+ const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
5192
+ if (Component) {
5193
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
5194
+ }
5195
+ return null;
5196
+ }) });
5197
+ }
5412
5198
 
5413
- // components/Render/index.tsx
5414
- init_react_import();
5415
- var import_react34 = __toESM(require("react"));
5199
+ // components/SlotRender/server.tsx
5200
+ var import_jsx_runtime22 = require("react/jsx-runtime");
5201
+ var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRender, __spreadValues({}, props));
5202
+ var Item = ({
5203
+ config,
5204
+ item,
5205
+ metadata
5206
+ }) => {
5207
+ const Component = config.components[item.type];
5208
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
5209
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5210
+ Component.render,
5211
+ __spreadProps(__spreadValues({}, props), {
5212
+ puck: __spreadProps(__spreadValues({}, props.puck), {
5213
+ renderDropZone: DropZoneRender,
5214
+ metadata: metadata || {}
5215
+ })
5216
+ })
5217
+ );
5218
+ };
5219
+ var SlotRender = (0, import_react33.forwardRef)(
5220
+ function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
5221
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
5222
+ if (!config.components[item.type]) {
5223
+ return null;
5224
+ }
5225
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5226
+ Item,
5227
+ {
5228
+ config,
5229
+ item,
5230
+ metadata
5231
+ },
5232
+ item.props.id
5233
+ );
5234
+ }) });
5235
+ }
5236
+ );
5416
5237
 
5417
5238
  // components/SlotRender/index.tsx
5418
- init_react_import();
5419
- var import_shallow3 = require("zustand/react/shallow");
5420
5239
  var import_jsx_runtime23 = require("react/jsx-runtime");
5421
5240
  var ContextSlotRender = ({
5422
5241
  componentId,
@@ -5450,7 +5269,7 @@ var renderContext = import_react34.default.createContext({
5450
5269
  data: { root: {}, content: [] },
5451
5270
  metadata: {}
5452
5271
  });
5453
- function Render2({
5272
+ function Render({
5454
5273
  config,
5455
5274
  data,
5456
5275
  metadata = {}
@@ -5604,14 +5423,14 @@ var DropZoneChild = ({
5604
5423
  isLoading
5605
5424
  );
5606
5425
  if (!item) return;
5607
- let Render3 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
5426
+ let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
5608
5427
  "No configuration for ",
5609
5428
  item.type
5610
5429
  ] });
5611
5430
  let componentType = item.type;
5612
5431
  const isInserting = "previewType" in item ? item.previewType === "insert" : false;
5613
5432
  if (isInserting) {
5614
- Render3 = renderPreview;
5433
+ Render2 = renderPreview;
5615
5434
  }
5616
5435
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5617
5436
  DraggableComponent,
@@ -5628,13 +5447,13 @@ var DropZoneChild = ({
5628
5447
  userDragAxis: collisionAxis,
5629
5448
  inDroppableZone,
5630
5449
  children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5631
- Render3,
5450
+ Render2,
5632
5451
  __spreadProps(__spreadValues({}, defaultedPropsWithSlots), {
5633
5452
  puck: __spreadProps(__spreadValues({}, defaultedPropsWithSlots.puck), {
5634
5453
  dragRef
5635
5454
  })
5636
5455
  })
5637
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render3, __spreadValues({}, defaultedPropsWithSlots)) })
5456
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues({}, defaultedPropsWithSlots)) })
5638
5457
  }
5639
5458
  );
5640
5459
  };
@@ -7548,7 +7367,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
7548
7367
  editMode: true,
7549
7368
  children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropZonePure, { zone: rootDroppableId })
7550
7369
  })
7551
- ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Render2, { data: renderData, config });
7370
+ ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Render, { data: renderData, config });
7552
7371
  (0, import_react46.useEffect)(() => {
7553
7372
  if (!iframe.enabled) {
7554
7373
  setStatus("READY");
@@ -9005,6 +8824,230 @@ Puck.Components = Components;
9005
8824
  Puck.Fields = Fields;
9006
8825
  Puck.Outline = Outline;
9007
8826
  Puck.Preview = Preview2;
8827
+
8828
+ // lib/migrate.ts
8829
+ init_react_import();
8830
+ var migrations = [
8831
+ // Migrate root to root.props
8832
+ (data) => {
8833
+ const rootProps = data.root.props || data.root;
8834
+ if (Object.keys(data.root).length > 0 && !data.root.props) {
8835
+ console.warn(
8836
+ "Migration applied: Root props moved from `root` to `root.props`."
8837
+ );
8838
+ return __spreadProps(__spreadValues({}, data), {
8839
+ root: {
8840
+ props: __spreadValues({}, rootProps)
8841
+ }
8842
+ });
8843
+ }
8844
+ return data;
8845
+ },
8846
+ // Migrate zones to slots
8847
+ (data, config, migrationOptions) => {
8848
+ var _a, _b;
8849
+ if (!config) return data;
8850
+ console.log("Migrating DropZones to slots...");
8851
+ const updatedItems = {};
8852
+ const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
8853
+ const { indexes } = walkAppState(appState, config);
8854
+ const deletedCompounds = [];
8855
+ walkAppState(appState, config, (content, zoneCompound, zoneType) => {
8856
+ var _a2, _b2, _c;
8857
+ if (zoneType === "dropzone") {
8858
+ const [id, slotName] = zoneCompound.split(":");
8859
+ const nodeData = indexes.nodes[id].data;
8860
+ const componentType = nodeData.type;
8861
+ const configForComponent = id === "root" ? config.root : config.components[componentType];
8862
+ if (((_b2 = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b2.type) === "slot") {
8863
+ updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
8864
+ props: __spreadProps(__spreadValues(__spreadValues({}, nodeData.props), (_c = updatedItems[id]) == null ? void 0 : _c.props), {
8865
+ [slotName]: content
8866
+ })
8867
+ });
8868
+ deletedCompounds.push(zoneCompound);
8869
+ }
8870
+ return content;
8871
+ }
8872
+ return content;
8873
+ });
8874
+ const updated = walkAppState(
8875
+ appState,
8876
+ config,
8877
+ (content) => content,
8878
+ (item) => {
8879
+ var _a2;
8880
+ return (_a2 = updatedItems[item.props.id]) != null ? _a2 : item;
8881
+ }
8882
+ );
8883
+ deletedCompounds.forEach((zoneCompound) => {
8884
+ var _a2;
8885
+ const [_, propName] = zoneCompound.split(":");
8886
+ console.log(
8887
+ `\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
8888
+ );
8889
+ (_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
8890
+ });
8891
+ if (migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) {
8892
+ const unmigratedZonesGrouped = {};
8893
+ Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
8894
+ var _a2;
8895
+ const [componentId, propName] = zoneCompound.split(":");
8896
+ const content = (_a2 = updated.data.zones) == null ? void 0 : _a2[zoneCompound];
8897
+ if (!content) {
8898
+ return;
8899
+ }
8900
+ if (!unmigratedZonesGrouped[componentId]) {
8901
+ unmigratedZonesGrouped[componentId] = {};
8902
+ }
8903
+ if (!unmigratedZonesGrouped[componentId][propName]) {
8904
+ unmigratedZonesGrouped[componentId][propName] = content;
8905
+ }
8906
+ });
8907
+ Object.keys(unmigratedZonesGrouped).forEach((componentId) => {
8908
+ updated.data = walkTree(updated.data, config, (content) => {
8909
+ return content.map((child) => {
8910
+ var _a2;
8911
+ if (child.props.id !== componentId) {
8912
+ return child;
8913
+ }
8914
+ const migrateFn = (_a2 = migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) == null ? void 0 : _a2[child.type];
8915
+ if (!migrateFn) {
8916
+ return child;
8917
+ }
8918
+ const zones = unmigratedZonesGrouped[componentId];
8919
+ const migratedProps = migrateFn(child.props, zones);
8920
+ Object.keys(zones).forEach((propName) => {
8921
+ var _a3;
8922
+ const zoneCompound = `${componentId}:${propName}`;
8923
+ console.log(`\u2713 Success: Migrated "${zoneCompound}" DropZone`);
8924
+ (_a3 = updated.data.zones) == null ? true : delete _a3[zoneCompound];
8925
+ });
8926
+ return __spreadProps(__spreadValues({}, child), {
8927
+ props: migratedProps
8928
+ });
8929
+ });
8930
+ });
8931
+ });
8932
+ }
8933
+ Object.keys((_b = updated.data.zones) != null ? _b : {}).forEach((zoneCompound) => {
8934
+ const [_, propName] = zoneCompound.split(":");
8935
+ throw new Error(
8936
+ `Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
8937
+ );
8938
+ });
8939
+ delete updated.data.zones;
8940
+ return updated.data;
8941
+ }
8942
+ ];
8943
+ function migrate(data, config, migrationOptions) {
8944
+ return migrations == null ? void 0 : migrations.reduce(
8945
+ (acc, migration) => migration(acc, config, migrationOptions),
8946
+ data
8947
+ );
8948
+ }
8949
+
8950
+ // lib/transform-props.ts
8951
+ init_react_import();
8952
+
8953
+ // lib/data/default-data.ts
8954
+ init_react_import();
8955
+ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
8956
+ root: data.root || {},
8957
+ content: data.content || []
8958
+ });
8959
+
8960
+ // lib/transform-props.ts
8961
+ function transformProps(data, propTransforms, config = { components: {} }) {
8962
+ const mapItem = (item) => {
8963
+ if (propTransforms[item.type]) {
8964
+ return __spreadProps(__spreadValues({}, item), {
8965
+ props: __spreadValues({
8966
+ id: item.props.id
8967
+ }, propTransforms[item.type](item.props))
8968
+ });
8969
+ }
8970
+ return item;
8971
+ };
8972
+ const defaultedData = defaultData(data);
8973
+ const rootProps = defaultedData.root.props || defaultedData.root;
8974
+ let newRoot = __spreadValues({}, defaultedData.root);
8975
+ if (propTransforms["root"]) {
8976
+ newRoot.props = propTransforms["root"](rootProps);
8977
+ }
8978
+ const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
8979
+ const updatedData = walkTree(
8980
+ dataWithUpdatedRoot,
8981
+ config,
8982
+ (content) => content.map(mapItem)
8983
+ );
8984
+ if (!defaultedData.root.props) {
8985
+ updatedData.root = updatedData.root.props;
8986
+ }
8987
+ return updatedData;
8988
+ }
8989
+
8990
+ // lib/resolve-all-data.ts
8991
+ init_react_import();
8992
+
8993
+ // lib/data/to-component.ts
8994
+ init_react_import();
8995
+ var toComponent = (item) => {
8996
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
8997
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
8998
+ type: "root"
8999
+ });
9000
+ };
9001
+
9002
+ // lib/resolve-all-data.ts
9003
+ function resolveAllData(_0, _1) {
9004
+ return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
9005
+ var _a;
9006
+ const defaultedData = defaultData(data);
9007
+ const resolveNode = (_node) => __async(this, null, function* () {
9008
+ const node = toComponent(_node);
9009
+ onResolveStart == null ? void 0 : onResolveStart(node);
9010
+ const resolved = (yield resolveComponentData(
9011
+ node,
9012
+ config,
9013
+ metadata,
9014
+ () => {
9015
+ },
9016
+ () => {
9017
+ },
9018
+ "force"
9019
+ )).node;
9020
+ const resolvedDeep = yield mapSlots(
9021
+ resolved,
9022
+ processContent,
9023
+ config
9024
+ );
9025
+ onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
9026
+ return resolvedDeep;
9027
+ });
9028
+ const processContent = (content) => __async(this, null, function* () {
9029
+ return Promise.all(content.map(resolveNode));
9030
+ });
9031
+ const processZones = () => __async(this, null, function* () {
9032
+ var _a2;
9033
+ const zones = (_a2 = data.zones) != null ? _a2 : {};
9034
+ Object.entries(zones).forEach((_02) => __async(this, [_02], function* ([zoneKey, content]) {
9035
+ zones[zoneKey] = yield Promise.all(content.map(resolveNode));
9036
+ }));
9037
+ return zones;
9038
+ });
9039
+ const dynamic = {
9040
+ root: yield resolveNode(defaultedData.root),
9041
+ content: yield processContent(defaultedData.content),
9042
+ zones: yield processZones()
9043
+ };
9044
+ Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(this, null, function* () {
9045
+ const content = defaultedData.zones[zoneKey];
9046
+ dynamic.zones[zoneKey] = yield processContent(content);
9047
+ }), {});
9048
+ return dynamic;
9049
+ });
9050
+ }
9008
9051
  // Annotate the CommonJS export names for ESM import in node:
9009
9052
  0 && (module.exports = {
9010
9053
  Action,