@ereo/plugin-images 0.1.6
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/README.md +197 -0
- package/dist/build/manifest.d.ts +94 -0
- package/dist/build/manifest.d.ts.map +1 -0
- package/dist/build/optimizer.d.ts +99 -0
- package/dist/build/optimizer.d.ts.map +1 -0
- package/dist/components/Image.d.ts +28 -0
- package/dist/components/Image.d.ts.map +1 -0
- package/dist/components/Picture.d.ts +36 -0
- package/dist/components/Picture.d.ts.map +1 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +3172 -0
- package/dist/components/types.d.ts +380 -0
- package/dist/components/types.d.ts.map +1 -0
- package/dist/config/defaults.d.ts +77 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/schema.d.ts +23 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4870 -0
- package/dist/plugin.d.ts +28 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/processing/blur.d.ts +78 -0
- package/dist/processing/blur.d.ts.map +1 -0
- package/dist/processing/color.d.ts +60 -0
- package/dist/processing/color.d.ts.map +1 -0
- package/dist/processing/processor.d.ts +101 -0
- package/dist/processing/processor.d.ts.map +1 -0
- package/dist/processing/sharp-processor.d.ts +74 -0
- package/dist/processing/sharp-processor.d.ts.map +1 -0
- package/dist/runtime/cache.d.ts +276 -0
- package/dist/runtime/cache.d.ts.map +1 -0
- package/dist/runtime/middleware.d.ts +29 -0
- package/dist/runtime/middleware.d.ts.map +1 -0
- package/package.json +51 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4870 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
|
|
20
|
+
// ../../node_modules/.bun/react@18.3.1/node_modules/react/cjs/react.development.js
|
|
21
|
+
var require_react_development = __commonJS((exports, module) => {
|
|
22
|
+
if (true) {
|
|
23
|
+
(function() {
|
|
24
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
25
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);
|
|
26
|
+
}
|
|
27
|
+
var ReactVersion = "18.3.1";
|
|
28
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
29
|
+
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
30
|
+
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
31
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
32
|
+
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
33
|
+
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
|
34
|
+
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
35
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
36
|
+
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
37
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
|
38
|
+
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
39
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
40
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
41
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
42
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
43
|
+
function getIteratorFn(maybeIterable) {
|
|
44
|
+
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
48
|
+
if (typeof maybeIterator === "function") {
|
|
49
|
+
return maybeIterator;
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
var ReactCurrentDispatcher = {
|
|
54
|
+
current: null
|
|
55
|
+
};
|
|
56
|
+
var ReactCurrentBatchConfig = {
|
|
57
|
+
transition: null
|
|
58
|
+
};
|
|
59
|
+
var ReactCurrentActQueue = {
|
|
60
|
+
current: null,
|
|
61
|
+
isBatchingLegacy: false,
|
|
62
|
+
didScheduleLegacyUpdate: false
|
|
63
|
+
};
|
|
64
|
+
var ReactCurrentOwner = {
|
|
65
|
+
current: null
|
|
66
|
+
};
|
|
67
|
+
var ReactDebugCurrentFrame = {};
|
|
68
|
+
var currentExtraStackFrame = null;
|
|
69
|
+
function setExtraStackFrame(stack) {
|
|
70
|
+
{
|
|
71
|
+
currentExtraStackFrame = stack;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
{
|
|
75
|
+
ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
|
|
76
|
+
{
|
|
77
|
+
currentExtraStackFrame = stack;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
81
|
+
ReactDebugCurrentFrame.getStackAddendum = function() {
|
|
82
|
+
var stack = "";
|
|
83
|
+
if (currentExtraStackFrame) {
|
|
84
|
+
stack += currentExtraStackFrame;
|
|
85
|
+
}
|
|
86
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
87
|
+
if (impl) {
|
|
88
|
+
stack += impl() || "";
|
|
89
|
+
}
|
|
90
|
+
return stack;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
var enableScopeAPI = false;
|
|
94
|
+
var enableCacheElement = false;
|
|
95
|
+
var enableTransitionTracing = false;
|
|
96
|
+
var enableLegacyHidden = false;
|
|
97
|
+
var enableDebugTracing = false;
|
|
98
|
+
var ReactSharedInternals = {
|
|
99
|
+
ReactCurrentDispatcher,
|
|
100
|
+
ReactCurrentBatchConfig,
|
|
101
|
+
ReactCurrentOwner
|
|
102
|
+
};
|
|
103
|
+
{
|
|
104
|
+
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
|
105
|
+
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
|
106
|
+
}
|
|
107
|
+
function warn(format) {
|
|
108
|
+
{
|
|
109
|
+
{
|
|
110
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1;_key < _len; _key++) {
|
|
111
|
+
args[_key - 1] = arguments[_key];
|
|
112
|
+
}
|
|
113
|
+
printWarning("warn", format, args);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function error(format) {
|
|
118
|
+
{
|
|
119
|
+
{
|
|
120
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1;_key2 < _len2; _key2++) {
|
|
121
|
+
args[_key2 - 1] = arguments[_key2];
|
|
122
|
+
}
|
|
123
|
+
printWarning("error", format, args);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function printWarning(level, format, args) {
|
|
128
|
+
{
|
|
129
|
+
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
130
|
+
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
131
|
+
if (stack !== "") {
|
|
132
|
+
format += "%s";
|
|
133
|
+
args = args.concat([stack]);
|
|
134
|
+
}
|
|
135
|
+
var argsWithFormat = args.map(function(item) {
|
|
136
|
+
return String(item);
|
|
137
|
+
});
|
|
138
|
+
argsWithFormat.unshift("Warning: " + format);
|
|
139
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
|
143
|
+
function warnNoop(publicInstance, callerName) {
|
|
144
|
+
{
|
|
145
|
+
var _constructor = publicInstance.constructor;
|
|
146
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass";
|
|
147
|
+
var warningKey = componentName + "." + callerName;
|
|
148
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
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);
|
|
152
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
var ReactNoopUpdateQueue = {
|
|
156
|
+
isMounted: function(publicInstance) {
|
|
157
|
+
return false;
|
|
158
|
+
},
|
|
159
|
+
enqueueForceUpdate: function(publicInstance, callback, callerName) {
|
|
160
|
+
warnNoop(publicInstance, "forceUpdate");
|
|
161
|
+
},
|
|
162
|
+
enqueueReplaceState: function(publicInstance, completeState, callback, callerName) {
|
|
163
|
+
warnNoop(publicInstance, "replaceState");
|
|
164
|
+
},
|
|
165
|
+
enqueueSetState: function(publicInstance, partialState, callback, callerName) {
|
|
166
|
+
warnNoop(publicInstance, "setState");
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
var assign = Object.assign;
|
|
170
|
+
var emptyObject = {};
|
|
171
|
+
{
|
|
172
|
+
Object.freeze(emptyObject);
|
|
173
|
+
}
|
|
174
|
+
function Component(props, context, updater) {
|
|
175
|
+
this.props = props;
|
|
176
|
+
this.context = context;
|
|
177
|
+
this.refs = emptyObject;
|
|
178
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
179
|
+
}
|
|
180
|
+
Component.prototype.isReactComponent = {};
|
|
181
|
+
Component.prototype.setState = function(partialState, callback) {
|
|
182
|
+
if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) {
|
|
183
|
+
throw new Error("setState(...): takes an object of state variables to update or a " + "function which returns an object of state variables.");
|
|
184
|
+
}
|
|
185
|
+
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
186
|
+
};
|
|
187
|
+
Component.prototype.forceUpdate = function(callback) {
|
|
188
|
+
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
189
|
+
};
|
|
190
|
+
{
|
|
191
|
+
var deprecatedAPIs = {
|
|
192
|
+
isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in " + "componentWillUnmount to prevent memory leaks."],
|
|
193
|
+
replaceState: ["replaceState", "Refactor your code to use setState instead (see " + "https://github.com/facebook/react/issues/3236)."]
|
|
194
|
+
};
|
|
195
|
+
var defineDeprecationWarning = function(methodName, info) {
|
|
196
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
197
|
+
get: function() {
|
|
198
|
+
warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
for (var fnName in deprecatedAPIs) {
|
|
204
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
205
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function ComponentDummy() {}
|
|
210
|
+
ComponentDummy.prototype = Component.prototype;
|
|
211
|
+
function PureComponent(props, context, updater) {
|
|
212
|
+
this.props = props;
|
|
213
|
+
this.context = context;
|
|
214
|
+
this.refs = emptyObject;
|
|
215
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
216
|
+
}
|
|
217
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy;
|
|
218
|
+
pureComponentPrototype.constructor = PureComponent;
|
|
219
|
+
assign(pureComponentPrototype, Component.prototype);
|
|
220
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
221
|
+
function createRef() {
|
|
222
|
+
var refObject = {
|
|
223
|
+
current: null
|
|
224
|
+
};
|
|
225
|
+
{
|
|
226
|
+
Object.seal(refObject);
|
|
227
|
+
}
|
|
228
|
+
return refObject;
|
|
229
|
+
}
|
|
230
|
+
var isArrayImpl = Array.isArray;
|
|
231
|
+
function isArray(a) {
|
|
232
|
+
return isArrayImpl(a);
|
|
233
|
+
}
|
|
234
|
+
function typeName(value) {
|
|
235
|
+
{
|
|
236
|
+
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
|
237
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
238
|
+
return type;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function willCoercionThrow(value) {
|
|
242
|
+
{
|
|
243
|
+
try {
|
|
244
|
+
testStringCoercion(value);
|
|
245
|
+
return false;
|
|
246
|
+
} catch (e) {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function testStringCoercion(value) {
|
|
252
|
+
return "" + value;
|
|
253
|
+
}
|
|
254
|
+
function checkKeyStringCoercion(value) {
|
|
255
|
+
{
|
|
256
|
+
if (willCoercionThrow(value)) {
|
|
257
|
+
error("The provided key is an unsupported type %s." + " This value must be coerced to a string before before using it here.", typeName(value));
|
|
258
|
+
return testStringCoercion(value);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
263
|
+
var displayName = outerType.displayName;
|
|
264
|
+
if (displayName) {
|
|
265
|
+
return displayName;
|
|
266
|
+
}
|
|
267
|
+
var functionName = innerType.displayName || innerType.name || "";
|
|
268
|
+
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
269
|
+
}
|
|
270
|
+
function getContextName(type) {
|
|
271
|
+
return type.displayName || "Context";
|
|
272
|
+
}
|
|
273
|
+
function getComponentNameFromType(type) {
|
|
274
|
+
if (type == null) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
{
|
|
278
|
+
if (typeof type.tag === "number") {
|
|
279
|
+
error("Received an unexpected object in getComponentNameFromType(). " + "This is likely a bug in React. Please file an issue.");
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (typeof type === "function") {
|
|
283
|
+
return type.displayName || type.name || null;
|
|
284
|
+
}
|
|
285
|
+
if (typeof type === "string") {
|
|
286
|
+
return type;
|
|
287
|
+
}
|
|
288
|
+
switch (type) {
|
|
289
|
+
case REACT_FRAGMENT_TYPE:
|
|
290
|
+
return "Fragment";
|
|
291
|
+
case REACT_PORTAL_TYPE:
|
|
292
|
+
return "Portal";
|
|
293
|
+
case REACT_PROFILER_TYPE:
|
|
294
|
+
return "Profiler";
|
|
295
|
+
case REACT_STRICT_MODE_TYPE:
|
|
296
|
+
return "StrictMode";
|
|
297
|
+
case REACT_SUSPENSE_TYPE:
|
|
298
|
+
return "Suspense";
|
|
299
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
300
|
+
return "SuspenseList";
|
|
301
|
+
}
|
|
302
|
+
if (typeof type === "object") {
|
|
303
|
+
switch (type.$$typeof) {
|
|
304
|
+
case REACT_CONTEXT_TYPE:
|
|
305
|
+
var context = type;
|
|
306
|
+
return getContextName(context) + ".Consumer";
|
|
307
|
+
case REACT_PROVIDER_TYPE:
|
|
308
|
+
var provider = type;
|
|
309
|
+
return getContextName(provider._context) + ".Provider";
|
|
310
|
+
case REACT_FORWARD_REF_TYPE:
|
|
311
|
+
return getWrappedName(type, type.render, "ForwardRef");
|
|
312
|
+
case REACT_MEMO_TYPE:
|
|
313
|
+
var outerName = type.displayName || null;
|
|
314
|
+
if (outerName !== null) {
|
|
315
|
+
return outerName;
|
|
316
|
+
}
|
|
317
|
+
return getComponentNameFromType(type.type) || "Memo";
|
|
318
|
+
case REACT_LAZY_TYPE: {
|
|
319
|
+
var lazyComponent = type;
|
|
320
|
+
var payload = lazyComponent._payload;
|
|
321
|
+
var init = lazyComponent._init;
|
|
322
|
+
try {
|
|
323
|
+
return getComponentNameFromType(init(payload));
|
|
324
|
+
} catch (x) {
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
333
|
+
var RESERVED_PROPS = {
|
|
334
|
+
key: true,
|
|
335
|
+
ref: true,
|
|
336
|
+
__self: true,
|
|
337
|
+
__source: true
|
|
338
|
+
};
|
|
339
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
340
|
+
{
|
|
341
|
+
didWarnAboutStringRefs = {};
|
|
342
|
+
}
|
|
343
|
+
function hasValidRef(config) {
|
|
344
|
+
{
|
|
345
|
+
if (hasOwnProperty.call(config, "ref")) {
|
|
346
|
+
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
|
347
|
+
if (getter && getter.isReactWarning) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return config.ref !== undefined;
|
|
353
|
+
}
|
|
354
|
+
function hasValidKey(config) {
|
|
355
|
+
{
|
|
356
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
357
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
358
|
+
if (getter && getter.isReactWarning) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return config.key !== undefined;
|
|
364
|
+
}
|
|
365
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
366
|
+
var warnAboutAccessingKey = function() {
|
|
367
|
+
{
|
|
368
|
+
if (!specialPropKeyWarningShown) {
|
|
369
|
+
specialPropKeyWarningShown = true;
|
|
370
|
+
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);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
375
|
+
Object.defineProperty(props, "key", {
|
|
376
|
+
get: warnAboutAccessingKey,
|
|
377
|
+
configurable: true
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
381
|
+
var warnAboutAccessingRef = function() {
|
|
382
|
+
{
|
|
383
|
+
if (!specialPropRefWarningShown) {
|
|
384
|
+
specialPropRefWarningShown = true;
|
|
385
|
+
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);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
390
|
+
Object.defineProperty(props, "ref", {
|
|
391
|
+
get: warnAboutAccessingRef,
|
|
392
|
+
configurable: true
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
396
|
+
{
|
|
397
|
+
if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
398
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
399
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
400
|
+
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);
|
|
401
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
|
407
|
+
var element = {
|
|
408
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
409
|
+
type,
|
|
410
|
+
key,
|
|
411
|
+
ref,
|
|
412
|
+
props,
|
|
413
|
+
_owner: owner
|
|
414
|
+
};
|
|
415
|
+
{
|
|
416
|
+
element._store = {};
|
|
417
|
+
Object.defineProperty(element._store, "validated", {
|
|
418
|
+
configurable: false,
|
|
419
|
+
enumerable: false,
|
|
420
|
+
writable: true,
|
|
421
|
+
value: false
|
|
422
|
+
});
|
|
423
|
+
Object.defineProperty(element, "_self", {
|
|
424
|
+
configurable: false,
|
|
425
|
+
enumerable: false,
|
|
426
|
+
writable: false,
|
|
427
|
+
value: self
|
|
428
|
+
});
|
|
429
|
+
Object.defineProperty(element, "_source", {
|
|
430
|
+
configurable: false,
|
|
431
|
+
enumerable: false,
|
|
432
|
+
writable: false,
|
|
433
|
+
value: source
|
|
434
|
+
});
|
|
435
|
+
if (Object.freeze) {
|
|
436
|
+
Object.freeze(element.props);
|
|
437
|
+
Object.freeze(element);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return element;
|
|
441
|
+
};
|
|
442
|
+
function createElement(type, config, children) {
|
|
443
|
+
var propName;
|
|
444
|
+
var props = {};
|
|
445
|
+
var key = null;
|
|
446
|
+
var ref = null;
|
|
447
|
+
var self = null;
|
|
448
|
+
var source = null;
|
|
449
|
+
if (config != null) {
|
|
450
|
+
if (hasValidRef(config)) {
|
|
451
|
+
ref = config.ref;
|
|
452
|
+
{
|
|
453
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (hasValidKey(config)) {
|
|
457
|
+
{
|
|
458
|
+
checkKeyStringCoercion(config.key);
|
|
459
|
+
}
|
|
460
|
+
key = "" + config.key;
|
|
461
|
+
}
|
|
462
|
+
self = config.__self === undefined ? null : config.__self;
|
|
463
|
+
source = config.__source === undefined ? null : config.__source;
|
|
464
|
+
for (propName in config) {
|
|
465
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
466
|
+
props[propName] = config[propName];
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
var childrenLength = arguments.length - 2;
|
|
471
|
+
if (childrenLength === 1) {
|
|
472
|
+
props.children = children;
|
|
473
|
+
} else if (childrenLength > 1) {
|
|
474
|
+
var childArray = Array(childrenLength);
|
|
475
|
+
for (var i = 0;i < childrenLength; i++) {
|
|
476
|
+
childArray[i] = arguments[i + 2];
|
|
477
|
+
}
|
|
478
|
+
{
|
|
479
|
+
if (Object.freeze) {
|
|
480
|
+
Object.freeze(childArray);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
props.children = childArray;
|
|
484
|
+
}
|
|
485
|
+
if (type && type.defaultProps) {
|
|
486
|
+
var defaultProps = type.defaultProps;
|
|
487
|
+
for (propName in defaultProps) {
|
|
488
|
+
if (props[propName] === undefined) {
|
|
489
|
+
props[propName] = defaultProps[propName];
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
{
|
|
494
|
+
if (key || ref) {
|
|
495
|
+
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
496
|
+
if (key) {
|
|
497
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
498
|
+
}
|
|
499
|
+
if (ref) {
|
|
500
|
+
defineRefPropWarningGetter(props, displayName);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
505
|
+
}
|
|
506
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
|
507
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
508
|
+
return newElement;
|
|
509
|
+
}
|
|
510
|
+
function cloneElement(element, config, children) {
|
|
511
|
+
if (element === null || element === undefined) {
|
|
512
|
+
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
|
513
|
+
}
|
|
514
|
+
var propName;
|
|
515
|
+
var props = assign({}, element.props);
|
|
516
|
+
var key = element.key;
|
|
517
|
+
var ref = element.ref;
|
|
518
|
+
var self = element._self;
|
|
519
|
+
var source = element._source;
|
|
520
|
+
var owner = element._owner;
|
|
521
|
+
if (config != null) {
|
|
522
|
+
if (hasValidRef(config)) {
|
|
523
|
+
ref = config.ref;
|
|
524
|
+
owner = ReactCurrentOwner.current;
|
|
525
|
+
}
|
|
526
|
+
if (hasValidKey(config)) {
|
|
527
|
+
{
|
|
528
|
+
checkKeyStringCoercion(config.key);
|
|
529
|
+
}
|
|
530
|
+
key = "" + config.key;
|
|
531
|
+
}
|
|
532
|
+
var defaultProps;
|
|
533
|
+
if (element.type && element.type.defaultProps) {
|
|
534
|
+
defaultProps = element.type.defaultProps;
|
|
535
|
+
}
|
|
536
|
+
for (propName in config) {
|
|
537
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
538
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
539
|
+
props[propName] = defaultProps[propName];
|
|
540
|
+
} else {
|
|
541
|
+
props[propName] = config[propName];
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
var childrenLength = arguments.length - 2;
|
|
547
|
+
if (childrenLength === 1) {
|
|
548
|
+
props.children = children;
|
|
549
|
+
} else if (childrenLength > 1) {
|
|
550
|
+
var childArray = Array(childrenLength);
|
|
551
|
+
for (var i = 0;i < childrenLength; i++) {
|
|
552
|
+
childArray[i] = arguments[i + 2];
|
|
553
|
+
}
|
|
554
|
+
props.children = childArray;
|
|
555
|
+
}
|
|
556
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
557
|
+
}
|
|
558
|
+
function isValidElement(object) {
|
|
559
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
560
|
+
}
|
|
561
|
+
var SEPARATOR = ".";
|
|
562
|
+
var SUBSEPARATOR = ":";
|
|
563
|
+
function escape(key) {
|
|
564
|
+
var escapeRegex = /[=:]/g;
|
|
565
|
+
var escaperLookup = {
|
|
566
|
+
"=": "=0",
|
|
567
|
+
":": "=2"
|
|
568
|
+
};
|
|
569
|
+
var escapedString = key.replace(escapeRegex, function(match) {
|
|
570
|
+
return escaperLookup[match];
|
|
571
|
+
});
|
|
572
|
+
return "$" + escapedString;
|
|
573
|
+
}
|
|
574
|
+
var didWarnAboutMaps = false;
|
|
575
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
576
|
+
function escapeUserProvidedKey(text) {
|
|
577
|
+
return text.replace(userProvidedKeyEscapeRegex, "$&/");
|
|
578
|
+
}
|
|
579
|
+
function getElementKey(element, index) {
|
|
580
|
+
if (typeof element === "object" && element !== null && element.key != null) {
|
|
581
|
+
{
|
|
582
|
+
checkKeyStringCoercion(element.key);
|
|
583
|
+
}
|
|
584
|
+
return escape("" + element.key);
|
|
585
|
+
}
|
|
586
|
+
return index.toString(36);
|
|
587
|
+
}
|
|
588
|
+
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
589
|
+
var type = typeof children;
|
|
590
|
+
if (type === "undefined" || type === "boolean") {
|
|
591
|
+
children = null;
|
|
592
|
+
}
|
|
593
|
+
var invokeCallback = false;
|
|
594
|
+
if (children === null) {
|
|
595
|
+
invokeCallback = true;
|
|
596
|
+
} else {
|
|
597
|
+
switch (type) {
|
|
598
|
+
case "string":
|
|
599
|
+
case "number":
|
|
600
|
+
invokeCallback = true;
|
|
601
|
+
break;
|
|
602
|
+
case "object":
|
|
603
|
+
switch (children.$$typeof) {
|
|
604
|
+
case REACT_ELEMENT_TYPE:
|
|
605
|
+
case REACT_PORTAL_TYPE:
|
|
606
|
+
invokeCallback = true;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if (invokeCallback) {
|
|
611
|
+
var _child = children;
|
|
612
|
+
var mappedChild = callback(_child);
|
|
613
|
+
var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
614
|
+
if (isArray(mappedChild)) {
|
|
615
|
+
var escapedChildKey = "";
|
|
616
|
+
if (childKey != null) {
|
|
617
|
+
escapedChildKey = escapeUserProvidedKey(childKey) + "/";
|
|
618
|
+
}
|
|
619
|
+
mapIntoArray(mappedChild, array, escapedChildKey, "", function(c) {
|
|
620
|
+
return c;
|
|
621
|
+
});
|
|
622
|
+
} else if (mappedChild != null) {
|
|
623
|
+
if (isValidElement(mappedChild)) {
|
|
624
|
+
{
|
|
625
|
+
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
|
626
|
+
checkKeyStringCoercion(mappedChild.key);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
mappedChild = cloneAndReplaceKey(mappedChild, escapedPrefix + (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey("" + mappedChild.key) + "/" : "") + childKey);
|
|
630
|
+
}
|
|
631
|
+
array.push(mappedChild);
|
|
632
|
+
}
|
|
633
|
+
return 1;
|
|
634
|
+
}
|
|
635
|
+
var child;
|
|
636
|
+
var nextName;
|
|
637
|
+
var subtreeCount = 0;
|
|
638
|
+
var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
639
|
+
if (isArray(children)) {
|
|
640
|
+
for (var i = 0;i < children.length; i++) {
|
|
641
|
+
child = children[i];
|
|
642
|
+
nextName = nextNamePrefix + getElementKey(child, i);
|
|
643
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
644
|
+
}
|
|
645
|
+
} else {
|
|
646
|
+
var iteratorFn = getIteratorFn(children);
|
|
647
|
+
if (typeof iteratorFn === "function") {
|
|
648
|
+
var iterableChildren = children;
|
|
649
|
+
{
|
|
650
|
+
if (iteratorFn === iterableChildren.entries) {
|
|
651
|
+
if (!didWarnAboutMaps) {
|
|
652
|
+
warn("Using Maps as children is not supported. " + "Use an array of keyed ReactElements instead.");
|
|
653
|
+
}
|
|
654
|
+
didWarnAboutMaps = true;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
var iterator = iteratorFn.call(iterableChildren);
|
|
658
|
+
var step;
|
|
659
|
+
var ii = 0;
|
|
660
|
+
while (!(step = iterator.next()).done) {
|
|
661
|
+
child = step.value;
|
|
662
|
+
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
663
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
664
|
+
}
|
|
665
|
+
} else if (type === "object") {
|
|
666
|
+
var childrenString = String(children);
|
|
667
|
+
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.");
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return subtreeCount;
|
|
671
|
+
}
|
|
672
|
+
function mapChildren(children, func, context) {
|
|
673
|
+
if (children == null) {
|
|
674
|
+
return children;
|
|
675
|
+
}
|
|
676
|
+
var result = [];
|
|
677
|
+
var count = 0;
|
|
678
|
+
mapIntoArray(children, result, "", "", function(child) {
|
|
679
|
+
return func.call(context, child, count++);
|
|
680
|
+
});
|
|
681
|
+
return result;
|
|
682
|
+
}
|
|
683
|
+
function countChildren(children) {
|
|
684
|
+
var n = 0;
|
|
685
|
+
mapChildren(children, function() {
|
|
686
|
+
n++;
|
|
687
|
+
});
|
|
688
|
+
return n;
|
|
689
|
+
}
|
|
690
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
691
|
+
mapChildren(children, function() {
|
|
692
|
+
forEachFunc.apply(this, arguments);
|
|
693
|
+
}, forEachContext);
|
|
694
|
+
}
|
|
695
|
+
function toArray(children) {
|
|
696
|
+
return mapChildren(children, function(child) {
|
|
697
|
+
return child;
|
|
698
|
+
}) || [];
|
|
699
|
+
}
|
|
700
|
+
function onlyChild(children) {
|
|
701
|
+
if (!isValidElement(children)) {
|
|
702
|
+
throw new Error("React.Children.only expected to receive a single React element child.");
|
|
703
|
+
}
|
|
704
|
+
return children;
|
|
705
|
+
}
|
|
706
|
+
function createContext(defaultValue) {
|
|
707
|
+
var context = {
|
|
708
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
709
|
+
_currentValue: defaultValue,
|
|
710
|
+
_currentValue2: defaultValue,
|
|
711
|
+
_threadCount: 0,
|
|
712
|
+
Provider: null,
|
|
713
|
+
Consumer: null,
|
|
714
|
+
_defaultValue: null,
|
|
715
|
+
_globalName: null
|
|
716
|
+
};
|
|
717
|
+
context.Provider = {
|
|
718
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
|
719
|
+
_context: context
|
|
720
|
+
};
|
|
721
|
+
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
722
|
+
var hasWarnedAboutUsingConsumerProvider = false;
|
|
723
|
+
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
724
|
+
{
|
|
725
|
+
var Consumer = {
|
|
726
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
727
|
+
_context: context
|
|
728
|
+
};
|
|
729
|
+
Object.defineProperties(Consumer, {
|
|
730
|
+
Provider: {
|
|
731
|
+
get: function() {
|
|
732
|
+
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
733
|
+
hasWarnedAboutUsingConsumerProvider = true;
|
|
734
|
+
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?");
|
|
735
|
+
}
|
|
736
|
+
return context.Provider;
|
|
737
|
+
},
|
|
738
|
+
set: function(_Provider) {
|
|
739
|
+
context.Provider = _Provider;
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
_currentValue: {
|
|
743
|
+
get: function() {
|
|
744
|
+
return context._currentValue;
|
|
745
|
+
},
|
|
746
|
+
set: function(_currentValue) {
|
|
747
|
+
context._currentValue = _currentValue;
|
|
748
|
+
}
|
|
749
|
+
},
|
|
750
|
+
_currentValue2: {
|
|
751
|
+
get: function() {
|
|
752
|
+
return context._currentValue2;
|
|
753
|
+
},
|
|
754
|
+
set: function(_currentValue2) {
|
|
755
|
+
context._currentValue2 = _currentValue2;
|
|
756
|
+
}
|
|
757
|
+
},
|
|
758
|
+
_threadCount: {
|
|
759
|
+
get: function() {
|
|
760
|
+
return context._threadCount;
|
|
761
|
+
},
|
|
762
|
+
set: function(_threadCount) {
|
|
763
|
+
context._threadCount = _threadCount;
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
Consumer: {
|
|
767
|
+
get: function() {
|
|
768
|
+
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
769
|
+
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
770
|
+
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?");
|
|
771
|
+
}
|
|
772
|
+
return context.Consumer;
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
displayName: {
|
|
776
|
+
get: function() {
|
|
777
|
+
return context.displayName;
|
|
778
|
+
},
|
|
779
|
+
set: function(displayName) {
|
|
780
|
+
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
781
|
+
warn("Setting `displayName` on Context.Consumer has no effect. " + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
782
|
+
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
context.Consumer = Consumer;
|
|
788
|
+
}
|
|
789
|
+
{
|
|
790
|
+
context._currentRenderer = null;
|
|
791
|
+
context._currentRenderer2 = null;
|
|
792
|
+
}
|
|
793
|
+
return context;
|
|
794
|
+
}
|
|
795
|
+
var Uninitialized = -1;
|
|
796
|
+
var Pending = 0;
|
|
797
|
+
var Resolved = 1;
|
|
798
|
+
var Rejected = 2;
|
|
799
|
+
function lazyInitializer(payload) {
|
|
800
|
+
if (payload._status === Uninitialized) {
|
|
801
|
+
var ctor = payload._result;
|
|
802
|
+
var thenable = ctor();
|
|
803
|
+
thenable.then(function(moduleObject2) {
|
|
804
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
805
|
+
var resolved = payload;
|
|
806
|
+
resolved._status = Resolved;
|
|
807
|
+
resolved._result = moduleObject2;
|
|
808
|
+
}
|
|
809
|
+
}, function(error2) {
|
|
810
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
811
|
+
var rejected = payload;
|
|
812
|
+
rejected._status = Rejected;
|
|
813
|
+
rejected._result = error2;
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
if (payload._status === Uninitialized) {
|
|
817
|
+
var pending = payload;
|
|
818
|
+
pending._status = Pending;
|
|
819
|
+
pending._result = thenable;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
if (payload._status === Resolved) {
|
|
823
|
+
var moduleObject = payload._result;
|
|
824
|
+
{
|
|
825
|
+
if (moduleObject === undefined) {
|
|
826
|
+
error("lazy: Expected the result of a dynamic imp" + "ort() call. " + `Instead received: %s
|
|
827
|
+
|
|
828
|
+
Your code should look like:
|
|
829
|
+
` + "const MyComponent = lazy(() => imp" + `ort('./MyComponent'))
|
|
830
|
+
|
|
831
|
+
` + "Did you accidentally put curly braces around the import?", moduleObject);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
{
|
|
835
|
+
if (!("default" in moduleObject)) {
|
|
836
|
+
error("lazy: Expected the result of a dynamic imp" + "ort() call. " + `Instead received: %s
|
|
837
|
+
|
|
838
|
+
Your code should look like:
|
|
839
|
+
` + "const MyComponent = lazy(() => imp" + "ort('./MyComponent'))", moduleObject);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return moduleObject.default;
|
|
843
|
+
} else {
|
|
844
|
+
throw payload._result;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
function lazy(ctor) {
|
|
848
|
+
var payload = {
|
|
849
|
+
_status: Uninitialized,
|
|
850
|
+
_result: ctor
|
|
851
|
+
};
|
|
852
|
+
var lazyType = {
|
|
853
|
+
$$typeof: REACT_LAZY_TYPE,
|
|
854
|
+
_payload: payload,
|
|
855
|
+
_init: lazyInitializer
|
|
856
|
+
};
|
|
857
|
+
{
|
|
858
|
+
var defaultProps;
|
|
859
|
+
var propTypes;
|
|
860
|
+
Object.defineProperties(lazyType, {
|
|
861
|
+
defaultProps: {
|
|
862
|
+
configurable: true,
|
|
863
|
+
get: function() {
|
|
864
|
+
return defaultProps;
|
|
865
|
+
},
|
|
866
|
+
set: function(newDefaultProps) {
|
|
867
|
+
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.");
|
|
868
|
+
defaultProps = newDefaultProps;
|
|
869
|
+
Object.defineProperty(lazyType, "defaultProps", {
|
|
870
|
+
enumerable: true
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
propTypes: {
|
|
875
|
+
configurable: true,
|
|
876
|
+
get: function() {
|
|
877
|
+
return propTypes;
|
|
878
|
+
},
|
|
879
|
+
set: function(newPropTypes) {
|
|
880
|
+
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.");
|
|
881
|
+
propTypes = newPropTypes;
|
|
882
|
+
Object.defineProperty(lazyType, "propTypes", {
|
|
883
|
+
enumerable: true
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
return lazyType;
|
|
890
|
+
}
|
|
891
|
+
function forwardRef(render) {
|
|
892
|
+
{
|
|
893
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
894
|
+
error("forwardRef requires a render function but received a `memo` " + "component. Instead of forwardRef(memo(...)), use " + "memo(forwardRef(...)).");
|
|
895
|
+
} else if (typeof render !== "function") {
|
|
896
|
+
error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render);
|
|
897
|
+
} else {
|
|
898
|
+
if (render.length !== 0 && render.length !== 2) {
|
|
899
|
+
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.");
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
if (render != null) {
|
|
903
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
|
904
|
+
error("forwardRef render functions do not support propTypes or defaultProps. " + "Did you accidentally pass a React component?");
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
var elementType = {
|
|
909
|
+
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
910
|
+
render
|
|
911
|
+
};
|
|
912
|
+
{
|
|
913
|
+
var ownName;
|
|
914
|
+
Object.defineProperty(elementType, "displayName", {
|
|
915
|
+
enumerable: false,
|
|
916
|
+
configurable: true,
|
|
917
|
+
get: function() {
|
|
918
|
+
return ownName;
|
|
919
|
+
},
|
|
920
|
+
set: function(name) {
|
|
921
|
+
ownName = name;
|
|
922
|
+
if (!render.name && !render.displayName) {
|
|
923
|
+
render.displayName = name;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
return elementType;
|
|
929
|
+
}
|
|
930
|
+
var REACT_MODULE_REFERENCE;
|
|
931
|
+
{
|
|
932
|
+
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
933
|
+
}
|
|
934
|
+
function isValidElementType(type) {
|
|
935
|
+
if (typeof type === "string" || typeof type === "function") {
|
|
936
|
+
return true;
|
|
937
|
+
}
|
|
938
|
+
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) {
|
|
939
|
+
return true;
|
|
940
|
+
}
|
|
941
|
+
if (typeof type === "object" && type !== null) {
|
|
942
|
+
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 !== undefined) {
|
|
943
|
+
return true;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
return false;
|
|
947
|
+
}
|
|
948
|
+
function memo(type, compare) {
|
|
949
|
+
{
|
|
950
|
+
if (!isValidElementType(type)) {
|
|
951
|
+
error("memo: The first argument must be a component. Instead " + "received: %s", type === null ? "null" : typeof type);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
var elementType = {
|
|
955
|
+
$$typeof: REACT_MEMO_TYPE,
|
|
956
|
+
type,
|
|
957
|
+
compare: compare === undefined ? null : compare
|
|
958
|
+
};
|
|
959
|
+
{
|
|
960
|
+
var ownName;
|
|
961
|
+
Object.defineProperty(elementType, "displayName", {
|
|
962
|
+
enumerable: false,
|
|
963
|
+
configurable: true,
|
|
964
|
+
get: function() {
|
|
965
|
+
return ownName;
|
|
966
|
+
},
|
|
967
|
+
set: function(name) {
|
|
968
|
+
ownName = name;
|
|
969
|
+
if (!type.name && !type.displayName) {
|
|
970
|
+
type.displayName = name;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
return elementType;
|
|
976
|
+
}
|
|
977
|
+
function resolveDispatcher() {
|
|
978
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
|
979
|
+
{
|
|
980
|
+
if (dispatcher === null) {
|
|
981
|
+
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:
|
|
982
|
+
` + `1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
983
|
+
` + `2. You might be breaking the Rules of Hooks
|
|
984
|
+
` + `3. You might have more than one copy of React in the same app
|
|
985
|
+
` + "See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
return dispatcher;
|
|
989
|
+
}
|
|
990
|
+
function useContext(Context) {
|
|
991
|
+
var dispatcher = resolveDispatcher();
|
|
992
|
+
{
|
|
993
|
+
if (Context._context !== undefined) {
|
|
994
|
+
var realContext = Context._context;
|
|
995
|
+
if (realContext.Consumer === Context) {
|
|
996
|
+
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?");
|
|
997
|
+
} else if (realContext.Provider === Context) {
|
|
998
|
+
error("Calling useContext(Context.Provider) is not supported. " + "Did you mean to call useContext(Context) instead?");
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
return dispatcher.useContext(Context);
|
|
1003
|
+
}
|
|
1004
|
+
function useState(initialState) {
|
|
1005
|
+
var dispatcher = resolveDispatcher();
|
|
1006
|
+
return dispatcher.useState(initialState);
|
|
1007
|
+
}
|
|
1008
|
+
function useReducer(reducer, initialArg, init) {
|
|
1009
|
+
var dispatcher = resolveDispatcher();
|
|
1010
|
+
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1011
|
+
}
|
|
1012
|
+
function useRef(initialValue) {
|
|
1013
|
+
var dispatcher = resolveDispatcher();
|
|
1014
|
+
return dispatcher.useRef(initialValue);
|
|
1015
|
+
}
|
|
1016
|
+
function useEffect(create, deps) {
|
|
1017
|
+
var dispatcher = resolveDispatcher();
|
|
1018
|
+
return dispatcher.useEffect(create, deps);
|
|
1019
|
+
}
|
|
1020
|
+
function useInsertionEffect(create, deps) {
|
|
1021
|
+
var dispatcher = resolveDispatcher();
|
|
1022
|
+
return dispatcher.useInsertionEffect(create, deps);
|
|
1023
|
+
}
|
|
1024
|
+
function useLayoutEffect(create, deps) {
|
|
1025
|
+
var dispatcher = resolveDispatcher();
|
|
1026
|
+
return dispatcher.useLayoutEffect(create, deps);
|
|
1027
|
+
}
|
|
1028
|
+
function useCallback(callback, deps) {
|
|
1029
|
+
var dispatcher = resolveDispatcher();
|
|
1030
|
+
return dispatcher.useCallback(callback, deps);
|
|
1031
|
+
}
|
|
1032
|
+
function useMemo(create, deps) {
|
|
1033
|
+
var dispatcher = resolveDispatcher();
|
|
1034
|
+
return dispatcher.useMemo(create, deps);
|
|
1035
|
+
}
|
|
1036
|
+
function useImperativeHandle(ref, create, deps) {
|
|
1037
|
+
var dispatcher = resolveDispatcher();
|
|
1038
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1039
|
+
}
|
|
1040
|
+
function useDebugValue(value, formatterFn) {
|
|
1041
|
+
{
|
|
1042
|
+
var dispatcher = resolveDispatcher();
|
|
1043
|
+
return dispatcher.useDebugValue(value, formatterFn);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
function useTransition() {
|
|
1047
|
+
var dispatcher = resolveDispatcher();
|
|
1048
|
+
return dispatcher.useTransition();
|
|
1049
|
+
}
|
|
1050
|
+
function useDeferredValue(value) {
|
|
1051
|
+
var dispatcher = resolveDispatcher();
|
|
1052
|
+
return dispatcher.useDeferredValue(value);
|
|
1053
|
+
}
|
|
1054
|
+
function useId() {
|
|
1055
|
+
var dispatcher = resolveDispatcher();
|
|
1056
|
+
return dispatcher.useId();
|
|
1057
|
+
}
|
|
1058
|
+
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
1059
|
+
var dispatcher = resolveDispatcher();
|
|
1060
|
+
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1061
|
+
}
|
|
1062
|
+
var disabledDepth = 0;
|
|
1063
|
+
var prevLog;
|
|
1064
|
+
var prevInfo;
|
|
1065
|
+
var prevWarn;
|
|
1066
|
+
var prevError;
|
|
1067
|
+
var prevGroup;
|
|
1068
|
+
var prevGroupCollapsed;
|
|
1069
|
+
var prevGroupEnd;
|
|
1070
|
+
function disabledLog() {}
|
|
1071
|
+
disabledLog.__reactDisabledLog = true;
|
|
1072
|
+
function disableLogs() {
|
|
1073
|
+
{
|
|
1074
|
+
if (disabledDepth === 0) {
|
|
1075
|
+
prevLog = console.log;
|
|
1076
|
+
prevInfo = console.info;
|
|
1077
|
+
prevWarn = console.warn;
|
|
1078
|
+
prevError = console.error;
|
|
1079
|
+
prevGroup = console.group;
|
|
1080
|
+
prevGroupCollapsed = console.groupCollapsed;
|
|
1081
|
+
prevGroupEnd = console.groupEnd;
|
|
1082
|
+
var props = {
|
|
1083
|
+
configurable: true,
|
|
1084
|
+
enumerable: true,
|
|
1085
|
+
value: disabledLog,
|
|
1086
|
+
writable: true
|
|
1087
|
+
};
|
|
1088
|
+
Object.defineProperties(console, {
|
|
1089
|
+
info: props,
|
|
1090
|
+
log: props,
|
|
1091
|
+
warn: props,
|
|
1092
|
+
error: props,
|
|
1093
|
+
group: props,
|
|
1094
|
+
groupCollapsed: props,
|
|
1095
|
+
groupEnd: props
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
disabledDepth++;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
function reenableLogs() {
|
|
1102
|
+
{
|
|
1103
|
+
disabledDepth--;
|
|
1104
|
+
if (disabledDepth === 0) {
|
|
1105
|
+
var props = {
|
|
1106
|
+
configurable: true,
|
|
1107
|
+
enumerable: true,
|
|
1108
|
+
writable: true
|
|
1109
|
+
};
|
|
1110
|
+
Object.defineProperties(console, {
|
|
1111
|
+
log: assign({}, props, {
|
|
1112
|
+
value: prevLog
|
|
1113
|
+
}),
|
|
1114
|
+
info: assign({}, props, {
|
|
1115
|
+
value: prevInfo
|
|
1116
|
+
}),
|
|
1117
|
+
warn: assign({}, props, {
|
|
1118
|
+
value: prevWarn
|
|
1119
|
+
}),
|
|
1120
|
+
error: assign({}, props, {
|
|
1121
|
+
value: prevError
|
|
1122
|
+
}),
|
|
1123
|
+
group: assign({}, props, {
|
|
1124
|
+
value: prevGroup
|
|
1125
|
+
}),
|
|
1126
|
+
groupCollapsed: assign({}, props, {
|
|
1127
|
+
value: prevGroupCollapsed
|
|
1128
|
+
}),
|
|
1129
|
+
groupEnd: assign({}, props, {
|
|
1130
|
+
value: prevGroupEnd
|
|
1131
|
+
})
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
if (disabledDepth < 0) {
|
|
1135
|
+
error("disabledDepth fell below zero. " + "This is a bug in React. Please file an issue.");
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1140
|
+
var prefix;
|
|
1141
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1142
|
+
{
|
|
1143
|
+
if (prefix === undefined) {
|
|
1144
|
+
try {
|
|
1145
|
+
throw Error();
|
|
1146
|
+
} catch (x) {
|
|
1147
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
1148
|
+
prefix = match && match[1] || "";
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
return `
|
|
1152
|
+
` + prefix + name;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
var reentry = false;
|
|
1156
|
+
var componentFrameCache;
|
|
1157
|
+
{
|
|
1158
|
+
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
|
1159
|
+
componentFrameCache = new PossiblyWeakMap;
|
|
1160
|
+
}
|
|
1161
|
+
function describeNativeComponentFrame(fn, construct) {
|
|
1162
|
+
if (!fn || reentry) {
|
|
1163
|
+
return "";
|
|
1164
|
+
}
|
|
1165
|
+
{
|
|
1166
|
+
var frame = componentFrameCache.get(fn);
|
|
1167
|
+
if (frame !== undefined) {
|
|
1168
|
+
return frame;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
var control;
|
|
1172
|
+
reentry = true;
|
|
1173
|
+
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
1174
|
+
Error.prepareStackTrace = undefined;
|
|
1175
|
+
var previousDispatcher;
|
|
1176
|
+
{
|
|
1177
|
+
previousDispatcher = ReactCurrentDispatcher$1.current;
|
|
1178
|
+
ReactCurrentDispatcher$1.current = null;
|
|
1179
|
+
disableLogs();
|
|
1180
|
+
}
|
|
1181
|
+
try {
|
|
1182
|
+
if (construct) {
|
|
1183
|
+
var Fake = function() {
|
|
1184
|
+
throw Error();
|
|
1185
|
+
};
|
|
1186
|
+
Object.defineProperty(Fake.prototype, "props", {
|
|
1187
|
+
set: function() {
|
|
1188
|
+
throw Error();
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
if (typeof Reflect === "object" && Reflect.construct) {
|
|
1192
|
+
try {
|
|
1193
|
+
Reflect.construct(Fake, []);
|
|
1194
|
+
} catch (x) {
|
|
1195
|
+
control = x;
|
|
1196
|
+
}
|
|
1197
|
+
Reflect.construct(fn, [], Fake);
|
|
1198
|
+
} else {
|
|
1199
|
+
try {
|
|
1200
|
+
Fake.call();
|
|
1201
|
+
} catch (x) {
|
|
1202
|
+
control = x;
|
|
1203
|
+
}
|
|
1204
|
+
fn.call(Fake.prototype);
|
|
1205
|
+
}
|
|
1206
|
+
} else {
|
|
1207
|
+
try {
|
|
1208
|
+
throw Error();
|
|
1209
|
+
} catch (x) {
|
|
1210
|
+
control = x;
|
|
1211
|
+
}
|
|
1212
|
+
fn();
|
|
1213
|
+
}
|
|
1214
|
+
} catch (sample) {
|
|
1215
|
+
if (sample && control && typeof sample.stack === "string") {
|
|
1216
|
+
var sampleLines = sample.stack.split(`
|
|
1217
|
+
`);
|
|
1218
|
+
var controlLines = control.stack.split(`
|
|
1219
|
+
`);
|
|
1220
|
+
var s = sampleLines.length - 1;
|
|
1221
|
+
var c = controlLines.length - 1;
|
|
1222
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
1223
|
+
c--;
|
|
1224
|
+
}
|
|
1225
|
+
for (;s >= 1 && c >= 0; s--, c--) {
|
|
1226
|
+
if (sampleLines[s] !== controlLines[c]) {
|
|
1227
|
+
if (s !== 1 || c !== 1) {
|
|
1228
|
+
do {
|
|
1229
|
+
s--;
|
|
1230
|
+
c--;
|
|
1231
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
1232
|
+
var _frame = `
|
|
1233
|
+
` + sampleLines[s].replace(" at new ", " at ");
|
|
1234
|
+
if (fn.displayName && _frame.includes("<anonymous>")) {
|
|
1235
|
+
_frame = _frame.replace("<anonymous>", fn.displayName);
|
|
1236
|
+
}
|
|
1237
|
+
{
|
|
1238
|
+
if (typeof fn === "function") {
|
|
1239
|
+
componentFrameCache.set(fn, _frame);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
return _frame;
|
|
1243
|
+
}
|
|
1244
|
+
} while (s >= 1 && c >= 0);
|
|
1245
|
+
}
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
} finally {
|
|
1251
|
+
reentry = false;
|
|
1252
|
+
{
|
|
1253
|
+
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
1254
|
+
reenableLogs();
|
|
1255
|
+
}
|
|
1256
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
1257
|
+
}
|
|
1258
|
+
var name = fn ? fn.displayName || fn.name : "";
|
|
1259
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
1260
|
+
{
|
|
1261
|
+
if (typeof fn === "function") {
|
|
1262
|
+
componentFrameCache.set(fn, syntheticFrame);
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
return syntheticFrame;
|
|
1266
|
+
}
|
|
1267
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
1268
|
+
{
|
|
1269
|
+
return describeNativeComponentFrame(fn, false);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
function shouldConstruct(Component2) {
|
|
1273
|
+
var prototype = Component2.prototype;
|
|
1274
|
+
return !!(prototype && prototype.isReactComponent);
|
|
1275
|
+
}
|
|
1276
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
1277
|
+
if (type == null) {
|
|
1278
|
+
return "";
|
|
1279
|
+
}
|
|
1280
|
+
if (typeof type === "function") {
|
|
1281
|
+
{
|
|
1282
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
if (typeof type === "string") {
|
|
1286
|
+
return describeBuiltInComponentFrame(type);
|
|
1287
|
+
}
|
|
1288
|
+
switch (type) {
|
|
1289
|
+
case REACT_SUSPENSE_TYPE:
|
|
1290
|
+
return describeBuiltInComponentFrame("Suspense");
|
|
1291
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
1292
|
+
return describeBuiltInComponentFrame("SuspenseList");
|
|
1293
|
+
}
|
|
1294
|
+
if (typeof type === "object") {
|
|
1295
|
+
switch (type.$$typeof) {
|
|
1296
|
+
case REACT_FORWARD_REF_TYPE:
|
|
1297
|
+
return describeFunctionComponentFrame(type.render);
|
|
1298
|
+
case REACT_MEMO_TYPE:
|
|
1299
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
1300
|
+
case REACT_LAZY_TYPE: {
|
|
1301
|
+
var lazyComponent = type;
|
|
1302
|
+
var payload = lazyComponent._payload;
|
|
1303
|
+
var init = lazyComponent._init;
|
|
1304
|
+
try {
|
|
1305
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
1306
|
+
} catch (x) {}
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
return "";
|
|
1311
|
+
}
|
|
1312
|
+
var loggedTypeFailures = {};
|
|
1313
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1314
|
+
function setCurrentlyValidatingElement(element) {
|
|
1315
|
+
{
|
|
1316
|
+
if (element) {
|
|
1317
|
+
var owner = element._owner;
|
|
1318
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1319
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1320
|
+
} else {
|
|
1321
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
1326
|
+
{
|
|
1327
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
1328
|
+
for (var typeSpecName in typeSpecs) {
|
|
1329
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
1330
|
+
var error$1 = undefined;
|
|
1331
|
+
try {
|
|
1332
|
+
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
1333
|
+
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`.");
|
|
1334
|
+
err.name = "Invariant Violation";
|
|
1335
|
+
throw err;
|
|
1336
|
+
}
|
|
1337
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
1338
|
+
} catch (ex) {
|
|
1339
|
+
error$1 = ex;
|
|
1340
|
+
}
|
|
1341
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
1342
|
+
setCurrentlyValidatingElement(element);
|
|
1343
|
+
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);
|
|
1344
|
+
setCurrentlyValidatingElement(null);
|
|
1345
|
+
}
|
|
1346
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
1347
|
+
loggedTypeFailures[error$1.message] = true;
|
|
1348
|
+
setCurrentlyValidatingElement(element);
|
|
1349
|
+
error("Failed %s type: %s", location, error$1.message);
|
|
1350
|
+
setCurrentlyValidatingElement(null);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
1357
|
+
{
|
|
1358
|
+
if (element) {
|
|
1359
|
+
var owner = element._owner;
|
|
1360
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1361
|
+
setExtraStackFrame(stack);
|
|
1362
|
+
} else {
|
|
1363
|
+
setExtraStackFrame(null);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
var propTypesMisspellWarningShown;
|
|
1368
|
+
{
|
|
1369
|
+
propTypesMisspellWarningShown = false;
|
|
1370
|
+
}
|
|
1371
|
+
function getDeclarationErrorAddendum() {
|
|
1372
|
+
if (ReactCurrentOwner.current) {
|
|
1373
|
+
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
1374
|
+
if (name) {
|
|
1375
|
+
return `
|
|
1376
|
+
|
|
1377
|
+
Check the render method of \`` + name + "`.";
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
return "";
|
|
1381
|
+
}
|
|
1382
|
+
function getSourceInfoErrorAddendum(source) {
|
|
1383
|
+
if (source !== undefined) {
|
|
1384
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
|
1385
|
+
var lineNumber = source.lineNumber;
|
|
1386
|
+
return `
|
|
1387
|
+
|
|
1388
|
+
Check your code at ` + fileName + ":" + lineNumber + ".";
|
|
1389
|
+
}
|
|
1390
|
+
return "";
|
|
1391
|
+
}
|
|
1392
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
1393
|
+
if (elementProps !== null && elementProps !== undefined) {
|
|
1394
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
1395
|
+
}
|
|
1396
|
+
return "";
|
|
1397
|
+
}
|
|
1398
|
+
var ownerHasKeyUseWarning = {};
|
|
1399
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
1400
|
+
var info = getDeclarationErrorAddendum();
|
|
1401
|
+
if (!info) {
|
|
1402
|
+
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
1403
|
+
if (parentName) {
|
|
1404
|
+
info = `
|
|
1405
|
+
|
|
1406
|
+
Check the top-level render call using <` + parentName + ">.";
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
return info;
|
|
1410
|
+
}
|
|
1411
|
+
function validateExplicitKey(element, parentType) {
|
|
1412
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
element._store.validated = true;
|
|
1416
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1417
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
1421
|
+
var childOwner = "";
|
|
1422
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
1423
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1424
|
+
}
|
|
1425
|
+
{
|
|
1426
|
+
setCurrentlyValidatingElement$1(element);
|
|
1427
|
+
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);
|
|
1428
|
+
setCurrentlyValidatingElement$1(null);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
function validateChildKeys(node, parentType) {
|
|
1432
|
+
if (typeof node !== "object") {
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1435
|
+
if (isArray(node)) {
|
|
1436
|
+
for (var i = 0;i < node.length; i++) {
|
|
1437
|
+
var child = node[i];
|
|
1438
|
+
if (isValidElement(child)) {
|
|
1439
|
+
validateExplicitKey(child, parentType);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
} else if (isValidElement(node)) {
|
|
1443
|
+
if (node._store) {
|
|
1444
|
+
node._store.validated = true;
|
|
1445
|
+
}
|
|
1446
|
+
} else if (node) {
|
|
1447
|
+
var iteratorFn = getIteratorFn(node);
|
|
1448
|
+
if (typeof iteratorFn === "function") {
|
|
1449
|
+
if (iteratorFn !== node.entries) {
|
|
1450
|
+
var iterator = iteratorFn.call(node);
|
|
1451
|
+
var step;
|
|
1452
|
+
while (!(step = iterator.next()).done) {
|
|
1453
|
+
if (isValidElement(step.value)) {
|
|
1454
|
+
validateExplicitKey(step.value, parentType);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
function validatePropTypes(element) {
|
|
1462
|
+
{
|
|
1463
|
+
var type = element.type;
|
|
1464
|
+
if (type === null || type === undefined || typeof type === "string") {
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1467
|
+
var propTypes;
|
|
1468
|
+
if (typeof type === "function") {
|
|
1469
|
+
propTypes = type.propTypes;
|
|
1470
|
+
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1471
|
+
propTypes = type.propTypes;
|
|
1472
|
+
} else {
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
if (propTypes) {
|
|
1476
|
+
var name = getComponentNameFromType(type);
|
|
1477
|
+
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
1478
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1479
|
+
propTypesMisspellWarningShown = true;
|
|
1480
|
+
var _name = getComponentNameFromType(type);
|
|
1481
|
+
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
|
1482
|
+
}
|
|
1483
|
+
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
|
1484
|
+
error("getDefaultProps is only used on classic React.createClass " + "definitions. Use a static property named `defaultProps` instead.");
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
function validateFragmentProps(fragment) {
|
|
1489
|
+
{
|
|
1490
|
+
var keys = Object.keys(fragment.props);
|
|
1491
|
+
for (var i = 0;i < keys.length; i++) {
|
|
1492
|
+
var key = keys[i];
|
|
1493
|
+
if (key !== "children" && key !== "key") {
|
|
1494
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
1495
|
+
error("Invalid prop `%s` supplied to `React.Fragment`. " + "React.Fragment can only have `key` and `children` props.", key);
|
|
1496
|
+
setCurrentlyValidatingElement$1(null);
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
if (fragment.ref !== null) {
|
|
1501
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
1502
|
+
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
1503
|
+
setCurrentlyValidatingElement$1(null);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
function createElementWithValidation(type, props, children) {
|
|
1508
|
+
var validType = isValidElementType(type);
|
|
1509
|
+
if (!validType) {
|
|
1510
|
+
var info = "";
|
|
1511
|
+
if (type === undefined || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
|
1512
|
+
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.";
|
|
1513
|
+
}
|
|
1514
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
1515
|
+
if (sourceInfo) {
|
|
1516
|
+
info += sourceInfo;
|
|
1517
|
+
} else {
|
|
1518
|
+
info += getDeclarationErrorAddendum();
|
|
1519
|
+
}
|
|
1520
|
+
var typeString;
|
|
1521
|
+
if (type === null) {
|
|
1522
|
+
typeString = "null";
|
|
1523
|
+
} else if (isArray(type)) {
|
|
1524
|
+
typeString = "array";
|
|
1525
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1526
|
+
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
1527
|
+
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
1528
|
+
} else {
|
|
1529
|
+
typeString = typeof type;
|
|
1530
|
+
}
|
|
1531
|
+
{
|
|
1532
|
+
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);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
var element = createElement.apply(this, arguments);
|
|
1536
|
+
if (element == null) {
|
|
1537
|
+
return element;
|
|
1538
|
+
}
|
|
1539
|
+
if (validType) {
|
|
1540
|
+
for (var i = 2;i < arguments.length; i++) {
|
|
1541
|
+
validateChildKeys(arguments[i], type);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
1545
|
+
validateFragmentProps(element);
|
|
1546
|
+
} else {
|
|
1547
|
+
validatePropTypes(element);
|
|
1548
|
+
}
|
|
1549
|
+
return element;
|
|
1550
|
+
}
|
|
1551
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
|
1552
|
+
function createFactoryWithValidation(type) {
|
|
1553
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
1554
|
+
validatedFactory.type = type;
|
|
1555
|
+
{
|
|
1556
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
1557
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
|
1558
|
+
warn("React.createFactory() is deprecated and will be removed in " + "a future major release. Consider using JSX " + "or use React.createElement() directly instead.");
|
|
1559
|
+
}
|
|
1560
|
+
Object.defineProperty(validatedFactory, "type", {
|
|
1561
|
+
enumerable: false,
|
|
1562
|
+
get: function() {
|
|
1563
|
+
warn("Factory.type is deprecated. Access the class directly " + "before passing it to createFactory.");
|
|
1564
|
+
Object.defineProperty(this, "type", {
|
|
1565
|
+
value: type
|
|
1566
|
+
});
|
|
1567
|
+
return type;
|
|
1568
|
+
}
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
return validatedFactory;
|
|
1572
|
+
}
|
|
1573
|
+
function cloneElementWithValidation(element, props, children) {
|
|
1574
|
+
var newElement = cloneElement.apply(this, arguments);
|
|
1575
|
+
for (var i = 2;i < arguments.length; i++) {
|
|
1576
|
+
validateChildKeys(arguments[i], newElement.type);
|
|
1577
|
+
}
|
|
1578
|
+
validatePropTypes(newElement);
|
|
1579
|
+
return newElement;
|
|
1580
|
+
}
|
|
1581
|
+
function startTransition(scope, options) {
|
|
1582
|
+
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
1583
|
+
ReactCurrentBatchConfig.transition = {};
|
|
1584
|
+
var currentTransition = ReactCurrentBatchConfig.transition;
|
|
1585
|
+
{
|
|
1586
|
+
ReactCurrentBatchConfig.transition._updatedFibers = new Set;
|
|
1587
|
+
}
|
|
1588
|
+
try {
|
|
1589
|
+
scope();
|
|
1590
|
+
} finally {
|
|
1591
|
+
ReactCurrentBatchConfig.transition = prevTransition;
|
|
1592
|
+
{
|
|
1593
|
+
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
1594
|
+
var updatedFibersCount = currentTransition._updatedFibers.size;
|
|
1595
|
+
if (updatedFibersCount > 10) {
|
|
1596
|
+
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.");
|
|
1597
|
+
}
|
|
1598
|
+
currentTransition._updatedFibers.clear();
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
var didWarnAboutMessageChannel = false;
|
|
1604
|
+
var enqueueTaskImpl = null;
|
|
1605
|
+
function enqueueTask(task) {
|
|
1606
|
+
if (enqueueTaskImpl === null) {
|
|
1607
|
+
try {
|
|
1608
|
+
var requireString = ("require" + Math.random()).slice(0, 7);
|
|
1609
|
+
var nodeRequire = module && module[requireString];
|
|
1610
|
+
enqueueTaskImpl = nodeRequire.call(module, "timers").setImmediate;
|
|
1611
|
+
} catch (_err) {
|
|
1612
|
+
enqueueTaskImpl = function(callback) {
|
|
1613
|
+
{
|
|
1614
|
+
if (didWarnAboutMessageChannel === false) {
|
|
1615
|
+
didWarnAboutMessageChannel = true;
|
|
1616
|
+
if (typeof MessageChannel === "undefined") {
|
|
1617
|
+
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.");
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
var channel = new MessageChannel;
|
|
1622
|
+
channel.port1.onmessage = callback;
|
|
1623
|
+
channel.port2.postMessage(undefined);
|
|
1624
|
+
};
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
return enqueueTaskImpl(task);
|
|
1628
|
+
}
|
|
1629
|
+
var actScopeDepth = 0;
|
|
1630
|
+
var didWarnNoAwaitAct = false;
|
|
1631
|
+
function act(callback) {
|
|
1632
|
+
{
|
|
1633
|
+
var prevActScopeDepth = actScopeDepth;
|
|
1634
|
+
actScopeDepth++;
|
|
1635
|
+
if (ReactCurrentActQueue.current === null) {
|
|
1636
|
+
ReactCurrentActQueue.current = [];
|
|
1637
|
+
}
|
|
1638
|
+
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
|
1639
|
+
var result;
|
|
1640
|
+
try {
|
|
1641
|
+
ReactCurrentActQueue.isBatchingLegacy = true;
|
|
1642
|
+
result = callback();
|
|
1643
|
+
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
1644
|
+
var queue = ReactCurrentActQueue.current;
|
|
1645
|
+
if (queue !== null) {
|
|
1646
|
+
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
|
1647
|
+
flushActQueue(queue);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
} catch (error2) {
|
|
1651
|
+
popActScope(prevActScopeDepth);
|
|
1652
|
+
throw error2;
|
|
1653
|
+
} finally {
|
|
1654
|
+
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
|
1655
|
+
}
|
|
1656
|
+
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
|
1657
|
+
var thenableResult = result;
|
|
1658
|
+
var wasAwaited = false;
|
|
1659
|
+
var thenable = {
|
|
1660
|
+
then: function(resolve, reject) {
|
|
1661
|
+
wasAwaited = true;
|
|
1662
|
+
thenableResult.then(function(returnValue2) {
|
|
1663
|
+
popActScope(prevActScopeDepth);
|
|
1664
|
+
if (actScopeDepth === 0) {
|
|
1665
|
+
recursivelyFlushAsyncActWork(returnValue2, resolve, reject);
|
|
1666
|
+
} else {
|
|
1667
|
+
resolve(returnValue2);
|
|
1668
|
+
}
|
|
1669
|
+
}, function(error2) {
|
|
1670
|
+
popActScope(prevActScopeDepth);
|
|
1671
|
+
reject(error2);
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
{
|
|
1676
|
+
if (!didWarnNoAwaitAct && typeof Promise !== "undefined") {
|
|
1677
|
+
Promise.resolve().then(function() {}).then(function() {
|
|
1678
|
+
if (!wasAwaited) {
|
|
1679
|
+
didWarnNoAwaitAct = true;
|
|
1680
|
+
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 () => ...);");
|
|
1681
|
+
}
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
return thenable;
|
|
1686
|
+
} else {
|
|
1687
|
+
var returnValue = result;
|
|
1688
|
+
popActScope(prevActScopeDepth);
|
|
1689
|
+
if (actScopeDepth === 0) {
|
|
1690
|
+
var _queue = ReactCurrentActQueue.current;
|
|
1691
|
+
if (_queue !== null) {
|
|
1692
|
+
flushActQueue(_queue);
|
|
1693
|
+
ReactCurrentActQueue.current = null;
|
|
1694
|
+
}
|
|
1695
|
+
var _thenable = {
|
|
1696
|
+
then: function(resolve, reject) {
|
|
1697
|
+
if (ReactCurrentActQueue.current === null) {
|
|
1698
|
+
ReactCurrentActQueue.current = [];
|
|
1699
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
1700
|
+
} else {
|
|
1701
|
+
resolve(returnValue);
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
};
|
|
1705
|
+
return _thenable;
|
|
1706
|
+
} else {
|
|
1707
|
+
var _thenable2 = {
|
|
1708
|
+
then: function(resolve, reject) {
|
|
1709
|
+
resolve(returnValue);
|
|
1710
|
+
}
|
|
1711
|
+
};
|
|
1712
|
+
return _thenable2;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
function popActScope(prevActScopeDepth) {
|
|
1718
|
+
{
|
|
1719
|
+
if (prevActScopeDepth !== actScopeDepth - 1) {
|
|
1720
|
+
error("You seem to have overlapping act() calls, this is not supported. " + "Be sure to await previous act() calls before making a new one. ");
|
|
1721
|
+
}
|
|
1722
|
+
actScopeDepth = prevActScopeDepth;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
1726
|
+
{
|
|
1727
|
+
var queue = ReactCurrentActQueue.current;
|
|
1728
|
+
if (queue !== null) {
|
|
1729
|
+
try {
|
|
1730
|
+
flushActQueue(queue);
|
|
1731
|
+
enqueueTask(function() {
|
|
1732
|
+
if (queue.length === 0) {
|
|
1733
|
+
ReactCurrentActQueue.current = null;
|
|
1734
|
+
resolve(returnValue);
|
|
1735
|
+
} else {
|
|
1736
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
1737
|
+
}
|
|
1738
|
+
});
|
|
1739
|
+
} catch (error2) {
|
|
1740
|
+
reject(error2);
|
|
1741
|
+
}
|
|
1742
|
+
} else {
|
|
1743
|
+
resolve(returnValue);
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
var isFlushing = false;
|
|
1748
|
+
function flushActQueue(queue) {
|
|
1749
|
+
{
|
|
1750
|
+
if (!isFlushing) {
|
|
1751
|
+
isFlushing = true;
|
|
1752
|
+
var i = 0;
|
|
1753
|
+
try {
|
|
1754
|
+
for (;i < queue.length; i++) {
|
|
1755
|
+
var callback = queue[i];
|
|
1756
|
+
do {
|
|
1757
|
+
callback = callback(true);
|
|
1758
|
+
} while (callback !== null);
|
|
1759
|
+
}
|
|
1760
|
+
queue.length = 0;
|
|
1761
|
+
} catch (error2) {
|
|
1762
|
+
queue = queue.slice(i + 1);
|
|
1763
|
+
throw error2;
|
|
1764
|
+
} finally {
|
|
1765
|
+
isFlushing = false;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
var createElement$1 = createElementWithValidation;
|
|
1771
|
+
var cloneElement$1 = cloneElementWithValidation;
|
|
1772
|
+
var createFactory = createFactoryWithValidation;
|
|
1773
|
+
var Children = {
|
|
1774
|
+
map: mapChildren,
|
|
1775
|
+
forEach: forEachChildren,
|
|
1776
|
+
count: countChildren,
|
|
1777
|
+
toArray,
|
|
1778
|
+
only: onlyChild
|
|
1779
|
+
};
|
|
1780
|
+
exports.Children = Children;
|
|
1781
|
+
exports.Component = Component;
|
|
1782
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
1783
|
+
exports.Profiler = REACT_PROFILER_TYPE;
|
|
1784
|
+
exports.PureComponent = PureComponent;
|
|
1785
|
+
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1786
|
+
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
1787
|
+
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
1788
|
+
exports.act = act;
|
|
1789
|
+
exports.cloneElement = cloneElement$1;
|
|
1790
|
+
exports.createContext = createContext;
|
|
1791
|
+
exports.createElement = createElement$1;
|
|
1792
|
+
exports.createFactory = createFactory;
|
|
1793
|
+
exports.createRef = createRef;
|
|
1794
|
+
exports.forwardRef = forwardRef;
|
|
1795
|
+
exports.isValidElement = isValidElement;
|
|
1796
|
+
exports.lazy = lazy;
|
|
1797
|
+
exports.memo = memo;
|
|
1798
|
+
exports.startTransition = startTransition;
|
|
1799
|
+
exports.unstable_act = act;
|
|
1800
|
+
exports.useCallback = useCallback;
|
|
1801
|
+
exports.useContext = useContext;
|
|
1802
|
+
exports.useDebugValue = useDebugValue;
|
|
1803
|
+
exports.useDeferredValue = useDeferredValue;
|
|
1804
|
+
exports.useEffect = useEffect;
|
|
1805
|
+
exports.useId = useId;
|
|
1806
|
+
exports.useImperativeHandle = useImperativeHandle;
|
|
1807
|
+
exports.useInsertionEffect = useInsertionEffect;
|
|
1808
|
+
exports.useLayoutEffect = useLayoutEffect;
|
|
1809
|
+
exports.useMemo = useMemo;
|
|
1810
|
+
exports.useReducer = useReducer;
|
|
1811
|
+
exports.useRef = useRef;
|
|
1812
|
+
exports.useState = useState;
|
|
1813
|
+
exports.useSyncExternalStore = useSyncExternalStore;
|
|
1814
|
+
exports.useTransition = useTransition;
|
|
1815
|
+
exports.version = ReactVersion;
|
|
1816
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
1817
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error);
|
|
1818
|
+
}
|
|
1819
|
+
})();
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
1822
|
+
|
|
1823
|
+
// ../../node_modules/.bun/react@18.3.1/node_modules/react/index.js
|
|
1824
|
+
var require_react = __commonJS((exports, module) => {
|
|
1825
|
+
var react_development = __toESM(require_react_development());
|
|
1826
|
+
if (false) {} else {
|
|
1827
|
+
module.exports = react_development;
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
|
|
1831
|
+
// ../../node_modules/.bun/react@18.3.1/node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
|
1832
|
+
var require_react_jsx_dev_runtime_development = __commonJS((exports) => {
|
|
1833
|
+
var React = __toESM(require_react());
|
|
1834
|
+
if (true) {
|
|
1835
|
+
(function() {
|
|
1836
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
1837
|
+
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
1838
|
+
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
1839
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
1840
|
+
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
1841
|
+
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
|
1842
|
+
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
1843
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
1844
|
+
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
1845
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
|
1846
|
+
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
1847
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
1848
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
1849
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
1850
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
1851
|
+
function getIteratorFn(maybeIterable) {
|
|
1852
|
+
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
1853
|
+
return null;
|
|
1854
|
+
}
|
|
1855
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
1856
|
+
if (typeof maybeIterator === "function") {
|
|
1857
|
+
return maybeIterator;
|
|
1858
|
+
}
|
|
1859
|
+
return null;
|
|
1860
|
+
}
|
|
1861
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1862
|
+
function error(format) {
|
|
1863
|
+
{
|
|
1864
|
+
{
|
|
1865
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1;_key2 < _len2; _key2++) {
|
|
1866
|
+
args[_key2 - 1] = arguments[_key2];
|
|
1867
|
+
}
|
|
1868
|
+
printWarning("error", format, args);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
function printWarning(level, format, args) {
|
|
1873
|
+
{
|
|
1874
|
+
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1875
|
+
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
1876
|
+
if (stack !== "") {
|
|
1877
|
+
format += "%s";
|
|
1878
|
+
args = args.concat([stack]);
|
|
1879
|
+
}
|
|
1880
|
+
var argsWithFormat = args.map(function(item) {
|
|
1881
|
+
return String(item);
|
|
1882
|
+
});
|
|
1883
|
+
argsWithFormat.unshift("Warning: " + format);
|
|
1884
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
var enableScopeAPI = false;
|
|
1888
|
+
var enableCacheElement = false;
|
|
1889
|
+
var enableTransitionTracing = false;
|
|
1890
|
+
var enableLegacyHidden = false;
|
|
1891
|
+
var enableDebugTracing = false;
|
|
1892
|
+
var REACT_MODULE_REFERENCE;
|
|
1893
|
+
{
|
|
1894
|
+
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
1895
|
+
}
|
|
1896
|
+
function isValidElementType(type) {
|
|
1897
|
+
if (typeof type === "string" || typeof type === "function") {
|
|
1898
|
+
return true;
|
|
1899
|
+
}
|
|
1900
|
+
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) {
|
|
1901
|
+
return true;
|
|
1902
|
+
}
|
|
1903
|
+
if (typeof type === "object" && type !== null) {
|
|
1904
|
+
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 !== undefined) {
|
|
1905
|
+
return true;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
return false;
|
|
1909
|
+
}
|
|
1910
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
1911
|
+
var displayName = outerType.displayName;
|
|
1912
|
+
if (displayName) {
|
|
1913
|
+
return displayName;
|
|
1914
|
+
}
|
|
1915
|
+
var functionName = innerType.displayName || innerType.name || "";
|
|
1916
|
+
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
1917
|
+
}
|
|
1918
|
+
function getContextName(type) {
|
|
1919
|
+
return type.displayName || "Context";
|
|
1920
|
+
}
|
|
1921
|
+
function getComponentNameFromType(type) {
|
|
1922
|
+
if (type == null) {
|
|
1923
|
+
return null;
|
|
1924
|
+
}
|
|
1925
|
+
{
|
|
1926
|
+
if (typeof type.tag === "number") {
|
|
1927
|
+
error("Received an unexpected object in getComponentNameFromType(). " + "This is likely a bug in React. Please file an issue.");
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
if (typeof type === "function") {
|
|
1931
|
+
return type.displayName || type.name || null;
|
|
1932
|
+
}
|
|
1933
|
+
if (typeof type === "string") {
|
|
1934
|
+
return type;
|
|
1935
|
+
}
|
|
1936
|
+
switch (type) {
|
|
1937
|
+
case REACT_FRAGMENT_TYPE:
|
|
1938
|
+
return "Fragment";
|
|
1939
|
+
case REACT_PORTAL_TYPE:
|
|
1940
|
+
return "Portal";
|
|
1941
|
+
case REACT_PROFILER_TYPE:
|
|
1942
|
+
return "Profiler";
|
|
1943
|
+
case REACT_STRICT_MODE_TYPE:
|
|
1944
|
+
return "StrictMode";
|
|
1945
|
+
case REACT_SUSPENSE_TYPE:
|
|
1946
|
+
return "Suspense";
|
|
1947
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
1948
|
+
return "SuspenseList";
|
|
1949
|
+
}
|
|
1950
|
+
if (typeof type === "object") {
|
|
1951
|
+
switch (type.$$typeof) {
|
|
1952
|
+
case REACT_CONTEXT_TYPE:
|
|
1953
|
+
var context = type;
|
|
1954
|
+
return getContextName(context) + ".Consumer";
|
|
1955
|
+
case REACT_PROVIDER_TYPE:
|
|
1956
|
+
var provider = type;
|
|
1957
|
+
return getContextName(provider._context) + ".Provider";
|
|
1958
|
+
case REACT_FORWARD_REF_TYPE:
|
|
1959
|
+
return getWrappedName(type, type.render, "ForwardRef");
|
|
1960
|
+
case REACT_MEMO_TYPE:
|
|
1961
|
+
var outerName = type.displayName || null;
|
|
1962
|
+
if (outerName !== null) {
|
|
1963
|
+
return outerName;
|
|
1964
|
+
}
|
|
1965
|
+
return getComponentNameFromType(type.type) || "Memo";
|
|
1966
|
+
case REACT_LAZY_TYPE: {
|
|
1967
|
+
var lazyComponent = type;
|
|
1968
|
+
var payload = lazyComponent._payload;
|
|
1969
|
+
var init = lazyComponent._init;
|
|
1970
|
+
try {
|
|
1971
|
+
return getComponentNameFromType(init(payload));
|
|
1972
|
+
} catch (x) {
|
|
1973
|
+
return null;
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
return null;
|
|
1979
|
+
}
|
|
1980
|
+
var assign = Object.assign;
|
|
1981
|
+
var disabledDepth = 0;
|
|
1982
|
+
var prevLog;
|
|
1983
|
+
var prevInfo;
|
|
1984
|
+
var prevWarn;
|
|
1985
|
+
var prevError;
|
|
1986
|
+
var prevGroup;
|
|
1987
|
+
var prevGroupCollapsed;
|
|
1988
|
+
var prevGroupEnd;
|
|
1989
|
+
function disabledLog() {}
|
|
1990
|
+
disabledLog.__reactDisabledLog = true;
|
|
1991
|
+
function disableLogs() {
|
|
1992
|
+
{
|
|
1993
|
+
if (disabledDepth === 0) {
|
|
1994
|
+
prevLog = console.log;
|
|
1995
|
+
prevInfo = console.info;
|
|
1996
|
+
prevWarn = console.warn;
|
|
1997
|
+
prevError = console.error;
|
|
1998
|
+
prevGroup = console.group;
|
|
1999
|
+
prevGroupCollapsed = console.groupCollapsed;
|
|
2000
|
+
prevGroupEnd = console.groupEnd;
|
|
2001
|
+
var props = {
|
|
2002
|
+
configurable: true,
|
|
2003
|
+
enumerable: true,
|
|
2004
|
+
value: disabledLog,
|
|
2005
|
+
writable: true
|
|
2006
|
+
};
|
|
2007
|
+
Object.defineProperties(console, {
|
|
2008
|
+
info: props,
|
|
2009
|
+
log: props,
|
|
2010
|
+
warn: props,
|
|
2011
|
+
error: props,
|
|
2012
|
+
group: props,
|
|
2013
|
+
groupCollapsed: props,
|
|
2014
|
+
groupEnd: props
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
disabledDepth++;
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
function reenableLogs() {
|
|
2021
|
+
{
|
|
2022
|
+
disabledDepth--;
|
|
2023
|
+
if (disabledDepth === 0) {
|
|
2024
|
+
var props = {
|
|
2025
|
+
configurable: true,
|
|
2026
|
+
enumerable: true,
|
|
2027
|
+
writable: true
|
|
2028
|
+
};
|
|
2029
|
+
Object.defineProperties(console, {
|
|
2030
|
+
log: assign({}, props, {
|
|
2031
|
+
value: prevLog
|
|
2032
|
+
}),
|
|
2033
|
+
info: assign({}, props, {
|
|
2034
|
+
value: prevInfo
|
|
2035
|
+
}),
|
|
2036
|
+
warn: assign({}, props, {
|
|
2037
|
+
value: prevWarn
|
|
2038
|
+
}),
|
|
2039
|
+
error: assign({}, props, {
|
|
2040
|
+
value: prevError
|
|
2041
|
+
}),
|
|
2042
|
+
group: assign({}, props, {
|
|
2043
|
+
value: prevGroup
|
|
2044
|
+
}),
|
|
2045
|
+
groupCollapsed: assign({}, props, {
|
|
2046
|
+
value: prevGroupCollapsed
|
|
2047
|
+
}),
|
|
2048
|
+
groupEnd: assign({}, props, {
|
|
2049
|
+
value: prevGroupEnd
|
|
2050
|
+
})
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
if (disabledDepth < 0) {
|
|
2054
|
+
error("disabledDepth fell below zero. " + "This is a bug in React. Please file an issue.");
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
2059
|
+
var prefix;
|
|
2060
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
2061
|
+
{
|
|
2062
|
+
if (prefix === undefined) {
|
|
2063
|
+
try {
|
|
2064
|
+
throw Error();
|
|
2065
|
+
} catch (x) {
|
|
2066
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
2067
|
+
prefix = match && match[1] || "";
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
return `
|
|
2071
|
+
` + prefix + name;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
var reentry = false;
|
|
2075
|
+
var componentFrameCache;
|
|
2076
|
+
{
|
|
2077
|
+
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
|
2078
|
+
componentFrameCache = new PossiblyWeakMap;
|
|
2079
|
+
}
|
|
2080
|
+
function describeNativeComponentFrame(fn, construct) {
|
|
2081
|
+
if (!fn || reentry) {
|
|
2082
|
+
return "";
|
|
2083
|
+
}
|
|
2084
|
+
{
|
|
2085
|
+
var frame = componentFrameCache.get(fn);
|
|
2086
|
+
if (frame !== undefined) {
|
|
2087
|
+
return frame;
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
var control;
|
|
2091
|
+
reentry = true;
|
|
2092
|
+
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
2093
|
+
Error.prepareStackTrace = undefined;
|
|
2094
|
+
var previousDispatcher;
|
|
2095
|
+
{
|
|
2096
|
+
previousDispatcher = ReactCurrentDispatcher.current;
|
|
2097
|
+
ReactCurrentDispatcher.current = null;
|
|
2098
|
+
disableLogs();
|
|
2099
|
+
}
|
|
2100
|
+
try {
|
|
2101
|
+
if (construct) {
|
|
2102
|
+
var Fake = function() {
|
|
2103
|
+
throw Error();
|
|
2104
|
+
};
|
|
2105
|
+
Object.defineProperty(Fake.prototype, "props", {
|
|
2106
|
+
set: function() {
|
|
2107
|
+
throw Error();
|
|
2108
|
+
}
|
|
2109
|
+
});
|
|
2110
|
+
if (typeof Reflect === "object" && Reflect.construct) {
|
|
2111
|
+
try {
|
|
2112
|
+
Reflect.construct(Fake, []);
|
|
2113
|
+
} catch (x) {
|
|
2114
|
+
control = x;
|
|
2115
|
+
}
|
|
2116
|
+
Reflect.construct(fn, [], Fake);
|
|
2117
|
+
} else {
|
|
2118
|
+
try {
|
|
2119
|
+
Fake.call();
|
|
2120
|
+
} catch (x) {
|
|
2121
|
+
control = x;
|
|
2122
|
+
}
|
|
2123
|
+
fn.call(Fake.prototype);
|
|
2124
|
+
}
|
|
2125
|
+
} else {
|
|
2126
|
+
try {
|
|
2127
|
+
throw Error();
|
|
2128
|
+
} catch (x) {
|
|
2129
|
+
control = x;
|
|
2130
|
+
}
|
|
2131
|
+
fn();
|
|
2132
|
+
}
|
|
2133
|
+
} catch (sample) {
|
|
2134
|
+
if (sample && control && typeof sample.stack === "string") {
|
|
2135
|
+
var sampleLines = sample.stack.split(`
|
|
2136
|
+
`);
|
|
2137
|
+
var controlLines = control.stack.split(`
|
|
2138
|
+
`);
|
|
2139
|
+
var s = sampleLines.length - 1;
|
|
2140
|
+
var c = controlLines.length - 1;
|
|
2141
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
2142
|
+
c--;
|
|
2143
|
+
}
|
|
2144
|
+
for (;s >= 1 && c >= 0; s--, c--) {
|
|
2145
|
+
if (sampleLines[s] !== controlLines[c]) {
|
|
2146
|
+
if (s !== 1 || c !== 1) {
|
|
2147
|
+
do {
|
|
2148
|
+
s--;
|
|
2149
|
+
c--;
|
|
2150
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
2151
|
+
var _frame = `
|
|
2152
|
+
` + sampleLines[s].replace(" at new ", " at ");
|
|
2153
|
+
if (fn.displayName && _frame.includes("<anonymous>")) {
|
|
2154
|
+
_frame = _frame.replace("<anonymous>", fn.displayName);
|
|
2155
|
+
}
|
|
2156
|
+
{
|
|
2157
|
+
if (typeof fn === "function") {
|
|
2158
|
+
componentFrameCache.set(fn, _frame);
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
return _frame;
|
|
2162
|
+
}
|
|
2163
|
+
} while (s >= 1 && c >= 0);
|
|
2164
|
+
}
|
|
2165
|
+
break;
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
} finally {
|
|
2170
|
+
reentry = false;
|
|
2171
|
+
{
|
|
2172
|
+
ReactCurrentDispatcher.current = previousDispatcher;
|
|
2173
|
+
reenableLogs();
|
|
2174
|
+
}
|
|
2175
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
2176
|
+
}
|
|
2177
|
+
var name = fn ? fn.displayName || fn.name : "";
|
|
2178
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
2179
|
+
{
|
|
2180
|
+
if (typeof fn === "function") {
|
|
2181
|
+
componentFrameCache.set(fn, syntheticFrame);
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
return syntheticFrame;
|
|
2185
|
+
}
|
|
2186
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
2187
|
+
{
|
|
2188
|
+
return describeNativeComponentFrame(fn, false);
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
function shouldConstruct(Component) {
|
|
2192
|
+
var prototype = Component.prototype;
|
|
2193
|
+
return !!(prototype && prototype.isReactComponent);
|
|
2194
|
+
}
|
|
2195
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
2196
|
+
if (type == null) {
|
|
2197
|
+
return "";
|
|
2198
|
+
}
|
|
2199
|
+
if (typeof type === "function") {
|
|
2200
|
+
{
|
|
2201
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
if (typeof type === "string") {
|
|
2205
|
+
return describeBuiltInComponentFrame(type);
|
|
2206
|
+
}
|
|
2207
|
+
switch (type) {
|
|
2208
|
+
case REACT_SUSPENSE_TYPE:
|
|
2209
|
+
return describeBuiltInComponentFrame("Suspense");
|
|
2210
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
2211
|
+
return describeBuiltInComponentFrame("SuspenseList");
|
|
2212
|
+
}
|
|
2213
|
+
if (typeof type === "object") {
|
|
2214
|
+
switch (type.$$typeof) {
|
|
2215
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2216
|
+
return describeFunctionComponentFrame(type.render);
|
|
2217
|
+
case REACT_MEMO_TYPE:
|
|
2218
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
2219
|
+
case REACT_LAZY_TYPE: {
|
|
2220
|
+
var lazyComponent = type;
|
|
2221
|
+
var payload = lazyComponent._payload;
|
|
2222
|
+
var init = lazyComponent._init;
|
|
2223
|
+
try {
|
|
2224
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
2225
|
+
} catch (x) {}
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
return "";
|
|
2230
|
+
}
|
|
2231
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2232
|
+
var loggedTypeFailures = {};
|
|
2233
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
2234
|
+
function setCurrentlyValidatingElement(element) {
|
|
2235
|
+
{
|
|
2236
|
+
if (element) {
|
|
2237
|
+
var owner = element._owner;
|
|
2238
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2239
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
2240
|
+
} else {
|
|
2241
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
2246
|
+
{
|
|
2247
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
2248
|
+
for (var typeSpecName in typeSpecs) {
|
|
2249
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
2250
|
+
var error$1 = undefined;
|
|
2251
|
+
try {
|
|
2252
|
+
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
2253
|
+
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`.");
|
|
2254
|
+
err.name = "Invariant Violation";
|
|
2255
|
+
throw err;
|
|
2256
|
+
}
|
|
2257
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
2258
|
+
} catch (ex) {
|
|
2259
|
+
error$1 = ex;
|
|
2260
|
+
}
|
|
2261
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
2262
|
+
setCurrentlyValidatingElement(element);
|
|
2263
|
+
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);
|
|
2264
|
+
setCurrentlyValidatingElement(null);
|
|
2265
|
+
}
|
|
2266
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
2267
|
+
loggedTypeFailures[error$1.message] = true;
|
|
2268
|
+
setCurrentlyValidatingElement(element);
|
|
2269
|
+
error("Failed %s type: %s", location, error$1.message);
|
|
2270
|
+
setCurrentlyValidatingElement(null);
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
var isArrayImpl = Array.isArray;
|
|
2277
|
+
function isArray(a) {
|
|
2278
|
+
return isArrayImpl(a);
|
|
2279
|
+
}
|
|
2280
|
+
function typeName(value) {
|
|
2281
|
+
{
|
|
2282
|
+
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
|
2283
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
2284
|
+
return type;
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
function willCoercionThrow(value) {
|
|
2288
|
+
{
|
|
2289
|
+
try {
|
|
2290
|
+
testStringCoercion(value);
|
|
2291
|
+
return false;
|
|
2292
|
+
} catch (e) {
|
|
2293
|
+
return true;
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
function testStringCoercion(value) {
|
|
2298
|
+
return "" + value;
|
|
2299
|
+
}
|
|
2300
|
+
function checkKeyStringCoercion(value) {
|
|
2301
|
+
{
|
|
2302
|
+
if (willCoercionThrow(value)) {
|
|
2303
|
+
error("The provided key is an unsupported type %s." + " This value must be coerced to a string before before using it here.", typeName(value));
|
|
2304
|
+
return testStringCoercion(value);
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
2309
|
+
var RESERVED_PROPS = {
|
|
2310
|
+
key: true,
|
|
2311
|
+
ref: true,
|
|
2312
|
+
__self: true,
|
|
2313
|
+
__source: true
|
|
2314
|
+
};
|
|
2315
|
+
var specialPropKeyWarningShown;
|
|
2316
|
+
var specialPropRefWarningShown;
|
|
2317
|
+
var didWarnAboutStringRefs;
|
|
2318
|
+
{
|
|
2319
|
+
didWarnAboutStringRefs = {};
|
|
2320
|
+
}
|
|
2321
|
+
function hasValidRef(config) {
|
|
2322
|
+
{
|
|
2323
|
+
if (hasOwnProperty.call(config, "ref")) {
|
|
2324
|
+
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
|
2325
|
+
if (getter && getter.isReactWarning) {
|
|
2326
|
+
return false;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
return config.ref !== undefined;
|
|
2331
|
+
}
|
|
2332
|
+
function hasValidKey(config) {
|
|
2333
|
+
{
|
|
2334
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
2335
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
2336
|
+
if (getter && getter.isReactWarning) {
|
|
2337
|
+
return false;
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
return config.key !== undefined;
|
|
2342
|
+
}
|
|
2343
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
2344
|
+
{
|
|
2345
|
+
if (typeof config.ref === "string" && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
2346
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
2347
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
2348
|
+
error('Component "%s" contains the string ref "%s". ' + "Support for string refs will be removed in a future major release. " + "This case cannot be automatically converted to an arrow function. " + "We ask you to manually fix this case by using useRef() or createRef() instead. " + "Learn more about using refs safely here: " + "https://reactjs.org/link/strict-mode-string-ref", getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
|
2349
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
2355
|
+
{
|
|
2356
|
+
var warnAboutAccessingKey = function() {
|
|
2357
|
+
if (!specialPropKeyWarningShown) {
|
|
2358
|
+
specialPropKeyWarningShown = true;
|
|
2359
|
+
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);
|
|
2360
|
+
}
|
|
2361
|
+
};
|
|
2362
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
2363
|
+
Object.defineProperty(props, "key", {
|
|
2364
|
+
get: warnAboutAccessingKey,
|
|
2365
|
+
configurable: true
|
|
2366
|
+
});
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
2370
|
+
{
|
|
2371
|
+
var warnAboutAccessingRef = function() {
|
|
2372
|
+
if (!specialPropRefWarningShown) {
|
|
2373
|
+
specialPropRefWarningShown = true;
|
|
2374
|
+
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);
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2377
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
2378
|
+
Object.defineProperty(props, "ref", {
|
|
2379
|
+
get: warnAboutAccessingRef,
|
|
2380
|
+
configurable: true
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
|
2385
|
+
var element = {
|
|
2386
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
2387
|
+
type,
|
|
2388
|
+
key,
|
|
2389
|
+
ref,
|
|
2390
|
+
props,
|
|
2391
|
+
_owner: owner
|
|
2392
|
+
};
|
|
2393
|
+
{
|
|
2394
|
+
element._store = {};
|
|
2395
|
+
Object.defineProperty(element._store, "validated", {
|
|
2396
|
+
configurable: false,
|
|
2397
|
+
enumerable: false,
|
|
2398
|
+
writable: true,
|
|
2399
|
+
value: false
|
|
2400
|
+
});
|
|
2401
|
+
Object.defineProperty(element, "_self", {
|
|
2402
|
+
configurable: false,
|
|
2403
|
+
enumerable: false,
|
|
2404
|
+
writable: false,
|
|
2405
|
+
value: self
|
|
2406
|
+
});
|
|
2407
|
+
Object.defineProperty(element, "_source", {
|
|
2408
|
+
configurable: false,
|
|
2409
|
+
enumerable: false,
|
|
2410
|
+
writable: false,
|
|
2411
|
+
value: source
|
|
2412
|
+
});
|
|
2413
|
+
if (Object.freeze) {
|
|
2414
|
+
Object.freeze(element.props);
|
|
2415
|
+
Object.freeze(element);
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
return element;
|
|
2419
|
+
};
|
|
2420
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
2421
|
+
{
|
|
2422
|
+
var propName;
|
|
2423
|
+
var props = {};
|
|
2424
|
+
var key = null;
|
|
2425
|
+
var ref = null;
|
|
2426
|
+
if (maybeKey !== undefined) {
|
|
2427
|
+
{
|
|
2428
|
+
checkKeyStringCoercion(maybeKey);
|
|
2429
|
+
}
|
|
2430
|
+
key = "" + maybeKey;
|
|
2431
|
+
}
|
|
2432
|
+
if (hasValidKey(config)) {
|
|
2433
|
+
{
|
|
2434
|
+
checkKeyStringCoercion(config.key);
|
|
2435
|
+
}
|
|
2436
|
+
key = "" + config.key;
|
|
2437
|
+
}
|
|
2438
|
+
if (hasValidRef(config)) {
|
|
2439
|
+
ref = config.ref;
|
|
2440
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
2441
|
+
}
|
|
2442
|
+
for (propName in config) {
|
|
2443
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
2444
|
+
props[propName] = config[propName];
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
if (type && type.defaultProps) {
|
|
2448
|
+
var defaultProps = type.defaultProps;
|
|
2449
|
+
for (propName in defaultProps) {
|
|
2450
|
+
if (props[propName] === undefined) {
|
|
2451
|
+
props[propName] = defaultProps[propName];
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
if (key || ref) {
|
|
2456
|
+
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
2457
|
+
if (key) {
|
|
2458
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
2459
|
+
}
|
|
2460
|
+
if (ref) {
|
|
2461
|
+
defineRefPropWarningGetter(props, displayName);
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
2468
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
2469
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
2470
|
+
{
|
|
2471
|
+
if (element) {
|
|
2472
|
+
var owner = element._owner;
|
|
2473
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2474
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
2475
|
+
} else {
|
|
2476
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
var propTypesMisspellWarningShown;
|
|
2481
|
+
{
|
|
2482
|
+
propTypesMisspellWarningShown = false;
|
|
2483
|
+
}
|
|
2484
|
+
function isValidElement(object) {
|
|
2485
|
+
{
|
|
2486
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
function getDeclarationErrorAddendum() {
|
|
2490
|
+
{
|
|
2491
|
+
if (ReactCurrentOwner$1.current) {
|
|
2492
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
2493
|
+
if (name) {
|
|
2494
|
+
return `
|
|
2495
|
+
|
|
2496
|
+
Check the render method of \`` + name + "`.";
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
return "";
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
function getSourceInfoErrorAddendum(source) {
|
|
2503
|
+
{
|
|
2504
|
+
if (source !== undefined) {
|
|
2505
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
|
2506
|
+
var lineNumber = source.lineNumber;
|
|
2507
|
+
return `
|
|
2508
|
+
|
|
2509
|
+
Check your code at ` + fileName + ":" + lineNumber + ".";
|
|
2510
|
+
}
|
|
2511
|
+
return "";
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
var ownerHasKeyUseWarning = {};
|
|
2515
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
2516
|
+
{
|
|
2517
|
+
var info = getDeclarationErrorAddendum();
|
|
2518
|
+
if (!info) {
|
|
2519
|
+
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
2520
|
+
if (parentName) {
|
|
2521
|
+
info = `
|
|
2522
|
+
|
|
2523
|
+
Check the top-level render call using <` + parentName + ">.";
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
return info;
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
function validateExplicitKey(element, parentType) {
|
|
2530
|
+
{
|
|
2531
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
2532
|
+
return;
|
|
2533
|
+
}
|
|
2534
|
+
element._store.validated = true;
|
|
2535
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2536
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2537
|
+
return;
|
|
2538
|
+
}
|
|
2539
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
2540
|
+
var childOwner = "";
|
|
2541
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
2542
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
2543
|
+
}
|
|
2544
|
+
setCurrentlyValidatingElement$1(element);
|
|
2545
|
+
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);
|
|
2546
|
+
setCurrentlyValidatingElement$1(null);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
function validateChildKeys(node, parentType) {
|
|
2550
|
+
{
|
|
2551
|
+
if (typeof node !== "object") {
|
|
2552
|
+
return;
|
|
2553
|
+
}
|
|
2554
|
+
if (isArray(node)) {
|
|
2555
|
+
for (var i = 0;i < node.length; i++) {
|
|
2556
|
+
var child = node[i];
|
|
2557
|
+
if (isValidElement(child)) {
|
|
2558
|
+
validateExplicitKey(child, parentType);
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
} else if (isValidElement(node)) {
|
|
2562
|
+
if (node._store) {
|
|
2563
|
+
node._store.validated = true;
|
|
2564
|
+
}
|
|
2565
|
+
} else if (node) {
|
|
2566
|
+
var iteratorFn = getIteratorFn(node);
|
|
2567
|
+
if (typeof iteratorFn === "function") {
|
|
2568
|
+
if (iteratorFn !== node.entries) {
|
|
2569
|
+
var iterator = iteratorFn.call(node);
|
|
2570
|
+
var step;
|
|
2571
|
+
while (!(step = iterator.next()).done) {
|
|
2572
|
+
if (isValidElement(step.value)) {
|
|
2573
|
+
validateExplicitKey(step.value, parentType);
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
function validatePropTypes(element) {
|
|
2582
|
+
{
|
|
2583
|
+
var type = element.type;
|
|
2584
|
+
if (type === null || type === undefined || typeof type === "string") {
|
|
2585
|
+
return;
|
|
2586
|
+
}
|
|
2587
|
+
var propTypes;
|
|
2588
|
+
if (typeof type === "function") {
|
|
2589
|
+
propTypes = type.propTypes;
|
|
2590
|
+
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MEMO_TYPE)) {
|
|
2591
|
+
propTypes = type.propTypes;
|
|
2592
|
+
} else {
|
|
2593
|
+
return;
|
|
2594
|
+
}
|
|
2595
|
+
if (propTypes) {
|
|
2596
|
+
var name = getComponentNameFromType(type);
|
|
2597
|
+
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
2598
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2599
|
+
propTypesMisspellWarningShown = true;
|
|
2600
|
+
var _name = getComponentNameFromType(type);
|
|
2601
|
+
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
|
2602
|
+
}
|
|
2603
|
+
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
|
2604
|
+
error("getDefaultProps is only used on classic React.createClass " + "definitions. Use a static property named `defaultProps` instead.");
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
function validateFragmentProps(fragment) {
|
|
2609
|
+
{
|
|
2610
|
+
var keys = Object.keys(fragment.props);
|
|
2611
|
+
for (var i = 0;i < keys.length; i++) {
|
|
2612
|
+
var key = keys[i];
|
|
2613
|
+
if (key !== "children" && key !== "key") {
|
|
2614
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
2615
|
+
error("Invalid prop `%s` supplied to `React.Fragment`. " + "React.Fragment can only have `key` and `children` props.", key);
|
|
2616
|
+
setCurrentlyValidatingElement$1(null);
|
|
2617
|
+
break;
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
if (fragment.ref !== null) {
|
|
2621
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
2622
|
+
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
2623
|
+
setCurrentlyValidatingElement$1(null);
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
var didWarnAboutKeySpread = {};
|
|
2628
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
2629
|
+
{
|
|
2630
|
+
var validType = isValidElementType(type);
|
|
2631
|
+
if (!validType) {
|
|
2632
|
+
var info = "";
|
|
2633
|
+
if (type === undefined || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
|
2634
|
+
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.";
|
|
2635
|
+
}
|
|
2636
|
+
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
2637
|
+
if (sourceInfo) {
|
|
2638
|
+
info += sourceInfo;
|
|
2639
|
+
} else {
|
|
2640
|
+
info += getDeclarationErrorAddendum();
|
|
2641
|
+
}
|
|
2642
|
+
var typeString;
|
|
2643
|
+
if (type === null) {
|
|
2644
|
+
typeString = "null";
|
|
2645
|
+
} else if (isArray(type)) {
|
|
2646
|
+
typeString = "array";
|
|
2647
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2648
|
+
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
2649
|
+
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
2650
|
+
} else {
|
|
2651
|
+
typeString = typeof type;
|
|
2652
|
+
}
|
|
2653
|
+
error("React.jsx: type is invalid -- expected a string (for " + "built-in components) or a class/function (for composite " + "components) but got: %s.%s", typeString, info);
|
|
2654
|
+
}
|
|
2655
|
+
var element = jsxDEV(type, props, key, source, self);
|
|
2656
|
+
if (element == null) {
|
|
2657
|
+
return element;
|
|
2658
|
+
}
|
|
2659
|
+
if (validType) {
|
|
2660
|
+
var children = props.children;
|
|
2661
|
+
if (children !== undefined) {
|
|
2662
|
+
if (isStaticChildren) {
|
|
2663
|
+
if (isArray(children)) {
|
|
2664
|
+
for (var i = 0;i < children.length; i++) {
|
|
2665
|
+
validateChildKeys(children[i], type);
|
|
2666
|
+
}
|
|
2667
|
+
if (Object.freeze) {
|
|
2668
|
+
Object.freeze(children);
|
|
2669
|
+
}
|
|
2670
|
+
} else {
|
|
2671
|
+
error("React.jsx: Static children should always be an array. " + "You are likely explicitly calling React.jsxs or React.jsxDEV. " + "Use the Babel transform instead.");
|
|
2672
|
+
}
|
|
2673
|
+
} else {
|
|
2674
|
+
validateChildKeys(children, type);
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
{
|
|
2679
|
+
if (hasOwnProperty.call(props, "key")) {
|
|
2680
|
+
var componentName = getComponentNameFromType(type);
|
|
2681
|
+
var keys = Object.keys(props).filter(function(k) {
|
|
2682
|
+
return k !== "key";
|
|
2683
|
+
});
|
|
2684
|
+
var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
2685
|
+
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
2686
|
+
var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
|
|
2687
|
+
error(`A props object containing a "key" prop is being spread into JSX:
|
|
2688
|
+
` + ` let props = %s;
|
|
2689
|
+
` + ` <%s {...props} />
|
|
2690
|
+
` + `React keys must be passed directly to JSX without using spread:
|
|
2691
|
+
` + ` let props = %s;
|
|
2692
|
+
` + " <%s key={someKey} {...props} />", beforeExample, componentName, afterExample, componentName);
|
|
2693
|
+
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
2698
|
+
validateFragmentProps(element);
|
|
2699
|
+
} else {
|
|
2700
|
+
validatePropTypes(element);
|
|
2701
|
+
}
|
|
2702
|
+
return element;
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
var jsxDEV$1 = jsxWithValidation;
|
|
2706
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
2707
|
+
exports.jsxDEV = jsxDEV$1;
|
|
2708
|
+
})();
|
|
2709
|
+
}
|
|
2710
|
+
});
|
|
2711
|
+
|
|
2712
|
+
// ../../node_modules/.bun/react@18.3.1/node_modules/react/jsx-dev-runtime.js
|
|
2713
|
+
var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
2714
|
+
var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development());
|
|
2715
|
+
if (false) {} else {
|
|
2716
|
+
module.exports = react_jsx_dev_runtime_development;
|
|
2717
|
+
}
|
|
2718
|
+
});
|
|
2719
|
+
|
|
2720
|
+
// src/components/Image.tsx
|
|
2721
|
+
var import_react = __toESM(require_react(), 1);
|
|
2722
|
+
var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
|
|
2723
|
+
"use client";
|
|
2724
|
+
var defaultLoader = ({ src, width, quality }) => {
|
|
2725
|
+
const params = new URLSearchParams({
|
|
2726
|
+
src,
|
|
2727
|
+
w: width.toString()
|
|
2728
|
+
});
|
|
2729
|
+
if (quality) {
|
|
2730
|
+
params.set("q", quality.toString());
|
|
2731
|
+
}
|
|
2732
|
+
return `/_ereo/image?${params.toString()}`;
|
|
2733
|
+
};
|
|
2734
|
+
var DEFAULT_DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
2735
|
+
function generateSrcset(src, loader, width, quality, sizes) {
|
|
2736
|
+
let widths;
|
|
2737
|
+
if (width) {
|
|
2738
|
+
const maxWidth = width * 2;
|
|
2739
|
+
widths = DEFAULT_DEVICE_SIZES.filter((w) => w <= maxWidth);
|
|
2740
|
+
if (!widths.includes(width)) {
|
|
2741
|
+
widths.push(width);
|
|
2742
|
+
widths.sort((a, b) => a - b);
|
|
2743
|
+
}
|
|
2744
|
+
} else {
|
|
2745
|
+
widths = DEFAULT_DEVICE_SIZES;
|
|
2746
|
+
}
|
|
2747
|
+
return widths.map((w) => `${loader({ src, width: w, quality })} ${w}w`).join(", ");
|
|
2748
|
+
}
|
|
2749
|
+
function getBlurStyle(blurDataURL, dominantColor, placeholder) {
|
|
2750
|
+
if (placeholder === "blur" && blurDataURL) {
|
|
2751
|
+
return {
|
|
2752
|
+
backgroundImage: `url("${blurDataURL}")`,
|
|
2753
|
+
backgroundSize: "cover",
|
|
2754
|
+
backgroundPosition: "center",
|
|
2755
|
+
filter: "blur(20px)",
|
|
2756
|
+
transform: "scale(1.1)"
|
|
2757
|
+
};
|
|
2758
|
+
}
|
|
2759
|
+
if (placeholder === "color" && dominantColor) {
|
|
2760
|
+
return {
|
|
2761
|
+
backgroundColor: dominantColor
|
|
2762
|
+
};
|
|
2763
|
+
}
|
|
2764
|
+
if (placeholder === "shimmer") {
|
|
2765
|
+
return {
|
|
2766
|
+
background: `linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)`,
|
|
2767
|
+
backgroundSize: "200% 100%",
|
|
2768
|
+
animation: "ereo-shimmer 1.5s infinite"
|
|
2769
|
+
};
|
|
2770
|
+
}
|
|
2771
|
+
return {};
|
|
2772
|
+
}
|
|
2773
|
+
var Image = import_react.forwardRef(function Image2({
|
|
2774
|
+
src,
|
|
2775
|
+
alt,
|
|
2776
|
+
width: propWidth,
|
|
2777
|
+
height: propHeight,
|
|
2778
|
+
fill = false,
|
|
2779
|
+
objectFit = "cover",
|
|
2780
|
+
objectPosition = "center",
|
|
2781
|
+
aspectRatio,
|
|
2782
|
+
sizes,
|
|
2783
|
+
placeholder = "empty",
|
|
2784
|
+
blurDataURL: propBlurDataURL,
|
|
2785
|
+
quality = 80,
|
|
2786
|
+
priority = false,
|
|
2787
|
+
loading: propLoading,
|
|
2788
|
+
decoding = "async",
|
|
2789
|
+
loader = defaultLoader,
|
|
2790
|
+
unoptimized = false,
|
|
2791
|
+
onLoad,
|
|
2792
|
+
onError,
|
|
2793
|
+
className,
|
|
2794
|
+
style,
|
|
2795
|
+
...rest
|
|
2796
|
+
}, ref) {
|
|
2797
|
+
const [isLoaded, setIsLoaded] = import_react.useState(false);
|
|
2798
|
+
const [hasError, setHasError] = import_react.useState(false);
|
|
2799
|
+
const imgRef = import_react.useRef(null);
|
|
2800
|
+
const isStaticImport = typeof src === "object";
|
|
2801
|
+
const imgSrc = isStaticImport ? src.src : src;
|
|
2802
|
+
const imgWidth = propWidth ?? (isStaticImport ? src.width : undefined);
|
|
2803
|
+
const imgHeight = propHeight ?? (isStaticImport ? src.height : undefined);
|
|
2804
|
+
const blurDataURL = propBlurDataURL ?? (isStaticImport ? src.blurDataURL : undefined);
|
|
2805
|
+
const dominantColor = isStaticImport ? src.dominantColor : undefined;
|
|
2806
|
+
const loading = propLoading ?? (priority ? "eager" : "lazy");
|
|
2807
|
+
const optimizedSrc = import_react.useMemo(() => {
|
|
2808
|
+
if (unoptimized) {
|
|
2809
|
+
return imgSrc;
|
|
2810
|
+
}
|
|
2811
|
+
const targetWidth = imgWidth || 1200;
|
|
2812
|
+
return loader({ src: imgSrc, width: targetWidth, quality });
|
|
2813
|
+
}, [imgSrc, imgWidth, quality, loader, unoptimized]);
|
|
2814
|
+
const srcSet = import_react.useMemo(() => {
|
|
2815
|
+
if (unoptimized) {
|
|
2816
|
+
return;
|
|
2817
|
+
}
|
|
2818
|
+
return generateSrcset(imgSrc, loader, imgWidth, quality, sizes);
|
|
2819
|
+
}, [imgSrc, loader, imgWidth, quality, sizes, unoptimized]);
|
|
2820
|
+
const handleLoad = (event) => {
|
|
2821
|
+
setIsLoaded(true);
|
|
2822
|
+
onLoad?.(event);
|
|
2823
|
+
};
|
|
2824
|
+
const handleError = (event) => {
|
|
2825
|
+
setHasError(true);
|
|
2826
|
+
onError?.(event);
|
|
2827
|
+
};
|
|
2828
|
+
import_react.useEffect(() => {
|
|
2829
|
+
if (priority && typeof window !== "undefined") {
|
|
2830
|
+
const link = document.createElement("link");
|
|
2831
|
+
link.rel = "preload";
|
|
2832
|
+
link.as = "image";
|
|
2833
|
+
link.href = optimizedSrc;
|
|
2834
|
+
if (srcSet) {
|
|
2835
|
+
link.setAttribute("imagesrcset", srcSet);
|
|
2836
|
+
}
|
|
2837
|
+
if (sizes) {
|
|
2838
|
+
link.setAttribute("imagesizes", sizes);
|
|
2839
|
+
}
|
|
2840
|
+
document.head.appendChild(link);
|
|
2841
|
+
return () => {
|
|
2842
|
+
document.head.removeChild(link);
|
|
2843
|
+
};
|
|
2844
|
+
}
|
|
2845
|
+
}, [priority, optimizedSrc, srcSet, sizes]);
|
|
2846
|
+
const combinedRef = (node) => {
|
|
2847
|
+
imgRef.current = node;
|
|
2848
|
+
if (typeof ref === "function") {
|
|
2849
|
+
ref(node);
|
|
2850
|
+
} else if (ref) {
|
|
2851
|
+
ref.current = node;
|
|
2852
|
+
}
|
|
2853
|
+
};
|
|
2854
|
+
const containerStyle = fill ? {
|
|
2855
|
+
position: "absolute",
|
|
2856
|
+
top: 0,
|
|
2857
|
+
left: 0,
|
|
2858
|
+
right: 0,
|
|
2859
|
+
bottom: 0,
|
|
2860
|
+
width: "100%",
|
|
2861
|
+
height: "100%"
|
|
2862
|
+
} : {};
|
|
2863
|
+
const imageStyle = {
|
|
2864
|
+
...style,
|
|
2865
|
+
...fill ? {
|
|
2866
|
+
objectFit,
|
|
2867
|
+
objectPosition,
|
|
2868
|
+
width: "100%",
|
|
2869
|
+
height: "100%"
|
|
2870
|
+
} : {},
|
|
2871
|
+
...aspectRatio && !fill ? {
|
|
2872
|
+
aspectRatio,
|
|
2873
|
+
width: imgWidth || "100%",
|
|
2874
|
+
height: "auto"
|
|
2875
|
+
} : {}
|
|
2876
|
+
};
|
|
2877
|
+
const placeholderStyle = getBlurStyle(blurDataURL, dominantColor, placeholder);
|
|
2878
|
+
const showPlaceholder = placeholder !== "empty" && !isLoaded && !hasError;
|
|
2879
|
+
if (showPlaceholder || fill) {
|
|
2880
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("span", {
|
|
2881
|
+
style: {
|
|
2882
|
+
display: fill ? "block" : "inline-block",
|
|
2883
|
+
position: fill ? "absolute" : "relative",
|
|
2884
|
+
overflow: "hidden",
|
|
2885
|
+
...containerStyle,
|
|
2886
|
+
...aspectRatio && !fill ? { aspectRatio, width: imgWidth || "100%" } : {}
|
|
2887
|
+
},
|
|
2888
|
+
children: [
|
|
2889
|
+
showPlaceholder && /* @__PURE__ */ jsx_dev_runtime.jsxDEV("span", {
|
|
2890
|
+
style: {
|
|
2891
|
+
position: "absolute",
|
|
2892
|
+
top: 0,
|
|
2893
|
+
left: 0,
|
|
2894
|
+
right: 0,
|
|
2895
|
+
bottom: 0,
|
|
2896
|
+
...placeholderStyle,
|
|
2897
|
+
transition: "opacity 0.3s ease-out",
|
|
2898
|
+
opacity: isLoaded ? 0 : 1,
|
|
2899
|
+
pointerEvents: "none"
|
|
2900
|
+
},
|
|
2901
|
+
"aria-hidden": "true"
|
|
2902
|
+
}, undefined, false, undefined, this),
|
|
2903
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV("img", {
|
|
2904
|
+
ref: combinedRef,
|
|
2905
|
+
src: optimizedSrc,
|
|
2906
|
+
srcSet,
|
|
2907
|
+
sizes,
|
|
2908
|
+
alt,
|
|
2909
|
+
width: fill ? undefined : imgWidth,
|
|
2910
|
+
height: fill ? undefined : imgHeight,
|
|
2911
|
+
loading,
|
|
2912
|
+
decoding,
|
|
2913
|
+
onLoad: handleLoad,
|
|
2914
|
+
onError: handleError,
|
|
2915
|
+
className,
|
|
2916
|
+
style: {
|
|
2917
|
+
...imageStyle,
|
|
2918
|
+
transition: placeholder !== "empty" ? "opacity 0.3s ease-out" : undefined,
|
|
2919
|
+
opacity: showPlaceholder && !isLoaded ? 0 : 1
|
|
2920
|
+
},
|
|
2921
|
+
...rest
|
|
2922
|
+
}, undefined, false, undefined, this),
|
|
2923
|
+
placeholder === "shimmer" && /* @__PURE__ */ jsx_dev_runtime.jsxDEV("style", {
|
|
2924
|
+
children: `
|
|
2925
|
+
@keyframes ereo-shimmer {
|
|
2926
|
+
0% { background-position: -200% 0; }
|
|
2927
|
+
100% { background-position: 200% 0; }
|
|
2928
|
+
}
|
|
2929
|
+
`
|
|
2930
|
+
}, undefined, false, undefined, this)
|
|
2931
|
+
]
|
|
2932
|
+
}, undefined, true, undefined, this);
|
|
2933
|
+
}
|
|
2934
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("img", {
|
|
2935
|
+
ref: combinedRef,
|
|
2936
|
+
src: optimizedSrc,
|
|
2937
|
+
srcSet,
|
|
2938
|
+
sizes,
|
|
2939
|
+
alt,
|
|
2940
|
+
width: imgWidth,
|
|
2941
|
+
height: imgHeight,
|
|
2942
|
+
loading,
|
|
2943
|
+
decoding,
|
|
2944
|
+
onLoad: handleLoad,
|
|
2945
|
+
onError: handleError,
|
|
2946
|
+
className,
|
|
2947
|
+
style: imageStyle,
|
|
2948
|
+
...rest
|
|
2949
|
+
}, undefined, false, undefined, this);
|
|
2950
|
+
});
|
|
2951
|
+
Image.displayName = "Image";
|
|
2952
|
+
var Image_default = Image;
|
|
2953
|
+
// src/components/Picture.tsx
|
|
2954
|
+
var import_react2 = __toESM(require_react(), 1);
|
|
2955
|
+
var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
2956
|
+
"use client";
|
|
2957
|
+
var defaultLoader2 = ({ src, width, quality }) => {
|
|
2958
|
+
const params = new URLSearchParams({
|
|
2959
|
+
src,
|
|
2960
|
+
w: width.toString()
|
|
2961
|
+
});
|
|
2962
|
+
if (quality) {
|
|
2963
|
+
params.set("q", quality.toString());
|
|
2964
|
+
}
|
|
2965
|
+
return `/_ereo/image?${params.toString()}`;
|
|
2966
|
+
};
|
|
2967
|
+
var DEFAULT_DEVICE_SIZES2 = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
2968
|
+
function generateSrcset2(src, loader, width, quality) {
|
|
2969
|
+
let widths;
|
|
2970
|
+
if (width) {
|
|
2971
|
+
const maxWidth = width * 2;
|
|
2972
|
+
widths = DEFAULT_DEVICE_SIZES2.filter((w) => w <= maxWidth);
|
|
2973
|
+
if (!widths.includes(width)) {
|
|
2974
|
+
widths.push(width);
|
|
2975
|
+
widths.sort((a, b) => a - b);
|
|
2976
|
+
}
|
|
2977
|
+
} else {
|
|
2978
|
+
widths = DEFAULT_DEVICE_SIZES2;
|
|
2979
|
+
}
|
|
2980
|
+
return widths.map((w) => `${loader({ src, width: w, quality })} ${w}w`).join(", ");
|
|
2981
|
+
}
|
|
2982
|
+
function getSrc(source) {
|
|
2983
|
+
return typeof source === "object" ? source.src : source;
|
|
2984
|
+
}
|
|
2985
|
+
function getDimensions(source, propWidth, propHeight) {
|
|
2986
|
+
if (typeof source === "object") {
|
|
2987
|
+
return {
|
|
2988
|
+
width: propWidth ?? source.width,
|
|
2989
|
+
height: propHeight ?? source.height
|
|
2990
|
+
};
|
|
2991
|
+
}
|
|
2992
|
+
return { width: propWidth, height: propHeight };
|
|
2993
|
+
}
|
|
2994
|
+
function getBlurDataURL(source) {
|
|
2995
|
+
return typeof source === "object" ? source.blurDataURL : undefined;
|
|
2996
|
+
}
|
|
2997
|
+
var Picture = import_react2.forwardRef(function Picture2({
|
|
2998
|
+
sources,
|
|
2999
|
+
fallback,
|
|
3000
|
+
alt,
|
|
3001
|
+
width: propWidth,
|
|
3002
|
+
height: propHeight,
|
|
3003
|
+
fill = false,
|
|
3004
|
+
objectFit = "cover",
|
|
3005
|
+
objectPosition = "center",
|
|
3006
|
+
aspectRatio,
|
|
3007
|
+
sizes,
|
|
3008
|
+
placeholder = "empty",
|
|
3009
|
+
blurDataURL: propBlurDataURL,
|
|
3010
|
+
quality = 80,
|
|
3011
|
+
priority = false,
|
|
3012
|
+
loading: propLoading,
|
|
3013
|
+
decoding = "async",
|
|
3014
|
+
loader = defaultLoader2,
|
|
3015
|
+
unoptimized = false,
|
|
3016
|
+
onLoad,
|
|
3017
|
+
onError,
|
|
3018
|
+
className,
|
|
3019
|
+
style,
|
|
3020
|
+
...rest
|
|
3021
|
+
}, ref) {
|
|
3022
|
+
const [isLoaded, setIsLoaded] = import_react2.useState(false);
|
|
3023
|
+
const [hasError, setHasError] = import_react2.useState(false);
|
|
3024
|
+
const fallbackSource = fallback ?? sources[sources.length - 1]?.src;
|
|
3025
|
+
const fallbackSrc = fallbackSource ? getSrc(fallbackSource) : "";
|
|
3026
|
+
const { width: fallbackWidth, height: fallbackHeight } = getDimensions(fallbackSource || "", propWidth, propHeight);
|
|
3027
|
+
const blurDataURL = propBlurDataURL ?? (fallbackSource ? getBlurDataURL(fallbackSource) : undefined);
|
|
3028
|
+
const loading = propLoading ?? (priority ? "eager" : "lazy");
|
|
3029
|
+
const sourceElements = import_react2.useMemo(() => {
|
|
3030
|
+
return sources.map((source, index) => {
|
|
3031
|
+
const srcString = getSrc(source.src);
|
|
3032
|
+
const { width: sourceWidth } = getDimensions(source.src, source.width, source.height);
|
|
3033
|
+
const srcSet = unoptimized ? srcString : generateSrcset2(srcString, loader, sourceWidth, quality);
|
|
3034
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV("source", {
|
|
3035
|
+
srcSet,
|
|
3036
|
+
media: source.media,
|
|
3037
|
+
type: source.type,
|
|
3038
|
+
sizes: source.sizes ?? sizes
|
|
3039
|
+
}, index, false, undefined, this);
|
|
3040
|
+
});
|
|
3041
|
+
}, [sources, loader, quality, sizes, unoptimized]);
|
|
3042
|
+
const fallbackSrcSet = import_react2.useMemo(() => {
|
|
3043
|
+
if (unoptimized || !fallbackSrc) {
|
|
3044
|
+
return;
|
|
3045
|
+
}
|
|
3046
|
+
return generateSrcset2(fallbackSrc, loader, fallbackWidth, quality);
|
|
3047
|
+
}, [fallbackSrc, loader, fallbackWidth, quality, unoptimized]);
|
|
3048
|
+
const optimizedFallbackSrc = import_react2.useMemo(() => {
|
|
3049
|
+
if (unoptimized || !fallbackSrc) {
|
|
3050
|
+
return fallbackSrc;
|
|
3051
|
+
}
|
|
3052
|
+
const targetWidth = fallbackWidth || 1200;
|
|
3053
|
+
return loader({ src: fallbackSrc, width: targetWidth, quality });
|
|
3054
|
+
}, [fallbackSrc, fallbackWidth, quality, loader, unoptimized]);
|
|
3055
|
+
const handleLoad = (event) => {
|
|
3056
|
+
setIsLoaded(true);
|
|
3057
|
+
onLoad?.(event);
|
|
3058
|
+
};
|
|
3059
|
+
const handleError = (event) => {
|
|
3060
|
+
setHasError(true);
|
|
3061
|
+
onError?.(event);
|
|
3062
|
+
};
|
|
3063
|
+
const containerStyle = fill ? {
|
|
3064
|
+
position: "absolute",
|
|
3065
|
+
top: 0,
|
|
3066
|
+
left: 0,
|
|
3067
|
+
right: 0,
|
|
3068
|
+
bottom: 0,
|
|
3069
|
+
width: "100%",
|
|
3070
|
+
height: "100%"
|
|
3071
|
+
} : {};
|
|
3072
|
+
const imageStyle = {
|
|
3073
|
+
...style,
|
|
3074
|
+
...fill ? {
|
|
3075
|
+
objectFit,
|
|
3076
|
+
objectPosition,
|
|
3077
|
+
width: "100%",
|
|
3078
|
+
height: "100%"
|
|
3079
|
+
} : {},
|
|
3080
|
+
...aspectRatio && !fill ? {
|
|
3081
|
+
aspectRatio,
|
|
3082
|
+
width: fallbackWidth || "100%",
|
|
3083
|
+
height: "auto"
|
|
3084
|
+
} : {}
|
|
3085
|
+
};
|
|
3086
|
+
const getPlaceholderStyle = () => {
|
|
3087
|
+
if (placeholder === "blur" && blurDataURL) {
|
|
3088
|
+
return {
|
|
3089
|
+
backgroundImage: `url("${blurDataURL}")`,
|
|
3090
|
+
backgroundSize: "cover",
|
|
3091
|
+
backgroundPosition: "center",
|
|
3092
|
+
filter: "blur(20px)",
|
|
3093
|
+
transform: "scale(1.1)"
|
|
3094
|
+
};
|
|
3095
|
+
}
|
|
3096
|
+
if (placeholder === "shimmer") {
|
|
3097
|
+
return {
|
|
3098
|
+
background: `linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)`,
|
|
3099
|
+
backgroundSize: "200% 100%",
|
|
3100
|
+
animation: "ereo-shimmer 1.5s infinite"
|
|
3101
|
+
};
|
|
3102
|
+
}
|
|
3103
|
+
return {};
|
|
3104
|
+
};
|
|
3105
|
+
const showPlaceholder = placeholder !== "empty" && !isLoaded && !hasError;
|
|
3106
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV("span", {
|
|
3107
|
+
style: {
|
|
3108
|
+
display: fill ? "block" : "inline-block",
|
|
3109
|
+
position: fill ? "absolute" : "relative",
|
|
3110
|
+
overflow: "hidden",
|
|
3111
|
+
...containerStyle,
|
|
3112
|
+
...aspectRatio && !fill ? { aspectRatio, width: fallbackWidth || "100%" } : {}
|
|
3113
|
+
},
|
|
3114
|
+
children: [
|
|
3115
|
+
showPlaceholder && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV("span", {
|
|
3116
|
+
style: {
|
|
3117
|
+
position: "absolute",
|
|
3118
|
+
top: 0,
|
|
3119
|
+
left: 0,
|
|
3120
|
+
right: 0,
|
|
3121
|
+
bottom: 0,
|
|
3122
|
+
...getPlaceholderStyle(),
|
|
3123
|
+
transition: "opacity 0.3s ease-out",
|
|
3124
|
+
opacity: isLoaded ? 0 : 1,
|
|
3125
|
+
pointerEvents: "none"
|
|
3126
|
+
},
|
|
3127
|
+
"aria-hidden": "true"
|
|
3128
|
+
}, undefined, false, undefined, this),
|
|
3129
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV("picture", {
|
|
3130
|
+
children: [
|
|
3131
|
+
sourceElements,
|
|
3132
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV("img", {
|
|
3133
|
+
ref,
|
|
3134
|
+
src: optimizedFallbackSrc,
|
|
3135
|
+
srcSet: fallbackSrcSet,
|
|
3136
|
+
sizes,
|
|
3137
|
+
alt,
|
|
3138
|
+
width: fill ? undefined : fallbackWidth,
|
|
3139
|
+
height: fill ? undefined : fallbackHeight,
|
|
3140
|
+
loading,
|
|
3141
|
+
decoding,
|
|
3142
|
+
onLoad: handleLoad,
|
|
3143
|
+
onError: handleError,
|
|
3144
|
+
className,
|
|
3145
|
+
style: {
|
|
3146
|
+
...imageStyle,
|
|
3147
|
+
transition: placeholder !== "empty" ? "opacity 0.3s ease-out" : undefined,
|
|
3148
|
+
opacity: showPlaceholder && !isLoaded ? 0 : 1
|
|
3149
|
+
},
|
|
3150
|
+
...rest
|
|
3151
|
+
}, undefined, false, undefined, this)
|
|
3152
|
+
]
|
|
3153
|
+
}, undefined, true, undefined, this),
|
|
3154
|
+
placeholder === "shimmer" && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV("style", {
|
|
3155
|
+
children: `
|
|
3156
|
+
@keyframes ereo-shimmer {
|
|
3157
|
+
0% { background-position: -200% 0; }
|
|
3158
|
+
100% { background-position: 200% 0; }
|
|
3159
|
+
}
|
|
3160
|
+
`
|
|
3161
|
+
}, undefined, false, undefined, this)
|
|
3162
|
+
]
|
|
3163
|
+
}, undefined, true, undefined, this);
|
|
3164
|
+
});
|
|
3165
|
+
Picture.displayName = "Picture";
|
|
3166
|
+
var Picture_default = Picture;
|
|
3167
|
+
// src/plugin.ts
|
|
3168
|
+
import { join as join6, relative as relative3, extname as extname4 } from "path";
|
|
3169
|
+
import { readFile as readFile6 } from "fs/promises";
|
|
3170
|
+
|
|
3171
|
+
// src/config/defaults.ts
|
|
3172
|
+
var DEFAULT_DEVICE_SIZES3 = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
3173
|
+
var DEFAULT_IMAGE_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
3174
|
+
var ALL_SIZES = [...DEFAULT_IMAGE_SIZES, ...DEFAULT_DEVICE_SIZES3].sort((a, b) => a - b);
|
|
3175
|
+
var DEFAULT_QUALITY = 80;
|
|
3176
|
+
var MAX_DIMENSION = 3840;
|
|
3177
|
+
var DEFAULT_CACHE_TTL = 31536000;
|
|
3178
|
+
var BLUR_WIDTH = 8;
|
|
3179
|
+
var IMAGE_PATH_PREFIX = "/_ereo/image";
|
|
3180
|
+
var CACHE_DIR = ".ereo/images";
|
|
3181
|
+
var SUPPORTED_INPUT_FORMATS = ["jpeg", "jpg", "png", "webp", "avif", "gif", "svg"];
|
|
3182
|
+
var SUPPORTED_OUTPUT_FORMATS = ["webp", "avif", "jpeg", "png"];
|
|
3183
|
+
var FORMAT_MIME_TYPES = {
|
|
3184
|
+
webp: "image/webp",
|
|
3185
|
+
avif: "image/avif",
|
|
3186
|
+
jpeg: "image/jpeg",
|
|
3187
|
+
jpg: "image/jpeg",
|
|
3188
|
+
png: "image/png",
|
|
3189
|
+
gif: "image/gif",
|
|
3190
|
+
svg: "image/svg+xml"
|
|
3191
|
+
};
|
|
3192
|
+
var FORMAT_EXTENSIONS = {
|
|
3193
|
+
webp: ".webp",
|
|
3194
|
+
avif: ".avif",
|
|
3195
|
+
jpeg: ".jpg",
|
|
3196
|
+
jpg: ".jpg",
|
|
3197
|
+
png: ".png"
|
|
3198
|
+
};
|
|
3199
|
+
var DEFAULT_CONFIG = {
|
|
3200
|
+
remotePatterns: [],
|
|
3201
|
+
formats: {
|
|
3202
|
+
webp: true,
|
|
3203
|
+
avif: false,
|
|
3204
|
+
jpeg: true,
|
|
3205
|
+
png: true
|
|
3206
|
+
},
|
|
3207
|
+
quality: DEFAULT_QUALITY,
|
|
3208
|
+
sizes: {
|
|
3209
|
+
deviceSizes: DEFAULT_DEVICE_SIZES3,
|
|
3210
|
+
imageSizes: DEFAULT_IMAGE_SIZES
|
|
3211
|
+
},
|
|
3212
|
+
minimumCacheTTL: DEFAULT_CACHE_TTL,
|
|
3213
|
+
domains: [],
|
|
3214
|
+
cacheDir: CACHE_DIR,
|
|
3215
|
+
generateBlurPlaceholder: true,
|
|
3216
|
+
extractDominantColor: true,
|
|
3217
|
+
maxDimension: MAX_DIMENSION,
|
|
3218
|
+
path: IMAGE_PATH_PREFIX,
|
|
3219
|
+
dangerouslyAllowAllRemote: false
|
|
3220
|
+
};
|
|
3221
|
+
function getAllSizes(config) {
|
|
3222
|
+
const deviceSizes = config.sizes?.deviceSizes ?? DEFAULT_DEVICE_SIZES3;
|
|
3223
|
+
const imageSizes = config.sizes?.imageSizes ?? DEFAULT_IMAGE_SIZES;
|
|
3224
|
+
return [...imageSizes, ...deviceSizes].sort((a, b) => a - b);
|
|
3225
|
+
}
|
|
3226
|
+
function getSizesForWidth(targetWidth, config) {
|
|
3227
|
+
const allSizes = getAllSizes(config);
|
|
3228
|
+
const maxSize = targetWidth * 2;
|
|
3229
|
+
return allSizes.filter((size) => size <= maxSize);
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
// src/config/schema.ts
|
|
3233
|
+
class ConfigValidationError extends Error {
|
|
3234
|
+
field;
|
|
3235
|
+
value;
|
|
3236
|
+
constructor(message, field, value) {
|
|
3237
|
+
super(`Invalid configuration for '${field}': ${message}`);
|
|
3238
|
+
this.field = field;
|
|
3239
|
+
this.value = value;
|
|
3240
|
+
this.name = "ConfigValidationError";
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
function validateRemotePattern(pattern, index) {
|
|
3244
|
+
if (!pattern.hostname) {
|
|
3245
|
+
throw new ConfigValidationError("hostname is required", `remotePatterns[${index}].hostname`, pattern);
|
|
3246
|
+
}
|
|
3247
|
+
if (typeof pattern.hostname !== "string") {
|
|
3248
|
+
throw new ConfigValidationError("hostname must be a string", `remotePatterns[${index}].hostname`, pattern.hostname);
|
|
3249
|
+
}
|
|
3250
|
+
if (pattern.protocol && !["http", "https"].includes(pattern.protocol)) {
|
|
3251
|
+
throw new ConfigValidationError('protocol must be "http" or "https"', `remotePatterns[${index}].protocol`, pattern.protocol);
|
|
3252
|
+
}
|
|
3253
|
+
if (pattern.port && typeof pattern.port !== "string") {
|
|
3254
|
+
throw new ConfigValidationError("port must be a string", `remotePatterns[${index}].port`, pattern.port);
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
function validateQuality(quality) {
|
|
3258
|
+
if (quality === undefined) {
|
|
3259
|
+
return DEFAULT_CONFIG.quality;
|
|
3260
|
+
}
|
|
3261
|
+
if (typeof quality !== "number") {
|
|
3262
|
+
throw new ConfigValidationError("quality must be a number", "quality", quality);
|
|
3263
|
+
}
|
|
3264
|
+
if (quality < 1 || quality > 100) {
|
|
3265
|
+
throw new ConfigValidationError("quality must be between 1 and 100", "quality", quality);
|
|
3266
|
+
}
|
|
3267
|
+
return Math.round(quality);
|
|
3268
|
+
}
|
|
3269
|
+
function validateFormats(formats) {
|
|
3270
|
+
if (formats === undefined) {
|
|
3271
|
+
return DEFAULT_CONFIG.formats;
|
|
3272
|
+
}
|
|
3273
|
+
if (typeof formats !== "object" || formats === null) {
|
|
3274
|
+
throw new ConfigValidationError("formats must be an object", "formats", formats);
|
|
3275
|
+
}
|
|
3276
|
+
const validFormats = formats;
|
|
3277
|
+
const result = {};
|
|
3278
|
+
for (const format of SUPPORTED_OUTPUT_FORMATS) {
|
|
3279
|
+
if (format in validFormats) {
|
|
3280
|
+
if (typeof validFormats[format] !== "boolean") {
|
|
3281
|
+
throw new ConfigValidationError(`formats.${format} must be a boolean`, `formats.${format}`, validFormats[format]);
|
|
3282
|
+
}
|
|
3283
|
+
result[format] = validFormats[format];
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
return result;
|
|
3287
|
+
}
|
|
3288
|
+
function validateSizes(sizes) {
|
|
3289
|
+
if (sizes === undefined) {
|
|
3290
|
+
return DEFAULT_CONFIG.sizes;
|
|
3291
|
+
}
|
|
3292
|
+
if (typeof sizes !== "object" || sizes === null) {
|
|
3293
|
+
throw new ConfigValidationError("sizes must be an object", "sizes", sizes);
|
|
3294
|
+
}
|
|
3295
|
+
const sizesConfig = sizes;
|
|
3296
|
+
const result = {};
|
|
3297
|
+
if (sizesConfig.deviceSizes !== undefined) {
|
|
3298
|
+
if (!Array.isArray(sizesConfig.deviceSizes)) {
|
|
3299
|
+
throw new ConfigValidationError("deviceSizes must be an array", "sizes.deviceSizes", sizesConfig.deviceSizes);
|
|
3300
|
+
}
|
|
3301
|
+
for (let i = 0;i < sizesConfig.deviceSizes.length; i++) {
|
|
3302
|
+
const size = sizesConfig.deviceSizes[i];
|
|
3303
|
+
if (typeof size !== "number" || size <= 0 || size > MAX_DIMENSION) {
|
|
3304
|
+
throw new ConfigValidationError(`deviceSizes[${i}] must be a positive number <= ${MAX_DIMENSION}`, `sizes.deviceSizes[${i}]`, size);
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
result.deviceSizes = sizesConfig.deviceSizes;
|
|
3308
|
+
}
|
|
3309
|
+
if (sizesConfig.imageSizes !== undefined) {
|
|
3310
|
+
if (!Array.isArray(sizesConfig.imageSizes)) {
|
|
3311
|
+
throw new ConfigValidationError("imageSizes must be an array", "sizes.imageSizes", sizesConfig.imageSizes);
|
|
3312
|
+
}
|
|
3313
|
+
for (let i = 0;i < sizesConfig.imageSizes.length; i++) {
|
|
3314
|
+
const size = sizesConfig.imageSizes[i];
|
|
3315
|
+
if (typeof size !== "number" || size <= 0 || size > MAX_DIMENSION) {
|
|
3316
|
+
throw new ConfigValidationError(`imageSizes[${i}] must be a positive number <= ${MAX_DIMENSION}`, `sizes.imageSizes[${i}]`, size);
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
result.imageSizes = sizesConfig.imageSizes;
|
|
3320
|
+
}
|
|
3321
|
+
return result;
|
|
3322
|
+
}
|
|
3323
|
+
function validateConfig(config = {}) {
|
|
3324
|
+
if (config.remotePatterns) {
|
|
3325
|
+
if (!Array.isArray(config.remotePatterns)) {
|
|
3326
|
+
throw new ConfigValidationError("remotePatterns must be an array", "remotePatterns", config.remotePatterns);
|
|
3327
|
+
}
|
|
3328
|
+
config.remotePatterns.forEach((pattern, index) => validateRemotePattern(pattern, index));
|
|
3329
|
+
}
|
|
3330
|
+
if (config.domains) {
|
|
3331
|
+
if (!Array.isArray(config.domains)) {
|
|
3332
|
+
throw new ConfigValidationError("domains must be an array", "domains", config.domains);
|
|
3333
|
+
}
|
|
3334
|
+
for (const domain of config.domains) {
|
|
3335
|
+
if (typeof domain !== "string") {
|
|
3336
|
+
throw new ConfigValidationError("domains must be strings", "domains", domain);
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
console.warn('[@ereo/plugin-images] The "domains" option is deprecated. Use "remotePatterns" instead.');
|
|
3340
|
+
}
|
|
3341
|
+
const quality = validateQuality(config.quality);
|
|
3342
|
+
const formats = validateFormats(config.formats);
|
|
3343
|
+
const sizes = validateSizes(config.sizes);
|
|
3344
|
+
if (config.maxDimension !== undefined) {
|
|
3345
|
+
if (typeof config.maxDimension !== "number" || config.maxDimension <= 0) {
|
|
3346
|
+
throw new ConfigValidationError("maxDimension must be a positive number", "maxDimension", config.maxDimension);
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
if (config.path !== undefined) {
|
|
3350
|
+
if (typeof config.path !== "string" || !config.path.startsWith("/")) {
|
|
3351
|
+
throw new ConfigValidationError('path must be a string starting with "/"', "path", config.path);
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
if (config.cacheDir !== undefined) {
|
|
3355
|
+
if (typeof config.cacheDir !== "string") {
|
|
3356
|
+
throw new ConfigValidationError("cacheDir must be a string", "cacheDir", config.cacheDir);
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
return {
|
|
3360
|
+
...DEFAULT_CONFIG,
|
|
3361
|
+
...config,
|
|
3362
|
+
quality,
|
|
3363
|
+
formats: { ...DEFAULT_CONFIG.formats, ...formats },
|
|
3364
|
+
sizes: { ...DEFAULT_CONFIG.sizes, ...sizes }
|
|
3365
|
+
};
|
|
3366
|
+
}
|
|
3367
|
+
function matchesRemotePattern(url, patterns, domains = []) {
|
|
3368
|
+
if (domains.includes(url.hostname)) {
|
|
3369
|
+
return true;
|
|
3370
|
+
}
|
|
3371
|
+
for (const pattern of patterns) {
|
|
3372
|
+
if (pattern.protocol) {
|
|
3373
|
+
const urlProtocol = url.protocol.slice(0, -1);
|
|
3374
|
+
if (urlProtocol !== pattern.protocol) {
|
|
3375
|
+
continue;
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
const hostnamePattern = pattern.hostname.replace(/\./g, "\\.").replace(/\*/g, ".*");
|
|
3379
|
+
const hostnameRegex = new RegExp(`^${hostnamePattern}$`, "i");
|
|
3380
|
+
if (!hostnameRegex.test(url.hostname)) {
|
|
3381
|
+
continue;
|
|
3382
|
+
}
|
|
3383
|
+
if (pattern.port && url.port !== pattern.port) {
|
|
3384
|
+
continue;
|
|
3385
|
+
}
|
|
3386
|
+
if (pattern.pathname) {
|
|
3387
|
+
const pathnamePattern = pattern.pathname.replace(/\./g, "\\.").replace(/\*/g, ".*");
|
|
3388
|
+
const pathnameRegex = new RegExp(`^${pathnamePattern}`, "i");
|
|
3389
|
+
if (!pathnameRegex.test(url.pathname)) {
|
|
3390
|
+
continue;
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
return true;
|
|
3394
|
+
}
|
|
3395
|
+
return false;
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
// src/processing/processor.ts
|
|
3399
|
+
import { readFile } from "fs/promises";
|
|
3400
|
+
import { extname } from "path";
|
|
3401
|
+
|
|
3402
|
+
// src/processing/sharp-processor.ts
|
|
3403
|
+
import sharp from "sharp";
|
|
3404
|
+
class SharpProcessor {
|
|
3405
|
+
quality;
|
|
3406
|
+
maxDimension;
|
|
3407
|
+
constructor(options = {}) {
|
|
3408
|
+
this.quality = options.quality ?? DEFAULT_QUALITY;
|
|
3409
|
+
this.maxDimension = options.maxDimension ?? MAX_DIMENSION;
|
|
3410
|
+
if (options.cache === false) {
|
|
3411
|
+
sharp.cache(false);
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
async process(input, params) {
|
|
3415
|
+
const { width, height, quality = this.quality, format = "auto" } = params;
|
|
3416
|
+
if (width > this.maxDimension) {
|
|
3417
|
+
throw new Error(`Width ${width} exceeds maximum dimension ${this.maxDimension}`);
|
|
3418
|
+
}
|
|
3419
|
+
if (height && height > this.maxDimension) {
|
|
3420
|
+
throw new Error(`Height ${height} exceeds maximum dimension ${this.maxDimension}`);
|
|
3421
|
+
}
|
|
3422
|
+
let image = sharp(input);
|
|
3423
|
+
const metadata = await image.metadata();
|
|
3424
|
+
const resizeOptions = {
|
|
3425
|
+
width,
|
|
3426
|
+
height: height || undefined,
|
|
3427
|
+
fit: "inside",
|
|
3428
|
+
withoutEnlargement: true
|
|
3429
|
+
};
|
|
3430
|
+
image = image.resize(resizeOptions);
|
|
3431
|
+
let outputFormat;
|
|
3432
|
+
if (format === "auto") {
|
|
3433
|
+
outputFormat = "webp";
|
|
3434
|
+
} else {
|
|
3435
|
+
outputFormat = format;
|
|
3436
|
+
}
|
|
3437
|
+
switch (outputFormat) {
|
|
3438
|
+
case "webp":
|
|
3439
|
+
image = image.webp({
|
|
3440
|
+
quality,
|
|
3441
|
+
effort: 4,
|
|
3442
|
+
smartSubsample: true
|
|
3443
|
+
});
|
|
3444
|
+
break;
|
|
3445
|
+
case "avif":
|
|
3446
|
+
image = image.avif({
|
|
3447
|
+
quality,
|
|
3448
|
+
effort: 4,
|
|
3449
|
+
chromaSubsampling: "4:2:0"
|
|
3450
|
+
});
|
|
3451
|
+
break;
|
|
3452
|
+
case "jpeg":
|
|
3453
|
+
image = image.jpeg({
|
|
3454
|
+
quality,
|
|
3455
|
+
progressive: true,
|
|
3456
|
+
mozjpeg: true
|
|
3457
|
+
});
|
|
3458
|
+
break;
|
|
3459
|
+
case "png":
|
|
3460
|
+
image = image.png({
|
|
3461
|
+
compressionLevel: 9,
|
|
3462
|
+
progressive: true
|
|
3463
|
+
});
|
|
3464
|
+
break;
|
|
3465
|
+
default:
|
|
3466
|
+
image = image.webp({ quality });
|
|
3467
|
+
outputFormat = "webp";
|
|
3468
|
+
}
|
|
3469
|
+
const { data: buffer, info } = await image.toBuffer({ resolveWithObject: true });
|
|
3470
|
+
return {
|
|
3471
|
+
buffer,
|
|
3472
|
+
contentType: FORMAT_MIME_TYPES[outputFormat] || FORMAT_MIME_TYPES.webp,
|
|
3473
|
+
width: info.width,
|
|
3474
|
+
height: info.height,
|
|
3475
|
+
format: outputFormat
|
|
3476
|
+
};
|
|
3477
|
+
}
|
|
3478
|
+
async getMetadata(input) {
|
|
3479
|
+
const metadata = await sharp(input).metadata();
|
|
3480
|
+
if (!metadata.width || !metadata.height || !metadata.format) {
|
|
3481
|
+
throw new Error("Unable to read image metadata");
|
|
3482
|
+
}
|
|
3483
|
+
return {
|
|
3484
|
+
width: metadata.width,
|
|
3485
|
+
height: metadata.height,
|
|
3486
|
+
format: metadata.format,
|
|
3487
|
+
space: metadata.space,
|
|
3488
|
+
channels: metadata.channels,
|
|
3489
|
+
depth: metadata.depth,
|
|
3490
|
+
density: metadata.density,
|
|
3491
|
+
hasAlpha: metadata.hasAlpha,
|
|
3492
|
+
orientation: metadata.orientation
|
|
3493
|
+
};
|
|
3494
|
+
}
|
|
3495
|
+
async resize(input, width, height, options = {}) {
|
|
3496
|
+
return sharp(input).resize({
|
|
3497
|
+
width,
|
|
3498
|
+
height,
|
|
3499
|
+
fit: options.fit ?? "inside",
|
|
3500
|
+
withoutEnlargement: options.withoutEnlargement ?? true,
|
|
3501
|
+
...options
|
|
3502
|
+
}).toBuffer();
|
|
3503
|
+
}
|
|
3504
|
+
async toFormat(input, format, quality = this.quality) {
|
|
3505
|
+
let image = sharp(input);
|
|
3506
|
+
switch (format) {
|
|
3507
|
+
case "webp":
|
|
3508
|
+
image = image.webp({ quality });
|
|
3509
|
+
break;
|
|
3510
|
+
case "avif":
|
|
3511
|
+
image = image.avif({ quality });
|
|
3512
|
+
break;
|
|
3513
|
+
case "jpeg":
|
|
3514
|
+
image = image.jpeg({ quality, mozjpeg: true });
|
|
3515
|
+
break;
|
|
3516
|
+
case "png":
|
|
3517
|
+
image = image.png({ compressionLevel: 9 });
|
|
3518
|
+
break;
|
|
3519
|
+
}
|
|
3520
|
+
return image.toBuffer();
|
|
3521
|
+
}
|
|
3522
|
+
async hasTransparency(input) {
|
|
3523
|
+
const metadata = await sharp(input).metadata();
|
|
3524
|
+
return metadata.hasAlpha === true;
|
|
3525
|
+
}
|
|
3526
|
+
async normalize(input) {
|
|
3527
|
+
return sharp(input).rotate().toBuffer();
|
|
3528
|
+
}
|
|
3529
|
+
async getDominantColor(input) {
|
|
3530
|
+
const { dominant } = await sharp(input).stats();
|
|
3531
|
+
const r = Math.round(dominant.r);
|
|
3532
|
+
const g = Math.round(dominant.g);
|
|
3533
|
+
const b = Math.round(dominant.b);
|
|
3534
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
function createSharpProcessor(options) {
|
|
3538
|
+
return new SharpProcessor(options);
|
|
3539
|
+
}
|
|
3540
|
+
|
|
3541
|
+
// src/processing/blur.ts
|
|
3542
|
+
import sharp2 from "sharp";
|
|
3543
|
+
async function generateBlurPlaceholder(input, options = {}) {
|
|
3544
|
+
const { width = BLUR_WIDTH, quality = 10, sigma = 1 } = options;
|
|
3545
|
+
const metadata = await sharp2(input).metadata();
|
|
3546
|
+
if (!metadata.width || !metadata.height) {
|
|
3547
|
+
throw new Error("Unable to read image dimensions");
|
|
3548
|
+
}
|
|
3549
|
+
const aspectRatio = metadata.width / metadata.height;
|
|
3550
|
+
const height = Math.round(width / aspectRatio);
|
|
3551
|
+
const buffer = await sharp2(input).resize(width, height, {
|
|
3552
|
+
fit: "fill"
|
|
3553
|
+
}).blur(sigma).webp({
|
|
3554
|
+
quality,
|
|
3555
|
+
alphaQuality: quality,
|
|
3556
|
+
smartSubsample: true
|
|
3557
|
+
}).toBuffer();
|
|
3558
|
+
const base64 = buffer.toString("base64");
|
|
3559
|
+
const dataURL = `data:image/webp;base64,${base64}`;
|
|
3560
|
+
return {
|
|
3561
|
+
dataURL,
|
|
3562
|
+
width,
|
|
3563
|
+
height
|
|
3564
|
+
};
|
|
3565
|
+
}
|
|
3566
|
+
function generateShimmerSVG(width, height, color = "#f3f4f6") {
|
|
3567
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}">
|
|
3568
|
+
<defs>
|
|
3569
|
+
<linearGradient id="shimmer" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
3570
|
+
<stop offset="0%" stop-color="${color}">
|
|
3571
|
+
<animate attributeName="offset" values="-2;1" dur="1.5s" repeatCount="indefinite"/>
|
|
3572
|
+
</stop>
|
|
3573
|
+
<stop offset="50%" stop-color="#e5e7eb">
|
|
3574
|
+
<animate attributeName="offset" values="-1;2" dur="1.5s" repeatCount="indefinite"/>
|
|
3575
|
+
</stop>
|
|
3576
|
+
<stop offset="100%" stop-color="${color}">
|
|
3577
|
+
<animate attributeName="offset" values="0;3" dur="1.5s" repeatCount="indefinite"/>
|
|
3578
|
+
</stop>
|
|
3579
|
+
</linearGradient>
|
|
3580
|
+
</defs>
|
|
3581
|
+
<rect width="100%" height="100%" fill="url(#shimmer)"/>
|
|
3582
|
+
</svg>`.replace(/\n\s*/g, "");
|
|
3583
|
+
}
|
|
3584
|
+
function generateShimmerDataURL(width, height, color) {
|
|
3585
|
+
const svg = generateShimmerSVG(width, height, color);
|
|
3586
|
+
const base64 = Buffer.from(svg).toString("base64");
|
|
3587
|
+
return `data:image/svg+xml;base64,${base64}`;
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
// src/processing/color.ts
|
|
3591
|
+
import sharp3 from "sharp";
|
|
3592
|
+
async function extractDominantColor(input, options = {}) {
|
|
3593
|
+
const {
|
|
3594
|
+
colorCount = 5,
|
|
3595
|
+
sampleSize = 64,
|
|
3596
|
+
minSaturation = 0.1,
|
|
3597
|
+
transparencyThreshold = 0.5
|
|
3598
|
+
} = options;
|
|
3599
|
+
const { data, info } = await sharp3(input).resize(sampleSize, sampleSize, { fit: "fill" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
3600
|
+
const pixels = [];
|
|
3601
|
+
let transparentPixels = 0;
|
|
3602
|
+
const totalPixels = data.length / 4;
|
|
3603
|
+
for (let i = 0;i < data.length; i += 4) {
|
|
3604
|
+
const r = data[i];
|
|
3605
|
+
const g = data[i + 1];
|
|
3606
|
+
const b = data[i + 2];
|
|
3607
|
+
const a = data[i + 3];
|
|
3608
|
+
if (a < 128) {
|
|
3609
|
+
transparentPixels++;
|
|
3610
|
+
continue;
|
|
3611
|
+
}
|
|
3612
|
+
pixels.push({ r, g, b });
|
|
3613
|
+
}
|
|
3614
|
+
const hasTransparency = transparentPixels / totalPixels > transparencyThreshold;
|
|
3615
|
+
if (pixels.length < 10) {
|
|
3616
|
+
return {
|
|
3617
|
+
dominant: "rgb(128, 128, 128)",
|
|
3618
|
+
palette: ["rgb(128, 128, 128)"],
|
|
3619
|
+
dominantRGB: { r: 128, g: 128, b: 128 },
|
|
3620
|
+
hasTransparency: true
|
|
3621
|
+
};
|
|
3622
|
+
}
|
|
3623
|
+
const clusters = kMeansClustering(pixels, colorCount);
|
|
3624
|
+
clusters.sort((a, b) => b.count - a.count);
|
|
3625
|
+
const palette = clusters.map(({ centroid }) => `rgb(${Math.round(centroid.r)}, ${Math.round(centroid.g)}, ${Math.round(centroid.b)})`);
|
|
3626
|
+
let dominantIndex = 0;
|
|
3627
|
+
let maxVibrancy = 0;
|
|
3628
|
+
for (let i = 0;i < Math.min(3, clusters.length); i++) {
|
|
3629
|
+
const { centroid } = clusters[i];
|
|
3630
|
+
const vibrancy = getColorVibrancy(centroid);
|
|
3631
|
+
if (vibrancy > maxVibrancy && getSaturation(centroid) >= minSaturation) {
|
|
3632
|
+
maxVibrancy = vibrancy;
|
|
3633
|
+
dominantIndex = i;
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
const dominantRGB = {
|
|
3637
|
+
r: Math.round(clusters[dominantIndex].centroid.r),
|
|
3638
|
+
g: Math.round(clusters[dominantIndex].centroid.g),
|
|
3639
|
+
b: Math.round(clusters[dominantIndex].centroid.b)
|
|
3640
|
+
};
|
|
3641
|
+
return {
|
|
3642
|
+
dominant: `rgb(${dominantRGB.r}, ${dominantRGB.g}, ${dominantRGB.b})`,
|
|
3643
|
+
palette,
|
|
3644
|
+
dominantRGB,
|
|
3645
|
+
hasTransparency
|
|
3646
|
+
};
|
|
3647
|
+
}
|
|
3648
|
+
function kMeansClustering(pixels, k, iterations = 10) {
|
|
3649
|
+
const centroids = initializeCentroids(pixels, k);
|
|
3650
|
+
for (let iter = 0;iter < iterations; iter++) {
|
|
3651
|
+
const assignments = new Array(k).fill(null).map(() => []);
|
|
3652
|
+
for (const pixel of pixels) {
|
|
3653
|
+
let minDist = Infinity;
|
|
3654
|
+
let nearestCluster = 0;
|
|
3655
|
+
for (let i = 0;i < centroids.length; i++) {
|
|
3656
|
+
const dist = colorDistance(pixel, centroids[i]);
|
|
3657
|
+
if (dist < minDist) {
|
|
3658
|
+
minDist = dist;
|
|
3659
|
+
nearestCluster = i;
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
assignments[nearestCluster].push(pixel);
|
|
3663
|
+
}
|
|
3664
|
+
for (let i = 0;i < centroids.length; i++) {
|
|
3665
|
+
if (assignments[i].length > 0) {
|
|
3666
|
+
centroids[i] = calculateCentroid(assignments[i]);
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
const counts = new Array(k).fill(0);
|
|
3671
|
+
for (const pixel of pixels) {
|
|
3672
|
+
let minDist = Infinity;
|
|
3673
|
+
let nearestCluster = 0;
|
|
3674
|
+
for (let i = 0;i < centroids.length; i++) {
|
|
3675
|
+
const dist = colorDistance(pixel, centroids[i]);
|
|
3676
|
+
if (dist < minDist) {
|
|
3677
|
+
minDist = dist;
|
|
3678
|
+
nearestCluster = i;
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
counts[nearestCluster]++;
|
|
3682
|
+
}
|
|
3683
|
+
return centroids.map((centroid, i) => ({
|
|
3684
|
+
centroid,
|
|
3685
|
+
count: counts[i]
|
|
3686
|
+
}));
|
|
3687
|
+
}
|
|
3688
|
+
function initializeCentroids(pixels, k) {
|
|
3689
|
+
const centroids = [];
|
|
3690
|
+
centroids.push(pixels[Math.floor(Math.random() * pixels.length)]);
|
|
3691
|
+
for (let i = 1;i < k; i++) {
|
|
3692
|
+
const distances = pixels.map((pixel) => {
|
|
3693
|
+
let minDist = Infinity;
|
|
3694
|
+
for (const centroid of centroids) {
|
|
3695
|
+
const dist = colorDistance(pixel, centroid);
|
|
3696
|
+
if (dist < minDist) {
|
|
3697
|
+
minDist = dist;
|
|
3698
|
+
}
|
|
3699
|
+
}
|
|
3700
|
+
return minDist * minDist;
|
|
3701
|
+
});
|
|
3702
|
+
const totalDistance = distances.reduce((sum, d) => sum + d, 0);
|
|
3703
|
+
let threshold = Math.random() * totalDistance;
|
|
3704
|
+
for (let j = 0;j < pixels.length; j++) {
|
|
3705
|
+
threshold -= distances[j];
|
|
3706
|
+
if (threshold <= 0) {
|
|
3707
|
+
centroids.push(pixels[j]);
|
|
3708
|
+
break;
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
return centroids;
|
|
3713
|
+
}
|
|
3714
|
+
function calculateCentroid(colors) {
|
|
3715
|
+
const sum = colors.reduce((acc, color) => ({
|
|
3716
|
+
r: acc.r + color.r,
|
|
3717
|
+
g: acc.g + color.g,
|
|
3718
|
+
b: acc.b + color.b
|
|
3719
|
+
}), { r: 0, g: 0, b: 0 });
|
|
3720
|
+
return {
|
|
3721
|
+
r: sum.r / colors.length,
|
|
3722
|
+
g: sum.g / colors.length,
|
|
3723
|
+
b: sum.b / colors.length
|
|
3724
|
+
};
|
|
3725
|
+
}
|
|
3726
|
+
function colorDistance(c1, c2) {
|
|
3727
|
+
const dr = c1.r - c2.r;
|
|
3728
|
+
const dg = c1.g - c2.g;
|
|
3729
|
+
const db = c1.b - c2.b;
|
|
3730
|
+
return Math.sqrt(dr * dr + dg * dg + db * db);
|
|
3731
|
+
}
|
|
3732
|
+
function getColorVibrancy(color) {
|
|
3733
|
+
const { r, g, b } = color;
|
|
3734
|
+
const max = Math.max(r, g, b);
|
|
3735
|
+
const min = Math.min(r, g, b);
|
|
3736
|
+
const l = (max + min) / 2 / 255;
|
|
3737
|
+
const s = getSaturation(color);
|
|
3738
|
+
const lightnessScore = 1 - Math.abs(l - 0.5) * 2;
|
|
3739
|
+
return s * lightnessScore;
|
|
3740
|
+
}
|
|
3741
|
+
function getSaturation(color) {
|
|
3742
|
+
const { r, g, b } = color;
|
|
3743
|
+
const max = Math.max(r, g, b);
|
|
3744
|
+
const min = Math.min(r, g, b);
|
|
3745
|
+
if (max === min) {
|
|
3746
|
+
return 0;
|
|
3747
|
+
}
|
|
3748
|
+
const l = (max + min) / 2;
|
|
3749
|
+
return l > 127.5 ? (max - min) / (510 - max - min) : (max - min) / (max + min);
|
|
3750
|
+
}
|
|
3751
|
+
function rgbToHex(color) {
|
|
3752
|
+
const { r, g, b } = color;
|
|
3753
|
+
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`;
|
|
3754
|
+
}
|
|
3755
|
+
function hexToRgb(hex) {
|
|
3756
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
3757
|
+
if (!result) {
|
|
3758
|
+
throw new Error(`Invalid hex color: ${hex}`);
|
|
3759
|
+
}
|
|
3760
|
+
return {
|
|
3761
|
+
r: parseInt(result[1], 16),
|
|
3762
|
+
g: parseInt(result[2], 16),
|
|
3763
|
+
b: parseInt(result[3], 16)
|
|
3764
|
+
};
|
|
3765
|
+
}
|
|
3766
|
+
function getContrastColor(background) {
|
|
3767
|
+
const luminance = (0.299 * background.r + 0.587 * background.g + 0.114 * background.b) / 255;
|
|
3768
|
+
return luminance > 0.5 ? "#000000" : "#ffffff";
|
|
3769
|
+
}
|
|
3770
|
+
|
|
3771
|
+
// src/processing/processor.ts
|
|
3772
|
+
class ImageProcessor {
|
|
3773
|
+
config;
|
|
3774
|
+
sharp;
|
|
3775
|
+
cache = new Map;
|
|
3776
|
+
constructor(config = {}) {
|
|
3777
|
+
this.config = validateConfig(config);
|
|
3778
|
+
this.sharp = createSharpProcessor({
|
|
3779
|
+
quality: this.config.quality,
|
|
3780
|
+
maxDimension: this.config.maxDimension
|
|
3781
|
+
});
|
|
3782
|
+
}
|
|
3783
|
+
async process(input, params) {
|
|
3784
|
+
const cacheKey = this.getCacheKey(input, params);
|
|
3785
|
+
const cached = this.cache.get(cacheKey);
|
|
3786
|
+
if (cached) {
|
|
3787
|
+
return cached;
|
|
3788
|
+
}
|
|
3789
|
+
const result = await this.sharp.process(input, params);
|
|
3790
|
+
this.cache.set(cacheKey, result);
|
|
3791
|
+
return result;
|
|
3792
|
+
}
|
|
3793
|
+
async processWithMetadata(input, params) {
|
|
3794
|
+
const metadata = await this.sharp.getMetadata(input);
|
|
3795
|
+
const processed = await this.process(input, params);
|
|
3796
|
+
let blur;
|
|
3797
|
+
if (this.config.generateBlurPlaceholder) {
|
|
3798
|
+
try {
|
|
3799
|
+
blur = await generateBlurPlaceholder(input);
|
|
3800
|
+
} catch (error) {
|
|
3801
|
+
console.warn("Failed to generate blur placeholder:", error);
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
let colors;
|
|
3805
|
+
if (this.config.extractDominantColor) {
|
|
3806
|
+
try {
|
|
3807
|
+
colors = await extractDominantColor(input);
|
|
3808
|
+
} catch (error) {
|
|
3809
|
+
console.warn("Failed to extract dominant color:", error);
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3812
|
+
return {
|
|
3813
|
+
processed,
|
|
3814
|
+
metadata,
|
|
3815
|
+
blur,
|
|
3816
|
+
colors
|
|
3817
|
+
};
|
|
3818
|
+
}
|
|
3819
|
+
async processFile(filePath) {
|
|
3820
|
+
const buffer = await readFile(filePath);
|
|
3821
|
+
const metadata = await this.sharp.getMetadata(buffer);
|
|
3822
|
+
let blurDataURL;
|
|
3823
|
+
let dominantColor;
|
|
3824
|
+
if (this.config.generateBlurPlaceholder) {
|
|
3825
|
+
try {
|
|
3826
|
+
const blur = await generateBlurPlaceholder(buffer);
|
|
3827
|
+
blurDataURL = blur.dataURL;
|
|
3828
|
+
} catch (error) {
|
|
3829
|
+
console.warn(`Failed to generate blur placeholder for ${filePath}:`, error);
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
if (this.config.extractDominantColor) {
|
|
3833
|
+
try {
|
|
3834
|
+
const colors = await extractDominantColor(buffer);
|
|
3835
|
+
dominantColor = colors.dominant;
|
|
3836
|
+
} catch (error) {
|
|
3837
|
+
console.warn(`Failed to extract dominant color for ${filePath}:`, error);
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3840
|
+
const allSizes = getAllSizes(this.config);
|
|
3841
|
+
const formats = this.getEnabledFormats(metadata.hasAlpha);
|
|
3842
|
+
const variants = [];
|
|
3843
|
+
for (const width of allSizes) {
|
|
3844
|
+
if (width >= metadata.width) {
|
|
3845
|
+
continue;
|
|
3846
|
+
}
|
|
3847
|
+
for (const format of formats) {
|
|
3848
|
+
try {
|
|
3849
|
+
const processed = await this.process(buffer, {
|
|
3850
|
+
src: filePath,
|
|
3851
|
+
width,
|
|
3852
|
+
quality: this.config.quality,
|
|
3853
|
+
format
|
|
3854
|
+
});
|
|
3855
|
+
const ext = FORMAT_EXTENSIONS[format] || `.${format}`;
|
|
3856
|
+
const variantPath = this.getVariantPath(filePath, width, format);
|
|
3857
|
+
variants.push({
|
|
3858
|
+
width: processed.width,
|
|
3859
|
+
height: processed.height,
|
|
3860
|
+
format,
|
|
3861
|
+
path: variantPath,
|
|
3862
|
+
buffer: processed.buffer
|
|
3863
|
+
});
|
|
3864
|
+
} catch (error) {
|
|
3865
|
+
console.warn(`Failed to generate ${width}px ${format} variant:`, error);
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
for (const format of formats) {
|
|
3870
|
+
if (format !== metadata.format) {
|
|
3871
|
+
try {
|
|
3872
|
+
const processed = await this.process(buffer, {
|
|
3873
|
+
src: filePath,
|
|
3874
|
+
width: metadata.width,
|
|
3875
|
+
quality: this.config.quality,
|
|
3876
|
+
format
|
|
3877
|
+
});
|
|
3878
|
+
const variantPath = this.getVariantPath(filePath, metadata.width, format);
|
|
3879
|
+
variants.push({
|
|
3880
|
+
width: processed.width,
|
|
3881
|
+
height: processed.height,
|
|
3882
|
+
format,
|
|
3883
|
+
path: variantPath,
|
|
3884
|
+
buffer: processed.buffer
|
|
3885
|
+
});
|
|
3886
|
+
} catch (error) {
|
|
3887
|
+
console.warn(`Failed to generate original ${format} variant:`, error);
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
}
|
|
3891
|
+
return {
|
|
3892
|
+
staticData: {
|
|
3893
|
+
src: filePath,
|
|
3894
|
+
width: metadata.width,
|
|
3895
|
+
height: metadata.height,
|
|
3896
|
+
blurDataURL,
|
|
3897
|
+
dominantColor,
|
|
3898
|
+
type: `image/${metadata.format}`
|
|
3899
|
+
},
|
|
3900
|
+
path: filePath,
|
|
3901
|
+
variants
|
|
3902
|
+
};
|
|
3903
|
+
}
|
|
3904
|
+
async getMetadata(input) {
|
|
3905
|
+
return this.sharp.getMetadata(input);
|
|
3906
|
+
}
|
|
3907
|
+
async generateBlur(input) {
|
|
3908
|
+
return generateBlurPlaceholder(input);
|
|
3909
|
+
}
|
|
3910
|
+
async extractColor(input) {
|
|
3911
|
+
return extractDominantColor(input);
|
|
3912
|
+
}
|
|
3913
|
+
isSupported(filePath) {
|
|
3914
|
+
const ext = extname(filePath).toLowerCase().slice(1);
|
|
3915
|
+
return SUPPORTED_INPUT_FORMATS.includes(ext);
|
|
3916
|
+
}
|
|
3917
|
+
clearCache() {
|
|
3918
|
+
this.cache.clear();
|
|
3919
|
+
}
|
|
3920
|
+
getEnabledFormats(hasAlpha) {
|
|
3921
|
+
const formats = [];
|
|
3922
|
+
if (this.config.formats?.webp) {
|
|
3923
|
+
formats.push("webp");
|
|
3924
|
+
}
|
|
3925
|
+
if (this.config.formats?.avif) {
|
|
3926
|
+
formats.push("avif");
|
|
3927
|
+
}
|
|
3928
|
+
if (hasAlpha) {
|
|
3929
|
+
if (this.config.formats?.png) {
|
|
3930
|
+
formats.push("png");
|
|
3931
|
+
}
|
|
3932
|
+
} else {
|
|
3933
|
+
if (this.config.formats?.jpeg) {
|
|
3934
|
+
formats.push("jpeg");
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
if (formats.length === 0) {
|
|
3938
|
+
formats.push("webp");
|
|
3939
|
+
}
|
|
3940
|
+
return formats;
|
|
3941
|
+
}
|
|
3942
|
+
getVariantPath(originalPath, width, format) {
|
|
3943
|
+
const ext = extname(originalPath);
|
|
3944
|
+
const base = originalPath.slice(0, -ext.length);
|
|
3945
|
+
const newExt = FORMAT_EXTENSIONS[format] || `.${format}`;
|
|
3946
|
+
return `${base}-${width}w${newExt}`;
|
|
3947
|
+
}
|
|
3948
|
+
getCacheKey(input, params) {
|
|
3949
|
+
const src = typeof input === "string" ? input : "buffer";
|
|
3950
|
+
const inputHash = typeof input === "string" ? input : this.hashBuffer(input);
|
|
3951
|
+
return `${inputHash}:${params.width}:${params.height || ""}:${params.quality || ""}:${params.format || ""}`;
|
|
3952
|
+
}
|
|
3953
|
+
hashBuffer(buffer) {
|
|
3954
|
+
let hash = 0;
|
|
3955
|
+
for (let i = 0;i < Math.min(buffer.length, 1000); i++) {
|
|
3956
|
+
hash = (hash << 5) - hash + buffer[i] | 0;
|
|
3957
|
+
}
|
|
3958
|
+
return hash.toString(36);
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
function createImageProcessor(config) {
|
|
3962
|
+
return new ImageProcessor(config);
|
|
3963
|
+
}
|
|
3964
|
+
|
|
3965
|
+
// src/build/optimizer.ts
|
|
3966
|
+
import { readFile as readFile3, writeFile as writeFile2, mkdir as mkdir2, readdir } from "fs/promises";
|
|
3967
|
+
import { join as join3, relative as relative2, dirname as dirname2, extname as extname2, basename } from "path";
|
|
3968
|
+
import { createHash as createHash2 } from "crypto";
|
|
3969
|
+
|
|
3970
|
+
// src/build/manifest.ts
|
|
3971
|
+
import { readFile as readFile2, writeFile, mkdir } from "fs/promises";
|
|
3972
|
+
import { dirname, join as join2 } from "path";
|
|
3973
|
+
import { createHash } from "crypto";
|
|
3974
|
+
var DEFAULT_MANIFEST = {
|
|
3975
|
+
version: 1,
|
|
3976
|
+
buildTime: 0,
|
|
3977
|
+
images: {}
|
|
3978
|
+
};
|
|
3979
|
+
|
|
3980
|
+
class ImageManifestManager {
|
|
3981
|
+
manifest = { ...DEFAULT_MANIFEST };
|
|
3982
|
+
manifestPath;
|
|
3983
|
+
dirty = false;
|
|
3984
|
+
constructor(outDir) {
|
|
3985
|
+
this.manifestPath = join2(outDir, "images-manifest.json");
|
|
3986
|
+
}
|
|
3987
|
+
async load() {
|
|
3988
|
+
try {
|
|
3989
|
+
const content = await readFile2(this.manifestPath, "utf-8");
|
|
3990
|
+
this.manifest = JSON.parse(content);
|
|
3991
|
+
} catch (error) {
|
|
3992
|
+
this.manifest = { ...DEFAULT_MANIFEST };
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
async save() {
|
|
3996
|
+
if (!this.dirty) {
|
|
3997
|
+
return;
|
|
3998
|
+
}
|
|
3999
|
+
this.manifest.buildTime = Date.now();
|
|
4000
|
+
await mkdir(dirname(this.manifestPath), { recursive: true });
|
|
4001
|
+
await writeFile(this.manifestPath, JSON.stringify(this.manifest, null, 2));
|
|
4002
|
+
this.dirty = false;
|
|
4003
|
+
}
|
|
4004
|
+
addImage(sourcePath, data) {
|
|
4005
|
+
const hash = this.generateHash(sourcePath, data);
|
|
4006
|
+
this.manifest.images[sourcePath] = {
|
|
4007
|
+
...data,
|
|
4008
|
+
hash
|
|
4009
|
+
};
|
|
4010
|
+
this.dirty = true;
|
|
4011
|
+
}
|
|
4012
|
+
getImage(sourcePath) {
|
|
4013
|
+
return this.manifest.images[sourcePath];
|
|
4014
|
+
}
|
|
4015
|
+
needsReprocessing(sourcePath, fileHash) {
|
|
4016
|
+
const entry = this.manifest.images[sourcePath];
|
|
4017
|
+
if (!entry) {
|
|
4018
|
+
return true;
|
|
4019
|
+
}
|
|
4020
|
+
return entry.hash !== fileHash;
|
|
4021
|
+
}
|
|
4022
|
+
removeImage(sourcePath) {
|
|
4023
|
+
delete this.manifest.images[sourcePath];
|
|
4024
|
+
this.dirty = true;
|
|
4025
|
+
}
|
|
4026
|
+
getAllImages() {
|
|
4027
|
+
return this.manifest.images;
|
|
4028
|
+
}
|
|
4029
|
+
getImageCount() {
|
|
4030
|
+
return Object.keys(this.manifest.images).length;
|
|
4031
|
+
}
|
|
4032
|
+
getVariantCount() {
|
|
4033
|
+
return Object.values(this.manifest.images).reduce((count, entry) => count + entry.variants.length, 0);
|
|
4034
|
+
}
|
|
4035
|
+
getTotalSize() {
|
|
4036
|
+
return Object.values(this.manifest.images).reduce((size, entry) => size + entry.variants.reduce((vSize, v) => vSize + v.size, 0), 0);
|
|
4037
|
+
}
|
|
4038
|
+
clear() {
|
|
4039
|
+
this.manifest = { ...DEFAULT_MANIFEST };
|
|
4040
|
+
this.dirty = true;
|
|
4041
|
+
}
|
|
4042
|
+
generateHash(sourcePath, data) {
|
|
4043
|
+
const content = JSON.stringify({
|
|
4044
|
+
sourcePath,
|
|
4045
|
+
width: data.width,
|
|
4046
|
+
height: data.height,
|
|
4047
|
+
variants: data.variants.map((v) => `${v.width}x${v.height}-${v.format}`)
|
|
4048
|
+
});
|
|
4049
|
+
return createHash("md5").update(content).digest("hex").slice(0, 8);
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
function createManifestManager(outDir) {
|
|
4053
|
+
return new ImageManifestManager(outDir);
|
|
4054
|
+
}
|
|
4055
|
+
|
|
4056
|
+
// src/build/optimizer.ts
|
|
4057
|
+
class BuildOptimizer {
|
|
4058
|
+
config;
|
|
4059
|
+
processor;
|
|
4060
|
+
manifest;
|
|
4061
|
+
root;
|
|
4062
|
+
outDir;
|
|
4063
|
+
scanDirs;
|
|
4064
|
+
force;
|
|
4065
|
+
onProgress;
|
|
4066
|
+
constructor(options) {
|
|
4067
|
+
this.config = validateConfig(options.config);
|
|
4068
|
+
this.processor = createImageProcessor(options.config);
|
|
4069
|
+
this.manifest = createManifestManager(options.outDir);
|
|
4070
|
+
this.root = options.root;
|
|
4071
|
+
this.outDir = options.outDir;
|
|
4072
|
+
this.scanDirs = options.scanDirs || ["public", "app/assets", "assets"];
|
|
4073
|
+
this.force = options.force || false;
|
|
4074
|
+
this.onProgress = options.onProgress;
|
|
4075
|
+
}
|
|
4076
|
+
async run() {
|
|
4077
|
+
const startTime = Date.now();
|
|
4078
|
+
const result = {
|
|
4079
|
+
processed: 0,
|
|
4080
|
+
skipped: 0,
|
|
4081
|
+
variants: 0,
|
|
4082
|
+
totalSize: 0,
|
|
4083
|
+
duration: 0,
|
|
4084
|
+
errors: []
|
|
4085
|
+
};
|
|
4086
|
+
await this.manifest.load();
|
|
4087
|
+
const imageFiles = await this.scanForImages();
|
|
4088
|
+
const totalFiles = imageFiles.length;
|
|
4089
|
+
console.log(`Found ${totalFiles} images to process`);
|
|
4090
|
+
for (let i = 0;i < imageFiles.length; i++) {
|
|
4091
|
+
const file = imageFiles[i];
|
|
4092
|
+
const relativePath = relative2(this.root, file);
|
|
4093
|
+
this.onProgress?.(i + 1, totalFiles, relativePath);
|
|
4094
|
+
try {
|
|
4095
|
+
const fileBuffer = await readFile3(file);
|
|
4096
|
+
const fileHash = this.hashBuffer(fileBuffer);
|
|
4097
|
+
if (!this.force && !this.manifest.needsReprocessing(relativePath, fileHash)) {
|
|
4098
|
+
result.skipped++;
|
|
4099
|
+
continue;
|
|
4100
|
+
}
|
|
4101
|
+
const entry = await this.processImage(file, fileBuffer, relativePath);
|
|
4102
|
+
this.manifest.addImage(relativePath, {
|
|
4103
|
+
...entry,
|
|
4104
|
+
src: relativePath
|
|
4105
|
+
});
|
|
4106
|
+
result.processed++;
|
|
4107
|
+
result.variants += entry.variants.length;
|
|
4108
|
+
result.totalSize += entry.variants.reduce((sum, v) => sum + v.size, 0);
|
|
4109
|
+
} catch (error) {
|
|
4110
|
+
result.errors.push({
|
|
4111
|
+
file: relativePath,
|
|
4112
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4113
|
+
});
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
await this.manifest.save();
|
|
4117
|
+
result.duration = Date.now() - startTime;
|
|
4118
|
+
return result;
|
|
4119
|
+
}
|
|
4120
|
+
async processImage(filePath, buffer, relativePath) {
|
|
4121
|
+
const metadata = await this.processor.getMetadata(buffer);
|
|
4122
|
+
let blurDataURL;
|
|
4123
|
+
if (this.config.generateBlurPlaceholder) {
|
|
4124
|
+
try {
|
|
4125
|
+
const blur = await this.processor.generateBlur(buffer);
|
|
4126
|
+
blurDataURL = blur.dataURL;
|
|
4127
|
+
} catch {}
|
|
4128
|
+
}
|
|
4129
|
+
let dominantColor;
|
|
4130
|
+
if (this.config.extractDominantColor) {
|
|
4131
|
+
try {
|
|
4132
|
+
const colors = await this.processor.extractColor(buffer);
|
|
4133
|
+
dominantColor = colors.dominant;
|
|
4134
|
+
} catch {}
|
|
4135
|
+
}
|
|
4136
|
+
const hasAlpha = metadata.hasAlpha;
|
|
4137
|
+
const formats = this.getOutputFormats(hasAlpha);
|
|
4138
|
+
const variants = [];
|
|
4139
|
+
const allSizes = getAllSizes(this.config);
|
|
4140
|
+
for (const width of allSizes) {
|
|
4141
|
+
if (width > metadata.width) {
|
|
4142
|
+
continue;
|
|
4143
|
+
}
|
|
4144
|
+
const height = Math.round(width / metadata.width * metadata.height);
|
|
4145
|
+
for (const format of formats) {
|
|
4146
|
+
try {
|
|
4147
|
+
const processed = await this.processor.process(buffer, {
|
|
4148
|
+
src: relativePath,
|
|
4149
|
+
width,
|
|
4150
|
+
quality: this.config.quality,
|
|
4151
|
+
format
|
|
4152
|
+
});
|
|
4153
|
+
const variantPath = this.getVariantPath(relativePath, width, format);
|
|
4154
|
+
const fullPath = join3(this.outDir, variantPath);
|
|
4155
|
+
await mkdir2(dirname2(fullPath), { recursive: true });
|
|
4156
|
+
await writeFile2(fullPath, processed.buffer);
|
|
4157
|
+
variants.push({
|
|
4158
|
+
path: variantPath,
|
|
4159
|
+
width: processed.width,
|
|
4160
|
+
height: processed.height,
|
|
4161
|
+
format,
|
|
4162
|
+
size: processed.buffer.length
|
|
4163
|
+
});
|
|
4164
|
+
} catch (error) {
|
|
4165
|
+
console.warn(`Failed to generate ${width}px ${format} variant for ${relativePath}`);
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
}
|
|
4169
|
+
const originalExt = extname2(relativePath).slice(1).toLowerCase();
|
|
4170
|
+
if (!formats.includes(originalExt) && SUPPORTED_INPUT_FORMATS.includes(originalExt)) {
|
|
4171
|
+
const variantPath = this.getVariantPath(relativePath, metadata.width, originalExt);
|
|
4172
|
+
const fullPath = join3(this.outDir, variantPath);
|
|
4173
|
+
await mkdir2(dirname2(fullPath), { recursive: true });
|
|
4174
|
+
await writeFile2(fullPath, buffer);
|
|
4175
|
+
variants.push({
|
|
4176
|
+
path: variantPath,
|
|
4177
|
+
width: metadata.width,
|
|
4178
|
+
height: metadata.height,
|
|
4179
|
+
format: originalExt,
|
|
4180
|
+
size: buffer.length
|
|
4181
|
+
});
|
|
4182
|
+
}
|
|
4183
|
+
return {
|
|
4184
|
+
src: relativePath,
|
|
4185
|
+
width: metadata.width,
|
|
4186
|
+
height: metadata.height,
|
|
4187
|
+
variants,
|
|
4188
|
+
blurDataURL,
|
|
4189
|
+
dominantColor
|
|
4190
|
+
};
|
|
4191
|
+
}
|
|
4192
|
+
async scanForImages() {
|
|
4193
|
+
const images = [];
|
|
4194
|
+
for (const scanDir of this.scanDirs) {
|
|
4195
|
+
const fullDir = join3(this.root, scanDir);
|
|
4196
|
+
try {
|
|
4197
|
+
await this.scanDirectory(fullDir, images);
|
|
4198
|
+
} catch {}
|
|
4199
|
+
}
|
|
4200
|
+
return images;
|
|
4201
|
+
}
|
|
4202
|
+
async scanDirectory(dir, images) {
|
|
4203
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
4204
|
+
for (const entry of entries) {
|
|
4205
|
+
const fullPath = join3(dir, entry.name);
|
|
4206
|
+
if (entry.isDirectory()) {
|
|
4207
|
+
if (!entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
4208
|
+
await this.scanDirectory(fullPath, images);
|
|
4209
|
+
}
|
|
4210
|
+
} else if (entry.isFile()) {
|
|
4211
|
+
const ext = extname2(entry.name).slice(1).toLowerCase();
|
|
4212
|
+
if (SUPPORTED_INPUT_FORMATS.includes(ext)) {
|
|
4213
|
+
images.push(fullPath);
|
|
4214
|
+
}
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
}
|
|
4218
|
+
getOutputFormats(hasAlpha) {
|
|
4219
|
+
const formats = [];
|
|
4220
|
+
if (this.config.formats?.webp !== false) {
|
|
4221
|
+
formats.push("webp");
|
|
4222
|
+
}
|
|
4223
|
+
if (this.config.formats?.avif) {
|
|
4224
|
+
formats.push("avif");
|
|
4225
|
+
}
|
|
4226
|
+
if (hasAlpha && this.config.formats?.png !== false) {
|
|
4227
|
+
formats.push("png");
|
|
4228
|
+
} else if (!hasAlpha && this.config.formats?.jpeg !== false) {
|
|
4229
|
+
formats.push("jpeg");
|
|
4230
|
+
}
|
|
4231
|
+
return formats;
|
|
4232
|
+
}
|
|
4233
|
+
getVariantPath(originalPath, width, format) {
|
|
4234
|
+
const dir = dirname2(originalPath);
|
|
4235
|
+
const name = basename(originalPath, extname2(originalPath));
|
|
4236
|
+
const ext = format === "jpeg" ? "jpg" : format;
|
|
4237
|
+
return join3("images", dir, `${name}-${width}w.${ext}`);
|
|
4238
|
+
}
|
|
4239
|
+
hashBuffer(buffer) {
|
|
4240
|
+
return createHash2("md5").update(buffer).digest("hex").slice(0, 8);
|
|
4241
|
+
}
|
|
4242
|
+
getManifest() {
|
|
4243
|
+
return this.manifest;
|
|
4244
|
+
}
|
|
4245
|
+
}
|
|
4246
|
+
function createBuildOptimizer(options) {
|
|
4247
|
+
return new BuildOptimizer(options);
|
|
4248
|
+
}
|
|
4249
|
+
async function optimizeImages(options) {
|
|
4250
|
+
const optimizer = createBuildOptimizer(options);
|
|
4251
|
+
return optimizer.run();
|
|
4252
|
+
}
|
|
4253
|
+
|
|
4254
|
+
// src/runtime/middleware.ts
|
|
4255
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
4256
|
+
import { join as join5 } from "path";
|
|
4257
|
+
|
|
4258
|
+
// src/runtime/cache.ts
|
|
4259
|
+
import { readFile as readFile4, writeFile as writeFile3, mkdir as mkdir3, unlink, readdir as readdir2, stat as stat3 } from "fs/promises";
|
|
4260
|
+
import { join as join4, dirname as dirname3 } from "path";
|
|
4261
|
+
import { createHash as createHash3 } from "crypto";
|
|
4262
|
+
|
|
4263
|
+
class MemoryCache {
|
|
4264
|
+
cache = new Map;
|
|
4265
|
+
maxItems;
|
|
4266
|
+
maxSize;
|
|
4267
|
+
ttl;
|
|
4268
|
+
currentSize = 0;
|
|
4269
|
+
constructor(options = {}) {
|
|
4270
|
+
this.maxItems = options.maxItems ?? 100;
|
|
4271
|
+
this.maxSize = options.maxSize ?? 100 * 1024 * 1024;
|
|
4272
|
+
this.ttl = options.ttl ?? 0;
|
|
4273
|
+
}
|
|
4274
|
+
get(key) {
|
|
4275
|
+
const item = this.cache.get(key);
|
|
4276
|
+
if (!item) {
|
|
4277
|
+
return;
|
|
4278
|
+
}
|
|
4279
|
+
if (this.ttl > 0 && Date.now() - item.createdAt > this.ttl) {
|
|
4280
|
+
this.delete(key);
|
|
4281
|
+
return;
|
|
4282
|
+
}
|
|
4283
|
+
item.lastAccessed = Date.now();
|
|
4284
|
+
return item.value;
|
|
4285
|
+
}
|
|
4286
|
+
set(key, value) {
|
|
4287
|
+
if (this.cache.has(key)) {
|
|
4288
|
+
this.delete(key);
|
|
4289
|
+
}
|
|
4290
|
+
const size = value.length;
|
|
4291
|
+
while ((this.cache.size >= this.maxItems || this.currentSize + size > this.maxSize) && this.cache.size > 0) {
|
|
4292
|
+
this.evictLRU();
|
|
4293
|
+
}
|
|
4294
|
+
if (size > this.maxSize) {
|
|
4295
|
+
return;
|
|
4296
|
+
}
|
|
4297
|
+
const now = Date.now();
|
|
4298
|
+
this.cache.set(key, {
|
|
4299
|
+
value,
|
|
4300
|
+
size,
|
|
4301
|
+
createdAt: now,
|
|
4302
|
+
lastAccessed: now
|
|
4303
|
+
});
|
|
4304
|
+
this.currentSize += size;
|
|
4305
|
+
}
|
|
4306
|
+
has(key) {
|
|
4307
|
+
const item = this.cache.get(key);
|
|
4308
|
+
if (!item) {
|
|
4309
|
+
return false;
|
|
4310
|
+
}
|
|
4311
|
+
if (this.ttl > 0 && Date.now() - item.createdAt > this.ttl) {
|
|
4312
|
+
this.delete(key);
|
|
4313
|
+
return false;
|
|
4314
|
+
}
|
|
4315
|
+
return true;
|
|
4316
|
+
}
|
|
4317
|
+
delete(key) {
|
|
4318
|
+
const item = this.cache.get(key);
|
|
4319
|
+
if (!item) {
|
|
4320
|
+
return false;
|
|
4321
|
+
}
|
|
4322
|
+
this.currentSize -= item.size;
|
|
4323
|
+
return this.cache.delete(key);
|
|
4324
|
+
}
|
|
4325
|
+
clear() {
|
|
4326
|
+
this.cache.clear();
|
|
4327
|
+
this.currentSize = 0;
|
|
4328
|
+
}
|
|
4329
|
+
stats() {
|
|
4330
|
+
return {
|
|
4331
|
+
items: this.cache.size,
|
|
4332
|
+
size: this.currentSize,
|
|
4333
|
+
maxItems: this.maxItems,
|
|
4334
|
+
maxSize: this.maxSize
|
|
4335
|
+
};
|
|
4336
|
+
}
|
|
4337
|
+
evictLRU() {
|
|
4338
|
+
let oldestKey;
|
|
4339
|
+
let oldestTime = Infinity;
|
|
4340
|
+
for (const [key, item] of this.cache) {
|
|
4341
|
+
if (item.lastAccessed < oldestTime) {
|
|
4342
|
+
oldestTime = item.lastAccessed;
|
|
4343
|
+
oldestKey = key;
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
if (oldestKey) {
|
|
4347
|
+
this.delete(oldestKey);
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4351
|
+
|
|
4352
|
+
class DiskCache {
|
|
4353
|
+
dir;
|
|
4354
|
+
maxSize;
|
|
4355
|
+
ttl;
|
|
4356
|
+
initialized = false;
|
|
4357
|
+
constructor(options) {
|
|
4358
|
+
this.dir = options.dir;
|
|
4359
|
+
this.maxSize = options.maxSize ?? 500 * 1024 * 1024;
|
|
4360
|
+
this.ttl = options.ttl ?? 7 * 24 * 60 * 60 * 1000;
|
|
4361
|
+
}
|
|
4362
|
+
async init() {
|
|
4363
|
+
if (this.initialized) {
|
|
4364
|
+
return;
|
|
4365
|
+
}
|
|
4366
|
+
await mkdir3(this.dir, { recursive: true });
|
|
4367
|
+
this.initialized = true;
|
|
4368
|
+
}
|
|
4369
|
+
getPath(key) {
|
|
4370
|
+
const hash = createHash3("md5").update(key).digest("hex");
|
|
4371
|
+
return join4(this.dir, hash.slice(0, 2), hash);
|
|
4372
|
+
}
|
|
4373
|
+
async get(key) {
|
|
4374
|
+
await this.init();
|
|
4375
|
+
const path = this.getPath(key);
|
|
4376
|
+
try {
|
|
4377
|
+
const stats = await stat3(path);
|
|
4378
|
+
if (this.ttl > 0 && Date.now() - stats.mtimeMs > this.ttl) {
|
|
4379
|
+
await unlink(path).catch(() => {});
|
|
4380
|
+
return;
|
|
4381
|
+
}
|
|
4382
|
+
return await readFile4(path);
|
|
4383
|
+
} catch {
|
|
4384
|
+
return;
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
4387
|
+
async set(key, value) {
|
|
4388
|
+
await this.init();
|
|
4389
|
+
const path = this.getPath(key);
|
|
4390
|
+
try {
|
|
4391
|
+
await mkdir3(dirname3(path), { recursive: true });
|
|
4392
|
+
await writeFile3(path, value);
|
|
4393
|
+
} catch (error) {
|
|
4394
|
+
console.warn("Failed to write to disk cache:", error);
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
async has(key) {
|
|
4398
|
+
await this.init();
|
|
4399
|
+
const path = this.getPath(key);
|
|
4400
|
+
try {
|
|
4401
|
+
const stats = await stat3(path);
|
|
4402
|
+
if (this.ttl > 0 && Date.now() - stats.mtimeMs > this.ttl) {
|
|
4403
|
+
await unlink(path).catch(() => {});
|
|
4404
|
+
return false;
|
|
4405
|
+
}
|
|
4406
|
+
return true;
|
|
4407
|
+
} catch {
|
|
4408
|
+
return false;
|
|
4409
|
+
}
|
|
4410
|
+
}
|
|
4411
|
+
async delete(key) {
|
|
4412
|
+
await this.init();
|
|
4413
|
+
const path = this.getPath(key);
|
|
4414
|
+
try {
|
|
4415
|
+
await unlink(path);
|
|
4416
|
+
return true;
|
|
4417
|
+
} catch {
|
|
4418
|
+
return false;
|
|
4419
|
+
}
|
|
4420
|
+
}
|
|
4421
|
+
async cleanup() {
|
|
4422
|
+
await this.init();
|
|
4423
|
+
let deleted = 0;
|
|
4424
|
+
let freed = 0;
|
|
4425
|
+
try {
|
|
4426
|
+
const subdirs = await readdir2(this.dir);
|
|
4427
|
+
for (const subdir of subdirs) {
|
|
4428
|
+
const subdirPath = join4(this.dir, subdir);
|
|
4429
|
+
const stats = await stat3(subdirPath).catch(() => null);
|
|
4430
|
+
if (!stats?.isDirectory()) {
|
|
4431
|
+
continue;
|
|
4432
|
+
}
|
|
4433
|
+
const files = await readdir2(subdirPath);
|
|
4434
|
+
for (const file of files) {
|
|
4435
|
+
const filePath = join4(subdirPath, file);
|
|
4436
|
+
const fileStats = await stat3(filePath).catch(() => null);
|
|
4437
|
+
if (!fileStats) {
|
|
4438
|
+
continue;
|
|
4439
|
+
}
|
|
4440
|
+
if (this.ttl > 0 && Date.now() - fileStats.mtimeMs > this.ttl) {
|
|
4441
|
+
try {
|
|
4442
|
+
await unlink(filePath);
|
|
4443
|
+
deleted++;
|
|
4444
|
+
freed += fileStats.size;
|
|
4445
|
+
} catch {}
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4449
|
+
} catch {}
|
|
4450
|
+
return { deleted, freed };
|
|
4451
|
+
}
|
|
4452
|
+
async stats() {
|
|
4453
|
+
await this.init();
|
|
4454
|
+
let files = 0;
|
|
4455
|
+
let size = 0;
|
|
4456
|
+
try {
|
|
4457
|
+
const subdirs = await readdir2(this.dir);
|
|
4458
|
+
for (const subdir of subdirs) {
|
|
4459
|
+
const subdirPath = join4(this.dir, subdir);
|
|
4460
|
+
const stats = await stat3(subdirPath).catch(() => null);
|
|
4461
|
+
if (!stats?.isDirectory()) {
|
|
4462
|
+
continue;
|
|
4463
|
+
}
|
|
4464
|
+
const dirFiles = await readdir2(subdirPath);
|
|
4465
|
+
for (const file of dirFiles) {
|
|
4466
|
+
const filePath = join4(subdirPath, file);
|
|
4467
|
+
const fileStats = await stat3(filePath).catch(() => null);
|
|
4468
|
+
if (fileStats?.isFile()) {
|
|
4469
|
+
files++;
|
|
4470
|
+
size += fileStats.size;
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
4474
|
+
} catch {}
|
|
4475
|
+
return { files, size };
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4478
|
+
|
|
4479
|
+
class TwoTierCache {
|
|
4480
|
+
memory;
|
|
4481
|
+
disk;
|
|
4482
|
+
constructor(options) {
|
|
4483
|
+
this.memory = new MemoryCache(options.memory);
|
|
4484
|
+
this.disk = new DiskCache(options.disk);
|
|
4485
|
+
}
|
|
4486
|
+
async get(key) {
|
|
4487
|
+
const memResult = this.memory.get(key);
|
|
4488
|
+
if (memResult) {
|
|
4489
|
+
return memResult;
|
|
4490
|
+
}
|
|
4491
|
+
const diskResult = await this.disk.get(key);
|
|
4492
|
+
if (diskResult) {
|
|
4493
|
+
this.memory.set(key, diskResult);
|
|
4494
|
+
return diskResult;
|
|
4495
|
+
}
|
|
4496
|
+
return;
|
|
4497
|
+
}
|
|
4498
|
+
async set(key, value) {
|
|
4499
|
+
this.memory.set(key, value);
|
|
4500
|
+
await this.disk.set(key, value);
|
|
4501
|
+
}
|
|
4502
|
+
async has(key) {
|
|
4503
|
+
if (this.memory.has(key)) {
|
|
4504
|
+
return true;
|
|
4505
|
+
}
|
|
4506
|
+
return this.disk.has(key);
|
|
4507
|
+
}
|
|
4508
|
+
async delete(key) {
|
|
4509
|
+
const memDeleted = this.memory.delete(key);
|
|
4510
|
+
const diskDeleted = await this.disk.delete(key);
|
|
4511
|
+
return memDeleted || diskDeleted;
|
|
4512
|
+
}
|
|
4513
|
+
async clear() {
|
|
4514
|
+
this.memory.clear();
|
|
4515
|
+
}
|
|
4516
|
+
async stats() {
|
|
4517
|
+
const memStats = this.memory.stats();
|
|
4518
|
+
const diskStats = await this.disk.stats();
|
|
4519
|
+
return {
|
|
4520
|
+
memory: { items: memStats.items, size: memStats.size },
|
|
4521
|
+
disk: diskStats
|
|
4522
|
+
};
|
|
4523
|
+
}
|
|
4524
|
+
async cleanup() {
|
|
4525
|
+
return this.disk.cleanup();
|
|
4526
|
+
}
|
|
4527
|
+
}
|
|
4528
|
+
function generateCacheKey(params) {
|
|
4529
|
+
return `${params.src}:w${params.width}:h${params.height || ""}:q${params.quality || ""}:f${params.format || ""}`;
|
|
4530
|
+
}
|
|
4531
|
+
|
|
4532
|
+
// src/runtime/middleware.ts
|
|
4533
|
+
function parseQueryParams(url) {
|
|
4534
|
+
const src = url.searchParams.get("src");
|
|
4535
|
+
const width = url.searchParams.get("w");
|
|
4536
|
+
const height = url.searchParams.get("h");
|
|
4537
|
+
const quality = url.searchParams.get("q");
|
|
4538
|
+
const format = url.searchParams.get("f");
|
|
4539
|
+
if (!src || !width) {
|
|
4540
|
+
return null;
|
|
4541
|
+
}
|
|
4542
|
+
const w = parseInt(width, 10);
|
|
4543
|
+
if (isNaN(w) || w <= 0 || w > MAX_DIMENSION) {
|
|
4544
|
+
return null;
|
|
4545
|
+
}
|
|
4546
|
+
const params = {
|
|
4547
|
+
src,
|
|
4548
|
+
width: w
|
|
4549
|
+
};
|
|
4550
|
+
if (height) {
|
|
4551
|
+
const h = parseInt(height, 10);
|
|
4552
|
+
if (!isNaN(h) && h > 0 && h <= MAX_DIMENSION) {
|
|
4553
|
+
params.height = h;
|
|
4554
|
+
}
|
|
4555
|
+
}
|
|
4556
|
+
if (quality) {
|
|
4557
|
+
const q = parseInt(quality, 10);
|
|
4558
|
+
if (!isNaN(q) && q >= 1 && q <= 100) {
|
|
4559
|
+
params.quality = q;
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
if (format) {
|
|
4563
|
+
const f = format.toLowerCase();
|
|
4564
|
+
if (f === "auto" || SUPPORTED_OUTPUT_FORMATS.includes(f)) {
|
|
4565
|
+
params.format = f;
|
|
4566
|
+
}
|
|
4567
|
+
}
|
|
4568
|
+
return params;
|
|
4569
|
+
}
|
|
4570
|
+
function getBestFormat(accept, params, config) {
|
|
4571
|
+
if (params.format && params.format !== "auto") {
|
|
4572
|
+
return params.format;
|
|
4573
|
+
}
|
|
4574
|
+
if (accept) {
|
|
4575
|
+
if (config.formats?.avif && accept.includes("image/avif")) {
|
|
4576
|
+
return "avif";
|
|
4577
|
+
}
|
|
4578
|
+
if (config.formats?.webp !== false && accept.includes("image/webp")) {
|
|
4579
|
+
return "webp";
|
|
4580
|
+
}
|
|
4581
|
+
}
|
|
4582
|
+
return config.formats?.webp !== false ? "webp" : "jpeg";
|
|
4583
|
+
}
|
|
4584
|
+
function isSourceAllowed(src, config) {
|
|
4585
|
+
if (src.startsWith("/") || src.startsWith("./")) {
|
|
4586
|
+
return true;
|
|
4587
|
+
}
|
|
4588
|
+
try {
|
|
4589
|
+
const url = new URL(src);
|
|
4590
|
+
if (config.dangerouslyAllowAllRemote) {
|
|
4591
|
+
return true;
|
|
4592
|
+
}
|
|
4593
|
+
return matchesRemotePattern(url, config.remotePatterns, config.domains);
|
|
4594
|
+
} catch {
|
|
4595
|
+
return true;
|
|
4596
|
+
}
|
|
4597
|
+
}
|
|
4598
|
+
function createImageMiddleware(options) {
|
|
4599
|
+
const config = validateConfig(options.config);
|
|
4600
|
+
const processor = createImageProcessor(options.config);
|
|
4601
|
+
const pathPrefix = config.path || IMAGE_PATH_PREFIX;
|
|
4602
|
+
let cache = null;
|
|
4603
|
+
if (options.cache !== false) {
|
|
4604
|
+
cache = new TwoTierCache({
|
|
4605
|
+
memory: {
|
|
4606
|
+
maxItems: 100,
|
|
4607
|
+
maxSize: 50 * 1024 * 1024
|
|
4608
|
+
},
|
|
4609
|
+
disk: {
|
|
4610
|
+
dir: join5(options.root, options.cacheDir || CACHE_DIR, "runtime"),
|
|
4611
|
+
maxSize: 500 * 1024 * 1024,
|
|
4612
|
+
ttl: 7 * 24 * 60 * 60 * 1000
|
|
4613
|
+
}
|
|
4614
|
+
});
|
|
4615
|
+
}
|
|
4616
|
+
return async (request, context, next) => {
|
|
4617
|
+
const url = new URL(request.url);
|
|
4618
|
+
if (!url.pathname.startsWith(pathPrefix)) {
|
|
4619
|
+
return next();
|
|
4620
|
+
}
|
|
4621
|
+
if (request.method !== "GET") {
|
|
4622
|
+
return new Response("Method not allowed", { status: 405 });
|
|
4623
|
+
}
|
|
4624
|
+
const params = parseQueryParams(url);
|
|
4625
|
+
if (!params) {
|
|
4626
|
+
return new Response("Invalid parameters. Required: src, w", { status: 400 });
|
|
4627
|
+
}
|
|
4628
|
+
if (!isSourceAllowed(params.src, config)) {
|
|
4629
|
+
return new Response("Source not allowed", { status: 403 });
|
|
4630
|
+
}
|
|
4631
|
+
const accept = request.headers.get("Accept");
|
|
4632
|
+
const format = getBestFormat(accept, params, config);
|
|
4633
|
+
params.format = format;
|
|
4634
|
+
const cacheKey = generateCacheKey(params);
|
|
4635
|
+
if (cache) {
|
|
4636
|
+
const cached = await cache.get(cacheKey);
|
|
4637
|
+
if (cached) {
|
|
4638
|
+
return createImageResponse(cached, format, true);
|
|
4639
|
+
}
|
|
4640
|
+
}
|
|
4641
|
+
try {
|
|
4642
|
+
let sourceBuffer;
|
|
4643
|
+
if (params.src.startsWith("http://") || params.src.startsWith("https://")) {
|
|
4644
|
+
const response = await fetch(params.src);
|
|
4645
|
+
if (!response.ok) {
|
|
4646
|
+
return new Response("Failed to fetch source image", { status: 502 });
|
|
4647
|
+
}
|
|
4648
|
+
sourceBuffer = Buffer.from(await response.arrayBuffer());
|
|
4649
|
+
} else {
|
|
4650
|
+
const localPath = params.src.startsWith("/") ? join5(options.root, "public", params.src) : join5(options.root, params.src);
|
|
4651
|
+
try {
|
|
4652
|
+
sourceBuffer = await readFile5(localPath);
|
|
4653
|
+
} catch (error) {
|
|
4654
|
+
return new Response("Source image not found", { status: 404 });
|
|
4655
|
+
}
|
|
4656
|
+
}
|
|
4657
|
+
const processed = await processor.process(sourceBuffer, params);
|
|
4658
|
+
if (cache) {
|
|
4659
|
+
await cache.set(cacheKey, processed.buffer);
|
|
4660
|
+
}
|
|
4661
|
+
return createImageResponse(processed.buffer, format, false);
|
|
4662
|
+
} catch (error) {
|
|
4663
|
+
console.error("Image processing error:", error);
|
|
4664
|
+
return new Response("Image processing failed", { status: 500 });
|
|
4665
|
+
}
|
|
4666
|
+
};
|
|
4667
|
+
}
|
|
4668
|
+
function createImageResponse(buffer, format, cached) {
|
|
4669
|
+
const contentType = FORMAT_MIME_TYPES[format] || "application/octet-stream";
|
|
4670
|
+
const headers = new Headers({
|
|
4671
|
+
"Content-Type": contentType,
|
|
4672
|
+
"Content-Length": buffer.length.toString(),
|
|
4673
|
+
"Cache-Control": "public, max-age=31536000, immutable",
|
|
4674
|
+
Vary: "Accept"
|
|
4675
|
+
});
|
|
4676
|
+
if (cached) {
|
|
4677
|
+
headers.set("X-Cache", "HIT");
|
|
4678
|
+
} else {
|
|
4679
|
+
headers.set("X-Cache", "MISS");
|
|
4680
|
+
}
|
|
4681
|
+
return new Response(new Uint8Array(buffer), {
|
|
4682
|
+
status: 200,
|
|
4683
|
+
headers
|
|
4684
|
+
});
|
|
4685
|
+
}
|
|
4686
|
+
function imageMiddleware(options) {
|
|
4687
|
+
const handler = createImageMiddleware(options);
|
|
4688
|
+
return async (request, context, next) => {
|
|
4689
|
+
return handler(request, context, next);
|
|
4690
|
+
};
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4693
|
+
// src/plugin.ts
|
|
4694
|
+
var VIRTUAL_PREFIX = "\x00ereo-image:";
|
|
4695
|
+
function imagesPlugin(options = {}) {
|
|
4696
|
+
const config = validateConfig(options);
|
|
4697
|
+
let state = null;
|
|
4698
|
+
return {
|
|
4699
|
+
name: "ereo:images",
|
|
4700
|
+
async setup(context) {
|
|
4701
|
+
const { root, mode } = context;
|
|
4702
|
+
const processor = createImageProcessor(config);
|
|
4703
|
+
const outDir = join6(root, config.cacheDir || CACHE_DIR);
|
|
4704
|
+
const manifest = createManifestManager(outDir);
|
|
4705
|
+
await manifest.load();
|
|
4706
|
+
state = {
|
|
4707
|
+
root,
|
|
4708
|
+
mode,
|
|
4709
|
+
config,
|
|
4710
|
+
processor,
|
|
4711
|
+
manifest,
|
|
4712
|
+
processedImages: new Map
|
|
4713
|
+
};
|
|
4714
|
+
console.log(` @ereo/plugin-images initialized (${mode} mode)`);
|
|
4715
|
+
},
|
|
4716
|
+
resolveId(id) {
|
|
4717
|
+
if (!state)
|
|
4718
|
+
return null;
|
|
4719
|
+
const ext = extname4(id).slice(1).toLowerCase();
|
|
4720
|
+
if (SUPPORTED_INPUT_FORMATS.includes(ext)) {
|
|
4721
|
+
const isAbsolute = id.startsWith("/") || id.startsWith(state.root);
|
|
4722
|
+
const fullPath = isAbsolute ? id : join6(state.root, id);
|
|
4723
|
+
return `${VIRTUAL_PREFIX}${fullPath}`;
|
|
4724
|
+
}
|
|
4725
|
+
return null;
|
|
4726
|
+
},
|
|
4727
|
+
async load(id) {
|
|
4728
|
+
if (!state)
|
|
4729
|
+
return null;
|
|
4730
|
+
if (!id.startsWith(VIRTUAL_PREFIX)) {
|
|
4731
|
+
return null;
|
|
4732
|
+
}
|
|
4733
|
+
const imagePath = id.slice(VIRTUAL_PREFIX.length);
|
|
4734
|
+
try {
|
|
4735
|
+
let imageData = state.processedImages.get(imagePath);
|
|
4736
|
+
if (!imageData) {
|
|
4737
|
+
const buffer = await readFile6(imagePath);
|
|
4738
|
+
const metadata = await state.processor.getMetadata(buffer);
|
|
4739
|
+
let blurDataURL;
|
|
4740
|
+
let dominantColor;
|
|
4741
|
+
if (state.config.generateBlurPlaceholder) {
|
|
4742
|
+
try {
|
|
4743
|
+
const blur = await state.processor.generateBlur(buffer);
|
|
4744
|
+
blurDataURL = blur.dataURL;
|
|
4745
|
+
} catch {}
|
|
4746
|
+
}
|
|
4747
|
+
if (state.config.extractDominantColor) {
|
|
4748
|
+
try {
|
|
4749
|
+
const colors = await state.processor.extractColor(buffer);
|
|
4750
|
+
dominantColor = colors.dominant;
|
|
4751
|
+
} catch {}
|
|
4752
|
+
}
|
|
4753
|
+
const relativePath = relative3(state.root, imagePath);
|
|
4754
|
+
const publicPath = relativePath.startsWith("public/") ? `/${relativePath.slice("public/".length)}` : `/${relativePath}`;
|
|
4755
|
+
imageData = {
|
|
4756
|
+
src: publicPath,
|
|
4757
|
+
width: metadata.width,
|
|
4758
|
+
height: metadata.height,
|
|
4759
|
+
blurDataURL,
|
|
4760
|
+
dominantColor,
|
|
4761
|
+
type: `image/${metadata.format}`
|
|
4762
|
+
};
|
|
4763
|
+
state.processedImages.set(imagePath, imageData);
|
|
4764
|
+
}
|
|
4765
|
+
return `export default ${JSON.stringify(imageData, null, 2)};`;
|
|
4766
|
+
} catch (error) {
|
|
4767
|
+
console.error(`Failed to process image: ${imagePath}`, error);
|
|
4768
|
+
return null;
|
|
4769
|
+
}
|
|
4770
|
+
},
|
|
4771
|
+
async transform(code, id) {
|
|
4772
|
+
return null;
|
|
4773
|
+
},
|
|
4774
|
+
async configureServer(server) {
|
|
4775
|
+
if (!state)
|
|
4776
|
+
return;
|
|
4777
|
+
server.middlewares.push(imageMiddleware({
|
|
4778
|
+
root: state.root,
|
|
4779
|
+
config: state.config,
|
|
4780
|
+
cache: true,
|
|
4781
|
+
cacheDir: state.config.cacheDir
|
|
4782
|
+
}));
|
|
4783
|
+
console.log(` Image optimization endpoint: ${state.config.path || IMAGE_PATH_PREFIX}`);
|
|
4784
|
+
},
|
|
4785
|
+
async buildStart() {
|
|
4786
|
+
if (!state)
|
|
4787
|
+
return;
|
|
4788
|
+
if (state.mode === "production") {
|
|
4789
|
+
const outDir = join6(state.root, ".ereo", "public");
|
|
4790
|
+
state.optimizer = createBuildOptimizer({
|
|
4791
|
+
root: state.root,
|
|
4792
|
+
outDir,
|
|
4793
|
+
config: state.config,
|
|
4794
|
+
scanDirs: ["public", "app/assets", "assets"],
|
|
4795
|
+
onProgress: (current, total, file) => {
|
|
4796
|
+
process.stdout.write(`\r Processing images: ${current}/${total} - ${file}`);
|
|
4797
|
+
}
|
|
4798
|
+
});
|
|
4799
|
+
const result = await state.optimizer.run();
|
|
4800
|
+
process.stdout.write("\r" + " ".repeat(80) + "\r");
|
|
4801
|
+
console.log(` Processed ${result.processed} images (${result.skipped} skipped)`);
|
|
4802
|
+
console.log(` Generated ${result.variants} variants (${formatBytes(result.totalSize)})`);
|
|
4803
|
+
if (result.errors.length > 0) {
|
|
4804
|
+
console.warn(` ${result.errors.length} errors during image processing`);
|
|
4805
|
+
result.errors.forEach(({ file, error }) => {
|
|
4806
|
+
console.warn(` - ${file}: ${error}`);
|
|
4807
|
+
});
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
},
|
|
4811
|
+
async buildEnd() {
|
|
4812
|
+
if (!state)
|
|
4813
|
+
return;
|
|
4814
|
+
await state.manifest.save();
|
|
4815
|
+
const imageCount = state.processedImages.size;
|
|
4816
|
+
if (imageCount > 0) {
|
|
4817
|
+
console.log(` ${imageCount} images with metadata generated`);
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
};
|
|
4821
|
+
}
|
|
4822
|
+
function formatBytes(bytes) {
|
|
4823
|
+
if (bytes === 0)
|
|
4824
|
+
return "0 B";
|
|
4825
|
+
const k = 1024;
|
|
4826
|
+
const sizes = ["B", "KB", "MB", "GB"];
|
|
4827
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
4828
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
4829
|
+
}
|
|
4830
|
+
export {
|
|
4831
|
+
validateConfig,
|
|
4832
|
+
rgbToHex,
|
|
4833
|
+
optimizeImages,
|
|
4834
|
+
matchesRemotePattern,
|
|
4835
|
+
imagesPlugin,
|
|
4836
|
+
imageMiddleware,
|
|
4837
|
+
hexToRgb,
|
|
4838
|
+
getSizesForWidth,
|
|
4839
|
+
getContrastColor,
|
|
4840
|
+
getAllSizes,
|
|
4841
|
+
generateShimmerSVG,
|
|
4842
|
+
generateShimmerDataURL,
|
|
4843
|
+
generateCacheKey,
|
|
4844
|
+
generateBlurPlaceholder,
|
|
4845
|
+
extractDominantColor,
|
|
4846
|
+
imagesPlugin as default,
|
|
4847
|
+
createSharpProcessor,
|
|
4848
|
+
createManifestManager,
|
|
4849
|
+
createImageProcessor,
|
|
4850
|
+
createImageMiddleware,
|
|
4851
|
+
createBuildOptimizer,
|
|
4852
|
+
TwoTierCache,
|
|
4853
|
+
SharpProcessor,
|
|
4854
|
+
SUPPORTED_OUTPUT_FORMATS,
|
|
4855
|
+
SUPPORTED_INPUT_FORMATS,
|
|
4856
|
+
Picture,
|
|
4857
|
+
MemoryCache,
|
|
4858
|
+
MAX_DIMENSION,
|
|
4859
|
+
ImageProcessor,
|
|
4860
|
+
ImageManifestManager,
|
|
4861
|
+
Image,
|
|
4862
|
+
IMAGE_PATH_PREFIX,
|
|
4863
|
+
FORMAT_MIME_TYPES,
|
|
4864
|
+
DiskCache,
|
|
4865
|
+
DEFAULT_QUALITY,
|
|
4866
|
+
DEFAULT_IMAGE_SIZES,
|
|
4867
|
+
DEFAULT_DEVICE_SIZES3 as DEFAULT_DEVICE_SIZES,
|
|
4868
|
+
ConfigValidationError,
|
|
4869
|
+
BuildOptimizer
|
|
4870
|
+
};
|