@tma.js/sdk-react 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +582 -580
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
var
|
|
4
|
-
function
|
|
1
|
+
import { jsx as mt } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Xt, useContext as te, useState as bt, useEffect as C, useMemo as vt, useRef as dt, useCallback as ee } from "react";
|
|
3
|
+
var se = Object.defineProperty, ne = (e, t, s) => t in e ? se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (ne(e, typeof t != "symbol" ? t + "" : t, s), s);
|
|
4
|
+
function yt(e, t) {
|
|
5
5
|
let s;
|
|
6
6
|
const n = () => {
|
|
7
7
|
s !== void 0 && t && t(s), s = void 0;
|
|
8
8
|
};
|
|
9
9
|
return [() => s === void 0 ? s = e(n) : s, n];
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Et(e) {
|
|
12
12
|
const t = G(), { count: s } = t;
|
|
13
|
-
t.unsubscribe(e), s && !t.count &&
|
|
13
|
+
t.unsubscribe(e), s && !t.count && Ce();
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return G().subscribe(e), () =>
|
|
15
|
+
function re(e) {
|
|
16
|
+
return G().subscribe(e), () => Et(e);
|
|
17
17
|
}
|
|
18
|
-
class
|
|
18
|
+
class ie {
|
|
19
19
|
constructor(t, s = {}) {
|
|
20
20
|
this.scope = t, this.options = s;
|
|
21
21
|
}
|
|
@@ -55,18 +55,18 @@ class ae {
|
|
|
55
55
|
this.print("log", ...t);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
const st = new
|
|
58
|
+
const st = new ie("SDK", {
|
|
59
59
|
bgColor: "forestgreen",
|
|
60
60
|
textColor: "white"
|
|
61
61
|
});
|
|
62
62
|
let X = !1;
|
|
63
|
-
const
|
|
63
|
+
const _t = ({ event: e, args: [t] }) => {
|
|
64
64
|
st.log("Event received:", t === void 0 ? { name: e } : { name: e, data: t });
|
|
65
65
|
};
|
|
66
|
-
function
|
|
67
|
-
X !== e && (X = e, e ?
|
|
66
|
+
function oe(e) {
|
|
67
|
+
X !== e && (X = e, e ? re(_t) : Et(_t));
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function ae(...e) {
|
|
70
70
|
X && st.log(...e);
|
|
71
71
|
}
|
|
72
72
|
class H {
|
|
@@ -147,12 +147,12 @@ class W extends Error {
|
|
|
147
147
|
super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, W.prototype);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function m(e, t, s) {
|
|
151
151
|
return new W(e, t, s);
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
function
|
|
155
|
-
return
|
|
153
|
+
const ce = "ERR_METHOD_UNSUPPORTED", he = "ERR_METHOD_PARAMETER_UNSUPPORTED", pe = "ERR_UNKNOWN_ENV", ue = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", le = "ERR_TIMED_OUT", de = "ERR_UNEXPECTED_TYPE", Pt = "ERR_PARSE", _e = "ERR_NAVIGATION_LIST_EMPTY", ge = "ERR_NAVIGATION_CURSOR_INVALID", _n = "ERR_NAVIGATION_ITEM_INVALID", gn = "ERR_SSR_INIT", we = "ERR_INVALID_PATH_BASE";
|
|
154
|
+
function T() {
|
|
155
|
+
return m(de, "Value has unexpected type");
|
|
156
156
|
}
|
|
157
157
|
class j {
|
|
158
158
|
constructor(t, s, n) {
|
|
@@ -169,8 +169,8 @@ class j {
|
|
|
169
169
|
try {
|
|
170
170
|
return this.parser(t);
|
|
171
171
|
} catch (s) {
|
|
172
|
-
throw
|
|
173
|
-
|
|
172
|
+
throw m(
|
|
173
|
+
Pt,
|
|
174
174
|
`Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
|
|
175
175
|
s
|
|
176
176
|
);
|
|
@@ -180,10 +180,10 @@ class j {
|
|
|
180
180
|
return this.isOptional = !0, this;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function A(e, t) {
|
|
184
184
|
return () => new j(e, !1, t);
|
|
185
185
|
}
|
|
186
|
-
const P =
|
|
186
|
+
const P = A((e) => {
|
|
187
187
|
if (typeof e == "boolean")
|
|
188
188
|
return e;
|
|
189
189
|
const t = String(e);
|
|
@@ -191,9 +191,9 @@ const P = T((e) => {
|
|
|
191
191
|
return !0;
|
|
192
192
|
if (t === "0" || t === "false")
|
|
193
193
|
return !1;
|
|
194
|
-
throw
|
|
194
|
+
throw T();
|
|
195
195
|
}, "boolean");
|
|
196
|
-
function
|
|
196
|
+
function Rt(e, t) {
|
|
197
197
|
const s = {};
|
|
198
198
|
for (const n in e) {
|
|
199
199
|
const r = e[n];
|
|
@@ -210,7 +210,7 @@ function Ct(e, t) {
|
|
|
210
210
|
const o = a(t(i));
|
|
211
211
|
o !== void 0 && (s[n] = o);
|
|
212
212
|
} catch (o) {
|
|
213
|
-
throw
|
|
213
|
+
throw m(Pt, `Unable to parse field "${n}"`, o);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
return s;
|
|
@@ -218,16 +218,16 @@ function Ct(e, t) {
|
|
|
218
218
|
function nt(e) {
|
|
219
219
|
let t = e;
|
|
220
220
|
if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
|
|
221
|
-
throw
|
|
221
|
+
throw T();
|
|
222
222
|
return t;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function g(e, t) {
|
|
225
225
|
return new j((s) => {
|
|
226
226
|
const n = nt(s);
|
|
227
|
-
return
|
|
227
|
+
return Rt(e, (r) => n[r]);
|
|
228
228
|
}, !1, t);
|
|
229
229
|
}
|
|
230
|
-
const x =
|
|
230
|
+
const x = A((e) => {
|
|
231
231
|
if (typeof e == "number")
|
|
232
232
|
return e;
|
|
233
233
|
if (typeof e == "string") {
|
|
@@ -235,19 +235,19 @@ const x = T((e) => {
|
|
|
235
235
|
if (!Number.isNaN(t))
|
|
236
236
|
return t;
|
|
237
237
|
}
|
|
238
|
-
throw
|
|
238
|
+
throw T();
|
|
239
239
|
}, "number");
|
|
240
240
|
function rt(e) {
|
|
241
241
|
return /^#[\da-f]{6}$/i.test(e);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function fe(e) {
|
|
244
244
|
return /^#[\da-f]{3}$/i.test(e);
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function xt(e) {
|
|
247
247
|
const t = e.replace(/\s/g, "").toLowerCase();
|
|
248
248
|
if (rt(t))
|
|
249
249
|
return t;
|
|
250
|
-
if (
|
|
250
|
+
if (fe(t)) {
|
|
251
251
|
let n = "#";
|
|
252
252
|
for (let r = 0; r < 3; r += 1)
|
|
253
253
|
n += t[1 + r].repeat(2);
|
|
@@ -261,30 +261,30 @@ function St(e) {
|
|
|
261
261
|
return n + (i.length === 1 ? "0" : "") + i;
|
|
262
262
|
}, "#");
|
|
263
263
|
}
|
|
264
|
-
const
|
|
264
|
+
const p = A((e) => {
|
|
265
265
|
if (typeof e == "string" || typeof e == "number")
|
|
266
266
|
return e.toString();
|
|
267
|
-
throw
|
|
268
|
-
}, "string"),
|
|
269
|
-
function
|
|
270
|
-
return
|
|
271
|
-
eventType:
|
|
267
|
+
throw T();
|
|
268
|
+
}, "string"), Ct = A((e) => xt(p().parse(e)), "rgb");
|
|
269
|
+
function me(e) {
|
|
270
|
+
return g({
|
|
271
|
+
eventType: p(),
|
|
272
272
|
eventData: (t) => t
|
|
273
273
|
}).parse(e);
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function be() {
|
|
276
276
|
["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
|
|
277
277
|
delete window[e];
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function ve(e, t) {
|
|
281
281
|
window.dispatchEvent(new MessageEvent("message", {
|
|
282
282
|
data: JSON.stringify({ eventType: e, eventData: t }),
|
|
283
283
|
// We specify window.parent to imitate the case, the parent iframe sent us this event.
|
|
284
284
|
source: window.parent
|
|
285
285
|
}));
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function ye() {
|
|
288
288
|
[
|
|
289
289
|
["TelegramGameProxy_receiveEvent"],
|
|
290
290
|
// Windows Phone.
|
|
@@ -296,60 +296,60 @@ function Pe() {
|
|
|
296
296
|
let t = window;
|
|
297
297
|
e.forEach((s, n, r) => {
|
|
298
298
|
if (n === r.length - 1) {
|
|
299
|
-
t[s] =
|
|
299
|
+
t[s] = ve;
|
|
300
300
|
return;
|
|
301
301
|
}
|
|
302
302
|
s in t || (t[s] = {}), t = t[s];
|
|
303
303
|
});
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
|
-
const
|
|
307
|
-
button_id: (e) => e == null ? void 0 :
|
|
308
|
-
}),
|
|
309
|
-
clipboard_text_received:
|
|
310
|
-
req_id:
|
|
311
|
-
data: (e) => e === null ? e :
|
|
306
|
+
const Ee = g({
|
|
307
|
+
button_id: (e) => e == null ? void 0 : p().parse(e)
|
|
308
|
+
}), Pe = {
|
|
309
|
+
clipboard_text_received: g({
|
|
310
|
+
req_id: p(),
|
|
311
|
+
data: (e) => e === null ? e : p().optional().parse(e)
|
|
312
312
|
}),
|
|
313
|
-
custom_method_invoked:
|
|
314
|
-
req_id:
|
|
313
|
+
custom_method_invoked: g({
|
|
314
|
+
req_id: p(),
|
|
315
315
|
result: (e) => e,
|
|
316
|
-
error:
|
|
316
|
+
error: p().optional()
|
|
317
317
|
}),
|
|
318
|
-
invoice_closed:
|
|
319
|
-
slug:
|
|
320
|
-
status:
|
|
318
|
+
invoice_closed: g({
|
|
319
|
+
slug: p(),
|
|
320
|
+
status: p()
|
|
321
321
|
}),
|
|
322
|
-
phone_requested:
|
|
323
|
-
status:
|
|
322
|
+
phone_requested: g({
|
|
323
|
+
status: p()
|
|
324
324
|
}),
|
|
325
325
|
popup_closed: {
|
|
326
|
-
parse: (e) =>
|
|
326
|
+
parse: (e) => Ee.parse(e ?? {})
|
|
327
327
|
},
|
|
328
|
-
qr_text_received:
|
|
329
|
-
data:
|
|
328
|
+
qr_text_received: g({
|
|
329
|
+
data: p().optional()
|
|
330
330
|
}),
|
|
331
|
-
theme_changed:
|
|
331
|
+
theme_changed: g({
|
|
332
332
|
theme_params: (e) => {
|
|
333
|
-
const t =
|
|
333
|
+
const t = Ct().optional();
|
|
334
334
|
return Object.entries(nt(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
|
|
335
335
|
}
|
|
336
336
|
}),
|
|
337
|
-
viewport_changed:
|
|
337
|
+
viewport_changed: g({
|
|
338
338
|
height: x(),
|
|
339
339
|
width: (e) => e == null ? window.innerWidth : x().parse(e),
|
|
340
340
|
is_state_stable: P(),
|
|
341
341
|
is_expanded: P()
|
|
342
342
|
}),
|
|
343
|
-
write_access_requested:
|
|
344
|
-
status:
|
|
343
|
+
write_access_requested: g({
|
|
344
|
+
status: p()
|
|
345
345
|
})
|
|
346
346
|
};
|
|
347
|
-
function
|
|
347
|
+
function Re() {
|
|
348
348
|
const e = new H();
|
|
349
|
-
|
|
349
|
+
ye();
|
|
350
350
|
let t = [
|
|
351
351
|
// Don't forget to remove created handlers.
|
|
352
|
-
|
|
352
|
+
be,
|
|
353
353
|
// Add "resize" event listener to make sure, we always have fresh viewport information.
|
|
354
354
|
// Desktop version of Telegram is sometimes not sending the viewport_changed
|
|
355
355
|
// event. For example, when the MainButton is shown. That's why we should
|
|
@@ -370,11 +370,11 @@ function Ce() {
|
|
|
370
370
|
return;
|
|
371
371
|
let n;
|
|
372
372
|
try {
|
|
373
|
-
n =
|
|
373
|
+
n = me(s.data);
|
|
374
374
|
} catch {
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
377
|
-
const { eventType: r, eventData: i } = n, a =
|
|
377
|
+
const { eventType: r, eventData: i } = n, a = Pe[r];
|
|
378
378
|
try {
|
|
379
379
|
const o = a ? a.parse(i) : i;
|
|
380
380
|
e.emit(...o ? [r, o] : [r]);
|
|
@@ -393,9 +393,9 @@ function Ce() {
|
|
|
393
393
|
t.forEach((s) => s()), t = [];
|
|
394
394
|
}];
|
|
395
395
|
}
|
|
396
|
-
const [
|
|
396
|
+
const [xe, Ce] = yt(
|
|
397
397
|
(e) => {
|
|
398
|
-
const [t, s] =
|
|
398
|
+
const [t, s] = Re(), n = t.off.bind(t);
|
|
399
399
|
return t.off = (r, i) => {
|
|
400
400
|
const { count: a } = t;
|
|
401
401
|
n(r, i), a && !t.count && e();
|
|
@@ -404,7 +404,7 @@ const [Se, Te] = Pt(
|
|
|
404
404
|
([, e]) => e()
|
|
405
405
|
);
|
|
406
406
|
function G() {
|
|
407
|
-
return
|
|
407
|
+
return xe()[0];
|
|
408
408
|
}
|
|
409
409
|
function z(e, t) {
|
|
410
410
|
G().off(e, t);
|
|
@@ -412,10 +412,10 @@ function z(e, t) {
|
|
|
412
412
|
function E(e, t, s) {
|
|
413
413
|
return G().on(e, t, s);
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function M(e) {
|
|
416
416
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function Se(e, t) {
|
|
419
419
|
const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
|
|
420
420
|
for (let i = 0; i < r; i += 1) {
|
|
421
421
|
const a = parseInt(s[i] || "0", 10), o = parseInt(n[i] || "0", 10);
|
|
@@ -425,9 +425,9 @@ function Ae(e, t) {
|
|
|
425
425
|
return 0;
|
|
426
426
|
}
|
|
427
427
|
function y(e, t) {
|
|
428
|
-
return
|
|
428
|
+
return Se(e, t) <= 0;
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function S(e, t, s) {
|
|
431
431
|
if (typeof s == "string") {
|
|
432
432
|
if (e === "web_app_open_link" && t === "try_instant_view")
|
|
433
433
|
return y("6.4", s);
|
|
@@ -478,102 +478,102 @@ function C(e, t, s) {
|
|
|
478
478
|
].includes(e);
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
function
|
|
482
|
-
return "external" in e &&
|
|
481
|
+
function Te(e) {
|
|
482
|
+
return "external" in e && M(e.external) && "notify" in e.external && typeof e.external.notify == "function";
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
return "TelegramWebviewProxy" in e &&
|
|
484
|
+
function St(e) {
|
|
485
|
+
return "TelegramWebviewProxy" in e && M(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function Tt() {
|
|
488
488
|
try {
|
|
489
489
|
return window.self !== window.top;
|
|
490
490
|
} catch {
|
|
491
491
|
return !0;
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
let
|
|
495
|
-
function
|
|
496
|
-
|
|
494
|
+
let At = "https://web.telegram.org";
|
|
495
|
+
function wn(e) {
|
|
496
|
+
At = e;
|
|
497
497
|
}
|
|
498
|
-
function
|
|
499
|
-
return
|
|
498
|
+
function Ae() {
|
|
499
|
+
return At;
|
|
500
500
|
}
|
|
501
501
|
function N(e, t, s) {
|
|
502
502
|
let n = {}, r;
|
|
503
503
|
t === void 0 && s === void 0 ? n = {} : t !== void 0 && s !== void 0 ? (n = s, r = t) : t !== void 0 && ("targetOrigin" in t ? n = t : r = t);
|
|
504
|
-
const { targetOrigin: i =
|
|
505
|
-
if (
|
|
504
|
+
const { targetOrigin: i = Ae() } = n;
|
|
505
|
+
if (ae("Posting event:", r ? { event: e, data: r } : { event: e }), Tt()) {
|
|
506
506
|
window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
|
|
507
507
|
return;
|
|
508
508
|
}
|
|
509
|
-
if (
|
|
509
|
+
if (Te(window)) {
|
|
510
510
|
window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
|
|
511
511
|
return;
|
|
512
512
|
}
|
|
513
|
-
if (
|
|
513
|
+
if (St(window)) {
|
|
514
514
|
window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
|
-
throw
|
|
518
|
-
|
|
517
|
+
throw m(
|
|
518
|
+
pe,
|
|
519
519
|
"Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside of Telegram application environment."
|
|
520
520
|
);
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function ke(e) {
|
|
523
523
|
return (t, s) => {
|
|
524
|
-
if (!
|
|
525
|
-
throw
|
|
526
|
-
if (
|
|
524
|
+
if (!S(t, e))
|
|
525
|
+
throw m(ce, `Method "${t}" is unsupported in Mini Apps version ${e}`);
|
|
526
|
+
if (M(s)) {
|
|
527
527
|
let n;
|
|
528
|
-
if (t === "web_app_open_link" && "try_instant_view" in s ? n = "try_instant_view" : t === "web_app_set_header_color" && "color" in s && (n = "color"), n && !
|
|
529
|
-
throw
|
|
530
|
-
|
|
528
|
+
if (t === "web_app_open_link" && "try_instant_view" in s ? n = "try_instant_view" : t === "web_app_set_header_color" && "color" in s && (n = "color"), n && !S(t, n, e))
|
|
529
|
+
throw m(
|
|
530
|
+
he,
|
|
531
531
|
`Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
|
|
532
532
|
);
|
|
533
533
|
}
|
|
534
534
|
return N(t, s);
|
|
535
535
|
};
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function kt(e) {
|
|
538
538
|
return ({ req_id: t }) => t === e;
|
|
539
539
|
}
|
|
540
|
-
function
|
|
541
|
-
return
|
|
540
|
+
function It(e) {
|
|
541
|
+
return m(le, `Timeout reached: ${e}ms`);
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function Ot(e, t) {
|
|
544
544
|
return Promise.race([
|
|
545
545
|
typeof e == "function" ? e() : e,
|
|
546
546
|
new Promise((s, n) => {
|
|
547
547
|
setTimeout(() => {
|
|
548
|
-
n(
|
|
548
|
+
n(It(t));
|
|
549
549
|
}, t);
|
|
550
550
|
})
|
|
551
551
|
]);
|
|
552
552
|
}
|
|
553
|
-
async function
|
|
553
|
+
async function w(e) {
|
|
554
554
|
let t;
|
|
555
|
-
const s = new Promise((
|
|
556
|
-
t =
|
|
555
|
+
const s = new Promise((h) => {
|
|
556
|
+
t = h;
|
|
557
557
|
}), {
|
|
558
558
|
method: n,
|
|
559
559
|
event: r,
|
|
560
560
|
capture: i,
|
|
561
561
|
postEvent: a = N,
|
|
562
562
|
timeout: o
|
|
563
|
-
} = e,
|
|
564
|
-
(
|
|
563
|
+
} = e, u = (Array.isArray(r) ? r : [r]).map(
|
|
564
|
+
(h) => E(h, (v) => (!i || i(v)) && t(v))
|
|
565
565
|
);
|
|
566
566
|
try {
|
|
567
|
-
return a(n, e.params), await (o ?
|
|
567
|
+
return a(n, e.params), await (o ? Ot(s, o) : s);
|
|
568
568
|
} finally {
|
|
569
|
-
|
|
569
|
+
u.forEach((h) => h());
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
async function q(e, t, s, n = {}) {
|
|
573
573
|
const {
|
|
574
574
|
result: r,
|
|
575
575
|
error: i
|
|
576
|
-
} = await
|
|
576
|
+
} = await w({
|
|
577
577
|
...n,
|
|
578
578
|
method: "web_app_invoke_custom_method",
|
|
579
579
|
event: "custom_method_invoked",
|
|
@@ -582,30 +582,30 @@ async function q(e, t, s, n = {}) {
|
|
|
582
582
|
params: t,
|
|
583
583
|
req_id: s
|
|
584
584
|
},
|
|
585
|
-
capture:
|
|
585
|
+
capture: kt(s)
|
|
586
586
|
});
|
|
587
587
|
if (i)
|
|
588
|
-
throw
|
|
588
|
+
throw m(ue, i);
|
|
589
589
|
return r;
|
|
590
590
|
}
|
|
591
591
|
function et(...e) {
|
|
592
592
|
return e.map((t) => {
|
|
593
593
|
if (typeof t == "string")
|
|
594
594
|
return t;
|
|
595
|
-
if (
|
|
595
|
+
if (M(t))
|
|
596
596
|
return et(Object.entries(t).map((s) => s[1] && s[0]));
|
|
597
597
|
if (Array.isArray(t))
|
|
598
598
|
return et(...t);
|
|
599
599
|
}).filter(Boolean).join(" ");
|
|
600
600
|
}
|
|
601
|
-
function
|
|
602
|
-
return e.reduce((t, s) => (
|
|
601
|
+
function fn(...e) {
|
|
602
|
+
return e.reduce((t, s) => (M(s) && Object.entries(s).forEach(([n, r]) => {
|
|
603
603
|
const i = et(t[n], r);
|
|
604
604
|
i.length && (t[n] = i);
|
|
605
605
|
}), t), {});
|
|
606
606
|
}
|
|
607
|
-
function
|
|
608
|
-
const t =
|
|
607
|
+
function qt(e) {
|
|
608
|
+
const t = xt(e);
|
|
609
609
|
return Math.sqrt(
|
|
610
610
|
[0.299, 0.587, 0.114].reduce((s, n, r) => {
|
|
611
611
|
const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
|
|
@@ -613,7 +613,7 @@ function Nt(e) {
|
|
|
613
613
|
}, 0)
|
|
614
614
|
) < 120;
|
|
615
615
|
}
|
|
616
|
-
class
|
|
616
|
+
class Ie {
|
|
617
617
|
constructor(t) {
|
|
618
618
|
c(this, "ee", new H()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
|
|
619
619
|
}
|
|
@@ -636,18 +636,18 @@ class qe {
|
|
|
636
636
|
}
|
|
637
637
|
class it {
|
|
638
638
|
constructor(t) {
|
|
639
|
-
c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new
|
|
639
|
+
c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new Ie(t), this.set = this.state.set.bind(this.state), this.get = this.state.get.bind(this.state), this.clone = this.state.clone.bind(this.state);
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
-
function
|
|
643
|
-
return (s) =>
|
|
642
|
+
function Dt(e, t) {
|
|
643
|
+
return (s) => S(t[s], e);
|
|
644
644
|
}
|
|
645
645
|
class ot extends it {
|
|
646
646
|
constructor(t, s, n) {
|
|
647
|
-
super(t), c(this, "supports"), this.supports =
|
|
647
|
+
super(t), c(this, "supports"), this.supports = Dt(s, n);
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
|
-
class
|
|
650
|
+
class Oe extends ot {
|
|
651
651
|
constructor(t, s, n) {
|
|
652
652
|
super({ isVisible: t }, s, {
|
|
653
653
|
show: "web_app_setup_back_button",
|
|
@@ -676,28 +676,28 @@ class De extends ot {
|
|
|
676
676
|
this.isVisible = !0;
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
|
-
const
|
|
679
|
+
const Nt = A((e) => e instanceof Date ? e : new Date(x().parse(e) * 1e3), "Date");
|
|
680
680
|
function at(e, t) {
|
|
681
681
|
return new j((s) => {
|
|
682
682
|
if (typeof s != "string" && !(s instanceof URLSearchParams))
|
|
683
|
-
throw
|
|
683
|
+
throw T();
|
|
684
684
|
const n = typeof s == "string" ? new URLSearchParams(s) : s;
|
|
685
|
-
return
|
|
685
|
+
return Rt(e, (r) => {
|
|
686
686
|
const i = n.get(r);
|
|
687
687
|
return i === null ? void 0 : i;
|
|
688
688
|
});
|
|
689
689
|
}, !1, t);
|
|
690
690
|
}
|
|
691
|
-
const
|
|
691
|
+
const qe = g({
|
|
692
692
|
id: x(),
|
|
693
|
-
type:
|
|
694
|
-
title:
|
|
693
|
+
type: p(),
|
|
694
|
+
title: p(),
|
|
695
695
|
photoUrl: {
|
|
696
|
-
type:
|
|
696
|
+
type: p().optional(),
|
|
697
697
|
from: "photo_url"
|
|
698
698
|
},
|
|
699
|
-
username:
|
|
700
|
-
}, "Chat").optional(),
|
|
699
|
+
username: p().optional()
|
|
700
|
+
}, "Chat").optional(), gt = g({
|
|
701
701
|
addedToAttachmentMenu: {
|
|
702
702
|
type: P().optional(),
|
|
703
703
|
from: "added_to_attachment_menu"
|
|
@@ -707,7 +707,7 @@ const Ne = w({
|
|
|
707
707
|
from: "allows_write_to_pm"
|
|
708
708
|
},
|
|
709
709
|
firstName: {
|
|
710
|
-
type:
|
|
710
|
+
type: p(),
|
|
711
711
|
from: "first_name"
|
|
712
712
|
},
|
|
713
713
|
id: x(),
|
|
@@ -720,80 +720,80 @@ const Ne = w({
|
|
|
720
720
|
from: "is_premium"
|
|
721
721
|
},
|
|
722
722
|
languageCode: {
|
|
723
|
-
type:
|
|
723
|
+
type: p().optional(),
|
|
724
724
|
from: "language_code"
|
|
725
725
|
},
|
|
726
726
|
lastName: {
|
|
727
|
-
type:
|
|
727
|
+
type: p().optional(),
|
|
728
728
|
from: "last_name"
|
|
729
729
|
},
|
|
730
730
|
photoUrl: {
|
|
731
|
-
type:
|
|
731
|
+
type: p().optional(),
|
|
732
732
|
from: "photo_url"
|
|
733
733
|
},
|
|
734
|
-
username:
|
|
734
|
+
username: p().optional()
|
|
735
735
|
}, "User").optional();
|
|
736
|
-
function
|
|
736
|
+
function Bt() {
|
|
737
737
|
return at({
|
|
738
738
|
authDate: {
|
|
739
|
-
type:
|
|
739
|
+
type: Nt(),
|
|
740
740
|
from: "auth_date"
|
|
741
741
|
},
|
|
742
742
|
canSendAfter: {
|
|
743
743
|
type: x().optional(),
|
|
744
744
|
from: "can_send_after"
|
|
745
745
|
},
|
|
746
|
-
chat:
|
|
746
|
+
chat: qe,
|
|
747
747
|
chatInstance: {
|
|
748
|
-
type:
|
|
748
|
+
type: p().optional(),
|
|
749
749
|
from: "chat_instance"
|
|
750
750
|
},
|
|
751
751
|
chatType: {
|
|
752
|
-
type:
|
|
752
|
+
type: p().optional(),
|
|
753
753
|
from: "chat_type"
|
|
754
754
|
},
|
|
755
|
-
hash:
|
|
755
|
+
hash: p(),
|
|
756
756
|
queryId: {
|
|
757
|
-
type:
|
|
757
|
+
type: p().optional(),
|
|
758
758
|
from: "query_id"
|
|
759
759
|
},
|
|
760
|
-
receiver:
|
|
760
|
+
receiver: gt,
|
|
761
761
|
startParam: {
|
|
762
|
-
type:
|
|
762
|
+
type: p().optional(),
|
|
763
763
|
from: "start_param"
|
|
764
764
|
},
|
|
765
|
-
user:
|
|
765
|
+
user: gt
|
|
766
766
|
}, "InitData");
|
|
767
767
|
}
|
|
768
|
-
function
|
|
768
|
+
function De(e) {
|
|
769
769
|
return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function Ne(e) {
|
|
772
772
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
773
773
|
}
|
|
774
|
-
const
|
|
774
|
+
const Mt = A(
|
|
775
775
|
(e) => {
|
|
776
|
-
const t =
|
|
777
|
-
return Object.entries(nt(e)).reduce((s, [n, r]) => (s[
|
|
776
|
+
const t = Ct().optional();
|
|
777
|
+
return Object.entries(nt(e)).reduce((s, [n, r]) => (s[De(n)] = t.parse(r), s), {});
|
|
778
778
|
},
|
|
779
779
|
"ThemeParams"
|
|
780
780
|
);
|
|
781
|
-
function
|
|
781
|
+
function Vt(e) {
|
|
782
782
|
return at({
|
|
783
783
|
botInline: {
|
|
784
784
|
type: P().optional(),
|
|
785
785
|
from: "tgWebAppBotInline"
|
|
786
786
|
},
|
|
787
787
|
initData: {
|
|
788
|
-
type:
|
|
788
|
+
type: Bt().optional(),
|
|
789
789
|
from: "tgWebAppData"
|
|
790
790
|
},
|
|
791
791
|
initDataRaw: {
|
|
792
|
-
type:
|
|
792
|
+
type: p().optional(),
|
|
793
793
|
from: "tgWebAppData"
|
|
794
794
|
},
|
|
795
795
|
platform: {
|
|
796
|
-
type:
|
|
796
|
+
type: p(),
|
|
797
797
|
from: "tgWebAppPlatform"
|
|
798
798
|
},
|
|
799
799
|
showSettings: {
|
|
@@ -801,60 +801,60 @@ function Lt(e) {
|
|
|
801
801
|
from: "tgWebAppShowSettings"
|
|
802
802
|
},
|
|
803
803
|
startParam: {
|
|
804
|
-
type:
|
|
804
|
+
type: p().optional(),
|
|
805
805
|
from: "tgWebAppStartParam"
|
|
806
806
|
},
|
|
807
807
|
themeParams: {
|
|
808
|
-
type:
|
|
808
|
+
type: Mt(),
|
|
809
809
|
from: "tgWebAppThemeParams"
|
|
810
810
|
},
|
|
811
811
|
version: {
|
|
812
|
-
type:
|
|
812
|
+
type: p(),
|
|
813
813
|
from: "tgWebAppVersion"
|
|
814
814
|
}
|
|
815
815
|
}).parse(e);
|
|
816
816
|
}
|
|
817
|
-
function
|
|
818
|
-
return
|
|
817
|
+
function $t(e) {
|
|
818
|
+
return Vt(
|
|
819
819
|
e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
|
|
820
820
|
);
|
|
821
821
|
}
|
|
822
|
-
function
|
|
823
|
-
return
|
|
822
|
+
function Be() {
|
|
823
|
+
return $t(window.location.href);
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function Lt() {
|
|
826
826
|
return performance.getEntriesByType("navigation")[0];
|
|
827
827
|
}
|
|
828
|
-
function
|
|
829
|
-
const e =
|
|
828
|
+
function Me() {
|
|
829
|
+
const e = Lt();
|
|
830
830
|
if (!e)
|
|
831
831
|
throw new Error("Unable to get first navigation entry.");
|
|
832
|
-
return
|
|
832
|
+
return $t(e.name);
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function Ut(e) {
|
|
835
835
|
return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
|
|
836
836
|
}
|
|
837
|
-
function
|
|
838
|
-
sessionStorage.setItem(
|
|
837
|
+
function Ht(e, t) {
|
|
838
|
+
sessionStorage.setItem(Ut(e), JSON.stringify(t));
|
|
839
839
|
}
|
|
840
|
-
function
|
|
841
|
-
const t = sessionStorage.getItem(
|
|
840
|
+
function Wt(e) {
|
|
841
|
+
const t = sessionStorage.getItem(Ut(e));
|
|
842
842
|
try {
|
|
843
843
|
return t ? JSON.parse(t) : void 0;
|
|
844
844
|
} catch {
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
|
-
function
|
|
848
|
-
return
|
|
847
|
+
function Ve() {
|
|
848
|
+
return Vt(Wt("launchParams") || "");
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function $e(e) {
|
|
851
851
|
return JSON.stringify(
|
|
852
852
|
Object.fromEntries(
|
|
853
|
-
Object.entries(e).map(([t, s]) => [
|
|
853
|
+
Object.entries(e).map(([t, s]) => [Ne(t), s])
|
|
854
854
|
)
|
|
855
855
|
);
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function Le(e) {
|
|
858
858
|
const {
|
|
859
859
|
initDataRaw: t,
|
|
860
860
|
themeParams: s,
|
|
@@ -863,38 +863,38 @@ function He(e) {
|
|
|
863
863
|
showSettings: i,
|
|
864
864
|
startParam: a,
|
|
865
865
|
botInline: o
|
|
866
|
-
} = e,
|
|
867
|
-
return
|
|
866
|
+
} = e, u = new URLSearchParams();
|
|
867
|
+
return u.set("tgWebAppPlatform", n), u.set("tgWebAppThemeParams", $e(s)), u.set("tgWebAppVersion", r), t && u.set("tgWebAppData", t), a && u.set("tgWebAppStartParam", a), typeof i == "boolean" && u.set("tgWebAppShowSettings", i ? "1" : "0"), typeof o == "boolean" && u.set("tgWebAppBotInline", o ? "1" : "0"), u.toString();
|
|
868
868
|
}
|
|
869
|
-
function
|
|
870
|
-
|
|
869
|
+
function Ue(e) {
|
|
870
|
+
Ht("launchParams", Le(e));
|
|
871
871
|
}
|
|
872
|
-
function
|
|
872
|
+
function jt() {
|
|
873
873
|
for (const e of [
|
|
874
874
|
// Try to retrieve launch parameters from the current location. This method can return
|
|
875
875
|
// nothing in case, location was changed and then page was reloaded.
|
|
876
|
-
|
|
876
|
+
Be,
|
|
877
877
|
// Then, try using the lower level API - window.performance.
|
|
878
|
-
|
|
878
|
+
Me,
|
|
879
879
|
// Finally, try to extract launch parameters from the session storage.
|
|
880
|
-
|
|
880
|
+
Ve
|
|
881
881
|
])
|
|
882
882
|
try {
|
|
883
883
|
const t = e();
|
|
884
|
-
return
|
|
884
|
+
return Ue(t), t;
|
|
885
885
|
} catch {
|
|
886
886
|
}
|
|
887
887
|
throw new Error("Unable to retrieve launch parameters from any known source.");
|
|
888
888
|
}
|
|
889
|
-
function
|
|
890
|
-
const e =
|
|
889
|
+
function Gt() {
|
|
890
|
+
const e = Lt();
|
|
891
891
|
return !!(e && e.type === "reload");
|
|
892
892
|
}
|
|
893
|
-
function
|
|
893
|
+
function He() {
|
|
894
894
|
let e = 0;
|
|
895
895
|
return () => (e += 1).toString();
|
|
896
896
|
}
|
|
897
|
-
function
|
|
897
|
+
function We() {
|
|
898
898
|
let e = !1;
|
|
899
899
|
const t = [];
|
|
900
900
|
return [
|
|
@@ -905,45 +905,45 @@ function Ge() {
|
|
|
905
905
|
e
|
|
906
906
|
];
|
|
907
907
|
}
|
|
908
|
-
const [
|
|
909
|
-
function
|
|
908
|
+
const [je] = yt(He);
|
|
909
|
+
function l(e, t) {
|
|
910
910
|
return () => {
|
|
911
|
-
const s =
|
|
911
|
+
const s = jt(), n = {
|
|
912
912
|
...s,
|
|
913
|
-
postEvent:
|
|
914
|
-
createRequestId:
|
|
913
|
+
postEvent: ke(s.version),
|
|
914
|
+
createRequestId: je()
|
|
915
915
|
};
|
|
916
916
|
if (typeof e == "function")
|
|
917
917
|
return e(n);
|
|
918
|
-
const [r, i, a] =
|
|
918
|
+
const [r, i, a] = We(), o = t({
|
|
919
919
|
...n,
|
|
920
920
|
// State should only be passed only in case, current page was reloaded. If we don't add
|
|
921
921
|
// this check, state restoration will work improperly in the web version of Telegram,
|
|
922
922
|
// when we are always working in the same "session" (tab).
|
|
923
|
-
state:
|
|
923
|
+
state: Gt() ? Wt(e) : void 0,
|
|
924
924
|
addCleanup: r
|
|
925
|
-
}),
|
|
926
|
-
|
|
927
|
-
|
|
925
|
+
}), u = (h) => (a || r(
|
|
926
|
+
h.on("change", (v) => {
|
|
927
|
+
Ht(e, v);
|
|
928
928
|
})
|
|
929
|
-
),
|
|
929
|
+
), h);
|
|
930
930
|
return [
|
|
931
|
-
o instanceof Promise ? o.then(
|
|
931
|
+
o instanceof Promise ? o.then(u) : u(o),
|
|
932
932
|
i
|
|
933
933
|
];
|
|
934
934
|
};
|
|
935
935
|
}
|
|
936
|
-
const
|
|
936
|
+
const Ge = l("backButton", ({
|
|
937
937
|
postEvent: e,
|
|
938
938
|
version: t,
|
|
939
939
|
state: s = { isVisible: !1 }
|
|
940
|
-
}) => new
|
|
941
|
-
class
|
|
940
|
+
}) => new Oe(s.isVisible, t, e));
|
|
941
|
+
class V extends ot {
|
|
942
942
|
constructor() {
|
|
943
943
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function zt(e) {
|
|
947
947
|
const t = e.available ? e : {
|
|
948
948
|
available: !1,
|
|
949
949
|
device_id: "",
|
|
@@ -961,7 +961,7 @@ function Jt(e) {
|
|
|
961
961
|
accessGranted: t.access_granted
|
|
962
962
|
};
|
|
963
963
|
}
|
|
964
|
-
class
|
|
964
|
+
class ze extends V {
|
|
965
965
|
constructor({ postEvent: t, version: s, ...n }) {
|
|
966
966
|
super(n, s, {
|
|
967
967
|
auth: "web_app_biometry_request_auth",
|
|
@@ -998,7 +998,7 @@ class Je extends M {
|
|
|
998
998
|
reason: t,
|
|
999
999
|
...s
|
|
1000
1000
|
}) {
|
|
1001
|
-
return this.authPromise || (this.authPromise =
|
|
1001
|
+
return this.authPromise || (this.authPromise = w({
|
|
1002
1002
|
...s,
|
|
1003
1003
|
method: "web_app_biometry_request_auth",
|
|
1004
1004
|
event: "biometry_auth_requested",
|
|
@@ -1032,14 +1032,14 @@ class Je extends M {
|
|
|
1032
1032
|
* @returns Promise with true, if access was granted.
|
|
1033
1033
|
*/
|
|
1034
1034
|
requestAccess({ reason: t, ...s } = {}) {
|
|
1035
|
-
return this.accessPromise || (this.accessPromise =
|
|
1035
|
+
return this.accessPromise || (this.accessPromise = w({
|
|
1036
1036
|
...s,
|
|
1037
1037
|
postEvent: this.postEvent,
|
|
1038
1038
|
method: "web_app_biometry_request_access",
|
|
1039
1039
|
event: "biometry_info_received",
|
|
1040
1040
|
params: { reason: t || "" }
|
|
1041
1041
|
}).then((n) => {
|
|
1042
|
-
const r =
|
|
1042
|
+
const r = zt(n);
|
|
1043
1043
|
return this.set(r), r.accessGranted;
|
|
1044
1044
|
}).finally(() => this.accessPromise = void 0)), this.accessPromise;
|
|
1045
1045
|
}
|
|
@@ -1061,7 +1061,7 @@ class Je extends M {
|
|
|
1061
1061
|
*/
|
|
1062
1062
|
async updateToken({ token: t, ...s } = {}) {
|
|
1063
1063
|
return ["removed", "updated"].includes(
|
|
1064
|
-
(await
|
|
1064
|
+
(await w({
|
|
1065
1065
|
...s,
|
|
1066
1066
|
postEvent: this.postEvent,
|
|
1067
1067
|
method: "web_app_biometry_update_token",
|
|
@@ -1071,19 +1071,19 @@ class Je extends M {
|
|
|
1071
1071
|
);
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
|
-
async function
|
|
1075
|
-
return
|
|
1076
|
-
await
|
|
1074
|
+
async function Ke(e) {
|
|
1075
|
+
return zt(
|
|
1076
|
+
await w({
|
|
1077
1077
|
...e || {},
|
|
1078
1078
|
method: "web_app_biometry_get_info",
|
|
1079
1079
|
event: "biometry_info_received"
|
|
1080
1080
|
})
|
|
1081
1081
|
);
|
|
1082
1082
|
}
|
|
1083
|
-
const
|
|
1083
|
+
const Je = l(
|
|
1084
1084
|
"biometryManager",
|
|
1085
|
-
async ({ postEvent: e, version: t, state: s }) => new
|
|
1086
|
-
...s || await
|
|
1085
|
+
async ({ postEvent: e, version: t, state: s }) => new ze({
|
|
1086
|
+
...s || await Ke({ timeout: 1e3 }),
|
|
1087
1087
|
version: t,
|
|
1088
1088
|
postEvent: e
|
|
1089
1089
|
})
|
|
@@ -1093,7 +1093,7 @@ class ct extends it {
|
|
|
1093
1093
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
|
-
class
|
|
1096
|
+
class Qe extends ct {
|
|
1097
1097
|
constructor(t, s) {
|
|
1098
1098
|
super({ isConfirmationNeeded: t }), this.postEvent = s;
|
|
1099
1099
|
}
|
|
@@ -1120,19 +1120,19 @@ class Ye extends ct {
|
|
|
1120
1120
|
this.isConfirmationNeeded = !0;
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
|
-
const
|
|
1123
|
+
const Fe = l(
|
|
1124
1124
|
"closingBehavior",
|
|
1125
1125
|
({
|
|
1126
1126
|
postEvent: e,
|
|
1127
1127
|
state: t = { isConfirmationNeeded: !1 }
|
|
1128
|
-
}) => new
|
|
1128
|
+
}) => new Qe(t.isConfirmationNeeded, e)
|
|
1129
1129
|
);
|
|
1130
1130
|
class ht {
|
|
1131
1131
|
constructor(t, s) {
|
|
1132
|
-
c(this, "supports"), this.supports =
|
|
1132
|
+
c(this, "supports"), this.supports = Dt(t, s);
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1135
|
+
function Ye(e) {
|
|
1136
1136
|
if (Array.isArray(e))
|
|
1137
1137
|
return e;
|
|
1138
1138
|
if (typeof e == "string")
|
|
@@ -1142,11 +1142,11 @@ function Xe(e) {
|
|
|
1142
1142
|
return t;
|
|
1143
1143
|
} catch {
|
|
1144
1144
|
}
|
|
1145
|
-
throw
|
|
1145
|
+
throw T();
|
|
1146
1146
|
}
|
|
1147
|
-
class
|
|
1147
|
+
class Ze extends j {
|
|
1148
1148
|
constructor(t, s, n) {
|
|
1149
|
-
super(
|
|
1149
|
+
super(Ye, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
|
|
1150
1150
|
}
|
|
1151
1151
|
/**
|
|
1152
1152
|
* Attempts to parse passed value
|
|
@@ -1162,13 +1162,13 @@ class ts extends j {
|
|
|
1162
1162
|
return this.itemParser = typeof t == "function" ? t : t.parse.bind(t), this;
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
|
-
function
|
|
1166
|
-
return new
|
|
1165
|
+
function Xe(e) {
|
|
1166
|
+
return new Ze((t) => t, !1, e);
|
|
1167
1167
|
}
|
|
1168
|
-
function
|
|
1168
|
+
function wt(e, t) {
|
|
1169
1169
|
return Object.fromEntries(e.map((s) => [s, t]));
|
|
1170
1170
|
}
|
|
1171
|
-
class
|
|
1171
|
+
class ts extends ht {
|
|
1172
1172
|
constructor(t, s, n) {
|
|
1173
1173
|
super(t, {
|
|
1174
1174
|
delete: "web_app_invoke_custom_method",
|
|
@@ -1196,7 +1196,7 @@ class ss extends ht {
|
|
|
1196
1196
|
* @param options - request execution options.
|
|
1197
1197
|
*/
|
|
1198
1198
|
async getKeys(t = {}) {
|
|
1199
|
-
return
|
|
1199
|
+
return Xe().of(p()).parse(
|
|
1200
1200
|
await q(
|
|
1201
1201
|
"getStorageKeys",
|
|
1202
1202
|
{},
|
|
@@ -1208,13 +1208,13 @@ class ss extends ht {
|
|
|
1208
1208
|
async get(t, s = {}) {
|
|
1209
1209
|
const n = Array.isArray(t) ? t : [t];
|
|
1210
1210
|
if (!n.length)
|
|
1211
|
-
return
|
|
1211
|
+
return wt(n, "");
|
|
1212
1212
|
const r = await q(
|
|
1213
1213
|
"getStorageValues",
|
|
1214
1214
|
{ keys: n },
|
|
1215
1215
|
this.createRequestId(),
|
|
1216
1216
|
{ ...s, postEvent: this.postEvent }
|
|
1217
|
-
), i =
|
|
1217
|
+
), i = g(wt(n, p()), "CloudStorageData").parse(r);
|
|
1218
1218
|
return Array.isArray(t) ? i : i[t];
|
|
1219
1219
|
}
|
|
1220
1220
|
/**
|
|
@@ -1232,10 +1232,10 @@ class ss extends ht {
|
|
|
1232
1232
|
);
|
|
1233
1233
|
}
|
|
1234
1234
|
}
|
|
1235
|
-
const
|
|
1236
|
-
({ createRequestId: e, postEvent: t, version: s }) => new
|
|
1235
|
+
const es = l(
|
|
1236
|
+
({ createRequestId: e, postEvent: t, version: s }) => new ts(s, e, t)
|
|
1237
1237
|
);
|
|
1238
|
-
class
|
|
1238
|
+
class ss extends ht {
|
|
1239
1239
|
constructor(t, s) {
|
|
1240
1240
|
super(t, {
|
|
1241
1241
|
impactOccurred: "web_app_trigger_haptic_feedback",
|
|
@@ -1277,10 +1277,10 @@ class rs extends ht {
|
|
|
1277
1277
|
this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
|
-
const
|
|
1281
|
-
({ version: e, postEvent: t }) => new
|
|
1280
|
+
const ns = l(
|
|
1281
|
+
({ version: e, postEvent: t }) => new ss(e, t)
|
|
1282
1282
|
);
|
|
1283
|
-
class
|
|
1283
|
+
class rs {
|
|
1284
1284
|
constructor(t) {
|
|
1285
1285
|
this.initData = t;
|
|
1286
1286
|
}
|
|
@@ -1353,13 +1353,13 @@ class os {
|
|
|
1353
1353
|
return this.initData.user;
|
|
1354
1354
|
}
|
|
1355
1355
|
}
|
|
1356
|
-
const
|
|
1357
|
-
({ initData: e }) => e ? new
|
|
1356
|
+
const is = l(
|
|
1357
|
+
({ initData: e }) => e ? new rs(e) : void 0
|
|
1358
1358
|
);
|
|
1359
|
-
function
|
|
1360
|
-
return
|
|
1359
|
+
function mn(e) {
|
|
1360
|
+
return Bt().parse(e);
|
|
1361
1361
|
}
|
|
1362
|
-
class
|
|
1362
|
+
class os extends V {
|
|
1363
1363
|
constructor(t, s, n) {
|
|
1364
1364
|
super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
|
|
1365
1365
|
}
|
|
@@ -1389,7 +1389,7 @@ class cs extends M {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
this.isOpened = !0;
|
|
1391
1391
|
try {
|
|
1392
|
-
return (await
|
|
1392
|
+
return (await w({
|
|
1393
1393
|
method: "web_app_open_invoice",
|
|
1394
1394
|
event: "invoice_closed",
|
|
1395
1395
|
params: { slug: n },
|
|
@@ -1403,10 +1403,10 @@ class cs extends M {
|
|
|
1403
1403
|
}
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
|
-
const
|
|
1407
|
-
({ version: e, postEvent: t }) => new
|
|
1406
|
+
const as = l(
|
|
1407
|
+
({ version: e, postEvent: t }) => new os(!1, e, t)
|
|
1408
1408
|
);
|
|
1409
|
-
class
|
|
1409
|
+
class cs extends it {
|
|
1410
1410
|
constructor({ postEvent: t, ...s }) {
|
|
1411
1411
|
super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? E("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? z("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
|
|
1412
1412
|
}
|
|
@@ -1537,7 +1537,7 @@ class ps extends it {
|
|
|
1537
1537
|
return this.set(t), this.commit(), this;
|
|
1538
1538
|
}
|
|
1539
1539
|
}
|
|
1540
|
-
const
|
|
1540
|
+
const hs = l(
|
|
1541
1541
|
"mainButton",
|
|
1542
1542
|
({
|
|
1543
1543
|
postEvent: e,
|
|
@@ -1550,47 +1550,47 @@ const us = d(
|
|
|
1550
1550
|
textColor: t.buttonTextColor || "#ffffff",
|
|
1551
1551
|
backgroundColor: t.buttonColor || "#000000"
|
|
1552
1552
|
}
|
|
1553
|
-
}) => new
|
|
1553
|
+
}) => new cs({ ...s, postEvent: e })
|
|
1554
1554
|
);
|
|
1555
|
-
function
|
|
1555
|
+
function ps() {
|
|
1556
1556
|
return at({
|
|
1557
|
-
contact:
|
|
1557
|
+
contact: g({
|
|
1558
1558
|
userId: {
|
|
1559
1559
|
type: x(),
|
|
1560
1560
|
from: "user_id"
|
|
1561
1561
|
},
|
|
1562
1562
|
phoneNumber: {
|
|
1563
|
-
type:
|
|
1563
|
+
type: p(),
|
|
1564
1564
|
from: "phone_number"
|
|
1565
1565
|
},
|
|
1566
1566
|
firstName: {
|
|
1567
|
-
type:
|
|
1567
|
+
type: p(),
|
|
1568
1568
|
from: "first_name"
|
|
1569
1569
|
},
|
|
1570
1570
|
lastName: {
|
|
1571
|
-
type:
|
|
1571
|
+
type: p().optional(),
|
|
1572
1572
|
from: "last_name"
|
|
1573
1573
|
}
|
|
1574
1574
|
}),
|
|
1575
1575
|
authDate: {
|
|
1576
|
-
type:
|
|
1576
|
+
type: Nt(),
|
|
1577
1577
|
from: "auth_date"
|
|
1578
1578
|
},
|
|
1579
|
-
hash:
|
|
1579
|
+
hash: p()
|
|
1580
1580
|
}, "RequestedContact");
|
|
1581
1581
|
}
|
|
1582
|
-
function
|
|
1582
|
+
function Kt(e, t) {
|
|
1583
1583
|
return (s) => {
|
|
1584
1584
|
const [n, r] = t[s];
|
|
1585
|
-
return
|
|
1585
|
+
return S(n, r, e);
|
|
1586
1586
|
};
|
|
1587
1587
|
}
|
|
1588
|
-
function
|
|
1588
|
+
function us(e) {
|
|
1589
1589
|
return new Promise((t) => {
|
|
1590
1590
|
setTimeout(t, e);
|
|
1591
1591
|
});
|
|
1592
1592
|
}
|
|
1593
|
-
class
|
|
1593
|
+
class ls extends V {
|
|
1594
1594
|
constructor({ postEvent: t, createRequestId: s, version: n, botInline: r, ...i }) {
|
|
1595
1595
|
super(i, n, {
|
|
1596
1596
|
requestPhoneAccess: "web_app_request_phone",
|
|
@@ -1600,7 +1600,7 @@ class _s extends M {
|
|
|
1600
1600
|
setBackgroundColor: "web_app_set_background_color"
|
|
1601
1601
|
}), c(this, "botInline"), c(this, "postEvent"), c(this, "createRequestId"), c(this, "requestPhoneAccessPromise"), c(this, "requestWriteAccessPromise"), c(this, "supportsParam"), this.createRequestId = s, this.postEvent = t, this.botInline = r;
|
|
1602
1602
|
const a = this.supports.bind(this);
|
|
1603
|
-
this.supports = (o) => a(o) ? o !== "switchInlineQuery" || r : !1, this.supportsParam =
|
|
1603
|
+
this.supports = (o) => a(o) ? o !== "switchInlineQuery" || r : !1, this.supportsParam = Kt(n, {
|
|
1604
1604
|
"setHeaderColor.color": ["web_app_set_header_color", "color"]
|
|
1605
1605
|
});
|
|
1606
1606
|
}
|
|
@@ -1611,7 +1611,7 @@ class _s extends M {
|
|
|
1611
1611
|
async getRequestedContact({
|
|
1612
1612
|
timeout: t = 1e4
|
|
1613
1613
|
} = {}) {
|
|
1614
|
-
return
|
|
1614
|
+
return ps().parse(
|
|
1615
1615
|
await q(
|
|
1616
1616
|
"getRequestedContact",
|
|
1617
1617
|
{},
|
|
@@ -1651,7 +1651,7 @@ class _s extends M {
|
|
|
1651
1651
|
* True if current Mini App background color is recognized as dark.
|
|
1652
1652
|
*/
|
|
1653
1653
|
get isDark() {
|
|
1654
|
-
return
|
|
1654
|
+
return qt(this.bgColor);
|
|
1655
1655
|
}
|
|
1656
1656
|
/**
|
|
1657
1657
|
* Informs the Telegram app that the Mini App is ready to be displayed.
|
|
@@ -1680,15 +1680,15 @@ class _s extends M {
|
|
|
1680
1680
|
throw new Error("Access denied.");
|
|
1681
1681
|
const s = Date.now() + t;
|
|
1682
1682
|
let n = 50;
|
|
1683
|
-
return
|
|
1683
|
+
return Ot(async () => {
|
|
1684
1684
|
for (; Date.now() < s; ) {
|
|
1685
1685
|
try {
|
|
1686
1686
|
return await this.getRequestedContact();
|
|
1687
1687
|
} catch {
|
|
1688
1688
|
}
|
|
1689
|
-
await
|
|
1689
|
+
await us(n), n += 50;
|
|
1690
1690
|
}
|
|
1691
|
-
throw
|
|
1691
|
+
throw It(t);
|
|
1692
1692
|
}, t);
|
|
1693
1693
|
}
|
|
1694
1694
|
/**
|
|
@@ -1701,7 +1701,7 @@ class _s extends M {
|
|
|
1701
1701
|
* @see requestContact
|
|
1702
1702
|
*/
|
|
1703
1703
|
async requestPhoneAccess(t = {}) {
|
|
1704
|
-
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise =
|
|
1704
|
+
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = w({
|
|
1705
1705
|
...t,
|
|
1706
1706
|
method: "web_app_request_phone",
|
|
1707
1707
|
event: "phone_requested",
|
|
@@ -1713,7 +1713,7 @@ class _s extends M {
|
|
|
1713
1713
|
* @param options - additional options.
|
|
1714
1714
|
*/
|
|
1715
1715
|
async requestWriteAccess(t = {}) {
|
|
1716
|
-
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise =
|
|
1716
|
+
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = w({
|
|
1717
1717
|
...t,
|
|
1718
1718
|
method: "web_app_request_write_access",
|
|
1719
1719
|
event: "write_access_requested",
|
|
@@ -1771,7 +1771,7 @@ class _s extends M {
|
|
|
1771
1771
|
this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
|
|
1772
1772
|
}
|
|
1773
1773
|
}
|
|
1774
|
-
const
|
|
1774
|
+
const ds = l(
|
|
1775
1775
|
"miniApp",
|
|
1776
1776
|
({
|
|
1777
1777
|
themeParams: e,
|
|
@@ -1781,9 +1781,9 @@ const gs = d(
|
|
|
1781
1781
|
headerColor: e.headerBgColor || "#000000"
|
|
1782
1782
|
},
|
|
1783
1783
|
...n
|
|
1784
|
-
}) => new
|
|
1784
|
+
}) => new ls({ ...n, ...s, botInline: t })
|
|
1785
1785
|
);
|
|
1786
|
-
function
|
|
1786
|
+
function _s(e) {
|
|
1787
1787
|
const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
|
|
1788
1788
|
let r;
|
|
1789
1789
|
if (s.length > 64)
|
|
@@ -1799,15 +1799,15 @@ function ws(e) {
|
|
|
1799
1799
|
if (!i.type || i.type === "default" || i.type === "destructive") {
|
|
1800
1800
|
const o = i.text.trim();
|
|
1801
1801
|
if (!o.length || o.length > 64) {
|
|
1802
|
-
const
|
|
1803
|
-
throw new Error(`Button text with type "${
|
|
1802
|
+
const u = i.type || "default";
|
|
1803
|
+
throw new Error(`Button text with type "${u}" has incorrect size: ${i.text.length}`);
|
|
1804
1804
|
}
|
|
1805
1805
|
return { ...i, text: o, id: a };
|
|
1806
1806
|
}
|
|
1807
1807
|
return { ...i, id: a };
|
|
1808
1808
|
}) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
|
|
1809
1809
|
}
|
|
1810
|
-
class
|
|
1810
|
+
class gs extends V {
|
|
1811
1811
|
constructor(t, s, n) {
|
|
1812
1812
|
super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
|
|
1813
1813
|
}
|
|
@@ -1836,11 +1836,11 @@ class fs extends M {
|
|
|
1836
1836
|
throw new Error("Popup is already opened.");
|
|
1837
1837
|
this.isOpened = !0;
|
|
1838
1838
|
try {
|
|
1839
|
-
const { button_id: s = null } = await
|
|
1839
|
+
const { button_id: s = null } = await w({
|
|
1840
1840
|
event: "popup_closed",
|
|
1841
1841
|
method: "web_app_open_popup",
|
|
1842
1842
|
postEvent: this.postEvent,
|
|
1843
|
-
params:
|
|
1843
|
+
params: _s(t)
|
|
1844
1844
|
});
|
|
1845
1845
|
return s;
|
|
1846
1846
|
} finally {
|
|
@@ -1848,10 +1848,10 @@ class fs extends M {
|
|
|
1848
1848
|
}
|
|
1849
1849
|
}
|
|
1850
1850
|
}
|
|
1851
|
-
const
|
|
1852
|
-
({ postEvent: e, version: t }) => new
|
|
1851
|
+
const ws = l(
|
|
1852
|
+
({ postEvent: e, version: t }) => new gs(!1, t, e)
|
|
1853
1853
|
);
|
|
1854
|
-
class
|
|
1854
|
+
class fs extends V {
|
|
1855
1855
|
constructor(t, s, n) {
|
|
1856
1856
|
super({ isOpened: t }, s, {
|
|
1857
1857
|
close: "web_app_close_scan_qr_popup",
|
|
@@ -1884,7 +1884,7 @@ class bs extends M {
|
|
|
1884
1884
|
throw new Error("QR scanner is already opened.");
|
|
1885
1885
|
this.isOpened = !0;
|
|
1886
1886
|
try {
|
|
1887
|
-
return (await
|
|
1887
|
+
return (await w({
|
|
1888
1888
|
method: "web_app_open_scan_qr_popup",
|
|
1889
1889
|
event: ["qr_text_received", "scan_qr_popup_closed"],
|
|
1890
1890
|
postEvent: this.postEvent,
|
|
@@ -1895,10 +1895,10 @@ class bs extends M {
|
|
|
1895
1895
|
}
|
|
1896
1896
|
}
|
|
1897
1897
|
}
|
|
1898
|
-
const
|
|
1899
|
-
({ version: e, postEvent: t }) => new
|
|
1898
|
+
const ms = l(
|
|
1899
|
+
({ version: e, postEvent: t }) => new fs(!1, e, t)
|
|
1900
1900
|
);
|
|
1901
|
-
class
|
|
1901
|
+
class bs extends ot {
|
|
1902
1902
|
constructor(t, s, n) {
|
|
1903
1903
|
super({ isVisible: t }, s, {
|
|
1904
1904
|
show: "web_app_setup_settings_button",
|
|
@@ -1927,18 +1927,18 @@ class ys extends ot {
|
|
|
1927
1927
|
this.isVisible = !0;
|
|
1928
1928
|
}
|
|
1929
1929
|
}
|
|
1930
|
-
const
|
|
1930
|
+
const vs = l(
|
|
1931
1931
|
"settingsButton",
|
|
1932
1932
|
({
|
|
1933
1933
|
version: e,
|
|
1934
1934
|
postEvent: t,
|
|
1935
1935
|
state: s = { isVisible: !1 }
|
|
1936
|
-
}) => new
|
|
1936
|
+
}) => new bs(s.isVisible, e, t)
|
|
1937
1937
|
);
|
|
1938
|
-
function
|
|
1939
|
-
return
|
|
1938
|
+
function Jt(e) {
|
|
1939
|
+
return Mt().parse(e);
|
|
1940
1940
|
}
|
|
1941
|
-
class
|
|
1941
|
+
class ys extends ct {
|
|
1942
1942
|
/**
|
|
1943
1943
|
* @since v6.10
|
|
1944
1944
|
*/
|
|
@@ -1977,7 +1977,7 @@ class Ps extends ct {
|
|
|
1977
1977
|
* value is calculated according to theme bg color.
|
|
1978
1978
|
*/
|
|
1979
1979
|
get isDark() {
|
|
1980
|
-
return !this.bgColor ||
|
|
1980
|
+
return !this.bgColor || qt(this.bgColor);
|
|
1981
1981
|
}
|
|
1982
1982
|
get linkColor() {
|
|
1983
1983
|
return this.get("linkColor");
|
|
@@ -2003,7 +2003,7 @@ class Ps extends ct {
|
|
|
2003
2003
|
*/
|
|
2004
2004
|
listen() {
|
|
2005
2005
|
return E("theme_changed", (t) => {
|
|
2006
|
-
this.set(
|
|
2006
|
+
this.set(Jt(t.theme_params));
|
|
2007
2007
|
});
|
|
2008
2008
|
}
|
|
2009
2009
|
/**
|
|
@@ -2016,23 +2016,23 @@ class Ps extends ct {
|
|
|
2016
2016
|
return this.get("textColor");
|
|
2017
2017
|
}
|
|
2018
2018
|
}
|
|
2019
|
-
const
|
|
2019
|
+
const Es = l(
|
|
2020
2020
|
"themeParams",
|
|
2021
2021
|
({ themeParams: e, state: t = e, addCleanup: s }) => {
|
|
2022
|
-
const n = new
|
|
2022
|
+
const n = new ys(t);
|
|
2023
2023
|
return s(n.listen()), n;
|
|
2024
2024
|
}
|
|
2025
2025
|
);
|
|
2026
|
-
function
|
|
2027
|
-
return
|
|
2026
|
+
function bn(e = {}) {
|
|
2027
|
+
return w({
|
|
2028
2028
|
...e,
|
|
2029
2029
|
method: "web_app_request_theme",
|
|
2030
2030
|
event: "theme_changed"
|
|
2031
|
-
}).then(
|
|
2031
|
+
}).then(Jt);
|
|
2032
2032
|
}
|
|
2033
|
-
class
|
|
2033
|
+
class Ps extends ht {
|
|
2034
2034
|
constructor(t, s, n) {
|
|
2035
|
-
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam =
|
|
2035
|
+
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = Kt(t, {
|
|
2036
2036
|
"openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
|
|
2037
2037
|
});
|
|
2038
2038
|
}
|
|
@@ -2047,7 +2047,7 @@ class xs extends ht {
|
|
|
2047
2047
|
*/
|
|
2048
2048
|
openLink(t, s) {
|
|
2049
2049
|
const n = new URL(t, window.location.href).toString();
|
|
2050
|
-
if (!
|
|
2050
|
+
if (!S("web_app_open_link", this.version)) {
|
|
2051
2051
|
window.open(n, "_blank");
|
|
2052
2052
|
return;
|
|
2053
2053
|
}
|
|
@@ -2066,7 +2066,7 @@ class xs extends ht {
|
|
|
2066
2066
|
const { hostname: s, pathname: n, search: r } = new URL(t, window.location.href);
|
|
2067
2067
|
if (s !== "t.me")
|
|
2068
2068
|
throw new Error(`URL has not allowed hostname: ${s}. Only "t.me" is allowed`);
|
|
2069
|
-
if (!
|
|
2069
|
+
if (!S("web_app_open_tg_link", this.version)) {
|
|
2070
2070
|
window.location.href = t;
|
|
2071
2071
|
return;
|
|
2072
2072
|
}
|
|
@@ -2081,41 +2081,41 @@ class xs extends ht {
|
|
|
2081
2081
|
async readTextFromClipboard() {
|
|
2082
2082
|
const t = this.createRequestId(), {
|
|
2083
2083
|
data: s = null
|
|
2084
|
-
} = await
|
|
2084
|
+
} = await w({
|
|
2085
2085
|
method: "web_app_read_text_from_clipboard",
|
|
2086
2086
|
event: "clipboard_text_received",
|
|
2087
2087
|
postEvent: this.postEvent,
|
|
2088
2088
|
params: { req_id: t },
|
|
2089
|
-
capture:
|
|
2089
|
+
capture: kt(t)
|
|
2090
2090
|
});
|
|
2091
2091
|
return s;
|
|
2092
2092
|
}
|
|
2093
2093
|
}
|
|
2094
|
-
const
|
|
2095
|
-
({ version: e, postEvent: t, createRequestId: s }) => new
|
|
2094
|
+
const Rs = l(
|
|
2095
|
+
({ version: e, postEvent: t, createRequestId: s }) => new Ps(e, s, t)
|
|
2096
2096
|
);
|
|
2097
|
-
async function
|
|
2097
|
+
async function Qt(e = {}) {
|
|
2098
2098
|
const {
|
|
2099
2099
|
is_expanded: t,
|
|
2100
2100
|
is_state_stable: s,
|
|
2101
2101
|
...n
|
|
2102
|
-
} = await
|
|
2102
|
+
} = await w({
|
|
2103
2103
|
...e,
|
|
2104
2104
|
method: "web_app_request_viewport",
|
|
2105
2105
|
event: "viewport_changed"
|
|
2106
2106
|
});
|
|
2107
2107
|
return { ...n, isExpanded: t, isStateStable: s };
|
|
2108
2108
|
}
|
|
2109
|
-
function
|
|
2109
|
+
function O(e) {
|
|
2110
2110
|
return e < 0 ? 0 : e;
|
|
2111
2111
|
}
|
|
2112
|
-
class
|
|
2112
|
+
class xs extends ct {
|
|
2113
2113
|
constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
|
|
2114
2114
|
super({
|
|
2115
|
-
height:
|
|
2115
|
+
height: O(n),
|
|
2116
2116
|
isExpanded: i,
|
|
2117
|
-
stableHeight:
|
|
2118
|
-
width:
|
|
2117
|
+
stableHeight: O(s),
|
|
2118
|
+
width: O(r)
|
|
2119
2119
|
}), c(this, "postEvent"), this.postEvent = t;
|
|
2120
2120
|
}
|
|
2121
2121
|
/**
|
|
@@ -2124,7 +2124,7 @@ class Ss extends ct {
|
|
|
2124
2124
|
* @param options - options to request fresh data.
|
|
2125
2125
|
*/
|
|
2126
2126
|
async sync(t) {
|
|
2127
|
-
const { isStateStable: s, ...n } = await
|
|
2127
|
+
const { isStateStable: s, ...n } = await Qt(t);
|
|
2128
2128
|
this.set({
|
|
2129
2129
|
...n,
|
|
2130
2130
|
stableHeight: s ? n.height : this.get("stableHeight")
|
|
@@ -2177,11 +2177,11 @@ class Ss extends ct {
|
|
|
2177
2177
|
width: n,
|
|
2178
2178
|
is_expanded: r,
|
|
2179
2179
|
is_state_stable: i
|
|
2180
|
-
} = t, a =
|
|
2180
|
+
} = t, a = O(s);
|
|
2181
2181
|
this.set({
|
|
2182
2182
|
height: a,
|
|
2183
2183
|
isExpanded: r,
|
|
2184
|
-
width:
|
|
2184
|
+
width: O(n),
|
|
2185
2185
|
...i ? { stableHeight: a } : {}
|
|
2186
2186
|
});
|
|
2187
2187
|
});
|
|
@@ -2216,7 +2216,7 @@ class Ss extends ct {
|
|
|
2216
2216
|
return this.stableHeight === this.height;
|
|
2217
2217
|
}
|
|
2218
2218
|
}
|
|
2219
|
-
const
|
|
2219
|
+
const Cs = l(
|
|
2220
2220
|
"viewport",
|
|
2221
2221
|
async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
|
|
2222
2222
|
let r = !1, i = 0, a = 0, o = 0;
|
|
@@ -2225,31 +2225,31 @@ const Ts = d(
|
|
|
2225
2225
|
else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
|
|
2226
2226
|
r = !0, i = window.innerHeight, a = window.innerWidth, o = window.innerHeight;
|
|
2227
2227
|
else {
|
|
2228
|
-
const
|
|
2229
|
-
r =
|
|
2228
|
+
const h = await Qt({ timeout: 1e3, postEvent: s });
|
|
2229
|
+
r = h.isExpanded, i = h.height, a = h.width, o = h.isStateStable ? i : 0;
|
|
2230
2230
|
}
|
|
2231
|
-
const
|
|
2231
|
+
const u = new xs({
|
|
2232
2232
|
postEvent: s,
|
|
2233
2233
|
height: i,
|
|
2234
2234
|
width: a,
|
|
2235
2235
|
stableHeight: o,
|
|
2236
2236
|
isExpanded: r
|
|
2237
2237
|
});
|
|
2238
|
-
return n(
|
|
2238
|
+
return n(u.listen()), u;
|
|
2239
2239
|
}
|
|
2240
2240
|
);
|
|
2241
2241
|
function R(e, t) {
|
|
2242
2242
|
document.documentElement.style.setProperty(e, t);
|
|
2243
2243
|
}
|
|
2244
|
-
function
|
|
2244
|
+
function vn(e, t, s) {
|
|
2245
2245
|
s || (s = (o) => `--tg-${o}-color`);
|
|
2246
2246
|
const n = s("header"), r = s("bg"), i = () => {
|
|
2247
2247
|
const { headerColor: o } = e;
|
|
2248
2248
|
if (rt(o))
|
|
2249
2249
|
R(n, o);
|
|
2250
2250
|
else {
|
|
2251
|
-
const { bgColor:
|
|
2252
|
-
o === "bg_color" &&
|
|
2251
|
+
const { bgColor: u, secondaryBgColor: h } = t;
|
|
2252
|
+
o === "bg_color" && u ? R(n, u) : o === "secondary_bg_color" && h && R(n, h);
|
|
2253
2253
|
}
|
|
2254
2254
|
R(r, e.bgColor);
|
|
2255
2255
|
}, a = [
|
|
@@ -2258,7 +2258,7 @@ function En(e, t, s) {
|
|
|
2258
2258
|
];
|
|
2259
2259
|
return i(), () => a.forEach((o) => o());
|
|
2260
2260
|
}
|
|
2261
|
-
function
|
|
2261
|
+
function yn(e, t) {
|
|
2262
2262
|
t || (t = (n) => `--tg-theme-${n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`);
|
|
2263
2263
|
const s = () => {
|
|
2264
2264
|
Object.entries(e.getState()).forEach(([n, r]) => {
|
|
@@ -2267,20 +2267,20 @@ function Pn(e, t) {
|
|
|
2267
2267
|
};
|
|
2268
2268
|
return s(), e.on("change", s);
|
|
2269
2269
|
}
|
|
2270
|
-
function
|
|
2271
|
-
t || (t = (
|
|
2270
|
+
function En(e, t) {
|
|
2271
|
+
t || (t = (h) => `--tg-viewport-${h}`);
|
|
2272
2272
|
const [
|
|
2273
2273
|
s,
|
|
2274
2274
|
n,
|
|
2275
2275
|
r
|
|
2276
|
-
] = ["height", "width", "stable-height"].map((
|
|
2276
|
+
] = ["height", "width", "stable-height"].map((h) => t(h)), i = () => R(s, `${e.height}px`), a = () => R(n, `${e.width}px`), o = () => R(r, `${e.stableHeight}px`), u = [
|
|
2277
2277
|
e.on("change:height", i),
|
|
2278
2278
|
e.on("change:width", a),
|
|
2279
2279
|
e.on("change:stableHeight", o)
|
|
2280
2280
|
];
|
|
2281
|
-
return i(), a(), o(), () =>
|
|
2281
|
+
return i(), a(), o(), () => u.forEach((h) => h());
|
|
2282
2282
|
}
|
|
2283
|
-
function
|
|
2283
|
+
function Ss(e = !0) {
|
|
2284
2284
|
const t = [
|
|
2285
2285
|
E("reload_iframe", () => {
|
|
2286
2286
|
N("iframe_will_reload"), window.location.reload();
|
|
@@ -2297,23 +2297,23 @@ function As(e = !0) {
|
|
|
2297
2297
|
}
|
|
2298
2298
|
return N("iframe_ready", { reload_supported: !0 }), s;
|
|
2299
2299
|
}
|
|
2300
|
-
function
|
|
2300
|
+
function Ts() {
|
|
2301
2301
|
return typeof window > "u";
|
|
2302
2302
|
}
|
|
2303
|
-
async function
|
|
2304
|
-
if (
|
|
2303
|
+
async function Pn() {
|
|
2304
|
+
if (St(window))
|
|
2305
2305
|
return !0;
|
|
2306
2306
|
try {
|
|
2307
|
-
return await
|
|
2307
|
+
return await w({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
2308
2308
|
} catch {
|
|
2309
2309
|
return !1;
|
|
2310
2310
|
}
|
|
2311
2311
|
}
|
|
2312
|
-
function
|
|
2312
|
+
function As(e) {
|
|
2313
2313
|
return e instanceof W;
|
|
2314
2314
|
}
|
|
2315
|
-
function
|
|
2316
|
-
return
|
|
2315
|
+
function Rn(e, t) {
|
|
2316
|
+
return As(e) && e.type === t;
|
|
2317
2317
|
}
|
|
2318
2318
|
function J(e, t) {
|
|
2319
2319
|
let s, n, r;
|
|
@@ -2323,13 +2323,13 @@ function J(e, t) {
|
|
|
2323
2323
|
params: n
|
|
2324
2324
|
});
|
|
2325
2325
|
}
|
|
2326
|
-
class
|
|
2326
|
+
class ks {
|
|
2327
2327
|
constructor(t, s, n = N) {
|
|
2328
2328
|
if (c(this, "history"), c(this, "ee", new H()), c(this, "attached", !1), c(this, "back", () => this.go(-1)), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this._index = s, this.postEvent = n, t.length === 0)
|
|
2329
|
-
throw
|
|
2329
|
+
throw m(_e, "History should not be empty.");
|
|
2330
2330
|
if (s < 0 || s >= t.length)
|
|
2331
|
-
throw
|
|
2332
|
-
|
|
2331
|
+
throw m(
|
|
2332
|
+
ge,
|
|
2333
2333
|
"Index should not be zero and higher or equal than history size."
|
|
2334
2334
|
);
|
|
2335
2335
|
this.history = t.map((r) => J(r, ""));
|
|
@@ -2483,39 +2483,39 @@ async function D(e) {
|
|
|
2483
2483
|
})
|
|
2484
2484
|
]);
|
|
2485
2485
|
}
|
|
2486
|
-
async function
|
|
2486
|
+
async function Is() {
|
|
2487
2487
|
if (window.history.length <= 1 || (window.history.pushState(null, ""), await D(1 - window.history.length)))
|
|
2488
2488
|
return;
|
|
2489
2489
|
let e = await D(-1);
|
|
2490
2490
|
for (; e; )
|
|
2491
2491
|
e = await D(-1);
|
|
2492
2492
|
}
|
|
2493
|
-
function
|
|
2493
|
+
function Ft(e) {
|
|
2494
2494
|
return L(e).pathname;
|
|
2495
2495
|
}
|
|
2496
|
-
const
|
|
2497
|
-
class
|
|
2496
|
+
const ft = 0, Y = 1, Z = 2;
|
|
2497
|
+
class Yt {
|
|
2498
2498
|
constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
|
|
2499
2499
|
c(this, "navigator"), c(this, "ee", new H()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: a }) => {
|
|
2500
2500
|
if (a === null)
|
|
2501
2501
|
return this.push(this.parsePath(window.location.href));
|
|
2502
|
-
a ===
|
|
2502
|
+
a === ft ? window.history.forward() : a === Y && this.back(), a === Z && this.forward();
|
|
2503
2503
|
}), c(this, "onNavigatorChange", async ({
|
|
2504
2504
|
to: a,
|
|
2505
2505
|
from: o,
|
|
2506
|
-
delta:
|
|
2506
|
+
delta: u
|
|
2507
2507
|
}) => {
|
|
2508
2508
|
this.attached && await this.syncHistory(), this.ee.emit("change", {
|
|
2509
|
-
delta:
|
|
2509
|
+
delta: u,
|
|
2510
2510
|
from: Q(o),
|
|
2511
2511
|
to: Q(a),
|
|
2512
2512
|
navigator: this
|
|
2513
2513
|
});
|
|
2514
|
-
}), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new
|
|
2514
|
+
}), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new ks(
|
|
2515
2515
|
t.map((a) => F(a, "/")),
|
|
2516
2516
|
s,
|
|
2517
2517
|
n
|
|
2518
|
-
), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base =
|
|
2518
|
+
), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = Ft(i || "");
|
|
2519
2519
|
}
|
|
2520
2520
|
/**
|
|
2521
2521
|
* Attaches current navigator to the browser history allowing navigator to manipulate it.
|
|
@@ -2672,7 +2672,7 @@ class Xt {
|
|
|
2672
2672
|
async syncHistory() {
|
|
2673
2673
|
window.removeEventListener("popstate", this.onPopState);
|
|
2674
2674
|
const { state: t } = this, s = this.renderPath(this);
|
|
2675
|
-
await
|
|
2675
|
+
await Is(), this.hasPrev && this.hasNext ? (window.history.replaceState(Y, ""), window.history.pushState(t, "", s), window.history.pushState(Z, ""), await D(-1)) : this.hasPrev ? (window.history.replaceState(Y, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(Z, ""), await D(-1)) : (window.history.replaceState(ft, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
|
|
2676
2676
|
}
|
|
2677
2677
|
/**
|
|
2678
2678
|
* Current query parameters.
|
|
@@ -2690,73 +2690,73 @@ class Xt {
|
|
|
2690
2690
|
return (this.navigator.current.params || {}).state;
|
|
2691
2691
|
}
|
|
2692
2692
|
}
|
|
2693
|
-
function
|
|
2693
|
+
function Os(e) {
|
|
2694
2694
|
e || (e = {});
|
|
2695
2695
|
const { href: t, hash: s } = window.location;
|
|
2696
2696
|
let n = U(
|
|
2697
2697
|
e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
|
|
2698
2698
|
);
|
|
2699
|
-
const r = e.base ?
|
|
2699
|
+
const r = e.base ? Ft(e.base) : void 0;
|
|
2700
2700
|
if (r) {
|
|
2701
2701
|
if (!n.startsWith(r))
|
|
2702
|
-
throw
|
|
2703
|
-
|
|
2702
|
+
throw m(
|
|
2703
|
+
we,
|
|
2704
2704
|
`Path "${n}" expected to be starting with "${r}"`
|
|
2705
2705
|
);
|
|
2706
2706
|
n = n.slice(r.length);
|
|
2707
2707
|
}
|
|
2708
|
-
return new
|
|
2708
|
+
return new Yt([n], 0, e);
|
|
2709
2709
|
}
|
|
2710
|
-
function
|
|
2710
|
+
function xn(e) {
|
|
2711
2711
|
const t = e.match(/#(.+)/);
|
|
2712
2712
|
return t ? t[1] : null;
|
|
2713
2713
|
}
|
|
2714
|
-
function
|
|
2715
|
-
if (
|
|
2714
|
+
function qs(e, t) {
|
|
2715
|
+
if (Gt()) {
|
|
2716
2716
|
const s = sessionStorage.getItem(e);
|
|
2717
2717
|
if (s)
|
|
2718
2718
|
try {
|
|
2719
2719
|
const { index: n, history: r } = JSON.parse(s);
|
|
2720
|
-
return new
|
|
2720
|
+
return new Yt(r, n, t);
|
|
2721
2721
|
} catch (n) {
|
|
2722
2722
|
console.error("Unable to restore hash navigator state.", n);
|
|
2723
2723
|
}
|
|
2724
2724
|
}
|
|
2725
|
-
return
|
|
2725
|
+
return Os(t);
|
|
2726
2726
|
}
|
|
2727
|
-
function
|
|
2728
|
-
const s =
|
|
2727
|
+
function Cn(e, t) {
|
|
2728
|
+
const s = qs(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
2729
2729
|
index: s.index,
|
|
2730
2730
|
history: s.history
|
|
2731
2731
|
}));
|
|
2732
2732
|
return s.on("change", n), n(), s;
|
|
2733
2733
|
}
|
|
2734
|
-
function
|
|
2734
|
+
function d(e, t) {
|
|
2735
2735
|
function s(n) {
|
|
2736
2736
|
return (r, i, a) => (o) => {
|
|
2737
|
-
const
|
|
2738
|
-
return /* @__PURE__ */
|
|
2737
|
+
const u = o[i] || [], h = { ...o, [r]: n(...u) };
|
|
2738
|
+
return /* @__PURE__ */ mt(a, { ...h });
|
|
2739
2739
|
};
|
|
2740
2740
|
}
|
|
2741
2741
|
return [s(e), s(t)];
|
|
2742
2742
|
}
|
|
2743
|
-
const
|
|
2744
|
-
function
|
|
2745
|
-
const e =
|
|
2743
|
+
const Zt = Xt(void 0);
|
|
2744
|
+
function Ds() {
|
|
2745
|
+
const e = te(Zt);
|
|
2746
2746
|
if (!e)
|
|
2747
2747
|
throw new Error("useSDK was used outside the SDKProvider.");
|
|
2748
2748
|
return e;
|
|
2749
2749
|
}
|
|
2750
|
-
function
|
|
2750
|
+
function _(e) {
|
|
2751
2751
|
function t(n) {
|
|
2752
|
-
const r =
|
|
2752
|
+
const r = Ds(), [i, a] = bt(
|
|
2753
2753
|
n ? void 0 : () => {
|
|
2754
|
-
if (
|
|
2754
|
+
if (Ts())
|
|
2755
2755
|
throw new Error("Using hooks on the server side, you must explicitly specify ssr = true option");
|
|
2756
2756
|
return r.use(e);
|
|
2757
2757
|
}
|
|
2758
2758
|
);
|
|
2759
|
-
return
|
|
2759
|
+
return C(() => {
|
|
2760
2760
|
a(r.use(e));
|
|
2761
2761
|
}, [r]), i;
|
|
2762
2762
|
}
|
|
@@ -2770,246 +2770,248 @@ function g(e) {
|
|
|
2770
2770
|
}
|
|
2771
2771
|
return [t, s];
|
|
2772
2772
|
}
|
|
2773
|
-
const [
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
), [
|
|
2773
|
+
const [Ns, Bs] = _(Ge), [Sn, Tn] = d(
|
|
2774
|
+
Ns,
|
|
2775
|
+
Bs
|
|
2776
|
+
), [Ms, Vs] = _(Je), [An, kn] = d(
|
|
2777
|
+
Ms,
|
|
2778
|
+
Vs
|
|
2779
|
+
), [$s, Ls] = _(Fe), [In, On] = d(
|
|
2777
2780
|
$s,
|
|
2778
2781
|
Ls
|
|
2779
|
-
), [Us, Hs] =
|
|
2782
|
+
), [Us, Hs] = _(es), [qn, Dn] = d(
|
|
2780
2783
|
Us,
|
|
2781
2784
|
Hs
|
|
2782
|
-
), [Ws, js] =
|
|
2785
|
+
), [Ws, js] = _(ns), [Nn, Bn] = d(
|
|
2783
2786
|
Ws,
|
|
2784
2787
|
js
|
|
2785
|
-
), [Gs, zs] =
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
), [
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
const n = _t(!0), r = _t(/* @__PURE__ */ new Map()), [i, a] = yt([]), o = gt(() => a([]), []), p = gt(
|
|
2798
|
-
(l) => {
|
|
2799
|
-
n.current && (l && l(r.current), o());
|
|
2788
|
+
), [Gs, zs] = _(is), [Mn, Vn] = d(Gs, zs), [Ks, Js] = _(as), [$n, Ln] = d(Ks, Js), [Qs, Fs] = _(hs), [Un, Hn] = d(Qs, Fs), [Ys, Zs] = _(ds), [Wn, jn] = d(Ys, Zs), [Xs, tn] = _(ws), [Gn, zn] = d(Xs, tn), [en, sn] = _(ms), [Kn, Jn] = d(en, sn), [nn, rn] = _(vs), [Qn, Fn] = d(
|
|
2789
|
+
nn,
|
|
2790
|
+
rn
|
|
2791
|
+
), [on, an] = _(Es), [Yn, Zn] = d(on, an);
|
|
2792
|
+
function Xn() {
|
|
2793
|
+
return vt(jt, []);
|
|
2794
|
+
}
|
|
2795
|
+
const [cn, hn] = _(Rs), [tr, er] = d(cn, hn), [pn, un] = _(Cs), [sr, nr] = d(pn, un);
|
|
2796
|
+
function rr({ children: e, acceptCustomStyles: t, debug: s }) {
|
|
2797
|
+
const n = dt(!0), [r, i] = bt(/* @__PURE__ */ new Map()), a = dt(r), o = ee(
|
|
2798
|
+
(h) => {
|
|
2799
|
+
n.current && i((v) => (h && h(v), new Map(v)));
|
|
2800
2800
|
},
|
|
2801
|
-
[
|
|
2802
|
-
), u =
|
|
2803
|
-
use(
|
|
2804
|
-
const
|
|
2805
|
-
if (
|
|
2806
|
-
return
|
|
2807
|
-
let
|
|
2801
|
+
[]
|
|
2802
|
+
), u = vt(() => ({
|
|
2803
|
+
use(h, ...v) {
|
|
2804
|
+
const pt = r.get(h);
|
|
2805
|
+
if (pt)
|
|
2806
|
+
return pt;
|
|
2807
|
+
let b, K;
|
|
2808
2808
|
try {
|
|
2809
|
-
|
|
2810
|
-
} catch (
|
|
2811
|
-
K =
|
|
2809
|
+
b = h(...v);
|
|
2810
|
+
} catch (f) {
|
|
2811
|
+
K = f;
|
|
2812
2812
|
}
|
|
2813
|
-
function $(
|
|
2814
|
-
return
|
|
2813
|
+
function $(f) {
|
|
2814
|
+
return r.set(h, f), f;
|
|
2815
2815
|
}
|
|
2816
2816
|
if (K)
|
|
2817
2817
|
return $({ error: K });
|
|
2818
|
-
let
|
|
2819
|
-
if (Array.isArray(
|
|
2820
|
-
return $({ result:
|
|
2821
|
-
function
|
|
2822
|
-
if ("on" in
|
|
2823
|
-
const
|
|
2824
|
-
|
|
2825
|
-
|
|
2818
|
+
let k;
|
|
2819
|
+
if (Array.isArray(b) && (k = b[1], b = b[0]), !b)
|
|
2820
|
+
return $({ result: b, cleanup: k });
|
|
2821
|
+
function ut(f) {
|
|
2822
|
+
if ("on" in f) {
|
|
2823
|
+
const I = f.on("change", () => o()), lt = k;
|
|
2824
|
+
k = () => {
|
|
2825
|
+
lt && lt(), I();
|
|
2826
2826
|
};
|
|
2827
2827
|
}
|
|
2828
|
-
return { result:
|
|
2828
|
+
return { result: f, cleanup: k };
|
|
2829
2829
|
}
|
|
2830
|
-
return
|
|
2831
|
-
(
|
|
2832
|
-
(
|
|
2833
|
-
), $({})) : $(
|
|
2830
|
+
return b instanceof Promise ? (b.then(
|
|
2831
|
+
(f) => o((I) => I.set(h, ut(f))),
|
|
2832
|
+
(f) => o((I) => I.set(h, { error: f }))
|
|
2833
|
+
), $({})) : $(ut(b));
|
|
2834
2834
|
}
|
|
2835
|
-
}), [
|
|
2836
|
-
return
|
|
2837
|
-
if (kt())
|
|
2838
|
-
return As(t);
|
|
2839
|
-
}, [t]), O(() => {
|
|
2840
|
-
ce(s || !1);
|
|
2841
|
-
}, [s]), O(() => () => {
|
|
2835
|
+
}), [r]);
|
|
2836
|
+
return C(() => (n.current = !0, () => {
|
|
2842
2837
|
n.current = !1;
|
|
2843
|
-
}, []),
|
|
2844
|
-
|
|
2845
|
-
|
|
2838
|
+
}), []), C(() => {
|
|
2839
|
+
if (Tt())
|
|
2840
|
+
return Ss(t);
|
|
2841
|
+
}, [t]), C(() => {
|
|
2842
|
+
oe(s || !1);
|
|
2843
|
+
}, [s]), C(() => {
|
|
2844
|
+
a.current = r;
|
|
2845
|
+
}, [r]), C(() => () => {
|
|
2846
|
+
a.current.forEach((h) => {
|
|
2847
|
+
"cleanup" in h && h.cleanup && h.cleanup();
|
|
2846
2848
|
});
|
|
2847
|
-
}, [
|
|
2849
|
+
}, []), /* @__PURE__ */ mt(Zt.Provider, { value: u, children: e });
|
|
2848
2850
|
}
|
|
2849
2851
|
export {
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2852
|
+
Oe as BackButton,
|
|
2853
|
+
ks as BasicNavigator,
|
|
2854
|
+
ze as BiometryManager,
|
|
2855
|
+
Yt as BrowserNavigator,
|
|
2856
|
+
Qe as ClosingBehavior,
|
|
2857
|
+
ts as CloudStorage,
|
|
2858
|
+
we as ERR_INVALID_PATH_BASE,
|
|
2859
|
+
ue as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
|
|
2860
|
+
he as ERR_METHOD_PARAMETER_UNSUPPORTED,
|
|
2861
|
+
ce as ERR_METHOD_UNSUPPORTED,
|
|
2862
|
+
_e as ERR_NAVIGATION_HISTORY_EMPTY,
|
|
2863
|
+
ge as ERR_NAVIGATION_INDEX_INVALID,
|
|
2864
|
+
_n as ERR_NAVIGATION_ITEM_INVALID,
|
|
2865
|
+
Pt as ERR_PARSE,
|
|
2866
|
+
gn as ERR_SSR_INIT,
|
|
2867
|
+
le as ERR_TIMED_OUT,
|
|
2868
|
+
de as ERR_UNEXPECTED_TYPE,
|
|
2869
|
+
pe as ERR_UNKNOWN_ENV,
|
|
2868
2870
|
H as EventEmitter,
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2871
|
+
ss as HapticFeedback,
|
|
2872
|
+
rs as InitData,
|
|
2873
|
+
os as Invoice,
|
|
2874
|
+
cs as MainButton,
|
|
2875
|
+
ls as MiniApp,
|
|
2876
|
+
gs as Popup,
|
|
2877
|
+
fs as QRScanner,
|
|
2876
2878
|
W as SDKError,
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2879
|
+
rr as SDKProvider,
|
|
2880
|
+
bs as SettingsButton,
|
|
2881
|
+
ys as ThemeParams,
|
|
2882
|
+
Ps as Utils,
|
|
2883
|
+
xs as Viewport,
|
|
2884
|
+
Xe as array,
|
|
2885
|
+
vn as bindMiniAppCSSVars,
|
|
2886
|
+
yn as bindThemeParamsCSSVars,
|
|
2887
|
+
En as bindViewportCSSVars,
|
|
2886
2888
|
P as boolean,
|
|
2887
|
-
|
|
2889
|
+
kt as captureSameReq,
|
|
2888
2890
|
et as classNames,
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2891
|
+
Se as compareVersions,
|
|
2892
|
+
Os as createBrowserNavigatorFromLocation,
|
|
2893
|
+
ke as createPostEvent,
|
|
2892
2894
|
L as createSafeURL,
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2895
|
+
Nt as date,
|
|
2896
|
+
xn as getHash,
|
|
2897
|
+
Ft as getPathname,
|
|
2898
|
+
Ge as initBackButton,
|
|
2899
|
+
Je as initBiometryManager,
|
|
2900
|
+
Fe as initClosingBehavior,
|
|
2901
|
+
es as initCloudStorage,
|
|
2902
|
+
ns as initHapticFeedback,
|
|
2903
|
+
is as initInitData,
|
|
2904
|
+
as as initInvoice,
|
|
2905
|
+
hs as initMainButton,
|
|
2906
|
+
ds as initMiniApp,
|
|
2907
|
+
Cn as initNavigator,
|
|
2908
|
+
ws as initPopup,
|
|
2909
|
+
ms as initQRScanner,
|
|
2910
|
+
vs as initSettingsButton,
|
|
2911
|
+
Es as initThemeParams,
|
|
2912
|
+
Rs as initUtils,
|
|
2913
|
+
Cs as initViewport,
|
|
2914
|
+
Ss as initWeb,
|
|
2913
2915
|
q as invokeCustomMethod,
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2916
|
+
qt as isColorDark,
|
|
2917
|
+
Tt as isIframe,
|
|
2918
|
+
Gt as isPageReload,
|
|
2917
2919
|
rt as isRGB,
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2920
|
+
fe as isRGBShort,
|
|
2921
|
+
As as isSDKError,
|
|
2922
|
+
Rn as isSDKErrorOfType,
|
|
2923
|
+
Ts as isSSR,
|
|
2924
|
+
Pn as isTMA,
|
|
2925
|
+
g as json,
|
|
2926
|
+
fn as mergeClassNames,
|
|
2925
2927
|
x as number,
|
|
2926
2928
|
z as off,
|
|
2927
2929
|
E as on,
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2930
|
+
mn as parseInitData,
|
|
2931
|
+
Vt as parseLaunchParams,
|
|
2932
|
+
Jt as parseThemeParams,
|
|
2931
2933
|
N as postEvent,
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2934
|
+
w as request,
|
|
2935
|
+
Ke as requestBiometryInfo,
|
|
2936
|
+
bn as requestThemeParams,
|
|
2937
|
+
Qt as requestViewport,
|
|
2938
|
+
jt as retrieveLaunchParams,
|
|
2939
|
+
Ct as rgb,
|
|
2938
2940
|
at as searchParams,
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
+
Le as serializeLaunchParams,
|
|
2942
|
+
$e as serializeThemeParams,
|
|
2941
2943
|
R as setCSSVar,
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2944
|
+
oe as setDebug,
|
|
2945
|
+
wn as setTargetOrigin,
|
|
2946
|
+
p as string,
|
|
2947
|
+
re as subscribe,
|
|
2948
|
+
S as supports,
|
|
2949
|
+
Ae as targetOrigin,
|
|
2950
|
+
xt as toRGB,
|
|
2951
|
+
Et as unsubscribe,
|
|
2950
2952
|
U as urlToPath,
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
2953
|
+
Bs as useBackButton,
|
|
2954
|
+
Ns as useBackButtonRaw,
|
|
2955
|
+
Vs as useBiometryManager,
|
|
2956
|
+
Ms as useBiometryManagerRaw,
|
|
2957
|
+
Ls as useClosingBehavior,
|
|
2958
|
+
$s as useClosingBehaviorRaw,
|
|
2959
|
+
Hs as useCloudStorage,
|
|
2960
|
+
Us as useCloudStorageRaw,
|
|
2961
|
+
js as useHapticFeedback,
|
|
2962
|
+
Ws as useHapticFeedbackRaw,
|
|
2963
|
+
zs as useInitData,
|
|
2964
|
+
Gs as useInitDataRaw,
|
|
2965
|
+
Js as useInvoice,
|
|
2966
|
+
Ks as useInvoiceRaw,
|
|
2967
|
+
Xn as useLaunchParams,
|
|
2968
|
+
Fs as useMainButton,
|
|
2969
|
+
Qs as useMainButtonRaw,
|
|
2970
|
+
Zs as useMiniApp,
|
|
2971
|
+
Ys as useMiniAppRaw,
|
|
2972
|
+
tn as usePopup,
|
|
2973
|
+
Xs as usePopupRaw,
|
|
2974
|
+
sn as useQRScanner,
|
|
2975
|
+
en as useQRScannerRaw,
|
|
2976
|
+
Ds as useSDK,
|
|
2977
|
+
rn as useSettingsButton,
|
|
2978
|
+
nn as useSettingsButtonRaw,
|
|
2979
|
+
an as useThemeParams,
|
|
2980
|
+
on as useThemeParamsRaw,
|
|
2981
|
+
hn as useUtils,
|
|
2982
|
+
cn as useUtilsRaw,
|
|
2983
|
+
un as useViewport,
|
|
2984
|
+
pn as useViewportRaw,
|
|
2985
|
+
Tn as withBackButton,
|
|
2986
|
+
Sn as withBackButtonRaw,
|
|
2987
|
+
kn as withBiometryManager,
|
|
2988
|
+
An as withBiometryManagerRaw,
|
|
2989
|
+
On as withClosingBehavior,
|
|
2990
|
+
In as withClosingBehaviorRaw,
|
|
2991
|
+
Dn as withCloudStorage,
|
|
2992
|
+
qn as withCloudStorageRaw,
|
|
2993
|
+
Bn as withHapticFeedback,
|
|
2994
|
+
Nn as withHapticFeedbackRaw,
|
|
2995
|
+
Vn as withInitData,
|
|
2996
|
+
Mn as withInitDataRaw,
|
|
2997
|
+
Ln as withInvoice,
|
|
2998
|
+
$n as withInvoiceRaw,
|
|
2999
|
+
Hn as withMainButton,
|
|
3000
|
+
Un as withMainButtonRaw,
|
|
3001
|
+
jn as withMiniApp,
|
|
3002
|
+
Wn as withMiniAppRaw,
|
|
3003
|
+
zn as withPopup,
|
|
3004
|
+
Gn as withPopupRaw,
|
|
3005
|
+
Jn as withQRScanner,
|
|
3006
|
+
Kn as withQRScannerRaw,
|
|
3007
|
+
Fn as withSettingsButton,
|
|
3008
|
+
Qn as withSettingsButtonRaw,
|
|
3009
|
+
Zn as withThemeParams,
|
|
3010
|
+
Yn as withThemeParamsRaw,
|
|
3011
|
+
Ot as withTimeout,
|
|
3012
|
+
er as withUtils,
|
|
3013
|
+
tr as withUtilsRaw,
|
|
3014
|
+
nr as withViewport,
|
|
3015
|
+
sr as withViewportRaw
|
|
3014
3016
|
};
|
|
3015
3017
|
//# sourceMappingURL=index.js.map
|