@kubb/plugin-oas 3.0.0-alpha.3 → 3.0.0-alpha.31

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 (105) hide show
  1. package/README.md +13 -4
  2. package/dist/OperationGenerator-BgQeGRzk.d.cts +550 -0
  3. package/dist/OperationGenerator-BgQeGRzk.d.ts +550 -0
  4. package/dist/Schema-1iM2I0dK.d.ts +22 -0
  5. package/dist/Schema-5o-c5UOy.d.cts +22 -0
  6. package/dist/chunk-ABOQ73FL.cjs +36 -0
  7. package/dist/chunk-ABOQ73FL.cjs.map +1 -0
  8. package/dist/chunk-BG77DP54.js +30 -0
  9. package/dist/chunk-BG77DP54.js.map +1 -0
  10. package/dist/chunk-GF26SDHQ.js +28 -0
  11. package/dist/chunk-GF26SDHQ.js.map +1 -0
  12. package/dist/chunk-PADR76WZ.cjs +4 -0
  13. package/dist/chunk-PADR76WZ.cjs.map +1 -0
  14. package/dist/chunk-QAFBZLJA.cjs +48 -0
  15. package/dist/chunk-QAFBZLJA.cjs.map +1 -0
  16. package/dist/chunk-QT6ZFRNJ.cjs +752 -0
  17. package/dist/chunk-QT6ZFRNJ.cjs.map +1 -0
  18. package/dist/chunk-QWO5NQGQ.js +88 -0
  19. package/dist/chunk-QWO5NQGQ.js.map +1 -0
  20. package/dist/chunk-R47XMJ32.js +3 -0
  21. package/dist/chunk-R47XMJ32.js.map +1 -0
  22. package/dist/chunk-SR63CBLH.cjs +92 -0
  23. package/dist/chunk-SR63CBLH.cjs.map +1 -0
  24. package/dist/chunk-V2JO6RHI.js +744 -0
  25. package/dist/chunk-V2JO6RHI.js.map +1 -0
  26. package/dist/chunk-XNCEFOE6.js +45 -0
  27. package/dist/chunk-XNCEFOE6.js.map +1 -0
  28. package/dist/chunk-ZWHQ54JM.cjs +32 -0
  29. package/dist/chunk-ZWHQ54JM.cjs.map +1 -0
  30. package/dist/components.cjs +20 -12
  31. package/dist/components.cjs.map +1 -1
  32. package/dist/components.d.cts +4 -7
  33. package/dist/components.d.ts +4 -7
  34. package/dist/components.js +3 -12
  35. package/dist/components.js.map +1 -1
  36. package/dist/generators.cjs +14 -0
  37. package/dist/generators.cjs.map +1 -0
  38. package/dist/generators.d.cts +9 -0
  39. package/dist/generators.d.ts +9 -0
  40. package/dist/generators.js +5 -0
  41. package/dist/generators.js.map +1 -0
  42. package/dist/hooks.cjs +102 -57
  43. package/dist/hooks.cjs.map +1 -1
  44. package/dist/hooks.d.cts +41 -10
  45. package/dist/hooks.d.ts +41 -10
  46. package/dist/hooks.js +91 -53
  47. package/dist/hooks.js.map +1 -1
  48. package/dist/index.cjs +192 -258
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.d.cts +3 -6
  51. package/dist/index.d.ts +3 -6
  52. package/dist/index.js +135 -228
  53. package/dist/index.js.map +1 -1
  54. package/dist/utils.cjs +32 -87
  55. package/dist/utils.cjs.map +1 -1
  56. package/dist/utils.d.cts +8 -43
  57. package/dist/utils.d.ts +8 -43
  58. package/dist/utils.js +8 -86
  59. package/dist/utils.js.map +1 -1
  60. package/package.json +20 -14
  61. package/src/OperationGenerator.ts +23 -30
  62. package/src/SchemaGenerator.ts +80 -23
  63. package/src/SchemaMapper.ts +7 -5
  64. package/src/components/Oas.tsx +1 -1
  65. package/src/components/Operation.tsx +1 -1
  66. package/src/components/Schema.tsx +2 -102
  67. package/src/{parser.tsx → generator.tsx} +31 -22
  68. package/src/generators/index.ts +1 -0
  69. package/src/generators/jsonGenerator.ts +32 -0
  70. package/src/hooks/index.ts +2 -0
  71. package/src/hooks/useOperationManager.ts +77 -29
  72. package/src/hooks/useSchemaManager.ts +77 -0
  73. package/src/index.ts +3 -3
  74. package/src/plugin.ts +67 -59
  75. package/src/types.ts +24 -16
  76. package/src/utils/getParams.ts +2 -2
  77. package/src/utils/getSchemaFactory.ts +1 -1
  78. package/src/utils/index.ts +2 -2
  79. package/src/utils/parseFromConfig.ts +7 -7
  80. package/dist/OperationGenerator-D7rSlflc.d.cts +0 -158
  81. package/dist/OperationGenerator-vw0Zf-Mi.d.ts +0 -158
  82. package/dist/Schema-DxyOIX7q.d.cts +0 -35
  83. package/dist/Schema-gHgN14i2.d.ts +0 -35
  84. package/dist/SchemaMapper-BM1IGWqD.d.cts +0 -248
  85. package/dist/SchemaMapper-BM1IGWqD.d.ts +0 -248
  86. package/dist/chunk-264TCCJF.cjs +0 -3973
  87. package/dist/chunk-264TCCJF.cjs.map +0 -1
  88. package/dist/chunk-7KIEQOVZ.cjs +0 -7
  89. package/dist/chunk-7KIEQOVZ.cjs.map +0 -1
  90. package/dist/chunk-FZN3PBEK.js +0 -3973
  91. package/dist/chunk-FZN3PBEK.js.map +0 -1
  92. package/dist/chunk-P42X362U.cjs +0 -101
  93. package/dist/chunk-P42X362U.cjs.map +0 -1
  94. package/dist/chunk-QLJIL3U5.cjs +0 -35
  95. package/dist/chunk-QLJIL3U5.cjs.map +0 -1
  96. package/dist/chunk-TWKZEVSM.js +0 -7
  97. package/dist/chunk-TWKZEVSM.js.map +0 -1
  98. package/dist/chunk-UB552H4J.js +0 -101
  99. package/dist/chunk-UB552H4J.js.map +0 -1
  100. package/dist/chunk-Y4V7HHX7.js +0 -35
  101. package/dist/chunk-Y4V7HHX7.js.map +0 -1
  102. package/dist/types-C2RXaY0_.d.cts +0 -143
  103. package/dist/types-C2RXaY0_.d.ts +0 -143
  104. package/src/utils/getGroupedByTagFiles.ts +0 -82
  105. package/src/utils/refSorter.ts +0 -13
@@ -1,3973 +0,0 @@
1
- import {
2
- __commonJS,
3
- __privateAdd,
4
- __privateGet,
5
- __privateMethod,
6
- __toESM,
7
- getSchemaFactory,
8
- getSchemas,
9
- init_esm_shims
10
- } from "./chunk-UB552H4J.js";
11
-
12
- // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
13
- var require_react_production_min = __commonJS({
14
- "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js"(exports) {
15
- "use strict";
16
- init_esm_shims();
17
- var l = Symbol.for("react.element");
18
- var n = Symbol.for("react.portal");
19
- var p = Symbol.for("react.fragment");
20
- var q = Symbol.for("react.strict_mode");
21
- var r = Symbol.for("react.profiler");
22
- var t = Symbol.for("react.provider");
23
- var u = Symbol.for("react.context");
24
- var v = Symbol.for("react.forward_ref");
25
- var w = Symbol.for("react.suspense");
26
- var x = Symbol.for("react.memo");
27
- var y = Symbol.for("react.lazy");
28
- var z = Symbol.iterator;
29
- function A(a) {
30
- if (null === a || "object" !== typeof a) return null;
31
- a = z && a[z] || a["@@iterator"];
32
- return "function" === typeof a ? a : null;
33
- }
34
- var B = { isMounted: function() {
35
- return false;
36
- }, enqueueForceUpdate: function() {
37
- }, enqueueReplaceState: function() {
38
- }, enqueueSetState: function() {
39
- } };
40
- var C = Object.assign;
41
- var D = {};
42
- function E(a, b, e) {
43
- this.props = a;
44
- this.context = b;
45
- this.refs = D;
46
- this.updater = e || B;
47
- }
48
- E.prototype.isReactComponent = {};
49
- E.prototype.setState = function(a, b) {
50
- 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.");
51
- this.updater.enqueueSetState(this, a, b, "setState");
52
- };
53
- E.prototype.forceUpdate = function(a) {
54
- this.updater.enqueueForceUpdate(this, a, "forceUpdate");
55
- };
56
- function F() {
57
- }
58
- F.prototype = E.prototype;
59
- function G(a, b, e) {
60
- this.props = a;
61
- this.context = b;
62
- this.refs = D;
63
- this.updater = e || B;
64
- }
65
- var H = G.prototype = new F();
66
- H.constructor = G;
67
- C(H, E.prototype);
68
- H.isPureReactComponent = true;
69
- var I = Array.isArray;
70
- var J = Object.prototype.hasOwnProperty;
71
- var K = { current: null };
72
- var L = { key: true, ref: true, __self: true, __source: true };
73
- function M(a, b, e) {
74
- var d, c = {}, k = null, h = null;
75
- 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]);
76
- var g = arguments.length - 2;
77
- if (1 === g) c.children = e;
78
- else if (1 < g) {
79
- for (var f = Array(g), m = 0; m < g; m++) f[m] = arguments[m + 2];
80
- c.children = f;
81
- }
82
- if (a && a.defaultProps) for (d in g = a.defaultProps, g) void 0 === c[d] && (c[d] = g[d]);
83
- return { $$typeof: l, type: a, key: k, ref: h, props: c, _owner: K.current };
84
- }
85
- function N(a, b) {
86
- return { $$typeof: l, type: a.type, key: b, ref: a.ref, props: a.props, _owner: a._owner };
87
- }
88
- function O(a) {
89
- return "object" === typeof a && null !== a && a.$$typeof === l;
90
- }
91
- function escape(a) {
92
- var b = { "=": "=0", ":": "=2" };
93
- return "$" + a.replace(/[=:]/g, function(a2) {
94
- return b[a2];
95
- });
96
- }
97
- var P = /\/+/g;
98
- function Q(a, b) {
99
- return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
100
- }
101
- function R(a, b, e, d, c) {
102
- var k = typeof a;
103
- if ("undefined" === k || "boolean" === k) a = null;
104
- var h = false;
105
- if (null === a) h = true;
106
- else switch (k) {
107
- case "string":
108
- case "number":
109
- h = true;
110
- break;
111
- case "object":
112
- switch (a.$$typeof) {
113
- case l:
114
- case n:
115
- h = true;
116
- }
117
- }
118
- 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) {
119
- return a2;
120
- })) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), b.push(c)), 1;
121
- h = 0;
122
- d = "" === d ? "." : d + ":";
123
- if (I(a)) for (var g = 0; g < a.length; g++) {
124
- k = a[g];
125
- var f = d + Q(k, g);
126
- h += R(k, b, e, f, c);
127
- }
128
- 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);
129
- 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.");
130
- return h;
131
- }
132
- function S(a, b, e) {
133
- if (null == a) return a;
134
- var d = [], c = 0;
135
- R(a, d, "", "", function(a2) {
136
- return b.call(e, a2, c++);
137
- });
138
- return d;
139
- }
140
- function T(a) {
141
- if (-1 === a._status) {
142
- var b = a._result;
143
- b = b();
144
- b.then(function(b2) {
145
- if (0 === a._status || -1 === a._status) a._status = 1, a._result = b2;
146
- }, function(b2) {
147
- if (0 === a._status || -1 === a._status) a._status = 2, a._result = b2;
148
- });
149
- -1 === a._status && (a._status = 0, a._result = b);
150
- }
151
- if (1 === a._status) return a._result.default;
152
- throw a._result;
153
- }
154
- var U = { current: null };
155
- var V = { transition: null };
156
- var W = { ReactCurrentDispatcher: U, ReactCurrentBatchConfig: V, ReactCurrentOwner: K };
157
- function X() {
158
- throw Error("act(...) is not supported in production builds of React.");
159
- }
160
- exports.Children = { map: S, forEach: function(a, b, e) {
161
- S(a, function() {
162
- b.apply(this, arguments);
163
- }, e);
164
- }, count: function(a) {
165
- var b = 0;
166
- S(a, function() {
167
- b++;
168
- });
169
- return b;
170
- }, toArray: function(a) {
171
- return S(a, function(a2) {
172
- return a2;
173
- }) || [];
174
- }, only: function(a) {
175
- if (!O(a)) throw Error("React.Children.only expected to receive a single React element child.");
176
- return a;
177
- } };
178
- exports.Component = E;
179
- exports.Fragment = p;
180
- exports.Profiler = r;
181
- exports.PureComponent = G;
182
- exports.StrictMode = q;
183
- exports.Suspense = w;
184
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
185
- exports.act = X;
186
- exports.cloneElement = function(a, b, e) {
187
- if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
188
- var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner;
189
- if (null != b) {
190
- void 0 !== b.ref && (k = b.ref, h = K.current);
191
- void 0 !== b.key && (c = "" + b.key);
192
- if (a.type && a.type.defaultProps) var g = a.type.defaultProps;
193
- for (f in b) J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
194
- }
195
- var f = arguments.length - 2;
196
- if (1 === f) d.children = e;
197
- else if (1 < f) {
198
- g = Array(f);
199
- for (var m = 0; m < f; m++) g[m] = arguments[m + 2];
200
- d.children = g;
201
- }
202
- return { $$typeof: l, type: a.type, key: c, ref: k, props: d, _owner: h };
203
- };
204
- exports.createContext = function(a) {
205
- a = { $$typeof: u, _currentValue: a, _currentValue2: a, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null };
206
- a.Provider = { $$typeof: t, _context: a };
207
- return a.Consumer = a;
208
- };
209
- exports.createElement = M;
210
- exports.createFactory = function(a) {
211
- var b = M.bind(null, a);
212
- b.type = a;
213
- return b;
214
- };
215
- exports.createRef = function() {
216
- return { current: null };
217
- };
218
- exports.forwardRef = function(a) {
219
- return { $$typeof: v, render: a };
220
- };
221
- exports.isValidElement = O;
222
- exports.lazy = function(a) {
223
- return { $$typeof: y, _payload: { _status: -1, _result: a }, _init: T };
224
- };
225
- exports.memo = function(a, b) {
226
- return { $$typeof: x, type: a, compare: void 0 === b ? null : b };
227
- };
228
- exports.startTransition = function(a) {
229
- var b = V.transition;
230
- V.transition = {};
231
- try {
232
- a();
233
- } finally {
234
- V.transition = b;
235
- }
236
- };
237
- exports.unstable_act = X;
238
- exports.useCallback = function(a, b) {
239
- return U.current.useCallback(a, b);
240
- };
241
- exports.useContext = function(a) {
242
- return U.current.useContext(a);
243
- };
244
- exports.useDebugValue = function() {
245
- };
246
- exports.useDeferredValue = function(a) {
247
- return U.current.useDeferredValue(a);
248
- };
249
- exports.useEffect = function(a, b) {
250
- return U.current.useEffect(a, b);
251
- };
252
- exports.useId = function() {
253
- return U.current.useId();
254
- };
255
- exports.useImperativeHandle = function(a, b, e) {
256
- return U.current.useImperativeHandle(a, b, e);
257
- };
258
- exports.useInsertionEffect = function(a, b) {
259
- return U.current.useInsertionEffect(a, b);
260
- };
261
- exports.useLayoutEffect = function(a, b) {
262
- return U.current.useLayoutEffect(a, b);
263
- };
264
- exports.useMemo = function(a, b) {
265
- return U.current.useMemo(a, b);
266
- };
267
- exports.useReducer = function(a, b, e) {
268
- return U.current.useReducer(a, b, e);
269
- };
270
- exports.useRef = function(a) {
271
- return U.current.useRef(a);
272
- };
273
- exports.useState = function(a) {
274
- return U.current.useState(a);
275
- };
276
- exports.useSyncExternalStore = function(a, b, e) {
277
- return U.current.useSyncExternalStore(a, b, e);
278
- };
279
- exports.useTransition = function() {
280
- return U.current.useTransition();
281
- };
282
- exports.version = "18.3.1";
283
- }
284
- });
285
-
286
- // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js
287
- var require_react_development = __commonJS({
288
- "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js"(exports, module) {
289
- "use strict";
290
- init_esm_shims();
291
- if (process.env.NODE_ENV !== "production") {
292
- (function() {
293
- "use strict";
294
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
295
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
296
- }
297
- var ReactVersion = "18.3.1";
298
- var REACT_ELEMENT_TYPE = Symbol.for("react.element");
299
- var REACT_PORTAL_TYPE = Symbol.for("react.portal");
300
- var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
301
- var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
302
- var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
303
- var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
304
- var REACT_CONTEXT_TYPE = Symbol.for("react.context");
305
- var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
306
- var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
307
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
308
- var REACT_MEMO_TYPE = Symbol.for("react.memo");
309
- var REACT_LAZY_TYPE = Symbol.for("react.lazy");
310
- var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
311
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
312
- var FAUX_ITERATOR_SYMBOL = "@@iterator";
313
- function getIteratorFn(maybeIterable) {
314
- if (maybeIterable === null || typeof maybeIterable !== "object") {
315
- return null;
316
- }
317
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
318
- if (typeof maybeIterator === "function") {
319
- return maybeIterator;
320
- }
321
- return null;
322
- }
323
- var ReactCurrentDispatcher = {
324
- /**
325
- * @internal
326
- * @type {ReactComponent}
327
- */
328
- current: null
329
- };
330
- var ReactCurrentBatchConfig = {
331
- transition: null
332
- };
333
- var ReactCurrentActQueue = {
334
- current: null,
335
- // Used to reproduce behavior of `batchedUpdates` in legacy mode.
336
- isBatchingLegacy: false,
337
- didScheduleLegacyUpdate: false
338
- };
339
- var ReactCurrentOwner = {
340
- /**
341
- * @internal
342
- * @type {ReactComponent}
343
- */
344
- current: null
345
- };
346
- var ReactDebugCurrentFrame = {};
347
- var currentExtraStackFrame = null;
348
- function setExtraStackFrame(stack) {
349
- {
350
- currentExtraStackFrame = stack;
351
- }
352
- }
353
- {
354
- ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
355
- {
356
- currentExtraStackFrame = stack;
357
- }
358
- };
359
- ReactDebugCurrentFrame.getCurrentStack = null;
360
- ReactDebugCurrentFrame.getStackAddendum = function() {
361
- var stack = "";
362
- if (currentExtraStackFrame) {
363
- stack += currentExtraStackFrame;
364
- }
365
- var impl = ReactDebugCurrentFrame.getCurrentStack;
366
- if (impl) {
367
- stack += impl() || "";
368
- }
369
- return stack;
370
- };
371
- }
372
- var enableScopeAPI = false;
373
- var enableCacheElement = false;
374
- var enableTransitionTracing = false;
375
- var enableLegacyHidden = false;
376
- var enableDebugTracing = false;
377
- var ReactSharedInternals = {
378
- ReactCurrentDispatcher,
379
- ReactCurrentBatchConfig,
380
- ReactCurrentOwner
381
- };
382
- {
383
- ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
384
- ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
385
- }
386
- function warn(format) {
387
- {
388
- {
389
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
390
- args[_key - 1] = arguments[_key];
391
- }
392
- printWarning("warn", format, args);
393
- }
394
- }
395
- }
396
- function error(format) {
397
- {
398
- {
399
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
400
- args[_key2 - 1] = arguments[_key2];
401
- }
402
- printWarning("error", format, args);
403
- }
404
- }
405
- }
406
- function printWarning(level, format, args) {
407
- {
408
- var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
409
- var stack = ReactDebugCurrentFrame2.getStackAddendum();
410
- if (stack !== "") {
411
- format += "%s";
412
- args = args.concat([stack]);
413
- }
414
- var argsWithFormat = args.map(function(item) {
415
- return String(item);
416
- });
417
- argsWithFormat.unshift("Warning: " + format);
418
- Function.prototype.apply.call(console[level], console, argsWithFormat);
419
- }
420
- }
421
- var didWarnStateUpdateForUnmountedComponent = {};
422
- function warnNoop(publicInstance, callerName) {
423
- {
424
- var _constructor = publicInstance.constructor;
425
- var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass";
426
- var warningKey = componentName + "." + callerName;
427
- if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
428
- return;
429
- }
430
- 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);
431
- didWarnStateUpdateForUnmountedComponent[warningKey] = true;
432
- }
433
- }
434
- var ReactNoopUpdateQueue = {
435
- /**
436
- * Checks whether or not this composite component is mounted.
437
- * @param {ReactClass} publicInstance The instance we want to test.
438
- * @return {boolean} True if mounted, false otherwise.
439
- * @protected
440
- * @final
441
- */
442
- isMounted: function(publicInstance) {
443
- return false;
444
- },
445
- /**
446
- * Forces an update. This should only be invoked when it is known with
447
- * certainty that we are **not** in a DOM transaction.
448
- *
449
- * You may want to call this when you know that some deeper aspect of the
450
- * component's state has changed but `setState` was not called.
451
- *
452
- * This will not invoke `shouldComponentUpdate`, but it will invoke
453
- * `componentWillUpdate` and `componentDidUpdate`.
454
- *
455
- * @param {ReactClass} publicInstance The instance that should rerender.
456
- * @param {?function} callback Called after component is updated.
457
- * @param {?string} callerName name of the calling function in the public API.
458
- * @internal
459
- */
460
- enqueueForceUpdate: function(publicInstance, callback, callerName) {
461
- warnNoop(publicInstance, "forceUpdate");
462
- },
463
- /**
464
- * Replaces all of the state. Always use this or `setState` to mutate state.
465
- * You should treat `this.state` as immutable.
466
- *
467
- * There is no guarantee that `this.state` will be immediately updated, so
468
- * accessing `this.state` after calling this method may return the old value.
469
- *
470
- * @param {ReactClass} publicInstance The instance that should rerender.
471
- * @param {object} completeState Next state.
472
- * @param {?function} callback Called after component is updated.
473
- * @param {?string} callerName name of the calling function in the public API.
474
- * @internal
475
- */
476
- enqueueReplaceState: function(publicInstance, completeState, callback, callerName) {
477
- warnNoop(publicInstance, "replaceState");
478
- },
479
- /**
480
- * Sets a subset of the state. This only exists because _pendingState is
481
- * internal. This provides a merging strategy that is not available to deep
482
- * properties which is confusing. TODO: Expose pendingState or don't use it
483
- * during the merge.
484
- *
485
- * @param {ReactClass} publicInstance The instance that should rerender.
486
- * @param {object} partialState Next partial state to be merged with state.
487
- * @param {?function} callback Called after component is updated.
488
- * @param {?string} Name of the calling function in the public API.
489
- * @internal
490
- */
491
- enqueueSetState: function(publicInstance, partialState, callback, callerName) {
492
- warnNoop(publicInstance, "setState");
493
- }
494
- };
495
- var assign = Object.assign;
496
- var emptyObject = {};
497
- {
498
- Object.freeze(emptyObject);
499
- }
500
- function Component(props, context, updater) {
501
- this.props = props;
502
- this.context = context;
503
- this.refs = emptyObject;
504
- this.updater = updater || ReactNoopUpdateQueue;
505
- }
506
- Component.prototype.isReactComponent = {};
507
- Component.prototype.setState = function(partialState, callback) {
508
- if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) {
509
- throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
510
- }
511
- this.updater.enqueueSetState(this, partialState, callback, "setState");
512
- };
513
- Component.prototype.forceUpdate = function(callback) {
514
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
515
- };
516
- {
517
- var deprecatedAPIs = {
518
- isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
519
- replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
520
- };
521
- var defineDeprecationWarning = function(methodName, info) {
522
- Object.defineProperty(Component.prototype, methodName, {
523
- get: function() {
524
- warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
525
- return void 0;
526
- }
527
- });
528
- };
529
- for (var fnName in deprecatedAPIs) {
530
- if (deprecatedAPIs.hasOwnProperty(fnName)) {
531
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
532
- }
533
- }
534
- }
535
- function ComponentDummy() {
536
- }
537
- ComponentDummy.prototype = Component.prototype;
538
- function PureComponent(props, context, updater) {
539
- this.props = props;
540
- this.context = context;
541
- this.refs = emptyObject;
542
- this.updater = updater || ReactNoopUpdateQueue;
543
- }
544
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
545
- pureComponentPrototype.constructor = PureComponent;
546
- assign(pureComponentPrototype, Component.prototype);
547
- pureComponentPrototype.isPureReactComponent = true;
548
- function createRef() {
549
- var refObject = {
550
- current: null
551
- };
552
- {
553
- Object.seal(refObject);
554
- }
555
- return refObject;
556
- }
557
- var isArrayImpl = Array.isArray;
558
- function isArray(a) {
559
- return isArrayImpl(a);
560
- }
561
- function typeName(value) {
562
- {
563
- var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
564
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
565
- return type;
566
- }
567
- }
568
- function willCoercionThrow(value) {
569
- {
570
- try {
571
- testStringCoercion(value);
572
- return false;
573
- } catch (e) {
574
- return true;
575
- }
576
- }
577
- }
578
- function testStringCoercion(value) {
579
- return "" + value;
580
- }
581
- function checkKeyStringCoercion(value) {
582
- {
583
- if (willCoercionThrow(value)) {
584
- error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
585
- return testStringCoercion(value);
586
- }
587
- }
588
- }
589
- function getWrappedName(outerType, innerType, wrapperName) {
590
- var displayName = outerType.displayName;
591
- if (displayName) {
592
- return displayName;
593
- }
594
- var functionName = innerType.displayName || innerType.name || "";
595
- return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
596
- }
597
- function getContextName(type) {
598
- return type.displayName || "Context";
599
- }
600
- function getComponentNameFromType(type) {
601
- if (type == null) {
602
- return null;
603
- }
604
- {
605
- if (typeof type.tag === "number") {
606
- error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
607
- }
608
- }
609
- if (typeof type === "function") {
610
- return type.displayName || type.name || null;
611
- }
612
- if (typeof type === "string") {
613
- return type;
614
- }
615
- switch (type) {
616
- case REACT_FRAGMENT_TYPE:
617
- return "Fragment";
618
- case REACT_PORTAL_TYPE:
619
- return "Portal";
620
- case REACT_PROFILER_TYPE:
621
- return "Profiler";
622
- case REACT_STRICT_MODE_TYPE:
623
- return "StrictMode";
624
- case REACT_SUSPENSE_TYPE:
625
- return "Suspense";
626
- case REACT_SUSPENSE_LIST_TYPE:
627
- return "SuspenseList";
628
- }
629
- if (typeof type === "object") {
630
- switch (type.$$typeof) {
631
- case REACT_CONTEXT_TYPE:
632
- var context = type;
633
- return getContextName(context) + ".Consumer";
634
- case REACT_PROVIDER_TYPE:
635
- var provider = type;
636
- return getContextName(provider._context) + ".Provider";
637
- case REACT_FORWARD_REF_TYPE:
638
- return getWrappedName(type, type.render, "ForwardRef");
639
- case REACT_MEMO_TYPE:
640
- var outerName = type.displayName || null;
641
- if (outerName !== null) {
642
- return outerName;
643
- }
644
- return getComponentNameFromType(type.type) || "Memo";
645
- case REACT_LAZY_TYPE: {
646
- var lazyComponent = type;
647
- var payload = lazyComponent._payload;
648
- var init = lazyComponent._init;
649
- try {
650
- return getComponentNameFromType(init(payload));
651
- } catch (x) {
652
- return null;
653
- }
654
- }
655
- }
656
- }
657
- return null;
658
- }
659
- var hasOwnProperty = Object.prototype.hasOwnProperty;
660
- var RESERVED_PROPS = {
661
- key: true,
662
- ref: true,
663
- __self: true,
664
- __source: true
665
- };
666
- var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
667
- {
668
- didWarnAboutStringRefs = {};
669
- }
670
- function hasValidRef(config) {
671
- {
672
- if (hasOwnProperty.call(config, "ref")) {
673
- var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
674
- if (getter && getter.isReactWarning) {
675
- return false;
676
- }
677
- }
678
- }
679
- return config.ref !== void 0;
680
- }
681
- function hasValidKey(config) {
682
- {
683
- if (hasOwnProperty.call(config, "key")) {
684
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
685
- if (getter && getter.isReactWarning) {
686
- return false;
687
- }
688
- }
689
- }
690
- return config.key !== void 0;
691
- }
692
- function defineKeyPropWarningGetter(props, displayName) {
693
- var warnAboutAccessingKey = function() {
694
- {
695
- if (!specialPropKeyWarningShown) {
696
- specialPropKeyWarningShown = true;
697
- 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);
698
- }
699
- }
700
- };
701
- warnAboutAccessingKey.isReactWarning = true;
702
- Object.defineProperty(props, "key", {
703
- get: warnAboutAccessingKey,
704
- configurable: true
705
- });
706
- }
707
- function defineRefPropWarningGetter(props, displayName) {
708
- var warnAboutAccessingRef = function() {
709
- {
710
- if (!specialPropRefWarningShown) {
711
- specialPropRefWarningShown = true;
712
- 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);
713
- }
714
- }
715
- };
716
- warnAboutAccessingRef.isReactWarning = true;
717
- Object.defineProperty(props, "ref", {
718
- get: warnAboutAccessingRef,
719
- configurable: true
720
- });
721
- }
722
- function warnIfStringRefCannotBeAutoConverted(config) {
723
- {
724
- if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
725
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
726
- if (!didWarnAboutStringRefs[componentName]) {
727
- 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);
728
- didWarnAboutStringRefs[componentName] = true;
729
- }
730
- }
731
- }
732
- }
733
- var ReactElement = function(type, key, ref, self, source, owner, props) {
734
- var element = {
735
- // This tag allows us to uniquely identify this as a React Element
736
- $$typeof: REACT_ELEMENT_TYPE,
737
- // Built-in properties that belong on the element
738
- type,
739
- key,
740
- ref,
741
- props,
742
- // Record the component responsible for creating this element.
743
- _owner: owner
744
- };
745
- {
746
- element._store = {};
747
- Object.defineProperty(element._store, "validated", {
748
- configurable: false,
749
- enumerable: false,
750
- writable: true,
751
- value: false
752
- });
753
- Object.defineProperty(element, "_self", {
754
- configurable: false,
755
- enumerable: false,
756
- writable: false,
757
- value: self
758
- });
759
- Object.defineProperty(element, "_source", {
760
- configurable: false,
761
- enumerable: false,
762
- writable: false,
763
- value: source
764
- });
765
- if (Object.freeze) {
766
- Object.freeze(element.props);
767
- Object.freeze(element);
768
- }
769
- }
770
- return element;
771
- };
772
- function createElement(type, config, children) {
773
- var propName;
774
- var props = {};
775
- var key = null;
776
- var ref = null;
777
- var self = null;
778
- var source = null;
779
- if (config != null) {
780
- if (hasValidRef(config)) {
781
- ref = config.ref;
782
- {
783
- warnIfStringRefCannotBeAutoConverted(config);
784
- }
785
- }
786
- if (hasValidKey(config)) {
787
- {
788
- checkKeyStringCoercion(config.key);
789
- }
790
- key = "" + config.key;
791
- }
792
- self = config.__self === void 0 ? null : config.__self;
793
- source = config.__source === void 0 ? null : config.__source;
794
- for (propName in config) {
795
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
796
- props[propName] = config[propName];
797
- }
798
- }
799
- }
800
- var childrenLength = arguments.length - 2;
801
- if (childrenLength === 1) {
802
- props.children = children;
803
- } else if (childrenLength > 1) {
804
- var childArray = Array(childrenLength);
805
- for (var i = 0; i < childrenLength; i++) {
806
- childArray[i] = arguments[i + 2];
807
- }
808
- {
809
- if (Object.freeze) {
810
- Object.freeze(childArray);
811
- }
812
- }
813
- props.children = childArray;
814
- }
815
- if (type && type.defaultProps) {
816
- var defaultProps = type.defaultProps;
817
- for (propName in defaultProps) {
818
- if (props[propName] === void 0) {
819
- props[propName] = defaultProps[propName];
820
- }
821
- }
822
- }
823
- {
824
- if (key || ref) {
825
- var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
826
- if (key) {
827
- defineKeyPropWarningGetter(props, displayName);
828
- }
829
- if (ref) {
830
- defineRefPropWarningGetter(props, displayName);
831
- }
832
- }
833
- }
834
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
835
- }
836
- function cloneAndReplaceKey(oldElement, newKey) {
837
- var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
838
- return newElement;
839
- }
840
- function cloneElement(element, config, children) {
841
- if (element === null || element === void 0) {
842
- throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
843
- }
844
- var propName;
845
- var props = assign({}, element.props);
846
- var key = element.key;
847
- var ref = element.ref;
848
- var self = element._self;
849
- var source = element._source;
850
- var owner = element._owner;
851
- if (config != null) {
852
- if (hasValidRef(config)) {
853
- ref = config.ref;
854
- owner = ReactCurrentOwner.current;
855
- }
856
- if (hasValidKey(config)) {
857
- {
858
- checkKeyStringCoercion(config.key);
859
- }
860
- key = "" + config.key;
861
- }
862
- var defaultProps;
863
- if (element.type && element.type.defaultProps) {
864
- defaultProps = element.type.defaultProps;
865
- }
866
- for (propName in config) {
867
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
868
- if (config[propName] === void 0 && defaultProps !== void 0) {
869
- props[propName] = defaultProps[propName];
870
- } else {
871
- props[propName] = config[propName];
872
- }
873
- }
874
- }
875
- }
876
- var childrenLength = arguments.length - 2;
877
- if (childrenLength === 1) {
878
- props.children = children;
879
- } else if (childrenLength > 1) {
880
- var childArray = Array(childrenLength);
881
- for (var i = 0; i < childrenLength; i++) {
882
- childArray[i] = arguments[i + 2];
883
- }
884
- props.children = childArray;
885
- }
886
- return ReactElement(element.type, key, ref, self, source, owner, props);
887
- }
888
- function isValidElement(object) {
889
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
890
- }
891
- var SEPARATOR = ".";
892
- var SUBSEPARATOR = ":";
893
- function escape(key) {
894
- var escapeRegex = /[=:]/g;
895
- var escaperLookup = {
896
- "=": "=0",
897
- ":": "=2"
898
- };
899
- var escapedString = key.replace(escapeRegex, function(match) {
900
- return escaperLookup[match];
901
- });
902
- return "$" + escapedString;
903
- }
904
- var didWarnAboutMaps = false;
905
- var userProvidedKeyEscapeRegex = /\/+/g;
906
- function escapeUserProvidedKey(text) {
907
- return text.replace(userProvidedKeyEscapeRegex, "$&/");
908
- }
909
- function getElementKey(element, index) {
910
- if (typeof element === "object" && element !== null && element.key != null) {
911
- {
912
- checkKeyStringCoercion(element.key);
913
- }
914
- return escape("" + element.key);
915
- }
916
- return index.toString(36);
917
- }
918
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
919
- var type = typeof children;
920
- if (type === "undefined" || type === "boolean") {
921
- children = null;
922
- }
923
- var invokeCallback = false;
924
- if (children === null) {
925
- invokeCallback = true;
926
- } else {
927
- switch (type) {
928
- case "string":
929
- case "number":
930
- invokeCallback = true;
931
- break;
932
- case "object":
933
- switch (children.$$typeof) {
934
- case REACT_ELEMENT_TYPE:
935
- case REACT_PORTAL_TYPE:
936
- invokeCallback = true;
937
- }
938
- }
939
- }
940
- if (invokeCallback) {
941
- var _child = children;
942
- var mappedChild = callback(_child);
943
- var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
944
- if (isArray(mappedChild)) {
945
- var escapedChildKey = "";
946
- if (childKey != null) {
947
- escapedChildKey = escapeUserProvidedKey(childKey) + "/";
948
- }
949
- mapIntoArray(mappedChild, array, escapedChildKey, "", function(c) {
950
- return c;
951
- });
952
- } else if (mappedChild != null) {
953
- if (isValidElement(mappedChild)) {
954
- {
955
- if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
956
- checkKeyStringCoercion(mappedChild.key);
957
- }
958
- }
959
- mappedChild = cloneAndReplaceKey(
960
- mappedChild,
961
- // Keep both the (mapped) and old keys if they differ, just as
962
- // traverseAllChildren used to do for objects as children
963
- escapedPrefix + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
964
- (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? (
965
- // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
966
- // eslint-disable-next-line react-internal/safe-string-coercion
967
- escapeUserProvidedKey("" + mappedChild.key) + "/"
968
- ) : "") + childKey
969
- );
970
- }
971
- array.push(mappedChild);
972
- }
973
- return 1;
974
- }
975
- var child;
976
- var nextName;
977
- var subtreeCount = 0;
978
- var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
979
- if (isArray(children)) {
980
- for (var i = 0; i < children.length; i++) {
981
- child = children[i];
982
- nextName = nextNamePrefix + getElementKey(child, i);
983
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
984
- }
985
- } else {
986
- var iteratorFn = getIteratorFn(children);
987
- if (typeof iteratorFn === "function") {
988
- var iterableChildren = children;
989
- {
990
- if (iteratorFn === iterableChildren.entries) {
991
- if (!didWarnAboutMaps) {
992
- warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
993
- }
994
- didWarnAboutMaps = true;
995
- }
996
- }
997
- var iterator = iteratorFn.call(iterableChildren);
998
- var step;
999
- var ii = 0;
1000
- while (!(step = iterator.next()).done) {
1001
- child = step.value;
1002
- nextName = nextNamePrefix + getElementKey(child, ii++);
1003
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1004
- }
1005
- } else if (type === "object") {
1006
- var childrenString = String(children);
1007
- 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.");
1008
- }
1009
- }
1010
- return subtreeCount;
1011
- }
1012
- function mapChildren(children, func, context) {
1013
- if (children == null) {
1014
- return children;
1015
- }
1016
- var result = [];
1017
- var count = 0;
1018
- mapIntoArray(children, result, "", "", function(child) {
1019
- return func.call(context, child, count++);
1020
- });
1021
- return result;
1022
- }
1023
- function countChildren(children) {
1024
- var n = 0;
1025
- mapChildren(children, function() {
1026
- n++;
1027
- });
1028
- return n;
1029
- }
1030
- function forEachChildren(children, forEachFunc, forEachContext) {
1031
- mapChildren(children, function() {
1032
- forEachFunc.apply(this, arguments);
1033
- }, forEachContext);
1034
- }
1035
- function toArray(children) {
1036
- return mapChildren(children, function(child) {
1037
- return child;
1038
- }) || [];
1039
- }
1040
- function onlyChild(children) {
1041
- if (!isValidElement(children)) {
1042
- throw new Error("React.Children.only expected to receive a single React element child.");
1043
- }
1044
- return children;
1045
- }
1046
- function createContext4(defaultValue) {
1047
- var context = {
1048
- $$typeof: REACT_CONTEXT_TYPE,
1049
- // As a workaround to support multiple concurrent renderers, we categorize
1050
- // some renderers as primary and others as secondary. We only expect
1051
- // there to be two concurrent renderers at most: React Native (primary) and
1052
- // Fabric (secondary); React DOM (primary) and React ART (secondary).
1053
- // Secondary renderers store their context values on separate fields.
1054
- _currentValue: defaultValue,
1055
- _currentValue2: defaultValue,
1056
- // Used to track how many concurrent renderers this context currently
1057
- // supports within in a single renderer. Such as parallel server rendering.
1058
- _threadCount: 0,
1059
- // These are circular
1060
- Provider: null,
1061
- Consumer: null,
1062
- // Add these to use same hidden class in VM as ServerContext
1063
- _defaultValue: null,
1064
- _globalName: null
1065
- };
1066
- context.Provider = {
1067
- $$typeof: REACT_PROVIDER_TYPE,
1068
- _context: context
1069
- };
1070
- var hasWarnedAboutUsingNestedContextConsumers = false;
1071
- var hasWarnedAboutUsingConsumerProvider = false;
1072
- var hasWarnedAboutDisplayNameOnConsumer = false;
1073
- {
1074
- var Consumer = {
1075
- $$typeof: REACT_CONTEXT_TYPE,
1076
- _context: context
1077
- };
1078
- Object.defineProperties(Consumer, {
1079
- Provider: {
1080
- get: function() {
1081
- if (!hasWarnedAboutUsingConsumerProvider) {
1082
- hasWarnedAboutUsingConsumerProvider = true;
1083
- 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?");
1084
- }
1085
- return context.Provider;
1086
- },
1087
- set: function(_Provider) {
1088
- context.Provider = _Provider;
1089
- }
1090
- },
1091
- _currentValue: {
1092
- get: function() {
1093
- return context._currentValue;
1094
- },
1095
- set: function(_currentValue) {
1096
- context._currentValue = _currentValue;
1097
- }
1098
- },
1099
- _currentValue2: {
1100
- get: function() {
1101
- return context._currentValue2;
1102
- },
1103
- set: function(_currentValue2) {
1104
- context._currentValue2 = _currentValue2;
1105
- }
1106
- },
1107
- _threadCount: {
1108
- get: function() {
1109
- return context._threadCount;
1110
- },
1111
- set: function(_threadCount) {
1112
- context._threadCount = _threadCount;
1113
- }
1114
- },
1115
- Consumer: {
1116
- get: function() {
1117
- if (!hasWarnedAboutUsingNestedContextConsumers) {
1118
- hasWarnedAboutUsingNestedContextConsumers = true;
1119
- 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?");
1120
- }
1121
- return context.Consumer;
1122
- }
1123
- },
1124
- displayName: {
1125
- get: function() {
1126
- return context.displayName;
1127
- },
1128
- set: function(displayName) {
1129
- if (!hasWarnedAboutDisplayNameOnConsumer) {
1130
- warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName);
1131
- hasWarnedAboutDisplayNameOnConsumer = true;
1132
- }
1133
- }
1134
- }
1135
- });
1136
- context.Consumer = Consumer;
1137
- }
1138
- {
1139
- context._currentRenderer = null;
1140
- context._currentRenderer2 = null;
1141
- }
1142
- return context;
1143
- }
1144
- var Uninitialized = -1;
1145
- var Pending = 0;
1146
- var Resolved = 1;
1147
- var Rejected = 2;
1148
- function lazyInitializer(payload) {
1149
- if (payload._status === Uninitialized) {
1150
- var ctor = payload._result;
1151
- var thenable = ctor();
1152
- thenable.then(function(moduleObject2) {
1153
- if (payload._status === Pending || payload._status === Uninitialized) {
1154
- var resolved = payload;
1155
- resolved._status = Resolved;
1156
- resolved._result = moduleObject2;
1157
- }
1158
- }, function(error2) {
1159
- if (payload._status === Pending || payload._status === Uninitialized) {
1160
- var rejected = payload;
1161
- rejected._status = Rejected;
1162
- rejected._result = error2;
1163
- }
1164
- });
1165
- if (payload._status === Uninitialized) {
1166
- var pending = payload;
1167
- pending._status = Pending;
1168
- pending._result = thenable;
1169
- }
1170
- }
1171
- if (payload._status === Resolved) {
1172
- var moduleObject = payload._result;
1173
- {
1174
- if (moduleObject === void 0) {
1175
- 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);
1176
- }
1177
- }
1178
- {
1179
- if (!("default" in moduleObject)) {
1180
- 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);
1181
- }
1182
- }
1183
- return moduleObject.default;
1184
- } else {
1185
- throw payload._result;
1186
- }
1187
- }
1188
- function lazy(ctor) {
1189
- var payload = {
1190
- // We use these fields to store the result.
1191
- _status: Uninitialized,
1192
- _result: ctor
1193
- };
1194
- var lazyType = {
1195
- $$typeof: REACT_LAZY_TYPE,
1196
- _payload: payload,
1197
- _init: lazyInitializer
1198
- };
1199
- {
1200
- var defaultProps;
1201
- var propTypes;
1202
- Object.defineProperties(lazyType, {
1203
- defaultProps: {
1204
- configurable: true,
1205
- get: function() {
1206
- return defaultProps;
1207
- },
1208
- set: function(newDefaultProps) {
1209
- 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.");
1210
- defaultProps = newDefaultProps;
1211
- Object.defineProperty(lazyType, "defaultProps", {
1212
- enumerable: true
1213
- });
1214
- }
1215
- },
1216
- propTypes: {
1217
- configurable: true,
1218
- get: function() {
1219
- return propTypes;
1220
- },
1221
- set: function(newPropTypes) {
1222
- 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.");
1223
- propTypes = newPropTypes;
1224
- Object.defineProperty(lazyType, "propTypes", {
1225
- enumerable: true
1226
- });
1227
- }
1228
- }
1229
- });
1230
- }
1231
- return lazyType;
1232
- }
1233
- function forwardRef(render) {
1234
- {
1235
- if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1236
- error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
1237
- } else if (typeof render !== "function") {
1238
- error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render);
1239
- } else {
1240
- if (render.length !== 0 && render.length !== 2) {
1241
- 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.");
1242
- }
1243
- }
1244
- if (render != null) {
1245
- if (render.defaultProps != null || render.propTypes != null) {
1246
- error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");
1247
- }
1248
- }
1249
- }
1250
- var elementType = {
1251
- $$typeof: REACT_FORWARD_REF_TYPE,
1252
- render
1253
- };
1254
- {
1255
- var ownName;
1256
- Object.defineProperty(elementType, "displayName", {
1257
- enumerable: false,
1258
- configurable: true,
1259
- get: function() {
1260
- return ownName;
1261
- },
1262
- set: function(name) {
1263
- ownName = name;
1264
- if (!render.name && !render.displayName) {
1265
- render.displayName = name;
1266
- }
1267
- }
1268
- });
1269
- }
1270
- return elementType;
1271
- }
1272
- var REACT_MODULE_REFERENCE;
1273
- {
1274
- REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
1275
- }
1276
- function isValidElementType(type) {
1277
- if (typeof type === "string" || typeof type === "function") {
1278
- return true;
1279
- }
1280
- 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) {
1281
- return true;
1282
- }
1283
- if (typeof type === "object" && type !== null) {
1284
- 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
1285
- // types supported by any Flight configuration anywhere since
1286
- // we don't know which Flight build this will end up being used
1287
- // with.
1288
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
1289
- return true;
1290
- }
1291
- }
1292
- return false;
1293
- }
1294
- function memo(type, compare) {
1295
- {
1296
- if (!isValidElementType(type)) {
1297
- error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
1298
- }
1299
- }
1300
- var elementType = {
1301
- $$typeof: REACT_MEMO_TYPE,
1302
- type,
1303
- compare: compare === void 0 ? null : compare
1304
- };
1305
- {
1306
- var ownName;
1307
- Object.defineProperty(elementType, "displayName", {
1308
- enumerable: false,
1309
- configurable: true,
1310
- get: function() {
1311
- return ownName;
1312
- },
1313
- set: function(name) {
1314
- ownName = name;
1315
- if (!type.name && !type.displayName) {
1316
- type.displayName = name;
1317
- }
1318
- }
1319
- });
1320
- }
1321
- return elementType;
1322
- }
1323
- function resolveDispatcher() {
1324
- var dispatcher = ReactCurrentDispatcher.current;
1325
- {
1326
- if (dispatcher === null) {
1327
- 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.");
1328
- }
1329
- }
1330
- return dispatcher;
1331
- }
1332
- function useContext2(Context) {
1333
- var dispatcher = resolveDispatcher();
1334
- {
1335
- if (Context._context !== void 0) {
1336
- var realContext = Context._context;
1337
- if (realContext.Consumer === Context) {
1338
- 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?");
1339
- } else if (realContext.Provider === Context) {
1340
- error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?");
1341
- }
1342
- }
1343
- }
1344
- return dispatcher.useContext(Context);
1345
- }
1346
- function useState(initialState) {
1347
- var dispatcher = resolveDispatcher();
1348
- return dispatcher.useState(initialState);
1349
- }
1350
- function useReducer(reducer, initialArg, init) {
1351
- var dispatcher = resolveDispatcher();
1352
- return dispatcher.useReducer(reducer, initialArg, init);
1353
- }
1354
- function useRef(initialValue) {
1355
- var dispatcher = resolveDispatcher();
1356
- return dispatcher.useRef(initialValue);
1357
- }
1358
- function useEffect(create, deps) {
1359
- var dispatcher = resolveDispatcher();
1360
- return dispatcher.useEffect(create, deps);
1361
- }
1362
- function useInsertionEffect(create, deps) {
1363
- var dispatcher = resolveDispatcher();
1364
- return dispatcher.useInsertionEffect(create, deps);
1365
- }
1366
- function useLayoutEffect(create, deps) {
1367
- var dispatcher = resolveDispatcher();
1368
- return dispatcher.useLayoutEffect(create, deps);
1369
- }
1370
- function useCallback(callback, deps) {
1371
- var dispatcher = resolveDispatcher();
1372
- return dispatcher.useCallback(callback, deps);
1373
- }
1374
- function useMemo(create, deps) {
1375
- var dispatcher = resolveDispatcher();
1376
- return dispatcher.useMemo(create, deps);
1377
- }
1378
- function useImperativeHandle(ref, create, deps) {
1379
- var dispatcher = resolveDispatcher();
1380
- return dispatcher.useImperativeHandle(ref, create, deps);
1381
- }
1382
- function useDebugValue(value, formatterFn) {
1383
- {
1384
- var dispatcher = resolveDispatcher();
1385
- return dispatcher.useDebugValue(value, formatterFn);
1386
- }
1387
- }
1388
- function useTransition() {
1389
- var dispatcher = resolveDispatcher();
1390
- return dispatcher.useTransition();
1391
- }
1392
- function useDeferredValue(value) {
1393
- var dispatcher = resolveDispatcher();
1394
- return dispatcher.useDeferredValue(value);
1395
- }
1396
- function useId() {
1397
- var dispatcher = resolveDispatcher();
1398
- return dispatcher.useId();
1399
- }
1400
- function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
1401
- var dispatcher = resolveDispatcher();
1402
- return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
1403
- }
1404
- var disabledDepth = 0;
1405
- var prevLog;
1406
- var prevInfo;
1407
- var prevWarn;
1408
- var prevError;
1409
- var prevGroup;
1410
- var prevGroupCollapsed;
1411
- var prevGroupEnd;
1412
- function disabledLog() {
1413
- }
1414
- disabledLog.__reactDisabledLog = true;
1415
- function disableLogs() {
1416
- {
1417
- if (disabledDepth === 0) {
1418
- prevLog = console.log;
1419
- prevInfo = console.info;
1420
- prevWarn = console.warn;
1421
- prevError = console.error;
1422
- prevGroup = console.group;
1423
- prevGroupCollapsed = console.groupCollapsed;
1424
- prevGroupEnd = console.groupEnd;
1425
- var props = {
1426
- configurable: true,
1427
- enumerable: true,
1428
- value: disabledLog,
1429
- writable: true
1430
- };
1431
- Object.defineProperties(console, {
1432
- info: props,
1433
- log: props,
1434
- warn: props,
1435
- error: props,
1436
- group: props,
1437
- groupCollapsed: props,
1438
- groupEnd: props
1439
- });
1440
- }
1441
- disabledDepth++;
1442
- }
1443
- }
1444
- function reenableLogs() {
1445
- {
1446
- disabledDepth--;
1447
- if (disabledDepth === 0) {
1448
- var props = {
1449
- configurable: true,
1450
- enumerable: true,
1451
- writable: true
1452
- };
1453
- Object.defineProperties(console, {
1454
- log: assign({}, props, {
1455
- value: prevLog
1456
- }),
1457
- info: assign({}, props, {
1458
- value: prevInfo
1459
- }),
1460
- warn: assign({}, props, {
1461
- value: prevWarn
1462
- }),
1463
- error: assign({}, props, {
1464
- value: prevError
1465
- }),
1466
- group: assign({}, props, {
1467
- value: prevGroup
1468
- }),
1469
- groupCollapsed: assign({}, props, {
1470
- value: prevGroupCollapsed
1471
- }),
1472
- groupEnd: assign({}, props, {
1473
- value: prevGroupEnd
1474
- })
1475
- });
1476
- }
1477
- if (disabledDepth < 0) {
1478
- error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
1479
- }
1480
- }
1481
- }
1482
- var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1483
- var prefix;
1484
- function describeBuiltInComponentFrame(name, source, ownerFn) {
1485
- {
1486
- if (prefix === void 0) {
1487
- try {
1488
- throw Error();
1489
- } catch (x) {
1490
- var match = x.stack.trim().match(/\n( *(at )?)/);
1491
- prefix = match && match[1] || "";
1492
- }
1493
- }
1494
- return "\n" + prefix + name;
1495
- }
1496
- }
1497
- var reentry = false;
1498
- var componentFrameCache;
1499
- {
1500
- var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
1501
- componentFrameCache = new PossiblyWeakMap();
1502
- }
1503
- function describeNativeComponentFrame(fn, construct) {
1504
- if (!fn || reentry) {
1505
- return "";
1506
- }
1507
- {
1508
- var frame = componentFrameCache.get(fn);
1509
- if (frame !== void 0) {
1510
- return frame;
1511
- }
1512
- }
1513
- var control;
1514
- reentry = true;
1515
- var previousPrepareStackTrace = Error.prepareStackTrace;
1516
- Error.prepareStackTrace = void 0;
1517
- var previousDispatcher;
1518
- {
1519
- previousDispatcher = ReactCurrentDispatcher$1.current;
1520
- ReactCurrentDispatcher$1.current = null;
1521
- disableLogs();
1522
- }
1523
- try {
1524
- if (construct) {
1525
- var Fake = function() {
1526
- throw Error();
1527
- };
1528
- Object.defineProperty(Fake.prototype, "props", {
1529
- set: function() {
1530
- throw Error();
1531
- }
1532
- });
1533
- if (typeof Reflect === "object" && Reflect.construct) {
1534
- try {
1535
- Reflect.construct(Fake, []);
1536
- } catch (x) {
1537
- control = x;
1538
- }
1539
- Reflect.construct(fn, [], Fake);
1540
- } else {
1541
- try {
1542
- Fake.call();
1543
- } catch (x) {
1544
- control = x;
1545
- }
1546
- fn.call(Fake.prototype);
1547
- }
1548
- } else {
1549
- try {
1550
- throw Error();
1551
- } catch (x) {
1552
- control = x;
1553
- }
1554
- fn();
1555
- }
1556
- } catch (sample) {
1557
- if (sample && control && typeof sample.stack === "string") {
1558
- var sampleLines = sample.stack.split("\n");
1559
- var controlLines = control.stack.split("\n");
1560
- var s = sampleLines.length - 1;
1561
- var c = controlLines.length - 1;
1562
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1563
- c--;
1564
- }
1565
- for (; s >= 1 && c >= 0; s--, c--) {
1566
- if (sampleLines[s] !== controlLines[c]) {
1567
- if (s !== 1 || c !== 1) {
1568
- do {
1569
- s--;
1570
- c--;
1571
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
1572
- var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
1573
- if (fn.displayName && _frame.includes("<anonymous>")) {
1574
- _frame = _frame.replace("<anonymous>", fn.displayName);
1575
- }
1576
- {
1577
- if (typeof fn === "function") {
1578
- componentFrameCache.set(fn, _frame);
1579
- }
1580
- }
1581
- return _frame;
1582
- }
1583
- } while (s >= 1 && c >= 0);
1584
- }
1585
- break;
1586
- }
1587
- }
1588
- }
1589
- } finally {
1590
- reentry = false;
1591
- {
1592
- ReactCurrentDispatcher$1.current = previousDispatcher;
1593
- reenableLogs();
1594
- }
1595
- Error.prepareStackTrace = previousPrepareStackTrace;
1596
- }
1597
- var name = fn ? fn.displayName || fn.name : "";
1598
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
1599
- {
1600
- if (typeof fn === "function") {
1601
- componentFrameCache.set(fn, syntheticFrame);
1602
- }
1603
- }
1604
- return syntheticFrame;
1605
- }
1606
- function describeFunctionComponentFrame(fn, source, ownerFn) {
1607
- {
1608
- return describeNativeComponentFrame(fn, false);
1609
- }
1610
- }
1611
- function shouldConstruct(Component2) {
1612
- var prototype = Component2.prototype;
1613
- return !!(prototype && prototype.isReactComponent);
1614
- }
1615
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1616
- if (type == null) {
1617
- return "";
1618
- }
1619
- if (typeof type === "function") {
1620
- {
1621
- return describeNativeComponentFrame(type, shouldConstruct(type));
1622
- }
1623
- }
1624
- if (typeof type === "string") {
1625
- return describeBuiltInComponentFrame(type);
1626
- }
1627
- switch (type) {
1628
- case REACT_SUSPENSE_TYPE:
1629
- return describeBuiltInComponentFrame("Suspense");
1630
- case REACT_SUSPENSE_LIST_TYPE:
1631
- return describeBuiltInComponentFrame("SuspenseList");
1632
- }
1633
- if (typeof type === "object") {
1634
- switch (type.$$typeof) {
1635
- case REACT_FORWARD_REF_TYPE:
1636
- return describeFunctionComponentFrame(type.render);
1637
- case REACT_MEMO_TYPE:
1638
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
1639
- case REACT_LAZY_TYPE: {
1640
- var lazyComponent = type;
1641
- var payload = lazyComponent._payload;
1642
- var init = lazyComponent._init;
1643
- try {
1644
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
1645
- } catch (x) {
1646
- }
1647
- }
1648
- }
1649
- }
1650
- return "";
1651
- }
1652
- var loggedTypeFailures = {};
1653
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1654
- function setCurrentlyValidatingElement(element) {
1655
- {
1656
- if (element) {
1657
- var owner = element._owner;
1658
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1659
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1660
- } else {
1661
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1662
- }
1663
- }
1664
- }
1665
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
1666
- {
1667
- var has = Function.call.bind(hasOwnProperty);
1668
- for (var typeSpecName in typeSpecs) {
1669
- if (has(typeSpecs, typeSpecName)) {
1670
- var error$1 = void 0;
1671
- try {
1672
- if (typeof typeSpecs[typeSpecName] !== "function") {
1673
- 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`.");
1674
- err.name = "Invariant Violation";
1675
- throw err;
1676
- }
1677
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
1678
- } catch (ex) {
1679
- error$1 = ex;
1680
- }
1681
- if (error$1 && !(error$1 instanceof Error)) {
1682
- setCurrentlyValidatingElement(element);
1683
- 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);
1684
- setCurrentlyValidatingElement(null);
1685
- }
1686
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1687
- loggedTypeFailures[error$1.message] = true;
1688
- setCurrentlyValidatingElement(element);
1689
- error("Failed %s type: %s", location, error$1.message);
1690
- setCurrentlyValidatingElement(null);
1691
- }
1692
- }
1693
- }
1694
- }
1695
- }
1696
- function setCurrentlyValidatingElement$1(element) {
1697
- {
1698
- if (element) {
1699
- var owner = element._owner;
1700
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1701
- setExtraStackFrame(stack);
1702
- } else {
1703
- setExtraStackFrame(null);
1704
- }
1705
- }
1706
- }
1707
- var propTypesMisspellWarningShown;
1708
- {
1709
- propTypesMisspellWarningShown = false;
1710
- }
1711
- function getDeclarationErrorAddendum() {
1712
- if (ReactCurrentOwner.current) {
1713
- var name = getComponentNameFromType(ReactCurrentOwner.current.type);
1714
- if (name) {
1715
- return "\n\nCheck the render method of `" + name + "`.";
1716
- }
1717
- }
1718
- return "";
1719
- }
1720
- function getSourceInfoErrorAddendum(source) {
1721
- if (source !== void 0) {
1722
- var fileName = source.fileName.replace(/^.*[\\\/]/, "");
1723
- var lineNumber = source.lineNumber;
1724
- return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
1725
- }
1726
- return "";
1727
- }
1728
- function getSourceInfoErrorAddendumForProps(elementProps) {
1729
- if (elementProps !== null && elementProps !== void 0) {
1730
- return getSourceInfoErrorAddendum(elementProps.__source);
1731
- }
1732
- return "";
1733
- }
1734
- var ownerHasKeyUseWarning = {};
1735
- function getCurrentComponentErrorInfo(parentType) {
1736
- var info = getDeclarationErrorAddendum();
1737
- if (!info) {
1738
- var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
1739
- if (parentName) {
1740
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1741
- }
1742
- }
1743
- return info;
1744
- }
1745
- function validateExplicitKey(element, parentType) {
1746
- if (!element._store || element._store.validated || element.key != null) {
1747
- return;
1748
- }
1749
- element._store.validated = true;
1750
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1751
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1752
- return;
1753
- }
1754
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
1755
- var childOwner = "";
1756
- if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1757
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1758
- }
1759
- {
1760
- setCurrentlyValidatingElement$1(element);
1761
- 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);
1762
- setCurrentlyValidatingElement$1(null);
1763
- }
1764
- }
1765
- function validateChildKeys(node, parentType) {
1766
- if (typeof node !== "object") {
1767
- return;
1768
- }
1769
- if (isArray(node)) {
1770
- for (var i = 0; i < node.length; i++) {
1771
- var child = node[i];
1772
- if (isValidElement(child)) {
1773
- validateExplicitKey(child, parentType);
1774
- }
1775
- }
1776
- } else if (isValidElement(node)) {
1777
- if (node._store) {
1778
- node._store.validated = true;
1779
- }
1780
- } else if (node) {
1781
- var iteratorFn = getIteratorFn(node);
1782
- if (typeof iteratorFn === "function") {
1783
- if (iteratorFn !== node.entries) {
1784
- var iterator = iteratorFn.call(node);
1785
- var step;
1786
- while (!(step = iterator.next()).done) {
1787
- if (isValidElement(step.value)) {
1788
- validateExplicitKey(step.value, parentType);
1789
- }
1790
- }
1791
- }
1792
- }
1793
- }
1794
- }
1795
- function validatePropTypes(element) {
1796
- {
1797
- var type = element.type;
1798
- if (type === null || type === void 0 || typeof type === "string") {
1799
- return;
1800
- }
1801
- var propTypes;
1802
- if (typeof type === "function") {
1803
- propTypes = type.propTypes;
1804
- } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1805
- // Inner props are checked in the reconciler.
1806
- type.$$typeof === REACT_MEMO_TYPE)) {
1807
- propTypes = type.propTypes;
1808
- } else {
1809
- return;
1810
- }
1811
- if (propTypes) {
1812
- var name = getComponentNameFromType(type);
1813
- checkPropTypes(propTypes, element.props, "prop", name, element);
1814
- } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
1815
- propTypesMisspellWarningShown = true;
1816
- var _name = getComponentNameFromType(type);
1817
- error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
1818
- }
1819
- if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
1820
- error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
1821
- }
1822
- }
1823
- }
1824
- function validateFragmentProps(fragment) {
1825
- {
1826
- var keys = Object.keys(fragment.props);
1827
- for (var i = 0; i < keys.length; i++) {
1828
- var key = keys[i];
1829
- if (key !== "children" && key !== "key") {
1830
- setCurrentlyValidatingElement$1(fragment);
1831
- error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
1832
- setCurrentlyValidatingElement$1(null);
1833
- break;
1834
- }
1835
- }
1836
- if (fragment.ref !== null) {
1837
- setCurrentlyValidatingElement$1(fragment);
1838
- error("Invalid attribute `ref` supplied to `React.Fragment`.");
1839
- setCurrentlyValidatingElement$1(null);
1840
- }
1841
- }
1842
- }
1843
- function createElementWithValidation(type, props, children) {
1844
- var validType = isValidElementType(type);
1845
- if (!validType) {
1846
- var info = "";
1847
- if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
1848
- 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.";
1849
- }
1850
- var sourceInfo = getSourceInfoErrorAddendumForProps(props);
1851
- if (sourceInfo) {
1852
- info += sourceInfo;
1853
- } else {
1854
- info += getDeclarationErrorAddendum();
1855
- }
1856
- var typeString;
1857
- if (type === null) {
1858
- typeString = "null";
1859
- } else if (isArray(type)) {
1860
- typeString = "array";
1861
- } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
1862
- typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
1863
- info = " Did you accidentally export a JSX literal instead of a component?";
1864
- } else {
1865
- typeString = typeof type;
1866
- }
1867
- {
1868
- 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);
1869
- }
1870
- }
1871
- var element = createElement.apply(this, arguments);
1872
- if (element == null) {
1873
- return element;
1874
- }
1875
- if (validType) {
1876
- for (var i = 2; i < arguments.length; i++) {
1877
- validateChildKeys(arguments[i], type);
1878
- }
1879
- }
1880
- if (type === REACT_FRAGMENT_TYPE) {
1881
- validateFragmentProps(element);
1882
- } else {
1883
- validatePropTypes(element);
1884
- }
1885
- return element;
1886
- }
1887
- var didWarnAboutDeprecatedCreateFactory = false;
1888
- function createFactoryWithValidation(type) {
1889
- var validatedFactory = createElementWithValidation.bind(null, type);
1890
- validatedFactory.type = type;
1891
- {
1892
- if (!didWarnAboutDeprecatedCreateFactory) {
1893
- didWarnAboutDeprecatedCreateFactory = true;
1894
- warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.");
1895
- }
1896
- Object.defineProperty(validatedFactory, "type", {
1897
- enumerable: false,
1898
- get: function() {
1899
- warn("Factory.type is deprecated. Access the class directly before passing it to createFactory.");
1900
- Object.defineProperty(this, "type", {
1901
- value: type
1902
- });
1903
- return type;
1904
- }
1905
- });
1906
- }
1907
- return validatedFactory;
1908
- }
1909
- function cloneElementWithValidation(element, props, children) {
1910
- var newElement = cloneElement.apply(this, arguments);
1911
- for (var i = 2; i < arguments.length; i++) {
1912
- validateChildKeys(arguments[i], newElement.type);
1913
- }
1914
- validatePropTypes(newElement);
1915
- return newElement;
1916
- }
1917
- function startTransition(scope, options) {
1918
- var prevTransition = ReactCurrentBatchConfig.transition;
1919
- ReactCurrentBatchConfig.transition = {};
1920
- var currentTransition = ReactCurrentBatchConfig.transition;
1921
- {
1922
- ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set();
1923
- }
1924
- try {
1925
- scope();
1926
- } finally {
1927
- ReactCurrentBatchConfig.transition = prevTransition;
1928
- {
1929
- if (prevTransition === null && currentTransition._updatedFibers) {
1930
- var updatedFibersCount = currentTransition._updatedFibers.size;
1931
- if (updatedFibersCount > 10) {
1932
- 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.");
1933
- }
1934
- currentTransition._updatedFibers.clear();
1935
- }
1936
- }
1937
- }
1938
- }
1939
- var didWarnAboutMessageChannel = false;
1940
- var enqueueTaskImpl = null;
1941
- function enqueueTask(task) {
1942
- if (enqueueTaskImpl === null) {
1943
- try {
1944
- var requireString = ("require" + Math.random()).slice(0, 7);
1945
- var nodeRequire = module && module[requireString];
1946
- enqueueTaskImpl = nodeRequire.call(module, "timers").setImmediate;
1947
- } catch (_err) {
1948
- enqueueTaskImpl = function(callback) {
1949
- {
1950
- if (didWarnAboutMessageChannel === false) {
1951
- didWarnAboutMessageChannel = true;
1952
- if (typeof MessageChannel === "undefined") {
1953
- 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.");
1954
- }
1955
- }
1956
- }
1957
- var channel = new MessageChannel();
1958
- channel.port1.onmessage = callback;
1959
- channel.port2.postMessage(void 0);
1960
- };
1961
- }
1962
- }
1963
- return enqueueTaskImpl(task);
1964
- }
1965
- var actScopeDepth = 0;
1966
- var didWarnNoAwaitAct = false;
1967
- function act(callback) {
1968
- {
1969
- var prevActScopeDepth = actScopeDepth;
1970
- actScopeDepth++;
1971
- if (ReactCurrentActQueue.current === null) {
1972
- ReactCurrentActQueue.current = [];
1973
- }
1974
- var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
1975
- var result;
1976
- try {
1977
- ReactCurrentActQueue.isBatchingLegacy = true;
1978
- result = callback();
1979
- if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
1980
- var queue = ReactCurrentActQueue.current;
1981
- if (queue !== null) {
1982
- ReactCurrentActQueue.didScheduleLegacyUpdate = false;
1983
- flushActQueue(queue);
1984
- }
1985
- }
1986
- } catch (error2) {
1987
- popActScope(prevActScopeDepth);
1988
- throw error2;
1989
- } finally {
1990
- ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
1991
- }
1992
- if (result !== null && typeof result === "object" && typeof result.then === "function") {
1993
- var thenableResult = result;
1994
- var wasAwaited = false;
1995
- var thenable = {
1996
- then: function(resolve, reject) {
1997
- wasAwaited = true;
1998
- thenableResult.then(function(returnValue2) {
1999
- popActScope(prevActScopeDepth);
2000
- if (actScopeDepth === 0) {
2001
- recursivelyFlushAsyncActWork(returnValue2, resolve, reject);
2002
- } else {
2003
- resolve(returnValue2);
2004
- }
2005
- }, function(error2) {
2006
- popActScope(prevActScopeDepth);
2007
- reject(error2);
2008
- });
2009
- }
2010
- };
2011
- {
2012
- if (!didWarnNoAwaitAct && typeof Promise !== "undefined") {
2013
- Promise.resolve().then(function() {
2014
- }).then(function() {
2015
- if (!wasAwaited) {
2016
- didWarnNoAwaitAct = true;
2017
- 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 () => ...);");
2018
- }
2019
- });
2020
- }
2021
- }
2022
- return thenable;
2023
- } else {
2024
- var returnValue = result;
2025
- popActScope(prevActScopeDepth);
2026
- if (actScopeDepth === 0) {
2027
- var _queue = ReactCurrentActQueue.current;
2028
- if (_queue !== null) {
2029
- flushActQueue(_queue);
2030
- ReactCurrentActQueue.current = null;
2031
- }
2032
- var _thenable = {
2033
- then: function(resolve, reject) {
2034
- if (ReactCurrentActQueue.current === null) {
2035
- ReactCurrentActQueue.current = [];
2036
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2037
- } else {
2038
- resolve(returnValue);
2039
- }
2040
- }
2041
- };
2042
- return _thenable;
2043
- } else {
2044
- var _thenable2 = {
2045
- then: function(resolve, reject) {
2046
- resolve(returnValue);
2047
- }
2048
- };
2049
- return _thenable2;
2050
- }
2051
- }
2052
- }
2053
- }
2054
- function popActScope(prevActScopeDepth) {
2055
- {
2056
- if (prevActScopeDepth !== actScopeDepth - 1) {
2057
- error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
2058
- }
2059
- actScopeDepth = prevActScopeDepth;
2060
- }
2061
- }
2062
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
2063
- {
2064
- var queue = ReactCurrentActQueue.current;
2065
- if (queue !== null) {
2066
- try {
2067
- flushActQueue(queue);
2068
- enqueueTask(function() {
2069
- if (queue.length === 0) {
2070
- ReactCurrentActQueue.current = null;
2071
- resolve(returnValue);
2072
- } else {
2073
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2074
- }
2075
- });
2076
- } catch (error2) {
2077
- reject(error2);
2078
- }
2079
- } else {
2080
- resolve(returnValue);
2081
- }
2082
- }
2083
- }
2084
- var isFlushing = false;
2085
- function flushActQueue(queue) {
2086
- {
2087
- if (!isFlushing) {
2088
- isFlushing = true;
2089
- var i = 0;
2090
- try {
2091
- for (; i < queue.length; i++) {
2092
- var callback = queue[i];
2093
- do {
2094
- callback = callback(true);
2095
- } while (callback !== null);
2096
- }
2097
- queue.length = 0;
2098
- } catch (error2) {
2099
- queue = queue.slice(i + 1);
2100
- throw error2;
2101
- } finally {
2102
- isFlushing = false;
2103
- }
2104
- }
2105
- }
2106
- }
2107
- var createElement$1 = createElementWithValidation;
2108
- var cloneElement$1 = cloneElementWithValidation;
2109
- var createFactory = createFactoryWithValidation;
2110
- var Children = {
2111
- map: mapChildren,
2112
- forEach: forEachChildren,
2113
- count: countChildren,
2114
- toArray,
2115
- only: onlyChild
2116
- };
2117
- exports.Children = Children;
2118
- exports.Component = Component;
2119
- exports.Fragment = REACT_FRAGMENT_TYPE;
2120
- exports.Profiler = REACT_PROFILER_TYPE;
2121
- exports.PureComponent = PureComponent;
2122
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
2123
- exports.Suspense = REACT_SUSPENSE_TYPE;
2124
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2125
- exports.act = act;
2126
- exports.cloneElement = cloneElement$1;
2127
- exports.createContext = createContext4;
2128
- exports.createElement = createElement$1;
2129
- exports.createFactory = createFactory;
2130
- exports.createRef = createRef;
2131
- exports.forwardRef = forwardRef;
2132
- exports.isValidElement = isValidElement;
2133
- exports.lazy = lazy;
2134
- exports.memo = memo;
2135
- exports.startTransition = startTransition;
2136
- exports.unstable_act = act;
2137
- exports.useCallback = useCallback;
2138
- exports.useContext = useContext2;
2139
- exports.useDebugValue = useDebugValue;
2140
- exports.useDeferredValue = useDeferredValue;
2141
- exports.useEffect = useEffect;
2142
- exports.useId = useId;
2143
- exports.useImperativeHandle = useImperativeHandle;
2144
- exports.useInsertionEffect = useInsertionEffect;
2145
- exports.useLayoutEffect = useLayoutEffect;
2146
- exports.useMemo = useMemo;
2147
- exports.useReducer = useReducer;
2148
- exports.useRef = useRef;
2149
- exports.useState = useState;
2150
- exports.useSyncExternalStore = useSyncExternalStore;
2151
- exports.useTransition = useTransition;
2152
- exports.version = ReactVersion;
2153
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
2154
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2155
- }
2156
- })();
2157
- }
2158
- }
2159
- });
2160
-
2161
- // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
2162
- var require_react = __commonJS({
2163
- "../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"(exports, module) {
2164
- "use strict";
2165
- init_esm_shims();
2166
- if (process.env.NODE_ENV === "production") {
2167
- module.exports = require_react_production_min();
2168
- } else {
2169
- module.exports = require_react_development();
2170
- }
2171
- }
2172
- });
2173
-
2174
- // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js
2175
- var require_react_jsx_runtime_production_min = __commonJS({
2176
- "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js"(exports) {
2177
- "use strict";
2178
- init_esm_shims();
2179
- var f = require_react();
2180
- var k = Symbol.for("react.element");
2181
- var l = Symbol.for("react.fragment");
2182
- var m = Object.prototype.hasOwnProperty;
2183
- var n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
2184
- var p = { key: true, ref: true, __self: true, __source: true };
2185
- function q(c, a, g) {
2186
- var b, d = {}, e = null, h = null;
2187
- void 0 !== g && (e = "" + g);
2188
- void 0 !== a.key && (e = "" + a.key);
2189
- void 0 !== a.ref && (h = a.ref);
2190
- for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
2191
- if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
2192
- return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
2193
- }
2194
- exports.Fragment = l;
2195
- exports.jsx = q;
2196
- exports.jsxs = q;
2197
- }
2198
- });
2199
-
2200
- // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js
2201
- var require_react_jsx_runtime_development = __commonJS({
2202
- "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
2203
- "use strict";
2204
- init_esm_shims();
2205
- if (process.env.NODE_ENV !== "production") {
2206
- (function() {
2207
- "use strict";
2208
- var React = require_react();
2209
- var REACT_ELEMENT_TYPE = Symbol.for("react.element");
2210
- var REACT_PORTAL_TYPE = Symbol.for("react.portal");
2211
- var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
2212
- var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
2213
- var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
2214
- var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
2215
- var REACT_CONTEXT_TYPE = Symbol.for("react.context");
2216
- var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
2217
- var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
2218
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
2219
- var REACT_MEMO_TYPE = Symbol.for("react.memo");
2220
- var REACT_LAZY_TYPE = Symbol.for("react.lazy");
2221
- var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
2222
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
2223
- var FAUX_ITERATOR_SYMBOL = "@@iterator";
2224
- function getIteratorFn(maybeIterable) {
2225
- if (maybeIterable === null || typeof maybeIterable !== "object") {
2226
- return null;
2227
- }
2228
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
2229
- if (typeof maybeIterator === "function") {
2230
- return maybeIterator;
2231
- }
2232
- return null;
2233
- }
2234
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2235
- function error(format) {
2236
- {
2237
- {
2238
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2239
- args[_key2 - 1] = arguments[_key2];
2240
- }
2241
- printWarning("error", format, args);
2242
- }
2243
- }
2244
- }
2245
- function printWarning(level, format, args) {
2246
- {
2247
- var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
2248
- var stack = ReactDebugCurrentFrame2.getStackAddendum();
2249
- if (stack !== "") {
2250
- format += "%s";
2251
- args = args.concat([stack]);
2252
- }
2253
- var argsWithFormat = args.map(function(item) {
2254
- return String(item);
2255
- });
2256
- argsWithFormat.unshift("Warning: " + format);
2257
- Function.prototype.apply.call(console[level], console, argsWithFormat);
2258
- }
2259
- }
2260
- var enableScopeAPI = false;
2261
- var enableCacheElement = false;
2262
- var enableTransitionTracing = false;
2263
- var enableLegacyHidden = false;
2264
- var enableDebugTracing = false;
2265
- var REACT_MODULE_REFERENCE;
2266
- {
2267
- REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
2268
- }
2269
- function isValidElementType(type) {
2270
- if (typeof type === "string" || typeof type === "function") {
2271
- return true;
2272
- }
2273
- 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) {
2274
- return true;
2275
- }
2276
- if (typeof type === "object" && type !== null) {
2277
- 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
2278
- // types supported by any Flight configuration anywhere since
2279
- // we don't know which Flight build this will end up being used
2280
- // with.
2281
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
2282
- return true;
2283
- }
2284
- }
2285
- return false;
2286
- }
2287
- function getWrappedName(outerType, innerType, wrapperName) {
2288
- var displayName = outerType.displayName;
2289
- if (displayName) {
2290
- return displayName;
2291
- }
2292
- var functionName = innerType.displayName || innerType.name || "";
2293
- return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
2294
- }
2295
- function getContextName(type) {
2296
- return type.displayName || "Context";
2297
- }
2298
- function getComponentNameFromType(type) {
2299
- if (type == null) {
2300
- return null;
2301
- }
2302
- {
2303
- if (typeof type.tag === "number") {
2304
- error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
2305
- }
2306
- }
2307
- if (typeof type === "function") {
2308
- return type.displayName || type.name || null;
2309
- }
2310
- if (typeof type === "string") {
2311
- return type;
2312
- }
2313
- switch (type) {
2314
- case REACT_FRAGMENT_TYPE:
2315
- return "Fragment";
2316
- case REACT_PORTAL_TYPE:
2317
- return "Portal";
2318
- case REACT_PROFILER_TYPE:
2319
- return "Profiler";
2320
- case REACT_STRICT_MODE_TYPE:
2321
- return "StrictMode";
2322
- case REACT_SUSPENSE_TYPE:
2323
- return "Suspense";
2324
- case REACT_SUSPENSE_LIST_TYPE:
2325
- return "SuspenseList";
2326
- }
2327
- if (typeof type === "object") {
2328
- switch (type.$$typeof) {
2329
- case REACT_CONTEXT_TYPE:
2330
- var context = type;
2331
- return getContextName(context) + ".Consumer";
2332
- case REACT_PROVIDER_TYPE:
2333
- var provider = type;
2334
- return getContextName(provider._context) + ".Provider";
2335
- case REACT_FORWARD_REF_TYPE:
2336
- return getWrappedName(type, type.render, "ForwardRef");
2337
- case REACT_MEMO_TYPE:
2338
- var outerName = type.displayName || null;
2339
- if (outerName !== null) {
2340
- return outerName;
2341
- }
2342
- return getComponentNameFromType(type.type) || "Memo";
2343
- case REACT_LAZY_TYPE: {
2344
- var lazyComponent = type;
2345
- var payload = lazyComponent._payload;
2346
- var init = lazyComponent._init;
2347
- try {
2348
- return getComponentNameFromType(init(payload));
2349
- } catch (x) {
2350
- return null;
2351
- }
2352
- }
2353
- }
2354
- }
2355
- return null;
2356
- }
2357
- var assign = Object.assign;
2358
- var disabledDepth = 0;
2359
- var prevLog;
2360
- var prevInfo;
2361
- var prevWarn;
2362
- var prevError;
2363
- var prevGroup;
2364
- var prevGroupCollapsed;
2365
- var prevGroupEnd;
2366
- function disabledLog() {
2367
- }
2368
- disabledLog.__reactDisabledLog = true;
2369
- function disableLogs() {
2370
- {
2371
- if (disabledDepth === 0) {
2372
- prevLog = console.log;
2373
- prevInfo = console.info;
2374
- prevWarn = console.warn;
2375
- prevError = console.error;
2376
- prevGroup = console.group;
2377
- prevGroupCollapsed = console.groupCollapsed;
2378
- prevGroupEnd = console.groupEnd;
2379
- var props = {
2380
- configurable: true,
2381
- enumerable: true,
2382
- value: disabledLog,
2383
- writable: true
2384
- };
2385
- Object.defineProperties(console, {
2386
- info: props,
2387
- log: props,
2388
- warn: props,
2389
- error: props,
2390
- group: props,
2391
- groupCollapsed: props,
2392
- groupEnd: props
2393
- });
2394
- }
2395
- disabledDepth++;
2396
- }
2397
- }
2398
- function reenableLogs() {
2399
- {
2400
- disabledDepth--;
2401
- if (disabledDepth === 0) {
2402
- var props = {
2403
- configurable: true,
2404
- enumerable: true,
2405
- writable: true
2406
- };
2407
- Object.defineProperties(console, {
2408
- log: assign({}, props, {
2409
- value: prevLog
2410
- }),
2411
- info: assign({}, props, {
2412
- value: prevInfo
2413
- }),
2414
- warn: assign({}, props, {
2415
- value: prevWarn
2416
- }),
2417
- error: assign({}, props, {
2418
- value: prevError
2419
- }),
2420
- group: assign({}, props, {
2421
- value: prevGroup
2422
- }),
2423
- groupCollapsed: assign({}, props, {
2424
- value: prevGroupCollapsed
2425
- }),
2426
- groupEnd: assign({}, props, {
2427
- value: prevGroupEnd
2428
- })
2429
- });
2430
- }
2431
- if (disabledDepth < 0) {
2432
- error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
2433
- }
2434
- }
2435
- }
2436
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
2437
- var prefix;
2438
- function describeBuiltInComponentFrame(name, source, ownerFn) {
2439
- {
2440
- if (prefix === void 0) {
2441
- try {
2442
- throw Error();
2443
- } catch (x) {
2444
- var match = x.stack.trim().match(/\n( *(at )?)/);
2445
- prefix = match && match[1] || "";
2446
- }
2447
- }
2448
- return "\n" + prefix + name;
2449
- }
2450
- }
2451
- var reentry = false;
2452
- var componentFrameCache;
2453
- {
2454
- var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
2455
- componentFrameCache = new PossiblyWeakMap();
2456
- }
2457
- function describeNativeComponentFrame(fn, construct) {
2458
- if (!fn || reentry) {
2459
- return "";
2460
- }
2461
- {
2462
- var frame = componentFrameCache.get(fn);
2463
- if (frame !== void 0) {
2464
- return frame;
2465
- }
2466
- }
2467
- var control;
2468
- reentry = true;
2469
- var previousPrepareStackTrace = Error.prepareStackTrace;
2470
- Error.prepareStackTrace = void 0;
2471
- var previousDispatcher;
2472
- {
2473
- previousDispatcher = ReactCurrentDispatcher.current;
2474
- ReactCurrentDispatcher.current = null;
2475
- disableLogs();
2476
- }
2477
- try {
2478
- if (construct) {
2479
- var Fake = function() {
2480
- throw Error();
2481
- };
2482
- Object.defineProperty(Fake.prototype, "props", {
2483
- set: function() {
2484
- throw Error();
2485
- }
2486
- });
2487
- if (typeof Reflect === "object" && Reflect.construct) {
2488
- try {
2489
- Reflect.construct(Fake, []);
2490
- } catch (x) {
2491
- control = x;
2492
- }
2493
- Reflect.construct(fn, [], Fake);
2494
- } else {
2495
- try {
2496
- Fake.call();
2497
- } catch (x) {
2498
- control = x;
2499
- }
2500
- fn.call(Fake.prototype);
2501
- }
2502
- } else {
2503
- try {
2504
- throw Error();
2505
- } catch (x) {
2506
- control = x;
2507
- }
2508
- fn();
2509
- }
2510
- } catch (sample) {
2511
- if (sample && control && typeof sample.stack === "string") {
2512
- var sampleLines = sample.stack.split("\n");
2513
- var controlLines = control.stack.split("\n");
2514
- var s = sampleLines.length - 1;
2515
- var c = controlLines.length - 1;
2516
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
2517
- c--;
2518
- }
2519
- for (; s >= 1 && c >= 0; s--, c--) {
2520
- if (sampleLines[s] !== controlLines[c]) {
2521
- if (s !== 1 || c !== 1) {
2522
- do {
2523
- s--;
2524
- c--;
2525
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
2526
- var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
2527
- if (fn.displayName && _frame.includes("<anonymous>")) {
2528
- _frame = _frame.replace("<anonymous>", fn.displayName);
2529
- }
2530
- {
2531
- if (typeof fn === "function") {
2532
- componentFrameCache.set(fn, _frame);
2533
- }
2534
- }
2535
- return _frame;
2536
- }
2537
- } while (s >= 1 && c >= 0);
2538
- }
2539
- break;
2540
- }
2541
- }
2542
- }
2543
- } finally {
2544
- reentry = false;
2545
- {
2546
- ReactCurrentDispatcher.current = previousDispatcher;
2547
- reenableLogs();
2548
- }
2549
- Error.prepareStackTrace = previousPrepareStackTrace;
2550
- }
2551
- var name = fn ? fn.displayName || fn.name : "";
2552
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
2553
- {
2554
- if (typeof fn === "function") {
2555
- componentFrameCache.set(fn, syntheticFrame);
2556
- }
2557
- }
2558
- return syntheticFrame;
2559
- }
2560
- function describeFunctionComponentFrame(fn, source, ownerFn) {
2561
- {
2562
- return describeNativeComponentFrame(fn, false);
2563
- }
2564
- }
2565
- function shouldConstruct(Component) {
2566
- var prototype = Component.prototype;
2567
- return !!(prototype && prototype.isReactComponent);
2568
- }
2569
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
2570
- if (type == null) {
2571
- return "";
2572
- }
2573
- if (typeof type === "function") {
2574
- {
2575
- return describeNativeComponentFrame(type, shouldConstruct(type));
2576
- }
2577
- }
2578
- if (typeof type === "string") {
2579
- return describeBuiltInComponentFrame(type);
2580
- }
2581
- switch (type) {
2582
- case REACT_SUSPENSE_TYPE:
2583
- return describeBuiltInComponentFrame("Suspense");
2584
- case REACT_SUSPENSE_LIST_TYPE:
2585
- return describeBuiltInComponentFrame("SuspenseList");
2586
- }
2587
- if (typeof type === "object") {
2588
- switch (type.$$typeof) {
2589
- case REACT_FORWARD_REF_TYPE:
2590
- return describeFunctionComponentFrame(type.render);
2591
- case REACT_MEMO_TYPE:
2592
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
2593
- case REACT_LAZY_TYPE: {
2594
- var lazyComponent = type;
2595
- var payload = lazyComponent._payload;
2596
- var init = lazyComponent._init;
2597
- try {
2598
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
2599
- } catch (x) {
2600
- }
2601
- }
2602
- }
2603
- }
2604
- return "";
2605
- }
2606
- var hasOwnProperty = Object.prototype.hasOwnProperty;
2607
- var loggedTypeFailures = {};
2608
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2609
- function setCurrentlyValidatingElement(element) {
2610
- {
2611
- if (element) {
2612
- var owner = element._owner;
2613
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2614
- ReactDebugCurrentFrame.setExtraStackFrame(stack);
2615
- } else {
2616
- ReactDebugCurrentFrame.setExtraStackFrame(null);
2617
- }
2618
- }
2619
- }
2620
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
2621
- {
2622
- var has = Function.call.bind(hasOwnProperty);
2623
- for (var typeSpecName in typeSpecs) {
2624
- if (has(typeSpecs, typeSpecName)) {
2625
- var error$1 = void 0;
2626
- try {
2627
- if (typeof typeSpecs[typeSpecName] !== "function") {
2628
- 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`.");
2629
- err.name = "Invariant Violation";
2630
- throw err;
2631
- }
2632
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
2633
- } catch (ex) {
2634
- error$1 = ex;
2635
- }
2636
- if (error$1 && !(error$1 instanceof Error)) {
2637
- setCurrentlyValidatingElement(element);
2638
- 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);
2639
- setCurrentlyValidatingElement(null);
2640
- }
2641
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
2642
- loggedTypeFailures[error$1.message] = true;
2643
- setCurrentlyValidatingElement(element);
2644
- error("Failed %s type: %s", location, error$1.message);
2645
- setCurrentlyValidatingElement(null);
2646
- }
2647
- }
2648
- }
2649
- }
2650
- }
2651
- var isArrayImpl = Array.isArray;
2652
- function isArray(a) {
2653
- return isArrayImpl(a);
2654
- }
2655
- function typeName(value) {
2656
- {
2657
- var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
2658
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
2659
- return type;
2660
- }
2661
- }
2662
- function willCoercionThrow(value) {
2663
- {
2664
- try {
2665
- testStringCoercion(value);
2666
- return false;
2667
- } catch (e) {
2668
- return true;
2669
- }
2670
- }
2671
- }
2672
- function testStringCoercion(value) {
2673
- return "" + value;
2674
- }
2675
- function checkKeyStringCoercion(value) {
2676
- {
2677
- if (willCoercionThrow(value)) {
2678
- error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
2679
- return testStringCoercion(value);
2680
- }
2681
- }
2682
- }
2683
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
2684
- var RESERVED_PROPS = {
2685
- key: true,
2686
- ref: true,
2687
- __self: true,
2688
- __source: true
2689
- };
2690
- var specialPropKeyWarningShown;
2691
- var specialPropRefWarningShown;
2692
- var didWarnAboutStringRefs;
2693
- {
2694
- didWarnAboutStringRefs = {};
2695
- }
2696
- function hasValidRef(config) {
2697
- {
2698
- if (hasOwnProperty.call(config, "ref")) {
2699
- var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
2700
- if (getter && getter.isReactWarning) {
2701
- return false;
2702
- }
2703
- }
2704
- }
2705
- return config.ref !== void 0;
2706
- }
2707
- function hasValidKey(config) {
2708
- {
2709
- if (hasOwnProperty.call(config, "key")) {
2710
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
2711
- if (getter && getter.isReactWarning) {
2712
- return false;
2713
- }
2714
- }
2715
- }
2716
- return config.key !== void 0;
2717
- }
2718
- function warnIfStringRefCannotBeAutoConverted(config, self) {
2719
- {
2720
- if (typeof config.ref === "string" && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
2721
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
2722
- if (!didWarnAboutStringRefs[componentName]) {
2723
- 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', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
2724
- didWarnAboutStringRefs[componentName] = true;
2725
- }
2726
- }
2727
- }
2728
- }
2729
- function defineKeyPropWarningGetter(props, displayName) {
2730
- {
2731
- var warnAboutAccessingKey = function() {
2732
- if (!specialPropKeyWarningShown) {
2733
- specialPropKeyWarningShown = true;
2734
- 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);
2735
- }
2736
- };
2737
- warnAboutAccessingKey.isReactWarning = true;
2738
- Object.defineProperty(props, "key", {
2739
- get: warnAboutAccessingKey,
2740
- configurable: true
2741
- });
2742
- }
2743
- }
2744
- function defineRefPropWarningGetter(props, displayName) {
2745
- {
2746
- var warnAboutAccessingRef = function() {
2747
- if (!specialPropRefWarningShown) {
2748
- specialPropRefWarningShown = true;
2749
- 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);
2750
- }
2751
- };
2752
- warnAboutAccessingRef.isReactWarning = true;
2753
- Object.defineProperty(props, "ref", {
2754
- get: warnAboutAccessingRef,
2755
- configurable: true
2756
- });
2757
- }
2758
- }
2759
- var ReactElement = function(type, key, ref, self, source, owner, props) {
2760
- var element = {
2761
- // This tag allows us to uniquely identify this as a React Element
2762
- $$typeof: REACT_ELEMENT_TYPE,
2763
- // Built-in properties that belong on the element
2764
- type,
2765
- key,
2766
- ref,
2767
- props,
2768
- // Record the component responsible for creating this element.
2769
- _owner: owner
2770
- };
2771
- {
2772
- element._store = {};
2773
- Object.defineProperty(element._store, "validated", {
2774
- configurable: false,
2775
- enumerable: false,
2776
- writable: true,
2777
- value: false
2778
- });
2779
- Object.defineProperty(element, "_self", {
2780
- configurable: false,
2781
- enumerable: false,
2782
- writable: false,
2783
- value: self
2784
- });
2785
- Object.defineProperty(element, "_source", {
2786
- configurable: false,
2787
- enumerable: false,
2788
- writable: false,
2789
- value: source
2790
- });
2791
- if (Object.freeze) {
2792
- Object.freeze(element.props);
2793
- Object.freeze(element);
2794
- }
2795
- }
2796
- return element;
2797
- };
2798
- function jsxDEV(type, config, maybeKey, source, self) {
2799
- {
2800
- var propName;
2801
- var props = {};
2802
- var key = null;
2803
- var ref = null;
2804
- if (maybeKey !== void 0) {
2805
- {
2806
- checkKeyStringCoercion(maybeKey);
2807
- }
2808
- key = "" + maybeKey;
2809
- }
2810
- if (hasValidKey(config)) {
2811
- {
2812
- checkKeyStringCoercion(config.key);
2813
- }
2814
- key = "" + config.key;
2815
- }
2816
- if (hasValidRef(config)) {
2817
- ref = config.ref;
2818
- warnIfStringRefCannotBeAutoConverted(config, self);
2819
- }
2820
- for (propName in config) {
2821
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
2822
- props[propName] = config[propName];
2823
- }
2824
- }
2825
- if (type && type.defaultProps) {
2826
- var defaultProps = type.defaultProps;
2827
- for (propName in defaultProps) {
2828
- if (props[propName] === void 0) {
2829
- props[propName] = defaultProps[propName];
2830
- }
2831
- }
2832
- }
2833
- if (key || ref) {
2834
- var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
2835
- if (key) {
2836
- defineKeyPropWarningGetter(props, displayName);
2837
- }
2838
- if (ref) {
2839
- defineRefPropWarningGetter(props, displayName);
2840
- }
2841
- }
2842
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
2843
- }
2844
- }
2845
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
2846
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
2847
- function setCurrentlyValidatingElement$1(element) {
2848
- {
2849
- if (element) {
2850
- var owner = element._owner;
2851
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2852
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
2853
- } else {
2854
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
2855
- }
2856
- }
2857
- }
2858
- var propTypesMisspellWarningShown;
2859
- {
2860
- propTypesMisspellWarningShown = false;
2861
- }
2862
- function isValidElement(object) {
2863
- {
2864
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2865
- }
2866
- }
2867
- function getDeclarationErrorAddendum() {
2868
- {
2869
- if (ReactCurrentOwner$1.current) {
2870
- var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
2871
- if (name) {
2872
- return "\n\nCheck the render method of `" + name + "`.";
2873
- }
2874
- }
2875
- return "";
2876
- }
2877
- }
2878
- function getSourceInfoErrorAddendum(source) {
2879
- {
2880
- if (source !== void 0) {
2881
- var fileName = source.fileName.replace(/^.*[\\\/]/, "");
2882
- var lineNumber = source.lineNumber;
2883
- return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
2884
- }
2885
- return "";
2886
- }
2887
- }
2888
- var ownerHasKeyUseWarning = {};
2889
- function getCurrentComponentErrorInfo(parentType) {
2890
- {
2891
- var info = getDeclarationErrorAddendum();
2892
- if (!info) {
2893
- var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
2894
- if (parentName) {
2895
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2896
- }
2897
- }
2898
- return info;
2899
- }
2900
- }
2901
- function validateExplicitKey(element, parentType) {
2902
- {
2903
- if (!element._store || element._store.validated || element.key != null) {
2904
- return;
2905
- }
2906
- element._store.validated = true;
2907
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2908
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2909
- return;
2910
- }
2911
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
2912
- var childOwner = "";
2913
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
2914
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
2915
- }
2916
- setCurrentlyValidatingElement$1(element);
2917
- 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);
2918
- setCurrentlyValidatingElement$1(null);
2919
- }
2920
- }
2921
- function validateChildKeys(node, parentType) {
2922
- {
2923
- if (typeof node !== "object") {
2924
- return;
2925
- }
2926
- if (isArray(node)) {
2927
- for (var i = 0; i < node.length; i++) {
2928
- var child = node[i];
2929
- if (isValidElement(child)) {
2930
- validateExplicitKey(child, parentType);
2931
- }
2932
- }
2933
- } else if (isValidElement(node)) {
2934
- if (node._store) {
2935
- node._store.validated = true;
2936
- }
2937
- } else if (node) {
2938
- var iteratorFn = getIteratorFn(node);
2939
- if (typeof iteratorFn === "function") {
2940
- if (iteratorFn !== node.entries) {
2941
- var iterator = iteratorFn.call(node);
2942
- var step;
2943
- while (!(step = iterator.next()).done) {
2944
- if (isValidElement(step.value)) {
2945
- validateExplicitKey(step.value, parentType);
2946
- }
2947
- }
2948
- }
2949
- }
2950
- }
2951
- }
2952
- }
2953
- function validatePropTypes(element) {
2954
- {
2955
- var type = element.type;
2956
- if (type === null || type === void 0 || typeof type === "string") {
2957
- return;
2958
- }
2959
- var propTypes;
2960
- if (typeof type === "function") {
2961
- propTypes = type.propTypes;
2962
- } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2963
- // Inner props are checked in the reconciler.
2964
- type.$$typeof === REACT_MEMO_TYPE)) {
2965
- propTypes = type.propTypes;
2966
- } else {
2967
- return;
2968
- }
2969
- if (propTypes) {
2970
- var name = getComponentNameFromType(type);
2971
- checkPropTypes(propTypes, element.props, "prop", name, element);
2972
- } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
2973
- propTypesMisspellWarningShown = true;
2974
- var _name = getComponentNameFromType(type);
2975
- error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
2976
- }
2977
- if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
2978
- error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
2979
- }
2980
- }
2981
- }
2982
- function validateFragmentProps(fragment) {
2983
- {
2984
- var keys = Object.keys(fragment.props);
2985
- for (var i = 0; i < keys.length; i++) {
2986
- var key = keys[i];
2987
- if (key !== "children" && key !== "key") {
2988
- setCurrentlyValidatingElement$1(fragment);
2989
- error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
2990
- setCurrentlyValidatingElement$1(null);
2991
- break;
2992
- }
2993
- }
2994
- if (fragment.ref !== null) {
2995
- setCurrentlyValidatingElement$1(fragment);
2996
- error("Invalid attribute `ref` supplied to `React.Fragment`.");
2997
- setCurrentlyValidatingElement$1(null);
2998
- }
2999
- }
3000
- }
3001
- var didWarnAboutKeySpread = {};
3002
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
3003
- {
3004
- var validType = isValidElementType(type);
3005
- if (!validType) {
3006
- var info = "";
3007
- if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
3008
- 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.";
3009
- }
3010
- var sourceInfo = getSourceInfoErrorAddendum(source);
3011
- if (sourceInfo) {
3012
- info += sourceInfo;
3013
- } else {
3014
- info += getDeclarationErrorAddendum();
3015
- }
3016
- var typeString;
3017
- if (type === null) {
3018
- typeString = "null";
3019
- } else if (isArray(type)) {
3020
- typeString = "array";
3021
- } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
3022
- typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
3023
- info = " Did you accidentally export a JSX literal instead of a component?";
3024
- } else {
3025
- typeString = typeof type;
3026
- }
3027
- error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
3028
- }
3029
- var element = jsxDEV(type, props, key, source, self);
3030
- if (element == null) {
3031
- return element;
3032
- }
3033
- if (validType) {
3034
- var children = props.children;
3035
- if (children !== void 0) {
3036
- if (isStaticChildren) {
3037
- if (isArray(children)) {
3038
- for (var i = 0; i < children.length; i++) {
3039
- validateChildKeys(children[i], type);
3040
- }
3041
- if (Object.freeze) {
3042
- Object.freeze(children);
3043
- }
3044
- } else {
3045
- error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
3046
- }
3047
- } else {
3048
- validateChildKeys(children, type);
3049
- }
3050
- }
3051
- }
3052
- {
3053
- if (hasOwnProperty.call(props, "key")) {
3054
- var componentName = getComponentNameFromType(type);
3055
- var keys = Object.keys(props).filter(function(k) {
3056
- return k !== "key";
3057
- });
3058
- var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
3059
- if (!didWarnAboutKeySpread[componentName + beforeExample]) {
3060
- var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
3061
- error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
3062
- didWarnAboutKeySpread[componentName + beforeExample] = true;
3063
- }
3064
- }
3065
- }
3066
- if (type === REACT_FRAGMENT_TYPE) {
3067
- validateFragmentProps(element);
3068
- } else {
3069
- validatePropTypes(element);
3070
- }
3071
- return element;
3072
- }
3073
- }
3074
- function jsxWithValidationStatic(type, props, key) {
3075
- {
3076
- return jsxWithValidation(type, props, key, true);
3077
- }
3078
- }
3079
- function jsxWithValidationDynamic(type, props, key) {
3080
- {
3081
- return jsxWithValidation(type, props, key, false);
3082
- }
3083
- }
3084
- var jsx4 = jsxWithValidationDynamic;
3085
- var jsxs2 = jsxWithValidationStatic;
3086
- exports.Fragment = REACT_FRAGMENT_TYPE;
3087
- exports.jsx = jsx4;
3088
- exports.jsxs = jsxs2;
3089
- })();
3090
- }
3091
- }
3092
- });
3093
-
3094
- // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js
3095
- var require_jsx_runtime = __commonJS({
3096
- "../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js"(exports, module) {
3097
- "use strict";
3098
- init_esm_shims();
3099
- if (process.env.NODE_ENV === "production") {
3100
- module.exports = require_react_jsx_runtime_production_min();
3101
- } else {
3102
- module.exports = require_react_jsx_runtime_development();
3103
- }
3104
- }
3105
- });
3106
-
3107
- // src/SchemaMapper.ts
3108
- init_esm_shims();
3109
- var schemaKeywords = {
3110
- any: "any",
3111
- strict: "strict",
3112
- unknown: "unknown",
3113
- number: "number",
3114
- integer: "integer",
3115
- string: "string",
3116
- boolean: "boolean",
3117
- undefined: "undefined",
3118
- nullable: "nullable",
3119
- null: "null",
3120
- nullish: "nullish",
3121
- array: "array",
3122
- tuple: "tuple",
3123
- enum: "enum",
3124
- union: "union",
3125
- datetime: "datetime",
3126
- date: "date",
3127
- email: "email",
3128
- uuid: "uuid",
3129
- url: "url",
3130
- /* intersection */
3131
- default: "default",
3132
- const: "const",
3133
- and: "and",
3134
- describe: "describe",
3135
- min: "min",
3136
- max: "max",
3137
- optional: "optional",
3138
- readOnly: "readOnly",
3139
- // custom ones
3140
- object: "object",
3141
- ref: "ref",
3142
- matches: "matches",
3143
- firstName: "firstName",
3144
- lastName: "lastName",
3145
- password: "password",
3146
- phone: "phone",
3147
- blob: "blob",
3148
- deprecated: "deprecated",
3149
- example: "example",
3150
- schema: "schema",
3151
- catchall: "catchall",
3152
- time: "time",
3153
- name: "name"
3154
- };
3155
- function isKeyword(meta, keyword) {
3156
- return meta.keyword === keyword;
3157
- }
3158
-
3159
- // src/SchemaGenerator.ts
3160
- init_esm_shims();
3161
- import { Generator } from "@kubb/core";
3162
- import transformers, { pascalCase } from "@kubb/core/transformers";
3163
- import { getUniqueName } from "@kubb/core/utils";
3164
- import { isReference } from "@kubb/oas";
3165
- import { isDeepEqual, isNumber, uniqueWith } from "remeda";
3166
- var _usedAliasNames, _SchemaGenerator_instances, getUsedEnumNames_fn, getOptions_fn, getUnknownReturn_fn, parseProperties_fn, getRefAlias_fn, getParsedSchemaObject_fn, parseSchemaObject_fn;
3167
- var _SchemaGenerator = class _SchemaGenerator extends Generator {
3168
- constructor() {
3169
- super(...arguments);
3170
- __privateAdd(this, _SchemaGenerator_instances);
3171
- // Collect the types of all referenced schemas, so we can export them later
3172
- this.refs = {};
3173
- // Keep track of already used type aliases
3174
- __privateAdd(this, _usedAliasNames, {});
3175
- }
3176
- /**
3177
- * Creates a type node from a given schema.
3178
- * Delegates to getBaseTypeFromSchema internally and
3179
- * optionally adds a union with null.
3180
- */
3181
- parse(props) {
3182
- const options = __privateMethod(this, _SchemaGenerator_instances, getOptions_fn).call(this, props);
3183
- const defaultSchemas = __privateMethod(this, _SchemaGenerator_instances, parseSchemaObject_fn).call(this, props);
3184
- const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || [];
3185
- return uniqueWith(schemas, isDeepEqual);
3186
- }
3187
- deepSearch(tree, keyword) {
3188
- return _SchemaGenerator.deepSearch(tree, keyword);
3189
- }
3190
- find(tree, keyword) {
3191
- return _SchemaGenerator.find(tree, keyword);
3192
- }
3193
- static deepSearch(tree, keyword) {
3194
- const foundItems = [];
3195
- tree?.forEach((schema) => {
3196
- if (schema.keyword === keyword) {
3197
- foundItems.push(schema);
3198
- }
3199
- if (schema.keyword === schemaKeywords.object) {
3200
- const subItem = schema;
3201
- Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {
3202
- foundItems.push(..._SchemaGenerator.deepSearch(entrySchema, keyword));
3203
- });
3204
- Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {
3205
- foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
3206
- });
3207
- }
3208
- if (schema.keyword === schemaKeywords.array) {
3209
- const subItem = schema;
3210
- subItem.args.items.forEach((entrySchema) => {
3211
- foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
3212
- });
3213
- }
3214
- if (schema.keyword === schemaKeywords.and) {
3215
- const subItem = schema;
3216
- subItem.args.forEach((entrySchema) => {
3217
- foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
3218
- });
3219
- }
3220
- if (schema.keyword === schemaKeywords.tuple) {
3221
- const subItem = schema;
3222
- subItem.args.items.forEach((entrySchema) => {
3223
- foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
3224
- });
3225
- }
3226
- if (schema.keyword === schemaKeywords.union) {
3227
- const subItem = schema;
3228
- subItem.args.forEach((entrySchema) => {
3229
- foundItems.push(..._SchemaGenerator.deepSearch([entrySchema], keyword));
3230
- });
3231
- }
3232
- });
3233
- return foundItems;
3234
- }
3235
- static findInObject(tree, keyword) {
3236
- let foundItem = void 0;
3237
- tree?.forEach((schema) => {
3238
- if (!foundItem && schema.keyword === keyword) {
3239
- foundItem = schema;
3240
- }
3241
- if (schema.keyword === schemaKeywords.object) {
3242
- const subItem = schema;
3243
- Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {
3244
- if (!foundItem) {
3245
- foundItem = _SchemaGenerator.find(entrySchema, keyword);
3246
- }
3247
- });
3248
- Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {
3249
- if (!foundItem) {
3250
- foundItem = _SchemaGenerator.find([entrySchema], keyword);
3251
- }
3252
- });
3253
- }
3254
- });
3255
- return foundItem;
3256
- }
3257
- static find(tree, keyword) {
3258
- let foundItem = void 0;
3259
- tree?.forEach((schema) => {
3260
- if (!foundItem && schema.keyword === keyword) {
3261
- foundItem = schema;
3262
- }
3263
- if (schema.keyword === schemaKeywords.array) {
3264
- const subItem = schema;
3265
- subItem.args.items.forEach((entrySchema) => {
3266
- if (!foundItem) {
3267
- foundItem = _SchemaGenerator.find([entrySchema], keyword);
3268
- }
3269
- });
3270
- }
3271
- if (schema.keyword === schemaKeywords.and) {
3272
- const subItem = schema;
3273
- subItem.args.forEach((entrySchema) => {
3274
- if (!foundItem) {
3275
- foundItem = _SchemaGenerator.find([entrySchema], keyword);
3276
- }
3277
- });
3278
- }
3279
- if (schema.keyword === schemaKeywords.tuple) {
3280
- const subItem = schema;
3281
- subItem.args.items.forEach((entrySchema) => {
3282
- if (!foundItem) {
3283
- foundItem = _SchemaGenerator.find([entrySchema], keyword);
3284
- }
3285
- });
3286
- }
3287
- if (schema.keyword === schemaKeywords.union) {
3288
- const subItem = schema;
3289
- subItem.args.forEach((entrySchema) => {
3290
- if (!foundItem) {
3291
- foundItem = _SchemaGenerator.find([entrySchema], keyword);
3292
- }
3293
- });
3294
- }
3295
- });
3296
- return foundItem;
3297
- }
3298
- async build(...parsers) {
3299
- const { oas, contentType, include } = this.context;
3300
- const schemas = getSchemas({ oas, contentType, includes: include });
3301
- const promises = Object.entries(schemas).reduce((acc, [name, schema]) => {
3302
- const options = __privateMethod(this, _SchemaGenerator_instances, getOptions_fn).call(this, { name });
3303
- const promiseOperation = this.schema.call(this, name, schema, {
3304
- ...this.options,
3305
- ...options
3306
- });
3307
- if (promiseOperation) {
3308
- acc.push(promiseOperation);
3309
- }
3310
- parsers?.forEach((parser) => {
3311
- const promise = parser.schema?.({
3312
- instance: this,
3313
- name,
3314
- schema,
3315
- options: {
3316
- ...this.options,
3317
- ...options
3318
- }
3319
- });
3320
- if (promise) {
3321
- acc.push(promise);
3322
- }
3323
- });
3324
- return acc;
3325
- }, []);
3326
- const files = await Promise.all(promises);
3327
- return files.flat().filter(Boolean);
3328
- }
3329
- /**
3330
- * Schema
3331
- */
3332
- async schema(name, object, options) {
3333
- return [];
3334
- }
3335
- };
3336
- _usedAliasNames = new WeakMap();
3337
- _SchemaGenerator_instances = new WeakSet();
3338
- getUsedEnumNames_fn = function(props) {
3339
- const options = __privateMethod(this, _SchemaGenerator_instances, getOptions_fn).call(this, props);
3340
- return options.usedEnumNames || {};
3341
- };
3342
- getOptions_fn = function({ name }) {
3343
- const { override = [] } = this.context;
3344
- return {
3345
- ...this.options,
3346
- ...override.find(({ pattern, type }) => {
3347
- if (name && type === "schemaName") {
3348
- return !!name.match(pattern);
3349
- }
3350
- return false;
3351
- })?.options || {}
3352
- };
3353
- };
3354
- getUnknownReturn_fn = function(props) {
3355
- const options = __privateMethod(this, _SchemaGenerator_instances, getOptions_fn).call(this, props);
3356
- if (options.unknownType === "any") {
3357
- return schemaKeywords.any;
3358
- }
3359
- return schemaKeywords.unknown;
3360
- };
3361
- /**
3362
- * Recursively creates a type literal with the given props.
3363
- */
3364
- parseProperties_fn = function({ schema, name }) {
3365
- const properties = schema?.properties || {};
3366
- const additionalProperties = schema?.additionalProperties;
3367
- const required = schema?.required;
3368
- const propertiesSchemas = Object.keys(properties).map((propertyName) => {
3369
- const validationFunctions = [];
3370
- const propertySchema = properties[propertyName];
3371
- const isRequired = Array.isArray(required) ? required?.includes(propertyName) : !!required;
3372
- const nullable = propertySchema.nullable ?? propertySchema["x-nullable"] ?? false;
3373
- validationFunctions.push(...this.parse({ schema: propertySchema, name: propertyName, parentName: name }));
3374
- validationFunctions.push({
3375
- keyword: schemaKeywords.name,
3376
- args: propertyName
3377
- });
3378
- if (!isRequired && nullable) {
3379
- validationFunctions.push({ keyword: schemaKeywords.nullish });
3380
- } else if (!isRequired) {
3381
- validationFunctions.push({ keyword: schemaKeywords.optional });
3382
- }
3383
- return {
3384
- [propertyName]: validationFunctions
3385
- };
3386
- }).reduce((acc, curr) => ({ ...acc, ...curr }), {});
3387
- let additionalPropertiesSchemas = [];
3388
- if (additionalProperties) {
3389
- additionalPropertiesSchemas = additionalProperties === true ? [{ keyword: __privateMethod(this, _SchemaGenerator_instances, getUnknownReturn_fn).call(this, { schema, name }) }] : this.parse({ schema: additionalProperties, parentName: name });
3390
- }
3391
- return [
3392
- {
3393
- keyword: schemaKeywords.object,
3394
- args: {
3395
- properties: propertiesSchemas,
3396
- additionalProperties: additionalPropertiesSchemas
3397
- }
3398
- }
3399
- ];
3400
- };
3401
- /**
3402
- * Create a type alias for the schema referenced by the given ReferenceObject
3403
- */
3404
- getRefAlias_fn = function(obj) {
3405
- const { $ref } = obj;
3406
- let ref = this.refs[$ref];
3407
- const originalName = getUniqueName($ref.replace(/.+\//, ""), __privateGet(this, _usedAliasNames));
3408
- const propertyName = this.context.pluginManager.resolveName({
3409
- name: originalName,
3410
- pluginKey: this.context.plugin.key,
3411
- type: "function"
3412
- });
3413
- if (ref) {
3414
- return [
3415
- {
3416
- keyword: schemaKeywords.ref,
3417
- args: { name: ref.propertyName, path: ref.path }
3418
- }
3419
- ];
3420
- }
3421
- const fileName = this.context.pluginManager.resolveName({
3422
- name: originalName,
3423
- pluginKey: this.context.plugin.key,
3424
- type: "file"
3425
- });
3426
- const file = this.context.pluginManager.getFile({
3427
- name: fileName,
3428
- pluginKey: this.context.plugin.key,
3429
- extName: ".ts"
3430
- });
3431
- ref = this.refs[$ref] = {
3432
- propertyName,
3433
- originalName,
3434
- path: file.path
3435
- };
3436
- return [
3437
- {
3438
- keyword: schemaKeywords.ref,
3439
- args: { name: ref.propertyName, path: ref?.path, isTypeOnly: false }
3440
- }
3441
- ];
3442
- };
3443
- getParsedSchemaObject_fn = function(schema) {
3444
- const parsedSchema = getSchemaFactory(this.context.oas)(schema);
3445
- return parsedSchema;
3446
- };
3447
- /**
3448
- * This is the very core of the OpenAPI to TS conversion - it takes a
3449
- * schema and returns the appropriate type.
3450
- */
3451
- parseSchemaObject_fn = function({ schema: _schema, name, parentName }) {
3452
- const options = __privateMethod(this, _SchemaGenerator_instances, getOptions_fn).call(this, { schema: _schema, name });
3453
- const unknownReturn = __privateMethod(this, _SchemaGenerator_instances, getUnknownReturn_fn).call(this, { schema: _schema, name });
3454
- const { schema, version } = __privateMethod(this, _SchemaGenerator_instances, getParsedSchemaObject_fn).call(this, _schema);
3455
- const resolvedName = this.context.pluginManager.resolveName({
3456
- name: `${parentName || ""} ${name}`,
3457
- pluginKey: this.context.plugin.key,
3458
- type: "type"
3459
- });
3460
- if (!schema) {
3461
- return [{ keyword: unknownReturn }];
3462
- }
3463
- const baseItems = [
3464
- {
3465
- keyword: schemaKeywords.schema,
3466
- args: {
3467
- type: schema.type,
3468
- format: schema.format
3469
- }
3470
- }
3471
- ];
3472
- const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? void 0;
3473
- const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? void 0;
3474
- const nullable = schema.nullable ?? schema["x-nullable"] ?? false;
3475
- if (schema.default !== void 0 && !Array.isArray(schema.default)) {
3476
- if (typeof schema.default === "string") {
3477
- baseItems.push({
3478
- keyword: schemaKeywords.default,
3479
- args: transformers.stringify(schema.default)
3480
- });
3481
- }
3482
- if (typeof schema.default === "boolean") {
3483
- baseItems.push({
3484
- keyword: schemaKeywords.default,
3485
- args: schema.default ?? false
3486
- });
3487
- }
3488
- }
3489
- if (schema.description) {
3490
- baseItems.push({
3491
- keyword: schemaKeywords.describe,
3492
- args: schema.description
3493
- });
3494
- }
3495
- if (schema.pattern) {
3496
- baseItems.unshift({
3497
- keyword: schemaKeywords.matches,
3498
- args: schema.pattern
3499
- });
3500
- }
3501
- if (max !== void 0) {
3502
- baseItems.unshift({ keyword: schemaKeywords.max, args: max });
3503
- }
3504
- if (min !== void 0) {
3505
- baseItems.unshift({ keyword: schemaKeywords.min, args: min });
3506
- }
3507
- if (nullable) {
3508
- baseItems.push({ keyword: schemaKeywords.nullable });
3509
- }
3510
- if (schema.type && Array.isArray(schema.type)) {
3511
- const [_schema2, nullable2] = schema.type;
3512
- if (nullable2 === "null") {
3513
- baseItems.push({ keyword: schemaKeywords.nullable });
3514
- }
3515
- }
3516
- if (schema.readOnly) {
3517
- baseItems.push({ keyword: schemaKeywords.readOnly });
3518
- }
3519
- if (isReference(schema)) {
3520
- return [
3521
- ...__privateMethod(this, _SchemaGenerator_instances, getRefAlias_fn).call(this, schema),
3522
- nullable && { keyword: schemaKeywords.nullable },
3523
- {
3524
- keyword: schemaKeywords.schema,
3525
- args: {
3526
- type: schema.type,
3527
- format: schema.format
3528
- }
3529
- }
3530
- ].filter(Boolean);
3531
- }
3532
- if (schema.oneOf) {
3533
- const schemaWithoutOneOf = { ...schema, oneOf: void 0 };
3534
- const union = {
3535
- keyword: schemaKeywords.union,
3536
- args: schema.oneOf.map((item) => {
3537
- return item && this.parse({ schema: item, name, parentName })[0];
3538
- }).filter(Boolean).filter((item) => {
3539
- return item && item.keyword !== unknownReturn;
3540
- })
3541
- };
3542
- if (schemaWithoutOneOf.properties) {
3543
- return [...this.parse({ schema: schemaWithoutOneOf, name, parentName }), union, ...baseItems];
3544
- }
3545
- return [union, ...baseItems];
3546
- }
3547
- if (schema.anyOf) {
3548
- const schemaWithoutAnyOf = { ...schema, anyOf: void 0 };
3549
- const union = {
3550
- keyword: schemaKeywords.union,
3551
- args: schema.anyOf.map((item) => {
3552
- return item && this.parse({ schema: item, name, parentName })[0];
3553
- }).filter(Boolean).filter((item) => {
3554
- return item && item.keyword !== unknownReturn;
3555
- }).map((item) => {
3556
- if (isKeyword(item, schemaKeywords.object)) {
3557
- return {
3558
- ...item,
3559
- args: {
3560
- ...item.args,
3561
- strict: true
3562
- }
3563
- };
3564
- }
3565
- return item;
3566
- })
3567
- };
3568
- if (schemaWithoutAnyOf.properties) {
3569
- return [...this.parse({ schema: schemaWithoutAnyOf, name, parentName }), union, ...baseItems];
3570
- }
3571
- return [union, ...baseItems];
3572
- }
3573
- if (schema.allOf) {
3574
- const schemaWithoutAllOf = { ...schema, allOf: void 0 };
3575
- const and = {
3576
- keyword: schemaKeywords.and,
3577
- args: schema.allOf.map((item) => {
3578
- return item && this.parse({ schema: item, name, parentName })[0];
3579
- }).filter(Boolean).filter((item) => {
3580
- return item && item.keyword !== unknownReturn;
3581
- })
3582
- };
3583
- if (schemaWithoutAllOf.properties) {
3584
- return [
3585
- {
3586
- ...and,
3587
- args: [...and.args || [], ...this.parse({ schema: schemaWithoutAllOf, name, parentName })]
3588
- },
3589
- ...baseItems
3590
- ];
3591
- }
3592
- return [and, ...baseItems];
3593
- }
3594
- if (schema.enum) {
3595
- const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].join(" ")), __privateMethod(this, _SchemaGenerator_instances, getUsedEnumNames_fn).call(this, { schema, name }));
3596
- const typeName = this.context.pluginManager.resolveName({
3597
- name: enumName,
3598
- pluginKey: this.context.plugin.key,
3599
- type: "type"
3600
- });
3601
- const nullableEnum = schema.enum.includes(null);
3602
- if (nullableEnum) {
3603
- baseItems.push({ keyword: schemaKeywords.nullable });
3604
- }
3605
- const filteredValues = schema.enum.filter((value) => value !== null);
3606
- const extensionEnums = ["x-enumNames", "x-enum-varnames"].filter((extensionKey) => extensionKey in schema).map((extensionKey) => {
3607
- return [
3608
- {
3609
- keyword: schemaKeywords.enum,
3610
- args: {
3611
- name,
3612
- typeName,
3613
- asConst: false,
3614
- items: [...new Set(schema[extensionKey])].map((name2, index) => ({
3615
- name: transformers.stringify(name2),
3616
- value: schema.enum?.[index],
3617
- format: isNumber(schema.enum?.[index]) ? "number" : "string"
3618
- }))
3619
- }
3620
- },
3621
- ...baseItems.filter(
3622
- (item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches
3623
- )
3624
- ];
3625
- });
3626
- if (schema.type === "number" || schema.type === "integer") {
3627
- const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum));
3628
- return [
3629
- {
3630
- keyword: schemaKeywords.enum,
3631
- args: {
3632
- name: enumName,
3633
- typeName,
3634
- asConst: true,
3635
- items: enumNames?.args?.items ? [...new Set(enumNames.args.items)].map(({ name: name2, value }) => ({
3636
- name: name2,
3637
- value,
3638
- format: "number"
3639
- })) : [...new Set(filteredValues)].map((value) => {
3640
- return {
3641
- name: value,
3642
- value,
3643
- format: "number"
3644
- };
3645
- })
3646
- }
3647
- },
3648
- ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches)
3649
- ];
3650
- }
3651
- if (extensionEnums.length > 0 && extensionEnums[0]) {
3652
- return extensionEnums[0];
3653
- }
3654
- return [
3655
- {
3656
- keyword: schemaKeywords.enum,
3657
- args: {
3658
- name: enumName,
3659
- typeName,
3660
- asConst: false,
3661
- items: [...new Set(filteredValues)].map((value) => ({
3662
- name: transformers.stringify(value),
3663
- value,
3664
- format: isNumber(value) ? "number" : "string"
3665
- }))
3666
- }
3667
- },
3668
- ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches)
3669
- ];
3670
- }
3671
- if ("prefixItems" in schema) {
3672
- const prefixItems = schema.prefixItems;
3673
- const min2 = schema.minimum ?? schema.minLength ?? schema.minItems ?? void 0;
3674
- const max2 = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? void 0;
3675
- return [
3676
- {
3677
- keyword: schemaKeywords.tuple,
3678
- args: {
3679
- min: min2,
3680
- max: max2,
3681
- items: prefixItems.map((item) => {
3682
- return this.parse({ schema: item, name, parentName })[0];
3683
- }).filter(Boolean)
3684
- }
3685
- },
3686
- ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max)
3687
- ];
3688
- }
3689
- if (version === "3.1" && "const" in schema) {
3690
- if (schema["const"]) {
3691
- return [
3692
- {
3693
- keyword: schemaKeywords.const,
3694
- args: {
3695
- name: schema["const"],
3696
- format: typeof schema["const"] === "number" ? "number" : "string",
3697
- value: schema["const"]
3698
- }
3699
- },
3700
- ...baseItems
3701
- ];
3702
- }
3703
- return [{ keyword: schemaKeywords.null }];
3704
- }
3705
- if (schema.format) {
3706
- switch (schema.format) {
3707
- case "binary":
3708
- baseItems.push({ keyword: schemaKeywords.blob });
3709
- return baseItems;
3710
- case "date-time":
3711
- if (options.dateType) {
3712
- if (options.dateType === "date") {
3713
- baseItems.unshift({ keyword: schemaKeywords.date, args: { type: "date" } });
3714
- return baseItems;
3715
- }
3716
- if (options.dateType === "stringOffset") {
3717
- baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } });
3718
- return baseItems;
3719
- }
3720
- if (options.dateType === "stringLocal") {
3721
- baseItems.unshift({ keyword: schemaKeywords.datetime, args: { local: true } });
3722
- return baseItems;
3723
- }
3724
- baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } });
3725
- return baseItems;
3726
- }
3727
- break;
3728
- case "date":
3729
- if (options.dateType) {
3730
- if (options.dateType === "date") {
3731
- baseItems.unshift({ keyword: schemaKeywords.date, args: { type: "date" } });
3732
- return baseItems;
3733
- }
3734
- baseItems.unshift({ keyword: schemaKeywords.date, args: { type: "string" } });
3735
- return baseItems;
3736
- }
3737
- break;
3738
- case "time":
3739
- if (options.dateType) {
3740
- if (options.dateType === "date") {
3741
- baseItems.unshift({ keyword: schemaKeywords.time, args: { type: "date" } });
3742
- return baseItems;
3743
- }
3744
- baseItems.unshift({ keyword: schemaKeywords.time, args: { type: "string" } });
3745
- return baseItems;
3746
- }
3747
- break;
3748
- case "uuid":
3749
- baseItems.unshift({ keyword: schemaKeywords.uuid });
3750
- break;
3751
- case "email":
3752
- case "idn-email":
3753
- baseItems.unshift({ keyword: schemaKeywords.email });
3754
- break;
3755
- case "uri":
3756
- case "ipv4":
3757
- case "ipv6":
3758
- case "uri-reference":
3759
- case "hostname":
3760
- case "idn-hostname":
3761
- baseItems.unshift({ keyword: schemaKeywords.url });
3762
- break;
3763
- default:
3764
- break;
3765
- }
3766
- }
3767
- if ("items" in schema || schema.type === "array") {
3768
- const min2 = schema.minimum ?? schema.minLength ?? schema.minItems ?? void 0;
3769
- const max2 = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? void 0;
3770
- const items = this.parse({ schema: "items" in schema ? schema.items : [], name, parentName });
3771
- return [
3772
- {
3773
- keyword: schemaKeywords.array,
3774
- args: {
3775
- items,
3776
- min: min2,
3777
- max: max2
3778
- }
3779
- },
3780
- ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max)
3781
- ];
3782
- }
3783
- if (schema.properties || schema.additionalProperties) {
3784
- return [...__privateMethod(this, _SchemaGenerator_instances, parseProperties_fn).call(this, { schema, name }), ...baseItems];
3785
- }
3786
- if (schema.type) {
3787
- if (Array.isArray(schema.type)) {
3788
- const [type] = schema.type;
3789
- return [
3790
- ...this.parse({
3791
- schema: {
3792
- ...schema,
3793
- type
3794
- },
3795
- name,
3796
- parentName
3797
- }),
3798
- ...baseItems
3799
- ].filter(Boolean);
3800
- }
3801
- if (!["boolean", "object", "number", "string", "integer"].includes(schema.type)) {
3802
- this.context.pluginManager.logger.emit("warning", `Schema type '${schema.type}' is not valid for schema ${parentName}.${name}`);
3803
- }
3804
- return [{ keyword: schema.type }, ...baseItems];
3805
- }
3806
- return [{ keyword: unknownReturn }];
3807
- };
3808
- var SchemaGenerator = _SchemaGenerator;
3809
-
3810
- // src/components/Operation.tsx
3811
- init_esm_shims();
3812
- var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
3813
- import { createContext } from "@kubb/react";
3814
- var OperationContext = createContext({});
3815
- function Operation({ operation, children }) {
3816
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OperationContext.Provider, { value: { operation }, children });
3817
- }
3818
- Operation.Context = OperationContext;
3819
-
3820
- // src/hooks/useSchema.ts
3821
- init_esm_shims();
3822
- import { useContext } from "@kubb/react";
3823
-
3824
- // src/components/Schema.tsx
3825
- init_esm_shims();
3826
- import { File, Parser, createContext as createContext2, useApp, useFile } from "@kubb/react";
3827
- var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
3828
- var SchemaContext = createContext2({
3829
- name: "unknown",
3830
- tree: []
3831
- });
3832
- function Schema({ name, value, tree = [], children }) {
3833
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SchemaContext.Provider, { value: { name, schema: value, tree }, children });
3834
- }
3835
- Schema.File = function({ output, isTypeOnly, children }) {
3836
- const { plugin, pluginManager, mode } = useApp();
3837
- const { name } = useSchema();
3838
- if (mode === "single") {
3839
- const baseName2 = output;
3840
- const resolvedPath2 = pluginManager.resolvePath({
3841
- baseName: "",
3842
- pluginKey: plugin.key
3843
- });
3844
- if (!resolvedPath2) {
3845
- return null;
3846
- }
3847
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Parser, { language: "typescript", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3848
- File,
3849
- {
3850
- baseName: baseName2,
3851
- path: resolvedPath2,
3852
- meta: {
3853
- pluginKey: plugin.key
3854
- },
3855
- children
3856
- }
3857
- ) });
3858
- }
3859
- const baseName = `${pluginManager.resolveName({
3860
- name,
3861
- pluginKey: plugin.key,
3862
- type: "file"
3863
- })}.ts`;
3864
- const resolvedPath = pluginManager.resolvePath({
3865
- baseName,
3866
- pluginKey: plugin.key
3867
- });
3868
- if (!resolvedPath) {
3869
- return null;
3870
- }
3871
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Parser, { language: "typescript", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
3872
- File,
3873
- {
3874
- baseName,
3875
- path: resolvedPath,
3876
- meta: {
3877
- pluginKey: plugin.key
3878
- },
3879
- children: [
3880
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Schema.Imports, { isTypeOnly }),
3881
- children
3882
- ]
3883
- }
3884
- ) });
3885
- };
3886
- Schema.Imports = ({ isTypeOnly, extName }) => {
3887
- const { tree } = useSchema();
3888
- const { path: root } = useFile();
3889
- const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref);
3890
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: refs?.map((item, i) => {
3891
- if (!item.args.path) {
3892
- return void 0;
3893
- }
3894
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(File.Import, { extName, root, name: [item.args.name], path: item.args.path, isTypeOnly: item.args.isTypeOnly ?? isTypeOnly }, i);
3895
- }).filter(Boolean) });
3896
- };
3897
- Schema.Context = SchemaContext;
3898
-
3899
- // src/hooks/useSchema.ts
3900
- function useSchema() {
3901
- const props = useContext(Schema.Context);
3902
- return props;
3903
- }
3904
-
3905
- // src/components/Oas.tsx
3906
- init_esm_shims();
3907
- import { createContext as createContext3 } from "@kubb/react";
3908
- var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
3909
- var OasContext = createContext3({});
3910
- function Oas({ oas, children, operations, generator }) {
3911
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(OasContext.Provider, { value: { oas, generator, operations }, children });
3912
- }
3913
- Oas.Context = OasContext;
3914
- Oas.Operation = Operation;
3915
- Oas.Schema = Schema;
3916
-
3917
- export {
3918
- schemaKeywords,
3919
- isKeyword,
3920
- SchemaGenerator,
3921
- require_jsx_runtime,
3922
- Operation,
3923
- useSchema,
3924
- Schema,
3925
- Oas
3926
- };
3927
- /*! Bundled license information:
3928
-
3929
- react/cjs/react.production.min.js:
3930
- (**
3931
- * @license React
3932
- * react.production.min.js
3933
- *
3934
- * Copyright (c) Facebook, Inc. and its affiliates.
3935
- *
3936
- * This source code is licensed under the MIT license found in the
3937
- * LICENSE file in the root directory of this source tree.
3938
- *)
3939
-
3940
- react/cjs/react.development.js:
3941
- (**
3942
- * @license React
3943
- * react.development.js
3944
- *
3945
- * Copyright (c) Facebook, Inc. and its affiliates.
3946
- *
3947
- * This source code is licensed under the MIT license found in the
3948
- * LICENSE file in the root directory of this source tree.
3949
- *)
3950
-
3951
- react/cjs/react-jsx-runtime.production.min.js:
3952
- (**
3953
- * @license React
3954
- * react-jsx-runtime.production.min.js
3955
- *
3956
- * Copyright (c) Facebook, Inc. and its affiliates.
3957
- *
3958
- * This source code is licensed under the MIT license found in the
3959
- * LICENSE file in the root directory of this source tree.
3960
- *)
3961
-
3962
- react/cjs/react-jsx-runtime.development.js:
3963
- (**
3964
- * @license React
3965
- * react-jsx-runtime.development.js
3966
- *
3967
- * Copyright (c) Facebook, Inc. and its affiliates.
3968
- *
3969
- * This source code is licensed under the MIT license found in the
3970
- * LICENSE file in the root directory of this source tree.
3971
- *)
3972
- */
3973
- //# sourceMappingURL=chunk-FZN3PBEK.js.map