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