@makeswift/runtime 0.0.0-018e17a

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 (87) hide show
  1. package/dist/actions.cjs.js +91 -0
  2. package/dist/actions.cjs.js.map +1 -0
  3. package/dist/actions.es.js +80 -0
  4. package/dist/actions.es.js.map +1 -0
  5. package/dist/box-model.cjs.js +9 -0
  6. package/dist/box-model.cjs.js.map +1 -0
  7. package/dist/box-model.es.js +3 -0
  8. package/dist/box-model.es.js.map +1 -0
  9. package/dist/box-models.cjs.js +236 -0
  10. package/dist/box-models.cjs.js.map +1 -0
  11. package/dist/box-models.es.js +227 -0
  12. package/dist/box-models.es.js.map +1 -0
  13. package/dist/components.cjs.js +305 -0
  14. package/dist/components.cjs.js.map +1 -0
  15. package/dist/components.es.js +298 -0
  16. package/dist/components.es.js.map +1 -0
  17. package/dist/main.cjs.js +8 -0
  18. package/dist/main.cjs.js.map +1 -0
  19. package/dist/main.es.js +2 -0
  20. package/dist/main.es.js.map +1 -0
  21. package/dist/prop-controllers.cjs.js +177 -0
  22. package/dist/prop-controllers.cjs.js.map +1 -0
  23. package/dist/prop-controllers.es.js +174 -0
  24. package/dist/prop-controllers.es.js.map +1 -0
  25. package/dist/react-builder-preview.cjs.js +4301 -0
  26. package/dist/react-builder-preview.cjs.js.map +1 -0
  27. package/dist/react-builder-preview.es.js +4294 -0
  28. package/dist/react-builder-preview.es.js.map +1 -0
  29. package/dist/react.cjs.js +13 -0
  30. package/dist/react.cjs.js.map +1 -0
  31. package/dist/react.cjs2.js +835 -0
  32. package/dist/react.cjs2.js.map +1 -0
  33. package/dist/react.es.js +4 -0
  34. package/dist/react.es.js.map +1 -0
  35. package/dist/react.es2.js +810 -0
  36. package/dist/react.es2.js.map +1 -0
  37. package/dist/types/box-model.d.ts +3 -0
  38. package/dist/types/box-model.d.ts.map +1 -0
  39. package/dist/types/components/Root/Root.d.ts +11 -0
  40. package/dist/types/components/Root/Root.d.ts.map +1 -0
  41. package/dist/types/components/Root/components/Placeholder/index.d.ts +5 -0
  42. package/dist/types/components/Root/components/Placeholder/index.d.ts.map +1 -0
  43. package/dist/types/components/Root/index.d.ts +2 -0
  44. package/dist/types/components/Root/index.d.ts.map +1 -0
  45. package/dist/types/components/index.d.ts +2 -0
  46. package/dist/types/components/index.d.ts.map +1 -0
  47. package/dist/types/components/utils/columns.d.ts +2 -0
  48. package/dist/types/components/utils/columns.d.ts.map +1 -0
  49. package/dist/types/components/utils/cssMediaRules.d.ts +18 -0
  50. package/dist/types/components/utils/cssMediaRules.d.ts.map +1 -0
  51. package/dist/types/components/utils/devices.d.ts +16 -0
  52. package/dist/types/components/utils/devices.d.ts.map +1 -0
  53. package/dist/types/index.d.ts +6 -0
  54. package/dist/types/index.d.ts.map +1 -0
  55. package/dist/types/prop-controllers/descriptors.d.ts +656 -0
  56. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -0
  57. package/dist/types/prop-controllers/index.d.ts +3 -0
  58. package/dist/types/prop-controllers/index.d.ts.map +1 -0
  59. package/dist/types/react.d.ts +4 -0
  60. package/dist/types/react.d.ts.map +1 -0
  61. package/dist/types/runtimes/react.d.ts +28 -0
  62. package/dist/types/runtimes/react.d.ts.map +1 -0
  63. package/dist/types/state/actions.d.ts +124 -0
  64. package/dist/types/state/actions.d.ts.map +1 -0
  65. package/dist/types/state/modules/box-models.d.ts +22 -0
  66. package/dist/types/state/modules/box-models.d.ts.map +1 -0
  67. package/dist/types/state/modules/components-meta.d.ts +14 -0
  68. package/dist/types/state/modules/components-meta.d.ts.map +1 -0
  69. package/dist/types/state/modules/prop-controllers.d.ts +10 -0
  70. package/dist/types/state/modules/prop-controllers.d.ts.map +1 -0
  71. package/dist/types/state/modules/react-components.d.ts +10 -0
  72. package/dist/types/state/modules/react-components.d.ts.map +1 -0
  73. package/dist/types/state/modules/read-only-documents.d.ts +28 -0
  74. package/dist/types/state/modules/read-only-documents.d.ts.map +1 -0
  75. package/dist/types/state/modules/read-write-documents.d.ts +13 -0
  76. package/dist/types/state/modules/read-write-documents.d.ts.map +1 -0
  77. package/dist/types/state/react-builder-preview.d.ts +39 -0
  78. package/dist/types/state/react-builder-preview.d.ts.map +1 -0
  79. package/dist/types/state/react-page.d.ts +28 -0
  80. package/dist/types/state/react-page.d.ts.map +1 -0
  81. package/dist/types/utils/deepEqual.d.ts +3 -0
  82. package/dist/types/utils/deepEqual.d.ts.map +1 -0
  83. package/dist/types/utils/is.d.ts +2 -0
  84. package/dist/types/utils/is.d.ts.map +1 -0
  85. package/dist/types/utils/shallowEqual.d.ts +3 -0
  86. package/dist/types/utils/shallowEqual.d.ts.map +1 -0
  87. package/package.json +103 -0
@@ -0,0 +1,835 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var require$$0 = require("react");
22
+ var actions = require("./actions.cjs.js");
23
+ function _interopDefaultLegacy(e2) {
24
+ return e2 && typeof e2 === "object" && "default" in e2 ? e2 : { "default": e2 };
25
+ }
26
+ var require$$0__default = /* @__PURE__ */ _interopDefaultLegacy(require$$0);
27
+ var withSelector = { exports: {} };
28
+ var withSelector_production_min = {};
29
+ var shim = { exports: {} };
30
+ var useSyncExternalStoreShim_production_min = {};
31
+ /** @license React vundefined
32
+ * use-sync-external-store-shim.production.min.js
33
+ *
34
+ * Copyright (c) Facebook, Inc. and its affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */
39
+ var e = require$$0__default["default"];
40
+ function h$2(a, b) {
41
+ return a === b && (a !== 0 || 1 / a === 1 / b) || a !== a && b !== b;
42
+ }
43
+ var k = typeof Object.is === "function" ? Object.is : h$2, l = e.useState, m$1 = e.useEffect, n$2 = e.useLayoutEffect, p$2 = e.useDebugValue;
44
+ function q$2(a, b) {
45
+ var d = b(), f2 = l({ inst: { value: d, getSnapshot: b } }), c = f2[0].inst, g2 = f2[1];
46
+ n$2(function() {
47
+ c.value = d;
48
+ c.getSnapshot = b;
49
+ r$1(c) && g2({ inst: c });
50
+ }, [a, d, b]);
51
+ m$1(function() {
52
+ r$1(c) && g2({ inst: c });
53
+ return a(function() {
54
+ r$1(c) && g2({ inst: c });
55
+ });
56
+ }, [a]);
57
+ p$2(d);
58
+ return d;
59
+ }
60
+ function r$1(a) {
61
+ var b = a.getSnapshot;
62
+ a = a.value;
63
+ try {
64
+ var d = b();
65
+ return !k(a, d);
66
+ } catch (f2) {
67
+ return true;
68
+ }
69
+ }
70
+ function t$1(a, b) {
71
+ return b();
72
+ }
73
+ var u$1 = typeof window === "undefined" || typeof window.document === "undefined" || typeof window.document.createElement === "undefined" ? t$1 : q$2;
74
+ useSyncExternalStoreShim_production_min.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u$1;
75
+ {
76
+ shim.exports = useSyncExternalStoreShim_production_min;
77
+ }
78
+ /** @license React vundefined
79
+ * use-sync-external-store-shim/with-selector.production.min.js
80
+ *
81
+ * Copyright (c) Facebook, Inc. and its affiliates.
82
+ *
83
+ * This source code is licensed under the MIT license found in the
84
+ * LICENSE file in the root directory of this source tree.
85
+ */
86
+ var h$1 = require$$0__default["default"], n$1 = shim.exports;
87
+ function p$1(a, b) {
88
+ return a === b && (a !== 0 || 1 / a === 1 / b) || a !== a && b !== b;
89
+ }
90
+ var q$1 = typeof Object.is === "function" ? Object.is : p$1, r = n$1.useSyncExternalStore, t = h$1.useRef, u = h$1.useEffect, v = h$1.useMemo, w = h$1.useDebugValue;
91
+ withSelector_production_min.useSyncExternalStoreWithSelector = function(a, b, e2, l2, g2) {
92
+ var c = t(null);
93
+ if (c.current === null) {
94
+ var f2 = { hasValue: false, value: null };
95
+ c.current = f2;
96
+ } else
97
+ f2 = c.current;
98
+ c = v(function() {
99
+ function a2(a3) {
100
+ if (!c2) {
101
+ c2 = true;
102
+ d2 = a3;
103
+ a3 = l2(a3);
104
+ if (g2 !== void 0 && f2.hasValue) {
105
+ var b2 = f2.value;
106
+ if (g2(b2, a3))
107
+ return k2 = b2;
108
+ }
109
+ return k2 = a3;
110
+ }
111
+ b2 = k2;
112
+ if (q$1(d2, a3))
113
+ return b2;
114
+ var e3 = l2(a3);
115
+ if (g2 !== void 0 && g2(b2, e3))
116
+ return b2;
117
+ d2 = a3;
118
+ return k2 = e3;
119
+ }
120
+ var c2 = false, d2, k2, m2 = e2 === void 0 ? null : e2;
121
+ return [function() {
122
+ return a2(b());
123
+ }, m2 === null ? void 0 : function() {
124
+ return a2(m2());
125
+ }];
126
+ }, [b, e2, l2, g2]);
127
+ var d = r(a, c[0], c[1]);
128
+ u(function() {
129
+ f2.hasValue = true;
130
+ f2.value = d;
131
+ }, [d]);
132
+ w(d);
133
+ return d;
134
+ };
135
+ {
136
+ withSelector.exports = withSelector_production_min;
137
+ }
138
+ function _defineProperty(obj, key, value) {
139
+ if (key in obj) {
140
+ Object.defineProperty(obj, key, {
141
+ value,
142
+ enumerable: true,
143
+ configurable: true,
144
+ writable: true
145
+ });
146
+ } else {
147
+ obj[key] = value;
148
+ }
149
+ return obj;
150
+ }
151
+ function ownKeys(object, enumerableOnly) {
152
+ var keys = Object.keys(object);
153
+ if (Object.getOwnPropertySymbols) {
154
+ var symbols = Object.getOwnPropertySymbols(object);
155
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
156
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
157
+ })), keys.push.apply(keys, symbols);
158
+ }
159
+ return keys;
160
+ }
161
+ function _objectSpread2(target) {
162
+ for (var i = 1; i < arguments.length; i++) {
163
+ var source = arguments[i] != null ? arguments[i] : {};
164
+ i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
165
+ _defineProperty(target, key, source[key]);
166
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
167
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
168
+ });
169
+ }
170
+ return target;
171
+ }
172
+ function formatProdErrorMessage(code) {
173
+ return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or use the non-minified dev environment for full errors. ";
174
+ }
175
+ var $$observable = function() {
176
+ return typeof Symbol === "function" && Symbol.observable || "@@observable";
177
+ }();
178
+ var randomString = function randomString2() {
179
+ return Math.random().toString(36).substring(7).split("").join(".");
180
+ };
181
+ var ActionTypes = {
182
+ INIT: "@@redux/INIT" + randomString(),
183
+ REPLACE: "@@redux/REPLACE" + randomString(),
184
+ PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
185
+ return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
186
+ }
187
+ };
188
+ function isPlainObject(obj) {
189
+ if (typeof obj !== "object" || obj === null)
190
+ return false;
191
+ var proto = obj;
192
+ while (Object.getPrototypeOf(proto) !== null) {
193
+ proto = Object.getPrototypeOf(proto);
194
+ }
195
+ return Object.getPrototypeOf(obj) === proto;
196
+ }
197
+ function createStore(reducer2, preloadedState, enhancer) {
198
+ var _ref2;
199
+ if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") {
200
+ throw new Error(formatProdErrorMessage(0));
201
+ }
202
+ if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
203
+ enhancer = preloadedState;
204
+ preloadedState = void 0;
205
+ }
206
+ if (typeof enhancer !== "undefined") {
207
+ if (typeof enhancer !== "function") {
208
+ throw new Error(formatProdErrorMessage(1));
209
+ }
210
+ return enhancer(createStore)(reducer2, preloadedState);
211
+ }
212
+ if (typeof reducer2 !== "function") {
213
+ throw new Error(formatProdErrorMessage(2));
214
+ }
215
+ var currentReducer = reducer2;
216
+ var currentState = preloadedState;
217
+ var currentListeners = [];
218
+ var nextListeners = currentListeners;
219
+ var isDispatching = false;
220
+ function ensureCanMutateNextListeners() {
221
+ if (nextListeners === currentListeners) {
222
+ nextListeners = currentListeners.slice();
223
+ }
224
+ }
225
+ function getState() {
226
+ if (isDispatching) {
227
+ throw new Error(formatProdErrorMessage(3));
228
+ }
229
+ return currentState;
230
+ }
231
+ function subscribe(listener) {
232
+ if (typeof listener !== "function") {
233
+ throw new Error(formatProdErrorMessage(4));
234
+ }
235
+ if (isDispatching) {
236
+ throw new Error(formatProdErrorMessage(5));
237
+ }
238
+ var isSubscribed = true;
239
+ ensureCanMutateNextListeners();
240
+ nextListeners.push(listener);
241
+ return function unsubscribe() {
242
+ if (!isSubscribed) {
243
+ return;
244
+ }
245
+ if (isDispatching) {
246
+ throw new Error(formatProdErrorMessage(6));
247
+ }
248
+ isSubscribed = false;
249
+ ensureCanMutateNextListeners();
250
+ var index = nextListeners.indexOf(listener);
251
+ nextListeners.splice(index, 1);
252
+ currentListeners = null;
253
+ };
254
+ }
255
+ function dispatch(action) {
256
+ if (!isPlainObject(action)) {
257
+ throw new Error(formatProdErrorMessage(7));
258
+ }
259
+ if (typeof action.type === "undefined") {
260
+ throw new Error(formatProdErrorMessage(8));
261
+ }
262
+ if (isDispatching) {
263
+ throw new Error(formatProdErrorMessage(9));
264
+ }
265
+ try {
266
+ isDispatching = true;
267
+ currentState = currentReducer(currentState, action);
268
+ } finally {
269
+ isDispatching = false;
270
+ }
271
+ var listeners = currentListeners = nextListeners;
272
+ for (var i = 0; i < listeners.length; i++) {
273
+ var listener = listeners[i];
274
+ listener();
275
+ }
276
+ return action;
277
+ }
278
+ function replaceReducer(nextReducer) {
279
+ if (typeof nextReducer !== "function") {
280
+ throw new Error(formatProdErrorMessage(10));
281
+ }
282
+ currentReducer = nextReducer;
283
+ dispatch({
284
+ type: ActionTypes.REPLACE
285
+ });
286
+ }
287
+ function observable() {
288
+ var _ref;
289
+ var outerSubscribe = subscribe;
290
+ return _ref = {
291
+ subscribe: function subscribe2(observer) {
292
+ if (typeof observer !== "object" || observer === null) {
293
+ throw new Error(formatProdErrorMessage(11));
294
+ }
295
+ function observeState() {
296
+ if (observer.next) {
297
+ observer.next(getState());
298
+ }
299
+ }
300
+ observeState();
301
+ var unsubscribe = outerSubscribe(observeState);
302
+ return {
303
+ unsubscribe
304
+ };
305
+ }
306
+ }, _ref[$$observable] = function() {
307
+ return this;
308
+ }, _ref;
309
+ }
310
+ dispatch({
311
+ type: ActionTypes.INIT
312
+ });
313
+ return _ref2 = {
314
+ dispatch,
315
+ subscribe,
316
+ getState,
317
+ replaceReducer
318
+ }, _ref2[$$observable] = observable, _ref2;
319
+ }
320
+ function assertReducerShape(reducers) {
321
+ Object.keys(reducers).forEach(function(key) {
322
+ var reducer2 = reducers[key];
323
+ var initialState = reducer2(void 0, {
324
+ type: ActionTypes.INIT
325
+ });
326
+ if (typeof initialState === "undefined") {
327
+ throw new Error(formatProdErrorMessage(12));
328
+ }
329
+ if (typeof reducer2(void 0, {
330
+ type: ActionTypes.PROBE_UNKNOWN_ACTION()
331
+ }) === "undefined") {
332
+ throw new Error(formatProdErrorMessage(13));
333
+ }
334
+ });
335
+ }
336
+ function combineReducers(reducers) {
337
+ var reducerKeys = Object.keys(reducers);
338
+ var finalReducers = {};
339
+ for (var i = 0; i < reducerKeys.length; i++) {
340
+ var key = reducerKeys[i];
341
+ if (typeof reducers[key] === "function") {
342
+ finalReducers[key] = reducers[key];
343
+ }
344
+ }
345
+ var finalReducerKeys = Object.keys(finalReducers);
346
+ var shapeAssertionError;
347
+ try {
348
+ assertReducerShape(finalReducers);
349
+ } catch (e2) {
350
+ shapeAssertionError = e2;
351
+ }
352
+ return function combination(state, action) {
353
+ if (state === void 0) {
354
+ state = {};
355
+ }
356
+ if (shapeAssertionError) {
357
+ throw shapeAssertionError;
358
+ }
359
+ var hasChanged = false;
360
+ var nextState = {};
361
+ for (var _i = 0; _i < finalReducerKeys.length; _i++) {
362
+ var _key = finalReducerKeys[_i];
363
+ var reducer2 = finalReducers[_key];
364
+ var previousStateForKey = state[_key];
365
+ var nextStateForKey = reducer2(previousStateForKey, action);
366
+ if (typeof nextStateForKey === "undefined") {
367
+ action && action.type;
368
+ throw new Error(formatProdErrorMessage(14));
369
+ }
370
+ nextState[_key] = nextStateForKey;
371
+ hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
372
+ }
373
+ hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
374
+ return hasChanged ? nextState : state;
375
+ };
376
+ }
377
+ function compose() {
378
+ for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
379
+ funcs[_key] = arguments[_key];
380
+ }
381
+ if (funcs.length === 0) {
382
+ return function(arg) {
383
+ return arg;
384
+ };
385
+ }
386
+ if (funcs.length === 1) {
387
+ return funcs[0];
388
+ }
389
+ return funcs.reduce(function(a, b) {
390
+ return function() {
391
+ return a(b.apply(void 0, arguments));
392
+ };
393
+ });
394
+ }
395
+ function applyMiddleware() {
396
+ for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
397
+ middlewares[_key] = arguments[_key];
398
+ }
399
+ return function(createStore2) {
400
+ return function() {
401
+ var store = createStore2.apply(void 0, arguments);
402
+ var _dispatch = function dispatch() {
403
+ throw new Error(formatProdErrorMessage(15));
404
+ };
405
+ var middlewareAPI = {
406
+ getState: store.getState,
407
+ dispatch: function dispatch() {
408
+ return _dispatch.apply(void 0, arguments);
409
+ }
410
+ };
411
+ var chain = middlewares.map(function(middleware) {
412
+ return middleware(middlewareAPI);
413
+ });
414
+ _dispatch = compose.apply(void 0, chain)(store.dispatch);
415
+ return _objectSpread2(_objectSpread2({}, store), {}, {
416
+ dispatch: _dispatch
417
+ });
418
+ };
419
+ };
420
+ }
421
+ function createThunkMiddleware(extraArgument) {
422
+ var middleware = function middleware2(_ref) {
423
+ var dispatch = _ref.dispatch, getState = _ref.getState;
424
+ return function(next) {
425
+ return function(action) {
426
+ if (typeof action === "function") {
427
+ return action(dispatch, getState, extraArgument);
428
+ }
429
+ return next(action);
430
+ };
431
+ };
432
+ };
433
+ return middleware;
434
+ }
435
+ var thunk = createThunkMiddleware();
436
+ thunk.withExtraArgument = createThunkMiddleware;
437
+ var thunk$1 = thunk;
438
+ function isElementReference(element) {
439
+ return !("props" in element);
440
+ }
441
+ function createDocument(rootElement) {
442
+ return { rootElement };
443
+ }
444
+ function getInitialState$3({
445
+ rootElements = /* @__PURE__ */ new Map()
446
+ } = {}) {
447
+ const initialState = /* @__PURE__ */ new Map();
448
+ rootElements.forEach((rootElement, elementKey) => {
449
+ initialState.set(elementKey, createDocument(rootElement));
450
+ });
451
+ return initialState;
452
+ }
453
+ function getDocuments(state) {
454
+ return state;
455
+ }
456
+ function getDocument(state, documentKey) {
457
+ var _a;
458
+ return (_a = getDocuments(state).get(documentKey)) != null ? _a : null;
459
+ }
460
+ function getDocumentRootElement$1(state, documentKey) {
461
+ var _a, _b;
462
+ return (_b = (_a = getDocument(state, documentKey)) == null ? void 0 : _a.rootElement) != null ? _b : null;
463
+ }
464
+ function reducer$4(state = getInitialState$3(), _action) {
465
+ return state;
466
+ }
467
+ function getInitialState$2({
468
+ reactComponents = /* @__PURE__ */ new Map()
469
+ } = {}) {
470
+ return reactComponents;
471
+ }
472
+ function getReactComponents(state) {
473
+ return state;
474
+ }
475
+ function getReactComponent$1(state, type) {
476
+ var _a;
477
+ return (_a = getReactComponents(state).get(type)) != null ? _a : null;
478
+ }
479
+ function reducer$3(state = getInitialState$2(), action) {
480
+ switch (action.type) {
481
+ case actions.ActionTypes.REGISTER_REACT_COMPONENT:
482
+ return new Map(state).set(action.payload.type, action.payload.component);
483
+ case actions.ActionTypes.UNREGISTER_REACT_COMPONENT: {
484
+ const nextState = new Map(state);
485
+ const deleted = nextState.delete(action.payload.type);
486
+ return deleted ? nextState : state;
487
+ }
488
+ default:
489
+ return state;
490
+ }
491
+ }
492
+ function getInitialState$1({
493
+ componentsMeta = /* @__PURE__ */ new Map()
494
+ } = {}) {
495
+ return componentsMeta;
496
+ }
497
+ function getComponentsMeta(state) {
498
+ return state;
499
+ }
500
+ function reducer$2(state = getInitialState$1(), action) {
501
+ switch (action.type) {
502
+ case actions.ActionTypes.REGISTER_COMPONENT:
503
+ return new Map(state).set(action.payload.type, action.payload.meta);
504
+ case actions.ActionTypes.UNREGISTER_COMPONENT: {
505
+ const nextState = new Map(state);
506
+ const deleted = nextState.delete(action.payload.type);
507
+ return deleted ? nextState : state;
508
+ }
509
+ default:
510
+ return state;
511
+ }
512
+ }
513
+ function getInitialState({
514
+ propControllerDescriptors = /* @__PURE__ */ new Map()
515
+ } = {}) {
516
+ return propControllerDescriptors;
517
+ }
518
+ function getPropControllerDescriptors(state) {
519
+ return state;
520
+ }
521
+ function getComponentPropControllerDescriptors(state, componentType) {
522
+ var _a;
523
+ return (_a = getPropControllerDescriptors(state).get(componentType)) != null ? _a : null;
524
+ }
525
+ function reducer$1(state = getInitialState(), action) {
526
+ switch (action.type) {
527
+ case actions.ActionTypes.REGISTER_COMPONENT:
528
+ return new Map(state).set(action.payload.type, action.payload.propControllerDescriptors);
529
+ case actions.ActionTypes.UNREGISTER_COMPONENT: {
530
+ const nextState = new Map(state);
531
+ const deleted = nextState.delete(action.payload.type);
532
+ return deleted ? nextState : state;
533
+ }
534
+ default:
535
+ return state;
536
+ }
537
+ }
538
+ const reducer = combineReducers({
539
+ documents: reducer$4,
540
+ reactComponents: reducer$3,
541
+ componentsMeta: reducer$2,
542
+ propControllers: reducer$1
543
+ });
544
+ function getDocumentsStateSlice(state) {
545
+ return state.documents;
546
+ }
547
+ function getDocumentRootElement(state, documentKey) {
548
+ return getDocumentRootElement$1(getDocumentsStateSlice(state), documentKey);
549
+ }
550
+ function getReactComponentsStateSlice(state) {
551
+ return state.reactComponents;
552
+ }
553
+ function getReactComponent(state, type) {
554
+ return getReactComponent$1(getReactComponentsStateSlice(state), type);
555
+ }
556
+ function configureStore({
557
+ rootElements,
558
+ preloadedState
559
+ } = {}) {
560
+ return createStore(reducer, __spreadProps(__spreadValues({}, preloadedState), { documents: getInitialState$3({ rootElements }) }), applyMiddleware(thunk$1));
561
+ }
562
+ var jsxRuntime = { exports: {} };
563
+ var reactJsxRuntime_production_min = {};
564
+ /*
565
+ object-assign
566
+ (c) Sindre Sorhus
567
+ @license MIT
568
+ */
569
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
570
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
571
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
572
+ function toObject(val) {
573
+ if (val === null || val === void 0) {
574
+ throw new TypeError("Object.assign cannot be called with null or undefined");
575
+ }
576
+ return Object(val);
577
+ }
578
+ function shouldUseNative() {
579
+ try {
580
+ if (!Object.assign) {
581
+ return false;
582
+ }
583
+ var test1 = new String("abc");
584
+ test1[5] = "de";
585
+ if (Object.getOwnPropertyNames(test1)[0] === "5") {
586
+ return false;
587
+ }
588
+ var test2 = {};
589
+ for (var i = 0; i < 10; i++) {
590
+ test2["_" + String.fromCharCode(i)] = i;
591
+ }
592
+ var order2 = Object.getOwnPropertyNames(test2).map(function(n2) {
593
+ return test2[n2];
594
+ });
595
+ if (order2.join("") !== "0123456789") {
596
+ return false;
597
+ }
598
+ var test3 = {};
599
+ "abcdefghijklmnopqrst".split("").forEach(function(letter) {
600
+ test3[letter] = letter;
601
+ });
602
+ if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
603
+ return false;
604
+ }
605
+ return true;
606
+ } catch (err) {
607
+ return false;
608
+ }
609
+ }
610
+ shouldUseNative() ? Object.assign : function(target, source) {
611
+ var from;
612
+ var to = toObject(target);
613
+ var symbols;
614
+ for (var s = 1; s < arguments.length; s++) {
615
+ from = Object(arguments[s]);
616
+ for (var key in from) {
617
+ if (hasOwnProperty.call(from, key)) {
618
+ to[key] = from[key];
619
+ }
620
+ }
621
+ if (getOwnPropertySymbols) {
622
+ symbols = getOwnPropertySymbols(from);
623
+ for (var i = 0; i < symbols.length; i++) {
624
+ if (propIsEnumerable.call(from, symbols[i])) {
625
+ to[symbols[i]] = from[symbols[i]];
626
+ }
627
+ }
628
+ }
629
+ }
630
+ return to;
631
+ };
632
+ /** @license React v17.0.2
633
+ * react-jsx-runtime.production.min.js
634
+ *
635
+ * Copyright (c) Facebook, Inc. and its affiliates.
636
+ *
637
+ * This source code is licensed under the MIT license found in the
638
+ * LICENSE file in the root directory of this source tree.
639
+ */
640
+ var f = require$$0__default["default"], g = 60103;
641
+ reactJsxRuntime_production_min.Fragment = 60107;
642
+ if (typeof Symbol === "function" && Symbol.for) {
643
+ var h = Symbol.for;
644
+ g = h("react.element");
645
+ reactJsxRuntime_production_min.Fragment = h("react.fragment");
646
+ }
647
+ var m = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = Object.prototype.hasOwnProperty, p = { key: true, ref: true, __self: true, __source: true };
648
+ function q(c, a, k2) {
649
+ var b, d = {}, e2 = null, l2 = null;
650
+ k2 !== void 0 && (e2 = "" + k2);
651
+ a.key !== void 0 && (e2 = "" + a.key);
652
+ a.ref !== void 0 && (l2 = a.ref);
653
+ for (b in a)
654
+ n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
655
+ if (c && c.defaultProps)
656
+ for (b in a = c.defaultProps, a)
657
+ d[b] === void 0 && (d[b] = a[b]);
658
+ return { $$typeof: g, type: c, key: e2, ref: l2, props: d, _owner: m.current };
659
+ }
660
+ reactJsxRuntime_production_min.jsx = q;
661
+ reactJsxRuntime_production_min.jsxs = q;
662
+ {
663
+ jsxRuntime.exports = reactJsxRuntime_production_min;
664
+ }
665
+ const jsx = jsxRuntime.exports.jsx;
666
+ const jsxs = jsxRuntime.exports.jsxs;
667
+ const Fragment = jsxRuntime.exports.Fragment;
668
+ const contextDefaultValue = configureStore();
669
+ const ReactRuntime = {
670
+ registerComponent(component, {
671
+ type,
672
+ label,
673
+ icon = "Cube40",
674
+ hidden = false,
675
+ props
676
+ }) {
677
+ const unregisterComponent = contextDefaultValue.dispatch(actions.registerComponentEffect(type, {
678
+ label,
679
+ icon,
680
+ hidden
681
+ }, props != null ? props : {}));
682
+ const unregisterReactComponent = contextDefaultValue.dispatch(actions.registerReactComponentEffect(type, component));
683
+ return () => {
684
+ unregisterComponent();
685
+ unregisterReactComponent();
686
+ };
687
+ }
688
+ };
689
+ const Context = require$$0.createContext(contextDefaultValue);
690
+ function RuntimeProvider({
691
+ children,
692
+ defaultRootElements
693
+ }) {
694
+ const [store, setStore] = require$$0.useState(() => configureStore({
695
+ preloadedState: contextDefaultValue.getState(),
696
+ rootElements: defaultRootElements
697
+ }));
698
+ require$$0.useEffect(() => {
699
+ const isInBuilder = window.parent !== window;
700
+ if (!isInBuilder)
701
+ return;
702
+ const initializePromise = initializeReactBuilderPreview();
703
+ return () => {
704
+ initializePromise.then((cleanUp) => {
705
+ cleanUp();
706
+ });
707
+ };
708
+ async function initializeReactBuilderPreview() {
709
+ const ReactBuilderPreview = await Promise.resolve().then(function() {
710
+ return require("./react-builder-preview.cjs.js");
711
+ });
712
+ const store2 = await new Promise((resolve) => {
713
+ setStore((store3) => {
714
+ const nextStore = ReactBuilderPreview.configureStore({
715
+ preloadedState: store3.getState()
716
+ });
717
+ resolve(nextStore);
718
+ return nextStore;
719
+ });
720
+ });
721
+ return store2.dispatch(ReactBuilderPreview.initialize());
722
+ }
723
+ }, []);
724
+ return /* @__PURE__ */ jsx(Context.Provider, {
725
+ value: store,
726
+ children
727
+ });
728
+ }
729
+ function useSelector(selector) {
730
+ const store = require$$0.useContext(Context);
731
+ return withSelector.exports.useSyncExternalStoreWithSelector(store.subscribe, store.getState, store.getState, selector);
732
+ }
733
+ function useComponent(type) {
734
+ return useSelector((state) => getReactComponent(state, type));
735
+ }
736
+ function useDocumentRootElement(documentKey) {
737
+ return useSelector((state) => getDocumentRootElement(state, documentKey));
738
+ }
739
+ function useDispatch() {
740
+ const store = require$$0.useContext(Context);
741
+ return store.dispatch;
742
+ }
743
+ const ElementData = require$$0.memo(require$$0.forwardRef(function ElementData2({
744
+ elementData
745
+ }, ref) {
746
+ const Component = useComponent(elementData.type);
747
+ if (Component == null) {
748
+ return /* @__PURE__ */ jsxs("div", {
749
+ ref,
750
+ children: [/* @__PURE__ */ jsx("p", {
751
+ children: "Component Not Found"
752
+ }), /* @__PURE__ */ jsx("pre", {
753
+ children: /* @__PURE__ */ jsx("code", {
754
+ children: JSON.stringify(elementData, null, 2)
755
+ })
756
+ })]
757
+ });
758
+ }
759
+ return /* @__PURE__ */ require$$0.createElement(Component, __spreadProps(__spreadValues({}, elementData.props), {
760
+ key: elementData.key,
761
+ ref
762
+ }));
763
+ }));
764
+ const ElementReference = require$$0.memo(require$$0.forwardRef(function ElementReference2({
765
+ elementReference
766
+ }, ref) {
767
+ return /* @__PURE__ */ jsxs("div", {
768
+ ref,
769
+ children: [/* @__PURE__ */ jsx("p", {
770
+ children: "Not Implemented"
771
+ }), /* @__PURE__ */ jsx("pre", {
772
+ children: /* @__PURE__ */ jsx("code", {
773
+ children: JSON.stringify(elementReference, null, 2)
774
+ })
775
+ })]
776
+ });
777
+ }));
778
+ const Element = require$$0.memo(function Element2({
779
+ element
780
+ }) {
781
+ const elementKey = element.key;
782
+ const dispatch = useDispatch();
783
+ const ref = require$$0.useCallback((handle) => {
784
+ dispatch(actions.changeComponentHandle(elementKey, handle));
785
+ }, [dispatch, elementKey]);
786
+ require$$0.useEffect(() => dispatch(actions.mountComponentEffect(elementKey)), [dispatch, elementKey]);
787
+ return isElementReference(element) ? /* @__PURE__ */ jsx(ElementReference, {
788
+ ref,
789
+ elementReference: element
790
+ }, elementKey) : /* @__PURE__ */ jsx(ElementData, {
791
+ ref,
792
+ elementData: element
793
+ }, elementKey);
794
+ });
795
+ const Document = require$$0.memo(function Document2({
796
+ documentKey
797
+ }) {
798
+ const documentRootElement = useDocumentRootElement(documentKey);
799
+ if (documentRootElement == null) {
800
+ return /* @__PURE__ */ jsxs("div", {
801
+ children: [/* @__PURE__ */ jsx("p", {
802
+ children: "Document Not Found"
803
+ }), /* @__PURE__ */ jsx("pre", {
804
+ children: /* @__PURE__ */ jsx("code", {
805
+ children: JSON.stringify({
806
+ documentKey
807
+ }, null, 2)
808
+ })
809
+ })]
810
+ });
811
+ }
812
+ return /* @__PURE__ */ jsx(Element, {
813
+ element: documentRootElement
814
+ });
815
+ });
816
+ exports.Document = Document;
817
+ exports.Element = Element;
818
+ exports.Fragment = Fragment;
819
+ exports.ReactRuntime = ReactRuntime;
820
+ exports.RuntimeProvider = RuntimeProvider;
821
+ exports.applyMiddleware = applyMiddleware;
822
+ exports.combineReducers = combineReducers;
823
+ exports.createDocument = createDocument;
824
+ exports.createStore = createStore;
825
+ exports.getComponentPropControllerDescriptors = getComponentPropControllerDescriptors;
826
+ exports.getComponentsMeta = getComponentsMeta;
827
+ exports.getDocumentRootElement = getDocumentRootElement$1;
828
+ exports.getInitialState = getInitialState$3;
829
+ exports.jsx = jsx;
830
+ exports.jsxs = jsxs;
831
+ exports.reducer = reducer$3;
832
+ exports.reducer$1 = reducer$2;
833
+ exports.reducer$2 = reducer$1;
834
+ exports.thunk = thunk$1;
835
+ //# sourceMappingURL=react.cjs2.js.map