@dotcms/react 0.0.1-beta.9 → 1.0.0

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 (57) hide show
  1. package/README.md +531 -93
  2. package/index.esm.js +2992 -786
  3. package/package.json +9 -11
  4. package/src/index.d.ts +7 -1
  5. package/src/lib/next/__test__/mock.d.ts +2 -1
  6. package/src/lib/next/components/Column/Column.d.ts +1 -1
  7. package/src/lib/next/components/Container/Container.d.ts +1 -1
  8. package/src/lib/next/components/Container/{ContainerFallbakcs.d.ts → ContainerFallbacks.d.ts} +2 -2
  9. package/src/lib/next/components/Contentlet/Contentlet.d.ts +2 -2
  10. package/src/lib/next/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer.d.ts +27 -0
  11. package/src/lib/{deprecated/components/BlockEditorRenderer/item → next/components/DotCMSBlockEditorRenderer/components}/BlockEditorBlock.d.ts +8 -5
  12. package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Code.d.ts +24 -0
  13. package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/DotContent.d.ts +14 -0
  14. package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Image.d.ts +10 -0
  15. package/src/lib/{deprecated/components/BlockEditorRenderer → next/components/DotCMSBlockEditorRenderer/components}/blocks/Lists.d.ts +8 -4
  16. package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/NoComponentProvided.d.ts +3 -0
  17. package/src/lib/{deprecated/components/BlockEditorRenderer → next/components/DotCMSBlockEditorRenderer/components}/blocks/Table.d.ts +3 -3
  18. package/src/lib/{deprecated/components/BlockEditorRenderer → next/components/DotCMSBlockEditorRenderer/components}/blocks/Texts.d.ts +23 -13
  19. package/src/lib/next/components/DotCMSBlockEditorRenderer/components/blocks/Video.d.ts +10 -0
  20. package/src/lib/{deprecated/components/DotEditableText/DotEditableText.d.ts → next/components/DotCMSEditableText/DotCMSEditableText.d.ts} +8 -6
  21. package/src/lib/{deprecated/components/DotEditableText → next/components/DotCMSEditableText}/utils.d.ts +9 -9
  22. package/src/lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.d.ts +5 -5
  23. package/src/lib/next/components/DotCMSLayoutBody/components/ErrorMessage.d.ts +1 -4
  24. package/src/lib/next/components/DotCMSShow/DotCMSShow.d.ts +2 -2
  25. package/src/lib/next/components/FallbackComponent/FallbackComponent.d.ts +6 -6
  26. package/src/lib/next/components/Row/Row.d.ts +1 -1
  27. package/src/lib/next/contexts/DotCMSPageContext.d.ts +2 -3
  28. package/src/lib/next/hooks/{useShowInUVE.d.ts → useDotCMSShowWhen.d.ts} +5 -5
  29. package/src/lib/next/hooks/useEditableDotCMSPage.d.ts +90 -0
  30. package/src/lib/next/hooks/useIsDevMode.d.ts +2 -5
  31. package/es.regexp.to-string.esm.js +0 -1878
  32. package/next.esm.d.ts +0 -1
  33. package/next.esm.js +0 -738
  34. package/src/lib/deprecated/components/BlockEditorRenderer/BlockEditorRenderer.d.ts +0 -37
  35. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Code.d.ts +0 -17
  36. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Contentlet.d.ts +0 -41
  37. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Image.d.ts +0 -8
  38. package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Video.d.ts +0 -8
  39. package/src/lib/deprecated/components/Column/Column.d.ts +0 -19
  40. package/src/lib/deprecated/components/Container/Container.d.ts +0 -19
  41. package/src/lib/deprecated/components/DotcmsLayout/DotcmsLayout.d.ts +0 -34
  42. package/src/lib/deprecated/components/PageProvider/PageProvider.d.ts +0 -14
  43. package/src/lib/deprecated/components/Row/Row.d.ts +0 -26
  44. package/src/lib/deprecated/contexts/PageContext.d.ts +0 -8
  45. package/src/lib/deprecated/deprecated_api.d.ts +0 -7
  46. package/src/lib/deprecated/hooks/useCheckHaveContent.d.ts +0 -5
  47. package/src/lib/deprecated/hooks/useDotcmsEditor.d.ts +0 -13
  48. package/src/lib/deprecated/hooks/useDotcmsPageContext.d.ts +0 -9
  49. package/src/lib/deprecated/mocks/index.d.ts +0 -1
  50. package/src/lib/deprecated/mocks/mockPageContext.d.ts +0 -7
  51. package/src/lib/deprecated/models/blocks.interface.d.ts +0 -89
  52. package/src/lib/deprecated/models/content-node.interface.d.ts +0 -82
  53. package/src/lib/deprecated/models/index.d.ts +0 -127
  54. package/src/lib/deprecated/utils/utils.d.ts +0 -58
  55. package/src/lib/next/types.d.ts +0 -421
  56. package/src/lib/next/utils/index.d.ts +0 -136
  57. package/src/next.d.ts +0 -3
package/index.esm.js CHANGED
@@ -1,286 +1,2292 @@
1
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import { s as styleInject, f as functionUncurryThis, t as toString$4, r as requireObjectCoercible$1, a as toIntegerOrInfinity$1, i as iteratorDefine, b as internalState, c as createIterResultObject$2, d as fails$2, w as wellKnownSymbol$4, e as descriptors, g as classofRaw$1, h as aCallable$2, j as functionBindNative, m as makeBuiltInExports, o as objectDefineProperty, k as objectIsPrototypeOf, l as functionCall, n as anObject$4, p as getMethod$2, q as iterators, u as getBuiltIn$1, v as isCallable$2, x as classof$3, y as inspectSource$1, z as createPropertyDescriptor$2, A as isNullOrUndefined$1, B as tryToString$1, C as toObject$1, D as lengthOfArrayLike$1, E as global$3, F as defineBuiltIn$5, G as arraySlice$2, _ as _export, H as setToStringTag$2, I as iteratorCreateConstructor, J as isObject$1, K as objectCreate, L as hasOwnProperty_1, M as objectAssign } from './es.regexp.to-string.esm.js';
3
- import { useState, useEffect, createContext, useRef, useContext, createElement, forwardRef } from 'react';
4
- import { isInsideEditor, initEditor, updateNavigation, destroyEditor, postMessageToEditor, CLIENT_ACTIONS, DotCmsClient, NOTIFY_CLIENT, initInlineEditing } from '@dotcms/client';
5
- import { createUVESubscription } from '@dotcms/uve';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { createContext, useContext, useState, useEffect, useLayoutEffect, useRef, useMemo } from 'react';
3
+ import { UVE_MODE, UVEEventType, DotCMSUVEAction } from '@dotcms/types';
4
+ import { getUVEState, initUVE, updateNavigation, createUVESubscription, sendMessageToUVE } from '@dotcms/uve';
5
+ import { DEVELOPMENT_MODE, EMPTY_CONTAINER_STYLE_REACT, getDotContentletAttributes, CUSTOM_NO_COMPONENT, getContainersData, getContentletsInContainer, getDotContainerAttributes, getColumnPositionClasses, combineClasses, __DEFAULT_TINYMCE_CONFIG__, __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__, __TINYMCE_PATH_ON_DOTCMS__, isValidBlocks } from '@dotcms/uve/internal';
6
6
  import { Editor } from '@tinymce/tinymce-react';
7
+ import { __DOTCMS_UVE_EVENT__, BlockEditorDefaultBlocks } from '@dotcms/types/internal';
8
+
9
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
+
11
+ var check = function (it) {
12
+ return it && it.Math === Math && it;
13
+ };
14
+
15
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
16
+ var global$f =
17
+ // eslint-disable-next-line es/no-global-this -- safe
18
+ check(typeof globalThis == 'object' && globalThis) ||
19
+ check(typeof window == 'object' && window) ||
20
+ // eslint-disable-next-line no-restricted-globals -- safe
21
+ check(typeof self == 'object' && self) ||
22
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
23
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
24
+ // eslint-disable-next-line no-new-func -- fallback
25
+ (function () { return this; })() || Function('return this')();
26
+
27
+ var objectGetOwnPropertyDescriptor = {};
28
+
29
+ var fails$g = function (exec) {
30
+ try {
31
+ return !!exec();
32
+ } catch (error) {
33
+ return true;
34
+ }
35
+ };
36
+
37
+ var fails$f = fails$g;
38
+
39
+ // Detect IE8's incomplete defineProperty implementation
40
+ var descriptors = !fails$f(function () {
41
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
42
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
43
+ });
44
+
45
+ var fails$e = fails$g;
46
+
47
+ var functionBindNative = !fails$e(function () {
48
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
49
+ var test = (function () { /* empty */ }).bind();
50
+ // eslint-disable-next-line no-prototype-builtins -- safe
51
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
52
+ });
53
+
54
+ var NATIVE_BIND$3 = functionBindNative;
55
+
56
+ var call$g = Function.prototype.call;
57
+
58
+ var functionCall = NATIVE_BIND$3 ? call$g.bind(call$g) : function () {
59
+ return call$g.apply(call$g, arguments);
60
+ };
61
+
62
+ var objectPropertyIsEnumerable = {};
63
+
64
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
65
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
66
+ var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
67
+
68
+ // Nashorn ~ JDK8 bug
69
+ var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
70
+
71
+ // `Object.prototype.propertyIsEnumerable` method implementation
72
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
73
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
74
+ var descriptor = getOwnPropertyDescriptor$2(this, V);
75
+ return !!descriptor && descriptor.enumerable;
76
+ } : $propertyIsEnumerable;
77
+
78
+ var createPropertyDescriptor$5 = function (bitmap, value) {
79
+ return {
80
+ enumerable: !(bitmap & 1),
81
+ configurable: !(bitmap & 2),
82
+ writable: !(bitmap & 4),
83
+ value: value
84
+ };
85
+ };
86
+
87
+ var NATIVE_BIND$2 = functionBindNative;
88
+
89
+ var FunctionPrototype$2 = Function.prototype;
90
+ var call$f = FunctionPrototype$2.call;
91
+ var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$f, call$f);
92
+
93
+ var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
94
+ return function () {
95
+ return call$f.apply(fn, arguments);
96
+ };
97
+ };
98
+
99
+ var uncurryThis$n = functionUncurryThis;
100
+
101
+ var toString$7 = uncurryThis$n({}.toString);
102
+ var stringSlice$4 = uncurryThis$n(''.slice);
103
+
104
+ var classofRaw$2 = function (it) {
105
+ return stringSlice$4(toString$7(it), 8, -1);
106
+ };
107
+
108
+ var uncurryThis$m = functionUncurryThis;
109
+ var fails$d = fails$g;
110
+ var classof$7 = classofRaw$2;
111
+
112
+ var $Object$4 = Object;
113
+ var split$3 = uncurryThis$m(''.split);
114
+
115
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
116
+ var indexedObject = fails$d(function () {
117
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
118
+ // eslint-disable-next-line no-prototype-builtins -- safe
119
+ return !$Object$4('z').propertyIsEnumerable(0);
120
+ }) ? function (it) {
121
+ return classof$7(it) === 'String' ? split$3(it, '') : $Object$4(it);
122
+ } : $Object$4;
123
+
124
+ // we can't use just `it == null` since of `document.all` special case
125
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
126
+ var isNullOrUndefined$3 = function (it) {
127
+ return it === null || it === undefined;
128
+ };
129
+
130
+ var isNullOrUndefined$2 = isNullOrUndefined$3;
131
+
132
+ var $TypeError$a = TypeError;
133
+
134
+ // `RequireObjectCoercible` abstract operation
135
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
136
+ var requireObjectCoercible$4 = function (it) {
137
+ if (isNullOrUndefined$2(it)) throw new $TypeError$a("Can't call method on " + it);
138
+ return it;
139
+ };
140
+
141
+ // toObject with fallback for non-array-like ES3 strings
142
+ var IndexedObject$1 = indexedObject;
143
+ var requireObjectCoercible$3 = requireObjectCoercible$4;
144
+
145
+ var toIndexedObject$5 = function (it) {
146
+ return IndexedObject$1(requireObjectCoercible$3(it));
147
+ };
148
+
149
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
150
+ var documentAll = typeof document == 'object' && document.all;
151
+
152
+ // `IsCallable` abstract operation
153
+ // https://tc39.es/ecma262/#sec-iscallable
154
+ // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
155
+ var isCallable$j = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
156
+ return typeof argument == 'function' || argument === documentAll;
157
+ } : function (argument) {
158
+ return typeof argument == 'function';
159
+ };
160
+
161
+ var isCallable$i = isCallable$j;
162
+
163
+ var isObject$9 = function (it) {
164
+ return typeof it == 'object' ? it !== null : isCallable$i(it);
165
+ };
166
+
167
+ var global$e = global$f;
168
+ var isCallable$h = isCallable$j;
169
+
170
+ var aFunction = function (argument) {
171
+ return isCallable$h(argument) ? argument : undefined;
172
+ };
173
+
174
+ var getBuiltIn$5 = function (namespace, method) {
175
+ return arguments.length < 2 ? aFunction(global$e[namespace]) : global$e[namespace] && global$e[namespace][method];
176
+ };
177
+
178
+ var uncurryThis$l = functionUncurryThis;
179
+
180
+ var objectIsPrototypeOf = uncurryThis$l({}.isPrototypeOf);
181
+
182
+ var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
183
+
184
+ var global$d = global$f;
185
+ var userAgent = engineUserAgent;
186
+
187
+ var process = global$d.process;
188
+ var Deno = global$d.Deno;
189
+ var versions = process && process.versions || Deno && Deno.version;
190
+ var v8 = versions && versions.v8;
191
+ var match, version;
192
+
193
+ if (v8) {
194
+ match = v8.split('.');
195
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
196
+ // but their correct versions are not interesting for us
197
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
198
+ }
199
+
200
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
201
+ // so check `userAgent` even if `.v8` exists, but 0
202
+ if (!version && userAgent) {
203
+ match = userAgent.match(/Edge\/(\d+)/);
204
+ if (!match || match[1] >= 74) {
205
+ match = userAgent.match(/Chrome\/(\d+)/);
206
+ if (match) version = +match[1];
207
+ }
208
+ }
209
+
210
+ var engineV8Version = version;
211
+
212
+ /* eslint-disable es/no-symbol -- required for testing */
213
+ var V8_VERSION = engineV8Version;
214
+ var fails$c = fails$g;
215
+ var global$c = global$f;
216
+
217
+ var $String$6 = global$c.String;
218
+
219
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
220
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$c(function () {
221
+ var symbol = Symbol('symbol detection');
222
+ // Chrome 38 Symbol has incorrect toString conversion
223
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
224
+ // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
225
+ // of course, fail.
226
+ return !$String$6(symbol) || !(Object(symbol) instanceof Symbol) ||
227
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
228
+ !Symbol.sham && V8_VERSION && V8_VERSION < 41;
229
+ });
230
+
231
+ /* eslint-disable es/no-symbol -- required for testing */
232
+ var NATIVE_SYMBOL$2 = symbolConstructorDetection;
233
+
234
+ var useSymbolAsUid = NATIVE_SYMBOL$2
235
+ && !Symbol.sham
236
+ && typeof Symbol.iterator == 'symbol';
237
+
238
+ var getBuiltIn$4 = getBuiltIn$5;
239
+ var isCallable$g = isCallable$j;
240
+ var isPrototypeOf$2 = objectIsPrototypeOf;
241
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
242
+
243
+ var $Object$3 = Object;
244
+
245
+ var isSymbol$3 = USE_SYMBOL_AS_UID$1 ? function (it) {
246
+ return typeof it == 'symbol';
247
+ } : function (it) {
248
+ var $Symbol = getBuiltIn$4('Symbol');
249
+ return isCallable$g($Symbol) && isPrototypeOf$2($Symbol.prototype, $Object$3(it));
250
+ };
251
+
252
+ var $String$5 = String;
253
+
254
+ var tryToString$2 = function (argument) {
255
+ try {
256
+ return $String$5(argument);
257
+ } catch (error) {
258
+ return 'Object';
259
+ }
260
+ };
261
+
262
+ var isCallable$f = isCallable$j;
263
+ var tryToString$1 = tryToString$2;
264
+
265
+ var $TypeError$9 = TypeError;
266
+
267
+ // `Assert: IsCallable(argument) is true`
268
+ var aCallable$5 = function (argument) {
269
+ if (isCallable$f(argument)) return argument;
270
+ throw new $TypeError$9(tryToString$1(argument) + ' is not a function');
271
+ };
272
+
273
+ var aCallable$4 = aCallable$5;
274
+ var isNullOrUndefined$1 = isNullOrUndefined$3;
275
+
276
+ // `GetMethod` abstract operation
277
+ // https://tc39.es/ecma262/#sec-getmethod
278
+ var getMethod$4 = function (V, P) {
279
+ var func = V[P];
280
+ return isNullOrUndefined$1(func) ? undefined : aCallable$4(func);
281
+ };
282
+
283
+ var call$e = functionCall;
284
+ var isCallable$e = isCallable$j;
285
+ var isObject$8 = isObject$9;
286
+
287
+ var $TypeError$8 = TypeError;
288
+
289
+ // `OrdinaryToPrimitive` abstract operation
290
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
291
+ var ordinaryToPrimitive$1 = function (input, pref) {
292
+ var fn, val;
293
+ if (pref === 'string' && isCallable$e(fn = input.toString) && !isObject$8(val = call$e(fn, input))) return val;
294
+ if (isCallable$e(fn = input.valueOf) && !isObject$8(val = call$e(fn, input))) return val;
295
+ if (pref !== 'string' && isCallable$e(fn = input.toString) && !isObject$8(val = call$e(fn, input))) return val;
296
+ throw new $TypeError$8("Can't convert object to primitive value");
297
+ };
298
+
299
+ var sharedStore = {exports: {}};
7
300
 
8
301
  var isPure = false;
9
302
 
10
- /**
11
- * Custom Hook to handle the DotCMS editor interaction with the page.
12
- *
13
- * @category Hooks
14
- * @param {DotcmsPageProps} props {
15
- * pageContext,
16
- * config,
17
- * }
18
- * @returns {DotCMSPageContext} The context for a DotCMS page provided by the editor.
19
- */
20
- const useDotcmsEditor = ({
21
- pageContext,
22
- config
23
- }) => {
24
- const {
25
- pathname,
26
- onReload,
27
- editor
28
- } = config;
29
- const [state, setState] = useState(Object.assign({}, pageContext, {
30
- isInsideEditor: false
31
- }));
32
- /**
33
- * Initializes the DotCMS editor.
34
- */
35
- useEffect(() => {
36
- if (!isInsideEditor()) {
37
- return;
303
+ var global$b = global$f;
304
+
305
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
306
+ var defineProperty$6 = Object.defineProperty;
307
+
308
+ var defineGlobalProperty$3 = function (key, value) {
309
+ try {
310
+ defineProperty$6(global$b, key, { value: value, configurable: true, writable: true });
311
+ } catch (error) {
312
+ global$b[key] = value;
313
+ } return value;
314
+ };
315
+
316
+ var globalThis$1 = global$f;
317
+ var defineGlobalProperty$2 = defineGlobalProperty$3;
318
+
319
+ var SHARED = '__core-js_shared__';
320
+ var store$3 = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty$2(SHARED, {});
321
+
322
+ (store$3.versions || (store$3.versions = [])).push({
323
+ version: '3.36.1',
324
+ mode: 'global',
325
+ copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
326
+ license: 'https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE',
327
+ source: 'https://github.com/zloirock/core-js'
328
+ });
329
+
330
+ var sharedStoreExports = sharedStore.exports;
331
+
332
+ var store$2 = sharedStoreExports;
333
+
334
+ var shared$3 = function (key, value) {
335
+ return store$2[key] || (store$2[key] = value || {});
336
+ };
337
+
338
+ var requireObjectCoercible$2 = requireObjectCoercible$4;
339
+
340
+ var $Object$2 = Object;
341
+
342
+ // `ToObject` abstract operation
343
+ // https://tc39.es/ecma262/#sec-toobject
344
+ var toObject$4 = function (argument) {
345
+ return $Object$2(requireObjectCoercible$2(argument));
346
+ };
347
+
348
+ var uncurryThis$k = functionUncurryThis;
349
+ var toObject$3 = toObject$4;
350
+
351
+ var hasOwnProperty = uncurryThis$k({}.hasOwnProperty);
352
+
353
+ // `HasOwnProperty` abstract operation
354
+ // https://tc39.es/ecma262/#sec-hasownproperty
355
+ // eslint-disable-next-line es/no-object-hasown -- safe
356
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
357
+ return hasOwnProperty(toObject$3(it), key);
358
+ };
359
+
360
+ var uncurryThis$j = functionUncurryThis;
361
+
362
+ var id = 0;
363
+ var postfix = Math.random();
364
+ var toString$6 = uncurryThis$j(1.0.toString);
365
+
366
+ var uid$2 = function (key) {
367
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$6(++id + postfix, 36);
368
+ };
369
+
370
+ var global$a = global$f;
371
+ var shared$2 = shared$3;
372
+ var hasOwn$c = hasOwnProperty_1;
373
+ var uid$1 = uid$2;
374
+ var NATIVE_SYMBOL$1 = symbolConstructorDetection;
375
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
376
+
377
+ var Symbol$1 = global$a.Symbol;
378
+ var WellKnownSymbolsStore = shared$2('wks');
379
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
380
+
381
+ var wellKnownSymbol$e = function (name) {
382
+ if (!hasOwn$c(WellKnownSymbolsStore, name)) {
383
+ WellKnownSymbolsStore[name] = NATIVE_SYMBOL$1 && hasOwn$c(Symbol$1, name)
384
+ ? Symbol$1[name]
385
+ : createWellKnownSymbol('Symbol.' + name);
386
+ } return WellKnownSymbolsStore[name];
387
+ };
388
+
389
+ var call$d = functionCall;
390
+ var isObject$7 = isObject$9;
391
+ var isSymbol$2 = isSymbol$3;
392
+ var getMethod$3 = getMethod$4;
393
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
394
+ var wellKnownSymbol$d = wellKnownSymbol$e;
395
+
396
+ var $TypeError$7 = TypeError;
397
+ var TO_PRIMITIVE = wellKnownSymbol$d('toPrimitive');
398
+
399
+ // `ToPrimitive` abstract operation
400
+ // https://tc39.es/ecma262/#sec-toprimitive
401
+ var toPrimitive$1 = function (input, pref) {
402
+ if (!isObject$7(input) || isSymbol$2(input)) return input;
403
+ var exoticToPrim = getMethod$3(input, TO_PRIMITIVE);
404
+ var result;
405
+ if (exoticToPrim) {
406
+ if (pref === undefined) pref = 'default';
407
+ result = call$d(exoticToPrim, input, pref);
408
+ if (!isObject$7(result) || isSymbol$2(result)) return result;
409
+ throw new $TypeError$7("Can't convert object to primitive value");
410
+ }
411
+ if (pref === undefined) pref = 'number';
412
+ return ordinaryToPrimitive(input, pref);
413
+ };
414
+
415
+ var toPrimitive = toPrimitive$1;
416
+ var isSymbol$1 = isSymbol$3;
417
+
418
+ // `ToPropertyKey` abstract operation
419
+ // https://tc39.es/ecma262/#sec-topropertykey
420
+ var toPropertyKey$2 = function (argument) {
421
+ var key = toPrimitive(argument, 'string');
422
+ return isSymbol$1(key) ? key : key + '';
423
+ };
424
+
425
+ var global$9 = global$f;
426
+ var isObject$6 = isObject$9;
427
+
428
+ var document$1 = global$9.document;
429
+ // typeof document.createElement is 'object' in old IE
430
+ var EXISTS$1 = isObject$6(document$1) && isObject$6(document$1.createElement);
431
+
432
+ var documentCreateElement$2 = function (it) {
433
+ return EXISTS$1 ? document$1.createElement(it) : {};
434
+ };
435
+
436
+ var DESCRIPTORS$g = descriptors;
437
+ var fails$b = fails$g;
438
+ var createElement = documentCreateElement$2;
439
+
440
+ // Thanks to IE8 for its funny defineProperty
441
+ var ie8DomDefine = !DESCRIPTORS$g && !fails$b(function () {
442
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
443
+ return Object.defineProperty(createElement('div'), 'a', {
444
+ get: function () { return 7; }
445
+ }).a !== 7;
446
+ });
447
+
448
+ var DESCRIPTORS$f = descriptors;
449
+ var call$c = functionCall;
450
+ var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
451
+ var createPropertyDescriptor$4 = createPropertyDescriptor$5;
452
+ var toIndexedObject$4 = toIndexedObject$5;
453
+ var toPropertyKey$1 = toPropertyKey$2;
454
+ var hasOwn$b = hasOwnProperty_1;
455
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
456
+
457
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
458
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
459
+
460
+ // `Object.getOwnPropertyDescriptor` method
461
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
462
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$f ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
463
+ O = toIndexedObject$4(O);
464
+ P = toPropertyKey$1(P);
465
+ if (IE8_DOM_DEFINE$1) try {
466
+ return $getOwnPropertyDescriptor$1(O, P);
467
+ } catch (error) { /* empty */ }
468
+ if (hasOwn$b(O, P)) return createPropertyDescriptor$4(!call$c(propertyIsEnumerableModule$1.f, O, P), O[P]);
469
+ };
470
+
471
+ var objectDefineProperty = {};
472
+
473
+ var DESCRIPTORS$e = descriptors;
474
+ var fails$a = fails$g;
475
+
476
+ // V8 ~ Chrome 36-
477
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
478
+ var v8PrototypeDefineBug = DESCRIPTORS$e && fails$a(function () {
479
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
480
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
481
+ value: 42,
482
+ writable: false
483
+ }).prototype !== 42;
484
+ });
485
+
486
+ var isObject$5 = isObject$9;
487
+
488
+ var $String$4 = String;
489
+ var $TypeError$6 = TypeError;
490
+
491
+ // `Assert: Type(argument) is Object`
492
+ var anObject$c = function (argument) {
493
+ if (isObject$5(argument)) return argument;
494
+ throw new $TypeError$6($String$4(argument) + ' is not an object');
495
+ };
496
+
497
+ var DESCRIPTORS$d = descriptors;
498
+ var IE8_DOM_DEFINE = ie8DomDefine;
499
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
500
+ var anObject$b = anObject$c;
501
+ var toPropertyKey = toPropertyKey$2;
502
+
503
+ var $TypeError$5 = TypeError;
504
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
505
+ var $defineProperty = Object.defineProperty;
506
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
507
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
508
+ var ENUMERABLE = 'enumerable';
509
+ var CONFIGURABLE$1 = 'configurable';
510
+ var WRITABLE = 'writable';
511
+
512
+ // `Object.defineProperty` method
513
+ // https://tc39.es/ecma262/#sec-object.defineproperty
514
+ objectDefineProperty.f = DESCRIPTORS$d ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
515
+ anObject$b(O);
516
+ P = toPropertyKey(P);
517
+ anObject$b(Attributes);
518
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
519
+ var current = $getOwnPropertyDescriptor(O, P);
520
+ if (current && current[WRITABLE]) {
521
+ O[P] = Attributes.value;
522
+ Attributes = {
523
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
524
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
525
+ writable: false
526
+ };
527
+ }
528
+ } return $defineProperty(O, P, Attributes);
529
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
530
+ anObject$b(O);
531
+ P = toPropertyKey(P);
532
+ anObject$b(Attributes);
533
+ if (IE8_DOM_DEFINE) try {
534
+ return $defineProperty(O, P, Attributes);
535
+ } catch (error) { /* empty */ }
536
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$5('Accessors not supported');
537
+ if ('value' in Attributes) O[P] = Attributes.value;
538
+ return O;
539
+ };
540
+
541
+ var DESCRIPTORS$c = descriptors;
542
+ var definePropertyModule$4 = objectDefineProperty;
543
+ var createPropertyDescriptor$3 = createPropertyDescriptor$5;
544
+
545
+ var createNonEnumerableProperty$5 = DESCRIPTORS$c ? function (object, key, value) {
546
+ return definePropertyModule$4.f(object, key, createPropertyDescriptor$3(1, value));
547
+ } : function (object, key, value) {
548
+ object[key] = value;
549
+ return object;
550
+ };
551
+
552
+ var makeBuiltIn$3 = {exports: {}};
553
+
554
+ var DESCRIPTORS$b = descriptors;
555
+ var hasOwn$a = hasOwnProperty_1;
556
+
557
+ var FunctionPrototype$1 = Function.prototype;
558
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
559
+ var getDescriptor = DESCRIPTORS$b && Object.getOwnPropertyDescriptor;
560
+
561
+ var EXISTS = hasOwn$a(FunctionPrototype$1, 'name');
562
+ // additional protection from minified / mangled / dropped function names
563
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
564
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$b || (DESCRIPTORS$b && getDescriptor(FunctionPrototype$1, 'name').configurable));
565
+
566
+ var functionName = {
567
+ PROPER: PROPER,
568
+ CONFIGURABLE: CONFIGURABLE
569
+ };
570
+
571
+ var uncurryThis$i = functionUncurryThis;
572
+ var isCallable$d = isCallable$j;
573
+ var store$1 = sharedStoreExports;
574
+
575
+ var functionToString = uncurryThis$i(Function.toString);
576
+
577
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
578
+ if (!isCallable$d(store$1.inspectSource)) {
579
+ store$1.inspectSource = function (it) {
580
+ return functionToString(it);
581
+ };
582
+ }
583
+
584
+ var inspectSource$2 = store$1.inspectSource;
585
+
586
+ var global$8 = global$f;
587
+ var isCallable$c = isCallable$j;
588
+
589
+ var WeakMap$1 = global$8.WeakMap;
590
+
591
+ var weakMapBasicDetection = isCallable$c(WeakMap$1) && /native code/.test(String(WeakMap$1));
592
+
593
+ var shared$1 = shared$3;
594
+ var uid = uid$2;
595
+
596
+ var keys = shared$1('keys');
597
+
598
+ var sharedKey$3 = function (key) {
599
+ return keys[key] || (keys[key] = uid(key));
600
+ };
601
+
602
+ var hiddenKeys$4 = {};
603
+
604
+ var NATIVE_WEAK_MAP = weakMapBasicDetection;
605
+ var global$7 = global$f;
606
+ var isObject$4 = isObject$9;
607
+ var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
608
+ var hasOwn$9 = hasOwnProperty_1;
609
+ var shared = sharedStoreExports;
610
+ var sharedKey$2 = sharedKey$3;
611
+ var hiddenKeys$3 = hiddenKeys$4;
612
+
613
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
614
+ var TypeError$3 = global$7.TypeError;
615
+ var WeakMap = global$7.WeakMap;
616
+ var set, get, has;
617
+
618
+ var enforce = function (it) {
619
+ return has(it) ? get(it) : set(it, {});
620
+ };
621
+
622
+ var getterFor = function (TYPE) {
623
+ return function (it) {
624
+ var state;
625
+ if (!isObject$4(it) || (state = get(it)).type !== TYPE) {
626
+ throw new TypeError$3('Incompatible receiver, ' + TYPE + ' required');
627
+ } return state;
628
+ };
629
+ };
630
+
631
+ if (NATIVE_WEAK_MAP || shared.state) {
632
+ var store = shared.state || (shared.state = new WeakMap());
633
+ /* eslint-disable no-self-assign -- prototype methods protection */
634
+ store.get = store.get;
635
+ store.has = store.has;
636
+ store.set = store.set;
637
+ /* eslint-enable no-self-assign -- prototype methods protection */
638
+ set = function (it, metadata) {
639
+ if (store.has(it)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED);
640
+ metadata.facade = it;
641
+ store.set(it, metadata);
642
+ return metadata;
643
+ };
644
+ get = function (it) {
645
+ return store.get(it) || {};
646
+ };
647
+ has = function (it) {
648
+ return store.has(it);
649
+ };
650
+ } else {
651
+ var STATE = sharedKey$2('state');
652
+ hiddenKeys$3[STATE] = true;
653
+ set = function (it, metadata) {
654
+ if (hasOwn$9(it, STATE)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED);
655
+ metadata.facade = it;
656
+ createNonEnumerableProperty$4(it, STATE, metadata);
657
+ return metadata;
658
+ };
659
+ get = function (it) {
660
+ return hasOwn$9(it, STATE) ? it[STATE] : {};
661
+ };
662
+ has = function (it) {
663
+ return hasOwn$9(it, STATE);
664
+ };
665
+ }
666
+
667
+ var internalState = {
668
+ set: set,
669
+ get: get,
670
+ has: has,
671
+ enforce: enforce,
672
+ getterFor: getterFor
673
+ };
674
+
675
+ var uncurryThis$h = functionUncurryThis;
676
+ var fails$9 = fails$g;
677
+ var isCallable$b = isCallable$j;
678
+ var hasOwn$8 = hasOwnProperty_1;
679
+ var DESCRIPTORS$a = descriptors;
680
+ var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
681
+ var inspectSource$1 = inspectSource$2;
682
+ var InternalStateModule$5 = internalState;
683
+
684
+ var enforceInternalState = InternalStateModule$5.enforce;
685
+ var getInternalState$2 = InternalStateModule$5.get;
686
+ var $String$3 = String;
687
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
688
+ var defineProperty$5 = Object.defineProperty;
689
+ var stringSlice$3 = uncurryThis$h(''.slice);
690
+ var replace$4 = uncurryThis$h(''.replace);
691
+ var join$3 = uncurryThis$h([].join);
692
+
693
+ var CONFIGURABLE_LENGTH = DESCRIPTORS$a && !fails$9(function () {
694
+ return defineProperty$5(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
695
+ });
696
+
697
+ var TEMPLATE = String(String).split('String');
698
+
699
+ var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
700
+ if (stringSlice$3($String$3(name), 0, 7) === 'Symbol(') {
701
+ name = '[' + replace$4($String$3(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
702
+ }
703
+ if (options && options.getter) name = 'get ' + name;
704
+ if (options && options.setter) name = 'set ' + name;
705
+ if (!hasOwn$8(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
706
+ if (DESCRIPTORS$a) defineProperty$5(value, 'name', { value: name, configurable: true });
707
+ else value.name = name;
708
+ }
709
+ if (CONFIGURABLE_LENGTH && options && hasOwn$8(options, 'arity') && value.length !== options.arity) {
710
+ defineProperty$5(value, 'length', { value: options.arity });
711
+ }
712
+ try {
713
+ if (options && hasOwn$8(options, 'constructor') && options.constructor) {
714
+ if (DESCRIPTORS$a) defineProperty$5(value, 'prototype', { writable: false });
715
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
716
+ } else if (value.prototype) value.prototype = undefined;
717
+ } catch (error) { /* empty */ }
718
+ var state = enforceInternalState(value);
719
+ if (!hasOwn$8(state, 'source')) {
720
+ state.source = join$3(TEMPLATE, typeof name == 'string' ? name : '');
721
+ } return value;
722
+ };
723
+
724
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
725
+ // eslint-disable-next-line no-extend-native -- required
726
+ Function.prototype.toString = makeBuiltIn$2(function toString() {
727
+ return isCallable$b(this) && getInternalState$2(this).source || inspectSource$1(this);
728
+ }, 'toString');
729
+
730
+ var makeBuiltInExports = makeBuiltIn$3.exports;
731
+
732
+ var isCallable$a = isCallable$j;
733
+ var definePropertyModule$3 = objectDefineProperty;
734
+ var makeBuiltIn$1 = makeBuiltInExports;
735
+ var defineGlobalProperty$1 = defineGlobalProperty$3;
736
+
737
+ var defineBuiltIn$9 = function (O, key, value, options) {
738
+ if (!options) options = {};
739
+ var simple = options.enumerable;
740
+ var name = options.name !== undefined ? options.name : key;
741
+ if (isCallable$a(value)) makeBuiltIn$1(value, name, options);
742
+ if (options.global) {
743
+ if (simple) O[key] = value;
744
+ else defineGlobalProperty$1(key, value);
745
+ } else {
746
+ try {
747
+ if (!options.unsafe) delete O[key];
748
+ else if (O[key]) simple = true;
749
+ } catch (error) { /* empty */ }
750
+ if (simple) O[key] = value;
751
+ else definePropertyModule$3.f(O, key, {
752
+ value: value,
753
+ enumerable: false,
754
+ configurable: !options.nonConfigurable,
755
+ writable: !options.nonWritable
756
+ });
757
+ } return O;
758
+ };
759
+
760
+ var objectGetOwnPropertyNames = {};
761
+
762
+ var ceil = Math.ceil;
763
+ var floor$3 = Math.floor;
764
+
765
+ // `Math.trunc` method
766
+ // https://tc39.es/ecma262/#sec-math.trunc
767
+ // eslint-disable-next-line es/no-math-trunc -- safe
768
+ var mathTrunc = Math.trunc || function trunc(x) {
769
+ var n = +x;
770
+ return (n > 0 ? floor$3 : ceil)(n);
771
+ };
772
+
773
+ var trunc = mathTrunc;
774
+
775
+ // `ToIntegerOrInfinity` abstract operation
776
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
777
+ var toIntegerOrInfinity$3 = function (argument) {
778
+ var number = +argument;
779
+ // eslint-disable-next-line no-self-compare -- NaN check
780
+ return number !== number || number === 0 ? 0 : trunc(number);
781
+ };
782
+
783
+ var toIntegerOrInfinity$2 = toIntegerOrInfinity$3;
784
+
785
+ var max = Math.max;
786
+ var min$1 = Math.min;
787
+
788
+ // Helper for a popular repeating case of the spec:
789
+ // Let integer be ? ToInteger(index).
790
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
791
+ var toAbsoluteIndex$1 = function (index, length) {
792
+ var integer = toIntegerOrInfinity$2(index);
793
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
794
+ };
795
+
796
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$3;
797
+
798
+ var min = Math.min;
799
+
800
+ // `ToLength` abstract operation
801
+ // https://tc39.es/ecma262/#sec-tolength
802
+ var toLength$1 = function (argument) {
803
+ var len = toIntegerOrInfinity$1(argument);
804
+ return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
805
+ };
806
+
807
+ var toLength = toLength$1;
808
+
809
+ // `LengthOfArrayLike` abstract operation
810
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
811
+ var lengthOfArrayLike$2 = function (obj) {
812
+ return toLength(obj.length);
813
+ };
814
+
815
+ var toIndexedObject$3 = toIndexedObject$5;
816
+ var toAbsoluteIndex = toAbsoluteIndex$1;
817
+ var lengthOfArrayLike$1 = lengthOfArrayLike$2;
818
+
819
+ // `Array.prototype.{ indexOf, includes }` methods implementation
820
+ var createMethod$1 = function (IS_INCLUDES) {
821
+ return function ($this, el, fromIndex) {
822
+ var O = toIndexedObject$3($this);
823
+ var length = lengthOfArrayLike$1(O);
824
+ if (length === 0) return !IS_INCLUDES && -1;
825
+ var index = toAbsoluteIndex(fromIndex, length);
826
+ var value;
827
+ // Array#includes uses SameValueZero equality algorithm
828
+ // eslint-disable-next-line no-self-compare -- NaN check
829
+ if (IS_INCLUDES && el !== el) while (length > index) {
830
+ value = O[index++];
831
+ // eslint-disable-next-line no-self-compare -- NaN check
832
+ if (value !== value) return true;
833
+ // Array#indexOf ignores holes, Array#includes - not
834
+ } else for (;length > index; index++) {
835
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
836
+ } return !IS_INCLUDES && -1;
837
+ };
838
+ };
839
+
840
+ var arrayIncludes = {
841
+ // `Array.prototype.indexOf` method
842
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
843
+ indexOf: createMethod$1(false)
844
+ };
845
+
846
+ var uncurryThis$g = functionUncurryThis;
847
+ var hasOwn$7 = hasOwnProperty_1;
848
+ var toIndexedObject$2 = toIndexedObject$5;
849
+ var indexOf = arrayIncludes.indexOf;
850
+ var hiddenKeys$2 = hiddenKeys$4;
851
+
852
+ var push$5 = uncurryThis$g([].push);
853
+
854
+ var objectKeysInternal = function (object, names) {
855
+ var O = toIndexedObject$2(object);
856
+ var i = 0;
857
+ var result = [];
858
+ var key;
859
+ for (key in O) !hasOwn$7(hiddenKeys$2, key) && hasOwn$7(O, key) && push$5(result, key);
860
+ // Don't enum bug & hidden keys
861
+ while (names.length > i) if (hasOwn$7(O, key = names[i++])) {
862
+ ~indexOf(result, key) || push$5(result, key);
863
+ }
864
+ return result;
865
+ };
866
+
867
+ // IE8- don't enum bug keys
868
+ var enumBugKeys$3 = [
869
+ 'constructor',
870
+ 'hasOwnProperty',
871
+ 'isPrototypeOf',
872
+ 'propertyIsEnumerable',
873
+ 'toLocaleString',
874
+ 'toString',
875
+ 'valueOf'
876
+ ];
877
+
878
+ var internalObjectKeys$1 = objectKeysInternal;
879
+ var enumBugKeys$2 = enumBugKeys$3;
880
+
881
+ var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
882
+
883
+ // `Object.getOwnPropertyNames` method
884
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
885
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
886
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
887
+ return internalObjectKeys$1(O, hiddenKeys$1);
888
+ };
889
+
890
+ var objectGetOwnPropertySymbols = {};
891
+
892
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
893
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
894
+
895
+ var getBuiltIn$3 = getBuiltIn$5;
896
+ var uncurryThis$f = functionUncurryThis;
897
+ var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
898
+ var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
899
+ var anObject$a = anObject$c;
900
+
901
+ var concat$1 = uncurryThis$f([].concat);
902
+
903
+ // all object keys, includes non-enumerable and symbols
904
+ var ownKeys$1 = getBuiltIn$3('Reflect', 'ownKeys') || function ownKeys(it) {
905
+ var keys = getOwnPropertyNamesModule.f(anObject$a(it));
906
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
907
+ return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
908
+ };
909
+
910
+ var hasOwn$6 = hasOwnProperty_1;
911
+ var ownKeys = ownKeys$1;
912
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
913
+ var definePropertyModule$2 = objectDefineProperty;
914
+
915
+ var copyConstructorProperties$1 = function (target, source, exceptions) {
916
+ var keys = ownKeys(source);
917
+ var defineProperty = definePropertyModule$2.f;
918
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
919
+ for (var i = 0; i < keys.length; i++) {
920
+ var key = keys[i];
921
+ if (!hasOwn$6(target, key) && !(exceptions && hasOwn$6(exceptions, key))) {
922
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
923
+ }
924
+ }
925
+ };
926
+
927
+ var fails$8 = fails$g;
928
+ var isCallable$9 = isCallable$j;
929
+
930
+ var replacement = /#|\.prototype\./;
931
+
932
+ var isForced$1 = function (feature, detection) {
933
+ var value = data[normalize(feature)];
934
+ return value === POLYFILL ? true
935
+ : value === NATIVE ? false
936
+ : isCallable$9(detection) ? fails$8(detection)
937
+ : !!detection;
938
+ };
939
+
940
+ var normalize = isForced$1.normalize = function (string) {
941
+ return String(string).replace(replacement, '.').toLowerCase();
942
+ };
943
+
944
+ var data = isForced$1.data = {};
945
+ var NATIVE = isForced$1.NATIVE = 'N';
946
+ var POLYFILL = isForced$1.POLYFILL = 'P';
947
+
948
+ var isForced_1 = isForced$1;
949
+
950
+ var global$6 = global$f;
951
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
952
+ var createNonEnumerableProperty$3 = createNonEnumerableProperty$5;
953
+ var defineBuiltIn$8 = defineBuiltIn$9;
954
+ var defineGlobalProperty = defineGlobalProperty$3;
955
+ var copyConstructorProperties = copyConstructorProperties$1;
956
+ var isForced = isForced_1;
957
+
958
+ /*
959
+ options.target - name of the target object
960
+ options.global - target is the global object
961
+ options.stat - export as static methods of target
962
+ options.proto - export as prototype methods of target
963
+ options.real - real prototype method for the `pure` version
964
+ options.forced - export even if the native feature is available
965
+ options.bind - bind methods to the target, required for the `pure` version
966
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
967
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
968
+ options.sham - add a flag to not completely full polyfills
969
+ options.enumerable - export as enumerable property
970
+ options.dontCallGetSet - prevent calling a getter on target
971
+ options.name - the .name of the function if it does not match the key
972
+ */
973
+ var _export = function (options, source) {
974
+ var TARGET = options.target;
975
+ var GLOBAL = options.global;
976
+ var STATIC = options.stat;
977
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
978
+ if (GLOBAL) {
979
+ target = global$6;
980
+ } else if (STATIC) {
981
+ target = global$6[TARGET] || defineGlobalProperty(TARGET, {});
982
+ } else {
983
+ target = global$6[TARGET] && global$6[TARGET].prototype;
984
+ }
985
+ if (target) for (key in source) {
986
+ sourceProperty = source[key];
987
+ if (options.dontCallGetSet) {
988
+ descriptor = getOwnPropertyDescriptor$1(target, key);
989
+ targetProperty = descriptor && descriptor.value;
990
+ } else targetProperty = target[key];
991
+ FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
992
+ // contained in target
993
+ if (!FORCED && targetProperty !== undefined) {
994
+ if (typeof sourceProperty == typeof targetProperty) continue;
995
+ copyConstructorProperties(sourceProperty, targetProperty);
996
+ }
997
+ // add a flag to not completely full polyfills
998
+ if (options.sham || (targetProperty && targetProperty.sham)) {
999
+ createNonEnumerableProperty$3(sourceProperty, 'sham', true);
1000
+ }
1001
+ defineBuiltIn$8(target, key, sourceProperty, options);
1002
+ }
1003
+ };
1004
+
1005
+ var isPrototypeOf$1 = objectIsPrototypeOf;
1006
+
1007
+ var $TypeError$4 = TypeError;
1008
+
1009
+ var anInstance$3 = function (it, Prototype) {
1010
+ if (isPrototypeOf$1(Prototype, it)) return it;
1011
+ throw new $TypeError$4('Incorrect invocation');
1012
+ };
1013
+
1014
+ var fails$7 = fails$g;
1015
+
1016
+ var correctPrototypeGetter = !fails$7(function () {
1017
+ function F() { /* empty */ }
1018
+ F.prototype.constructor = null;
1019
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1020
+ return Object.getPrototypeOf(new F()) !== F.prototype;
1021
+ });
1022
+
1023
+ var hasOwn$5 = hasOwnProperty_1;
1024
+ var isCallable$8 = isCallable$j;
1025
+ var toObject$2 = toObject$4;
1026
+ var sharedKey$1 = sharedKey$3;
1027
+ var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1028
+
1029
+ var IE_PROTO$1 = sharedKey$1('IE_PROTO');
1030
+ var $Object$1 = Object;
1031
+ var ObjectPrototype = $Object$1.prototype;
1032
+
1033
+ // `Object.getPrototypeOf` method
1034
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
1035
+ // eslint-disable-next-line es/no-object-getprototypeof -- safe
1036
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
1037
+ var object = toObject$2(O);
1038
+ if (hasOwn$5(object, IE_PROTO$1)) return object[IE_PROTO$1];
1039
+ var constructor = object.constructor;
1040
+ if (isCallable$8(constructor) && object instanceof constructor) {
1041
+ return constructor.prototype;
1042
+ } return object instanceof $Object$1 ? ObjectPrototype : null;
1043
+ };
1044
+
1045
+ var makeBuiltIn = makeBuiltInExports;
1046
+ var defineProperty$4 = objectDefineProperty;
1047
+
1048
+ var defineBuiltInAccessor$4 = function (target, name, descriptor) {
1049
+ if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1050
+ if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1051
+ return defineProperty$4.f(target, name, descriptor);
1052
+ };
1053
+
1054
+ var DESCRIPTORS$9 = descriptors;
1055
+ var definePropertyModule$1 = objectDefineProperty;
1056
+ var createPropertyDescriptor$2 = createPropertyDescriptor$5;
1057
+
1058
+ var createProperty$2 = function (object, key, value) {
1059
+ if (DESCRIPTORS$9) definePropertyModule$1.f(object, key, createPropertyDescriptor$2(0, value));
1060
+ else object[key] = value;
1061
+ };
1062
+
1063
+ var objectDefineProperties = {};
1064
+
1065
+ var internalObjectKeys = objectKeysInternal;
1066
+ var enumBugKeys$1 = enumBugKeys$3;
1067
+
1068
+ // `Object.keys` method
1069
+ // https://tc39.es/ecma262/#sec-object.keys
1070
+ // eslint-disable-next-line es/no-object-keys -- safe
1071
+ var objectKeys$2 = Object.keys || function keys(O) {
1072
+ return internalObjectKeys(O, enumBugKeys$1);
1073
+ };
1074
+
1075
+ var DESCRIPTORS$8 = descriptors;
1076
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1077
+ var definePropertyModule = objectDefineProperty;
1078
+ var anObject$9 = anObject$c;
1079
+ var toIndexedObject$1 = toIndexedObject$5;
1080
+ var objectKeys$1 = objectKeys$2;
1081
+
1082
+ // `Object.defineProperties` method
1083
+ // https://tc39.es/ecma262/#sec-object.defineproperties
1084
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
1085
+ objectDefineProperties.f = DESCRIPTORS$8 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1086
+ anObject$9(O);
1087
+ var props = toIndexedObject$1(Properties);
1088
+ var keys = objectKeys$1(Properties);
1089
+ var length = keys.length;
1090
+ var index = 0;
1091
+ var key;
1092
+ while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
1093
+ return O;
1094
+ };
1095
+
1096
+ var getBuiltIn$2 = getBuiltIn$5;
1097
+
1098
+ var html$1 = getBuiltIn$2('document', 'documentElement');
1099
+
1100
+ /* global ActiveXObject -- old IE, WSH */
1101
+ var anObject$8 = anObject$c;
1102
+ var definePropertiesModule = objectDefineProperties;
1103
+ var enumBugKeys = enumBugKeys$3;
1104
+ var hiddenKeys = hiddenKeys$4;
1105
+ var html = html$1;
1106
+ var documentCreateElement$1 = documentCreateElement$2;
1107
+ var sharedKey = sharedKey$3;
1108
+
1109
+ var GT = '>';
1110
+ var LT = '<';
1111
+ var PROTOTYPE = 'prototype';
1112
+ var SCRIPT = 'script';
1113
+ var IE_PROTO = sharedKey('IE_PROTO');
1114
+
1115
+ var EmptyConstructor = function () { /* empty */ };
1116
+
1117
+ var scriptTag = function (content) {
1118
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1119
+ };
1120
+
1121
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1122
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
1123
+ activeXDocument.write(scriptTag(''));
1124
+ activeXDocument.close();
1125
+ var temp = activeXDocument.parentWindow.Object;
1126
+ activeXDocument = null; // avoid memory leak
1127
+ return temp;
1128
+ };
1129
+
1130
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
1131
+ var NullProtoObjectViaIFrame = function () {
1132
+ // Thrash, waste and sodomy: IE GC bug
1133
+ var iframe = documentCreateElement$1('iframe');
1134
+ var JS = 'java' + SCRIPT + ':';
1135
+ var iframeDocument;
1136
+ iframe.style.display = 'none';
1137
+ html.appendChild(iframe);
1138
+ // https://github.com/zloirock/core-js/issues/475
1139
+ iframe.src = String(JS);
1140
+ iframeDocument = iframe.contentWindow.document;
1141
+ iframeDocument.open();
1142
+ iframeDocument.write(scriptTag('document.F=Object'));
1143
+ iframeDocument.close();
1144
+ return iframeDocument.F;
1145
+ };
1146
+
1147
+ // Check for document.domain and active x support
1148
+ // No need to use active x approach when document.domain is not set
1149
+ // see https://github.com/es-shims/es5-shim/issues/150
1150
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1151
+ // avoid IE GC bug
1152
+ var activeXDocument;
1153
+ var NullProtoObject = function () {
1154
+ try {
1155
+ activeXDocument = new ActiveXObject('htmlfile');
1156
+ } catch (error) { /* ignore */ }
1157
+ NullProtoObject = typeof document != 'undefined'
1158
+ ? document.domain && activeXDocument
1159
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1160
+ : NullProtoObjectViaIFrame()
1161
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
1162
+ var length = enumBugKeys.length;
1163
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1164
+ return NullProtoObject();
1165
+ };
1166
+
1167
+ hiddenKeys[IE_PROTO] = true;
1168
+
1169
+ // `Object.create` method
1170
+ // https://tc39.es/ecma262/#sec-object.create
1171
+ // eslint-disable-next-line es/no-object-create -- safe
1172
+ var objectCreate = Object.create || function create(O, Properties) {
1173
+ var result;
1174
+ if (O !== null) {
1175
+ EmptyConstructor[PROTOTYPE] = anObject$8(O);
1176
+ result = new EmptyConstructor();
1177
+ EmptyConstructor[PROTOTYPE] = null;
1178
+ // add "__proto__" for Object.getPrototypeOf polyfill
1179
+ result[IE_PROTO] = O;
1180
+ } else result = NullProtoObject();
1181
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1182
+ };
1183
+
1184
+ var fails$6 = fails$g;
1185
+ var isCallable$7 = isCallable$j;
1186
+ var isObject$3 = isObject$9;
1187
+ var getPrototypeOf$2 = objectGetPrototypeOf;
1188
+ var defineBuiltIn$7 = defineBuiltIn$9;
1189
+ var wellKnownSymbol$c = wellKnownSymbol$e;
1190
+
1191
+ var ITERATOR$7 = wellKnownSymbol$c('iterator');
1192
+ var BUGGY_SAFARI_ITERATORS$1 = false;
1193
+
1194
+ // `%IteratorPrototype%` object
1195
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1196
+ var IteratorPrototype$4, PrototypeOfArrayIteratorPrototype, arrayIterator;
1197
+
1198
+ /* eslint-disable es/no-array-prototype-keys -- safe */
1199
+ if ([].keys) {
1200
+ arrayIterator = [].keys();
1201
+ // Safari 8 has buggy iterators w/o `next`
1202
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1203
+ else {
1204
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$2(getPrototypeOf$2(arrayIterator));
1205
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$4 = PrototypeOfArrayIteratorPrototype;
1206
+ }
1207
+ }
1208
+
1209
+ var NEW_ITERATOR_PROTOTYPE = !isObject$3(IteratorPrototype$4) || fails$6(function () {
1210
+ var test = {};
1211
+ // FF44- legacy iterators case
1212
+ return IteratorPrototype$4[ITERATOR$7].call(test) !== test;
1213
+ });
1214
+
1215
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$4 = {};
1216
+
1217
+ // `%IteratorPrototype%[@@iterator]()` method
1218
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1219
+ if (!isCallable$7(IteratorPrototype$4[ITERATOR$7])) {
1220
+ defineBuiltIn$7(IteratorPrototype$4, ITERATOR$7, function () {
1221
+ return this;
1222
+ });
1223
+ }
1224
+
1225
+ var iteratorsCore = {
1226
+ IteratorPrototype: IteratorPrototype$4,
1227
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1228
+ };
1229
+
1230
+ var $$7 = _export;
1231
+ var global$5 = global$f;
1232
+ var anInstance$2 = anInstance$3;
1233
+ var anObject$7 = anObject$c;
1234
+ var isCallable$6 = isCallable$j;
1235
+ var getPrototypeOf$1 = objectGetPrototypeOf;
1236
+ var defineBuiltInAccessor$3 = defineBuiltInAccessor$4;
1237
+ var createProperty$1 = createProperty$2;
1238
+ var fails$5 = fails$g;
1239
+ var hasOwn$4 = hasOwnProperty_1;
1240
+ var wellKnownSymbol$b = wellKnownSymbol$e;
1241
+ var IteratorPrototype$3 = iteratorsCore.IteratorPrototype;
1242
+ var DESCRIPTORS$7 = descriptors;
1243
+
1244
+ var CONSTRUCTOR = 'constructor';
1245
+ var ITERATOR$6 = 'Iterator';
1246
+ var TO_STRING_TAG$4 = wellKnownSymbol$b('toStringTag');
1247
+
1248
+ var $TypeError$3 = TypeError;
1249
+ var NativeIterator = global$5[ITERATOR$6];
1250
+
1251
+ // FF56- have non-standard global helper `Iterator`
1252
+ var FORCED = !isCallable$6(NativeIterator)
1253
+ || NativeIterator.prototype !== IteratorPrototype$3
1254
+ // FF44- non-standard `Iterator` passes previous tests
1255
+ || !fails$5(function () { NativeIterator({}); });
1256
+
1257
+ var IteratorConstructor = function Iterator() {
1258
+ anInstance$2(this, IteratorPrototype$3);
1259
+ if (getPrototypeOf$1(this) === IteratorPrototype$3) throw new $TypeError$3('Abstract class Iterator not directly constructable');
1260
+ };
1261
+
1262
+ var defineIteratorPrototypeAccessor = function (key, value) {
1263
+ if (DESCRIPTORS$7) {
1264
+ defineBuiltInAccessor$3(IteratorPrototype$3, key, {
1265
+ configurable: true,
1266
+ get: function () {
1267
+ return value;
1268
+ },
1269
+ set: function (replacement) {
1270
+ anObject$7(this);
1271
+ if (this === IteratorPrototype$3) throw new $TypeError$3("You can't redefine this property");
1272
+ if (hasOwn$4(this, key)) this[key] = replacement;
1273
+ else createProperty$1(this, key, replacement);
1274
+ }
1275
+ });
1276
+ } else IteratorPrototype$3[key] = value;
1277
+ };
1278
+
1279
+ if (!hasOwn$4(IteratorPrototype$3, TO_STRING_TAG$4)) defineIteratorPrototypeAccessor(TO_STRING_TAG$4, ITERATOR$6);
1280
+
1281
+ if (FORCED || !hasOwn$4(IteratorPrototype$3, CONSTRUCTOR) || IteratorPrototype$3[CONSTRUCTOR] === Object) {
1282
+ defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);
1283
+ }
1284
+
1285
+ IteratorConstructor.prototype = IteratorPrototype$3;
1286
+
1287
+ // `Iterator` constructor
1288
+ // https://github.com/tc39/proposal-iterator-helpers
1289
+ $$7({ global: true, constructor: true, forced: FORCED }, {
1290
+ Iterator: IteratorConstructor
1291
+ });
1292
+
1293
+ // `GetIteratorDirect(obj)` abstract operation
1294
+ // https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect
1295
+ var getIteratorDirect$1 = function (obj) {
1296
+ return {
1297
+ iterator: obj,
1298
+ next: obj.next,
1299
+ done: false
1300
+ };
1301
+ };
1302
+
1303
+ var defineBuiltIn$6 = defineBuiltIn$9;
1304
+
1305
+ var defineBuiltIns$2 = function (target, src, options) {
1306
+ for (var key in src) defineBuiltIn$6(target, key, src[key], options);
1307
+ return target;
1308
+ };
1309
+
1310
+ // `CreateIterResultObject` abstract operation
1311
+ // https://tc39.es/ecma262/#sec-createiterresultobject
1312
+ var createIterResultObject$4 = function (value, done) {
1313
+ return { value: value, done: done };
1314
+ };
1315
+
1316
+ var call$b = functionCall;
1317
+ var anObject$6 = anObject$c;
1318
+ var getMethod$2 = getMethod$4;
1319
+
1320
+ var iteratorClose$2 = function (iterator, kind, value) {
1321
+ var innerResult, innerError;
1322
+ anObject$6(iterator);
1323
+ try {
1324
+ innerResult = getMethod$2(iterator, 'return');
1325
+ if (!innerResult) {
1326
+ if (kind === 'throw') throw value;
1327
+ return value;
1328
+ }
1329
+ innerResult = call$b(innerResult, iterator);
1330
+ } catch (error) {
1331
+ innerError = true;
1332
+ innerResult = error;
1333
+ }
1334
+ if (kind === 'throw') throw value;
1335
+ if (innerError) throw innerResult;
1336
+ anObject$6(innerResult);
1337
+ return value;
1338
+ };
1339
+
1340
+ var call$a = functionCall;
1341
+ var create$3 = objectCreate;
1342
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
1343
+ var defineBuiltIns$1 = defineBuiltIns$2;
1344
+ var wellKnownSymbol$a = wellKnownSymbol$e;
1345
+ var InternalStateModule$4 = internalState;
1346
+ var getMethod$1 = getMethod$4;
1347
+ var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
1348
+ var createIterResultObject$3 = createIterResultObject$4;
1349
+ var iteratorClose$1 = iteratorClose$2;
1350
+
1351
+ var TO_STRING_TAG$3 = wellKnownSymbol$a('toStringTag');
1352
+ var ITERATOR_HELPER = 'IteratorHelper';
1353
+ var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator';
1354
+ var setInternalState$4 = InternalStateModule$4.set;
1355
+
1356
+ var createIteratorProxyPrototype = function (IS_ITERATOR) {
1357
+ var getInternalState = InternalStateModule$4.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);
1358
+
1359
+ return defineBuiltIns$1(create$3(IteratorPrototype$2), {
1360
+ next: function next() {
1361
+ var state = getInternalState(this);
1362
+ // for simplification:
1363
+ // for `%WrapForValidIteratorPrototype%.next` our `nextHandler` returns `IterResultObject`
1364
+ // for `%IteratorHelperPrototype%.next` - just a value
1365
+ if (IS_ITERATOR) return state.nextHandler();
1366
+ try {
1367
+ var result = state.done ? undefined : state.nextHandler();
1368
+ return createIterResultObject$3(result, state.done);
1369
+ } catch (error) {
1370
+ state.done = true;
1371
+ throw error;
1372
+ }
1373
+ },
1374
+ 'return': function () {
1375
+ var state = getInternalState(this);
1376
+ var iterator = state.iterator;
1377
+ state.done = true;
1378
+ if (IS_ITERATOR) {
1379
+ var returnMethod = getMethod$1(iterator, 'return');
1380
+ return returnMethod ? call$a(returnMethod, iterator) : createIterResultObject$3(undefined, true);
1381
+ }
1382
+ if (state.inner) try {
1383
+ iteratorClose$1(state.inner.iterator, 'normal');
1384
+ } catch (error) {
1385
+ return iteratorClose$1(iterator, 'throw', error);
1386
+ }
1387
+ iteratorClose$1(iterator, 'normal');
1388
+ return createIterResultObject$3(undefined, true);
1389
+ }
1390
+ });
1391
+ };
1392
+
1393
+ var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);
1394
+ var IteratorHelperPrototype = createIteratorProxyPrototype(false);
1395
+
1396
+ createNonEnumerableProperty$2(IteratorHelperPrototype, TO_STRING_TAG$3, 'Iterator Helper');
1397
+
1398
+ var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) {
1399
+ var IteratorProxy = function Iterator(record, state) {
1400
+ if (state) {
1401
+ state.iterator = record.iterator;
1402
+ state.next = record.next;
1403
+ } else state = record;
1404
+ state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;
1405
+ state.nextHandler = nextHandler;
1406
+ state.counter = 0;
1407
+ state.done = false;
1408
+ setInternalState$4(this, state);
1409
+ };
1410
+
1411
+ IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;
1412
+
1413
+ return IteratorProxy;
1414
+ };
1415
+
1416
+ var anObject$5 = anObject$c;
1417
+ var iteratorClose = iteratorClose$2;
1418
+
1419
+ // call something on iterator step with safe closing on error
1420
+ var callWithSafeIterationClosing$2 = function (iterator, fn, value, ENTRIES) {
1421
+ try {
1422
+ return ENTRIES ? fn(anObject$5(value)[0], value[1]) : fn(value);
1423
+ } catch (error) {
1424
+ iteratorClose(iterator, 'throw', error);
1425
+ }
1426
+ };
1427
+
1428
+ var call$9 = functionCall;
1429
+ var aCallable$3 = aCallable$5;
1430
+ var anObject$4 = anObject$c;
1431
+ var getIteratorDirect = getIteratorDirect$1;
1432
+ var createIteratorProxy = iteratorCreateProxy;
1433
+ var callWithSafeIterationClosing$1 = callWithSafeIterationClosing$2;
1434
+
1435
+ var IteratorProxy = createIteratorProxy(function () {
1436
+ var iterator = this.iterator;
1437
+ var result = anObject$4(call$9(this.next, iterator));
1438
+ var done = this.done = !!result.done;
1439
+ if (!done) return callWithSafeIterationClosing$1(iterator, this.mapper, [result.value, this.counter++], true);
1440
+ });
1441
+
1442
+ // `Iterator.prototype.map` method
1443
+ // https://github.com/tc39/proposal-iterator-helpers
1444
+ var iteratorMap = function map(mapper) {
1445
+ anObject$4(this);
1446
+ aCallable$3(mapper);
1447
+ return new IteratorProxy(getIteratorDirect(this), {
1448
+ mapper: mapper
1449
+ });
1450
+ };
1451
+
1452
+ var $$6 = _export;
1453
+ var map = iteratorMap;
1454
+ var IS_PURE$1 = isPure;
1455
+
1456
+ // `Iterator.prototype.map` method
1457
+ // https://github.com/tc39/proposal-iterator-helpers
1458
+ $$6({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
1459
+ map: map
1460
+ });
1461
+
1462
+ var wellKnownSymbol$9 = wellKnownSymbol$e;
1463
+ var create$2 = objectCreate;
1464
+ var defineProperty$3 = objectDefineProperty.f;
1465
+
1466
+ var UNSCOPABLES = wellKnownSymbol$9('unscopables');
1467
+ var ArrayPrototype$1 = Array.prototype;
1468
+
1469
+ // Array.prototype[@@unscopables]
1470
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1471
+ if (ArrayPrototype$1[UNSCOPABLES] === undefined) {
1472
+ defineProperty$3(ArrayPrototype$1, UNSCOPABLES, {
1473
+ configurable: true,
1474
+ value: create$2(null)
1475
+ });
1476
+ }
1477
+
1478
+ // add a key to Array.prototype[@@unscopables]
1479
+ var addToUnscopables$1 = function (key) {
1480
+ ArrayPrototype$1[UNSCOPABLES][key] = true;
1481
+ };
1482
+
1483
+ var iterators = {};
1484
+
1485
+ var defineProperty$2 = objectDefineProperty.f;
1486
+ var hasOwn$3 = hasOwnProperty_1;
1487
+ var wellKnownSymbol$8 = wellKnownSymbol$e;
1488
+
1489
+ var TO_STRING_TAG$2 = wellKnownSymbol$8('toStringTag');
1490
+
1491
+ var setToStringTag$5 = function (target, TAG, STATIC) {
1492
+ if (target && !STATIC) target = target.prototype;
1493
+ if (target && !hasOwn$3(target, TO_STRING_TAG$2)) {
1494
+ defineProperty$2(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
1495
+ }
1496
+ };
1497
+
1498
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1499
+ var create$1 = objectCreate;
1500
+ var createPropertyDescriptor$1 = createPropertyDescriptor$5;
1501
+ var setToStringTag$4 = setToStringTag$5;
1502
+ var Iterators$4 = iterators;
1503
+
1504
+ var returnThis$1 = function () { return this; };
1505
+
1506
+ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1507
+ var TO_STRING_TAG = NAME + ' Iterator';
1508
+ IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor$1(+!ENUMERABLE_NEXT, next) });
1509
+ setToStringTag$4(IteratorConstructor, TO_STRING_TAG, false);
1510
+ Iterators$4[TO_STRING_TAG] = returnThis$1;
1511
+ return IteratorConstructor;
1512
+ };
1513
+
1514
+ var uncurryThis$e = functionUncurryThis;
1515
+ var aCallable$2 = aCallable$5;
1516
+
1517
+ var functionUncurryThisAccessor = function (object, key, method) {
1518
+ try {
1519
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1520
+ return uncurryThis$e(aCallable$2(Object.getOwnPropertyDescriptor(object, key)[method]));
1521
+ } catch (error) { /* empty */ }
1522
+ };
1523
+
1524
+ var isObject$2 = isObject$9;
1525
+
1526
+ var isPossiblePrototype$1 = function (argument) {
1527
+ return isObject$2(argument) || argument === null;
1528
+ };
1529
+
1530
+ var isPossiblePrototype = isPossiblePrototype$1;
1531
+
1532
+ var $String$2 = String;
1533
+ var $TypeError$2 = TypeError;
1534
+
1535
+ var aPossiblePrototype$1 = function (argument) {
1536
+ if (isPossiblePrototype(argument)) return argument;
1537
+ throw new $TypeError$2("Can't set " + $String$2(argument) + ' as a prototype');
1538
+ };
1539
+
1540
+ /* eslint-disable no-proto -- safe */
1541
+ var uncurryThisAccessor = functionUncurryThisAccessor;
1542
+ var isObject$1 = isObject$9;
1543
+ var requireObjectCoercible$1 = requireObjectCoercible$4;
1544
+ var aPossiblePrototype = aPossiblePrototype$1;
1545
+
1546
+ // `Object.setPrototypeOf` method
1547
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
1548
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
1549
+ // eslint-disable-next-line es/no-object-setprototypeof -- safe
1550
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1551
+ var CORRECT_SETTER = false;
1552
+ var test = {};
1553
+ var setter;
1554
+ try {
1555
+ setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
1556
+ setter(test, []);
1557
+ CORRECT_SETTER = test instanceof Array;
1558
+ } catch (error) { /* empty */ }
1559
+ return function setPrototypeOf(O, proto) {
1560
+ requireObjectCoercible$1(O);
1561
+ aPossiblePrototype(proto);
1562
+ if (!isObject$1(O)) return O;
1563
+ if (CORRECT_SETTER) setter(O, proto);
1564
+ else O.__proto__ = proto;
1565
+ return O;
1566
+ };
1567
+ }() : undefined);
1568
+
1569
+ var $$5 = _export;
1570
+ var call$8 = functionCall;
1571
+ var FunctionName = functionName;
1572
+ var isCallable$5 = isCallable$j;
1573
+ var createIteratorConstructor$1 = iteratorCreateConstructor;
1574
+ var getPrototypeOf = objectGetPrototypeOf;
1575
+ var setPrototypeOf = objectSetPrototypeOf;
1576
+ var setToStringTag$3 = setToStringTag$5;
1577
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
1578
+ var defineBuiltIn$5 = defineBuiltIn$9;
1579
+ var wellKnownSymbol$7 = wellKnownSymbol$e;
1580
+ var Iterators$3 = iterators;
1581
+ var IteratorsCore = iteratorsCore;
1582
+
1583
+ var PROPER_FUNCTION_NAME$1 = FunctionName.PROPER;
1584
+ var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1585
+ var IteratorPrototype = IteratorsCore.IteratorPrototype;
1586
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1587
+ var ITERATOR$5 = wellKnownSymbol$7('iterator');
1588
+ var KEYS = 'keys';
1589
+ var VALUES = 'values';
1590
+ var ENTRIES = 'entries';
1591
+
1592
+ var returnThis = function () { return this; };
1593
+
1594
+ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1595
+ createIteratorConstructor$1(IteratorConstructor, NAME, next);
1596
+
1597
+ var getIterationMethod = function (KIND) {
1598
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1599
+ if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
1600
+
1601
+ switch (KIND) {
1602
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1603
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1604
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
38
1605
  }
39
- initEditor({
40
- pathname
41
- });
42
- updateNavigation(pathname || '/');
43
- setState(prevState => Object.assign({}, prevState, {
44
- isInsideEditor: true
45
- }));
46
- return () => destroyEditor();
47
- }, [pathname]);
48
- /**
49
- * Reloads the page when changes are made in the editor.
50
- */
51
- useEffect(() => {
52
- const insideEditor = isInsideEditor();
53
- if (!insideEditor || !onReload) {
54
- return;
1606
+
1607
+ return function () { return new IteratorConstructor(this); };
1608
+ };
1609
+
1610
+ var TO_STRING_TAG = NAME + ' Iterator';
1611
+ var INCORRECT_VALUES_NAME = false;
1612
+ var IterablePrototype = Iterable.prototype;
1613
+ var nativeIterator = IterablePrototype[ITERATOR$5]
1614
+ || IterablePrototype['@@iterator']
1615
+ || DEFAULT && IterablePrototype[DEFAULT];
1616
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
1617
+ var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1618
+ var CurrentIteratorPrototype, methods, KEY;
1619
+
1620
+ // fix native
1621
+ if (anyNativeIterator) {
1622
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
1623
+ if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1624
+ if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1625
+ if (setPrototypeOf) {
1626
+ setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
1627
+ } else if (!isCallable$5(CurrentIteratorPrototype[ITERATOR$5])) {
1628
+ defineBuiltIn$5(CurrentIteratorPrototype, ITERATOR$5, returnThis);
1629
+ }
1630
+ }
1631
+ // Set @@toStringTag to native iterators
1632
+ setToStringTag$3(CurrentIteratorPrototype, TO_STRING_TAG, true);
55
1633
  }
56
- const {
57
- unsubscribe
58
- } = createUVESubscription('changes', () => onReload());
59
- return () => unsubscribe();
60
- }, [onReload]);
61
- /**
62
- * Sends a message to the editor when the client is ready.
63
- */
64
- useEffect(() => {
65
- if (!isInsideEditor()) {
66
- return;
1634
+ }
1635
+
1636
+ // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1637
+ if (PROPER_FUNCTION_NAME$1 && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1638
+ if (CONFIGURABLE_FUNCTION_NAME) {
1639
+ createNonEnumerableProperty$1(IterablePrototype, 'name', VALUES);
1640
+ } else {
1641
+ INCORRECT_VALUES_NAME = true;
1642
+ defaultIterator = function values() { return call$8(nativeIterator, this); };
67
1643
  }
68
- postMessageToEditor({
69
- action: CLIENT_ACTIONS.CLIENT_READY,
70
- payload: editor
71
- });
72
- }, [pathname, editor]);
73
- /**
74
- * Old
75
- */
76
- useEffect(() => {
77
- if (!isInsideEditor()) {
78
- return;
1644
+ }
1645
+
1646
+ // export additional methods
1647
+ if (DEFAULT) {
1648
+ methods = {
1649
+ values: getIterationMethod(VALUES),
1650
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1651
+ entries: getIterationMethod(ENTRIES)
1652
+ };
1653
+ if (FORCED) for (KEY in methods) {
1654
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1655
+ defineBuiltIn$5(IterablePrototype, KEY, methods[KEY]);
1656
+ }
1657
+ } else $$5({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1658
+ }
1659
+
1660
+ // define iterator
1661
+ if (IterablePrototype[ITERATOR$5] !== defaultIterator) {
1662
+ defineBuiltIn$5(IterablePrototype, ITERATOR$5, defaultIterator, { name: DEFAULT });
1663
+ }
1664
+ Iterators$3[NAME] = defaultIterator;
1665
+
1666
+ return methods;
1667
+ };
1668
+
1669
+ var toIndexedObject = toIndexedObject$5;
1670
+ var addToUnscopables = addToUnscopables$1;
1671
+ var Iterators$2 = iterators;
1672
+ var InternalStateModule$3 = internalState;
1673
+ var defineProperty$1 = objectDefineProperty.f;
1674
+ var defineIterator$1 = iteratorDefine;
1675
+ var createIterResultObject$2 = createIterResultObject$4;
1676
+ var DESCRIPTORS$6 = descriptors;
1677
+
1678
+ var ARRAY_ITERATOR = 'Array Iterator';
1679
+ var setInternalState$3 = InternalStateModule$3.set;
1680
+ var getInternalState$1 = InternalStateModule$3.getterFor(ARRAY_ITERATOR);
1681
+
1682
+ // `Array.prototype.entries` method
1683
+ // https://tc39.es/ecma262/#sec-array.prototype.entries
1684
+ // `Array.prototype.keys` method
1685
+ // https://tc39.es/ecma262/#sec-array.prototype.keys
1686
+ // `Array.prototype.values` method
1687
+ // https://tc39.es/ecma262/#sec-array.prototype.values
1688
+ // `Array.prototype[@@iterator]` method
1689
+ // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1690
+ // `CreateArrayIterator` internal method
1691
+ // https://tc39.es/ecma262/#sec-createarrayiterator
1692
+ var es_array_iterator = defineIterator$1(Array, 'Array', function (iterated, kind) {
1693
+ setInternalState$3(this, {
1694
+ type: ARRAY_ITERATOR,
1695
+ target: toIndexedObject(iterated), // target
1696
+ index: 0, // next index
1697
+ kind: kind // kind
1698
+ });
1699
+ // `%ArrayIteratorPrototype%.next` method
1700
+ // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1701
+ }, function () {
1702
+ var state = getInternalState$1(this);
1703
+ var target = state.target;
1704
+ var index = state.index++;
1705
+ if (!target || index >= target.length) {
1706
+ state.target = undefined;
1707
+ return createIterResultObject$2(undefined, true);
1708
+ }
1709
+ switch (state.kind) {
1710
+ case 'keys': return createIterResultObject$2(index, false);
1711
+ case 'values': return createIterResultObject$2(target[index], false);
1712
+ } return createIterResultObject$2([index, target[index]], false);
1713
+ }, 'values');
1714
+
1715
+ // argumentsList[@@iterator] is %ArrayProto_values%
1716
+ // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1717
+ // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1718
+ var values = Iterators$2.Arguments = Iterators$2.Array;
1719
+
1720
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1721
+ addToUnscopables('keys');
1722
+ addToUnscopables('values');
1723
+ addToUnscopables('entries');
1724
+
1725
+ // V8 ~ Chrome 45- bug
1726
+ if (DESCRIPTORS$6 && values.name !== 'values') try {
1727
+ defineProperty$1(values, 'name', { value: 'values' });
1728
+ } catch (error) { /* empty */ }
1729
+
1730
+ // iterable DOM collections
1731
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1732
+ var domIterables = {
1733
+ CSSRuleList: 0,
1734
+ CSSStyleDeclaration: 0,
1735
+ CSSValueList: 0,
1736
+ ClientRectList: 0,
1737
+ DOMRectList: 0,
1738
+ DOMStringList: 0,
1739
+ DOMTokenList: 1,
1740
+ DataTransferItemList: 0,
1741
+ FileList: 0,
1742
+ HTMLAllCollection: 0,
1743
+ HTMLCollection: 0,
1744
+ HTMLFormElement: 0,
1745
+ HTMLSelectElement: 0,
1746
+ MediaList: 0,
1747
+ MimeTypeArray: 0,
1748
+ NamedNodeMap: 0,
1749
+ NodeList: 1,
1750
+ PaintRequestList: 0,
1751
+ Plugin: 0,
1752
+ PluginArray: 0,
1753
+ SVGLengthList: 0,
1754
+ SVGNumberList: 0,
1755
+ SVGPathSegList: 0,
1756
+ SVGPointList: 0,
1757
+ SVGStringList: 0,
1758
+ SVGTransformList: 0,
1759
+ SourceBufferList: 0,
1760
+ StyleSheetList: 0,
1761
+ TextTrackCueList: 0,
1762
+ TextTrackList: 0,
1763
+ TouchList: 0
1764
+ };
1765
+
1766
+ // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
1767
+ var documentCreateElement = documentCreateElement$2;
1768
+
1769
+ var classList = documentCreateElement('span').classList;
1770
+ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
1771
+
1772
+ var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
1773
+
1774
+ var global$4 = global$f;
1775
+ var DOMIterables = domIterables;
1776
+ var DOMTokenListPrototype = domTokenListPrototype;
1777
+ var ArrayIteratorMethods = es_array_iterator;
1778
+ var createNonEnumerableProperty = createNonEnumerableProperty$5;
1779
+ var setToStringTag$2 = setToStringTag$5;
1780
+ var wellKnownSymbol$6 = wellKnownSymbol$e;
1781
+
1782
+ var ITERATOR$4 = wellKnownSymbol$6('iterator');
1783
+ var ArrayValues = ArrayIteratorMethods.values;
1784
+
1785
+ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1786
+ if (CollectionPrototype) {
1787
+ // some Chrome versions have non-configurable methods on DOMTokenList
1788
+ if (CollectionPrototype[ITERATOR$4] !== ArrayValues) try {
1789
+ createNonEnumerableProperty(CollectionPrototype, ITERATOR$4, ArrayValues);
1790
+ } catch (error) {
1791
+ CollectionPrototype[ITERATOR$4] = ArrayValues;
79
1792
  }
80
- const {
81
- unsubscribe
82
- } = createUVESubscription('changes', data => {
83
- const pageAsset = data;
84
- setState(state => Object.assign({}, state, {
85
- pageAsset
86
- }));
87
- });
88
- return () => unsubscribe();
89
- }, []);
90
- return state;
1793
+ setToStringTag$2(CollectionPrototype, COLLECTION_NAME, true);
1794
+ if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
1795
+ // some Chrome versions have non-configurable methods on DOMTokenList
1796
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
1797
+ createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
1798
+ } catch (error) {
1799
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
1800
+ }
1801
+ }
1802
+ }
91
1803
  };
92
1804
 
1805
+ for (var COLLECTION_NAME in DOMIterables) {
1806
+ handlePrototype(global$4[COLLECTION_NAME] && global$4[COLLECTION_NAME].prototype, COLLECTION_NAME);
1807
+ }
1808
+
1809
+ handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1810
+
93
1811
  /**
94
1812
  * The `PageContext` is a React context that provides access to the DotCMS page context.
95
1813
  *
96
1814
  * @category Contexts
97
1815
  */
98
- const PageContext = /*#__PURE__*/createContext(null);
1816
+ const DotCMSPageContext = /*#__PURE__*/createContext({
1817
+ pageAsset: {},
1818
+ mode: 'production',
1819
+ userComponents: {}
1820
+ });
99
1821
 
100
1822
  /**
101
- * `PageProvider` is a functional component that provides a context for a DotCMS page.
102
- * It takes a `PageProviderProps` object as a parameter and returns a JSX element.
1823
+ * @internal
1824
+ * A React hook that determines if the current environment is in development mode.
103
1825
  *
104
- * @category Components
105
- * @param {PageProviderProps} props - The properties for the PageProvider. Includes an `entity` and `children`.
106
- * @returns {JSX.Element} - A JSX element that provides a context for a DotCMS page.
1826
+ * The hook returns `true` if either:
1827
+ * - The application is running inside the DotCMS editor (as determined by `getUVEState()`).
1828
+ *
1829
+ * @returns {boolean} - `true` if in development mode or inside the editor; otherwise, `false`.
107
1830
  */
108
- function PageProvider(props) {
1831
+ const useIsDevMode = () => {
109
1832
  const {
110
- pageContext,
111
- children
112
- } = props;
113
- return jsx(PageContext.Provider, {
114
- value: pageContext,
115
- children: children
1833
+ mode
1834
+ } = useContext(DotCMSPageContext);
1835
+ const [isDevMode, setIsDevMode] = useState(mode === 'development');
1836
+ useEffect(() => {
1837
+ var _getUVEState;
1838
+ // Inside UVE we rely on the UVE state to determine if we are in development mode
1839
+ if ((_getUVEState = getUVEState()) != null && _getUVEState.mode) {
1840
+ var _getUVEState2;
1841
+ const isUVEInEditor = ((_getUVEState2 = getUVEState()) == null ? void 0 : _getUVEState2.mode) === UVE_MODE.EDIT;
1842
+ setIsDevMode(isUVEInEditor);
1843
+ return;
1844
+ }
1845
+ setIsDevMode(mode === DEVELOPMENT_MODE);
1846
+ }, [mode]);
1847
+ return isDevMode;
1848
+ };
1849
+
1850
+ /**
1851
+ * Error message component for when the page body is missing
1852
+ *
1853
+ * @return {JSX.Element} Error message component
1854
+ */
1855
+ const ErrorMessage = () => {
1856
+ const isDevMode = useIsDevMode();
1857
+ useEffect(() => {
1858
+ console.warn('Missing required layout.body property in page');
1859
+ }, []);
1860
+ return isDevMode && jsxs("div", {
1861
+ "data-testid": "error-message",
1862
+ style: {
1863
+ padding: '1rem',
1864
+ border: '1px solid #e0e0e0',
1865
+ borderRadius: '4px'
1866
+ },
1867
+ children: [jsxs("p", {
1868
+ style: {
1869
+ margin: '0 0 0.5rem',
1870
+ color: '#666'
1871
+ },
1872
+ children: ["The ", jsx("code", {
1873
+ children: "page"
1874
+ }), " is missing the required ", jsx("code", {
1875
+ children: "layout.body"
1876
+ }), " property."]
1877
+ }), jsx("p", {
1878
+ style: {
1879
+ margin: 0,
1880
+ color: '#666'
1881
+ },
1882
+ children: "Make sure the page asset is properly loaded and includes a layout configuration."
1883
+ })]
116
1884
  });
1885
+ };
1886
+
1887
+ function styleInject(css, ref) {
1888
+ if ( ref === void 0 ) ref = {};
1889
+ var insertAt = ref.insertAt;
1890
+
1891
+ if (!css || typeof document === 'undefined') { return; }
1892
+
1893
+ var head = document.head || document.getElementsByTagName('head')[0];
1894
+ var style = document.createElement('style');
1895
+ style.type = 'text/css';
1896
+
1897
+ if (insertAt === 'top') {
1898
+ if (head.firstChild) {
1899
+ head.insertBefore(style, head.firstChild);
1900
+ } else {
1901
+ head.appendChild(style);
1902
+ }
1903
+ } else {
1904
+ head.appendChild(style);
1905
+ }
1906
+
1907
+ if (style.styleSheet) {
1908
+ style.styleSheet.cssText = css;
1909
+ } else {
1910
+ style.appendChild(document.createTextNode(css));
1911
+ }
117
1912
  }
118
1913
 
119
- var css_248z$1 = ".Row-module_row__1QEdR {\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n gap: 1rem;\n}\n";
120
- var styles$1 = {"row":"Row-module_row__1QEdR"};
1914
+ var css_248z$1 = ".Row-module_row__PS0UP {\n display: grid;\n grid-template-columns: repeat(12, 1fr);\n gap: 1rem;\n}\n";
1915
+ var styles$1 = {"row":"Row-module_row__PS0UP"};
121
1916
  styleInject(css_248z$1);
122
1917
 
123
- var css_248z = ".Column-module_col-start-1__pAqyF {\n grid-column-start: 1;\n}\n\n.Column-module_col-start-2__WwVhl {\n grid-column-start: 2;\n}\n\n.Column-module_col-start-3__DAtqM {\n grid-column-start: 3;\n}\n\n.Column-module_col-start-4__KAXJl {\n grid-column-start: 4;\n}\n\n.Column-module_col-start-5__9yg8H {\n grid-column-start: 5;\n}\n\n.Column-module_col-start-6__L9Fl1 {\n grid-column-start: 6;\n}\n\n.Column-module_col-start-7__7GWMg {\n grid-column-start: 7;\n}\n\n.Column-module_col-start-8__VPNje {\n grid-column-start: 8;\n}\n\n.Column-module_col-start-9__TQinR {\n grid-column-start: 9;\n}\n\n.Column-module_col-start-10__WuD2n {\n grid-column-start: 10;\n}\n\n.Column-module_col-start-11__ZYzHu {\n grid-column-start: 11;\n}\n\n.Column-module_col-start-12__XupQX {\n grid-column-start: 12;\n}\n\n.Column-module_col-end-1__thNVg {\n grid-column-end: 1;\n}\n\n.Column-module_col-end-2__7vCsE {\n grid-column-end: 2;\n}\n\n.Column-module_col-end-3__TiQJe {\n grid-column-end: 3;\n}\n\n.Column-module_col-end-4__66z6K {\n grid-column-end: 4;\n}\n\n.Column-module_col-end-5__MLwPh {\n grid-column-end: 5;\n}\n\n.Column-module_col-end-6__dz6-q {\n grid-column-end: 6;\n}\n\n.Column-module_col-end-7__Loe0Q {\n grid-column-end: 7;\n}\n\n.Column-module_col-end-8__NePGi {\n grid-column-end: 8;\n}\n\n.Column-module_col-end-9__V0-is {\n grid-column-end: 9;\n}\n\n.Column-module_col-end-10__b-1ia {\n grid-column-end: 10;\n}\n\n.Column-module_col-end-11__QroWM {\n grid-column-end: 11;\n}\n\n.Column-module_col-end-12__j-YYw {\n grid-column-end: 12;\n}\n\n.Column-module_col-end-13__khBAA {\n grid-column-end: 13;\n}\n";
124
- var styles = {"col-start-1":"Column-module_col-start-1__pAqyF","col-start-2":"Column-module_col-start-2__WwVhl","col-start-3":"Column-module_col-start-3__DAtqM","col-start-4":"Column-module_col-start-4__KAXJl","col-start-5":"Column-module_col-start-5__9yg8H","col-start-6":"Column-module_col-start-6__L9Fl1","col-start-7":"Column-module_col-start-7__7GWMg","col-start-8":"Column-module_col-start-8__VPNje","col-start-9":"Column-module_col-start-9__TQinR","col-start-10":"Column-module_col-start-10__WuD2n","col-start-11":"Column-module_col-start-11__ZYzHu","col-start-12":"Column-module_col-start-12__XupQX","col-end-1":"Column-module_col-end-1__thNVg","col-end-2":"Column-module_col-end-2__7vCsE","col-end-3":"Column-module_col-end-3__TiQJe","col-end-4":"Column-module_col-end-4__66z6K","col-end-5":"Column-module_col-end-5__MLwPh","col-end-6":"Column-module_col-end-6__dz6-q","col-end-7":"Column-module_col-end-7__Loe0Q","col-end-8":"Column-module_col-end-8__NePGi","col-end-9":"Column-module_col-end-9__V0-is","col-end-10":"Column-module_col-end-10__b-1ia","col-end-11":"Column-module_col-end-11__QroWM","col-end-12":"Column-module_col-end-12__j-YYw","col-end-13":"Column-module_col-end-13__khBAA"};
1918
+ var css_248z = ".Column-module_col-start-1__xylw6 {\n grid-column-start: 1;\n}\n\n.Column-module_col-start-2__Mod81 {\n grid-column-start: 2;\n}\n\n.Column-module_col-start-3__HHbXB {\n grid-column-start: 3;\n}\n\n.Column-module_col-start-4__Uk-Qj {\n grid-column-start: 4;\n}\n\n.Column-module_col-start-5__jlV8e {\n grid-column-start: 5;\n}\n\n.Column-module_col-start-6__oi8k0 {\n grid-column-start: 6;\n}\n\n.Column-module_col-start-7__EmPky {\n grid-column-start: 7;\n}\n\n.Column-module_col-start-8__hLI1h {\n grid-column-start: 8;\n}\n\n.Column-module_col-start-9__Kcv9X {\n grid-column-start: 9;\n}\n\n.Column-module_col-start-10__-MOrt {\n grid-column-start: 10;\n}\n\n.Column-module_col-start-11__gDEQM {\n grid-column-start: 11;\n}\n\n.Column-module_col-start-12__omVX6 {\n grid-column-start: 12;\n}\n\n.Column-module_col-end-1__Ho2y9 {\n grid-column-end: 1;\n}\n\n.Column-module_col-end-2__KwFu9 {\n grid-column-end: 2;\n}\n\n.Column-module_col-end-3__vfbJk {\n grid-column-end: 3;\n}\n\n.Column-module_col-end-4__d4pyL {\n grid-column-end: 4;\n}\n\n.Column-module_col-end-5__6yPd4 {\n grid-column-end: 5;\n}\n\n.Column-module_col-end-6__xQpAX {\n grid-column-end: 6;\n}\n\n.Column-module_col-end-7__CCF7e {\n grid-column-end: 7;\n}\n\n.Column-module_col-end-8__fVWEi {\n grid-column-end: 8;\n}\n\n.Column-module_col-end-9__tpIGv {\n grid-column-end: 9;\n}\n\n.Column-module_col-end-10__SX75K {\n grid-column-end: 10;\n}\n\n.Column-module_col-end-11__9K1zv {\n grid-column-end: 11;\n}\n\n.Column-module_col-end-12__oqTiE {\n grid-column-end: 12;\n}\n\n.Column-module_col-end-13__L-nK9 {\n grid-column-end: 13;\n}\n";
1919
+ var styles = {"col-start-1":"Column-module_col-start-1__xylw6","col-start-2":"Column-module_col-start-2__Mod81","col-start-3":"Column-module_col-start-3__HHbXB","col-start-4":"Column-module_col-start-4__Uk-Qj","col-start-5":"Column-module_col-start-5__jlV8e","col-start-6":"Column-module_col-start-6__oi8k0","col-start-7":"Column-module_col-start-7__EmPky","col-start-8":"Column-module_col-start-8__hLI1h","col-start-9":"Column-module_col-start-9__Kcv9X","col-start-10":"Column-module_col-start-10__-MOrt","col-start-11":"Column-module_col-start-11__gDEQM","col-start-12":"Column-module_col-start-12__omVX6","col-end-1":"Column-module_col-end-1__Ho2y9","col-end-2":"Column-module_col-end-2__KwFu9","col-end-3":"Column-module_col-end-3__vfbJk","col-end-4":"Column-module_col-end-4__d4pyL","col-end-5":"Column-module_col-end-5__6yPd4","col-end-6":"Column-module_col-end-6__xQpAX","col-end-7":"Column-module_col-end-7__CCF7e","col-end-8":"Column-module_col-end-8__fVWEi","col-end-9":"Column-module_col-end-9__tpIGv","col-end-10":"Column-module_col-end-10__SX75K","col-end-11":"Column-module_col-end-11__9K1zv","col-end-12":"Column-module_col-end-12__oqTiE","col-end-13":"Column-module_col-end-13__L-nK9"};
125
1920
  styleInject(css_248z);
126
1921
 
127
- const endClassMap = {
128
- 1: 'col-end-1',
129
- 2: 'col-end-2',
130
- 3: 'col-end-3',
131
- 4: 'col-end-4',
132
- 5: 'col-end-5',
133
- 6: 'col-end-6',
134
- 7: 'col-end-7',
135
- 8: 'col-end-8',
136
- 9: 'col-end-9',
137
- 10: 'col-end-10',
138
- 11: 'col-end-11',
139
- 12: 'col-end-12',
140
- 13: 'col-end-13'
141
- };
142
- const startClassMap = {
143
- 1: 'col-start-1',
144
- 2: 'col-start-2',
145
- 3: 'col-start-3',
146
- 4: 'col-start-4',
147
- 5: 'col-start-5',
148
- 6: 'col-start-6',
149
- 7: 'col-start-7',
150
- 8: 'col-start-8',
151
- 9: 'col-start-9',
152
- 10: 'col-start-10',
153
- 11: 'col-start-11',
154
- 12: 'col-start-12'
1922
+ var NATIVE_BIND$1 = functionBindNative;
1923
+
1924
+ var FunctionPrototype = Function.prototype;
1925
+ var apply$1 = FunctionPrototype.apply;
1926
+ var call$7 = FunctionPrototype.call;
1927
+
1928
+ // eslint-disable-next-line es/no-reflect -- safe
1929
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$7.bind(apply$1) : function () {
1930
+ return call$7.apply(apply$1, arguments);
1931
+ });
1932
+
1933
+ var uncurryThis$d = functionUncurryThis;
1934
+
1935
+ var arraySlice$3 = uncurryThis$d([].slice);
1936
+
1937
+ var classof$6 = classofRaw$2;
1938
+
1939
+ // `IsArray` abstract operation
1940
+ // https://tc39.es/ecma262/#sec-isarray
1941
+ // eslint-disable-next-line es/no-array-isarray -- safe
1942
+ var isArray$1 = Array.isArray || function isArray(argument) {
1943
+ return classof$6(argument) === 'Array';
1944
+ };
1945
+
1946
+ var wellKnownSymbol$5 = wellKnownSymbol$e;
1947
+
1948
+ var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
1949
+ var test = {};
1950
+
1951
+ test[TO_STRING_TAG$1] = 'z';
1952
+
1953
+ var toStringTagSupport = String(test) === '[object z]';
1954
+
1955
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1956
+ var isCallable$4 = isCallable$j;
1957
+ var classofRaw$1 = classofRaw$2;
1958
+ var wellKnownSymbol$4 = wellKnownSymbol$e;
1959
+
1960
+ var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
1961
+ var $Object = Object;
1962
+
1963
+ // ES3 wrong here
1964
+ var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) === 'Arguments';
1965
+
1966
+ // fallback for IE11 Script Access Denied error
1967
+ var tryGet = function (it, key) {
1968
+ try {
1969
+ return it[key];
1970
+ } catch (error) { /* empty */ }
1971
+ };
1972
+
1973
+ // getting tag from ES6+ `Object.prototype.toString`
1974
+ var classof$5 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
1975
+ var O, tag, result;
1976
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
1977
+ // @@toStringTag case
1978
+ : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1979
+ // builtinTag case
1980
+ : CORRECT_ARGUMENTS ? classofRaw$1(O)
1981
+ // ES3 arguments fallback
1982
+ : (result = classofRaw$1(O)) === 'Object' && isCallable$4(O.callee) ? 'Arguments' : result;
1983
+ };
1984
+
1985
+ var classof$4 = classof$5;
1986
+
1987
+ var $String$1 = String;
1988
+
1989
+ var toString$5 = function (argument) {
1990
+ if (classof$4(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
1991
+ return $String$1(argument);
1992
+ };
1993
+
1994
+ var uncurryThis$c = functionUncurryThis;
1995
+ var isArray = isArray$1;
1996
+ var isCallable$3 = isCallable$j;
1997
+ var classof$3 = classofRaw$2;
1998
+ var toString$4 = toString$5;
1999
+
2000
+ var push$4 = uncurryThis$c([].push);
2001
+
2002
+ var getJsonReplacerFunction = function (replacer) {
2003
+ if (isCallable$3(replacer)) return replacer;
2004
+ if (!isArray(replacer)) return;
2005
+ var rawLength = replacer.length;
2006
+ var keys = [];
2007
+ for (var i = 0; i < rawLength; i++) {
2008
+ var element = replacer[i];
2009
+ if (typeof element == 'string') push$4(keys, element);
2010
+ else if (typeof element == 'number' || classof$3(element) === 'Number' || classof$3(element) === 'String') push$4(keys, toString$4(element));
2011
+ }
2012
+ var keysLength = keys.length;
2013
+ var root = true;
2014
+ return function (key, value) {
2015
+ if (root) {
2016
+ root = false;
2017
+ return value;
2018
+ }
2019
+ if (isArray(this)) return value;
2020
+ for (var j = 0; j < keysLength; j++) if (keys[j] === key) return value;
2021
+ };
2022
+ };
2023
+
2024
+ var $$4 = _export;
2025
+ var getBuiltIn$1 = getBuiltIn$5;
2026
+ var apply = functionApply;
2027
+ var call$6 = functionCall;
2028
+ var uncurryThis$b = functionUncurryThis;
2029
+ var fails$4 = fails$g;
2030
+ var isCallable$2 = isCallable$j;
2031
+ var isSymbol = isSymbol$3;
2032
+ var arraySlice$2 = arraySlice$3;
2033
+ var getReplacerFunction = getJsonReplacerFunction;
2034
+ var NATIVE_SYMBOL = symbolConstructorDetection;
2035
+
2036
+ var $String = String;
2037
+ var $stringify = getBuiltIn$1('JSON', 'stringify');
2038
+ var exec$3 = uncurryThis$b(/./.exec);
2039
+ var charAt$4 = uncurryThis$b(''.charAt);
2040
+ var charCodeAt$2 = uncurryThis$b(''.charCodeAt);
2041
+ var replace$3 = uncurryThis$b(''.replace);
2042
+ var numberToString$1 = uncurryThis$b(1.0.toString);
2043
+
2044
+ var tester = /[\uD800-\uDFFF]/g;
2045
+ var low = /^[\uD800-\uDBFF]$/;
2046
+ var hi = /^[\uDC00-\uDFFF]$/;
2047
+
2048
+ var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails$4(function () {
2049
+ var symbol = getBuiltIn$1('Symbol')('stringify detection');
2050
+ // MS Edge converts symbol values to JSON as {}
2051
+ return $stringify([symbol]) !== '[null]'
2052
+ // WebKit converts symbol values to JSON as null
2053
+ || $stringify({ a: symbol }) !== '{}'
2054
+ // V8 throws on boxed symbols
2055
+ || $stringify(Object(symbol)) !== '{}';
2056
+ });
2057
+
2058
+ // https://github.com/tc39/proposal-well-formed-stringify
2059
+ var ILL_FORMED_UNICODE = fails$4(function () {
2060
+ return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
2061
+ || $stringify('\uDEAD') !== '"\\udead"';
2062
+ });
2063
+
2064
+ var stringifyWithSymbolsFix = function (it, replacer) {
2065
+ var args = arraySlice$2(arguments);
2066
+ var $replacer = getReplacerFunction(replacer);
2067
+ if (!isCallable$2($replacer) && (it === undefined || isSymbol(it))) return; // IE8 returns string on undefined
2068
+ args[1] = function (key, value) {
2069
+ // some old implementations (like WebKit) could pass numbers as keys
2070
+ if (isCallable$2($replacer)) value = call$6($replacer, this, $String(key), value);
2071
+ if (!isSymbol(value)) return value;
2072
+ };
2073
+ return apply($stringify, null, args);
2074
+ };
2075
+
2076
+ var fixIllFormed = function (match, offset, string) {
2077
+ var prev = charAt$4(string, offset - 1);
2078
+ var next = charAt$4(string, offset + 1);
2079
+ if ((exec$3(low, match) && !exec$3(hi, next)) || (exec$3(hi, match) && !exec$3(low, prev))) {
2080
+ return '\\u' + numberToString$1(charCodeAt$2(match, 0), 16);
2081
+ } return match;
155
2082
  };
2083
+
2084
+ if ($stringify) {
2085
+ // `JSON.stringify` method
2086
+ // https://tc39.es/ecma262/#sec-json.stringify
2087
+ $$4({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
2088
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
2089
+ stringify: function stringify(it, replacer, space) {
2090
+ var args = arraySlice$2(arguments);
2091
+ var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
2092
+ return ILL_FORMED_UNICODE && typeof result == 'string' ? replace$3(result, tester, fixIllFormed) : result;
2093
+ }
2094
+ });
2095
+ }
2096
+
2097
+ var DESCRIPTORS$5 = descriptors;
2098
+ var uncurryThis$a = functionUncurryThis;
2099
+ var call$5 = functionCall;
2100
+ var fails$3 = fails$g;
2101
+ var objectKeys = objectKeys$2;
2102
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
2103
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
2104
+ var toObject$1 = toObject$4;
2105
+ var IndexedObject = indexedObject;
2106
+
2107
+ // eslint-disable-next-line es/no-object-assign -- safe
2108
+ var $assign = Object.assign;
2109
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
2110
+ var defineProperty = Object.defineProperty;
2111
+ var concat = uncurryThis$a([].concat);
2112
+
2113
+ // `Object.assign` method
2114
+ // https://tc39.es/ecma262/#sec-object.assign
2115
+ var objectAssign = !$assign || fails$3(function () {
2116
+ // should have correct order of operations (Edge bug)
2117
+ if (DESCRIPTORS$5 && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
2118
+ enumerable: true,
2119
+ get: function () {
2120
+ defineProperty(this, 'b', {
2121
+ value: 3,
2122
+ enumerable: false
2123
+ });
2124
+ }
2125
+ }), { b: 2 })).b !== 1) return true;
2126
+ // should work with symbols and should have deterministic property order (V8 bug)
2127
+ var A = {};
2128
+ var B = {};
2129
+ // eslint-disable-next-line es/no-symbol -- safe
2130
+ var symbol = Symbol('assign detection');
2131
+ var alphabet = 'abcdefghijklmnopqrst';
2132
+ A[symbol] = 7;
2133
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
2134
+ return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
2135
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
2136
+ var T = toObject$1(target);
2137
+ var argumentsLength = arguments.length;
2138
+ var index = 1;
2139
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
2140
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
2141
+ while (argumentsLength > index) {
2142
+ var S = IndexedObject(arguments[index++]);
2143
+ var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
2144
+ var length = keys.length;
2145
+ var j = 0;
2146
+ var key;
2147
+ while (length > j) {
2148
+ key = keys[j++];
2149
+ if (!DESCRIPTORS$5 || call$5(propertyIsEnumerable, S, key)) T[key] = S[key];
2150
+ }
2151
+ } return T;
2152
+ } : $assign;
2153
+
2154
+ var $$3 = _export;
2155
+ var assign$1 = objectAssign;
2156
+
2157
+ // `Object.assign` method
2158
+ // https://tc39.es/ecma262/#sec-object.assign
2159
+ // eslint-disable-next-line es/no-object-assign -- required for testing
2160
+ $$3({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign$1 }, {
2161
+ assign: assign$1
2162
+ });
2163
+
156
2164
  /**
157
- * Get the container data from the containers object using the current container reference obtained from the layout.
2165
+ * @internal
158
2166
  *
159
- * @param {ContainerData} containers
160
- * @param {DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0]} containerRef
161
- * @returns {Object} Container with all the data it has.
2167
+ * Component to display when a container is not found in the system.
2168
+ * Only renders in development mode for debugging purposes.
2169
+ *
2170
+ * @component
2171
+ * @param {Object} props - Component properties
2172
+ * @param {string} props.identifier - Container identifier
2173
+ * @returns {JSX.Element | null} Message about missing container or null in production
162
2174
  */
163
- const getContainersData = (containers, containerRef) => {
164
- var _containers$identifie;
165
- const {
166
- identifier,
167
- uuid
168
- } = containerRef;
169
- const {
170
- containerStructures,
171
- container
172
- } = containers[identifier];
173
- // Get the variant id
174
- const {
175
- variantId
176
- } = (container == null ? void 0 : container.parentPermissionable) || {};
177
- // Get accepts types of content types for this container
178
- const acceptTypes = containerStructures.map(structure => structure.contentTypeVar).join(',');
179
- // Get the contentlets for "this" container
180
- const contentlets = (_containers$identifie = containers[identifier].contentlets[`uuid-${uuid}`]) != null ? _containers$identifie : containers[identifier].contentlets[`uuid-dotParser_${uuid}`];
181
- if (!contentlets) {
182
- console.warn(`We couldn't find the contentlets for the container with the identifier ${identifier} and the uuid ${uuid} becareful by adding content to this container.\nWe recommend to change the container in the layout and add the content again.`);
183
- }
184
- return Object.assign({}, containers[identifier].container, {
185
- acceptTypes,
186
- contentlets: contentlets != null ? contentlets : [],
187
- variantId
2175
+ const ContainerNotFound = ({
2176
+ identifier
2177
+ }) => {
2178
+ const isDevMode = useIsDevMode();
2179
+ useEffect(() => {
2180
+ if (!isDevMode) {
2181
+ return;
2182
+ }
2183
+ console.error(`Container with identifier ${identifier} not found`);
2184
+ }, [identifier, isDevMode]);
2185
+ if (!isDevMode) {
2186
+ return null;
2187
+ }
2188
+ return jsxs("div", {
2189
+ "data-testid": "container-not-found",
2190
+ style: EMPTY_CONTAINER_STYLE_REACT,
2191
+ children: ["This container with identifier ", identifier, " was not found."]
188
2192
  });
189
2193
  };
190
2194
  /**
191
- * Combine classes into a single string.
2195
+ * @internal
192
2196
  *
193
- * @param {string[]} classes
194
- * @returns {string} Combined classes
195
- */
196
- const combineClasses = classes => classes.filter(Boolean).join(' ');
197
- /**
198
- * Get the start and end classes for the column based on the left offset and width.
2197
+ * Component to display when a container is empty.
199
2198
  *
200
- * @param {number} start
201
- * @param {number} end
202
- * @returns {Object} Start and end classes
2199
+ * @param {DotContainerAttributes} dotAttributes
2200
+ * @return {*}
203
2201
  */
204
- const getPositionStyleClasses = (start, end) => {
205
- const startClass = startClassMap[start];
206
- const endClass = endClassMap[end];
207
- return {
208
- startClass,
209
- endClass
210
- };
2202
+ const EmptyContainer = dotAttributes => {
2203
+ const isDevMode = useIsDevMode();
2204
+ if (!isDevMode) {
2205
+ return null;
2206
+ }
2207
+ return jsx("div", Object.assign({}, dotAttributes, {
2208
+ style: EMPTY_CONTAINER_STYLE_REACT,
2209
+ children: jsx("span", {
2210
+ "data-testid": "empty-container-message",
2211
+ "data-dot-object": "empty-content",
2212
+ children: "This container is empty."
2213
+ })
2214
+ }));
211
2215
  };
2216
+
212
2217
  /**
213
- * Validates the structure of a Block Editor block.
2218
+ * @internal
2219
+ * A custom React hook that checks whether a referenced HTMLDivElement has visible content based on its height.
2220
+ *
2221
+ * @param {RefObject<HTMLDivElement>} ref - A React ref object pointing to an HTMLDivElement.
2222
+ * @returns {boolean} - Returns true if the element's height is greater than zero (indicating visible content), otherwise false.
2223
+ *
2224
+ * @example
2225
+ * import { useRef } from 'react';
2226
+ * import { useCheckVisibleContent } from 'src/lib/next/hooks/useCheckVisibleContent';
214
2227
  *
215
- * This function checks that:
216
- * 1. The blocks parameter is a valid object
217
- * 2. The block has a 'doc' type
218
- * 3. The block has a valid content array that is not empty
2228
+ * function MyComponent() {
2229
+ * const contentRef = useRef<HTMLDivElement>(null);
2230
+ * const isContentVisible = useCheckVisibleContent(contentRef);
219
2231
  *
220
- * @param {Block} blocks - The blocks structure to validate
221
- * @returns {BlockEditorState} Object containing validation state and any error message
222
- * @property {boolean} BlockEditorState.isValid - Whether the blocks structure is valid
223
- * @property {string | null} BlockEditorState.error - Error message if invalid, null if valid
2232
+ * return (
2233
+ * <div ref={contentRef}>
2234
+ * {isContentVisible ? 'Content is visible' : 'Content is not visible'}
2235
+ * </div>
2236
+ * );
2237
+ * }
224
2238
  */
225
- const isValidBlocks = blocks => {
226
- if (!blocks) {
227
- return {
228
- error: `Error: Blocks object is not defined`
229
- };
230
- }
231
- if (typeof blocks !== 'object') {
232
- return {
233
- error: `Error: Blocks must be an object, but received: ${typeof blocks}`
234
- };
235
- }
236
- if (blocks.type !== 'doc') {
237
- return {
238
- error: 'Error: Blocks must have a doc type'
239
- };
240
- }
241
- if (!blocks.content || !Array.isArray(blocks.content)) {
242
- return {
243
- error: 'Error: Blocks must have a valid content array'
244
- };
245
- }
246
- if (blocks.content.length === 0) {
247
- return {
248
- error: 'Error: Blocks content is empty'
249
- };
250
- }
251
- return {
252
- error: null
253
- };
254
- };
255
-
256
- const useCheckHaveContent = () => {
257
- const contentletDivRef = useRef(null);
2239
+ const useCheckVisibleContent = ref => {
258
2240
  const [haveContent, setHaveContent] = useState(false);
259
- useEffect(() => {
260
- if (!contentletDivRef.current) {
261
- return;
262
- }
263
- const childElement = contentletDivRef.current.firstElementChild;
264
- if (!childElement) {
2241
+ useLayoutEffect(() => {
2242
+ if (!ref.current) {
2243
+ setHaveContent(false);
265
2244
  return;
266
2245
  }
267
- const height = childElement.getBoundingClientRect().height;
268
- if (height > 0) {
269
- setHaveContent(true);
270
- return;
271
- }
272
- setHaveContent(false);
273
- }, [contentletDivRef]);
274
- return {
275
- contentletDivRef,
276
- haveContent
277
- };
2246
+ const {
2247
+ height
2248
+ } = ref.current.getBoundingClientRect();
2249
+ setHaveContent(height > 0);
2250
+ }, [ref]);
2251
+ return haveContent;
278
2252
  };
279
2253
 
280
2254
  /**
2255
+ * @internal
2256
+ *
2257
+ * Renders a fallback component when no matching component is found for a content type
2258
+ *
2259
+ * @component
2260
+ * @param {DotCMSFallbackComponentProps} props - Component properties
2261
+ * @param {NoComponentType} [props.UserNoComponent] - Optional custom component to render
2262
+ * @param {DotCMSContentlet} [props.contentlet] - The contentlet that couldn't be rendered
2263
+ * @returns {JSX.Element} The rendered fallback component
2264
+ *
2265
+ * @example
2266
+ * ```tsx
2267
+ * <FallbackComponent
2268
+ * UserNoComponent={CustomNoComponent}
2269
+ * contentlet={contentlet}
2270
+ * />
2271
+ * ```
2272
+ */
2273
+ function FallbackComponent({
2274
+ UserNoComponent,
2275
+ contentlet
2276
+ }) {
2277
+ const isDevMode = useIsDevMode();
2278
+ if (!isDevMode) {
2279
+ return null;
2280
+ }
2281
+ const NoComponentFound = UserNoComponent || NoComponent;
2282
+ return jsx(NoComponentFound, Object.assign({}, contentlet));
2283
+ }
2284
+ /**
2285
+ * @internal
2286
+ *
281
2287
  * Component to render when there is no component for the content type.
282
2288
  *
283
- * @param {{ readonly contentType: string }} { contentType }
2289
+ * @param {DotCMSBasicContentlet} contentType - The content type that couldn't be rendered
284
2290
  * @return {*}
285
2291
  */
286
2292
  function NoComponent({
@@ -288,140 +2294,161 @@ function NoComponent({
288
2294
  }) {
289
2295
  return jsxs("div", {
290
2296
  "data-testid": "no-component",
291
- children: ["No Component for ", contentType]
2297
+ children: ["No Component for ", jsx("strong", {
2298
+ children: contentType
2299
+ }), "."]
292
2300
  });
293
2301
  }
2302
+
294
2303
  /**
295
- * Component to render when there is no content in the container.
2304
+ * Contentlet component that renders DotCMS content with development mode support
296
2305
  *
297
- * @return {*}
2306
+ * @component
2307
+ * @param {DotCMSContentletRendererProps} props - Component properties
2308
+ * @param {DotCMSContentlet} props.contentlet - The contentlet to be rendered
2309
+ * @param {string} props.container - The container identifier
2310
+ * @returns {JSX.Element} Rendered contentlet with appropriate wrapper and attributes
2311
+ *
2312
+ * @example
2313
+ * ```tsx
2314
+ * <Contentlet
2315
+ * contentlet={myContentlet}
2316
+ * container="container-1"
2317
+ * />
2318
+ * ```
298
2319
  */
299
- function EmptyContent() {
300
- return null;
2320
+ function Contentlet({
2321
+ contentlet,
2322
+ container
2323
+ }) {
2324
+ const ref = useRef(null);
2325
+ const isDevMode = useIsDevMode();
2326
+ const haveContent = useCheckVisibleContent(ref);
2327
+ const style = useMemo(() => isDevMode ? {
2328
+ minHeight: haveContent ? undefined : '4rem'
2329
+ } : {}, [isDevMode, haveContent]);
2330
+ const dotAttributes = useMemo(() => isDevMode ? getDotContentletAttributes(contentlet, container) : {}, [isDevMode, contentlet, container]);
2331
+ return jsx("div", Object.assign({}, dotAttributes, {
2332
+ "data-dot-object": "contentlet",
2333
+ ref: ref,
2334
+ style: style,
2335
+ children: jsx(CustomComponent, {
2336
+ contentlet: contentlet
2337
+ })
2338
+ }));
301
2339
  }
302
2340
  /**
303
- * Renders a Container with its content using information provided by dotCMS Page API.
2341
+ * Renders a custom component based on the contentlet type or falls back to a default component
304
2342
  *
305
- * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
306
- * @export
307
- * @param {ContainerProps} { containerRef }
308
- * @return {JSX.Element} Rendered container with content
2343
+ * @component
2344
+ * @param {CustomComponentProps} props - Component properties
2345
+ * @param {DotCMSContentlet} props.contentlet - The contentlet data to render
2346
+ * @returns {JSX.Element} The rendered custom component or fallback component
2347
+ *
2348
+ * @internal
309
2349
  */
310
- function Container({
311
- containerRef
2350
+ function CustomComponent({
2351
+ contentlet
312
2352
  }) {
313
2353
  const {
314
- isInsideEditor
315
- } = useContext(PageContext);
316
- const {
317
- identifier,
318
- uuid
319
- } = containerRef;
320
- const {
321
- haveContent,
322
- contentletDivRef
323
- } = useCheckHaveContent();
324
- // Get the containers from the global context
325
- const {
326
- pageAsset: {
327
- containers
328
- },
329
- components
330
- } = useContext(PageContext);
331
- const {
332
- acceptTypes,
333
- contentlets,
334
- maxContentlets,
335
- variantId,
336
- path
337
- } = getContainersData(containers, containerRef);
338
- const container = {
339
- acceptTypes,
340
- identifier: path != null ? path : identifier,
341
- maxContentlets,
342
- variantId,
343
- uuid
344
- };
345
- const containerStyles = contentlets.length ? undefined : {
346
- width: '100%',
347
- backgroundColor: '#ECF0FD',
348
- display: 'flex',
349
- justifyContent: 'center',
350
- alignItems: 'center',
351
- color: '#030E32',
352
- height: '10rem'
353
- };
354
- const ContainerChildren = contentlets.map(contentlet => {
355
- const ContentTypeComponent = components[contentlet.contentType];
356
- const DefaultComponent = components['CustomNoComponent'] || NoComponent;
357
- const Component = isInsideEditor ? ContentTypeComponent || DefaultComponent : ContentTypeComponent || EmptyContent;
358
- return isInsideEditor ? jsx("div", {
359
- "data-testid": "dot-contentlet",
360
- "data-dot-object": "contentlet",
361
- "data-dot-identifier": contentlet.identifier,
362
- "data-dot-basetype": contentlet.baseType,
363
- "data-dot-title": contentlet.widgetTitle || contentlet.title,
364
- "data-dot-inode": contentlet.inode,
365
- "data-dot-type": contentlet.contentType,
366
- "data-dot-container": JSON.stringify(container),
367
- "data-dot-on-number-of-pages": contentlet.onNumberOfPages,
368
- ref: contentletDivRef,
369
- style: {
370
- minHeight: haveContent ? undefined : '4rem'
371
- },
372
- children: jsx(Component, Object.assign({}, contentlet))
373
- }, contentlet.identifier) : (/*#__PURE__*/createElement(Component, Object.assign({}, contentlet, {
374
- key: contentlet.identifier
375
- })));
376
- });
377
- return isInsideEditor ? jsx("div", {
378
- "data-testid": "dot-container",
379
- "data-dot-object": "container",
380
- "data-dot-accept-types": acceptTypes,
381
- "data-dot-identifier": path != null ? path : identifier,
382
- "data-max-contentlets": maxContentlets,
383
- "data-dot-uuid": uuid,
384
- style: containerStyles,
385
- children: ContainerChildren.length ? ContainerChildren : 'This container is empty.'
386
- }) :
387
- // eslint-disable-next-line react/jsx-no-useless-fragment
388
- jsx(Fragment, {
389
- children: ContainerChildren
2354
+ userComponents
2355
+ } = useContext(DotCMSPageContext);
2356
+ const UserComponent = userComponents[contentlet == null ? void 0 : contentlet.contentType];
2357
+ if (UserComponent) {
2358
+ return jsx(UserComponent, Object.assign({}, contentlet));
2359
+ }
2360
+ const UserNoComponent = userComponents[CUSTOM_NO_COMPONENT];
2361
+ return jsx(FallbackComponent, {
2362
+ UserNoComponent: UserNoComponent,
2363
+ contentlet: contentlet
390
2364
  });
391
2365
  }
392
2366
 
393
2367
  /**
394
- * Renders a Column with its containers using information provided by dotCMS Page API.
2368
+ * @internal
2369
+ *
2370
+ * Container component that renders DotCMS containers and their contentlets.
2371
+ * This component is responsible for:
2372
+ * - Rendering container content based on DotCMS Page API data
2373
+ * - Handling empty container states
2374
+ * - Providing proper data attributes for DotCMS functionality
2375
+ * - Managing container contentlets rendering
2376
+ *
2377
+ * @component
2378
+ * @param {DotCMSContainerRendererProps} props - Component properties
2379
+ * @returns {JSX.Element} Rendered container with its contentlets or empty state message
2380
+ *
2381
+ * @example
2382
+ * ```tsx
2383
+ * <Container container={containerData} />
2384
+ * ```
2385
+ */
2386
+ function Container({
2387
+ container
2388
+ }) {
2389
+ const {
2390
+ pageAsset
2391
+ } = useContext(DotCMSPageContext);
2392
+ const containerData = useMemo(() => getContainersData(pageAsset, container), [pageAsset, container]);
2393
+ const contentlets = useMemo(() => getContentletsInContainer(pageAsset, container), [pageAsset, container]);
2394
+ if (!containerData) {
2395
+ return jsx(ContainerNotFound, {
2396
+ identifier: container.identifier
2397
+ });
2398
+ }
2399
+ const isEmpty = contentlets.length === 0;
2400
+ const dotAttributes = getDotContainerAttributes(containerData);
2401
+ if (isEmpty) {
2402
+ return jsx(EmptyContainer, Object.assign({}, dotAttributes));
2403
+ }
2404
+ return jsx("div", Object.assign({}, dotAttributes, {
2405
+ children: contentlets.map(contentlet => jsx(Contentlet, {
2406
+ contentlet: contentlet,
2407
+ container: JSON.stringify(containerData)
2408
+ }, contentlet.identifier))
2409
+ }));
2410
+ }
2411
+
2412
+ /**
2413
+ * @internal
2414
+ *
2415
+ * Renders a Column component that represents a single column in a 12-column grid system.
2416
+ * The column's position and width are determined by the leftOffset and width properties
2417
+ * from the dotCMS Page API. Uses CSS Grid classes for positioning.
2418
+ *
2419
+ * @example
2420
+ * ```tsx
2421
+ * <Column column={{
2422
+ * leftOffset: 0,
2423
+ * width: 6,
2424
+ * styleClass: "custom-class",
2425
+ * containers: []
2426
+ * }} />
2427
+ * ```
395
2428
  *
396
2429
  * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
397
2430
  * @export
398
- * @param {ColumnProps} { column }
399
- * @return {JSX.Element} Rendered column with containers
2431
+ * @param {ColumnProps} { column } - Column configuration object
2432
+ * @return {JSX.Element} Rendered column with its containers positioned in the grid
400
2433
  */
401
2434
  function Column({
402
2435
  column
403
2436
  }) {
404
- const {
405
- isInsideEditor
406
- } = useContext(PageContext);
407
2437
  const {
408
2438
  startClass,
409
2439
  endClass
410
- } = getPositionStyleClasses(column.leftOffset, column.width + column.leftOffset);
2440
+ } = getColumnPositionClasses(column);
411
2441
  const combinedClasses = combineClasses([styles[endClass], styles[startClass]]);
412
- const columnProps = isInsideEditor ? {
413
- 'data-dot': 'column',
414
- 'data-testid': 'column'
415
- } : {};
416
- return jsx("div", Object.assign({}, columnProps, {
2442
+ return jsx("div", {
2443
+ "data-dot": "column",
417
2444
  className: combinedClasses,
418
2445
  children: jsx("div", {
419
2446
  className: column.styleClass,
420
2447
  children: column.containers.map(container => jsx(Container, {
421
- containerRef: container
2448
+ container: container
422
2449
  }, `${container.identifier}-${container.uuid}`))
423
2450
  })
424
- }));
2451
+ });
425
2452
  }
426
2453
 
427
2454
  /**
@@ -429,59 +2456,331 @@ function Column({
429
2456
  *
430
2457
  * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
431
2458
  * @category Components
432
- * @param {React.ForwardedRef<HTMLDivElement, RowProps>} ref
2459
+ * @param {React.ForwardedRef<HTMLDivElement, DotCMS>} ref
433
2460
  * @return {JSX.Element} Rendered rows with columns
434
2461
  */
435
- const Row = /*#__PURE__*/forwardRef((props, ref) => {
436
- const {
437
- isInsideEditor
438
- } = useContext(PageContext);
439
- const {
440
- row
441
- } = props;
442
- const rowProps = isInsideEditor ? {
443
- 'data-dot': 'row',
444
- 'data-testid': 'row',
445
- ref
446
- } : {};
2462
+ const Row = ({
2463
+ row
2464
+ }) => {
2465
+ const customRowClass = combineClasses([row.styleClass || '', styles$1.row]);
447
2466
  return jsx("div", {
448
- className: row.styleClass,
2467
+ className: "dot-row-container",
449
2468
  children: jsx("div", {
450
- className: "container",
451
- children: jsx("div", Object.assign({}, rowProps, {
452
- className: styles$1.row,
453
- children: row.columns.map((column, index) => jsx(Column, {
454
- column: column
455
- }, index))
456
- }))
2469
+ className: customRowClass,
2470
+ "data-dot-object": 'row',
2471
+ children: row.columns.map((column, index) => jsx(Column, {
2472
+ column: column
2473
+ }, index))
457
2474
  })
458
2475
  });
459
- });
2476
+ };
460
2477
 
461
2478
  /**
462
- * `DotcmsLayout` is a functional component that renders a layout for a DotCMS page.
463
- * It takes a `DotcmsPageProps` object as a parameter and returns a JSX element.
2479
+ * DotCMSLayoutBody component renders the layout body for a DotCMS page.
2480
+ *
2481
+ * It utilizes the dotCMS page asset's layout body to render the page body.
2482
+ * If the layout body does not exist, it renders an error message in the mode is `development`.
2483
+ *
2484
+ * @public
2485
+ * @component
2486
+ * @param {Object} props - Component properties.
2487
+ * @param {DotCMSPageAsset} props.page - The DotCMS page asset containing the layout information.
2488
+ * @param {Record<string, React.ComponentType<DotCMSContentlet>>} [props.components] - mapping of custom components for content rendering.
2489
+ * @param {DotCMSPageRendererMode} [props.mode='production'] - The renderer mode; defaults to 'production'. Alternate modes might trigger different behaviors.
2490
+ *
2491
+ * @returns {JSX.Element} The rendered DotCMS page body or an error message if the layout body is missing.
464
2492
  *
465
- * @category Components
466
- * @param {DotcmsPageProps} props - The properties for the DotCMS page.
467
- * @returns {JSX.Element} - A JSX element that represents the layout for a DotCMS page.
468
- * @deprecated Use {@link https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/react/src/lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.tsx DotCMSLayoutBody} instead.
469
2493
  */
470
- function DotcmsLayout(dotPageProps) {
471
- var _pageContext$pageAsse;
472
- const pageContext = useDotcmsEditor(dotPageProps);
473
- return jsx(PageProvider, {
474
- pageContext: pageContext,
475
- children: (_pageContext$pageAsse = pageContext.pageAsset) == null || (_pageContext$pageAsse = _pageContext$pageAsse.layout) == null ? void 0 : _pageContext$pageAsse.body.rows.map((row, index) => jsx(Row, {
2494
+ const DotCMSLayoutBody = ({
2495
+ page,
2496
+ components: _components = {},
2497
+ mode: _mode = 'production'
2498
+ }) => {
2499
+ var _page$layout;
2500
+ const dotCMSPageBody = page == null || (_page$layout = page.layout) == null ? void 0 : _page$layout.body;
2501
+ const contextValue = {
2502
+ pageAsset: page,
2503
+ userComponents: _components,
2504
+ mode: _mode
2505
+ };
2506
+ return jsx(DotCMSPageContext.Provider, {
2507
+ value: contextValue,
2508
+ children: dotCMSPageBody ? dotCMSPageBody.rows.map((row, index) => jsx(Row, {
476
2509
  row: row
477
- }, index))
2510
+ }, index)) : jsx(ErrorMessage, {})
478
2511
  });
2512
+ };
2513
+
2514
+ /**
2515
+ * Custom hook to determine if the current UVE (Universal Visual Editor) mode
2516
+ * matches the specified mode. This hook is useful for conditionally rendering
2517
+ * components based on the UVE mode.
2518
+ *
2519
+ * @param {UVE_MODE} when - The UVE mode to check against.
2520
+ * @returns {boolean} True if the current UVE mode matches the specified mode, otherwise false.
2521
+ *
2522
+ * @example
2523
+ * // Basic usage: Check if the UVE is in edit mode
2524
+ * const showInEditMode = useDotCMSShowWhen(UVE_MODE.EDIT);
2525
+ * if (showInEditMode) {
2526
+ * // Render edit-specific components
2527
+ * }
2528
+ *
2529
+ * @example
2530
+ * // Check if the UVE is in preview mode
2531
+ * const showInPreviewMode = useDotCMSShowWhen(UVE_MODE.PREVIEW);
2532
+ * if (showInPreviewMode) {
2533
+ * // Render preview-specific components
2534
+ * }
2535
+ *
2536
+ * @example
2537
+ * // Check if the UVE is in live mode
2538
+ * const showInLiveMode = useDotCMSShowWhen(UVE_MODE.LIVE);
2539
+ * if (showInLiveMode) {
2540
+ * // Render live-specific components
2541
+ * }
2542
+ */
2543
+ const useDotCMSShowWhen = when => {
2544
+ const [show, setShow] = useState(false);
2545
+ useEffect(() => {
2546
+ var _getUVEState;
2547
+ setShow(((_getUVEState = getUVEState()) == null ? void 0 : _getUVEState.mode) === when);
2548
+ }, [when]);
2549
+ return show;
2550
+ };
2551
+
2552
+ /**
2553
+ * DotCMSShow component is used to conditionally render its children
2554
+ * based on the Universal Visual Editor (UVE) mode. It checks if the UVE
2555
+ * is in a specified mode and only renders its children in that case.
2556
+ *
2557
+ * @param {Object} props - The component props.
2558
+ * @param {React.ReactNode} props.children - The children to be rendered when the condition is met.
2559
+ * @param {UVE_MODE} [props.when=UVE_MODE.EDIT] - The UVE mode in which the children should be rendered.
2560
+ * @returns {React.ReactNode | null} The children if the current UVE mode matches the `when` prop, otherwise null.
2561
+ *
2562
+ * @example
2563
+ * // Basic usage: Render content only in edit mode
2564
+ * <DotCMSShow when={UVE_MODE.EDIT}>
2565
+ * <div>Edit Mode Content</div>
2566
+ * </DotCMSShow>
2567
+ *
2568
+ * // This will render <div>Edit Mode Content</div> only if the UVE is in edit mode.
2569
+ *
2570
+ * @example
2571
+ * // Render content in preview mode
2572
+ * <DotCMSShow when={UVE_MODE.PREVIEW}>
2573
+ * <MyCustomPreviewComponent />
2574
+ * </DotCMSShow>
2575
+ *
2576
+ * // MyCustomPreviewComponent will only be rendered if the UVE is in preview mode.
2577
+ *
2578
+ * @example
2579
+ * // Render content in live mode
2580
+ * <DotCMSShow when={UVE_MODE.LIVE}>
2581
+ * <LiveContentComponent />
2582
+ * </DotCMSShow>
2583
+ *
2584
+ * // LiveContentComponent will only be rendered if the UVE is in live mode.
2585
+ */
2586
+ const DotCMSShow = ({
2587
+ children,
2588
+ when: _when = UVE_MODE.EDIT
2589
+ }) => {
2590
+ const show = useDotCMSShowWhen(_when);
2591
+ if (!show) {
2592
+ return null;
2593
+ }
2594
+ return children;
2595
+ };
2596
+
2597
+ /**
2598
+ * Custom hook to manage the editable state of a DotCMS page.
2599
+ *
2600
+ * This hook initializes the Universal Visual Editor (UVE) and subscribes to content changes.
2601
+ * It updates the editable page state when content changes are detected in the UVE,
2602
+ * ensuring your React components always display the latest content when editing in DotCMS.
2603
+ *
2604
+ * @example
2605
+ * ```ts
2606
+ * // Import the hook and the client
2607
+ * import { useEditableDotCMSPage } from '@dotcms/react';
2608
+ * import { createDotCMSClient } from '@dotcms/client';
2609
+ *
2610
+ * // Create the client
2611
+ * const client = createDotCMSClient({
2612
+ * dotcmsURL: 'https://your-dotcms-instance.com',
2613
+ * authToken: 'your-auth-token'
2614
+ * });
2615
+ *
2616
+ * // Get the page
2617
+ * const page = await client.page.get('/', {
2618
+ * languageId: '1',
2619
+ * });
2620
+ *
2621
+ * // Use the hook to get an editable version of the page
2622
+ * const editablePage = useEditableDotCMSPage(page);
2623
+ *
2624
+ * // Then use the page data in your component
2625
+ * return (
2626
+ * <div>
2627
+ * <h1>{editablePage.page.title}</h1>
2628
+ * <div dangerouslySetInnerHTML={{ __html: editablePage.page.body }} />
2629
+ * </div>
2630
+ * );
2631
+ * ```
2632
+ *
2633
+ * @example
2634
+ * ```ts
2635
+ * // Import the hook and the client
2636
+ * import { useEditableDotCMSPage } from '@dotcms/react';
2637
+ * import { createDotCMSClient } from '@dotcms/client';
2638
+ *
2639
+ * // Create the client
2640
+ * const client = createDotCMSClient({
2641
+ * dotcmsURL: 'https://your-dotcms-instance.com',
2642
+ * authToken: 'your-auth-token'
2643
+ * });
2644
+ *
2645
+ * // Get the page with GraphQL content
2646
+ * const page = await client.page.get('/', {
2647
+ * languageId: '1',
2648
+ * graphql: {
2649
+ * content: {
2650
+ * products: `ProductCollection(query: "+title:snow", limit: 10, offset: 0, sortBy: "score") {
2651
+ * title
2652
+ * urlMap
2653
+ * category {
2654
+ * name
2655
+ * inode
2656
+ * }
2657
+ * retailPrice
2658
+ * image {
2659
+ * versionPath
2660
+ * }
2661
+ * }`
2662
+ * }
2663
+ * }
2664
+ * });
2665
+ *
2666
+ * // Use the hook to get an editable version of the page and its content
2667
+ * const editablePage = useEditableDotCMSPage(page);
2668
+ *
2669
+ * // Access both page data and GraphQL content
2670
+ * const { page: pageData, content } = editablePage;
2671
+ *
2672
+ * // Use the products from GraphQL content
2673
+ * return (
2674
+ * <div>
2675
+ * <h1>{pageData.title}</h1>
2676
+ * <ProductList products={content.products} />
2677
+ * </div>
2678
+ * );
2679
+ * ```
2680
+ * @param {DotCMSPageResponse} pageResponse - The initial editable page data from client.page.get().
2681
+ *
2682
+ * @returns {DotCMSPageResponse} The updated editable page state that reflects any changes made in the UVE.
2683
+ * The structure includes page data and any GraphQL content that was requested.
2684
+ */
2685
+ const useEditableDotCMSPage = pageResponse => {
2686
+ const [updatedPageResponse, setUpdatedPageResponse] = useState(pageResponse);
2687
+ useEffect(() => {
2688
+ var _pageResponse$pageAss;
2689
+ if (!getUVEState()) {
2690
+ return;
2691
+ }
2692
+ if (!pageResponse) {
2693
+ console.warn('[useEditableDotCMSPage]: No DotCMSPageResponse provided');
2694
+ return;
2695
+ }
2696
+ const pageURI = pageResponse == null || (_pageResponse$pageAss = pageResponse.pageAsset) == null || (_pageResponse$pageAss = _pageResponse$pageAss.page) == null ? void 0 : _pageResponse$pageAss.pageURI;
2697
+ const {
2698
+ destroyUVESubscriptions
2699
+ } = initUVE(pageResponse);
2700
+ // Update the navigation to the pageURI, when we have a pageURI
2701
+ // Sometimes the page is null due to permissions, so we don't want to update the navigation
2702
+ // And wait for the UVE to resolve the page
2703
+ if (pageURI) {
2704
+ updateNavigation(pageURI);
2705
+ }
2706
+ return () => {
2707
+ destroyUVESubscriptions();
2708
+ };
2709
+ }, [pageResponse]);
2710
+ useEffect(() => {
2711
+ const {
2712
+ unsubscribe
2713
+ } = createUVESubscription(UVEEventType.CONTENT_CHANGES, payload => {
2714
+ setUpdatedPageResponse(payload);
2715
+ });
2716
+ return () => {
2717
+ unsubscribe();
2718
+ };
2719
+ }, []);
2720
+ return updatedPageResponse;
2721
+ };
2722
+
2723
+ var anObject$3 = anObject$c;
2724
+
2725
+ // `RegExp.prototype.flags` getter implementation
2726
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
2727
+ var regexpFlags = function () {
2728
+ var that = anObject$3(this);
2729
+ var result = '';
2730
+ if (that.hasIndices) result += 'd';
2731
+ if (that.global) result += 'g';
2732
+ if (that.ignoreCase) result += 'i';
2733
+ if (that.multiline) result += 'm';
2734
+ if (that.dotAll) result += 's';
2735
+ if (that.unicode) result += 'u';
2736
+ if (that.unicodeSets) result += 'v';
2737
+ if (that.sticky) result += 'y';
2738
+ return result;
2739
+ };
2740
+
2741
+ var call$4 = functionCall;
2742
+ var hasOwn$2 = hasOwnProperty_1;
2743
+ var isPrototypeOf = objectIsPrototypeOf;
2744
+ var regExpFlags = regexpFlags;
2745
+
2746
+ var RegExpPrototype$1 = RegExp.prototype;
2747
+
2748
+ var regexpGetFlags = function (R) {
2749
+ var flags = R.flags;
2750
+ return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$2(R, 'flags') && isPrototypeOf(RegExpPrototype$1, R)
2751
+ ? call$4(regExpFlags, R) : flags;
2752
+ };
2753
+
2754
+ var PROPER_FUNCTION_NAME = functionName.PROPER;
2755
+ var defineBuiltIn$4 = defineBuiltIn$9;
2756
+ var anObject$2 = anObject$c;
2757
+ var $toString$2 = toString$5;
2758
+ var fails$2 = fails$g;
2759
+ var getRegExpFlags = regexpGetFlags;
2760
+
2761
+ var TO_STRING = 'toString';
2762
+ var RegExpPrototype = RegExp.prototype;
2763
+ var nativeToString = RegExpPrototype[TO_STRING];
2764
+
2765
+ var NOT_GENERIC = fails$2(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
2766
+ // FF44- RegExp#toString has a wrong name
2767
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
2768
+
2769
+ // `RegExp.prototype.toString` method
2770
+ // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
2771
+ if (NOT_GENERIC || INCORRECT_NAME) {
2772
+ defineBuiltIn$4(RegExpPrototype, TO_STRING, function toString() {
2773
+ var R = anObject$2(this);
2774
+ var pattern = $toString$2(R.source);
2775
+ var flags = $toString$2(getRegExpFlags(R));
2776
+ return '/' + pattern + '/' + flags;
2777
+ }, { unsafe: true });
479
2778
  }
480
2779
 
481
2780
  var uncurryThis$9 = functionUncurryThis;
482
- var toIntegerOrInfinity = toIntegerOrInfinity$1;
483
- var toString$3 = toString$4;
484
- var requireObjectCoercible = requireObjectCoercible$1;
2781
+ var toIntegerOrInfinity = toIntegerOrInfinity$3;
2782
+ var toString$3 = toString$5;
2783
+ var requireObjectCoercible = requireObjectCoercible$4;
485
2784
 
486
2785
  var charAt$3 = uncurryThis$9(''.charAt);
487
2786
  var charCodeAt$1 = uncurryThis$9(''.charCodeAt);
@@ -516,10 +2815,10 @@ var stringMultibyte = {
516
2815
  };
517
2816
 
518
2817
  var charAt$2 = stringMultibyte.charAt;
519
- var toString$2 = toString$4;
2818
+ var toString$2 = toString$5;
520
2819
  var InternalStateModule$2 = internalState;
521
2820
  var defineIterator = iteratorDefine;
522
- var createIterResultObject$1 = createIterResultObject$2;
2821
+ var createIterResultObject$1 = createIterResultObject$4;
523
2822
 
524
2823
  var STRING_ITERATOR = 'String Iterator';
525
2824
  var setInternalState$2 = InternalStateModule$2.set;
@@ -546,9 +2845,9 @@ defineIterator(String, 'String', function (iterated) {
546
2845
  return createIterResultObject$1(point, false);
547
2846
  });
548
2847
 
549
- var fails$1 = fails$2;
550
- var wellKnownSymbol$3 = wellKnownSymbol$4;
551
- var DESCRIPTORS$5 = descriptors;
2848
+ var fails$1 = fails$g;
2849
+ var wellKnownSymbol$3 = wellKnownSymbol$e;
2850
+ var DESCRIPTORS$4 = descriptors;
552
2851
  var IS_PURE = isPure;
553
2852
 
554
2853
  var ITERATOR$3 = wellKnownSymbol$3('iterator');
@@ -569,7 +2868,7 @@ var urlConstructorDetection = !fails$1(function () {
569
2868
  // https://bugs.chromium.org/p/v8/issues/detail?id=14222
570
2869
  params2['delete']('b', undefined);
571
2870
  return (IS_PURE && (!url.toJSON || !params2.has('a', 1) || params2.has('a', 2) || !params2.has('a', undefined) || params2.has('b')))
572
- || (!params.size && (IS_PURE || !DESCRIPTORS$5))
2871
+ || (!params.size && (IS_PURE || !DESCRIPTORS$4))
573
2872
  || !params.sort
574
2873
  || url.href !== 'http://a/c%20d?a=1&c=3'
575
2874
  || params.get('c') !== '3'
@@ -588,7 +2887,7 @@ var urlConstructorDetection = !fails$1(function () {
588
2887
  || new URL('http://x', undefined).host !== 'x';
589
2888
  });
590
2889
 
591
- var classofRaw = classofRaw$1;
2890
+ var classofRaw = classofRaw$2;
592
2891
  var uncurryThis$8 = functionUncurryThis;
593
2892
 
594
2893
  var functionUncurryThisClause = function (fn) {
@@ -599,7 +2898,7 @@ var functionUncurryThisClause = function (fn) {
599
2898
  };
600
2899
 
601
2900
  var uncurryThis$7 = functionUncurryThisClause;
602
- var aCallable$1 = aCallable$2;
2901
+ var aCallable$1 = aCallable$5;
603
2902
  var NATIVE_BIND = functionBindNative;
604
2903
 
605
2904
  var bind$3 = uncurryThis$7(uncurryThis$7.bind);
@@ -612,61 +2911,7 @@ var functionBindContext = function (fn, that) {
612
2911
  };
613
2912
  };
614
2913
 
615
- var makeBuiltIn = makeBuiltInExports;
616
- var defineProperty = objectDefineProperty;
617
-
618
- var defineBuiltInAccessor$3 = function (target, name, descriptor) {
619
- if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
620
- if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
621
- return defineProperty.f(target, name, descriptor);
622
- };
623
-
624
- var isPrototypeOf = objectIsPrototypeOf;
625
-
626
- var $TypeError$2 = TypeError;
627
-
628
- var anInstance$2 = function (it, Prototype) {
629
- if (isPrototypeOf(Prototype, it)) return it;
630
- throw new $TypeError$2('Incorrect invocation');
631
- };
632
-
633
- var call$4 = functionCall;
634
- var anObject$3 = anObject$4;
635
- var getMethod$1 = getMethod$2;
636
-
637
- var iteratorClose$1 = function (iterator, kind, value) {
638
- var innerResult, innerError;
639
- anObject$3(iterator);
640
- try {
641
- innerResult = getMethod$1(iterator, 'return');
642
- if (!innerResult) {
643
- if (kind === 'throw') throw value;
644
- return value;
645
- }
646
- innerResult = call$4(innerResult, iterator);
647
- } catch (error) {
648
- innerError = true;
649
- innerResult = error;
650
- }
651
- if (kind === 'throw') throw value;
652
- if (innerError) throw innerResult;
653
- anObject$3(innerResult);
654
- return value;
655
- };
656
-
657
- var anObject$2 = anObject$4;
658
- var iteratorClose = iteratorClose$1;
659
-
660
- // call something on iterator step with safe closing on error
661
- var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) {
662
- try {
663
- return ENTRIES ? fn(anObject$2(value)[0], value[1]) : fn(value);
664
- } catch (error) {
665
- iteratorClose(iterator, 'throw', error);
666
- }
667
- };
668
-
669
- var wellKnownSymbol$2 = wellKnownSymbol$4;
2914
+ var wellKnownSymbol$2 = wellKnownSymbol$e;
670
2915
  var Iterators$1 = iterators;
671
2916
 
672
2917
  var ITERATOR$2 = wellKnownSymbol$2('iterator');
@@ -678,11 +2923,11 @@ var isArrayIteratorMethod$1 = function (it) {
678
2923
  };
679
2924
 
680
2925
  var uncurryThis$6 = functionUncurryThis;
681
- var fails = fails$2;
682
- var isCallable$1 = isCallable$2;
683
- var classof$2 = classof$3;
684
- var getBuiltIn = getBuiltIn$1;
685
- var inspectSource = inspectSource$1;
2926
+ var fails = fails$g;
2927
+ var isCallable$1 = isCallable$j;
2928
+ var classof$2 = classof$5;
2929
+ var getBuiltIn = getBuiltIn$5;
2930
+ var inspectSource = inspectSource$2;
686
2931
 
687
2932
  var noop = function () { /* empty */ };
688
2933
  var construct = getBuiltIn('Reflect', 'construct');
@@ -729,20 +2974,11 @@ var isConstructor$1 = !construct || fails(function () {
729
2974
  || called;
730
2975
  }) ? isConstructorLegacy : isConstructorModern;
731
2976
 
732
- var DESCRIPTORS$4 = descriptors;
733
- var definePropertyModule = objectDefineProperty;
734
- var createPropertyDescriptor$1 = createPropertyDescriptor$2;
735
-
736
- var createProperty$1 = function (object, key, value) {
737
- if (DESCRIPTORS$4) definePropertyModule.f(object, key, createPropertyDescriptor$1(0, value));
738
- else object[key] = value;
739
- };
740
-
741
- var classof$1 = classof$3;
742
- var getMethod = getMethod$2;
743
- var isNullOrUndefined = isNullOrUndefined$1;
2977
+ var classof$1 = classof$5;
2978
+ var getMethod = getMethod$4;
2979
+ var isNullOrUndefined = isNullOrUndefined$3;
744
2980
  var Iterators = iterators;
745
- var wellKnownSymbol$1 = wellKnownSymbol$4;
2981
+ var wellKnownSymbol$1 = wellKnownSymbol$e;
746
2982
 
747
2983
  var ITERATOR$1 = wellKnownSymbol$1('iterator');
748
2984
 
@@ -753,9 +2989,9 @@ var getIteratorMethod$3 = function (it) {
753
2989
  };
754
2990
 
755
2991
  var call$3 = functionCall;
756
- var aCallable = aCallable$2;
757
- var anObject$1 = anObject$4;
758
- var tryToString = tryToString$1;
2992
+ var aCallable = aCallable$5;
2993
+ var anObject$1 = anObject$c;
2994
+ var tryToString = tryToString$2;
759
2995
  var getIteratorMethod$2 = getIteratorMethod$3;
760
2996
 
761
2997
  var $TypeError$1 = TypeError;
@@ -768,12 +3004,12 @@ var getIterator$2 = function (argument, usingIterator) {
768
3004
 
769
3005
  var bind$2 = functionBindContext;
770
3006
  var call$2 = functionCall;
771
- var toObject = toObject$1;
772
- var callWithSafeIterationClosing = callWithSafeIterationClosing$1;
3007
+ var toObject = toObject$4;
3008
+ var callWithSafeIterationClosing = callWithSafeIterationClosing$2;
773
3009
  var isArrayIteratorMethod = isArrayIteratorMethod$1;
774
3010
  var isConstructor = isConstructor$1;
775
- var lengthOfArrayLike = lengthOfArrayLike$1;
776
- var createProperty = createProperty$1;
3011
+ var lengthOfArrayLike = lengthOfArrayLike$2;
3012
+ var createProperty = createProperty$2;
777
3013
  var getIterator$1 = getIterator$2;
778
3014
  var getIteratorMethod$1 = getIteratorMethod$3;
779
3015
 
@@ -1000,7 +3236,7 @@ var validateArgumentsLength$4 = function (passed, required) {
1000
3236
  return passed;
1001
3237
  };
1002
3238
 
1003
- var global$2 = global$3;
3239
+ var global$3 = global$f;
1004
3240
  var DESCRIPTORS$3 = descriptors;
1005
3241
 
1006
3242
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
@@ -1008,19 +3244,12 @@ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1008
3244
 
1009
3245
  // Avoid NodeJS experimental warning
1010
3246
  var safeGetBuiltIn$1 = function (name) {
1011
- if (!DESCRIPTORS$3) return global$2[name];
1012
- var descriptor = getOwnPropertyDescriptor(global$2, name);
3247
+ if (!DESCRIPTORS$3) return global$3[name];
3248
+ var descriptor = getOwnPropertyDescriptor(global$3, name);
1013
3249
  return descriptor && descriptor.value;
1014
3250
  };
1015
3251
 
1016
- var defineBuiltIn$4 = defineBuiltIn$5;
1017
-
1018
- var defineBuiltIns$1 = function (target, src, options) {
1019
- for (var key in src) defineBuiltIn$4(target, key, src[key], options);
1020
- return target;
1021
- };
1022
-
1023
- var arraySlice$1 = arraySlice$2;
3252
+ var arraySlice$1 = arraySlice$3;
1024
3253
 
1025
3254
  var floor$1 = Math.floor;
1026
3255
 
@@ -1065,33 +3294,33 @@ var arraySort$1 = sort;
1065
3294
  // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
1066
3295
 
1067
3296
  var $$2 = _export;
1068
- var global$1 = global$3;
3297
+ var global$2 = global$f;
1069
3298
  var safeGetBuiltIn = safeGetBuiltIn$1;
1070
3299
  var call$1 = functionCall;
1071
3300
  var uncurryThis$4 = functionUncurryThis;
1072
3301
  var DESCRIPTORS$2 = descriptors;
1073
3302
  var USE_NATIVE_URL$1 = urlConstructorDetection;
1074
- var defineBuiltIn$3 = defineBuiltIn$5;
1075
- var defineBuiltInAccessor$2 = defineBuiltInAccessor$3;
1076
- var defineBuiltIns = defineBuiltIns$1;
1077
- var setToStringTag$1 = setToStringTag$2;
3303
+ var defineBuiltIn$3 = defineBuiltIn$9;
3304
+ var defineBuiltInAccessor$2 = defineBuiltInAccessor$4;
3305
+ var defineBuiltIns = defineBuiltIns$2;
3306
+ var setToStringTag$1 = setToStringTag$5;
1078
3307
  var createIteratorConstructor = iteratorCreateConstructor;
1079
3308
  var InternalStateModule$1 = internalState;
1080
- var anInstance$1 = anInstance$2;
1081
- var isCallable = isCallable$2;
3309
+ var anInstance$1 = anInstance$3;
3310
+ var isCallable = isCallable$j;
1082
3311
  var hasOwn$1 = hasOwnProperty_1;
1083
3312
  var bind$1 = functionBindContext;
1084
- var classof = classof$3;
1085
- var anObject = anObject$4;
1086
- var isObject = isObject$1;
1087
- var $toString$1 = toString$4;
3313
+ var classof = classof$5;
3314
+ var anObject = anObject$c;
3315
+ var isObject = isObject$9;
3316
+ var $toString$1 = toString$5;
1088
3317
  var create = objectCreate;
1089
- var createPropertyDescriptor = createPropertyDescriptor$2;
3318
+ var createPropertyDescriptor = createPropertyDescriptor$5;
1090
3319
  var getIterator = getIterator$2;
1091
3320
  var getIteratorMethod = getIteratorMethod$3;
1092
- var createIterResultObject = createIterResultObject$2;
3321
+ var createIterResultObject = createIterResultObject$4;
1093
3322
  var validateArgumentsLength$3 = validateArgumentsLength$4;
1094
- var wellKnownSymbol = wellKnownSymbol$4;
3323
+ var wellKnownSymbol = wellKnownSymbol$e;
1095
3324
  var arraySort = arraySort$1;
1096
3325
 
1097
3326
  var ITERATOR = wellKnownSymbol('iterator');
@@ -1106,10 +3335,10 @@ var NativeRequest = safeGetBuiltIn('Request');
1106
3335
  var Headers = safeGetBuiltIn('Headers');
1107
3336
  var RequestPrototype = NativeRequest && NativeRequest.prototype;
1108
3337
  var HeadersPrototype = Headers && Headers.prototype;
1109
- var RegExp$1 = global$1.RegExp;
1110
- var TypeError$2 = global$1.TypeError;
1111
- var decodeURIComponent = global$1.decodeURIComponent;
1112
- var encodeURIComponent$1 = global$1.encodeURIComponent;
3338
+ var RegExp$1 = global$2.RegExp;
3339
+ var TypeError$2 = global$2.TypeError;
3340
+ var decodeURIComponent = global$2.decodeURIComponent;
3341
+ var encodeURIComponent$1 = global$2.encodeURIComponent;
1113
3342
  var charAt$1 = uncurryThis$4(''.charAt);
1114
3343
  var join$1 = uncurryThis$4([].join);
1115
3344
  var push$2 = uncurryThis$4([].push);
@@ -1483,20 +3712,20 @@ var web_urlSearchParams_constructor = {
1483
3712
  var $$1 = _export;
1484
3713
  var DESCRIPTORS$1 = descriptors;
1485
3714
  var USE_NATIVE_URL = urlConstructorDetection;
1486
- var global = global$3;
3715
+ var global$1 = global$f;
1487
3716
  var bind = functionBindContext;
1488
3717
  var uncurryThis$3 = functionUncurryThis;
1489
- var defineBuiltIn$2 = defineBuiltIn$5;
1490
- var defineBuiltInAccessor$1 = defineBuiltInAccessor$3;
1491
- var anInstance = anInstance$2;
3718
+ var defineBuiltIn$2 = defineBuiltIn$9;
3719
+ var defineBuiltInAccessor$1 = defineBuiltInAccessor$4;
3720
+ var anInstance = anInstance$3;
1492
3721
  var hasOwn = hasOwnProperty_1;
1493
3722
  var assign = objectAssign;
1494
3723
  var arrayFrom = arrayFrom$1;
1495
- var arraySlice = arraySlice$2;
3724
+ var arraySlice = arraySlice$3;
1496
3725
  var codeAt = stringMultibyte.codeAt;
1497
3726
  var toASCII = stringPunycodeToAscii;
1498
- var $toString = toString$4;
1499
- var setToStringTag = setToStringTag$2;
3727
+ var $toString = toString$5;
3728
+ var setToStringTag = setToStringTag$5;
1500
3729
  var validateArgumentsLength$2 = validateArgumentsLength$4;
1501
3730
  var URLSearchParamsModule = web_urlSearchParams_constructor;
1502
3731
  var InternalStateModule = internalState;
@@ -1506,9 +3735,9 @@ var getInternalURLState = InternalStateModule.getterFor('URL');
1506
3735
  var URLSearchParams$1 = URLSearchParamsModule.URLSearchParams;
1507
3736
  var getInternalSearchParamsState = URLSearchParamsModule.getState;
1508
3737
 
1509
- var NativeURL = global.URL;
1510
- var TypeError$1 = global.TypeError;
1511
- var parseInt = global.parseInt;
3738
+ var NativeURL = global$1.URL;
3739
+ var TypeError$1 = global$1.TypeError;
3740
+ var parseInt = global$1.parseInt;
1512
3741
  var floor = Math.floor;
1513
3742
  var pow = Math.pow;
1514
3743
  var charAt = uncurryThis$3(''.charAt);
@@ -2537,9 +4766,9 @@ $({ target: 'URL', proto: true, enumerable: true }, {
2537
4766
  }
2538
4767
  });
2539
4768
 
2540
- var defineBuiltIn$1 = defineBuiltIn$5;
4769
+ var defineBuiltIn$1 = defineBuiltIn$9;
2541
4770
  var uncurryThis$2 = functionUncurryThis;
2542
- var toString$1 = toString$4;
4771
+ var toString$1 = toString$5;
2543
4772
  var validateArgumentsLength$1 = validateArgumentsLength$4;
2544
4773
 
2545
4774
  var $URLSearchParams$1 = URLSearchParams;
@@ -2586,9 +4815,9 @@ if (params$1 + '' !== 'a=2') {
2586
4815
  }, { enumerable: true, unsafe: true });
2587
4816
  }
2588
4817
 
2589
- var defineBuiltIn = defineBuiltIn$5;
4818
+ var defineBuiltIn = defineBuiltIn$9;
2590
4819
  var uncurryThis$1 = functionUncurryThis;
2591
- var toString = toString$4;
4820
+ var toString = toString$5;
2592
4821
  var validateArgumentsLength = validateArgumentsLength$4;
2593
4822
 
2594
4823
  var $URLSearchParams = URLSearchParams;
@@ -2616,7 +4845,7 @@ if (params.has('a', 2) || !params.has('a', undefined)) {
2616
4845
 
2617
4846
  var DESCRIPTORS = descriptors;
2618
4847
  var uncurryThis = functionUncurryThis;
2619
- var defineBuiltInAccessor = defineBuiltInAccessor$3;
4848
+ var defineBuiltInAccessor = defineBuiltInAccessor$4;
2620
4849
 
2621
4850
  var URLSearchParamsPrototype = URLSearchParams.prototype;
2622
4851
  var forEach = uncurryThis(URLSearchParamsPrototype.forEach);
@@ -2635,67 +4864,21 @@ if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) {
2635
4864
  });
2636
4865
  }
2637
4866
 
2638
- const DEFAULT_TINYMCE_CONFIG = {
2639
- inline: true,
2640
- menubar: false,
2641
- powerpaste_html_import: 'clean',
2642
- powerpaste_word_import: 'clean',
2643
- suffix: '.min',
2644
- valid_styles: {
2645
- '*': 'font-size,font-family,color,text-decoration,text-align'
2646
- }
2647
- };
4867
+ const DEFAULT_TINYMCE_CONFIG = Object.assign({}, __DEFAULT_TINYMCE_CONFIG__, {
4868
+ licenseKey: 'gpl' // Using self-hosted license key
4869
+ });
2648
4870
  const TINYMCE_CONFIG = {
2649
- full: Object.assign({}, DEFAULT_TINYMCE_CONFIG, {
2650
- plugins: 'link lists autolink charmap',
2651
- toolbar: ['styleselect undo redo | bold italic underline | forecolor backcolor | alignleft aligncenter alignright alignfull | numlist bullist outdent indent | hr charmap removeformat | link'],
2652
- style_formats: [{
2653
- title: 'Paragraph',
2654
- format: 'p'
2655
- }, {
2656
- title: 'Header 1',
2657
- format: 'h1'
2658
- }, {
2659
- title: 'Header 2',
2660
- format: 'h2'
2661
- }, {
2662
- title: 'Header 3',
2663
- format: 'h3'
2664
- }, {
2665
- title: 'Header 4',
2666
- format: 'h4'
2667
- }, {
2668
- title: 'Header 5',
2669
- format: 'h5'
2670
- }, {
2671
- title: 'Header 6',
2672
- format: 'h6'
2673
- }, {
2674
- title: 'Pre',
2675
- format: 'pre'
2676
- }, {
2677
- title: 'Code',
2678
- format: 'code'
2679
- }]
2680
- }),
2681
- plain: Object.assign({}, DEFAULT_TINYMCE_CONFIG, {
2682
- plugins: '',
2683
- toolbar: ''
2684
- }),
2685
- minimal: Object.assign({}, DEFAULT_TINYMCE_CONFIG, {
2686
- plugins: 'link autolink',
2687
- toolbar: 'bold italic underline | link',
2688
- valid_elements: 'strong,em,span[style],a[href]'
2689
- })
2690
- };
2691
-
2692
- const MCE_URL = '/ext/tinymcev7/tinymce.min.js';
4871
+ full: Object.assign({}, DEFAULT_TINYMCE_CONFIG, __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__.full),
4872
+ plain: Object.assign({}, DEFAULT_TINYMCE_CONFIG, __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__.plain),
4873
+ minimal: Object.assign({}, DEFAULT_TINYMCE_CONFIG, __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__.minimal)
4874
+ };
4875
+
2693
4876
  /**
2694
4877
  * Allows inline edit content pulled from dotCMS API using TinyMCE editor
2695
4878
  *
2696
4879
  * @export
2697
4880
  * @component
2698
- * @param {Readonly<DotEditableTextProps>} props {
4881
+ * @param {Readonly<DotCMSEditableTextProps>} props {
2699
4882
  * mode = 'plain',
2700
4883
  * format = 'text',
2701
4884
  * contentlet,
@@ -2703,11 +4886,11 @@ const MCE_URL = '/ext/tinymcev7/tinymce.min.js';
2703
4886
  * }
2704
4887
  * @example
2705
4888
  * ```javascript
2706
- * import { DotEditableText } from '@dotcms/react';
4889
+ * import { DotCMSEditableText } from '@dotcms/react';
2707
4890
  *
2708
4891
  * const MyContentletWithTitle = ({ contentlet }) => (
2709
4892
  * <h2>
2710
- * <DotEditableText
4893
+ * <DotCMSEditableText
2711
4894
  * contentlet={contentlet}
2712
4895
  * fieldName="title"
2713
4896
  * mode='full'
@@ -2717,37 +4900,45 @@ const MCE_URL = '/ext/tinymcev7/tinymce.min.js';
2717
4900
  * ```
2718
4901
  * @returns {JSX.Element} A component to edit content inline
2719
4902
  */
2720
- function DotEditableText({
4903
+ function DotCMSEditableText({
2721
4904
  mode = 'plain',
2722
4905
  format = 'text',
2723
4906
  contentlet,
2724
- fieldName = ''
4907
+ fieldName
2725
4908
  }) {
2726
4909
  const editorRef = useRef(null);
2727
4910
  const [scriptSrc, setScriptSrc] = useState('');
2728
- const [isInsideEditor$1, setIsInsideEditor] = useState(false);
4911
+ const [initEditor, setInitEditor] = useState(false);
2729
4912
  const [content, setContent] = useState((contentlet == null ? void 0 : contentlet[fieldName]) || '');
2730
4913
  useEffect(() => {
2731
- var _editorRef$current;
2732
- setIsInsideEditor(isInsideEditor());
4914
+ setContent((contentlet == null ? void 0 : contentlet[fieldName]) || '');
4915
+ }, [fieldName, contentlet]);
4916
+ useEffect(() => {
4917
+ var _state$dotCMSHost, _editorRef$current;
4918
+ const state = getUVEState();
4919
+ setInitEditor((state == null ? void 0 : state.mode) === UVE_MODE.EDIT && !!(state != null && (_state$dotCMSHost = state.dotCMSHost) != null && _state$dotCMSHost.length));
2733
4920
  if (!contentlet || !fieldName) {
2734
- console.error('DotEditableText: contentlet or fieldName is missing');
2735
- console.error('Ensure that all needed props are passed to view and edit the content');
4921
+ console.error('[DotCMSEditableText]: contentlet or fieldName is missing', 'Ensure that all needed props are passed to view and edit the content');
4922
+ return;
4923
+ }
4924
+ if (state && state.mode !== UVE_MODE.EDIT) {
4925
+ console.warn('[DotCMSEditableText]: TinyMCE is not available in the current mode');
2736
4926
  return;
2737
4927
  }
2738
- if (!isInsideEditor()) {
4928
+ if (!(state != null && state.dotCMSHost)) {
4929
+ console.warn('[DotCMSEditableText]: The `dotCMSHost` parameter is not defined. Check that the UVE is sending the correct parameters.');
2739
4930
  return;
2740
4931
  }
2741
- const createURL = new URL(MCE_URL, DotCmsClient.dotcmsUrl);
4932
+ const createURL = new URL(__TINYMCE_PATH_ON_DOTCMS__, state.dotCMSHost);
2742
4933
  setScriptSrc(createURL.toString());
2743
4934
  const content = (contentlet == null ? void 0 : contentlet[fieldName]) || '';
2744
4935
  (_editorRef$current = editorRef.current) == null || _editorRef$current.setContent(content, {
2745
4936
  format
2746
4937
  });
2747
- setContent(content);
2748
- }, [format, fieldName, contentlet]);
4938
+ }, [format, fieldName, contentlet, content]);
2749
4939
  useEffect(() => {
2750
- if (!isInsideEditor()) {
4940
+ var _getUVEState;
4941
+ if (((_getUVEState = getUVEState()) == null ? void 0 : _getUVEState.mode) !== UVE_MODE.EDIT) {
2751
4942
  return;
2752
4943
  }
2753
4944
  const onMessage = ({
@@ -2757,7 +4948,7 @@ function DotEditableText({
2757
4948
  name,
2758
4949
  payload
2759
4950
  } = data;
2760
- if (name !== NOTIFY_CLIENT.UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS) {
4951
+ if (name !== __DOTCMS_UVE_EVENT__.UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS) {
2761
4952
  return;
2762
4953
  }
2763
4954
  const {
@@ -2775,7 +4966,7 @@ function DotEditableText({
2775
4966
  return () => {
2776
4967
  window.removeEventListener('message', onMessage);
2777
4968
  };
2778
- }, [contentlet.inode]);
4969
+ }, [contentlet == null ? void 0 : contentlet.inode]);
2779
4970
  const onMouseDown = event => {
2780
4971
  var _editorRef$current3;
2781
4972
  const {
@@ -2785,13 +4976,13 @@ function DotEditableText({
2785
4976
  inode,
2786
4977
  languageId: language
2787
4978
  } = contentlet;
2788
- if (onNumberOfPages <= 1 || (_editorRef$current3 = editorRef.current) != null && _editorRef$current3.hasFocus()) {
4979
+ if (Number(onNumberOfPages) <= 1 || (_editorRef$current3 = editorRef.current) != null && _editorRef$current3.hasFocus()) {
2789
4980
  return;
2790
4981
  }
2791
4982
  event.stopPropagation();
2792
4983
  event.preventDefault();
2793
- postMessageToEditor({
2794
- action: CLIENT_ACTIONS.COPY_CONTENTLET_INLINE_EDITING,
4984
+ sendMessageToUVE({
4985
+ action: DotCMSUVEAction.COPY_CONTENTLET_INLINE_EDITING,
2795
4986
  payload: {
2796
4987
  dataset: {
2797
4988
  inode,
@@ -2813,8 +5004,8 @@ function DotEditableText({
2813
5004
  if (!((_editorRef$current5 = editorRef.current) != null && _editorRef$current5.isDirty()) || !didContentChange(editedContent)) {
2814
5005
  return;
2815
5006
  }
2816
- postMessageToEditor({
2817
- action: CLIENT_ACTIONS.UPDATE_CONTENTLET_INLINE_EDITING,
5007
+ sendMessageToUVE({
5008
+ action: DotCMSUVEAction.UPDATE_CONTENTLET_INLINE_EDITING,
2818
5009
  payload: {
2819
5010
  content: editedContent,
2820
5011
  dataset: {
@@ -2828,7 +5019,7 @@ function DotEditableText({
2828
5019
  const didContentChange = editedContent => {
2829
5020
  return content !== editedContent;
2830
5021
  };
2831
- if (!isInsideEditor$1) {
5022
+ if (!initEditor) {
2832
5023
  // We can let the user pass the Child Component and create a root to get the HTML for the editor
2833
5024
  return jsx("span", {
2834
5025
  dangerouslySetInnerHTML: {
@@ -2836,52 +5027,23 @@ function DotEditableText({
2836
5027
  }
2837
5028
  });
2838
5029
  }
2839
- return jsx(Editor, {
2840
- tinymceScriptSrc: scriptSrc,
2841
- inline: true,
2842
- onInit: (_, editor) => editorRef.current = editor,
2843
- init: TINYMCE_CONFIG[mode],
2844
- initialValue: content,
2845
- onMouseDown: onMouseDown,
2846
- onFocusOut: onFocusOut
5030
+ return jsx("div", {
5031
+ style: {
5032
+ outline: '2px solid #006ce7',
5033
+ borderRadius: '4px'
5034
+ },
5035
+ children: jsx(Editor, {
5036
+ tinymceScriptSrc: scriptSrc,
5037
+ inline: true,
5038
+ onInit: (_, editor) => editorRef.current = editor,
5039
+ init: TINYMCE_CONFIG[mode],
5040
+ initialValue: content,
5041
+ onMouseDown: onMouseDown,
5042
+ onFocusOut: onFocusOut
5043
+ })
2847
5044
  });
2848
5045
  }
2849
5046
 
2850
- /**
2851
- * `useDotcmsPageContext` is a custom React hook that provides access to the `PageProviderContext`.
2852
- * It takes no parameters and returns the context value or `null` if it's not available.
2853
- *
2854
- * @category Hooks
2855
- * @returns {DotCMSPageContext | null} - The context value or `null` if it's not available.
2856
- */
2857
- function useDotcmsPageContext() {
2858
- return useContext(PageContext);
2859
- }
2860
-
2861
- /**
2862
- * Represents the different types of Blocks that can be used in the Block Editor
2863
- *
2864
- * @export
2865
- * @enum {number}
2866
- */
2867
- var Blocks;
2868
- (function (Blocks) {
2869
- Blocks["PARAGRAPH"] = "paragraph";
2870
- Blocks["HEADING"] = "heading";
2871
- Blocks["TEXT"] = "text";
2872
- Blocks["BULLET_LIST"] = "bulletList";
2873
- Blocks["ORDERED_LIST"] = "orderedList";
2874
- Blocks["LIST_ITEM"] = "listItem";
2875
- Blocks["BLOCK_QUOTE"] = "blockquote";
2876
- Blocks["CODE_BLOCK"] = "codeBlock";
2877
- Blocks["HARDBREAK"] = "hardBreak";
2878
- Blocks["HORIZONTAL_RULE"] = "horizontalRule";
2879
- Blocks["DOT_IMAGE"] = "dotImage";
2880
- Blocks["DOT_VIDEO"] = "dotVideo";
2881
- Blocks["TABLE"] = "table";
2882
- Blocks["DOT_CONTENT"] = "dotContent";
2883
- })(Blocks || (Blocks = {}));
2884
-
2885
5047
  /**
2886
5048
  * Renders a code block component.
2887
5049
  *
@@ -2890,10 +5052,11 @@ var Blocks;
2890
5052
  * @returns The rendered code block component.
2891
5053
  */
2892
5054
  const CodeBlock = ({
2893
- attrs,
5055
+ node,
2894
5056
  children
2895
5057
  }) => {
2896
- const language = (attrs == null ? void 0 : attrs.language) || '';
5058
+ var _node$attrs;
5059
+ const language = (node == null || (_node$attrs = node.attrs) == null ? void 0 : _node$attrs.language) || '';
2897
5060
  return jsx("pre", {
2898
5061
  "data-language": language,
2899
5062
  children: jsx("code", {
@@ -2915,63 +5078,100 @@ const BlockQuote = ({
2915
5078
  });
2916
5079
  };
2917
5080
 
2918
- function _objectWithoutPropertiesLoose(r, e) {
2919
- if (null == r) return {};
2920
- var t = {};
2921
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
2922
- if (e.includes(n)) continue;
2923
- t[n] = r[n];
2924
- }
2925
- return t;
2926
- }
5081
+ const NoComponentProvided = ({
5082
+ contentType
5083
+ }) => {
5084
+ const style = {
5085
+ backgroundColor: '#fffaf0',
5086
+ color: '#333',
5087
+ padding: '1rem',
5088
+ borderRadius: '0.5rem',
5089
+ marginBottom: '1rem',
5090
+ marginTop: '1rem',
5091
+ border: '1px solid #ed8936'
5092
+ };
5093
+ return jsxs("div", {
5094
+ "data-testid": "no-component-provided",
5095
+ style: style,
5096
+ children: [jsx("strong", {
5097
+ style: {
5098
+ color: '#c05621'
5099
+ },
5100
+ children: "Dev Warning"
5101
+ }), ": No component or custom renderer provided for content type", jsx("strong", {
5102
+ style: {
5103
+ color: '#c05621'
5104
+ },
5105
+ children: contentType || 'Unknown'
5106
+ }), ".", jsx("br", {}), "Please refer to the", jsx("a", {
5107
+ href: "https://dev.dotcms.com/docs/block-editor",
5108
+ target: "_blank",
5109
+ rel: "noopener noreferrer",
5110
+ style: {
5111
+ color: '#c05621'
5112
+ },
5113
+ children: "Block Editor Custom Renderers Documentation"
5114
+ }), ' ', "for guidance."]
5115
+ });
5116
+ };
2927
5117
 
2928
- const _excluded = ["customRenderers"];
2929
- /**
2930
- * Renders the default content for an unknown content type.
2931
- */
2932
- const DefaultContent = () => jsx("div", {
2933
- children: "Unknown Content Type"
2934
- });
5118
+ const DOT_CONTENT_NO_DATA_MESSAGE = '[DotCMSBlockEditorRenderer]: No data provided for Contentlet Block. Try to add a contentlet to the block editor. If the error persists, please contact the DotCMS support team.';
5119
+ const DOT_CONTENT_NO_MATCHING_COMPONENT_MESSAGE = contentType => `[DotCMSBlockEditorRenderer]: No matching component found for content type: ${contentType}. Provide a custom renderer for this content type to fix this error.`;
2935
5120
  /**
2936
5121
  * Renders a DotContent component.
2937
5122
  *
2938
5123
  * @param {DotContentProps} props - The props for the DotContent component.
2939
5124
  * @returns {JSX.Element} The rendered DotContent component.
2940
5125
  */
2941
- const DotContent = _ref => {
2942
- var _customRenderers$data;
2943
- let {
2944
- customRenderers
2945
- } = _ref,
2946
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
5126
+ const DotContent = ({
5127
+ customRenderers,
5128
+ node
5129
+ }) => {
5130
+ const isDevMode = useIsDevMode();
2947
5131
  const {
2948
- attrs
2949
- } = props;
2950
- const data = attrs == null ? void 0 : attrs.data;
2951
- const Component = (_customRenderers$data = customRenderers == null ? void 0 : customRenderers[data == null ? void 0 : data.contentType]) != null ? _customRenderers$data : DefaultContent;
5132
+ attrs = {}
5133
+ } = node;
5134
+ const {
5135
+ data
5136
+ } = attrs;
2952
5137
  if (!data) {
2953
- console.error('DotContent: No data provided');
5138
+ console.error(DOT_CONTENT_NO_DATA_MESSAGE);
5139
+ return null;
5140
+ }
5141
+ const {
5142
+ contentType = 'Unknown Content Type'
5143
+ } = data;
5144
+ const Component = customRenderers[contentType];
5145
+ /* In dev mode, show a helpful message for unknown content types */
5146
+ if (isDevMode && !Component) {
5147
+ return jsx(NoComponentProvided, {
5148
+ contentType: contentType
5149
+ });
5150
+ }
5151
+ /* In production, use default component if no matching component found */
5152
+ if (!Component) {
5153
+ console.warn(DOT_CONTENT_NO_MATCHING_COMPONENT_MESSAGE(contentType));
5154
+ return null;
2954
5155
  }
2955
- return jsx(Component, Object.assign({}, props));
5156
+ return jsx(Component, Object.assign({}, node));
2956
5157
  };
2957
5158
 
2958
5159
  /**
2959
5160
  * Renders an image component for dotCMS.
2960
5161
  *
2961
- * @param props - The props for the DotCMSImage component.
5162
+ * @param node - The node for the DotCMSImage component.
2962
5163
  * @returns The rendered image component.
2963
5164
  */
2964
- const DotCMSImage = props => {
5165
+ const DotCMSImage = ({
5166
+ node
5167
+ }) => {
2965
5168
  const {
2966
- data,
2967
5169
  src,
2968
5170
  alt
2969
- } = props.attrs;
2970
- const client = DotCmsClient.instance;
2971
- const srcUrl = data != null && data.identifier ? `${client.dotcmsUrl}${src}` : src;
5171
+ } = node.attrs;
2972
5172
  return jsx("img", {
2973
5173
  alt: alt,
2974
- src: srcUrl
5174
+ src: src
2975
5175
  });
2976
5176
  };
2977
5177
 
@@ -3027,8 +5227,9 @@ const TableRenderer = ({
3027
5227
  }) => {
3028
5228
  const BlockEditorItemComponent = blockEditorItem;
3029
5229
  const renderTableContent = node => {
5230
+ var _node$content;
3030
5231
  return jsx(BlockEditorItemComponent, {
3031
- content: node.content
5232
+ content: (_node$content = node.content) != null ? _node$content : []
3032
5233
  });
3033
5234
  };
3034
5235
  return jsxs("table", {
@@ -3113,8 +5314,9 @@ const Underline = ({
3113
5314
  */
3114
5315
  const Paragraph = ({
3115
5316
  children,
3116
- attrs
5317
+ node
3117
5318
  }) => {
5319
+ const attrs = (node == null ? void 0 : node.attrs) || {};
3118
5320
  return jsx("p", {
3119
5321
  style: attrs,
3120
5322
  children: children
@@ -3144,9 +5346,10 @@ const Link = ({
3144
5346
  */
3145
5347
  const Heading = ({
3146
5348
  children,
3147
- attrs
5349
+ node
3148
5350
  }) => {
3149
- const level = (attrs == null ? void 0 : attrs.level) || 1;
5351
+ const attrs = (node == null ? void 0 : node.attrs) || {};
5352
+ const level = attrs.level || 1;
3150
5353
  const Tag = `h${level}`;
3151
5354
  return jsx(Tag, {
3152
5355
  children: children
@@ -3173,13 +5376,17 @@ const Subscript = ({
3173
5376
  children: children
3174
5377
  });
3175
5378
  const nodeMarks = {
3176
- link: Link,
3177
5379
  bold: Bold,
3178
- underline: Underline,
5380
+ link: Link,
3179
5381
  italic: Italic,
3180
5382
  strike: Strike,
3181
- superscript: Superscript,
3182
- subscript: Subscript
5383
+ subscript: Subscript,
5384
+ underline: Underline,
5385
+ superscript: Superscript
5386
+ };
5387
+ const defaultMark = {
5388
+ type: '',
5389
+ attrs: {}
3183
5390
  };
3184
5391
  /**
3185
5392
  * Renders a text block with optional marks.
@@ -3187,20 +5394,17 @@ const nodeMarks = {
3187
5394
  * @param props - The props for the TextBlock component.
3188
5395
  * @returns The rendered text block.
3189
5396
  */
3190
- const TextBlock = props => {
5397
+ const TextBlock = (props = {}) => {
3191
5398
  const {
3192
5399
  marks = [],
3193
5400
  text
3194
5401
  } = props;
3195
- const mark = marks[0] || {
3196
- type: '',
3197
- attrs: {}
3198
- };
3199
- const newProps = Object.assign({}, props, {
5402
+ const mark = marks[0] || defaultMark;
5403
+ const textProps = Object.assign({}, props, {
3200
5404
  marks: marks.slice(1)
3201
5405
  });
3202
5406
  const Component = nodeMarks[mark == null ? void 0 : mark.type];
3203
- // To avoid the warning: "Warning: Invalid DOM property `class`. Did you mean `className`?"
5407
+ // In React, class is not a valid attribute name, so we need to rename it to className
3204
5408
  if (mark.attrs) {
3205
5409
  mark.attrs.className = mark.attrs.class;
3206
5410
  delete mark.attrs.class;
@@ -3209,8 +5413,9 @@ const TextBlock = props => {
3209
5413
  return text;
3210
5414
  }
3211
5415
  return jsx(Component, {
5416
+ type: mark.type,
3212
5417
  attrs: mark.attrs,
3213
- children: jsx(TextBlock, Object.assign({}, newProps))
5418
+ children: jsx(TextBlock, Object.assign({}, textProps))
3214
5419
  });
3215
5420
  };
3216
5421
 
@@ -3220,34 +5425,37 @@ const TextBlock = props => {
3220
5425
  * @param props - The properties for the video component.
3221
5426
  * @returns The rendered video component.
3222
5427
  */
3223
- const DotCMSVideo = props => {
5428
+ const DotCMSVideo = ({
5429
+ node
5430
+ }) => {
3224
5431
  const {
3225
5432
  data,
3226
5433
  src,
3227
5434
  mimeType,
3228
5435
  width,
3229
5436
  height
3230
- } = props.attrs;
3231
- const client = DotCmsClient.instance;
3232
- const srcUrl = data != null && data.identifier ? `${client.dotcmsUrl}${src}` : src;
3233
- const poster = data != null && data.thumbnail ? `${client.dotcmsUrl}${data == null ? void 0 : data.thumbnail}` : 'poster-image.jpg';
3234
- return jsxs("video", {
5437
+ } = node.attrs;
5438
+ const poster = data == null ? void 0 : data.thumbnail;
5439
+ const posterAttribute = poster ? {
5440
+ poster
5441
+ } : {};
5442
+ return jsxs("video", Object.assign({
3235
5443
  controls: true,
3236
5444
  preload: "metadata",
3237
- poster: poster,
3238
5445
  width: width,
3239
- height: height,
5446
+ height: height
5447
+ }, posterAttribute, {
3240
5448
  children: [jsx("track", {
3241
5449
  default: true,
3242
5450
  kind: "captions",
3243
5451
  srcLang: "en"
3244
5452
  }), jsx("source", {
3245
- src: srcUrl,
5453
+ src: src,
3246
5454
  type: mimeType
3247
5455
  }), "Your browser does not support the ", jsx("code", {
3248
5456
  children: "video"
3249
5457
  }), " element."]
3250
- });
5458
+ }));
3251
5459
  };
3252
5460
 
3253
5461
  /**
@@ -3261,167 +5469,166 @@ const BlockEditorBlock = ({
3261
5469
  content,
3262
5470
  customRenderers
3263
5471
  }) => {
5472
+ if (!content) {
5473
+ return null;
5474
+ }
3264
5475
  return content == null ? void 0 : content.map((node, index) => {
5476
+ var _node$content;
3265
5477
  const CustomRendererComponent = customRenderers == null ? void 0 : customRenderers[node.type];
5478
+ const key = `${node.type}-${index}`;
3266
5479
  if (CustomRendererComponent) {
3267
- return jsx(CustomRendererComponent, Object.assign({}, node, {
5480
+ return jsx(CustomRendererComponent, {
3268
5481
  content: node.content,
3269
5482
  children: jsx(BlockEditorBlock, {
3270
5483
  content: node.content,
3271
5484
  customRenderers: customRenderers
3272
5485
  })
3273
- }), `${node.type}-${index}`);
5486
+ }, key);
3274
5487
  }
3275
5488
  switch (node.type) {
3276
- case Blocks.PARAGRAPH:
3277
- return jsx(Paragraph, Object.assign({}, node, {
5489
+ case BlockEditorDefaultBlocks.PARAGRAPH:
5490
+ return jsx(Paragraph, {
5491
+ node: node,
3278
5492
  children: jsx(BlockEditorBlock, {
3279
5493
  content: node.content,
3280
5494
  customRenderers: customRenderers
3281
5495
  })
3282
- }), `${node.type}-${index}`);
3283
- case Blocks.HEADING:
3284
- return jsx(Heading, Object.assign({}, node, {
5496
+ }, key);
5497
+ case BlockEditorDefaultBlocks.HEADING:
5498
+ return jsx(Heading, {
5499
+ node: node,
3285
5500
  children: jsx(BlockEditorBlock, {
3286
5501
  content: node.content,
3287
5502
  customRenderers: customRenderers
3288
5503
  })
3289
- }), `${node.type}-${index}`);
3290
- case Blocks.TEXT:
3291
- return jsx(TextBlock, Object.assign({}, node), `${node.type}-${index}`);
3292
- case Blocks.BULLET_LIST:
5504
+ }, key);
5505
+ case BlockEditorDefaultBlocks.TEXT:
5506
+ return jsx(TextBlock, Object.assign({}, node), key);
5507
+ case BlockEditorDefaultBlocks.BULLET_LIST:
3293
5508
  return jsx(BulletList, {
3294
5509
  children: jsx(BlockEditorBlock, {
3295
5510
  content: node.content,
3296
5511
  customRenderers: customRenderers
3297
5512
  })
3298
- }, `${node.type}-${index}`);
3299
- case Blocks.ORDERED_LIST:
5513
+ }, key);
5514
+ case BlockEditorDefaultBlocks.ORDERED_LIST:
3300
5515
  return jsx(OrderedList, {
3301
5516
  children: jsx(BlockEditorBlock, {
3302
5517
  content: node.content,
3303
5518
  customRenderers: customRenderers
3304
5519
  })
3305
- }, `${node.type}-${index}`);
3306
- case Blocks.LIST_ITEM:
5520
+ }, key);
5521
+ case BlockEditorDefaultBlocks.LIST_ITEM:
3307
5522
  return jsx(ListItem, {
3308
5523
  children: jsx(BlockEditorBlock, {
3309
5524
  content: node.content,
3310
5525
  customRenderers: customRenderers
3311
5526
  })
3312
- }, `${node.type}-${index}`);
3313
- case Blocks.BLOCK_QUOTE:
5527
+ }, key);
5528
+ case BlockEditorDefaultBlocks.BLOCK_QUOTE:
3314
5529
  return jsx(BlockQuote, {
3315
5530
  children: jsx(BlockEditorBlock, {
3316
5531
  content: node.content,
3317
5532
  customRenderers: customRenderers
3318
5533
  })
3319
- }, `${node.type}-${index}`);
3320
- case Blocks.CODE_BLOCK:
3321
- return jsx(CodeBlock, Object.assign({}, node, {
5534
+ }, key);
5535
+ case BlockEditorDefaultBlocks.CODE_BLOCK:
5536
+ return jsx(CodeBlock, {
5537
+ node: node,
3322
5538
  children: jsx(BlockEditorBlock, {
3323
5539
  content: node.content,
3324
5540
  customRenderers: customRenderers
3325
5541
  })
3326
- }), `${node.type}-${index}`);
3327
- case Blocks.HARDBREAK:
3328
- return jsx("br", {}, `${node.type}-${index}`);
3329
- case Blocks.HORIZONTAL_RULE:
3330
- return jsx("hr", {}, `${node.type}-${index}`);
3331
- case Blocks.DOT_IMAGE:
3332
- return jsx(DotCMSImage, Object.assign({}, node), `${node.type}-${index}`);
3333
- case Blocks.DOT_VIDEO:
3334
- return jsx(DotCMSVideo, Object.assign({}, node), `${node.type}-${index}`);
3335
- case Blocks.TABLE:
5542
+ }, key);
5543
+ case BlockEditorDefaultBlocks.HARDBREAK:
5544
+ return jsx("br", {}, key);
5545
+ case BlockEditorDefaultBlocks.HORIZONTAL_RULE:
5546
+ return jsx("hr", {}, key);
5547
+ case BlockEditorDefaultBlocks.DOT_IMAGE:
5548
+ return jsx(DotCMSImage, {
5549
+ node: node
5550
+ }, key);
5551
+ case BlockEditorDefaultBlocks.DOT_VIDEO:
5552
+ return jsx(DotCMSVideo, {
5553
+ node: node
5554
+ }, key);
5555
+ case BlockEditorDefaultBlocks.TABLE:
3336
5556
  return jsx(TableRenderer, {
3337
- content: node.content,
5557
+ content: (_node$content = node.content) != null ? _node$content : [],
3338
5558
  blockEditorItem: BlockEditorBlock
3339
- }, `${node.type}-${index}`);
3340
- case Blocks.DOT_CONTENT:
3341
- return jsx(DotContent, Object.assign({}, node, {
3342
- customRenderers: customRenderers
3343
- }), `${node.type}-${index}`);
5559
+ }, key);
5560
+ case BlockEditorDefaultBlocks.DOT_CONTENT:
5561
+ return jsx(DotContent, {
5562
+ customRenderers: customRenderers,
5563
+ node: node
5564
+ }, key);
3344
5565
  default:
3345
- return jsxs("div", {
3346
- children: ["Unknown Block Type ", node.type]
3347
- }, `${node.type}-${index}`);
5566
+ return jsx(UnknownBlock, {
5567
+ node: node
5568
+ }, key);
3348
5569
  }
3349
5570
  });
3350
5571
  };
5572
+ /**
5573
+ * Renders an unknown block type with a warning message in development mode.
5574
+ *
5575
+ * @param node - The block editor node to render.
5576
+ * @returns The rendered block or null if in production mode.
5577
+ */
5578
+ const UnknownBlock = ({
5579
+ node
5580
+ }) => {
5581
+ const style = {
5582
+ backgroundColor: '#fff5f5',
5583
+ color: '#333',
5584
+ padding: '1rem',
5585
+ borderRadius: '0.5rem',
5586
+ marginBottom: '1rem',
5587
+ marginTop: '1rem',
5588
+ border: '1px solid #fc8181'
5589
+ };
5590
+ if (getUVEState()) {
5591
+ return jsxs("div", {
5592
+ style: style,
5593
+ children: [jsx("strong", {
5594
+ style: {
5595
+ color: '#c53030'
5596
+ },
5597
+ children: "Warning:"
5598
+ }), " The block type", ' ', jsx("strong", {
5599
+ children: node.type
5600
+ }), " is not recognized. Please check your", ' ', jsx("a", {
5601
+ href: "https://dev.dotcms.com/docs/block-editor",
5602
+ target: "_blank",
5603
+ rel: "noopener noreferrer",
5604
+ children: "configuration"
5605
+ }), ' ', "or contact support for assistance."]
5606
+ });
5607
+ }
5608
+ return null;
5609
+ };
3351
5610
 
3352
5611
  /**
3353
5612
  * BlockEditorRenderer component for rendering block editor field.
3354
5613
  *
3355
5614
  * @component
3356
5615
  * @param {Object} props - The component props.
3357
- * @param {Block} props.blocks - The blocks of content to render.
5616
+ * @param {BlockEditorContent} props.blocks - The blocks of content to render.
3358
5617
  * @param {CustomRenderer} [props.customRenderers] - Optional custom renderers for specific block types.
3359
5618
  * @param {string} [props.className] - Optional CSS class name for the container div.
3360
5619
  * @param {React.CSSProperties} [props.style] - Optional inline styles for the container div.
3361
- * @param {boolean} props.editable - Flag to enable inline editing. When true, `contentlet` and `fieldName` are required. Note: Enterprise only feature.
3362
- * @param {DotCMSContentlet} [props.contentlet] - Contentlet object for inline editing. Required when `editable` is true.
3363
- * @param {string} [props.fieldName] - Field name for inline editing. Required when `editable` is true.
3364
5620
  * @returns {JSX.Element} A div containing the rendered blocks of content.
3365
5621
  */
3366
- const BlockEditorRenderer = ({
3367
- style,
5622
+ const DotCMSBlockEditorRenderer = ({
3368
5623
  blocks,
3369
- editable,
3370
- fieldName,
5624
+ style,
3371
5625
  className,
3372
- contentlet,
3373
5626
  customRenderers
3374
5627
  }) => {
3375
- const ref = useRef(null);
3376
5628
  const [blockEditorState, setBlockEditorState] = useState({
3377
5629
  error: null
3378
5630
  });
3379
- /**
3380
- * Sets up inline editing functionality when the component is editable and inside the editor.
3381
- *
3382
- * This effect:
3383
- * 1. Checks if inline editing should be enabled based on props and editor context
3384
- * 2. Validates required props for inline editing (contentlet and fieldName)
3385
- * 3. Extracts necessary data from the contentlet
3386
- * 4. Adds a click handler to initialize inline editing with the block editor
3387
- * 5. Cleans up event listener on unmount
3388
- *
3389
- * @dependency {boolean} editable - Flag to enable/disable inline editing
3390
- * @dependency {DotCMSContentlet} contentlet - Contentlet data required for editing
3391
- * @dependency {Block} blocks - The content blocks to edit
3392
- * @dependency {string} fieldName - Name of the field being edited
3393
- */
3394
- useEffect(() => {
3395
- if (!editable || !ref.current || !isInsideEditor()) {
3396
- return;
3397
- }
3398
- // TypeScript will throw an error if contentlet or fieldName are not provided when editable is true,
3399
- // but we need to check them again to avoid runtime errors in Pure JavaScript
3400
- if (!contentlet || !fieldName) {
3401
- console.error('contentlet and fieldName are required to enable inline editing');
3402
- return;
3403
- }
3404
- const {
3405
- inode,
3406
- languageId: language,
3407
- contentType
3408
- } = contentlet;
3409
- // `ContentNode` lives on `@dotcms/react` that's why we can use it in `@dotcms/client`
3410
- // We need to move interfaces to external lib
3411
- const content = blocks;
3412
- const element = ref.current;
3413
- const handleClickEvent = () => {
3414
- initInlineEditing('BLOCK_EDITOR', {
3415
- inode,
3416
- content,
3417
- language,
3418
- fieldName,
3419
- contentType
3420
- });
3421
- };
3422
- element.addEventListener('click', handleClickEvent);
3423
- return () => element.removeEventListener('click', handleClickEvent);
3424
- }, [editable, contentlet, blocks, fieldName]);
5631
+ const isDevMode = useIsDevMode();
3425
5632
  /**
3426
5633
  * Validates the blocks structure and updates the block editor state.
3427
5634
  *
@@ -3441,7 +5648,7 @@ const BlockEditorRenderer = ({
3441
5648
  }, [blocks]);
3442
5649
  if (blockEditorState.error) {
3443
5650
  console.error(blockEditorState.error);
3444
- if (isInsideEditor()) {
5651
+ if (isDevMode) {
3445
5652
  return jsx("div", {
3446
5653
  "data-testid": "invalid-blocks-message",
3447
5654
  children: blockEditorState.error
@@ -3452,7 +5659,6 @@ const BlockEditorRenderer = ({
3452
5659
  return jsx("div", {
3453
5660
  className: className,
3454
5661
  style: style,
3455
- ref: ref,
3456
5662
  "data-testid": "dot-block-editor-container",
3457
5663
  children: jsx(BlockEditorBlock, {
3458
5664
  content: blocks == null ? void 0 : blocks.content,
@@ -3461,4 +5667,4 @@ const BlockEditorRenderer = ({
3461
5667
  });
3462
5668
  };
3463
5669
 
3464
- export { BlockEditorRenderer, DotEditableText, DotcmsLayout, PageProvider, Row, useDotcmsPageContext };
5670
+ export { DotCMSBlockEditorRenderer, DotCMSEditableText, DotCMSLayoutBody, DotCMSShow, useDotCMSShowWhen, useEditableDotCMSPage };