@jolibox/ads 1.1.19-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,3662 @@
1
+ var yt = Object.getOwnPropertySymbols;
2
+ var Ni = Object.prototype.hasOwnProperty, Pi = Object.prototype.propertyIsEnumerable;
3
+ var gt = (t, e) => {
4
+ var i = {};
5
+ for (var n in t)
6
+ Ni.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]);
7
+ if (t != null && yt)
8
+ for (var n of yt(t))
9
+ e.indexOf(n) < 0 && Pi.call(t, n) && (i[n] = t[n]);
10
+ return i;
11
+ };
12
+ import { options as I, Component as ie, isValidElement as Ci, createElement as mt, Fragment as bt, toChildArray as Ye, render as Li, createRef as At } from "preact";
13
+ function j(t, e, i) {
14
+ return (e = $i(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
15
+ }
16
+ function $i(t) {
17
+ var e = Mi(t, "string");
18
+ return typeof e == "symbol" ? e : e + "";
19
+ }
20
+ function Mi(t, e) {
21
+ if (typeof t != "object" || !t)
22
+ return t;
23
+ var i = t[Symbol.toPrimitive];
24
+ if (i !== void 0) {
25
+ var n = i.call(t, e);
26
+ if (typeof n != "object")
27
+ return n;
28
+ throw new TypeError("@@toPrimitive must return a primitive value.");
29
+ }
30
+ return (e === "string" ? String : Number)(t);
31
+ }
32
+ class Ui {
33
+ constructor(e) {
34
+ j(this, "context", void 0), j(this, "continueCallback", void 0), j(this, "isBeforeAdCalled", !1), j(this, "isBeforeRewardCalled", !1), j(this, "isAdDismissedCalled", !1), j(this, "isAdViewedCalled", !1), j(this, "isAfterAdCalled", !1), j(this, "currentProvider", void 0), j(this, "currentClientParams", void 0), j(this, "adsHasResponse", !1), j(this, "videoChecker", window.document.createElement("video")), j(this, "wrapShowAdFn", (i) => () => {
35
+ this.adsHasResponse = !0;
36
+ let n = !1;
37
+ this.videoChecker.play().catch(() => {
38
+ n = !1;
39
+ }), n = !this.videoChecker.paused, this.videoChecker.pause(), this.context.track("CallShowAdFn", Object.assign({}, {
40
+ userEvent: n
41
+ }, this.paramsToTrack)), i();
42
+ }), this.context = e;
43
+ }
44
+ get paramsToTrack() {
45
+ var e, i, n, r, o, s;
46
+ return {
47
+ provider: (i = (e = this.currentProvider) == null ? void 0 : e.name) != null ? i : null,
48
+ type: (n = this.currentClientParams) == null ? void 0 : n.type,
49
+ name: ((r = this.currentClientParams) == null ? void 0 : r.type) === "preroll" ? null : (s = (o = this.currentClientParams) == null ? void 0 : o.name) != null ? s : ""
50
+ };
51
+ }
52
+ wrapBeforeAd(e) {
53
+ return () => {
54
+ this.adsHasResponse = !0, this.context.track("CallBeforeAd", this.paramsToTrack), this.isBeforeAdCalled || (this.isBeforeAdCalled = !0, e == null || e());
55
+ };
56
+ }
57
+ wrapBeforeReward(e) {
58
+ return (i) => {
59
+ this.adsHasResponse = !0, this.isBeforeRewardCalled ? this.wrapShowAdFn(i)() : (this.isBeforeRewardCalled = !0, e == null || e(this.wrapShowAdFn(i)));
60
+ };
61
+ }
62
+ wrapAdDismissed(e) {
63
+ return () => {
64
+ this.adsHasResponse = !0, this.isAdDismissedCalled || (this.isAdDismissedCalled = !0, e == null || e());
65
+ };
66
+ }
67
+ wrapAdViewed(e) {
68
+ return () => {
69
+ this.adsHasResponse = !0, this.isAdViewedCalled || (this.isAdViewedCalled = !0, e == null || e());
70
+ };
71
+ }
72
+ wrapAfterAd(e) {
73
+ return () => {
74
+ this.adsHasResponse = !0, this.context.track("CallAfterAd", this.paramsToTrack), this.isAfterAdCalled || (this.isAfterAdCalled = !0, e == null || e());
75
+ };
76
+ }
77
+ wrapAdBreakDone(e) {
78
+ return (i) => {
79
+ var n, r, o, s, a;
80
+ switch (this.adsHasResponse = !0, this.context.track("CallAdBreakDone", {
81
+ provider: (r = (n = this.currentProvider) == null ? void 0 : n.name) != null ? r : null,
82
+ breakType: i.breakType,
83
+ breakName: (o = i.breakName) != null ? o : "",
84
+ breakFormat: i.breakFormat,
85
+ breakStatus: i.breakStatus
86
+ }), i.breakStatus) {
87
+ case "viewed":
88
+ case "ignored":
89
+ case "dismissed":
90
+ case "error": {
91
+ e == null || e(i), (s = this.continueCallback) == null || s.call(this, [!1, i]);
92
+ break;
93
+ }
94
+ default: {
95
+ (a = this.continueCallback) == null || a.call(this, [!0, i]);
96
+ break;
97
+ }
98
+ }
99
+ };
100
+ }
101
+ /**
102
+ * Manages ad break execution and continuation logic
103
+ * @param adsProvider The ad provider implementation
104
+ * @param clientParams Configuration for the ad break
105
+ * @returns Promise resolving with continuation flag and last placement info
106
+ */
107
+ async callAdBreakAndContinue(e, i, n) {
108
+ return this.currentProvider = e, this.currentClientParams = i, this.adsHasResponse = !1, new Promise((r) => {
109
+ this.continueCallback = r;
110
+ let o;
111
+ switch (i.type) {
112
+ case "preroll": {
113
+ o = {
114
+ type: i.type,
115
+ adBreakDone: this.wrapAdBreakDone(i.adBreakDone)
116
+ };
117
+ break;
118
+ }
119
+ case "reward": {
120
+ o = {
121
+ name: i.name,
122
+ type: i.type,
123
+ beforeAd: this.wrapBeforeAd(i.beforeAd),
124
+ beforeReward: this.wrapBeforeReward(i.beforeReward),
125
+ adDismissed: this.wrapAdDismissed(i.adDismissed),
126
+ adViewed: this.wrapAdViewed(i.adViewed),
127
+ afterAd: this.wrapAfterAd(i.afterAd),
128
+ adBreakDone: this.wrapAdBreakDone(i.adBreakDone)
129
+ };
130
+ break;
131
+ }
132
+ default: {
133
+ o = {
134
+ name: i.name,
135
+ type: i.type,
136
+ beforeAd: this.wrapBeforeAd(i.beforeAd),
137
+ afterAd: this.wrapAfterAd(i.afterAd),
138
+ adBreakDone: this.wrapAdBreakDone(i.adBreakDone)
139
+ };
140
+ break;
141
+ }
142
+ }
143
+ window.setTimeout(() => {
144
+ var s, a, l, c;
145
+ this.adsHasResponse || (this.context.track("CallAdBreakTimeout", {
146
+ type: i.type,
147
+ provider: (a = (s = this.currentProvider) == null ? void 0 : s.name) != null ? a : null
148
+ }), (c = this.continueCallback) == null || c.call(this, [!0, {
149
+ breakType: i.type,
150
+ breakName: i.type === "preroll" ? "" : (l = i.name) != null ? l : "",
151
+ breakFormat: i.type === "reward" ? "reward" : "interstitial",
152
+ breakStatus: "timeout"
153
+ }]));
154
+ }, 5e3), this.context.track("CallAdBreak", this.paramsToTrack), e.adBreak(o, n), window.JoliTesterBridge && console.log("joli-fullscreen-ad-show");
155
+ });
156
+ }
157
+ }
158
+ function Ae(t, e, i) {
159
+ return (e = ji(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
160
+ }
161
+ function ji(t) {
162
+ var e = Fi(t, "string");
163
+ return typeof e == "symbol" ? e : e + "";
164
+ }
165
+ function Fi(t, e) {
166
+ if (typeof t != "object" || !t)
167
+ return t;
168
+ var i = t[Symbol.toPrimitive];
169
+ if (i !== void 0) {
170
+ var n = i.call(t, e);
171
+ if (typeof n != "object")
172
+ return n;
173
+ throw new TypeError("@@toPrimitive must return a primitive value.");
174
+ }
175
+ return (e === "string" ? String : Number)(t);
176
+ }
177
+ class Bi {
178
+ constructor(e) {
179
+ Ae(this, "context", void 0), Ae(this, "adBreakIsShowing", !1), Ae(this, "reportPageJumpOut", () => {
180
+ this.context.track("AdBreakJumpOut", {
181
+ context: "AdsActionDetection"
182
+ });
183
+ }), Ae(this, "reportPageHide", () => {
184
+ this.context.track("AdBreakHide", {
185
+ context: "AdsActionDetection"
186
+ });
187
+ }), this.context = e, window.addEventListener("visibilitychange", () => {
188
+ document.hidden && this.adBreakIsShowing && this.reportPageHide();
189
+ }), window.addEventListener("beforeunload", (i) => {
190
+ this.adBreakIsShowing && this.reportPageJumpOut();
191
+ });
192
+ }
193
+ }
194
+ var Xt = Object.defineProperty, Vi = Object.defineProperties, Gi = Object.getOwnPropertyDescriptors, wt = Object.getOwnPropertySymbols, Ki = Object.prototype.hasOwnProperty, zi = Object.prototype.propertyIsEnumerable, Et = (t, e, i) => e in t ? Xt(t, e, {
195
+ enumerable: !0,
196
+ configurable: !0,
197
+ writable: !0,
198
+ value: i
199
+ }) : t[e] = i, qi = (t, e) => {
200
+ for (var i in e || (e = {}))
201
+ Ki.call(e, i) && Et(t, i, e[i]);
202
+ if (wt)
203
+ for (var i of wt(e))
204
+ zi.call(e, i) && Et(t, i, e[i]);
205
+ return t;
206
+ }, Hi = (t, e) => Vi(t, Gi(e)), Wi = (t, e) => {
207
+ for (var i in e)
208
+ Xt(t, i, {
209
+ get: e[i],
210
+ enumerable: !0
211
+ });
212
+ }, Zt = (t, e, i, n) => {
213
+ for (var r = e, o = t.length - 1, s; o >= 0; o--)
214
+ (s = t[o]) && (r = s(r) || r);
215
+ return r;
216
+ }, Ji = (t, e, i) => new Promise((n, r) => {
217
+ var o = (l) => {
218
+ try {
219
+ a(i.next(l));
220
+ } catch (c) {
221
+ r(c);
222
+ }
223
+ }, s = (l) => {
224
+ try {
225
+ a(i.throw(l));
226
+ } catch (c) {
227
+ r(c);
228
+ }
229
+ }, a = (l) => l.done ? n(l.value) : Promise.resolve(l.value).then(o, s);
230
+ a((i = i.apply(t, e)).next());
231
+ });
232
+ if (typeof window != "undefined" && !window.AbortController) {
233
+ let t = function() {
234
+ this.signal = new e();
235
+ };
236
+ t.prototype.abort = function() {
237
+ this.signal._aborted = !0, typeof this.signal.onabort == "function" && this.signal.onabort(new Event("abort"));
238
+ let i = new Event("abort");
239
+ this.signal.dispatchEvent(i);
240
+ };
241
+ let e = function() {
242
+ this._aborted = !1, this.aborted = !1, this.onabort = null, this._eventListeners = {};
243
+ };
244
+ Object.defineProperty(e.prototype, "aborted", {
245
+ get: function() {
246
+ return this._aborted;
247
+ }
248
+ }), e.prototype.addEventListener = function(i, n) {
249
+ this._eventListeners[i] || (this._eventListeners[i] = []), this._eventListeners[i].push(n);
250
+ }, e.prototype.removeEventListener = function(i, n) {
251
+ if (!this._eventListeners[i])
252
+ return;
253
+ let r = this._eventListeners[i].indexOf(n);
254
+ r !== -1 && this._eventListeners[i].splice(r, 1);
255
+ }, e.prototype.dispatchEvent = function(i) {
256
+ if (this._eventListeners[i.type])
257
+ for (let n of this._eventListeners[i.type])
258
+ n.call(this, i);
259
+ }, window.AbortController = t, window.AbortSignal = e;
260
+ }
261
+ function Yi(t) {
262
+ return new Promise((e) => {
263
+ setTimeout(() => {
264
+ e();
265
+ }, t);
266
+ });
267
+ }
268
+ function Qi(t) {
269
+ return typeof t == "string";
270
+ }
271
+ function Xi(t) {
272
+ return typeof t == "undefined";
273
+ }
274
+ function Zi(t) {
275
+ return Xi(t) || t === null;
276
+ }
277
+ function en(t) {
278
+ return typeof t == "function";
279
+ }
280
+ function ei(t) {
281
+ let e = t, i = null, n = function() {
282
+ for (var r = arguments.length, o = new Array(r), s = 0; s < r; s++)
283
+ o[s] = arguments[s];
284
+ return i || (i = new e(...o)), i;
285
+ };
286
+ return n.prototype = e.prototype, n;
287
+ }
288
+ var tn = ((t) => (t[t.DEVELOPER_FILE_NOT_FOUND = 0] = "DEVELOPER_FILE_NOT_FOUND", t[t.INTERNAL_IOS_CAN_NOT_FOUND_PKG = 1] = "INTERNAL_IOS_CAN_NOT_FOUND_PKG", t[t.USER_IOS_LOAD_TIMEOUT = 2] = "USER_IOS_LOAD_TIMEOUT", t[t.INTERNAL_IOS_PKG_LOAD_ERROR = 3] = "INTERNAL_IOS_PKG_LOAD_ERROR", t[t.INTERNAL_IOS_PKG_PARSE_FAIL = 4] = "INTERNAL_IOS_PKG_PARSE_FAIL", t[t.USER_IOS_GET_EMPTY_DATA = 5] = "USER_IOS_GET_EMPTY_DATA", t[t.USER_ANDROID_GET_PKG_FAIL = 6] = "USER_ANDROID_GET_PKG_FAIL", t[t.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE = 7] = "DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE", t))(tn || {});
289
+ function le(t) {
290
+ return function() {
291
+ var e, i;
292
+ ((i = (e = globalThis.VConsole) == null ? void 0 : e[t]) != null ? i : globalThis.console[t])(...arguments);
293
+ };
294
+ }
295
+ var nn = {
296
+ log: le("log"),
297
+ warn: le("warn"),
298
+ info: le("info"),
299
+ error: le("error"),
300
+ debug: le("debug")
301
+ };
302
+ Object.assign(globalThis, {
303
+ logger: nn
304
+ });
305
+ var St = Symbol.for("Jolibox.canIUseMap"), rn = {};
306
+ globalThis[St] || (globalThis[St] = rn);
307
+ var ti = ((t) => (t[t.System = 1e3] = "System", t[t.ErrorTrace = 1001] = "ErrorTrace", t[t.UserDefined = 1002] = "UserDefined", t))(ti || {}), ii = ((t) => (t.MiniGame = "mini-game", t.MiniDrama = "mini-drama", t.App = "app", t.WebSDK = "web-sdk", t.AppSDK = "app-sdk", t))(ii || {}), ni = ((t) => (t[t.App = 0] = "App", t[t.H5 = 1] = "H5", t[t.Weapp = 2] = "Weapp", t[t.Alipay = 3] = "Alipay", t[t.Gcash = 4] = "Gcash", t[t.Dana = 5] = "Dana", t[t.Umma = 6] = "Umma", t[t.WebSDK = 1e3] = "WebSDK", t[t.AppSDK = 1001] = "AppSDK", t[t.Other = 9999] = "Other", t))(ni || {}), xt = ["name", "params"], on = ["name", "type", "location", "target", "extra", "timestamp", "userId"], sn = ["platform", "os", "appVersion", "appId", "model", "brand", "uuid", "jsSdkVersion", "extra"];
308
+ function xe(t, e) {
309
+ return e.map((i) => {
310
+ if (i === "params" && t[i]) {
311
+ let n = t[i];
312
+ return Object.keys(n).reduce((r, o) => (r[o] = String(n[o]), r), {});
313
+ }
314
+ return t[i];
315
+ });
316
+ }
317
+ function an(t) {
318
+ let e = t.location ? xe(t.location, xt) : null, i = t.target ? xe(t.target, xt) : null;
319
+ return xe(Hi(qi({}, t), {
320
+ location: e,
321
+ target: i
322
+ }), on);
323
+ }
324
+ function ln(t) {
325
+ let e = t.events.map((n) => an(n)), i = xe(t.device, sn);
326
+ return [t.protocolVersion, e, i, t.project];
327
+ }
328
+ function cn() {
329
+ try {
330
+ if (window.__joliboxLocalStorage__)
331
+ return window.__joliboxLocalStorage__;
332
+ let t = Object.getOwnPropertyDescriptor(window, "localStorage");
333
+ if (t && t.get) {
334
+ let n = t.get.call(window);
335
+ return window.__joliboxLocalStorage__ = n, n;
336
+ }
337
+ if (t = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window), "localStorage"), t && t.get)
338
+ return t.get.call(window);
339
+ let e = Window.prototype, i = Object.getOwnPropertyDescriptor(e, "localStorage");
340
+ if (i && i.get) {
341
+ let n = i.get.call(window);
342
+ return window.__joliboxLocalStorage__ = n, n;
343
+ }
344
+ return localStorage;
345
+ } catch (t) {
346
+ return console.warn("Failed to get original localStorage, fallback to default implementation", t), localStorage;
347
+ }
348
+ }
349
+ cn();
350
+ navigator.userAgent.includes("iPhone") || navigator.userAgent.includes("iPod") || navigator.userAgent.includes("iPad") || navigator.userAgent.includes("iPhone OS"), navigator.userAgent.includes("Android"), navigator.userAgent.includes("Mac"), navigator.userAgent.includes("FB_IAB"), !navigator.userAgent.includes("iPhone") && navigator.userAgent.includes("Android");
351
+ var Qe = class Xe {
352
+ constructor(e) {
353
+ this.element = e, this.next = Xe.Undefined, this.prev = Xe.Undefined;
354
+ }
355
+ };
356
+ Qe.Undefined = new Qe(void 0);
357
+ var x = Qe, un = class {
358
+ constructor() {
359
+ this._first = x.Undefined, this._last = x.Undefined, this._size = 0;
360
+ }
361
+ get size() {
362
+ return this._size;
363
+ }
364
+ isEmpty() {
365
+ return this._first === x.Undefined;
366
+ }
367
+ clear() {
368
+ let e = this._first;
369
+ for (; e !== x.Undefined; ) {
370
+ let i = e.next;
371
+ e.prev = x.Undefined, e.next = x.Undefined, e = i;
372
+ }
373
+ this._first = x.Undefined, this._last = x.Undefined, this._size = 0;
374
+ }
375
+ unshift(e) {
376
+ return this._insert(e, !1);
377
+ }
378
+ push(e) {
379
+ return this._insert(e, !0);
380
+ }
381
+ _insert(e, i) {
382
+ let n = new x(e);
383
+ if (this._first === x.Undefined)
384
+ this._first = n, this._last = n;
385
+ else if (i) {
386
+ let o = this._last;
387
+ this._last = n, n.prev = o, o.next = n;
388
+ } else {
389
+ let o = this._first;
390
+ this._first = n, n.next = o, o.prev = n;
391
+ }
392
+ this._size += 1;
393
+ let r = !1;
394
+ return () => {
395
+ r || (r = !0, this._remove(n));
396
+ };
397
+ }
398
+ shift() {
399
+ if (this._first !== x.Undefined) {
400
+ let e = this._first.element;
401
+ return this._remove(this._first), e;
402
+ }
403
+ }
404
+ pop() {
405
+ if (this._last !== x.Undefined) {
406
+ let e = this._last.element;
407
+ return this._remove(this._last), e;
408
+ }
409
+ }
410
+ _remove(e) {
411
+ if (e.prev !== x.Undefined && e.next !== x.Undefined) {
412
+ let i = e.prev;
413
+ i.next = e.next, e.next.prev = i;
414
+ } else
415
+ e.prev === x.Undefined && e.next === x.Undefined ? (this._first = x.Undefined, this._last = x.Undefined) : e.next === x.Undefined ? (this._last = this._last.prev, this._last.next = x.Undefined) : e.prev === x.Undefined && (this._first = this._first.next, this._first.prev = x.Undefined);
416
+ this._size -= 1;
417
+ }
418
+ *[Symbol.iterator]() {
419
+ let e = this._first;
420
+ for (; e !== x.Undefined; )
421
+ yield e.element, e = e.next;
422
+ }
423
+ }, dn = 0, ce = class {
424
+ constructor(e) {
425
+ this.value = e, this.id = dn++;
426
+ }
427
+ }, ve = class {
428
+ constructor(e) {
429
+ this.options = e, this._size = 0;
430
+ }
431
+ dispose(e) {
432
+ var i, n;
433
+ this._disposed || (this._disposed = !0, this._listeners && (e ? (this._listeners instanceof ce && (this._listeners = [this._listeners]), this._listeners = this._listeners.filter((r) => (r == null ? void 0 : r.value) === e)) : (this._listeners = void 0, this._size = 0)), (n = (i = this.options) == null ? void 0 : i.onDidRemoveLastListener) == null || n.call(i));
434
+ }
435
+ get event() {
436
+ return this._event != null || (this._event = (e, i) => {
437
+ var n, r, o, s, a, l;
438
+ if (this._disposed)
439
+ return () => {
440
+ console.info("[Jolibox SDK] Emitter is _disposed");
441
+ };
442
+ i && (e = e.bind(i));
443
+ let c = new ce(e);
444
+ return this._listeners ? this._listeners instanceof ce ? this._listeners = [this._listeners, c] : this._listeners.push(c) : ((r = (n = this.options) == null ? void 0 : n.onWillAddFirstListener) == null || r.call(n, this), this._listeners = c, (s = (o = this.options) == null ? void 0 : o.onDidFirstListener) == null || s.call(o, this)), (l = (a = this.options) == null ? void 0 : a.onDidAddListener) == null || l.call(a, this), this._size++, () => {
445
+ var u, d, f, v;
446
+ if (!this._disposed) {
447
+ if (this._listeners instanceof ce)
448
+ this._listeners.id === c.id && (this._listeners = void 0, this._size = 0, (d = (u = this.options) == null ? void 0 : u.onDidRemoveLastListener) == null || d.call(u));
449
+ else if (this._listeners) {
450
+ let y = this._listeners.indexOf(c);
451
+ y >= 0 && (this._listeners.splice(y, 1), this._size--, this._size === 0 && ((v = (f = this.options) == null ? void 0 : f.onDidRemoveLastListener) == null || v.call(f)));
452
+ }
453
+ }
454
+ };
455
+ }), this._event;
456
+ }
457
+ _deliver(e, i) {
458
+ var n;
459
+ if (!e)
460
+ return;
461
+ let r = ((n = this.options) == null ? void 0 : n.onListenerError) || Error.constructor;
462
+ if (!r) {
463
+ e.value(i);
464
+ return;
465
+ }
466
+ try {
467
+ e.value(i);
468
+ } catch (o) {
469
+ r(o);
470
+ }
471
+ }
472
+ fire(e) {
473
+ this._listeners && (this._listeners instanceof ce ? this._deliver(this._listeners, e) : this._listeners.forEach((i) => this._deliver(i, e)));
474
+ }
475
+ hasListeners() {
476
+ return this._size > 0;
477
+ }
478
+ }, fn = class {
479
+ constructor() {
480
+ this.listeners = /* @__PURE__ */ new Map(), this.listerHandlerMap = /* @__PURE__ */ new WeakMap(), this.cachedEventQueue = /* @__PURE__ */ new Map();
481
+ }
482
+ on(t, e) {
483
+ var i;
484
+ let n = (i = this.listeners.get(t)) != null ? i : new ve(), r = (a) => e(...a.args), o = n.event(r);
485
+ this.listerHandlerMap.set(e, {
486
+ handler: r,
487
+ dispose: o
488
+ }), this.listeners.set(t, n);
489
+ let s = this.cachedEventQueue.get(t);
490
+ if (s)
491
+ for (let a of s)
492
+ e(...a.args);
493
+ }
494
+ flushCachedEvent(t) {
495
+ t ? this.cachedEventQueue.delete(t) : this.cachedEventQueue.clear();
496
+ }
497
+ off(t, e) {
498
+ let i = this.listerHandlerMap.get(e);
499
+ i && (i.dispose(), this.listerHandlerMap.delete(e));
500
+ }
501
+ emit(t) {
502
+ let e = this.listeners.get(t), i = this.cachedEventQueue.get(t);
503
+ for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++)
504
+ r[o - 1] = arguments[o];
505
+ i || (i = new un(), this.cachedEventQueue.set(t, i)), i.push({
506
+ args: r
507
+ }), e && e.fire({
508
+ event: t,
509
+ args: r
510
+ });
511
+ }
512
+ }, Ze = {};
513
+ Wi(Ze, {
514
+ None: () => hn,
515
+ filter: () => _n,
516
+ once: () => ri,
517
+ toPromise: () => vn
518
+ });
519
+ var hn = () => (console.log("[Jolibox SDK] None Event"), () => {
520
+ console.log("[Jolibox SDK] None Event dispose");
521
+ });
522
+ function vn(t) {
523
+ return new Promise((e) => ri(t)(e));
524
+ }
525
+ function ri(t) {
526
+ return function(e) {
527
+ let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, n = !1;
528
+ return t((r) => {
529
+ if (!n)
530
+ return n = !0, e.call(i, r);
531
+ }, null);
532
+ };
533
+ }
534
+ function _n(t, e) {
535
+ return ((i) => {
536
+ let n = {
537
+ onWillAddFirstListener() {
538
+ i(r.fire, r);
539
+ }
540
+ }, r = new ve(n);
541
+ return r.event;
542
+ })(function(i) {
543
+ let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
544
+ return t((r) => e(r) && i.call(n, r), null);
545
+ });
546
+ }
547
+ var Be = Symbol.for("Jolibox.hostEmitter"), pn = () => {
548
+ let t = new fn();
549
+ return globalThis[Be] || (globalThis[Be] = {
550
+ on: t.on.bind(t),
551
+ off: t.off.bind(t),
552
+ emit: t.emit.bind(t)
553
+ }), globalThis[Be];
554
+ };
555
+ pn();
556
+ function yn(t, e) {
557
+ let i = Math.min(t.length, e.length);
558
+ for (let n = 0; n < i; n++)
559
+ gn(t[n], e[n]);
560
+ }
561
+ function gn(t, e) {
562
+ if (Qi(e)) {
563
+ if (typeof t !== e)
564
+ throw new Error(`argument does not match constraint: typeof ${e}`);
565
+ } else if (en(e)) {
566
+ try {
567
+ if (t instanceof e)
568
+ return;
569
+ } catch (i) {
570
+ }
571
+ if (!Zi(t) && t.constructor === e || e.length === 1 && e.call(void 0, t) === !0)
572
+ return;
573
+ throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true");
574
+ }
575
+ }
576
+ var et = class {
577
+ constructor() {
578
+ this._commands = /* @__PURE__ */ new Map(), this._onDidRegisterCommand = new ve(), this.onDidRegisterCommand = this._onDidRegisterCommand.event, console.log("[Jolibox SDK] command registry");
579
+ }
580
+ registerCommand(e) {
581
+ if (!e)
582
+ throw new Error("invalid command");
583
+ if (e.metadata && Array.isArray(e.metadata.args)) {
584
+ let n = [];
585
+ for (let o of e.metadata.args)
586
+ n.push(o.constraint);
587
+ let r = e.handler;
588
+ e.handler = function() {
589
+ for (var o = arguments.length, s = new Array(o), a = 0; a < o; a++)
590
+ s[a] = arguments[a];
591
+ return yn(s, n), r(...s);
592
+ };
593
+ }
594
+ let {
595
+ id: i
596
+ } = e;
597
+ this._commands.get(i) && console.info(`[Jolibox SDK] duplicated command is registered ${i}`), this._commands.set(i, e), this._onDidRegisterCommand.fire(i);
598
+ }
599
+ getCommand(e) {
600
+ return this._commands.get(e);
601
+ }
602
+ getCommands() {
603
+ let e = /* @__PURE__ */ new Map();
604
+ for (let i of this._commands.keys()) {
605
+ let n = this.getCommand(i);
606
+ n && e.set(i, n);
607
+ }
608
+ return e;
609
+ }
610
+ };
611
+ et = Zt([ei], et);
612
+ var Rt = class {
613
+ constructor() {
614
+ this._onWillExecuteCommand = new ve(), this.onWillExecuteCommand = this._onWillExecuteCommand.event, this._onDidExecuteCommand = new ve(), this.onDidExecuteCommand = this._onDidExecuteCommand.event, this.registry = new et(), this._starActivation = null;
615
+ }
616
+ _activateStar() {
617
+ return this._starActivation || (this._starActivation = Yi(3e4)), this._starActivation;
618
+ }
619
+ executeCommand(e) {
620
+ for (var i = arguments.length, n = new Array(i > 1 ? i - 1 : 0), r = 1; r < i; r++)
621
+ n[r - 1] = arguments[r];
622
+ return Ji(this, null, function* () {
623
+ return this.registry.getCommand(e) ? this._tryExecuteCommand(e, n) : (yield Promise.all([Promise.race([this._activateStar(), Ze.toPromise(Ze.filter(this.registry.onDidRegisterCommand, (o) => o === e))])]), this._tryExecuteCommand(e, n));
624
+ });
625
+ }
626
+ executeCommandThowErr(e) {
627
+ if (!this.registry.getCommand(e))
628
+ throw new Error(`command '${e}' not found`);
629
+ let i = this.registry.getCommand(e);
630
+ for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++)
631
+ r[o - 1] = arguments[o];
632
+ this._onWillExecuteCommand.fire({
633
+ commandId: e,
634
+ args: r
635
+ });
636
+ let s = this.invokeFunction(i.handler, ...r);
637
+ return this._onDidExecuteCommand.fire({
638
+ commandId: e,
639
+ args: r
640
+ }), s;
641
+ }
642
+ _tryExecuteCommand(e, i) {
643
+ let n = this.registry.getCommand(e);
644
+ if (!n)
645
+ return Promise.reject(new Error(`command '${e}' not found`));
646
+ try {
647
+ this._onWillExecuteCommand.fire({
648
+ commandId: e,
649
+ args: i
650
+ });
651
+ let r = this.invokeFunction(n.handler, ...i);
652
+ return this._onDidExecuteCommand.fire({
653
+ commandId: e,
654
+ args: i
655
+ }), Promise.resolve(r);
656
+ } catch (r) {
657
+ return Promise.reject(r);
658
+ }
659
+ }
660
+ invokeFunction(e) {
661
+ try {
662
+ for (var i = arguments.length, n = new Array(i > 1 ? i - 1 : 0), r = 1; r < i; r++)
663
+ n[r - 1] = arguments[r];
664
+ return e(...n);
665
+ } finally {
666
+ }
667
+ }
668
+ };
669
+ Rt = Zt([ei], Rt);
670
+ function Ve(t, e, i) {
671
+ return (e = mn(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
672
+ }
673
+ function mn(t) {
674
+ var e = bn(t, "string");
675
+ return typeof e == "symbol" ? e : e + "";
676
+ }
677
+ function bn(t, e) {
678
+ if (typeof t != "object" || !t)
679
+ return t;
680
+ var i = t[Symbol.toPrimitive];
681
+ if (i !== void 0) {
682
+ var n = i.call(t, e);
683
+ if (typeof n != "object")
684
+ return n;
685
+ throw new TypeError("@@toPrimitive must return a primitive value.");
686
+ }
687
+ return (e === "string" ? String : Number)(t);
688
+ }
689
+ class oi {
690
+ constructor(e) {
691
+ let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "GAME";
692
+ Ve(this, "context", void 0), Ve(this, "placement", "GAME"), Ve(this, "contextInfo", void 0), this.context = e, this.placement = i, this.contextInfo = this.context.getContextInfo();
693
+ }
694
+ getLocation() {
695
+ const e = new URLSearchParams(window.location.search), i = {};
696
+ return e.forEach((n, r) => {
697
+ i[r] = n;
698
+ }), {
699
+ name: this.placement === "GAME" ? "GamePage" : "DramaPage",
700
+ params: i
701
+ };
702
+ }
703
+ getDevice() {
704
+ var e, i, n, r;
705
+ return {
706
+ platform: (e = this.contextInfo.platform) != null ? e : ni.WebSDK,
707
+ os: this.contextInfo.osType + "_" + this.contextInfo.runtimeType,
708
+ appVersion: "1.0.0",
709
+ // mock
710
+ appId: (i = this.contextInfo.hostAppId) != null ? i : "1",
711
+ model: (n = this.contextInfo.deviceModel) != null ? n : "UnknownModel",
712
+ brand: (r = this.contextInfo.deviceBrand) != null ? r : "UnknownBrand",
713
+ uuid: this.contextInfo.deviceId,
714
+ jsSdkVersion: "1.0.0",
715
+ // mock
716
+ extra: {}
717
+ };
718
+ }
719
+ serialize(e, i) {
720
+ var o;
721
+ const r = {
722
+ protocolVersion: "1.0.0",
723
+ events: [{
724
+ name: e,
725
+ type: ti.System,
726
+ location: this.getLocation(),
727
+ target: null,
728
+ extra: i,
729
+ timestamp: Date.now(),
730
+ userId: (o = this.contextInfo.userId) != null ? o : null
731
+ }],
732
+ device: this.getDevice(),
733
+ project: ii.WebSDK
734
+ };
735
+ return ln(r);
736
+ }
737
+ }
738
+ function we(t, e, i) {
739
+ return (e = An(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
740
+ }
741
+ function An(t) {
742
+ var e = wn(t, "string");
743
+ return typeof e == "symbol" ? e : e + "";
744
+ }
745
+ function wn(t, e) {
746
+ if (typeof t != "object" || !t)
747
+ return t;
748
+ var i = t[Symbol.toPrimitive];
749
+ if (i !== void 0) {
750
+ var n = i.call(t, e);
751
+ if (typeof n != "object")
752
+ return n;
753
+ throw new TypeError("@@toPrimitive must return a primitive value.");
754
+ }
755
+ return (e === "string" ? String : Number)(t);
756
+ }
757
+ class En {
758
+ constructor(e) {
759
+ we(this, "configs", null), we(this, "firstRun", !0), we(this, "context", void 0), we(this, "contextInfo", void 0), this.context = e, this.contextInfo = this.context.getContextInfo(), this.init();
760
+ }
761
+ async init() {
762
+ try {
763
+ this.configs = await this.context.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config", {});
764
+ } catch (e) {
765
+ }
766
+ }
767
+ /**
768
+ * Should bypass calling interstitial based on the channel policy.
769
+ * @returns
770
+ */
771
+ shouldBypassCallingInterstitial() {
772
+ var i, n;
773
+ let e;
774
+ if (!this.configs)
775
+ this.init(), e = !this.firstRun;
776
+ else {
777
+ const r = (i = this.contextInfo.channel) != null ? i : "", o = this.configs[r], s = (n = o == null ? void 0 : o.interstitialRate) != null ? n : 1;
778
+ e = Math.random() < s;
779
+ }
780
+ return this.firstRun = !1, e;
781
+ }
782
+ }
783
+ function H(t, e, i) {
784
+ return (e = Sn(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
785
+ }
786
+ function Sn(t) {
787
+ var e = xn(t, "string");
788
+ return typeof e == "symbol" ? e : e + "";
789
+ }
790
+ function xn(t, e) {
791
+ if (typeof t != "object" || !t)
792
+ return t;
793
+ var i = t[Symbol.toPrimitive];
794
+ if (i !== void 0) {
795
+ var n = i.call(t, e);
796
+ if (typeof n != "object")
797
+ return n;
798
+ throw new TypeError("@@toPrimitive must return a primitive value.");
799
+ }
800
+ return (e === "string" ? String : Number)(t);
801
+ }
802
+ class Rn {
803
+ /**
804
+ * Internal constructor, should not be called directly
805
+ */
806
+ constructor(e, i) {
807
+ H(this, "name", "ADSENSE"), H(this, "context", void 0), H(this, "contextInfo", void 0), H(this, "configured", !1), H(this, "initParams", void 0), H(this, "push", function() {
808
+ let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
809
+ window.adsbygoogle.push(n);
810
+ }), H(this, "adConfig", (n) => {
811
+ const s = n, {
812
+ onReady: r
813
+ } = s, o = gt(s, [
814
+ "onReady"
815
+ ]);
816
+ this.context.track("CallAdConfig", o), this.configured ? console.warn("Ad config already set, skipping") : (this.configured = !0, this.push(n));
817
+ }), H(this, "adBreak", (n) => {
818
+ if (!this.contextInfo.objectId) {
819
+ console.warn("Game ID is not set, skip calling adBreak");
820
+ return;
821
+ }
822
+ this.push(n);
823
+ }), H(this, "adUnit", async (n) => {
824
+ var y, p, A, h;
825
+ if (this.context.track("CallAdUnit", {
826
+ adFormat: (p = (y = n.adFormat) == null ? void 0 : y.toString()) != null ? p : null,
827
+ fullWidthResponsive: (A = n.fullWidthResponsive) != null ? A : null
828
+ }), document.querySelector("#jolibox-ads")) {
829
+ console.warn("Ad unit already set, skipping");
830
+ return;
831
+ }
832
+ const {
833
+ el: r,
834
+ slot: o,
835
+ adFormat: s,
836
+ fullWidthResponsive: a,
837
+ style: l
838
+ } = n;
839
+ let c;
840
+ if (!r)
841
+ throw new Error("targeting element is required");
842
+ if (typeof r == "string" ? c = document.querySelector(r) : c = r, !c)
843
+ throw new Error("targeting element not found");
844
+ let u = o;
845
+ if (u || (u = this.initParams.unitId), !u)
846
+ throw new Error("slot is required");
847
+ const d = typeof s == "object" && Array.isArray(s) ? s.join(", ") : s, f = document.createElement("ins");
848
+ if (f.className = "adsbygoogle", f.id = "jolibox-ads", f.style.display = "block", f.setAttribute("data-ad-client", this.initParams.clientId), f.setAttribute("data-ad-slot", u), d && f.setAttribute("data-ad-format", d), a && f.setAttribute("data-full-width-responsive", a), l && f.setAttribute("style", l), (h = this.contextInfo.testAdsMode) != null ? h : !1) {
849
+ const _ = document.createElement("div");
850
+ _.style.position = "absolute", _.style.top = "0", _.style.left = "0", _.style.width = "100%", _.style.height = "100%", _.style.display = "flex", _.style.justifyContent = "center", _.style.alignItems = "center", _.style.backgroundColor = "rgba(0, 0, 0, 0.5)", _.style.color = "white", _.innerHTML = "Test Ad", f.style.position = "relative", c.appendChild(f), f.appendChild(_);
851
+ } else
852
+ c.appendChild(f), new MutationObserver((L) => {
853
+ L.forEach((q) => {
854
+ if (q.type === "attributes" && q.attributeName === "data-ad-status") {
855
+ const B = f.getAttribute("data-ad-status");
856
+ this.context.track("AdSenseUnitStatusChanged", {
857
+ status: B != null ? B : "null"
858
+ });
859
+ }
860
+ });
861
+ }).observe(f, {
862
+ attributes: !0,
863
+ attributeFilter: ["data-ad-status"]
864
+ }), this.push({});
865
+ }), this.context = e, this.contextInfo = this.context.getContextInfo(), this.initParams = i, window.adsbygoogle = window.adsbygoogle || [];
866
+ }
867
+ async init() {
868
+ var n;
869
+ if (this.context.track("CallAdsInit", {
870
+ provider: this.name
871
+ }), typeof window == "undefined")
872
+ return;
873
+ const e = "google-adsense", i = (n = this.contextInfo.testAdsMode) != null ? n : !1;
874
+ if (!document.getElementById(e) && this.initParams.clientId) {
875
+ const r = document.createElement("script");
876
+ r.id = e, r.async = !0, r.crossOrigin = "anonymous", r.src = `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`, i && r.setAttribute("data-adbreak-test", "on"), this.initParams.channelId && r.setAttribute("data-ad-channel", this.initParams.channelId), document.head.appendChild(r), this.context.track("LoadAdsenseCompleted", null);
877
+ }
878
+ }
879
+ }
880
+ function In(t) {
881
+ if (t.sheet)
882
+ return t.sheet;
883
+ for (var e = 0; e < document.styleSheets.length; e++)
884
+ if (document.styleSheets[e].ownerNode === t)
885
+ return document.styleSheets[e];
886
+ }
887
+ function On(t) {
888
+ var e = document.createElement("style");
889
+ return e.setAttribute("data-emotion", t.key), t.nonce !== void 0 && e.setAttribute("nonce", t.nonce), e.appendChild(document.createTextNode("")), e.setAttribute("data-s", ""), e;
890
+ }
891
+ var Tn = /* @__PURE__ */ function() {
892
+ function t(i) {
893
+ var n = this;
894
+ this._insertTag = function(r) {
895
+ var o;
896
+ n.tags.length === 0 ? n.insertionPoint ? o = n.insertionPoint.nextSibling : n.prepend ? o = n.container.firstChild : o = n.before : o = n.tags[n.tags.length - 1].nextSibling, n.container.insertBefore(r, o), n.tags.push(r);
897
+ }, this.isSpeedy = i.speedy === void 0 ? !0 : i.speedy, this.tags = [], this.ctr = 0, this.nonce = i.nonce, this.key = i.key, this.container = i.container, this.prepend = i.prepend, this.insertionPoint = i.insertionPoint, this.before = null;
898
+ }
899
+ var e = t.prototype;
900
+ return e.hydrate = function(n) {
901
+ n.forEach(this._insertTag);
902
+ }, e.insert = function(n) {
903
+ this.ctr % (this.isSpeedy ? 65e3 : 1) === 0 && this._insertTag(On(this));
904
+ var r = this.tags[this.tags.length - 1];
905
+ if (this.isSpeedy) {
906
+ var o = In(r);
907
+ try {
908
+ o.insertRule(n, o.cssRules.length);
909
+ } catch (s) {
910
+ }
911
+ } else
912
+ r.appendChild(document.createTextNode(n));
913
+ this.ctr++;
914
+ }, e.flush = function() {
915
+ this.tags.forEach(function(n) {
916
+ var r;
917
+ return (r = n.parentNode) == null ? void 0 : r.removeChild(n);
918
+ }), this.tags = [], this.ctr = 0;
919
+ }, t;
920
+ }(), N = "-ms-", Ne = "-moz-", g = "-webkit-", si = "comm", lt = "rule", ct = "decl", kn = "@import", ai = "@keyframes", Dn = "@layer", Nn = Math.abs, $e = String.fromCharCode, Pn = Object.assign;
921
+ function Cn(t, e) {
922
+ return k(t, 0) ^ 45 ? (((e << 2 ^ k(t, 0)) << 2 ^ k(t, 1)) << 2 ^ k(t, 2)) << 2 ^ k(t, 3) : 0;
923
+ }
924
+ function li(t) {
925
+ return t.trim();
926
+ }
927
+ function Ln(t, e) {
928
+ return (t = e.exec(t)) ? t[0] : t;
929
+ }
930
+ function m(t, e, i) {
931
+ return t.replace(e, i);
932
+ }
933
+ function tt(t, e) {
934
+ return t.indexOf(e);
935
+ }
936
+ function k(t, e) {
937
+ return t.charCodeAt(e) | 0;
938
+ }
939
+ function _e(t, e, i) {
940
+ return t.slice(e, i);
941
+ }
942
+ function K(t) {
943
+ return t.length;
944
+ }
945
+ function ut(t) {
946
+ return t.length;
947
+ }
948
+ function Ee(t, e) {
949
+ return e.push(t), t;
950
+ }
951
+ function $n(t, e) {
952
+ return t.map(e).join("");
953
+ }
954
+ var Me = 1, ne = 1, ci = 0, M = 0, T = 0, re = "";
955
+ function Ue(t, e, i, n, r, o, s) {
956
+ return { value: t, root: e, parent: i, type: n, props: r, children: o, line: Me, column: ne, length: s, return: "" };
957
+ }
958
+ function ue(t, e) {
959
+ return Pn(Ue("", null, null, "", null, null, 0), t, { length: -t.length }, e);
960
+ }
961
+ function Mn() {
962
+ return T;
963
+ }
964
+ function Un() {
965
+ return T = M > 0 ? k(re, --M) : 0, ne--, T === 10 && (ne = 1, Me--), T;
966
+ }
967
+ function U() {
968
+ return T = M < ci ? k(re, M++) : 0, ne++, T === 10 && (ne = 1, Me++), T;
969
+ }
970
+ function z() {
971
+ return k(re, M);
972
+ }
973
+ function Re() {
974
+ return M;
975
+ }
976
+ function ge(t, e) {
977
+ return _e(re, t, e);
978
+ }
979
+ function pe(t) {
980
+ switch (t) {
981
+ case 0:
982
+ case 9:
983
+ case 10:
984
+ case 13:
985
+ case 32:
986
+ return 5;
987
+ case 33:
988
+ case 43:
989
+ case 44:
990
+ case 47:
991
+ case 62:
992
+ case 64:
993
+ case 126:
994
+ case 59:
995
+ case 123:
996
+ case 125:
997
+ return 4;
998
+ case 58:
999
+ return 3;
1000
+ case 34:
1001
+ case 39:
1002
+ case 40:
1003
+ case 91:
1004
+ return 2;
1005
+ case 41:
1006
+ case 93:
1007
+ return 1;
1008
+ }
1009
+ return 0;
1010
+ }
1011
+ function ui(t) {
1012
+ return Me = ne = 1, ci = K(re = t), M = 0, [];
1013
+ }
1014
+ function di(t) {
1015
+ return re = "", t;
1016
+ }
1017
+ function Ie(t) {
1018
+ return li(ge(M - 1, it(t === 91 ? t + 2 : t === 40 ? t + 1 : t)));
1019
+ }
1020
+ function jn(t) {
1021
+ for (; (T = z()) && T < 33; )
1022
+ U();
1023
+ return pe(t) > 2 || pe(T) > 3 ? "" : " ";
1024
+ }
1025
+ function Fn(t, e) {
1026
+ for (; --e && U() && !(T < 48 || T > 102 || T > 57 && T < 65 || T > 70 && T < 97); )
1027
+ ;
1028
+ return ge(t, Re() + (e < 6 && z() == 32 && U() == 32));
1029
+ }
1030
+ function it(t) {
1031
+ for (; U(); )
1032
+ switch (T) {
1033
+ case t:
1034
+ return M;
1035
+ case 34:
1036
+ case 39:
1037
+ t !== 34 && t !== 39 && it(T);
1038
+ break;
1039
+ case 40:
1040
+ t === 41 && it(t);
1041
+ break;
1042
+ case 92:
1043
+ U();
1044
+ break;
1045
+ }
1046
+ return M;
1047
+ }
1048
+ function Bn(t, e) {
1049
+ for (; U() && t + T !== 57; )
1050
+ if (t + T === 84 && z() === 47)
1051
+ break;
1052
+ return "/*" + ge(e, M - 1) + "*" + $e(t === 47 ? t : U());
1053
+ }
1054
+ function Vn(t) {
1055
+ for (; !pe(z()); )
1056
+ U();
1057
+ return ge(t, M);
1058
+ }
1059
+ function Gn(t) {
1060
+ return di(Oe("", null, null, null, [""], t = ui(t), 0, [0], t));
1061
+ }
1062
+ function Oe(t, e, i, n, r, o, s, a, l) {
1063
+ for (var c = 0, u = 0, d = s, f = 0, v = 0, y = 0, p = 1, A = 1, h = 1, _ = 0, L = "", q = r, B = o, G = n, E = L; A; )
1064
+ switch (y = _, _ = U()) {
1065
+ case 40:
1066
+ if (y != 108 && k(E, d - 1) == 58) {
1067
+ tt(E += m(Ie(_), "&", "&\f"), "&\f") != -1 && (h = -1);
1068
+ break;
1069
+ }
1070
+ case 34:
1071
+ case 39:
1072
+ case 91:
1073
+ E += Ie(_);
1074
+ break;
1075
+ case 9:
1076
+ case 10:
1077
+ case 13:
1078
+ case 32:
1079
+ E += jn(y);
1080
+ break;
1081
+ case 92:
1082
+ E += Fn(Re() - 1, 7);
1083
+ continue;
1084
+ case 47:
1085
+ switch (z()) {
1086
+ case 42:
1087
+ case 47:
1088
+ Ee(Kn(Bn(U(), Re()), e, i), l);
1089
+ break;
1090
+ default:
1091
+ E += "/";
1092
+ }
1093
+ break;
1094
+ case 123 * p:
1095
+ a[c++] = K(E) * h;
1096
+ case 125 * p:
1097
+ case 59:
1098
+ case 0:
1099
+ switch (_) {
1100
+ case 0:
1101
+ case 125:
1102
+ A = 0;
1103
+ case 59 + u:
1104
+ h == -1 && (E = m(E, /\f/g, "")), v > 0 && K(E) - d && Ee(v > 32 ? Ot(E + ";", n, i, d - 1) : Ot(m(E, " ", "") + ";", n, i, d - 2), l);
1105
+ break;
1106
+ case 59:
1107
+ E += ";";
1108
+ default:
1109
+ if (Ee(G = It(E, e, i, c, u, r, a, L, q = [], B = [], d), o), _ === 123)
1110
+ if (u === 0)
1111
+ Oe(E, e, G, G, q, o, d, a, B);
1112
+ else
1113
+ switch (f === 99 && k(E, 3) === 110 ? 100 : f) {
1114
+ case 100:
1115
+ case 108:
1116
+ case 109:
1117
+ case 115:
1118
+ Oe(t, G, G, n && Ee(It(t, G, G, 0, 0, r, a, L, r, q = [], d), B), r, B, d, a, n ? q : B);
1119
+ break;
1120
+ default:
1121
+ Oe(E, G, G, G, [""], B, 0, a, B);
1122
+ }
1123
+ }
1124
+ c = u = v = 0, p = h = 1, L = E = "", d = s;
1125
+ break;
1126
+ case 58:
1127
+ d = 1 + K(E), v = y;
1128
+ default:
1129
+ if (p < 1) {
1130
+ if (_ == 123)
1131
+ --p;
1132
+ else if (_ == 125 && p++ == 0 && Un() == 125)
1133
+ continue;
1134
+ }
1135
+ switch (E += $e(_), _ * p) {
1136
+ case 38:
1137
+ h = u > 0 ? 1 : (E += "\f", -1);
1138
+ break;
1139
+ case 44:
1140
+ a[c++] = (K(E) - 1) * h, h = 1;
1141
+ break;
1142
+ case 64:
1143
+ z() === 45 && (E += Ie(U())), f = z(), u = d = K(L = E += Vn(Re())), _++;
1144
+ break;
1145
+ case 45:
1146
+ y === 45 && K(E) == 2 && (p = 0);
1147
+ }
1148
+ }
1149
+ return o;
1150
+ }
1151
+ function It(t, e, i, n, r, o, s, a, l, c, u) {
1152
+ for (var d = r - 1, f = r === 0 ? o : [""], v = ut(f), y = 0, p = 0, A = 0; y < n; ++y)
1153
+ for (var h = 0, _ = _e(t, d + 1, d = Nn(p = s[y])), L = t; h < v; ++h)
1154
+ (L = li(p > 0 ? f[h] + " " + _ : m(_, /&\f/g, f[h]))) && (l[A++] = L);
1155
+ return Ue(t, e, i, r === 0 ? lt : a, l, c, u);
1156
+ }
1157
+ function Kn(t, e, i) {
1158
+ return Ue(t, e, i, si, $e(Mn()), _e(t, 2, -2), 0);
1159
+ }
1160
+ function Ot(t, e, i, n) {
1161
+ return Ue(t, e, i, ct, _e(t, 0, n), _e(t, n + 1, -1), n);
1162
+ }
1163
+ function te(t, e) {
1164
+ for (var i = "", n = ut(t), r = 0; r < n; r++)
1165
+ i += e(t[r], r, t, e) || "";
1166
+ return i;
1167
+ }
1168
+ function zn(t, e, i, n) {
1169
+ switch (t.type) {
1170
+ case Dn:
1171
+ if (t.children.length)
1172
+ break;
1173
+ case kn:
1174
+ case ct:
1175
+ return t.return = t.return || t.value;
1176
+ case si:
1177
+ return "";
1178
+ case ai:
1179
+ return t.return = t.value + "{" + te(t.children, n) + "}";
1180
+ case lt:
1181
+ t.value = t.props.join(",");
1182
+ }
1183
+ return K(i = te(t.children, n)) ? t.return = t.value + "{" + i + "}" : "";
1184
+ }
1185
+ function qn(t) {
1186
+ var e = ut(t);
1187
+ return function(i, n, r, o) {
1188
+ for (var s = "", a = 0; a < e; a++)
1189
+ s += t[a](i, n, r, o) || "";
1190
+ return s;
1191
+ };
1192
+ }
1193
+ function Hn(t) {
1194
+ return function(e) {
1195
+ e.root || (e = e.return) && t(e);
1196
+ };
1197
+ }
1198
+ function Wn(t) {
1199
+ var e = /* @__PURE__ */ Object.create(null);
1200
+ return function(i) {
1201
+ return e[i] === void 0 && (e[i] = t(i)), e[i];
1202
+ };
1203
+ }
1204
+ var Jn = function(e, i, n) {
1205
+ for (var r = 0, o = 0; r = o, o = z(), r === 38 && o === 12 && (i[n] = 1), !pe(o); )
1206
+ U();
1207
+ return ge(e, M);
1208
+ }, Yn = function(e, i) {
1209
+ var n = -1, r = 44;
1210
+ do
1211
+ switch (pe(r)) {
1212
+ case 0:
1213
+ r === 38 && z() === 12 && (i[n] = 1), e[n] += Jn(M - 1, i, n);
1214
+ break;
1215
+ case 2:
1216
+ e[n] += Ie(r);
1217
+ break;
1218
+ case 4:
1219
+ if (r === 44) {
1220
+ e[++n] = z() === 58 ? "&\f" : "", i[n] = e[n].length;
1221
+ break;
1222
+ }
1223
+ default:
1224
+ e[n] += $e(r);
1225
+ }
1226
+ while (r = U());
1227
+ return e;
1228
+ }, Qn = function(e, i) {
1229
+ return di(Yn(ui(e), i));
1230
+ }, Tt = /* @__PURE__ */ new WeakMap(), Xn = function(e) {
1231
+ if (!(e.type !== "rule" || !e.parent || // positive .length indicates that this rule contains pseudo
1232
+ // negative .length indicates that this rule has been already prefixed
1233
+ e.length < 1)) {
1234
+ for (var i = e.value, n = e.parent, r = e.column === n.column && e.line === n.line; n.type !== "rule"; )
1235
+ if (n = n.parent, !n)
1236
+ return;
1237
+ if (!(e.props.length === 1 && i.charCodeAt(0) !== 58 && !Tt.get(n)) && !r) {
1238
+ Tt.set(e, !0);
1239
+ for (var o = [], s = Qn(i, o), a = n.props, l = 0, c = 0; l < s.length; l++)
1240
+ for (var u = 0; u < a.length; u++, c++)
1241
+ e.props[c] = o[l] ? s[l].replace(/&\f/g, a[u]) : a[u] + " " + s[l];
1242
+ }
1243
+ }
1244
+ }, Zn = function(e) {
1245
+ if (e.type === "decl") {
1246
+ var i = e.value;
1247
+ // charcode for l
1248
+ i.charCodeAt(0) === 108 && // charcode for b
1249
+ i.charCodeAt(2) === 98 && (e.return = "", e.value = "");
1250
+ }
1251
+ };
1252
+ function fi(t, e) {
1253
+ switch (Cn(t, e)) {
1254
+ case 5103:
1255
+ return g + "print-" + t + t;
1256
+ case 5737:
1257
+ case 4201:
1258
+ case 3177:
1259
+ case 3433:
1260
+ case 1641:
1261
+ case 4457:
1262
+ case 2921:
1263
+ case 5572:
1264
+ case 6356:
1265
+ case 5844:
1266
+ case 3191:
1267
+ case 6645:
1268
+ case 3005:
1269
+ case 6391:
1270
+ case 5879:
1271
+ case 5623:
1272
+ case 6135:
1273
+ case 4599:
1274
+ case 4855:
1275
+ case 4215:
1276
+ case 6389:
1277
+ case 5109:
1278
+ case 5365:
1279
+ case 5621:
1280
+ case 3829:
1281
+ return g + t + t;
1282
+ case 5349:
1283
+ case 4246:
1284
+ case 4810:
1285
+ case 6968:
1286
+ case 2756:
1287
+ return g + t + Ne + t + N + t + t;
1288
+ case 6828:
1289
+ case 4268:
1290
+ return g + t + N + t + t;
1291
+ case 6165:
1292
+ return g + t + N + "flex-" + t + t;
1293
+ case 5187:
1294
+ return g + t + m(t, /(\w+).+(:[^]+)/, g + "box-$1$2" + N + "flex-$1$2") + t;
1295
+ case 5443:
1296
+ return g + t + N + "flex-item-" + m(t, /flex-|-self/, "") + t;
1297
+ case 4675:
1298
+ return g + t + N + "flex-line-pack" + m(t, /align-content|flex-|-self/, "") + t;
1299
+ case 5548:
1300
+ return g + t + N + m(t, "shrink", "negative") + t;
1301
+ case 5292:
1302
+ return g + t + N + m(t, "basis", "preferred-size") + t;
1303
+ case 6060:
1304
+ return g + "box-" + m(t, "-grow", "") + g + t + N + m(t, "grow", "positive") + t;
1305
+ case 4554:
1306
+ return g + m(t, /([^-])(transform)/g, "$1" + g + "$2") + t;
1307
+ case 6187:
1308
+ return m(m(m(t, /(zoom-|grab)/, g + "$1"), /(image-set)/, g + "$1"), t, "") + t;
1309
+ case 5495:
1310
+ case 3959:
1311
+ return m(t, /(image-set\([^]*)/, g + "$1$`$1");
1312
+ case 4968:
1313
+ return m(m(t, /(.+:)(flex-)?(.*)/, g + "box-pack:$3" + N + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + g + t + t;
1314
+ case 4095:
1315
+ case 3583:
1316
+ case 4068:
1317
+ case 2532:
1318
+ return m(t, /(.+)-inline(.+)/, g + "$1$2") + t;
1319
+ case 8116:
1320
+ case 7059:
1321
+ case 5753:
1322
+ case 5535:
1323
+ case 5445:
1324
+ case 5701:
1325
+ case 4933:
1326
+ case 4677:
1327
+ case 5533:
1328
+ case 5789:
1329
+ case 5021:
1330
+ case 4765:
1331
+ if (K(t) - 1 - e > 6)
1332
+ switch (k(t, e + 1)) {
1333
+ case 109:
1334
+ if (k(t, e + 4) !== 45)
1335
+ break;
1336
+ case 102:
1337
+ return m(t, /(.+:)(.+)-([^]+)/, "$1" + g + "$2-$3$1" + Ne + (k(t, e + 3) == 108 ? "$3" : "$2-$3")) + t;
1338
+ case 115:
1339
+ return ~tt(t, "stretch") ? fi(m(t, "stretch", "fill-available"), e) + t : t;
1340
+ }
1341
+ break;
1342
+ case 4949:
1343
+ if (k(t, e + 1) !== 115)
1344
+ break;
1345
+ case 6444:
1346
+ switch (k(t, K(t) - 3 - (~tt(t, "!important") && 10))) {
1347
+ case 107:
1348
+ return m(t, ":", ":" + g) + t;
1349
+ case 101:
1350
+ return m(t, /(.+:)([^;!]+)(;|!.+)?/, "$1" + g + (k(t, 14) === 45 ? "inline-" : "") + "box$3$1" + g + "$2$3$1" + N + "$2box$3") + t;
1351
+ }
1352
+ break;
1353
+ case 5936:
1354
+ switch (k(t, e + 11)) {
1355
+ case 114:
1356
+ return g + t + N + m(t, /[svh]\w+-[tblr]{2}/, "tb") + t;
1357
+ case 108:
1358
+ return g + t + N + m(t, /[svh]\w+-[tblr]{2}/, "tb-rl") + t;
1359
+ case 45:
1360
+ return g + t + N + m(t, /[svh]\w+-[tblr]{2}/, "lr") + t;
1361
+ }
1362
+ return g + t + N + t + t;
1363
+ }
1364
+ return t;
1365
+ }
1366
+ var er = function(e, i, n, r) {
1367
+ if (e.length > -1 && !e.return)
1368
+ switch (e.type) {
1369
+ case ct:
1370
+ e.return = fi(e.value, e.length);
1371
+ break;
1372
+ case ai:
1373
+ return te([ue(e, {
1374
+ value: m(e.value, "@", "@" + g)
1375
+ })], r);
1376
+ case lt:
1377
+ if (e.length)
1378
+ return $n(e.props, function(o) {
1379
+ switch (Ln(o, /(::plac\w+|:read-\w+)/)) {
1380
+ case ":read-only":
1381
+ case ":read-write":
1382
+ return te([ue(e, {
1383
+ props: [m(o, /:(read-\w+)/, ":" + Ne + "$1")]
1384
+ })], r);
1385
+ case "::placeholder":
1386
+ return te([ue(e, {
1387
+ props: [m(o, /:(plac\w+)/, ":" + g + "input-$1")]
1388
+ }), ue(e, {
1389
+ props: [m(o, /:(plac\w+)/, ":" + Ne + "$1")]
1390
+ }), ue(e, {
1391
+ props: [m(o, /:(plac\w+)/, N + "input-$1")]
1392
+ })], r);
1393
+ }
1394
+ return "";
1395
+ });
1396
+ }
1397
+ }, tr = [er], ir = function(e) {
1398
+ var i = e.key;
1399
+ if (i === "css") {
1400
+ var n = document.querySelectorAll("style[data-emotion]:not([data-s])");
1401
+ Array.prototype.forEach.call(n, function(p) {
1402
+ var A = p.getAttribute("data-emotion");
1403
+ A.indexOf(" ") !== -1 && (document.head.appendChild(p), p.setAttribute("data-s", ""));
1404
+ });
1405
+ }
1406
+ var r = e.stylisPlugins || tr, o = {}, s, a = [];
1407
+ s = e.container || document.head, Array.prototype.forEach.call(
1408
+ // this means we will ignore elements which don't have a space in them which
1409
+ // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
1410
+ document.querySelectorAll('style[data-emotion^="' + i + ' "]'),
1411
+ function(p) {
1412
+ for (var A = p.getAttribute("data-emotion").split(" "), h = 1; h < A.length; h++)
1413
+ o[A[h]] = !0;
1414
+ a.push(p);
1415
+ }
1416
+ );
1417
+ var l, c = [Xn, Zn];
1418
+ {
1419
+ var u, d = [zn, Hn(function(p) {
1420
+ u.insert(p);
1421
+ })], f = qn(c.concat(r, d)), v = function(A) {
1422
+ return te(Gn(A), f);
1423
+ };
1424
+ l = function(A, h, _, L) {
1425
+ u = _, v(A ? A + "{" + h.styles + "}" : h.styles), L && (y.inserted[h.name] = !0);
1426
+ };
1427
+ }
1428
+ var y = {
1429
+ key: i,
1430
+ sheet: new Tn({
1431
+ key: i,
1432
+ container: s,
1433
+ nonce: e.nonce,
1434
+ speedy: e.speedy,
1435
+ prepend: e.prepend,
1436
+ insertionPoint: e.insertionPoint
1437
+ }),
1438
+ nonce: e.nonce,
1439
+ inserted: o,
1440
+ registered: {},
1441
+ insert: l
1442
+ };
1443
+ return y.sheet.hydrate(a), y;
1444
+ };
1445
+ function nr(t) {
1446
+ for (var e = 0, i, n = 0, r = t.length; r >= 4; ++n, r -= 4)
1447
+ i = t.charCodeAt(n) & 255 | (t.charCodeAt(++n) & 255) << 8 | (t.charCodeAt(++n) & 255) << 16 | (t.charCodeAt(++n) & 255) << 24, i = /* Math.imul(k, m): */
1448
+ (i & 65535) * 1540483477 + ((i >>> 16) * 59797 << 16), i ^= /* k >>> r: */
1449
+ i >>> 24, e = /* Math.imul(k, m): */
1450
+ (i & 65535) * 1540483477 + ((i >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
1451
+ (e & 65535) * 1540483477 + ((e >>> 16) * 59797 << 16);
1452
+ switch (r) {
1453
+ case 3:
1454
+ e ^= (t.charCodeAt(n + 2) & 255) << 16;
1455
+ case 2:
1456
+ e ^= (t.charCodeAt(n + 1) & 255) << 8;
1457
+ case 1:
1458
+ e ^= t.charCodeAt(n) & 255, e = /* Math.imul(h, m): */
1459
+ (e & 65535) * 1540483477 + ((e >>> 16) * 59797 << 16);
1460
+ }
1461
+ return e ^= e >>> 13, e = /* Math.imul(h, m): */
1462
+ (e & 65535) * 1540483477 + ((e >>> 16) * 59797 << 16), ((e ^ e >>> 15) >>> 0).toString(36);
1463
+ }
1464
+ var rr = {
1465
+ animationIterationCount: 1,
1466
+ aspectRatio: 1,
1467
+ borderImageOutset: 1,
1468
+ borderImageSlice: 1,
1469
+ borderImageWidth: 1,
1470
+ boxFlex: 1,
1471
+ boxFlexGroup: 1,
1472
+ boxOrdinalGroup: 1,
1473
+ columnCount: 1,
1474
+ columns: 1,
1475
+ flex: 1,
1476
+ flexGrow: 1,
1477
+ flexPositive: 1,
1478
+ flexShrink: 1,
1479
+ flexNegative: 1,
1480
+ flexOrder: 1,
1481
+ gridRow: 1,
1482
+ gridRowEnd: 1,
1483
+ gridRowSpan: 1,
1484
+ gridRowStart: 1,
1485
+ gridColumn: 1,
1486
+ gridColumnEnd: 1,
1487
+ gridColumnSpan: 1,
1488
+ gridColumnStart: 1,
1489
+ msGridRow: 1,
1490
+ msGridRowSpan: 1,
1491
+ msGridColumn: 1,
1492
+ msGridColumnSpan: 1,
1493
+ fontWeight: 1,
1494
+ lineHeight: 1,
1495
+ opacity: 1,
1496
+ order: 1,
1497
+ orphans: 1,
1498
+ scale: 1,
1499
+ tabSize: 1,
1500
+ widows: 1,
1501
+ zIndex: 1,
1502
+ zoom: 1,
1503
+ WebkitLineClamp: 1,
1504
+ // SVG-related properties
1505
+ fillOpacity: 1,
1506
+ floodOpacity: 1,
1507
+ stopOpacity: 1,
1508
+ strokeDasharray: 1,
1509
+ strokeDashoffset: 1,
1510
+ strokeMiterlimit: 1,
1511
+ strokeOpacity: 1,
1512
+ strokeWidth: 1
1513
+ }, or = /[A-Z]|^ms/g, sr = /_EMO_([^_]+?)_([^]*?)_EMO_/g, hi = function(e) {
1514
+ return e.charCodeAt(1) === 45;
1515
+ }, kt = function(e) {
1516
+ return e != null && typeof e != "boolean";
1517
+ }, Ge = /* @__PURE__ */ Wn(function(t) {
1518
+ return hi(t) ? t : t.replace(or, "-$&").toLowerCase();
1519
+ }), Dt = function(e, i) {
1520
+ switch (e) {
1521
+ case "animation":
1522
+ case "animationName":
1523
+ if (typeof i == "string")
1524
+ return i.replace(sr, function(n, r, o) {
1525
+ return Q = {
1526
+ name: r,
1527
+ styles: o,
1528
+ next: Q
1529
+ }, r;
1530
+ });
1531
+ }
1532
+ return rr[e] !== 1 && !hi(e) && typeof i == "number" && i !== 0 ? i + "px" : i;
1533
+ };
1534
+ function Pe(t, e, i) {
1535
+ if (i == null)
1536
+ return "";
1537
+ var n = i;
1538
+ if (n.__emotion_styles !== void 0)
1539
+ return n;
1540
+ switch (typeof i) {
1541
+ case "boolean":
1542
+ return "";
1543
+ case "object": {
1544
+ var r = i;
1545
+ if (r.anim === 1)
1546
+ return Q = {
1547
+ name: r.name,
1548
+ styles: r.styles,
1549
+ next: Q
1550
+ }, r.name;
1551
+ var o = i;
1552
+ if (o.styles !== void 0) {
1553
+ var s = o.next;
1554
+ if (s !== void 0)
1555
+ for (; s !== void 0; )
1556
+ Q = {
1557
+ name: s.name,
1558
+ styles: s.styles,
1559
+ next: Q
1560
+ }, s = s.next;
1561
+ var a = o.styles + ";";
1562
+ return a;
1563
+ }
1564
+ return ar(t, e, i);
1565
+ }
1566
+ }
1567
+ var l = i;
1568
+ if (e == null)
1569
+ return l;
1570
+ var c = e[l];
1571
+ return c !== void 0 ? c : l;
1572
+ }
1573
+ function ar(t, e, i) {
1574
+ var n = "";
1575
+ if (Array.isArray(i))
1576
+ for (var r = 0; r < i.length; r++)
1577
+ n += Pe(t, e, i[r]) + ";";
1578
+ else
1579
+ for (var o in i) {
1580
+ var s = i[o];
1581
+ if (typeof s != "object") {
1582
+ var a = s;
1583
+ e != null && e[a] !== void 0 ? n += o + "{" + e[a] + "}" : kt(a) && (n += Ge(o) + ":" + Dt(o, a) + ";");
1584
+ } else if (Array.isArray(s) && typeof s[0] == "string" && (e == null || e[s[0]] === void 0))
1585
+ for (var l = 0; l < s.length; l++)
1586
+ kt(s[l]) && (n += Ge(o) + ":" + Dt(o, s[l]) + ";");
1587
+ else {
1588
+ var c = Pe(t, e, s);
1589
+ switch (o) {
1590
+ case "animation":
1591
+ case "animationName": {
1592
+ n += Ge(o) + ":" + c + ";";
1593
+ break;
1594
+ }
1595
+ default:
1596
+ n += o + "{" + c + "}";
1597
+ }
1598
+ }
1599
+ }
1600
+ return n;
1601
+ }
1602
+ var Nt = /label:\s*([^\s;{]+)\s*(;|$)/g, Q;
1603
+ function Ke(t, e, i) {
1604
+ if (t.length === 1 && typeof t[0] == "object" && t[0] !== null && t[0].styles !== void 0)
1605
+ return t[0];
1606
+ var n = !0, r = "";
1607
+ Q = void 0;
1608
+ var o = t[0];
1609
+ if (o == null || o.raw === void 0)
1610
+ n = !1, r += Pe(i, e, o);
1611
+ else {
1612
+ var s = o;
1613
+ r += s[0];
1614
+ }
1615
+ for (var a = 1; a < t.length; a++)
1616
+ if (r += Pe(i, e, t[a]), n) {
1617
+ var l = o;
1618
+ r += l[a];
1619
+ }
1620
+ Nt.lastIndex = 0;
1621
+ for (var c = "", u; (u = Nt.exec(r)) !== null; )
1622
+ c += "-" + u[1];
1623
+ var d = nr(r) + c;
1624
+ return {
1625
+ name: d,
1626
+ styles: r,
1627
+ next: Q
1628
+ };
1629
+ }
1630
+ function vi(t, e, i) {
1631
+ var n = "";
1632
+ return i.split(" ").forEach(function(r) {
1633
+ t[r] !== void 0 ? e.push(t[r] + ";") : r && (n += r + " ");
1634
+ }), n;
1635
+ }
1636
+ var lr = function(e, i, n) {
1637
+ var r = e.key + "-" + i.name;
1638
+ // we only need to add the styles to the registered cache if the
1639
+ // class name could be used further down
1640
+ // the tree but if it's a string tag, we know it won't
1641
+ // so we don't have to add it to registered cache.
1642
+ // this improves memory usage since we can avoid storing the whole style string
1643
+ e.registered[r] === void 0 && (e.registered[r] = i.styles);
1644
+ }, cr = function(e, i, n) {
1645
+ lr(e, i);
1646
+ var r = e.key + "-" + i.name;
1647
+ if (e.inserted[i.name] === void 0) {
1648
+ var o = i;
1649
+ do
1650
+ e.insert(i === o ? "." + r : "", o, e.sheet, !0), o = o.next;
1651
+ while (o !== void 0);
1652
+ }
1653
+ };
1654
+ function Pt(t, e) {
1655
+ if (t.inserted[e.name] === void 0)
1656
+ return t.insert("", e, t.sheet, !0);
1657
+ }
1658
+ function Ct(t, e, i) {
1659
+ var n = [], r = vi(t, n, i);
1660
+ return n.length < 2 ? i : r + e(n);
1661
+ }
1662
+ var ur = function(e) {
1663
+ var i = ir(e);
1664
+ i.sheet.speedy = function(a) {
1665
+ this.isSpeedy = a;
1666
+ }, i.compat = !0;
1667
+ var n = function() {
1668
+ for (var l = arguments.length, c = new Array(l), u = 0; u < l; u++)
1669
+ c[u] = arguments[u];
1670
+ var d = Ke(c, i.registered, void 0);
1671
+ return cr(i, d), i.key + "-" + d.name;
1672
+ }, r = function() {
1673
+ for (var l = arguments.length, c = new Array(l), u = 0; u < l; u++)
1674
+ c[u] = arguments[u];
1675
+ var d = Ke(c, i.registered), f = "animation-" + d.name;
1676
+ return Pt(i, {
1677
+ name: d.name,
1678
+ styles: "@keyframes " + f + "{" + d.styles + "}"
1679
+ }), f;
1680
+ }, o = function() {
1681
+ for (var l = arguments.length, c = new Array(l), u = 0; u < l; u++)
1682
+ c[u] = arguments[u];
1683
+ var d = Ke(c, i.registered);
1684
+ Pt(i, d);
1685
+ }, s = function() {
1686
+ for (var l = arguments.length, c = new Array(l), u = 0; u < l; u++)
1687
+ c[u] = arguments[u];
1688
+ return Ct(i.registered, n, dr(c));
1689
+ };
1690
+ return {
1691
+ css: n,
1692
+ cx: s,
1693
+ injectGlobal: o,
1694
+ keyframes: r,
1695
+ hydrate: function(l) {
1696
+ l.forEach(function(c) {
1697
+ i.inserted[c] = !0;
1698
+ });
1699
+ },
1700
+ flush: function() {
1701
+ i.registered = {}, i.inserted = {}, i.sheet.flush();
1702
+ },
1703
+ sheet: i.sheet,
1704
+ cache: i,
1705
+ getRegisteredStyles: vi.bind(null, i.registered),
1706
+ merge: Ct.bind(null, i.registered, n)
1707
+ };
1708
+ }, dr = function t(e) {
1709
+ for (var i = "", n = 0; n < e.length; n++) {
1710
+ var r = e[n];
1711
+ if (r != null) {
1712
+ var o = void 0;
1713
+ switch (typeof r) {
1714
+ case "boolean":
1715
+ break;
1716
+ case "object": {
1717
+ if (Array.isArray(r))
1718
+ o = t(r);
1719
+ else {
1720
+ o = "";
1721
+ for (var s in r)
1722
+ r[s] && s && (o && (o += " "), o += s);
1723
+ }
1724
+ break;
1725
+ }
1726
+ default:
1727
+ o = r;
1728
+ }
1729
+ o && (i && (i += " "), i += o);
1730
+ }
1731
+ }
1732
+ return i;
1733
+ }, fr = ur({
1734
+ key: "css"
1735
+ }), me = fr.css, ye, P, ze, Lt, nt = 0, _i = [], R = I, $t = R.__b, Mt = R.__r, Ut = R.diffed, jt = R.__c, Ft = R.unmount, Bt = R.__;
1736
+ function dt(t, e) {
1737
+ R.__h && R.__h(P, t, nt || e), nt = 0;
1738
+ var i = P.__H || (P.__H = { __: [], __h: [] });
1739
+ return t >= i.__.length && i.__.push({}), i.__[t];
1740
+ }
1741
+ function ft(t, e) {
1742
+ var i = dt(ye++, 3);
1743
+ !R.__s && ht(i.__H, e) && (i.__ = t, i.u = e, P.__H.__h.push(i));
1744
+ }
1745
+ function hr(t, e) {
1746
+ var i = dt(ye++, 4);
1747
+ !R.__s && ht(i.__H, e) && (i.__ = t, i.u = e, P.__h.push(i));
1748
+ }
1749
+ function pi(t) {
1750
+ return nt = 5, je(function() {
1751
+ return { current: t };
1752
+ }, []);
1753
+ }
1754
+ function je(t, e) {
1755
+ var i = dt(ye++, 7);
1756
+ return ht(i.__H, e) && (i.__ = t(), i.__H = e, i.__h = t), i.__;
1757
+ }
1758
+ function vr() {
1759
+ for (var t; t = _i.shift(); )
1760
+ if (t.__P && t.__H)
1761
+ try {
1762
+ t.__H.__h.forEach(Te), t.__H.__h.forEach(rt), t.__H.__h = [];
1763
+ } catch (e) {
1764
+ t.__H.__h = [], R.__e(e, t.__v);
1765
+ }
1766
+ }
1767
+ R.__b = function(t) {
1768
+ P = null, $t && $t(t);
1769
+ }, R.__ = function(t, e) {
1770
+ t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Bt && Bt(t, e);
1771
+ }, R.__r = function(t) {
1772
+ Mt && Mt(t), ye = 0;
1773
+ var e = (P = t.__c).__H;
1774
+ e && (ze === P ? (e.__h = [], P.__h = [], e.__.forEach(function(i) {
1775
+ i.__N && (i.__ = i.__N), i.u = i.__N = void 0;
1776
+ })) : (e.__h.forEach(Te), e.__h.forEach(rt), e.__h = [], ye = 0)), ze = P;
1777
+ }, R.diffed = function(t) {
1778
+ Ut && Ut(t);
1779
+ var e = t.__c;
1780
+ e && e.__H && (e.__H.__h.length && (_i.push(e) !== 1 && Lt === R.requestAnimationFrame || ((Lt = R.requestAnimationFrame) || _r)(vr)), e.__H.__.forEach(function(i) {
1781
+ i.u && (i.__H = i.u), i.u = void 0;
1782
+ })), ze = P = null;
1783
+ }, R.__c = function(t, e) {
1784
+ e.some(function(i) {
1785
+ try {
1786
+ i.__h.forEach(Te), i.__h = i.__h.filter(function(n) {
1787
+ return !n.__ || rt(n);
1788
+ });
1789
+ } catch (n) {
1790
+ e.some(function(r) {
1791
+ r.__h && (r.__h = []);
1792
+ }), e = [], R.__e(n, i.__v);
1793
+ }
1794
+ }), jt && jt(t, e);
1795
+ }, R.unmount = function(t) {
1796
+ Ft && Ft(t);
1797
+ var e, i = t.__c;
1798
+ i && i.__H && (i.__H.__.forEach(function(n) {
1799
+ try {
1800
+ Te(n);
1801
+ } catch (r) {
1802
+ e = r;
1803
+ }
1804
+ }), i.__H = void 0, e && R.__e(e, i.__v));
1805
+ };
1806
+ var Vt = typeof requestAnimationFrame == "function";
1807
+ function _r(t) {
1808
+ var e, i = function() {
1809
+ clearTimeout(n), Vt && cancelAnimationFrame(e), setTimeout(t);
1810
+ }, n = setTimeout(i, 100);
1811
+ Vt && (e = requestAnimationFrame(i));
1812
+ }
1813
+ function Te(t) {
1814
+ var e = P, i = t.__c;
1815
+ typeof i == "function" && (t.__c = void 0, i()), P = e;
1816
+ }
1817
+ function rt(t) {
1818
+ var e = P;
1819
+ t.__c = t.__(), P = e;
1820
+ }
1821
+ function ht(t, e) {
1822
+ return !t || t.length !== e.length || e.some(function(i, n) {
1823
+ return i !== t[n];
1824
+ });
1825
+ }
1826
+ var pr = Symbol.for("preact-signals");
1827
+ function Fe() {
1828
+ if (X > 1)
1829
+ X--;
1830
+ else {
1831
+ for (var t, e = !1; fe !== void 0; ) {
1832
+ var i = fe;
1833
+ for (fe = void 0, ot++; i !== void 0; ) {
1834
+ var n = i.o;
1835
+ if (i.o = void 0, i.f &= -3, !(8 & i.f) && gi(i))
1836
+ try {
1837
+ i.c();
1838
+ } catch (r) {
1839
+ e || (t = r, e = !0);
1840
+ }
1841
+ i = n;
1842
+ }
1843
+ }
1844
+ if (ot = 0, X--, e)
1845
+ throw t;
1846
+ }
1847
+ }
1848
+ function C(t) {
1849
+ if (X > 0)
1850
+ return t();
1851
+ X++;
1852
+ try {
1853
+ return t();
1854
+ } finally {
1855
+ Fe();
1856
+ }
1857
+ }
1858
+ var w = void 0, fe = void 0, X = 0, ot = 0, Ce = 0;
1859
+ function yi(t) {
1860
+ if (w !== void 0) {
1861
+ var e = t.n;
1862
+ if (e === void 0 || e.t !== w)
1863
+ return e = { i: 0, S: t, p: w.s, n: void 0, t: w, e: void 0, x: void 0, r: e }, w.s !== void 0 && (w.s.n = e), w.s = e, t.n = e, 32 & w.f && t.S(e), e;
1864
+ if (e.i === -1)
1865
+ return e.i = 0, e.n !== void 0 && (e.n.p = e.p, e.p !== void 0 && (e.p.n = e.n), e.p = w.s, e.n = void 0, w.s.n = e, w.s = e), e;
1866
+ }
1867
+ }
1868
+ function D(t) {
1869
+ this.v = t, this.i = 0, this.n = void 0, this.t = void 0;
1870
+ }
1871
+ D.prototype.brand = pr;
1872
+ D.prototype.h = function() {
1873
+ return !0;
1874
+ };
1875
+ D.prototype.S = function(t) {
1876
+ this.t !== t && t.e === void 0 && (t.x = this.t, this.t !== void 0 && (this.t.e = t), this.t = t);
1877
+ };
1878
+ D.prototype.U = function(t) {
1879
+ if (this.t !== void 0) {
1880
+ var e = t.e, i = t.x;
1881
+ e !== void 0 && (e.x = i, t.e = void 0), i !== void 0 && (i.e = e, t.x = void 0), t === this.t && (this.t = i);
1882
+ }
1883
+ };
1884
+ D.prototype.subscribe = function(t) {
1885
+ var e = this;
1886
+ return se(function() {
1887
+ var i = e.value, n = w;
1888
+ w = void 0;
1889
+ try {
1890
+ t(i);
1891
+ } finally {
1892
+ w = n;
1893
+ }
1894
+ });
1895
+ };
1896
+ D.prototype.valueOf = function() {
1897
+ return this.value;
1898
+ };
1899
+ D.prototype.toString = function() {
1900
+ return this.value + "";
1901
+ };
1902
+ D.prototype.toJSON = function() {
1903
+ return this.value;
1904
+ };
1905
+ D.prototype.peek = function() {
1906
+ var t = w;
1907
+ w = void 0;
1908
+ try {
1909
+ return this.value;
1910
+ } finally {
1911
+ w = t;
1912
+ }
1913
+ };
1914
+ Object.defineProperty(D.prototype, "value", { get: function() {
1915
+ var t = yi(this);
1916
+ return t !== void 0 && (t.i = this.i), this.v;
1917
+ }, set: function(t) {
1918
+ if (t !== this.v) {
1919
+ if (ot > 100)
1920
+ throw new Error("Cycle detected");
1921
+ this.v = t, this.i++, Ce++, X++;
1922
+ try {
1923
+ for (var e = this.t; e !== void 0; e = e.x)
1924
+ e.t.N();
1925
+ } finally {
1926
+ Fe();
1927
+ }
1928
+ }
1929
+ } });
1930
+ function O(t) {
1931
+ return new D(t);
1932
+ }
1933
+ function gi(t) {
1934
+ for (var e = t.s; e !== void 0; e = e.n)
1935
+ if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i)
1936
+ return !0;
1937
+ return !1;
1938
+ }
1939
+ function mi(t) {
1940
+ for (var e = t.s; e !== void 0; e = e.n) {
1941
+ var i = e.S.n;
1942
+ if (i !== void 0 && (e.r = i), e.S.n = e, e.i = -1, e.n === void 0) {
1943
+ t.s = e;
1944
+ break;
1945
+ }
1946
+ }
1947
+ }
1948
+ function bi(t) {
1949
+ for (var e = t.s, i = void 0; e !== void 0; ) {
1950
+ var n = e.p;
1951
+ e.i === -1 ? (e.S.U(e), n !== void 0 && (n.n = e.n), e.n !== void 0 && (e.n.p = n)) : i = e, e.S.n = e.r, e.r !== void 0 && (e.r = void 0), e = n;
1952
+ }
1953
+ t.s = i;
1954
+ }
1955
+ function oe(t) {
1956
+ D.call(this, void 0), this.x = t, this.s = void 0, this.g = Ce - 1, this.f = 4;
1957
+ }
1958
+ (oe.prototype = new D()).h = function() {
1959
+ if (this.f &= -3, 1 & this.f)
1960
+ return !1;
1961
+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === Ce))
1962
+ return !0;
1963
+ if (this.g = Ce, this.f |= 1, this.i > 0 && !gi(this))
1964
+ return this.f &= -2, !0;
1965
+ var t = w;
1966
+ try {
1967
+ mi(this), w = this;
1968
+ var e = this.x();
1969
+ (16 & this.f || this.v !== e || this.i === 0) && (this.v = e, this.f &= -17, this.i++);
1970
+ } catch (i) {
1971
+ this.v = i, this.f |= 16, this.i++;
1972
+ }
1973
+ return w = t, bi(this), this.f &= -2, !0;
1974
+ };
1975
+ oe.prototype.S = function(t) {
1976
+ if (this.t === void 0) {
1977
+ this.f |= 36;
1978
+ for (var e = this.s; e !== void 0; e = e.n)
1979
+ e.S.S(e);
1980
+ }
1981
+ D.prototype.S.call(this, t);
1982
+ };
1983
+ oe.prototype.U = function(t) {
1984
+ if (this.t !== void 0 && (D.prototype.U.call(this, t), this.t === void 0)) {
1985
+ this.f &= -33;
1986
+ for (var e = this.s; e !== void 0; e = e.n)
1987
+ e.S.U(e);
1988
+ }
1989
+ };
1990
+ oe.prototype.N = function() {
1991
+ if (!(2 & this.f)) {
1992
+ this.f |= 6;
1993
+ for (var t = this.t; t !== void 0; t = t.x)
1994
+ t.t.N();
1995
+ }
1996
+ };
1997
+ Object.defineProperty(oe.prototype, "value", { get: function() {
1998
+ if (1 & this.f)
1999
+ throw new Error("Cycle detected");
2000
+ var t = yi(this);
2001
+ if (this.h(), t !== void 0 && (t.i = this.i), 16 & this.f)
2002
+ throw this.v;
2003
+ return this.v;
2004
+ } });
2005
+ function he(t) {
2006
+ return new oe(t);
2007
+ }
2008
+ function Ai(t) {
2009
+ var e = t.u;
2010
+ if (t.u = void 0, typeof e == "function") {
2011
+ X++;
2012
+ var i = w;
2013
+ w = void 0;
2014
+ try {
2015
+ e();
2016
+ } catch (n) {
2017
+ throw t.f &= -2, t.f |= 8, vt(t), n;
2018
+ } finally {
2019
+ w = i, Fe();
2020
+ }
2021
+ }
2022
+ }
2023
+ function vt(t) {
2024
+ for (var e = t.s; e !== void 0; e = e.n)
2025
+ e.S.U(e);
2026
+ t.x = void 0, t.s = void 0, Ai(t);
2027
+ }
2028
+ function yr(t) {
2029
+ if (w !== this)
2030
+ throw new Error("Out-of-order effect");
2031
+ bi(this), w = t, this.f &= -2, 8 & this.f && vt(this), Fe();
2032
+ }
2033
+ function be(t) {
2034
+ this.x = t, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32;
2035
+ }
2036
+ be.prototype.c = function() {
2037
+ var t = this.S();
2038
+ try {
2039
+ if (8 & this.f || this.x === void 0)
2040
+ return;
2041
+ var e = this.x();
2042
+ typeof e == "function" && (this.u = e);
2043
+ } finally {
2044
+ t();
2045
+ }
2046
+ };
2047
+ be.prototype.S = function() {
2048
+ if (1 & this.f)
2049
+ throw new Error("Cycle detected");
2050
+ this.f |= 1, this.f &= -9, Ai(this), mi(this), X++;
2051
+ var t = w;
2052
+ return w = this, yr.bind(this, t);
2053
+ };
2054
+ be.prototype.N = function() {
2055
+ 2 & this.f || (this.f |= 2, this.o = fe, fe = this);
2056
+ };
2057
+ be.prototype.d = function() {
2058
+ this.f |= 8, 1 & this.f || vt(this);
2059
+ };
2060
+ function se(t) {
2061
+ var e = new be(t);
2062
+ try {
2063
+ e.c();
2064
+ } catch (i) {
2065
+ throw e.d(), i;
2066
+ }
2067
+ return e.d.bind(e);
2068
+ }
2069
+ var _t, qe, wi = [], Ei = [];
2070
+ se(function() {
2071
+ _t = this.N;
2072
+ })();
2073
+ function ae(t, e) {
2074
+ I[t] = e.bind(null, I[t] || function() {
2075
+ });
2076
+ }
2077
+ function Le(t) {
2078
+ qe && qe(), qe = t && t.S();
2079
+ }
2080
+ function Si(t) {
2081
+ var e = this, i = t.data, n = xi(i);
2082
+ n.value = i;
2083
+ var r = je(function() {
2084
+ for (var a = e, l = e.__v; l = l.__; )
2085
+ if (l.__c) {
2086
+ l.__c.__$f |= 4;
2087
+ break;
2088
+ }
2089
+ var c = he(function() {
2090
+ var v = n.value.value;
2091
+ return v === 0 ? 0 : v === !0 ? "" : v || "";
2092
+ }), u = he(function() {
2093
+ return !Array.isArray(c.value) && !Ci(c.value);
2094
+ }), d = se(function() {
2095
+ if (this.N = Ri, u.value) {
2096
+ var v = c.value;
2097
+ a.__v && a.__v.__e && a.__v.__e.nodeType === 3 && (a.__v.__e.data = v);
2098
+ }
2099
+ }), f = e.__$u.d;
2100
+ return e.__$u.d = function() {
2101
+ d(), f.call(this);
2102
+ }, [u, c];
2103
+ }, []), o = r[0], s = r[1];
2104
+ return o.value ? s.peek() : s.value;
2105
+ }
2106
+ Si.displayName = "_st";
2107
+ Object.defineProperties(D.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: Si }, props: { configurable: !0, get: function() {
2108
+ return { data: this };
2109
+ } }, __b: { configurable: !0, value: 1 } });
2110
+ ae("__b", function(t, e) {
2111
+ if (typeof e.type == "string") {
2112
+ var i, n = e.props;
2113
+ for (var r in n)
2114
+ if (r !== "children") {
2115
+ var o = n[r];
2116
+ o instanceof D && (i || (e.__np = i = {}), i[r] = o, n[r] = o.peek());
2117
+ }
2118
+ }
2119
+ t(e);
2120
+ });
2121
+ ae("__r", function(t, e) {
2122
+ Le();
2123
+ var i, n = e.__c;
2124
+ n && (n.__$f &= -2, (i = n.__$u) === void 0 && (n.__$u = i = function(r) {
2125
+ var o;
2126
+ return se(function() {
2127
+ o = this;
2128
+ }), o.c = function() {
2129
+ n.__$f |= 1, n.setState({});
2130
+ }, o;
2131
+ }())), Le(i), t(e);
2132
+ });
2133
+ ae("__e", function(t, e, i, n) {
2134
+ Le(), t(e, i, n);
2135
+ });
2136
+ ae("diffed", function(t, e) {
2137
+ Le();
2138
+ var i;
2139
+ if (typeof e.type == "string" && (i = e.__e)) {
2140
+ var n = e.__np, r = e.props;
2141
+ if (n) {
2142
+ var o = i.U;
2143
+ if (o)
2144
+ for (var s in o) {
2145
+ var a = o[s];
2146
+ a !== void 0 && !(s in n) && (a.d(), o[s] = void 0);
2147
+ }
2148
+ else
2149
+ o = {}, i.U = o;
2150
+ for (var l in n) {
2151
+ var c = o[l], u = n[l];
2152
+ c === void 0 ? (c = gr(i, l, u, r), o[l] = c) : c.o(u, r);
2153
+ }
2154
+ }
2155
+ }
2156
+ t(e);
2157
+ });
2158
+ function gr(t, e, i, n) {
2159
+ var r = e in t && t.ownerSVGElement === void 0, o = O(i);
2160
+ return { o: function(s, a) {
2161
+ o.value = s, n = a;
2162
+ }, d: se(function() {
2163
+ this.N = Ri;
2164
+ var s = o.value.value;
2165
+ n[e] !== s && (n[e] = s, r ? t[e] = s : s ? t.setAttribute(e, s) : t.removeAttribute(e));
2166
+ }) };
2167
+ }
2168
+ ae("unmount", function(t, e) {
2169
+ if (typeof e.type == "string") {
2170
+ var i = e.__e;
2171
+ if (i) {
2172
+ var n = i.U;
2173
+ if (n) {
2174
+ i.U = void 0;
2175
+ for (var r in n) {
2176
+ var o = n[r];
2177
+ o && o.d();
2178
+ }
2179
+ }
2180
+ }
2181
+ } else {
2182
+ var s = e.__c;
2183
+ if (s) {
2184
+ var a = s.__$u;
2185
+ a && (s.__$u = void 0, a.d());
2186
+ }
2187
+ }
2188
+ t(e);
2189
+ });
2190
+ ae("__h", function(t, e, i, n) {
2191
+ (n < 3 || n === 9) && (e.__$f |= 2), t(e, i, n);
2192
+ });
2193
+ ie.prototype.shouldComponentUpdate = function(t, e) {
2194
+ var i = this.__$u, n = i && i.s !== void 0;
2195
+ for (var r in e)
2196
+ return !0;
2197
+ if (this.__f || typeof this.u == "boolean" && this.u === !0) {
2198
+ var o = 2 & this.__$f;
2199
+ if (!(n || o || 4 & this.__$f) || 1 & this.__$f)
2200
+ return !0;
2201
+ } else if (!(n || 4 & this.__$f) || 3 & this.__$f)
2202
+ return !0;
2203
+ for (var s in t)
2204
+ if (s !== "__source" && t[s] !== this.props[s])
2205
+ return !0;
2206
+ for (var a in this.props)
2207
+ if (!(a in t))
2208
+ return !0;
2209
+ return !1;
2210
+ };
2211
+ function xi(t) {
2212
+ return je(function() {
2213
+ return O(t);
2214
+ }, []);
2215
+ }
2216
+ var mr = typeof requestAnimationFrame == "undefined" ? setTimeout : function(t) {
2217
+ var e = function() {
2218
+ clearTimeout(i), cancelAnimationFrame(n), t();
2219
+ }, i = setTimeout(e, 100), n = requestAnimationFrame(e);
2220
+ }, br = function(t) {
2221
+ queueMicrotask(function() {
2222
+ queueMicrotask(t);
2223
+ });
2224
+ };
2225
+ function Ar() {
2226
+ C(function() {
2227
+ for (var t; t = wi.shift(); )
2228
+ _t.call(t);
2229
+ });
2230
+ }
2231
+ function wr() {
2232
+ wi.push(this) === 1 && (I.requestAnimationFrame || mr)(Ar);
2233
+ }
2234
+ function Er() {
2235
+ C(function() {
2236
+ for (var t; t = Ei.shift(); )
2237
+ _t.call(t);
2238
+ });
2239
+ }
2240
+ function Ri() {
2241
+ Ei.push(this) === 1 && (I.requestAnimationFrame || br)(Er);
2242
+ }
2243
+ function Sr(t) {
2244
+ var e = pi(t);
2245
+ e.current = t, ft(function() {
2246
+ return se(function() {
2247
+ return this.N = wr, e.current();
2248
+ });
2249
+ }, []);
2250
+ }
2251
+ const $ = me`
2252
+ inset: 0;
2253
+ clear: none;
2254
+ float: none;
2255
+ max-height: none;
2256
+ max-width: none;
2257
+ opacity: 1;
2258
+ overflow: visible;
2259
+ visibility: visible;
2260
+ padding: 0;
2261
+ margin: 0;
2262
+ top: 0;
2263
+ left: 0;
2264
+ padding: 0;
2265
+ border: none;
2266
+ text-decoration: none;
2267
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
2268
+ 'Helvetica Neue', sans-serif;
2269
+ `;
2270
+ function xr(t, e) {
2271
+ for (var i in e)
2272
+ t[i] = e[i];
2273
+ return t;
2274
+ }
2275
+ function Gt(t, e) {
2276
+ for (var i in t)
2277
+ if (i !== "__source" && !(i in e))
2278
+ return !0;
2279
+ for (var n in e)
2280
+ if (n !== "__source" && t[n] !== e[n])
2281
+ return !0;
2282
+ return !1;
2283
+ }
2284
+ function Kt(t, e) {
2285
+ this.props = t, this.context = e;
2286
+ }
2287
+ (Kt.prototype = new ie()).isPureReactComponent = !0, Kt.prototype.shouldComponentUpdate = function(t, e) {
2288
+ return Gt(this.props, t) || Gt(this.state, e);
2289
+ };
2290
+ var zt = I.__b;
2291
+ I.__b = function(t) {
2292
+ t.type && t.type.__f && t.ref && (t.props.ref = t.ref, t.ref = null), zt && zt(t);
2293
+ };
2294
+ var Rr = I.__e;
2295
+ I.__e = function(t, e, i, n) {
2296
+ if (t.then) {
2297
+ for (var r, o = e; o = o.__; )
2298
+ if ((r = o.__c) && r.__c)
2299
+ return e.__e == null && (e.__e = i.__e, e.__k = i.__k), r.__c(t, e);
2300
+ }
2301
+ Rr(t, e, i, n);
2302
+ };
2303
+ var qt = I.unmount;
2304
+ function Ii(t, e, i) {
2305
+ return t && (t.__c && t.__c.__H && (t.__c.__H.__.forEach(function(n) {
2306
+ typeof n.__c == "function" && n.__c();
2307
+ }), t.__c.__H = null), (t = xr({}, t)).__c != null && (t.__c.__P === i && (t.__c.__P = e), t.__c = null), t.__k = t.__k && t.__k.map(function(n) {
2308
+ return Ii(n, e, i);
2309
+ })), t;
2310
+ }
2311
+ function Oi(t, e, i) {
2312
+ return t && i && (t.__v = null, t.__k = t.__k && t.__k.map(function(n) {
2313
+ return Oi(n, e, i);
2314
+ }), t.__c && t.__c.__P === e && (t.__e && i.appendChild(t.__e), t.__c.__e = !0, t.__c.__P = i)), t;
2315
+ }
2316
+ function He() {
2317
+ this.__u = 0, this.o = null, this.__b = null;
2318
+ }
2319
+ function Ti(t) {
2320
+ var e = t.__.__c;
2321
+ return e && e.__a && e.__a(t);
2322
+ }
2323
+ function Se() {
2324
+ this.i = null, this.l = null;
2325
+ }
2326
+ I.unmount = function(t) {
2327
+ var e = t.__c;
2328
+ e && e.__R && e.__R(), e && 32 & t.__u && (t.type = null), qt && qt(t);
2329
+ }, (He.prototype = new ie()).__c = function(t, e) {
2330
+ var i = e.__c, n = this;
2331
+ n.o == null && (n.o = []), n.o.push(i);
2332
+ var r = Ti(n.__v), o = !1, s = function() {
2333
+ o || (o = !0, i.__R = null, r ? r(a) : a());
2334
+ };
2335
+ i.__R = s;
2336
+ var a = function() {
2337
+ if (!--n.__u) {
2338
+ if (n.state.__a) {
2339
+ var l = n.state.__a;
2340
+ n.__v.__k[0] = Oi(l, l.__c.__P, l.__c.__O);
2341
+ }
2342
+ var c;
2343
+ for (n.setState({ __a: n.__b = null }); c = n.o.pop(); )
2344
+ c.forceUpdate();
2345
+ }
2346
+ };
2347
+ n.__u++ || 32 & e.__u || n.setState({ __a: n.__b = n.__v.__k[0] }), t.then(s, s);
2348
+ }, He.prototype.componentWillUnmount = function() {
2349
+ this.o = [];
2350
+ }, He.prototype.render = function(t, e) {
2351
+ if (this.__b) {
2352
+ if (this.__v.__k) {
2353
+ var i = document.createElement("div"), n = this.__v.__k[0].__c;
2354
+ this.__v.__k[0] = Ii(this.__b, i, n.__O = n.__P);
2355
+ }
2356
+ this.__b = null;
2357
+ }
2358
+ var r = e.__a && mt(bt, null, t.fallback);
2359
+ return r && (r.__u &= -33), [mt(bt, null, e.__a ? null : t.children), r];
2360
+ };
2361
+ var Ht = function(t, e, i) {
2362
+ if (++i[1] === i[0] && t.l.delete(e), t.props.revealOrder && (t.props.revealOrder[0] !== "t" || !t.l.size))
2363
+ for (i = t.i; i; ) {
2364
+ for (; i.length > 3; )
2365
+ i.pop()();
2366
+ if (i[1] < i[0])
2367
+ break;
2368
+ t.i = i = i[2];
2369
+ }
2370
+ };
2371
+ (Se.prototype = new ie()).__a = function(t) {
2372
+ var e = this, i = Ti(e.__v), n = e.l.get(t);
2373
+ return n[0]++, function(r) {
2374
+ var o = function() {
2375
+ e.props.revealOrder ? (n.push(r), Ht(e, t, n)) : r();
2376
+ };
2377
+ i ? i(o) : o();
2378
+ };
2379
+ }, Se.prototype.render = function(t) {
2380
+ this.i = null, this.l = /* @__PURE__ */ new Map();
2381
+ var e = Ye(t.children);
2382
+ t.revealOrder && t.revealOrder[0] === "b" && e.reverse();
2383
+ for (var i = e.length; i--; )
2384
+ this.l.set(e[i], this.i = [1, 0, this.i]);
2385
+ return t.children;
2386
+ }, Se.prototype.componentDidUpdate = Se.prototype.componentDidMount = function() {
2387
+ var t = this;
2388
+ this.l.forEach(function(e, i) {
2389
+ Ht(t, i, e);
2390
+ });
2391
+ };
2392
+ var Ir = typeof Symbol != "undefined" && Symbol.for && Symbol.for("react.element") || 60103, Or = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, Tr = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, kr = /[A-Z0-9]/g, Dr = typeof document != "undefined", Nr = function(t) {
2393
+ return (typeof Symbol != "undefined" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(t);
2394
+ };
2395
+ function pt(t, e, i) {
2396
+ return e.__k == null && (e.textContent = ""), Li(t, e), typeof i == "function" && i(), t ? t.__c : null;
2397
+ }
2398
+ ie.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(t) {
2399
+ Object.defineProperty(ie.prototype, t, { configurable: !0, get: function() {
2400
+ return this["UNSAFE_" + t];
2401
+ }, set: function(e) {
2402
+ Object.defineProperty(this, t, { configurable: !0, writable: !0, value: e });
2403
+ } });
2404
+ });
2405
+ var Wt = I.event;
2406
+ function Pr() {
2407
+ }
2408
+ function Cr() {
2409
+ return this.cancelBubble;
2410
+ }
2411
+ function Lr() {
2412
+ return this.defaultPrevented;
2413
+ }
2414
+ I.event = function(t) {
2415
+ return Wt && (t = Wt(t)), t.persist = Pr, t.isPropagationStopped = Cr, t.isDefaultPrevented = Lr, t.nativeEvent = t;
2416
+ };
2417
+ var $r = { enumerable: !1, configurable: !0, get: function() {
2418
+ return this.class;
2419
+ } }, Jt = I.vnode;
2420
+ I.vnode = function(t) {
2421
+ typeof t.type == "string" && function(e) {
2422
+ var i = e.props, n = e.type, r = {}, o = n.indexOf("-") === -1;
2423
+ for (var s in i) {
2424
+ var a = i[s];
2425
+ if (!(s === "value" && "defaultValue" in i && a == null || Dr && s === "children" && n === "noscript" || s === "class" || s === "className")) {
2426
+ var l = s.toLowerCase();
2427
+ s === "defaultValue" && "value" in i && i.value == null ? s = "value" : s === "download" && a === !0 ? a = "" : l === "translate" && a === "no" ? a = !1 : l[0] === "o" && l[1] === "n" ? l === "ondoubleclick" ? s = "ondblclick" : l !== "onchange" || n !== "input" && n !== "textarea" || Nr(i.type) ? l === "onfocus" ? s = "onfocusin" : l === "onblur" ? s = "onfocusout" : Tr.test(s) && (s = l) : l = s = "oninput" : o && Or.test(s) ? s = s.replace(kr, "-$&").toLowerCase() : a === null && (a = void 0), l === "oninput" && r[s = l] && (s = "oninputCapture"), r[s] = a;
2428
+ }
2429
+ }
2430
+ n == "select" && r.multiple && Array.isArray(r.value) && (r.value = Ye(i.children).forEach(function(c) {
2431
+ c.props.selected = r.value.indexOf(c.props.value) != -1;
2432
+ })), n == "select" && r.defaultValue != null && (r.value = Ye(i.children).forEach(function(c) {
2433
+ c.props.selected = r.multiple ? r.defaultValue.indexOf(c.props.value) != -1 : r.defaultValue == c.props.value;
2434
+ })), i.class && !i.className ? (r.class = i.class, Object.defineProperty(r, "className", $r)) : (i.className && !i.class || i.class && i.className) && (r.class = r.className = i.className), e.props = r;
2435
+ }(t), t.$$typeof = Ir, Jt && Jt(t);
2436
+ };
2437
+ var Yt = I.__r;
2438
+ I.__r = function(t) {
2439
+ Yt && Yt(t), t.__c;
2440
+ };
2441
+ var Qt = I.diffed;
2442
+ I.diffed = function(t) {
2443
+ Qt && Qt(t);
2444
+ var e = t.props, i = t.__e;
2445
+ i != null && t.type === "textarea" && "value" in e && e.value !== i.value && (i.value = e.value == null ? "" : e.value);
2446
+ };
2447
+ function Mr(t, e) {
2448
+ const i = pi(t);
2449
+ hr(() => {
2450
+ i.current = t;
2451
+ }, [t]), ft(() => {
2452
+ if (e === null)
2453
+ return;
2454
+ const n = setInterval(() => {
2455
+ i.current();
2456
+ }, e);
2457
+ return () => {
2458
+ clearInterval(n);
2459
+ };
2460
+ }, [e]);
2461
+ }
2462
+ var Ur = 0;
2463
+ function b(t, e, i, n, r, o) {
2464
+ e || (e = {});
2465
+ var s, a, l = e;
2466
+ if ("ref" in l)
2467
+ for (a in l = {}, e)
2468
+ a == "ref" ? s = e[a] : l[a] = e[a];
2469
+ var c = { type: t, props: l, key: i, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Ur, __i: -1, __u: 0, __source: r, __self: o };
2470
+ if (typeof t == "function" && (s = t.defaultProps))
2471
+ for (a in s)
2472
+ l[a] === void 0 && (l[a] = s[a]);
2473
+ return I.vnode && I.vnode(c), c;
2474
+ }
2475
+ const jr = me`
2476
+ ${$}
2477
+ position: fixed;
2478
+ top: 0;
2479
+ left: 0;
2480
+ display: flex;
2481
+ justify-content: center;
2482
+ align-items: center;
2483
+ z-index: 998;
2484
+ background: rgba(0, 0, 0, 0.5);
2485
+ width: 100vw;
2486
+ height: 100vh;
2487
+
2488
+ .card-wrapper {
2489
+ ${$}
2490
+ position: relative;
2491
+ display: flex;
2492
+ flex-direction: column;
2493
+ justify-content: center;
2494
+ align-items: center;
2495
+ background: white;
2496
+ border-radius: 8px;
2497
+ overflow: hidden;
2498
+ width: 250px;
2499
+ min-height: 100px;
2500
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
2501
+
2502
+ .body {
2503
+ ${$}
2504
+ display: flex;
2505
+ flex-direction: column;
2506
+ width: 100%;
2507
+ padding: 16px;
2508
+ min-height: 100px;
2509
+ box-sizing: border-box;
2510
+ justify-content: center;
2511
+ .title {
2512
+ ${$}
2513
+ text-align: center;
2514
+ font-size: 16px;
2515
+ font-weight: bold;
2516
+ margin-bottom: 8px;
2517
+ }
2518
+
2519
+ .content {
2520
+ ${$}
2521
+ font-size: 14px;
2522
+ color: #888;
2523
+ margin-bottom: 16px;
2524
+ }
2525
+ }
2526
+
2527
+ .footer {
2528
+ ${$}
2529
+ display: flex;
2530
+ align-items: center;
2531
+ width: 100%;
2532
+ height: 40px;
2533
+ button {
2534
+ ${$}
2535
+ border: none;
2536
+ outline: none;
2537
+ height: 100%;
2538
+ font-size: 14px;
2539
+ padding: 8px 16px;
2540
+ flex: 1;
2541
+ cursor: pointer;
2542
+
2543
+ &.confirm-btm {
2544
+ background: rgb(120, 23, 255);
2545
+ color: white;
2546
+ }
2547
+ }
2548
+ }
2549
+ }
2550
+ `, V = O(null), st = O(""), at = O(""), ke = O(!1), Fr = () => {
2551
+ var t;
2552
+ (t = V.value) == null || t.call(V, !1);
2553
+ }, Br = () => {
2554
+ var t;
2555
+ (t = V.value) == null || t.call(V, !0);
2556
+ }, Vr = async (t) => {
2557
+ let {
2558
+ title: e,
2559
+ content: i
2560
+ } = t;
2561
+ return V.value && (V.value(!1), C(() => {
2562
+ V.value = null, ke.value = !1;
2563
+ })), C(() => {
2564
+ st.value = e || "", at.value = i || "", ke.value = !0;
2565
+ }), new Promise((n) => {
2566
+ V.value = (r) => {
2567
+ C(() => {
2568
+ V.value = null, ke.value = !1, st.value = "", at.value = "";
2569
+ }), n(r);
2570
+ };
2571
+ });
2572
+ }, Gr = () => ke.value ? b("div", {
2573
+ className: jr,
2574
+ children: b("div", {
2575
+ className: "card-wrapper",
2576
+ children: [b("div", {
2577
+ className: "body",
2578
+ children: [b("div", {
2579
+ className: "title",
2580
+ children: st.value
2581
+ }), b("div", {
2582
+ className: "content",
2583
+ children: at.value
2584
+ })]
2585
+ }), b("div", {
2586
+ className: "footer",
2587
+ children: [b("button", {
2588
+ onClick: Fr,
2589
+ className: "cancel-btn",
2590
+ children: "Cancel"
2591
+ }), b("button", {
2592
+ onClick: Br,
2593
+ className: "confirm-btm",
2594
+ children: "Confirm"
2595
+ })]
2596
+ })]
2597
+ })
2598
+ }) : null, Kr = me`
2599
+ ${$}
2600
+ position: relative;
2601
+ display: flex;
2602
+ align-items: center;
2603
+ justify-content: flex-end;
2604
+ background: black;
2605
+ padding-top: env(safe-area-inset-top, 20px);
2606
+ width: 100%;
2607
+ height: 60px;
2608
+ padding: 0 20px;
2609
+ box-sizing: border-box;
2610
+
2611
+ .timer {
2612
+ color: white;
2613
+ margin-right: 20px;
2614
+ }
2615
+
2616
+ button {
2617
+ ${$}
2618
+ padding: 0 20px;
2619
+ height: 30px;
2620
+ line-height: 30px;
2621
+ font-size: 16px;
2622
+ background: rgb(120, 23, 255);
2623
+ border-radius: 100px;
2624
+ color: white;
2625
+
2626
+ &:disabled {
2627
+ opacity: 0.5;
2628
+ cursor: not-allowed;
2629
+ }
2630
+ }
2631
+ `, zr = () => {
2632
+ const t = O(!1), e = O(null);
2633
+ return {
2634
+ timerPaused: t,
2635
+ startTimestamp: e,
2636
+ startTimer: () => {
2637
+ C(() => {
2638
+ e.value = Date.now(), t.value = !1;
2639
+ });
2640
+ }
2641
+ };
2642
+ }, qr = (t) => {
2643
+ let {
2644
+ countdown: e = 0,
2645
+ mode: i,
2646
+ onClose: n,
2647
+ state: r
2648
+ } = t;
2649
+ const {
2650
+ startTimestamp: o,
2651
+ timerPaused: s
2652
+ } = r, a = xi(e);
2653
+ Sr(() => {
2654
+ o.value && (a.value = e);
2655
+ }), Mr(() => {
2656
+ a.value > 0 ? a.value -= 1 : C(() => {
2657
+ s.value = !0, a.value = 0;
2658
+ });
2659
+ }, s.value ? null : 1e3);
2660
+ const l = he(() => {
2661
+ if (i === "interstitial" || i === "rewarded_insterstitial" || !o.value)
2662
+ return !1;
2663
+ const v = Date.now() - o.value;
2664
+ return a.value > 0 && e - a.value >= 5 && v >= 5e3;
2665
+ }), c = he(() => {
2666
+ if (i === "interstitial")
2667
+ return !0;
2668
+ if (!o.value)
2669
+ return !1;
2670
+ const v = Date.now() - o.value;
2671
+ return a.value <= 0 && v >= (e - 1) * 1e3 && e > 5;
2672
+ }), u = he(() => i === "interstitial" ? !1 : !l.value && !c.value), d = async () => {
2673
+ if (s.value = !0, !await Vr({
2674
+ title: "Are you sure?",
2675
+ content: "You will lose your reward if you dismiss this Ad."
2676
+ })) {
2677
+ s.value = !1;
2678
+ return;
2679
+ }
2680
+ n("dismiss"), C(() => {
2681
+ s.value = !0, a.value = 0, o.value = null;
2682
+ });
2683
+ }, f = () => {
2684
+ n("viewed"), C(() => {
2685
+ s.value = !0, a.value = 0, o.value = null;
2686
+ });
2687
+ };
2688
+ return b("div", {
2689
+ className: Kr,
2690
+ children: [a.value > 0 && i !== "interstitial" && b("div", {
2691
+ className: "timer",
2692
+ children: [a.value, "s"]
2693
+ }), b("button", {
2694
+ onClick: l.value ? d : c.value ? f : void 0,
2695
+ disabled: u.value,
2696
+ children: b("svg", {
2697
+ width: "12",
2698
+ height: "12",
2699
+ viewBox: "0 0 14 14",
2700
+ fill: "none",
2701
+ xmlns: "http://www.w3.org/2000/svg",
2702
+ children: b("path", {
2703
+ d: "M13.3 0.710215C12.91 0.320215 12.28 0.320215 11.89 0.710215L6.99997 5.59022L2.10997 0.700215C1.71997 0.310215 1.08997 0.310215 0.699971 0.700215C0.309971 1.09021 0.309971 1.72022 0.699971 2.11022L5.58997 7.00022L0.699971 11.8902C0.309971 12.2802 0.309971 12.9102 0.699971 13.3002C1.08997 13.6902 1.71997 13.6902 2.10997 13.3002L6.99997 8.41021L11.89 13.3002C12.28 13.6902 12.91 13.6902 13.3 13.3002C13.69 12.9102 13.69 12.2802 13.3 11.8902L8.40997 7.00022L13.3 2.11022C13.68 1.73022 13.68 1.09022 13.3 0.710215Z",
2704
+ fill: "white"
2705
+ })
2706
+ })
2707
+ })]
2708
+ });
2709
+ }, ki = () => {
2710
+ const t = O(), e = O(), i = O(), n = O(), r = O(), o = O(!1), s = O(15), a = O(""), l = O("reward");
2711
+ return {
2712
+ afterAd: t,
2713
+ adDismissed: e,
2714
+ adViewed: i,
2715
+ adBreakDone: n,
2716
+ adLoaded: r,
2717
+ visible: o,
2718
+ countdown: s,
2719
+ src: a,
2720
+ mode: l
2721
+ };
2722
+ }, Hr = me`
2723
+ ${$}
2724
+ position: fixed;
2725
+ z-index: 2147483647;
2726
+ background: white;
2727
+ width: 100vw;
2728
+ height: 100vh;
2729
+ display: flex;
2730
+ flex-direction: column;
2731
+
2732
+ iframe {
2733
+ ${$}
2734
+ flex: 1;
2735
+ position: relative;
2736
+ display: block;
2737
+ background: white;
2738
+ width: 100%;
2739
+ height: 100%;
2740
+ }
2741
+ `, Di = (t) => {
2742
+ let {
2743
+ state: e
2744
+ } = t;
2745
+ const {
2746
+ afterAd: i,
2747
+ adDismissed: n,
2748
+ adViewed: r,
2749
+ adBreakDone: o,
2750
+ adLoaded: s,
2751
+ visible: a,
2752
+ countdown: l,
2753
+ src: c,
2754
+ mode: u
2755
+ } = e, d = je(() => zr(), []), f = (y) => {
2756
+ var p, A, h, _;
2757
+ a.value = !1, y === "dismiss" ? (p = n.value) == null || p.call(n) : y === "viewed" && ((A = r.value) == null || A.call(r)), (h = i.value) == null || h.call(i), (_ = o.value) == null || _.call(o);
2758
+ }, v = () => {
2759
+ var y;
2760
+ (u.value === "reward" || u.value === "rewarded_insterstitial") && setTimeout(() => {
2761
+ d.startTimer();
2762
+ }, 100), (y = s.value) == null || y.call(s);
2763
+ };
2764
+ return a.value ? b("div", {
2765
+ className: Hr,
2766
+ children: [b(qr, {
2767
+ mode: u.value,
2768
+ onClose: f,
2769
+ countdown: l.value,
2770
+ state: d
2771
+ }), a.value && b("iframe", {
2772
+ src: c.value,
2773
+ onLoad: v,
2774
+ sandbox: "allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"
2775
+ }), b(Gr, {})]
2776
+ }) : null;
2777
+ };
2778
+ function W(t, e, i) {
2779
+ return (e = Wr(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
2780
+ }
2781
+ function Wr(t) {
2782
+ var e = Jr(t, "string");
2783
+ return typeof e == "symbol" ? e : e + "";
2784
+ }
2785
+ function Jr(t, e) {
2786
+ if (typeof t != "object" || !t)
2787
+ return t;
2788
+ var i = t[Symbol.toPrimitive];
2789
+ if (i !== void 0) {
2790
+ var n = i.call(t, e);
2791
+ if (typeof n != "object")
2792
+ return n;
2793
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2794
+ }
2795
+ return (e === "string" ? String : Number)(t);
2796
+ }
2797
+ class Yr {
2798
+ constructor(e, i) {
2799
+ W(this, "name", "OKSPIN"), W(this, "initialized", !1), W(this, "initCompleter", null), W(this, "context", void 0), W(this, "initParams", void 0), W(this, "adsOverlay", null), W(this, "adsIsShowing", !1), W(this, "lastUnDisplayedAdBreak", null), W(this, "state", ki()), this.context = e, this.initParams = i;
2800
+ }
2801
+ async init() {
2802
+ var e;
2803
+ this.adsOverlay = document.createElement("div"), this.adsOverlay.setAttribute("data-placement-info", "afg"), pt(b(Di, {
2804
+ state: this.state
2805
+ }), this.adsOverlay), document.documentElement.appendChild(this.adsOverlay), this.initialized = !0, (e = this.initCompleter) == null || e.call(this);
2806
+ }
2807
+ adConfig(e) {
2808
+ var i;
2809
+ if (this.initialized) {
2810
+ (i = e.onReady) == null || i.call(e);
2811
+ return;
2812
+ }
2813
+ this.initCompleter = () => {
2814
+ var n;
2815
+ (n = e.onReady) == null || n.call(e);
2816
+ };
2817
+ }
2818
+ async adBreak(e, i) {
2819
+ var n, r, o, s, a, l, c, u;
2820
+ if (!this.initialized || !this.adsOverlay || !i.params.url) {
2821
+ (n = e.adBreakDone) == null || n.call(e, {
2822
+ breakType: e.type,
2823
+ breakName: e.type === "preroll" ? "" : e.name,
2824
+ breakFormat: e.type === "reward" ? "reward" : "interstitial",
2825
+ breakStatus: "notReady"
2826
+ });
2827
+ return;
2828
+ }
2829
+ if (this.adsIsShowing) {
2830
+ (r = e.adBreakDone) == null || r.call(e, {
2831
+ breakType: e.type,
2832
+ breakName: e.type === "preroll" ? "" : e.name,
2833
+ breakFormat: e.type === "reward" ? "reward" : "interstitial",
2834
+ breakStatus: "frequencyCapped"
2835
+ });
2836
+ return;
2837
+ }
2838
+ switch (e.type) {
2839
+ case "preroll": {
2840
+ (o = e.adBreakDone) == null || o.call(e, {
2841
+ breakType: e.type,
2842
+ breakName: "",
2843
+ breakFormat: "interstitial",
2844
+ breakStatus: "noAdPreloaded"
2845
+ });
2846
+ break;
2847
+ }
2848
+ case "start":
2849
+ case "browse":
2850
+ case "next":
2851
+ case "pause": {
2852
+ (s = e.beforeAd) == null || s.call(e);
2853
+ const d = () => {
2854
+ var v;
2855
+ this.adsIsShowing = !1, (v = e.afterAd) == null || v.call(e);
2856
+ }, f = () => {
2857
+ var v;
2858
+ this.adsIsShowing = !1, (v = e.adBreakDone) == null || v.call(e, {
2859
+ breakType: e.type,
2860
+ breakName: e.name,
2861
+ breakFormat: "interstitial",
2862
+ breakStatus: "viewed"
2863
+ });
2864
+ };
2865
+ C(() => {
2866
+ this.adsIsShowing = !0, this.state.afterAd.value = d, this.state.adBreakDone.value = f, this.state.src.value = i.params.url, this.state.mode.value = "interstitial", this.state.visible.value = !0;
2867
+ });
2868
+ break;
2869
+ }
2870
+ case "reward": {
2871
+ this.lastUnDisplayedAdBreak && ((l = (a = this.lastUnDisplayedAdBreak).adBreakDone) == null || l.call(a, {
2872
+ breakType: this.lastUnDisplayedAdBreak.type,
2873
+ breakName: this.lastUnDisplayedAdBreak.type === "preroll" ? "" : this.lastUnDisplayedAdBreak.name,
2874
+ breakFormat: this.lastUnDisplayedAdBreak.type === "reward" ? "reward" : "interstitial",
2875
+ breakStatus: "ignored"
2876
+ }), this.lastUnDisplayedAdBreak = null), (c = e.beforeAd) == null || c.call(e);
2877
+ const d = () => {
2878
+ var h;
2879
+ this.adsIsShowing = !1, (h = e.afterAd) == null || h.call(e);
2880
+ }, f = {
2881
+ breakType: e.type,
2882
+ breakName: e.name,
2883
+ breakFormat: "reward",
2884
+ breakStatus: "ignored"
2885
+ }, v = () => {
2886
+ var h;
2887
+ this.adsIsShowing = !1, f.breakStatus = "dismissed", (h = e.adDismissed) == null || h.call(e);
2888
+ }, y = () => {
2889
+ var h;
2890
+ this.adsIsShowing = !1, f.breakStatus = "viewed", (h = e.adViewed) == null || h.call(e);
2891
+ }, p = () => {
2892
+ var h;
2893
+ this.adsIsShowing = !1, (h = e.adBreakDone) == null || h.call(e, f);
2894
+ };
2895
+ C(() => {
2896
+ this.state.afterAd.value = d, this.state.adDismissed.value = v, this.state.adViewed.value = y, this.state.adBreakDone.value = p;
2897
+ });
2898
+ const A = () => {
2899
+ var h;
2900
+ if (this.lastUnDisplayedAdBreak = null, !this.adsOverlay) {
2901
+ (h = e.adBreakDone) == null || h.call(e, {
2902
+ breakType: e.type,
2903
+ breakName: e.name,
2904
+ breakFormat: "reward",
2905
+ breakStatus: "notReady"
2906
+ });
2907
+ return;
2908
+ }
2909
+ this.adsIsShowing = !0, C(() => {
2910
+ var _;
2911
+ this.state.countdown.value = (_ = i.params.countdown) != null ? _ : 15, this.state.src.value = i.params.url, this.state.mode.value = "reward", this.state.visible.value = !0;
2912
+ });
2913
+ };
2914
+ this.lastUnDisplayedAdBreak = e, (u = e.beforeReward) == null || u.call(e, A);
2915
+ break;
2916
+ }
2917
+ }
2918
+ }
2919
+ }
2920
+ function Z(t, e, i) {
2921
+ return (e = Qr(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
2922
+ }
2923
+ function Qr(t) {
2924
+ var e = Xr(t, "string");
2925
+ return typeof e == "symbol" ? e : e + "";
2926
+ }
2927
+ function Xr(t, e) {
2928
+ if (typeof t != "object" || !t)
2929
+ return t;
2930
+ var i = t[Symbol.toPrimitive];
2931
+ if (i !== void 0) {
2932
+ var n = i.call(t, e);
2933
+ if (typeof n != "object")
2934
+ return n;
2935
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2936
+ }
2937
+ return (e === "string" ? String : Number)(t);
2938
+ }
2939
+ class Oo {
2940
+ constructor(e) {
2941
+ if (Z(this, "context", void 0), Z(this, "contextInfo", void 0), Z(this, "providers", {}), Z(this, "channelPolicy", void 0), Z(this, "adsActionDetection", void 0), Z(this, "adsTrackSerializer", void 0), Z(this, "initialized", !1), e)
2942
+ this.context = e, this.channelPolicy = new En(this.context), this.adsActionDetection = new Bi(this.context), this.adsTrackSerializer = new oi(this.context), this.contextInfo = this.context.getContextInfo();
2943
+ else
2944
+ throw new Error("JoliboxAdsForGame requires a configuration object");
2945
+ }
2946
+ getRequestContextData(e) {
2947
+ var i, n;
2948
+ return {
2949
+ report: JSON.stringify(this.adsTrackSerializer.serialize(e, {
2950
+ sessionId: this.contextInfo.sessionId,
2951
+ objectType: this.contextInfo.objectType,
2952
+ objectId: this.contextInfo.objectId,
2953
+ testAdsMode: this.contextInfo.testAdsMode
2954
+ })),
2955
+ osType: this.contextInfo.osType,
2956
+ runtimeType: this.contextInfo.runtimeType,
2957
+ sessionId: this.contextInfo.sessionId,
2958
+ deviceId: this.contextInfo.deviceId,
2959
+ adId: this.contextInfo.adId,
2960
+ deviceModel: (i = this.contextInfo.deviceModel) != null ? i : "UnknownModel",
2961
+ deviceBrand: (n = this.contextInfo.deviceBrand) != null ? n : "UnknownBrand"
2962
+ };
2963
+ }
2964
+ getRequestBizParams() {
2965
+ return {
2966
+ objectType: this.contextInfo.objectType,
2967
+ objectId: this.contextInfo.objectId
2968
+ };
2969
+ }
2970
+ async init(e) {
2971
+ window.adsbygoogle = window.adsbygoogle || [];
2972
+ const {
2973
+ data: i
2974
+ } = await this.context.httpClient.post("/api/ads/init", {
2975
+ data: {
2976
+ contextData: this.getRequestContextData("AdsAFGSDKInit"),
2977
+ bizParams: this.getRequestBizParams(),
2978
+ testAdsMode: this.contextInfo.testAdsMode
2979
+ }
2980
+ });
2981
+ if ((i == null ? void 0 : i.length) > 0)
2982
+ for (const n of i)
2983
+ switch (n.provider) {
2984
+ case "ADSENSE": {
2985
+ const r = new Rn(this.context, n.params);
2986
+ await r.init(), this.providers.ADSENSE = r;
2987
+ break;
2988
+ }
2989
+ case "OKSPIN": {
2990
+ const r = new Yr(this.context, n.params);
2991
+ await r.init(), this.providers.OKSPIN = r;
2992
+ break;
2993
+ }
2994
+ }
2995
+ this.initialized = !0;
2996
+ }
2997
+ adConfig(e) {
2998
+ this.providers.ADSENSE ? this.providers.ADSENSE.adConfig(e) : window.adsbygoogle.push(e);
2999
+ }
3000
+ async adBreak(e) {
3001
+ var i, n, r, o, s, a, l, c, u;
3002
+ if ((i = this.context.eventEmitter) == null || i.emit("isAdShowing", !0), this.adsActionDetection.adBreakIsShowing = !0, this.initialized || await this.init(), e.type !== "reward" && !this.channelPolicy.shouldBypassCallingInterstitial()) {
3003
+ (n = e.adBreakDone) == null || n.call(e, {
3004
+ breakType: e.type,
3005
+ breakName: "skipInterstitials",
3006
+ breakFormat: "interstitial",
3007
+ breakStatus: "viewed"
3008
+ });
3009
+ return;
3010
+ }
3011
+ this.context.checkNetwork() || (r = e.adBreakDone) == null || r.call(e, {
3012
+ breakType: e.type,
3013
+ breakName: "NETWORK_NOT_OK",
3014
+ breakFormat: e.type === "reward" ? "reward" : "interstitial",
3015
+ breakStatus: "noAdPreloaded"
3016
+ });
3017
+ try {
3018
+ const {
3019
+ data: d,
3020
+ code: f
3021
+ } = await this.context.httpClient.post("/api/ads/info", {
3022
+ data: {
3023
+ contextData: this.getRequestContextData("AdsAFGSDKAdBreak"),
3024
+ bizParams: this.getRequestBizParams(),
3025
+ adsType: e.type === "reward" ? "REWARD" : "INTERSTITIAL",
3026
+ testAdsMode: this.contextInfo.testAdsMode,
3027
+ name: e.type === "preroll" ? "" : e.name
3028
+ }
3029
+ });
3030
+ if (f !== "SUCCESS") {
3031
+ (o = e.adBreakDone) == null || o.call(e, {
3032
+ breakType: e.type,
3033
+ breakName: "UNKNOWN_ERROR",
3034
+ breakFormat: e.type === "reward" ? "reward" : "interstitial",
3035
+ breakStatus: "noAdPreloaded"
3036
+ });
3037
+ return;
3038
+ } else {
3039
+ const v = d;
3040
+ if (v.length === 0) {
3041
+ (s = e.adBreakDone) == null || s.call(e, {
3042
+ breakType: e.type,
3043
+ breakName: "NO_ADS",
3044
+ breakFormat: e.type === "reward" ? "reward" : "interstitial",
3045
+ breakStatus: "noAdPreloaded"
3046
+ });
3047
+ return;
3048
+ }
3049
+ let y = !0, p = null;
3050
+ const A = new Ui(this.context);
3051
+ for (; v.length > 0; ) {
3052
+ const h = v.shift(), _ = this.providers[h.provider];
3053
+ if (_) {
3054
+ const [L, q] = await A.callAdBreakAndContinue(_, e, h);
3055
+ y = L, p = q;
3056
+ } else
3057
+ y = !0, p = {
3058
+ breakType: e.type,
3059
+ breakName: e.type === "preroll" ? "" : (a = e.name) != null ? a : "",
3060
+ breakFormat: e.type === "reward" ? "reward" : "interstitial",
3061
+ breakStatus: "notReady"
3062
+ };
3063
+ if (!y)
3064
+ break;
3065
+ }
3066
+ y && p && ((l = e.adBreakDone) == null || l.call(e, p));
3067
+ }
3068
+ } catch (d) {
3069
+ (c = e.adBreakDone) == null || c.call(e, {
3070
+ breakType: e.type,
3071
+ breakFormat: e.type === "reward" ? "reward" : "interstitial",
3072
+ breakStatus: "noAdPreloaded"
3073
+ });
3074
+ } finally {
3075
+ (u = this.context.eventEmitter) == null || u.emit("isAdShowing", !1), this.adsActionDetection.adBreakIsShowing = !1;
3076
+ }
3077
+ }
3078
+ adUnit(e) {
3079
+ console.warn("This method has been deprecated. We will not support AdSense AdUnit in the future.");
3080
+ }
3081
+ }
3082
+ function We(t, e, i) {
3083
+ return (e = Zr(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
3084
+ }
3085
+ function Zr(t) {
3086
+ var e = eo(t, "string");
3087
+ return typeof e == "symbol" ? e : e + "";
3088
+ }
3089
+ function eo(t, e) {
3090
+ if (typeof t != "object" || !t)
3091
+ return t;
3092
+ var i = t[Symbol.toPrimitive];
3093
+ if (i !== void 0) {
3094
+ var n = i.call(t, e);
3095
+ if (typeof n != "object")
3096
+ return n;
3097
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3098
+ }
3099
+ return (e === "string" ? String : Number)(t);
3100
+ }
3101
+ class to {
3102
+ constructor(e) {
3103
+ We(this, "context", void 0), We(this, "currentProvider", void 0), We(this, "continueCallback", void 0), this.context = e;
3104
+ }
3105
+ get paramsToTrack() {
3106
+ var e, i;
3107
+ return {
3108
+ provider: (i = (e = this.currentProvider) == null ? void 0 : e.name) != null ? i : null
3109
+ };
3110
+ }
3111
+ wrapAdRequested(e) {
3112
+ return () => {
3113
+ this.context.track("CallAFVRequest", this.paramsToTrack), e == null || e();
3114
+ };
3115
+ }
3116
+ wrapAdLoaded(e) {
3117
+ return (i) => {
3118
+ this.context.track("CallAFVLoad", this.paramsToTrack), e == null || e(i);
3119
+ };
3120
+ }
3121
+ wrapAdPlaying(e) {
3122
+ return (i) => {
3123
+ this.context.track("CallAFVPlaying", this.paramsToTrack), e == null || e(i);
3124
+ };
3125
+ }
3126
+ wrapAdCompleted(e) {
3127
+ return (i) => {
3128
+ var n;
3129
+ this.context.track("CallAFVCompleted", this.paramsToTrack), e == null || e(i), (n = this.continueCallback) == null || n.call(this, [!1, null]);
3130
+ };
3131
+ }
3132
+ wrapAdError(e) {
3133
+ return (i) => {
3134
+ var n;
3135
+ this.context.track("CallAFVError", this.paramsToTrack), (n = this.continueCallback) == null || n.call(this, [!0, i]);
3136
+ };
3137
+ }
3138
+ async callAdRequestAndContinue(e, i, n) {
3139
+ return this.currentProvider = e, new Promise((r) => {
3140
+ this.continueCallback = r;
3141
+ const o = Object.assign({}, i);
3142
+ o.onAdRequested = this.wrapAdRequested(i.onAdRequested), o.onAdLoaded = this.wrapAdLoaded(i.onAdLoaded), o.onAdPlaying = this.wrapAdPlaying(i.onAdPlaying), o.onAdCompleted = this.wrapAdCompleted(i.onAdCompleted), o.onAdError = this.wrapAdError(i.onAdError), e.requestAd(o, n);
3143
+ });
3144
+ }
3145
+ }
3146
+ function Je(t, e, i) {
3147
+ return (e = io(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
3148
+ }
3149
+ function io(t) {
3150
+ var e = no(t, "string");
3151
+ return typeof e == "symbol" ? e : e + "";
3152
+ }
3153
+ function no(t, e) {
3154
+ if (typeof t != "object" || !t)
3155
+ return t;
3156
+ var i = t[Symbol.toPrimitive];
3157
+ if (i !== void 0) {
3158
+ var n = i.call(t, e);
3159
+ if (typeof n != "object")
3160
+ return n;
3161
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3162
+ }
3163
+ return (e === "string" ? String : Number)(t);
3164
+ }
3165
+ class F extends Error {
3166
+ constructor(e, i) {
3167
+ super(e.message), Je(this, "name", void 0), Je(this, "type", void 0), Je(this, "raw", void 0), this.name = "AFVRequestError", this.type = i, this.raw = e, this.stack = e.stack, this.message = e.message;
3168
+ }
3169
+ static from(e, i) {
3170
+ switch (i) {
3171
+ case "GOOGLE_IMA_ERROR":
3172
+ return new F(e, i);
3173
+ case "JOLIBOX_IMA_ERROR":
3174
+ return new F(e, i);
3175
+ }
3176
+ }
3177
+ }
3178
+ function S(t, e, i) {
3179
+ return (e = ro(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
3180
+ }
3181
+ function ro(t) {
3182
+ var e = oo(t, "string");
3183
+ return typeof e == "symbol" ? e : e + "";
3184
+ }
3185
+ function oo(t, e) {
3186
+ if (typeof t != "object" || !t)
3187
+ return t;
3188
+ var i = t[Symbol.toPrimitive];
3189
+ if (i !== void 0) {
3190
+ var n = i.call(t, e);
3191
+ if (typeof n != "object")
3192
+ return n;
3193
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3194
+ }
3195
+ return (e === "string" ? String : Number)(t);
3196
+ }
3197
+ class so {
3198
+ constructor(e, i, n) {
3199
+ S(this, "adsLoader", void 0), S(this, "adDisplayContainer", void 0), S(this, "isAdPlaying", !1), S(this, "isContentFinished", !1), S(this, "videoContent", void 0), S(this, "adContainer", void 0), S(this, "adsManager", void 0), S(this, "intervalTimer", void 0), S(this, "completed", !1), S(this, "adTagUrl", void 0), S(this, "notifyRequestAd", void 0), S(this, "notifyLoaded", void 0), S(this, "notifyPlayingAd", void 0), S(this, "notifyCompleted", void 0), S(this, "notifyError", void 0), S(this, "destroy", () => {
3200
+ var r, o, s, a, l, c, u, d, f, v, y;
3201
+ this.intervalTimer && clearInterval(this.intervalTimer), (r = this.adsManager) == null || r.stop(), (o = this.adDisplayContainer) == null || o.destroy(), (s = this.adsLoader) == null || s.removeEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, this.onAdsManagerLoaded), (a = this.adsLoader) == null || a.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR, this.onAdError), (l = this.adsManager) == null || l.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR, this.onAdError), (c = this.adsManager) == null || c.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED, this.onContentPauseRequested), (u = this.adsManager) == null || u.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED, this.onContentResumeRequested), (d = this.adsManager) == null || d.removeEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED, this.onAdEvent), (f = this.adsManager) == null || f.removeEventListener(window.google.ima.AdEvent.Type.LOADED, this.onAdEvent), (v = this.adsManager) == null || v.removeEventListener(window.google.ima.AdEvent.Type.STARTED, this.onAdEvent), (y = this.adsManager) == null || y.removeEventListener(window.google.ima.AdEvent.Type.COMPLETE, this.onAdEvent);
3202
+ }), S(this, "requestAds", async (r, o) => {
3203
+ var u;
3204
+ this.createAdDisplayContainer(), this.notifyRequestAd = r.onAdRequested, this.notifyLoaded = r.onAdLoaded, this.notifyPlayingAd = r.onAdPlaying, this.notifyCompleted = r.onAdCompleted, this.notifyError = (d) => {
3205
+ var f;
3206
+ return (f = r.onAdError) == null ? void 0 : f.call(r, F.from(d, "GOOGLE_IMA_ERROR"));
3207
+ }, this.adsLoader = new window.google.ima.AdsLoader(this.adDisplayContainer), this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, this.onAdsManagerLoaded, !1), this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR, this.onAdError, !1);
3208
+ const s = () => {
3209
+ var d;
3210
+ this.isAdPlaying || (this.isContentFinished = !0, (d = this.adsLoader) == null || d.contentComplete());
3211
+ };
3212
+ this.videoContent.onended = s;
3213
+ const a = new window.google.ima.AdsRequest();
3214
+ let l = "";
3215
+ Object.keys(o.params).forEach((d) => {
3216
+ const f = window.encodeURIComponent(o.params[d]);
3217
+ l += `&${d}=${f}`;
3218
+ });
3219
+ const c = `${this.adTagUrl}${l}`;
3220
+ a.adTagUrl = c, a.linearAdSlotWidth = 640, a.linearAdSlotHeight = 400, a.nonLinearAdSlotWidth = 640, a.nonLinearAdSlotHeight = 150, this.adsLoader.requestAds(a), (u = this.notifyRequestAd) == null || u.call(this);
3221
+ }), S(this, "createAdDisplayContainer", () => {
3222
+ this.adDisplayContainer = new window.google.ima.AdDisplayContainer(this.adContainer, this.videoContent);
3223
+ }), S(this, "playAds", () => {
3224
+ var r, o;
3225
+ this.videoContent.load(), this.adDisplayContainer.initialize(), this.completed = !1;
3226
+ try {
3227
+ (r = this.adsManager) == null || r.init(window.document.body.clientWidth, window.document.body.clientHeight, window.google.ima.ViewMode.NORMAL), (o = this.adsManager) == null || o.start();
3228
+ } catch (s) {
3229
+ console.error("[JoliboxAFV] Google IMA Error: ", s), this.videoContent.play();
3230
+ }
3231
+ }), S(this, "onAdsManagerLoaded", (r) => {
3232
+ const o = new window.google.ima.AdsRenderingSettings();
3233
+ o.restoreCustomPlaybackStateOnAdBreakComplete = !0, this.adsManager = r.getAdsManager(this.videoContent, o), this.adsManager.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR, this.onAdError), this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED, this.onContentPauseRequested), this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED, this.onContentResumeRequested), this.adsManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED, this.onAdEvent), this.adsManager.addEventListener(window.google.ima.AdEvent.Type.LOADED, this.onAdEvent), this.adsManager.addEventListener(window.google.ima.AdEvent.Type.STARTED, this.onAdEvent), this.adsManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE, this.onAdEvent), r.type === "adsManagerLoaded" && this.playAds();
3234
+ }), S(this, "onAdEvent", (r) => {
3235
+ var s, a, l, c;
3236
+ const o = r.getAd();
3237
+ switch (r.type) {
3238
+ case window.google.ima.AdEvent.Type.LOADED:
3239
+ o != null && o.isLinear() || this.videoContent.play(), (s = this.notifyLoaded) == null || s.call(this, r);
3240
+ break;
3241
+ case window.google.ima.AdEvent.Type.STARTED:
3242
+ o != null && o.isLinear() && (this.intervalTimer = window.setInterval(function() {
3243
+ }, 300)), (a = this.notifyPlayingAd) == null || a.call(this, r);
3244
+ break;
3245
+ case window.google.ima.AdEvent.Type.COMPLETE:
3246
+ o != null && o.isLinear() && clearInterval(this.intervalTimer), this.completed || (this.completed = !0, (l = this.notifyCompleted) == null || l.call(this, r));
3247
+ break;
3248
+ case window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
3249
+ o != null && o.isLinear() && clearInterval(this.intervalTimer), this.completed || (this.completed = !0, (c = this.notifyCompleted) == null || c.call(this, r));
3250
+ break;
3251
+ }
3252
+ }), S(this, "onAdError", (r) => {
3253
+ var o, s;
3254
+ (o = this.notifyError) == null || o.call(this, r.getError()), (s = this.adsManager) == null || s.destroy();
3255
+ }), S(this, "onContentPauseRequested", () => {
3256
+ this.isAdPlaying = !0, this.videoContent.pause();
3257
+ }), S(this, "onContentResumeRequested", () => {
3258
+ this.isAdPlaying = !1;
3259
+ }), this.adTagUrl = e, this.videoContent = i, this.adContainer = n;
3260
+ }
3261
+ }
3262
+ var De = /* @__PURE__ */ ((t) => (t[t.ADS_REQUEST_NETWORK_ERROR = 1012] = "ADS_REQUEST_NETWORK_ERROR", t[t.ASSET_FALLBACK_FAILED = 1021] = "ASSET_FALLBACK_FAILED", t[t.AUTOPLAY_DISALLOWED = 1205] = "AUTOPLAY_DISALLOWED", t[t.COMPANION_AD_LOADING_FAILED = 603] = "COMPANION_AD_LOADING_FAILED", t[t.COMPANION_REQUIRED_ERROR = 602] = "COMPANION_REQUIRED_ERROR", t[t.FAILED_TO_REQUEST_ADS = 1005] = "FAILED_TO_REQUEST_ADS", t[t.INVALID_AD_TAG = 1013] = "INVALID_AD_TAG", t[t.INVALID_ADX_EXTENSION = 1105] = "INVALID_ADX_EXTENSION", t[t.INVALID_ARGUMENTS = 1101] = "INVALID_ARGUMENTS", t[t.NONLINEAR_DIMENSIONS_ERROR = 501] = "NONLINEAR_DIMENSIONS_ERROR", t[t.OVERLAY_AD_LOADING_FAILED = 502] = "OVERLAY_AD_LOADING_FAILED", t[t.OVERLAY_AD_PLAYING_FAILED = 500] = "OVERLAY_AD_PLAYING_FAILED", t[t.STREAM_INITIALIZATION_FAILED = 1020] = "STREAM_INITIALIZATION_FAILED", t[t.UNKNOWN_AD_RESPONSE = 1010] = "UNKNOWN_AD_RESPONSE", t[t.UNKNOWN_ERROR = 900] = "UNKNOWN_ERROR", t[t.UNSUPPORTED_LOCALE = 1011] = "UNSUPPORTED_LOCALE", t[t.VAST_ASSET_NOT_FOUND = 1007] = "VAST_ASSET_NOT_FOUND", t[t.VAST_EMPTY_RESPONSE = 1009] = "VAST_EMPTY_RESPONSE", t[t.VAST_LINEAR_ASSET_MISMATCH = 403] = "VAST_LINEAR_ASSET_MISMATCH", t[t.VAST_LOAD_TIMEOUT = 301] = "VAST_LOAD_TIMEOUT", t[t.VAST_MALFORMED_RESPONSE = 100] = "VAST_MALFORMED_RESPONSE", t[t.VAST_MEDIA_LOAD_TIMEOUT = 402] = "VAST_MEDIA_LOAD_TIMEOUT", t[t.VAST_NO_ADS_AFTER_WRAPPER = 303] = "VAST_NO_ADS_AFTER_WRAPPER", t[t.VAST_NONLINEAR_ASSET_MISMATCH = 503] = "VAST_NONLINEAR_ASSET_MISMATCH", t[t.VAST_PROBLEM_DISPLAYING_MEDIA_FILE = 405] = "VAST_PROBLEM_DISPLAYING_MEDIA_FILE", t[t.VAST_SCHEMA_VALIDATION_ERROR = 101] = "VAST_SCHEMA_VALIDATION_ERROR", t[t.VAST_TOO_MANY_REDIRECTS = 302] = "VAST_TOO_MANY_REDIRECTS", t[t.VAST_TRAFFICKING_ERROR = 200] = "VAST_TRAFFICKING_ERROR", t[t.VAST_UNEXPECTED_DURATION_ERROR = 202] = "VAST_UNEXPECTED_DURATION_ERROR", t[t.VAST_UNEXPECTED_LINEARITY = 201] = "VAST_UNEXPECTED_LINEARITY", t[t.VAST_UNSUPPORTED_VERSION = 102] = "VAST_UNSUPPORTED_VERSION", t[t.VAST_WRAPPER_ERROR = 300] = "VAST_WRAPPER_ERROR", t[t.VIDEO_PLAY_ERROR = 400] = "VIDEO_PLAY_ERROR", t[t.VPAID_ERROR = 901] = "VPAID_ERROR", t))(De || {});
3263
+ const ao = () => {
3264
+ const t = O(!1), e = O(!1), i = O(null), n = At(), r = At();
3265
+ return {
3266
+ visible: t,
3267
+ canRetry: e,
3268
+ retry: i,
3269
+ videoRef: n,
3270
+ adContainerRef: r
3271
+ };
3272
+ }, lo = me`
3273
+ ${$}
3274
+ position: fixed;
3275
+ left: 0;
3276
+ top: 0;
3277
+ display: none;
3278
+ z-index: 2147483647;
3279
+ background: black;
3280
+ width: 100vw;
3281
+ height: 100vh;
3282
+
3283
+ &[data-visible='true'] {
3284
+ display: block;
3285
+ }
3286
+
3287
+ .ads-wrapper {
3288
+ ${$}
3289
+ position: relative;
3290
+ width: 100%;
3291
+ height: 100%;
3292
+ display: block;
3293
+
3294
+ video {
3295
+ position: absolute;
3296
+ top: 0;
3297
+ left: 0;
3298
+ width: 100%;
3299
+ height: 100%;
3300
+ }
3301
+
3302
+ #ad-container {
3303
+ position: absolute;
3304
+ top: 0;
3305
+ left: 0;
3306
+ width: 100%;
3307
+ height: 100%;
3308
+ }
3309
+
3310
+ .retry-button {
3311
+ ${$}
3312
+ position: absolute;
3313
+ width: 100%;
3314
+ height: 100%;
3315
+ display: flex;
3316
+ justify-content: center;
3317
+ align-items: center;
3318
+ cursor: pointer;
3319
+ }
3320
+ }
3321
+ `, co = (t) => {
3322
+ let {
3323
+ onReady: e,
3324
+ state: i
3325
+ } = t;
3326
+ const {
3327
+ visible: n,
3328
+ retry: r,
3329
+ canRetry: o,
3330
+ videoRef: s,
3331
+ adContainerRef: a
3332
+ } = i, l = () => {
3333
+ r.value && (r.value(), C(() => {
3334
+ r.value = null, o.value = !1;
3335
+ }));
3336
+ };
3337
+ return ft(() => {
3338
+ e();
3339
+ }, [e]), b("div", {
3340
+ className: lo,
3341
+ "data-visible": n.value,
3342
+ children: b("div", {
3343
+ className: "ads-wrapper",
3344
+ children: [b("video", {
3345
+ ref: s,
3346
+ width: "100%",
3347
+ height: "100%"
3348
+ }), b("div", {
3349
+ id: "ad-container",
3350
+ ref: a
3351
+ }), o.value ? b("div", {
3352
+ className: "retry-button",
3353
+ onClick: l,
3354
+ children: b("svg", {
3355
+ width: "64",
3356
+ height: "64",
3357
+ viewBox: "0 0 64 64",
3358
+ fill: "none",
3359
+ xmlns: "http://www.w3.org/2000/svg",
3360
+ children: [b("circle", {
3361
+ cx: "32",
3362
+ cy: "32",
3363
+ r: "32",
3364
+ fill: "#141416",
3365
+ fillOpacity: "0.3"
3366
+ }), b("path", {
3367
+ d: "M25.3334 23.3668V40.6334C25.3334 41.9501 26.7834 42.7501 27.9 42.0334L41.4667 33.4001C42.5 32.7501 42.5 31.2501 41.4667 30.5834L27.9 21.9668C26.7834 21.2501 25.3334 22.0501 25.3334 23.3668Z",
3368
+ fill: "white"
3369
+ })]
3370
+ })
3371
+ }) : null]
3372
+ })
3373
+ });
3374
+ };
3375
+ function Y(t, e, i) {
3376
+ return (e = uo(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
3377
+ }
3378
+ function uo(t) {
3379
+ var e = fo(t, "string");
3380
+ return typeof e == "symbol" ? e : e + "";
3381
+ }
3382
+ function fo(t, e) {
3383
+ if (typeof t != "object" || !t)
3384
+ return t;
3385
+ var i = t[Symbol.toPrimitive];
3386
+ if (i !== void 0) {
3387
+ var n = i.call(t, e);
3388
+ if (typeof n != "object")
3389
+ return n;
3390
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3391
+ }
3392
+ return (e === "string" ? String : Number)(t);
3393
+ }
3394
+ class ho {
3395
+ constructor(e) {
3396
+ Y(this, "name", "GOOGLE_IMA"), Y(this, "context", void 0), Y(this, "adsOverlay", null), Y(this, "initialized", !1), Y(this, "ima", null), Y(this, "state", ao()), Y(this, "init", async (i) => {
3397
+ const n = "//imasdk.googleapis.com/js/sdkloader/ima3.js";
3398
+ await new Promise((r, o) => {
3399
+ const s = document.createElement("script");
3400
+ s.src = n, s.onload = () => {
3401
+ var a;
3402
+ (a = window.google) != null && a.ima ? r() : setTimeout(r, 100);
3403
+ }, s.onerror = o, document.head.appendChild(s);
3404
+ }), this.adsOverlay = document.createElement("div"), document.documentElement.appendChild(this.adsOverlay), await new Promise((r, o) => {
3405
+ pt(b(co, {
3406
+ state: this.state,
3407
+ onReady: () => {
3408
+ this.ima = new so(i.params.adTagUrl, this.state.videoRef.current, this.state.adContainerRef.current), r();
3409
+ }
3410
+ }), this.adsOverlay);
3411
+ }), this.initialized = !0;
3412
+ }), Y(this, "requestAd", (i, n) => {
3413
+ var a;
3414
+ if (!this.adsOverlay || !this.ima || !this.initialized) {
3415
+ const l = F.from(new Error("IMA not initialized"), "JOLIBOX_IMA_ERROR");
3416
+ (a = i.onAdError) == null || a.call(i, l);
3417
+ return;
3418
+ }
3419
+ const r = (l) => {
3420
+ var c;
3421
+ this.ima.destroy(), this.state.visible.value = !1, (c = i.onAdCompleted) == null || c.call(i, l);
3422
+ }, o = (l) => {
3423
+ let c = !1;
3424
+ switch (l.raw.getErrorCode()) {
3425
+ case De.AUTOPLAY_DISALLOWED:
3426
+ case De.VIDEO_PLAY_ERROR:
3427
+ case De.ADS_REQUEST_NETWORK_ERROR: {
3428
+ c = !0;
3429
+ break;
3430
+ }
3431
+ default: {
3432
+ c = !1;
3433
+ break;
3434
+ }
3435
+ }
3436
+ if (!c)
3437
+ this.ima.destroy(), this.state.visible.value = !1;
3438
+ else {
3439
+ const u = () => {
3440
+ this.ima.destroy(), this.requestAd(i, n);
3441
+ };
3442
+ C(() => {
3443
+ this.state.canRetry.value = !0, this.state.retry.value = u;
3444
+ });
3445
+ }
3446
+ }, s = Object.assign({}, i);
3447
+ s.onAdCompleted = r, s.onAdError = o, this.ima.requestAds(s, n), this.state.visible.value = !0;
3448
+ }), this.context = e;
3449
+ }
3450
+ }
3451
+ function J(t, e, i) {
3452
+ return (e = vo(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
3453
+ }
3454
+ function vo(t) {
3455
+ var e = _o(t, "string");
3456
+ return typeof e == "symbol" ? e : e + "";
3457
+ }
3458
+ function _o(t, e) {
3459
+ if (typeof t != "object" || !t)
3460
+ return t;
3461
+ var i = t[Symbol.toPrimitive];
3462
+ if (i !== void 0) {
3463
+ var n = i.call(t, e);
3464
+ if (typeof n != "object")
3465
+ return n;
3466
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3467
+ }
3468
+ return (e === "string" ? String : Number)(t);
3469
+ }
3470
+ class po {
3471
+ constructor(e) {
3472
+ J(this, "name", "OKSPIN"), J(this, "initialized", !1), J(this, "initCompleter", null), J(this, "context", void 0), J(this, "adsOverlay", null), J(this, "adsIsShowing", !1), J(this, "state", ki()), J(this, "init", async (i) => {
3473
+ var n;
3474
+ this.adsOverlay = document.createElement("div"), this.adsOverlay.setAttribute("data-placement-info", "afv"), pt(b(Di, {
3475
+ state: this.state
3476
+ }), this.adsOverlay), document.documentElement.appendChild(this.adsOverlay), this.initialized = !0, (n = this.initCompleter) == null || n.call(this);
3477
+ }), J(this, "requestAd", (i, n) => {
3478
+ var s, a, l, c;
3479
+ if (!this.adsOverlay || !this.initialized) {
3480
+ (s = i.onAdError) == null || s.call(i, F.from(new Error("Ads not initialized"), "JOLIBOX_IMA_ERROR"));
3481
+ return;
3482
+ }
3483
+ if (this.adsIsShowing) {
3484
+ (a = i.onAdError) == null || a.call(i, F.from(new Error("Ads already showing"), "JOLIBOX_IMA_ERROR"));
3485
+ return;
3486
+ }
3487
+ (l = i.onAdRequested) == null || l.call(i);
3488
+ const r = () => {
3489
+ var u;
3490
+ this.adsIsShowing = !1, (u = i.onAdCompleted) == null || u.call(i, void 0);
3491
+ }, o = () => {
3492
+ var u;
3493
+ (u = i.onAdLoaded) == null || u.call(i, void 0);
3494
+ };
3495
+ this.adsIsShowing = !0, C(() => {
3496
+ var u;
3497
+ this.state.adLoaded.value = o, this.state.adBreakDone.value = r, this.state.countdown.value = (u = n.params.countdown) != null ? u : 15, this.state.src.value = n.params.url, this.state.mode.value = "rewarded_insterstitial", this.state.visible.value = !0;
3498
+ }), (c = i.onAdPlaying) == null || c.call(i, void 0);
3499
+ }), this.context = e;
3500
+ }
3501
+ }
3502
+ function de(t, e, i) {
3503
+ return (e = yo(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
3504
+ }
3505
+ function yo(t) {
3506
+ var e = go(t, "string");
3507
+ return typeof e == "symbol" ? e : e + "";
3508
+ }
3509
+ function go(t, e) {
3510
+ if (typeof t != "object" || !t)
3511
+ return t;
3512
+ var i = t[Symbol.toPrimitive];
3513
+ if (i !== void 0) {
3514
+ var n = i.call(t, e);
3515
+ if (typeof n != "object")
3516
+ return n;
3517
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3518
+ }
3519
+ return (e === "string" ? String : Number)(t);
3520
+ }
3521
+ class To {
3522
+ constructor(e) {
3523
+ if (de(this, "context", void 0), de(this, "contextInfo", void 0), de(this, "providers", {}), de(this, "adsTrackSerializer", void 0), de(this, "initialized", !1), e)
3524
+ this.context = e, this.adsTrackSerializer = new oi(e), this.contextInfo = this.context.getContextInfo();
3525
+ else
3526
+ throw new Error("JoliboxAdsForVideo requires a configuration object");
3527
+ }
3528
+ getRequestContextData(e) {
3529
+ var i, n;
3530
+ return {
3531
+ report: JSON.stringify(this.adsTrackSerializer.serialize(e, {
3532
+ sessionId: this.contextInfo.sessionId,
3533
+ objectType: this.contextInfo.objectType,
3534
+ objectId: this.contextInfo.objectId,
3535
+ testAdsMode: this.contextInfo.testAdsMode
3536
+ })),
3537
+ osType: this.contextInfo.osType,
3538
+ runtimeType: this.contextInfo.runtimeType,
3539
+ sessionId: this.contextInfo.sessionId,
3540
+ deviceId: this.contextInfo.deviceId,
3541
+ adId: this.contextInfo.adId,
3542
+ deviceModel: (i = this.contextInfo.deviceModel) != null ? i : "UnknownModel",
3543
+ deviceBrand: (n = this.contextInfo.deviceBrand) != null ? n : "UnknownBrand"
3544
+ };
3545
+ }
3546
+ getRequestBizParams() {
3547
+ return {
3548
+ objectType: this.contextInfo.objectType,
3549
+ objectId: this.contextInfo.objectId
3550
+ };
3551
+ }
3552
+ async init() {
3553
+ const {
3554
+ data: e
3555
+ } = await this.context.httpClient.post("/api/ads/init", {
3556
+ data: {
3557
+ contextData: this.getRequestContextData("AdsAFVSDKInit"),
3558
+ bizParams: this.getRequestBizParams(),
3559
+ testAdsMode: this.contextInfo.testAdsMode
3560
+ }
3561
+ });
3562
+ if ((e == null ? void 0 : e.length) > 0)
3563
+ for (const i of e)
3564
+ switch (i.provider) {
3565
+ case "GOOGLE_IMA": {
3566
+ const n = new ho(this.context);
3567
+ await n.init(i), this.providers.GOOGLE_IMA = n;
3568
+ break;
3569
+ }
3570
+ case "OKSPIN": {
3571
+ const n = new po(this.context);
3572
+ await n.init(i), this.providers.OKSPIN = n;
3573
+ break;
3574
+ }
3575
+ }
3576
+ this.initialized = !0;
3577
+ }
3578
+ async requestAd(e) {
3579
+ var i, n, r, o, s, a, l;
3580
+ if ((i = this.context.eventEmitter) == null || i.emit("isAdShowing", !0), this.initialized || await this.init(), !this.context.checkNetwork()) {
3581
+ const c = F.from(new Error("No network connection"), "JOLIBOX_IMA_ERROR");
3582
+ (n = e.onAdError) == null || n.call(e, c);
3583
+ return;
3584
+ }
3585
+ try {
3586
+ const {
3587
+ data: c,
3588
+ code: u
3589
+ } = await this.context.httpClient.post("/api/ads/info", {
3590
+ data: {
3591
+ contextData: this.getRequestContextData("AdsAFVSDKRequest"),
3592
+ bizParams: this.getRequestBizParams(),
3593
+ testAdsMode: this.contextInfo.testAdsMode,
3594
+ adsType: "REWARD_INTERSTITIAL"
3595
+ }
3596
+ });
3597
+ if (u !== "SUCCESS") {
3598
+ const d = F.from(new Error("Unknown error"), "JOLIBOX_IMA_ERROR");
3599
+ (r = e.onAdError) == null || r.call(e, d);
3600
+ return;
3601
+ } else {
3602
+ const d = c;
3603
+ if (d.length === 0) {
3604
+ const p = F.from(new Error("No ads available"), "JOLIBOX_IMA_ERROR");
3605
+ (o = e.onAdError) == null || o.call(e, p);
3606
+ return;
3607
+ }
3608
+ let f = !0, v = null;
3609
+ const y = new to(this.context);
3610
+ for (; d.length > 0; ) {
3611
+ const p = d.shift(), A = this.providers[p.provider];
3612
+ if (A) {
3613
+ const [h, _] = await y.callAdRequestAndContinue(A, e, p);
3614
+ f = h, v = _;
3615
+ } else
3616
+ f = !0, v = F.from(new Error("No provider available"), "JOLIBOX_IMA_ERROR");
3617
+ if (!f)
3618
+ break;
3619
+ }
3620
+ f && v && ((s = e.onAdError) == null || s.call(e, v));
3621
+ }
3622
+ } catch (c) {
3623
+ const u = F.from(new Error("Failed to request ad"), "JOLIBOX_IMA_ERROR");
3624
+ (a = e.onAdError) == null || a.call(e, u);
3625
+ } finally {
3626
+ (l = this.context.eventEmitter) == null || l.emit("isAdShowing", !1);
3627
+ }
3628
+ }
3629
+ }
3630
+ function ee(t, e, i) {
3631
+ return (e = mo(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
3632
+ }
3633
+ function mo(t) {
3634
+ var e = bo(t, "string");
3635
+ return typeof e == "symbol" ? e : e + "";
3636
+ }
3637
+ function bo(t, e) {
3638
+ if (typeof t != "object" || !t)
3639
+ return t;
3640
+ var i = t[Symbol.toPrimitive];
3641
+ if (i !== void 0) {
3642
+ var n = i.call(t, e);
3643
+ if (typeof n != "object")
3644
+ return n;
3645
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3646
+ }
3647
+ return (e === "string" ? String : Number)(t);
3648
+ }
3649
+ class ko extends Error {
3650
+ constructor(e) {
3651
+ super(e), ee(this, "name", void 0), ee(this, "message", void 0), ee(this, "errMsg", void 0), ee(this, "code", void 0), ee(this, "data", void 0), ee(this, "extra", void 0), this.name = "ResponseError", this.message = e, this.errMsg = e;
3652
+ }
3653
+ }
3654
+ export {
3655
+ Rn as GoogleAdSenseProvider,
3656
+ ho as GoogleIMAProvider,
3657
+ Oo as JoliboxAdsForGame,
3658
+ To as JoliboxAdsForVideo,
3659
+ Yr as OKSpinForGameProvider,
3660
+ po as OKSpinForVideoProvider,
3661
+ ko as ResponseError
3662
+ };