@alleyboss/micropay-solana-x402-paywall 3.1.3 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -6,9 +6,1460 @@ var client = require('@x402/core/client');
6
6
  var svm = require('@x402/svm');
7
7
  var http = require('@x402/core/http');
8
8
  var web3_js = require('@solana/web3.js');
9
+ var bs58 = require('bs58');
9
10
  var jose = require('jose');
10
11
 
11
- // src/index.ts
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ var bs58__default = /*#__PURE__*/_interopDefault(bs58);
15
+
16
+ var __create = Object.create;
17
+ var __defProp = Object.defineProperty;
18
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
19
+ var __getOwnPropNames = Object.getOwnPropertyNames;
20
+ var __getProtoOf = Object.getPrototypeOf;
21
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
22
+ var __commonJS = (cb, mod) => function __require() {
23
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
+ };
25
+ var __copyProps = (to, from, except, desc) => {
26
+ if (from && typeof from === "object" || typeof from === "function") {
27
+ for (let key of __getOwnPropNames(from))
28
+ if (!__hasOwnProp.call(to, key) && key !== except)
29
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
30
+ }
31
+ return to;
32
+ };
33
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
34
+ // If the importer is in node compatibility mode or this is not an ESM
35
+ // file that has been converted to a CommonJS file using a Babel-
36
+ // compatible transform (i.e. "__esModule" has not been set), then set
37
+ // "default" to the CommonJS "module.exports" for node compatibility.
38
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
39
+ mod
40
+ ));
41
+
42
+ // ../../node_modules/react/cjs/react.production.js
43
+ var require_react_production = __commonJS({
44
+ "../../node_modules/react/cjs/react.production.js"(exports$1) {
45
+ var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element");
46
+ var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
47
+ var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
48
+ var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
49
+ var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
50
+ var REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer");
51
+ var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
52
+ var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
53
+ var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
54
+ var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
55
+ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
56
+ var REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity");
57
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
58
+ function getIteratorFn(maybeIterable) {
59
+ if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
60
+ maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
61
+ return "function" === typeof maybeIterable ? maybeIterable : null;
62
+ }
63
+ var ReactNoopUpdateQueue = {
64
+ isMounted: function() {
65
+ return false;
66
+ },
67
+ enqueueForceUpdate: function() {
68
+ },
69
+ enqueueReplaceState: function() {
70
+ },
71
+ enqueueSetState: function() {
72
+ }
73
+ };
74
+ var assign = Object.assign;
75
+ var emptyObject = {};
76
+ function Component(props, context, updater) {
77
+ this.props = props;
78
+ this.context = context;
79
+ this.refs = emptyObject;
80
+ this.updater = updater || ReactNoopUpdateQueue;
81
+ }
82
+ Component.prototype.isReactComponent = {};
83
+ Component.prototype.setState = function(partialState, callback) {
84
+ if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
85
+ throw Error(
86
+ "takes an object of state variables to update or a function which returns an object of state variables."
87
+ );
88
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
89
+ };
90
+ Component.prototype.forceUpdate = function(callback) {
91
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
92
+ };
93
+ function ComponentDummy() {
94
+ }
95
+ ComponentDummy.prototype = Component.prototype;
96
+ function PureComponent(props, context, updater) {
97
+ this.props = props;
98
+ this.context = context;
99
+ this.refs = emptyObject;
100
+ this.updater = updater || ReactNoopUpdateQueue;
101
+ }
102
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
103
+ pureComponentPrototype.constructor = PureComponent;
104
+ assign(pureComponentPrototype, Component.prototype);
105
+ pureComponentPrototype.isPureReactComponent = true;
106
+ var isArrayImpl = Array.isArray;
107
+ function noop() {
108
+ }
109
+ var ReactSharedInternals = { H: null, A: null, T: null, S: null };
110
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
111
+ function ReactElement(type, key, props) {
112
+ var refProp = props.ref;
113
+ return {
114
+ $$typeof: REACT_ELEMENT_TYPE,
115
+ type,
116
+ key,
117
+ ref: void 0 !== refProp ? refProp : null,
118
+ props
119
+ };
120
+ }
121
+ function cloneAndReplaceKey(oldElement, newKey) {
122
+ return ReactElement(oldElement.type, newKey, oldElement.props);
123
+ }
124
+ function isValidElement(object) {
125
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
126
+ }
127
+ function escape(key) {
128
+ var escaperLookup = { "=": "=0", ":": "=2" };
129
+ return "$" + key.replace(/[=:]/g, function(match) {
130
+ return escaperLookup[match];
131
+ });
132
+ }
133
+ var userProvidedKeyEscapeRegex = /\/+/g;
134
+ function getElementKey(element, index) {
135
+ return "object" === typeof element && null !== element && null != element.key ? escape("" + element.key) : index.toString(36);
136
+ }
137
+ function resolveThenable(thenable) {
138
+ switch (thenable.status) {
139
+ case "fulfilled":
140
+ return thenable.value;
141
+ case "rejected":
142
+ throw thenable.reason;
143
+ default:
144
+ switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
145
+ function(fulfilledValue) {
146
+ "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
147
+ },
148
+ function(error) {
149
+ "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
150
+ }
151
+ )), thenable.status) {
152
+ case "fulfilled":
153
+ return thenable.value;
154
+ case "rejected":
155
+ throw thenable.reason;
156
+ }
157
+ }
158
+ throw thenable;
159
+ }
160
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
161
+ var type = typeof children;
162
+ if ("undefined" === type || "boolean" === type) children = null;
163
+ var invokeCallback = false;
164
+ if (null === children) invokeCallback = true;
165
+ else
166
+ switch (type) {
167
+ case "bigint":
168
+ case "string":
169
+ case "number":
170
+ invokeCallback = true;
171
+ break;
172
+ case "object":
173
+ switch (children.$$typeof) {
174
+ case REACT_ELEMENT_TYPE:
175
+ case REACT_PORTAL_TYPE:
176
+ invokeCallback = true;
177
+ break;
178
+ case REACT_LAZY_TYPE:
179
+ return invokeCallback = children._init, mapIntoArray(
180
+ invokeCallback(children._payload),
181
+ array,
182
+ escapedPrefix,
183
+ nameSoFar,
184
+ callback
185
+ );
186
+ }
187
+ }
188
+ if (invokeCallback)
189
+ return callback = callback(children), invokeCallback = "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar, isArrayImpl(callback) ? (escapedPrefix = "", null != invokeCallback && (escapedPrefix = invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
190
+ return c;
191
+ })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(
192
+ callback,
193
+ escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(
194
+ userProvidedKeyEscapeRegex,
195
+ "$&/"
196
+ ) + "/") + invokeCallback
197
+ )), array.push(callback)), 1;
198
+ invokeCallback = 0;
199
+ var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
200
+ if (isArrayImpl(children))
201
+ for (var i = 0; i < children.length; i++)
202
+ nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
203
+ nameSoFar,
204
+ array,
205
+ escapedPrefix,
206
+ type,
207
+ callback
208
+ );
209
+ else if (i = getIteratorFn(children), "function" === typeof i)
210
+ for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
211
+ nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
212
+ nameSoFar,
213
+ array,
214
+ escapedPrefix,
215
+ type,
216
+ callback
217
+ );
218
+ else if ("object" === type) {
219
+ if ("function" === typeof children.then)
220
+ return mapIntoArray(
221
+ resolveThenable(children),
222
+ array,
223
+ escapedPrefix,
224
+ nameSoFar,
225
+ callback
226
+ );
227
+ array = String(children);
228
+ throw Error(
229
+ "Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
230
+ );
231
+ }
232
+ return invokeCallback;
233
+ }
234
+ function mapChildren(children, func, context) {
235
+ if (null == children) return children;
236
+ var result = [], count = 0;
237
+ mapIntoArray(children, result, "", "", function(child) {
238
+ return func.call(context, child, count++);
239
+ });
240
+ return result;
241
+ }
242
+ function lazyInitializer(payload) {
243
+ if (-1 === payload._status) {
244
+ var ctor = payload._result;
245
+ ctor = ctor();
246
+ ctor.then(
247
+ function(moduleObject) {
248
+ if (0 === payload._status || -1 === payload._status)
249
+ payload._status = 1, payload._result = moduleObject;
250
+ },
251
+ function(error) {
252
+ if (0 === payload._status || -1 === payload._status)
253
+ payload._status = 2, payload._result = error;
254
+ }
255
+ );
256
+ -1 === payload._status && (payload._status = 0, payload._result = ctor);
257
+ }
258
+ if (1 === payload._status) return payload._result.default;
259
+ throw payload._result;
260
+ }
261
+ var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
262
+ if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
263
+ var event = new window.ErrorEvent("error", {
264
+ bubbles: true,
265
+ cancelable: true,
266
+ message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
267
+ error
268
+ });
269
+ if (!window.dispatchEvent(event)) return;
270
+ } else if ("object" === typeof process && "function" === typeof process.emit) {
271
+ process.emit("uncaughtException", error);
272
+ return;
273
+ }
274
+ console.error(error);
275
+ };
276
+ var Children = {
277
+ map: mapChildren,
278
+ forEach: function(children, forEachFunc, forEachContext) {
279
+ mapChildren(
280
+ children,
281
+ function() {
282
+ forEachFunc.apply(this, arguments);
283
+ },
284
+ forEachContext
285
+ );
286
+ },
287
+ count: function(children) {
288
+ var n = 0;
289
+ mapChildren(children, function() {
290
+ n++;
291
+ });
292
+ return n;
293
+ },
294
+ toArray: function(children) {
295
+ return mapChildren(children, function(child) {
296
+ return child;
297
+ }) || [];
298
+ },
299
+ only: function(children) {
300
+ if (!isValidElement(children))
301
+ throw Error(
302
+ "React.Children.only expected to receive a single React element child."
303
+ );
304
+ return children;
305
+ }
306
+ };
307
+ exports$1.Activity = REACT_ACTIVITY_TYPE;
308
+ exports$1.Children = Children;
309
+ exports$1.Component = Component;
310
+ exports$1.Fragment = REACT_FRAGMENT_TYPE;
311
+ exports$1.Profiler = REACT_PROFILER_TYPE;
312
+ exports$1.PureComponent = PureComponent;
313
+ exports$1.StrictMode = REACT_STRICT_MODE_TYPE;
314
+ exports$1.Suspense = REACT_SUSPENSE_TYPE;
315
+ exports$1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
316
+ exports$1.__COMPILER_RUNTIME = {
317
+ __proto__: null,
318
+ c: function(size) {
319
+ return ReactSharedInternals.H.useMemoCache(size);
320
+ }
321
+ };
322
+ exports$1.cache = function(fn) {
323
+ return function() {
324
+ return fn.apply(null, arguments);
325
+ };
326
+ };
327
+ exports$1.cacheSignal = function() {
328
+ return null;
329
+ };
330
+ exports$1.cloneElement = function(element, config2, children) {
331
+ if (null === element || void 0 === element)
332
+ throw Error(
333
+ "The argument must be a React element, but you passed " + element + "."
334
+ );
335
+ var props = assign({}, element.props), key = element.key;
336
+ if (null != config2)
337
+ for (propName in void 0 !== config2.key && (key = "" + config2.key), config2)
338
+ !hasOwnProperty.call(config2, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config2.ref || (props[propName] = config2[propName]);
339
+ var propName = arguments.length - 2;
340
+ if (1 === propName) props.children = children;
341
+ else if (1 < propName) {
342
+ for (var childArray = Array(propName), i = 0; i < propName; i++)
343
+ childArray[i] = arguments[i + 2];
344
+ props.children = childArray;
345
+ }
346
+ return ReactElement(element.type, key, props);
347
+ };
348
+ exports$1.createContext = function(defaultValue) {
349
+ defaultValue = {
350
+ $$typeof: REACT_CONTEXT_TYPE,
351
+ _currentValue: defaultValue,
352
+ _currentValue2: defaultValue,
353
+ _threadCount: 0,
354
+ Provider: null,
355
+ Consumer: null
356
+ };
357
+ defaultValue.Provider = defaultValue;
358
+ defaultValue.Consumer = {
359
+ $$typeof: REACT_CONSUMER_TYPE,
360
+ _context: defaultValue
361
+ };
362
+ return defaultValue;
363
+ };
364
+ exports$1.createElement = function(type, config2, children) {
365
+ var propName, props = {}, key = null;
366
+ if (null != config2)
367
+ for (propName in void 0 !== config2.key && (key = "" + config2.key), config2)
368
+ hasOwnProperty.call(config2, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config2[propName]);
369
+ var childrenLength = arguments.length - 2;
370
+ if (1 === childrenLength) props.children = children;
371
+ else if (1 < childrenLength) {
372
+ for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
373
+ childArray[i] = arguments[i + 2];
374
+ props.children = childArray;
375
+ }
376
+ if (type && type.defaultProps)
377
+ for (propName in childrenLength = type.defaultProps, childrenLength)
378
+ void 0 === props[propName] && (props[propName] = childrenLength[propName]);
379
+ return ReactElement(type, key, props);
380
+ };
381
+ exports$1.createRef = function() {
382
+ return { current: null };
383
+ };
384
+ exports$1.forwardRef = function(render) {
385
+ return { $$typeof: REACT_FORWARD_REF_TYPE, render };
386
+ };
387
+ exports$1.isValidElement = isValidElement;
388
+ exports$1.lazy = function(ctor) {
389
+ return {
390
+ $$typeof: REACT_LAZY_TYPE,
391
+ _payload: { _status: -1, _result: ctor },
392
+ _init: lazyInitializer
393
+ };
394
+ };
395
+ exports$1.memo = function(type, compare) {
396
+ return {
397
+ $$typeof: REACT_MEMO_TYPE,
398
+ type,
399
+ compare: void 0 === compare ? null : compare
400
+ };
401
+ };
402
+ exports$1.startTransition = function(scope) {
403
+ var prevTransition = ReactSharedInternals.T, currentTransition = {};
404
+ ReactSharedInternals.T = currentTransition;
405
+ try {
406
+ var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
407
+ null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
408
+ "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
409
+ } catch (error) {
410
+ reportGlobalError(error);
411
+ } finally {
412
+ null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
413
+ }
414
+ };
415
+ exports$1.unstable_useCacheRefresh = function() {
416
+ return ReactSharedInternals.H.useCacheRefresh();
417
+ };
418
+ exports$1.use = function(usable) {
419
+ return ReactSharedInternals.H.use(usable);
420
+ };
421
+ exports$1.useActionState = function(action, initialState, permalink) {
422
+ return ReactSharedInternals.H.useActionState(action, initialState, permalink);
423
+ };
424
+ exports$1.useCallback = function(callback, deps) {
425
+ return ReactSharedInternals.H.useCallback(callback, deps);
426
+ };
427
+ exports$1.useContext = function(Context) {
428
+ return ReactSharedInternals.H.useContext(Context);
429
+ };
430
+ exports$1.useDebugValue = function() {
431
+ };
432
+ exports$1.useDeferredValue = function(value, initialValue) {
433
+ return ReactSharedInternals.H.useDeferredValue(value, initialValue);
434
+ };
435
+ exports$1.useEffect = function(create, deps) {
436
+ return ReactSharedInternals.H.useEffect(create, deps);
437
+ };
438
+ exports$1.useEffectEvent = function(callback) {
439
+ return ReactSharedInternals.H.useEffectEvent(callback);
440
+ };
441
+ exports$1.useId = function() {
442
+ return ReactSharedInternals.H.useId();
443
+ };
444
+ exports$1.useImperativeHandle = function(ref, create, deps) {
445
+ return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
446
+ };
447
+ exports$1.useInsertionEffect = function(create, deps) {
448
+ return ReactSharedInternals.H.useInsertionEffect(create, deps);
449
+ };
450
+ exports$1.useLayoutEffect = function(create, deps) {
451
+ return ReactSharedInternals.H.useLayoutEffect(create, deps);
452
+ };
453
+ exports$1.useMemo = function(create, deps) {
454
+ return ReactSharedInternals.H.useMemo(create, deps);
455
+ };
456
+ exports$1.useOptimistic = function(passthrough, reducer) {
457
+ return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
458
+ };
459
+ exports$1.useReducer = function(reducer, initialArg, init) {
460
+ return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
461
+ };
462
+ exports$1.useRef = function(initialValue) {
463
+ return ReactSharedInternals.H.useRef(initialValue);
464
+ };
465
+ exports$1.useState = function(initialState) {
466
+ return ReactSharedInternals.H.useState(initialState);
467
+ };
468
+ exports$1.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
469
+ return ReactSharedInternals.H.useSyncExternalStore(
470
+ subscribe,
471
+ getSnapshot,
472
+ getServerSnapshot
473
+ );
474
+ };
475
+ exports$1.useTransition = function() {
476
+ return ReactSharedInternals.H.useTransition();
477
+ };
478
+ exports$1.version = "19.2.3";
479
+ }
480
+ });
481
+
482
+ // ../../node_modules/react/cjs/react.development.js
483
+ var require_react_development = __commonJS({
484
+ "../../node_modules/react/cjs/react.development.js"(exports$1, module) {
485
+ "production" !== process.env.NODE_ENV && (function() {
486
+ function defineDeprecationWarning(methodName, info) {
487
+ Object.defineProperty(Component.prototype, methodName, {
488
+ get: function() {
489
+ console.warn(
490
+ "%s(...) is deprecated in plain JavaScript React classes. %s",
491
+ info[0],
492
+ info[1]
493
+ );
494
+ }
495
+ });
496
+ }
497
+ function getIteratorFn(maybeIterable) {
498
+ if (null === maybeIterable || "object" !== typeof maybeIterable)
499
+ return null;
500
+ maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
501
+ return "function" === typeof maybeIterable ? maybeIterable : null;
502
+ }
503
+ function warnNoop(publicInstance, callerName) {
504
+ publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
505
+ var warningKey = publicInstance + "." + callerName;
506
+ didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error(
507
+ "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.",
508
+ callerName,
509
+ publicInstance
510
+ ), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
511
+ }
512
+ function Component(props, context, updater) {
513
+ this.props = props;
514
+ this.context = context;
515
+ this.refs = emptyObject;
516
+ this.updater = updater || ReactNoopUpdateQueue;
517
+ }
518
+ function ComponentDummy() {
519
+ }
520
+ function PureComponent(props, context, updater) {
521
+ this.props = props;
522
+ this.context = context;
523
+ this.refs = emptyObject;
524
+ this.updater = updater || ReactNoopUpdateQueue;
525
+ }
526
+ function noop() {
527
+ }
528
+ function testStringCoercion(value) {
529
+ return "" + value;
530
+ }
531
+ function checkKeyStringCoercion(value) {
532
+ try {
533
+ testStringCoercion(value);
534
+ var JSCompiler_inline_result = false;
535
+ } catch (e) {
536
+ JSCompiler_inline_result = true;
537
+ }
538
+ if (JSCompiler_inline_result) {
539
+ JSCompiler_inline_result = console;
540
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
541
+ var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
542
+ JSCompiler_temp_const.call(
543
+ JSCompiler_inline_result,
544
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
545
+ JSCompiler_inline_result$jscomp$0
546
+ );
547
+ return testStringCoercion(value);
548
+ }
549
+ }
550
+ function getComponentNameFromType(type) {
551
+ if (null == type) return null;
552
+ if ("function" === typeof type)
553
+ return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
554
+ if ("string" === typeof type) return type;
555
+ switch (type) {
556
+ case REACT_FRAGMENT_TYPE:
557
+ return "Fragment";
558
+ case REACT_PROFILER_TYPE:
559
+ return "Profiler";
560
+ case REACT_STRICT_MODE_TYPE:
561
+ return "StrictMode";
562
+ case REACT_SUSPENSE_TYPE:
563
+ return "Suspense";
564
+ case REACT_SUSPENSE_LIST_TYPE:
565
+ return "SuspenseList";
566
+ case REACT_ACTIVITY_TYPE:
567
+ return "Activity";
568
+ }
569
+ if ("object" === typeof type)
570
+ switch ("number" === typeof type.tag && console.error(
571
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
572
+ ), type.$$typeof) {
573
+ case REACT_PORTAL_TYPE:
574
+ return "Portal";
575
+ case REACT_CONTEXT_TYPE:
576
+ return type.displayName || "Context";
577
+ case REACT_CONSUMER_TYPE:
578
+ return (type._context.displayName || "Context") + ".Consumer";
579
+ case REACT_FORWARD_REF_TYPE:
580
+ var innerType = type.render;
581
+ type = type.displayName;
582
+ type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
583
+ return type;
584
+ case REACT_MEMO_TYPE:
585
+ return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
586
+ case REACT_LAZY_TYPE:
587
+ innerType = type._payload;
588
+ type = type._init;
589
+ try {
590
+ return getComponentNameFromType(type(innerType));
591
+ } catch (x) {
592
+ }
593
+ }
594
+ return null;
595
+ }
596
+ function getTaskName(type) {
597
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
598
+ if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
599
+ return "<...>";
600
+ try {
601
+ var name = getComponentNameFromType(type);
602
+ return name ? "<" + name + ">" : "<...>";
603
+ } catch (x) {
604
+ return "<...>";
605
+ }
606
+ }
607
+ function getOwner() {
608
+ var dispatcher = ReactSharedInternals.A;
609
+ return null === dispatcher ? null : dispatcher.getOwner();
610
+ }
611
+ function UnknownOwner() {
612
+ return Error("react-stack-top-frame");
613
+ }
614
+ function hasValidKey(config2) {
615
+ if (hasOwnProperty.call(config2, "key")) {
616
+ var getter = Object.getOwnPropertyDescriptor(config2, "key").get;
617
+ if (getter && getter.isReactWarning) return false;
618
+ }
619
+ return void 0 !== config2.key;
620
+ }
621
+ function defineKeyPropWarningGetter(props, displayName) {
622
+ function warnAboutAccessingKey() {
623
+ specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
624
+ "%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)",
625
+ displayName
626
+ ));
627
+ }
628
+ warnAboutAccessingKey.isReactWarning = true;
629
+ Object.defineProperty(props, "key", {
630
+ get: warnAboutAccessingKey,
631
+ configurable: true
632
+ });
633
+ }
634
+ function elementRefGetterWithDeprecationWarning() {
635
+ var componentName = getComponentNameFromType(this.type);
636
+ didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
637
+ "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."
638
+ ));
639
+ componentName = this.props.ref;
640
+ return void 0 !== componentName ? componentName : null;
641
+ }
642
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
643
+ var refProp = props.ref;
644
+ type = {
645
+ $$typeof: REACT_ELEMENT_TYPE,
646
+ type,
647
+ key,
648
+ props,
649
+ _owner: owner
650
+ };
651
+ null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
652
+ enumerable: false,
653
+ get: elementRefGetterWithDeprecationWarning
654
+ }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
655
+ type._store = {};
656
+ Object.defineProperty(type._store, "validated", {
657
+ configurable: false,
658
+ enumerable: false,
659
+ writable: true,
660
+ value: 0
661
+ });
662
+ Object.defineProperty(type, "_debugInfo", {
663
+ configurable: false,
664
+ enumerable: false,
665
+ writable: true,
666
+ value: null
667
+ });
668
+ Object.defineProperty(type, "_debugStack", {
669
+ configurable: false,
670
+ enumerable: false,
671
+ writable: true,
672
+ value: debugStack
673
+ });
674
+ Object.defineProperty(type, "_debugTask", {
675
+ configurable: false,
676
+ enumerable: false,
677
+ writable: true,
678
+ value: debugTask
679
+ });
680
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
681
+ return type;
682
+ }
683
+ function cloneAndReplaceKey(oldElement, newKey) {
684
+ newKey = ReactElement(
685
+ oldElement.type,
686
+ newKey,
687
+ oldElement.props,
688
+ oldElement._owner,
689
+ oldElement._debugStack,
690
+ oldElement._debugTask
691
+ );
692
+ oldElement._store && (newKey._store.validated = oldElement._store.validated);
693
+ return newKey;
694
+ }
695
+ function validateChildKeys(node) {
696
+ isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
697
+ }
698
+ function isValidElement(object) {
699
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
700
+ }
701
+ function escape(key) {
702
+ var escaperLookup = { "=": "=0", ":": "=2" };
703
+ return "$" + key.replace(/[=:]/g, function(match) {
704
+ return escaperLookup[match];
705
+ });
706
+ }
707
+ function getElementKey(element, index) {
708
+ return "object" === typeof element && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
709
+ }
710
+ function resolveThenable(thenable) {
711
+ switch (thenable.status) {
712
+ case "fulfilled":
713
+ return thenable.value;
714
+ case "rejected":
715
+ throw thenable.reason;
716
+ default:
717
+ switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
718
+ function(fulfilledValue) {
719
+ "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
720
+ },
721
+ function(error) {
722
+ "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
723
+ }
724
+ )), thenable.status) {
725
+ case "fulfilled":
726
+ return thenable.value;
727
+ case "rejected":
728
+ throw thenable.reason;
729
+ }
730
+ }
731
+ throw thenable;
732
+ }
733
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
734
+ var type = typeof children;
735
+ if ("undefined" === type || "boolean" === type) children = null;
736
+ var invokeCallback = false;
737
+ if (null === children) invokeCallback = true;
738
+ else
739
+ switch (type) {
740
+ case "bigint":
741
+ case "string":
742
+ case "number":
743
+ invokeCallback = true;
744
+ break;
745
+ case "object":
746
+ switch (children.$$typeof) {
747
+ case REACT_ELEMENT_TYPE:
748
+ case REACT_PORTAL_TYPE:
749
+ invokeCallback = true;
750
+ break;
751
+ case REACT_LAZY_TYPE:
752
+ return invokeCallback = children._init, mapIntoArray(
753
+ invokeCallback(children._payload),
754
+ array,
755
+ escapedPrefix,
756
+ nameSoFar,
757
+ callback
758
+ );
759
+ }
760
+ }
761
+ if (invokeCallback) {
762
+ invokeCallback = children;
763
+ callback = callback(invokeCallback);
764
+ var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
765
+ isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
766
+ return c;
767
+ })) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(
768
+ callback,
769
+ escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(
770
+ userProvidedKeyEscapeRegex,
771
+ "$&/"
772
+ ) + "/") + childKey
773
+ ), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
774
+ return 1;
775
+ }
776
+ invokeCallback = 0;
777
+ childKey = "" === nameSoFar ? "." : nameSoFar + ":";
778
+ if (isArrayImpl(children))
779
+ for (var i = 0; i < children.length; i++)
780
+ nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
781
+ nameSoFar,
782
+ array,
783
+ escapedPrefix,
784
+ type,
785
+ callback
786
+ );
787
+ else if (i = getIteratorFn(children), "function" === typeof i)
788
+ for (i === children.entries && (didWarnAboutMaps || console.warn(
789
+ "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
790
+ ), didWarnAboutMaps = true), children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
791
+ nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
792
+ nameSoFar,
793
+ array,
794
+ escapedPrefix,
795
+ type,
796
+ callback
797
+ );
798
+ else if ("object" === type) {
799
+ if ("function" === typeof children.then)
800
+ return mapIntoArray(
801
+ resolveThenable(children),
802
+ array,
803
+ escapedPrefix,
804
+ nameSoFar,
805
+ callback
806
+ );
807
+ array = String(children);
808
+ throw Error(
809
+ "Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
810
+ );
811
+ }
812
+ return invokeCallback;
813
+ }
814
+ function mapChildren(children, func, context) {
815
+ if (null == children) return children;
816
+ var result = [], count = 0;
817
+ mapIntoArray(children, result, "", "", function(child) {
818
+ return func.call(context, child, count++);
819
+ });
820
+ return result;
821
+ }
822
+ function lazyInitializer(payload) {
823
+ if (-1 === payload._status) {
824
+ var ioInfo = payload._ioInfo;
825
+ null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
826
+ ioInfo = payload._result;
827
+ var thenable = ioInfo();
828
+ thenable.then(
829
+ function(moduleObject) {
830
+ if (0 === payload._status || -1 === payload._status) {
831
+ payload._status = 1;
832
+ payload._result = moduleObject;
833
+ var _ioInfo = payload._ioInfo;
834
+ null != _ioInfo && (_ioInfo.end = performance.now());
835
+ void 0 === thenable.status && (thenable.status = "fulfilled", thenable.value = moduleObject);
836
+ }
837
+ },
838
+ function(error) {
839
+ if (0 === payload._status || -1 === payload._status) {
840
+ payload._status = 2;
841
+ payload._result = error;
842
+ var _ioInfo2 = payload._ioInfo;
843
+ null != _ioInfo2 && (_ioInfo2.end = performance.now());
844
+ void 0 === thenable.status && (thenable.status = "rejected", thenable.reason = error);
845
+ }
846
+ }
847
+ );
848
+ ioInfo = payload._ioInfo;
849
+ if (null != ioInfo) {
850
+ ioInfo.value = thenable;
851
+ var displayName = thenable.displayName;
852
+ "string" === typeof displayName && (ioInfo.name = displayName);
853
+ }
854
+ -1 === payload._status && (payload._status = 0, payload._result = thenable);
855
+ }
856
+ if (1 === payload._status)
857
+ return ioInfo = payload._result, void 0 === ioInfo && console.error(
858
+ "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?",
859
+ ioInfo
860
+ ), "default" in ioInfo || console.error(
861
+ "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
862
+ ioInfo
863
+ ), ioInfo.default;
864
+ throw payload._result;
865
+ }
866
+ function resolveDispatcher() {
867
+ var dispatcher = ReactSharedInternals.H;
868
+ null === dispatcher && console.error(
869
+ "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."
870
+ );
871
+ return dispatcher;
872
+ }
873
+ function releaseAsyncTransition() {
874
+ ReactSharedInternals.asyncTransitions--;
875
+ }
876
+ function enqueueTask(task) {
877
+ if (null === enqueueTaskImpl)
878
+ try {
879
+ var requireString = ("require" + Math.random()).slice(0, 7);
880
+ enqueueTaskImpl = (module && module[requireString]).call(
881
+ module,
882
+ "timers"
883
+ ).setImmediate;
884
+ } catch (_err) {
885
+ enqueueTaskImpl = function(callback) {
886
+ false === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = true, "undefined" === typeof MessageChannel && console.error(
887
+ "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."
888
+ ));
889
+ var channel = new MessageChannel();
890
+ channel.port1.onmessage = callback;
891
+ channel.port2.postMessage(void 0);
892
+ };
893
+ }
894
+ return enqueueTaskImpl(task);
895
+ }
896
+ function aggregateErrors(errors) {
897
+ return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
898
+ }
899
+ function popActScope(prevActQueue, prevActScopeDepth) {
900
+ prevActScopeDepth !== actScopeDepth - 1 && console.error(
901
+ "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
902
+ );
903
+ actScopeDepth = prevActScopeDepth;
904
+ }
905
+ function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
906
+ var queue = ReactSharedInternals.actQueue;
907
+ if (null !== queue)
908
+ if (0 !== queue.length)
909
+ try {
910
+ flushActQueue(queue);
911
+ enqueueTask(function() {
912
+ return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
913
+ });
914
+ return;
915
+ } catch (error) {
916
+ ReactSharedInternals.thrownErrors.push(error);
917
+ }
918
+ else ReactSharedInternals.actQueue = null;
919
+ 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
920
+ }
921
+ function flushActQueue(queue) {
922
+ if (!isFlushing) {
923
+ isFlushing = true;
924
+ var i = 0;
925
+ try {
926
+ for (; i < queue.length; i++) {
927
+ var callback = queue[i];
928
+ do {
929
+ ReactSharedInternals.didUsePromise = false;
930
+ var continuation = callback(false);
931
+ if (null !== continuation) {
932
+ if (ReactSharedInternals.didUsePromise) {
933
+ queue[i] = callback;
934
+ queue.splice(0, i);
935
+ return;
936
+ }
937
+ callback = continuation;
938
+ } else break;
939
+ } while (1);
940
+ }
941
+ queue.length = 0;
942
+ } catch (error) {
943
+ queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
944
+ } finally {
945
+ isFlushing = false;
946
+ }
947
+ }
948
+ }
949
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
950
+ var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
951
+ isMounted: function() {
952
+ return false;
953
+ },
954
+ enqueueForceUpdate: function(publicInstance) {
955
+ warnNoop(publicInstance, "forceUpdate");
956
+ },
957
+ enqueueReplaceState: function(publicInstance) {
958
+ warnNoop(publicInstance, "replaceState");
959
+ },
960
+ enqueueSetState: function(publicInstance) {
961
+ warnNoop(publicInstance, "setState");
962
+ }
963
+ }, assign = Object.assign, emptyObject = {};
964
+ Object.freeze(emptyObject);
965
+ Component.prototype.isReactComponent = {};
966
+ Component.prototype.setState = function(partialState, callback) {
967
+ if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
968
+ throw Error(
969
+ "takes an object of state variables to update or a function which returns an object of state variables."
970
+ );
971
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
972
+ };
973
+ Component.prototype.forceUpdate = function(callback) {
974
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
975
+ };
976
+ var deprecatedAPIs = {
977
+ isMounted: [
978
+ "isMounted",
979
+ "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
980
+ ],
981
+ replaceState: [
982
+ "replaceState",
983
+ "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
984
+ ]
985
+ };
986
+ for (fnName in deprecatedAPIs)
987
+ deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
988
+ ComponentDummy.prototype = Component.prototype;
989
+ deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
990
+ deprecatedAPIs.constructor = PureComponent;
991
+ assign(deprecatedAPIs, Component.prototype);
992
+ deprecatedAPIs.isPureReactComponent = true;
993
+ var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = {
994
+ H: null,
995
+ A: null,
996
+ T: null,
997
+ S: null,
998
+ actQueue: null,
999
+ asyncTransitions: 0,
1000
+ isBatchingLegacy: false,
1001
+ didScheduleLegacyUpdate: false,
1002
+ didUsePromise: false,
1003
+ thrownErrors: [],
1004
+ getCurrentStack: null,
1005
+ recentlyCreatedOwnerStacks: 0
1006
+ }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
1007
+ return null;
1008
+ };
1009
+ deprecatedAPIs = {
1010
+ react_stack_bottom_frame: function(callStackForError) {
1011
+ return callStackForError();
1012
+ }
1013
+ };
1014
+ var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
1015
+ var didWarnAboutElementRef = {};
1016
+ var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
1017
+ deprecatedAPIs,
1018
+ UnknownOwner
1019
+ )();
1020
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
1021
+ var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
1022
+ if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
1023
+ var event = new window.ErrorEvent("error", {
1024
+ bubbles: true,
1025
+ cancelable: true,
1026
+ message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
1027
+ error
1028
+ });
1029
+ if (!window.dispatchEvent(event)) return;
1030
+ } else if ("object" === typeof process && "function" === typeof process.emit) {
1031
+ process.emit("uncaughtException", error);
1032
+ return;
1033
+ }
1034
+ console.error(error);
1035
+ }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function(callback) {
1036
+ queueMicrotask(function() {
1037
+ return queueMicrotask(callback);
1038
+ });
1039
+ } : enqueueTask;
1040
+ deprecatedAPIs = Object.freeze({
1041
+ __proto__: null,
1042
+ c: function(size) {
1043
+ return resolveDispatcher().useMemoCache(size);
1044
+ }
1045
+ });
1046
+ var fnName = {
1047
+ map: mapChildren,
1048
+ forEach: function(children, forEachFunc, forEachContext) {
1049
+ mapChildren(
1050
+ children,
1051
+ function() {
1052
+ forEachFunc.apply(this, arguments);
1053
+ },
1054
+ forEachContext
1055
+ );
1056
+ },
1057
+ count: function(children) {
1058
+ var n = 0;
1059
+ mapChildren(children, function() {
1060
+ n++;
1061
+ });
1062
+ return n;
1063
+ },
1064
+ toArray: function(children) {
1065
+ return mapChildren(children, function(child) {
1066
+ return child;
1067
+ }) || [];
1068
+ },
1069
+ only: function(children) {
1070
+ if (!isValidElement(children))
1071
+ throw Error(
1072
+ "React.Children.only expected to receive a single React element child."
1073
+ );
1074
+ return children;
1075
+ }
1076
+ };
1077
+ exports$1.Activity = REACT_ACTIVITY_TYPE;
1078
+ exports$1.Children = fnName;
1079
+ exports$1.Component = Component;
1080
+ exports$1.Fragment = REACT_FRAGMENT_TYPE;
1081
+ exports$1.Profiler = REACT_PROFILER_TYPE;
1082
+ exports$1.PureComponent = PureComponent;
1083
+ exports$1.StrictMode = REACT_STRICT_MODE_TYPE;
1084
+ exports$1.Suspense = REACT_SUSPENSE_TYPE;
1085
+ exports$1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
1086
+ exports$1.__COMPILER_RUNTIME = deprecatedAPIs;
1087
+ exports$1.act = function(callback) {
1088
+ var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
1089
+ actScopeDepth++;
1090
+ var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [], didAwaitActCall = false;
1091
+ try {
1092
+ var result = callback();
1093
+ } catch (error) {
1094
+ ReactSharedInternals.thrownErrors.push(error);
1095
+ }
1096
+ if (0 < ReactSharedInternals.thrownErrors.length)
1097
+ throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1098
+ if (null !== result && "object" === typeof result && "function" === typeof result.then) {
1099
+ var thenable = result;
1100
+ queueSeveralMicrotasks(function() {
1101
+ didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1102
+ "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 () => ...);"
1103
+ ));
1104
+ });
1105
+ return {
1106
+ then: function(resolve, reject) {
1107
+ didAwaitActCall = true;
1108
+ thenable.then(
1109
+ function(returnValue) {
1110
+ popActScope(prevActQueue, prevActScopeDepth);
1111
+ if (0 === prevActScopeDepth) {
1112
+ try {
1113
+ flushActQueue(queue), enqueueTask(function() {
1114
+ return recursivelyFlushAsyncActWork(
1115
+ returnValue,
1116
+ resolve,
1117
+ reject
1118
+ );
1119
+ });
1120
+ } catch (error$0) {
1121
+ ReactSharedInternals.thrownErrors.push(error$0);
1122
+ }
1123
+ if (0 < ReactSharedInternals.thrownErrors.length) {
1124
+ var _thrownError = aggregateErrors(
1125
+ ReactSharedInternals.thrownErrors
1126
+ );
1127
+ ReactSharedInternals.thrownErrors.length = 0;
1128
+ reject(_thrownError);
1129
+ }
1130
+ } else resolve(returnValue);
1131
+ },
1132
+ function(error) {
1133
+ popActScope(prevActQueue, prevActScopeDepth);
1134
+ 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(
1135
+ ReactSharedInternals.thrownErrors
1136
+ ), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
1137
+ }
1138
+ );
1139
+ }
1140
+ };
1141
+ }
1142
+ var returnValue$jscomp$0 = result;
1143
+ popActScope(prevActQueue, prevActScopeDepth);
1144
+ 0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function() {
1145
+ didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
1146
+ "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(() => ...)"
1147
+ ));
1148
+ }), ReactSharedInternals.actQueue = null);
1149
+ if (0 < ReactSharedInternals.thrownErrors.length)
1150
+ throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1151
+ return {
1152
+ then: function(resolve, reject) {
1153
+ didAwaitActCall = true;
1154
+ 0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
1155
+ return recursivelyFlushAsyncActWork(
1156
+ returnValue$jscomp$0,
1157
+ resolve,
1158
+ reject
1159
+ );
1160
+ })) : resolve(returnValue$jscomp$0);
1161
+ }
1162
+ };
1163
+ };
1164
+ exports$1.cache = function(fn) {
1165
+ return function() {
1166
+ return fn.apply(null, arguments);
1167
+ };
1168
+ };
1169
+ exports$1.cacheSignal = function() {
1170
+ return null;
1171
+ };
1172
+ exports$1.captureOwnerStack = function() {
1173
+ var getCurrentStack = ReactSharedInternals.getCurrentStack;
1174
+ return null === getCurrentStack ? null : getCurrentStack();
1175
+ };
1176
+ exports$1.cloneElement = function(element, config2, children) {
1177
+ if (null === element || void 0 === element)
1178
+ throw Error(
1179
+ "The argument must be a React element, but you passed " + element + "."
1180
+ );
1181
+ var props = assign({}, element.props), key = element.key, owner = element._owner;
1182
+ if (null != config2) {
1183
+ var JSCompiler_inline_result;
1184
+ a: {
1185
+ if (hasOwnProperty.call(config2, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
1186
+ config2,
1187
+ "ref"
1188
+ ).get) && JSCompiler_inline_result.isReactWarning) {
1189
+ JSCompiler_inline_result = false;
1190
+ break a;
1191
+ }
1192
+ JSCompiler_inline_result = void 0 !== config2.ref;
1193
+ }
1194
+ JSCompiler_inline_result && (owner = getOwner());
1195
+ hasValidKey(config2) && (checkKeyStringCoercion(config2.key), key = "" + config2.key);
1196
+ for (propName in config2)
1197
+ !hasOwnProperty.call(config2, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config2.ref || (props[propName] = config2[propName]);
1198
+ }
1199
+ var propName = arguments.length - 2;
1200
+ if (1 === propName) props.children = children;
1201
+ else if (1 < propName) {
1202
+ JSCompiler_inline_result = Array(propName);
1203
+ for (var i = 0; i < propName; i++)
1204
+ JSCompiler_inline_result[i] = arguments[i + 2];
1205
+ props.children = JSCompiler_inline_result;
1206
+ }
1207
+ props = ReactElement(
1208
+ element.type,
1209
+ key,
1210
+ props,
1211
+ owner,
1212
+ element._debugStack,
1213
+ element._debugTask
1214
+ );
1215
+ for (key = 2; key < arguments.length; key++)
1216
+ validateChildKeys(arguments[key]);
1217
+ return props;
1218
+ };
1219
+ exports$1.createContext = function(defaultValue) {
1220
+ defaultValue = {
1221
+ $$typeof: REACT_CONTEXT_TYPE,
1222
+ _currentValue: defaultValue,
1223
+ _currentValue2: defaultValue,
1224
+ _threadCount: 0,
1225
+ Provider: null,
1226
+ Consumer: null
1227
+ };
1228
+ defaultValue.Provider = defaultValue;
1229
+ defaultValue.Consumer = {
1230
+ $$typeof: REACT_CONSUMER_TYPE,
1231
+ _context: defaultValue
1232
+ };
1233
+ defaultValue._currentRenderer = null;
1234
+ defaultValue._currentRenderer2 = null;
1235
+ return defaultValue;
1236
+ };
1237
+ exports$1.createElement = function(type, config2, children) {
1238
+ for (var i = 2; i < arguments.length; i++)
1239
+ validateChildKeys(arguments[i]);
1240
+ i = {};
1241
+ var key = null;
1242
+ if (null != config2)
1243
+ for (propName in didWarnAboutOldJSXRuntime || !("__self" in config2) || "key" in config2 || (didWarnAboutOldJSXRuntime = true, console.warn(
1244
+ "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"
1245
+ )), hasValidKey(config2) && (checkKeyStringCoercion(config2.key), key = "" + config2.key), config2)
1246
+ hasOwnProperty.call(config2, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config2[propName]);
1247
+ var childrenLength = arguments.length - 2;
1248
+ if (1 === childrenLength) i.children = children;
1249
+ else if (1 < childrenLength) {
1250
+ for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++)
1251
+ childArray[_i] = arguments[_i + 2];
1252
+ Object.freeze && Object.freeze(childArray);
1253
+ i.children = childArray;
1254
+ }
1255
+ if (type && type.defaultProps)
1256
+ for (propName in childrenLength = type.defaultProps, childrenLength)
1257
+ void 0 === i[propName] && (i[propName] = childrenLength[propName]);
1258
+ key && defineKeyPropWarningGetter(
1259
+ i,
1260
+ "function" === typeof type ? type.displayName || type.name || "Unknown" : type
1261
+ );
1262
+ var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1263
+ return ReactElement(
1264
+ type,
1265
+ key,
1266
+ i,
1267
+ getOwner(),
1268
+ propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1269
+ propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1270
+ );
1271
+ };
1272
+ exports$1.createRef = function() {
1273
+ var refObject = { current: null };
1274
+ Object.seal(refObject);
1275
+ return refObject;
1276
+ };
1277
+ exports$1.forwardRef = function(render) {
1278
+ null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error(
1279
+ "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
1280
+ ) : "function" !== typeof render ? console.error(
1281
+ "forwardRef requires a render function but was given %s.",
1282
+ null === render ? "null" : typeof render
1283
+ ) : 0 !== render.length && 2 !== render.length && console.error(
1284
+ "forwardRef render functions accept exactly two parameters: props and ref. %s",
1285
+ 1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
1286
+ );
1287
+ null != render && null != render.defaultProps && console.error(
1288
+ "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
1289
+ );
1290
+ var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
1291
+ Object.defineProperty(elementType, "displayName", {
1292
+ enumerable: false,
1293
+ configurable: true,
1294
+ get: function() {
1295
+ return ownName;
1296
+ },
1297
+ set: function(name) {
1298
+ ownName = name;
1299
+ render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
1300
+ }
1301
+ });
1302
+ return elementType;
1303
+ };
1304
+ exports$1.isValidElement = isValidElement;
1305
+ exports$1.lazy = function(ctor) {
1306
+ ctor = { _status: -1, _result: ctor };
1307
+ var lazyType = {
1308
+ $$typeof: REACT_LAZY_TYPE,
1309
+ _payload: ctor,
1310
+ _init: lazyInitializer
1311
+ }, ioInfo = {
1312
+ name: "lazy",
1313
+ start: -1,
1314
+ end: -1,
1315
+ value: null,
1316
+ owner: null,
1317
+ debugStack: Error("react-stack-top-frame"),
1318
+ debugTask: console.createTask ? console.createTask("lazy()") : null
1319
+ };
1320
+ ctor._ioInfo = ioInfo;
1321
+ lazyType._debugInfo = [{ awaited: ioInfo }];
1322
+ return lazyType;
1323
+ };
1324
+ exports$1.memo = function(type, compare) {
1325
+ null == type && console.error(
1326
+ "memo: The first argument must be a component. Instead received: %s",
1327
+ null === type ? "null" : typeof type
1328
+ );
1329
+ compare = {
1330
+ $$typeof: REACT_MEMO_TYPE,
1331
+ type,
1332
+ compare: void 0 === compare ? null : compare
1333
+ };
1334
+ var ownName;
1335
+ Object.defineProperty(compare, "displayName", {
1336
+ enumerable: false,
1337
+ configurable: true,
1338
+ get: function() {
1339
+ return ownName;
1340
+ },
1341
+ set: function(name) {
1342
+ ownName = name;
1343
+ type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
1344
+ }
1345
+ });
1346
+ return compare;
1347
+ };
1348
+ exports$1.startTransition = function(scope) {
1349
+ var prevTransition = ReactSharedInternals.T, currentTransition = {};
1350
+ currentTransition._updatedFibers = /* @__PURE__ */ new Set();
1351
+ ReactSharedInternals.T = currentTransition;
1352
+ try {
1353
+ var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
1354
+ null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
1355
+ "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
1356
+ } catch (error) {
1357
+ reportGlobalError(error);
1358
+ } finally {
1359
+ null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn(
1360
+ "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."
1361
+ )), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error(
1362
+ "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."
1363
+ ), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
1364
+ }
1365
+ };
1366
+ exports$1.unstable_useCacheRefresh = function() {
1367
+ return resolveDispatcher().useCacheRefresh();
1368
+ };
1369
+ exports$1.use = function(usable) {
1370
+ return resolveDispatcher().use(usable);
1371
+ };
1372
+ exports$1.useActionState = function(action, initialState, permalink) {
1373
+ return resolveDispatcher().useActionState(
1374
+ action,
1375
+ initialState,
1376
+ permalink
1377
+ );
1378
+ };
1379
+ exports$1.useCallback = function(callback, deps) {
1380
+ return resolveDispatcher().useCallback(callback, deps);
1381
+ };
1382
+ exports$1.useContext = function(Context) {
1383
+ var dispatcher = resolveDispatcher();
1384
+ Context.$$typeof === REACT_CONSUMER_TYPE && console.error(
1385
+ "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
1386
+ );
1387
+ return dispatcher.useContext(Context);
1388
+ };
1389
+ exports$1.useDebugValue = function(value, formatterFn) {
1390
+ return resolveDispatcher().useDebugValue(value, formatterFn);
1391
+ };
1392
+ exports$1.useDeferredValue = function(value, initialValue) {
1393
+ return resolveDispatcher().useDeferredValue(value, initialValue);
1394
+ };
1395
+ exports$1.useEffect = function(create, deps) {
1396
+ null == create && console.warn(
1397
+ "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1398
+ );
1399
+ return resolveDispatcher().useEffect(create, deps);
1400
+ };
1401
+ exports$1.useEffectEvent = function(callback) {
1402
+ return resolveDispatcher().useEffectEvent(callback);
1403
+ };
1404
+ exports$1.useId = function() {
1405
+ return resolveDispatcher().useId();
1406
+ };
1407
+ exports$1.useImperativeHandle = function(ref, create, deps) {
1408
+ return resolveDispatcher().useImperativeHandle(ref, create, deps);
1409
+ };
1410
+ exports$1.useInsertionEffect = function(create, deps) {
1411
+ null == create && console.warn(
1412
+ "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1413
+ );
1414
+ return resolveDispatcher().useInsertionEffect(create, deps);
1415
+ };
1416
+ exports$1.useLayoutEffect = function(create, deps) {
1417
+ null == create && console.warn(
1418
+ "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1419
+ );
1420
+ return resolveDispatcher().useLayoutEffect(create, deps);
1421
+ };
1422
+ exports$1.useMemo = function(create, deps) {
1423
+ return resolveDispatcher().useMemo(create, deps);
1424
+ };
1425
+ exports$1.useOptimistic = function(passthrough, reducer) {
1426
+ return resolveDispatcher().useOptimistic(passthrough, reducer);
1427
+ };
1428
+ exports$1.useReducer = function(reducer, initialArg, init) {
1429
+ return resolveDispatcher().useReducer(reducer, initialArg, init);
1430
+ };
1431
+ exports$1.useRef = function(initialValue) {
1432
+ return resolveDispatcher().useRef(initialValue);
1433
+ };
1434
+ exports$1.useState = function(initialState) {
1435
+ return resolveDispatcher().useState(initialState);
1436
+ };
1437
+ exports$1.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
1438
+ return resolveDispatcher().useSyncExternalStore(
1439
+ subscribe,
1440
+ getSnapshot,
1441
+ getServerSnapshot
1442
+ );
1443
+ };
1444
+ exports$1.useTransition = function() {
1445
+ return resolveDispatcher().useTransition();
1446
+ };
1447
+ exports$1.version = "19.2.3";
1448
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1449
+ })();
1450
+ }
1451
+ });
1452
+
1453
+ // ../../node_modules/react/index.js
1454
+ var require_react = __commonJS({
1455
+ "../../node_modules/react/index.js"(exports$1, module) {
1456
+ if (process.env.NODE_ENV === "production") {
1457
+ module.exports = require_react_production();
1458
+ } else {
1459
+ module.exports = require_react_development();
1460
+ }
1461
+ }
1462
+ });
12
1463
 
13
1464
  // src/client/types.ts
14
1465
  var TOKEN_MINTS = {
@@ -119,6 +1570,136 @@ function createX402AuthorizationHeader(signature, paymentRequiredHeader) {
119
1570
  const token = http.encodePaymentSignatureHeader(payload);
120
1571
  return `x402 ${token}`;
121
1572
  }
1573
+ async function sendSolanaPayment({
1574
+ connection,
1575
+ wallet,
1576
+ recipientAddress,
1577
+ amount,
1578
+ // memo, // TODO: Add memo support to transaction
1579
+ commitment = "confirmed"
1580
+ }) {
1581
+ if (!wallet.publicKey) {
1582
+ throw new Error("Wallet not connected");
1583
+ }
1584
+ if (amount <= 0n) {
1585
+ throw new Error("Amount must be greater than 0");
1586
+ }
1587
+ try {
1588
+ const recipientPubkey = new web3_js.PublicKey(recipientAddress);
1589
+ const transaction = new web3_js.Transaction().add(
1590
+ web3_js.SystemProgram.transfer({
1591
+ fromPubkey: wallet.publicKey,
1592
+ toPubkey: recipientPubkey,
1593
+ lamports: amount
1594
+ })
1595
+ );
1596
+ const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash(commitment);
1597
+ transaction.recentBlockhash = blockhash;
1598
+ transaction.feePayer = wallet.publicKey;
1599
+ const signature = await wallet.sendTransaction(transaction, connection);
1600
+ await connection.confirmTransaction({
1601
+ signature,
1602
+ blockhash,
1603
+ lastValidBlockHeight
1604
+ }, commitment);
1605
+ return {
1606
+ signature,
1607
+ amountSol: Number(amount) / web3_js.LAMPORTS_PER_SOL
1608
+ };
1609
+ } catch (error) {
1610
+ console.error("Payment failed:", error);
1611
+ throw new Error(error.message || "Payment failed");
1612
+ }
1613
+ }
1614
+
1615
+ // src/client/react.ts
1616
+ var import_react = __toESM(require_react());
1617
+ function usePaywallResource({
1618
+ url,
1619
+ connection,
1620
+ wallet
1621
+ }) {
1622
+ const [data, setData] = (0, import_react.useState)(null);
1623
+ const [isLocked, setIsLocked] = (0, import_react.useState)(true);
1624
+ const [isLoading, setIsLoading] = (0, import_react.useState)(true);
1625
+ const [error, setError] = (0, import_react.useState)(null);
1626
+ const [paymentHeader, setPaymentHeader] = (0, import_react.useState)(null);
1627
+ const [price, setPrice] = (0, import_react.useState)();
1628
+ const [recipient, setRecipient] = (0, import_react.useState)();
1629
+ const fetchData = (0, import_react.useCallback)(async (authHeader) => {
1630
+ setIsLoading(true);
1631
+ setError(null);
1632
+ try {
1633
+ const headers = {
1634
+ "Content-Type": "application/json"
1635
+ };
1636
+ if (authHeader) {
1637
+ headers["Authorization"] = authHeader;
1638
+ }
1639
+ const res = await fetch(url, { headers });
1640
+ if (res.status === 402) {
1641
+ const wwwAuth = res.headers.get("WWW-Authenticate");
1642
+ if (wwwAuth) {
1643
+ setPaymentHeader(wwwAuth);
1644
+ try {
1645
+ const match = wwwAuth.match(/amount="([^"]+)",\s*payTo="([^"]+)"/);
1646
+ if (match) {
1647
+ setPrice(BigInt(match[1]));
1648
+ setRecipient(match[2]);
1649
+ }
1650
+ } catch (e) {
1651
+ console.warn("Failed to parse 402 details from header", e);
1652
+ }
1653
+ }
1654
+ setIsLocked(true);
1655
+ setData(null);
1656
+ } else if (res.ok) {
1657
+ const json = await res.json();
1658
+ setData(json);
1659
+ setIsLocked(false);
1660
+ } else {
1661
+ throw new Error(`Request failed with status ${res.status}`);
1662
+ }
1663
+ } catch (err) {
1664
+ setError(err.message || "Failed to fetch resource");
1665
+ } finally {
1666
+ setIsLoading(false);
1667
+ }
1668
+ }, [url]);
1669
+ (0, import_react.useEffect)(() => {
1670
+ fetchData();
1671
+ }, [fetchData]);
1672
+ const unlock = (0, import_react.useCallback)(async () => {
1673
+ if (!paymentHeader || !price || !recipient) {
1674
+ setError("Missing payment requirements");
1675
+ return;
1676
+ }
1677
+ setIsLoading(true);
1678
+ try {
1679
+ const { signature } = await sendSolanaPayment({
1680
+ connection,
1681
+ wallet,
1682
+ recipientAddress: recipient,
1683
+ amount: price
1684
+ });
1685
+ const authHeader = createX402AuthorizationHeader(signature, paymentHeader);
1686
+ await fetchData(authHeader);
1687
+ } catch (err) {
1688
+ console.error("Unlock failed", err);
1689
+ setError(err.message || "Payment/Unlock failed");
1690
+ setIsLoading(false);
1691
+ }
1692
+ }, [connection, wallet, paymentHeader, price, recipient, fetchData]);
1693
+ return {
1694
+ data,
1695
+ isLocked,
1696
+ isLoading,
1697
+ price,
1698
+ recipient,
1699
+ error,
1700
+ unlock
1701
+ };
1702
+ }
122
1703
  var DEFAULT_COMPUTE_UNITS = 2e5;
123
1704
  var DEFAULT_MICRO_LAMPORTS = 1e3;
124
1705
  function createPriorityFeeInstructions(config2 = {}) {
@@ -166,8 +1747,6 @@ async function buildVersionedTransaction(config2) {
166
1747
  lastValidBlockHeight
167
1748
  };
168
1749
  }
169
-
170
- // src/agent/agentPayment.ts
171
1750
  var WALLET_REGEX = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
172
1751
  function isValidWalletAddress(address) {
173
1752
  if (!address || typeof address !== "string") return false;
@@ -268,15 +1847,19 @@ async function hasAgentSufficientBalance(connection, agentKeypair, requiredLampo
268
1847
  };
269
1848
  }
270
1849
  function keypairFromBase58(base58Secret) {
271
- const bytes = Buffer.from(base58Secret, "base64");
272
- if (bytes.length !== 64) {
1850
+ try {
1851
+ const bytes = bs58__default.default.decode(base58Secret);
1852
+ if (bytes.length !== 64) {
1853
+ throw new Error("Invalid secret key length. Expected 64 bytes.");
1854
+ }
1855
+ return web3_js.Keypair.fromSecretKey(bytes);
1856
+ } catch (error) {
273
1857
  const parts = base58Secret.split(",").map((n) => parseInt(n.trim(), 10));
274
1858
  if (parts.length === 64) {
275
1859
  return web3_js.Keypair.fromSecretKey(Uint8Array.from(parts));
276
1860
  }
277
1861
  throw new Error("Invalid secret key format. Expected base58 string or comma-separated bytes.");
278
1862
  }
279
- return web3_js.Keypair.fromSecretKey(bytes);
280
1863
  }
281
1864
  function generateAgentKeypair() {
282
1865
  const keypair = web3_js.Keypair.generate();
@@ -593,6 +2176,30 @@ function clearPriceCache() {
593
2176
  function getProviders() {
594
2177
  return PROVIDERS.map((p) => ({ name: p.name, url: p.url }));
595
2178
  }
2179
+ /*! Bundled license information:
2180
+
2181
+ react/cjs/react.production.js:
2182
+ (**
2183
+ * @license React
2184
+ * react.production.js
2185
+ *
2186
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
2187
+ *
2188
+ * This source code is licensed under the MIT license found in the
2189
+ * LICENSE file in the root directory of this source tree.
2190
+ *)
2191
+
2192
+ react/cjs/react.development.js:
2193
+ (**
2194
+ * @license React
2195
+ * react.development.js
2196
+ *
2197
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
2198
+ *
2199
+ * This source code is licensed under the MIT license found in the
2200
+ * LICENSE file in the root directory of this source tree.
2201
+ *)
2202
+ */
596
2203
 
597
2204
  exports.addCredits = addCredits;
598
2205
  exports.buildSolanaPayUrl = buildSolanaPayUrl;
@@ -614,8 +2221,10 @@ exports.hasAgentSufficientBalance = hasAgentSufficientBalance;
614
2221
  exports.keypairFromBase58 = keypairFromBase58;
615
2222
  exports.lamportsToSol = lamportsToSol;
616
2223
  exports.lamportsToUsd = lamportsToUsd;
2224
+ exports.sendSolanaPayment = sendSolanaPayment;
617
2225
  exports.usdToLamports = usdToLamports;
618
2226
  exports.useCredit = useCredit;
2227
+ exports.usePaywallResource = usePaywallResource;
619
2228
  exports.validateCreditSession = validateCreditSession;
620
2229
  Object.keys(core).forEach(function (k) {
621
2230
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {