@quantabit/invite-sdk 1.0.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.
@@ -0,0 +1,4415 @@
1
+ function _arrayLikeToArray(r, a) {
2
+ (null == a || a > r.length) && (a = r.length);
3
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
4
+ return n;
5
+ }
6
+ function _arrayWithHoles(r) {
7
+ if (Array.isArray(r)) return r;
8
+ }
9
+ function _arrayWithoutHoles(r) {
10
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
11
+ }
12
+ function _assertThisInitialized(e) {
13
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14
+ return e;
15
+ }
16
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
17
+ try {
18
+ var i = n[a](c),
19
+ u = i.value;
20
+ } catch (n) {
21
+ return void e(n);
22
+ }
23
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
24
+ }
25
+ function _asyncToGenerator(n) {
26
+ return function () {
27
+ var t = this,
28
+ e = arguments;
29
+ return new Promise(function (r, o) {
30
+ var a = n.apply(t, e);
31
+ function _next(n) {
32
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
33
+ }
34
+ function _throw(n) {
35
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
36
+ }
37
+ _next(void 0);
38
+ });
39
+ };
40
+ }
41
+ function _callSuper(t, o, e) {
42
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
43
+ }
44
+ function _classCallCheck(a, n) {
45
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
46
+ }
47
+ function _defineProperties(e, r) {
48
+ for (var t = 0; t < r.length; t++) {
49
+ var o = r[t];
50
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
51
+ }
52
+ }
53
+ function _createClass(e, r, t) {
54
+ return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
55
+ writable: false
56
+ }), e;
57
+ }
58
+ function _createForOfIteratorHelper(r, e) {
59
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
60
+ if (!t) {
61
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
62
+ t && (r = t);
63
+ var n = 0,
64
+ F = function () {};
65
+ return {
66
+ s: F,
67
+ n: function () {
68
+ return n >= r.length ? {
69
+ done: true
70
+ } : {
71
+ done: false,
72
+ value: r[n++]
73
+ };
74
+ },
75
+ e: function (r) {
76
+ throw r;
77
+ },
78
+ f: F
79
+ };
80
+ }
81
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
82
+ }
83
+ var o,
84
+ a = true,
85
+ u = false;
86
+ return {
87
+ s: function () {
88
+ t = t.call(r);
89
+ },
90
+ n: function () {
91
+ var r = t.next();
92
+ return a = r.done, r;
93
+ },
94
+ e: function (r) {
95
+ u = true, o = r;
96
+ },
97
+ f: function () {
98
+ try {
99
+ a || null == t.return || t.return();
100
+ } finally {
101
+ if (u) throw o;
102
+ }
103
+ }
104
+ };
105
+ }
106
+ function _defineProperty(e, r, t) {
107
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
108
+ value: t,
109
+ enumerable: true,
110
+ configurable: true,
111
+ writable: true
112
+ }) : e[r] = t, e;
113
+ }
114
+ function _getPrototypeOf(t) {
115
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
116
+ return t.__proto__ || Object.getPrototypeOf(t);
117
+ }, _getPrototypeOf(t);
118
+ }
119
+ function _inherits(t, e) {
120
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
121
+ t.prototype = Object.create(e && e.prototype, {
122
+ constructor: {
123
+ value: t,
124
+ writable: true,
125
+ configurable: true
126
+ }
127
+ }), Object.defineProperty(t, "prototype", {
128
+ writable: false
129
+ }), e && _setPrototypeOf(t, e);
130
+ }
131
+ function _isNativeReflectConstruct() {
132
+ try {
133
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
134
+ } catch (t) {}
135
+ return (_isNativeReflectConstruct = function () {
136
+ return !!t;
137
+ })();
138
+ }
139
+ function _iterableToArray(r) {
140
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
141
+ }
142
+ function _iterableToArrayLimit(r, l) {
143
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
144
+ if (null != t) {
145
+ var e,
146
+ n,
147
+ i,
148
+ u,
149
+ a = [],
150
+ f = true,
151
+ o = false;
152
+ try {
153
+ if (i = (t = t.call(r)).next, 0 === l) {
154
+ if (Object(t) !== t) return;
155
+ f = !1;
156
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
157
+ } catch (r) {
158
+ o = true, n = r;
159
+ } finally {
160
+ try {
161
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
162
+ } finally {
163
+ if (o) throw n;
164
+ }
165
+ }
166
+ return a;
167
+ }
168
+ }
169
+ function _nonIterableRest() {
170
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
171
+ }
172
+ function _nonIterableSpread() {
173
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
174
+ }
175
+ function ownKeys(e, r) {
176
+ var t = Object.keys(e);
177
+ if (Object.getOwnPropertySymbols) {
178
+ var o = Object.getOwnPropertySymbols(e);
179
+ r && (o = o.filter(function (r) {
180
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
181
+ })), t.push.apply(t, o);
182
+ }
183
+ return t;
184
+ }
185
+ function _objectSpread2(e) {
186
+ for (var r = 1; r < arguments.length; r++) {
187
+ var t = null != arguments[r] ? arguments[r] : {};
188
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
189
+ _defineProperty(e, r, t[r]);
190
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
191
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
192
+ });
193
+ }
194
+ return e;
195
+ }
196
+ function _possibleConstructorReturn(t, e) {
197
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
198
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
199
+ return _assertThisInitialized(t);
200
+ }
201
+ function _regenerator() {
202
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
203
+ var e,
204
+ t,
205
+ r = "function" == typeof Symbol ? Symbol : {},
206
+ n = r.iterator || "@@iterator",
207
+ o = r.toStringTag || "@@toStringTag";
208
+ function i(r, n, o, i) {
209
+ var c = n && n.prototype instanceof Generator ? n : Generator,
210
+ u = Object.create(c.prototype);
211
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
212
+ var i,
213
+ c,
214
+ u,
215
+ f = 0,
216
+ p = o || [],
217
+ y = false,
218
+ G = {
219
+ p: 0,
220
+ n: 0,
221
+ v: e,
222
+ a: d,
223
+ f: d.bind(e, 4),
224
+ d: function (t, r) {
225
+ return i = t, c = 0, u = e, G.n = r, a;
226
+ }
227
+ };
228
+ function d(r, n) {
229
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
230
+ var o,
231
+ i = p[t],
232
+ d = G.p,
233
+ l = i[2];
234
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
235
+ }
236
+ if (o || r > 1) return a;
237
+ throw y = true, n;
238
+ }
239
+ return function (o, p, l) {
240
+ if (f > 1) throw TypeError("Generator is already running");
241
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
242
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
243
+ try {
244
+ if (f = 2, i) {
245
+ if (c || (o = "next"), t = i[o]) {
246
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
247
+ if (!t.done) return t;
248
+ u = t.value, c < 2 && (c = 0);
249
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
250
+ i = e;
251
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
252
+ } catch (t) {
253
+ i = e, c = 1, u = t;
254
+ } finally {
255
+ f = 1;
256
+ }
257
+ }
258
+ return {
259
+ value: t,
260
+ done: y
261
+ };
262
+ };
263
+ }(r, o, i), true), u;
264
+ }
265
+ var a = {};
266
+ function Generator() {}
267
+ function GeneratorFunction() {}
268
+ function GeneratorFunctionPrototype() {}
269
+ t = Object.getPrototypeOf;
270
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
271
+ return this;
272
+ }), t),
273
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
274
+ function f(e) {
275
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
276
+ }
277
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
278
+ return this;
279
+ }), _regeneratorDefine(u, "toString", function () {
280
+ return "[object Generator]";
281
+ }), (_regenerator = function () {
282
+ return {
283
+ w: i,
284
+ m: f
285
+ };
286
+ })();
287
+ }
288
+ function _regeneratorDefine(e, r, n, t) {
289
+ var i = Object.defineProperty;
290
+ try {
291
+ i({}, "", {});
292
+ } catch (e) {
293
+ i = 0;
294
+ }
295
+ _regeneratorDefine = function (e, r, n, t) {
296
+ function o(r, n) {
297
+ _regeneratorDefine(e, r, function (e) {
298
+ return this._invoke(r, n, e);
299
+ });
300
+ }
301
+ r ? i ? i(e, r, {
302
+ value: n,
303
+ enumerable: !t,
304
+ configurable: !t,
305
+ writable: !t
306
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
307
+ }, _regeneratorDefine(e, r, n, t);
308
+ }
309
+ function _setPrototypeOf(t, e) {
310
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
311
+ return t.__proto__ = e, t;
312
+ }, _setPrototypeOf(t, e);
313
+ }
314
+ function _slicedToArray(r, e) {
315
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
316
+ }
317
+ function _toConsumableArray(r) {
318
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
319
+ }
320
+ function _toPrimitive(t, r) {
321
+ if ("object" != typeof t || !t) return t;
322
+ var e = t[Symbol.toPrimitive];
323
+ if (void 0 !== e) {
324
+ var i = e.call(t, r);
325
+ if ("object" != typeof i) return i;
326
+ throw new TypeError("@@toPrimitive must return a primitive value.");
327
+ }
328
+ return (String )(t);
329
+ }
330
+ function _toPropertyKey(t) {
331
+ var i = _toPrimitive(t, "string");
332
+ return "symbol" == typeof i ? i : i + "";
333
+ }
334
+ function _typeof(o) {
335
+ "@babel/helpers - typeof";
336
+
337
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
338
+ return typeof o;
339
+ } : function (o) {
340
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
341
+ }, _typeof(o);
342
+ }
343
+ function _unsupportedIterableToArray(r, a) {
344
+ if (r) {
345
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
346
+ var t = {}.toString.call(r).slice(8, -1);
347
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
348
+ }
349
+ }
350
+
351
+ function getDefaultExportFromCjs (x) {
352
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
353
+ }
354
+
355
+ var react = {exports: {}};
356
+
357
+ var react_production = {};
358
+
359
+ var hasRequiredReact_production;
360
+ function requireReact_production() {
361
+ if (hasRequiredReact_production) return react_production;
362
+ hasRequiredReact_production = 1;
363
+ var REACT_ELEMENT_TYPE = Symbol["for"]("react.transitional.element"),
364
+ REACT_PORTAL_TYPE = Symbol["for"]("react.portal"),
365
+ REACT_FRAGMENT_TYPE = Symbol["for"]("react.fragment"),
366
+ REACT_STRICT_MODE_TYPE = Symbol["for"]("react.strict_mode"),
367
+ REACT_PROFILER_TYPE = Symbol["for"]("react.profiler"),
368
+ REACT_CONSUMER_TYPE = Symbol["for"]("react.consumer"),
369
+ REACT_CONTEXT_TYPE = Symbol["for"]("react.context"),
370
+ REACT_FORWARD_REF_TYPE = Symbol["for"]("react.forward_ref"),
371
+ REACT_SUSPENSE_TYPE = Symbol["for"]("react.suspense"),
372
+ REACT_MEMO_TYPE = Symbol["for"]("react.memo"),
373
+ REACT_LAZY_TYPE = Symbol["for"]("react.lazy"),
374
+ REACT_ACTIVITY_TYPE = Symbol["for"]("react.activity"),
375
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
376
+ function getIteratorFn(maybeIterable) {
377
+ if (null === maybeIterable || "object" !== _typeof(maybeIterable)) return null;
378
+ maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
379
+ return "function" === typeof maybeIterable ? maybeIterable : null;
380
+ }
381
+ var ReactNoopUpdateQueue = {
382
+ isMounted: function isMounted() {
383
+ return false;
384
+ },
385
+ enqueueForceUpdate: function enqueueForceUpdate() {},
386
+ enqueueReplaceState: function enqueueReplaceState() {},
387
+ enqueueSetState: function enqueueSetState() {}
388
+ },
389
+ assign = Object.assign,
390
+ emptyObject = {};
391
+ function Component(props, context, updater) {
392
+ this.props = props;
393
+ this.context = context;
394
+ this.refs = emptyObject;
395
+ this.updater = updater || ReactNoopUpdateQueue;
396
+ }
397
+ Component.prototype.isReactComponent = {};
398
+ Component.prototype.setState = function (partialState, callback) {
399
+ if ("object" !== _typeof(partialState) && "function" !== typeof partialState && null != partialState) throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
400
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
401
+ };
402
+ Component.prototype.forceUpdate = function (callback) {
403
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
404
+ };
405
+ function ComponentDummy() {}
406
+ ComponentDummy.prototype = Component.prototype;
407
+ function PureComponent(props, context, updater) {
408
+ this.props = props;
409
+ this.context = context;
410
+ this.refs = emptyObject;
411
+ this.updater = updater || ReactNoopUpdateQueue;
412
+ }
413
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
414
+ pureComponentPrototype.constructor = PureComponent;
415
+ assign(pureComponentPrototype, Component.prototype);
416
+ pureComponentPrototype.isPureReactComponent = true;
417
+ var isArrayImpl = Array.isArray;
418
+ function noop() {}
419
+ var ReactSharedInternals = {
420
+ H: null,
421
+ A: null,
422
+ T: null,
423
+ S: null
424
+ },
425
+ hasOwnProperty = Object.prototype.hasOwnProperty;
426
+ function ReactElement(type, key, props) {
427
+ var refProp = props.ref;
428
+ return {
429
+ $$typeof: REACT_ELEMENT_TYPE,
430
+ type: type,
431
+ key: key,
432
+ ref: void 0 !== refProp ? refProp : null,
433
+ props: props
434
+ };
435
+ }
436
+ function cloneAndReplaceKey(oldElement, newKey) {
437
+ return ReactElement(oldElement.type, newKey, oldElement.props);
438
+ }
439
+ function isValidElement(object) {
440
+ return "object" === _typeof(object) && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
441
+ }
442
+ function escape(key) {
443
+ var escaperLookup = {
444
+ "=": "=0",
445
+ ":": "=2"
446
+ };
447
+ return "$" + key.replace(/[=:]/g, function (match) {
448
+ return escaperLookup[match];
449
+ });
450
+ }
451
+ var userProvidedKeyEscapeRegex = /\/+/g;
452
+ function getElementKey(element, index) {
453
+ return "object" === _typeof(element) && null !== element && null != element.key ? escape("" + element.key) : index.toString(36);
454
+ }
455
+ function resolveThenable(thenable) {
456
+ switch (thenable.status) {
457
+ case "fulfilled":
458
+ return thenable.value;
459
+ case "rejected":
460
+ throw thenable.reason;
461
+ default:
462
+ switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(function (fulfilledValue) {
463
+ "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
464
+ }, function (error) {
465
+ "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
466
+ })), thenable.status) {
467
+ case "fulfilled":
468
+ return thenable.value;
469
+ case "rejected":
470
+ throw thenable.reason;
471
+ }
472
+ }
473
+ throw thenable;
474
+ }
475
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
476
+ var type = _typeof(children);
477
+ if ("undefined" === type || "boolean" === type) children = null;
478
+ var invokeCallback = false;
479
+ if (null === children) invokeCallback = true;else switch (type) {
480
+ case "bigint":
481
+ case "string":
482
+ case "number":
483
+ invokeCallback = true;
484
+ break;
485
+ case "object":
486
+ switch (children.$$typeof) {
487
+ case REACT_ELEMENT_TYPE:
488
+ case REACT_PORTAL_TYPE:
489
+ invokeCallback = true;
490
+ break;
491
+ case REACT_LAZY_TYPE:
492
+ return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
493
+ }
494
+ }
495
+ if (invokeCallback) 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) {
496
+ return c;
497
+ })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(callback, escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + invokeCallback)), array.push(callback)), 1;
498
+ invokeCallback = 0;
499
+ var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
500
+ if (isArrayImpl(children)) for (var i = 0; i < children.length; i++) nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);else if (i = getIteratorFn(children), "function" === typeof i) for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done;) nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);else if ("object" === type) {
501
+ if ("function" === typeof children.then) return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
502
+ array = String(children);
503
+ throw Error("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.");
504
+ }
505
+ return invokeCallback;
506
+ }
507
+ function mapChildren(children, func, context) {
508
+ if (null == children) return children;
509
+ var result = [],
510
+ count = 0;
511
+ mapIntoArray(children, result, "", "", function (child) {
512
+ return func.call(context, child, count++);
513
+ });
514
+ return result;
515
+ }
516
+ function lazyInitializer(payload) {
517
+ if (-1 === payload._status) {
518
+ var ctor = payload._result;
519
+ ctor = ctor();
520
+ ctor.then(function (moduleObject) {
521
+ if (0 === payload._status || -1 === payload._status) payload._status = 1, payload._result = moduleObject;
522
+ }, function (error) {
523
+ if (0 === payload._status || -1 === payload._status) payload._status = 2, payload._result = error;
524
+ });
525
+ -1 === payload._status && (payload._status = 0, payload._result = ctor);
526
+ }
527
+ if (1 === payload._status) return payload._result["default"];
528
+ throw payload._result;
529
+ }
530
+ var reportGlobalError = "function" === typeof reportError ? reportError : function (error) {
531
+ if ("object" === (typeof window === "undefined" ? "undefined" : _typeof(window)) && "function" === typeof window.ErrorEvent) {
532
+ var event = new window.ErrorEvent("error", {
533
+ bubbles: true,
534
+ cancelable: true,
535
+ message: "object" === _typeof(error) && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
536
+ error: error
537
+ });
538
+ if (!window.dispatchEvent(event)) return;
539
+ } else if ("object" === (typeof process === "undefined" ? "undefined" : _typeof(process)) && "function" === typeof process.emit) {
540
+ process.emit("uncaughtException", error);
541
+ return;
542
+ }
543
+ console.error(error);
544
+ },
545
+ Children = {
546
+ map: mapChildren,
547
+ forEach: function forEach(children, forEachFunc, forEachContext) {
548
+ mapChildren(children, function () {
549
+ forEachFunc.apply(this, arguments);
550
+ }, forEachContext);
551
+ },
552
+ count: function count(children) {
553
+ var n = 0;
554
+ mapChildren(children, function () {
555
+ n++;
556
+ });
557
+ return n;
558
+ },
559
+ toArray: function toArray(children) {
560
+ return mapChildren(children, function (child) {
561
+ return child;
562
+ }) || [];
563
+ },
564
+ only: function only(children) {
565
+ if (!isValidElement(children)) throw Error("React.Children.only expected to receive a single React element child.");
566
+ return children;
567
+ }
568
+ };
569
+ react_production.Activity = REACT_ACTIVITY_TYPE;
570
+ react_production.Children = Children;
571
+ react_production.Component = Component;
572
+ react_production.Fragment = REACT_FRAGMENT_TYPE;
573
+ react_production.Profiler = REACT_PROFILER_TYPE;
574
+ react_production.PureComponent = PureComponent;
575
+ react_production.StrictMode = REACT_STRICT_MODE_TYPE;
576
+ react_production.Suspense = REACT_SUSPENSE_TYPE;
577
+ react_production.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
578
+ react_production.__COMPILER_RUNTIME = {
579
+ __proto__: null,
580
+ c: function c(size) {
581
+ return ReactSharedInternals.H.useMemoCache(size);
582
+ }
583
+ };
584
+ react_production.cache = function (fn) {
585
+ return function () {
586
+ return fn.apply(null, arguments);
587
+ };
588
+ };
589
+ react_production.cacheSignal = function () {
590
+ return null;
591
+ };
592
+ react_production.cloneElement = function (element, config, children) {
593
+ if (null === element || void 0 === element) throw Error("The argument must be a React element, but you passed " + element + ".");
594
+ var props = assign({}, element.props),
595
+ key = element.key;
596
+ if (null != config) for (propName in void 0 !== config.key && (key = "" + config.key), config) !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
597
+ var propName = arguments.length - 2;
598
+ if (1 === propName) props.children = children;else if (1 < propName) {
599
+ for (var childArray = Array(propName), i = 0; i < propName; i++) childArray[i] = arguments[i + 2];
600
+ props.children = childArray;
601
+ }
602
+ return ReactElement(element.type, key, props);
603
+ };
604
+ react_production.createContext = function (defaultValue) {
605
+ defaultValue = {
606
+ $$typeof: REACT_CONTEXT_TYPE,
607
+ _currentValue: defaultValue,
608
+ _currentValue2: defaultValue,
609
+ _threadCount: 0,
610
+ Provider: null,
611
+ Consumer: null
612
+ };
613
+ defaultValue.Provider = defaultValue;
614
+ defaultValue.Consumer = {
615
+ $$typeof: REACT_CONSUMER_TYPE,
616
+ _context: defaultValue
617
+ };
618
+ return defaultValue;
619
+ };
620
+ react_production.createElement = function (type, config, children) {
621
+ var propName,
622
+ props = {},
623
+ key = null;
624
+ if (null != config) for (propName in void 0 !== config.key && (key = "" + config.key), config) hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
625
+ var childrenLength = arguments.length - 2;
626
+ if (1 === childrenLength) props.children = children;else if (1 < childrenLength) {
627
+ for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 2];
628
+ props.children = childArray;
629
+ }
630
+ if (type && type.defaultProps) for (propName in childrenLength = type.defaultProps, childrenLength) void 0 === props[propName] && (props[propName] = childrenLength[propName]);
631
+ return ReactElement(type, key, props);
632
+ };
633
+ react_production.createRef = function () {
634
+ return {
635
+ current: null
636
+ };
637
+ };
638
+ react_production.forwardRef = function (render) {
639
+ return {
640
+ $$typeof: REACT_FORWARD_REF_TYPE,
641
+ render: render
642
+ };
643
+ };
644
+ react_production.isValidElement = isValidElement;
645
+ react_production.lazy = function (ctor) {
646
+ return {
647
+ $$typeof: REACT_LAZY_TYPE,
648
+ _payload: {
649
+ _status: -1,
650
+ _result: ctor
651
+ },
652
+ _init: lazyInitializer
653
+ };
654
+ };
655
+ react_production.memo = function (type, compare) {
656
+ return {
657
+ $$typeof: REACT_MEMO_TYPE,
658
+ type: type,
659
+ compare: void 0 === compare ? null : compare
660
+ };
661
+ };
662
+ react_production.startTransition = function (scope) {
663
+ var prevTransition = ReactSharedInternals.T,
664
+ currentTransition = {};
665
+ ReactSharedInternals.T = currentTransition;
666
+ try {
667
+ var returnValue = scope(),
668
+ onStartTransitionFinish = ReactSharedInternals.S;
669
+ null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
670
+ "object" === _typeof(returnValue) && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
671
+ } catch (error) {
672
+ reportGlobalError(error);
673
+ } finally {
674
+ null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
675
+ }
676
+ };
677
+ react_production.unstable_useCacheRefresh = function () {
678
+ return ReactSharedInternals.H.useCacheRefresh();
679
+ };
680
+ react_production.use = function (usable) {
681
+ return ReactSharedInternals.H.use(usable);
682
+ };
683
+ react_production.useActionState = function (action, initialState, permalink) {
684
+ return ReactSharedInternals.H.useActionState(action, initialState, permalink);
685
+ };
686
+ react_production.useCallback = function (callback, deps) {
687
+ return ReactSharedInternals.H.useCallback(callback, deps);
688
+ };
689
+ react_production.useContext = function (Context) {
690
+ return ReactSharedInternals.H.useContext(Context);
691
+ };
692
+ react_production.useDebugValue = function () {};
693
+ react_production.useDeferredValue = function (value, initialValue) {
694
+ return ReactSharedInternals.H.useDeferredValue(value, initialValue);
695
+ };
696
+ react_production.useEffect = function (create, deps) {
697
+ return ReactSharedInternals.H.useEffect(create, deps);
698
+ };
699
+ react_production.useEffectEvent = function (callback) {
700
+ return ReactSharedInternals.H.useEffectEvent(callback);
701
+ };
702
+ react_production.useId = function () {
703
+ return ReactSharedInternals.H.useId();
704
+ };
705
+ react_production.useImperativeHandle = function (ref, create, deps) {
706
+ return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
707
+ };
708
+ react_production.useInsertionEffect = function (create, deps) {
709
+ return ReactSharedInternals.H.useInsertionEffect(create, deps);
710
+ };
711
+ react_production.useLayoutEffect = function (create, deps) {
712
+ return ReactSharedInternals.H.useLayoutEffect(create, deps);
713
+ };
714
+ react_production.useMemo = function (create, deps) {
715
+ return ReactSharedInternals.H.useMemo(create, deps);
716
+ };
717
+ react_production.useOptimistic = function (passthrough, reducer) {
718
+ return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
719
+ };
720
+ react_production.useReducer = function (reducer, initialArg, init) {
721
+ return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
722
+ };
723
+ react_production.useRef = function (initialValue) {
724
+ return ReactSharedInternals.H.useRef(initialValue);
725
+ };
726
+ react_production.useState = function (initialState) {
727
+ return ReactSharedInternals.H.useState(initialState);
728
+ };
729
+ react_production.useSyncExternalStore = function (subscribe, getSnapshot, getServerSnapshot) {
730
+ return ReactSharedInternals.H.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
731
+ };
732
+ react_production.useTransition = function () {
733
+ return ReactSharedInternals.H.useTransition();
734
+ };
735
+ react_production.version = "19.2.5";
736
+ return react_production;
737
+ }
738
+
739
+ var react_development = {exports: {}};
740
+
741
+ react_development.exports;
742
+ var hasRequiredReact_development;
743
+ function requireReact_development() {
744
+ if (hasRequiredReact_development) return react_development.exports;
745
+ hasRequiredReact_development = 1;
746
+ (function (module, exports$1) {
747
+
748
+ "production" !== process.env.NODE_ENV && function () {
749
+ function defineDeprecationWarning(methodName, info) {
750
+ Object.defineProperty(Component.prototype, methodName, {
751
+ get: function get() {
752
+ console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
753
+ }
754
+ });
755
+ }
756
+ function getIteratorFn(maybeIterable) {
757
+ if (null === maybeIterable || "object" !== _typeof(maybeIterable)) return null;
758
+ maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
759
+ return "function" === typeof maybeIterable ? maybeIterable : null;
760
+ }
761
+ function warnNoop(publicInstance, callerName) {
762
+ publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
763
+ var warningKey = publicInstance + "." + callerName;
764
+ didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, publicInstance), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
765
+ }
766
+ function Component(props, context, updater) {
767
+ this.props = props;
768
+ this.context = context;
769
+ this.refs = emptyObject;
770
+ this.updater = updater || ReactNoopUpdateQueue;
771
+ }
772
+ function ComponentDummy() {}
773
+ function PureComponent(props, context, updater) {
774
+ this.props = props;
775
+ this.context = context;
776
+ this.refs = emptyObject;
777
+ this.updater = updater || ReactNoopUpdateQueue;
778
+ }
779
+ function noop() {}
780
+ function testStringCoercion(value) {
781
+ return "" + value;
782
+ }
783
+ function checkKeyStringCoercion(value) {
784
+ try {
785
+ testStringCoercion(value);
786
+ var JSCompiler_inline_result = !1;
787
+ } catch (e) {
788
+ JSCompiler_inline_result = true;
789
+ }
790
+ if (JSCompiler_inline_result) {
791
+ JSCompiler_inline_result = console;
792
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
793
+ var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
794
+ JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
795
+ return testStringCoercion(value);
796
+ }
797
+ }
798
+ function getComponentNameFromType(type) {
799
+ if (null == type) return null;
800
+ if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
801
+ if ("string" === typeof type) return type;
802
+ switch (type) {
803
+ case REACT_FRAGMENT_TYPE:
804
+ return "Fragment";
805
+ case REACT_PROFILER_TYPE:
806
+ return "Profiler";
807
+ case REACT_STRICT_MODE_TYPE:
808
+ return "StrictMode";
809
+ case REACT_SUSPENSE_TYPE:
810
+ return "Suspense";
811
+ case REACT_SUSPENSE_LIST_TYPE:
812
+ return "SuspenseList";
813
+ case REACT_ACTIVITY_TYPE:
814
+ return "Activity";
815
+ }
816
+ if ("object" === _typeof(type)) switch ("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
817
+ case REACT_PORTAL_TYPE:
818
+ return "Portal";
819
+ case REACT_CONTEXT_TYPE:
820
+ return type.displayName || "Context";
821
+ case REACT_CONSUMER_TYPE:
822
+ return (type._context.displayName || "Context") + ".Consumer";
823
+ case REACT_FORWARD_REF_TYPE:
824
+ var innerType = type.render;
825
+ type = type.displayName;
826
+ type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
827
+ return type;
828
+ case REACT_MEMO_TYPE:
829
+ return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
830
+ case REACT_LAZY_TYPE:
831
+ innerType = type._payload;
832
+ type = type._init;
833
+ try {
834
+ return getComponentNameFromType(type(innerType));
835
+ } catch (x) {}
836
+ }
837
+ return null;
838
+ }
839
+ function getTaskName(type) {
840
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
841
+ if ("object" === _typeof(type) && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>";
842
+ try {
843
+ var name = getComponentNameFromType(type);
844
+ return name ? "<" + name + ">" : "<...>";
845
+ } catch (x) {
846
+ return "<...>";
847
+ }
848
+ }
849
+ function getOwner() {
850
+ var dispatcher = ReactSharedInternals.A;
851
+ return null === dispatcher ? null : dispatcher.getOwner();
852
+ }
853
+ function UnknownOwner() {
854
+ return Error("react-stack-top-frame");
855
+ }
856
+ function hasValidKey(config) {
857
+ if (hasOwnProperty.call(config, "key")) {
858
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
859
+ if (getter && getter.isReactWarning) return false;
860
+ }
861
+ return void 0 !== config.key;
862
+ }
863
+ function defineKeyPropWarningGetter(props, displayName) {
864
+ function warnAboutAccessingKey() {
865
+ specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
866
+ }
867
+ warnAboutAccessingKey.isReactWarning = true;
868
+ Object.defineProperty(props, "key", {
869
+ get: warnAboutAccessingKey,
870
+ configurable: true
871
+ });
872
+ }
873
+ function elementRefGetterWithDeprecationWarning() {
874
+ var componentName = getComponentNameFromType(this.type);
875
+ didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
876
+ componentName = this.props.ref;
877
+ return void 0 !== componentName ? componentName : null;
878
+ }
879
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
880
+ var refProp = props.ref;
881
+ type = {
882
+ $$typeof: REACT_ELEMENT_TYPE,
883
+ type: type,
884
+ key: key,
885
+ props: props,
886
+ _owner: owner
887
+ };
888
+ null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
889
+ enumerable: false,
890
+ get: elementRefGetterWithDeprecationWarning
891
+ }) : Object.defineProperty(type, "ref", {
892
+ enumerable: false,
893
+ value: null
894
+ });
895
+ type._store = {};
896
+ Object.defineProperty(type._store, "validated", {
897
+ configurable: false,
898
+ enumerable: false,
899
+ writable: true,
900
+ value: 0
901
+ });
902
+ Object.defineProperty(type, "_debugInfo", {
903
+ configurable: false,
904
+ enumerable: false,
905
+ writable: true,
906
+ value: null
907
+ });
908
+ Object.defineProperty(type, "_debugStack", {
909
+ configurable: false,
910
+ enumerable: false,
911
+ writable: true,
912
+ value: debugStack
913
+ });
914
+ Object.defineProperty(type, "_debugTask", {
915
+ configurable: false,
916
+ enumerable: false,
917
+ writable: true,
918
+ value: debugTask
919
+ });
920
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
921
+ return type;
922
+ }
923
+ function cloneAndReplaceKey(oldElement, newKey) {
924
+ newKey = ReactElement(oldElement.type, newKey, oldElement.props, oldElement._owner, oldElement._debugStack, oldElement._debugTask);
925
+ oldElement._store && (newKey._store.validated = oldElement._store.validated);
926
+ return newKey;
927
+ }
928
+ function validateChildKeys(node) {
929
+ 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));
930
+ }
931
+ function isValidElement(object) {
932
+ return "object" === _typeof(object) && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
933
+ }
934
+ function escape(key) {
935
+ var escaperLookup = {
936
+ "=": "=0",
937
+ ":": "=2"
938
+ };
939
+ return "$" + key.replace(/[=:]/g, function (match) {
940
+ return escaperLookup[match];
941
+ });
942
+ }
943
+ function getElementKey(element, index) {
944
+ return "object" === _typeof(element) && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
945
+ }
946
+ function resolveThenable(thenable) {
947
+ switch (thenable.status) {
948
+ case "fulfilled":
949
+ return thenable.value;
950
+ case "rejected":
951
+ throw thenable.reason;
952
+ default:
953
+ switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(function (fulfilledValue) {
954
+ "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
955
+ }, function (error) {
956
+ "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
957
+ })), thenable.status) {
958
+ case "fulfilled":
959
+ return thenable.value;
960
+ case "rejected":
961
+ throw thenable.reason;
962
+ }
963
+ }
964
+ throw thenable;
965
+ }
966
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
967
+ var type = _typeof(children);
968
+ if ("undefined" === type || "boolean" === type) children = null;
969
+ var invokeCallback = false;
970
+ if (null === children) invokeCallback = true;else switch (type) {
971
+ case "bigint":
972
+ case "string":
973
+ case "number":
974
+ invokeCallback = true;
975
+ break;
976
+ case "object":
977
+ switch (children.$$typeof) {
978
+ case REACT_ELEMENT_TYPE:
979
+ case REACT_PORTAL_TYPE:
980
+ invokeCallback = true;
981
+ break;
982
+ case REACT_LAZY_TYPE:
983
+ return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
984
+ }
985
+ }
986
+ if (invokeCallback) {
987
+ invokeCallback = children;
988
+ callback = callback(invokeCallback);
989
+ var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
990
+ isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function (c) {
991
+ return c;
992
+ })) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(callback, escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + childKey), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
993
+ return 1;
994
+ }
995
+ invokeCallback = 0;
996
+ childKey = "" === nameSoFar ? "." : nameSoFar + ":";
997
+ if (isArrayImpl(children)) for (var i = 0; i < children.length; i++) nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);else if (i = getIteratorFn(children), "function" === typeof i) for (i === children.entries && (didWarnAboutMaps || console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = true), children = i.call(children), i = 0; !(nameSoFar = children.next()).done;) nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);else if ("object" === type) {
998
+ if ("function" === typeof children.then) return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
999
+ array = String(children);
1000
+ throw Error("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.");
1001
+ }
1002
+ return invokeCallback;
1003
+ }
1004
+ function mapChildren(children, func, context) {
1005
+ if (null == children) return children;
1006
+ var result = [],
1007
+ count = 0;
1008
+ mapIntoArray(children, result, "", "", function (child) {
1009
+ return func.call(context, child, count++);
1010
+ });
1011
+ return result;
1012
+ }
1013
+ function lazyInitializer(payload) {
1014
+ if (-1 === payload._status) {
1015
+ var ioInfo = payload._ioInfo;
1016
+ null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
1017
+ ioInfo = payload._result;
1018
+ var thenable = ioInfo();
1019
+ thenable.then(function (moduleObject) {
1020
+ if (0 === payload._status || -1 === payload._status) {
1021
+ payload._status = 1;
1022
+ payload._result = moduleObject;
1023
+ var _ioInfo = payload._ioInfo;
1024
+ null != _ioInfo && (_ioInfo.end = performance.now());
1025
+ void 0 === thenable.status && (thenable.status = "fulfilled", thenable.value = moduleObject);
1026
+ }
1027
+ }, function (error) {
1028
+ if (0 === payload._status || -1 === payload._status) {
1029
+ payload._status = 2;
1030
+ payload._result = error;
1031
+ var _ioInfo2 = payload._ioInfo;
1032
+ null != _ioInfo2 && (_ioInfo2.end = performance.now());
1033
+ void 0 === thenable.status && (thenable.status = "rejected", thenable.reason = error);
1034
+ }
1035
+ });
1036
+ ioInfo = payload._ioInfo;
1037
+ if (null != ioInfo) {
1038
+ ioInfo.value = thenable;
1039
+ var displayName = thenable.displayName;
1040
+ "string" === typeof displayName && (ioInfo.name = displayName);
1041
+ }
1042
+ -1 === payload._status && (payload._status = 0, payload._result = thenable);
1043
+ }
1044
+ if (1 === payload._status) return ioInfo = payload._result, void 0 === ioInfo && console.error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", ioInfo), "default" in ioInfo || console.error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", ioInfo), ioInfo["default"];
1045
+ throw payload._result;
1046
+ }
1047
+ function resolveDispatcher() {
1048
+ var dispatcher = ReactSharedInternals.H;
1049
+ null === dispatcher && console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\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.");
1050
+ return dispatcher;
1051
+ }
1052
+ function releaseAsyncTransition() {
1053
+ ReactSharedInternals.asyncTransitions--;
1054
+ }
1055
+ function enqueueTask(task) {
1056
+ if (null === enqueueTaskImpl) try {
1057
+ var requireString = ("require" + Math.random()).slice(0, 7);
1058
+ enqueueTaskImpl = (module && module[requireString]).call(module, "timers").setImmediate;
1059
+ } catch (_err) {
1060
+ enqueueTaskImpl = function enqueueTaskImpl(callback) {
1061
+ false === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = true, "undefined" === typeof MessageChannel && console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));
1062
+ var channel = new MessageChannel();
1063
+ channel.port1.onmessage = callback;
1064
+ channel.port2.postMessage(void 0);
1065
+ };
1066
+ }
1067
+ return enqueueTaskImpl(task);
1068
+ }
1069
+ function aggregateErrors(errors) {
1070
+ return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
1071
+ }
1072
+ function popActScope(prevActQueue, prevActScopeDepth) {
1073
+ prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
1074
+ actScopeDepth = prevActScopeDepth;
1075
+ }
1076
+ function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
1077
+ var queue = ReactSharedInternals.actQueue;
1078
+ if (null !== queue) if (0 !== queue.length) try {
1079
+ flushActQueue(queue);
1080
+ enqueueTask(function () {
1081
+ return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
1082
+ });
1083
+ return;
1084
+ } catch (error) {
1085
+ ReactSharedInternals.thrownErrors.push(error);
1086
+ } else ReactSharedInternals.actQueue = null;
1087
+ 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
1088
+ }
1089
+ function flushActQueue(queue) {
1090
+ if (!isFlushing) {
1091
+ isFlushing = true;
1092
+ var i = 0;
1093
+ try {
1094
+ for (; i < queue.length; i++) {
1095
+ var callback = queue[i];
1096
+ do {
1097
+ ReactSharedInternals.didUsePromise = !1;
1098
+ var continuation = callback(!1);
1099
+ if (null !== continuation) {
1100
+ if (ReactSharedInternals.didUsePromise) {
1101
+ queue[i] = callback;
1102
+ queue.splice(0, i);
1103
+ return;
1104
+ }
1105
+ callback = continuation;
1106
+ } else break;
1107
+ } while (1);
1108
+ }
1109
+ queue.length = 0;
1110
+ } catch (error) {
1111
+ queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
1112
+ } finally {
1113
+ isFlushing = false;
1114
+ }
1115
+ }
1116
+ }
1117
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
1118
+ var REACT_ELEMENT_TYPE = Symbol["for"]("react.transitional.element"),
1119
+ REACT_PORTAL_TYPE = Symbol["for"]("react.portal"),
1120
+ REACT_FRAGMENT_TYPE = Symbol["for"]("react.fragment"),
1121
+ REACT_STRICT_MODE_TYPE = Symbol["for"]("react.strict_mode"),
1122
+ REACT_PROFILER_TYPE = Symbol["for"]("react.profiler"),
1123
+ REACT_CONSUMER_TYPE = Symbol["for"]("react.consumer"),
1124
+ REACT_CONTEXT_TYPE = Symbol["for"]("react.context"),
1125
+ REACT_FORWARD_REF_TYPE = Symbol["for"]("react.forward_ref"),
1126
+ REACT_SUSPENSE_TYPE = Symbol["for"]("react.suspense"),
1127
+ REACT_SUSPENSE_LIST_TYPE = Symbol["for"]("react.suspense_list"),
1128
+ REACT_MEMO_TYPE = Symbol["for"]("react.memo"),
1129
+ REACT_LAZY_TYPE = Symbol["for"]("react.lazy"),
1130
+ REACT_ACTIVITY_TYPE = Symbol["for"]("react.activity"),
1131
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
1132
+ didWarnStateUpdateForUnmountedComponent = {},
1133
+ ReactNoopUpdateQueue = {
1134
+ isMounted: function isMounted() {
1135
+ return false;
1136
+ },
1137
+ enqueueForceUpdate: function enqueueForceUpdate(publicInstance) {
1138
+ warnNoop(publicInstance, "forceUpdate");
1139
+ },
1140
+ enqueueReplaceState: function enqueueReplaceState(publicInstance) {
1141
+ warnNoop(publicInstance, "replaceState");
1142
+ },
1143
+ enqueueSetState: function enqueueSetState(publicInstance) {
1144
+ warnNoop(publicInstance, "setState");
1145
+ }
1146
+ },
1147
+ assign = Object.assign,
1148
+ emptyObject = {};
1149
+ Object.freeze(emptyObject);
1150
+ Component.prototype.isReactComponent = {};
1151
+ Component.prototype.setState = function (partialState, callback) {
1152
+ if ("object" !== _typeof(partialState) && "function" !== typeof partialState && null != partialState) throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
1153
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
1154
+ };
1155
+ Component.prototype.forceUpdate = function (callback) {
1156
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
1157
+ };
1158
+ var deprecatedAPIs = {
1159
+ isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
1160
+ replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
1161
+ };
1162
+ for (fnName in deprecatedAPIs) deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
1163
+ ComponentDummy.prototype = Component.prototype;
1164
+ deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
1165
+ deprecatedAPIs.constructor = PureComponent;
1166
+ assign(deprecatedAPIs, Component.prototype);
1167
+ deprecatedAPIs.isPureReactComponent = true;
1168
+ var isArrayImpl = Array.isArray,
1169
+ REACT_CLIENT_REFERENCE = Symbol["for"]("react.client.reference"),
1170
+ ReactSharedInternals = {
1171
+ H: null,
1172
+ A: null,
1173
+ T: null,
1174
+ S: null,
1175
+ actQueue: null,
1176
+ asyncTransitions: 0,
1177
+ isBatchingLegacy: false,
1178
+ didScheduleLegacyUpdate: false,
1179
+ didUsePromise: false,
1180
+ thrownErrors: [],
1181
+ getCurrentStack: null,
1182
+ recentlyCreatedOwnerStacks: 0
1183
+ },
1184
+ hasOwnProperty = Object.prototype.hasOwnProperty,
1185
+ createTask = console.createTask ? console.createTask : function () {
1186
+ return null;
1187
+ };
1188
+ deprecatedAPIs = {
1189
+ react_stack_bottom_frame: function react_stack_bottom_frame(callStackForError) {
1190
+ return callStackForError();
1191
+ }
1192
+ };
1193
+ var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
1194
+ var didWarnAboutElementRef = {};
1195
+ var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(deprecatedAPIs, UnknownOwner)();
1196
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
1197
+ var didWarnAboutMaps = false,
1198
+ userProvidedKeyEscapeRegex = /\/+/g,
1199
+ reportGlobalError = "function" === typeof reportError ? reportError : function (error) {
1200
+ if ("object" === (typeof window === "undefined" ? "undefined" : _typeof(window)) && "function" === typeof window.ErrorEvent) {
1201
+ var event = new window.ErrorEvent("error", {
1202
+ bubbles: true,
1203
+ cancelable: true,
1204
+ message: "object" === _typeof(error) && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
1205
+ error: error
1206
+ });
1207
+ if (!window.dispatchEvent(event)) return;
1208
+ } else if ("object" === (typeof process === "undefined" ? "undefined" : _typeof(process)) && "function" === typeof process.emit) {
1209
+ process.emit("uncaughtException", error);
1210
+ return;
1211
+ }
1212
+ console.error(error);
1213
+ },
1214
+ didWarnAboutMessageChannel = false,
1215
+ enqueueTaskImpl = null,
1216
+ actScopeDepth = 0,
1217
+ didWarnNoAwaitAct = false,
1218
+ isFlushing = false,
1219
+ queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function (callback) {
1220
+ queueMicrotask(function () {
1221
+ return queueMicrotask(callback);
1222
+ });
1223
+ } : enqueueTask;
1224
+ deprecatedAPIs = Object.freeze({
1225
+ __proto__: null,
1226
+ c: function c(size) {
1227
+ return resolveDispatcher().useMemoCache(size);
1228
+ }
1229
+ });
1230
+ var fnName = {
1231
+ map: mapChildren,
1232
+ forEach: function forEach(children, forEachFunc, forEachContext) {
1233
+ mapChildren(children, function () {
1234
+ forEachFunc.apply(this, arguments);
1235
+ }, forEachContext);
1236
+ },
1237
+ count: function count(children) {
1238
+ var n = 0;
1239
+ mapChildren(children, function () {
1240
+ n++;
1241
+ });
1242
+ return n;
1243
+ },
1244
+ toArray: function toArray(children) {
1245
+ return mapChildren(children, function (child) {
1246
+ return child;
1247
+ }) || [];
1248
+ },
1249
+ only: function only(children) {
1250
+ if (!isValidElement(children)) throw Error("React.Children.only expected to receive a single React element child.");
1251
+ return children;
1252
+ }
1253
+ };
1254
+ exports$1.Activity = REACT_ACTIVITY_TYPE;
1255
+ exports$1.Children = fnName;
1256
+ exports$1.Component = Component;
1257
+ exports$1.Fragment = REACT_FRAGMENT_TYPE;
1258
+ exports$1.Profiler = REACT_PROFILER_TYPE;
1259
+ exports$1.PureComponent = PureComponent;
1260
+ exports$1.StrictMode = REACT_STRICT_MODE_TYPE;
1261
+ exports$1.Suspense = REACT_SUSPENSE_TYPE;
1262
+ exports$1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
1263
+ exports$1.__COMPILER_RUNTIME = deprecatedAPIs;
1264
+ exports$1.act = function (callback) {
1265
+ var prevActQueue = ReactSharedInternals.actQueue,
1266
+ prevActScopeDepth = actScopeDepth;
1267
+ actScopeDepth++;
1268
+ var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [],
1269
+ didAwaitActCall = false;
1270
+ try {
1271
+ var result = callback();
1272
+ } catch (error) {
1273
+ ReactSharedInternals.thrownErrors.push(error);
1274
+ }
1275
+ if (0 < ReactSharedInternals.thrownErrors.length) throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1276
+ if (null !== result && "object" === _typeof(result) && "function" === typeof result.then) {
1277
+ var thenable = result;
1278
+ queueSeveralMicrotasks(function () {
1279
+ didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
1280
+ });
1281
+ return {
1282
+ then: function then(resolve, reject) {
1283
+ didAwaitActCall = true;
1284
+ thenable.then(function (returnValue) {
1285
+ popActScope(prevActQueue, prevActScopeDepth);
1286
+ if (0 === prevActScopeDepth) {
1287
+ try {
1288
+ flushActQueue(queue), enqueueTask(function () {
1289
+ return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
1290
+ });
1291
+ } catch (error$0) {
1292
+ ReactSharedInternals.thrownErrors.push(error$0);
1293
+ }
1294
+ if (0 < ReactSharedInternals.thrownErrors.length) {
1295
+ var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
1296
+ ReactSharedInternals.thrownErrors.length = 0;
1297
+ reject(_thrownError);
1298
+ }
1299
+ } else resolve(returnValue);
1300
+ }, function (error) {
1301
+ popActScope(prevActQueue, prevActScopeDepth);
1302
+ 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
1303
+ });
1304
+ }
1305
+ };
1306
+ }
1307
+ var returnValue$jscomp$0 = result;
1308
+ popActScope(prevActQueue, prevActScopeDepth);
1309
+ 0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function () {
1310
+ didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));
1311
+ }), ReactSharedInternals.actQueue = null);
1312
+ if (0 < ReactSharedInternals.thrownErrors.length) throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
1313
+ return {
1314
+ then: function then(resolve, reject) {
1315
+ didAwaitActCall = true;
1316
+ 0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function () {
1317
+ return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve, reject);
1318
+ })) : resolve(returnValue$jscomp$0);
1319
+ }
1320
+ };
1321
+ };
1322
+ exports$1.cache = function (fn) {
1323
+ return function () {
1324
+ return fn.apply(null, arguments);
1325
+ };
1326
+ };
1327
+ exports$1.cacheSignal = function () {
1328
+ return null;
1329
+ };
1330
+ exports$1.captureOwnerStack = function () {
1331
+ var getCurrentStack = ReactSharedInternals.getCurrentStack;
1332
+ return null === getCurrentStack ? null : getCurrentStack();
1333
+ };
1334
+ exports$1.cloneElement = function (element, config, children) {
1335
+ if (null === element || void 0 === element) throw Error("The argument must be a React element, but you passed " + element + ".");
1336
+ var props = assign({}, element.props),
1337
+ key = element.key,
1338
+ owner = element._owner;
1339
+ if (null != config) {
1340
+ var JSCompiler_inline_result;
1341
+ a: {
1342
+ if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(config, "ref").get) && JSCompiler_inline_result.isReactWarning) {
1343
+ JSCompiler_inline_result = false;
1344
+ break a;
1345
+ }
1346
+ JSCompiler_inline_result = void 0 !== config.ref;
1347
+ }
1348
+ JSCompiler_inline_result && (owner = getOwner());
1349
+ hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
1350
+ for (propName in config) !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
1351
+ }
1352
+ var propName = arguments.length - 2;
1353
+ if (1 === propName) props.children = children;else if (1 < propName) {
1354
+ JSCompiler_inline_result = Array(propName);
1355
+ for (var i = 0; i < propName; i++) JSCompiler_inline_result[i] = arguments[i + 2];
1356
+ props.children = JSCompiler_inline_result;
1357
+ }
1358
+ props = ReactElement(element.type, key, props, owner, element._debugStack, element._debugTask);
1359
+ for (key = 2; key < arguments.length; key++) validateChildKeys(arguments[key]);
1360
+ return props;
1361
+ };
1362
+ exports$1.createContext = function (defaultValue) {
1363
+ defaultValue = {
1364
+ $$typeof: REACT_CONTEXT_TYPE,
1365
+ _currentValue: defaultValue,
1366
+ _currentValue2: defaultValue,
1367
+ _threadCount: 0,
1368
+ Provider: null,
1369
+ Consumer: null
1370
+ };
1371
+ defaultValue.Provider = defaultValue;
1372
+ defaultValue.Consumer = {
1373
+ $$typeof: REACT_CONSUMER_TYPE,
1374
+ _context: defaultValue
1375
+ };
1376
+ defaultValue._currentRenderer = null;
1377
+ defaultValue._currentRenderer2 = null;
1378
+ return defaultValue;
1379
+ };
1380
+ exports$1.createElement = function (type, config, children) {
1381
+ for (var i = 2; i < arguments.length; i++) validateChildKeys(arguments[i]);
1382
+ i = {};
1383
+ var key = null;
1384
+ if (null != config) for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config) hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
1385
+ var childrenLength = arguments.length - 2;
1386
+ if (1 === childrenLength) i.children = children;else if (1 < childrenLength) {
1387
+ for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++) childArray[_i] = arguments[_i + 2];
1388
+ Object.freeze && Object.freeze(childArray);
1389
+ i.children = childArray;
1390
+ }
1391
+ if (type && type.defaultProps) for (propName in childrenLength = type.defaultProps, childrenLength) void 0 === i[propName] && (i[propName] = childrenLength[propName]);
1392
+ key && defineKeyPropWarningGetter(i, "function" === typeof type ? type.displayName || type.name || "Unknown" : type);
1393
+ var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1394
+ return ReactElement(type, key, i, getOwner(), propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
1395
+ };
1396
+ exports$1.createRef = function () {
1397
+ var refObject = {
1398
+ current: null
1399
+ };
1400
+ Object.seal(refObject);
1401
+ return refObject;
1402
+ };
1403
+ exports$1.forwardRef = function (render) {
1404
+ null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).") : "function" !== typeof render ? console.error("forwardRef requires a render function but was given %s.", null === render ? "null" : _typeof(render)) : 0 !== render.length && 2 !== render.length && console.error("forwardRef render functions accept exactly two parameters: props and ref. %s", 1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
1405
+ null != render && null != render.defaultProps && console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");
1406
+ var elementType = {
1407
+ $$typeof: REACT_FORWARD_REF_TYPE,
1408
+ render: render
1409
+ },
1410
+ ownName;
1411
+ Object.defineProperty(elementType, "displayName", {
1412
+ enumerable: false,
1413
+ configurable: true,
1414
+ get: function get() {
1415
+ return ownName;
1416
+ },
1417
+ set: function set(name) {
1418
+ ownName = name;
1419
+ render.name || render.displayName || (Object.defineProperty(render, "name", {
1420
+ value: name
1421
+ }), render.displayName = name);
1422
+ }
1423
+ });
1424
+ return elementType;
1425
+ };
1426
+ exports$1.isValidElement = isValidElement;
1427
+ exports$1.lazy = function (ctor) {
1428
+ ctor = {
1429
+ _status: -1,
1430
+ _result: ctor
1431
+ };
1432
+ var lazyType = {
1433
+ $$typeof: REACT_LAZY_TYPE,
1434
+ _payload: ctor,
1435
+ _init: lazyInitializer
1436
+ },
1437
+ ioInfo = {
1438
+ name: "lazy",
1439
+ start: -1,
1440
+ end: -1,
1441
+ value: null,
1442
+ owner: null,
1443
+ debugStack: Error("react-stack-top-frame"),
1444
+ debugTask: console.createTask ? console.createTask("lazy()") : null
1445
+ };
1446
+ ctor._ioInfo = ioInfo;
1447
+ lazyType._debugInfo = [{
1448
+ awaited: ioInfo
1449
+ }];
1450
+ return lazyType;
1451
+ };
1452
+ exports$1.memo = function (type, compare) {
1453
+ null == type && console.error("memo: The first argument must be a component. Instead received: %s", null === type ? "null" : _typeof(type));
1454
+ compare = {
1455
+ $$typeof: REACT_MEMO_TYPE,
1456
+ type: type,
1457
+ compare: void 0 === compare ? null : compare
1458
+ };
1459
+ var ownName;
1460
+ Object.defineProperty(compare, "displayName", {
1461
+ enumerable: false,
1462
+ configurable: true,
1463
+ get: function get() {
1464
+ return ownName;
1465
+ },
1466
+ set: function set(name) {
1467
+ ownName = name;
1468
+ type.name || type.displayName || (Object.defineProperty(type, "name", {
1469
+ value: name
1470
+ }), type.displayName = name);
1471
+ }
1472
+ });
1473
+ return compare;
1474
+ };
1475
+ exports$1.startTransition = function (scope) {
1476
+ var prevTransition = ReactSharedInternals.T,
1477
+ currentTransition = {};
1478
+ currentTransition._updatedFibers = new Set();
1479
+ ReactSharedInternals.T = currentTransition;
1480
+ try {
1481
+ var returnValue = scope(),
1482
+ onStartTransitionFinish = ReactSharedInternals.S;
1483
+ null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
1484
+ "object" === _typeof(returnValue) && null !== returnValue && "function" === typeof returnValue.then && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
1485
+ } catch (error) {
1486
+ reportGlobalError(error);
1487
+ } finally {
1488
+ null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
1489
+ }
1490
+ };
1491
+ exports$1.unstable_useCacheRefresh = function () {
1492
+ return resolveDispatcher().useCacheRefresh();
1493
+ };
1494
+ exports$1.use = function (usable) {
1495
+ return resolveDispatcher().use(usable);
1496
+ };
1497
+ exports$1.useActionState = function (action, initialState, permalink) {
1498
+ return resolveDispatcher().useActionState(action, initialState, permalink);
1499
+ };
1500
+ exports$1.useCallback = function (callback, deps) {
1501
+ return resolveDispatcher().useCallback(callback, deps);
1502
+ };
1503
+ exports$1.useContext = function (Context) {
1504
+ var dispatcher = resolveDispatcher();
1505
+ Context.$$typeof === REACT_CONSUMER_TYPE && console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?");
1506
+ return dispatcher.useContext(Context);
1507
+ };
1508
+ exports$1.useDebugValue = function (value, formatterFn) {
1509
+ return resolveDispatcher().useDebugValue(value, formatterFn);
1510
+ };
1511
+ exports$1.useDeferredValue = function (value, initialValue) {
1512
+ return resolveDispatcher().useDeferredValue(value, initialValue);
1513
+ };
1514
+ exports$1.useEffect = function (create, deps) {
1515
+ null == create && console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");
1516
+ return resolveDispatcher().useEffect(create, deps);
1517
+ };
1518
+ exports$1.useEffectEvent = function (callback) {
1519
+ return resolveDispatcher().useEffectEvent(callback);
1520
+ };
1521
+ exports$1.useId = function () {
1522
+ return resolveDispatcher().useId();
1523
+ };
1524
+ exports$1.useImperativeHandle = function (ref, create, deps) {
1525
+ return resolveDispatcher().useImperativeHandle(ref, create, deps);
1526
+ };
1527
+ exports$1.useInsertionEffect = function (create, deps) {
1528
+ null == create && console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?");
1529
+ return resolveDispatcher().useInsertionEffect(create, deps);
1530
+ };
1531
+ exports$1.useLayoutEffect = function (create, deps) {
1532
+ null == create && console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?");
1533
+ return resolveDispatcher().useLayoutEffect(create, deps);
1534
+ };
1535
+ exports$1.useMemo = function (create, deps) {
1536
+ return resolveDispatcher().useMemo(create, deps);
1537
+ };
1538
+ exports$1.useOptimistic = function (passthrough, reducer) {
1539
+ return resolveDispatcher().useOptimistic(passthrough, reducer);
1540
+ };
1541
+ exports$1.useReducer = function (reducer, initialArg, init) {
1542
+ return resolveDispatcher().useReducer(reducer, initialArg, init);
1543
+ };
1544
+ exports$1.useRef = function (initialValue) {
1545
+ return resolveDispatcher().useRef(initialValue);
1546
+ };
1547
+ exports$1.useState = function (initialState) {
1548
+ return resolveDispatcher().useState(initialState);
1549
+ };
1550
+ exports$1.useSyncExternalStore = function (subscribe, getSnapshot, getServerSnapshot) {
1551
+ return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
1552
+ };
1553
+ exports$1.useTransition = function () {
1554
+ return resolveDispatcher().useTransition();
1555
+ };
1556
+ exports$1.version = "19.2.5";
1557
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1558
+ }();
1559
+ })(react_development, react_development.exports);
1560
+ return react_development.exports;
1561
+ }
1562
+
1563
+ if (process.env.NODE_ENV === 'production') {
1564
+ react.exports = requireReact_production();
1565
+ } else {
1566
+ react.exports = requireReact_development();
1567
+ }
1568
+ var reactExports = react.exports;
1569
+ var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
1570
+
1571
+ var _process$env, _window$location, _process$env2, _process$env3, _process$env4, _process$env5, _process$env6, _process$env7, _process$env8, _process$env9, _process$env0, _process$env1, _process$env10, _process$env11, _process$env12, _process$env13, _process$env14, _process$env15, _process$env16, _process$env17, _process$env18, _process$env19, _process$env20, _process$env21;
1572
+
1573
+ /**
1574
+ * @quantabit/sdk-config - BaseApiClient
1575
+ *
1576
+ * SDK API 客户端基类
1577
+ * 封装所有通用的配置、请求、Token 管理逻辑
1578
+ *
1579
+ * 使用方式:
1580
+ * ```javascript
1581
+ * import { BaseApiClient } from '@quantabit/sdk-config';
1582
+ *
1583
+ * class MyApiClient extends BaseApiClient {
1584
+ * constructor(config = {}) {
1585
+ * super('/my-module', config); // 只需传入模块路径
1586
+ * }
1587
+ *
1588
+ * // 专注于业务方法
1589
+ * async getList() {
1590
+ * return this.request('/list');
1591
+ * }
1592
+ * }
1593
+ * ```
1594
+ */
1595
+
1596
+ function joinUrlSegments() {
1597
+ var baseUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1598
+ var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1599
+ var cleanBase = String(baseUrl || '').replace(/\/+$/, '');
1600
+ var cleanPath = String(path || '').replace(/^\/+/, '');
1601
+ if (!cleanBase) {
1602
+ return cleanPath ? "/".concat(cleanPath) : '';
1603
+ }
1604
+ if (!cleanPath) {
1605
+ return cleanBase;
1606
+ }
1607
+ return "".concat(cleanBase, "/").concat(cleanPath);
1608
+ }
1609
+ function parseResponseBody(_x) {
1610
+ return _parseResponseBody.apply(this, arguments);
1611
+ }
1612
+ /**
1613
+ * SDK API 客户端基类
1614
+ * 所有 SDK 的 API 客户端都应继承此类
1615
+ */
1616
+ function _parseResponseBody() {
1617
+ _parseResponseBody = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(response) {
1618
+ var contentType, text;
1619
+ return _regenerator().w(function (_context9) {
1620
+ while (1) switch (_context9.p = _context9.n) {
1621
+ case 0:
1622
+ if (!(response.status === 204 || response.status === 205)) {
1623
+ _context9.n = 1;
1624
+ break;
1625
+ }
1626
+ return _context9.a(2, null);
1627
+ case 1:
1628
+ contentType = response.headers.get('content-type') || '';
1629
+ if (!contentType.includes('application/json')) {
1630
+ _context9.n = 2;
1631
+ break;
1632
+ }
1633
+ return _context9.a(2, response.json());
1634
+ case 2:
1635
+ _context9.n = 3;
1636
+ return response.text();
1637
+ case 3:
1638
+ text = _context9.v;
1639
+ if (text) {
1640
+ _context9.n = 4;
1641
+ break;
1642
+ }
1643
+ return _context9.a(2, null);
1644
+ case 4:
1645
+ _context9.p = 4;
1646
+ return _context9.a(2, JSON.parse(text));
1647
+ case 5:
1648
+ _context9.p = 5;
1649
+ _context9.v;
1650
+ return _context9.a(2, text);
1651
+ }
1652
+ }, _callee9, null, [[4, 5]]);
1653
+ }));
1654
+ return _parseResponseBody.apply(this, arguments);
1655
+ }
1656
+ var BaseApiClient = /*#__PURE__*/function () {
1657
+ /**
1658
+ * 构造函数
1659
+ * @param {string} modulePath - 模块路径,如 '/auth', '/points', '/wallet'
1660
+ * @param {Object} config - 配置选项
1661
+ * @param {string} config.baseUrl - 自定义基础 URL(覆盖全局配置)
1662
+ * @param {number} config.timeout - 自定义超时时间(毫秒)
1663
+ * @param {number} config.maxRetries - 最大重试次数(默认 0 不重试)
1664
+ * @param {number} config.retryDelay - 重试间隔基数毫秒(默认 1000,指数退避)
1665
+ * @param {Function} config.onError - 错误回调
1666
+ * @param {Function} config.getLanguage - 获取语言的函数
1667
+ */
1668
+ function BaseApiClient() {
1669
+ var _this = this;
1670
+ var modulePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1671
+ var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1672
+ _classCallCheck(this, BaseApiClient);
1673
+ this.modulePath = modulePath;
1674
+ this._customBaseUrl = config.baseUrl;
1675
+ this._customTimeout = config.timeout;
1676
+ this.maxRetries = config.maxRetries || 0;
1677
+ this.retryDelay = config.retryDelay || 1000;
1678
+ this.token = null;
1679
+ this.onError = config.onError;
1680
+ this.getLanguage = config.getLanguage || function () {
1681
+ return 'zh';
1682
+ };
1683
+
1684
+ // 从全局配置初始化
1685
+ this._updateFromGlobalConfig(getConfig());
1686
+
1687
+ // 订阅配置变更(使用 WeakRef 避免内存泄漏)
1688
+ if (typeof WeakRef !== 'undefined') {
1689
+ var weakSelf = new WeakRef(this);
1690
+ var unsubscribe;
1691
+ var listener = function listener(newConfig) {
1692
+ var self = weakSelf.deref();
1693
+ if (self) {
1694
+ self._updateFromGlobalConfig(newConfig);
1695
+ } else if (unsubscribe) {
1696
+ unsubscribe();
1697
+ }
1698
+ };
1699
+ unsubscribe = subscribeConfig(listener);
1700
+ this._unsubscribe = unsubscribe;
1701
+ } else {
1702
+ this._unsubscribe = subscribeConfig(function (newConfig) {
1703
+ _this._updateFromGlobalConfig(newConfig);
1704
+ });
1705
+ }
1706
+ }
1707
+
1708
+ /**
1709
+ * 从全局配置更新本地配置
1710
+ * @private
1711
+ */
1712
+ return _createClass(BaseApiClient, [{
1713
+ key: "_updateFromGlobalConfig",
1714
+ value: function _updateFromGlobalConfig(globalConfig) {
1715
+ // 只有未自定义时才使用全局配置
1716
+ if (!this._customBaseUrl) {
1717
+ var base = globalConfig.apiBaseUrl || '/api/v1';
1718
+ var isAbsolute = /^https?:\/\//i.test(base);
1719
+ var isServer = typeof window === 'undefined';
1720
+ if (!isAbsolute && isServer) {
1721
+ // 如果是 Server 端或 Node.js 环境,将相对路径补全为完整品牌域名路径
1722
+ var fullUrl = globalConfig.apiFullUrl || 'https://api.qbitchain.io';
1723
+ base = joinUrlSegments(fullUrl, base);
1724
+ }
1725
+ this.baseUrl = joinUrlSegments(base, this.modulePath);
1726
+ } else {
1727
+ this.baseUrl = joinUrlSegments(this._customBaseUrl, '');
1728
+ }
1729
+ if (!this._customTimeout) {
1730
+ this.timeout = globalConfig.timeout || 30000;
1731
+ } else {
1732
+ this.timeout = this._customTimeout;
1733
+ }
1734
+ }
1735
+
1736
+ /**
1737
+ * 设置 Token
1738
+ * @param {string} token - 访问令牌
1739
+ */
1740
+ }, {
1741
+ key: "setToken",
1742
+ value: function setToken(token) {
1743
+ this.token = token;
1744
+ }
1745
+
1746
+ /**
1747
+ * 设置基础 URL
1748
+ * @param {string} url - 新的基础 URL
1749
+ */
1750
+ }, {
1751
+ key: "setBaseUrl",
1752
+ value: function setBaseUrl(url) {
1753
+ this._customBaseUrl = url;
1754
+ this.baseUrl = joinUrlSegments(url, '');
1755
+ }
1756
+
1757
+ /**
1758
+ * 获取当前使用的 Token
1759
+ * 优先使用实例 Token,否则从存储获取
1760
+ * @returns {string|null}
1761
+ */
1762
+ }, {
1763
+ key: "getToken",
1764
+ value: function getToken() {
1765
+ return this.token || _getToken();
1766
+ }
1767
+
1768
+ /**
1769
+ * 发送 HTTP 请求
1770
+ * @param {string} endpoint - API 端点(相对于 baseUrl)
1771
+ * @param {Object} options - fetch 选项
1772
+ * @returns {Promise<any>} 响应数据
1773
+ */
1774
+ }, {
1775
+ key: "request",
1776
+ value: (function () {
1777
+ var _request = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(endpoint) {
1778
+ var options,
1779
+ url,
1780
+ retryCount,
1781
+ headers,
1782
+ token,
1783
+ controller,
1784
+ timeoutId,
1785
+ response,
1786
+ delay,
1787
+ data,
1788
+ _this$onError,
1789
+ errorMsg,
1790
+ _errorMsg$,
1791
+ _errorMsg$2,
1792
+ error,
1793
+ _this$onError2,
1794
+ timeoutError,
1795
+ _this$onError3,
1796
+ _delay,
1797
+ networkError,
1798
+ _args = arguments,
1799
+ _t;
1800
+ return _regenerator().w(function (_context) {
1801
+ while (1) switch (_context.p = _context.n) {
1802
+ case 0:
1803
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
1804
+ url = "".concat(this.baseUrl).concat(endpoint);
1805
+ retryCount = options._retryCount || 0; // 构建请求头
1806
+ headers = _objectSpread2({
1807
+ 'Content-Type': 'application/json',
1808
+ 'Accept-Language': this.getLanguage()
1809
+ }, options.headers); // 添加认证头
1810
+ token = this.getToken();
1811
+ if (token) {
1812
+ headers['Authorization'] = "Bearer ".concat(token);
1813
+ }
1814
+
1815
+ // 超时控制
1816
+ controller = new AbortController();
1817
+ timeoutId = setTimeout(function () {
1818
+ return controller.abort();
1819
+ }, this.timeout);
1820
+ _context.p = 1;
1821
+ _context.n = 2;
1822
+ return fetch(url, _objectSpread2(_objectSpread2({}, options), {}, {
1823
+ headers: headers,
1824
+ signal: controller.signal
1825
+ }));
1826
+ case 2:
1827
+ response = _context.v;
1828
+ clearTimeout(timeoutId);
1829
+
1830
+ // 5xx 服务端错误 — 可重试
1831
+ if (!(response.status >= 500 && retryCount < this.maxRetries)) {
1832
+ _context.n = 4;
1833
+ break;
1834
+ }
1835
+ delay = this.retryDelay * Math.pow(2, retryCount);
1836
+ logger.warn("".concat(this.constructor.name, " 5xx error, retrying in ").concat(delay, "ms... (").concat(retryCount + 1, "/").concat(this.maxRetries, ")"));
1837
+ _context.n = 3;
1838
+ return new Promise(function (r) {
1839
+ return setTimeout(r, delay);
1840
+ });
1841
+ case 3:
1842
+ return _context.a(2, this.request(endpoint, _objectSpread2(_objectSpread2({}, options), {}, {
1843
+ _retryCount: retryCount + 1
1844
+ })));
1845
+ case 4:
1846
+ _context.n = 5;
1847
+ return parseResponseBody(response);
1848
+ case 5:
1849
+ data = _context.v;
1850
+ if (response.ok) {
1851
+ _context.n = 6;
1852
+ break;
1853
+ }
1854
+ errorMsg = (data && _typeof(data) === 'object' ? data.message || data.detail : null) || (typeof data === 'string' ? data : null);
1855
+ if (Array.isArray(errorMsg)) {
1856
+ errorMsg = ((_errorMsg$ = errorMsg[0]) === null || _errorMsg$ === void 0 ? void 0 : _errorMsg$.msg) || ((_errorMsg$2 = errorMsg[0]) === null || _errorMsg$2 === void 0 ? void 0 : _errorMsg$2.message) || JSON.stringify(errorMsg);
1857
+ } else if (_typeof(errorMsg) === 'object' && errorMsg !== null) {
1858
+ errorMsg = errorMsg.msg || errorMsg.message || JSON.stringify(errorMsg);
1859
+ }
1860
+ error = new Error(errorMsg || "HTTP ".concat(response.status));
1861
+ error.code = (data === null || data === void 0 ? void 0 : data.code) || "HTTP_".concat(response.status);
1862
+ error.status = response.status;
1863
+ error.data = data;
1864
+ (_this$onError = this.onError) === null || _this$onError === void 0 || _this$onError.call(this, error);
1865
+ logger.error("".concat(this.constructor.name, " Error:"), error.message);
1866
+ throw error;
1867
+ case 6:
1868
+ return _context.a(2, data);
1869
+ case 7:
1870
+ _context.p = 7;
1871
+ _t = _context.v;
1872
+ clearTimeout(timeoutId);
1873
+
1874
+ // 处理超时错误
1875
+ if (!(_t.name === 'AbortError')) {
1876
+ _context.n = 8;
1877
+ break;
1878
+ }
1879
+ timeoutError = new Error('Request timeout');
1880
+ timeoutError.code = 'TIMEOUT';
1881
+ (_this$onError2 = this.onError) === null || _this$onError2 === void 0 || _this$onError2.call(this, timeoutError);
1882
+ throw timeoutError;
1883
+ case 8:
1884
+ if (!(_t.name === 'TypeError' && _t.message.includes('fetch'))) {
1885
+ _context.n = 11;
1886
+ break;
1887
+ }
1888
+ if (!(retryCount < this.maxRetries)) {
1889
+ _context.n = 10;
1890
+ break;
1891
+ }
1892
+ _delay = this.retryDelay * Math.pow(2, retryCount);
1893
+ logger.warn("".concat(this.constructor.name, " Network error, retrying in ").concat(_delay, "ms..."));
1894
+ _context.n = 9;
1895
+ return new Promise(function (r) {
1896
+ return setTimeout(r, _delay);
1897
+ });
1898
+ case 9:
1899
+ return _context.a(2, this.request(endpoint, _objectSpread2(_objectSpread2({}, options), {}, {
1900
+ _retryCount: retryCount + 1
1901
+ })));
1902
+ case 10:
1903
+ networkError = new Error('Network error');
1904
+ networkError.code = 'NETWORK_ERROR';
1905
+ (_this$onError3 = this.onError) === null || _this$onError3 === void 0 || _this$onError3.call(this, networkError);
1906
+ throw networkError;
1907
+ case 11:
1908
+ throw _t;
1909
+ case 12:
1910
+ return _context.a(2);
1911
+ }
1912
+ }, _callee, this, [[1, 7]]);
1913
+ }));
1914
+ function request(_x2) {
1915
+ return _request.apply(this, arguments);
1916
+ }
1917
+ return request;
1918
+ }()
1919
+ /**
1920
+ * GET 请求便捷方法
1921
+ * @param {string} endpoint - API 端点
1922
+ * @param {Object} params - 查询参数
1923
+ */
1924
+ )
1925
+ }, {
1926
+ key: "get",
1927
+ value: (function () {
1928
+ var _get = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(endpoint) {
1929
+ var params,
1930
+ query,
1931
+ url,
1932
+ _args2 = arguments;
1933
+ return _regenerator().w(function (_context2) {
1934
+ while (1) switch (_context2.n) {
1935
+ case 0:
1936
+ params = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
1937
+ query = new URLSearchParams(params).toString();
1938
+ url = query ? "".concat(endpoint, "?").concat(query) : endpoint;
1939
+ return _context2.a(2, this.request(url, {
1940
+ method: 'GET'
1941
+ }));
1942
+ }
1943
+ }, _callee2, this);
1944
+ }));
1945
+ function get(_x3) {
1946
+ return _get.apply(this, arguments);
1947
+ }
1948
+ return get;
1949
+ }()
1950
+ /**
1951
+ * POST 请求便捷方法
1952
+ * @param {string} endpoint - API 端点
1953
+ * @param {Object} data - 请求体数据
1954
+ */
1955
+ )
1956
+ }, {
1957
+ key: "post",
1958
+ value: (function () {
1959
+ var _post = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(endpoint) {
1960
+ var data,
1961
+ _args3 = arguments;
1962
+ return _regenerator().w(function (_context3) {
1963
+ while (1) switch (_context3.n) {
1964
+ case 0:
1965
+ data = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
1966
+ return _context3.a(2, this.request(endpoint, {
1967
+ method: 'POST',
1968
+ body: JSON.stringify(data)
1969
+ }));
1970
+ }
1971
+ }, _callee3, this);
1972
+ }));
1973
+ function post(_x4) {
1974
+ return _post.apply(this, arguments);
1975
+ }
1976
+ return post;
1977
+ }()
1978
+ /**
1979
+ * PUT 请求便捷方法
1980
+ * @param {string} endpoint - API 端点
1981
+ * @param {Object} data - 请求体数据
1982
+ */
1983
+ )
1984
+ }, {
1985
+ key: "put",
1986
+ value: (function () {
1987
+ var _put = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(endpoint) {
1988
+ var data,
1989
+ _args4 = arguments;
1990
+ return _regenerator().w(function (_context4) {
1991
+ while (1) switch (_context4.n) {
1992
+ case 0:
1993
+ data = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
1994
+ return _context4.a(2, this.request(endpoint, {
1995
+ method: 'PUT',
1996
+ body: JSON.stringify(data)
1997
+ }));
1998
+ }
1999
+ }, _callee4, this);
2000
+ }));
2001
+ function put(_x5) {
2002
+ return _put.apply(this, arguments);
2003
+ }
2004
+ return put;
2005
+ }()
2006
+ /**
2007
+ * DELETE 请求便捷方法
2008
+ * @param {string} endpoint - API 端点
2009
+ * @param {Object} data - 请求体数据(可选)
2010
+ */
2011
+ )
2012
+ }, {
2013
+ key: "delete",
2014
+ value: (function () {
2015
+ var _delete2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(endpoint) {
2016
+ var data,
2017
+ options,
2018
+ _args5 = arguments;
2019
+ return _regenerator().w(function (_context5) {
2020
+ while (1) switch (_context5.n) {
2021
+ case 0:
2022
+ data = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : null;
2023
+ options = {
2024
+ method: 'DELETE'
2025
+ };
2026
+ if (data) {
2027
+ options.body = JSON.stringify(data);
2028
+ }
2029
+ return _context5.a(2, this.request(endpoint, options));
2030
+ }
2031
+ }, _callee5, this);
2032
+ }));
2033
+ function _delete(_x6) {
2034
+ return _delete2.apply(this, arguments);
2035
+ }
2036
+ return _delete;
2037
+ }()
2038
+ /**
2039
+ * PATCH 请求便捷方法
2040
+ * @param {string} endpoint - API 端点
2041
+ * @param {Object} data - 请求体数据
2042
+ */
2043
+ )
2044
+ }, {
2045
+ key: "patch",
2046
+ value: (function () {
2047
+ var _patch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(endpoint) {
2048
+ var data,
2049
+ _args6 = arguments;
2050
+ return _regenerator().w(function (_context6) {
2051
+ while (1) switch (_context6.n) {
2052
+ case 0:
2053
+ data = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
2054
+ return _context6.a(2, this.request(endpoint, {
2055
+ method: 'PATCH',
2056
+ body: JSON.stringify(data)
2057
+ }));
2058
+ }
2059
+ }, _callee6, this);
2060
+ }));
2061
+ function patch(_x7) {
2062
+ return _patch.apply(this, arguments);
2063
+ }
2064
+ return patch;
2065
+ }()
2066
+ /**
2067
+ * 销毁实例,取消配置订阅
2068
+ */
2069
+ )
2070
+ }, {
2071
+ key: "destroy",
2072
+ value: function destroy() {
2073
+ if (this._unsubscribe) {
2074
+ this._unsubscribe();
2075
+ this._unsubscribe = null;
2076
+ }
2077
+ }
2078
+ }]);
2079
+ }();
2080
+
2081
+ /**
2082
+ * @quantabit/sdk-config - ConsentManager
2083
+ *
2084
+ * 全局隐私同意管理器
2085
+ * 统一管理所有 SDK 的数据采集同意状态
2086
+ *
2087
+ * 隐私等级:
2088
+ * - essential: 核心功能(无需同意,如认证、安全)
2089
+ * - functional: 功能增强(如语言偏好、主题设置)
2090
+ * - analytics: 数据分析(如页面浏览、点击追踪)
2091
+ * - marketing: 营销推广(如广告追踪、再营销)
2092
+ *
2093
+ * 合规标准: GDPR, CCPA, ePrivacy
2094
+ */
2095
+
2096
+ // ============ 隐私等级定义 ============
2097
+
2098
+ var PrivacyLevel = {
2099
+ ESSENTIAL: 'essential',
2100
+ // 核心必需 — 不可关闭
2101
+ FUNCTIONAL: 'functional',
2102
+ // 功能性 — 可选
2103
+ ANALYTICS: 'analytics',
2104
+ // 数据分析 — 需同意
2105
+ MARKETING: 'marketing' // 营销追踪 — 需同意
2106
+ };
2107
+
2108
+ // ============ 同意状态 ============
2109
+
2110
+ var ConsentStatus = {
2111
+ UNKNOWN: 'unknown',
2112
+ // 用户尚未做出选择
2113
+ GRANTED: 'granted',
2114
+ // 用户已同意
2115
+ DENIED: 'denied',
2116
+ // 用户已拒绝
2117
+ WITHDRAWN: 'withdrawn' // 用户撤回同意
2118
+ };
2119
+
2120
+ // ============ 存储键 ============
2121
+
2122
+ var CONSENT_STORAGE_KEY = 'qbit_privacy_consent';
2123
+ var CONSENT_TIMESTAMP_KEY = 'qbit_privacy_consent_ts';
2124
+ var CONSENT_VERSION_KEY = 'qbit_privacy_consent_ver';
2125
+
2126
+ // 当前隐私政策版本 — 版本变更时会要求用户重新同意
2127
+ var CURRENT_PRIVACY_VERSION = '1.0.0';
2128
+
2129
+ // ============ ConsentManager ============
2130
+ var ConsentManagerClass = /*#__PURE__*/function () {
2131
+ function ConsentManagerClass() {
2132
+ _classCallCheck(this, ConsentManagerClass);
2133
+ this._consent = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, PrivacyLevel.ESSENTIAL, ConsentStatus.GRANTED), PrivacyLevel.FUNCTIONAL, ConsentStatus.UNKNOWN), PrivacyLevel.ANALYTICS, ConsentStatus.UNKNOWN), PrivacyLevel.MARKETING, ConsentStatus.UNKNOWN);
2134
+ this._listeners = new Set();
2135
+ this._initialized = false;
2136
+ this._blockedCallbacks = new Map(); // SDK 名称 -> 被阻塞的回调列表
2137
+ }
2138
+
2139
+ /**
2140
+ * 初始化同意管理器
2141
+ * 从 localStorage 恢复已保存的同意状态
2142
+ */
2143
+ return _createClass(ConsentManagerClass, [{
2144
+ key: "init",
2145
+ value: function init() {
2146
+ if (this._initialized) return this;
2147
+
2148
+ // 初始化审计日志
2149
+ this._auditLog = [];
2150
+ if (typeof window !== 'undefined') {
2151
+ try {
2152
+ // 检查 GPC (Global Privacy Control) 信号 — CCPA §999.315
2153
+ if (navigator.globalPrivacyControl === true) {
2154
+ logger.info('[ConsentManager] GPC 信号检测到 — 自动拒绝非必要追踪');
2155
+ this._consent[PrivacyLevel.ANALYTICS] = ConsentStatus.DENIED;
2156
+ this._consent[PrivacyLevel.MARKETING] = ConsentStatus.DENIED;
2157
+ this._consent[PrivacyLevel.FUNCTIONAL] = ConsentStatus.GRANTED; // GPC 不影响功能性
2158
+ this._gpcDetected = true;
2159
+ this._persistConsent();
2160
+ this._addAuditEntry('gpc_detected', 'analytics,marketing auto-denied by GPC signal');
2161
+ this._initialized = true;
2162
+ return this;
2163
+ }
2164
+
2165
+ // 检查隐私政策版本是否变更
2166
+ var savedVersion = localStorage.getItem(CONSENT_VERSION_KEY);
2167
+ if (savedVersion !== CURRENT_PRIVACY_VERSION) {
2168
+ // 隐私政策更新,需要用户重新同意
2169
+ logger.info('隐私政策版本已更新,需要重新同意');
2170
+ this._addAuditEntry('policy_version_change', "".concat(savedVersion, " \u2192 ").concat(CURRENT_PRIVACY_VERSION));
2171
+ this._clearStoredConsent();
2172
+ } else {
2173
+ // 恢复已保存的同意状态
2174
+ var saved = localStorage.getItem(CONSENT_STORAGE_KEY);
2175
+ if (saved) {
2176
+ var parsed = JSON.parse(saved);
2177
+ Object.assign(this._consent, parsed);
2178
+ // 核心同意永远保持
2179
+ this._consent[PrivacyLevel.ESSENTIAL] = ConsentStatus.GRANTED;
2180
+ }
2181
+ }
2182
+ } catch (e) {
2183
+ logger.warn('无法恢复隐私同意状态:', e);
2184
+ }
2185
+ }
2186
+ this._initialized = true;
2187
+ return this;
2188
+ }
2189
+
2190
+ /**
2191
+ * 获取指定等级的同意状态
2192
+ * @param {string} level - 隐私等级
2193
+ * @returns {string} 同意状态
2194
+ */
2195
+ }, {
2196
+ key: "getConsent",
2197
+ value: function getConsent(level) {
2198
+ return this._consent[level] || ConsentStatus.UNKNOWN;
2199
+ }
2200
+
2201
+ /**
2202
+ * 获取所有同意状态
2203
+ * @returns {object} 完整的同意状态对象
2204
+ */
2205
+ }, {
2206
+ key: "getAllConsent",
2207
+ value: function getAllConsent() {
2208
+ return _objectSpread2({}, this._consent);
2209
+ }
2210
+
2211
+ /**
2212
+ * 检查是否已同意指定等级
2213
+ * @param {string} level - 隐私等级
2214
+ * @returns {boolean}
2215
+ */
2216
+ }, {
2217
+ key: "hasConsent",
2218
+ value: function hasConsent(level) {
2219
+ if (level === PrivacyLevel.ESSENTIAL) return true;
2220
+ return this._consent[level] === ConsentStatus.GRANTED;
2221
+ }
2222
+
2223
+ /**
2224
+ * 检查用户是否已做出选择(非 unknown 状态)
2225
+ * @returns {boolean}
2226
+ */
2227
+ }, {
2228
+ key: "hasUserDecided",
2229
+ value: function hasUserDecided() {
2230
+ var _this2 = this;
2231
+ return Object.keys(this._consent).filter(function (k) {
2232
+ return k !== PrivacyLevel.ESSENTIAL;
2233
+ }).some(function (k) {
2234
+ return _this2._consent[k] !== ConsentStatus.UNKNOWN;
2235
+ });
2236
+ }
2237
+
2238
+ /**
2239
+ * 设置同意状态
2240
+ * @param {string} level - 隐私等级
2241
+ * @param {boolean} granted - 是否同意
2242
+ */
2243
+ }, {
2244
+ key: "setConsent",
2245
+ value: function setConsent(level, granted) {
2246
+ if (level === PrivacyLevel.ESSENTIAL) {
2247
+ logger.warn('核心功能同意不能被修改');
2248
+ return;
2249
+ }
2250
+ var newStatus = granted ? ConsentStatus.GRANTED : ConsentStatus.DENIED;
2251
+ var oldStatus = this._consent[level];
2252
+ this._consent[level] = newStatus;
2253
+
2254
+ // 持久化
2255
+ this._persistConsent();
2256
+
2257
+ // 审计日志
2258
+ this._addAuditEntry('consent_change', "".concat(level, ": ").concat(oldStatus, " \u2192 ").concat(newStatus));
2259
+
2260
+ // 通知监听器
2261
+ this._notifyListeners(level, newStatus, oldStatus);
2262
+
2263
+ // 如果同意了,执行被阻塞的回调
2264
+ if (granted) {
2265
+ this._executeBlockedCallbacks(level);
2266
+ }
2267
+ logger.info("\u9690\u79C1\u540C\u610F\u5DF2\u66F4\u65B0: ".concat(level, " = ").concat(newStatus));
2268
+ }
2269
+
2270
+ /**
2271
+ * 接受所有
2272
+ */
2273
+ }, {
2274
+ key: "acceptAll",
2275
+ value: function acceptAll() {
2276
+ var _this3 = this;
2277
+ [PrivacyLevel.FUNCTIONAL, PrivacyLevel.ANALYTICS, PrivacyLevel.MARKETING].forEach(function (level) {
2278
+ _this3._consent[level] = ConsentStatus.GRANTED;
2279
+ });
2280
+ this._persistConsent();
2281
+ this._notifyListeners('all', ConsentStatus.GRANTED);
2282
+
2283
+ // 执行所有被阻塞的回调
2284
+ for (var _i = 0, _Object$keys = Object.keys(this._consent); _i < _Object$keys.length; _i++) {
2285
+ var level = _Object$keys[_i];
2286
+ this._executeBlockedCallbacks(level);
2287
+ }
2288
+ logger.info('用户已接受所有隐私同意');
2289
+ }
2290
+
2291
+ /**
2292
+ * 仅接受必需项
2293
+ */
2294
+ }, {
2295
+ key: "acceptEssentialOnly",
2296
+ value: function acceptEssentialOnly() {
2297
+ var _this4 = this;
2298
+ [PrivacyLevel.FUNCTIONAL, PrivacyLevel.ANALYTICS, PrivacyLevel.MARKETING].forEach(function (level) {
2299
+ _this4._consent[level] = ConsentStatus.DENIED;
2300
+ });
2301
+ this._persistConsent();
2302
+ this._notifyListeners('all', ConsentStatus.DENIED);
2303
+ logger.info('用户仅接受必要隐私同意');
2304
+ }
2305
+
2306
+ /**
2307
+ * 撤回所有同意
2308
+ */
2309
+ }, {
2310
+ key: "withdrawAll",
2311
+ value: function withdrawAll() {
2312
+ var _this5 = this;
2313
+ [PrivacyLevel.FUNCTIONAL, PrivacyLevel.ANALYTICS, PrivacyLevel.MARKETING].forEach(function (level) {
2314
+ _this5._consent[level] = ConsentStatus.WITHDRAWN;
2315
+ });
2316
+ this._persistConsent();
2317
+ this._notifyListeners('all', ConsentStatus.WITHDRAWN);
2318
+ logger.info('用户已撤回所有隐私同意');
2319
+ }
2320
+
2321
+ /**
2322
+ * 在获得同意后执行回调
2323
+ * 如果已同意则立即执行,否则挂起等待同意
2324
+ *
2325
+ * @param {string} level - 所需的隐私等级
2326
+ * @param {function} callback - 回调函数
2327
+ * @param {string} sdkName - SDK 标识 (用于调试)
2328
+ */
2329
+ }, {
2330
+ key: "withConsent",
2331
+ value: function withConsent(level, callback) {
2332
+ var sdkName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'unknown';
2333
+ if (this.hasConsent(level)) {
2334
+ callback();
2335
+ } else {
2336
+ // 挂起回调,等待同意
2337
+ if (!this._blockedCallbacks.has(level)) {
2338
+ this._blockedCallbacks.set(level, []);
2339
+ }
2340
+ this._blockedCallbacks.get(level).push({
2341
+ callback: callback,
2342
+ sdkName: sdkName
2343
+ });
2344
+ logger.debug("[".concat(sdkName, "] \u529F\u80FD\u5DF2\u6302\u8D77\uFF0C\u7B49\u5F85 ").concat(level, " \u9690\u79C1\u540C\u610F"));
2345
+ }
2346
+ }
2347
+
2348
+ /**
2349
+ * 订阅同意变更
2350
+ * @param {function} listener - (level, newStatus, oldStatus) => void
2351
+ * @returns {function} 取消订阅函数
2352
+ */
2353
+ }, {
2354
+ key: "subscribe",
2355
+ value: function subscribe(listener) {
2356
+ var _this6 = this;
2357
+ this._listeners.add(listener);
2358
+ return function () {
2359
+ return _this6._listeners["delete"](listener);
2360
+ };
2361
+ }
2362
+
2363
+ /**
2364
+ * 按隐私等级订阅同意变更
2365
+ * 比 subscribe 更精准 — 只在指定等级变更时触发
2366
+ *
2367
+ * @param {string} level - 隐私等级 (analytics/functional/marketing)
2368
+ * @param {function} callback - (granted: boolean) => void
2369
+ * @returns {function} 取消订阅函数
2370
+ *
2371
+ * @example
2372
+ * consentManager.onConsentChange('analytics', (granted) => {
2373
+ * if (granted) startTracking();
2374
+ * else stopTracking();
2375
+ * });
2376
+ */
2377
+ }, {
2378
+ key: "onConsentChange",
2379
+ value: function onConsentChange(level, callback) {
2380
+ var _this7 = this;
2381
+ var wrapper = function wrapper(changedLevel, newStatus) {
2382
+ // 精确匹配 或 全局变更(acceptAll/withdrawAll)
2383
+ if (changedLevel === level || changedLevel === 'all') {
2384
+ var granted = changedLevel === 'all' ? _this7.hasConsent(level) : newStatus === ConsentStatus.GRANTED;
2385
+ try {
2386
+ callback(granted);
2387
+ } catch (e) {
2388
+ logger.error("[ConsentManager] onConsentChange \u56DE\u8C03\u9519\u8BEF (".concat(level, "):"), e);
2389
+ }
2390
+ }
2391
+ };
2392
+ this._listeners.add(wrapper);
2393
+ return function () {
2394
+ return _this7._listeners["delete"](wrapper);
2395
+ };
2396
+ }
2397
+
2398
+ /**
2399
+ * 获取隐私摘要 — 用于展示给用户
2400
+ * @returns {object}
2401
+ */
2402
+ }, {
2403
+ key: "getPrivacySummary",
2404
+ value: function getPrivacySummary() {
2405
+ return {
2406
+ version: CURRENT_PRIVACY_VERSION,
2407
+ consent: this.getAllConsent(),
2408
+ decided: this.hasUserDecided(),
2409
+ timestamp: typeof window !== 'undefined' ? localStorage.getItem(CONSENT_TIMESTAMP_KEY) : null,
2410
+ categories: _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, PrivacyLevel.ESSENTIAL, {
2411
+ label: 'Essential',
2412
+ labelZh: '核心必需',
2413
+ description: 'Required for basic functionality like security and authentication.',
2414
+ descriptionZh: '安全认证等基础功能所必需,不可关闭。',
2415
+ required: true
2416
+ }), PrivacyLevel.FUNCTIONAL, {
2417
+ label: 'Functional',
2418
+ labelZh: '功能增强',
2419
+ description: 'Enables enhanced features like language preferences and theme settings.',
2420
+ descriptionZh: '语言偏好、主题设置等功能增强。',
2421
+ required: false
2422
+ }), PrivacyLevel.ANALYTICS, {
2423
+ label: 'Analytics',
2424
+ labelZh: '数据分析',
2425
+ description: 'Helps us understand usage patterns to improve the product.',
2426
+ descriptionZh: '帮助我们了解使用模式以改进产品。',
2427
+ required: false
2428
+ }), PrivacyLevel.MARKETING, {
2429
+ label: 'Marketing',
2430
+ labelZh: '营销推广',
2431
+ description: 'Used for personalized content and advertising.',
2432
+ descriptionZh: '用于个性化内容和广告推送。',
2433
+ required: false
2434
+ })
2435
+ };
2436
+ }
2437
+
2438
+ // ============ 内部方法 ============
2439
+ }, {
2440
+ key: "_persistConsent",
2441
+ value: function _persistConsent() {
2442
+ if (typeof window === 'undefined') return;
2443
+ try {
2444
+ localStorage.setItem(CONSENT_STORAGE_KEY, JSON.stringify(this._consent));
2445
+ localStorage.setItem(CONSENT_TIMESTAMP_KEY, new Date().toISOString());
2446
+ localStorage.setItem(CONSENT_VERSION_KEY, CURRENT_PRIVACY_VERSION);
2447
+ } catch (e) {
2448
+ logger.warn('无法持久化隐私同意:', e);
2449
+ }
2450
+ }
2451
+ }, {
2452
+ key: "_clearStoredConsent",
2453
+ value: function _clearStoredConsent() {
2454
+ if (typeof window === 'undefined') return;
2455
+ try {
2456
+ localStorage.removeItem(CONSENT_STORAGE_KEY);
2457
+ localStorage.removeItem(CONSENT_TIMESTAMP_KEY);
2458
+ localStorage.removeItem(CONSENT_VERSION_KEY);
2459
+ } catch (e) {/* ignore */}
2460
+ }
2461
+ }, {
2462
+ key: "_notifyListeners",
2463
+ value: function _notifyListeners(level, newStatus, oldStatus) {
2464
+ this._listeners.forEach(function (listener) {
2465
+ try {
2466
+ listener(level, newStatus, oldStatus);
2467
+ } catch (e) {
2468
+ logger.error('隐私同意监听器执行错误:', e);
2469
+ }
2470
+ });
2471
+
2472
+ // 触发全局事件
2473
+ if (typeof window !== 'undefined') {
2474
+ try {
2475
+ window.dispatchEvent(new CustomEvent('qbit:consent-change', {
2476
+ detail: {
2477
+ level: level,
2478
+ status: newStatus,
2479
+ previousStatus: oldStatus
2480
+ }
2481
+ }));
2482
+ } catch (e) {/* ignore */}
2483
+ }
2484
+ }
2485
+ }, {
2486
+ key: "_executeBlockedCallbacks",
2487
+ value: function _executeBlockedCallbacks(level) {
2488
+ var callbacks = this._blockedCallbacks.get(level) || [];
2489
+ callbacks.forEach(function (_ref3) {
2490
+ var callback = _ref3.callback,
2491
+ sdkName = _ref3.sdkName;
2492
+ try {
2493
+ logger.debug("[".concat(sdkName, "] \u540C\u610F\u5DF2\u83B7\u5F97\uFF0C\u6267\u884C\u6302\u8D77\u7684\u529F\u80FD"));
2494
+ callback();
2495
+ } catch (e) {
2496
+ logger.error("[".concat(sdkName, "] \u6302\u8D77\u56DE\u8C03\u6267\u884C\u9519\u8BEF:"), e);
2497
+ }
2498
+ });
2499
+ this._blockedCallbacks["delete"](level);
2500
+ }
2501
+
2502
+ // ============ 审计日志 ============
2503
+
2504
+ /**
2505
+ * 添加审计条目
2506
+ * @param {string} action - 操作类型
2507
+ * @param {string} detail - 详细信息
2508
+ * @private
2509
+ */
2510
+ }, {
2511
+ key: "_addAuditEntry",
2512
+ value: function _addAuditEntry(action, detail) {
2513
+ if (!this._auditLog) this._auditLog = [];
2514
+ this._auditLog.push({
2515
+ action: action,
2516
+ detail: detail,
2517
+ timestamp: new Date().toISOString(),
2518
+ consent: _objectSpread2({}, this._consent)
2519
+ });
2520
+ // 保留最近 50 条
2521
+ if (this._auditLog.length > 50) {
2522
+ this._auditLog = this._auditLog.slice(-50);
2523
+ }
2524
+ }
2525
+
2526
+ /**
2527
+ * 获取同意审计日志 — 用于 GDPR 数据导出
2528
+ * @returns {Array} 审计条目
2529
+ */
2530
+ }, {
2531
+ key: "getConsentLog",
2532
+ value: function getConsentLog() {
2533
+ return this._auditLog || [];
2534
+ }
2535
+
2536
+ /**
2537
+ * 是否检测到 GPC 信号
2538
+ * @returns {boolean}
2539
+ */
2540
+ }, {
2541
+ key: "isGPCDetected",
2542
+ get: function get() {
2543
+ return this._gpcDetected === true;
2544
+ }
2545
+
2546
+ /**
2547
+ * 是否检测到 DNT 信号
2548
+ * @returns {boolean}
2549
+ */
2550
+ }, {
2551
+ key: "isDNTDetected",
2552
+ get: function get() {
2553
+ if (typeof navigator === 'undefined') return false;
2554
+ return navigator.doNotTrack === '1' || navigator.doNotTrack === 'yes';
2555
+ }
2556
+ }]);
2557
+ }(); // ============ 单例导出 ============
2558
+ var consentManager = new ConsentManagerClass();
2559
+
2560
+ /**
2561
+ * @quantabit/sdk-config - DataSanitizer
2562
+ *
2563
+ * 数据脱敏工具
2564
+ * 自动检测和脱敏 PII (个人身份信息)
2565
+ * 用于日志、错误报告、分析数据中的隐私保护
2566
+ */
2567
+
2568
+ // ============ PII 检测模式 ============
2569
+
2570
+ var PII_PATTERNS = {
2571
+ // 邮箱地址
2572
+ email: {
2573
+ regex: /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,
2574
+ mask: function mask(match) {
2575
+ var _match$split = match.split('@'),
2576
+ _match$split2 = _slicedToArray(_match$split, 2),
2577
+ local = _match$split2[0],
2578
+ domain = _match$split2[1];
2579
+ return "".concat(local[0], "***@").concat(domain);
2580
+ }
2581
+ },
2582
+ // 手机号码 (国际格式)
2583
+ phone: {
2584
+ regex: /(\+?\d{1,4}[-.\s]?)?\(?\d{2,4}\)?[-.\s]?\d{3,4}[-.\s]?\d{3,4}/g,
2585
+ mask: function mask(match) {
2586
+ var digits = match.replace(/\D/g, '');
2587
+ if (digits.length < 7) return match; // 太短不是手机号
2588
+ return "".concat(digits.slice(0, 3), "****").concat(digits.slice(-4));
2589
+ }
2590
+ },
2591
+ // 身份证号 (中国)
2592
+ idCard: {
2593
+ regex: /\d{6}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[0-9Xx]/g,
2594
+ mask: function mask(match) {
2595
+ return "".concat(match.slice(0, 6), "********").concat(match.slice(-4));
2596
+ }
2597
+ },
2598
+ // 钱包地址 (Ethereum-style)
2599
+ walletAddress: {
2600
+ regex: /0x[a-fA-F0-9]{40}/g,
2601
+ mask: function mask(match) {
2602
+ return "".concat(match.slice(0, 6), "...").concat(match.slice(-4));
2603
+ }
2604
+ },
2605
+ // IP 地址
2606
+ ipAddress: {
2607
+ regex: /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g,
2608
+ mask: function mask(match) {
2609
+ var parts = match.split('.');
2610
+ return "".concat(parts[0], ".").concat(parts[1], ".*.*");
2611
+ }
2612
+ },
2613
+ // JWT Token
2614
+ jwtToken: {
2615
+ regex: /eyJ[a-zA-Z0-9_-]+\.eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/g,
2616
+ mask: function mask() {
2617
+ return '[REDACTED_TOKEN]';
2618
+ }
2619
+ },
2620
+ // API Key patterns
2621
+ apiKey: {
2622
+ regex: /(api[_-]?key|apikey|secret|password|token|auth)[=:]\s*['"]?([a-zA-Z0-9_\-./+]{20,})['"]?/gi,
2623
+ mask: function mask(match) {
2624
+ var colonIdx = match.indexOf(':');
2625
+ var equalIdx = match.indexOf('=');
2626
+ var sepIdx = colonIdx >= 0 ? colonIdx : equalIdx;
2627
+ var key = match.slice(0, sepIdx + 1);
2628
+ return "".concat(key, " [REDACTED]");
2629
+ }
2630
+ },
2631
+ // 信用卡号 (Visa/MC/Amex 等常见格式)
2632
+ creditCard: {
2633
+ regex: /\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})\b/g,
2634
+ mask: function mask(match) {
2635
+ return "****-****-****-".concat(match.slice(-4));
2636
+ }
2637
+ },
2638
+ // DID (去中心化身份标识符)
2639
+ did: {
2640
+ regex: /did:[a-z]+:[a-zA-Z0-9._%-]+/g,
2641
+ mask: function mask(match) {
2642
+ var parts = match.split(':');
2643
+ if (parts.length >= 3) {
2644
+ var id = parts[2];
2645
+ return "".concat(parts[0], ":").concat(parts[1], ":").concat(id.slice(0, 6), "...").concat(id.slice(-4));
2646
+ }
2647
+ return "".concat(match.slice(0, 12), "...");
2648
+ }
2649
+ },
2650
+ // SSN (美国社会安全号)
2651
+ ssn: {
2652
+ regex: /\b\d{3}-\d{2}-\d{4}\b/g,
2653
+ mask: function mask() {
2654
+ return '***-**-****';
2655
+ }
2656
+ }
2657
+ };
2658
+
2659
+ // ============ 敏感字段名 ============
2660
+
2661
+ var SENSITIVE_FIELDS = new Set(['password', 'passwd', 'secret', 'token', 'accessToken', 'refreshToken', 'access_token', 'refresh_token', 'api_key', 'apiKey', 'privateKey', 'private_key', 'ssn', 'socialSecurityNumber', 'creditCard', 'credit_card', 'cardNumber', 'card_number', 'cvv', 'pin', 'otp', 'mnemonic', 'seed', 'seedPhrase', 'seed_phrase', 'idNumber', 'id_number', 'passport',
2662
+ // Web3 / DeFi 扩展
2663
+ 'keystore', 'encryptedKey', 'encrypted_key', 'recoveryPhrase', 'recovery_phrase', 'walletSeed', 'wallet_seed', 'derivationPath', 'derivation_path', 'secretKey', 'secret_key', 'signingKey', 'signing_key',
2664
+ // 支付安全
2665
+ 'cardCvv', 'card_cvv', 'securityCode', 'security_code', 'expiryDate', 'expiry_date', 'paymentPassword', 'payment_password']);
2666
+
2667
+ // ============ DataSanitizer ============
2668
+ var DataSanitizerClass = /*#__PURE__*/function () {
2669
+ function DataSanitizerClass() {
2670
+ _classCallCheck(this, DataSanitizerClass);
2671
+ this._customRules = [];
2672
+ this._whitelistFields = new Set();
2673
+ }
2674
+
2675
+ /**
2676
+ * 脱敏文本内容 — 自动检测并掩码 PII
2677
+ * @param {string} text - 原始文本
2678
+ * @param {string[]} types - 要检测的 PII 类型 (默认全部)
2679
+ * @returns {string} 脱敏后的文本
2680
+ */
2681
+ return _createClass(DataSanitizerClass, [{
2682
+ key: "sanitizeText",
2683
+ value: function sanitizeText(text) {
2684
+ var types = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2685
+ if (typeof text !== 'string') return text;
2686
+ var result = text;
2687
+ var patterns = types ? Object.entries(PII_PATTERNS).filter(function (_ref4) {
2688
+ var _ref5 = _slicedToArray(_ref4, 1),
2689
+ key = _ref5[0];
2690
+ return types.includes(key);
2691
+ }) : Object.entries(PII_PATTERNS);
2692
+ var _iterator = _createForOfIteratorHelper(patterns),
2693
+ _step;
2694
+ try {
2695
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2696
+ var _step$value = _slicedToArray(_step.value, 2),
2697
+ _step$value$ = _step$value[1],
2698
+ regex = _step$value$.regex,
2699
+ mask = _step$value$.mask;
2700
+ // 因为 regex 有 /g 标志,需要重置 lastIndex
2701
+ regex.lastIndex = 0;
2702
+ result = result.replace(regex, mask);
2703
+ }
2704
+
2705
+ // 应用自定义规则
2706
+ } catch (err) {
2707
+ _iterator.e(err);
2708
+ } finally {
2709
+ _iterator.f();
2710
+ }
2711
+ var _iterator2 = _createForOfIteratorHelper(this._customRules),
2712
+ _step2;
2713
+ try {
2714
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
2715
+ var rule = _step2.value;
2716
+ rule.regex.lastIndex = 0;
2717
+ result = result.replace(rule.regex, rule.mask);
2718
+ }
2719
+ } catch (err) {
2720
+ _iterator2.e(err);
2721
+ } finally {
2722
+ _iterator2.f();
2723
+ }
2724
+ return result;
2725
+ }
2726
+
2727
+ /**
2728
+ * 脱敏对象 — 递归处理所有字段
2729
+ * @param {object} obj - 原始对象
2730
+ * @param {object} options - 选项
2731
+ * @returns {object} 脱敏后的深拷贝对象
2732
+ */
2733
+ }, {
2734
+ key: "sanitizeObject",
2735
+ value: function sanitizeObject(obj) {
2736
+ var _this8 = this;
2737
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2738
+ if (obj === null || obj === undefined) return obj;
2739
+ if (_typeof(obj) !== 'object') return obj;
2740
+ if (Array.isArray(obj)) {
2741
+ return obj.map(function (item) {
2742
+ return _this8.sanitizeObject(item, options);
2743
+ });
2744
+ }
2745
+ var maxDepth = options.maxDepth || 10;
2746
+ var currentDepth = options._currentDepth || 0;
2747
+ if (currentDepth >= maxDepth) {
2748
+ return '[MAX_DEPTH_REACHED]';
2749
+ }
2750
+ var result = {};
2751
+ for (var _i2 = 0, _Object$entries = Object.entries(obj); _i2 < _Object$entries.length; _i2++) {
2752
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
2753
+ key = _Object$entries$_i[0],
2754
+ value = _Object$entries$_i[1];
2755
+ // 白名单字段跳过
2756
+ if (this._whitelistFields.has(key)) {
2757
+ result[key] = value;
2758
+ continue;
2759
+ }
2760
+
2761
+ // 检查是否为敏感字段
2762
+ if (SENSITIVE_FIELDS.has(key) || SENSITIVE_FIELDS.has(key.toLowerCase())) {
2763
+ result[key] = typeof value === 'string' && value.length > 0 ? '[REDACTED]' : value;
2764
+ continue;
2765
+ }
2766
+
2767
+ // 递归处理对象
2768
+ if (_typeof(value) === 'object' && value !== null) {
2769
+ result[key] = this.sanitizeObject(value, _objectSpread2(_objectSpread2({}, options), {}, {
2770
+ _currentDepth: currentDepth + 1
2771
+ }));
2772
+ } else if (typeof value === 'string') {
2773
+ result[key] = this.sanitizeText(value);
2774
+ } else {
2775
+ result[key] = value;
2776
+ }
2777
+ }
2778
+ return result;
2779
+ }
2780
+
2781
+ /**
2782
+ * 脱敏 URL — 移除查询参数中的敏感信息
2783
+ * @param {string} url - 原始 URL
2784
+ * @returns {string} 脱敏后的 URL
2785
+ */
2786
+ }, {
2787
+ key: "sanitizeUrl",
2788
+ value: function sanitizeUrl(url) {
2789
+ if (typeof url !== 'string') return url;
2790
+ try {
2791
+ var parsed = new URL(url, 'https://placeholder.com');
2792
+ var sensitiveParams = ['token', 'key', 'secret', 'password', 'auth', 'api_key', 'access_token'];
2793
+ for (var _i3 = 0, _sensitiveParams = sensitiveParams; _i3 < _sensitiveParams.length; _i3++) {
2794
+ var param = _sensitiveParams[_i3];
2795
+ if (parsed.searchParams.has(param)) {
2796
+ parsed.searchParams.set(param, '[REDACTED]');
2797
+ }
2798
+ }
2799
+
2800
+ // 如果原始 URL 是相对路径
2801
+ if (!url.startsWith('http')) {
2802
+ return parsed.pathname + parsed.search + parsed.hash;
2803
+ }
2804
+ return parsed.toString();
2805
+ } catch (_unused) {
2806
+ // URL 解析失败,使用文本脱敏
2807
+ return this.sanitizeText(url);
2808
+ }
2809
+ }
2810
+
2811
+ /**
2812
+ * 创建安全的日志对象
2813
+ * 用于错误报告和审计日志
2814
+ *
2815
+ * @param {object} data - 原始数据
2816
+ * @returns {object} 安全的日志数据
2817
+ */
2818
+ }, {
2819
+ key: "createSafeLogEntry",
2820
+ value: function createSafeLogEntry(data) {
2821
+ return this.sanitizeObject(data);
2822
+ }
2823
+
2824
+ /**
2825
+ * 添加自定义脱敏规则
2826
+ * @param {string} name - 规则名称
2827
+ * @param {RegExp} regex - 匹配正则 (必须有 /g 标志)
2828
+ * @param {function} mask - 掩码函数 (match) => maskedString
2829
+ */
2830
+ }, {
2831
+ key: "addRule",
2832
+ value: function addRule(name, regex, mask) {
2833
+ this._customRules.push({
2834
+ name: name,
2835
+ regex: regex,
2836
+ mask: mask
2837
+ });
2838
+ }
2839
+
2840
+ /**
2841
+ * 添加白名单字段 — 这些字段不会被脱敏
2842
+ * @param {string[]} fields - 字段名列表
2843
+ */
2844
+ }, {
2845
+ key: "addWhitelist",
2846
+ value: function addWhitelist(fields) {
2847
+ var _this9 = this;
2848
+ fields.forEach(function (f) {
2849
+ return _this9._whitelistFields.add(f);
2850
+ });
2851
+ }
2852
+
2853
+ /**
2854
+ * 匿名化用户数据
2855
+ * 用于分析统计时的数据处理
2856
+ *
2857
+ * @param {object} userData - 用户数据
2858
+ * @returns {object} 匿名化后的数据
2859
+ */
2860
+ }, {
2861
+ key: "anonymize",
2862
+ value: function anonymize(userData) {
2863
+ if (!userData || _typeof(userData) !== 'object') return userData;
2864
+ var anonymized = _objectSpread2({}, userData);
2865
+
2866
+ // 替换直接标识符
2867
+ if (anonymized.email) anonymized.email = this._hashString(anonymized.email);
2868
+ if (anonymized.phone) anonymized.phone = this._hashString(anonymized.phone);
2869
+ if (anonymized.name) delete anonymized.name;
2870
+ if (anonymized.realName) delete anonymized.realName;
2871
+ if (anonymized.real_name) delete anonymized.real_name;
2872
+ if (anonymized.address) delete anonymized.address;
2873
+ if (anonymized.ip) anonymized.ip = this._anonymizeIp(anonymized.ip);
2874
+ if (anonymized.walletAddress) {
2875
+ anonymized.walletAddress = anonymized.walletAddress.slice(0, 6) + '...';
2876
+ }
2877
+
2878
+ // 保留非标识性数据用于分析
2879
+ // 如:国家、语言、设备类型、浏览器类型等
2880
+
2881
+ return anonymized;
2882
+ }
2883
+
2884
+ // ============ 内部方法 ============
2885
+
2886
+ /**
2887
+ * 简单哈希 — 用于匿名化(非加密安全)
2888
+ */
2889
+ }, {
2890
+ key: "_hashString",
2891
+ value: function _hashString(str) {
2892
+ var hash = 0;
2893
+ for (var i = 0; i < str.length; i++) {
2894
+ var _char = str.charCodeAt(i);
2895
+ hash = (hash << 5) - hash + _char;
2896
+ hash = hash & hash; // Convert to 32bit integer
2897
+ }
2898
+ return "anon_".concat(Math.abs(hash).toString(36));
2899
+ }
2900
+ }, {
2901
+ key: "_anonymizeIp",
2902
+ value: function _anonymizeIp(ip) {
2903
+ if (typeof ip !== 'string') return ip;
2904
+ var parts = ip.split('.');
2905
+ if (parts.length === 4) {
2906
+ return "".concat(parts[0], ".").concat(parts[1], ".0.0");
2907
+ }
2908
+ return ip;
2909
+ }
2910
+
2911
+ /**
2912
+ * 一键日志脱敏 — 所有 SDK 通用的日志安全输出
2913
+ * 自动检测并脱敏 PII、Token、API Key 等敏感数据
2914
+ *
2915
+ * @param {...*} args - 任意数量的日志参数
2916
+ * @returns {string[]} 脱敏后的日志参数数组
2917
+ *
2918
+ * @example
2919
+ * // 替代 console.log(user.email, token)
2920
+ * console.log(...dataSanitizer.sanitizeForLogging(user.email, token));
2921
+ */
2922
+ }, {
2923
+ key: "sanitizeForLogging",
2924
+ value: function sanitizeForLogging() {
2925
+ var _this0 = this;
2926
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2927
+ args[_key2] = arguments[_key2];
2928
+ }
2929
+ return args.map(function (arg) {
2930
+ if (typeof arg === 'string') {
2931
+ return _this0.sanitizeText(arg);
2932
+ }
2933
+ if (arg && _typeof(arg) === 'object') {
2934
+ try {
2935
+ return JSON.parse(JSON.stringify(arg, function (key, value) {
2936
+ if (typeof value === 'string') {
2937
+ return _this0.sanitizeText(value);
2938
+ }
2939
+ // 脱敏常见敏感字段名
2940
+ var sensitiveKeys = ['password', 'secret', 'token', 'apiKey', 'api_key', 'authorization', 'cookie', 'session', 'private_key', 'mnemonic', 'seed', 'passphrase'];
2941
+ if (sensitiveKeys.includes(key.toLowerCase())) {
2942
+ return '[REDACTED]';
2943
+ }
2944
+ return value;
2945
+ }));
2946
+ } catch (_unused2) {
2947
+ return '[Object - sanitize failed]';
2948
+ }
2949
+ }
2950
+ return arg;
2951
+ });
2952
+ }
2953
+
2954
+ /**
2955
+ * 完全移除所有 PII — GDPR 数据删除场景
2956
+ * 比 sanitizeText 更激进,直接替换为占位符
2957
+ *
2958
+ * @param {*} data - 任意数据
2959
+ * @returns {*} PII 完全移除后的数据
2960
+ */
2961
+ }, {
2962
+ key: "redactAllPII",
2963
+ value: function redactAllPII(data) {
2964
+ var _this1 = this;
2965
+ if (typeof data === 'string') {
2966
+ var result = data;
2967
+ for (var _i4 = 0, _Object$values = Object.values(PII_PATTERNS); _i4 < _Object$values.length; _i4++) {
2968
+ var regex = _Object$values[_i4].regex;
2969
+ var freshRegex = new RegExp(regex.source, regex.flags);
2970
+ result = result.replace(freshRegex, '[PII_REMOVED]');
2971
+ }
2972
+ return result;
2973
+ }
2974
+ if (Array.isArray(data)) {
2975
+ return data.map(function (item) {
2976
+ return _this1.redactAllPII(item);
2977
+ });
2978
+ }
2979
+ if (data && _typeof(data) === 'object') {
2980
+ var _result = {};
2981
+ for (var _i5 = 0, _Object$entries2 = Object.entries(data); _i5 < _Object$entries2.length; _i5++) {
2982
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i5], 2),
2983
+ key = _Object$entries2$_i[0],
2984
+ value = _Object$entries2$_i[1];
2985
+ _result[key] = this.redactAllPII(value);
2986
+ }
2987
+ return _result;
2988
+ }
2989
+ return data;
2990
+ }
2991
+ }]);
2992
+ }(); // ============ 单例导出 ============
2993
+ new DataSanitizerClass();
2994
+
2995
+ /**
2996
+ * Privacy Orchestrator — 统一隐私合规编排器
2997
+ *
2998
+ * 跨所有 SDK 的一站式隐私操作:
2999
+ * - 一键数据删除 (GDPR 第17条: 被遗忘权)
3000
+ * - 一键数据导出 (GDPR 第20条: 数据可携带性)
3001
+ * - 统一同意管理
3002
+ * - 全平台数据声明
3003
+ *
3004
+ * 使用场景:
3005
+ * import { privacyOrchestrator } from '@quantabit/sdk-config';
3006
+ * await privacyOrchestrator.deleteAllUserData(); // GDPR 数据删除
3007
+ * const exportData = await privacyOrchestrator.exportAllUserData(); // 数据导出
3008
+ */
3009
+
3010
+ /**
3011
+ * 隐私编排器
3012
+ */
3013
+ var PrivacyOrchestratorClass = /*#__PURE__*/function () {
3014
+ function PrivacyOrchestratorClass() {
3015
+ _classCallCheck(this, PrivacyOrchestratorClass);
3016
+ // 注册的 SDK 清理器
3017
+ this._cleaners = new Map();
3018
+ // 注册的 SDK 数据导出器
3019
+ this._exporters = new Map();
3020
+ // 注册的 SDK 数据声明
3021
+ this._disclosures = new Map();
3022
+ }
3023
+
3024
+ /**
3025
+ * 注册 SDK 的隐私操作
3026
+ * 各 SDK 在初始化时调用此方法注册自己的隐私处理函数
3027
+ *
3028
+ * @param {string} sdkName - SDK 名称
3029
+ * @param {object} handlers - 隐私处理器
3030
+ * @param {function} handlers.clean - 数据清理函数 (应返回 boolean)
3031
+ * @param {function} handlers.export - 数据导出函数 (应返回 object)
3032
+ * @param {function} handlers.getDisclosure - 数据声明函数
3033
+ */
3034
+ return _createClass(PrivacyOrchestratorClass, [{
3035
+ key: "register",
3036
+ value: function register(sdkName) {
3037
+ var handlers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3038
+ if (handlers.clean) this._cleaners.set(sdkName, handlers.clean);
3039
+ if (handlers["export"]) this._exporters.set(sdkName, handlers["export"]);
3040
+ if (handlers.getDisclosure) this._disclosures.set(sdkName, handlers.getDisclosure);
3041
+ }
3042
+
3043
+ /**
3044
+ * 注销 SDK
3045
+ */
3046
+ }, {
3047
+ key: "unregister",
3048
+ value: function unregister(sdkName) {
3049
+ this._cleaners["delete"](sdkName);
3050
+ this._exporters["delete"](sdkName);
3051
+ this._disclosures["delete"](sdkName);
3052
+ }
3053
+
3054
+ /**
3055
+ * 一键删除所有用户数据 — GDPR 第17条: 被遗忘权
3056
+ * 调用所有已注册 SDK 的数据清理函数
3057
+ *
3058
+ * @returns {Promise<object>} 每个 SDK 的清理结果
3059
+ */
3060
+ }, {
3061
+ key: "deleteAllUserData",
3062
+ value: (function () {
3063
+ var _deleteAllUserData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
3064
+ var results, errors, _iterator3, _step3, _step3$value, sdkName, cleanFn, result, _t2, _t3;
3065
+ return _regenerator().w(function (_context7) {
3066
+ while (1) switch (_context7.p = _context7.n) {
3067
+ case 0:
3068
+ results = {};
3069
+ errors = [];
3070
+ _iterator3 = _createForOfIteratorHelper(this._cleaners);
3071
+ _context7.p = 1;
3072
+ _iterator3.s();
3073
+ case 2:
3074
+ if ((_step3 = _iterator3.n()).done) {
3075
+ _context7.n = 7;
3076
+ break;
3077
+ }
3078
+ _step3$value = _slicedToArray(_step3.value, 2), sdkName = _step3$value[0], cleanFn = _step3$value[1];
3079
+ _context7.p = 3;
3080
+ _context7.n = 4;
3081
+ return cleanFn();
3082
+ case 4:
3083
+ result = _context7.v;
3084
+ results[sdkName] = {
3085
+ success: true,
3086
+ result: result
3087
+ };
3088
+ _context7.n = 6;
3089
+ break;
3090
+ case 5:
3091
+ _context7.p = 5;
3092
+ _t2 = _context7.v;
3093
+ results[sdkName] = {
3094
+ success: false,
3095
+ error: _t2.message
3096
+ };
3097
+ errors.push({
3098
+ sdk: sdkName,
3099
+ error: _t2.message
3100
+ });
3101
+ case 6:
3102
+ _context7.n = 2;
3103
+ break;
3104
+ case 7:
3105
+ _context7.n = 9;
3106
+ break;
3107
+ case 8:
3108
+ _context7.p = 8;
3109
+ _t3 = _context7.v;
3110
+ _iterator3.e(_t3);
3111
+ case 9:
3112
+ _context7.p = 9;
3113
+ _iterator3.f();
3114
+ return _context7.f(9);
3115
+ case 10:
3116
+ // 清除通用 localStorage 数据
3117
+ this._clearGenericLocalStorage();
3118
+
3119
+ // 撤销所有同意
3120
+ consentManager.init();
3121
+ consentManager.acceptEssentialOnly();
3122
+ return _context7.a(2, {
3123
+ timestamp: new Date().toISOString(),
3124
+ action: 'delete_all_user_data',
3125
+ gdprArticle: 'Art. 17 - Right to erasure',
3126
+ sdkResults: results,
3127
+ errors: errors,
3128
+ localStorageCleared: true,
3129
+ consentReset: true
3130
+ });
3131
+ }
3132
+ }, _callee7, this, [[3, 5], [1, 8, 9, 10]]);
3133
+ }));
3134
+ function deleteAllUserData() {
3135
+ return _deleteAllUserData.apply(this, arguments);
3136
+ }
3137
+ return deleteAllUserData;
3138
+ }()
3139
+ /**
3140
+ * 一键导出所有用户数据 — GDPR 第20条: 数据可携带性
3141
+ * 调用所有已注册 SDK 的数据导出函数
3142
+ *
3143
+ * @param {object} options - 导出选项
3144
+ * @param {string} options.format - 导出格式 (json/csv)
3145
+ * @returns {Promise<object>} 合并的导出数据
3146
+ */
3147
+ )
3148
+ }, {
3149
+ key: "exportAllUserData",
3150
+ value: (function () {
3151
+ var _exportAllUserData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
3152
+ var _consentManager$getCo;
3153
+ var options,
3154
+ exportData,
3155
+ _iterator4,
3156
+ _step4,
3157
+ _step4$value,
3158
+ sdkName,
3159
+ exportFn,
3160
+ data,
3161
+ _args8 = arguments,
3162
+ _t4,
3163
+ _t5;
3164
+ return _regenerator().w(function (_context8) {
3165
+ while (1) switch (_context8.p = _context8.n) {
3166
+ case 0:
3167
+ options = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
3168
+ exportData = {
3169
+ exportDate: new Date().toISOString(),
3170
+ format: 'QBit Platform Data Export (GDPR Art. 20)',
3171
+ platform: 'QuantaBit',
3172
+ sdkData: {},
3173
+ errors: []
3174
+ };
3175
+ _iterator4 = _createForOfIteratorHelper(this._exporters);
3176
+ _context8.p = 1;
3177
+ _iterator4.s();
3178
+ case 2:
3179
+ if ((_step4 = _iterator4.n()).done) {
3180
+ _context8.n = 7;
3181
+ break;
3182
+ }
3183
+ _step4$value = _slicedToArray(_step4.value, 2), sdkName = _step4$value[0], exportFn = _step4$value[1];
3184
+ _context8.p = 3;
3185
+ _context8.n = 4;
3186
+ return exportFn(options);
3187
+ case 4:
3188
+ data = _context8.v;
3189
+ exportData.sdkData[sdkName] = data;
3190
+ _context8.n = 6;
3191
+ break;
3192
+ case 5:
3193
+ _context8.p = 5;
3194
+ _t4 = _context8.v;
3195
+ exportData.errors.push({
3196
+ sdk: sdkName,
3197
+ error: _t4.message
3198
+ });
3199
+ case 6:
3200
+ _context8.n = 2;
3201
+ break;
3202
+ case 7:
3203
+ _context8.n = 9;
3204
+ break;
3205
+ case 8:
3206
+ _context8.p = 8;
3207
+ _t5 = _context8.v;
3208
+ _iterator4.e(_t5);
3209
+ case 9:
3210
+ _context8.p = 9;
3211
+ _iterator4.f();
3212
+ return _context8.f(9);
3213
+ case 10:
3214
+ // 添加同意记录
3215
+ exportData.consentHistory = ((_consentManager$getCo = consentManager.getConsentLog) === null || _consentManager$getCo === void 0 ? void 0 : _consentManager$getCo.call(consentManager)) || 'Not available';
3216
+ return _context8.a(2, exportData);
3217
+ }
3218
+ }, _callee8, this, [[3, 5], [1, 8, 9, 10]]);
3219
+ }));
3220
+ function exportAllUserData() {
3221
+ return _exportAllUserData.apply(this, arguments);
3222
+ }
3223
+ return exportAllUserData;
3224
+ }()
3225
+ /**
3226
+ * 获取全平台数据使用声明
3227
+ * 汇总所有 SDK 的数据收集声明
3228
+ *
3229
+ * @returns {object} 统一的数据声明
3230
+ */
3231
+ )
3232
+ }, {
3233
+ key: "getFullDataDisclosure",
3234
+ value: function getFullDataDisclosure() {
3235
+ var disclosure = {
3236
+ platform: 'QuantaBit',
3237
+ lastUpdated: new Date().toISOString(),
3238
+ sdks: {},
3239
+ consentLevels: {
3240
+ essential: '核心安全功能(身份验证、防欺诈),无需同意。',
3241
+ functional: '增强体验(推送通知、钱包功能),需要用户同意。',
3242
+ analytics: '使用分析和行为追踪,需要用户明确同意。',
3243
+ marketing: '营销和广告定向,需要用户明确同意。'
3244
+ }
3245
+ };
3246
+ var _iterator5 = _createForOfIteratorHelper(this._disclosures),
3247
+ _step5;
3248
+ try {
3249
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
3250
+ var _step5$value = _slicedToArray(_step5.value, 2),
3251
+ sdkName = _step5$value[0],
3252
+ disclosureFn = _step5$value[1];
3253
+ try {
3254
+ disclosure.sdks[sdkName] = disclosureFn();
3255
+ } catch (e) {
3256
+ disclosure.sdks[sdkName] = {
3257
+ error: e.message
3258
+ };
3259
+ }
3260
+ }
3261
+ } catch (err) {
3262
+ _iterator5.e(err);
3263
+ } finally {
3264
+ _iterator5.f();
3265
+ }
3266
+ return disclosure;
3267
+ }
3268
+
3269
+ /**
3270
+ * 撤销所有同意并停止所有追踪
3271
+ */
3272
+ }, {
3273
+ key: "revokeAllConsent",
3274
+ value: function revokeAllConsent() {
3275
+ consentManager.init();
3276
+ consentManager.acceptEssentialOnly();
3277
+ return {
3278
+ success: true,
3279
+ timestamp: new Date().toISOString()
3280
+ };
3281
+ }
3282
+
3283
+ /**
3284
+ * 获取已注册的 SDK 数量
3285
+ */
3286
+ }, {
3287
+ key: "registeredSDKs",
3288
+ get: function get() {
3289
+ return {
3290
+ cleaners: _toConsumableArray(this._cleaners.keys()),
3291
+ exporters: _toConsumableArray(this._exporters.keys()),
3292
+ disclosures: _toConsumableArray(this._disclosures.keys())
3293
+ };
3294
+ }
3295
+
3296
+ /**
3297
+ * 清除通用 localStorage 数据
3298
+ * @private
3299
+ */
3300
+ }, {
3301
+ key: "_clearGenericLocalStorage",
3302
+ value: function _clearGenericLocalStorage() {
3303
+ if (typeof localStorage === 'undefined') return;
3304
+ var prefixes = ['qbit_', 'im_', 'tracking_', 'analytics_', 'wallet_', 'push_', 'notification_'];
3305
+ var keysToRemove = [];
3306
+ var _loop = function _loop() {
3307
+ var key = localStorage.key(i);
3308
+ if (key && prefixes.some(function (prefix) {
3309
+ return key.startsWith(prefix);
3310
+ })) {
3311
+ keysToRemove.push(key);
3312
+ }
3313
+ };
3314
+ for (var i = 0; i < localStorage.length; i++) {
3315
+ _loop();
3316
+ }
3317
+ keysToRemove.forEach(function (key) {
3318
+ return localStorage.removeItem(key);
3319
+ });
3320
+ }
3321
+
3322
+ // ============ 自动注册辅助 ============
3323
+
3324
+ /**
3325
+ * 从 SDK 实例自动注册隐私处理器
3326
+ * SDK 只需实现 clearAllUserData/exportXxxData/getDataDisclosure 任一方法即可
3327
+ *
3328
+ * @param {string} sdkName - SDK 名称
3329
+ * @param {object} instance - SDK 实例
3330
+ *
3331
+ * @example
3332
+ * // 在 SDK 初始化时自动注册
3333
+ * privacyOrchestrator.registerFromInstance('search-sdk', searchApi);
3334
+ */
3335
+ }, {
3336
+ key: "registerFromInstance",
3337
+ value: function registerFromInstance(sdkName, instance) {
3338
+ var handlers = {};
3339
+
3340
+ // 自动检测清理方法
3341
+ var cleanMethods = ['clearAllUserData', 'clearData', 'clearLocal', 'gdprClear'];
3342
+ var _loop2 = function _loop2() {
3343
+ var method = _cleanMethods[_i6];
3344
+ if (typeof instance[method] === 'function') {
3345
+ handlers.clean = function () {
3346
+ return instance[method]();
3347
+ };
3348
+ return 1; // break
3349
+ }
3350
+ };
3351
+ for (var _i6 = 0, _cleanMethods = cleanMethods; _i6 < _cleanMethods.length; _i6++) {
3352
+ if (_loop2()) break;
3353
+ }
3354
+
3355
+ // 自动检测导出方法
3356
+ var exportMethods = ['exportMyData', 'exportSearchData', 'exportPushData', 'exportPaymentData', 'exportKycData', 'exportChatData', 'exportData'];
3357
+ var _loop3 = function _loop3() {
3358
+ var method = _exportMethods[_i7];
3359
+ if (typeof instance[method] === 'function') {
3360
+ handlers["export"] = function (opts) {
3361
+ return instance[method](opts);
3362
+ };
3363
+ return 1; // break
3364
+ }
3365
+ };
3366
+ for (var _i7 = 0, _exportMethods = exportMethods; _i7 < _exportMethods.length; _i7++) {
3367
+ if (_loop3()) break;
3368
+ }
3369
+
3370
+ // 自动检测声明方法
3371
+ if (typeof instance.getDataDisclosure === 'function') {
3372
+ handlers.getDisclosure = function () {
3373
+ return instance.getDataDisclosure();
3374
+ };
3375
+ }
3376
+ if (Object.keys(handlers).length > 0) {
3377
+ this.register(sdkName, handlers);
3378
+ }
3379
+ }
3380
+
3381
+ /**
3382
+ * 批量注册多个 SDK
3383
+ * @param {Object<string, object>} sdkMap - { sdkName: instance }
3384
+ */
3385
+ }, {
3386
+ key: "registerBatch",
3387
+ value: function registerBatch(sdkMap) {
3388
+ for (var _i8 = 0, _Object$entries3 = Object.entries(sdkMap); _i8 < _Object$entries3.length; _i8++) {
3389
+ var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i8], 2),
3390
+ name = _Object$entries3$_i[0],
3391
+ instance = _Object$entries3$_i[1];
3392
+ this.registerFromInstance(name, instance);
3393
+ }
3394
+ }
3395
+ }]);
3396
+ }();
3397
+ new PrivacyOrchestratorClass();
3398
+
3399
+ /**
3400
+ * @quantabit/sdk-config
3401
+ *
3402
+ * QuantaBit SDK Unified Config
3403
+ *
3404
+ * All SDKs share this config - single point of modification for global effect:
3405
+ * - API base URL
3406
+ * - Timeout
3407
+ * - Auth configuration
3408
+ * - Debug mode
3409
+ *
3410
+ * Usage:
3411
+ * 1. Use default configuration directly
3412
+ * import { getConfig } from '@quantabit/sdk-config';
3413
+ * const config = getConfig();
3414
+ *
3415
+ * 2. Initialize config at app startup
3416
+ * import { initConfig } from '@quantabit/sdk-config';
3417
+ * initConfig({ apiBaseUrl: 'https://api.example.com' });
3418
+ *
3419
+ * 3. 使用 React Hook
3420
+ * import { useSDKConfig } from '@quantabit/sdk-config';
3421
+ * const { config, setApiBaseUrl } = useSDKConfig();
3422
+ */
3423
+
3424
+ // ============ 默认配置 ============
3425
+
3426
+ /**
3427
+ * 默认 API 配置
3428
+ * 注意:生产环境应通过 initConfig 覆盖这些值
3429
+ */
3430
+ var DEFAULT_CONFIG = {
3431
+ // === API 配置 ===
3432
+ apiBaseUrl: '/api/v1',
3433
+ // API 基础路径(相对路径,由后端代理)
3434
+ apiFullUrl: typeof process !== 'undefined' && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.QBIT_API_URL) || (typeof window !== 'undefined' && (_window$location = window.location) !== null && _window$location !== void 0 && (_window$location = _window$location.origin) !== null && _window$location !== void 0 && _window$location.includes('dev') ? 'https://api.dev.qbitchain.io' : 'https://api.qbitchain.io'),
3435
+ // 完整 API URL Fallback 品牌域名
3436
+
3437
+ // === 超时配置 ===
3438
+ timeout: 30000,
3439
+ // 请求超时(毫秒)
3440
+ retryCount: 3,
3441
+ // 重试次数
3442
+ retryDelay: 1000,
3443
+ // 重试延迟(毫秒)
3444
+
3445
+ // === Auth configuration ===
3446
+ tokenStorageKey: 'qbit_did_access_token',
3447
+ refreshTokenStorageKey: 'qbit_did_refresh_token',
3448
+ currentSessionKey: 'qbit_did_current',
3449
+ autoRefreshToken: true,
3450
+ // 自动刷新 Token
3451
+
3452
+ // === WebSocket 配置 ===
3453
+ wsBaseUrl: '',
3454
+ // WebSocket URL(需通过 initConfig 配置)
3455
+ wsReconnect: true,
3456
+ wsReconnectInterval: 3000,
3457
+ // === 收银台配置 ===
3458
+ checkoutUrl: typeof process !== 'undefined' && ((_process$env2 = process.env) === null || _process$env2 === void 0 ? void 0 : _process$env2.CHECKOUT_URL) || 'https://pay.qbitchain.io',
3459
+ checkoutSandboxUrl: typeof process !== 'undefined' && ((_process$env3 = process.env) === null || _process$env3 === void 0 ? void 0 : _process$env3.CHECKOUT_SANDBOX_URL) || 'https://sandbox-pay.qbitchain.io',
3460
+ // === 各子系统入口 URL ===
3461
+ merchantUrl: typeof process !== 'undefined' && ((_process$env4 = process.env) === null || _process$env4 === void 0 ? void 0 : _process$env4.NEXT_PUBLIC_MERCHANT_URL) || 'https://merchant.qbitchain.io',
3462
+ adminUrl: typeof process !== 'undefined' && ((_process$env5 = process.env) === null || _process$env5 === void 0 ? void 0 : _process$env5.NEXT_PUBLIC_ADMIN_URL) || 'https://admin.qbitchain.io',
3463
+ payUrl: typeof process !== 'undefined' && ((_process$env6 = process.env) === null || _process$env6 === void 0 ? void 0 : _process$env6.NEXT_PUBLIC_PAY_URL) || 'https://pay.qbitchain.io',
3464
+ walletUrl: typeof process !== 'undefined' && ((_process$env7 = process.env) === null || _process$env7 === void 0 ? void 0 : _process$env7.NEXT_PUBLIC_WALLET_URL) || 'https://wallet.qbitchain.io',
3465
+ didApiUrl: typeof process !== 'undefined' && ((_process$env8 = process.env) === null || _process$env8 === void 0 ? void 0 : _process$env8.NEXT_PUBLIC_DID_API_URL) || 'https://did.qbitchain.io',
3466
+ // === 调试配置 ===
3467
+ debug: process.env.NODE_ENV !== 'production',
3468
+ logLevel: 'info',
3469
+ // 'debug' | 'info' | 'warn' | 'error'
3470
+
3471
+ // === 环境配置 ===
3472
+ environment: process.env.NODE_ENV || 'development',
3473
+ // === QBit Chain 链配置 ===
3474
+ chainNetwork: 'mainnet',
3475
+ // 当前链网络: 'mainnet' | 'testnet' | 'devnet'
3476
+ chainEndpoint: 'https://api.mainnet.qbitchain.io/',
3477
+ // RPC 端点
3478
+ chainWsEndpoint: 'wss://api.mainnet.qbitchain.io/',
3479
+ // WebSocket RPC 端点
3480
+ chainCommitment: 'confirmed',
3481
+ // 确认级别: 'processed' | 'confirmed' | 'finalized'
3482
+ chainTimeoutMs: 30000,
3483
+ // 链交互超时(毫秒)
3484
+
3485
+ // === 语言配置 ===
3486
+ language: 'zh',
3487
+ // 默认语言
3488
+ fallbackLanguage: 'en',
3489
+ // 回退语言
3490
+ supportedLanguages: ['zh', 'en', 'ja', 'ko'],
3491
+ // Supported Languages
3492
+ languageStorageKey: 'qbit_did_language' // localStorage key
3493
+ };
3494
+
3495
+ // ============ QBit Chain 网络配置 ============
3496
+
3497
+ /**
3498
+ * QBit Chain 规范程序地址(重新创世后与 Solana 规范地址对齐)
3499
+ * 单一来源,供所有 SDK / web 引用,杜绝散落硬编码。
3500
+ * 与 qbit_webs/qbit-chain.config.json 及 configs/qbit_program_registry.json 保持一致。
3501
+ */
3502
+ var CANONICAL_PROGRAMS = {
3503
+ system: '11111111111111111111111111111111',
3504
+ token: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
3505
+ token2022: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',
3506
+ associatedToken: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
3507
+ memo: 'MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr',
3508
+ tokenMetadata: 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s',
3509
+ mplCore: 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d',
3510
+ raydiumCpmm: 'CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C',
3511
+ raydiumCpSwap: 'CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C',
3512
+ // 别名(向后兼容)
3513
+ raydiumAmmV4: '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8',
3514
+ raydiumClmm: 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK',
3515
+ squadsV4: 'SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf',
3516
+ orcaWhirlpool: 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc',
3517
+ openbookV2: 'opnb2LAfJYbRMAHHvqjCwQxanZn7ReEHp1k81EohpZb',
3518
+ mplBubblegum: 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY',
3519
+ mplCandyGuard: 'Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g'
3520
+ };
3521
+
3522
+ /**
3523
+ * QBit 代币 mint(非 program_id)。
3524
+ * ⚠️ XWIN 当前为旧链 mint,重新创世后需在规范 TokenkegQ 下重发并回填新 mint。
3525
+ */
3526
+ var CANONICAL_TOKENS = {
3527
+ wQBT: {
3528
+ mint: 'So11111111111111111111111111111111111111112',
3529
+ decimals: 9,
3530
+ symbol: 'wQBT',
3531
+ name: 'Wrapped QBT'
3532
+ },
3533
+ XWIN: {
3534
+ mint: 'Gw3veigZZ9FYfhixrQkD8hLUGUGq88AbTgnu7Ay3WwBa',
3535
+ decimals: 6,
3536
+ symbol: 'XWIN',
3537
+ name: 'XWIN',
3538
+ status: 'pending_reissue_on_new_genesis'
3539
+ }
3540
+ };
3541
+
3542
+ /**
3543
+ * QBit Chain 网络端点配置
3544
+ * 基于 Solana 改编,RPC 接口完全兼容
3545
+ */
3546
+ var CHAIN_NETWORKS = {
3547
+ mainnet: {
3548
+ rpcEndpoint: 'https://api.mainnet.qbitchain.io/',
3549
+ wsEndpoint: 'wss://api.mainnet.qbitchain.io/',
3550
+ programs: _objectSpread2({}, CANONICAL_PROGRAMS),
3551
+ tokens: _objectSpread2({}, CANONICAL_TOKENS)
3552
+ },
3553
+ testnet: {
3554
+ rpcEndpoint: 'https://api.testnet.qbitchain.io/',
3555
+ wsEndpoint: 'wss://api.testnet.qbitchain.io/',
3556
+ programs: _objectSpread2({}, CANONICAL_PROGRAMS),
3557
+ tokens: _objectSpread2({}, CANONICAL_TOKENS)
3558
+ },
3559
+ devnet: {
3560
+ rpcEndpoint: 'https://api.devnet.qbitchain.io/',
3561
+ wsEndpoint: 'wss://api.devnet.qbitchain.io/',
3562
+ programs: _objectSpread2({}, CANONICAL_PROGRAMS),
3563
+ tokens: _objectSpread2({}, CANONICAL_TOKENS)
3564
+ }
3565
+ };
3566
+
3567
+ // ============ 环境预设 ============
3568
+
3569
+ /**
3570
+ * 环境预设配置
3571
+ * 快速切换不同环境的配置
3572
+ */
3573
+ var ENVIRONMENT_PRESETS = {
3574
+ development: {
3575
+ apiBaseUrl: '/api/v1',
3576
+ apiFullUrl: '',
3577
+ wsBaseUrl: '',
3578
+ chainNetwork: 'devnet',
3579
+ chainEndpoint: CHAIN_NETWORKS.devnet.rpcEndpoint,
3580
+ chainWsEndpoint: CHAIN_NETWORKS.devnet.wsEndpoint,
3581
+ debug: true,
3582
+ logLevel: 'debug',
3583
+ merchantUrl: typeof process !== 'undefined' && ((_process$env9 = process.env) === null || _process$env9 === void 0 ? void 0 : _process$env9.NEXT_PUBLIC_MERCHANT_URL) || 'http://localhost:3501',
3584
+ adminUrl: typeof process !== 'undefined' && ((_process$env0 = process.env) === null || _process$env0 === void 0 ? void 0 : _process$env0.NEXT_PUBLIC_ADMIN_URL) || 'http://localhost:3400',
3585
+ payUrl: typeof process !== 'undefined' && ((_process$env1 = process.env) === null || _process$env1 === void 0 ? void 0 : _process$env1.NEXT_PUBLIC_PAY_URL) || 'http://localhost:3502',
3586
+ walletUrl: typeof process !== 'undefined' && ((_process$env10 = process.env) === null || _process$env10 === void 0 ? void 0 : _process$env10.NEXT_PUBLIC_WALLET_URL) || 'http://localhost:3503',
3587
+ didApiUrl: typeof process !== 'undefined' && ((_process$env11 = process.env) === null || _process$env11 === void 0 ? void 0 : _process$env11.NEXT_PUBLIC_DID_API_URL) || 'http://localhost:8102'
3588
+ },
3589
+ staging: {
3590
+ apiBaseUrl: '/api/v1',
3591
+ apiFullUrl: '',
3592
+ wsBaseUrl: '',
3593
+ chainNetwork: 'testnet',
3594
+ chainEndpoint: CHAIN_NETWORKS.testnet.rpcEndpoint,
3595
+ chainWsEndpoint: CHAIN_NETWORKS.testnet.wsEndpoint,
3596
+ debug: true,
3597
+ logLevel: 'info',
3598
+ merchantUrl: typeof process !== 'undefined' && ((_process$env12 = process.env) === null || _process$env12 === void 0 ? void 0 : _process$env12.NEXT_PUBLIC_MERCHANT_URL) || 'https://merchant.qbitchain.dev',
3599
+ adminUrl: typeof process !== 'undefined' && ((_process$env13 = process.env) === null || _process$env13 === void 0 ? void 0 : _process$env13.NEXT_PUBLIC_ADMIN_URL) || 'https://admin.qbitchain.dev',
3600
+ payUrl: typeof process !== 'undefined' && ((_process$env14 = process.env) === null || _process$env14 === void 0 ? void 0 : _process$env14.NEXT_PUBLIC_PAY_URL) || 'https://pay.qbitchain.dev',
3601
+ walletUrl: typeof process !== 'undefined' && ((_process$env15 = process.env) === null || _process$env15 === void 0 ? void 0 : _process$env15.NEXT_PUBLIC_WALLET_URL) || 'https://wallet.qbitchain.dev',
3602
+ didApiUrl: typeof process !== 'undefined' && ((_process$env16 = process.env) === null || _process$env16 === void 0 ? void 0 : _process$env16.NEXT_PUBLIC_DID_API_URL) || 'https://did.qbitchain.dev'
3603
+ },
3604
+ production: {
3605
+ apiBaseUrl: '/api/v1',
3606
+ apiFullUrl: '',
3607
+ wsBaseUrl: '',
3608
+ chainNetwork: 'mainnet',
3609
+ chainEndpoint: CHAIN_NETWORKS.mainnet.rpcEndpoint,
3610
+ chainWsEndpoint: CHAIN_NETWORKS.mainnet.wsEndpoint,
3611
+ debug: false,
3612
+ logLevel: 'error',
3613
+ merchantUrl: typeof process !== 'undefined' && ((_process$env17 = process.env) === null || _process$env17 === void 0 ? void 0 : _process$env17.NEXT_PUBLIC_MERCHANT_URL) || 'https://merchant.qbitchain.io',
3614
+ adminUrl: typeof process !== 'undefined' && ((_process$env18 = process.env) === null || _process$env18 === void 0 ? void 0 : _process$env18.NEXT_PUBLIC_ADMIN_URL) || 'https://admin.qbitchain.io',
3615
+ payUrl: typeof process !== 'undefined' && ((_process$env19 = process.env) === null || _process$env19 === void 0 ? void 0 : _process$env19.NEXT_PUBLIC_PAY_URL) || 'https://pay.qbitchain.io',
3616
+ walletUrl: typeof process !== 'undefined' && ((_process$env20 = process.env) === null || _process$env20 === void 0 ? void 0 : _process$env20.NEXT_PUBLIC_WALLET_URL) || 'https://wallet.qbitchain.io',
3617
+ didApiUrl: typeof process !== 'undefined' && ((_process$env21 = process.env) === null || _process$env21 === void 0 ? void 0 : _process$env21.NEXT_PUBLIC_DID_API_URL) || 'https://did.qbitchain.io'
3618
+ }
3619
+ };
3620
+
3621
+ // ============ 配置状态 ============
3622
+
3623
+ var getInitialConfig = function getInitialConfig() {
3624
+ var _process$env22;
3625
+ var env = typeof process !== 'undefined' && ((_process$env22 = process.env) === null || _process$env22 === void 0 ? void 0 : _process$env22.NODE_ENV) || 'development';
3626
+ var preset = ENVIRONMENT_PRESETS[env] || ENVIRONMENT_PRESETS.development;
3627
+ return _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_CONFIG), preset), {}, {
3628
+ environment: env
3629
+ });
3630
+ };
3631
+ var _config = getInitialConfig();
3632
+ var _listeners = new Set();
3633
+
3634
+ // ============ 核心函数 ============
3635
+
3636
+ /**
3637
+ * 获取当前配置
3638
+ * @returns {object} 当前配置对象
3639
+ */
3640
+ function getConfig() {
3641
+ return _objectSpread2({}, _config);
3642
+ }
3643
+
3644
+ // ============ 配置监听 ============
3645
+
3646
+ /**
3647
+ * 订阅配置变更
3648
+ *
3649
+ * @param {function} listener - 监听回调
3650
+ * @returns {function} 取消订阅函数
3651
+ */
3652
+ function subscribeConfig(listener) {
3653
+ _listeners.add(listener);
3654
+ return function () {
3655
+ return _listeners["delete"](listener);
3656
+ };
3657
+ }
3658
+
3659
+ /**
3660
+ * 获取认证 Token
3661
+ *
3662
+ * @returns {string|null} Token 或 null
3663
+ */
3664
+ function _getToken() {
3665
+ if (typeof window === 'undefined') return null;
3666
+ return localStorage.getItem(_config.tokenStorageKey);
3667
+ }
3668
+
3669
+ // ============ Logger ============
3670
+
3671
+ var LOG_LEVELS = {
3672
+ debug: 0,
3673
+ info: 1,
3674
+ warn: 2,
3675
+ error: 3
3676
+ };
3677
+
3678
+ /**
3679
+ * SDK 日志工具
3680
+ * 根据配置的日志级别输出日志
3681
+ */
3682
+ var logger = {
3683
+ debug: function debug() {
3684
+ if (_config.debug && LOG_LEVELS[_config.logLevel] <= LOG_LEVELS.debug) {
3685
+ var _console;
3686
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
3687
+ args[_key3] = arguments[_key3];
3688
+ }
3689
+ (_console = console).debug.apply(_console, ['[SDK]'].concat(args));
3690
+ }
3691
+ },
3692
+ info: function info() {
3693
+ if (_config.debug && LOG_LEVELS[_config.logLevel] <= LOG_LEVELS.info) {
3694
+ var _console2;
3695
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
3696
+ args[_key4] = arguments[_key4];
3697
+ }
3698
+ (_console2 = console).info.apply(_console2, ['[SDK]'].concat(args));
3699
+ }
3700
+ },
3701
+ warn: function warn() {
3702
+ if (LOG_LEVELS[_config.logLevel] <= LOG_LEVELS.warn) {
3703
+ var _console3;
3704
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
3705
+ args[_key5] = arguments[_key5];
3706
+ }
3707
+ (_console3 = console).warn.apply(_console3, ['[SDK]'].concat(args));
3708
+ }
3709
+ },
3710
+ error: function error() {
3711
+ var _console4;
3712
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
3713
+ args[_key6] = arguments[_key6];
3714
+ }
3715
+ (_console4 = console).error.apply(_console4, ['[SDK]'].concat(args));
3716
+ }
3717
+ };
3718
+
3719
+ var InviteApiClient = /*#__PURE__*/function (_BaseApiClient) {
3720
+ function InviteApiClient() {
3721
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3722
+ _classCallCheck(this, InviteApiClient);
3723
+ return _callSuper(this, InviteApiClient, ['/invites', config]);
3724
+ }
3725
+
3726
+ // 绑定邀请关系
3727
+ _inherits(InviteApiClient, _BaseApiClient);
3728
+ return _createClass(InviteApiClient, [{
3729
+ key: "bindInvite",
3730
+ value: function () {
3731
+ var _bindInvite = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(inviteCode, inviteeId) {
3732
+ return _regenerator().w(function (_context) {
3733
+ while (1) switch (_context.n) {
3734
+ case 0:
3735
+ return _context.a(2, this.post('/bind', {
3736
+ inviteCode: inviteCode,
3737
+ inviteeId: inviteeId
3738
+ }));
3739
+ }
3740
+ }, _callee, this);
3741
+ }));
3742
+ function bindInvite(_x, _x2) {
3743
+ return _bindInvite.apply(this, arguments);
3744
+ }
3745
+ return bindInvite;
3746
+ }() // 获取当前用户的邀请佣金、已邀请人总览
3747
+ }, {
3748
+ key: "getInviteStats",
3749
+ value: function () {
3750
+ var _getInviteStats = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(userId) {
3751
+ return _regenerator().w(function (_context2) {
3752
+ while (1) switch (_context2.n) {
3753
+ case 0:
3754
+ return _context2.a(2, this.get('/stats', {
3755
+ userId: userId
3756
+ }));
3757
+ }
3758
+ }, _callee2, this);
3759
+ }));
3760
+ function getInviteStats(_x3) {
3761
+ return _getInviteStats.apply(this, arguments);
3762
+ }
3763
+ return getInviteStats;
3764
+ }() // 获取邀请列表详情
3765
+ }, {
3766
+ key: "getInviteList",
3767
+ value: function () {
3768
+ var _getInviteList = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(userId) {
3769
+ var params,
3770
+ _args3 = arguments;
3771
+ return _regenerator().w(function (_context3) {
3772
+ while (1) switch (_context3.n) {
3773
+ case 0:
3774
+ params = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
3775
+ return _context3.a(2, this.get('/list', _objectSpread2({
3776
+ userId: userId
3777
+ }, params)));
3778
+ }
3779
+ }, _callee3, this);
3780
+ }));
3781
+ function getInviteList(_x4) {
3782
+ return _getInviteList.apply(this, arguments);
3783
+ }
3784
+ return getInviteList;
3785
+ }() // 领取/提取邀请奖励
3786
+ }, {
3787
+ key: "claimRewards",
3788
+ value: function () {
3789
+ var _claimRewards = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(userId) {
3790
+ return _regenerator().w(function (_context4) {
3791
+ while (1) switch (_context4.n) {
3792
+ case 0:
3793
+ return _context4.a(2, this.post('/claim-rewards', {
3794
+ userId: userId
3795
+ }));
3796
+ }
3797
+ }, _callee4, this);
3798
+ }));
3799
+ function claimRewards(_x5) {
3800
+ return _claimRewards.apply(this, arguments);
3801
+ }
3802
+ return claimRewards;
3803
+ }()
3804
+ }]);
3805
+ }(BaseApiClient);
3806
+ var inviteApi = new InviteApiClient();
3807
+
3808
+ function useInvite(userId) {
3809
+ var _useState = reactExports.useState({
3810
+ totalInvited: 0,
3811
+ rewardsEarned: 0,
3812
+ claimable: 0
3813
+ }),
3814
+ _useState2 = _slicedToArray(_useState, 2),
3815
+ stats = _useState2[0],
3816
+ setStats = _useState2[1];
3817
+ var _useState3 = reactExports.useState(false),
3818
+ _useState4 = _slicedToArray(_useState3, 2),
3819
+ loading = _useState4[0],
3820
+ setLoading = _useState4[1];
3821
+ var _useState5 = reactExports.useState(null),
3822
+ _useState6 = _slicedToArray(_useState5, 2),
3823
+ error = _useState6[0],
3824
+ setError = _useState6[1];
3825
+ var fetchStats = reactExports.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3826
+ var _data$totalInvited, _data$rewardsEarned, _data$claimable, data, _t;
3827
+ return _regenerator().w(function (_context) {
3828
+ while (1) switch (_context.p = _context.n) {
3829
+ case 0:
3830
+ if (userId) {
3831
+ _context.n = 1;
3832
+ break;
3833
+ }
3834
+ return _context.a(2);
3835
+ case 1:
3836
+ setLoading(true);
3837
+ setError(null);
3838
+ _context.p = 2;
3839
+ _context.n = 3;
3840
+ return inviteApi.getInviteStats(userId);
3841
+ case 3:
3842
+ data = _context.v;
3843
+ setStats({
3844
+ totalInvited: (_data$totalInvited = data === null || data === void 0 ? void 0 : data.totalInvited) !== null && _data$totalInvited !== void 0 ? _data$totalInvited : 0,
3845
+ rewardsEarned: (_data$rewardsEarned = data === null || data === void 0 ? void 0 : data.rewardsEarned) !== null && _data$rewardsEarned !== void 0 ? _data$rewardsEarned : 0,
3846
+ claimable: (_data$claimable = data === null || data === void 0 ? void 0 : data.claimable) !== null && _data$claimable !== void 0 ? _data$claimable : 0
3847
+ });
3848
+ _context.n = 5;
3849
+ break;
3850
+ case 4:
3851
+ _context.p = 4;
3852
+ _t = _context.v;
3853
+ setError(_t);
3854
+ // 降级 mock 模拟数据,供开发预览
3855
+ setStats({
3856
+ totalInvited: 12,
3857
+ rewardsEarned: 1200,
3858
+ claimable: 300
3859
+ });
3860
+ case 5:
3861
+ _context.p = 5;
3862
+ setLoading(false);
3863
+ return _context.f(5);
3864
+ case 6:
3865
+ return _context.a(2);
3866
+ }
3867
+ }, _callee, null, [[2, 4, 5, 6]]);
3868
+ })), [userId]);
3869
+ var claim = reactExports.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
3870
+ var _t2;
3871
+ return _regenerator().w(function (_context2) {
3872
+ while (1) switch (_context2.p = _context2.n) {
3873
+ case 0:
3874
+ if (userId) {
3875
+ _context2.n = 1;
3876
+ break;
3877
+ }
3878
+ return _context2.a(2, false);
3879
+ case 1:
3880
+ setLoading(true);
3881
+ _context2.p = 2;
3882
+ _context2.n = 3;
3883
+ return inviteApi.claimRewards(userId);
3884
+ case 3:
3885
+ _context2.n = 4;
3886
+ return fetchStats();
3887
+ case 4:
3888
+ return _context2.a(2, true);
3889
+ case 5:
3890
+ _context2.p = 5;
3891
+ _t2 = _context2.v;
3892
+ setError(_t2);
3893
+ // Mock领奖成功
3894
+ setStats(function (prev) {
3895
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
3896
+ claimable: 0
3897
+ });
3898
+ });
3899
+ return _context2.a(2, true);
3900
+ case 6:
3901
+ _context2.p = 6;
3902
+ setLoading(false);
3903
+ return _context2.f(6);
3904
+ case 7:
3905
+ return _context2.a(2);
3906
+ }
3907
+ }, _callee2, null, [[2, 5, 6, 7]]);
3908
+ })), [userId, fetchStats]);
3909
+ reactExports.useEffect(function () {
3910
+ fetchStats();
3911
+ }, [userId, fetchStats]);
3912
+ return {
3913
+ stats: stats,
3914
+ loading: loading,
3915
+ error: error,
3916
+ refresh: fetchStats,
3917
+ claim: claim
3918
+ };
3919
+ }
3920
+
3921
+ /**
3922
+ * QuantaBit Invite SDK - i18n support
3923
+ */
3924
+
3925
+ var messages = {
3926
+ en: {
3927
+ invitePanelTitle: 'Invite Friends & Earn Rewards',
3928
+ inviteLink: 'Your Invitation Link',
3929
+ copyLink: 'Copy Link',
3930
+ copied: 'Copied!',
3931
+ scanQR: 'Scan QR Code to Invite',
3932
+ totalInvited: 'Total Invited',
3933
+ rewardsEarned: 'Rewards Earned',
3934
+ claim: 'Claim',
3935
+ invitationCode: 'Invite Code'
3936
+ },
3937
+ zh: {
3938
+ invitePanelTitle: '邀请好友,共享奖励',
3939
+ inviteLink: '您的邀请专属链接',
3940
+ copyLink: '复制链接',
3941
+ copied: '已复制!',
3942
+ scanQR: '扫描二维码邀请',
3943
+ totalInvited: '累计邀请人数',
3944
+ rewardsEarned: '已获得奖励',
3945
+ claim: '立即领取',
3946
+ invitationCode: '邀请码'
3947
+ },
3948
+ ja: {
3949
+ invitePanelTitle: '友達を招待して報酬を獲得',
3950
+ inviteLink: '招待リンク',
3951
+ copyLink: 'リンクをコピー',
3952
+ copied: 'コピーしました!',
3953
+ scanQR: 'QRコードをスキャンして招待',
3954
+ totalInvited: '合計招待数',
3955
+ rewardsEarned: '獲得した報酬',
3956
+ claim: '受け取る',
3957
+ invitationCode: '招待コード'
3958
+ },
3959
+ ko: {
3960
+ invitePanelTitle: '친구 초대하고 보상 받기',
3961
+ inviteLink: '나의 초대 링크',
3962
+ copyLink: '링크 복사',
3963
+ copied: '복사 완료!',
3964
+ scanQR: 'QR 코드로 친구 초대',
3965
+ totalInvited: '총 초대 인원',
3966
+ rewardsEarned: '획득한 보상',
3967
+ claim: '보상 수령',
3968
+ invitationCode: '초대 코드'
3969
+ }
3970
+ };
3971
+ var SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];
3972
+ var currentLanguage = 'en';
3973
+ function setLanguage(lang) {
3974
+ if (SUPPORTED_LANGUAGES.includes(lang)) currentLanguage = lang;
3975
+ }
3976
+ function getLanguage() {
3977
+ return currentLanguage;
3978
+ }
3979
+ function t(key) {
3980
+ return (messages[currentLanguage] || messages.en)[key] || key;
3981
+ }
3982
+
3983
+ function InvitePanel(_ref) {
3984
+ var userId = _ref.userId,
3985
+ inviteCode = _ref.inviteCode,
3986
+ _ref$baseUrl = _ref.baseUrl,
3987
+ baseUrl = _ref$baseUrl === void 0 ? 'https://qbitchain.io/register' : _ref$baseUrl,
3988
+ _ref$className = _ref.className,
3989
+ className = _ref$className === void 0 ? '' : _ref$className;
3990
+ var _useInvite = useInvite(userId),
3991
+ stats = _useInvite.stats,
3992
+ loading = _useInvite.loading,
3993
+ claim = _useInvite.claim;
3994
+ var _useState = reactExports.useState(false),
3995
+ _useState2 = _slicedToArray(_useState, 2),
3996
+ copied = _useState2[0],
3997
+ setCopied = _useState2[1];
3998
+ var qrContainerRef = reactExports.useRef(null);
3999
+ var inviteLink = inviteCode ? "".concat(baseUrl, "?invite_code=").concat(encodeURIComponent(inviteCode)) : baseUrl;
4000
+ reactExports.useEffect(function () {
4001
+ if (qrContainerRef.current && inviteLink) {
4002
+ // 动态生成公共二维码图片
4003
+ var size = 140;
4004
+ var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?size=".concat(size, "x").concat(size, "&data=").concat(encodeURIComponent(inviteLink), "&margin=10");
4005
+ qrContainerRef.current.innerHTML = "<img src=\"".concat(qrUrl, "\" alt=\"QR\" width=\"").concat(size, "\" height=\"").concat(size, "\" style=\"border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.15);\" />");
4006
+ }
4007
+ }, [inviteLink]);
4008
+ var handleCopy = function handleCopy() {
4009
+ navigator.clipboard.writeText(inviteLink).then(function () {
4010
+ setCopied(true);
4011
+ setTimeout(function () {
4012
+ return setCopied(false);
4013
+ }, 2000);
4014
+ })["catch"](function (err) {
4015
+ return console.error('Failed to copy invite link:', err);
4016
+ });
4017
+ };
4018
+ return /*#__PURE__*/React.createElement("div", {
4019
+ className: "qbit-invite-panel ".concat(className)
4020
+ }, /*#__PURE__*/React.createElement("div", {
4021
+ className: "qbit-invite-card"
4022
+ }, /*#__PURE__*/React.createElement("h3", {
4023
+ className: "qbit-invite-title"
4024
+ }, t('invitePanelTitle')), /*#__PURE__*/React.createElement("div", {
4025
+ className: "qbit-invite-stats-row"
4026
+ }, /*#__PURE__*/React.createElement("div", {
4027
+ className: "qbit-invite-stat"
4028
+ }, /*#__PURE__*/React.createElement("span", {
4029
+ className: "label"
4030
+ }, t('totalInvited')), /*#__PURE__*/React.createElement("span", {
4031
+ className: "value"
4032
+ }, loading ? '...' : stats.totalInvited)), /*#__PURE__*/React.createElement("div", {
4033
+ className: "qbit-invite-stat"
4034
+ }, /*#__PURE__*/React.createElement("span", {
4035
+ className: "label"
4036
+ }, t('rewardsEarned')), /*#__PURE__*/React.createElement("span", {
4037
+ className: "value highlight"
4038
+ }, loading ? '...' : "".concat(stats.rewardsEarned, " QBT")))), /*#__PURE__*/React.createElement("div", {
4039
+ className: "qbit-invite-body"
4040
+ }, /*#__PURE__*/React.createElement("div", {
4041
+ className: "qbit-invite-link-box"
4042
+ }, /*#__PURE__*/React.createElement("label", {
4043
+ className: "qbit-invite-label"
4044
+ }, t('inviteLink')), /*#__PURE__*/React.createElement("div", {
4045
+ className: "qbit-invite-input-group"
4046
+ }, /*#__PURE__*/React.createElement("input", {
4047
+ type: "text",
4048
+ readOnly: true,
4049
+ value: inviteLink
4050
+ }), /*#__PURE__*/React.createElement("button", {
4051
+ onClick: handleCopy,
4052
+ className: copied ? 'copied' : ''
4053
+ }, copied ? t('copied') : t('copyLink')))), /*#__PURE__*/React.createElement("div", {
4054
+ className: "qbit-invite-qr-container"
4055
+ }, /*#__PURE__*/React.createElement("label", {
4056
+ className: "qbit-invite-label"
4057
+ }, t('scanQR')), /*#__PURE__*/React.createElement("div", {
4058
+ ref: qrContainerRef,
4059
+ className: "qbit-invite-qr-box"
4060
+ }))), stats.claimable > 0 && /*#__PURE__*/React.createElement("div", {
4061
+ className: "qbit-invite-claim-banner"
4062
+ }, /*#__PURE__*/React.createElement("p", null, "You have ", /*#__PURE__*/React.createElement("strong", null, stats.claimable, " QBT"), " claimable reward!"), /*#__PURE__*/React.createElement("button", {
4063
+ className: "qbit-invite-btn-claim",
4064
+ onClick: claim
4065
+ }, t('claim')))), /*#__PURE__*/React.createElement("style", null, "\n .qbit-invite-panel {\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n width: 100%;\n max-width: 500px;\n }\n .qbit-invite-card {\n background: #111827;\n border: 1px solid #1f2937;\n border-radius: 16px;\n padding: 24px;\n color: #f3f4f6;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);\n }\n .qbit-invite-title {\n margin-top: 0;\n margin-bottom: 20px;\n font-size: 18px;\n font-weight: 700;\n text-align: center;\n background: linear-gradient(135deg, #60a5fa, #3b82f6);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n }\n .qbit-invite-stats-row {\n display: flex;\n justify-content: space-around;\n background: #1f293780;\n padding: 16px;\n border-radius: 12px;\n margin-bottom: 20px;\n border: 1px solid #37415140;\n }\n .qbit-invite-stat {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 6px;\n }\n .qbit-invite-stat .label {\n font-size: 12px;\n color: #9ca3af;\n }\n .qbit-invite-stat .value {\n font-size: 20px;\n font-weight: bold;\n }\n .qbit-invite-stat .value.highlight {\n color: #3b82f6;\n }\n .qbit-invite-body {\n display: flex;\n flex-direction: column;\n gap: 16px;\n }\n .qbit-invite-label {\n display: block;\n font-size: 12px;\n color: #9ca3af;\n margin-bottom: 6px;\n text-transform: uppercase;\n }\n .qbit-invite-input-group {\n display: flex;\n gap: 8px;\n }\n .qbit-invite-input-group input {\n flex: 1;\n background: #1f2937;\n border: 1px solid #374151;\n border-radius: 8px;\n padding: 8px 12px;\n color: #f3f4f6;\n outline: none;\n font-size: 13px;\n }\n .qbit-invite-input-group button {\n background: #3b82f6;\n border: none;\n color: white;\n padding: 8px 16px;\n border-radius: 8px;\n font-weight: 500;\n cursor: pointer;\n font-size: 13px;\n transition: background 0.2s;\n }\n .qbit-invite-input-group button:hover {\n background: #2563eb;\n }\n .qbit-invite-input-group button.copied {\n background: #10b981;\n }\n .qbit-invite-qr-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n margin-top: 10px;\n }\n .qbit-invite-qr-box {\n background: white;\n padding: 8px;\n border-radius: 12px;\n display: inline-block;\n }\n .qbit-invite-claim-banner {\n margin-top: 20px;\n background: rgba(16, 185, 129, 0.1);\n border: 1px dashed rgba(16, 185, 129, 0.3);\n border-radius: 12px;\n padding: 12px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n .qbit-invite-claim-banner p {\n margin: 0;\n font-size: 13px;\n color: #34d399;\n }\n .qbit-invite-btn-claim {\n background: #10b981;\n color: white;\n border: none;\n padding: 6px 12px;\n border-radius: 6px;\n font-weight: 600;\n font-size: 12px;\n cursor: pointer;\n transition: background 0.2s;\n }\n .qbit-invite-btn-claim:hover {\n background: #059669;\n }\n "));
4066
+ }
4067
+
4068
+ var QbitInviteSDK = /*#__PURE__*/function () {
4069
+ /**
4070
+ * 初始化邀请 SDK
4071
+ * @param {Object} options 配置项
4072
+ */
4073
+ function QbitInviteSDK() {
4074
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4075
+ _classCallCheck(this, QbitInviteSDK);
4076
+ this.options = _objectSpread2({
4077
+ lang: options.lang || 'zh',
4078
+ // 默认语言: 'zh' 或 'en'
4079
+ paramName: options.paramName || 'invite_code',
4080
+ // URL 中邀请码的参数名
4081
+ storageKey: options.storageKey || 'qbit_invite_code',
4082
+ // 本地存储的 key
4083
+ storageType: options.storageType || 'localStorage',
4084
+ // 存储方式:'localStorage', 'sessionStorage', 'cookie'
4085
+ cookieDomain: options.cookieDomain || '',
4086
+ // 如果使用 cookie,指定 domain 解决跨子域问题
4087
+ cookieExpireDays: options.cookieExpireDays || 30,
4088
+ // cookie 过期天数
4089
+
4090
+ // 新增:奖励相关配置
4091
+ enableReward: options.enableReward !== undefined ? options.enableReward : false,
4092
+ // 奖励功能开关,默认关闭
4093
+ rewardAmount: options.rewardAmount || 100,
4094
+ // 奖励数额
4095
+ rewardName: options.rewardName || ''
4096
+ }, options);
4097
+
4098
+ // 多语言字典 (i18n)
4099
+ this.i18n = {
4100
+ zh: {
4101
+ defaultRewardName: '积分',
4102
+ toastTitle: '🎉 专属邀请奖励',
4103
+ toastMessage: '您已通过邀请链接访问!注册即可获得 <strong class="qbit-invite-highlight">{amount} {name}</strong> 奖励。',
4104
+ close: '关闭'
4105
+ },
4106
+ en: {
4107
+ defaultRewardName: 'Points',
4108
+ toastTitle: '🎉 Exclusive Invite Reward',
4109
+ toastMessage: 'You visited via an invite link! Register now to receive a <strong class="qbit-invite-highlight">{amount} {name}</strong> reward.',
4110
+ close: 'Close'
4111
+ }
4112
+ };
4113
+
4114
+ // 自动补全未填写的奖励名称
4115
+ if (!this.options.rewardName) {
4116
+ this.options.rewardName = this.i18n[this.options.lang].defaultRewardName;
4117
+ }
4118
+
4119
+ // 初始化样式
4120
+ if (this.options.enableReward) {
4121
+ this._initToastStyles();
4122
+ }
4123
+
4124
+ // 自动初始化:从 URL 捕获邀请码并保存
4125
+ this._captureInviteCodeFromUrl();
4126
+ }
4127
+
4128
+ /**
4129
+ * 切换语言
4130
+ * @param {string} lang 语言代码 ('zh' | 'en')
4131
+ */
4132
+ return _createClass(QbitInviteSDK, [{
4133
+ key: "setLanguage",
4134
+ value: function setLanguage(lang) {
4135
+ if (this.i18n[lang]) {
4136
+ this.options.lang = lang;
4137
+ // 如果使用了默认的奖励名称,切换语言时也顺便更新
4138
+ if (this.options.rewardName === this.i18n['zh'].defaultRewardName || this.options.rewardName === this.i18n['en'].defaultRewardName) {
4139
+ this.options.rewardName = this.i18n[lang].defaultRewardName;
4140
+ }
4141
+ }
4142
+ }
4143
+
4144
+ /**
4145
+ * 内部方法:注入 Toast 弹窗样式
4146
+ */
4147
+ }, {
4148
+ key: "_initToastStyles",
4149
+ value: function _initToastStyles() {
4150
+ if (document.getElementById('qbit-invite-sdk-styles')) return;
4151
+ var style = document.createElement('style');
4152
+ style.id = 'qbit-invite-sdk-styles';
4153
+ style.innerHTML = "\n .qbit-invite-toast-container {\n position: fixed;\n bottom: 24px;\n right: 24px;\n z-index: 999999;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n pointer-events: none;\n }\n .qbit-invite-toast {\n background: #ffffff;\n border-radius: 12px;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0,0,0,0.05);\n width: 320px;\n padding: 16px 20px;\n transform: translateX(120%);\n opacity: 0;\n transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);\n pointer-events: auto;\n position: relative;\n }\n .qbit-invite-toast.qbit-show {\n transform: translateX(0);\n opacity: 1;\n }\n .qbit-invite-toast-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n .qbit-invite-toast-title {\n font-size: 16px;\n font-weight: 600;\n color: #111827;\n margin: 0;\n }\n .qbit-invite-toast-close {\n background: transparent;\n border: none;\n color: #9ca3af;\n cursor: pointer;\n padding: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n transition: background 0.2s;\n }\n .qbit-invite-toast-close:hover {\n background: #f3f4f6;\n color: #4b5563;\n }\n .qbit-invite-toast-body {\n font-size: 14px;\n color: #4b5563;\n margin: 0;\n line-height: 1.5;\n }\n .qbit-invite-highlight {\n color: #ef4444; /* \u5956\u52B1\u9AD8\u4EAE\u8272 */\n font-weight: 600;\n }\n ";
4154
+ document.head.appendChild(style);
4155
+ }
4156
+
4157
+ /**
4158
+ * 显示奖励提示弹窗
4159
+ */
4160
+ }, {
4161
+ key: "showRewardToast",
4162
+ value: function showRewardToast() {
4163
+ if (!this.options.enableReward) return;
4164
+ var t = this.i18n[this.options.lang] || this.i18n['zh'];
4165
+ var message = t.toastMessage.replace('{amount}', this.options.rewardAmount).replace('{name}', this.options.rewardName);
4166
+
4167
+ // 创建容器
4168
+ var container = document.getElementById('qbit-invite-toast-container');
4169
+ if (!container) {
4170
+ container = document.createElement('div');
4171
+ container.id = 'qbit-invite-toast-container';
4172
+ container.className = 'qbit-invite-toast-container';
4173
+ document.body.appendChild(container);
4174
+ }
4175
+
4176
+ // 创建 Toast 元素
4177
+ var toast = document.createElement('div');
4178
+ toast.className = 'qbit-invite-toast';
4179
+ toast.innerHTML = "\n <div class=\"qbit-invite-toast-header\">\n <h3 class=\"qbit-invite-toast-title\">".concat(t.toastTitle, "</h3>\n <button class=\"qbit-invite-toast-close\" aria-label=\"").concat(t.close, "\">\n <svg width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n </button>\n </div>\n <p class=\"qbit-invite-toast-body\">").concat(message, "</p>\n ");
4180
+ container.appendChild(toast);
4181
+
4182
+ // 触发动画
4183
+ requestAnimationFrame(function () {
4184
+ toast.classList.add('qbit-show');
4185
+ });
4186
+
4187
+ // 关闭事件
4188
+ var closeBtn = toast.querySelector('.qbit-invite-toast-close');
4189
+ var hideToast = function hideToast() {
4190
+ toast.classList.remove('qbit-show');
4191
+ setTimeout(function () {
4192
+ if (toast.parentNode) toast.parentNode.removeChild(toast);
4193
+ }, 400);
4194
+ };
4195
+ closeBtn.addEventListener('click', hideToast);
4196
+
4197
+ // 自动消失 (6秒后)
4198
+ setTimeout(hideToast, 6000);
4199
+ }
4200
+
4201
+ /**
4202
+ * 内部方法:从 URL 中捕获邀请码
4203
+ */
4204
+ }, {
4205
+ key: "_captureInviteCodeFromUrl",
4206
+ value: function _captureInviteCodeFromUrl() {
4207
+ try {
4208
+ var urlParams = new URLSearchParams(window.location.search);
4209
+ var code = urlParams.get(this.options.paramName);
4210
+ if (code) {
4211
+ this.setInviteCode(code);
4212
+ // 触发一个自定义事件,方便页面其他逻辑监听
4213
+ window.dispatchEvent(new CustomEvent('qbit-invite-captured', {
4214
+ detail: {
4215
+ code: code
4216
+ }
4217
+ }));
4218
+
4219
+ // 如果开启了奖励且本次会话还没有弹过窗,则弹窗提示
4220
+ var sessionFlag = 'qbit_invite_toast_shown_' + code;
4221
+ if (this.options.enableReward && !sessionStorage.getItem(sessionFlag)) {
4222
+ this.showRewardToast();
4223
+ sessionStorage.setItem(sessionFlag, '1');
4224
+ }
4225
+ }
4226
+ } catch (error) {
4227
+ console.warn('QbitInviteSDK: URL 解析失败', error);
4228
+ }
4229
+ }
4230
+
4231
+ /**
4232
+ * 保存邀请码到本地存储
4233
+ * @param {string} code 邀请码
4234
+ */
4235
+ }, {
4236
+ key: "setInviteCode",
4237
+ value: function setInviteCode(code) {
4238
+ if (!code) return;
4239
+ var _this$options = this.options,
4240
+ storageType = _this$options.storageType,
4241
+ storageKey = _this$options.storageKey,
4242
+ cookieDomain = _this$options.cookieDomain,
4243
+ cookieExpireDays = _this$options.cookieExpireDays;
4244
+ if (storageType === 'localStorage') {
4245
+ localStorage.setItem(storageKey, code);
4246
+ } else if (storageType === 'sessionStorage') {
4247
+ sessionStorage.setItem(storageKey, code);
4248
+ } else if (storageType === 'cookie') {
4249
+ var expires = '';
4250
+ if (cookieExpireDays) {
4251
+ var date = new Date();
4252
+ date.setTime(date.getTime() + cookieExpireDays * 24 * 60 * 60 * 1000);
4253
+ expires = "; expires=".concat(date.toUTCString());
4254
+ }
4255
+ var domain = cookieDomain ? "; domain=".concat(cookieDomain) : '';
4256
+ document.cookie = "".concat(storageKey, "=").concat(encodeURIComponent(code)).concat(expires).concat(domain, "; path=/");
4257
+ }
4258
+ }
4259
+
4260
+ /**
4261
+ * 获取当前存储的邀请码
4262
+ * @returns {string|null} 邀请码
4263
+ */
4264
+ }, {
4265
+ key: "getInviteCode",
4266
+ value: function getInviteCode() {
4267
+ var _this$options2 = this.options,
4268
+ storageType = _this$options2.storageType,
4269
+ storageKey = _this$options2.storageKey;
4270
+ if (storageType === 'localStorage') {
4271
+ return localStorage.getItem(storageKey);
4272
+ } else if (storageType === 'sessionStorage') {
4273
+ return sessionStorage.getItem(storageKey);
4274
+ } else if (storageType === 'cookie') {
4275
+ var nameEQ = storageKey + '=';
4276
+ var ca = document.cookie.split(';');
4277
+ for (var i = 0; i < ca.length; i++) {
4278
+ var c = ca[i];
4279
+ while (c.charAt(0) === ' ') c = c.substring(1, c.length);
4280
+ if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));
4281
+ }
4282
+ }
4283
+ return null;
4284
+ }
4285
+
4286
+ /**
4287
+ * 注册成功后清除邀请码
4288
+ */
4289
+ }, {
4290
+ key: "clearInviteCode",
4291
+ value: function clearInviteCode() {
4292
+ var _this$options3 = this.options,
4293
+ storageType = _this$options3.storageType,
4294
+ storageKey = _this$options3.storageKey,
4295
+ cookieDomain = _this$options3.cookieDomain;
4296
+ if (storageType === 'localStorage') {
4297
+ localStorage.removeItem(storageKey);
4298
+ } else if (storageType === 'sessionStorage') {
4299
+ sessionStorage.removeItem(storageKey);
4300
+ } else if (storageType === 'cookie') {
4301
+ var domain = cookieDomain ? "; domain=".concat(cookieDomain) : '';
4302
+ document.cookie = "".concat(storageKey, "=; expires=Thu, 01 Jan 1970 00:00:00 UTC").concat(domain, "; path=/");
4303
+ }
4304
+ }
4305
+
4306
+ /**
4307
+ * 生成包含当前用户邀请码的分享链接
4308
+ * @param {string} baseUrl 基础链接(如官网首页或注册页)
4309
+ * @param {string} userInviteCode 当前用户的邀请码
4310
+ * @returns {string} 完整的邀请链接
4311
+ */
4312
+ }, {
4313
+ key: "generateInviteLink",
4314
+ value: function generateInviteLink(baseUrl, userInviteCode) {
4315
+ if (!userInviteCode) return baseUrl;
4316
+ try {
4317
+ var url = new URL(baseUrl);
4318
+ url.searchParams.set(this.options.paramName, userInviteCode);
4319
+ return url.toString();
4320
+ } catch (error) {
4321
+ // 如果 baseUrl 不是完整的绝对路径,做降级处理
4322
+ var separator = baseUrl.includes('?') ? '&' : '?';
4323
+ return "".concat(baseUrl).concat(separator).concat(this.options.paramName, "=").concat(encodeURIComponent(userInviteCode));
4324
+ }
4325
+ }
4326
+
4327
+ /**
4328
+ * 生成二维码(依赖免费的公共 API 生成,或者您可以后续替换为本地二维码库)
4329
+ * @param {string} containerId 容器元素的 ID
4330
+ * @param {string} inviteLink 要生成二维码的链接
4331
+ * @param {Object} options 二维码配置 (size, color 等)
4332
+ */
4333
+ }, {
4334
+ key: "renderQRCode",
4335
+ value: function renderQRCode(containerId, inviteLink) {
4336
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
4337
+ var container = document.getElementById(containerId);
4338
+ if (!container) {
4339
+ console.error("QbitInviteSDK: \u627E\u4E0D\u5230\u5BB9\u5668 ID \u4E3A ".concat(containerId, " \u7684\u5143\u7D20"));
4340
+ return;
4341
+ }
4342
+ var size = options.size || 200;
4343
+ // 使用可靠的第三方 API 生成二维码,方便轻量级集成
4344
+ var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?size=".concat(size, "x").concat(size, "&data=").concat(encodeURIComponent(inviteLink), "&margin=10");
4345
+ var img = document.createElement('img');
4346
+ img.src = qrUrl;
4347
+ img.alt = '邀请二维码';
4348
+ img.width = size;
4349
+ img.height = size;
4350
+ img.style.borderRadius = '8px';
4351
+ img.style.boxShadow = '0 4px 6px rgba(0, 0, 0, 0.1)';
4352
+ container.innerHTML = '';
4353
+ container.appendChild(img);
4354
+ }
4355
+
4356
+ /**
4357
+ * 自动将邀请码追加到指定的跳转链接上(适用于官网跳转注册页的场景)
4358
+ * 这样用户点击注册按钮时,URL 自动带上邀请码。
4359
+ * @param {string} selector 链接的 CSS 选择器,例如 '.register-link'
4360
+ */
4361
+ }, {
4362
+ key: "appendCodeToLinks",
4363
+ value: function appendCodeToLinks(selector) {
4364
+ var _this = this;
4365
+ var code = this.getInviteCode();
4366
+ if (!code) return;
4367
+ var links = document.querySelectorAll(selector);
4368
+ links.forEach(function (link) {
4369
+ try {
4370
+ // 如果是绝对路径
4371
+ if (link.href && link.href.startsWith('http')) {
4372
+ var url = new URL(link.href);
4373
+ url.searchParams.set(_this.options.paramName, code);
4374
+ link.href = url.toString();
4375
+ } else if (link.getAttribute('href')) {
4376
+ // 相对路径降级处理
4377
+ var href = link.getAttribute('href');
4378
+ var separator = href.includes('?') ? '&' : '?';
4379
+ link.setAttribute('href', "".concat(href).concat(separator).concat(_this.options.paramName, "=").concat(encodeURIComponent(code)));
4380
+ }
4381
+ } catch (e) {
4382
+ console.warn('QbitInviteSDK: 链接改写失败', link);
4383
+ }
4384
+ });
4385
+ }
4386
+
4387
+ /**
4388
+ * 自动将邀请码填入注册表单(适用于隐藏域或只读输入框)
4389
+ * @param {string} inputSelector 输入框的 CSS 选择器,例如 '#inviteCodeInput'
4390
+ */
4391
+ }, {
4392
+ key: "autoFillForm",
4393
+ value: function autoFillForm(inputSelector) {
4394
+ var code = this.getInviteCode();
4395
+ if (!code) return;
4396
+ var input = document.querySelector(inputSelector);
4397
+ if (input) {
4398
+ input.value = code;
4399
+ // 触发 input 事件,确保 React/Vue 等框架能够捕获到值的改变
4400
+ input.dispatchEvent(new Event('input', {
4401
+ bubbles: true
4402
+ }));
4403
+ input.dispatchEvent(new Event('change', {
4404
+ bubbles: true
4405
+ }));
4406
+ }
4407
+ }
4408
+ }]);
4409
+ }();
4410
+ if (typeof window !== 'undefined') {
4411
+ window.QbitInviteSDK = QbitInviteSDK;
4412
+ }
4413
+
4414
+ export { InviteApiClient, InvitePanel, QbitInviteSDK, SUPPORTED_LANGUAGES, QbitInviteSDK as default, getLanguage, inviteApi, messages, setLanguage, t, useInvite };
4415
+ //# sourceMappingURL=index.esm.js.map