@makeswift/runtime 0.10.1 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/Button.cjs.js +1 -1
  2. package/dist/Button.es.js +1 -1
  3. package/dist/Carousel.cjs.js +1 -1
  4. package/dist/Carousel.es.js +1 -1
  5. package/dist/Countdown.cjs.js +2 -2
  6. package/dist/Countdown.es.js +2 -2
  7. package/dist/Divider.cjs.js +1 -1
  8. package/dist/Divider.es.js +1 -1
  9. package/dist/Embed.cjs.js +2 -1
  10. package/dist/Embed.cjs.js.map +1 -1
  11. package/dist/Embed.es.js +2 -1
  12. package/dist/Embed.es.js.map +1 -1
  13. package/dist/Form.cjs.js +2 -2
  14. package/dist/Form.es.js +2 -2
  15. package/dist/Image.cjs.js +1 -1
  16. package/dist/Image.es.js +1 -1
  17. package/dist/LiveProvider.cjs.js +1 -1
  18. package/dist/LiveProvider.es.js +1 -1
  19. package/dist/Navigation.cjs.js +1 -1
  20. package/dist/Navigation.es.js +1 -1
  21. package/dist/PreviewProvider.cjs.js +1 -1
  22. package/dist/PreviewProvider.es.js +2 -2
  23. package/dist/ReadOnlyText.cjs.js +1 -1
  24. package/dist/ReadOnlyText.es.js +2 -2
  25. package/dist/ReadOnlyTextV2.cjs.js +1 -1
  26. package/dist/ReadOnlyTextV2.es.js +2 -2
  27. package/dist/Root.cjs.js +1 -1
  28. package/dist/Root.es.js +1 -1
  29. package/dist/SocialLinks.cjs.js +1 -1
  30. package/dist/SocialLinks.es.js +1 -1
  31. package/dist/Video.cjs.js +2 -1
  32. package/dist/Video.cjs.js.map +1 -1
  33. package/dist/Video.es.js +2 -1
  34. package/dist/Video.es.js.map +1 -1
  35. package/dist/builder.cjs.js +2 -1
  36. package/dist/builder.cjs.js.map +1 -1
  37. package/dist/builder.es.js +2 -1
  38. package/dist/builder.es.js.map +1 -1
  39. package/dist/components.cjs.js +1 -1
  40. package/dist/components.es.js +1 -1
  41. package/dist/control-serialization.cjs.js +1 -0
  42. package/dist/control-serialization.cjs.js.map +1 -1
  43. package/dist/control-serialization.es.js +1 -0
  44. package/dist/control-serialization.es.js.map +1 -1
  45. package/dist/controls.cjs.js +4 -1
  46. package/dist/controls.cjs.js.map +1 -1
  47. package/dist/controls.es.js +3 -2
  48. package/dist/controls.es.js.map +1 -1
  49. package/dist/index.cjs.js +2 -2
  50. package/dist/index.cjs2.js +1 -0
  51. package/dist/index.cjs2.js.map +1 -1
  52. package/dist/index.cjs7.js +1 -1
  53. package/dist/index.cjs8.js +1 -1
  54. package/dist/index.es.js +2 -2
  55. package/dist/index.es2.js +1 -0
  56. package/dist/index.es2.js.map +1 -1
  57. package/dist/index.es5.js +1 -1
  58. package/dist/index.es7.js +2 -2
  59. package/dist/index.es8.js +2 -2
  60. package/dist/main.cjs.js +2 -1
  61. package/dist/main.cjs.js.map +1 -1
  62. package/dist/main.es.js +2 -1
  63. package/dist/main.es.js.map +1 -1
  64. package/dist/next.cjs.js +2 -2
  65. package/dist/next.es.js +2 -2
  66. package/dist/prop-controllers.cjs.js +2 -1
  67. package/dist/prop-controllers.cjs.js.map +1 -1
  68. package/dist/prop-controllers.es.js +2 -1
  69. package/dist/prop-controllers.es.js.map +1 -1
  70. package/dist/react-page.cjs.js +473 -308
  71. package/dist/react-page.cjs.js.map +1 -1
  72. package/dist/react-page.es.js +473 -309
  73. package/dist/react-page.es.js.map +1 -1
  74. package/dist/react.cjs.js +2 -2
  75. package/dist/react.es.js +2 -2
  76. package/dist/slate.cjs.js +2 -2
  77. package/dist/slate.es.js +3 -3
  78. package/dist/types/src/controls/control.d.ts +1 -1
  79. package/dist/types/src/controls/control.d.ts.map +1 -1
  80. package/dist/types/src/controls/rich-text/__test__/copy.test.d.ts +2 -0
  81. package/dist/types/src/controls/rich-text/__test__/copy.test.d.ts.map +1 -0
  82. package/dist/types/src/controls/rich-text/__test__/introspection.test.d.ts.map +1 -0
  83. package/dist/types/src/controls/rich-text/__test__/translation.test.d.ts.map +1 -0
  84. package/dist/types/src/controls/rich-text/copy.d.ts +4 -0
  85. package/dist/types/src/controls/rich-text/copy.d.ts.map +1 -0
  86. package/dist/types/src/controls/rich-text/index.d.ts +1 -0
  87. package/dist/types/src/controls/rich-text/index.d.ts.map +1 -1
  88. package/dist/types/src/controls/rich-text-v2/__test__/copy.test.d.ts +2 -0
  89. package/dist/types/src/controls/rich-text-v2/__test__/copy.test.d.ts.map +1 -0
  90. package/dist/types/src/controls/rich-text-v2/__test__/introspection.test.d.ts.map +1 -0
  91. package/dist/types/src/controls/rich-text-v2/copy.d.ts +4 -0
  92. package/dist/types/src/controls/rich-text-v2/copy.d.ts.map +1 -0
  93. package/dist/types/src/controls/rich-text-v2/index.d.ts +1 -0
  94. package/dist/types/src/controls/rich-text-v2/index.d.ts.map +1 -1
  95. package/dist/types/src/controls/rich-text-v2/translation.d.ts +1 -1
  96. package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -1
  97. package/dist/types/src/slate/InlinePlugin/index.d.ts +2 -2
  98. package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -3
  99. package/dist/types/src/slate/TypographyPlugin/index.d.ts +3 -3
  100. package/package.json +1 -1
  101. package/dist/types/src/controls/rich-text/introspection.test.d.ts.map +0 -1
  102. package/dist/types/src/controls/rich-text/translation.test.d.ts.map +0 -1
  103. package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts.map +0 -1
  104. /package/dist/types/src/controls/rich-text/{introspection.test.d.ts → __test__/introspection.test.d.ts} +0 -0
  105. /package/dist/types/src/controls/rich-text/{translation.test.d.ts → __test__/translation.test.d.ts} +0 -0
  106. /package/dist/types/src/controls/rich-text-v2/{introspection.test.d.ts → __test__/introspection.test.d.ts} +0 -0
@@ -34,16 +34,17 @@ var __publicField = (obj, key, value) => {
34
34
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
35
35
  return value;
36
36
  };
37
- var _a;
37
+ var _c;
38
38
  var redux = require("redux");
39
39
  var thunk = require("redux-thunk");
40
40
  var actions = require("./actions.cjs.js");
41
41
  var state_breakpoints = require("./state/breakpoints.cjs.js");
42
+ var slate = require("slate");
43
+ var uuid = require("uuid");
42
44
  var React = require("react");
43
45
  var css = require("@emotion/css");
44
46
  var serialize = require("@emotion/serialize");
45
47
  var utils = require("@emotion/utils");
46
- var slate = require("slate");
47
48
  var jsxRuntime = require("react/jsx-runtime");
48
49
  var isHotkey = require("is-hotkey");
49
50
  function _interopDefaultLegacy(e) {
@@ -119,8 +120,8 @@ function getDocuments(state) {
119
120
  return state;
120
121
  }
121
122
  function getDocument$1(state, documentKey) {
122
- var _a2;
123
- return (_a2 = getDocuments(state).get(documentKey)) != null ? _a2 : null;
123
+ var _a;
124
+ return (_a = getDocuments(state).get(documentKey)) != null ? _a : null;
124
125
  }
125
126
  function reducer$8(state = getInitialState$7(), action) {
126
127
  switch (action.type) {
@@ -144,8 +145,8 @@ function getReactComponents(state) {
144
145
  return state;
145
146
  }
146
147
  function getReactComponent$1(state, type) {
147
- var _a2;
148
- return (_a2 = getReactComponents(state).get(type)) != null ? _a2 : null;
148
+ var _a;
149
+ return (_a = getReactComponents(state).get(type)) != null ? _a : null;
149
150
  }
150
151
  function reducer$7(state = getInitialState$6(), action) {
151
152
  switch (action.type) {
@@ -169,8 +170,8 @@ function getPropControllerDescriptors$1(state) {
169
170
  return state;
170
171
  }
171
172
  function getComponentPropControllerDescriptors$1(state, componentType) {
172
- var _a2;
173
- return (_a2 = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a2 : null;
173
+ var _a;
174
+ return (_a = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a : null;
174
175
  }
175
176
  function reducer$6(state = getInitialState$5(), action) {
176
177
  switch (action.type) {
@@ -195,24 +196,24 @@ function getInitialState$4() {
195
196
  return { handles: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Map() };
196
197
  }
197
198
  function getPropControllersHandle(state, documentKey, elementKey) {
198
- var _a2, _b;
199
- return (_b = (_a2 = state.handles.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
199
+ var _a, _b;
200
+ return (_b = (_a = state.handles.get(documentKey)) == null ? void 0 : _a.get(elementKey)) != null ? _b : null;
200
201
  }
201
202
  function getPropControllers$1(state, documentKey, elementKey) {
202
- var _a2, _b;
203
- return (_b = (_a2 = state.instances.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
203
+ var _a, _b;
204
+ return (_b = (_a = state.instances.get(documentKey)) == null ? void 0 : _a.get(elementKey)) != null ? _b : null;
204
205
  }
205
206
  function getPropController(state, documentKey, elementKey, propName) {
206
- var _a2, _b;
207
- return (_b = (_a2 = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a2[propName]) != null ? _b : null;
207
+ var _a, _b;
208
+ return (_b = (_a = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a[propName]) != null ? _b : null;
208
209
  }
209
210
  function reducer$5(state = getInitialState$4(), action) {
210
- var _a2, _b, _c, _d;
211
+ var _a, _b, _c2, _d;
211
212
  switch (action.type) {
212
213
  case actions.ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {
213
214
  const { documentKey, elementKey, handle } = action.payload;
214
215
  return __spreadProps(__spreadValues({}, state), {
215
- handles: new Map(state.handles).set(documentKey, new Map((_a2 = state.handles.get(documentKey)) != null ? _a2 : []).set(elementKey, handle))
216
+ handles: new Map(state.handles).set(documentKey, new Map((_a = state.handles.get(documentKey)) != null ? _a : []).set(elementKey, handle))
216
217
  });
217
218
  }
218
219
  case actions.ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {
@@ -224,7 +225,7 @@ function reducer$5(state = getInitialState$4(), action) {
224
225
  case actions.ActionTypes.REGISTER_PROP_CONTROLLERS: {
225
226
  const { documentKey, elementKey, propControllers } = action.payload;
226
227
  return __spreadProps(__spreadValues({}, state), {
227
- instances: new Map(state.instances).set(documentKey, new Map((_c = state.instances.get(documentKey)) != null ? _c : []).set(elementKey, propControllers))
228
+ instances: new Map(state.instances).set(documentKey, new Map((_c2 = state.instances.get(documentKey)) != null ? _c2 : []).set(elementKey, propControllers))
228
229
  });
229
230
  }
230
231
  case actions.ActionTypes.UNREGISTER_PROP_CONTROLLERS: {
@@ -277,11 +278,11 @@ function reducer$2(state = getInitialState$1(), action) {
277
278
  }
278
279
  }
279
280
  function getInitialState(initialState) {
280
- var _a2, _b, _c;
281
+ var _a, _b, _c2;
281
282
  return {
282
- locales: (_a2 = initialState == null ? void 0 : initialState.locales) != null ? _a2 : [],
283
+ locales: (_a = initialState == null ? void 0 : initialState.locales) != null ? _a : [],
283
284
  locale: (_b = initialState == null ? void 0 : initialState.locale) != null ? _b : null,
284
- defaultLocale: (_c = initialState == null ? void 0 : initialState.defaultLocale) != null ? _c : null
285
+ defaultLocale: (_c2 = initialState == null ? void 0 : initialState.defaultLocale) != null ? _c2 : null
285
286
  };
286
287
  }
287
288
  function reducer$1(state = getInitialState(), action) {
@@ -322,11 +323,11 @@ function Color(config = {}) {
322
323
  return { type: ColorControlType, config };
323
324
  }
324
325
  function copyColorData(value, context) {
325
- var _a2;
326
+ var _a;
326
327
  if (value == null)
327
328
  return value;
328
329
  return __spreadProps(__spreadValues({}, value), {
329
- swatchId: (_a2 = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a2 : value.swatchId
330
+ swatchId: (_a = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a : value.swatchId
330
331
  });
331
332
  }
332
333
  class PropController {
@@ -357,10 +358,10 @@ const AllStyleControlProperties = [
357
358
  StyleControlProperty.TextStyle
358
359
  ];
359
360
  function Style(params) {
360
- var _a2;
361
+ var _a;
361
362
  return {
362
363
  type: StyleControlType,
363
- config: { properties: (_a2 = params == null ? void 0 : params.properties) != null ? _a2 : StyleControlDefaultProperties }
364
+ config: { properties: (_a = params == null ? void 0 : params.properties) != null ? _a : StyleControlDefaultProperties }
364
365
  };
365
366
  }
366
367
  Style.Default = StyleControlDefaultProperties;
@@ -814,10 +815,10 @@ function Image(config = {}) {
814
815
  }
815
816
  Image.Format = ImageControlValueFormat;
816
817
  function copyImageData(value, context) {
817
- var _a2;
818
+ var _a;
818
819
  if (value == null)
819
820
  return value;
820
- return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
821
+ return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
821
822
  }
822
823
  if (void 0) {
823
824
  const { describe, test, expect } = void 0;
@@ -850,7 +851,7 @@ function Link(config = {}) {
850
851
  return { type: LinkControlType, config };
851
852
  }
852
853
  function copyLinkData(value, context) {
853
- var _a2;
854
+ var _a;
854
855
  if (value == null)
855
856
  return value;
856
857
  if (value.type === "OPEN_PAGE") {
@@ -858,7 +859,7 @@ function copyLinkData(value, context) {
858
859
  if (pageId != null) {
859
860
  return __spreadProps(__spreadValues({}, value), {
860
861
  payload: __spreadProps(__spreadValues({}, value.payload), {
861
- pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
862
+ pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
862
863
  })
863
864
  });
864
865
  }
@@ -1212,22 +1213,22 @@ function copy$e(value, context) {
1212
1213
  return value;
1213
1214
  return value.map((override) => __spreadProps(__spreadValues({}, override), {
1214
1215
  value: override.value.map((backgroundItem) => {
1215
- var _a2, _b;
1216
+ var _a, _b;
1216
1217
  switch (backgroundItem.type) {
1217
1218
  case "color":
1218
1219
  return __spreadProps(__spreadValues({}, backgroundItem), {
1219
1220
  payload: backgroundItem.payload === null ? null : __spreadProps(__spreadValues({}, backgroundItem.payload), {
1220
- swatchId: (_a2 = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a2 : backgroundItem.payload.swatchId
1221
+ swatchId: (_a = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a : backgroundItem.payload.swatchId
1221
1222
  })
1222
1223
  });
1223
1224
  case "gradient":
1224
1225
  return __spreadProps(__spreadValues({}, backgroundItem), {
1225
1226
  payload: __spreadProps(__spreadValues({}, backgroundItem.payload), {
1226
1227
  stops: backgroundItem.payload.stops.map((stop) => {
1227
- var _a3;
1228
+ var _a2;
1228
1229
  return __spreadProps(__spreadValues({}, stop), {
1229
1230
  color: stop.color == null ? null : __spreadProps(__spreadValues({}, stop.color), {
1230
- swatchId: (_a3 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a3 : stop.color.swatchId
1231
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a2 : stop.color.swatchId
1231
1232
  })
1232
1233
  });
1233
1234
  })
@@ -1253,7 +1254,7 @@ function copy$d(value, context) {
1253
1254
  });
1254
1255
  }
1255
1256
  function copy$c(value, context) {
1256
- var _a2, _b;
1257
+ var _a, _b;
1257
1258
  if (value == null)
1258
1259
  return value;
1259
1260
  switch (value.type) {
@@ -1263,7 +1264,7 @@ function copy$c(value, context) {
1263
1264
  return value;
1264
1265
  return __spreadProps(__spreadValues({}, value), {
1265
1266
  payload: __spreadProps(__spreadValues({}, value.payload), {
1266
- pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
1267
+ pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
1267
1268
  })
1268
1269
  });
1269
1270
  }
@@ -1296,10 +1297,10 @@ function copy$b(value, context) {
1296
1297
  payload: __spreadProps(__spreadValues({}, item.payload), {
1297
1298
  link: link != null ? copy$c(link, context) : void 0,
1298
1299
  color: color != null ? color.map((override) => {
1299
- var _a2;
1300
+ var _a;
1300
1301
  return __spreadProps(__spreadValues({}, override), {
1301
1302
  value: __spreadProps(__spreadValues({}, override.value), {
1302
- swatchId: (_a2 = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a2 : override.value.swatchId
1303
+ swatchId: (_a = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a : override.value.swatchId
1303
1304
  })
1304
1305
  });
1305
1306
  }) : void 0
@@ -1357,14 +1358,14 @@ function copy$a(value, context) {
1357
1358
  return value;
1358
1359
  return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
1359
1360
  function copyShadowItem(item) {
1360
- var _a2;
1361
+ var _a;
1361
1362
  const { color } = item.payload;
1362
1363
  if (color == null)
1363
1364
  return item;
1364
1365
  return __spreadProps(__spreadValues({}, item), {
1365
1366
  payload: __spreadProps(__spreadValues({}, item.payload), {
1366
1367
  color: __spreadProps(__spreadValues({}, color), {
1367
- swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
1368
+ swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
1368
1369
  })
1369
1370
  })
1370
1371
  });
@@ -1418,10 +1419,10 @@ if (void 0) {
1418
1419
  });
1419
1420
  }
1420
1421
  function copy$9(value, context) {
1421
- var _a2;
1422
+ var _a;
1422
1423
  if (value == null)
1423
1424
  return value;
1424
- return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
1425
+ return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
1425
1426
  }
1426
1427
  if (void 0) {
1427
1428
  const { describe, test, expect } = void 0;
@@ -1454,13 +1455,13 @@ function copy$8(value, context) {
1454
1455
  return value;
1455
1456
  return value.map(copyImagesPanelItem);
1456
1457
  function copyImagesPanelItem(imagesPanelItem) {
1457
- var _a2;
1458
+ var _a;
1458
1459
  const { file } = imagesPanelItem.props;
1459
1460
  if (file == null)
1460
1461
  return imagesPanelItem;
1461
1462
  return __spreadProps(__spreadValues({}, imagesPanelItem), {
1462
1463
  props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
1463
- file: (_a2 = context.replacementContext.fileIds.get(file)) != null ? _a2 : file
1464
+ file: (_a = context.replacementContext.fileIds.get(file)) != null ? _a : file
1464
1465
  })
1465
1466
  });
1466
1467
  }
@@ -1509,9 +1510,9 @@ function copy$7(value, context) {
1509
1510
  return value;
1510
1511
  return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyColorValue(override.value) }));
1511
1512
  function copyColorValue(colorValue) {
1512
- var _a2;
1513
+ var _a;
1513
1514
  return __spreadProps(__spreadValues({}, colorValue), {
1514
- swatchId: (_a2 = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a2 : colorValue.swatchId
1515
+ swatchId: (_a = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a : colorValue.swatchId
1515
1516
  });
1516
1517
  }
1517
1518
  }
@@ -1520,9 +1521,9 @@ function copy$6(value, context) {
1520
1521
  return value;
1521
1522
  return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
1522
1523
  function copyFormFieldsPanelItem(item) {
1523
- var _a2;
1524
+ var _a;
1524
1525
  return __spreadProps(__spreadValues({}, item), {
1525
- tableColumnId: (_a2 = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a2 : item.tableColumnId
1526
+ tableColumnId: (_a = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a : item.tableColumnId
1526
1527
  });
1527
1528
  }
1528
1529
  }
@@ -1576,10 +1577,10 @@ if (void 0) {
1576
1577
  });
1577
1578
  }
1578
1579
  function copy$5(value, context) {
1579
- var _a2;
1580
+ var _a;
1580
1581
  if (value == null)
1581
1582
  return value;
1582
- return (_a2 = context.replacementContext.tableIds.get(value)) != null ? _a2 : value;
1583
+ return (_a = context.replacementContext.tableIds.get(value)) != null ? _a : value;
1583
1584
  }
1584
1585
  if (void 0) {
1585
1586
  const { describe, test, expect } = void 0;
@@ -1621,13 +1622,13 @@ function copy$4(value, context) {
1621
1622
  };
1622
1623
  }
1623
1624
  function copyBorderSide(borderSide) {
1624
- var _a2;
1625
+ var _a;
1625
1626
  const { color } = borderSide;
1626
1627
  if (color == null)
1627
1628
  return borderSide;
1628
1629
  return __spreadProps(__spreadValues({}, borderSide), {
1629
1630
  color: __spreadProps(__spreadValues({}, color), {
1630
- swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
1631
+ swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
1631
1632
  })
1632
1633
  });
1633
1634
  }
@@ -1741,24 +1742,24 @@ function copy$3(value, context) {
1741
1742
  return value;
1742
1743
  return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
1743
1744
  function copyNode(node) {
1744
- var _a2;
1745
+ var _a;
1745
1746
  switch (node.object) {
1746
1747
  case "document":
1747
1748
  case "block":
1748
1749
  case "inline":
1749
1750
  return copyInline(node);
1750
1751
  case "text":
1751
- return __spreadProps(__spreadValues({}, node), { marks: (_a2 = node.marks) == null ? void 0 : _a2.map(copyMark) });
1752
+ return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
1752
1753
  default:
1753
1754
  return node;
1754
1755
  }
1755
1756
  }
1756
1757
  function copyInline(inline) {
1757
- var _a2, _b;
1758
+ var _a, _b;
1758
1759
  switch (inline.type) {
1759
1760
  case "link":
1760
1761
  return __spreadProps(__spreadValues({}, inline), {
1761
- nodes: (_a2 = inline.nodes) == null ? void 0 : _a2.map(copyNode),
1762
+ nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
1762
1763
  data: inline.data ? copyLinkData2(inline.data) : inline.data
1763
1764
  });
1764
1765
  default:
@@ -1766,7 +1767,7 @@ function copy$3(value, context) {
1766
1767
  }
1767
1768
  }
1768
1769
  function copyLinkData2(data) {
1769
- var _a2, _b;
1770
+ var _a, _b;
1770
1771
  switch (data.type) {
1771
1772
  case "OPEN_PAGE": {
1772
1773
  const pageId = data.payload.pageId;
@@ -1774,7 +1775,7 @@ function copy$3(value, context) {
1774
1775
  return data;
1775
1776
  return __spreadProps(__spreadValues({}, data), {
1776
1777
  payload: __spreadProps(__spreadValues({}, data.payload), {
1777
- pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : data.payload.pageId
1778
+ pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
1778
1779
  })
1779
1780
  });
1780
1781
  }
@@ -1795,20 +1796,20 @@ function copy$3(value, context) {
1795
1796
  }
1796
1797
  }
1797
1798
  function copyMark(mark) {
1798
- var _a2, _b, _c, _d;
1799
+ var _a, _b, _c2, _d;
1799
1800
  switch (mark.type) {
1800
1801
  case "typography": {
1801
- const typographyId = (_a2 = mark.data) == null ? void 0 : _a2.value.id;
1802
+ const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
1802
1803
  return __spreadProps(__spreadValues({}, mark), {
1803
1804
  data: __spreadProps(__spreadValues({}, mark.data), {
1804
1805
  value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
1805
- id: (_c = context.replacementContext.typographyIds.get(typographyId)) != null ? _c : typographyId,
1806
+ id: (_c2 = context.replacementContext.typographyIds.get(typographyId)) != null ? _c2 : typographyId,
1806
1807
  style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
1807
- var _a3, _b2, _c2;
1808
+ var _a2, _b2, _c3;
1808
1809
  return __spreadProps(__spreadValues({}, override), {
1809
1810
  value: __spreadProps(__spreadValues({}, override.value), {
1810
1811
  color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
1811
- swatchId: (_c2 = context.replacementContext.swatchIds.get((_a3 = override.value.color) == null ? void 0 : _a3.swatchId)) != null ? _c2 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
1812
+ swatchId: (_c3 = context.replacementContext.swatchIds.get((_a2 = override.value.color) == null ? void 0 : _a2.swatchId)) != null ? _c3 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
1812
1813
  })
1813
1814
  })
1814
1815
  });
@@ -1959,110 +1960,89 @@ function copy$1(descriptor, value, context) {
1959
1960
  function copyElementReference(value, context) {
1960
1961
  return context.replacementContext.globalElementIds.get(value) || value;
1961
1962
  }
1962
- function copy(definition2, value, context) {
1963
- switch (definition2.type) {
1964
- case Types.Backgrounds:
1965
- case Types.Grid:
1966
- case Types.NavigationLinks:
1967
- case Types.Link:
1968
- case Types.Shadows:
1969
- case Types.Image:
1970
- case Types.Images:
1971
- case Types.ResponsiveColor:
1972
- case Types.TableFormFields:
1973
- case Types.Table:
1974
- case Types.Border:
1975
- case Types.RichText:
1976
- case Types.ElementID:
1977
- return copy$1(definition2, value, context);
1978
- case ColorControlType:
1979
- return copyColorData(value, context);
1980
- case ImageControlType:
1981
- return copyImageData(value, context);
1982
- case LinkControlType:
1983
- return copyLinkData(value, context);
1984
- case ShapeControlType:
1985
- return copyShapeData(definition2, value, context);
1986
- case ListControlType:
1987
- return copyListData(definition2, value, context);
1988
- case StyleControlType:
1989
- return copyStyleData(value, context);
1990
- case SlotControlType:
1991
- return copySlotData(value, context);
1992
- default:
1993
- return value;
1994
- }
1995
- }
1996
- function merge(definition2, a, b = a, context) {
1997
- switch (definition2.type) {
1998
- case SlotControlType:
1999
- return mergeSlotData(a, b, context);
2000
- default:
2001
- return b;
1963
+ function copyRichTextData(value, context) {
1964
+ if (value == null)
1965
+ return value;
1966
+ return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
1967
+ function copyNode(node) {
1968
+ var _a;
1969
+ switch (node.object) {
1970
+ case "document":
1971
+ case "block":
1972
+ case "inline":
1973
+ return copyInline(node);
1974
+ case "text":
1975
+ return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
1976
+ default:
1977
+ return node;
1978
+ }
2002
1979
  }
2003
- }
2004
- const unstable_IconRadioGroupIcon = {
2005
- TextAlignCenter: "TextAlignCenter",
2006
- TextAlignJustify: "TextAlignJustify",
2007
- TextAlignLeft: "TextAlignLeft",
2008
- TextAlignRight: "TextAlignRight",
2009
- Superscript: "Superscript16",
2010
- Subscript: "Subscript16",
2011
- Code: "Code16"
2012
- };
2013
- const IconRadioGroupControlType = "makeswift::controls::icon-radio-group";
2014
- function unstable_IconRadioGroup(config) {
2015
- return { type: IconRadioGroupControlType, config };
2016
- }
2017
- const SelectControlType = "makeswift::controls::select";
2018
- function Select(config) {
2019
- return { type: SelectControlType, config };
2020
- }
2021
- const isServer = typeof window === "undefined";
2022
- const useInsertionEffectSpecifier = "useInsertionEffect";
2023
- const useInsertionEffect = (_a = React__default["default"][useInsertionEffectSpecifier]) != null ? _a : React__default["default"].useLayoutEffect;
2024
- function useStyle(style) {
2025
- const serialized = serialize.serializeStyles([style], css.cache.registered);
2026
- utils.registerStyles(css.cache, serialized, false);
2027
- useInsertionEffect(() => {
2028
- utils.insertStyles(css.cache, serialized, false);
2029
- });
2030
- if (isServer)
2031
- utils.insertStyles(css.cache, serialized, false);
2032
- return `${css.cache.key}-${serialized.name}`;
2033
- }
2034
- const StyleV2ControlType = "makeswift::controls::style-v2";
2035
- const unstable_useStyleV2ClassName = useStyle;
2036
- function unstable_StyleV2(config) {
2037
- return { type: StyleV2ControlType, config };
2038
- }
2039
- const StyleV2ControlMessageType = {
2040
- CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model",
2041
- STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::style-v2::message::child-control-message"
2042
- };
2043
- class StyleV2Control extends PropController {
2044
- constructor(send, descriptor) {
2045
- super(send);
2046
- __publicField(this, "control");
2047
- this.control = createPropController(descriptor.config.type, (message) => {
2048
- this.send({
2049
- type: StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE,
2050
- payload: { message }
2051
- });
2052
- });
1980
+ function copyInline(inline) {
1981
+ var _a, _b;
1982
+ switch (inline.type) {
1983
+ case "link":
1984
+ return __spreadProps(__spreadValues({}, inline), {
1985
+ nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
1986
+ data: inline.data ? copyLinkData2(inline.data) : inline.data
1987
+ });
1988
+ default:
1989
+ return __spreadProps(__spreadValues({}, inline), { nodes: (_b = inline.nodes) == null ? void 0 : _b.map(copyNode) });
1990
+ }
2053
1991
  }
2054
- changeBoxModel(boxModel) {
2055
- this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
1992
+ function copyLinkData2(data) {
1993
+ var _a, _b;
1994
+ switch (data.type) {
1995
+ case "OPEN_PAGE": {
1996
+ const pageId = data.payload.pageId;
1997
+ if (pageId == null)
1998
+ return data;
1999
+ return __spreadProps(__spreadValues({}, data), {
2000
+ payload: __spreadProps(__spreadValues({}, data.payload), {
2001
+ pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
2002
+ })
2003
+ });
2004
+ }
2005
+ case "SCROLL_TO_ELEMENT": {
2006
+ const elementIdConfig = data.payload.elementIdConfig;
2007
+ if (elementIdConfig == null)
2008
+ return data;
2009
+ return __spreadProps(__spreadValues({}, data), {
2010
+ payload: __spreadProps(__spreadValues({}, data.payload), {
2011
+ elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
2012
+ elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
2013
+ })
2014
+ })
2015
+ });
2016
+ }
2017
+ default:
2018
+ return data;
2019
+ }
2056
2020
  }
2057
- recv(message) {
2058
- switch (message.type) {
2059
- case StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: {
2060
- const control = this.control;
2061
- if (control == null)
2062
- return;
2063
- const recv = control.recv;
2064
- recv(message.payload.message);
2021
+ function copyMark(mark) {
2022
+ var _a, _b, _c2, _d;
2023
+ switch (mark.type) {
2024
+ case "typography": {
2025
+ const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
2026
+ return __spreadProps(__spreadValues({}, mark), {
2027
+ data: __spreadProps(__spreadValues({}, mark.data), {
2028
+ value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
2029
+ id: (_c2 = context.replacementContext.typographyIds.get(typographyId)) != null ? _c2 : typographyId,
2030
+ style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
2031
+ var _a2, _b2, _c3;
2032
+ return __spreadProps(__spreadValues({}, override), {
2033
+ value: __spreadProps(__spreadValues({}, override.value), {
2034
+ color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
2035
+ swatchId: (_c3 = context.replacementContext.swatchIds.get((_a2 = override.value.color) == null ? void 0 : _a2.swatchId)) != null ? _c3 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
2036
+ })
2037
+ })
2038
+ });
2039
+ })
2040
+ })
2041
+ })
2042
+ });
2065
2043
  }
2044
+ default:
2045
+ return mark;
2066
2046
  }
2067
2047
  }
2068
2048
  }
@@ -2116,22 +2096,22 @@ function isText(node) {
2116
2096
  return false;
2117
2097
  }
2118
2098
  function toTextDAO(node) {
2119
- var _a2, _b, _c, _d;
2120
- const typographyMark = (_a2 = node.marks) == null ? void 0 : _a2.find((mark) => mark.type === "typography");
2099
+ var _a, _b, _c2, _d;
2100
+ const typographyMark = (_a = node.marks) == null ? void 0 : _a.find((mark) => mark.type === "typography");
2121
2101
  return [
2122
2102
  {
2123
2103
  text: (_b = node.text) != null ? _b : "",
2124
- typography: (_d = (_c = typographyMark == null ? void 0 : typographyMark.data) == null ? void 0 : _c.value) != null ? _d : void 0
2104
+ typography: (_d = (_c2 = typographyMark == null ? void 0 : typographyMark.data) == null ? void 0 : _c2.value) != null ? _d : void 0
2125
2105
  }
2126
2106
  ];
2127
2107
  }
2128
2108
  function toInlineDAO(node) {
2129
- var _a2, _b, _c, _d;
2109
+ var _a, _b, _c2, _d;
2130
2110
  switch (node.type) {
2131
2111
  case InlineType.Link:
2132
2112
  return [
2133
2113
  {
2134
- children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toInlineOrTextDAO)) != null ? _b : [],
2114
+ children: (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(toInlineOrTextDAO)) != null ? _b : [],
2135
2115
  [node.type]: node.data,
2136
2116
  type: node.type
2137
2117
  }
@@ -2141,7 +2121,7 @@ function toInlineDAO(node) {
2141
2121
  case InlineType.SuperScript:
2142
2122
  return [
2143
2123
  {
2144
- children: (_d = (_c = node.nodes) == null ? void 0 : _c.flatMap(toInlineOrTextDAO)) != null ? _d : [],
2124
+ children: (_d = (_c2 = node.nodes) == null ? void 0 : _c2.flatMap(toInlineOrTextDAO)) != null ? _d : [],
2145
2125
  type: node.type
2146
2126
  }
2147
2127
  ];
@@ -2177,8 +2157,8 @@ function toNodeDAO(node) {
2177
2157
  }
2178
2158
  }
2179
2159
  function richTextDTOtoSelection(data) {
2180
- var _a2, _b, _c, _d;
2181
- if (((_b = (_a2 = data.selection) == null ? void 0 : _a2.anchor) == null ? void 0 : _b.offset) != null && data.selection.anchor.path != null && ((_d = (_c = data.selection) == null ? void 0 : _c.focus) == null ? void 0 : _d.offset) != null && data.selection.focus.path != null)
2160
+ var _a, _b, _c2, _d;
2161
+ if (((_b = (_a = data.selection) == null ? void 0 : _a.anchor) == null ? void 0 : _b.offset) != null && data.selection.anchor.path != null && ((_d = (_c2 = data.selection) == null ? void 0 : _c2.focus) == null ? void 0 : _d.offset) != null && data.selection.focus.path != null)
2182
2162
  return {
2183
2163
  anchor: {
2184
2164
  offset: data.selection.anchor.offset,
@@ -2192,11 +2172,11 @@ function richTextDTOtoSelection(data) {
2192
2172
  return null;
2193
2173
  }
2194
2174
  function richTextDTOtoDAO(data) {
2195
- var _a2, _b, _c;
2196
- return (_c = (_b = (_a2 = data.document) == null ? void 0 : _a2.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c : [];
2175
+ var _a, _b, _c2;
2176
+ return (_c2 = (_b = (_a = data.document) == null ? void 0 : _a.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c2 : [];
2197
2177
  }
2198
2178
  function toInlineOrTextDTO(node) {
2199
- var _a2;
2179
+ var _a;
2200
2180
  if (isText(node)) {
2201
2181
  return [
2202
2182
  {
@@ -2221,7 +2201,7 @@ function toInlineOrTextDTO(node) {
2221
2201
  object: ObjectType.Inline,
2222
2202
  nodes: node.children.flatMap(toInlineOrTextDTO),
2223
2203
  type: node.type,
2224
- data: (_a2 = node.link) != null ? _a2 : void 0
2204
+ data: (_a = node.link) != null ? _a : void 0
2225
2205
  }
2226
2206
  ];
2227
2207
  case InlineType.Code:
@@ -2238,7 +2218,7 @@ function toInlineOrTextDTO(node) {
2238
2218
  }
2239
2219
  }
2240
2220
  function toNodeDTO(node) {
2241
- var _a2, _b;
2221
+ var _a, _b;
2242
2222
  if (isText(node))
2243
2223
  return toInlineOrTextDTO(node);
2244
2224
  switch (node.type) {
@@ -2267,7 +2247,7 @@ function toNodeDTO(node) {
2267
2247
  textAlign: node.textAlign
2268
2248
  } : {},
2269
2249
  object: "block",
2270
- nodes: (_b = (_a2 = node.children) == null ? void 0 : _a2.flatMap(toNodeDTO)) != null ? _b : []
2250
+ nodes: (_b = (_a = node.children) == null ? void 0 : _a.flatMap(toNodeDTO)) != null ? _b : []
2271
2251
  }
2272
2252
  ];
2273
2253
  default:
@@ -2373,17 +2353,6 @@ class RichTextControl extends PropController {
2373
2353
  this.send({ type: RichTextControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
2374
2354
  }
2375
2355
  }
2376
- function richTextV2DataToDescendents(data) {
2377
- return data.descendants;
2378
- }
2379
- function richTextV2DescendentsToData(descendants, key) {
2380
- return {
2381
- type: RichTextV2ControlType,
2382
- version: 2,
2383
- descendants,
2384
- key
2385
- };
2386
- }
2387
2356
  function createRichTextV2Plugin({
2388
2357
  control,
2389
2358
  withPlugin,
@@ -2530,9 +2499,9 @@ function getBlocksInSelection(editor) {
2530
2499
  })).filter((entry) => ElementUtils.isRootBlock(entry[0]));
2531
2500
  }
2532
2501
  function getActiveBlockType(editor) {
2533
- var _a2;
2502
+ var _a;
2534
2503
  const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
2535
- return rootBlocks.reduce((a, b) => a === b ? b : null, (_a2 = rootBlocks.at(0)) != null ? _a2 : null);
2504
+ return rootBlocks.reduce((a, b) => a === b ? b : null, (_a = rootBlocks.at(0)) != null ? _a : null);
2536
2505
  }
2537
2506
  function unwrapInline(editor, type) {
2538
2507
  slate.Transforms.unwrapNodes(editor, {
@@ -2558,13 +2527,13 @@ function getLinksAndTextInSelection(editor) {
2558
2527
  }));
2559
2528
  }
2560
2529
  const getValue$3 = (editor) => {
2561
- var _a2;
2530
+ var _a;
2562
2531
  const roots = filterForSubtreeRoots(getLinksAndTextInSelection(editor));
2563
2532
  const areAllRootsLinks = roots.every(([root]) => isLinkElement(root) || slate.Text.isText(root));
2564
2533
  if (!areAllRootsLinks)
2565
2534
  return void 0;
2566
2535
  const matchingValues = roots.map(([node]) => node).filter(isLinkElement);
2567
- const match = matchingValues.reduce((a, b) => deepEqual(a == null ? void 0 : a.link, b == null ? void 0 : b.link) ? b : null, (_a2 = matchingValues.at(0)) != null ? _a2 : void 0);
2536
+ const match = matchingValues.reduce((a, b) => deepEqual(a == null ? void 0 : a.link, b == null ? void 0 : b.link) ? b : null, (_a = matchingValues.at(0)) != null ? _a : void 0);
2568
2537
  return match == null ? match : match.link;
2569
2538
  };
2570
2539
  const onChange$1 = (editor, value) => {
@@ -2595,6 +2564,19 @@ function LinkPlugin() {
2595
2564
  }
2596
2565
  });
2597
2566
  }
2567
+ const unstable_IconRadioGroupIcon = {
2568
+ TextAlignCenter: "TextAlignCenter",
2569
+ TextAlignJustify: "TextAlignJustify",
2570
+ TextAlignLeft: "TextAlignLeft",
2571
+ TextAlignRight: "TextAlignRight",
2572
+ Superscript: "Superscript16",
2573
+ Subscript: "Subscript16",
2574
+ Code: "Code16"
2575
+ };
2576
+ const IconRadioGroupControlType = "makeswift::controls::icon-radio-group";
2577
+ function unstable_IconRadioGroup(config) {
2578
+ return { type: IconRadioGroupControlType, config };
2579
+ }
2598
2580
  const supportedInlineOptions = [
2599
2581
  {
2600
2582
  icon: unstable_IconRadioGroupIcon.Superscript,
@@ -2626,13 +2608,13 @@ function getSupportedInlinesAndTextInSelection(editor) {
2626
2608
  }));
2627
2609
  }
2628
2610
  const getValue$2 = (editor) => {
2629
- var _a2;
2611
+ var _a;
2630
2612
  const roots = filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor));
2631
2613
  const areAllRootsSupportedInlineTypesOrText = roots.every((entry) => isSupportedInlineEntry(entry) || slate.Text.isText(entry[0]));
2632
2614
  if (!areAllRootsSupportedInlineTypesOrText)
2633
2615
  return void 0;
2634
2616
  const matchingValues = roots.filter(isSupportedInlineEntry).map(([node]) => node);
2635
- const match = matchingValues.reduce((a, b) => (a == null ? void 0 : a.type) === (b == null ? void 0 : b.type) ? b : null, (_a2 = matchingValues.at(0)) != null ? _a2 : void 0);
2617
+ const match = matchingValues.reduce((a, b) => (a == null ? void 0 : a.type) === (b == null ? void 0 : b.type) ? b : null, (_a = matchingValues.at(0)) != null ? _a : void 0);
2636
2618
  return match == null ? match : match.type;
2637
2619
  };
2638
2620
  const onChange = (editor, value) => {
@@ -2688,10 +2670,10 @@ function InlinePlugin() {
2688
2670
  }
2689
2671
  });
2690
2672
  }
2691
- function InlinePluginComponent(_b) {
2692
- var _c = _b, {
2673
+ function InlinePluginComponent(_a) {
2674
+ var _b = _a, {
2693
2675
  renderElement
2694
- } = _c, props = __objRest(_c, [
2676
+ } = _b, props = __objRest(_b, [
2695
2677
  "renderElement"
2696
2678
  ]);
2697
2679
  switch (props.element.type) {
@@ -2851,8 +2833,8 @@ function TextAlignPlugin() {
2851
2833
  });
2852
2834
  }
2853
2835
  function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
2854
- var _a2, _b;
2855
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
2836
+ var _a, _b;
2837
+ const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
2856
2838
  if (!at)
2857
2839
  return;
2858
2840
  const rootElements = getBlocksInSelection(editor);
@@ -2871,17 +2853,21 @@ function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options
2871
2853
  }
2872
2854
  }
2873
2855
  function clearBlockKeyForDevice(editor, deviceId, key) {
2874
- var _a2;
2856
+ var _a;
2875
2857
  const rootElements = getBlocksInSelection(editor);
2876
2858
  for (const [node, path] of rootElements) {
2877
2859
  if (ElementUtils.isBlock(node)) {
2878
- const deviceOverrides = (_a2 = node[key]) != null ? _a2 : [];
2860
+ const deviceOverrides = (_a = node[key]) != null ? _a : [];
2879
2861
  slate.Transforms.setNodes(editor, {
2880
2862
  [key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
2881
2863
  }, { at: path });
2882
2864
  }
2883
2865
  }
2884
2866
  }
2867
+ const SelectControlType = "makeswift::controls::select";
2868
+ function Select(config) {
2869
+ return { type: SelectControlType, config };
2870
+ }
2885
2871
  const EditorUtils = {
2886
2872
  getFirstAncestorList(editor, path) {
2887
2873
  try {
@@ -2931,8 +2917,8 @@ function unwrapPath(editor, listItemPath) {
2931
2917
  });
2932
2918
  }
2933
2919
  function unwrapList(editor, options) {
2934
- var _a2;
2935
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
2920
+ var _a;
2921
+ const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
2936
2922
  if (!at)
2937
2923
  return;
2938
2924
  const listItems = Array.from(slate.Editor.nodes(editor, {
@@ -2951,8 +2937,8 @@ function unwrapList(editor, options) {
2951
2937
  });
2952
2938
  }
2953
2939
  function wrapList(editor, options = { type: BlockType.UnorderedList }) {
2954
- var _a2;
2955
- const at = (_a2 = options.at) != null ? _a2 : editor.selection;
2940
+ var _a;
2941
+ const at = (_a = options.at) != null ? _a : editor.selection;
2956
2942
  if (!at)
2957
2943
  return;
2958
2944
  const nonListEntries = Array.from(slate.Editor.nodes(editor, {
@@ -2991,7 +2977,7 @@ const LocationUtils = {
2991
2977
  }
2992
2978
  };
2993
2979
  function getSelectedListItems(editor) {
2994
- var _a2, _b;
2980
+ var _a, _b;
2995
2981
  if (!editor.selection)
2996
2982
  return [];
2997
2983
  const start = LocationUtils.getStartPath(editor.selection);
@@ -2999,7 +2985,7 @@ function getSelectedListItems(editor) {
2999
2985
  at: editor.selection,
3000
2986
  match: (node) => ElementUtils.isListItem(node)
3001
2987
  });
3002
- const firstAncestorPath = (_b = (_a2 = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a2[1]) != null ? _b : [];
2988
+ const firstAncestorPath = (_b = (_a = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a[1]) != null ? _b : [];
3003
2989
  return Array.from(listItems).filter((node) => slate.Path.isDescendant(start, node[1]) ? slate.Path.equals(node[1], firstAncestorPath) : !slate.Path.isAfter(start, node[1]));
3004
2990
  }
3005
2991
  function indentPath(editor, path) {
@@ -3076,8 +3062,8 @@ function dedent(editor) {
3076
3062
  });
3077
3063
  }
3078
3064
  function toggleList(editor, options = { type: BlockType.UnorderedList }) {
3079
- var _a2;
3080
- const at = (_a2 = options.at) != null ? _a2 : editor.selection;
3065
+ var _a;
3066
+ const at = (_a = options.at) != null ? _a : editor.selection;
3081
3067
  if (at == null)
3082
3068
  return;
3083
3069
  const start = LocationUtils.getStartPath(at);
@@ -3094,6 +3080,19 @@ function toggleList(editor, options = { type: BlockType.UnorderedList }) {
3094
3080
  slate.Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath });
3095
3081
  }
3096
3082
  }
3083
+ const isServer = typeof window === "undefined";
3084
+ const useInsertionEffectSpecifier = "useInsertionEffect";
3085
+ const useInsertionEffect = (_c = React__default["default"][useInsertionEffectSpecifier]) != null ? _c : React__default["default"].useLayoutEffect;
3086
+ function useStyle(style) {
3087
+ const serialized = serialize.serializeStyles([style], css.cache.registered);
3088
+ utils.registerStyles(css.cache, serialized, false);
3089
+ useInsertionEffect(() => {
3090
+ utils.insertStyles(css.cache, serialized, false);
3091
+ });
3092
+ if (isServer)
3093
+ utils.insertStyles(css.cache, serialized, false);
3094
+ return `${css.cache.key}-${serialized.name}`;
3095
+ }
3097
3096
  const BlockActions = {
3098
3097
  setBlockKeyForDevice,
3099
3098
  clearBlockKeyForDevice,
@@ -3175,9 +3174,9 @@ function withBlock(editor) {
3175
3174
  return ElementUtils.isInline(entry);
3176
3175
  };
3177
3176
  editor.normalizeNode = (entry) => {
3178
- var _a2;
3177
+ var _a;
3179
3178
  const [normalizationNode, normalizationPath] = entry;
3180
- if (ElementUtils.isBlock(normalizationNode) && ((_a2 = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a2.length) == 0) {
3179
+ if (ElementUtils.isBlock(normalizationNode) && ((_a = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a.length) == 0) {
3181
3180
  slate.Transforms.unsetNodes(editor, "textAlign", {
3182
3181
  at: normalizationPath
3183
3182
  });
@@ -3418,8 +3417,8 @@ function BlockPluginComponent(_d) {
3418
3417
  }
3419
3418
  function clearActiveTypographyStyle(editor, options) {
3420
3419
  slate.Editor.withoutNormalizing(editor, () => {
3421
- var _a2;
3422
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
3420
+ var _a;
3421
+ const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
3423
3422
  if (!at)
3424
3423
  return;
3425
3424
  const atRef = slate.Editor.rangeRef(editor, at);
@@ -3453,8 +3452,8 @@ function clearActiveTypographyStyle(editor, options) {
3453
3452
  }
3454
3453
  function clearDeviceActiveTypography(editor, currentDeviceId, options) {
3455
3454
  slate.Editor.withoutNormalizing(editor, () => {
3456
- var _a2, _b, _c;
3457
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
3455
+ var _a, _b, _c2;
3456
+ const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
3458
3457
  if (!at)
3459
3458
  return;
3460
3459
  const atRef = slate.Editor.rangeRef(editor, at);
@@ -3475,7 +3474,7 @@ function clearDeviceActiveTypography(editor, currentDeviceId, options) {
3475
3474
  for (const [node, path] of textNodes) {
3476
3475
  if (slate.Text.isText(node)) {
3477
3476
  const typography = __spreadProps(__spreadValues({}, node.typography), {
3478
- style: (_c = (_b = node == null ? void 0 : node.typography) == null ? void 0 : _b.style.filter(({ deviceId }) => deviceId !== currentDeviceId)) != null ? _c : []
3477
+ style: (_c2 = (_b = node == null ? void 0 : node.typography) == null ? void 0 : _b.style.filter(({ deviceId }) => deviceId !== currentDeviceId)) != null ? _c2 : []
3479
3478
  });
3480
3479
  slate.Transforms.setNodes(editor, {
3481
3480
  typography
@@ -3488,8 +3487,8 @@ function clearDeviceActiveTypography(editor, currentDeviceId, options) {
3488
3487
  }
3489
3488
  function detachActiveTypography(editor, value, options) {
3490
3489
  slate.Editor.withoutNormalizing(editor, () => {
3491
- var _a2;
3492
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
3490
+ var _a;
3491
+ const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
3493
3492
  if (!at)
3494
3493
  return;
3495
3494
  const atRef = slate.Editor.rangeRef(editor, at);
@@ -3521,8 +3520,8 @@ function detachActiveTypography(editor, value, options) {
3521
3520
  });
3522
3521
  }
3523
3522
  function setActiveTypographyId(editor, id, options) {
3524
- var _a2;
3525
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
3523
+ var _a;
3524
+ const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
3526
3525
  if (!at)
3527
3526
  return;
3528
3527
  slate.Transforms.setNodes(editor, {
@@ -3538,8 +3537,8 @@ function setActiveTypographyId(editor, id, options) {
3538
3537
  }
3539
3538
  function setActiveTypographyStyle(editor, breakpoints, deviceId, prop, value, options) {
3540
3539
  slate.Editor.withoutNormalizing(editor, () => {
3541
- var _a2, _b, _c;
3542
- const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
3540
+ var _a, _b, _c2;
3541
+ const at = (_a = options == null ? void 0 : options.at) != null ? _a : editor.selection;
3543
3542
  if (!at)
3544
3543
  return;
3545
3544
  const atRef = slate.Editor.rangeRef(editor, at);
@@ -3559,7 +3558,7 @@ function setActiveTypographyStyle(editor, breakpoints, deviceId, prop, value, op
3559
3558
  }));
3560
3559
  for (const [node, path] of textNodes) {
3561
3560
  if (slate.Text.isText(node)) {
3562
- const deviceOverrides = (_c = (_b = node == null ? void 0 : node.typography) == null ? void 0 : _b.style) != null ? _c : [];
3561
+ const deviceOverrides = (_c2 = (_b = node == null ? void 0 : node.typography) == null ? void 0 : _b.style) != null ? _c2 : [];
3563
3562
  const deviceStyle = state_breakpoints.findBreakpointOverride(breakpoints, deviceOverrides, deviceId, (v) => v) || {
3564
3563
  value: {}
3565
3564
  };
@@ -3597,9 +3596,9 @@ const TYPOGRAPHY_KEY = "typography";
3597
3596
  function withTypography(editor) {
3598
3597
  const { normalizeNode } = editor;
3599
3598
  editor.normalizeNode = (entry) => {
3600
- var _a2, _b;
3599
+ var _a, _b;
3601
3600
  const [normalizationNode, normalizationPath] = entry;
3602
- if (slate.Text.isText(normalizationNode) && ((_a2 = normalizationNode == null ? void 0 : normalizationNode.typography) == null ? void 0 : _a2.id) == null && ((_b = normalizationNode == null ? void 0 : normalizationNode.typography) == null ? void 0 : _b.style.length) === 0) {
3601
+ if (slate.Text.isText(normalizationNode) && ((_a = normalizationNode == null ? void 0 : normalizationNode.typography) == null ? void 0 : _a.id) == null && ((_b = normalizationNode == null ? void 0 : normalizationNode.typography) == null ? void 0 : _b.style.length) === 0) {
3603
3602
  slate.Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath });
3604
3603
  return;
3605
3604
  }
@@ -3752,7 +3751,7 @@ class RichTextV2Control extends PropController {
3752
3751
  __publicField(this, "defaultValue", null);
3753
3752
  __publicField(this, "descriptor");
3754
3753
  __publicField(this, "recv", (message) => {
3755
- var _a2, _b, _c;
3754
+ var _a, _b, _c2;
3756
3755
  if (!this.editor)
3757
3756
  return;
3758
3757
  switch (message.type) {
@@ -3770,7 +3769,7 @@ class RichTextV2Control extends PropController {
3770
3769
  break;
3771
3770
  }
3772
3771
  case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
3773
- (_c = (_b = (_a2 = this.descriptor.config.plugins) == null ? void 0 : _a2.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c.onChange(this.editor, message.value);
3772
+ (_c2 = (_b = (_a = this.descriptor.config.plugins) == null ? void 0 : _a.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c2.onChange(this.editor, message.value);
3774
3773
  break;
3775
3774
  }
3776
3775
  }
@@ -3779,14 +3778,14 @@ class RichTextV2Control extends PropController {
3779
3778
  this.send = send;
3780
3779
  }
3781
3780
  setEditor(editor) {
3782
- var _a2, _b, _c;
3781
+ var _a, _b, _c2;
3783
3782
  this.editor = editor;
3784
3783
  this.send({
3785
3784
  type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
3786
- value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
3787
- var _a3;
3788
- return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
3789
- })) != null ? _c : []
3785
+ value: (_c2 = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
3786
+ var _a2;
3787
+ return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
3788
+ })) != null ? _c2 : []
3790
3789
  });
3791
3790
  const _onChange = editor.onChange;
3792
3791
  this.editor.onChange = (options) => {
@@ -3813,16 +3812,16 @@ class RichTextV2Control extends PropController {
3813
3812
  });
3814
3813
  }
3815
3814
  updatePluginValues() {
3816
- var _a2, _b, _c;
3815
+ var _a, _b, _c2;
3817
3816
  const editor = this.editor;
3818
3817
  if (editor == null)
3819
3818
  return;
3820
3819
  this.send({
3821
3820
  type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
3822
- value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
3823
- var _a3;
3824
- return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
3825
- })) != null ? _c : []
3821
+ value: (_c2 = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
3822
+ var _a2;
3823
+ return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
3824
+ })) != null ? _c2 : []
3826
3825
  });
3827
3826
  }
3828
3827
  select() {
@@ -3844,6 +3843,171 @@ class RichTextV2Control extends PropController {
3844
3843
  function isRichTextV1Data(value) {
3845
3844
  return value !== void 0 && typeof value === "object" && !Array.isArray(value) && "document" in value;
3846
3845
  }
3846
+ function richTextV2DataToDescendents(data) {
3847
+ return data.descendants;
3848
+ }
3849
+ function richTextV2DescendentsToData(descendants, key) {
3850
+ return {
3851
+ type: RichTextV2ControlType,
3852
+ version: 2,
3853
+ descendants,
3854
+ key: key != null ? key : uuid.v4()
3855
+ };
3856
+ }
3857
+ function copyRichTextV2Data(data, context) {
3858
+ var _a;
3859
+ if (data == null)
3860
+ return data;
3861
+ return richTextV2DescendentsToData((_a = data.descendants) == null ? void 0 : _a.flatMap((d) => copyNode(d)));
3862
+ function copyNode(descendant) {
3863
+ if (slate.Element.isElement(descendant) && ElementUtils.isInline(descendant)) {
3864
+ return copyLinkData2(descendant);
3865
+ }
3866
+ if (slate.Text.isText(descendant)) {
3867
+ return copyTypographyData(descendant);
3868
+ }
3869
+ return __spreadProps(__spreadValues({}, descendant), { children: descendant.children.map(copyNode) });
3870
+ }
3871
+ function copyLinkData2(descendant) {
3872
+ var _a2, _b;
3873
+ if (descendant.type !== "link") {
3874
+ return __spreadProps(__spreadValues({}, descendant), { children: descendant.children.map(copyNode) });
3875
+ }
3876
+ if (descendant.link == null)
3877
+ return descendant;
3878
+ switch (descendant.link.type) {
3879
+ case "OPEN_PAGE": {
3880
+ const pageId = descendant.link.payload.pageId;
3881
+ if (pageId == null)
3882
+ return descendant;
3883
+ return __spreadProps(__spreadValues({}, descendant), {
3884
+ link: __spreadProps(__spreadValues({}, descendant.link), {
3885
+ payload: __spreadProps(__spreadValues({}, descendant.link.payload), {
3886
+ pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : descendant.link.payload.pageId
3887
+ })
3888
+ }),
3889
+ children: descendant.children.map(copyNode)
3890
+ });
3891
+ }
3892
+ case "SCROLL_TO_ELEMENT": {
3893
+ const elementIdConfig = descendant.link.payload.elementIdConfig;
3894
+ if (elementIdConfig == null)
3895
+ return descendant;
3896
+ return __spreadProps(__spreadValues({}, descendant), {
3897
+ link: __spreadProps(__spreadValues({}, descendant.link), {
3898
+ payload: __spreadProps(__spreadValues({}, descendant.link.payload), {
3899
+ elementIdConfig: __spreadProps(__spreadValues({}, elementIdConfig), {
3900
+ elementKey: (_b = context.replacementContext.elementKeys.get(elementIdConfig.elementKey)) != null ? _b : elementIdConfig.elementKey
3901
+ })
3902
+ })
3903
+ }),
3904
+ children: descendant.children.map(copyNode)
3905
+ });
3906
+ }
3907
+ default:
3908
+ return descendant;
3909
+ }
3910
+ }
3911
+ function copyTypographyData(descendant) {
3912
+ var _a2, _b, _c2, _d, _e;
3913
+ return __spreadValues(__spreadValues({}, descendant), descendant.typography == null ? {} : {
3914
+ typography: {
3915
+ id: (_d = context.replacementContext.typographyIds.get((_b = (_a2 = descendant.typography) == null ? void 0 : _a2.id) != null ? _b : "")) != null ? _d : (_c2 = descendant.typography) == null ? void 0 : _c2.id,
3916
+ style: (_e = descendant.typography) == null ? void 0 : _e.style.map((override) => {
3917
+ var _a3, _b2, _c3, _d2;
3918
+ return __spreadProps(__spreadValues({}, override), {
3919
+ value: __spreadValues(__spreadValues({}, override.value), override.value.color == null ? {} : {
3920
+ color: __spreadProps(__spreadValues({}, override.value.color), {
3921
+ swatchId: (_d2 = context.replacementContext.swatchIds.get((_b2 = (_a3 = override.value.color) == null ? void 0 : _a3.swatchId) != null ? _b2 : "")) != null ? _d2 : (_c3 = override.value.color) == null ? void 0 : _c3.swatchId
3922
+ })
3923
+ })
3924
+ });
3925
+ })
3926
+ }
3927
+ });
3928
+ }
3929
+ }
3930
+ function copy(definition2, value, context) {
3931
+ switch (definition2.type) {
3932
+ case Types.Backgrounds:
3933
+ case Types.Grid:
3934
+ case Types.NavigationLinks:
3935
+ case Types.Link:
3936
+ case Types.Shadows:
3937
+ case Types.Image:
3938
+ case Types.Images:
3939
+ case Types.ResponsiveColor:
3940
+ case Types.TableFormFields:
3941
+ case Types.Table:
3942
+ case Types.Border:
3943
+ case Types.RichText:
3944
+ case Types.ElementID:
3945
+ return copy$1(definition2, value, context);
3946
+ case RichTextControlType:
3947
+ return copyRichTextData(value, context);
3948
+ case RichTextV2ControlType:
3949
+ return copyRichTextV2Data(isRichTextV1Data(value) ? richTextV2DescendentsToData(richTextDTOtoDAO(value)) : value, context);
3950
+ case ColorControlType:
3951
+ return copyColorData(value, context);
3952
+ case ImageControlType:
3953
+ return copyImageData(value, context);
3954
+ case LinkControlType:
3955
+ return copyLinkData(value, context);
3956
+ case ShapeControlType:
3957
+ return copyShapeData(definition2, value, context);
3958
+ case ListControlType:
3959
+ return copyListData(definition2, value, context);
3960
+ case StyleControlType:
3961
+ return copyStyleData(value, context);
3962
+ case SlotControlType:
3963
+ return copySlotData(value, context);
3964
+ default:
3965
+ return value;
3966
+ }
3967
+ }
3968
+ function merge(definition2, a, b = a, context) {
3969
+ switch (definition2.type) {
3970
+ case SlotControlType:
3971
+ return mergeSlotData(a, b, context);
3972
+ default:
3973
+ return b;
3974
+ }
3975
+ }
3976
+ const StyleV2ControlType = "makeswift::controls::style-v2";
3977
+ const unstable_useStyleV2ClassName = useStyle;
3978
+ function unstable_StyleV2(config) {
3979
+ return { type: StyleV2ControlType, config };
3980
+ }
3981
+ const StyleV2ControlMessageType = {
3982
+ CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model",
3983
+ STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: "makeswift::controls::style-v2::message::child-control-message"
3984
+ };
3985
+ class StyleV2Control extends PropController {
3986
+ constructor(send, descriptor) {
3987
+ super(send);
3988
+ __publicField(this, "control");
3989
+ this.control = createPropController(descriptor.config.type, (message) => {
3990
+ this.send({
3991
+ type: StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE,
3992
+ payload: { message }
3993
+ });
3994
+ });
3995
+ }
3996
+ changeBoxModel(boxModel) {
3997
+ this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
3998
+ }
3999
+ recv(message) {
4000
+ switch (message.type) {
4001
+ case StyleV2ControlMessageType.STYLE_V2_CONTROL_CHILD_CONTROL_MESSAGE: {
4002
+ const control = this.control;
4003
+ if (control == null)
4004
+ return;
4005
+ const recv = control.recv;
4006
+ recv(message.payload.message);
4007
+ }
4008
+ }
4009
+ }
4010
+ }
3847
4011
  const TypographyControlType = "makeswift::controls::typography";
3848
4012
  function unstable_Typography() {
3849
4013
  return {
@@ -3851,11 +4015,11 @@ function unstable_Typography() {
3851
4015
  };
3852
4016
  }
3853
4017
  function getTypographySwatchIds(value) {
3854
- var _a2;
3855
- return (_a2 = value == null ? void 0 : value.style.flatMap((style) => {
3856
- var _a3, _b;
3857
- return (_b = (_a3 = style.value.color) == null ? void 0 : _a3.swatchId) != null ? _b : [];
3858
- }).filter(isNonNullable)) != null ? _a2 : [];
4018
+ var _a;
4019
+ return (_a = value == null ? void 0 : value.style.flatMap((style) => {
4020
+ var _a2, _b;
4021
+ return (_b = (_a2 = style.value.color) == null ? void 0 : _a2.swatchId) != null ? _b : [];
4022
+ }).filter(isNonNullable)) != null ? _a : [];
3859
4023
  }
3860
4024
  function getTypographyTypographyIds(value) {
3861
4025
  return [value == null ? void 0 : value.id].filter(isNonNullable);
@@ -3865,28 +4029,28 @@ function getRichTextSwatchIds(value) {
3865
4029
  return [];
3866
4030
  return getNodeSwatchIds(value.document);
3867
4031
  function getNodeSwatchIds(node) {
3868
- var _a2, _b, _c, _d;
4032
+ var _a, _b, _c2, _d;
3869
4033
  switch (node.object) {
3870
4034
  case "document":
3871
4035
  case "block":
3872
4036
  case "inline":
3873
- return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeSwatchIds)) != null ? _b : [];
4037
+ return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodeSwatchIds)) != null ? _b : [];
3874
4038
  case "text":
3875
- return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
4039
+ return (_d = (_c2 = node.marks) == null ? void 0 : _c2.flatMap(getMarkSwatchIds)) != null ? _d : [];
3876
4040
  default:
3877
4041
  return [];
3878
4042
  }
3879
4043
  }
3880
4044
  function getTypographyStyleSwatchIds(style) {
3881
- var _a2;
3882
- return (_a2 = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
3883
- var _a3;
3884
- return (_a3 = typographyStyle.color) == null ? void 0 : _a3.swatchId;
3885
- }).filter(isNonNullable)) != null ? _a2 : [];
4045
+ var _a;
4046
+ return (_a = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
4047
+ var _a2;
4048
+ return (_a2 = typographyStyle.color) == null ? void 0 : _a2.swatchId;
4049
+ }).filter(isNonNullable)) != null ? _a : [];
3886
4050
  }
3887
4051
  function getMarkSwatchIds(mark) {
3888
- var _a2, _b;
3889
- return getTypographyStyleSwatchIds((_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.style);
4052
+ var _a, _b;
4053
+ return getTypographyStyleSwatchIds((_b = (_a = mark.data) == null ? void 0 : _a.value) == null ? void 0 : _b.style);
3890
4054
  }
3891
4055
  }
3892
4056
  function getRichTextTypographyIds(value) {
@@ -3894,21 +4058,21 @@ function getRichTextTypographyIds(value) {
3894
4058
  return [];
3895
4059
  return getNodeSwatchIds(value.document);
3896
4060
  function getNodeSwatchIds(node) {
3897
- var _a2, _b, _c, _d;
4061
+ var _a, _b, _c2, _d;
3898
4062
  switch (node.object) {
3899
4063
  case "document":
3900
4064
  case "block":
3901
4065
  case "inline":
3902
- return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeSwatchIds)) != null ? _b : [];
4066
+ return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodeSwatchIds)) != null ? _b : [];
3903
4067
  case "text":
3904
- return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
4068
+ return (_d = (_c2 = node.marks) == null ? void 0 : _c2.flatMap(getMarkSwatchIds)) != null ? _d : [];
3905
4069
  default:
3906
4070
  return [];
3907
4071
  }
3908
4072
  }
3909
4073
  function getMarkSwatchIds(mark) {
3910
- var _a2, _b;
3911
- return [(_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.id].filter(isNonNullable);
4074
+ var _a, _b;
4075
+ return [(_b = (_a = mark.data) == null ? void 0 : _a.value) == null ? void 0 : _b.id].filter(isNonNullable);
3912
4076
  }
3913
4077
  }
3914
4078
  function getRichTextPageIds(value) {
@@ -3916,11 +4080,11 @@ function getRichTextPageIds(value) {
3916
4080
  return [];
3917
4081
  return getNodePageIds(value.document);
3918
4082
  function getNodePageIds(node) {
3919
- var _a2, _b;
4083
+ var _a, _b;
3920
4084
  switch (node.object) {
3921
4085
  case "document":
3922
4086
  case "block":
3923
- return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodePageIds)) != null ? _b : [];
4087
+ return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodePageIds)) != null ? _b : [];
3924
4088
  case "inline":
3925
4089
  return getInlinePageIds(node);
3926
4090
  default:
@@ -3928,15 +4092,15 @@ function getRichTextPageIds(value) {
3928
4092
  }
3929
4093
  }
3930
4094
  function getInlinePageIds(inline) {
3931
- var _a2, _b, _c, _d;
4095
+ var _a, _b, _c2, _d;
3932
4096
  switch (inline.type) {
3933
4097
  case "link": {
3934
- const nodePageIds = (_b = (_a2 = inline.nodes) == null ? void 0 : _a2.flatMap(getNodePageIds)) != null ? _b : [];
4098
+ const nodePageIds = (_b = (_a = inline.nodes) == null ? void 0 : _a.flatMap(getNodePageIds)) != null ? _b : [];
3935
4099
  const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
3936
4100
  return [...nodePageIds, ...dataPageIds];
3937
4101
  }
3938
4102
  default:
3939
- return (_d = (_c = inline.nodes) == null ? void 0 : _c.flatMap(getNodePageIds)) != null ? _d : [];
4103
+ return (_d = (_c2 = inline.nodes) == null ? void 0 : _c2.flatMap(getNodePageIds)) != null ? _d : [];
3940
4104
  }
3941
4105
  }
3942
4106
  function getLinkDataPageIds(link) {
@@ -3964,18 +4128,18 @@ function introspectRichTextV2Data(definition2, data, func) {
3964
4128
  return [];
3965
4129
  }
3966
4130
  function getElementTypographyIds(descendant) {
3967
- var _a2;
3968
- return (_a2 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
3969
- var _a3;
3970
- return ((_a3 = plugin.control) == null ? void 0 : _a3.definition) && plugin.control.getElementValue ? func(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
3971
- })) != null ? _a2 : [];
4131
+ var _a;
4132
+ return (_a = plugins == null ? void 0 : plugins.flatMap((plugin) => {
4133
+ var _a2;
4134
+ return ((_a2 = plugin.control) == null ? void 0 : _a2.definition) && plugin.control.getElementValue ? func(plugin.control.definition, plugin.control.getElementValue(descendant)) : [];
4135
+ })) != null ? _a : [];
3972
4136
  }
3973
4137
  function getTextTypographyIds(text) {
3974
- var _a2;
3975
- return (_a2 = plugins == null ? void 0 : plugins.flatMap((plugin) => {
3976
- var _a3;
3977
- return ((_a3 = plugin.control) == null ? void 0 : _a3.definition) && plugin.control.getLeafValue ? func(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
3978
- })) != null ? _a2 : [];
4138
+ var _a;
4139
+ return (_a = plugins == null ? void 0 : plugins.flatMap((plugin) => {
4140
+ var _a2;
4141
+ return ((_a2 = plugin.control) == null ? void 0 : _a2.definition) && plugin.control.getLeafValue ? func(plugin.control.definition, plugin.control.getLeafValue(text)) : [];
4142
+ })) != null ? _a : [];
3979
4143
  }
3980
4144
  }
3981
4145
  function getRichTextV2SwatchIds(definition2, data) {
@@ -4024,44 +4188,44 @@ function getElementId$1(descriptor, prop) {
4024
4188
  }
4025
4189
  }
4026
4190
  function getBackgroundsSwatchIds(value) {
4027
- var _a2;
4028
- return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
4029
- var _a3;
4191
+ var _a;
4192
+ return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
4193
+ var _a2;
4030
4194
  switch (backgroundItem.type) {
4031
4195
  case "color":
4032
- return ((_a3 = backgroundItem.payload) == null ? void 0 : _a3.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
4196
+ return ((_a2 = backgroundItem.payload) == null ? void 0 : _a2.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
4033
4197
  case "gradient":
4034
4198
  return backgroundItem.payload.stops.flatMap((stop) => stop.color == null ? [] : stop.color.swatchId);
4035
4199
  default:
4036
4200
  return [];
4037
4201
  }
4038
- })) != null ? _a2 : [];
4202
+ })) != null ? _a : [];
4039
4203
  }
4040
4204
  function getBorderSwatchIds(value) {
4041
- var _a2;
4042
- return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((borderValue) => {
4043
- var _a3, _b, _c, _d, _e, _f, _g, _h;
4205
+ var _a;
4206
+ return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((borderValue) => {
4207
+ var _a2, _b, _c2, _d, _e, _f, _g, _h;
4044
4208
  return [
4045
- (_b = (_a3 = borderValue.borderTop) == null ? void 0 : _a3.color) == null ? void 0 : _b.swatchId,
4046
- (_d = (_c = borderValue.borderRight) == null ? void 0 : _c.color) == null ? void 0 : _d.swatchId,
4209
+ (_b = (_a2 = borderValue.borderTop) == null ? void 0 : _a2.color) == null ? void 0 : _b.swatchId,
4210
+ (_d = (_c2 = borderValue.borderRight) == null ? void 0 : _c2.color) == null ? void 0 : _d.swatchId,
4047
4211
  (_f = (_e = borderValue.borderBottom) == null ? void 0 : _e.color) == null ? void 0 : _f.swatchId,
4048
4212
  (_h = (_g = borderValue.borderLeft) == null ? void 0 : _g.color) == null ? void 0 : _h.swatchId
4049
4213
  ].filter((swatchId) => swatchId != null);
4050
- })) != null ? _a2 : [];
4214
+ })) != null ? _a : [];
4051
4215
  }
4052
4216
  function getBoxShadowsSwatchIds(value) {
4053
- var _a2;
4054
- return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).map((item) => {
4055
- var _a3;
4056
- return (_a3 = item.payload.color) == null ? void 0 : _a3.swatchId;
4057
- }).filter((swatchId) => swatchId != null)) != null ? _a2 : [];
4217
+ var _a;
4218
+ return (_a = value == null ? void 0 : value.flatMap((override) => override.value).map((item) => {
4219
+ var _a2;
4220
+ return (_a2 = item.payload.color) == null ? void 0 : _a2.swatchId;
4221
+ }).filter((swatchId) => swatchId != null)) != null ? _a : [];
4058
4222
  }
4059
4223
  function getResponsiveColorSwatchIds(value) {
4060
- var _a2;
4061
- return (_a2 = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a2 : [];
4224
+ var _a;
4225
+ return (_a = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a : [];
4062
4226
  }
4063
4227
  function getSwatchIds(descriptor, prop) {
4064
- var _a2, _b;
4228
+ var _a, _b;
4065
4229
  if (prop == null)
4066
4230
  return [];
4067
4231
  switch (descriptor.type) {
@@ -4071,17 +4235,17 @@ function getSwatchIds(descriptor, prop) {
4071
4235
  return getBorderSwatchIds(prop);
4072
4236
  case Types.NavigationLinks: {
4073
4237
  const value = prop;
4074
- return (_a2 = value == null ? void 0 : value.flatMap((item) => {
4075
- var _a3, _b2, _c, _d;
4238
+ return (_a = value == null ? void 0 : value.flatMap((item) => {
4239
+ var _a2, _b2, _c2, _d;
4076
4240
  switch (item.type) {
4077
4241
  case "button":
4078
4242
  case "dropdown":
4079
4243
  return [
4080
- ...(_b2 = (_a3 = item.payload.color) == null ? void 0 : _a3.map((override) => override.value).map((color) => color.swatchId)) != null ? _b2 : [],
4081
- ...(_d = (_c = item.payload.textColor) == null ? void 0 : _c.map((override) => override.value).map((color) => color.swatchId)) != null ? _d : []
4244
+ ...(_b2 = (_a2 = item.payload.color) == null ? void 0 : _a2.map((override) => override.value).map((color) => color.swatchId)) != null ? _b2 : [],
4245
+ ...(_d = (_c2 = item.payload.textColor) == null ? void 0 : _c2.map((override) => override.value).map((color) => color.swatchId)) != null ? _d : []
4082
4246
  ];
4083
4247
  }
4084
- })) != null ? _a2 : [];
4248
+ })) != null ? _a : [];
4085
4249
  }
4086
4250
  case Types.ResponsiveColor:
4087
4251
  return getResponsiveColorSwatchIds(prop);
@@ -4125,18 +4289,18 @@ function getSwatchIds(descriptor, prop) {
4125
4289
  }
4126
4290
  }
4127
4291
  function getBackgroundsFileIds(value) {
4128
- var _a2;
4129
- return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
4292
+ var _a;
4293
+ return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
4130
4294
  switch (backgroundItem.type) {
4131
4295
  case "image":
4132
4296
  return [backgroundItem.payload.imageId];
4133
4297
  default:
4134
4298
  return [];
4135
4299
  }
4136
- })) != null ? _a2 : [];
4300
+ })) != null ? _a : [];
4137
4301
  }
4138
4302
  function getFileIds(descriptor, prop) {
4139
- var _a2;
4303
+ var _a;
4140
4304
  if (prop == null)
4141
4305
  return [];
4142
4306
  switch (descriptor.type) {
@@ -4148,7 +4312,7 @@ function getFileIds(descriptor, prop) {
4148
4312
  }
4149
4313
  case Types.Images: {
4150
4314
  const value = prop;
4151
- return (_a2 = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a2 : [];
4315
+ return (_a = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a : [];
4152
4316
  }
4153
4317
  case ImageControlType: {
4154
4318
  const value = prop;
@@ -4216,7 +4380,7 @@ function getTableIds(descriptor, prop) {
4216
4380
  }
4217
4381
  }
4218
4382
  function getPageIds(descriptor, prop) {
4219
- var _a2;
4383
+ var _a;
4220
4384
  if (prop == null)
4221
4385
  return [];
4222
4386
  switch (descriptor.type) {
@@ -4246,8 +4410,8 @@ function getPageIds(descriptor, prop) {
4246
4410
  const value = prop;
4247
4411
  if (value == null)
4248
4412
  return [];
4249
- return (_a2 = value == null ? void 0 : value.flatMap((item) => {
4250
- var _a3, _b;
4413
+ return (_a = value == null ? void 0 : value.flatMap((item) => {
4414
+ var _a2, _b;
4251
4415
  switch (item.type) {
4252
4416
  case "button": {
4253
4417
  if (item.payload.link == null)
@@ -4260,7 +4424,7 @@ function getPageIds(descriptor, prop) {
4260
4424
  }
4261
4425
  }
4262
4426
  case "dropdown": {
4263
- return (_b = (_a3 = item.payload.links) == null ? void 0 : _a3.flatMap((link) => {
4427
+ return (_b = (_a2 = item.payload.links) == null ? void 0 : _a2.flatMap((link) => {
4264
4428
  if (link.payload.link == null)
4265
4429
  return [];
4266
4430
  switch (link.payload.link.type) {
@@ -4272,7 +4436,7 @@ function getPageIds(descriptor, prop) {
4272
4436
  })) != null ? _b : [];
4273
4437
  }
4274
4438
  }
4275
- })) != null ? _a2 : [];
4439
+ })) != null ? _a : [];
4276
4440
  }
4277
4441
  case RichTextControlType:
4278
4442
  case Types.RichText: {
@@ -4390,14 +4554,14 @@ function getDocumentKeysSortedByDepth(state) {
4390
4554
  elements.set(key, getDocumentElements(state, key));
4391
4555
  });
4392
4556
  keys.sort((a, b) => {
4393
- var _a2;
4394
- return ((_a2 = elements.get(a)) == null ? void 0 : _a2.has(b)) ? -1 : 1;
4557
+ var _a;
4558
+ return ((_a = elements.get(a)) == null ? void 0 : _a.has(b)) ? -1 : 1;
4395
4559
  });
4396
4560
  return keys;
4397
4561
  }
4398
4562
  function getElement(state, documentKey, elementKey) {
4399
- var _a2;
4400
- return (_a2 = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a2 : null;
4563
+ var _a;
4564
+ return (_a = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a : null;
4401
4565
  }
4402
4566
  function getElementPropControllerDescriptors(state, documentKey, elementKey) {
4403
4567
  const element = getElement(state, documentKey, elementKey);
@@ -4590,6 +4754,7 @@ exports.copyElementTree = copyElementTree;
4590
4754
  exports.copyImageData = copyImageData;
4591
4755
  exports.copyLinkData = copyLinkData;
4592
4756
  exports.copyListData = copyListData;
4757
+ exports.copyRichTextData = copyRichTextData;
4593
4758
  exports.copyShapeData = copyShapeData;
4594
4759
  exports.copySlotData = copySlotData;
4595
4760
  exports.copyStyleData = copyStyleData;