@kubb/plugin-ts 4.1.4 → 4.2.1
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-Cf7RuPmU.cjs +580 -0
- package/dist/components-Cf7RuPmU.cjs.map +1 -0
- package/dist/components-Wl2A-qA2.js +491 -0
- package/dist/components-Wl2A-qA2.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +2 -3
- package/dist/components.d.ts +2 -3
- package/dist/components.js +1 -1
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{plugin--SAE5fJd.cjs → plugin--YEvuFfE.cjs} +30 -26
- package/dist/plugin--YEvuFfE.cjs.map +1 -0
- package/dist/{plugin-C6Jg0eqz.js → plugin-BafrBt4Q.js} +31 -27
- package/dist/plugin-BafrBt4Q.js.map +1 -0
- package/dist/{types-C7OjrC1J.d.ts → types-DpBnlY1n.d.cts} +78 -122
- package/dist/{types-BLgrg7-y.d.cts → types-gqUseg33.d.ts} +79 -123
- package/package.json +10 -10
- package/src/components/Type.tsx +8 -10
- package/src/factory.ts +578 -0
- package/src/generators/oasGenerator.tsx +6 -7
- package/src/generators/typeGenerator.tsx +21 -12
- package/src/parser.ts +1 -1
- package/src/plugin.ts +5 -8
- package/dist/components-3SwDb74W.cjs +0 -1962
- package/dist/components-3SwDb74W.cjs.map +0 -1
- package/dist/components-CSEFpzdz.js +0 -1940
- package/dist/components-CSEFpzdz.js.map +0 -1
- package/dist/plugin--SAE5fJd.cjs.map +0 -1
- package/dist/plugin-C6Jg0eqz.js.map +0 -1
|
@@ -1,1940 +0,0 @@
|
|
|
1
|
-
import transformers from "@kubb/core/transformers";
|
|
2
|
-
import { SchemaGenerator, isKeyword, schemaKeywords } from "@kubb/plugin-oas";
|
|
3
|
-
import { print } from "@kubb/parser-ts";
|
|
4
|
-
import * as factory from "@kubb/parser-ts/factory";
|
|
5
|
-
import { createTypeDeclaration } from "@kubb/parser-ts/factory";
|
|
6
|
-
import { File, Type } from "@kubb/react";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "@kubb/react/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
//#region rolldown:runtime
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __commonJS = (cb, mod) => function() {
|
|
17
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
-
};
|
|
19
|
-
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n$1 = keys.length, key; i < n$1; i++) {
|
|
21
|
-
key = keys[i];
|
|
22
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
23
|
-
get: ((k) => from[k]).bind(null, key),
|
|
24
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
-
value: mod,
|
|
31
|
-
enumerable: true
|
|
32
|
-
}) : target, mod));
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/components/OasType.tsx
|
|
36
|
-
function OasType({ name, typeName, api }) {
|
|
37
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
-
/* @__PURE__ */ jsx(File.Source, {
|
|
39
|
-
name,
|
|
40
|
-
isExportable: true,
|
|
41
|
-
isIndexable: true,
|
|
42
|
-
children: `export const ${name} = ${JSON.stringify(api, void 0, 2)} as const`
|
|
43
|
-
}),
|
|
44
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
45
|
-
/* @__PURE__ */ jsx(File.Source, {
|
|
46
|
-
name: typeName,
|
|
47
|
-
isExportable: true,
|
|
48
|
-
isIndexable: true,
|
|
49
|
-
isTypeOnly: true,
|
|
50
|
-
children: /* @__PURE__ */ jsx(Type, {
|
|
51
|
-
name: typeName,
|
|
52
|
-
export: true,
|
|
53
|
-
children: `Infer<typeof ${name}>`
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
] });
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
|
|
61
|
-
var require_react_production_min = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js": ((exports) => {
|
|
62
|
-
var l = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), x = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), z = Symbol.iterator;
|
|
63
|
-
var B = {
|
|
64
|
-
isMounted: function() {
|
|
65
|
-
return !1;
|
|
66
|
-
},
|
|
67
|
-
enqueueForceUpdate: function() {},
|
|
68
|
-
enqueueReplaceState: function() {},
|
|
69
|
-
enqueueSetState: function() {}
|
|
70
|
-
}, C = Object.assign, D = {};
|
|
71
|
-
function E(a, b, e) {
|
|
72
|
-
this.props = a;
|
|
73
|
-
this.context = b;
|
|
74
|
-
this.refs = D;
|
|
75
|
-
this.updater = e || B;
|
|
76
|
-
}
|
|
77
|
-
E.prototype.isReactComponent = {};
|
|
78
|
-
E.prototype.setState = function(a, b) {
|
|
79
|
-
if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
|
80
|
-
this.updater.enqueueSetState(this, a, b, "setState");
|
|
81
|
-
};
|
|
82
|
-
E.prototype.forceUpdate = function(a) {
|
|
83
|
-
this.updater.enqueueForceUpdate(this, a, "forceUpdate");
|
|
84
|
-
};
|
|
85
|
-
function F() {}
|
|
86
|
-
F.prototype = E.prototype;
|
|
87
|
-
function G(a, b, e) {
|
|
88
|
-
this.props = a;
|
|
89
|
-
this.context = b;
|
|
90
|
-
this.refs = D;
|
|
91
|
-
this.updater = e || B;
|
|
92
|
-
}
|
|
93
|
-
var H = G.prototype = new F();
|
|
94
|
-
H.constructor = G;
|
|
95
|
-
C(H, E.prototype);
|
|
96
|
-
H.isPureReactComponent = !0;
|
|
97
|
-
var I = Array.isArray, J = Object.prototype.hasOwnProperty, K = { current: null }, L = {
|
|
98
|
-
key: !0,
|
|
99
|
-
ref: !0,
|
|
100
|
-
__self: !0,
|
|
101
|
-
__source: !0
|
|
102
|
-
};
|
|
103
|
-
exports.Fragment = p;
|
|
104
|
-
}) });
|
|
105
|
-
|
|
106
|
-
//#endregion
|
|
107
|
-
//#region ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js
|
|
108
|
-
var require_react_development = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js": ((exports, module) => {
|
|
109
|
-
if (process.env.NODE_ENV !== "production") (function() {
|
|
110
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(/* @__PURE__ */ new Error());
|
|
111
|
-
var ReactVersion = "18.3.1";
|
|
112
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
113
|
-
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
114
|
-
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
115
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
116
|
-
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
117
|
-
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
|
118
|
-
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
119
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
120
|
-
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
121
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
|
122
|
-
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
123
|
-
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
124
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
125
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
126
|
-
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
127
|
-
function getIteratorFn(maybeIterable) {
|
|
128
|
-
if (maybeIterable === null || typeof maybeIterable !== "object") return null;
|
|
129
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
130
|
-
if (typeof maybeIterator === "function") return maybeIterator;
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Keeps track of the current dispatcher.
|
|
135
|
-
*/
|
|
136
|
-
var ReactCurrentDispatcher = { current: null };
|
|
137
|
-
/**
|
|
138
|
-
* Keeps track of the current batch's configuration such as how long an update
|
|
139
|
-
* should suspend for if it needs to.
|
|
140
|
-
*/
|
|
141
|
-
var ReactCurrentBatchConfig = { transition: null };
|
|
142
|
-
var ReactCurrentActQueue = {
|
|
143
|
-
current: null,
|
|
144
|
-
isBatchingLegacy: false,
|
|
145
|
-
didScheduleLegacyUpdate: false
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Keeps track of the current owner.
|
|
149
|
-
*
|
|
150
|
-
* The current owner is the component who should own any components that are
|
|
151
|
-
* currently being constructed.
|
|
152
|
-
*/
|
|
153
|
-
var ReactCurrentOwner = { current: null };
|
|
154
|
-
var ReactDebugCurrentFrame = {};
|
|
155
|
-
var currentExtraStackFrame = null;
|
|
156
|
-
function setExtraStackFrame(stack) {
|
|
157
|
-
currentExtraStackFrame = stack;
|
|
158
|
-
}
|
|
159
|
-
ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
|
|
160
|
-
currentExtraStackFrame = stack;
|
|
161
|
-
};
|
|
162
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
163
|
-
ReactDebugCurrentFrame.getStackAddendum = function() {
|
|
164
|
-
var stack = "";
|
|
165
|
-
if (currentExtraStackFrame) stack += currentExtraStackFrame;
|
|
166
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
167
|
-
if (impl) stack += impl() || "";
|
|
168
|
-
return stack;
|
|
169
|
-
};
|
|
170
|
-
var enableScopeAPI = false;
|
|
171
|
-
var enableCacheElement = false;
|
|
172
|
-
var enableTransitionTracing = false;
|
|
173
|
-
var enableLegacyHidden = false;
|
|
174
|
-
var enableDebugTracing = false;
|
|
175
|
-
var ReactSharedInternals = {
|
|
176
|
-
ReactCurrentDispatcher,
|
|
177
|
-
ReactCurrentBatchConfig,
|
|
178
|
-
ReactCurrentOwner
|
|
179
|
-
};
|
|
180
|
-
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
|
181
|
-
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
|
182
|
-
function warn(format) {
|
|
183
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
|
|
184
|
-
printWarning("warn", format, args);
|
|
185
|
-
}
|
|
186
|
-
function error(format) {
|
|
187
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
|
|
188
|
-
printWarning("error", format, args);
|
|
189
|
-
}
|
|
190
|
-
function printWarning(level, format, args) {
|
|
191
|
-
var stack = ReactSharedInternals.ReactDebugCurrentFrame.getStackAddendum();
|
|
192
|
-
if (stack !== "") {
|
|
193
|
-
format += "%s";
|
|
194
|
-
args = args.concat([stack]);
|
|
195
|
-
}
|
|
196
|
-
var argsWithFormat = args.map(function(item) {
|
|
197
|
-
return String(item);
|
|
198
|
-
});
|
|
199
|
-
argsWithFormat.unshift("Warning: " + format);
|
|
200
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
201
|
-
}
|
|
202
|
-
var didWarnStateUpdateForUnmountedComponent = {};
|
|
203
|
-
function warnNoop(publicInstance, callerName) {
|
|
204
|
-
var _constructor = publicInstance.constructor;
|
|
205
|
-
var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass";
|
|
206
|
-
var warningKey = componentName + "." + callerName;
|
|
207
|
-
if (didWarnStateUpdateForUnmountedComponent[warningKey]) return;
|
|
208
|
-
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);
|
|
209
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* This is the abstract API for an update queue.
|
|
213
|
-
*/
|
|
214
|
-
var ReactNoopUpdateQueue = {
|
|
215
|
-
isMounted: function(publicInstance) {
|
|
216
|
-
return false;
|
|
217
|
-
},
|
|
218
|
-
enqueueForceUpdate: function(publicInstance, callback, callerName) {
|
|
219
|
-
warnNoop(publicInstance, "forceUpdate");
|
|
220
|
-
},
|
|
221
|
-
enqueueReplaceState: function(publicInstance, completeState, callback, callerName) {
|
|
222
|
-
warnNoop(publicInstance, "replaceState");
|
|
223
|
-
},
|
|
224
|
-
enqueueSetState: function(publicInstance, partialState, callback, callerName) {
|
|
225
|
-
warnNoop(publicInstance, "setState");
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
var assign = Object.assign;
|
|
229
|
-
var emptyObject = {};
|
|
230
|
-
Object.freeze(emptyObject);
|
|
231
|
-
/**
|
|
232
|
-
* Base class helpers for the updating state of a component.
|
|
233
|
-
*/
|
|
234
|
-
function Component(props, context, updater) {
|
|
235
|
-
this.props = props;
|
|
236
|
-
this.context = context;
|
|
237
|
-
this.refs = emptyObject;
|
|
238
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
239
|
-
}
|
|
240
|
-
Component.prototype.isReactComponent = {};
|
|
241
|
-
/**
|
|
242
|
-
* Sets a subset of the state. Always use this to mutate
|
|
243
|
-
* state. You should treat `this.state` as immutable.
|
|
244
|
-
*
|
|
245
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
246
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
247
|
-
*
|
|
248
|
-
* There is no guarantee that calls to `setState` will run synchronously,
|
|
249
|
-
* as they may eventually be batched together. You can provide an optional
|
|
250
|
-
* callback that will be executed when the call to setState is actually
|
|
251
|
-
* completed.
|
|
252
|
-
*
|
|
253
|
-
* When a function is provided to setState, it will be called at some point in
|
|
254
|
-
* the future (not synchronously). It will be called with the up to date
|
|
255
|
-
* component arguments (state, props, context). These values can be different
|
|
256
|
-
* from this.* because your function may be called after receiveProps but before
|
|
257
|
-
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
258
|
-
* assigned to this.
|
|
259
|
-
*
|
|
260
|
-
* @param {object|function} partialState Next partial state or function to
|
|
261
|
-
* produce next partial state to be merged with current state.
|
|
262
|
-
* @param {?function} callback Called after state is updated.
|
|
263
|
-
* @final
|
|
264
|
-
* @protected
|
|
265
|
-
*/
|
|
266
|
-
Component.prototype.setState = function(partialState, callback) {
|
|
267
|
-
if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
|
268
|
-
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* Forces an update. This should only be invoked when it is known with
|
|
272
|
-
* certainty that we are **not** in a DOM transaction.
|
|
273
|
-
*
|
|
274
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
275
|
-
* component's state has changed but `setState` was not called.
|
|
276
|
-
*
|
|
277
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
278
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
279
|
-
*
|
|
280
|
-
* @param {?function} callback Called after update is complete.
|
|
281
|
-
* @final
|
|
282
|
-
* @protected
|
|
283
|
-
*/
|
|
284
|
-
Component.prototype.forceUpdate = function(callback) {
|
|
285
|
-
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
286
|
-
};
|
|
287
|
-
var deprecatedAPIs = {
|
|
288
|
-
isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
|
|
289
|
-
replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
|
|
290
|
-
};
|
|
291
|
-
var defineDeprecationWarning = function(methodName, info) {
|
|
292
|
-
Object.defineProperty(Component.prototype, methodName, { get: function() {
|
|
293
|
-
warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
|
|
294
|
-
} });
|
|
295
|
-
};
|
|
296
|
-
for (var fnName in deprecatedAPIs) if (deprecatedAPIs.hasOwnProperty(fnName)) defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
297
|
-
function ComponentDummy() {}
|
|
298
|
-
ComponentDummy.prototype = Component.prototype;
|
|
299
|
-
/**
|
|
300
|
-
* Convenience component with default shallow equality check for sCU.
|
|
301
|
-
*/
|
|
302
|
-
function PureComponent(props, context, updater) {
|
|
303
|
-
this.props = props;
|
|
304
|
-
this.context = context;
|
|
305
|
-
this.refs = emptyObject;
|
|
306
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
307
|
-
}
|
|
308
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
309
|
-
pureComponentPrototype.constructor = PureComponent;
|
|
310
|
-
assign(pureComponentPrototype, Component.prototype);
|
|
311
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
312
|
-
function createRef() {
|
|
313
|
-
var refObject = { current: null };
|
|
314
|
-
Object.seal(refObject);
|
|
315
|
-
return refObject;
|
|
316
|
-
}
|
|
317
|
-
var isArrayImpl = Array.isArray;
|
|
318
|
-
function isArray(a) {
|
|
319
|
-
return isArrayImpl(a);
|
|
320
|
-
}
|
|
321
|
-
function typeName(value) {
|
|
322
|
-
return typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
323
|
-
}
|
|
324
|
-
function willCoercionThrow(value) {
|
|
325
|
-
try {
|
|
326
|
-
testStringCoercion(value);
|
|
327
|
-
return false;
|
|
328
|
-
} catch (e) {
|
|
329
|
-
return true;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
function testStringCoercion(value) {
|
|
333
|
-
return "" + value;
|
|
334
|
-
}
|
|
335
|
-
function checkKeyStringCoercion(value) {
|
|
336
|
-
if (willCoercionThrow(value)) {
|
|
337
|
-
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
338
|
-
return testStringCoercion(value);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
342
|
-
var displayName = outerType.displayName;
|
|
343
|
-
if (displayName) return displayName;
|
|
344
|
-
var functionName = innerType.displayName || innerType.name || "";
|
|
345
|
-
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
346
|
-
}
|
|
347
|
-
function getContextName(type) {
|
|
348
|
-
return type.displayName || "Context";
|
|
349
|
-
}
|
|
350
|
-
function getComponentNameFromType(type) {
|
|
351
|
-
if (type == null) return null;
|
|
352
|
-
if (typeof type.tag === "number") error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
|
353
|
-
if (typeof type === "function") return type.displayName || type.name || null;
|
|
354
|
-
if (typeof type === "string") return type;
|
|
355
|
-
switch (type) {
|
|
356
|
-
case REACT_FRAGMENT_TYPE: return "Fragment";
|
|
357
|
-
case REACT_PORTAL_TYPE: return "Portal";
|
|
358
|
-
case REACT_PROFILER_TYPE: return "Profiler";
|
|
359
|
-
case REACT_STRICT_MODE_TYPE: return "StrictMode";
|
|
360
|
-
case REACT_SUSPENSE_TYPE: return "Suspense";
|
|
361
|
-
case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList";
|
|
362
|
-
}
|
|
363
|
-
if (typeof type === "object") switch (type.$$typeof) {
|
|
364
|
-
case REACT_CONTEXT_TYPE: return getContextName(type) + ".Consumer";
|
|
365
|
-
case REACT_PROVIDER_TYPE: return getContextName(type._context) + ".Provider";
|
|
366
|
-
case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, "ForwardRef");
|
|
367
|
-
case REACT_MEMO_TYPE:
|
|
368
|
-
var outerName = type.displayName || null;
|
|
369
|
-
if (outerName !== null) return outerName;
|
|
370
|
-
return getComponentNameFromType(type.type) || "Memo";
|
|
371
|
-
case REACT_LAZY_TYPE:
|
|
372
|
-
var lazyComponent = type;
|
|
373
|
-
var payload = lazyComponent._payload;
|
|
374
|
-
var init = lazyComponent._init;
|
|
375
|
-
try {
|
|
376
|
-
return getComponentNameFromType(init(payload));
|
|
377
|
-
} catch (x$1) {
|
|
378
|
-
return null;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
return null;
|
|
382
|
-
}
|
|
383
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
384
|
-
var RESERVED_PROPS = {
|
|
385
|
-
key: true,
|
|
386
|
-
ref: true,
|
|
387
|
-
__self: true,
|
|
388
|
-
__source: true
|
|
389
|
-
};
|
|
390
|
-
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs = {};
|
|
391
|
-
function hasValidRef(config) {
|
|
392
|
-
if (hasOwnProperty.call(config, "ref")) {
|
|
393
|
-
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
|
394
|
-
if (getter && getter.isReactWarning) return false;
|
|
395
|
-
}
|
|
396
|
-
return config.ref !== void 0;
|
|
397
|
-
}
|
|
398
|
-
function hasValidKey(config) {
|
|
399
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
400
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
401
|
-
if (getter && getter.isReactWarning) return false;
|
|
402
|
-
}
|
|
403
|
-
return config.key !== void 0;
|
|
404
|
-
}
|
|
405
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
406
|
-
var warnAboutAccessingKey = function() {
|
|
407
|
-
if (!specialPropKeyWarningShown) {
|
|
408
|
-
specialPropKeyWarningShown = true;
|
|
409
|
-
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);
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
413
|
-
Object.defineProperty(props, "key", {
|
|
414
|
-
get: warnAboutAccessingKey,
|
|
415
|
-
configurable: true
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
419
|
-
var warnAboutAccessingRef = function() {
|
|
420
|
-
if (!specialPropRefWarningShown) {
|
|
421
|
-
specialPropRefWarningShown = true;
|
|
422
|
-
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);
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
426
|
-
Object.defineProperty(props, "ref", {
|
|
427
|
-
get: warnAboutAccessingRef,
|
|
428
|
-
configurable: true
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
432
|
-
if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
433
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
434
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
435
|
-
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);
|
|
436
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
442
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
443
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
444
|
-
* if something is a React Element.
|
|
445
|
-
*
|
|
446
|
-
* @param {*} type
|
|
447
|
-
* @param {*} props
|
|
448
|
-
* @param {*} key
|
|
449
|
-
* @param {string|object} ref
|
|
450
|
-
* @param {*} owner
|
|
451
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
452
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
453
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
454
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
455
|
-
* change in behavior.
|
|
456
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
457
|
-
* indicating filename, line number, and/or other information.
|
|
458
|
-
* @internal
|
|
459
|
-
*/
|
|
460
|
-
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
|
461
|
-
var element = {
|
|
462
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
463
|
-
type,
|
|
464
|
-
key,
|
|
465
|
-
ref,
|
|
466
|
-
props,
|
|
467
|
-
_owner: owner
|
|
468
|
-
};
|
|
469
|
-
element._store = {};
|
|
470
|
-
Object.defineProperty(element._store, "validated", {
|
|
471
|
-
configurable: false,
|
|
472
|
-
enumerable: false,
|
|
473
|
-
writable: true,
|
|
474
|
-
value: false
|
|
475
|
-
});
|
|
476
|
-
Object.defineProperty(element, "_self", {
|
|
477
|
-
configurable: false,
|
|
478
|
-
enumerable: false,
|
|
479
|
-
writable: false,
|
|
480
|
-
value: self
|
|
481
|
-
});
|
|
482
|
-
Object.defineProperty(element, "_source", {
|
|
483
|
-
configurable: false,
|
|
484
|
-
enumerable: false,
|
|
485
|
-
writable: false,
|
|
486
|
-
value: source
|
|
487
|
-
});
|
|
488
|
-
if (Object.freeze) {
|
|
489
|
-
Object.freeze(element.props);
|
|
490
|
-
Object.freeze(element);
|
|
491
|
-
}
|
|
492
|
-
return element;
|
|
493
|
-
};
|
|
494
|
-
/**
|
|
495
|
-
* Create and return a new ReactElement of the given type.
|
|
496
|
-
* See https://reactjs.org/docs/react-api.html#createelement
|
|
497
|
-
*/
|
|
498
|
-
function createElement(type, config, children) {
|
|
499
|
-
var propName;
|
|
500
|
-
var props = {};
|
|
501
|
-
var key = null;
|
|
502
|
-
var ref = null;
|
|
503
|
-
var self = null;
|
|
504
|
-
var source = null;
|
|
505
|
-
if (config != null) {
|
|
506
|
-
if (hasValidRef(config)) {
|
|
507
|
-
ref = config.ref;
|
|
508
|
-
warnIfStringRefCannotBeAutoConverted(config);
|
|
509
|
-
}
|
|
510
|
-
if (hasValidKey(config)) {
|
|
511
|
-
checkKeyStringCoercion(config.key);
|
|
512
|
-
key = "" + config.key;
|
|
513
|
-
}
|
|
514
|
-
self = config.__self === void 0 ? null : config.__self;
|
|
515
|
-
source = config.__source === void 0 ? null : config.__source;
|
|
516
|
-
for (propName in config) if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) props[propName] = config[propName];
|
|
517
|
-
}
|
|
518
|
-
var childrenLength = arguments.length - 2;
|
|
519
|
-
if (childrenLength === 1) props.children = children;
|
|
520
|
-
else if (childrenLength > 1) {
|
|
521
|
-
var childArray = Array(childrenLength);
|
|
522
|
-
for (var i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 2];
|
|
523
|
-
if (Object.freeze) Object.freeze(childArray);
|
|
524
|
-
props.children = childArray;
|
|
525
|
-
}
|
|
526
|
-
if (type && type.defaultProps) {
|
|
527
|
-
var defaultProps = type.defaultProps;
|
|
528
|
-
for (propName in defaultProps) if (props[propName] === void 0) props[propName] = defaultProps[propName];
|
|
529
|
-
}
|
|
530
|
-
if (key || ref) {
|
|
531
|
-
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
532
|
-
if (key) defineKeyPropWarningGetter(props, displayName);
|
|
533
|
-
if (ref) defineRefPropWarningGetter(props, displayName);
|
|
534
|
-
}
|
|
535
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
536
|
-
}
|
|
537
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
538
|
-
return ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Clone and return a new ReactElement using element as the starting point.
|
|
542
|
-
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
543
|
-
*/
|
|
544
|
-
function cloneElement(element, config, children) {
|
|
545
|
-
if (element === null || element === void 0) throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
|
546
|
-
var propName;
|
|
547
|
-
var props = assign({}, element.props);
|
|
548
|
-
var key = element.key;
|
|
549
|
-
var ref = element.ref;
|
|
550
|
-
var self = element._self;
|
|
551
|
-
var source = element._source;
|
|
552
|
-
var owner = element._owner;
|
|
553
|
-
if (config != null) {
|
|
554
|
-
if (hasValidRef(config)) {
|
|
555
|
-
ref = config.ref;
|
|
556
|
-
owner = ReactCurrentOwner.current;
|
|
557
|
-
}
|
|
558
|
-
if (hasValidKey(config)) {
|
|
559
|
-
checkKeyStringCoercion(config.key);
|
|
560
|
-
key = "" + config.key;
|
|
561
|
-
}
|
|
562
|
-
var defaultProps;
|
|
563
|
-
if (element.type && element.type.defaultProps) defaultProps = element.type.defaultProps;
|
|
564
|
-
for (propName in config) if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) if (config[propName] === void 0 && defaultProps !== void 0) props[propName] = defaultProps[propName];
|
|
565
|
-
else props[propName] = config[propName];
|
|
566
|
-
}
|
|
567
|
-
var childrenLength = arguments.length - 2;
|
|
568
|
-
if (childrenLength === 1) props.children = children;
|
|
569
|
-
else if (childrenLength > 1) {
|
|
570
|
-
var childArray = Array(childrenLength);
|
|
571
|
-
for (var i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 2];
|
|
572
|
-
props.children = childArray;
|
|
573
|
-
}
|
|
574
|
-
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* Verifies the object is a ReactElement.
|
|
578
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
579
|
-
* @param {?object} object
|
|
580
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
581
|
-
* @final
|
|
582
|
-
*/
|
|
583
|
-
function isValidElement(object) {
|
|
584
|
-
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
585
|
-
}
|
|
586
|
-
var SEPARATOR = ".";
|
|
587
|
-
var SUBSEPARATOR = ":";
|
|
588
|
-
/**
|
|
589
|
-
* Escape and wrap key so it is safe to use as a reactid
|
|
590
|
-
*
|
|
591
|
-
* @param {string} key to be escaped.
|
|
592
|
-
* @return {string} the escaped key.
|
|
593
|
-
*/
|
|
594
|
-
function escape(key) {
|
|
595
|
-
var escapeRegex = /[=:]/g;
|
|
596
|
-
var escaperLookup = {
|
|
597
|
-
"=": "=0",
|
|
598
|
-
":": "=2"
|
|
599
|
-
};
|
|
600
|
-
return "$" + key.replace(escapeRegex, function(match) {
|
|
601
|
-
return escaperLookup[match];
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* TODO: Test that a single child and an array with one item have the same key
|
|
606
|
-
* pattern.
|
|
607
|
-
*/
|
|
608
|
-
var didWarnAboutMaps = false;
|
|
609
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
610
|
-
function escapeUserProvidedKey(text) {
|
|
611
|
-
return text.replace(userProvidedKeyEscapeRegex, "$&/");
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Generate a key string that identifies a element within a set.
|
|
615
|
-
*
|
|
616
|
-
* @param {*} element A element that could contain a manual key.
|
|
617
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
|
618
|
-
* @return {string}
|
|
619
|
-
*/
|
|
620
|
-
function getElementKey(element, index) {
|
|
621
|
-
if (typeof element === "object" && element !== null && element.key != null) {
|
|
622
|
-
checkKeyStringCoercion(element.key);
|
|
623
|
-
return escape("" + element.key);
|
|
624
|
-
}
|
|
625
|
-
return index.toString(36);
|
|
626
|
-
}
|
|
627
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
628
|
-
var type = typeof children;
|
|
629
|
-
if (type === "undefined" || type === "boolean") children = null;
|
|
630
|
-
var invokeCallback = false;
|
|
631
|
-
if (children === null) invokeCallback = true;
|
|
632
|
-
else switch (type) {
|
|
633
|
-
case "string":
|
|
634
|
-
case "number":
|
|
635
|
-
invokeCallback = true;
|
|
636
|
-
break;
|
|
637
|
-
case "object": switch (children.$$typeof) {
|
|
638
|
-
case REACT_ELEMENT_TYPE:
|
|
639
|
-
case REACT_PORTAL_TYPE: invokeCallback = true;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
if (invokeCallback) {
|
|
643
|
-
var _child = children;
|
|
644
|
-
var mappedChild = callback(_child);
|
|
645
|
-
var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
646
|
-
if (isArray(mappedChild)) {
|
|
647
|
-
var escapedChildKey = "";
|
|
648
|
-
if (childKey != null) escapedChildKey = escapeUserProvidedKey(childKey) + "/";
|
|
649
|
-
mapIntoArray(mappedChild, array, escapedChildKey, "", function(c) {
|
|
650
|
-
return c;
|
|
651
|
-
});
|
|
652
|
-
} else if (mappedChild != null) {
|
|
653
|
-
if (isValidElement(mappedChild)) {
|
|
654
|
-
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) checkKeyStringCoercion(mappedChild.key);
|
|
655
|
-
mappedChild = cloneAndReplaceKey(mappedChild, escapedPrefix + (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey("" + mappedChild.key) + "/" : "") + childKey);
|
|
656
|
-
}
|
|
657
|
-
array.push(mappedChild);
|
|
658
|
-
}
|
|
659
|
-
return 1;
|
|
660
|
-
}
|
|
661
|
-
var child;
|
|
662
|
-
var nextName;
|
|
663
|
-
var subtreeCount = 0;
|
|
664
|
-
var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
665
|
-
if (isArray(children)) for (var i = 0; i < children.length; i++) {
|
|
666
|
-
child = children[i];
|
|
667
|
-
nextName = nextNamePrefix + getElementKey(child, i);
|
|
668
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
669
|
-
}
|
|
670
|
-
else {
|
|
671
|
-
var iteratorFn = getIteratorFn(children);
|
|
672
|
-
if (typeof iteratorFn === "function") {
|
|
673
|
-
var iterableChildren = children;
|
|
674
|
-
if (iteratorFn === iterableChildren.entries) {
|
|
675
|
-
if (!didWarnAboutMaps) warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
|
|
676
|
-
didWarnAboutMaps = true;
|
|
677
|
-
}
|
|
678
|
-
var iterator = iteratorFn.call(iterableChildren);
|
|
679
|
-
var step;
|
|
680
|
-
var ii = 0;
|
|
681
|
-
while (!(step = iterator.next()).done) {
|
|
682
|
-
child = step.value;
|
|
683
|
-
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
684
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
685
|
-
}
|
|
686
|
-
} else if (type === "object") {
|
|
687
|
-
var childrenString = String(children);
|
|
688
|
-
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.");
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
return subtreeCount;
|
|
692
|
-
}
|
|
693
|
-
/**
|
|
694
|
-
* Maps children that are typically specified as `props.children`.
|
|
695
|
-
*
|
|
696
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
697
|
-
*
|
|
698
|
-
* The provided mapFunction(child, index) will be called for each
|
|
699
|
-
* leaf child.
|
|
700
|
-
*
|
|
701
|
-
* @param {?*} children Children tree container.
|
|
702
|
-
* @param {function(*, int)} func The map function.
|
|
703
|
-
* @param {*} context Context for mapFunction.
|
|
704
|
-
* @return {object} Object containing the ordered map of results.
|
|
705
|
-
*/
|
|
706
|
-
function mapChildren(children, func, context) {
|
|
707
|
-
if (children == null) return children;
|
|
708
|
-
var result = [];
|
|
709
|
-
var count = 0;
|
|
710
|
-
mapIntoArray(children, result, "", "", function(child) {
|
|
711
|
-
return func.call(context, child, count++);
|
|
712
|
-
});
|
|
713
|
-
return result;
|
|
714
|
-
}
|
|
715
|
-
/**
|
|
716
|
-
* Count the number of children that are typically specified as
|
|
717
|
-
* `props.children`.
|
|
718
|
-
*
|
|
719
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
720
|
-
*
|
|
721
|
-
* @param {?*} children Children tree container.
|
|
722
|
-
* @return {number} The number of children.
|
|
723
|
-
*/
|
|
724
|
-
function countChildren(children) {
|
|
725
|
-
var n$1 = 0;
|
|
726
|
-
mapChildren(children, function() {
|
|
727
|
-
n$1++;
|
|
728
|
-
});
|
|
729
|
-
return n$1;
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Iterates through children that are typically specified as `props.children`.
|
|
733
|
-
*
|
|
734
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
735
|
-
*
|
|
736
|
-
* The provided forEachFunc(child, index) will be called for each
|
|
737
|
-
* leaf child.
|
|
738
|
-
*
|
|
739
|
-
* @param {?*} children Children tree container.
|
|
740
|
-
* @param {function(*, int)} forEachFunc
|
|
741
|
-
* @param {*} forEachContext Context for forEachContext.
|
|
742
|
-
*/
|
|
743
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
744
|
-
mapChildren(children, function() {
|
|
745
|
-
forEachFunc.apply(this, arguments);
|
|
746
|
-
}, forEachContext);
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Flatten a children object (typically specified as `props.children`) and
|
|
750
|
-
* return an array with appropriately re-keyed children.
|
|
751
|
-
*
|
|
752
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
753
|
-
*/
|
|
754
|
-
function toArray(children) {
|
|
755
|
-
return mapChildren(children, function(child) {
|
|
756
|
-
return child;
|
|
757
|
-
}) || [];
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* Returns the first child in a collection of children and verifies that there
|
|
761
|
-
* is only one child in the collection.
|
|
762
|
-
*
|
|
763
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
764
|
-
*
|
|
765
|
-
* The current implementation of this function assumes that a single child gets
|
|
766
|
-
* passed without a wrapper, but the purpose of this helper function is to
|
|
767
|
-
* abstract away the particular structure of children.
|
|
768
|
-
*
|
|
769
|
-
* @param {?object} children Child collection structure.
|
|
770
|
-
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
771
|
-
* structure.
|
|
772
|
-
*/
|
|
773
|
-
function onlyChild(children) {
|
|
774
|
-
if (!isValidElement(children)) throw new Error("React.Children.only expected to receive a single React element child.");
|
|
775
|
-
return children;
|
|
776
|
-
}
|
|
777
|
-
function createContext(defaultValue) {
|
|
778
|
-
var context = {
|
|
779
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
780
|
-
_currentValue: defaultValue,
|
|
781
|
-
_currentValue2: defaultValue,
|
|
782
|
-
_threadCount: 0,
|
|
783
|
-
Provider: null,
|
|
784
|
-
Consumer: null,
|
|
785
|
-
_defaultValue: null,
|
|
786
|
-
_globalName: null
|
|
787
|
-
};
|
|
788
|
-
context.Provider = {
|
|
789
|
-
$$typeof: REACT_PROVIDER_TYPE,
|
|
790
|
-
_context: context
|
|
791
|
-
};
|
|
792
|
-
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
793
|
-
var hasWarnedAboutUsingConsumerProvider = false;
|
|
794
|
-
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
795
|
-
var Consumer = {
|
|
796
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
797
|
-
_context: context
|
|
798
|
-
};
|
|
799
|
-
Object.defineProperties(Consumer, {
|
|
800
|
-
Provider: {
|
|
801
|
-
get: function() {
|
|
802
|
-
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
803
|
-
hasWarnedAboutUsingConsumerProvider = true;
|
|
804
|
-
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?");
|
|
805
|
-
}
|
|
806
|
-
return context.Provider;
|
|
807
|
-
},
|
|
808
|
-
set: function(_Provider) {
|
|
809
|
-
context.Provider = _Provider;
|
|
810
|
-
}
|
|
811
|
-
},
|
|
812
|
-
_currentValue: {
|
|
813
|
-
get: function() {
|
|
814
|
-
return context._currentValue;
|
|
815
|
-
},
|
|
816
|
-
set: function(_currentValue) {
|
|
817
|
-
context._currentValue = _currentValue;
|
|
818
|
-
}
|
|
819
|
-
},
|
|
820
|
-
_currentValue2: {
|
|
821
|
-
get: function() {
|
|
822
|
-
return context._currentValue2;
|
|
823
|
-
},
|
|
824
|
-
set: function(_currentValue2) {
|
|
825
|
-
context._currentValue2 = _currentValue2;
|
|
826
|
-
}
|
|
827
|
-
},
|
|
828
|
-
_threadCount: {
|
|
829
|
-
get: function() {
|
|
830
|
-
return context._threadCount;
|
|
831
|
-
},
|
|
832
|
-
set: function(_threadCount) {
|
|
833
|
-
context._threadCount = _threadCount;
|
|
834
|
-
}
|
|
835
|
-
},
|
|
836
|
-
Consumer: { get: function() {
|
|
837
|
-
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
838
|
-
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
839
|
-
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?");
|
|
840
|
-
}
|
|
841
|
-
return context.Consumer;
|
|
842
|
-
} },
|
|
843
|
-
displayName: {
|
|
844
|
-
get: function() {
|
|
845
|
-
return context.displayName;
|
|
846
|
-
},
|
|
847
|
-
set: function(displayName) {
|
|
848
|
-
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
849
|
-
warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
850
|
-
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
});
|
|
855
|
-
context.Consumer = Consumer;
|
|
856
|
-
context._currentRenderer = null;
|
|
857
|
-
context._currentRenderer2 = null;
|
|
858
|
-
return context;
|
|
859
|
-
}
|
|
860
|
-
var Uninitialized = -1;
|
|
861
|
-
var Pending = 0;
|
|
862
|
-
var Resolved = 1;
|
|
863
|
-
var Rejected = 2;
|
|
864
|
-
function lazyInitializer(payload) {
|
|
865
|
-
if (payload._status === Uninitialized) {
|
|
866
|
-
var ctor = payload._result;
|
|
867
|
-
var thenable = ctor();
|
|
868
|
-
thenable.then(function(moduleObject$1) {
|
|
869
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
870
|
-
var resolved = payload;
|
|
871
|
-
resolved._status = Resolved;
|
|
872
|
-
resolved._result = moduleObject$1;
|
|
873
|
-
}
|
|
874
|
-
}, function(error$1) {
|
|
875
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
876
|
-
var rejected = payload;
|
|
877
|
-
rejected._status = Rejected;
|
|
878
|
-
rejected._result = error$1;
|
|
879
|
-
}
|
|
880
|
-
});
|
|
881
|
-
if (payload._status === Uninitialized) {
|
|
882
|
-
var pending = payload;
|
|
883
|
-
pending._status = Pending;
|
|
884
|
-
pending._result = thenable;
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
if (payload._status === Resolved) {
|
|
888
|
-
var moduleObject = payload._result;
|
|
889
|
-
if (moduleObject === void 0) 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);
|
|
890
|
-
if (!("default" in moduleObject)) 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);
|
|
891
|
-
return moduleObject.default;
|
|
892
|
-
} else throw payload._result;
|
|
893
|
-
}
|
|
894
|
-
function lazy(ctor) {
|
|
895
|
-
var lazyType = {
|
|
896
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
897
|
-
_payload: {
|
|
898
|
-
_status: Uninitialized,
|
|
899
|
-
_result: ctor
|
|
900
|
-
},
|
|
901
|
-
_init: lazyInitializer
|
|
902
|
-
};
|
|
903
|
-
var defaultProps;
|
|
904
|
-
var propTypes;
|
|
905
|
-
Object.defineProperties(lazyType, {
|
|
906
|
-
defaultProps: {
|
|
907
|
-
configurable: true,
|
|
908
|
-
get: function() {
|
|
909
|
-
return defaultProps;
|
|
910
|
-
},
|
|
911
|
-
set: function(newDefaultProps) {
|
|
912
|
-
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.");
|
|
913
|
-
defaultProps = newDefaultProps;
|
|
914
|
-
Object.defineProperty(lazyType, "defaultProps", { enumerable: true });
|
|
915
|
-
}
|
|
916
|
-
},
|
|
917
|
-
propTypes: {
|
|
918
|
-
configurable: true,
|
|
919
|
-
get: function() {
|
|
920
|
-
return propTypes;
|
|
921
|
-
},
|
|
922
|
-
set: function(newPropTypes) {
|
|
923
|
-
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.");
|
|
924
|
-
propTypes = newPropTypes;
|
|
925
|
-
Object.defineProperty(lazyType, "propTypes", { enumerable: true });
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
});
|
|
929
|
-
return lazyType;
|
|
930
|
-
}
|
|
931
|
-
function forwardRef(render) {
|
|
932
|
-
if (render != null && render.$$typeof === REACT_MEMO_TYPE) error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
|
|
933
|
-
else if (typeof render !== "function") error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render);
|
|
934
|
-
else if (render.length !== 0 && render.length !== 2) 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.");
|
|
935
|
-
if (render != null) {
|
|
936
|
-
if (render.defaultProps != null || render.propTypes != null) error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");
|
|
937
|
-
}
|
|
938
|
-
var elementType = {
|
|
939
|
-
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
940
|
-
render
|
|
941
|
-
};
|
|
942
|
-
var ownName;
|
|
943
|
-
Object.defineProperty(elementType, "displayName", {
|
|
944
|
-
enumerable: false,
|
|
945
|
-
configurable: true,
|
|
946
|
-
get: function() {
|
|
947
|
-
return ownName;
|
|
948
|
-
},
|
|
949
|
-
set: function(name) {
|
|
950
|
-
ownName = name;
|
|
951
|
-
if (!render.name && !render.displayName) render.displayName = name;
|
|
952
|
-
}
|
|
953
|
-
});
|
|
954
|
-
return elementType;
|
|
955
|
-
}
|
|
956
|
-
var REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
957
|
-
function isValidElementType(type) {
|
|
958
|
-
if (typeof type === "string" || typeof type === "function") return true;
|
|
959
|
-
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) return true;
|
|
960
|
-
if (typeof type === "object" && type !== null) {
|
|
961
|
-
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 || type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) return true;
|
|
962
|
-
}
|
|
963
|
-
return false;
|
|
964
|
-
}
|
|
965
|
-
function memo(type, compare) {
|
|
966
|
-
if (!isValidElementType(type)) error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
|
|
967
|
-
var elementType = {
|
|
968
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
969
|
-
type,
|
|
970
|
-
compare: compare === void 0 ? null : compare
|
|
971
|
-
};
|
|
972
|
-
var ownName;
|
|
973
|
-
Object.defineProperty(elementType, "displayName", {
|
|
974
|
-
enumerable: false,
|
|
975
|
-
configurable: true,
|
|
976
|
-
get: function() {
|
|
977
|
-
return ownName;
|
|
978
|
-
},
|
|
979
|
-
set: function(name) {
|
|
980
|
-
ownName = name;
|
|
981
|
-
if (!type.name && !type.displayName) type.displayName = name;
|
|
982
|
-
}
|
|
983
|
-
});
|
|
984
|
-
return elementType;
|
|
985
|
-
}
|
|
986
|
-
function resolveDispatcher() {
|
|
987
|
-
var dispatcher = ReactCurrentDispatcher.current;
|
|
988
|
-
if (dispatcher === null) 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.");
|
|
989
|
-
return dispatcher;
|
|
990
|
-
}
|
|
991
|
-
function useContext(Context) {
|
|
992
|
-
var dispatcher = resolveDispatcher();
|
|
993
|
-
if (Context._context !== void 0) {
|
|
994
|
-
var realContext = Context._context;
|
|
995
|
-
if (realContext.Consumer === Context) 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?");
|
|
996
|
-
else if (realContext.Provider === Context) error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?");
|
|
997
|
-
}
|
|
998
|
-
return dispatcher.useContext(Context);
|
|
999
|
-
}
|
|
1000
|
-
function useState(initialState) {
|
|
1001
|
-
return resolveDispatcher().useState(initialState);
|
|
1002
|
-
}
|
|
1003
|
-
function useReducer(reducer, initialArg, init) {
|
|
1004
|
-
return resolveDispatcher().useReducer(reducer, initialArg, init);
|
|
1005
|
-
}
|
|
1006
|
-
function useRef(initialValue) {
|
|
1007
|
-
return resolveDispatcher().useRef(initialValue);
|
|
1008
|
-
}
|
|
1009
|
-
function useEffect(create, deps) {
|
|
1010
|
-
return resolveDispatcher().useEffect(create, deps);
|
|
1011
|
-
}
|
|
1012
|
-
function useInsertionEffect(create, deps) {
|
|
1013
|
-
return resolveDispatcher().useInsertionEffect(create, deps);
|
|
1014
|
-
}
|
|
1015
|
-
function useLayoutEffect(create, deps) {
|
|
1016
|
-
return resolveDispatcher().useLayoutEffect(create, deps);
|
|
1017
|
-
}
|
|
1018
|
-
function useCallback(callback, deps) {
|
|
1019
|
-
return resolveDispatcher().useCallback(callback, deps);
|
|
1020
|
-
}
|
|
1021
|
-
function useMemo(create, deps) {
|
|
1022
|
-
return resolveDispatcher().useMemo(create, deps);
|
|
1023
|
-
}
|
|
1024
|
-
function useImperativeHandle(ref, create, deps) {
|
|
1025
|
-
return resolveDispatcher().useImperativeHandle(ref, create, deps);
|
|
1026
|
-
}
|
|
1027
|
-
function useDebugValue(value, formatterFn) {
|
|
1028
|
-
return resolveDispatcher().useDebugValue(value, formatterFn);
|
|
1029
|
-
}
|
|
1030
|
-
function useTransition() {
|
|
1031
|
-
return resolveDispatcher().useTransition();
|
|
1032
|
-
}
|
|
1033
|
-
function useDeferredValue(value) {
|
|
1034
|
-
return resolveDispatcher().useDeferredValue(value);
|
|
1035
|
-
}
|
|
1036
|
-
function useId() {
|
|
1037
|
-
return resolveDispatcher().useId();
|
|
1038
|
-
}
|
|
1039
|
-
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
1040
|
-
return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1041
|
-
}
|
|
1042
|
-
var disabledDepth = 0;
|
|
1043
|
-
var prevLog;
|
|
1044
|
-
var prevInfo;
|
|
1045
|
-
var prevWarn;
|
|
1046
|
-
var prevError;
|
|
1047
|
-
var prevGroup;
|
|
1048
|
-
var prevGroupCollapsed;
|
|
1049
|
-
var prevGroupEnd;
|
|
1050
|
-
function disabledLog() {}
|
|
1051
|
-
disabledLog.__reactDisabledLog = true;
|
|
1052
|
-
function disableLogs() {
|
|
1053
|
-
if (disabledDepth === 0) {
|
|
1054
|
-
prevLog = console.log;
|
|
1055
|
-
prevInfo = console.info;
|
|
1056
|
-
prevWarn = console.warn;
|
|
1057
|
-
prevError = console.error;
|
|
1058
|
-
prevGroup = console.group;
|
|
1059
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
1060
|
-
prevGroupEnd = console.groupEnd;
|
|
1061
|
-
var props = {
|
|
1062
|
-
configurable: true,
|
|
1063
|
-
enumerable: true,
|
|
1064
|
-
value: disabledLog,
|
|
1065
|
-
writable: true
|
|
1066
|
-
};
|
|
1067
|
-
Object.defineProperties(console, {
|
|
1068
|
-
info: props,
|
|
1069
|
-
log: props,
|
|
1070
|
-
warn: props,
|
|
1071
|
-
error: props,
|
|
1072
|
-
group: props,
|
|
1073
|
-
groupCollapsed: props,
|
|
1074
|
-
groupEnd: props
|
|
1075
|
-
});
|
|
1076
|
-
}
|
|
1077
|
-
disabledDepth++;
|
|
1078
|
-
}
|
|
1079
|
-
function reenableLogs() {
|
|
1080
|
-
disabledDepth--;
|
|
1081
|
-
if (disabledDepth === 0) {
|
|
1082
|
-
var props = {
|
|
1083
|
-
configurable: true,
|
|
1084
|
-
enumerable: true,
|
|
1085
|
-
writable: true
|
|
1086
|
-
};
|
|
1087
|
-
Object.defineProperties(console, {
|
|
1088
|
-
log: assign({}, props, { value: prevLog }),
|
|
1089
|
-
info: assign({}, props, { value: prevInfo }),
|
|
1090
|
-
warn: assign({}, props, { value: prevWarn }),
|
|
1091
|
-
error: assign({}, props, { value: prevError }),
|
|
1092
|
-
group: assign({}, props, { value: prevGroup }),
|
|
1093
|
-
groupCollapsed: assign({}, props, { value: prevGroupCollapsed }),
|
|
1094
|
-
groupEnd: assign({}, props, { value: prevGroupEnd })
|
|
1095
|
-
});
|
|
1096
|
-
}
|
|
1097
|
-
if (disabledDepth < 0) error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
1098
|
-
}
|
|
1099
|
-
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1100
|
-
var prefix;
|
|
1101
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1102
|
-
if (prefix === void 0) try {
|
|
1103
|
-
throw Error();
|
|
1104
|
-
} catch (x$1) {
|
|
1105
|
-
var match = x$1.stack.trim().match(/\n( *(at )?)/);
|
|
1106
|
-
prefix = match && match[1] || "";
|
|
1107
|
-
}
|
|
1108
|
-
return "\n" + prefix + name;
|
|
1109
|
-
}
|
|
1110
|
-
var reentry = false;
|
|
1111
|
-
var componentFrameCache = new (typeof WeakMap === "function" ? WeakMap : Map)();
|
|
1112
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
1113
|
-
if (!fn || reentry) return "";
|
|
1114
|
-
var frame = componentFrameCache.get(fn);
|
|
1115
|
-
if (frame !== void 0) return frame;
|
|
1116
|
-
var control;
|
|
1117
|
-
reentry = true;
|
|
1118
|
-
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
1119
|
-
Error.prepareStackTrace = void 0;
|
|
1120
|
-
var previousDispatcher = ReactCurrentDispatcher$1.current;
|
|
1121
|
-
ReactCurrentDispatcher$1.current = null;
|
|
1122
|
-
disableLogs();
|
|
1123
|
-
try {
|
|
1124
|
-
if (construct) {
|
|
1125
|
-
var Fake = function() {
|
|
1126
|
-
throw Error();
|
|
1127
|
-
};
|
|
1128
|
-
Object.defineProperty(Fake.prototype, "props", { set: function() {
|
|
1129
|
-
throw Error();
|
|
1130
|
-
} });
|
|
1131
|
-
if (typeof Reflect === "object" && Reflect.construct) {
|
|
1132
|
-
try {
|
|
1133
|
-
Reflect.construct(Fake, []);
|
|
1134
|
-
} catch (x$1) {
|
|
1135
|
-
control = x$1;
|
|
1136
|
-
}
|
|
1137
|
-
Reflect.construct(fn, [], Fake);
|
|
1138
|
-
} else {
|
|
1139
|
-
try {
|
|
1140
|
-
Fake.call();
|
|
1141
|
-
} catch (x$1) {
|
|
1142
|
-
control = x$1;
|
|
1143
|
-
}
|
|
1144
|
-
fn.call(Fake.prototype);
|
|
1145
|
-
}
|
|
1146
|
-
} else {
|
|
1147
|
-
try {
|
|
1148
|
-
throw Error();
|
|
1149
|
-
} catch (x$1) {
|
|
1150
|
-
control = x$1;
|
|
1151
|
-
}
|
|
1152
|
-
fn();
|
|
1153
|
-
}
|
|
1154
|
-
} catch (sample) {
|
|
1155
|
-
if (sample && control && typeof sample.stack === "string") {
|
|
1156
|
-
var sampleLines = sample.stack.split("\n");
|
|
1157
|
-
var controlLines = control.stack.split("\n");
|
|
1158
|
-
var s = sampleLines.length - 1;
|
|
1159
|
-
var c = controlLines.length - 1;
|
|
1160
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) c--;
|
|
1161
|
-
for (; s >= 1 && c >= 0; s--, c--) if (sampleLines[s] !== controlLines[c]) {
|
|
1162
|
-
if (s !== 1 || c !== 1) do {
|
|
1163
|
-
s--;
|
|
1164
|
-
c--;
|
|
1165
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
1166
|
-
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
|
1167
|
-
if (fn.displayName && _frame.includes("<anonymous>")) _frame = _frame.replace("<anonymous>", fn.displayName);
|
|
1168
|
-
if (typeof fn === "function") componentFrameCache.set(fn, _frame);
|
|
1169
|
-
return _frame;
|
|
1170
|
-
}
|
|
1171
|
-
} while (s >= 1 && c >= 0);
|
|
1172
|
-
break;
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
} finally {
|
|
1176
|
-
reentry = false;
|
|
1177
|
-
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
1178
|
-
reenableLogs();
|
|
1179
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
1180
|
-
}
|
|
1181
|
-
var name = fn ? fn.displayName || fn.name : "";
|
|
1182
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
1183
|
-
if (typeof fn === "function") componentFrameCache.set(fn, syntheticFrame);
|
|
1184
|
-
return syntheticFrame;
|
|
1185
|
-
}
|
|
1186
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
1187
|
-
return describeNativeComponentFrame(fn, false);
|
|
1188
|
-
}
|
|
1189
|
-
function shouldConstruct(Component$1) {
|
|
1190
|
-
var prototype = Component$1.prototype;
|
|
1191
|
-
return !!(prototype && prototype.isReactComponent);
|
|
1192
|
-
}
|
|
1193
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
1194
|
-
if (type == null) return "";
|
|
1195
|
-
if (typeof type === "function") return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
1196
|
-
if (typeof type === "string") return describeBuiltInComponentFrame(type);
|
|
1197
|
-
switch (type) {
|
|
1198
|
-
case REACT_SUSPENSE_TYPE: return describeBuiltInComponentFrame("Suspense");
|
|
1199
|
-
case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame("SuspenseList");
|
|
1200
|
-
}
|
|
1201
|
-
if (typeof type === "object") switch (type.$$typeof) {
|
|
1202
|
-
case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render);
|
|
1203
|
-
case REACT_MEMO_TYPE: return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
1204
|
-
case REACT_LAZY_TYPE:
|
|
1205
|
-
var lazyComponent = type;
|
|
1206
|
-
var payload = lazyComponent._payload;
|
|
1207
|
-
var init = lazyComponent._init;
|
|
1208
|
-
try {
|
|
1209
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
1210
|
-
} catch (x$1) {}
|
|
1211
|
-
}
|
|
1212
|
-
return "";
|
|
1213
|
-
}
|
|
1214
|
-
var loggedTypeFailures = {};
|
|
1215
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1216
|
-
function setCurrentlyValidatingElement(element) {
|
|
1217
|
-
if (element) {
|
|
1218
|
-
var owner = element._owner;
|
|
1219
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1220
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1221
|
-
} else ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1222
|
-
}
|
|
1223
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
1224
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
1225
|
-
for (var typeSpecName in typeSpecs) if (has(typeSpecs, typeSpecName)) {
|
|
1226
|
-
var error$1 = void 0;
|
|
1227
|
-
try {
|
|
1228
|
-
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
1229
|
-
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`.");
|
|
1230
|
-
err.name = "Invariant Violation";
|
|
1231
|
-
throw err;
|
|
1232
|
-
}
|
|
1233
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
1234
|
-
} catch (ex) {
|
|
1235
|
-
error$1 = ex;
|
|
1236
|
-
}
|
|
1237
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
1238
|
-
setCurrentlyValidatingElement(element);
|
|
1239
|
-
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);
|
|
1240
|
-
setCurrentlyValidatingElement(null);
|
|
1241
|
-
}
|
|
1242
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
1243
|
-
loggedTypeFailures[error$1.message] = true;
|
|
1244
|
-
setCurrentlyValidatingElement(element);
|
|
1245
|
-
error("Failed %s type: %s", location, error$1.message);
|
|
1246
|
-
setCurrentlyValidatingElement(null);
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
1251
|
-
if (element) {
|
|
1252
|
-
var owner = element._owner;
|
|
1253
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1254
|
-
setExtraStackFrame(stack);
|
|
1255
|
-
} else setExtraStackFrame(null);
|
|
1256
|
-
}
|
|
1257
|
-
var propTypesMisspellWarningShown = false;
|
|
1258
|
-
function getDeclarationErrorAddendum() {
|
|
1259
|
-
if (ReactCurrentOwner.current) {
|
|
1260
|
-
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
1261
|
-
if (name) return "\n\nCheck the render method of `" + name + "`.";
|
|
1262
|
-
}
|
|
1263
|
-
return "";
|
|
1264
|
-
}
|
|
1265
|
-
function getSourceInfoErrorAddendum(source) {
|
|
1266
|
-
if (source !== void 0) {
|
|
1267
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
|
1268
|
-
var lineNumber = source.lineNumber;
|
|
1269
|
-
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
|
1270
|
-
}
|
|
1271
|
-
return "";
|
|
1272
|
-
}
|
|
1273
|
-
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
1274
|
-
if (elementProps !== null && elementProps !== void 0) return getSourceInfoErrorAddendum(elementProps.__source);
|
|
1275
|
-
return "";
|
|
1276
|
-
}
|
|
1277
|
-
/**
|
|
1278
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1279
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
1280
|
-
* updates.
|
|
1281
|
-
*/
|
|
1282
|
-
var ownerHasKeyUseWarning = {};
|
|
1283
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
1284
|
-
var info = getDeclarationErrorAddendum();
|
|
1285
|
-
if (!info) {
|
|
1286
|
-
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
1287
|
-
if (parentName) info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1288
|
-
}
|
|
1289
|
-
return info;
|
|
1290
|
-
}
|
|
1291
|
-
/**
|
|
1292
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1293
|
-
* This element is in an array. The array could grow and shrink or be
|
|
1294
|
-
* reordered. All children that haven't already been validated are required to
|
|
1295
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1296
|
-
* will only be shown once.
|
|
1297
|
-
*
|
|
1298
|
-
* @internal
|
|
1299
|
-
* @param {ReactElement} element Element that requires a key.
|
|
1300
|
-
* @param {*} parentType element's parent's type.
|
|
1301
|
-
*/
|
|
1302
|
-
function validateExplicitKey(element, parentType) {
|
|
1303
|
-
if (!element._store || element._store.validated || element.key != null) return;
|
|
1304
|
-
element._store.validated = true;
|
|
1305
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1306
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) return;
|
|
1307
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
1308
|
-
var childOwner = "";
|
|
1309
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner.current) childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1310
|
-
setCurrentlyValidatingElement$1(element);
|
|
1311
|
-
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);
|
|
1312
|
-
setCurrentlyValidatingElement$1(null);
|
|
1313
|
-
}
|
|
1314
|
-
/**
|
|
1315
|
-
* Ensure that every element either is passed in a static location, in an
|
|
1316
|
-
* array with an explicit keys property defined, or in an object literal
|
|
1317
|
-
* with valid key property.
|
|
1318
|
-
*
|
|
1319
|
-
* @internal
|
|
1320
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
1321
|
-
* @param {*} parentType node's parent's type.
|
|
1322
|
-
*/
|
|
1323
|
-
function validateChildKeys(node, parentType) {
|
|
1324
|
-
if (typeof node !== "object") return;
|
|
1325
|
-
if (isArray(node)) for (var i = 0; i < node.length; i++) {
|
|
1326
|
-
var child = node[i];
|
|
1327
|
-
if (isValidElement(child)) validateExplicitKey(child, parentType);
|
|
1328
|
-
}
|
|
1329
|
-
else if (isValidElement(node)) {
|
|
1330
|
-
if (node._store) node._store.validated = true;
|
|
1331
|
-
} else if (node) {
|
|
1332
|
-
var iteratorFn = getIteratorFn(node);
|
|
1333
|
-
if (typeof iteratorFn === "function") {
|
|
1334
|
-
if (iteratorFn !== node.entries) {
|
|
1335
|
-
var iterator = iteratorFn.call(node);
|
|
1336
|
-
var step;
|
|
1337
|
-
while (!(step = iterator.next()).done) if (isValidElement(step.value)) validateExplicitKey(step.value, parentType);
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
/**
|
|
1343
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
1344
|
-
* provided by the type.
|
|
1345
|
-
*
|
|
1346
|
-
* @param {ReactElement} element
|
|
1347
|
-
*/
|
|
1348
|
-
function validatePropTypes(element) {
|
|
1349
|
-
var type = element.type;
|
|
1350
|
-
if (type === null || type === void 0 || typeof type === "string") return;
|
|
1351
|
-
var propTypes;
|
|
1352
|
-
if (typeof type === "function") propTypes = type.propTypes;
|
|
1353
|
-
else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MEMO_TYPE)) propTypes = type.propTypes;
|
|
1354
|
-
else return;
|
|
1355
|
-
if (propTypes) {
|
|
1356
|
-
var name = getComponentNameFromType(type);
|
|
1357
|
-
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
1358
|
-
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
|
1359
|
-
propTypesMisspellWarningShown = true;
|
|
1360
|
-
var _name = getComponentNameFromType(type);
|
|
1361
|
-
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
|
1362
|
-
}
|
|
1363
|
-
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
1364
|
-
}
|
|
1365
|
-
/**
|
|
1366
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
1367
|
-
* @param {ReactElement} fragment
|
|
1368
|
-
*/
|
|
1369
|
-
function validateFragmentProps(fragment) {
|
|
1370
|
-
var keys = Object.keys(fragment.props);
|
|
1371
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1372
|
-
var key = keys[i];
|
|
1373
|
-
if (key !== "children" && key !== "key") {
|
|
1374
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1375
|
-
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
|
1376
|
-
setCurrentlyValidatingElement$1(null);
|
|
1377
|
-
break;
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
if (fragment.ref !== null) {
|
|
1381
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1382
|
-
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
1383
|
-
setCurrentlyValidatingElement$1(null);
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
function createElementWithValidation(type, props, children) {
|
|
1387
|
-
var validType = isValidElementType(type);
|
|
1388
|
-
if (!validType) {
|
|
1389
|
-
var info = "";
|
|
1390
|
-
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) 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.";
|
|
1391
|
-
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
1392
|
-
if (sourceInfo) info += sourceInfo;
|
|
1393
|
-
else info += getDeclarationErrorAddendum();
|
|
1394
|
-
var typeString;
|
|
1395
|
-
if (type === null) typeString = "null";
|
|
1396
|
-
else if (isArray(type)) typeString = "array";
|
|
1397
|
-
else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1398
|
-
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
1399
|
-
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
1400
|
-
} else typeString = typeof type;
|
|
1401
|
-
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);
|
|
1402
|
-
}
|
|
1403
|
-
var element = createElement.apply(this, arguments);
|
|
1404
|
-
if (element == null) return element;
|
|
1405
|
-
if (validType) for (var i = 2; i < arguments.length; i++) validateChildKeys(arguments[i], type);
|
|
1406
|
-
if (type === REACT_FRAGMENT_TYPE) validateFragmentProps(element);
|
|
1407
|
-
else validatePropTypes(element);
|
|
1408
|
-
return element;
|
|
1409
|
-
}
|
|
1410
|
-
var didWarnAboutDeprecatedCreateFactory = false;
|
|
1411
|
-
function createFactoryWithValidation(type) {
|
|
1412
|
-
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
1413
|
-
validatedFactory.type = type;
|
|
1414
|
-
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
1415
|
-
didWarnAboutDeprecatedCreateFactory = true;
|
|
1416
|
-
warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.");
|
|
1417
|
-
}
|
|
1418
|
-
Object.defineProperty(validatedFactory, "type", {
|
|
1419
|
-
enumerable: false,
|
|
1420
|
-
get: function() {
|
|
1421
|
-
warn("Factory.type is deprecated. Access the class directly before passing it to createFactory.");
|
|
1422
|
-
Object.defineProperty(this, "type", { value: type });
|
|
1423
|
-
return type;
|
|
1424
|
-
}
|
|
1425
|
-
});
|
|
1426
|
-
return validatedFactory;
|
|
1427
|
-
}
|
|
1428
|
-
function cloneElementWithValidation(element, props, children) {
|
|
1429
|
-
var newElement = cloneElement.apply(this, arguments);
|
|
1430
|
-
for (var i = 2; i < arguments.length; i++) validateChildKeys(arguments[i], newElement.type);
|
|
1431
|
-
validatePropTypes(newElement);
|
|
1432
|
-
return newElement;
|
|
1433
|
-
}
|
|
1434
|
-
function startTransition(scope, options) {
|
|
1435
|
-
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
1436
|
-
ReactCurrentBatchConfig.transition = {};
|
|
1437
|
-
var currentTransition = ReactCurrentBatchConfig.transition;
|
|
1438
|
-
ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set();
|
|
1439
|
-
try {
|
|
1440
|
-
scope();
|
|
1441
|
-
} finally {
|
|
1442
|
-
ReactCurrentBatchConfig.transition = prevTransition;
|
|
1443
|
-
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
1444
|
-
if (currentTransition._updatedFibers.size > 10) 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.");
|
|
1445
|
-
currentTransition._updatedFibers.clear();
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
var didWarnAboutMessageChannel = false;
|
|
1450
|
-
var enqueueTaskImpl = null;
|
|
1451
|
-
function enqueueTask(task) {
|
|
1452
|
-
if (enqueueTaskImpl === null) try {
|
|
1453
|
-
var requireString = ("require" + Math.random()).slice(0, 7);
|
|
1454
|
-
enqueueTaskImpl = (module && module[requireString]).call(module, "timers").setImmediate;
|
|
1455
|
-
} catch (_err) {
|
|
1456
|
-
enqueueTaskImpl = function(callback) {
|
|
1457
|
-
if (didWarnAboutMessageChannel === false) {
|
|
1458
|
-
didWarnAboutMessageChannel = true;
|
|
1459
|
-
if (typeof MessageChannel === "undefined") 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.");
|
|
1460
|
-
}
|
|
1461
|
-
var channel = new MessageChannel();
|
|
1462
|
-
channel.port1.onmessage = callback;
|
|
1463
|
-
channel.port2.postMessage(void 0);
|
|
1464
|
-
};
|
|
1465
|
-
}
|
|
1466
|
-
return enqueueTaskImpl(task);
|
|
1467
|
-
}
|
|
1468
|
-
var actScopeDepth = 0;
|
|
1469
|
-
var didWarnNoAwaitAct = false;
|
|
1470
|
-
function act(callback) {
|
|
1471
|
-
var prevActScopeDepth = actScopeDepth;
|
|
1472
|
-
actScopeDepth++;
|
|
1473
|
-
if (ReactCurrentActQueue.current === null) ReactCurrentActQueue.current = [];
|
|
1474
|
-
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
|
1475
|
-
var result;
|
|
1476
|
-
try {
|
|
1477
|
-
ReactCurrentActQueue.isBatchingLegacy = true;
|
|
1478
|
-
result = callback();
|
|
1479
|
-
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
1480
|
-
var queue = ReactCurrentActQueue.current;
|
|
1481
|
-
if (queue !== null) {
|
|
1482
|
-
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
|
1483
|
-
flushActQueue(queue);
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
} catch (error$1) {
|
|
1487
|
-
popActScope(prevActScopeDepth);
|
|
1488
|
-
throw error$1;
|
|
1489
|
-
} finally {
|
|
1490
|
-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
|
1491
|
-
}
|
|
1492
|
-
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
|
1493
|
-
var thenableResult = result;
|
|
1494
|
-
var wasAwaited = false;
|
|
1495
|
-
var thenable = { then: function(resolve, reject) {
|
|
1496
|
-
wasAwaited = true;
|
|
1497
|
-
thenableResult.then(function(returnValue$1) {
|
|
1498
|
-
popActScope(prevActScopeDepth);
|
|
1499
|
-
if (actScopeDepth === 0) recursivelyFlushAsyncActWork(returnValue$1, resolve, reject);
|
|
1500
|
-
else resolve(returnValue$1);
|
|
1501
|
-
}, function(error$1) {
|
|
1502
|
-
popActScope(prevActScopeDepth);
|
|
1503
|
-
reject(error$1);
|
|
1504
|
-
});
|
|
1505
|
-
} };
|
|
1506
|
-
if (!didWarnNoAwaitAct && typeof Promise !== "undefined") Promise.resolve().then(function() {}).then(function() {
|
|
1507
|
-
if (!wasAwaited) {
|
|
1508
|
-
didWarnNoAwaitAct = true;
|
|
1509
|
-
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 () => ...);");
|
|
1510
|
-
}
|
|
1511
|
-
});
|
|
1512
|
-
return thenable;
|
|
1513
|
-
} else {
|
|
1514
|
-
var returnValue = result;
|
|
1515
|
-
popActScope(prevActScopeDepth);
|
|
1516
|
-
if (actScopeDepth === 0) {
|
|
1517
|
-
var _queue = ReactCurrentActQueue.current;
|
|
1518
|
-
if (_queue !== null) {
|
|
1519
|
-
flushActQueue(_queue);
|
|
1520
|
-
ReactCurrentActQueue.current = null;
|
|
1521
|
-
}
|
|
1522
|
-
return { then: function(resolve, reject) {
|
|
1523
|
-
if (ReactCurrentActQueue.current === null) {
|
|
1524
|
-
ReactCurrentActQueue.current = [];
|
|
1525
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
1526
|
-
} else resolve(returnValue);
|
|
1527
|
-
} };
|
|
1528
|
-
} else return { then: function(resolve, reject) {
|
|
1529
|
-
resolve(returnValue);
|
|
1530
|
-
} };
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
function popActScope(prevActScopeDepth) {
|
|
1534
|
-
if (prevActScopeDepth !== actScopeDepth - 1) error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
|
|
1535
|
-
actScopeDepth = prevActScopeDepth;
|
|
1536
|
-
}
|
|
1537
|
-
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
1538
|
-
var queue = ReactCurrentActQueue.current;
|
|
1539
|
-
if (queue !== null) try {
|
|
1540
|
-
flushActQueue(queue);
|
|
1541
|
-
enqueueTask(function() {
|
|
1542
|
-
if (queue.length === 0) {
|
|
1543
|
-
ReactCurrentActQueue.current = null;
|
|
1544
|
-
resolve(returnValue);
|
|
1545
|
-
} else recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
1546
|
-
});
|
|
1547
|
-
} catch (error$1) {
|
|
1548
|
-
reject(error$1);
|
|
1549
|
-
}
|
|
1550
|
-
else resolve(returnValue);
|
|
1551
|
-
}
|
|
1552
|
-
var isFlushing = false;
|
|
1553
|
-
function flushActQueue(queue) {
|
|
1554
|
-
if (!isFlushing) {
|
|
1555
|
-
isFlushing = true;
|
|
1556
|
-
var i = 0;
|
|
1557
|
-
try {
|
|
1558
|
-
for (; i < queue.length; i++) {
|
|
1559
|
-
var callback = queue[i];
|
|
1560
|
-
do
|
|
1561
|
-
callback = callback(true);
|
|
1562
|
-
while (callback !== null);
|
|
1563
|
-
}
|
|
1564
|
-
queue.length = 0;
|
|
1565
|
-
} catch (error$1) {
|
|
1566
|
-
queue = queue.slice(i + 1);
|
|
1567
|
-
throw error$1;
|
|
1568
|
-
} finally {
|
|
1569
|
-
isFlushing = false;
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
var createElement$1 = createElementWithValidation;
|
|
1574
|
-
var cloneElement$1 = cloneElementWithValidation;
|
|
1575
|
-
var createFactory = createFactoryWithValidation;
|
|
1576
|
-
var Children = {
|
|
1577
|
-
map: mapChildren,
|
|
1578
|
-
forEach: forEachChildren,
|
|
1579
|
-
count: countChildren,
|
|
1580
|
-
toArray,
|
|
1581
|
-
only: onlyChild
|
|
1582
|
-
};
|
|
1583
|
-
exports.Children = Children;
|
|
1584
|
-
exports.Component = Component;
|
|
1585
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
1586
|
-
exports.Profiler = REACT_PROFILER_TYPE;
|
|
1587
|
-
exports.PureComponent = PureComponent;
|
|
1588
|
-
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1589
|
-
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
1590
|
-
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
1591
|
-
exports.act = act;
|
|
1592
|
-
exports.cloneElement = cloneElement$1;
|
|
1593
|
-
exports.createContext = createContext;
|
|
1594
|
-
exports.createElement = createElement$1;
|
|
1595
|
-
exports.createFactory = createFactory;
|
|
1596
|
-
exports.createRef = createRef;
|
|
1597
|
-
exports.forwardRef = forwardRef;
|
|
1598
|
-
exports.isValidElement = isValidElement;
|
|
1599
|
-
exports.lazy = lazy;
|
|
1600
|
-
exports.memo = memo;
|
|
1601
|
-
exports.startTransition = startTransition;
|
|
1602
|
-
exports.unstable_act = act;
|
|
1603
|
-
exports.useCallback = useCallback;
|
|
1604
|
-
exports.useContext = useContext;
|
|
1605
|
-
exports.useDebugValue = useDebugValue;
|
|
1606
|
-
exports.useDeferredValue = useDeferredValue;
|
|
1607
|
-
exports.useEffect = useEffect;
|
|
1608
|
-
exports.useId = useId;
|
|
1609
|
-
exports.useImperativeHandle = useImperativeHandle;
|
|
1610
|
-
exports.useInsertionEffect = useInsertionEffect;
|
|
1611
|
-
exports.useLayoutEffect = useLayoutEffect;
|
|
1612
|
-
exports.useMemo = useMemo;
|
|
1613
|
-
exports.useReducer = useReducer;
|
|
1614
|
-
exports.useRef = useRef;
|
|
1615
|
-
exports.useState = useState;
|
|
1616
|
-
exports.useSyncExternalStore = useSyncExternalStore;
|
|
1617
|
-
exports.useTransition = useTransition;
|
|
1618
|
-
exports.version = ReactVersion;
|
|
1619
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(/* @__PURE__ */ new Error());
|
|
1620
|
-
})();
|
|
1621
|
-
}) });
|
|
1622
|
-
|
|
1623
|
-
//#endregion
|
|
1624
|
-
//#region ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
|
|
1625
|
-
var require_react = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js": ((exports, module) => {
|
|
1626
|
-
if (process.env.NODE_ENV === "production") module.exports = require_react_production_min();
|
|
1627
|
-
else module.exports = require_react_development();
|
|
1628
|
-
}) });
|
|
1629
|
-
|
|
1630
|
-
//#endregion
|
|
1631
|
-
//#region src/parser.ts
|
|
1632
|
-
const typeKeywordMapper = {
|
|
1633
|
-
any: () => factory.keywordTypeNodes.any,
|
|
1634
|
-
unknown: () => factory.keywordTypeNodes.unknown,
|
|
1635
|
-
void: () => factory.keywordTypeNodes.void,
|
|
1636
|
-
number: () => factory.keywordTypeNodes.number,
|
|
1637
|
-
integer: () => factory.keywordTypeNodes.number,
|
|
1638
|
-
object: (nodes) => {
|
|
1639
|
-
if (!nodes || !nodes.length) return factory.keywordTypeNodes.object;
|
|
1640
|
-
return factory.createTypeLiteralNode(nodes);
|
|
1641
|
-
},
|
|
1642
|
-
string: () => factory.keywordTypeNodes.string,
|
|
1643
|
-
boolean: () => factory.keywordTypeNodes.boolean,
|
|
1644
|
-
undefined: () => factory.keywordTypeNodes.undefined,
|
|
1645
|
-
nullable: void 0,
|
|
1646
|
-
null: () => factory.keywordTypeNodes.null,
|
|
1647
|
-
nullish: void 0,
|
|
1648
|
-
array: (nodes) => {
|
|
1649
|
-
if (!nodes) return;
|
|
1650
|
-
return factory.createArrayDeclaration({ nodes });
|
|
1651
|
-
},
|
|
1652
|
-
tuple: (nodes, rest, min, max) => {
|
|
1653
|
-
if (!nodes) return;
|
|
1654
|
-
if (max) {
|
|
1655
|
-
nodes = nodes.slice(0, max);
|
|
1656
|
-
if (nodes.length < max && rest) nodes = [...nodes, ...Array(max - nodes.length).fill(rest)];
|
|
1657
|
-
}
|
|
1658
|
-
if (min) nodes = nodes.map((node, index) => index >= min ? factory.createOptionalTypeNode(node) : node);
|
|
1659
|
-
if (typeof max === "undefined" && rest) nodes.push(factory.createRestTypeNode(factory.createArrayTypeNode(rest)));
|
|
1660
|
-
return factory.createTupleTypeNode(nodes);
|
|
1661
|
-
},
|
|
1662
|
-
enum: (name) => {
|
|
1663
|
-
if (!name) return;
|
|
1664
|
-
return factory.createTypeReferenceNode(name, void 0);
|
|
1665
|
-
},
|
|
1666
|
-
union: (nodes) => {
|
|
1667
|
-
if (!nodes) return;
|
|
1668
|
-
return factory.createUnionDeclaration({
|
|
1669
|
-
withParentheses: true,
|
|
1670
|
-
nodes
|
|
1671
|
-
});
|
|
1672
|
-
},
|
|
1673
|
-
const: (name, format) => {
|
|
1674
|
-
if (name === null || name === void 0 || name === "") return;
|
|
1675
|
-
if (format === "boolean") {
|
|
1676
|
-
if (name === true) return factory.createLiteralTypeNode(factory.createTrue());
|
|
1677
|
-
return factory.createLiteralTypeNode(factory.createFalse());
|
|
1678
|
-
}
|
|
1679
|
-
if (format === "number" && typeof name === "number") return factory.createLiteralTypeNode(factory.createNumericLiteral(name));
|
|
1680
|
-
return factory.createLiteralTypeNode(factory.createStringLiteral(name.toString()));
|
|
1681
|
-
},
|
|
1682
|
-
datetime: () => factory.keywordTypeNodes.string,
|
|
1683
|
-
date: (type = "string") => type === "string" ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier("Date")),
|
|
1684
|
-
time: (type = "string") => type === "string" ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier("Date")),
|
|
1685
|
-
uuid: () => factory.keywordTypeNodes.string,
|
|
1686
|
-
url: () => factory.keywordTypeNodes.string,
|
|
1687
|
-
default: void 0,
|
|
1688
|
-
and: (nodes) => {
|
|
1689
|
-
if (!nodes) return;
|
|
1690
|
-
return factory.createIntersectionDeclaration({
|
|
1691
|
-
withParentheses: true,
|
|
1692
|
-
nodes
|
|
1693
|
-
});
|
|
1694
|
-
},
|
|
1695
|
-
describe: void 0,
|
|
1696
|
-
min: void 0,
|
|
1697
|
-
max: void 0,
|
|
1698
|
-
optional: void 0,
|
|
1699
|
-
matches: () => factory.keywordTypeNodes.string,
|
|
1700
|
-
email: () => factory.keywordTypeNodes.string,
|
|
1701
|
-
firstName: void 0,
|
|
1702
|
-
lastName: void 0,
|
|
1703
|
-
password: void 0,
|
|
1704
|
-
phone: void 0,
|
|
1705
|
-
readOnly: void 0,
|
|
1706
|
-
writeOnly: void 0,
|
|
1707
|
-
ref: (propertyName) => {
|
|
1708
|
-
if (!propertyName) return;
|
|
1709
|
-
return factory.createTypeReferenceNode(propertyName, void 0);
|
|
1710
|
-
},
|
|
1711
|
-
blob: () => factory.createTypeReferenceNode("Blob", []),
|
|
1712
|
-
deprecated: void 0,
|
|
1713
|
-
example: void 0,
|
|
1714
|
-
schema: void 0,
|
|
1715
|
-
catchall: void 0,
|
|
1716
|
-
name: void 0,
|
|
1717
|
-
interface: void 0
|
|
1718
|
-
};
|
|
1719
|
-
/**
|
|
1720
|
-
* Recursively parses a schema tree node into a corresponding TypeScript AST node.
|
|
1721
|
-
*
|
|
1722
|
-
* Maps OpenAPI schema keywords to TypeScript AST nodes using the `typeKeywordMapper`, handling complex types such as unions, intersections, arrays, tuples (with optional/rest elements and length constraints), enums, constants, references, and objects with property modifiers and documentation annotations.
|
|
1723
|
-
*
|
|
1724
|
-
* @param current - The schema node to parse.
|
|
1725
|
-
* @param siblings - Sibling schema nodes, used for context in certain mappings.
|
|
1726
|
-
* @param name - The name of the schema or property being parsed.
|
|
1727
|
-
* @param options - Parsing options controlling output style, property handling, and custom mappers.
|
|
1728
|
-
* @returns The generated TypeScript AST node, or `undefined` if the schema keyword is not mapped.
|
|
1729
|
-
*/
|
|
1730
|
-
function parse({ current, siblings, name }, options) {
|
|
1731
|
-
const value = typeKeywordMapper[current.keyword];
|
|
1732
|
-
if (!value) return;
|
|
1733
|
-
if (isKeyword(current, schemaKeywords.union)) return typeKeywordMapper.union(current.args.map((schema) => parse({
|
|
1734
|
-
parent: current,
|
|
1735
|
-
name,
|
|
1736
|
-
current: schema,
|
|
1737
|
-
siblings
|
|
1738
|
-
}, options)).filter(Boolean));
|
|
1739
|
-
if (isKeyword(current, schemaKeywords.and)) return typeKeywordMapper.and(current.args.map((schema) => parse({
|
|
1740
|
-
parent: current,
|
|
1741
|
-
name,
|
|
1742
|
-
current: schema,
|
|
1743
|
-
siblings
|
|
1744
|
-
}, options)).filter(Boolean));
|
|
1745
|
-
if (isKeyword(current, schemaKeywords.array)) return typeKeywordMapper.array(current.args.items.map((schema) => parse({
|
|
1746
|
-
parent: current,
|
|
1747
|
-
name,
|
|
1748
|
-
current: schema,
|
|
1749
|
-
siblings
|
|
1750
|
-
}, options)).filter(Boolean));
|
|
1751
|
-
if (isKeyword(current, schemaKeywords.enum)) return typeKeywordMapper.enum(options.enumType === "asConst" ? `${current.args.typeName}Key` : current.args.typeName);
|
|
1752
|
-
if (isKeyword(current, schemaKeywords.ref)) return typeKeywordMapper.ref(current.args.name);
|
|
1753
|
-
if (isKeyword(current, schemaKeywords.blob)) return value();
|
|
1754
|
-
if (isKeyword(current, schemaKeywords.tuple)) return typeKeywordMapper.tuple(current.args.items.map((schema) => parse({
|
|
1755
|
-
parent: current,
|
|
1756
|
-
name,
|
|
1757
|
-
current: schema,
|
|
1758
|
-
siblings
|
|
1759
|
-
}, options)).filter(Boolean), current.args.rest && (parse({
|
|
1760
|
-
parent: current,
|
|
1761
|
-
name,
|
|
1762
|
-
current: current.args.rest,
|
|
1763
|
-
siblings
|
|
1764
|
-
}, options) ?? void 0), current.args.min, current.args.max);
|
|
1765
|
-
if (isKeyword(current, schemaKeywords.const)) return typeKeywordMapper.const(current.args.name, current.args.format);
|
|
1766
|
-
if (isKeyword(current, schemaKeywords.object)) {
|
|
1767
|
-
const properties = Object.entries(current.args?.properties || {}).filter((item) => {
|
|
1768
|
-
const schemas = item[1];
|
|
1769
|
-
return schemas && typeof schemas.map === "function";
|
|
1770
|
-
}).map(([name$1, schemas]) => {
|
|
1771
|
-
const mappedName = schemas.find((schema) => schema.keyword === schemaKeywords.name)?.args || name$1;
|
|
1772
|
-
if (options.mapper?.[mappedName]) return options.mapper?.[mappedName];
|
|
1773
|
-
const isNullish = schemas.some((schema) => schema.keyword === schemaKeywords.nullish);
|
|
1774
|
-
const isNullable = schemas.some((schema) => schema.keyword === schemaKeywords.nullable);
|
|
1775
|
-
const isOptional = schemas.some((schema) => schema.keyword === schemaKeywords.optional);
|
|
1776
|
-
const isReadonly = schemas.some((schema) => schema.keyword === schemaKeywords.readOnly);
|
|
1777
|
-
const describeSchema = schemas.find((schema) => schema.keyword === schemaKeywords.describe);
|
|
1778
|
-
const deprecatedSchema = schemas.find((schema) => schema.keyword === schemaKeywords.deprecated);
|
|
1779
|
-
const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default);
|
|
1780
|
-
const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example);
|
|
1781
|
-
const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema);
|
|
1782
|
-
const minSchema = schemas.find((schema) => schema.keyword === schemaKeywords.min);
|
|
1783
|
-
const maxSchema = schemas.find((schema) => schema.keyword === schemaKeywords.max);
|
|
1784
|
-
const matchesSchema = schemas.find((schema) => schema.keyword === schemaKeywords.matches);
|
|
1785
|
-
let type = schemas.map((schema) => parse({
|
|
1786
|
-
parent: current,
|
|
1787
|
-
name: name$1,
|
|
1788
|
-
current: schema,
|
|
1789
|
-
siblings: schemas
|
|
1790
|
-
}, options)).filter(Boolean)[0];
|
|
1791
|
-
if (isNullable) type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.null] });
|
|
1792
|
-
if (isNullish && ["undefined", "questionTokenAndUndefined"].includes(options.optionalType)) type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] });
|
|
1793
|
-
if (isOptional && ["undefined", "questionTokenAndUndefined"].includes(options.optionalType)) type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] });
|
|
1794
|
-
const propertyNode = factory.createPropertySignature({
|
|
1795
|
-
questionToken: isOptional || isNullish ? ["questionToken", "questionTokenAndUndefined"].includes(options.optionalType) : false,
|
|
1796
|
-
name: mappedName,
|
|
1797
|
-
type,
|
|
1798
|
-
readOnly: isReadonly
|
|
1799
|
-
});
|
|
1800
|
-
return factory.appendJSDocToNode({
|
|
1801
|
-
node: propertyNode,
|
|
1802
|
-
comments: [
|
|
1803
|
-
describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : void 0,
|
|
1804
|
-
deprecatedSchema ? "@deprecated" : void 0,
|
|
1805
|
-
minSchema ? `@minLength ${minSchema.args}` : void 0,
|
|
1806
|
-
maxSchema ? `@maxLength ${maxSchema.args}` : void 0,
|
|
1807
|
-
matchesSchema ? `@pattern ${matchesSchema.args}` : void 0,
|
|
1808
|
-
defaultSchema ? `@default ${defaultSchema.args}` : void 0,
|
|
1809
|
-
exampleSchema ? `@example ${exampleSchema.args}` : void 0,
|
|
1810
|
-
schemaSchema?.args?.type || schemaSchema?.args?.format ? [`@type ${schemaSchema?.args?.type || "unknown"}${!isOptional ? "" : " | undefined"}`, schemaSchema?.args?.format].filter(Boolean).join(", ") : void 0
|
|
1811
|
-
].filter(Boolean)
|
|
1812
|
-
});
|
|
1813
|
-
});
|
|
1814
|
-
let additionalProperties;
|
|
1815
|
-
if (current.args?.additionalProperties?.length) {
|
|
1816
|
-
additionalProperties = current.args.additionalProperties.map((schema) => parse({
|
|
1817
|
-
parent: current,
|
|
1818
|
-
name,
|
|
1819
|
-
current: schema,
|
|
1820
|
-
siblings
|
|
1821
|
-
}, options)).filter(Boolean).at(0);
|
|
1822
|
-
if (current.args?.additionalProperties.some((schema) => isKeyword(schema, schemaKeywords.nullable))) additionalProperties = factory.createUnionDeclaration({ nodes: [additionalProperties, factory.keywordTypeNodes.null] });
|
|
1823
|
-
additionalProperties = factory.createIndexSignature(additionalProperties);
|
|
1824
|
-
}
|
|
1825
|
-
return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean));
|
|
1826
|
-
}
|
|
1827
|
-
if (isKeyword(current, schemaKeywords.datetime)) return typeKeywordMapper.datetime();
|
|
1828
|
-
if (isKeyword(current, schemaKeywords.date)) return typeKeywordMapper.date(current.args.type);
|
|
1829
|
-
if (isKeyword(current, schemaKeywords.time)) return typeKeywordMapper.time(current.args.type);
|
|
1830
|
-
if (current.keyword in typeKeywordMapper) return value();
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
//#endregion
|
|
1834
|
-
//#region src/components/Type.tsx
|
|
1835
|
-
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
1836
|
-
function Type$1({ name, typedName, tree, keysToOmit, schema, optionalType, syntaxType, enumType, mapper, description }) {
|
|
1837
|
-
const typeNodes = [];
|
|
1838
|
-
if (!tree.length) return "";
|
|
1839
|
-
const schemaFromTree = tree.find((item) => item.keyword === schemaKeywords.schema);
|
|
1840
|
-
const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords.enum);
|
|
1841
|
-
let type = tree.map((current, _index, siblings) => parse({
|
|
1842
|
-
parent: void 0,
|
|
1843
|
-
current,
|
|
1844
|
-
siblings
|
|
1845
|
-
}, {
|
|
1846
|
-
name,
|
|
1847
|
-
typedName,
|
|
1848
|
-
description,
|
|
1849
|
-
keysToOmit,
|
|
1850
|
-
optionalType,
|
|
1851
|
-
enumType,
|
|
1852
|
-
mapper,
|
|
1853
|
-
syntaxType
|
|
1854
|
-
})).filter(Boolean).at(0) || typeKeywordMapper.undefined();
|
|
1855
|
-
if (enumType === "asConst" && enumSchemas.length > 0) {
|
|
1856
|
-
const isDirectEnum = schema.type === "array" && schema.items !== void 0;
|
|
1857
|
-
const isEnumOnly = "enum" in schema && schema.enum;
|
|
1858
|
-
if (isDirectEnum || isEnumOnly) {
|
|
1859
|
-
const typeNameWithKey = `${enumSchemas[0].args.typeName}Key`;
|
|
1860
|
-
type = factory.createTypeReferenceNode(typeNameWithKey);
|
|
1861
|
-
if (schema.type === "array") type = factory.createArrayTypeNode(type);
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
if (schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.schema)) {
|
|
1865
|
-
const isNullish = tree.some((item) => item.keyword === schemaKeywords.nullish);
|
|
1866
|
-
const isNullable = tree.some((item) => item.keyword === schemaKeywords.nullable);
|
|
1867
|
-
const isOptional = tree.some((item) => item.keyword === schemaKeywords.optional);
|
|
1868
|
-
if (isNullable) type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.null] });
|
|
1869
|
-
if (isNullish && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] });
|
|
1870
|
-
if (isOptional && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] });
|
|
1871
|
-
}
|
|
1872
|
-
const useTypeGeneration = syntaxType === "type" || [factory.syntaxKind.union].includes(type.kind) || !!keysToOmit?.length;
|
|
1873
|
-
typeNodes.push(createTypeDeclaration({
|
|
1874
|
-
name,
|
|
1875
|
-
isExportable: true,
|
|
1876
|
-
type: keysToOmit?.length ? factory.createOmitDeclaration({
|
|
1877
|
-
keys: keysToOmit,
|
|
1878
|
-
type,
|
|
1879
|
-
nonNullable: true
|
|
1880
|
-
}) : type,
|
|
1881
|
-
syntax: useTypeGeneration ? "type" : "interface",
|
|
1882
|
-
comments: [
|
|
1883
|
-
description ? `@description ${transformers.jsStringEscape(description)}` : void 0,
|
|
1884
|
-
schema.deprecated ? "@deprecated" : void 0,
|
|
1885
|
-
schema.minLength ? `@minLength ${schema.minLength}` : void 0,
|
|
1886
|
-
schema.maxLength ? `@maxLength ${schema.maxLength}` : void 0,
|
|
1887
|
-
schema.pattern ? `@pattern ${schema.pattern}` : void 0,
|
|
1888
|
-
schema.default ? `@default ${schema.default}` : void 0,
|
|
1889
|
-
schema.example ? `@example ${schema.example}` : void 0
|
|
1890
|
-
]
|
|
1891
|
-
}));
|
|
1892
|
-
const enums = [...new Set(enumSchemas)].map((enumSchema) => {
|
|
1893
|
-
const name$1 = enumType === "asPascalConst" ? transformers.pascalCase(enumSchema.args.name) : transformers.camelCase(enumSchema.args.name);
|
|
1894
|
-
const typeName = enumType === "asConst" ? `${enumSchema.args.typeName}Key` : enumSchema.args.typeName;
|
|
1895
|
-
const [nameNode, typeNode] = factory.createEnumDeclaration({
|
|
1896
|
-
name: name$1,
|
|
1897
|
-
typeName,
|
|
1898
|
-
enums: enumSchema.args.items.map((item) => item.value === void 0 ? void 0 : [transformers.trimQuotes(item.name?.toString()), item.value]).filter(Boolean),
|
|
1899
|
-
type: enumType
|
|
1900
|
-
});
|
|
1901
|
-
return {
|
|
1902
|
-
nameNode,
|
|
1903
|
-
typeNode,
|
|
1904
|
-
name: name$1,
|
|
1905
|
-
typeName
|
|
1906
|
-
};
|
|
1907
|
-
});
|
|
1908
|
-
return /* @__PURE__ */ jsxs(import_react.Fragment, { children: [enums.map(({ name: name$1, nameNode, typeName, typeNode }) => /* @__PURE__ */ jsxs(import_react.Fragment, { children: [nameNode && /* @__PURE__ */ jsx(File.Source, {
|
|
1909
|
-
name: name$1,
|
|
1910
|
-
isExportable: true,
|
|
1911
|
-
isIndexable: true,
|
|
1912
|
-
children: print([nameNode])
|
|
1913
|
-
}), /* @__PURE__ */ jsx(File.Source, {
|
|
1914
|
-
name: typeName,
|
|
1915
|
-
isIndexable: true,
|
|
1916
|
-
isExportable: [
|
|
1917
|
-
"enum",
|
|
1918
|
-
"asConst",
|
|
1919
|
-
"constEnum",
|
|
1920
|
-
"literal",
|
|
1921
|
-
void 0
|
|
1922
|
-
].includes(enumType),
|
|
1923
|
-
isTypeOnly: [
|
|
1924
|
-
"asConst",
|
|
1925
|
-
"literal",
|
|
1926
|
-
void 0
|
|
1927
|
-
].includes(enumType),
|
|
1928
|
-
children: print([typeNode])
|
|
1929
|
-
})] })), enums.every((item) => item.typeName !== name) && /* @__PURE__ */ jsx(File.Source, {
|
|
1930
|
-
name: typedName,
|
|
1931
|
-
isTypeOnly: true,
|
|
1932
|
-
isExportable: true,
|
|
1933
|
-
isIndexable: true,
|
|
1934
|
-
children: print(typeNodes)
|
|
1935
|
-
})] });
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
//#endregion
|
|
1939
|
-
export { OasType, Type$1 as Type };
|
|
1940
|
-
//# sourceMappingURL=components-CSEFpzdz.js.map
|