@solana-mobile/mobile-wallet-adapter-walletlib 1.4.1 → 1.4.2

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/lib/esm/index.js CHANGED
@@ -1,1489 +1,140 @@
1
- import { Platform, NativeModules, NativeEventEmitter } from 'react-native';
2
-
1
+ import { NativeEventEmitter, NativeModules, Platform } from "react-native";
2
+ import { useEffect } from "react";
3
+ //#region src/mwaSessionEvents.ts
3
4
  /**
4
- * Mobile Wallet Adapter Session Events are notifications and events
5
- * about the underlying session between the wallet and the dApp.
6
- */
7
- var MWASessionEventType;
8
- (function (MWASessionEventType) {
9
- MWASessionEventType["SessionStartEvent"] = "SESSION_START";
10
- MWASessionEventType["SessionReadyEvent"] = "SESSION_READY";
11
- MWASessionEventType["SessionTerminatedEvent"] = "SESSION_TERMINATED";
12
- MWASessionEventType["SessionServingClientsEvent"] = "SESSION_SERVING_CLIENTS";
13
- MWASessionEventType["SessionServingCompleteEvent"] = "SESSION_SERVING_COMPLETE";
14
- MWASessionEventType["SessionCompleteEvent"] = "SESSION_COMPLETE";
15
- MWASessionEventType["SessionErrorEvent"] = "SESSION_ERROR";
16
- MWASessionEventType["SessionTeardownCompleteEvent"] = "SESSION_TEARDOWN_COMPLETE";
17
- MWASessionEventType["LowPowerNoConnectionEvent"] = "LOW_POWER_NO_CONNECTION";
18
- })(MWASessionEventType || (MWASessionEventType = {}));
19
-
20
- const LINKING_ERROR$2 = `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
21
- '- You rebuilt the app after installing the package\n' +
22
- '- If you are using Lerna workspaces\n' +
23
- ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n' +
24
- ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n' +
25
- '- You are not using Expo managed workflow\n';
26
- const SolanaMobileWalletAdapterWalletLib$1 = Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib
27
- ? NativeModules.SolanaMobileWalletAdapterWalletLib
28
- : new Proxy({}, {
29
- get() {
30
- throw new Error(Platform.OS !== 'android'
31
- ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'
32
- : LINKING_ERROR$2);
33
- },
34
- });
35
- var MWARequestType;
36
- (function (MWARequestType) {
37
- MWARequestType["AuthorizeDappRequest"] = "AUTHORIZE_DAPP";
38
- MWARequestType["ReauthorizeDappRequest"] = "REAUTHORIZE_DAPP";
39
- MWARequestType["DeauthorizeDappRequest"] = "DEAUTHORIZE_DAPP";
40
- MWARequestType["SignMessagesRequest"] = "SIGN_MESSAGES";
41
- MWARequestType["SignTransactionsRequest"] = "SIGN_TRANSACTIONS";
42
- MWARequestType["SignAndSendTransactionsRequest"] = "SIGN_AND_SEND_TRANSACTIONS";
43
- })(MWARequestType || (MWARequestType = {}));
44
- /* Failure Responses */
45
- var MWARequestFailReason;
46
- (function (MWARequestFailReason) {
47
- MWARequestFailReason["UserDeclined"] = "USER_DECLINED";
48
- MWARequestFailReason["TooManyPayloads"] = "TOO_MANY_PAYLOADS";
49
- MWARequestFailReason["InvalidSignatures"] = "INVALID_SIGNATURES";
50
- MWARequestFailReason["AuthorizationNotValid"] = "AUTHORIZATION_NOT_VALID";
51
- })(MWARequestFailReason || (MWARequestFailReason = {}));
5
+ * Mobile Wallet Adapter Session Events are notifications and events
6
+ * about the underlying session between the wallet and the dApp.
7
+ */
8
+ let MWASessionEventType = /* @__PURE__ */ function(MWASessionEventType) {
9
+ MWASessionEventType["SessionStartEvent"] = "SESSION_START";
10
+ MWASessionEventType["SessionReadyEvent"] = "SESSION_READY";
11
+ MWASessionEventType["SessionTerminatedEvent"] = "SESSION_TERMINATED";
12
+ MWASessionEventType["SessionServingClientsEvent"] = "SESSION_SERVING_CLIENTS";
13
+ MWASessionEventType["SessionServingCompleteEvent"] = "SESSION_SERVING_COMPLETE";
14
+ MWASessionEventType["SessionCompleteEvent"] = "SESSION_COMPLETE";
15
+ MWASessionEventType["SessionErrorEvent"] = "SESSION_ERROR";
16
+ MWASessionEventType["SessionTeardownCompleteEvent"] = "SESSION_TEARDOWN_COMPLETE";
17
+ MWASessionEventType["LowPowerNoConnectionEvent"] = "LOW_POWER_NO_CONNECTION";
18
+ return MWASessionEventType;
19
+ }({});
20
+ //#endregion
21
+ //#region src/resolve.ts
22
+ const LINKING_ERROR$2 = "The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n- You rebuilt the app after installing the package\n- If you are using Lerna workspaces\n - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n- You are not using Expo managed workflow\n";
23
+ const SolanaMobileWalletAdapterWalletLib$1 = Platform.OS === "android" && NativeModules.SolanaMobileWalletAdapterWalletLib ? NativeModules.SolanaMobileWalletAdapterWalletLib : new Proxy({}, { get() {
24
+ throw new Error(Platform.OS !== "android" ? "The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android" : LINKING_ERROR$2);
25
+ } });
26
+ let MWARequestType = /* @__PURE__ */ function(MWARequestType) {
27
+ MWARequestType["AuthorizeDappRequest"] = "AUTHORIZE_DAPP";
28
+ MWARequestType["ReauthorizeDappRequest"] = "REAUTHORIZE_DAPP";
29
+ MWARequestType["DeauthorizeDappRequest"] = "DEAUTHORIZE_DAPP";
30
+ MWARequestType["SignMessagesRequest"] = "SIGN_MESSAGES";
31
+ MWARequestType["SignTransactionsRequest"] = "SIGN_TRANSACTIONS";
32
+ MWARequestType["SignAndSendTransactionsRequest"] = "SIGN_AND_SEND_TRANSACTIONS";
33
+ return MWARequestType;
34
+ }({});
35
+ let MWARequestFailReason = /* @__PURE__ */ function(MWARequestFailReason) {
36
+ MWARequestFailReason["UserDeclined"] = "USER_DECLINED";
37
+ MWARequestFailReason["TooManyPayloads"] = "TOO_MANY_PAYLOADS";
38
+ MWARequestFailReason["InvalidSignatures"] = "INVALID_SIGNATURES";
39
+ MWARequestFailReason["AuthorizationNotValid"] = "AUTHORIZATION_NOT_VALID";
40
+ return MWARequestFailReason;
41
+ }({});
52
42
  function resolve(request, response) {
53
- SolanaMobileWalletAdapterWalletLib$1.resolve(JSON.stringify(request), JSON.stringify(response));
43
+ SolanaMobileWalletAdapterWalletLib$1.resolve(JSON.stringify(request), JSON.stringify(response));
54
44
  }
55
-
56
- var react = {exports: {}};
57
-
58
- var react_development = {exports: {}};
59
-
60
- /**
61
- * @license React
62
- * react.development.js
63
- *
64
- * Copyright (c) Meta Platforms, Inc. and affiliates.
65
- *
66
- * This source code is licensed under the MIT license found in the
67
- * LICENSE file in the root directory of this source tree.
68
- */
69
- react_development.exports;
70
-
71
- var hasRequiredReact_development;
72
-
73
- function requireReact_development () {
74
- if (hasRequiredReact_development) return react_development.exports;
75
- hasRequiredReact_development = 1;
76
- (function (module, exports$1) {
77
- ((function () {
78
- function defineDeprecationWarning(methodName, info) {
79
- Object.defineProperty(Component.prototype, methodName, {
80
- get: function () {
81
- console.warn(
82
- "%s(...) is deprecated in plain JavaScript React classes. %s",
83
- info[0],
84
- info[1]
85
- );
86
- }
87
- });
88
- }
89
- function getIteratorFn(maybeIterable) {
90
- if (null === maybeIterable || "object" !== typeof maybeIterable)
91
- return null;
92
- maybeIterable =
93
- (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
94
- maybeIterable["@@iterator"];
95
- return "function" === typeof maybeIterable ? maybeIterable : null;
96
- }
97
- function warnNoop(publicInstance, callerName) {
98
- publicInstance =
99
- ((publicInstance = publicInstance.constructor) &&
100
- (publicInstance.displayName || publicInstance.name)) ||
101
- "ReactClass";
102
- var warningKey = publicInstance + "." + callerName;
103
- didWarnStateUpdateForUnmountedComponent[warningKey] ||
104
- (console.error(
105
- "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.",
106
- callerName,
107
- publicInstance
108
- ),
109
- (didWarnStateUpdateForUnmountedComponent[warningKey] = true));
110
- }
111
- function Component(props, context, updater) {
112
- this.props = props;
113
- this.context = context;
114
- this.refs = emptyObject;
115
- this.updater = updater || ReactNoopUpdateQueue;
116
- }
117
- function ComponentDummy() {}
118
- function PureComponent(props, context, updater) {
119
- this.props = props;
120
- this.context = context;
121
- this.refs = emptyObject;
122
- this.updater = updater || ReactNoopUpdateQueue;
123
- }
124
- function noop() {}
125
- function testStringCoercion(value) {
126
- return "" + value;
127
- }
128
- function checkKeyStringCoercion(value) {
129
- try {
130
- testStringCoercion(value);
131
- var JSCompiler_inline_result = !1;
132
- } catch (e) {
133
- JSCompiler_inline_result = true;
134
- }
135
- if (JSCompiler_inline_result) {
136
- JSCompiler_inline_result = console;
137
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
138
- var JSCompiler_inline_result$jscomp$0 =
139
- ("function" === typeof Symbol &&
140
- Symbol.toStringTag &&
141
- value[Symbol.toStringTag]) ||
142
- value.constructor.name ||
143
- "Object";
144
- JSCompiler_temp_const.call(
145
- JSCompiler_inline_result,
146
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
147
- JSCompiler_inline_result$jscomp$0
148
- );
149
- return testStringCoercion(value);
150
- }
151
- }
152
- function getComponentNameFromType(type) {
153
- if (null == type) return null;
154
- if ("function" === typeof type)
155
- return type.$$typeof === REACT_CLIENT_REFERENCE
156
- ? null
157
- : type.displayName || type.name || null;
158
- if ("string" === typeof type) return type;
159
- switch (type) {
160
- case REACT_FRAGMENT_TYPE:
161
- return "Fragment";
162
- case REACT_PROFILER_TYPE:
163
- return "Profiler";
164
- case REACT_STRICT_MODE_TYPE:
165
- return "StrictMode";
166
- case REACT_SUSPENSE_TYPE:
167
- return "Suspense";
168
- case REACT_SUSPENSE_LIST_TYPE:
169
- return "SuspenseList";
170
- case REACT_ACTIVITY_TYPE:
171
- return "Activity";
172
- }
173
- if ("object" === typeof type)
174
- switch (
175
- ("number" === typeof type.tag &&
176
- console.error(
177
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
178
- ),
179
- type.$$typeof)
180
- ) {
181
- case REACT_PORTAL_TYPE:
182
- return "Portal";
183
- case REACT_CONTEXT_TYPE:
184
- return type.displayName || "Context";
185
- case REACT_CONSUMER_TYPE:
186
- return (type._context.displayName || "Context") + ".Consumer";
187
- case REACT_FORWARD_REF_TYPE:
188
- var innerType = type.render;
189
- type = type.displayName;
190
- type ||
191
- ((type = innerType.displayName || innerType.name || ""),
192
- (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
193
- return type;
194
- case REACT_MEMO_TYPE:
195
- return (
196
- (innerType = type.displayName || null),
197
- null !== innerType
198
- ? innerType
199
- : getComponentNameFromType(type.type) || "Memo"
200
- );
201
- case REACT_LAZY_TYPE:
202
- innerType = type._payload;
203
- type = type._init;
204
- try {
205
- return getComponentNameFromType(type(innerType));
206
- } catch (x) {}
207
- }
208
- return null;
209
- }
210
- function getTaskName(type) {
211
- if (type === REACT_FRAGMENT_TYPE) return "<>";
212
- if (
213
- "object" === typeof type &&
214
- null !== type &&
215
- type.$$typeof === REACT_LAZY_TYPE
216
- )
217
- return "<...>";
218
- try {
219
- var name = getComponentNameFromType(type);
220
- return name ? "<" + name + ">" : "<...>";
221
- } catch (x) {
222
- return "<...>";
223
- }
224
- }
225
- function getOwner() {
226
- var dispatcher = ReactSharedInternals.A;
227
- return null === dispatcher ? null : dispatcher.getOwner();
228
- }
229
- function UnknownOwner() {
230
- return Error("react-stack-top-frame");
231
- }
232
- function hasValidKey(config) {
233
- if (hasOwnProperty.call(config, "key")) {
234
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
235
- if (getter && getter.isReactWarning) return false;
236
- }
237
- return void 0 !== config.key;
238
- }
239
- function defineKeyPropWarningGetter(props, displayName) {
240
- function warnAboutAccessingKey() {
241
- specialPropKeyWarningShown ||
242
- ((specialPropKeyWarningShown = true),
243
- console.error(
244
- "%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)",
245
- displayName
246
- ));
247
- }
248
- warnAboutAccessingKey.isReactWarning = true;
249
- Object.defineProperty(props, "key", {
250
- get: warnAboutAccessingKey,
251
- configurable: true
252
- });
253
- }
254
- function elementRefGetterWithDeprecationWarning() {
255
- var componentName = getComponentNameFromType(this.type);
256
- didWarnAboutElementRef[componentName] ||
257
- ((didWarnAboutElementRef[componentName] = true),
258
- console.error(
259
- "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."
260
- ));
261
- componentName = this.props.ref;
262
- return void 0 !== componentName ? componentName : null;
263
- }
264
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
265
- var refProp = props.ref;
266
- type = {
267
- $$typeof: REACT_ELEMENT_TYPE,
268
- type: type,
269
- key: key,
270
- props: props,
271
- _owner: owner
272
- };
273
- null !== (void 0 !== refProp ? refProp : null)
274
- ? Object.defineProperty(type, "ref", {
275
- enumerable: false,
276
- get: elementRefGetterWithDeprecationWarning
277
- })
278
- : Object.defineProperty(type, "ref", { enumerable: false, value: null });
279
- type._store = {};
280
- Object.defineProperty(type._store, "validated", {
281
- configurable: false,
282
- enumerable: false,
283
- writable: true,
284
- value: 0
285
- });
286
- Object.defineProperty(type, "_debugInfo", {
287
- configurable: false,
288
- enumerable: false,
289
- writable: true,
290
- value: null
291
- });
292
- Object.defineProperty(type, "_debugStack", {
293
- configurable: false,
294
- enumerable: false,
295
- writable: true,
296
- value: debugStack
297
- });
298
- Object.defineProperty(type, "_debugTask", {
299
- configurable: false,
300
- enumerable: false,
301
- writable: true,
302
- value: debugTask
303
- });
304
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
305
- return type;
306
- }
307
- function cloneAndReplaceKey(oldElement, newKey) {
308
- newKey = ReactElement(
309
- oldElement.type,
310
- newKey,
311
- oldElement.props,
312
- oldElement._owner,
313
- oldElement._debugStack,
314
- oldElement._debugTask
315
- );
316
- oldElement._store &&
317
- (newKey._store.validated = oldElement._store.validated);
318
- return newKey;
319
- }
320
- function validateChildKeys(node) {
321
- isValidElement(node)
322
- ? node._store && (node._store.validated = 1)
323
- : "object" === typeof node &&
324
- null !== node &&
325
- node.$$typeof === REACT_LAZY_TYPE &&
326
- ("fulfilled" === node._payload.status
327
- ? isValidElement(node._payload.value) &&
328
- node._payload.value._store &&
329
- (node._payload.value._store.validated = 1)
330
- : node._store && (node._store.validated = 1));
331
- }
332
- function isValidElement(object) {
333
- return (
334
- "object" === typeof object &&
335
- null !== object &&
336
- object.$$typeof === REACT_ELEMENT_TYPE
337
- );
338
- }
339
- function escape(key) {
340
- var escaperLookup = { "=": "=0", ":": "=2" };
341
- return (
342
- "$" +
343
- key.replace(/[=:]/g, function (match) {
344
- return escaperLookup[match];
345
- })
346
- );
347
- }
348
- function getElementKey(element, index) {
349
- return "object" === typeof element &&
350
- null !== element &&
351
- null != element.key
352
- ? (checkKeyStringCoercion(element.key), escape("" + element.key))
353
- : index.toString(36);
354
- }
355
- function resolveThenable(thenable) {
356
- switch (thenable.status) {
357
- case "fulfilled":
358
- return thenable.value;
359
- case "rejected":
360
- throw thenable.reason;
361
- default:
362
- switch (
363
- ("string" === typeof thenable.status
364
- ? thenable.then(noop, noop)
365
- : ((thenable.status = "pending"),
366
- thenable.then(
367
- function (fulfilledValue) {
368
- "pending" === thenable.status &&
369
- ((thenable.status = "fulfilled"),
370
- (thenable.value = fulfilledValue));
371
- },
372
- function (error) {
373
- "pending" === thenable.status &&
374
- ((thenable.status = "rejected"),
375
- (thenable.reason = error));
376
- }
377
- )),
378
- thenable.status)
379
- ) {
380
- case "fulfilled":
381
- return thenable.value;
382
- case "rejected":
383
- throw thenable.reason;
384
- }
385
- }
386
- throw thenable;
387
- }
388
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
389
- var type = typeof children;
390
- if ("undefined" === type || "boolean" === type) children = null;
391
- var invokeCallback = false;
392
- if (null === children) invokeCallback = true;
393
- else
394
- switch (type) {
395
- case "bigint":
396
- case "string":
397
- case "number":
398
- invokeCallback = true;
399
- break;
400
- case "object":
401
- switch (children.$$typeof) {
402
- case REACT_ELEMENT_TYPE:
403
- case REACT_PORTAL_TYPE:
404
- invokeCallback = true;
405
- break;
406
- case REACT_LAZY_TYPE:
407
- return (
408
- (invokeCallback = children._init),
409
- mapIntoArray(
410
- invokeCallback(children._payload),
411
- array,
412
- escapedPrefix,
413
- nameSoFar,
414
- callback
415
- )
416
- );
417
- }
418
- }
419
- if (invokeCallback) {
420
- invokeCallback = children;
421
- callback = callback(invokeCallback);
422
- var childKey =
423
- "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
424
- isArrayImpl(callback)
425
- ? ((escapedPrefix = ""),
426
- null != childKey &&
427
- (escapedPrefix =
428
- childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
429
- mapIntoArray(callback, array, escapedPrefix, "", function (c) {
430
- return c;
431
- }))
432
- : null != callback &&
433
- (isValidElement(callback) &&
434
- (null != callback.key &&
435
- ((invokeCallback && invokeCallback.key === callback.key) ||
436
- checkKeyStringCoercion(callback.key)),
437
- (escapedPrefix = cloneAndReplaceKey(
438
- callback,
439
- escapedPrefix +
440
- (null == callback.key ||
441
- (invokeCallback && invokeCallback.key === callback.key)
442
- ? ""
443
- : ("" + callback.key).replace(
444
- userProvidedKeyEscapeRegex,
445
- "$&/"
446
- ) + "/") +
447
- childKey
448
- )),
449
- "" !== nameSoFar &&
450
- null != invokeCallback &&
451
- isValidElement(invokeCallback) &&
452
- null == invokeCallback.key &&
453
- invokeCallback._store &&
454
- !invokeCallback._store.validated &&
455
- (escapedPrefix._store.validated = 2),
456
- (callback = escapedPrefix)),
457
- array.push(callback));
458
- return 1;
459
- }
460
- invokeCallback = 0;
461
- childKey = "" === nameSoFar ? "." : nameSoFar + ":";
462
- if (isArrayImpl(children))
463
- for (var i = 0; i < children.length; i++)
464
- (nameSoFar = children[i]),
465
- (type = childKey + getElementKey(nameSoFar, i)),
466
- (invokeCallback += mapIntoArray(
467
- nameSoFar,
468
- array,
469
- escapedPrefix,
470
- type,
471
- callback
472
- ));
473
- else if (((i = getIteratorFn(children)), "function" === typeof i))
474
- for (
475
- i === children.entries &&
476
- (didWarnAboutMaps ||
477
- console.warn(
478
- "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
479
- ),
480
- (didWarnAboutMaps = true)),
481
- children = i.call(children),
482
- i = 0;
483
- !(nameSoFar = children.next()).done;
484
-
485
- )
486
- (nameSoFar = nameSoFar.value),
487
- (type = childKey + getElementKey(nameSoFar, i++)),
488
- (invokeCallback += mapIntoArray(
489
- nameSoFar,
490
- array,
491
- escapedPrefix,
492
- type,
493
- callback
494
- ));
495
- else if ("object" === type) {
496
- if ("function" === typeof children.then)
497
- return mapIntoArray(
498
- resolveThenable(children),
499
- array,
500
- escapedPrefix,
501
- nameSoFar,
502
- callback
503
- );
504
- array = String(children);
505
- throw Error(
506
- "Objects are not valid as a React child (found: " +
507
- ("[object Object]" === array
508
- ? "object with keys {" + Object.keys(children).join(", ") + "}"
509
- : array) +
510
- "). If you meant to render a collection of children, use an array instead."
511
- );
512
- }
513
- return invokeCallback;
514
- }
515
- function mapChildren(children, func, context) {
516
- if (null == children) return children;
517
- var result = [],
518
- count = 0;
519
- mapIntoArray(children, result, "", "", function (child) {
520
- return func.call(context, child, count++);
521
- });
522
- return result;
523
- }
524
- function lazyInitializer(payload) {
525
- if (-1 === payload._status) {
526
- var ioInfo = payload._ioInfo;
527
- null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
528
- ioInfo = payload._result;
529
- var thenable = ioInfo();
530
- thenable.then(
531
- function (moduleObject) {
532
- if (0 === payload._status || -1 === payload._status) {
533
- payload._status = 1;
534
- payload._result = moduleObject;
535
- var _ioInfo = payload._ioInfo;
536
- null != _ioInfo && (_ioInfo.end = performance.now());
537
- void 0 === thenable.status &&
538
- ((thenable.status = "fulfilled"),
539
- (thenable.value = moduleObject));
540
- }
541
- },
542
- function (error) {
543
- if (0 === payload._status || -1 === payload._status) {
544
- payload._status = 2;
545
- payload._result = error;
546
- var _ioInfo2 = payload._ioInfo;
547
- null != _ioInfo2 && (_ioInfo2.end = performance.now());
548
- void 0 === thenable.status &&
549
- ((thenable.status = "rejected"), (thenable.reason = error));
550
- }
551
- }
552
- );
553
- ioInfo = payload._ioInfo;
554
- if (null != ioInfo) {
555
- ioInfo.value = thenable;
556
- var displayName = thenable.displayName;
557
- "string" === typeof displayName && (ioInfo.name = displayName);
558
- }
559
- -1 === payload._status &&
560
- ((payload._status = 0), (payload._result = thenable));
561
- }
562
- if (1 === payload._status)
563
- return (
564
- (ioInfo = payload._result),
565
- void 0 === ioInfo &&
566
- console.error(
567
- "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
568
- ioInfo
569
- ),
570
- "default" in ioInfo ||
571
- console.error(
572
- "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
573
- ioInfo
574
- ),
575
- ioInfo.default
576
- );
577
- throw payload._result;
578
- }
579
- function resolveDispatcher() {
580
- var dispatcher = ReactSharedInternals.H;
581
- null === dispatcher &&
582
- console.error(
583
- "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
584
- );
585
- return dispatcher;
586
- }
587
- function releaseAsyncTransition() {
588
- ReactSharedInternals.asyncTransitions--;
589
- }
590
- function enqueueTask(task) {
591
- if (null === enqueueTaskImpl)
592
- try {
593
- var requireString = ("require" + Math.random()).slice(0, 7);
594
- enqueueTaskImpl = (module && module[requireString]).call(
595
- module,
596
- "timers"
597
- ).setImmediate;
598
- } catch (_err) {
599
- enqueueTaskImpl = function (callback) {
600
- false === didWarnAboutMessageChannel &&
601
- ((didWarnAboutMessageChannel = true),
602
- "undefined" === typeof MessageChannel &&
603
- console.error(
604
- "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."
605
- ));
606
- var channel = new MessageChannel();
607
- channel.port1.onmessage = callback;
608
- channel.port2.postMessage(void 0);
609
- };
610
- }
611
- return enqueueTaskImpl(task);
612
- }
613
- function aggregateErrors(errors) {
614
- return 1 < errors.length && "function" === typeof AggregateError
615
- ? new AggregateError(errors)
616
- : errors[0];
617
- }
618
- function popActScope(prevActQueue, prevActScopeDepth) {
619
- prevActScopeDepth !== actScopeDepth - 1 &&
620
- console.error(
621
- "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
622
- );
623
- actScopeDepth = prevActScopeDepth;
624
- }
625
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
626
- var queue = ReactSharedInternals.actQueue;
627
- if (null !== queue)
628
- if (0 !== queue.length)
629
- try {
630
- flushActQueue(queue);
631
- enqueueTask(function () {
632
- return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
633
- });
634
- return;
635
- } catch (error) {
636
- ReactSharedInternals.thrownErrors.push(error);
637
- }
638
- else ReactSharedInternals.actQueue = null;
639
- 0 < ReactSharedInternals.thrownErrors.length
640
- ? ((queue = aggregateErrors(ReactSharedInternals.thrownErrors)),
641
- (ReactSharedInternals.thrownErrors.length = 0),
642
- reject(queue))
643
- : resolve(returnValue);
644
- }
645
- function flushActQueue(queue) {
646
- if (!isFlushing) {
647
- isFlushing = true;
648
- var i = 0;
649
- try {
650
- for (; i < queue.length; i++) {
651
- var callback = queue[i];
652
- do {
653
- ReactSharedInternals.didUsePromise = !1;
654
- var continuation = callback(!1);
655
- if (null !== continuation) {
656
- if (ReactSharedInternals.didUsePromise) {
657
- queue[i] = callback;
658
- queue.splice(0, i);
659
- return;
660
- }
661
- callback = continuation;
662
- } else break;
663
- } while (1);
664
- }
665
- queue.length = 0;
666
- } catch (error) {
667
- queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
668
- } finally {
669
- isFlushing = false;
670
- }
671
- }
672
- }
673
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
674
- "function" ===
675
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
676
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
677
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
678
- REACT_PORTAL_TYPE = Symbol.for("react.portal"),
679
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
680
- REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
681
- REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
682
- REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
683
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
684
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
685
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
686
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
687
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
688
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
689
- REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
690
- MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
691
- didWarnStateUpdateForUnmountedComponent = {},
692
- ReactNoopUpdateQueue = {
693
- isMounted: function () {
694
- return false;
695
- },
696
- enqueueForceUpdate: function (publicInstance) {
697
- warnNoop(publicInstance, "forceUpdate");
698
- },
699
- enqueueReplaceState: function (publicInstance) {
700
- warnNoop(publicInstance, "replaceState");
701
- },
702
- enqueueSetState: function (publicInstance) {
703
- warnNoop(publicInstance, "setState");
704
- }
705
- },
706
- assign = Object.assign,
707
- emptyObject = {};
708
- Object.freeze(emptyObject);
709
- Component.prototype.isReactComponent = {};
710
- Component.prototype.setState = function (partialState, callback) {
711
- if (
712
- "object" !== typeof partialState &&
713
- "function" !== typeof partialState &&
714
- null != partialState
715
- )
716
- throw Error(
717
- "takes an object of state variables to update or a function which returns an object of state variables."
718
- );
719
- this.updater.enqueueSetState(this, partialState, callback, "setState");
720
- };
721
- Component.prototype.forceUpdate = function (callback) {
722
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
723
- };
724
- var deprecatedAPIs = {
725
- isMounted: [
726
- "isMounted",
727
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
728
- ],
729
- replaceState: [
730
- "replaceState",
731
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
732
- ]
733
- };
734
- for (fnName in deprecatedAPIs)
735
- deprecatedAPIs.hasOwnProperty(fnName) &&
736
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
737
- ComponentDummy.prototype = Component.prototype;
738
- deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
739
- deprecatedAPIs.constructor = PureComponent;
740
- assign(deprecatedAPIs, Component.prototype);
741
- deprecatedAPIs.isPureReactComponent = true;
742
- var isArrayImpl = Array.isArray,
743
- REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
744
- ReactSharedInternals = {
745
- H: null,
746
- A: null,
747
- T: null,
748
- S: null,
749
- actQueue: null,
750
- asyncTransitions: 0,
751
- isBatchingLegacy: false,
752
- didScheduleLegacyUpdate: false,
753
- didUsePromise: false,
754
- thrownErrors: [],
755
- getCurrentStack: null,
756
- recentlyCreatedOwnerStacks: 0
757
- },
758
- hasOwnProperty = Object.prototype.hasOwnProperty,
759
- createTask = console.createTask
760
- ? console.createTask
761
- : function () {
762
- return null;
763
- };
764
- deprecatedAPIs = {
765
- react_stack_bottom_frame: function (callStackForError) {
766
- return callStackForError();
767
- }
768
- };
769
- var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
770
- var didWarnAboutElementRef = {};
771
- var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
772
- deprecatedAPIs,
773
- UnknownOwner
774
- )();
775
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
776
- var didWarnAboutMaps = false,
777
- userProvidedKeyEscapeRegex = /\/+/g,
778
- reportGlobalError =
779
- "function" === typeof reportError
780
- ? reportError
781
- : function (error) {
782
- if (
783
- "object" === typeof window &&
784
- "function" === typeof window.ErrorEvent
785
- ) {
786
- var event = new window.ErrorEvent("error", {
787
- bubbles: true,
788
- cancelable: true,
789
- message:
790
- "object" === typeof error &&
791
- null !== error &&
792
- "string" === typeof error.message
793
- ? String(error.message)
794
- : String(error),
795
- error: error
796
- });
797
- if (!window.dispatchEvent(event)) return;
798
- } else if (
799
- "object" === typeof process &&
800
- "function" === typeof process.emit
801
- ) {
802
- process.emit("uncaughtException", error);
803
- return;
804
- }
805
- console.error(error);
806
- },
807
- didWarnAboutMessageChannel = false,
808
- enqueueTaskImpl = null,
809
- actScopeDepth = 0,
810
- didWarnNoAwaitAct = false,
811
- isFlushing = false,
812
- queueSeveralMicrotasks =
813
- "function" === typeof queueMicrotask
814
- ? function (callback) {
815
- queueMicrotask(function () {
816
- return queueMicrotask(callback);
817
- });
818
- }
819
- : enqueueTask;
820
- deprecatedAPIs = Object.freeze({
821
- __proto__: null,
822
- c: function (size) {
823
- return resolveDispatcher().useMemoCache(size);
824
- }
825
- });
826
- var fnName = {
827
- map: mapChildren,
828
- forEach: function (children, forEachFunc, forEachContext) {
829
- mapChildren(
830
- children,
831
- function () {
832
- forEachFunc.apply(this, arguments);
833
- },
834
- forEachContext
835
- );
836
- },
837
- count: function (children) {
838
- var n = 0;
839
- mapChildren(children, function () {
840
- n++;
841
- });
842
- return n;
843
- },
844
- toArray: function (children) {
845
- return (
846
- mapChildren(children, function (child) {
847
- return child;
848
- }) || []
849
- );
850
- },
851
- only: function (children) {
852
- if (!isValidElement(children))
853
- throw Error(
854
- "React.Children.only expected to receive a single React element child."
855
- );
856
- return children;
857
- }
858
- };
859
- exports$1.Activity = REACT_ACTIVITY_TYPE;
860
- exports$1.Children = fnName;
861
- exports$1.Component = Component;
862
- exports$1.Fragment = REACT_FRAGMENT_TYPE;
863
- exports$1.Profiler = REACT_PROFILER_TYPE;
864
- exports$1.PureComponent = PureComponent;
865
- exports$1.StrictMode = REACT_STRICT_MODE_TYPE;
866
- exports$1.Suspense = REACT_SUSPENSE_TYPE;
867
- exports$1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
868
- ReactSharedInternals;
869
- exports$1.__COMPILER_RUNTIME = deprecatedAPIs;
870
- exports$1.act = function (callback) {
871
- var prevActQueue = ReactSharedInternals.actQueue,
872
- prevActScopeDepth = actScopeDepth;
873
- actScopeDepth++;
874
- var queue = (ReactSharedInternals.actQueue =
875
- null !== prevActQueue ? prevActQueue : []),
876
- didAwaitActCall = false;
877
- try {
878
- var result = callback();
879
- } catch (error) {
880
- ReactSharedInternals.thrownErrors.push(error);
881
- }
882
- if (0 < ReactSharedInternals.thrownErrors.length)
883
- throw (
884
- (popActScope(prevActQueue, prevActScopeDepth),
885
- (callback = aggregateErrors(ReactSharedInternals.thrownErrors)),
886
- (ReactSharedInternals.thrownErrors.length = 0),
887
- callback)
888
- );
889
- if (
890
- null !== result &&
891
- "object" === typeof result &&
892
- "function" === typeof result.then
893
- ) {
894
- var thenable = result;
895
- queueSeveralMicrotasks(function () {
896
- didAwaitActCall ||
897
- didWarnNoAwaitAct ||
898
- ((didWarnNoAwaitAct = true),
899
- console.error(
900
- "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 () => ...);"
901
- ));
902
- });
903
- return {
904
- then: function (resolve, reject) {
905
- didAwaitActCall = true;
906
- thenable.then(
907
- function (returnValue) {
908
- popActScope(prevActQueue, prevActScopeDepth);
909
- if (0 === prevActScopeDepth) {
910
- try {
911
- flushActQueue(queue),
912
- enqueueTask(function () {
913
- return recursivelyFlushAsyncActWork(
914
- returnValue,
915
- resolve,
916
- reject
917
- );
918
- });
919
- } catch (error$0) {
920
- ReactSharedInternals.thrownErrors.push(error$0);
921
- }
922
- if (0 < ReactSharedInternals.thrownErrors.length) {
923
- var _thrownError = aggregateErrors(
924
- ReactSharedInternals.thrownErrors
925
- );
926
- ReactSharedInternals.thrownErrors.length = 0;
927
- reject(_thrownError);
928
- }
929
- } else resolve(returnValue);
930
- },
931
- function (error) {
932
- popActScope(prevActQueue, prevActScopeDepth);
933
- 0 < ReactSharedInternals.thrownErrors.length
934
- ? ((error = aggregateErrors(
935
- ReactSharedInternals.thrownErrors
936
- )),
937
- (ReactSharedInternals.thrownErrors.length = 0),
938
- reject(error))
939
- : reject(error);
940
- }
941
- );
942
- }
943
- };
944
- }
945
- var returnValue$jscomp$0 = result;
946
- popActScope(prevActQueue, prevActScopeDepth);
947
- 0 === prevActScopeDepth &&
948
- (flushActQueue(queue),
949
- 0 !== queue.length &&
950
- queueSeveralMicrotasks(function () {
951
- didAwaitActCall ||
952
- didWarnNoAwaitAct ||
953
- ((didWarnNoAwaitAct = true),
954
- console.error(
955
- "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(() => ...)"
956
- ));
957
- }),
958
- (ReactSharedInternals.actQueue = null));
959
- if (0 < ReactSharedInternals.thrownErrors.length)
960
- throw (
961
- ((callback = aggregateErrors(ReactSharedInternals.thrownErrors)),
962
- (ReactSharedInternals.thrownErrors.length = 0),
963
- callback)
964
- );
965
- return {
966
- then: function (resolve, reject) {
967
- didAwaitActCall = true;
968
- 0 === prevActScopeDepth
969
- ? ((ReactSharedInternals.actQueue = queue),
970
- enqueueTask(function () {
971
- return recursivelyFlushAsyncActWork(
972
- returnValue$jscomp$0,
973
- resolve,
974
- reject
975
- );
976
- }))
977
- : resolve(returnValue$jscomp$0);
978
- }
979
- };
980
- };
981
- exports$1.cache = function (fn) {
982
- return function () {
983
- return fn.apply(null, arguments);
984
- };
985
- };
986
- exports$1.cacheSignal = function () {
987
- return null;
988
- };
989
- exports$1.captureOwnerStack = function () {
990
- var getCurrentStack = ReactSharedInternals.getCurrentStack;
991
- return null === getCurrentStack ? null : getCurrentStack();
992
- };
993
- exports$1.cloneElement = function (element, config, children) {
994
- if (null === element || void 0 === element)
995
- throw Error(
996
- "The argument must be a React element, but you passed " +
997
- element +
998
- "."
999
- );
1000
- var props = assign({}, element.props),
1001
- key = element.key,
1002
- owner = element._owner;
1003
- if (null != config) {
1004
- var JSCompiler_inline_result;
1005
- a: {
1006
- if (
1007
- hasOwnProperty.call(config, "ref") &&
1008
- (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
1009
- config,
1010
- "ref"
1011
- ).get) &&
1012
- JSCompiler_inline_result.isReactWarning
1013
- ) {
1014
- JSCompiler_inline_result = false;
1015
- break a;
1016
- }
1017
- JSCompiler_inline_result = void 0 !== config.ref;
1018
- }
1019
- JSCompiler_inline_result && (owner = getOwner());
1020
- hasValidKey(config) &&
1021
- (checkKeyStringCoercion(config.key), (key = "" + config.key));
1022
- for (propName in config)
1023
- !hasOwnProperty.call(config, propName) ||
1024
- "key" === propName ||
1025
- "__self" === propName ||
1026
- "__source" === propName ||
1027
- ("ref" === propName && void 0 === config.ref) ||
1028
- (props[propName] = config[propName]);
1029
- }
1030
- var propName = arguments.length - 2;
1031
- if (1 === propName) props.children = children;
1032
- else if (1 < propName) {
1033
- JSCompiler_inline_result = Array(propName);
1034
- for (var i = 0; i < propName; i++)
1035
- JSCompiler_inline_result[i] = arguments[i + 2];
1036
- props.children = JSCompiler_inline_result;
1037
- }
1038
- props = ReactElement(
1039
- element.type,
1040
- key,
1041
- props,
1042
- owner,
1043
- element._debugStack,
1044
- element._debugTask
1045
- );
1046
- for (key = 2; key < arguments.length; key++)
1047
- validateChildKeys(arguments[key]);
1048
- return props;
1049
- };
1050
- exports$1.createContext = function (defaultValue) {
1051
- defaultValue = {
1052
- $$typeof: REACT_CONTEXT_TYPE,
1053
- _currentValue: defaultValue,
1054
- _currentValue2: defaultValue,
1055
- _threadCount: 0,
1056
- Provider: null,
1057
- Consumer: null
1058
- };
1059
- defaultValue.Provider = defaultValue;
1060
- defaultValue.Consumer = {
1061
- $$typeof: REACT_CONSUMER_TYPE,
1062
- _context: defaultValue
1063
- };
1064
- defaultValue._currentRenderer = null;
1065
- defaultValue._currentRenderer2 = null;
1066
- return defaultValue;
1067
- };
1068
- exports$1.createElement = function (type, config, children) {
1069
- for (var i = 2; i < arguments.length; i++)
1070
- validateChildKeys(arguments[i]);
1071
- i = {};
1072
- var key = null;
1073
- if (null != config)
1074
- for (propName in (didWarnAboutOldJSXRuntime ||
1075
- !("__self" in config) ||
1076
- "key" in config ||
1077
- ((didWarnAboutOldJSXRuntime = true),
1078
- console.warn(
1079
- "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"
1080
- )),
1081
- hasValidKey(config) &&
1082
- (checkKeyStringCoercion(config.key), (key = "" + config.key)),
1083
- config))
1084
- hasOwnProperty.call(config, propName) &&
1085
- "key" !== propName &&
1086
- "__self" !== propName &&
1087
- "__source" !== propName &&
1088
- (i[propName] = config[propName]);
1089
- var childrenLength = arguments.length - 2;
1090
- if (1 === childrenLength) i.children = children;
1091
- else if (1 < childrenLength) {
1092
- for (
1093
- var childArray = Array(childrenLength), _i = 0;
1094
- _i < childrenLength;
1095
- _i++
1096
- )
1097
- childArray[_i] = arguments[_i + 2];
1098
- Object.freeze && Object.freeze(childArray);
1099
- i.children = childArray;
1100
- }
1101
- if (type && type.defaultProps)
1102
- for (propName in ((childrenLength = type.defaultProps), childrenLength))
1103
- void 0 === i[propName] && (i[propName] = childrenLength[propName]);
1104
- key &&
1105
- defineKeyPropWarningGetter(
1106
- i,
1107
- "function" === typeof type
1108
- ? type.displayName || type.name || "Unknown"
1109
- : type
1110
- );
1111
- var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1112
- return ReactElement(
1113
- type,
1114
- key,
1115
- i,
1116
- getOwner(),
1117
- propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1118
- propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1119
- );
1120
- };
1121
- exports$1.createRef = function () {
1122
- var refObject = { current: null };
1123
- Object.seal(refObject);
1124
- return refObject;
1125
- };
1126
- exports$1.forwardRef = function (render) {
1127
- null != render && render.$$typeof === REACT_MEMO_TYPE
1128
- ? console.error(
1129
- "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
1130
- )
1131
- : "function" !== typeof render
1132
- ? console.error(
1133
- "forwardRef requires a render function but was given %s.",
1134
- null === render ? "null" : typeof render
1135
- )
1136
- : 0 !== render.length &&
1137
- 2 !== render.length &&
1138
- console.error(
1139
- "forwardRef render functions accept exactly two parameters: props and ref. %s",
1140
- 1 === render.length
1141
- ? "Did you forget to use the ref parameter?"
1142
- : "Any additional parameter will be undefined."
1143
- );
1144
- null != render &&
1145
- null != render.defaultProps &&
1146
- console.error(
1147
- "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
1148
- );
1149
- var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render },
1150
- ownName;
1151
- Object.defineProperty(elementType, "displayName", {
1152
- enumerable: false,
1153
- configurable: true,
1154
- get: function () {
1155
- return ownName;
1156
- },
1157
- set: function (name) {
1158
- ownName = name;
1159
- render.name ||
1160
- render.displayName ||
1161
- (Object.defineProperty(render, "name", { value: name }),
1162
- (render.displayName = name));
1163
- }
1164
- });
1165
- return elementType;
1166
- };
1167
- exports$1.isValidElement = isValidElement;
1168
- exports$1.lazy = function (ctor) {
1169
- ctor = { _status: -1, _result: ctor };
1170
- var lazyType = {
1171
- $$typeof: REACT_LAZY_TYPE,
1172
- _payload: ctor,
1173
- _init: lazyInitializer
1174
- },
1175
- ioInfo = {
1176
- name: "lazy",
1177
- start: -1,
1178
- end: -1,
1179
- value: null,
1180
- owner: null,
1181
- debugStack: Error("react-stack-top-frame"),
1182
- debugTask: console.createTask ? console.createTask("lazy()") : null
1183
- };
1184
- ctor._ioInfo = ioInfo;
1185
- lazyType._debugInfo = [{ awaited: ioInfo }];
1186
- return lazyType;
1187
- };
1188
- exports$1.memo = function (type, compare) {
1189
- null == type &&
1190
- console.error(
1191
- "memo: The first argument must be a component. Instead received: %s",
1192
- null === type ? "null" : typeof type
1193
- );
1194
- compare = {
1195
- $$typeof: REACT_MEMO_TYPE,
1196
- type: type,
1197
- compare: void 0 === compare ? null : compare
1198
- };
1199
- var ownName;
1200
- Object.defineProperty(compare, "displayName", {
1201
- enumerable: false,
1202
- configurable: true,
1203
- get: function () {
1204
- return ownName;
1205
- },
1206
- set: function (name) {
1207
- ownName = name;
1208
- type.name ||
1209
- type.displayName ||
1210
- (Object.defineProperty(type, "name", { value: name }),
1211
- (type.displayName = name));
1212
- }
1213
- });
1214
- return compare;
1215
- };
1216
- exports$1.startTransition = function (scope) {
1217
- var prevTransition = ReactSharedInternals.T,
1218
- currentTransition = {};
1219
- currentTransition._updatedFibers = new Set();
1220
- ReactSharedInternals.T = currentTransition;
1221
- try {
1222
- var returnValue = scope(),
1223
- onStartTransitionFinish = ReactSharedInternals.S;
1224
- null !== onStartTransitionFinish &&
1225
- onStartTransitionFinish(currentTransition, returnValue);
1226
- "object" === typeof returnValue &&
1227
- null !== returnValue &&
1228
- "function" === typeof returnValue.then &&
1229
- (ReactSharedInternals.asyncTransitions++,
1230
- returnValue.then(releaseAsyncTransition, releaseAsyncTransition),
1231
- returnValue.then(noop, reportGlobalError));
1232
- } catch (error) {
1233
- reportGlobalError(error);
1234
- } finally {
1235
- null === prevTransition &&
1236
- currentTransition._updatedFibers &&
1237
- ((scope = currentTransition._updatedFibers.size),
1238
- currentTransition._updatedFibers.clear(),
1239
- 10 < scope &&
1240
- console.warn(
1241
- "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."
1242
- )),
1243
- null !== prevTransition &&
1244
- null !== currentTransition.types &&
1245
- (null !== prevTransition.types &&
1246
- prevTransition.types !== currentTransition.types &&
1247
- console.error(
1248
- "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."
1249
- ),
1250
- (prevTransition.types = currentTransition.types)),
1251
- (ReactSharedInternals.T = prevTransition);
1252
- }
1253
- };
1254
- exports$1.unstable_useCacheRefresh = function () {
1255
- return resolveDispatcher().useCacheRefresh();
1256
- };
1257
- exports$1.use = function (usable) {
1258
- return resolveDispatcher().use(usable);
1259
- };
1260
- exports$1.useActionState = function (action, initialState, permalink) {
1261
- return resolveDispatcher().useActionState(
1262
- action,
1263
- initialState,
1264
- permalink
1265
- );
1266
- };
1267
- exports$1.useCallback = function (callback, deps) {
1268
- return resolveDispatcher().useCallback(callback, deps);
1269
- };
1270
- exports$1.useContext = function (Context) {
1271
- var dispatcher = resolveDispatcher();
1272
- Context.$$typeof === REACT_CONSUMER_TYPE &&
1273
- console.error(
1274
- "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
1275
- );
1276
- return dispatcher.useContext(Context);
1277
- };
1278
- exports$1.useDebugValue = function (value, formatterFn) {
1279
- return resolveDispatcher().useDebugValue(value, formatterFn);
1280
- };
1281
- exports$1.useDeferredValue = function (value, initialValue) {
1282
- return resolveDispatcher().useDeferredValue(value, initialValue);
1283
- };
1284
- exports$1.useEffect = function (create, deps) {
1285
- null == create &&
1286
- console.warn(
1287
- "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1288
- );
1289
- return resolveDispatcher().useEffect(create, deps);
1290
- };
1291
- exports$1.useEffectEvent = function (callback) {
1292
- return resolveDispatcher().useEffectEvent(callback);
1293
- };
1294
- exports$1.useId = function () {
1295
- return resolveDispatcher().useId();
1296
- };
1297
- exports$1.useImperativeHandle = function (ref, create, deps) {
1298
- return resolveDispatcher().useImperativeHandle(ref, create, deps);
1299
- };
1300
- exports$1.useInsertionEffect = function (create, deps) {
1301
- null == create &&
1302
- console.warn(
1303
- "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1304
- );
1305
- return resolveDispatcher().useInsertionEffect(create, deps);
1306
- };
1307
- exports$1.useLayoutEffect = function (create, deps) {
1308
- null == create &&
1309
- console.warn(
1310
- "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1311
- );
1312
- return resolveDispatcher().useLayoutEffect(create, deps);
1313
- };
1314
- exports$1.useMemo = function (create, deps) {
1315
- return resolveDispatcher().useMemo(create, deps);
1316
- };
1317
- exports$1.useOptimistic = function (passthrough, reducer) {
1318
- return resolveDispatcher().useOptimistic(passthrough, reducer);
1319
- };
1320
- exports$1.useReducer = function (reducer, initialArg, init) {
1321
- return resolveDispatcher().useReducer(reducer, initialArg, init);
1322
- };
1323
- exports$1.useRef = function (initialValue) {
1324
- return resolveDispatcher().useRef(initialValue);
1325
- };
1326
- exports$1.useState = function (initialState) {
1327
- return resolveDispatcher().useState(initialState);
1328
- };
1329
- exports$1.useSyncExternalStore = function (
1330
- subscribe,
1331
- getSnapshot,
1332
- getServerSnapshot
1333
- ) {
1334
- return resolveDispatcher().useSyncExternalStore(
1335
- subscribe,
1336
- getSnapshot,
1337
- getServerSnapshot
1338
- );
1339
- };
1340
- exports$1.useTransition = function () {
1341
- return resolveDispatcher().useTransition();
1342
- };
1343
- exports$1.version = "19.2.4";
1344
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1345
- "function" ===
1346
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
1347
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1348
- }))();
1349
- } (react_development, react_development.exports));
1350
- return react_development.exports;
1351
- }
1352
-
1353
- var hasRequiredReact;
1354
-
1355
- function requireReact () {
1356
- if (hasRequiredReact) return react.exports;
1357
- hasRequiredReact = 1;
1358
-
1359
- {
1360
- react.exports = requireReact_development();
45
+ //#endregion
46
+ //#region src/errors.ts
47
+ let SolanaMWAWalletLibErrorCode = /* @__PURE__ */ function(SolanaMWAWalletLibErrorCode) {
48
+ SolanaMWAWalletLibErrorCode["ERROR_INTENT_DATA_NOT_FOUND"] = "ERROR_INTENT_DATA_NOT_FOUND";
49
+ SolanaMWAWalletLibErrorCode["ERROR_SESSION_ALREADY_CREATED"] = "ERROR_SESSION_ALREADY_CREATED";
50
+ SolanaMWAWalletLibErrorCode["ERROR_UNSUPPORTED_ASSOCIATION_URI"] = "ERROR_UNSUPPORTED_ASSOCIATION_URI";
51
+ SolanaMWAWalletLibErrorCode["ERROR_UNSUPPORTED_ASSOCIATION_TYPE"] = "ERROR_UNSUPPORTED_ASSOCIATION_TYPE";
52
+ return SolanaMWAWalletLibErrorCode;
53
+ }({});
54
+ var SolanaMWAWalletLibError = class extends Error {
55
+ code;
56
+ constructor(code, message) {
57
+ super(message);
58
+ this.name = "SolanaMWAWalletLibError";
59
+ this.code = code;
1361
60
  }
1362
- return react.exports;
1363
- }
1364
-
1365
- var reactExports = requireReact();
1366
-
1367
- var SolanaMWAWalletLibErrorCode;
1368
- (function (SolanaMWAWalletLibErrorCode) {
1369
- SolanaMWAWalletLibErrorCode["ERROR_INTENT_DATA_NOT_FOUND"] = "ERROR_INTENT_DATA_NOT_FOUND";
1370
- SolanaMWAWalletLibErrorCode["ERROR_SESSION_ALREADY_CREATED"] = "ERROR_SESSION_ALREADY_CREATED";
1371
- SolanaMWAWalletLibErrorCode["ERROR_UNSUPPORTED_ASSOCIATION_URI"] = "ERROR_UNSUPPORTED_ASSOCIATION_URI";
1372
- SolanaMWAWalletLibErrorCode["ERROR_UNSUPPORTED_ASSOCIATION_TYPE"] = "ERROR_UNSUPPORTED_ASSOCIATION_TYPE";
1373
- })(SolanaMWAWalletLibErrorCode || (SolanaMWAWalletLibErrorCode = {}));
1374
- class SolanaMWAWalletLibError extends Error {
1375
- code;
1376
- constructor(code, message) {
1377
- super(message);
1378
- this.name = 'SolanaMWAWalletLibError';
1379
- this.code = code;
1380
- }
1381
- }
1382
-
1383
- const LINKING_ERROR$1 = `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
1384
- '- You rebuilt the app after installing the package\n' +
1385
- '- If you are using Lerna workspaces\n' +
1386
- ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n' +
1387
- ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n' +
1388
- '- You are not using Expo managed workflow\n';
1389
- const SolanaMobileWalletAdapterWalletLib = Platform.OS === 'android' && NativeModules.SolanaMobileWalletAdapterWalletLib
1390
- ? NativeModules.SolanaMobileWalletAdapterWalletLib
1391
- : new Proxy({}, {
1392
- get() {
1393
- throw new Error(Platform.OS !== 'android'
1394
- ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'
1395
- : LINKING_ERROR$1);
1396
- },
1397
- });
61
+ };
62
+ //#endregion
63
+ //#region src/initializeMobileWalletAdapterSession.ts
64
+ const LINKING_ERROR$1 = "The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n- You rebuilt the app after installing the package\n- If you are using Lerna workspaces\n - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n- You are not using Expo managed workflow\n";
65
+ const SolanaMobileWalletAdapterWalletLib = Platform.OS === "android" && NativeModules.SolanaMobileWalletAdapterWalletLib ? NativeModules.SolanaMobileWalletAdapterWalletLib : new Proxy({}, { get() {
66
+ throw new Error(Platform.OS !== "android" ? "The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android" : LINKING_ERROR$1);
67
+ } });
1398
68
  function handleError(e) {
1399
- if (e instanceof Error) {
1400
- const { code, message } = e;
1401
- if (code && code in SolanaMWAWalletLibErrorCode) {
1402
- throw new SolanaMWAWalletLibError(code, message);
1403
- }
1404
- }
1405
- throw e;
69
+ if (e instanceof Error) {
70
+ const { code, message } = e;
71
+ if (code && code in SolanaMWAWalletLibErrorCode) throw new SolanaMWAWalletLibError(code, message);
72
+ }
73
+ throw e;
1406
74
  }
1407
75
  async function initializeMobileWalletAdapterSession(walletName, config) {
1408
- try {
1409
- return await initializeScenario(walletName, config);
1410
- }
1411
- catch (e) {
1412
- handleError(e);
1413
- }
76
+ try {
77
+ return await initializeScenario(walletName, config);
78
+ } catch (e) {
79
+ handleError(e);
80
+ }
1414
81
  }
1415
- // Create Scenario and establish session with dapp
1416
82
  function initializeScenario(walletName, walletConfig) {
1417
- return SolanaMobileWalletAdapterWalletLib.createScenario(walletName, JSON.stringify(walletConfig));
83
+ return SolanaMobileWalletAdapterWalletLib.createScenario(walletName, JSON.stringify(walletConfig));
1418
84
  }
1419
-
1420
- const MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = 'MobileWalletAdapterServiceRequestBridge';
85
+ //#endregion
86
+ //#region src/initializeMWAEventListener.ts
87
+ const MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME = "MobileWalletAdapterServiceRequestBridge";
1421
88
  function initializeMWAEventListener(handleRequest, handleSessionEvent) {
1422
- const mwaEventEmitter = new NativeEventEmitter();
1423
- const listener = mwaEventEmitter.addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {
1424
- if (isMWARequest(nativeEvent)) {
1425
- handleRequest(nativeEvent);
1426
- }
1427
- else if (isMWASessionEvent(nativeEvent)) {
1428
- handleSessionEvent(nativeEvent);
1429
- }
1430
- else {
1431
- console.warn('Unexpected native event type');
1432
- }
1433
- });
1434
- return listener;
89
+ return new NativeEventEmitter().addListener(MOBILE_WALLET_ADAPTER_EVENT_BRIDGE_NAME, (nativeEvent) => {
90
+ if (isMWARequest(nativeEvent)) handleRequest(nativeEvent);
91
+ else if (isMWASessionEvent(nativeEvent)) handleSessionEvent(nativeEvent);
92
+ else console.warn("Unexpected native event type");
93
+ });
1435
94
  }
1436
95
  function isMWARequest(nativeEvent) {
1437
- return Object.values(MWARequestType).includes(nativeEvent.__type);
96
+ return Object.values(MWARequestType).includes(nativeEvent.__type);
1438
97
  }
1439
98
  function isMWASessionEvent(nativeEvent) {
1440
- return Object.values(MWASessionEventType).includes(nativeEvent.__type);
99
+ return Object.values(MWASessionEventType).includes(nativeEvent.__type);
1441
100
  }
1442
-
101
+ //#endregion
102
+ //#region src/useMobileWalletAdapterSession.ts
1443
103
  function useMobileWalletAdapterSession(walletName, config, handleRequest, handleSessionEvent) {
1444
- reactExports.useEffect(() => {
1445
- async function startSession() {
1446
- try {
1447
- await initializeMobileWalletAdapterSession(walletName, config);
1448
- }
1449
- catch (e) {
1450
- console.error(e);
1451
- }
1452
- }
1453
- const listener = initializeMWAEventListener(handleRequest, handleSessionEvent);
1454
- startSession();
1455
- return () => {
1456
- listener.remove();
1457
- };
1458
- }, []);
104
+ useEffect(() => {
105
+ async function startSession() {
106
+ try {
107
+ await initializeMobileWalletAdapterSession(walletName, config);
108
+ } catch (e) {
109
+ console.error(e);
110
+ }
111
+ }
112
+ const listener = initializeMWAEventListener(handleRequest, handleSessionEvent);
113
+ startSession();
114
+ return () => {
115
+ listener.remove();
116
+ };
117
+ }, []);
1459
118
  }
1460
-
1461
- const LINKING_ERROR = `The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n` +
1462
- '- You rebuilt the app after installing the package\n' +
1463
- '- If you are using Lerna workspaces\n' +
1464
- ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n' +
1465
- ' - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n' +
1466
- '- You are not using Expo managed workflow\n';
1467
- const SolanaMobileDigitalAssetLinks = Platform.OS === 'android' && NativeModules.SolanaMobileDigitalAssetLinks
1468
- ? NativeModules.SolanaMobileDigitalAssetLinks
1469
- : new Proxy({}, {
1470
- get() {
1471
- throw new Error(Platform.OS !== 'android'
1472
- ? 'The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android'
1473
- : LINKING_ERROR);
1474
- },
1475
- });
119
+ //#endregion
120
+ //#region src/useDigitalAssetLinks.ts
121
+ const LINKING_ERROR = "The package 'solana-mobile-wallet-adapter-walletlib' doesn't seem to be linked. Make sure: \n\n- You rebuilt the app after installing the package\n- If you are using Lerna workspaces\n - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` as an explicit dependency, and\n - You have added `@solana-mobile/mobile-wallet-adapter-walletlib` to the `nohoist` section of your package.json\n- You are not using Expo managed workflow\n";
122
+ const SolanaMobileDigitalAssetLinks = Platform.OS === "android" && NativeModules.SolanaMobileDigitalAssetLinks ? NativeModules.SolanaMobileDigitalAssetLinks : new Proxy({}, { get() {
123
+ throw new Error(Platform.OS !== "android" ? "The package `solana-mobile-wallet-adapter-walletlib` is only compatible with React Native Android" : LINKING_ERROR);
124
+ } });
1476
125
  async function getCallingPackage() {
1477
- return await SolanaMobileDigitalAssetLinks.getCallingPackage();
126
+ return await SolanaMobileDigitalAssetLinks.getCallingPackage();
1478
127
  }
1479
128
  async function verifyCallingPackage(clientIdentityUri) {
1480
- return await SolanaMobileDigitalAssetLinks.verifyCallingPackage(clientIdentityUri);
129
+ return await SolanaMobileDigitalAssetLinks.verifyCallingPackage(clientIdentityUri);
1481
130
  }
1482
131
  async function getCallingPackageUid() {
1483
- return await SolanaMobileDigitalAssetLinks.getCallingPackageUid();
132
+ return await SolanaMobileDigitalAssetLinks.getCallingPackageUid();
1484
133
  }
1485
134
  async function getUidForPackage(packageName) {
1486
- return await SolanaMobileDigitalAssetLinks.getUidForPackage(packageName);
135
+ return await SolanaMobileDigitalAssetLinks.getUidForPackage(packageName);
1487
136
  }
1488
-
137
+ //#endregion
1489
138
  export { MWARequestFailReason, MWARequestType, MWASessionEventType, SolanaMWAWalletLibError, SolanaMWAWalletLibErrorCode, getCallingPackage, getCallingPackageUid, getUidForPackage, initializeMWAEventListener, initializeMobileWalletAdapterSession, resolve, useMobileWalletAdapterSession, verifyCallingPackage };
139
+
140
+ //# sourceMappingURL=index.js.map