@siran/chat-react-hooks 0.1.6 → 0.1.8
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 +1 -1
- package/dist/index.js +69 -1141
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,1105 +1,33 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
7
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
8
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
9
|
-
for (let key of __getOwnPropNames(mod))
|
|
10
|
-
if (!__hasOwnProp.call(to, key))
|
|
11
|
-
__defProp(to, key, {
|
|
12
|
-
get: () => mod[key],
|
|
13
|
-
enumerable: true
|
|
14
|
-
});
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
|
-
|
|
19
|
-
// ../../node_modules/.bun/react@19.2.3/node_modules/react/cjs/react.development.js
|
|
20
|
-
var require_react_development = __commonJS((exports, module) => {
|
|
21
|
-
(function() {
|
|
22
|
-
function defineDeprecationWarning(methodName, info) {
|
|
23
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
24
|
-
get: function() {
|
|
25
|
-
console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function getIteratorFn(maybeIterable) {
|
|
30
|
-
if (maybeIterable === null || typeof maybeIterable !== "object")
|
|
31
|
-
return null;
|
|
32
|
-
maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
|
|
33
|
-
return typeof maybeIterable === "function" ? maybeIterable : null;
|
|
34
|
-
}
|
|
35
|
-
function warnNoop(publicInstance, callerName) {
|
|
36
|
-
publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
|
|
37
|
-
var warningKey = publicInstance + "." + callerName;
|
|
38
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] || (console.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, publicInstance), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
|
|
39
|
-
}
|
|
40
|
-
function Component(props, context, updater) {
|
|
41
|
-
this.props = props;
|
|
42
|
-
this.context = context;
|
|
43
|
-
this.refs = emptyObject;
|
|
44
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
45
|
-
}
|
|
46
|
-
function ComponentDummy() {}
|
|
47
|
-
function PureComponent(props, context, updater) {
|
|
48
|
-
this.props = props;
|
|
49
|
-
this.context = context;
|
|
50
|
-
this.refs = emptyObject;
|
|
51
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
52
|
-
}
|
|
53
|
-
function noop() {}
|
|
54
|
-
function testStringCoercion(value) {
|
|
55
|
-
return "" + value;
|
|
56
|
-
}
|
|
57
|
-
function checkKeyStringCoercion(value) {
|
|
58
|
-
try {
|
|
59
|
-
testStringCoercion(value);
|
|
60
|
-
var JSCompiler_inline_result = false;
|
|
61
|
-
} catch (e) {
|
|
62
|
-
JSCompiler_inline_result = true;
|
|
63
|
-
}
|
|
64
|
-
if (JSCompiler_inline_result) {
|
|
65
|
-
JSCompiler_inline_result = console;
|
|
66
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
67
|
-
var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
68
|
-
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
69
|
-
return testStringCoercion(value);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function getComponentNameFromType(type) {
|
|
73
|
-
if (type == null)
|
|
74
|
-
return null;
|
|
75
|
-
if (typeof type === "function")
|
|
76
|
-
return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
77
|
-
if (typeof type === "string")
|
|
78
|
-
return type;
|
|
79
|
-
switch (type) {
|
|
80
|
-
case REACT_FRAGMENT_TYPE:
|
|
81
|
-
return "Fragment";
|
|
82
|
-
case REACT_PROFILER_TYPE:
|
|
83
|
-
return "Profiler";
|
|
84
|
-
case REACT_STRICT_MODE_TYPE:
|
|
85
|
-
return "StrictMode";
|
|
86
|
-
case REACT_SUSPENSE_TYPE:
|
|
87
|
-
return "Suspense";
|
|
88
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
89
|
-
return "SuspenseList";
|
|
90
|
-
case REACT_ACTIVITY_TYPE:
|
|
91
|
-
return "Activity";
|
|
92
|
-
}
|
|
93
|
-
if (typeof type === "object")
|
|
94
|
-
switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
95
|
-
case REACT_PORTAL_TYPE:
|
|
96
|
-
return "Portal";
|
|
97
|
-
case REACT_CONTEXT_TYPE:
|
|
98
|
-
return type.displayName || "Context";
|
|
99
|
-
case REACT_CONSUMER_TYPE:
|
|
100
|
-
return (type._context.displayName || "Context") + ".Consumer";
|
|
101
|
-
case REACT_FORWARD_REF_TYPE:
|
|
102
|
-
var innerType = type.render;
|
|
103
|
-
type = type.displayName;
|
|
104
|
-
type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
105
|
-
return type;
|
|
106
|
-
case REACT_MEMO_TYPE:
|
|
107
|
-
return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
108
|
-
case REACT_LAZY_TYPE:
|
|
109
|
-
innerType = type._payload;
|
|
110
|
-
type = type._init;
|
|
111
|
-
try {
|
|
112
|
-
return getComponentNameFromType(type(innerType));
|
|
113
|
-
} catch (x) {}
|
|
114
|
-
}
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
function getTaskName(type) {
|
|
118
|
-
if (type === REACT_FRAGMENT_TYPE)
|
|
119
|
-
return "<>";
|
|
120
|
-
if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
|
|
121
|
-
return "<...>";
|
|
122
|
-
try {
|
|
123
|
-
var name = getComponentNameFromType(type);
|
|
124
|
-
return name ? "<" + name + ">" : "<...>";
|
|
125
|
-
} catch (x) {
|
|
126
|
-
return "<...>";
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
function getOwner() {
|
|
130
|
-
var dispatcher = ReactSharedInternals.A;
|
|
131
|
-
return dispatcher === null ? null : dispatcher.getOwner();
|
|
132
|
-
}
|
|
133
|
-
function UnknownOwner() {
|
|
134
|
-
return Error("react-stack-top-frame");
|
|
135
|
-
}
|
|
136
|
-
function hasValidKey(config) {
|
|
137
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
138
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
139
|
-
if (getter && getter.isReactWarning)
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
return config.key !== undefined;
|
|
143
|
-
}
|
|
144
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
145
|
-
function warnAboutAccessingKey() {
|
|
146
|
-
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.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://react.dev/link/special-props)", displayName));
|
|
147
|
-
}
|
|
148
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
149
|
-
Object.defineProperty(props, "key", {
|
|
150
|
-
get: warnAboutAccessingKey,
|
|
151
|
-
configurable: true
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
function elementRefGetterWithDeprecationWarning() {
|
|
155
|
-
var componentName = getComponentNameFromType(this.type);
|
|
156
|
-
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
157
|
-
componentName = this.props.ref;
|
|
158
|
-
return componentName !== undefined ? componentName : null;
|
|
159
|
-
}
|
|
160
|
-
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
161
|
-
var refProp = props.ref;
|
|
162
|
-
type = {
|
|
163
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
164
|
-
type,
|
|
165
|
-
key,
|
|
166
|
-
props,
|
|
167
|
-
_owner: owner
|
|
168
|
-
};
|
|
169
|
-
(refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
|
|
170
|
-
enumerable: false,
|
|
171
|
-
get: elementRefGetterWithDeprecationWarning
|
|
172
|
-
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
173
|
-
type._store = {};
|
|
174
|
-
Object.defineProperty(type._store, "validated", {
|
|
175
|
-
configurable: false,
|
|
176
|
-
enumerable: false,
|
|
177
|
-
writable: true,
|
|
178
|
-
value: 0
|
|
179
|
-
});
|
|
180
|
-
Object.defineProperty(type, "_debugInfo", {
|
|
181
|
-
configurable: false,
|
|
182
|
-
enumerable: false,
|
|
183
|
-
writable: true,
|
|
184
|
-
value: null
|
|
185
|
-
});
|
|
186
|
-
Object.defineProperty(type, "_debugStack", {
|
|
187
|
-
configurable: false,
|
|
188
|
-
enumerable: false,
|
|
189
|
-
writable: true,
|
|
190
|
-
value: debugStack
|
|
191
|
-
});
|
|
192
|
-
Object.defineProperty(type, "_debugTask", {
|
|
193
|
-
configurable: false,
|
|
194
|
-
enumerable: false,
|
|
195
|
-
writable: true,
|
|
196
|
-
value: debugTask
|
|
197
|
-
});
|
|
198
|
-
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
199
|
-
return type;
|
|
200
|
-
}
|
|
201
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
202
|
-
newKey = ReactElement(oldElement.type, newKey, oldElement.props, oldElement._owner, oldElement._debugStack, oldElement._debugTask);
|
|
203
|
-
oldElement._store && (newKey._store.validated = oldElement._store.validated);
|
|
204
|
-
return newKey;
|
|
205
|
-
}
|
|
206
|
-
function validateChildKeys(node) {
|
|
207
|
-
isValidElement(node) ? node._store && (node._store.validated = 1) : typeof node === "object" && node !== null && node.$$typeof === REACT_LAZY_TYPE && (node._payload.status === "fulfilled" ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
208
|
-
}
|
|
209
|
-
function isValidElement(object) {
|
|
210
|
-
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
211
|
-
}
|
|
212
|
-
function escape(key) {
|
|
213
|
-
var escaperLookup = { "=": "=0", ":": "=2" };
|
|
214
|
-
return "$" + key.replace(/[=:]/g, function(match) {
|
|
215
|
-
return escaperLookup[match];
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
function getElementKey(element, index) {
|
|
219
|
-
return typeof element === "object" && element !== null && element.key != null ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
|
|
220
|
-
}
|
|
221
|
-
function resolveThenable(thenable) {
|
|
222
|
-
switch (thenable.status) {
|
|
223
|
-
case "fulfilled":
|
|
224
|
-
return thenable.value;
|
|
225
|
-
case "rejected":
|
|
226
|
-
throw thenable.reason;
|
|
227
|
-
default:
|
|
228
|
-
switch (typeof thenable.status === "string" ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(function(fulfilledValue) {
|
|
229
|
-
thenable.status === "pending" && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
|
|
230
|
-
}, function(error) {
|
|
231
|
-
thenable.status === "pending" && (thenable.status = "rejected", thenable.reason = error);
|
|
232
|
-
})), thenable.status) {
|
|
233
|
-
case "fulfilled":
|
|
234
|
-
return thenable.value;
|
|
235
|
-
case "rejected":
|
|
236
|
-
throw thenable.reason;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
throw thenable;
|
|
240
|
-
}
|
|
241
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
242
|
-
var type = typeof children;
|
|
243
|
-
if (type === "undefined" || type === "boolean")
|
|
244
|
-
children = null;
|
|
245
|
-
var invokeCallback = false;
|
|
246
|
-
if (children === null)
|
|
247
|
-
invokeCallback = true;
|
|
248
|
-
else
|
|
249
|
-
switch (type) {
|
|
250
|
-
case "bigint":
|
|
251
|
-
case "string":
|
|
252
|
-
case "number":
|
|
253
|
-
invokeCallback = true;
|
|
254
|
-
break;
|
|
255
|
-
case "object":
|
|
256
|
-
switch (children.$$typeof) {
|
|
257
|
-
case REACT_ELEMENT_TYPE:
|
|
258
|
-
case REACT_PORTAL_TYPE:
|
|
259
|
-
invokeCallback = true;
|
|
260
|
-
break;
|
|
261
|
-
case REACT_LAZY_TYPE:
|
|
262
|
-
return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
if (invokeCallback) {
|
|
266
|
-
invokeCallback = children;
|
|
267
|
-
callback = callback(invokeCallback);
|
|
268
|
-
var childKey = nameSoFar === "" ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
|
|
269
|
-
isArrayImpl(callback) ? (escapedPrefix = "", childKey != null && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
|
|
270
|
-
return c;
|
|
271
|
-
})) : callback != null && (isValidElement(callback) && (callback.key != null && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(callback, escapedPrefix + (callback.key == null || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + childKey), nameSoFar !== "" && invokeCallback != null && isValidElement(invokeCallback) && invokeCallback.key == null && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
|
|
272
|
-
return 1;
|
|
273
|
-
}
|
|
274
|
-
invokeCallback = 0;
|
|
275
|
-
childKey = nameSoFar === "" ? "." : nameSoFar + ":";
|
|
276
|
-
if (isArrayImpl(children))
|
|
277
|
-
for (var i = 0;i < children.length; i++)
|
|
278
|
-
nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
|
|
279
|
-
else if (i = getIteratorFn(children), typeof i === "function")
|
|
280
|
-
for (i === children.entries && (didWarnAboutMaps || console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = true), children = i.call(children), i = 0;!(nameSoFar = children.next()).done; )
|
|
281
|
-
nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
|
|
282
|
-
else if (type === "object") {
|
|
283
|
-
if (typeof children.then === "function")
|
|
284
|
-
return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
|
|
285
|
-
array = String(children);
|
|
286
|
-
throw Error("Objects are not valid as a React child (found: " + (array === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead.");
|
|
287
|
-
}
|
|
288
|
-
return invokeCallback;
|
|
289
|
-
}
|
|
290
|
-
function mapChildren(children, func, context) {
|
|
291
|
-
if (children == null)
|
|
292
|
-
return children;
|
|
293
|
-
var result = [], count = 0;
|
|
294
|
-
mapIntoArray(children, result, "", "", function(child) {
|
|
295
|
-
return func.call(context, child, count++);
|
|
296
|
-
});
|
|
297
|
-
return result;
|
|
298
|
-
}
|
|
299
|
-
function lazyInitializer(payload) {
|
|
300
|
-
if (payload._status === -1) {
|
|
301
|
-
var ioInfo = payload._ioInfo;
|
|
302
|
-
ioInfo != null && (ioInfo.start = ioInfo.end = performance.now());
|
|
303
|
-
ioInfo = payload._result;
|
|
304
|
-
var thenable = ioInfo();
|
|
305
|
-
thenable.then(function(moduleObject) {
|
|
306
|
-
if (payload._status === 0 || payload._status === -1) {
|
|
307
|
-
payload._status = 1;
|
|
308
|
-
payload._result = moduleObject;
|
|
309
|
-
var _ioInfo = payload._ioInfo;
|
|
310
|
-
_ioInfo != null && (_ioInfo.end = performance.now());
|
|
311
|
-
thenable.status === undefined && (thenable.status = "fulfilled", thenable.value = moduleObject);
|
|
312
|
-
}
|
|
313
|
-
}, function(error) {
|
|
314
|
-
if (payload._status === 0 || payload._status === -1) {
|
|
315
|
-
payload._status = 2;
|
|
316
|
-
payload._result = error;
|
|
317
|
-
var _ioInfo2 = payload._ioInfo;
|
|
318
|
-
_ioInfo2 != null && (_ioInfo2.end = performance.now());
|
|
319
|
-
thenable.status === undefined && (thenable.status = "rejected", thenable.reason = error);
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
ioInfo = payload._ioInfo;
|
|
323
|
-
if (ioInfo != null) {
|
|
324
|
-
ioInfo.value = thenable;
|
|
325
|
-
var displayName = thenable.displayName;
|
|
326
|
-
typeof displayName === "string" && (ioInfo.name = displayName);
|
|
327
|
-
}
|
|
328
|
-
payload._status === -1 && (payload._status = 0, payload._result = thenable);
|
|
329
|
-
}
|
|
330
|
-
if (payload._status === 1)
|
|
331
|
-
return ioInfo = payload._result, ioInfo === undefined && console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
332
|
-
|
|
333
|
-
Your code should look like:
|
|
334
|
-
const MyComponent = lazy(() => import('./MyComponent'))
|
|
335
|
-
|
|
336
|
-
Did you accidentally put curly braces around the import?`, ioInfo), "default" in ioInfo || console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
337
|
-
|
|
338
|
-
Your code should look like:
|
|
339
|
-
const MyComponent = lazy(() => import('./MyComponent'))`, ioInfo), ioInfo.default;
|
|
340
|
-
throw payload._result;
|
|
341
|
-
}
|
|
342
|
-
function resolveDispatcher() {
|
|
343
|
-
var dispatcher = ReactSharedInternals.H;
|
|
344
|
-
dispatcher === null && console.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:
|
|
345
|
-
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
346
|
-
2. You might be breaking the Rules of Hooks
|
|
347
|
-
3. You might have more than one copy of React in the same app
|
|
348
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`);
|
|
349
|
-
return dispatcher;
|
|
350
|
-
}
|
|
351
|
-
function releaseAsyncTransition() {
|
|
352
|
-
ReactSharedInternals.asyncTransitions--;
|
|
353
|
-
}
|
|
354
|
-
function enqueueTask(task) {
|
|
355
|
-
if (enqueueTaskImpl === null)
|
|
356
|
-
try {
|
|
357
|
-
var requireString = ("require" + Math.random()).slice(0, 7);
|
|
358
|
-
enqueueTaskImpl = (module && module[requireString]).call(module, "timers").setImmediate;
|
|
359
|
-
} catch (_err) {
|
|
360
|
-
enqueueTaskImpl = function(callback) {
|
|
361
|
-
didWarnAboutMessageChannel === false && (didWarnAboutMessageChannel = true, typeof MessageChannel === "undefined" && console.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."));
|
|
362
|
-
var channel = new MessageChannel;
|
|
363
|
-
channel.port1.onmessage = callback;
|
|
364
|
-
channel.port2.postMessage(undefined);
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
return enqueueTaskImpl(task);
|
|
368
|
-
}
|
|
369
|
-
function aggregateErrors(errors) {
|
|
370
|
-
return 1 < errors.length && typeof AggregateError === "function" ? new AggregateError(errors) : errors[0];
|
|
371
|
-
}
|
|
372
|
-
function popActScope(prevActQueue, prevActScopeDepth) {
|
|
373
|
-
prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
|
|
374
|
-
actScopeDepth = prevActScopeDepth;
|
|
375
|
-
}
|
|
376
|
-
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
377
|
-
var queue = ReactSharedInternals.actQueue;
|
|
378
|
-
if (queue !== null)
|
|
379
|
-
if (queue.length !== 0)
|
|
380
|
-
try {
|
|
381
|
-
flushActQueue(queue);
|
|
382
|
-
enqueueTask(function() {
|
|
383
|
-
return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
384
|
-
});
|
|
385
|
-
return;
|
|
386
|
-
} catch (error) {
|
|
387
|
-
ReactSharedInternals.thrownErrors.push(error);
|
|
388
|
-
}
|
|
389
|
-
else
|
|
390
|
-
ReactSharedInternals.actQueue = null;
|
|
391
|
-
0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
|
|
392
|
-
}
|
|
393
|
-
function flushActQueue(queue) {
|
|
394
|
-
if (!isFlushing) {
|
|
395
|
-
isFlushing = true;
|
|
396
|
-
var i = 0;
|
|
397
|
-
try {
|
|
398
|
-
for (;i < queue.length; i++) {
|
|
399
|
-
var callback = queue[i];
|
|
400
|
-
do {
|
|
401
|
-
ReactSharedInternals.didUsePromise = false;
|
|
402
|
-
var continuation = callback(false);
|
|
403
|
-
if (continuation !== null) {
|
|
404
|
-
if (ReactSharedInternals.didUsePromise) {
|
|
405
|
-
queue[i] = callback;
|
|
406
|
-
queue.splice(0, i);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
callback = continuation;
|
|
410
|
-
} else
|
|
411
|
-
break;
|
|
412
|
-
} while (1);
|
|
413
|
-
}
|
|
414
|
-
queue.length = 0;
|
|
415
|
-
} catch (error) {
|
|
416
|
-
queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
|
|
417
|
-
} finally {
|
|
418
|
-
isFlushing = false;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
423
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
|
|
424
|
-
isMounted: function() {
|
|
425
|
-
return false;
|
|
426
|
-
},
|
|
427
|
-
enqueueForceUpdate: function(publicInstance) {
|
|
428
|
-
warnNoop(publicInstance, "forceUpdate");
|
|
429
|
-
},
|
|
430
|
-
enqueueReplaceState: function(publicInstance) {
|
|
431
|
-
warnNoop(publicInstance, "replaceState");
|
|
432
|
-
},
|
|
433
|
-
enqueueSetState: function(publicInstance) {
|
|
434
|
-
warnNoop(publicInstance, "setState");
|
|
435
|
-
}
|
|
436
|
-
}, assign = Object.assign, emptyObject = {};
|
|
437
|
-
Object.freeze(emptyObject);
|
|
438
|
-
Component.prototype.isReactComponent = {};
|
|
439
|
-
Component.prototype.setState = function(partialState, callback) {
|
|
440
|
-
if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null)
|
|
441
|
-
throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
|
|
442
|
-
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
443
|
-
};
|
|
444
|
-
Component.prototype.forceUpdate = function(callback) {
|
|
445
|
-
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
446
|
-
};
|
|
447
|
-
var deprecatedAPIs = {
|
|
448
|
-
isMounted: [
|
|
449
|
-
"isMounted",
|
|
450
|
-
"Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
|
|
451
|
-
],
|
|
452
|
-
replaceState: [
|
|
453
|
-
"replaceState",
|
|
454
|
-
"Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
|
|
455
|
-
]
|
|
456
|
-
};
|
|
457
|
-
for (fnName in deprecatedAPIs)
|
|
458
|
-
deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
459
|
-
ComponentDummy.prototype = Component.prototype;
|
|
460
|
-
deprecatedAPIs = PureComponent.prototype = new ComponentDummy;
|
|
461
|
-
deprecatedAPIs.constructor = PureComponent;
|
|
462
|
-
assign(deprecatedAPIs, Component.prototype);
|
|
463
|
-
deprecatedAPIs.isPureReactComponent = true;
|
|
464
|
-
var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
|
|
465
|
-
H: null,
|
|
466
|
-
A: null,
|
|
467
|
-
T: null,
|
|
468
|
-
S: null,
|
|
469
|
-
actQueue: null,
|
|
470
|
-
asyncTransitions: 0,
|
|
471
|
-
isBatchingLegacy: false,
|
|
472
|
-
didScheduleLegacyUpdate: false,
|
|
473
|
-
didUsePromise: false,
|
|
474
|
-
thrownErrors: [],
|
|
475
|
-
getCurrentStack: null,
|
|
476
|
-
recentlyCreatedOwnerStacks: 0
|
|
477
|
-
}, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
|
|
478
|
-
return null;
|
|
479
|
-
};
|
|
480
|
-
deprecatedAPIs = {
|
|
481
|
-
react_stack_bottom_frame: function(callStackForError) {
|
|
482
|
-
return callStackForError();
|
|
483
|
-
}
|
|
484
|
-
};
|
|
485
|
-
var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
|
|
486
|
-
var didWarnAboutElementRef = {};
|
|
487
|
-
var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(deprecatedAPIs, UnknownOwner)();
|
|
488
|
-
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
489
|
-
var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = typeof reportError === "function" ? reportError : function(error) {
|
|
490
|
-
if (typeof window === "object" && typeof window.ErrorEvent === "function") {
|
|
491
|
-
var event = new window.ErrorEvent("error", {
|
|
492
|
-
bubbles: true,
|
|
493
|
-
cancelable: true,
|
|
494
|
-
message: typeof error === "object" && error !== null && typeof error.message === "string" ? String(error.message) : String(error),
|
|
495
|
-
error
|
|
496
|
-
});
|
|
497
|
-
if (!window.dispatchEvent(event))
|
|
498
|
-
return;
|
|
499
|
-
} else if (typeof process === "object" && typeof process.emit === "function") {
|
|
500
|
-
process.emit("uncaughtException", error);
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
console.error(error);
|
|
504
|
-
}, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = typeof queueMicrotask === "function" ? function(callback) {
|
|
505
|
-
queueMicrotask(function() {
|
|
506
|
-
return queueMicrotask(callback);
|
|
507
|
-
});
|
|
508
|
-
} : enqueueTask;
|
|
509
|
-
deprecatedAPIs = Object.freeze({
|
|
510
|
-
__proto__: null,
|
|
511
|
-
c: function(size) {
|
|
512
|
-
return resolveDispatcher().useMemoCache(size);
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
var fnName = {
|
|
516
|
-
map: mapChildren,
|
|
517
|
-
forEach: function(children, forEachFunc, forEachContext) {
|
|
518
|
-
mapChildren(children, function() {
|
|
519
|
-
forEachFunc.apply(this, arguments);
|
|
520
|
-
}, forEachContext);
|
|
521
|
-
},
|
|
522
|
-
count: function(children) {
|
|
523
|
-
var n = 0;
|
|
524
|
-
mapChildren(children, function() {
|
|
525
|
-
n++;
|
|
526
|
-
});
|
|
527
|
-
return n;
|
|
528
|
-
},
|
|
529
|
-
toArray: function(children) {
|
|
530
|
-
return mapChildren(children, function(child) {
|
|
531
|
-
return child;
|
|
532
|
-
}) || [];
|
|
533
|
-
},
|
|
534
|
-
only: function(children) {
|
|
535
|
-
if (!isValidElement(children))
|
|
536
|
-
throw Error("React.Children.only expected to receive a single React element child.");
|
|
537
|
-
return children;
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
exports.Activity = REACT_ACTIVITY_TYPE;
|
|
541
|
-
exports.Children = fnName;
|
|
542
|
-
exports.Component = Component;
|
|
543
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
544
|
-
exports.Profiler = REACT_PROFILER_TYPE;
|
|
545
|
-
exports.PureComponent = PureComponent;
|
|
546
|
-
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
547
|
-
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
548
|
-
exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
|
|
549
|
-
exports.__COMPILER_RUNTIME = deprecatedAPIs;
|
|
550
|
-
exports.act = function(callback) {
|
|
551
|
-
var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
|
|
552
|
-
actScopeDepth++;
|
|
553
|
-
var queue = ReactSharedInternals.actQueue = prevActQueue !== null ? prevActQueue : [], didAwaitActCall = false;
|
|
554
|
-
try {
|
|
555
|
-
var result = callback();
|
|
556
|
-
} catch (error) {
|
|
557
|
-
ReactSharedInternals.thrownErrors.push(error);
|
|
558
|
-
}
|
|
559
|
-
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
560
|
-
throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
561
|
-
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
|
562
|
-
var thenable = result;
|
|
563
|
-
queueSeveralMicrotasks(function() {
|
|
564
|
-
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.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 () => ...);"));
|
|
565
|
-
});
|
|
566
|
-
return {
|
|
567
|
-
then: function(resolve, reject) {
|
|
568
|
-
didAwaitActCall = true;
|
|
569
|
-
thenable.then(function(returnValue) {
|
|
570
|
-
popActScope(prevActQueue, prevActScopeDepth);
|
|
571
|
-
if (prevActScopeDepth === 0) {
|
|
572
|
-
try {
|
|
573
|
-
flushActQueue(queue), enqueueTask(function() {
|
|
574
|
-
return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
575
|
-
});
|
|
576
|
-
} catch (error$0) {
|
|
577
|
-
ReactSharedInternals.thrownErrors.push(error$0);
|
|
578
|
-
}
|
|
579
|
-
if (0 < ReactSharedInternals.thrownErrors.length) {
|
|
580
|
-
var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
|
|
581
|
-
ReactSharedInternals.thrownErrors.length = 0;
|
|
582
|
-
reject(_thrownError);
|
|
583
|
-
}
|
|
584
|
-
} else
|
|
585
|
-
resolve(returnValue);
|
|
586
|
-
}, function(error) {
|
|
587
|
-
popActScope(prevActQueue, prevActScopeDepth);
|
|
588
|
-
0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
var returnValue$jscomp$0 = result;
|
|
594
|
-
popActScope(prevActQueue, prevActScopeDepth);
|
|
595
|
-
prevActScopeDepth === 0 && (flushActQueue(queue), queue.length !== 0 && queueSeveralMicrotasks(function() {
|
|
596
|
-
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));
|
|
597
|
-
}), ReactSharedInternals.actQueue = null);
|
|
598
|
-
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
599
|
-
throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
600
|
-
return {
|
|
601
|
-
then: function(resolve, reject) {
|
|
602
|
-
didAwaitActCall = true;
|
|
603
|
-
prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
|
|
604
|
-
return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve, reject);
|
|
605
|
-
})) : resolve(returnValue$jscomp$0);
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
};
|
|
609
|
-
exports.cache = function(fn) {
|
|
610
|
-
return function() {
|
|
611
|
-
return fn.apply(null, arguments);
|
|
612
|
-
};
|
|
613
|
-
};
|
|
614
|
-
exports.cacheSignal = function() {
|
|
615
|
-
return null;
|
|
616
|
-
};
|
|
617
|
-
exports.captureOwnerStack = function() {
|
|
618
|
-
var getCurrentStack = ReactSharedInternals.getCurrentStack;
|
|
619
|
-
return getCurrentStack === null ? null : getCurrentStack();
|
|
620
|
-
};
|
|
621
|
-
exports.cloneElement = function(element, config, children) {
|
|
622
|
-
if (element === null || element === undefined)
|
|
623
|
-
throw Error("The argument must be a React element, but you passed " + element + ".");
|
|
624
|
-
var props = assign({}, element.props), key = element.key, owner = element._owner;
|
|
625
|
-
if (config != null) {
|
|
626
|
-
var JSCompiler_inline_result;
|
|
627
|
-
a: {
|
|
628
|
-
if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(config, "ref").get) && JSCompiler_inline_result.isReactWarning) {
|
|
629
|
-
JSCompiler_inline_result = false;
|
|
630
|
-
break a;
|
|
631
|
-
}
|
|
632
|
-
JSCompiler_inline_result = config.ref !== undefined;
|
|
633
|
-
}
|
|
634
|
-
JSCompiler_inline_result && (owner = getOwner());
|
|
635
|
-
hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
|
|
636
|
-
for (propName in config)
|
|
637
|
-
!hasOwnProperty.call(config, propName) || propName === "key" || propName === "__self" || propName === "__source" || propName === "ref" && config.ref === undefined || (props[propName] = config[propName]);
|
|
638
|
-
}
|
|
639
|
-
var propName = arguments.length - 2;
|
|
640
|
-
if (propName === 1)
|
|
641
|
-
props.children = children;
|
|
642
|
-
else if (1 < propName) {
|
|
643
|
-
JSCompiler_inline_result = Array(propName);
|
|
644
|
-
for (var i = 0;i < propName; i++)
|
|
645
|
-
JSCompiler_inline_result[i] = arguments[i + 2];
|
|
646
|
-
props.children = JSCompiler_inline_result;
|
|
647
|
-
}
|
|
648
|
-
props = ReactElement(element.type, key, props, owner, element._debugStack, element._debugTask);
|
|
649
|
-
for (key = 2;key < arguments.length; key++)
|
|
650
|
-
validateChildKeys(arguments[key]);
|
|
651
|
-
return props;
|
|
652
|
-
};
|
|
653
|
-
exports.createContext = function(defaultValue) {
|
|
654
|
-
defaultValue = {
|
|
655
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
656
|
-
_currentValue: defaultValue,
|
|
657
|
-
_currentValue2: defaultValue,
|
|
658
|
-
_threadCount: 0,
|
|
659
|
-
Provider: null,
|
|
660
|
-
Consumer: null
|
|
661
|
-
};
|
|
662
|
-
defaultValue.Provider = defaultValue;
|
|
663
|
-
defaultValue.Consumer = {
|
|
664
|
-
$$typeof: REACT_CONSUMER_TYPE,
|
|
665
|
-
_context: defaultValue
|
|
666
|
-
};
|
|
667
|
-
defaultValue._currentRenderer = null;
|
|
668
|
-
defaultValue._currentRenderer2 = null;
|
|
669
|
-
return defaultValue;
|
|
670
|
-
};
|
|
671
|
-
exports.createElement = function(type, config, children) {
|
|
672
|
-
for (var i = 2;i < arguments.length; i++)
|
|
673
|
-
validateChildKeys(arguments[i]);
|
|
674
|
-
i = {};
|
|
675
|
-
var key = null;
|
|
676
|
-
if (config != null)
|
|
677
|
-
for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
|
|
678
|
-
hasOwnProperty.call(config, propName) && propName !== "key" && propName !== "__self" && propName !== "__source" && (i[propName] = config[propName]);
|
|
679
|
-
var childrenLength = arguments.length - 2;
|
|
680
|
-
if (childrenLength === 1)
|
|
681
|
-
i.children = children;
|
|
682
|
-
else if (1 < childrenLength) {
|
|
683
|
-
for (var childArray = Array(childrenLength), _i = 0;_i < childrenLength; _i++)
|
|
684
|
-
childArray[_i] = arguments[_i + 2];
|
|
685
|
-
Object.freeze && Object.freeze(childArray);
|
|
686
|
-
i.children = childArray;
|
|
687
|
-
}
|
|
688
|
-
if (type && type.defaultProps)
|
|
689
|
-
for (propName in childrenLength = type.defaultProps, childrenLength)
|
|
690
|
-
i[propName] === undefined && (i[propName] = childrenLength[propName]);
|
|
691
|
-
key && defineKeyPropWarningGetter(i, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
|
|
692
|
-
var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
693
|
-
return ReactElement(type, key, i, getOwner(), propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
694
|
-
};
|
|
695
|
-
exports.createRef = function() {
|
|
696
|
-
var refObject = { current: null };
|
|
697
|
-
Object.seal(refObject);
|
|
698
|
-
return refObject;
|
|
699
|
-
};
|
|
700
|
-
exports.forwardRef = function(render) {
|
|
701
|
-
render != null && render.$$typeof === REACT_MEMO_TYPE ? console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).") : typeof render !== "function" ? console.error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render) : render.length !== 0 && render.length !== 2 && console.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.");
|
|
702
|
-
render != null && render.defaultProps != null && console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");
|
|
703
|
-
var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
|
|
704
|
-
Object.defineProperty(elementType, "displayName", {
|
|
705
|
-
enumerable: false,
|
|
706
|
-
configurable: true,
|
|
707
|
-
get: function() {
|
|
708
|
-
return ownName;
|
|
709
|
-
},
|
|
710
|
-
set: function(name) {
|
|
711
|
-
ownName = name;
|
|
712
|
-
render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
|
|
713
|
-
}
|
|
714
|
-
});
|
|
715
|
-
return elementType;
|
|
716
|
-
};
|
|
717
|
-
exports.isValidElement = isValidElement;
|
|
718
|
-
exports.lazy = function(ctor) {
|
|
719
|
-
ctor = { _status: -1, _result: ctor };
|
|
720
|
-
var lazyType = {
|
|
721
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
722
|
-
_payload: ctor,
|
|
723
|
-
_init: lazyInitializer
|
|
724
|
-
}, ioInfo = {
|
|
725
|
-
name: "lazy",
|
|
726
|
-
start: -1,
|
|
727
|
-
end: -1,
|
|
728
|
-
value: null,
|
|
729
|
-
owner: null,
|
|
730
|
-
debugStack: Error("react-stack-top-frame"),
|
|
731
|
-
debugTask: console.createTask ? console.createTask("lazy()") : null
|
|
732
|
-
};
|
|
733
|
-
ctor._ioInfo = ioInfo;
|
|
734
|
-
lazyType._debugInfo = [{ awaited: ioInfo }];
|
|
735
|
-
return lazyType;
|
|
736
|
-
};
|
|
737
|
-
exports.memo = function(type, compare) {
|
|
738
|
-
type == null && console.error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
|
|
739
|
-
compare = {
|
|
740
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
741
|
-
type,
|
|
742
|
-
compare: compare === undefined ? null : compare
|
|
743
|
-
};
|
|
744
|
-
var ownName;
|
|
745
|
-
Object.defineProperty(compare, "displayName", {
|
|
746
|
-
enumerable: false,
|
|
747
|
-
configurable: true,
|
|
748
|
-
get: function() {
|
|
749
|
-
return ownName;
|
|
750
|
-
},
|
|
751
|
-
set: function(name) {
|
|
752
|
-
ownName = name;
|
|
753
|
-
type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
return compare;
|
|
757
|
-
};
|
|
758
|
-
exports.startTransition = function(scope) {
|
|
759
|
-
var prevTransition = ReactSharedInternals.T, currentTransition = {};
|
|
760
|
-
currentTransition._updatedFibers = new Set;
|
|
761
|
-
ReactSharedInternals.T = currentTransition;
|
|
762
|
-
try {
|
|
763
|
-
var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
|
|
764
|
-
onStartTransitionFinish !== null && onStartTransitionFinish(currentTransition, returnValue);
|
|
765
|
-
typeof returnValue === "object" && returnValue !== null && typeof returnValue.then === "function" && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
|
|
766
|
-
} catch (error) {
|
|
767
|
-
reportGlobalError(error);
|
|
768
|
-
} finally {
|
|
769
|
-
prevTransition === null && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.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.")), prevTransition !== null && currentTransition.types !== null && (prevTransition.types !== null && prevTransition.types !== currentTransition.types && console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
|
|
770
|
-
}
|
|
771
|
-
};
|
|
772
|
-
exports.unstable_useCacheRefresh = function() {
|
|
773
|
-
return resolveDispatcher().useCacheRefresh();
|
|
774
|
-
};
|
|
775
|
-
exports.use = function(usable) {
|
|
776
|
-
return resolveDispatcher().use(usable);
|
|
777
|
-
};
|
|
778
|
-
exports.useActionState = function(action, initialState, permalink) {
|
|
779
|
-
return resolveDispatcher().useActionState(action, initialState, permalink);
|
|
780
|
-
};
|
|
781
|
-
exports.useCallback = function(callback, deps) {
|
|
782
|
-
return resolveDispatcher().useCallback(callback, deps);
|
|
783
|
-
};
|
|
784
|
-
exports.useContext = function(Context) {
|
|
785
|
-
var dispatcher = resolveDispatcher();
|
|
786
|
-
Context.$$typeof === REACT_CONSUMER_TYPE && console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?");
|
|
787
|
-
return dispatcher.useContext(Context);
|
|
788
|
-
};
|
|
789
|
-
exports.useDebugValue = function(value, formatterFn) {
|
|
790
|
-
return resolveDispatcher().useDebugValue(value, formatterFn);
|
|
791
|
-
};
|
|
792
|
-
exports.useDeferredValue = function(value, initialValue) {
|
|
793
|
-
return resolveDispatcher().useDeferredValue(value, initialValue);
|
|
794
|
-
};
|
|
795
|
-
exports.useEffect = function(create, deps) {
|
|
796
|
-
create == null && console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");
|
|
797
|
-
return resolveDispatcher().useEffect(create, deps);
|
|
798
|
-
};
|
|
799
|
-
exports.useEffectEvent = function(callback) {
|
|
800
|
-
return resolveDispatcher().useEffectEvent(callback);
|
|
801
|
-
};
|
|
802
|
-
exports.useId = function() {
|
|
803
|
-
return resolveDispatcher().useId();
|
|
804
|
-
};
|
|
805
|
-
exports.useImperativeHandle = function(ref, create, deps) {
|
|
806
|
-
return resolveDispatcher().useImperativeHandle(ref, create, deps);
|
|
807
|
-
};
|
|
808
|
-
exports.useInsertionEffect = function(create, deps) {
|
|
809
|
-
create == null && console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?");
|
|
810
|
-
return resolveDispatcher().useInsertionEffect(create, deps);
|
|
811
|
-
};
|
|
812
|
-
exports.useLayoutEffect = function(create, deps) {
|
|
813
|
-
create == null && console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?");
|
|
814
|
-
return resolveDispatcher().useLayoutEffect(create, deps);
|
|
815
|
-
};
|
|
816
|
-
exports.useMemo = function(create, deps) {
|
|
817
|
-
return resolveDispatcher().useMemo(create, deps);
|
|
818
|
-
};
|
|
819
|
-
exports.useOptimistic = function(passthrough, reducer) {
|
|
820
|
-
return resolveDispatcher().useOptimistic(passthrough, reducer);
|
|
821
|
-
};
|
|
822
|
-
exports.useReducer = function(reducer, initialArg, init) {
|
|
823
|
-
return resolveDispatcher().useReducer(reducer, initialArg, init);
|
|
824
|
-
};
|
|
825
|
-
exports.useRef = function(initialValue) {
|
|
826
|
-
return resolveDispatcher().useRef(initialValue);
|
|
827
|
-
};
|
|
828
|
-
exports.useState = function(initialState) {
|
|
829
|
-
return resolveDispatcher().useState(initialState);
|
|
830
|
-
};
|
|
831
|
-
exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
|
|
832
|
-
return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
833
|
-
};
|
|
834
|
-
exports.useTransition = function() {
|
|
835
|
-
return resolveDispatcher().useTransition();
|
|
836
|
-
};
|
|
837
|
-
exports.version = "19.2.3";
|
|
838
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
839
|
-
})();
|
|
840
|
-
});
|
|
841
|
-
|
|
842
|
-
// ../../node_modules/.bun/react@19.2.3/node_modules/react/index.js
|
|
843
|
-
var require_react = __commonJS((exports, module) => {
|
|
844
|
-
var react_development = __toESM(require_react_development());
|
|
845
|
-
if (false) {} else {
|
|
846
|
-
module.exports = react_development;
|
|
847
|
-
}
|
|
848
|
-
});
|
|
849
|
-
|
|
850
|
-
// ../../node_modules/.bun/react@19.2.3/node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
|
851
|
-
var require_react_jsx_dev_runtime_development = __commonJS((exports) => {
|
|
852
|
-
var React = __toESM(require_react());
|
|
853
|
-
(function() {
|
|
854
|
-
function getComponentNameFromType(type) {
|
|
855
|
-
if (type == null)
|
|
856
|
-
return null;
|
|
857
|
-
if (typeof type === "function")
|
|
858
|
-
return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
859
|
-
if (typeof type === "string")
|
|
860
|
-
return type;
|
|
861
|
-
switch (type) {
|
|
862
|
-
case REACT_FRAGMENT_TYPE:
|
|
863
|
-
return "Fragment";
|
|
864
|
-
case REACT_PROFILER_TYPE:
|
|
865
|
-
return "Profiler";
|
|
866
|
-
case REACT_STRICT_MODE_TYPE:
|
|
867
|
-
return "StrictMode";
|
|
868
|
-
case REACT_SUSPENSE_TYPE:
|
|
869
|
-
return "Suspense";
|
|
870
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
871
|
-
return "SuspenseList";
|
|
872
|
-
case REACT_ACTIVITY_TYPE:
|
|
873
|
-
return "Activity";
|
|
874
|
-
}
|
|
875
|
-
if (typeof type === "object")
|
|
876
|
-
switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
877
|
-
case REACT_PORTAL_TYPE:
|
|
878
|
-
return "Portal";
|
|
879
|
-
case REACT_CONTEXT_TYPE:
|
|
880
|
-
return type.displayName || "Context";
|
|
881
|
-
case REACT_CONSUMER_TYPE:
|
|
882
|
-
return (type._context.displayName || "Context") + ".Consumer";
|
|
883
|
-
case REACT_FORWARD_REF_TYPE:
|
|
884
|
-
var innerType = type.render;
|
|
885
|
-
type = type.displayName;
|
|
886
|
-
type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
887
|
-
return type;
|
|
888
|
-
case REACT_MEMO_TYPE:
|
|
889
|
-
return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
890
|
-
case REACT_LAZY_TYPE:
|
|
891
|
-
innerType = type._payload;
|
|
892
|
-
type = type._init;
|
|
893
|
-
try {
|
|
894
|
-
return getComponentNameFromType(type(innerType));
|
|
895
|
-
} catch (x) {}
|
|
896
|
-
}
|
|
897
|
-
return null;
|
|
898
|
-
}
|
|
899
|
-
function testStringCoercion(value) {
|
|
900
|
-
return "" + value;
|
|
901
|
-
}
|
|
902
|
-
function checkKeyStringCoercion(value) {
|
|
903
|
-
try {
|
|
904
|
-
testStringCoercion(value);
|
|
905
|
-
var JSCompiler_inline_result = false;
|
|
906
|
-
} catch (e) {
|
|
907
|
-
JSCompiler_inline_result = true;
|
|
908
|
-
}
|
|
909
|
-
if (JSCompiler_inline_result) {
|
|
910
|
-
JSCompiler_inline_result = console;
|
|
911
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
912
|
-
var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
913
|
-
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
914
|
-
return testStringCoercion(value);
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
function getTaskName(type) {
|
|
918
|
-
if (type === REACT_FRAGMENT_TYPE)
|
|
919
|
-
return "<>";
|
|
920
|
-
if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
|
|
921
|
-
return "<...>";
|
|
922
|
-
try {
|
|
923
|
-
var name = getComponentNameFromType(type);
|
|
924
|
-
return name ? "<" + name + ">" : "<...>";
|
|
925
|
-
} catch (x) {
|
|
926
|
-
return "<...>";
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
function getOwner() {
|
|
930
|
-
var dispatcher = ReactSharedInternals.A;
|
|
931
|
-
return dispatcher === null ? null : dispatcher.getOwner();
|
|
932
|
-
}
|
|
933
|
-
function UnknownOwner() {
|
|
934
|
-
return Error("react-stack-top-frame");
|
|
935
|
-
}
|
|
936
|
-
function hasValidKey(config) {
|
|
937
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
938
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
939
|
-
if (getter && getter.isReactWarning)
|
|
940
|
-
return false;
|
|
941
|
-
}
|
|
942
|
-
return config.key !== undefined;
|
|
943
|
-
}
|
|
944
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
945
|
-
function warnAboutAccessingKey() {
|
|
946
|
-
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.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://react.dev/link/special-props)", displayName));
|
|
947
|
-
}
|
|
948
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
949
|
-
Object.defineProperty(props, "key", {
|
|
950
|
-
get: warnAboutAccessingKey,
|
|
951
|
-
configurable: true
|
|
952
|
-
});
|
|
953
|
-
}
|
|
954
|
-
function elementRefGetterWithDeprecationWarning() {
|
|
955
|
-
var componentName = getComponentNameFromType(this.type);
|
|
956
|
-
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
957
|
-
componentName = this.props.ref;
|
|
958
|
-
return componentName !== undefined ? componentName : null;
|
|
959
|
-
}
|
|
960
|
-
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
961
|
-
var refProp = props.ref;
|
|
962
|
-
type = {
|
|
963
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
964
|
-
type,
|
|
965
|
-
key,
|
|
966
|
-
props,
|
|
967
|
-
_owner: owner
|
|
968
|
-
};
|
|
969
|
-
(refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
|
|
970
|
-
enumerable: false,
|
|
971
|
-
get: elementRefGetterWithDeprecationWarning
|
|
972
|
-
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
973
|
-
type._store = {};
|
|
974
|
-
Object.defineProperty(type._store, "validated", {
|
|
975
|
-
configurable: false,
|
|
976
|
-
enumerable: false,
|
|
977
|
-
writable: true,
|
|
978
|
-
value: 0
|
|
979
|
-
});
|
|
980
|
-
Object.defineProperty(type, "_debugInfo", {
|
|
981
|
-
configurable: false,
|
|
982
|
-
enumerable: false,
|
|
983
|
-
writable: true,
|
|
984
|
-
value: null
|
|
985
|
-
});
|
|
986
|
-
Object.defineProperty(type, "_debugStack", {
|
|
987
|
-
configurable: false,
|
|
988
|
-
enumerable: false,
|
|
989
|
-
writable: true,
|
|
990
|
-
value: debugStack
|
|
991
|
-
});
|
|
992
|
-
Object.defineProperty(type, "_debugTask", {
|
|
993
|
-
configurable: false,
|
|
994
|
-
enumerable: false,
|
|
995
|
-
writable: true,
|
|
996
|
-
value: debugTask
|
|
997
|
-
});
|
|
998
|
-
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
999
|
-
return type;
|
|
1000
|
-
}
|
|
1001
|
-
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
1002
|
-
var children = config.children;
|
|
1003
|
-
if (children !== undefined)
|
|
1004
|
-
if (isStaticChildren)
|
|
1005
|
-
if (isArrayImpl(children)) {
|
|
1006
|
-
for (isStaticChildren = 0;isStaticChildren < children.length; isStaticChildren++)
|
|
1007
|
-
validateChildKeys(children[isStaticChildren]);
|
|
1008
|
-
Object.freeze && Object.freeze(children);
|
|
1009
|
-
} else
|
|
1010
|
-
console.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.");
|
|
1011
|
-
else
|
|
1012
|
-
validateChildKeys(children);
|
|
1013
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
1014
|
-
children = getComponentNameFromType(type);
|
|
1015
|
-
var keys = Object.keys(config).filter(function(k) {
|
|
1016
|
-
return k !== "key";
|
|
1017
|
-
});
|
|
1018
|
-
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
1019
|
-
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
1020
|
-
let props = %s;
|
|
1021
|
-
<%s {...props} />
|
|
1022
|
-
React keys must be passed directly to JSX without using spread:
|
|
1023
|
-
let props = %s;
|
|
1024
|
-
<%s key={someKey} {...props} />`, isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = true);
|
|
1025
|
-
}
|
|
1026
|
-
children = null;
|
|
1027
|
-
maybeKey !== undefined && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
1028
|
-
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
1029
|
-
if ("key" in config) {
|
|
1030
|
-
maybeKey = {};
|
|
1031
|
-
for (var propName in config)
|
|
1032
|
-
propName !== "key" && (maybeKey[propName] = config[propName]);
|
|
1033
|
-
} else
|
|
1034
|
-
maybeKey = config;
|
|
1035
|
-
children && defineKeyPropWarningGetter(maybeKey, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
|
|
1036
|
-
return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
|
|
1037
|
-
}
|
|
1038
|
-
function validateChildKeys(node) {
|
|
1039
|
-
isValidElement(node) ? node._store && (node._store.validated = 1) : typeof node === "object" && node !== null && node.$$typeof === REACT_LAZY_TYPE && (node._payload.status === "fulfilled" ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
1040
|
-
}
|
|
1041
|
-
function isValidElement(object) {
|
|
1042
|
-
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1043
|
-
}
|
|
1044
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
1045
|
-
return null;
|
|
1046
|
-
};
|
|
1047
|
-
React = {
|
|
1048
|
-
react_stack_bottom_frame: function(callStackForError) {
|
|
1049
|
-
return callStackForError();
|
|
1050
|
-
}
|
|
1051
|
-
};
|
|
1052
|
-
var specialPropKeyWarningShown;
|
|
1053
|
-
var didWarnAboutElementRef = {};
|
|
1054
|
-
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
|
|
1055
|
-
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
1056
|
-
var didWarnAboutKeySpread = {};
|
|
1057
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
1058
|
-
exports.jsxDEV = function(type, config, maybeKey, isStaticChildren) {
|
|
1059
|
-
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
1060
|
-
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
1061
|
-
};
|
|
1062
|
-
})();
|
|
1063
|
-
});
|
|
1064
|
-
|
|
1065
|
-
// ../../node_modules/.bun/react@19.2.3/node_modules/react/jsx-dev-runtime.js
|
|
1066
|
-
var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
1067
|
-
var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development());
|
|
1068
|
-
if (false) {} else {
|
|
1069
|
-
module.exports = react_jsx_dev_runtime_development;
|
|
1070
|
-
}
|
|
1071
|
-
});
|
|
1072
|
-
|
|
1073
1
|
// src/ChatContext.tsx
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
var ChatContext =
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
4
|
+
var ChatContext = createContext(null);
|
|
1077
5
|
function ChatProvider({ client, children }) {
|
|
1078
|
-
return /* @__PURE__ */
|
|
6
|
+
return /* @__PURE__ */ jsxDEV(ChatContext.Provider, {
|
|
1079
7
|
value: client,
|
|
1080
8
|
children
|
|
1081
9
|
}, undefined, false, undefined, this);
|
|
1082
10
|
}
|
|
1083
11
|
function useChat() {
|
|
1084
|
-
const client =
|
|
12
|
+
const client = useContext(ChatContext);
|
|
1085
13
|
if (!client) {
|
|
1086
14
|
throw new Error("useChat must be used within a ChatProvider");
|
|
1087
15
|
}
|
|
1088
16
|
return client;
|
|
1089
17
|
}
|
|
1090
18
|
// src/hooks/useConversations.ts
|
|
1091
|
-
|
|
19
|
+
import { useEffect, useState, useCallback, useSyncExternalStore, useRef } from "react";
|
|
1092
20
|
function useConversations(input, options) {
|
|
1093
21
|
const chat = useChat();
|
|
1094
|
-
const [state, setState] =
|
|
22
|
+
const [state, setState] = useState({
|
|
1095
23
|
data: null,
|
|
1096
24
|
loading: false,
|
|
1097
25
|
error: null
|
|
1098
26
|
});
|
|
1099
27
|
const inputKey = input ? JSON.stringify(input) : null;
|
|
1100
28
|
const autoLoad = options?.autoLoad;
|
|
1101
|
-
const lastConversationsRef =
|
|
1102
|
-
const storeConversations =
|
|
29
|
+
const lastConversationsRef = useRef([]);
|
|
30
|
+
const storeConversations = useSyncExternalStore((onStoreChange) => chat.store.subscribe(onStoreChange), () => {
|
|
1103
31
|
const conversations2 = chat.store.conversations();
|
|
1104
32
|
const hasChanged = conversations2.length !== lastConversationsRef.current.length || conversations2.some((conv, idx) => {
|
|
1105
33
|
const prevConv = lastConversationsRef.current[idx];
|
|
@@ -1111,7 +39,7 @@ function useConversations(input, options) {
|
|
|
1111
39
|
lastConversationsRef.current = conversations2;
|
|
1112
40
|
return conversations2;
|
|
1113
41
|
});
|
|
1114
|
-
const loadConversations =
|
|
42
|
+
const loadConversations = useCallback(async () => {
|
|
1115
43
|
if (!input) {
|
|
1116
44
|
setState((prev) => ({ ...prev, loading: false }));
|
|
1117
45
|
return;
|
|
@@ -1144,7 +72,7 @@ function useConversations(input, options) {
|
|
|
1144
72
|
});
|
|
1145
73
|
}
|
|
1146
74
|
}, [chat, inputKey]);
|
|
1147
|
-
|
|
75
|
+
useEffect(() => {
|
|
1148
76
|
if (autoLoad !== false && inputKey) {
|
|
1149
77
|
loadConversations();
|
|
1150
78
|
}
|
|
@@ -1158,18 +86,18 @@ function useConversations(input, options) {
|
|
|
1158
86
|
};
|
|
1159
87
|
}
|
|
1160
88
|
// src/hooks/useConversationsWithLastMessages.ts
|
|
1161
|
-
|
|
89
|
+
import { useEffect as useEffect2, useState as useState2, useCallback as useCallback2, useSyncExternalStore as useSyncExternalStore2, useRef as useRef2 } from "react";
|
|
1162
90
|
function useConversationsWithLastMessages(input, options) {
|
|
1163
91
|
const chat = useChat();
|
|
1164
|
-
const [state, setState] =
|
|
92
|
+
const [state, setState] = useState2({
|
|
1165
93
|
data: null,
|
|
1166
94
|
loading: false,
|
|
1167
95
|
error: null
|
|
1168
96
|
});
|
|
1169
97
|
const inputKey = input ? JSON.stringify(input) : null;
|
|
1170
98
|
const autoLoad = options?.autoLoad;
|
|
1171
|
-
const lastResultRef =
|
|
1172
|
-
const storeData =
|
|
99
|
+
const lastResultRef = useRef2([]);
|
|
100
|
+
const storeData = useSyncExternalStore2((onStoreChange) => chat.store.subscribe(onStoreChange), () => {
|
|
1173
101
|
const conversations = chat.store.conversations();
|
|
1174
102
|
const result = conversations.map((conversation) => ({
|
|
1175
103
|
conversation,
|
|
@@ -1193,7 +121,7 @@ function useConversationsWithLastMessages(input, options) {
|
|
|
1193
121
|
lastResultRef.current = result;
|
|
1194
122
|
return result;
|
|
1195
123
|
});
|
|
1196
|
-
const loadConversations =
|
|
124
|
+
const loadConversations = useCallback2(async () => {
|
|
1197
125
|
if (!input?.userId) {
|
|
1198
126
|
setState((prev) => ({ ...prev, loading: false }));
|
|
1199
127
|
return;
|
|
@@ -1222,7 +150,7 @@ function useConversationsWithLastMessages(input, options) {
|
|
|
1222
150
|
});
|
|
1223
151
|
}
|
|
1224
152
|
}, [chat, inputKey]);
|
|
1225
|
-
|
|
153
|
+
useEffect2(() => {
|
|
1226
154
|
if (autoLoad !== false && inputKey) {
|
|
1227
155
|
loadConversations();
|
|
1228
156
|
}
|
|
@@ -1235,12 +163,12 @@ function useConversationsWithLastMessages(input, options) {
|
|
|
1235
163
|
};
|
|
1236
164
|
}
|
|
1237
165
|
// src/hooks/useConversation.ts
|
|
1238
|
-
|
|
166
|
+
import { useSyncExternalStore as useSyncExternalStore3, useRef as useRef3 } from "react";
|
|
1239
167
|
function useConversation(conversationId) {
|
|
1240
168
|
const chat = useChat();
|
|
1241
|
-
const lastValueRef =
|
|
1242
|
-
const lastIdRef =
|
|
1243
|
-
return
|
|
169
|
+
const lastValueRef = useRef3(undefined);
|
|
170
|
+
const lastIdRef = useRef3(undefined);
|
|
171
|
+
return useSyncExternalStore3((onStoreChange) => chat.store.subscribe(onStoreChange), () => {
|
|
1244
172
|
if (!conversationId) {
|
|
1245
173
|
const value = undefined;
|
|
1246
174
|
if (lastIdRef.current !== undefined) {
|
|
@@ -1266,13 +194,13 @@ function useConversation(conversationId) {
|
|
|
1266
194
|
});
|
|
1267
195
|
}
|
|
1268
196
|
// src/hooks/useMessages.ts
|
|
1269
|
-
|
|
197
|
+
import { useEffect as useEffect3, useState as useState3, useCallback as useCallback3 } from "react";
|
|
1270
198
|
|
|
1271
199
|
// src/hooks/useChatStore.ts
|
|
1272
|
-
|
|
200
|
+
import { useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
1273
201
|
function useChatStore() {
|
|
1274
202
|
const chat = useChat();
|
|
1275
|
-
return
|
|
203
|
+
return useSyncExternalStore4((onStoreChange) => {
|
|
1276
204
|
return chat.store.subscribe(onStoreChange);
|
|
1277
205
|
}, () => {
|
|
1278
206
|
return chat.store.getSnapshot();
|
|
@@ -1283,14 +211,14 @@ function useChatStore() {
|
|
|
1283
211
|
function useMessages(conversationId, userId, input, options) {
|
|
1284
212
|
const chat = useChat();
|
|
1285
213
|
const store = useChatStore();
|
|
1286
|
-
const [state, setState] =
|
|
214
|
+
const [state, setState] = useState3({
|
|
1287
215
|
data: null,
|
|
1288
216
|
loading: false,
|
|
1289
217
|
error: null
|
|
1290
218
|
});
|
|
1291
219
|
const inputKey = input ? JSON.stringify(input) : null;
|
|
1292
220
|
const autoLoad = options?.autoLoad;
|
|
1293
|
-
const loadMessages =
|
|
221
|
+
const loadMessages = useCallback3(async () => {
|
|
1294
222
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
1295
223
|
try {
|
|
1296
224
|
const result = await chat.getMessages({
|
|
@@ -1319,7 +247,7 @@ function useMessages(conversationId, userId, input, options) {
|
|
|
1319
247
|
});
|
|
1320
248
|
}
|
|
1321
249
|
}, [chat, conversationId, userId, inputKey]);
|
|
1322
|
-
|
|
250
|
+
useEffect3(() => {
|
|
1323
251
|
if (autoLoad !== false) {
|
|
1324
252
|
loadMessages();
|
|
1325
253
|
}
|
|
@@ -1334,10 +262,10 @@ function useMessages(conversationId, userId, input, options) {
|
|
|
1334
262
|
};
|
|
1335
263
|
}
|
|
1336
264
|
// src/hooks/useMessage.ts
|
|
1337
|
-
|
|
265
|
+
import { useMemo } from "react";
|
|
1338
266
|
function useMessage(messageId) {
|
|
1339
267
|
const store = useChatStore();
|
|
1340
|
-
return
|
|
268
|
+
return useMemo(() => {
|
|
1341
269
|
if (!messageId)
|
|
1342
270
|
return;
|
|
1343
271
|
for (const conversationId in store.messages) {
|
|
@@ -1353,12 +281,12 @@ function useMessage(messageId) {
|
|
|
1353
281
|
}, [store.messages, messageId]);
|
|
1354
282
|
}
|
|
1355
283
|
// src/hooks/useLastMessage.ts
|
|
1356
|
-
|
|
284
|
+
import { useSyncExternalStore as useSyncExternalStore5, useRef as useRef4 } from "react";
|
|
1357
285
|
function useLastMessage(conversationId) {
|
|
1358
286
|
const chat = useChat();
|
|
1359
|
-
const lastValueRef =
|
|
1360
|
-
const lastIdRef =
|
|
1361
|
-
return
|
|
287
|
+
const lastValueRef = useRef4(undefined);
|
|
288
|
+
const lastIdRef = useRef4(undefined);
|
|
289
|
+
return useSyncExternalStore5((onStoreChange) => chat.store.subscribe(onStoreChange), () => {
|
|
1362
290
|
if (!conversationId) {
|
|
1363
291
|
if (lastIdRef.current !== undefined) {
|
|
1364
292
|
lastIdRef.current = undefined;
|
|
@@ -1398,7 +326,7 @@ function usePresence(userId) {
|
|
|
1398
326
|
return store.presence[userId];
|
|
1399
327
|
}
|
|
1400
328
|
// src/hooks/useMessagesPagination.ts
|
|
1401
|
-
|
|
329
|
+
import { useSyncExternalStore as useSyncExternalStore6, useRef as useRef5, useCallback as useCallback4, useEffect as useEffect4 } from "react";
|
|
1402
330
|
var MESSAGES_PER_PAGE = 50;
|
|
1403
331
|
var defaultPagination = {
|
|
1404
332
|
loading: false,
|
|
@@ -1412,13 +340,13 @@ function useMessagesPagination({
|
|
|
1412
340
|
autoLoad = true
|
|
1413
341
|
}) {
|
|
1414
342
|
const chat = useChat();
|
|
1415
|
-
const lastPaginationRef =
|
|
1416
|
-
const lastConversationIdRefPagination =
|
|
1417
|
-
const hasLoadedRef =
|
|
1418
|
-
const prevConversationIdRef =
|
|
1419
|
-
const messagesCache =
|
|
1420
|
-
const emptyArray =
|
|
1421
|
-
const messages =
|
|
343
|
+
const lastPaginationRef = useRef5(undefined);
|
|
344
|
+
const lastConversationIdRefPagination = useRef5(undefined);
|
|
345
|
+
const hasLoadedRef = useRef5(false);
|
|
346
|
+
const prevConversationIdRef = useRef5(undefined);
|
|
347
|
+
const messagesCache = useRef5(null);
|
|
348
|
+
const emptyArray = useRef5([]);
|
|
349
|
+
const messages = useSyncExternalStore6((onStoreChange) => chat.store.subscribe(onStoreChange), () => {
|
|
1422
350
|
if (!conversationId) {
|
|
1423
351
|
return emptyArray.current;
|
|
1424
352
|
}
|
|
@@ -1442,7 +370,7 @@ function useMessagesPagination({
|
|
|
1442
370
|
}
|
|
1443
371
|
return messagesCache.current.messages;
|
|
1444
372
|
});
|
|
1445
|
-
const pagination =
|
|
373
|
+
const pagination = useSyncExternalStore6((onStoreChange) => chat.store.subscribe(onStoreChange), () => {
|
|
1446
374
|
if (!conversationId) {
|
|
1447
375
|
return;
|
|
1448
376
|
}
|
|
@@ -1461,7 +389,7 @@ function useMessagesPagination({
|
|
|
1461
389
|
lastPaginationRef.current = pag;
|
|
1462
390
|
return pag;
|
|
1463
391
|
});
|
|
1464
|
-
|
|
392
|
+
useEffect4(() => {
|
|
1465
393
|
if (prevConversationIdRef.current !== conversationId) {
|
|
1466
394
|
hasLoadedRef.current = false;
|
|
1467
395
|
prevConversationIdRef.current = conversationId;
|
|
@@ -1475,7 +403,7 @@ function useMessagesPagination({
|
|
|
1475
403
|
});
|
|
1476
404
|
}
|
|
1477
405
|
}, [autoLoad, conversationId, userId, pagination?.loading, pagination?.hasMore, pagination?.error, chat]);
|
|
1478
|
-
const loadMoreMessages =
|
|
406
|
+
const loadMoreMessages = useCallback4(() => {
|
|
1479
407
|
if (!conversationId || pagination?.loadingMore || !pagination?.hasMore || messages.length === 0 || pagination?.loading) {
|
|
1480
408
|
return;
|
|
1481
409
|
}
|
|
@@ -1503,14 +431,14 @@ function useMessagesPagination({
|
|
|
1503
431
|
};
|
|
1504
432
|
}
|
|
1505
433
|
// src/hooks/useSendMessage.ts
|
|
1506
|
-
|
|
434
|
+
import { useState as useState4, useCallback as useCallback5 } from "react";
|
|
1507
435
|
function useSendMessage() {
|
|
1508
436
|
const chat = useChat();
|
|
1509
|
-
const [state, setState] =
|
|
437
|
+
const [state, setState] = useState4({
|
|
1510
438
|
loading: false,
|
|
1511
439
|
error: null
|
|
1512
440
|
});
|
|
1513
|
-
const sendMessage =
|
|
441
|
+
const sendMessage = useCallback5(async (input) => {
|
|
1514
442
|
setState({ loading: true, error: null });
|
|
1515
443
|
try {
|
|
1516
444
|
const result = await chat.sendMessage(input);
|
|
@@ -1538,14 +466,14 @@ function useSendMessage() {
|
|
|
1538
466
|
};
|
|
1539
467
|
}
|
|
1540
468
|
// src/hooks/useCreateConversation.ts
|
|
1541
|
-
|
|
469
|
+
import { useState as useState5, useCallback as useCallback6 } from "react";
|
|
1542
470
|
function useCreateConversation() {
|
|
1543
471
|
const chat = useChat();
|
|
1544
|
-
const [state, setState] =
|
|
472
|
+
const [state, setState] = useState5({
|
|
1545
473
|
loading: false,
|
|
1546
474
|
error: null
|
|
1547
475
|
});
|
|
1548
|
-
const createConversation =
|
|
476
|
+
const createConversation = useCallback6(async (input) => {
|
|
1549
477
|
setState({ loading: true, error: null });
|
|
1550
478
|
try {
|
|
1551
479
|
const result = await chat.createConversation(input);
|
|
@@ -1573,14 +501,14 @@ function useCreateConversation() {
|
|
|
1573
501
|
};
|
|
1574
502
|
}
|
|
1575
503
|
// src/hooks/useEditMessage.ts
|
|
1576
|
-
|
|
504
|
+
import { useState as useState6, useCallback as useCallback7 } from "react";
|
|
1577
505
|
function useEditMessage() {
|
|
1578
506
|
const chat = useChat();
|
|
1579
|
-
const [state, setState] =
|
|
507
|
+
const [state, setState] = useState6({
|
|
1580
508
|
loading: false,
|
|
1581
509
|
error: null
|
|
1582
510
|
});
|
|
1583
|
-
const editMessage =
|
|
511
|
+
const editMessage = useCallback7(async (input) => {
|
|
1584
512
|
setState({ loading: true, error: null });
|
|
1585
513
|
try {
|
|
1586
514
|
const result = await chat.editMessage(input);
|
|
@@ -1608,14 +536,14 @@ function useEditMessage() {
|
|
|
1608
536
|
};
|
|
1609
537
|
}
|
|
1610
538
|
// src/hooks/useDeleteMessage.ts
|
|
1611
|
-
|
|
539
|
+
import { useState as useState7, useCallback as useCallback8 } from "react";
|
|
1612
540
|
function useDeleteMessage() {
|
|
1613
541
|
const chat = useChat();
|
|
1614
|
-
const [state, setState] =
|
|
542
|
+
const [state, setState] = useState7({
|
|
1615
543
|
loading: false,
|
|
1616
544
|
error: null
|
|
1617
545
|
});
|
|
1618
|
-
const deleteMessage =
|
|
546
|
+
const deleteMessage = useCallback8(async (input) => {
|
|
1619
547
|
setState({ loading: true, error: null });
|
|
1620
548
|
try {
|
|
1621
549
|
const result = await chat.deleteMessage(input);
|
|
@@ -1643,14 +571,14 @@ function useDeleteMessage() {
|
|
|
1643
571
|
};
|
|
1644
572
|
}
|
|
1645
573
|
// src/hooks/useMarkMessageAsRead.ts
|
|
1646
|
-
|
|
574
|
+
import { useState as useState8, useCallback as useCallback9 } from "react";
|
|
1647
575
|
function useMarkMessageAsRead() {
|
|
1648
576
|
const chat = useChat();
|
|
1649
|
-
const [state, setState] =
|
|
577
|
+
const [state, setState] = useState8({
|
|
1650
578
|
loading: false,
|
|
1651
579
|
error: null
|
|
1652
580
|
});
|
|
1653
|
-
const markAsRead =
|
|
581
|
+
const markAsRead = useCallback9(async (input) => {
|
|
1654
582
|
setState({ loading: true, error: null });
|
|
1655
583
|
try {
|
|
1656
584
|
const result = await chat.markMessageAsRead(input);
|
|
@@ -1678,11 +606,11 @@ function useMarkMessageAsRead() {
|
|
|
1678
606
|
};
|
|
1679
607
|
}
|
|
1680
608
|
// src/hooks/useSubscribeToConversation.ts
|
|
1681
|
-
|
|
609
|
+
import { useEffect as useEffect5 } from "react";
|
|
1682
610
|
function useSubscribeToConversation(conversationId, options = {}) {
|
|
1683
611
|
const { enabled = true, userId } = options;
|
|
1684
612
|
const chat = useChat();
|
|
1685
|
-
|
|
613
|
+
useEffect5(() => {
|
|
1686
614
|
if (!enabled) {
|
|
1687
615
|
return;
|
|
1688
616
|
}
|
|
@@ -1691,10 +619,10 @@ function useSubscribeToConversation(conversationId, options = {}) {
|
|
|
1691
619
|
}, [chat, conversationId, enabled, userId]);
|
|
1692
620
|
}
|
|
1693
621
|
// src/hooks/useSubscribeToUser.ts
|
|
1694
|
-
|
|
622
|
+
import { useEffect as useEffect6 } from "react";
|
|
1695
623
|
function useSubscribeToUser(userId, enabled = true) {
|
|
1696
624
|
const chat = useChat();
|
|
1697
|
-
|
|
625
|
+
useEffect6(() => {
|
|
1698
626
|
if (!enabled) {
|
|
1699
627
|
return;
|
|
1700
628
|
}
|
|
@@ -1703,10 +631,10 @@ function useSubscribeToUser(userId, enabled = true) {
|
|
|
1703
631
|
}, [chat, userId, enabled]);
|
|
1704
632
|
}
|
|
1705
633
|
// src/hooks/useTrackPresence.ts
|
|
1706
|
-
|
|
634
|
+
import { useEffect as useEffect7 } from "react";
|
|
1707
635
|
function useTrackPresence(userId, enabled = true) {
|
|
1708
636
|
const chat = useChat();
|
|
1709
|
-
|
|
637
|
+
useEffect7(() => {
|
|
1710
638
|
if (!enabled || !userId) {
|
|
1711
639
|
return;
|
|
1712
640
|
}
|
|
@@ -1715,15 +643,15 @@ function useTrackPresence(userId, enabled = true) {
|
|
|
1715
643
|
}, [chat, userId, enabled]);
|
|
1716
644
|
}
|
|
1717
645
|
// src/hooks/useSubscribeToAllConversations.ts
|
|
1718
|
-
|
|
646
|
+
import { useEffect as useEffect8, useRef as useRef6 } from "react";
|
|
1719
647
|
function useSubscribeToAllConversations({
|
|
1720
648
|
userId,
|
|
1721
649
|
enabled = true
|
|
1722
650
|
}) {
|
|
1723
651
|
const chat = useChat();
|
|
1724
|
-
const unsubscribeFunctionsRef =
|
|
1725
|
-
const hasSubscribedRef =
|
|
1726
|
-
|
|
652
|
+
const unsubscribeFunctionsRef = useRef6([]);
|
|
653
|
+
const hasSubscribedRef = useRef6(false);
|
|
654
|
+
useEffect8(() => {
|
|
1727
655
|
if (!enabled || !userId) {
|
|
1728
656
|
return;
|
|
1729
657
|
}
|