@tiptap/static-renderer 3.0.0-next.1 → 3.0.0-next.5

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 (60) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +1 -1
  3. package/dist/index.cjs +573 -6
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +307 -32
  6. package/dist/index.d.ts +307 -32
  7. package/dist/index.js +552 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/json/html-string/index.cjs +16 -5
  10. package/dist/json/html-string/index.cjs.map +1 -1
  11. package/dist/json/html-string/index.d.cts +18 -22
  12. package/dist/json/html-string/index.d.ts +18 -22
  13. package/dist/json/html-string/index.js +10 -1
  14. package/dist/json/html-string/index.js.map +1 -1
  15. package/dist/json/react/index.cjs +13 -2202
  16. package/dist/json/react/index.cjs.map +1 -1
  17. package/dist/json/react/index.d.cts +5 -22
  18. package/dist/json/react/index.d.ts +5 -22
  19. package/dist/json/react/index.js +10 -2222
  20. package/dist/json/react/index.js.map +1 -1
  21. package/dist/json/renderer.cjs.map +1 -1
  22. package/dist/json/renderer.d.cts +5 -21
  23. package/dist/json/renderer.d.ts +5 -21
  24. package/dist/json/renderer.js.map +1 -1
  25. package/dist/pm/html-string/index.cjs +22 -37
  26. package/dist/pm/html-string/index.cjs.map +1 -1
  27. package/dist/pm/html-string/index.d.cts +7 -24
  28. package/dist/pm/html-string/index.d.ts +7 -24
  29. package/dist/pm/html-string/index.js +19 -34
  30. package/dist/pm/html-string/index.js.map +1 -1
  31. package/dist/pm/markdown/index.cjs +473 -0
  32. package/dist/pm/markdown/index.cjs.map +1 -0
  33. package/dist/pm/markdown/index.d.cts +153 -0
  34. package/dist/pm/markdown/index.d.ts +153 -0
  35. package/dist/pm/markdown/index.js +449 -0
  36. package/dist/pm/markdown/index.js.map +1 -0
  37. package/dist/pm/react/index.cjs +46 -2235
  38. package/dist/pm/react/index.cjs.map +1 -1
  39. package/dist/pm/react/index.d.cts +5 -23
  40. package/dist/pm/react/index.d.ts +5 -23
  41. package/dist/pm/react/index.js +51 -2263
  42. package/dist/pm/react/index.js.map +1 -1
  43. package/package.json +27 -8
  44. package/src/helpers.ts +5 -16
  45. package/src/index.ts +5 -1
  46. package/src/json/html-string/string.ts +39 -13
  47. package/src/json/react/{react.tsx → react.ts} +12 -15
  48. package/src/json/renderer.ts +50 -51
  49. package/src/pm/extensionRenderer.ts +16 -34
  50. package/src/pm/html-string/html-string.ts +29 -45
  51. package/src/pm/markdown/index.ts +2 -0
  52. package/src/pm/markdown/markdown.ts +142 -0
  53. package/src/pm/react/{react.tsx → react.ts} +50 -31
  54. package/src/helpers.example.ts +0 -35
  55. package/src/json/html-string/string.example.ts +0 -46
  56. package/src/json/react/react.example.ts +0 -45
  57. package/src/pm/html-string/html-string.example.ts +0 -225
  58. package/src/pm/markdown/markdown.example.ts +0 -296
  59. package/src/pm/react/react.example.tsx +0 -306
  60. package/src/types.ts +0 -57
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
8
  var __export = (target, all) => {
12
9
  for (var name in all)
13
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -30,2175 +27,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
27
  ));
31
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
29
 
33
- // ../../node_modules/react/cjs/react.production.min.js
34
- var require_react_production_min = __commonJS({
35
- "../../node_modules/react/cjs/react.production.min.js"(exports2) {
36
- "use strict";
37
- var l = Symbol.for("react.element");
38
- var n = Symbol.for("react.portal");
39
- var p = Symbol.for("react.fragment");
40
- var q = Symbol.for("react.strict_mode");
41
- var r = Symbol.for("react.profiler");
42
- var t = Symbol.for("react.provider");
43
- var u = Symbol.for("react.context");
44
- var v = Symbol.for("react.forward_ref");
45
- var w = Symbol.for("react.suspense");
46
- var x = Symbol.for("react.memo");
47
- var y = Symbol.for("react.lazy");
48
- var z = Symbol.iterator;
49
- function A(a) {
50
- if (null === a || "object" !== typeof a) return null;
51
- a = z && a[z] || a["@@iterator"];
52
- return "function" === typeof a ? a : null;
53
- }
54
- var B = { isMounted: function() {
55
- return false;
56
- }, enqueueForceUpdate: function() {
57
- }, enqueueReplaceState: function() {
58
- }, enqueueSetState: function() {
59
- } };
60
- var C = Object.assign;
61
- var D = {};
62
- function E(a, b, e) {
63
- this.props = a;
64
- this.context = b;
65
- this.refs = D;
66
- this.updater = e || B;
67
- }
68
- E.prototype.isReactComponent = {};
69
- E.prototype.setState = function(a, b) {
70
- if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
71
- this.updater.enqueueSetState(this, a, b, "setState");
72
- };
73
- E.prototype.forceUpdate = function(a) {
74
- this.updater.enqueueForceUpdate(this, a, "forceUpdate");
75
- };
76
- function F() {
77
- }
78
- F.prototype = E.prototype;
79
- function G(a, b, e) {
80
- this.props = a;
81
- this.context = b;
82
- this.refs = D;
83
- this.updater = e || B;
84
- }
85
- var H = G.prototype = new F();
86
- H.constructor = G;
87
- C(H, E.prototype);
88
- H.isPureReactComponent = true;
89
- var I = Array.isArray;
90
- var J = Object.prototype.hasOwnProperty;
91
- var K = { current: null };
92
- var L = { key: true, ref: true, __self: true, __source: true };
93
- function M(a, b, e) {
94
- var d, c = {}, k = null, h = null;
95
- if (null != b) for (d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b) J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]);
96
- var g = arguments.length - 2;
97
- if (1 === g) c.children = e;
98
- else if (1 < g) {
99
- for (var f = Array(g), m = 0; m < g; m++) f[m] = arguments[m + 2];
100
- c.children = f;
101
- }
102
- if (a && a.defaultProps) for (d in g = a.defaultProps, g) void 0 === c[d] && (c[d] = g[d]);
103
- return { $$typeof: l, type: a, key: k, ref: h, props: c, _owner: K.current };
104
- }
105
- function N(a, b) {
106
- return { $$typeof: l, type: a.type, key: b, ref: a.ref, props: a.props, _owner: a._owner };
107
- }
108
- function O(a) {
109
- return "object" === typeof a && null !== a && a.$$typeof === l;
110
- }
111
- function escape(a) {
112
- var b = { "=": "=0", ":": "=2" };
113
- return "$" + a.replace(/[=:]/g, function(a2) {
114
- return b[a2];
115
- });
116
- }
117
- var P = /\/+/g;
118
- function Q(a, b) {
119
- return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
120
- }
121
- function R(a, b, e, d, c) {
122
- var k = typeof a;
123
- if ("undefined" === k || "boolean" === k) a = null;
124
- var h = false;
125
- if (null === a) h = true;
126
- else switch (k) {
127
- case "string":
128
- case "number":
129
- h = true;
130
- break;
131
- case "object":
132
- switch (a.$$typeof) {
133
- case l:
134
- case n:
135
- h = true;
136
- }
137
- }
138
- if (h) return h = a, c = c(h), a = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", null != a && (e = a.replace(P, "$&/") + "/"), R(c, b, e, "", function(a2) {
139
- return a2;
140
- })) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), b.push(c)), 1;
141
- h = 0;
142
- d = "" === d ? "." : d + ":";
143
- if (I(a)) for (var g = 0; g < a.length; g++) {
144
- k = a[g];
145
- var f = d + Q(k, g);
146
- h += R(k, b, e, f, c);
147
- }
148
- else if (f = A(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done; ) k = k.value, f = d + Q(k, g++), h += R(k, b, e, f, c);
149
- else if ("object" === k) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
150
- return h;
151
- }
152
- function S(a, b, e) {
153
- if (null == a) return a;
154
- var d = [], c = 0;
155
- R(a, d, "", "", function(a2) {
156
- return b.call(e, a2, c++);
157
- });
158
- return d;
159
- }
160
- function T(a) {
161
- if (-1 === a._status) {
162
- var b = a._result;
163
- b = b();
164
- b.then(function(b2) {
165
- if (0 === a._status || -1 === a._status) a._status = 1, a._result = b2;
166
- }, function(b2) {
167
- if (0 === a._status || -1 === a._status) a._status = 2, a._result = b2;
168
- });
169
- -1 === a._status && (a._status = 0, a._result = b);
170
- }
171
- if (1 === a._status) return a._result.default;
172
- throw a._result;
173
- }
174
- var U = { current: null };
175
- var V = { transition: null };
176
- var W = { ReactCurrentDispatcher: U, ReactCurrentBatchConfig: V, ReactCurrentOwner: K };
177
- function X() {
178
- throw Error("act(...) is not supported in production builds of React.");
179
- }
180
- exports2.Children = { map: S, forEach: function(a, b, e) {
181
- S(a, function() {
182
- b.apply(this, arguments);
183
- }, e);
184
- }, count: function(a) {
185
- var b = 0;
186
- S(a, function() {
187
- b++;
188
- });
189
- return b;
190
- }, toArray: function(a) {
191
- return S(a, function(a2) {
192
- return a2;
193
- }) || [];
194
- }, only: function(a) {
195
- if (!O(a)) throw Error("React.Children.only expected to receive a single React element child.");
196
- return a;
197
- } };
198
- exports2.Component = E;
199
- exports2.Fragment = p;
200
- exports2.Profiler = r;
201
- exports2.PureComponent = G;
202
- exports2.StrictMode = q;
203
- exports2.Suspense = w;
204
- exports2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
205
- exports2.act = X;
206
- exports2.cloneElement = function(a, b, e) {
207
- if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
208
- var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner;
209
- if (null != b) {
210
- void 0 !== b.ref && (k = b.ref, h = K.current);
211
- void 0 !== b.key && (c = "" + b.key);
212
- if (a.type && a.type.defaultProps) var g = a.type.defaultProps;
213
- for (f in b) J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
214
- }
215
- var f = arguments.length - 2;
216
- if (1 === f) d.children = e;
217
- else if (1 < f) {
218
- g = Array(f);
219
- for (var m = 0; m < f; m++) g[m] = arguments[m + 2];
220
- d.children = g;
221
- }
222
- return { $$typeof: l, type: a.type, key: c, ref: k, props: d, _owner: h };
223
- };
224
- exports2.createContext = function(a) {
225
- a = { $$typeof: u, _currentValue: a, _currentValue2: a, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null };
226
- a.Provider = { $$typeof: t, _context: a };
227
- return a.Consumer = a;
228
- };
229
- exports2.createElement = M;
230
- exports2.createFactory = function(a) {
231
- var b = M.bind(null, a);
232
- b.type = a;
233
- return b;
234
- };
235
- exports2.createRef = function() {
236
- return { current: null };
237
- };
238
- exports2.forwardRef = function(a) {
239
- return { $$typeof: v, render: a };
240
- };
241
- exports2.isValidElement = O;
242
- exports2.lazy = function(a) {
243
- return { $$typeof: y, _payload: { _status: -1, _result: a }, _init: T };
244
- };
245
- exports2.memo = function(a, b) {
246
- return { $$typeof: x, type: a, compare: void 0 === b ? null : b };
247
- };
248
- exports2.startTransition = function(a) {
249
- var b = V.transition;
250
- V.transition = {};
251
- try {
252
- a();
253
- } finally {
254
- V.transition = b;
255
- }
256
- };
257
- exports2.unstable_act = X;
258
- exports2.useCallback = function(a, b) {
259
- return U.current.useCallback(a, b);
260
- };
261
- exports2.useContext = function(a) {
262
- return U.current.useContext(a);
263
- };
264
- exports2.useDebugValue = function() {
265
- };
266
- exports2.useDeferredValue = function(a) {
267
- return U.current.useDeferredValue(a);
268
- };
269
- exports2.useEffect = function(a, b) {
270
- return U.current.useEffect(a, b);
271
- };
272
- exports2.useId = function() {
273
- return U.current.useId();
274
- };
275
- exports2.useImperativeHandle = function(a, b, e) {
276
- return U.current.useImperativeHandle(a, b, e);
277
- };
278
- exports2.useInsertionEffect = function(a, b) {
279
- return U.current.useInsertionEffect(a, b);
280
- };
281
- exports2.useLayoutEffect = function(a, b) {
282
- return U.current.useLayoutEffect(a, b);
283
- };
284
- exports2.useMemo = function(a, b) {
285
- return U.current.useMemo(a, b);
286
- };
287
- exports2.useReducer = function(a, b, e) {
288
- return U.current.useReducer(a, b, e);
289
- };
290
- exports2.useRef = function(a) {
291
- return U.current.useRef(a);
292
- };
293
- exports2.useState = function(a) {
294
- return U.current.useState(a);
295
- };
296
- exports2.useSyncExternalStore = function(a, b, e) {
297
- return U.current.useSyncExternalStore(a, b, e);
298
- };
299
- exports2.useTransition = function() {
300
- return U.current.useTransition();
301
- };
302
- exports2.version = "18.3.1";
303
- }
304
- });
305
-
306
- // ../../node_modules/react/cjs/react.development.js
307
- var require_react_development = __commonJS({
308
- "../../node_modules/react/cjs/react.development.js"(exports2, module2) {
309
- "use strict";
310
- if (process.env.NODE_ENV !== "production") {
311
- (function() {
312
- "use strict";
313
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
314
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
315
- }
316
- var ReactVersion = "18.3.1";
317
- var REACT_ELEMENT_TYPE = Symbol.for("react.element");
318
- var REACT_PORTAL_TYPE = Symbol.for("react.portal");
319
- var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
320
- var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
321
- var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
322
- var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
323
- var REACT_CONTEXT_TYPE = Symbol.for("react.context");
324
- var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
325
- var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
326
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
327
- var REACT_MEMO_TYPE = Symbol.for("react.memo");
328
- var REACT_LAZY_TYPE = Symbol.for("react.lazy");
329
- var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
330
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
331
- var FAUX_ITERATOR_SYMBOL = "@@iterator";
332
- function getIteratorFn(maybeIterable) {
333
- if (maybeIterable === null || typeof maybeIterable !== "object") {
334
- return null;
335
- }
336
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
337
- if (typeof maybeIterator === "function") {
338
- return maybeIterator;
339
- }
340
- return null;
341
- }
342
- var ReactCurrentDispatcher = {
343
- /**
344
- * @internal
345
- * @type {ReactComponent}
346
- */
347
- current: null
348
- };
349
- var ReactCurrentBatchConfig = {
350
- transition: null
351
- };
352
- var ReactCurrentActQueue = {
353
- current: null,
354
- // Used to reproduce behavior of `batchedUpdates` in legacy mode.
355
- isBatchingLegacy: false,
356
- didScheduleLegacyUpdate: false
357
- };
358
- var ReactCurrentOwner = {
359
- /**
360
- * @internal
361
- * @type {ReactComponent}
362
- */
363
- current: null
364
- };
365
- var ReactDebugCurrentFrame = {};
366
- var currentExtraStackFrame = null;
367
- function setExtraStackFrame(stack) {
368
- {
369
- currentExtraStackFrame = stack;
370
- }
371
- }
372
- {
373
- ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
374
- {
375
- currentExtraStackFrame = stack;
376
- }
377
- };
378
- ReactDebugCurrentFrame.getCurrentStack = null;
379
- ReactDebugCurrentFrame.getStackAddendum = function() {
380
- var stack = "";
381
- if (currentExtraStackFrame) {
382
- stack += currentExtraStackFrame;
383
- }
384
- var impl = ReactDebugCurrentFrame.getCurrentStack;
385
- if (impl) {
386
- stack += impl() || "";
387
- }
388
- return stack;
389
- };
390
- }
391
- var enableScopeAPI = false;
392
- var enableCacheElement = false;
393
- var enableTransitionTracing = false;
394
- var enableLegacyHidden = false;
395
- var enableDebugTracing = false;
396
- var ReactSharedInternals = {
397
- ReactCurrentDispatcher,
398
- ReactCurrentBatchConfig,
399
- ReactCurrentOwner
400
- };
401
- {
402
- ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
403
- ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
404
- }
405
- function warn(format) {
406
- {
407
- {
408
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
409
- args[_key - 1] = arguments[_key];
410
- }
411
- printWarning("warn", format, args);
412
- }
413
- }
414
- }
415
- function error(format) {
416
- {
417
- {
418
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
419
- args[_key2 - 1] = arguments[_key2];
420
- }
421
- printWarning("error", format, args);
422
- }
423
- }
424
- }
425
- function printWarning(level, format, args) {
426
- {
427
- var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
428
- var stack = ReactDebugCurrentFrame2.getStackAddendum();
429
- if (stack !== "") {
430
- format += "%s";
431
- args = args.concat([stack]);
432
- }
433
- var argsWithFormat = args.map(function(item) {
434
- return String(item);
435
- });
436
- argsWithFormat.unshift("Warning: " + format);
437
- Function.prototype.apply.call(console[level], console, argsWithFormat);
438
- }
439
- }
440
- var didWarnStateUpdateForUnmountedComponent = {};
441
- function warnNoop(publicInstance, callerName) {
442
- {
443
- var _constructor = publicInstance.constructor;
444
- var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass";
445
- var warningKey = componentName + "." + callerName;
446
- if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
447
- return;
448
- }
449
- error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, componentName);
450
- didWarnStateUpdateForUnmountedComponent[warningKey] = true;
451
- }
452
- }
453
- var ReactNoopUpdateQueue = {
454
- /**
455
- * Checks whether or not this composite component is mounted.
456
- * @param {ReactClass} publicInstance The instance we want to test.
457
- * @return {boolean} True if mounted, false otherwise.
458
- * @protected
459
- * @final
460
- */
461
- isMounted: function(publicInstance) {
462
- return false;
463
- },
464
- /**
465
- * Forces an update. This should only be invoked when it is known with
466
- * certainty that we are **not** in a DOM transaction.
467
- *
468
- * You may want to call this when you know that some deeper aspect of the
469
- * component's state has changed but `setState` was not called.
470
- *
471
- * This will not invoke `shouldComponentUpdate`, but it will invoke
472
- * `componentWillUpdate` and `componentDidUpdate`.
473
- *
474
- * @param {ReactClass} publicInstance The instance that should rerender.
475
- * @param {?function} callback Called after component is updated.
476
- * @param {?string} callerName name of the calling function in the public API.
477
- * @internal
478
- */
479
- enqueueForceUpdate: function(publicInstance, callback, callerName) {
480
- warnNoop(publicInstance, "forceUpdate");
481
- },
482
- /**
483
- * Replaces all of the state. Always use this or `setState` to mutate state.
484
- * You should treat `this.state` as immutable.
485
- *
486
- * There is no guarantee that `this.state` will be immediately updated, so
487
- * accessing `this.state` after calling this method may return the old value.
488
- *
489
- * @param {ReactClass} publicInstance The instance that should rerender.
490
- * @param {object} completeState Next state.
491
- * @param {?function} callback Called after component is updated.
492
- * @param {?string} callerName name of the calling function in the public API.
493
- * @internal
494
- */
495
- enqueueReplaceState: function(publicInstance, completeState, callback, callerName) {
496
- warnNoop(publicInstance, "replaceState");
497
- },
498
- /**
499
- * Sets a subset of the state. This only exists because _pendingState is
500
- * internal. This provides a merging strategy that is not available to deep
501
- * properties which is confusing. TODO: Expose pendingState or don't use it
502
- * during the merge.
503
- *
504
- * @param {ReactClass} publicInstance The instance that should rerender.
505
- * @param {object} partialState Next partial state to be merged with state.
506
- * @param {?function} callback Called after component is updated.
507
- * @param {?string} Name of the calling function in the public API.
508
- * @internal
509
- */
510
- enqueueSetState: function(publicInstance, partialState, callback, callerName) {
511
- warnNoop(publicInstance, "setState");
512
- }
513
- };
514
- var assign = Object.assign;
515
- var emptyObject = {};
516
- {
517
- Object.freeze(emptyObject);
518
- }
519
- function Component(props, context, updater) {
520
- this.props = props;
521
- this.context = context;
522
- this.refs = emptyObject;
523
- this.updater = updater || ReactNoopUpdateQueue;
524
- }
525
- Component.prototype.isReactComponent = {};
526
- Component.prototype.setState = function(partialState, callback) {
527
- if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) {
528
- throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
529
- }
530
- this.updater.enqueueSetState(this, partialState, callback, "setState");
531
- };
532
- Component.prototype.forceUpdate = function(callback) {
533
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
534
- };
535
- {
536
- var deprecatedAPIs = {
537
- isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
538
- replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
539
- };
540
- var defineDeprecationWarning = function(methodName, info) {
541
- Object.defineProperty(Component.prototype, methodName, {
542
- get: function() {
543
- warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
544
- return void 0;
545
- }
546
- });
547
- };
548
- for (var fnName in deprecatedAPIs) {
549
- if (deprecatedAPIs.hasOwnProperty(fnName)) {
550
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
551
- }
552
- }
553
- }
554
- function ComponentDummy() {
555
- }
556
- ComponentDummy.prototype = Component.prototype;
557
- function PureComponent(props, context, updater) {
558
- this.props = props;
559
- this.context = context;
560
- this.refs = emptyObject;
561
- this.updater = updater || ReactNoopUpdateQueue;
562
- }
563
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
564
- pureComponentPrototype.constructor = PureComponent;
565
- assign(pureComponentPrototype, Component.prototype);
566
- pureComponentPrototype.isPureReactComponent = true;
567
- function createRef() {
568
- var refObject = {
569
- current: null
570
- };
571
- {
572
- Object.seal(refObject);
573
- }
574
- return refObject;
575
- }
576
- var isArrayImpl = Array.isArray;
577
- function isArray(a) {
578
- return isArrayImpl(a);
579
- }
580
- function typeName(value) {
581
- {
582
- var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
583
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
584
- return type;
585
- }
586
- }
587
- function willCoercionThrow(value) {
588
- {
589
- try {
590
- testStringCoercion(value);
591
- return false;
592
- } catch (e) {
593
- return true;
594
- }
595
- }
596
- }
597
- function testStringCoercion(value) {
598
- return "" + value;
599
- }
600
- function checkKeyStringCoercion(value) {
601
- {
602
- if (willCoercionThrow(value)) {
603
- error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
604
- return testStringCoercion(value);
605
- }
606
- }
607
- }
608
- function getWrappedName(outerType, innerType, wrapperName) {
609
- var displayName = outerType.displayName;
610
- if (displayName) {
611
- return displayName;
612
- }
613
- var functionName = innerType.displayName || innerType.name || "";
614
- return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
615
- }
616
- function getContextName(type) {
617
- return type.displayName || "Context";
618
- }
619
- function getComponentNameFromType(type) {
620
- if (type == null) {
621
- return null;
622
- }
623
- {
624
- if (typeof type.tag === "number") {
625
- error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
626
- }
627
- }
628
- if (typeof type === "function") {
629
- return type.displayName || type.name || null;
630
- }
631
- if (typeof type === "string") {
632
- return type;
633
- }
634
- switch (type) {
635
- case REACT_FRAGMENT_TYPE:
636
- return "Fragment";
637
- case REACT_PORTAL_TYPE:
638
- return "Portal";
639
- case REACT_PROFILER_TYPE:
640
- return "Profiler";
641
- case REACT_STRICT_MODE_TYPE:
642
- return "StrictMode";
643
- case REACT_SUSPENSE_TYPE:
644
- return "Suspense";
645
- case REACT_SUSPENSE_LIST_TYPE:
646
- return "SuspenseList";
647
- }
648
- if (typeof type === "object") {
649
- switch (type.$$typeof) {
650
- case REACT_CONTEXT_TYPE:
651
- var context = type;
652
- return getContextName(context) + ".Consumer";
653
- case REACT_PROVIDER_TYPE:
654
- var provider = type;
655
- return getContextName(provider._context) + ".Provider";
656
- case REACT_FORWARD_REF_TYPE:
657
- return getWrappedName(type, type.render, "ForwardRef");
658
- case REACT_MEMO_TYPE:
659
- var outerName = type.displayName || null;
660
- if (outerName !== null) {
661
- return outerName;
662
- }
663
- return getComponentNameFromType(type.type) || "Memo";
664
- case REACT_LAZY_TYPE: {
665
- var lazyComponent = type;
666
- var payload = lazyComponent._payload;
667
- var init = lazyComponent._init;
668
- try {
669
- return getComponentNameFromType(init(payload));
670
- } catch (x) {
671
- return null;
672
- }
673
- }
674
- }
675
- }
676
- return null;
677
- }
678
- var hasOwnProperty = Object.prototype.hasOwnProperty;
679
- var RESERVED_PROPS = {
680
- key: true,
681
- ref: true,
682
- __self: true,
683
- __source: true
684
- };
685
- var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
686
- {
687
- didWarnAboutStringRefs = {};
688
- }
689
- function hasValidRef(config) {
690
- {
691
- if (hasOwnProperty.call(config, "ref")) {
692
- var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
693
- if (getter && getter.isReactWarning) {
694
- return false;
695
- }
696
- }
697
- }
698
- return config.ref !== void 0;
699
- }
700
- function hasValidKey(config) {
701
- {
702
- if (hasOwnProperty.call(config, "key")) {
703
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
704
- if (getter && getter.isReactWarning) {
705
- return false;
706
- }
707
- }
708
- }
709
- return config.key !== void 0;
710
- }
711
- function defineKeyPropWarningGetter(props, displayName) {
712
- var warnAboutAccessingKey = function() {
713
- {
714
- if (!specialPropKeyWarningShown) {
715
- specialPropKeyWarningShown = true;
716
- error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
717
- }
718
- }
719
- };
720
- warnAboutAccessingKey.isReactWarning = true;
721
- Object.defineProperty(props, "key", {
722
- get: warnAboutAccessingKey,
723
- configurable: true
724
- });
725
- }
726
- function defineRefPropWarningGetter(props, displayName) {
727
- var warnAboutAccessingRef = function() {
728
- {
729
- if (!specialPropRefWarningShown) {
730
- specialPropRefWarningShown = true;
731
- error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
732
- }
733
- }
734
- };
735
- warnAboutAccessingRef.isReactWarning = true;
736
- Object.defineProperty(props, "ref", {
737
- get: warnAboutAccessingRef,
738
- configurable: true
739
- });
740
- }
741
- function warnIfStringRefCannotBeAutoConverted(config) {
742
- {
743
- if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
744
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
745
- if (!didWarnAboutStringRefs[componentName]) {
746
- error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
747
- didWarnAboutStringRefs[componentName] = true;
748
- }
749
- }
750
- }
751
- }
752
- var ReactElement = function(type, key, ref, self, source, owner, props) {
753
- var element = {
754
- // This tag allows us to uniquely identify this as a React Element
755
- $$typeof: REACT_ELEMENT_TYPE,
756
- // Built-in properties that belong on the element
757
- type,
758
- key,
759
- ref,
760
- props,
761
- // Record the component responsible for creating this element.
762
- _owner: owner
763
- };
764
- {
765
- element._store = {};
766
- Object.defineProperty(element._store, "validated", {
767
- configurable: false,
768
- enumerable: false,
769
- writable: true,
770
- value: false
771
- });
772
- Object.defineProperty(element, "_self", {
773
- configurable: false,
774
- enumerable: false,
775
- writable: false,
776
- value: self
777
- });
778
- Object.defineProperty(element, "_source", {
779
- configurable: false,
780
- enumerable: false,
781
- writable: false,
782
- value: source
783
- });
784
- if (Object.freeze) {
785
- Object.freeze(element.props);
786
- Object.freeze(element);
787
- }
788
- }
789
- return element;
790
- };
791
- function createElement(type, config, children) {
792
- var propName;
793
- var props = {};
794
- var key = null;
795
- var ref = null;
796
- var self = null;
797
- var source = null;
798
- if (config != null) {
799
- if (hasValidRef(config)) {
800
- ref = config.ref;
801
- {
802
- warnIfStringRefCannotBeAutoConverted(config);
803
- }
804
- }
805
- if (hasValidKey(config)) {
806
- {
807
- checkKeyStringCoercion(config.key);
808
- }
809
- key = "" + config.key;
810
- }
811
- self = config.__self === void 0 ? null : config.__self;
812
- source = config.__source === void 0 ? null : config.__source;
813
- for (propName in config) {
814
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
815
- props[propName] = config[propName];
816
- }
817
- }
818
- }
819
- var childrenLength = arguments.length - 2;
820
- if (childrenLength === 1) {
821
- props.children = children;
822
- } else if (childrenLength > 1) {
823
- var childArray = Array(childrenLength);
824
- for (var i = 0; i < childrenLength; i++) {
825
- childArray[i] = arguments[i + 2];
826
- }
827
- {
828
- if (Object.freeze) {
829
- Object.freeze(childArray);
830
- }
831
- }
832
- props.children = childArray;
833
- }
834
- if (type && type.defaultProps) {
835
- var defaultProps = type.defaultProps;
836
- for (propName in defaultProps) {
837
- if (props[propName] === void 0) {
838
- props[propName] = defaultProps[propName];
839
- }
840
- }
841
- }
842
- {
843
- if (key || ref) {
844
- var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
845
- if (key) {
846
- defineKeyPropWarningGetter(props, displayName);
847
- }
848
- if (ref) {
849
- defineRefPropWarningGetter(props, displayName);
850
- }
851
- }
852
- }
853
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
854
- }
855
- function cloneAndReplaceKey(oldElement, newKey) {
856
- var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
857
- return newElement;
858
- }
859
- function cloneElement(element, config, children) {
860
- if (element === null || element === void 0) {
861
- throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
862
- }
863
- var propName;
864
- var props = assign({}, element.props);
865
- var key = element.key;
866
- var ref = element.ref;
867
- var self = element._self;
868
- var source = element._source;
869
- var owner = element._owner;
870
- if (config != null) {
871
- if (hasValidRef(config)) {
872
- ref = config.ref;
873
- owner = ReactCurrentOwner.current;
874
- }
875
- if (hasValidKey(config)) {
876
- {
877
- checkKeyStringCoercion(config.key);
878
- }
879
- key = "" + config.key;
880
- }
881
- var defaultProps;
882
- if (element.type && element.type.defaultProps) {
883
- defaultProps = element.type.defaultProps;
884
- }
885
- for (propName in config) {
886
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
887
- if (config[propName] === void 0 && defaultProps !== void 0) {
888
- props[propName] = defaultProps[propName];
889
- } else {
890
- props[propName] = config[propName];
891
- }
892
- }
893
- }
894
- }
895
- var childrenLength = arguments.length - 2;
896
- if (childrenLength === 1) {
897
- props.children = children;
898
- } else if (childrenLength > 1) {
899
- var childArray = Array(childrenLength);
900
- for (var i = 0; i < childrenLength; i++) {
901
- childArray[i] = arguments[i + 2];
902
- }
903
- props.children = childArray;
904
- }
905
- return ReactElement(element.type, key, ref, self, source, owner, props);
906
- }
907
- function isValidElement(object) {
908
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
909
- }
910
- var SEPARATOR = ".";
911
- var SUBSEPARATOR = ":";
912
- function escape(key) {
913
- var escapeRegex = /[=:]/g;
914
- var escaperLookup = {
915
- "=": "=0",
916
- ":": "=2"
917
- };
918
- var escapedString = key.replace(escapeRegex, function(match) {
919
- return escaperLookup[match];
920
- });
921
- return "$" + escapedString;
922
- }
923
- var didWarnAboutMaps = false;
924
- var userProvidedKeyEscapeRegex = /\/+/g;
925
- function escapeUserProvidedKey(text) {
926
- return text.replace(userProvidedKeyEscapeRegex, "$&/");
927
- }
928
- function getElementKey(element, index) {
929
- if (typeof element === "object" && element !== null && element.key != null) {
930
- {
931
- checkKeyStringCoercion(element.key);
932
- }
933
- return escape("" + element.key);
934
- }
935
- return index.toString(36);
936
- }
937
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
938
- var type = typeof children;
939
- if (type === "undefined" || type === "boolean") {
940
- children = null;
941
- }
942
- var invokeCallback = false;
943
- if (children === null) {
944
- invokeCallback = true;
945
- } else {
946
- switch (type) {
947
- case "string":
948
- case "number":
949
- invokeCallback = true;
950
- break;
951
- case "object":
952
- switch (children.$$typeof) {
953
- case REACT_ELEMENT_TYPE:
954
- case REACT_PORTAL_TYPE:
955
- invokeCallback = true;
956
- }
957
- }
958
- }
959
- if (invokeCallback) {
960
- var _child = children;
961
- var mappedChild = callback(_child);
962
- var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
963
- if (isArray(mappedChild)) {
964
- var escapedChildKey = "";
965
- if (childKey != null) {
966
- escapedChildKey = escapeUserProvidedKey(childKey) + "/";
967
- }
968
- mapIntoArray(mappedChild, array, escapedChildKey, "", function(c) {
969
- return c;
970
- });
971
- } else if (mappedChild != null) {
972
- if (isValidElement(mappedChild)) {
973
- {
974
- if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
975
- checkKeyStringCoercion(mappedChild.key);
976
- }
977
- }
978
- mappedChild = cloneAndReplaceKey(
979
- mappedChild,
980
- // Keep both the (mapped) and old keys if they differ, just as
981
- // traverseAllChildren used to do for objects as children
982
- escapedPrefix + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
983
- (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? (
984
- // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
985
- // eslint-disable-next-line react-internal/safe-string-coercion
986
- escapeUserProvidedKey("" + mappedChild.key) + "/"
987
- ) : "") + childKey
988
- );
989
- }
990
- array.push(mappedChild);
991
- }
992
- return 1;
993
- }
994
- var child;
995
- var nextName;
996
- var subtreeCount = 0;
997
- var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
998
- if (isArray(children)) {
999
- for (var i = 0; i < children.length; i++) {
1000
- child = children[i];
1001
- nextName = nextNamePrefix + getElementKey(child, i);
1002
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1003
- }
1004
- } else {
1005
- var iteratorFn = getIteratorFn(children);
1006
- if (typeof iteratorFn === "function") {
1007
- var iterableChildren = children;
1008
- {
1009
- if (iteratorFn === iterableChildren.entries) {
1010
- if (!didWarnAboutMaps) {
1011
- warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
1012
- }
1013
- didWarnAboutMaps = true;
1014
- }
1015
- }
1016
- var iterator = iteratorFn.call(iterableChildren);
1017
- var step;
1018
- var ii = 0;
1019
- while (!(step = iterator.next()).done) {
1020
- child = step.value;
1021
- nextName = nextNamePrefix + getElementKey(child, ii++);
1022
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1023
- }
1024
- } else if (type === "object") {
1025
- var childrenString = String(children);
1026
- throw new Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
1027
- }
1028
- }
1029
- return subtreeCount;
1030
- }
1031
- function mapChildren(children, func, context) {
1032
- if (children == null) {
1033
- return children;
1034
- }
1035
- var result = [];
1036
- var count = 0;
1037
- mapIntoArray(children, result, "", "", function(child) {
1038
- return func.call(context, child, count++);
1039
- });
1040
- return result;
1041
- }
1042
- function countChildren(children) {
1043
- var n = 0;
1044
- mapChildren(children, function() {
1045
- n++;
1046
- });
1047
- return n;
1048
- }
1049
- function forEachChildren(children, forEachFunc, forEachContext) {
1050
- mapChildren(children, function() {
1051
- forEachFunc.apply(this, arguments);
1052
- }, forEachContext);
1053
- }
1054
- function toArray(children) {
1055
- return mapChildren(children, function(child) {
1056
- return child;
1057
- }) || [];
1058
- }
1059
- function onlyChild(children) {
1060
- if (!isValidElement(children)) {
1061
- throw new Error("React.Children.only expected to receive a single React element child.");
1062
- }
1063
- return children;
1064
- }
1065
- function createContext(defaultValue) {
1066
- var context = {
1067
- $$typeof: REACT_CONTEXT_TYPE,
1068
- // As a workaround to support multiple concurrent renderers, we categorize
1069
- // some renderers as primary and others as secondary. We only expect
1070
- // there to be two concurrent renderers at most: React Native (primary) and
1071
- // Fabric (secondary); React DOM (primary) and React ART (secondary).
1072
- // Secondary renderers store their context values on separate fields.
1073
- _currentValue: defaultValue,
1074
- _currentValue2: defaultValue,
1075
- // Used to track how many concurrent renderers this context currently
1076
- // supports within in a single renderer. Such as parallel server rendering.
1077
- _threadCount: 0,
1078
- // These are circular
1079
- Provider: null,
1080
- Consumer: null,
1081
- // Add these to use same hidden class in VM as ServerContext
1082
- _defaultValue: null,
1083
- _globalName: null
1084
- };
1085
- context.Provider = {
1086
- $$typeof: REACT_PROVIDER_TYPE,
1087
- _context: context
1088
- };
1089
- var hasWarnedAboutUsingNestedContextConsumers = false;
1090
- var hasWarnedAboutUsingConsumerProvider = false;
1091
- var hasWarnedAboutDisplayNameOnConsumer = false;
1092
- {
1093
- var Consumer = {
1094
- $$typeof: REACT_CONTEXT_TYPE,
1095
- _context: context
1096
- };
1097
- Object.defineProperties(Consumer, {
1098
- Provider: {
1099
- get: function() {
1100
- if (!hasWarnedAboutUsingConsumerProvider) {
1101
- hasWarnedAboutUsingConsumerProvider = true;
1102
- error("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?");
1103
- }
1104
- return context.Provider;
1105
- },
1106
- set: function(_Provider) {
1107
- context.Provider = _Provider;
1108
- }
1109
- },
1110
- _currentValue: {
1111
- get: function() {
1112
- return context._currentValue;
1113
- },
1114
- set: function(_currentValue) {
1115
- context._currentValue = _currentValue;
1116
- }
1117
- },
1118
- _currentValue2: {
1119
- get: function() {
1120
- return context._currentValue2;
1121
- },
1122
- set: function(_currentValue2) {
1123
- context._currentValue2 = _currentValue2;
1124
- }
1125
- },
1126
- _threadCount: {
1127
- get: function() {
1128
- return context._threadCount;
1129
- },
1130
- set: function(_threadCount) {
1131
- context._threadCount = _threadCount;
1132
- }
1133
- },
1134
- Consumer: {
1135
- get: function() {
1136
- if (!hasWarnedAboutUsingNestedContextConsumers) {
1137
- hasWarnedAboutUsingNestedContextConsumers = true;
1138
- error("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?");
1139
- }
1140
- return context.Consumer;
1141
- }
1142
- },
1143
- displayName: {
1144
- get: function() {
1145
- return context.displayName;
1146
- },
1147
- set: function(displayName) {
1148
- if (!hasWarnedAboutDisplayNameOnConsumer) {
1149
- warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName);
1150
- hasWarnedAboutDisplayNameOnConsumer = true;
1151
- }
1152
- }
1153
- }
1154
- });
1155
- context.Consumer = Consumer;
1156
- }
1157
- {
1158
- context._currentRenderer = null;
1159
- context._currentRenderer2 = null;
1160
- }
1161
- return context;
1162
- }
1163
- var Uninitialized = -1;
1164
- var Pending = 0;
1165
- var Resolved = 1;
1166
- var Rejected = 2;
1167
- function lazyInitializer(payload) {
1168
- if (payload._status === Uninitialized) {
1169
- var ctor = payload._result;
1170
- var thenable = ctor();
1171
- thenable.then(function(moduleObject2) {
1172
- if (payload._status === Pending || payload._status === Uninitialized) {
1173
- var resolved = payload;
1174
- resolved._status = Resolved;
1175
- resolved._result = moduleObject2;
1176
- }
1177
- }, function(error2) {
1178
- if (payload._status === Pending || payload._status === Uninitialized) {
1179
- var rejected = payload;
1180
- rejected._status = Rejected;
1181
- rejected._result = error2;
1182
- }
1183
- });
1184
- if (payload._status === Uninitialized) {
1185
- var pending = payload;
1186
- pending._status = Pending;
1187
- pending._result = thenable;
1188
- }
1189
- }
1190
- if (payload._status === Resolved) {
1191
- var moduleObject = payload._result;
1192
- {
1193
- if (moduleObject === void 0) {
1194
- error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", moduleObject);
1195
- }
1196
- }
1197
- {
1198
- if (!("default" in moduleObject)) {
1199
- error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
1200
- }
1201
- }
1202
- return moduleObject.default;
1203
- } else {
1204
- throw payload._result;
1205
- }
1206
- }
1207
- function lazy(ctor) {
1208
- var payload = {
1209
- // We use these fields to store the result.
1210
- _status: Uninitialized,
1211
- _result: ctor
1212
- };
1213
- var lazyType = {
1214
- $$typeof: REACT_LAZY_TYPE,
1215
- _payload: payload,
1216
- _init: lazyInitializer
1217
- };
1218
- {
1219
- var defaultProps;
1220
- var propTypes;
1221
- Object.defineProperties(lazyType, {
1222
- defaultProps: {
1223
- configurable: true,
1224
- get: function() {
1225
- return defaultProps;
1226
- },
1227
- set: function(newDefaultProps) {
1228
- error("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
1229
- defaultProps = newDefaultProps;
1230
- Object.defineProperty(lazyType, "defaultProps", {
1231
- enumerable: true
1232
- });
1233
- }
1234
- },
1235
- propTypes: {
1236
- configurable: true,
1237
- get: function() {
1238
- return propTypes;
1239
- },
1240
- set: function(newPropTypes) {
1241
- error("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
1242
- propTypes = newPropTypes;
1243
- Object.defineProperty(lazyType, "propTypes", {
1244
- enumerable: true
1245
- });
1246
- }
1247
- }
1248
- });
1249
- }
1250
- return lazyType;
1251
- }
1252
- function forwardRef(render) {
1253
- {
1254
- if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1255
- error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
1256
- } else if (typeof render !== "function") {
1257
- error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render);
1258
- } else {
1259
- if (render.length !== 0 && render.length !== 2) {
1260
- error("forwardRef render functions accept exactly two parameters: props and ref. %s", render.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
1261
- }
1262
- }
1263
- if (render != null) {
1264
- if (render.defaultProps != null || render.propTypes != null) {
1265
- error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");
1266
- }
1267
- }
1268
- }
1269
- var elementType = {
1270
- $$typeof: REACT_FORWARD_REF_TYPE,
1271
- render
1272
- };
1273
- {
1274
- var ownName;
1275
- Object.defineProperty(elementType, "displayName", {
1276
- enumerable: false,
1277
- configurable: true,
1278
- get: function() {
1279
- return ownName;
1280
- },
1281
- set: function(name) {
1282
- ownName = name;
1283
- if (!render.name && !render.displayName) {
1284
- render.displayName = name;
1285
- }
1286
- }
1287
- });
1288
- }
1289
- return elementType;
1290
- }
1291
- var REACT_MODULE_REFERENCE;
1292
- {
1293
- REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
1294
- }
1295
- function isValidElementType(type) {
1296
- if (typeof type === "string" || typeof type === "function") {
1297
- return true;
1298
- }
1299
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
1300
- return true;
1301
- }
1302
- if (typeof type === "object" && type !== null) {
1303
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
1304
- // types supported by any Flight configuration anywhere since
1305
- // we don't know which Flight build this will end up being used
1306
- // with.
1307
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
1308
- return true;
1309
- }
1310
- }
1311
- return false;
1312
- }
1313
- function memo(type, compare) {
1314
- {
1315
- if (!isValidElementType(type)) {
1316
- error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
1317
- }
1318
- }
1319
- var elementType = {
1320
- $$typeof: REACT_MEMO_TYPE,
1321
- type,
1322
- compare: compare === void 0 ? null : compare
1323
- };
1324
- {
1325
- var ownName;
1326
- Object.defineProperty(elementType, "displayName", {
1327
- enumerable: false,
1328
- configurable: true,
1329
- get: function() {
1330
- return ownName;
1331
- },
1332
- set: function(name) {
1333
- ownName = name;
1334
- if (!type.name && !type.displayName) {
1335
- type.displayName = name;
1336
- }
1337
- }
1338
- });
1339
- }
1340
- return elementType;
1341
- }
1342
- function resolveDispatcher() {
1343
- var dispatcher = ReactCurrentDispatcher.current;
1344
- {
1345
- if (dispatcher === null) {
1346
- error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
1347
- }
1348
- }
1349
- return dispatcher;
1350
- }
1351
- function useContext(Context) {
1352
- var dispatcher = resolveDispatcher();
1353
- {
1354
- if (Context._context !== void 0) {
1355
- var realContext = Context._context;
1356
- if (realContext.Consumer === Context) {
1357
- error("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?");
1358
- } else if (realContext.Provider === Context) {
1359
- error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?");
1360
- }
1361
- }
1362
- }
1363
- return dispatcher.useContext(Context);
1364
- }
1365
- function useState(initialState) {
1366
- var dispatcher = resolveDispatcher();
1367
- return dispatcher.useState(initialState);
1368
- }
1369
- function useReducer(reducer, initialArg, init) {
1370
- var dispatcher = resolveDispatcher();
1371
- return dispatcher.useReducer(reducer, initialArg, init);
1372
- }
1373
- function useRef(initialValue) {
1374
- var dispatcher = resolveDispatcher();
1375
- return dispatcher.useRef(initialValue);
1376
- }
1377
- function useEffect(create, deps) {
1378
- var dispatcher = resolveDispatcher();
1379
- return dispatcher.useEffect(create, deps);
1380
- }
1381
- function useInsertionEffect(create, deps) {
1382
- var dispatcher = resolveDispatcher();
1383
- return dispatcher.useInsertionEffect(create, deps);
1384
- }
1385
- function useLayoutEffect(create, deps) {
1386
- var dispatcher = resolveDispatcher();
1387
- return dispatcher.useLayoutEffect(create, deps);
1388
- }
1389
- function useCallback(callback, deps) {
1390
- var dispatcher = resolveDispatcher();
1391
- return dispatcher.useCallback(callback, deps);
1392
- }
1393
- function useMemo(create, deps) {
1394
- var dispatcher = resolveDispatcher();
1395
- return dispatcher.useMemo(create, deps);
1396
- }
1397
- function useImperativeHandle(ref, create, deps) {
1398
- var dispatcher = resolveDispatcher();
1399
- return dispatcher.useImperativeHandle(ref, create, deps);
1400
- }
1401
- function useDebugValue(value, formatterFn) {
1402
- {
1403
- var dispatcher = resolveDispatcher();
1404
- return dispatcher.useDebugValue(value, formatterFn);
1405
- }
1406
- }
1407
- function useTransition() {
1408
- var dispatcher = resolveDispatcher();
1409
- return dispatcher.useTransition();
1410
- }
1411
- function useDeferredValue(value) {
1412
- var dispatcher = resolveDispatcher();
1413
- return dispatcher.useDeferredValue(value);
1414
- }
1415
- function useId() {
1416
- var dispatcher = resolveDispatcher();
1417
- return dispatcher.useId();
1418
- }
1419
- function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
1420
- var dispatcher = resolveDispatcher();
1421
- return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
1422
- }
1423
- var disabledDepth = 0;
1424
- var prevLog;
1425
- var prevInfo;
1426
- var prevWarn;
1427
- var prevError;
1428
- var prevGroup;
1429
- var prevGroupCollapsed;
1430
- var prevGroupEnd;
1431
- function disabledLog() {
1432
- }
1433
- disabledLog.__reactDisabledLog = true;
1434
- function disableLogs() {
1435
- {
1436
- if (disabledDepth === 0) {
1437
- prevLog = console.log;
1438
- prevInfo = console.info;
1439
- prevWarn = console.warn;
1440
- prevError = console.error;
1441
- prevGroup = console.group;
1442
- prevGroupCollapsed = console.groupCollapsed;
1443
- prevGroupEnd = console.groupEnd;
1444
- var props = {
1445
- configurable: true,
1446
- enumerable: true,
1447
- value: disabledLog,
1448
- writable: true
1449
- };
1450
- Object.defineProperties(console, {
1451
- info: props,
1452
- log: props,
1453
- warn: props,
1454
- error: props,
1455
- group: props,
1456
- groupCollapsed: props,
1457
- groupEnd: props
1458
- });
1459
- }
1460
- disabledDepth++;
1461
- }
1462
- }
1463
- function reenableLogs() {
1464
- {
1465
- disabledDepth--;
1466
- if (disabledDepth === 0) {
1467
- var props = {
1468
- configurable: true,
1469
- enumerable: true,
1470
- writable: true
1471
- };
1472
- Object.defineProperties(console, {
1473
- log: assign({}, props, {
1474
- value: prevLog
1475
- }),
1476
- info: assign({}, props, {
1477
- value: prevInfo
1478
- }),
1479
- warn: assign({}, props, {
1480
- value: prevWarn
1481
- }),
1482
- error: assign({}, props, {
1483
- value: prevError
1484
- }),
1485
- group: assign({}, props, {
1486
- value: prevGroup
1487
- }),
1488
- groupCollapsed: assign({}, props, {
1489
- value: prevGroupCollapsed
1490
- }),
1491
- groupEnd: assign({}, props, {
1492
- value: prevGroupEnd
1493
- })
1494
- });
1495
- }
1496
- if (disabledDepth < 0) {
1497
- error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
1498
- }
1499
- }
1500
- }
1501
- var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1502
- var prefix;
1503
- function describeBuiltInComponentFrame(name, source, ownerFn) {
1504
- {
1505
- if (prefix === void 0) {
1506
- try {
1507
- throw Error();
1508
- } catch (x) {
1509
- var match = x.stack.trim().match(/\n( *(at )?)/);
1510
- prefix = match && match[1] || "";
1511
- }
1512
- }
1513
- return "\n" + prefix + name;
1514
- }
1515
- }
1516
- var reentry = false;
1517
- var componentFrameCache;
1518
- {
1519
- var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
1520
- componentFrameCache = new PossiblyWeakMap();
1521
- }
1522
- function describeNativeComponentFrame(fn, construct) {
1523
- if (!fn || reentry) {
1524
- return "";
1525
- }
1526
- {
1527
- var frame = componentFrameCache.get(fn);
1528
- if (frame !== void 0) {
1529
- return frame;
1530
- }
1531
- }
1532
- var control;
1533
- reentry = true;
1534
- var previousPrepareStackTrace = Error.prepareStackTrace;
1535
- Error.prepareStackTrace = void 0;
1536
- var previousDispatcher;
1537
- {
1538
- previousDispatcher = ReactCurrentDispatcher$1.current;
1539
- ReactCurrentDispatcher$1.current = null;
1540
- disableLogs();
1541
- }
1542
- try {
1543
- if (construct) {
1544
- var Fake = function() {
1545
- throw Error();
1546
- };
1547
- Object.defineProperty(Fake.prototype, "props", {
1548
- set: function() {
1549
- throw Error();
1550
- }
1551
- });
1552
- if (typeof Reflect === "object" && Reflect.construct) {
1553
- try {
1554
- Reflect.construct(Fake, []);
1555
- } catch (x) {
1556
- control = x;
1557
- }
1558
- Reflect.construct(fn, [], Fake);
1559
- } else {
1560
- try {
1561
- Fake.call();
1562
- } catch (x) {
1563
- control = x;
1564
- }
1565
- fn.call(Fake.prototype);
1566
- }
1567
- } else {
1568
- try {
1569
- throw Error();
1570
- } catch (x) {
1571
- control = x;
1572
- }
1573
- fn();
1574
- }
1575
- } catch (sample) {
1576
- if (sample && control && typeof sample.stack === "string") {
1577
- var sampleLines = sample.stack.split("\n");
1578
- var controlLines = control.stack.split("\n");
1579
- var s = sampleLines.length - 1;
1580
- var c = controlLines.length - 1;
1581
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1582
- c--;
1583
- }
1584
- for (; s >= 1 && c >= 0; s--, c--) {
1585
- if (sampleLines[s] !== controlLines[c]) {
1586
- if (s !== 1 || c !== 1) {
1587
- do {
1588
- s--;
1589
- c--;
1590
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
1591
- var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
1592
- if (fn.displayName && _frame.includes("<anonymous>")) {
1593
- _frame = _frame.replace("<anonymous>", fn.displayName);
1594
- }
1595
- {
1596
- if (typeof fn === "function") {
1597
- componentFrameCache.set(fn, _frame);
1598
- }
1599
- }
1600
- return _frame;
1601
- }
1602
- } while (s >= 1 && c >= 0);
1603
- }
1604
- break;
1605
- }
1606
- }
1607
- }
1608
- } finally {
1609
- reentry = false;
1610
- {
1611
- ReactCurrentDispatcher$1.current = previousDispatcher;
1612
- reenableLogs();
1613
- }
1614
- Error.prepareStackTrace = previousPrepareStackTrace;
1615
- }
1616
- var name = fn ? fn.displayName || fn.name : "";
1617
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
1618
- {
1619
- if (typeof fn === "function") {
1620
- componentFrameCache.set(fn, syntheticFrame);
1621
- }
1622
- }
1623
- return syntheticFrame;
1624
- }
1625
- function describeFunctionComponentFrame(fn, source, ownerFn) {
1626
- {
1627
- return describeNativeComponentFrame(fn, false);
1628
- }
1629
- }
1630
- function shouldConstruct(Component2) {
1631
- var prototype = Component2.prototype;
1632
- return !!(prototype && prototype.isReactComponent);
1633
- }
1634
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1635
- if (type == null) {
1636
- return "";
1637
- }
1638
- if (typeof type === "function") {
1639
- {
1640
- return describeNativeComponentFrame(type, shouldConstruct(type));
1641
- }
1642
- }
1643
- if (typeof type === "string") {
1644
- return describeBuiltInComponentFrame(type);
1645
- }
1646
- switch (type) {
1647
- case REACT_SUSPENSE_TYPE:
1648
- return describeBuiltInComponentFrame("Suspense");
1649
- case REACT_SUSPENSE_LIST_TYPE:
1650
- return describeBuiltInComponentFrame("SuspenseList");
1651
- }
1652
- if (typeof type === "object") {
1653
- switch (type.$$typeof) {
1654
- case REACT_FORWARD_REF_TYPE:
1655
- return describeFunctionComponentFrame(type.render);
1656
- case REACT_MEMO_TYPE:
1657
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
1658
- case REACT_LAZY_TYPE: {
1659
- var lazyComponent = type;
1660
- var payload = lazyComponent._payload;
1661
- var init = lazyComponent._init;
1662
- try {
1663
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
1664
- } catch (x) {
1665
- }
1666
- }
1667
- }
1668
- }
1669
- return "";
1670
- }
1671
- var loggedTypeFailures = {};
1672
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1673
- function setCurrentlyValidatingElement(element) {
1674
- {
1675
- if (element) {
1676
- var owner = element._owner;
1677
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1678
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1679
- } else {
1680
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1681
- }
1682
- }
1683
- }
1684
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
1685
- {
1686
- var has = Function.call.bind(hasOwnProperty);
1687
- for (var typeSpecName in typeSpecs) {
1688
- if (has(typeSpecs, typeSpecName)) {
1689
- var error$1 = void 0;
1690
- try {
1691
- if (typeof typeSpecs[typeSpecName] !== "function") {
1692
- var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
1693
- err.name = "Invariant Violation";
1694
- throw err;
1695
- }
1696
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
1697
- } catch (ex) {
1698
- error$1 = ex;
1699
- }
1700
- if (error$1 && !(error$1 instanceof Error)) {
1701
- setCurrentlyValidatingElement(element);
1702
- error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
1703
- setCurrentlyValidatingElement(null);
1704
- }
1705
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1706
- loggedTypeFailures[error$1.message] = true;
1707
- setCurrentlyValidatingElement(element);
1708
- error("Failed %s type: %s", location, error$1.message);
1709
- setCurrentlyValidatingElement(null);
1710
- }
1711
- }
1712
- }
1713
- }
1714
- }
1715
- function setCurrentlyValidatingElement$1(element) {
1716
- {
1717
- if (element) {
1718
- var owner = element._owner;
1719
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1720
- setExtraStackFrame(stack);
1721
- } else {
1722
- setExtraStackFrame(null);
1723
- }
1724
- }
1725
- }
1726
- var propTypesMisspellWarningShown;
1727
- {
1728
- propTypesMisspellWarningShown = false;
1729
- }
1730
- function getDeclarationErrorAddendum() {
1731
- if (ReactCurrentOwner.current) {
1732
- var name = getComponentNameFromType(ReactCurrentOwner.current.type);
1733
- if (name) {
1734
- return "\n\nCheck the render method of `" + name + "`.";
1735
- }
1736
- }
1737
- return "";
1738
- }
1739
- function getSourceInfoErrorAddendum(source) {
1740
- if (source !== void 0) {
1741
- var fileName = source.fileName.replace(/^.*[\\\/]/, "");
1742
- var lineNumber = source.lineNumber;
1743
- return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
1744
- }
1745
- return "";
1746
- }
1747
- function getSourceInfoErrorAddendumForProps(elementProps) {
1748
- if (elementProps !== null && elementProps !== void 0) {
1749
- return getSourceInfoErrorAddendum(elementProps.__source);
1750
- }
1751
- return "";
1752
- }
1753
- var ownerHasKeyUseWarning = {};
1754
- function getCurrentComponentErrorInfo(parentType) {
1755
- var info = getDeclarationErrorAddendum();
1756
- if (!info) {
1757
- var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
1758
- if (parentName) {
1759
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1760
- }
1761
- }
1762
- return info;
1763
- }
1764
- function validateExplicitKey(element, parentType) {
1765
- if (!element._store || element._store.validated || element.key != null) {
1766
- return;
1767
- }
1768
- element._store.validated = true;
1769
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1770
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1771
- return;
1772
- }
1773
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
1774
- var childOwner = "";
1775
- if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1776
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1777
- }
1778
- {
1779
- setCurrentlyValidatingElement$1(element);
1780
- error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1781
- setCurrentlyValidatingElement$1(null);
1782
- }
1783
- }
1784
- function validateChildKeys(node, parentType) {
1785
- if (typeof node !== "object") {
1786
- return;
1787
- }
1788
- if (isArray(node)) {
1789
- for (var i = 0; i < node.length; i++) {
1790
- var child = node[i];
1791
- if (isValidElement(child)) {
1792
- validateExplicitKey(child, parentType);
1793
- }
1794
- }
1795
- } else if (isValidElement(node)) {
1796
- if (node._store) {
1797
- node._store.validated = true;
1798
- }
1799
- } else if (node) {
1800
- var iteratorFn = getIteratorFn(node);
1801
- if (typeof iteratorFn === "function") {
1802
- if (iteratorFn !== node.entries) {
1803
- var iterator = iteratorFn.call(node);
1804
- var step;
1805
- while (!(step = iterator.next()).done) {
1806
- if (isValidElement(step.value)) {
1807
- validateExplicitKey(step.value, parentType);
1808
- }
1809
- }
1810
- }
1811
- }
1812
- }
1813
- }
1814
- function validatePropTypes(element) {
1815
- {
1816
- var type = element.type;
1817
- if (type === null || type === void 0 || typeof type === "string") {
1818
- return;
1819
- }
1820
- var propTypes;
1821
- if (typeof type === "function") {
1822
- propTypes = type.propTypes;
1823
- } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1824
- // Inner props are checked in the reconciler.
1825
- type.$$typeof === REACT_MEMO_TYPE)) {
1826
- propTypes = type.propTypes;
1827
- } else {
1828
- return;
1829
- }
1830
- if (propTypes) {
1831
- var name = getComponentNameFromType(type);
1832
- checkPropTypes(propTypes, element.props, "prop", name, element);
1833
- } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
1834
- propTypesMisspellWarningShown = true;
1835
- var _name = getComponentNameFromType(type);
1836
- error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
1837
- }
1838
- if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
1839
- error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
1840
- }
1841
- }
1842
- }
1843
- function validateFragmentProps(fragment) {
1844
- {
1845
- var keys = Object.keys(fragment.props);
1846
- for (var i = 0; i < keys.length; i++) {
1847
- var key = keys[i];
1848
- if (key !== "children" && key !== "key") {
1849
- setCurrentlyValidatingElement$1(fragment);
1850
- error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
1851
- setCurrentlyValidatingElement$1(null);
1852
- break;
1853
- }
1854
- }
1855
- if (fragment.ref !== null) {
1856
- setCurrentlyValidatingElement$1(fragment);
1857
- error("Invalid attribute `ref` supplied to `React.Fragment`.");
1858
- setCurrentlyValidatingElement$1(null);
1859
- }
1860
- }
1861
- }
1862
- function createElementWithValidation(type, props, children) {
1863
- var validType = isValidElementType(type);
1864
- if (!validType) {
1865
- var info = "";
1866
- if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
1867
- info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
1868
- }
1869
- var sourceInfo = getSourceInfoErrorAddendumForProps(props);
1870
- if (sourceInfo) {
1871
- info += sourceInfo;
1872
- } else {
1873
- info += getDeclarationErrorAddendum();
1874
- }
1875
- var typeString;
1876
- if (type === null) {
1877
- typeString = "null";
1878
- } else if (isArray(type)) {
1879
- typeString = "array";
1880
- } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
1881
- typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
1882
- info = " Did you accidentally export a JSX literal instead of a component?";
1883
- } else {
1884
- typeString = typeof type;
1885
- }
1886
- {
1887
- error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
1888
- }
1889
- }
1890
- var element = createElement.apply(this, arguments);
1891
- if (element == null) {
1892
- return element;
1893
- }
1894
- if (validType) {
1895
- for (var i = 2; i < arguments.length; i++) {
1896
- validateChildKeys(arguments[i], type);
1897
- }
1898
- }
1899
- if (type === REACT_FRAGMENT_TYPE) {
1900
- validateFragmentProps(element);
1901
- } else {
1902
- validatePropTypes(element);
1903
- }
1904
- return element;
1905
- }
1906
- var didWarnAboutDeprecatedCreateFactory = false;
1907
- function createFactoryWithValidation(type) {
1908
- var validatedFactory = createElementWithValidation.bind(null, type);
1909
- validatedFactory.type = type;
1910
- {
1911
- if (!didWarnAboutDeprecatedCreateFactory) {
1912
- didWarnAboutDeprecatedCreateFactory = true;
1913
- warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.");
1914
- }
1915
- Object.defineProperty(validatedFactory, "type", {
1916
- enumerable: false,
1917
- get: function() {
1918
- warn("Factory.type is deprecated. Access the class directly before passing it to createFactory.");
1919
- Object.defineProperty(this, "type", {
1920
- value: type
1921
- });
1922
- return type;
1923
- }
1924
- });
1925
- }
1926
- return validatedFactory;
1927
- }
1928
- function cloneElementWithValidation(element, props, children) {
1929
- var newElement = cloneElement.apply(this, arguments);
1930
- for (var i = 2; i < arguments.length; i++) {
1931
- validateChildKeys(arguments[i], newElement.type);
1932
- }
1933
- validatePropTypes(newElement);
1934
- return newElement;
1935
- }
1936
- function startTransition(scope, options) {
1937
- var prevTransition = ReactCurrentBatchConfig.transition;
1938
- ReactCurrentBatchConfig.transition = {};
1939
- var currentTransition = ReactCurrentBatchConfig.transition;
1940
- {
1941
- ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set();
1942
- }
1943
- try {
1944
- scope();
1945
- } finally {
1946
- ReactCurrentBatchConfig.transition = prevTransition;
1947
- {
1948
- if (prevTransition === null && currentTransition._updatedFibers) {
1949
- var updatedFibersCount = currentTransition._updatedFibers.size;
1950
- if (updatedFibersCount > 10) {
1951
- warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.");
1952
- }
1953
- currentTransition._updatedFibers.clear();
1954
- }
1955
- }
1956
- }
1957
- }
1958
- var didWarnAboutMessageChannel = false;
1959
- var enqueueTaskImpl = null;
1960
- function enqueueTask(task) {
1961
- if (enqueueTaskImpl === null) {
1962
- try {
1963
- var requireString = ("require" + Math.random()).slice(0, 7);
1964
- var nodeRequire = module2 && module2[requireString];
1965
- enqueueTaskImpl = nodeRequire.call(module2, "timers").setImmediate;
1966
- } catch (_err) {
1967
- enqueueTaskImpl = function(callback) {
1968
- {
1969
- if (didWarnAboutMessageChannel === false) {
1970
- didWarnAboutMessageChannel = true;
1971
- if (typeof MessageChannel === "undefined") {
1972
- error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning.");
1973
- }
1974
- }
1975
- }
1976
- var channel = new MessageChannel();
1977
- channel.port1.onmessage = callback;
1978
- channel.port2.postMessage(void 0);
1979
- };
1980
- }
1981
- }
1982
- return enqueueTaskImpl(task);
1983
- }
1984
- var actScopeDepth = 0;
1985
- var didWarnNoAwaitAct = false;
1986
- function act(callback) {
1987
- {
1988
- var prevActScopeDepth = actScopeDepth;
1989
- actScopeDepth++;
1990
- if (ReactCurrentActQueue.current === null) {
1991
- ReactCurrentActQueue.current = [];
1992
- }
1993
- var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
1994
- var result;
1995
- try {
1996
- ReactCurrentActQueue.isBatchingLegacy = true;
1997
- result = callback();
1998
- if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
1999
- var queue = ReactCurrentActQueue.current;
2000
- if (queue !== null) {
2001
- ReactCurrentActQueue.didScheduleLegacyUpdate = false;
2002
- flushActQueue(queue);
2003
- }
2004
- }
2005
- } catch (error2) {
2006
- popActScope(prevActScopeDepth);
2007
- throw error2;
2008
- } finally {
2009
- ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
2010
- }
2011
- if (result !== null && typeof result === "object" && typeof result.then === "function") {
2012
- var thenableResult = result;
2013
- var wasAwaited = false;
2014
- var thenable = {
2015
- then: function(resolve, reject) {
2016
- wasAwaited = true;
2017
- thenableResult.then(function(returnValue2) {
2018
- popActScope(prevActScopeDepth);
2019
- if (actScopeDepth === 0) {
2020
- recursivelyFlushAsyncActWork(returnValue2, resolve, reject);
2021
- } else {
2022
- resolve(returnValue2);
2023
- }
2024
- }, function(error2) {
2025
- popActScope(prevActScopeDepth);
2026
- reject(error2);
2027
- });
2028
- }
2029
- };
2030
- {
2031
- if (!didWarnNoAwaitAct && typeof Promise !== "undefined") {
2032
- Promise.resolve().then(function() {
2033
- }).then(function() {
2034
- if (!wasAwaited) {
2035
- didWarnNoAwaitAct = true;
2036
- error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);");
2037
- }
2038
- });
2039
- }
2040
- }
2041
- return thenable;
2042
- } else {
2043
- var returnValue = result;
2044
- popActScope(prevActScopeDepth);
2045
- if (actScopeDepth === 0) {
2046
- var _queue = ReactCurrentActQueue.current;
2047
- if (_queue !== null) {
2048
- flushActQueue(_queue);
2049
- ReactCurrentActQueue.current = null;
2050
- }
2051
- var _thenable = {
2052
- then: function(resolve, reject) {
2053
- if (ReactCurrentActQueue.current === null) {
2054
- ReactCurrentActQueue.current = [];
2055
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2056
- } else {
2057
- resolve(returnValue);
2058
- }
2059
- }
2060
- };
2061
- return _thenable;
2062
- } else {
2063
- var _thenable2 = {
2064
- then: function(resolve, reject) {
2065
- resolve(returnValue);
2066
- }
2067
- };
2068
- return _thenable2;
2069
- }
2070
- }
2071
- }
2072
- }
2073
- function popActScope(prevActScopeDepth) {
2074
- {
2075
- if (prevActScopeDepth !== actScopeDepth - 1) {
2076
- error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
2077
- }
2078
- actScopeDepth = prevActScopeDepth;
2079
- }
2080
- }
2081
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
2082
- {
2083
- var queue = ReactCurrentActQueue.current;
2084
- if (queue !== null) {
2085
- try {
2086
- flushActQueue(queue);
2087
- enqueueTask(function() {
2088
- if (queue.length === 0) {
2089
- ReactCurrentActQueue.current = null;
2090
- resolve(returnValue);
2091
- } else {
2092
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2093
- }
2094
- });
2095
- } catch (error2) {
2096
- reject(error2);
2097
- }
2098
- } else {
2099
- resolve(returnValue);
2100
- }
2101
- }
2102
- }
2103
- var isFlushing = false;
2104
- function flushActQueue(queue) {
2105
- {
2106
- if (!isFlushing) {
2107
- isFlushing = true;
2108
- var i = 0;
2109
- try {
2110
- for (; i < queue.length; i++) {
2111
- var callback = queue[i];
2112
- do {
2113
- callback = callback(true);
2114
- } while (callback !== null);
2115
- }
2116
- queue.length = 0;
2117
- } catch (error2) {
2118
- queue = queue.slice(i + 1);
2119
- throw error2;
2120
- } finally {
2121
- isFlushing = false;
2122
- }
2123
- }
2124
- }
2125
- }
2126
- var createElement$1 = createElementWithValidation;
2127
- var cloneElement$1 = cloneElementWithValidation;
2128
- var createFactory = createFactoryWithValidation;
2129
- var Children = {
2130
- map: mapChildren,
2131
- forEach: forEachChildren,
2132
- count: countChildren,
2133
- toArray,
2134
- only: onlyChild
2135
- };
2136
- exports2.Children = Children;
2137
- exports2.Component = Component;
2138
- exports2.Fragment = REACT_FRAGMENT_TYPE;
2139
- exports2.Profiler = REACT_PROFILER_TYPE;
2140
- exports2.PureComponent = PureComponent;
2141
- exports2.StrictMode = REACT_STRICT_MODE_TYPE;
2142
- exports2.Suspense = REACT_SUSPENSE_TYPE;
2143
- exports2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2144
- exports2.act = act;
2145
- exports2.cloneElement = cloneElement$1;
2146
- exports2.createContext = createContext;
2147
- exports2.createElement = createElement$1;
2148
- exports2.createFactory = createFactory;
2149
- exports2.createRef = createRef;
2150
- exports2.forwardRef = forwardRef;
2151
- exports2.isValidElement = isValidElement;
2152
- exports2.lazy = lazy;
2153
- exports2.memo = memo;
2154
- exports2.startTransition = startTransition;
2155
- exports2.unstable_act = act;
2156
- exports2.useCallback = useCallback;
2157
- exports2.useContext = useContext;
2158
- exports2.useDebugValue = useDebugValue;
2159
- exports2.useDeferredValue = useDeferredValue;
2160
- exports2.useEffect = useEffect;
2161
- exports2.useId = useId;
2162
- exports2.useImperativeHandle = useImperativeHandle;
2163
- exports2.useInsertionEffect = useInsertionEffect;
2164
- exports2.useLayoutEffect = useLayoutEffect;
2165
- exports2.useMemo = useMemo;
2166
- exports2.useReducer = useReducer;
2167
- exports2.useRef = useRef;
2168
- exports2.useState = useState;
2169
- exports2.useSyncExternalStore = useSyncExternalStore;
2170
- exports2.useTransition = useTransition;
2171
- exports2.version = ReactVersion;
2172
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
2173
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2174
- }
2175
- })();
2176
- }
2177
- }
2178
- });
2179
-
2180
- // ../../node_modules/react/index.js
2181
- var require_react = __commonJS({
2182
- "../../node_modules/react/index.js"(exports2, module2) {
2183
- "use strict";
2184
- if (process.env.NODE_ENV === "production") {
2185
- module2.exports = require_react_production_min();
2186
- } else {
2187
- module2.exports = require_react_development();
2188
- }
2189
- }
2190
- });
2191
-
2192
30
  // src/pm/react/index.ts
2193
- var react_exports = {};
2194
- __export(react_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
2195
33
  domOutputSpecToReactElement: () => domOutputSpecToReactElement,
2196
34
  mapMarkExtensionToReactNode: () => mapMarkExtensionToReactNode,
2197
35
  mapNodeExtensionToReactNode: () => mapNodeExtensionToReactNode,
2198
36
  renderToElement: () => renderToElement,
2199
37
  renderToReactElement: () => renderToReactElement
2200
38
  });
2201
- module.exports = __toCommonJS(react_exports);
39
+ module.exports = __toCommonJS(index_exports);
2202
40
 
2203
41
  // src/pm/extensionRenderer.ts
2204
42
  var import_core2 = require("@tiptap/core");
@@ -2212,7 +50,7 @@ function getAttributes(nodeOrMark, extensionAttributes, onlyRenderedAttributes)
2212
50
  return {};
2213
51
  }
2214
52
  return extensionAttributes.filter((item) => {
2215
- if (item.type !== nodeOrMark.type) {
53
+ if (item.type !== (typeof nodeOrMark.type === "string" ? nodeOrMark.type : nodeOrMark.type.name)) {
2216
54
  return false;
2217
55
  }
2218
56
  if (onlyRenderedAttributes) {
@@ -2242,11 +80,7 @@ function mapNodeExtensionToReactNode(domOutputSpecToElement, extension, extensio
2242
80
  storage: extension.storage,
2243
81
  parent: extension.parent
2244
82
  };
2245
- const renderToHTML = (0, import_core2.getExtensionField)(
2246
- extension,
2247
- "renderHTML",
2248
- context
2249
- );
83
+ const renderToHTML = (0, import_core2.getExtensionField)(extension, "renderHTML", context);
2250
84
  if (!renderToHTML) {
2251
85
  if (options == null ? void 0 : options.unhandledNode) {
2252
86
  return [extension.name, options.unhandledNode];
@@ -2286,11 +120,7 @@ function mapMarkExtensionToReactNode(domOutputSpecToElement, extension, extensio
2286
120
  storage: extension.storage,
2287
121
  parent: extension.parent
2288
122
  };
2289
- const renderToHTML = (0, import_core2.getExtensionField)(
2290
- extension,
2291
- "renderHTML",
2292
- context
2293
- );
123
+ const renderToHTML = (0, import_core2.getExtensionField)(extension, "renderHTML", context);
2294
124
  if (!renderToHTML) {
2295
125
  if (options == null ? void 0 : options.unhandledMark) {
2296
126
  return [extension.name, options.unhandledMark];
@@ -2298,9 +128,7 @@ function mapMarkExtensionToReactNode(domOutputSpecToElement, extension, extensio
2298
128
  return [
2299
129
  extension.name,
2300
130
  () => {
2301
- throw new Error(
2302
- `Node ${extension.name} cannot be rendered, it is missing a "renderToHTML" method`
2303
- );
131
+ throw new Error(`Node ${extension.name} cannot be rendered, it is missing a "renderToHTML" method`);
2304
132
  }
2305
133
  ];
2306
134
  }
@@ -2349,12 +177,9 @@ function renderToElement({
2349
177
  return !(e.name in options.nodeMapping);
2350
178
  }
2351
179
  return true;
2352
- }).map((nodeExtension) => mapNodeExtensionToReactNode(
2353
- domOutputSpecToElement,
2354
- nodeExtension,
2355
- extensionAttributes,
2356
- options
2357
- ))
180
+ }).map(
181
+ (nodeExtension) => mapNodeExtensionToReactNode(domOutputSpecToElement, nodeExtension, extensionAttributes, options)
182
+ )
2358
183
  ),
2359
184
  ...mapDefinedTypes,
2360
185
  ...options == null ? void 0 : options.nodeMapping
@@ -2366,23 +191,18 @@ function renderToElement({
2366
191
  return !(e.name in options.markMapping);
2367
192
  }
2368
193
  return true;
2369
- }).map((mark) => mapMarkExtensionToReactNode(
2370
- domOutputSpecToElement,
2371
- mark,
2372
- extensionAttributes,
2373
- options
2374
- ))
194
+ }).map((mark) => mapMarkExtensionToReactNode(domOutputSpecToElement, mark, extensionAttributes, options))
2375
195
  ),
2376
196
  ...options == null ? void 0 : options.markMapping
2377
197
  }
2378
198
  })({ content });
2379
199
  }
2380
200
 
2381
- // src/pm/react/react.tsx
2382
- var import_react2 = __toESM(require_react(), 1);
201
+ // src/pm/react/react.ts
202
+ var import_react2 = __toESM(require("react"), 1);
2383
203
 
2384
- // src/json/react/react.tsx
2385
- var import_react = __toESM(require_react(), 1);
204
+ // src/json/react/react.ts
205
+ var import_react = __toESM(require("react"), 1);
2386
206
 
2387
207
  // src/json/renderer.ts
2388
208
  function TiptapStaticRenderer(renderComponent, {
@@ -2445,23 +265,20 @@ function TiptapStaticRenderer(renderComponent, {
2445
265
  };
2446
266
  }
2447
267
 
2448
- // src/json/react/react.tsx
268
+ // src/json/react/react.ts
2449
269
  function renderJSONContentToReactElement(options) {
2450
270
  let key = 0;
2451
- return TiptapStaticRenderer(
2452
- ({ component, props: { children, ...props } }) => {
2453
- return import_react.default.createElement(
2454
- component,
2455
- // eslint-disable-next-line no-plusplus
2456
- Object.assign(props, { key: key++ }),
2457
- [].concat(children)
2458
- );
2459
- },
2460
- options
2461
- );
271
+ return TiptapStaticRenderer(({ component, props: { children, ...props } }) => {
272
+ return import_react.default.createElement(
273
+ component,
274
+ // eslint-disable-next-line no-plusplus
275
+ Object.assign(props, { key: key++ }),
276
+ [].concat(children)
277
+ );
278
+ }, options);
2462
279
  }
2463
280
 
2464
- // src/pm/react/react.tsx
281
+ // src/pm/react/react.ts
2465
282
  function mapAttrsToHTMLAttributes(attrs, key) {
2466
283
  if (!attrs) {
2467
284
  return { key };
@@ -2481,7 +298,25 @@ function domOutputSpecToReactElement(content, key = 0) {
2481
298
  return () => content;
2482
299
  }
2483
300
  if (typeof content === "object" && "length" in content) {
2484
- const [tag, attrs, children, ...rest] = content;
301
+ let [tag, attrs, children, ...rest] = content;
302
+ const parts = tag.split(" ");
303
+ if (parts.length > 1) {
304
+ tag = parts[1];
305
+ if (attrs === void 0) {
306
+ attrs = {
307
+ xmlns: parts[0]
308
+ };
309
+ }
310
+ if (attrs === 0) {
311
+ attrs = {
312
+ xmlns: parts[0]
313
+ };
314
+ children = 0;
315
+ }
316
+ if (typeof attrs === "object") {
317
+ attrs = Object.assign(attrs, { xmlns: parts[0] });
318
+ }
319
+ }
2485
320
  if (attrs === void 0) {
2486
321
  return () => import_react2.default.createElement(tag, mapAttrsToHTMLAttributes(void 0, key.toString()));
2487
322
  }
@@ -2525,7 +360,7 @@ function domOutputSpecToReactElement(content, key = 0) {
2525
360
  }
2526
361
  }
2527
362
  throw new Error(
2528
- "[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output",
363
+ "[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping",
2529
364
  {
2530
365
  cause: content
2531
366
  }
@@ -2541,7 +376,7 @@ function renderToReactElement({
2541
376
  domOutputSpecToElement: domOutputSpecToReactElement,
2542
377
  mapDefinedTypes: {
2543
378
  // Map a doc node to concatenated children
2544
- doc: ({ children }) => /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, children),
379
+ doc: ({ children }) => import_react2.default.createElement(import_react2.default.Fragment, {}, children),
2545
380
  // Map a text node to its text content
2546
381
  text: ({ node }) => {
2547
382
  var _a;
@@ -2561,28 +396,4 @@ function renderToReactElement({
2561
396
  renderToElement,
2562
397
  renderToReactElement
2563
398
  });
2564
- /*! Bundled license information:
2565
-
2566
- react/cjs/react.production.min.js:
2567
- (**
2568
- * @license React
2569
- * react.production.min.js
2570
- *
2571
- * Copyright (c) Facebook, Inc. and its affiliates.
2572
- *
2573
- * This source code is licensed under the MIT license found in the
2574
- * LICENSE file in the root directory of this source tree.
2575
- *)
2576
-
2577
- react/cjs/react.development.js:
2578
- (**
2579
- * @license React
2580
- * react.development.js
2581
- *
2582
- * Copyright (c) Facebook, Inc. and its affiliates.
2583
- *
2584
- * This source code is licensed under the MIT license found in the
2585
- * LICENSE file in the root directory of this source tree.
2586
- *)
2587
- */
2588
399
  //# sourceMappingURL=index.cjs.map