@tma.js/sdk-solid 2.1.10 → 2.1.11
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 +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +509 -524
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
var
|
|
3
|
-
function
|
|
1
|
+
import { createComponent as mt, mergeProps as pt, createContext as te, useContext as ee, createEffect as ut, onCleanup as lt, createResource as se, createMemo as dt, from as ne } from "solid-js";
|
|
2
|
+
var re = Object.defineProperty, ie = (e, t, s) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => ie(e, typeof t != "symbol" ? t + "" : t, s);
|
|
3
|
+
function bt(e, t) {
|
|
4
4
|
let s;
|
|
5
5
|
const n = () => {
|
|
6
6
|
s !== void 0 && t && t(s), s = void 0;
|
|
7
7
|
};
|
|
8
8
|
return [() => s === void 0 ? s = e(n) : s, n];
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const t =
|
|
12
|
-
t.unsubscribe(e), s && !t.count &&
|
|
10
|
+
function vt(e) {
|
|
11
|
+
const t = H(), { count: s } = t;
|
|
12
|
+
t.unsubscribe(e), s && !t.count && xe();
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
14
|
+
function oe(e) {
|
|
15
|
+
return H().subscribe(e), () => vt(e);
|
|
16
16
|
}
|
|
17
|
-
class
|
|
17
|
+
class ae {
|
|
18
18
|
constructor(t, s = {}) {
|
|
19
19
|
this.scope = t, this.options = s;
|
|
20
20
|
}
|
|
@@ -54,18 +54,18 @@ class ce {
|
|
|
54
54
|
this.print("log", ...t);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const X = new
|
|
57
|
+
const X = new ae("SDK", {
|
|
58
58
|
bgColor: "forestgreen",
|
|
59
59
|
textColor: "white"
|
|
60
60
|
});
|
|
61
61
|
let F = !1;
|
|
62
|
-
const
|
|
62
|
+
const _t = ({ name: e, payload: t }) => {
|
|
63
63
|
X.log("Event received:", t ? { name: e, payload: t } : { name: e });
|
|
64
64
|
};
|
|
65
|
-
function
|
|
66
|
-
F !== e && (F = e, e ?
|
|
65
|
+
function ce(e) {
|
|
66
|
+
F !== e && (F = e, e ? oe(_t) : vt(_t));
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function he(...e) {
|
|
69
69
|
F && X.log(...e);
|
|
70
70
|
}
|
|
71
71
|
class k {
|
|
@@ -143,7 +143,7 @@ function Q(e, t, s) {
|
|
|
143
143
|
}
|
|
144
144
|
function tt(...e) {
|
|
145
145
|
let t = !1;
|
|
146
|
-
const s =
|
|
146
|
+
const s = e.flat(1);
|
|
147
147
|
return [
|
|
148
148
|
(n) => !t && s.push(n),
|
|
149
149
|
() => {
|
|
@@ -157,12 +157,12 @@ class $ extends Error {
|
|
|
157
157
|
super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, $.prototype);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function m(e, t, s) {
|
|
161
161
|
return new $(e, t, s);
|
|
162
162
|
}
|
|
163
|
-
const
|
|
163
|
+
const pe = "ERR_METHOD_UNSUPPORTED", ue = "ERR_METHOD_PARAMETER_UNSUPPORTED", le = "ERR_UNKNOWN_ENV", de = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", _e = "ERR_TIMED_OUT", ge = "ERR_UNEXPECTED_TYPE", yt = "ERR_PARSE", fe = "ERR_NAVIGATION_LIST_EMPTY", we = "ERR_NAVIGATION_CURSOR_INVALID", Js = "ERR_NAVIGATION_ITEM_INVALID", Fs = "ERR_SSR_INIT", me = "ERR_INVALID_PATH_BASE";
|
|
164
164
|
function S() {
|
|
165
|
-
return
|
|
165
|
+
return m(ge, "Value has unexpected type");
|
|
166
166
|
}
|
|
167
167
|
class L {
|
|
168
168
|
constructor(t, s, n) {
|
|
@@ -179,8 +179,8 @@ class L {
|
|
|
179
179
|
try {
|
|
180
180
|
return this.parser(t);
|
|
181
181
|
} catch (s) {
|
|
182
|
-
throw
|
|
183
|
-
|
|
182
|
+
throw m(
|
|
183
|
+
yt,
|
|
184
184
|
`Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
|
|
185
185
|
s
|
|
186
186
|
);
|
|
@@ -203,7 +203,7 @@ const y = T((e) => {
|
|
|
203
203
|
return !1;
|
|
204
204
|
throw S();
|
|
205
205
|
}, "boolean");
|
|
206
|
-
function
|
|
206
|
+
function Et(e, t) {
|
|
207
207
|
const s = {};
|
|
208
208
|
for (const n in e) {
|
|
209
209
|
const r = e[n];
|
|
@@ -220,21 +220,21 @@ function Pt(e, t) {
|
|
|
220
220
|
const a = o(t(i));
|
|
221
221
|
a !== void 0 && (s[n] = a);
|
|
222
222
|
} catch (a) {
|
|
223
|
-
throw
|
|
223
|
+
throw m(yt, `Unable to parse field "${n}"`, a);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
return s;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Pt(e) {
|
|
229
229
|
let t = e;
|
|
230
230
|
if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
|
|
231
231
|
throw S();
|
|
232
232
|
return t;
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function b(e, t) {
|
|
235
235
|
return new L((s) => {
|
|
236
|
-
const n =
|
|
237
|
-
return
|
|
236
|
+
const n = Pt(s);
|
|
237
|
+
return Et(e, (r) => n[r]);
|
|
238
238
|
}, !1, t);
|
|
239
239
|
}
|
|
240
240
|
const P = T((e) => {
|
|
@@ -246,43 +246,18 @@ const P = T((e) => {
|
|
|
246
246
|
return t;
|
|
247
247
|
}
|
|
248
248
|
throw S();
|
|
249
|
-
}, "number")
|
|
250
|
-
function st(e) {
|
|
251
|
-
return /^#[\da-f]{6}$/i.test(e);
|
|
252
|
-
}
|
|
253
|
-
function ve(e) {
|
|
254
|
-
return /^#[\da-f]{3}$/i.test(e);
|
|
255
|
-
}
|
|
256
|
-
function xt(e) {
|
|
257
|
-
const t = e.replace(/\s/g, "").toLowerCase();
|
|
258
|
-
if (st(t))
|
|
259
|
-
return t;
|
|
260
|
-
if (ve(t)) {
|
|
261
|
-
let n = "#";
|
|
262
|
-
for (let r = 0; r < 3; r += 1)
|
|
263
|
-
n += t[1 + r].repeat(2);
|
|
264
|
-
return n;
|
|
265
|
-
}
|
|
266
|
-
const s = t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/) || t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);
|
|
267
|
-
if (!s)
|
|
268
|
-
throw new Error(`Value "${e}" does not satisfy any of known RGB formats.`);
|
|
269
|
-
return s.slice(1).reduce((n, r) => {
|
|
270
|
-
const i = parseInt(r, 10).toString(16);
|
|
271
|
-
return n + (i.length === 1 ? "0" : "") + i;
|
|
272
|
-
}, "#");
|
|
273
|
-
}
|
|
274
|
-
const p = T((e) => {
|
|
249
|
+
}, "number"), p = T((e) => {
|
|
275
250
|
if (typeof e == "string" || typeof e == "number")
|
|
276
251
|
return e.toString();
|
|
277
252
|
throw S();
|
|
278
|
-
}, "string")
|
|
279
|
-
function
|
|
280
|
-
return
|
|
253
|
+
}, "string");
|
|
254
|
+
function xt(e) {
|
|
255
|
+
return b({
|
|
281
256
|
eventType: p(),
|
|
282
257
|
eventData: (t) => t
|
|
283
258
|
}).parse(e);
|
|
284
259
|
}
|
|
285
|
-
function
|
|
260
|
+
function be() {
|
|
286
261
|
["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
|
|
287
262
|
delete window[e];
|
|
288
263
|
});
|
|
@@ -294,7 +269,7 @@ function Y(e, t) {
|
|
|
294
269
|
source: window.parent
|
|
295
270
|
}));
|
|
296
271
|
}
|
|
297
|
-
function
|
|
272
|
+
function ve() {
|
|
298
273
|
[
|
|
299
274
|
["TelegramGameProxy_receiveEvent"],
|
|
300
275
|
// Windows Phone.
|
|
@@ -313,48 +288,38 @@ function Ee() {
|
|
|
313
288
|
});
|
|
314
289
|
});
|
|
315
290
|
}
|
|
316
|
-
const
|
|
317
|
-
clipboard_text_received:
|
|
291
|
+
const ye = {
|
|
292
|
+
clipboard_text_received: b({
|
|
318
293
|
req_id: p(),
|
|
319
294
|
data: (e) => e === null ? e : p().optional().parse(e)
|
|
320
295
|
}),
|
|
321
|
-
custom_method_invoked:
|
|
296
|
+
custom_method_invoked: b({
|
|
322
297
|
req_id: p(),
|
|
323
298
|
result: (e) => e,
|
|
324
299
|
error: p().optional()
|
|
325
300
|
}),
|
|
326
|
-
invoice_closed: f({ slug: p(), status: p() }),
|
|
327
|
-
phone_requested: f({ status: p() }),
|
|
328
301
|
popup_closed: {
|
|
329
302
|
parse(e) {
|
|
330
|
-
return
|
|
303
|
+
return b({
|
|
331
304
|
button_id: (t) => t == null ? void 0 : p().parse(t)
|
|
332
305
|
}).parse(e ?? {});
|
|
333
306
|
}
|
|
334
307
|
},
|
|
335
|
-
|
|
336
|
-
theme_changed: f({
|
|
337
|
-
theme_params: (e) => {
|
|
338
|
-
const t = Ct().optional();
|
|
339
|
-
return Object.entries(et(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
|
|
340
|
-
}
|
|
341
|
-
}),
|
|
342
|
-
viewport_changed: f({
|
|
308
|
+
viewport_changed: b({
|
|
343
309
|
height: P(),
|
|
344
310
|
width: (e) => e == null ? window.innerWidth : P().parse(e),
|
|
345
311
|
is_state_stable: y(),
|
|
346
312
|
is_expanded: y()
|
|
347
|
-
})
|
|
348
|
-
write_access_requested: f({ status: p() })
|
|
313
|
+
})
|
|
349
314
|
};
|
|
350
|
-
function
|
|
315
|
+
function Ee() {
|
|
351
316
|
const e = new k(), t = new k();
|
|
352
317
|
t.subscribe((n) => {
|
|
353
318
|
e.emit("event", { name: n.event, payload: n.args[0] });
|
|
354
|
-
}),
|
|
319
|
+
}), ve();
|
|
355
320
|
const [, s] = tt(
|
|
356
321
|
// Don't forget to remove created handlers.
|
|
357
|
-
|
|
322
|
+
be,
|
|
358
323
|
// Add "resize" event listener to make sure, we always have fresh viewport information.
|
|
359
324
|
// Desktop version of Telegram is sometimes not sending the viewport_changed
|
|
360
325
|
// event. For example, when the MainButton is shown. That's why we should
|
|
@@ -375,17 +340,19 @@ function xe() {
|
|
|
375
340
|
return;
|
|
376
341
|
let r;
|
|
377
342
|
try {
|
|
378
|
-
r =
|
|
343
|
+
r = xt(n.data);
|
|
379
344
|
} catch {
|
|
380
345
|
return;
|
|
381
346
|
}
|
|
382
|
-
const { eventType: i, eventData: o } = r, a =
|
|
347
|
+
const { eventType: i, eventData: o } = r, a = ye[i];
|
|
383
348
|
try {
|
|
384
349
|
const h = a ? a.parse(o) : o;
|
|
385
350
|
t.emit(...h ? [i, h] : [i]);
|
|
386
351
|
} catch (h) {
|
|
387
352
|
X.error(
|
|
388
|
-
`An error occurred processing the "${i}" event from the Telegram application.
|
|
353
|
+
`An error occurred processing the "${i}" event from the Telegram application.
|
|
354
|
+
Please, file an issue here:
|
|
355
|
+
https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose`,
|
|
389
356
|
r,
|
|
390
357
|
h
|
|
391
358
|
);
|
|
@@ -409,9 +376,9 @@ function xe() {
|
|
|
409
376
|
}
|
|
410
377
|
}, s];
|
|
411
378
|
}
|
|
412
|
-
const [
|
|
379
|
+
const [Pe, xe] = bt(
|
|
413
380
|
(e) => {
|
|
414
|
-
const [t, s] =
|
|
381
|
+
const [t, s] = Ee(), n = t.off.bind(t);
|
|
415
382
|
return t.off = (r, i) => {
|
|
416
383
|
const { count: o } = t;
|
|
417
384
|
n(r, i), o && !t.count && e();
|
|
@@ -419,19 +386,19 @@ const [Ce, Se] = vt(
|
|
|
419
386
|
},
|
|
420
387
|
([, e]) => e()
|
|
421
388
|
);
|
|
422
|
-
function
|
|
423
|
-
return
|
|
389
|
+
function H() {
|
|
390
|
+
return Pe()[0];
|
|
424
391
|
}
|
|
425
|
-
function
|
|
426
|
-
|
|
392
|
+
function U(e, t) {
|
|
393
|
+
H().off(e, t);
|
|
427
394
|
}
|
|
428
395
|
function v(e, t, s) {
|
|
429
|
-
return
|
|
396
|
+
return H().on(e, t, s);
|
|
430
397
|
}
|
|
431
|
-
function
|
|
398
|
+
function D(e) {
|
|
432
399
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
433
400
|
}
|
|
434
|
-
function
|
|
401
|
+
function Ce(e, t) {
|
|
435
402
|
const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
|
|
436
403
|
for (let i = 0; i < r; i += 1) {
|
|
437
404
|
const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
|
|
@@ -440,21 +407,21 @@ function Te(e, t) {
|
|
|
440
407
|
}
|
|
441
408
|
return 0;
|
|
442
409
|
}
|
|
443
|
-
function
|
|
444
|
-
return
|
|
410
|
+
function w(e, t) {
|
|
411
|
+
return Ce(e, t) <= 0;
|
|
445
412
|
}
|
|
446
413
|
function x(e, t, s) {
|
|
447
414
|
if (typeof s == "string") {
|
|
448
415
|
if (e === "web_app_open_link") {
|
|
449
416
|
if (t === "try_instant_view")
|
|
450
|
-
return
|
|
417
|
+
return w("6.4", s);
|
|
451
418
|
if (t === "try_browser")
|
|
452
|
-
return
|
|
419
|
+
return w("7.6", s);
|
|
453
420
|
}
|
|
454
421
|
if (e === "web_app_set_header_color" && t === "color")
|
|
455
|
-
return
|
|
422
|
+
return w("6.9", s);
|
|
456
423
|
if (e === "web_app_close" && t === "return_back")
|
|
457
|
-
return
|
|
424
|
+
return w("7.6", s);
|
|
458
425
|
}
|
|
459
426
|
switch (e) {
|
|
460
427
|
case "web_app_open_tg_link":
|
|
@@ -463,27 +430,27 @@ function x(e, t, s) {
|
|
|
463
430
|
case "web_app_set_background_color":
|
|
464
431
|
case "web_app_set_header_color":
|
|
465
432
|
case "web_app_trigger_haptic_feedback":
|
|
466
|
-
return
|
|
433
|
+
return w("6.1", t);
|
|
467
434
|
case "web_app_open_popup":
|
|
468
|
-
return
|
|
435
|
+
return w("6.2", t);
|
|
469
436
|
case "web_app_close_scan_qr_popup":
|
|
470
437
|
case "web_app_open_scan_qr_popup":
|
|
471
438
|
case "web_app_read_text_from_clipboard":
|
|
472
|
-
return
|
|
439
|
+
return w("6.4", t);
|
|
473
440
|
case "web_app_switch_inline_query":
|
|
474
|
-
return
|
|
441
|
+
return w("6.7", t);
|
|
475
442
|
case "web_app_invoke_custom_method":
|
|
476
443
|
case "web_app_request_write_access":
|
|
477
444
|
case "web_app_request_phone":
|
|
478
|
-
return
|
|
445
|
+
return w("6.9", t);
|
|
479
446
|
case "web_app_setup_settings_button":
|
|
480
|
-
return
|
|
447
|
+
return w("6.10", t);
|
|
481
448
|
case "web_app_biometry_get_info":
|
|
482
449
|
case "web_app_biometry_open_settings":
|
|
483
450
|
case "web_app_biometry_request_access":
|
|
484
451
|
case "web_app_biometry_request_auth":
|
|
485
452
|
case "web_app_biometry_update_token":
|
|
486
|
-
return
|
|
453
|
+
return w("7.2", t);
|
|
487
454
|
default:
|
|
488
455
|
return [
|
|
489
456
|
"iframe_ready",
|
|
@@ -500,89 +467,88 @@ function x(e, t, s) {
|
|
|
500
467
|
].includes(e);
|
|
501
468
|
}
|
|
502
469
|
}
|
|
503
|
-
function
|
|
504
|
-
return "external" in e &&
|
|
470
|
+
function Ct(e) {
|
|
471
|
+
return "external" in e && D(e.external) && "notify" in e.external && typeof e.external.notify == "function";
|
|
505
472
|
}
|
|
506
|
-
function
|
|
507
|
-
return "TelegramWebviewProxy" in e &&
|
|
473
|
+
function St(e) {
|
|
474
|
+
return "TelegramWebviewProxy" in e && D(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
|
|
508
475
|
}
|
|
509
|
-
function
|
|
476
|
+
function et() {
|
|
510
477
|
try {
|
|
511
478
|
return window.self !== window.top;
|
|
512
479
|
} catch {
|
|
513
480
|
return !0;
|
|
514
481
|
}
|
|
515
482
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
483
|
+
const Se = "https://web.telegram.org";
|
|
484
|
+
let Tt = Se;
|
|
485
|
+
function Qs(e) {
|
|
486
|
+
Tt = e;
|
|
519
487
|
}
|
|
520
|
-
function
|
|
521
|
-
return
|
|
488
|
+
function Te() {
|
|
489
|
+
return Tt;
|
|
522
490
|
}
|
|
523
|
-
function
|
|
491
|
+
function O(e, t, s) {
|
|
524
492
|
let n = {}, r;
|
|
525
|
-
t
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
if (Tt(window)) {
|
|
493
|
+
if (!t && !s ? n = {} : t && s ? (n = s, r = t) : t && ("targetOrigin" in t ? n = t : r = t), he("Posting event:", r ? { event: e, data: r } : { event: e }), et())
|
|
494
|
+
return window.parent.postMessage(
|
|
495
|
+
JSON.stringify({ eventType: e, eventData: r }),
|
|
496
|
+
n.targetOrigin || Te()
|
|
497
|
+
);
|
|
498
|
+
if (Ct(window)) {
|
|
532
499
|
window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
|
|
533
500
|
return;
|
|
534
501
|
}
|
|
535
|
-
if (
|
|
502
|
+
if (St(window)) {
|
|
536
503
|
window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
|
|
537
504
|
return;
|
|
538
505
|
}
|
|
539
|
-
throw
|
|
540
|
-
|
|
541
|
-
"Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside
|
|
506
|
+
throw m(
|
|
507
|
+
le,
|
|
508
|
+
"Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside the Telegram application environment."
|
|
542
509
|
);
|
|
543
510
|
}
|
|
544
|
-
function
|
|
511
|
+
function Re(e) {
|
|
545
512
|
return (t, s) => {
|
|
546
513
|
if (!x(t, e))
|
|
547
|
-
throw
|
|
548
|
-
if (
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
);
|
|
555
|
-
}
|
|
556
|
-
return q(t, s);
|
|
514
|
+
throw m(pe, `Method "${t}" is unsupported in Mini Apps version ${e}`);
|
|
515
|
+
if (D(s) && t === "web_app_set_header_color" && "color" in s && !x(t, "color", e))
|
|
516
|
+
throw m(
|
|
517
|
+
ue,
|
|
518
|
+
`Parameter "color" of "${t}" method is unsupported in Mini Apps version ${e}`
|
|
519
|
+
);
|
|
520
|
+
return O(t, s);
|
|
557
521
|
};
|
|
558
522
|
}
|
|
559
|
-
function
|
|
523
|
+
function Rt(e) {
|
|
560
524
|
return ({ req_id: t }) => t === e;
|
|
561
525
|
}
|
|
562
|
-
function
|
|
563
|
-
return
|
|
526
|
+
function At(e) {
|
|
527
|
+
return m(_e, `Timeout reached: ${e}ms`);
|
|
564
528
|
}
|
|
565
|
-
function
|
|
529
|
+
function It(e, t) {
|
|
566
530
|
return Promise.race([
|
|
567
531
|
typeof e == "function" ? e() : e,
|
|
568
532
|
new Promise((s, n) => {
|
|
569
533
|
setTimeout(() => {
|
|
570
|
-
n(
|
|
534
|
+
n(At(t));
|
|
571
535
|
}, t);
|
|
572
536
|
})
|
|
573
537
|
]);
|
|
574
538
|
}
|
|
575
|
-
async function
|
|
539
|
+
async function f(e) {
|
|
576
540
|
let t;
|
|
577
|
-
const s = new Promise((a) => {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
541
|
+
const s = new Promise((a) => t = a), { event: n, capture: r, timeout: i } = e, [, o] = tt(
|
|
542
|
+
// We need to iterate over all tracked events, and create their event listeners.
|
|
543
|
+
(Array.isArray(n) ? n : [n]).map((a) => v(a, (h) => {
|
|
544
|
+
(!r || (Array.isArray(n) ? r({
|
|
545
|
+
event: a,
|
|
546
|
+
payload: h
|
|
547
|
+
}) : r(h))) && t(h);
|
|
548
|
+
}))
|
|
583
549
|
);
|
|
584
550
|
try {
|
|
585
|
-
return (e.postEvent ||
|
|
551
|
+
return (e.postEvent || O)(e.method, e.params), await (i ? It(s, i) : s);
|
|
586
552
|
} finally {
|
|
587
553
|
o();
|
|
588
554
|
}
|
|
@@ -591,7 +557,7 @@ async function A(e, t, s, n = {}) {
|
|
|
591
557
|
const {
|
|
592
558
|
result: r,
|
|
593
559
|
error: i
|
|
594
|
-
} = await
|
|
560
|
+
} = await f({
|
|
595
561
|
...n,
|
|
596
562
|
method: "web_app_invoke_custom_method",
|
|
597
563
|
event: "custom_method_invoked",
|
|
@@ -600,30 +566,54 @@ async function A(e, t, s, n = {}) {
|
|
|
600
566
|
params: t,
|
|
601
567
|
req_id: s
|
|
602
568
|
},
|
|
603
|
-
capture:
|
|
569
|
+
capture: Rt(s)
|
|
604
570
|
});
|
|
605
571
|
if (i)
|
|
606
|
-
throw
|
|
572
|
+
throw m(de, i);
|
|
607
573
|
return r;
|
|
608
574
|
}
|
|
609
575
|
function Z(...e) {
|
|
610
576
|
return e.map((t) => {
|
|
611
577
|
if (typeof t == "string")
|
|
612
578
|
return t;
|
|
613
|
-
if (
|
|
579
|
+
if (D(t))
|
|
614
580
|
return Z(Object.entries(t).map((s) => s[1] && s[0]));
|
|
615
581
|
if (Array.isArray(t))
|
|
616
582
|
return Z(...t);
|
|
617
583
|
}).filter(Boolean).join(" ");
|
|
618
584
|
}
|
|
619
|
-
function
|
|
620
|
-
return e.reduce((t, s) => (
|
|
585
|
+
function Ys(...e) {
|
|
586
|
+
return e.reduce((t, s) => (D(s) && Object.entries(s).forEach(([n, r]) => {
|
|
621
587
|
const i = Z(t[n], r);
|
|
622
588
|
i.length && (t[n] = i);
|
|
623
589
|
}), t), {});
|
|
624
590
|
}
|
|
591
|
+
function st(e) {
|
|
592
|
+
return /^#[\da-f]{6}$/i.test(e);
|
|
593
|
+
}
|
|
594
|
+
function Ae(e) {
|
|
595
|
+
return /^#[\da-f]{3}$/i.test(e);
|
|
596
|
+
}
|
|
597
|
+
function kt(e) {
|
|
598
|
+
const t = e.replace(/\s/g, "").toLowerCase();
|
|
599
|
+
if (st(t))
|
|
600
|
+
return t;
|
|
601
|
+
if (Ae(t)) {
|
|
602
|
+
let n = "#";
|
|
603
|
+
for (let r = 0; r < 3; r += 1)
|
|
604
|
+
n += t[1 + r].repeat(2);
|
|
605
|
+
return n;
|
|
606
|
+
}
|
|
607
|
+
const s = t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/) || t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);
|
|
608
|
+
if (!s)
|
|
609
|
+
throw new Error(`Value "${e}" does not satisfy any of known RGB formats.`);
|
|
610
|
+
return s.slice(1).reduce((n, r) => {
|
|
611
|
+
const i = parseInt(r, 10).toString(16);
|
|
612
|
+
return n + (i.length === 1 ? "0" : "") + i;
|
|
613
|
+
}, "#");
|
|
614
|
+
}
|
|
625
615
|
function Ot(e) {
|
|
626
|
-
const t =
|
|
616
|
+
const t = kt(e);
|
|
627
617
|
return Math.sqrt(
|
|
628
618
|
[0.299, 0.587, 0.114].reduce((s, n, r) => {
|
|
629
619
|
const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
|
|
@@ -652,25 +642,25 @@ class Ie {
|
|
|
652
642
|
return this.state[t];
|
|
653
643
|
}
|
|
654
644
|
}
|
|
655
|
-
class
|
|
645
|
+
class nt {
|
|
656
646
|
constructor(t) {
|
|
657
647
|
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);
|
|
658
648
|
}
|
|
659
649
|
}
|
|
660
|
-
function
|
|
650
|
+
function qt(e, t) {
|
|
661
651
|
return (s) => x(t[s], e);
|
|
662
652
|
}
|
|
663
|
-
class
|
|
653
|
+
class rt extends nt {
|
|
664
654
|
constructor(t, s, n) {
|
|
665
|
-
super(t), c(this, "supports"), this.supports =
|
|
655
|
+
super(t), c(this, "supports"), this.supports = qt(s, n);
|
|
666
656
|
}
|
|
667
657
|
}
|
|
668
|
-
class ke extends
|
|
658
|
+
class ke extends rt {
|
|
669
659
|
constructor(t, s, n) {
|
|
670
660
|
super({ isVisible: t }, s, {
|
|
671
661
|
show: "web_app_setup_back_button",
|
|
672
662
|
hide: "web_app_setup_back_button"
|
|
673
|
-
}), c(this, "on", (r, i) => r === "click" ? v("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ?
|
|
663
|
+
}), c(this, "on", (r, i) => r === "click" ? v("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? U("back_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
|
|
674
664
|
}
|
|
675
665
|
set isVisible(t) {
|
|
676
666
|
this.set("isVisible", t), this.postEvent("web_app_setup_back_button", { is_visible: t });
|
|
@@ -694,19 +684,19 @@ class ke extends it {
|
|
|
694
684
|
this.isVisible = !0;
|
|
695
685
|
}
|
|
696
686
|
}
|
|
697
|
-
const
|
|
698
|
-
function
|
|
687
|
+
const Nt = T((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
|
|
688
|
+
function it(e, t) {
|
|
699
689
|
return new L((s) => {
|
|
700
690
|
if (typeof s != "string" && !(s instanceof URLSearchParams))
|
|
701
691
|
throw S();
|
|
702
692
|
const n = typeof s == "string" ? new URLSearchParams(s) : s;
|
|
703
|
-
return
|
|
693
|
+
return Et(e, (r) => {
|
|
704
694
|
const i = n.get(r);
|
|
705
695
|
return i === null ? void 0 : i;
|
|
706
696
|
});
|
|
707
697
|
}, !1, t);
|
|
708
698
|
}
|
|
709
|
-
const
|
|
699
|
+
const Oe = b({
|
|
710
700
|
id: P(),
|
|
711
701
|
type: p(),
|
|
712
702
|
title: p(),
|
|
@@ -715,7 +705,7 @@ const qe = f({
|
|
|
715
705
|
from: "photo_url"
|
|
716
706
|
},
|
|
717
707
|
username: p().optional()
|
|
718
|
-
}, "Chat").optional(),
|
|
708
|
+
}, "Chat").optional(), gt = b({
|
|
719
709
|
addedToAttachmentMenu: {
|
|
720
710
|
type: y().optional(),
|
|
721
711
|
from: "added_to_attachment_menu"
|
|
@@ -751,17 +741,17 @@ const qe = f({
|
|
|
751
741
|
},
|
|
752
742
|
username: p().optional()
|
|
753
743
|
}, "User").optional();
|
|
754
|
-
function
|
|
755
|
-
return
|
|
744
|
+
function Dt() {
|
|
745
|
+
return it({
|
|
756
746
|
authDate: {
|
|
757
|
-
type:
|
|
747
|
+
type: Nt(),
|
|
758
748
|
from: "auth_date"
|
|
759
749
|
},
|
|
760
750
|
canSendAfter: {
|
|
761
751
|
type: P().optional(),
|
|
762
752
|
from: "can_send_after"
|
|
763
753
|
},
|
|
764
|
-
chat:
|
|
754
|
+
chat: Oe,
|
|
765
755
|
chatInstance: {
|
|
766
756
|
type: p().optional(),
|
|
767
757
|
from: "chat_instance"
|
|
@@ -775,35 +765,36 @@ function Vt() {
|
|
|
775
765
|
type: p().optional(),
|
|
776
766
|
from: "query_id"
|
|
777
767
|
},
|
|
778
|
-
receiver:
|
|
768
|
+
receiver: gt,
|
|
779
769
|
startParam: {
|
|
780
770
|
type: p().optional(),
|
|
781
771
|
from: "start_param"
|
|
782
772
|
},
|
|
783
|
-
user:
|
|
773
|
+
user: gt
|
|
784
774
|
}, "InitData");
|
|
785
775
|
}
|
|
786
|
-
|
|
776
|
+
const qe = T((e) => kt(p().parse(e)), "rgb");
|
|
777
|
+
function Ne(e) {
|
|
787
778
|
return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
788
779
|
}
|
|
789
|
-
function
|
|
780
|
+
function De(e) {
|
|
790
781
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
791
782
|
}
|
|
792
|
-
const
|
|
783
|
+
const Vt = T(
|
|
793
784
|
(e) => {
|
|
794
|
-
const t =
|
|
795
|
-
return Object.entries(
|
|
785
|
+
const t = qe().optional();
|
|
786
|
+
return Object.entries(Pt(e)).reduce((s, [n, r]) => (s[Ne(n)] = t.parse(r), s), {});
|
|
796
787
|
},
|
|
797
788
|
"ThemeParams"
|
|
798
789
|
);
|
|
799
|
-
function
|
|
800
|
-
return
|
|
790
|
+
function ot(e) {
|
|
791
|
+
return it({
|
|
801
792
|
botInline: {
|
|
802
793
|
type: y().optional(),
|
|
803
794
|
from: "tgWebAppBotInline"
|
|
804
795
|
},
|
|
805
796
|
initData: {
|
|
806
|
-
type:
|
|
797
|
+
type: Dt().optional(),
|
|
807
798
|
from: "tgWebAppData"
|
|
808
799
|
},
|
|
809
800
|
initDataRaw: {
|
|
@@ -823,7 +814,7 @@ function at(e) {
|
|
|
823
814
|
from: "tgWebAppStartParam"
|
|
824
815
|
},
|
|
825
816
|
themeParams: {
|
|
826
|
-
type:
|
|
817
|
+
type: Vt(),
|
|
827
818
|
from: "tgWebAppThemeParams"
|
|
828
819
|
},
|
|
829
820
|
version: {
|
|
@@ -832,47 +823,47 @@ function at(e) {
|
|
|
832
823
|
}
|
|
833
824
|
}).parse(e);
|
|
834
825
|
}
|
|
835
|
-
function
|
|
836
|
-
return
|
|
826
|
+
function Mt(e) {
|
|
827
|
+
return ot(
|
|
837
828
|
e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
|
|
838
829
|
);
|
|
839
830
|
}
|
|
840
|
-
function
|
|
841
|
-
return
|
|
831
|
+
function Ve() {
|
|
832
|
+
return Mt(window.location.href);
|
|
842
833
|
}
|
|
843
|
-
function
|
|
834
|
+
function Bt() {
|
|
844
835
|
return performance.getEntriesByType("navigation")[0];
|
|
845
836
|
}
|
|
846
|
-
function
|
|
847
|
-
const e =
|
|
837
|
+
function Me() {
|
|
838
|
+
const e = Bt();
|
|
848
839
|
if (!e)
|
|
849
840
|
throw new Error("Unable to get first navigation entry.");
|
|
850
|
-
return
|
|
841
|
+
return Mt(e.name);
|
|
851
842
|
}
|
|
852
|
-
function
|
|
843
|
+
function $t(e) {
|
|
853
844
|
return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
|
|
854
845
|
}
|
|
855
|
-
function
|
|
856
|
-
sessionStorage.setItem(
|
|
846
|
+
function Lt(e, t) {
|
|
847
|
+
sessionStorage.setItem($t(e), JSON.stringify(t));
|
|
857
848
|
}
|
|
858
849
|
function Ht(e) {
|
|
859
|
-
const t = sessionStorage.getItem(
|
|
850
|
+
const t = sessionStorage.getItem($t(e));
|
|
860
851
|
try {
|
|
861
852
|
return t ? JSON.parse(t) : void 0;
|
|
862
853
|
} catch {
|
|
863
854
|
}
|
|
864
855
|
}
|
|
865
|
-
function
|
|
866
|
-
return
|
|
856
|
+
function Be() {
|
|
857
|
+
return ot(Ht("launchParams") || "");
|
|
867
858
|
}
|
|
868
|
-
function
|
|
859
|
+
function Ut(e) {
|
|
869
860
|
return JSON.stringify(
|
|
870
861
|
Object.fromEntries(
|
|
871
|
-
Object.entries(e).map(([t, s]) => [
|
|
862
|
+
Object.entries(e).map(([t, s]) => [De(t), s])
|
|
872
863
|
)
|
|
873
864
|
);
|
|
874
865
|
}
|
|
875
|
-
function
|
|
866
|
+
function $e(e) {
|
|
876
867
|
const {
|
|
877
868
|
initDataRaw: t,
|
|
878
869
|
themeParams: s,
|
|
@@ -882,42 +873,42 @@ function Be(e) {
|
|
|
882
873
|
startParam: o,
|
|
883
874
|
botInline: a
|
|
884
875
|
} = e, h = new URLSearchParams();
|
|
885
|
-
return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams",
|
|
876
|
+
return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams", Ut(s)), h.set("tgWebAppVersion", r), t && h.set("tgWebAppData", t), o && h.set("tgWebAppStartParam", o), typeof i == "boolean" && h.set("tgWebAppShowSettings", i ? "1" : "0"), typeof a == "boolean" && h.set("tgWebAppBotInline", a ? "1" : "0"), h.toString();
|
|
886
877
|
}
|
|
887
|
-
function
|
|
888
|
-
|
|
878
|
+
function Wt(e) {
|
|
879
|
+
Lt("launchParams", $e(e));
|
|
889
880
|
}
|
|
890
|
-
function
|
|
881
|
+
function Le() {
|
|
891
882
|
for (const e of [
|
|
892
883
|
// Try to retrieve launch parameters from the current location. This method can return
|
|
893
884
|
// nothing in case, location was changed and then page was reloaded.
|
|
894
|
-
De,
|
|
895
|
-
// Then, try using the lower level API - window.performance.
|
|
896
885
|
Ve,
|
|
886
|
+
// Then, try using the lower level API - window.performance.
|
|
887
|
+
Me,
|
|
897
888
|
// Finally, try to extract launch parameters from the session storage.
|
|
898
|
-
|
|
889
|
+
Be
|
|
899
890
|
])
|
|
900
891
|
try {
|
|
901
892
|
const t = e();
|
|
902
|
-
return
|
|
893
|
+
return Wt(t), t;
|
|
903
894
|
} catch {
|
|
904
895
|
}
|
|
905
896
|
throw new Error("Unable to retrieve launch parameters from any known source.");
|
|
906
897
|
}
|
|
907
898
|
function Gt() {
|
|
908
|
-
const e =
|
|
899
|
+
const e = Bt();
|
|
909
900
|
return !!(e && e.type === "reload");
|
|
910
901
|
}
|
|
911
|
-
function
|
|
902
|
+
function He() {
|
|
912
903
|
let e = 0;
|
|
913
904
|
return () => (e += 1).toString();
|
|
914
905
|
}
|
|
915
|
-
const [Ue] =
|
|
906
|
+
const [Ue] = bt(He);
|
|
916
907
|
function d(e, t) {
|
|
917
908
|
return () => {
|
|
918
|
-
const s =
|
|
909
|
+
const s = Le(), n = {
|
|
919
910
|
...s,
|
|
920
|
-
postEvent:
|
|
911
|
+
postEvent: Re(s.version),
|
|
921
912
|
createRequestId: Ue()
|
|
922
913
|
};
|
|
923
914
|
if (typeof e == "function")
|
|
@@ -931,7 +922,7 @@ function d(e, t) {
|
|
|
931
922
|
addCleanup: r
|
|
932
923
|
}), h = (u) => (o || r(
|
|
933
924
|
u.on("change", (l) => {
|
|
934
|
-
|
|
925
|
+
Lt(e, l);
|
|
935
926
|
})
|
|
936
927
|
), u);
|
|
937
928
|
return [
|
|
@@ -940,17 +931,17 @@ function d(e, t) {
|
|
|
940
931
|
];
|
|
941
932
|
};
|
|
942
933
|
}
|
|
943
|
-
const
|
|
934
|
+
const We = d("backButton", ({
|
|
944
935
|
postEvent: e,
|
|
945
936
|
version: t,
|
|
946
937
|
state: s = { isVisible: !1 }
|
|
947
938
|
}) => new ke(s.isVisible, t, e));
|
|
948
|
-
class
|
|
939
|
+
class V extends rt {
|
|
949
940
|
constructor() {
|
|
950
941
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
951
942
|
}
|
|
952
943
|
}
|
|
953
|
-
function
|
|
944
|
+
function jt(e) {
|
|
954
945
|
const t = e.available ? e : {
|
|
955
946
|
available: !1,
|
|
956
947
|
device_id: "",
|
|
@@ -968,7 +959,7 @@ function Kt(e) {
|
|
|
968
959
|
accessGranted: t.access_granted
|
|
969
960
|
};
|
|
970
961
|
}
|
|
971
|
-
class
|
|
962
|
+
class Ge extends V {
|
|
972
963
|
constructor({ postEvent: t, version: s, ...n }) {
|
|
973
964
|
super(n, s, {
|
|
974
965
|
auth: "web_app_biometry_request_auth",
|
|
@@ -1005,7 +996,7 @@ class We extends D {
|
|
|
1005
996
|
reason: t,
|
|
1006
997
|
...s
|
|
1007
998
|
}) {
|
|
1008
|
-
return this.authPromise || (this.authPromise =
|
|
999
|
+
return this.authPromise || (this.authPromise = f({
|
|
1009
1000
|
...s,
|
|
1010
1001
|
method: "web_app_biometry_request_auth",
|
|
1011
1002
|
event: "biometry_auth_requested",
|
|
@@ -1039,14 +1030,14 @@ class We extends D {
|
|
|
1039
1030
|
* @returns Promise with true, if access was granted.
|
|
1040
1031
|
*/
|
|
1041
1032
|
requestAccess({ reason: t, ...s } = {}) {
|
|
1042
|
-
return this.accessPromise || (this.accessPromise =
|
|
1033
|
+
return this.accessPromise || (this.accessPromise = f({
|
|
1043
1034
|
...s,
|
|
1044
1035
|
postEvent: this.postEvent,
|
|
1045
1036
|
method: "web_app_biometry_request_access",
|
|
1046
1037
|
event: "biometry_info_received",
|
|
1047
1038
|
params: { reason: t || "" }
|
|
1048
1039
|
}).then((n) => {
|
|
1049
|
-
const r =
|
|
1040
|
+
const r = jt(n);
|
|
1050
1041
|
return this.set(r), r.accessGranted;
|
|
1051
1042
|
}).finally(() => this.accessPromise = void 0)), this.accessPromise;
|
|
1052
1043
|
}
|
|
@@ -1068,7 +1059,7 @@ class We extends D {
|
|
|
1068
1059
|
*/
|
|
1069
1060
|
async updateToken({ token: t, ...s } = {}) {
|
|
1070
1061
|
return ["removed", "updated"].includes(
|
|
1071
|
-
(await
|
|
1062
|
+
(await f({
|
|
1072
1063
|
...s,
|
|
1073
1064
|
postEvent: this.postEvent,
|
|
1074
1065
|
method: "web_app_biometry_update_token",
|
|
@@ -1079,17 +1070,17 @@ class We extends D {
|
|
|
1079
1070
|
}
|
|
1080
1071
|
}
|
|
1081
1072
|
async function je(e) {
|
|
1082
|
-
return
|
|
1083
|
-
await
|
|
1073
|
+
return jt(
|
|
1074
|
+
await f({
|
|
1084
1075
|
...e || {},
|
|
1085
1076
|
method: "web_app_biometry_get_info",
|
|
1086
1077
|
event: "biometry_info_received"
|
|
1087
1078
|
})
|
|
1088
1079
|
);
|
|
1089
1080
|
}
|
|
1090
|
-
const
|
|
1081
|
+
const Ke = d(
|
|
1091
1082
|
"biometryManager",
|
|
1092
|
-
async ({ postEvent: e, version: t, state: s }) => new
|
|
1083
|
+
async ({ postEvent: e, version: t, state: s }) => new Ge({
|
|
1093
1084
|
...s || x("web_app_biometry_get_info", t) ? s || await je({ timeout: 1e3 }) : {
|
|
1094
1085
|
available: !1,
|
|
1095
1086
|
accessGranted: !1,
|
|
@@ -1101,12 +1092,12 @@ const Ge = d(
|
|
|
1101
1092
|
postEvent: e
|
|
1102
1093
|
})
|
|
1103
1094
|
);
|
|
1104
|
-
class
|
|
1095
|
+
class at extends nt {
|
|
1105
1096
|
constructor() {
|
|
1106
1097
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
1107
1098
|
}
|
|
1108
1099
|
}
|
|
1109
|
-
class
|
|
1100
|
+
class ze extends at {
|
|
1110
1101
|
constructor(t, s) {
|
|
1111
1102
|
super({ isConfirmationNeeded: t }), this.postEvent = s;
|
|
1112
1103
|
}
|
|
@@ -1133,19 +1124,19 @@ class Ke extends ct {
|
|
|
1133
1124
|
this.isConfirmationNeeded = !0;
|
|
1134
1125
|
}
|
|
1135
1126
|
}
|
|
1136
|
-
const
|
|
1127
|
+
const Je = d(
|
|
1137
1128
|
"closingBehavior",
|
|
1138
1129
|
({
|
|
1139
1130
|
postEvent: e,
|
|
1140
1131
|
state: t = { isConfirmationNeeded: !1 }
|
|
1141
|
-
}) => new
|
|
1132
|
+
}) => new ze(t.isConfirmationNeeded, e)
|
|
1142
1133
|
);
|
|
1143
|
-
class
|
|
1134
|
+
class ct {
|
|
1144
1135
|
constructor(t, s) {
|
|
1145
|
-
c(this, "supports"), this.supports =
|
|
1136
|
+
c(this, "supports"), this.supports = qt(t, s);
|
|
1146
1137
|
}
|
|
1147
1138
|
}
|
|
1148
|
-
function
|
|
1139
|
+
function Fe(e) {
|
|
1149
1140
|
if (Array.isArray(e))
|
|
1150
1141
|
return e;
|
|
1151
1142
|
if (typeof e == "string")
|
|
@@ -1157,9 +1148,9 @@ function Je(e) {
|
|
|
1157
1148
|
}
|
|
1158
1149
|
throw S();
|
|
1159
1150
|
}
|
|
1160
|
-
class
|
|
1151
|
+
class Qe extends L {
|
|
1161
1152
|
constructor(t, s, n) {
|
|
1162
|
-
super(
|
|
1153
|
+
super(Fe, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
|
|
1163
1154
|
}
|
|
1164
1155
|
/**
|
|
1165
1156
|
* Attempts to parse passed value
|
|
@@ -1175,13 +1166,13 @@ class Fe extends L {
|
|
|
1175
1166
|
return this.itemParser = typeof t == "function" ? t : t.parse.bind(t), this;
|
|
1176
1167
|
}
|
|
1177
1168
|
}
|
|
1178
|
-
function
|
|
1179
|
-
return new
|
|
1169
|
+
function Ye(e) {
|
|
1170
|
+
return new Qe((t) => t, !1, e);
|
|
1180
1171
|
}
|
|
1181
|
-
function
|
|
1172
|
+
function ft(e, t) {
|
|
1182
1173
|
return Object.fromEntries(e.map((s) => [s, t]));
|
|
1183
1174
|
}
|
|
1184
|
-
class
|
|
1175
|
+
class Ze extends ct {
|
|
1185
1176
|
constructor(t, s, n) {
|
|
1186
1177
|
super(t, {
|
|
1187
1178
|
delete: "web_app_invoke_custom_method",
|
|
@@ -1209,7 +1200,7 @@ class Ye extends ht {
|
|
|
1209
1200
|
* @param options - request execution options.
|
|
1210
1201
|
*/
|
|
1211
1202
|
async getKeys(t = {}) {
|
|
1212
|
-
return
|
|
1203
|
+
return Ye().of(p()).parse(
|
|
1213
1204
|
await A(
|
|
1214
1205
|
"getStorageKeys",
|
|
1215
1206
|
{},
|
|
@@ -1221,13 +1212,13 @@ class Ye extends ht {
|
|
|
1221
1212
|
async get(t, s = {}) {
|
|
1222
1213
|
const n = Array.isArray(t) ? t : [t];
|
|
1223
1214
|
if (!n.length)
|
|
1224
|
-
return
|
|
1215
|
+
return ft(n, "");
|
|
1225
1216
|
const r = await A(
|
|
1226
1217
|
"getStorageValues",
|
|
1227
1218
|
{ keys: n },
|
|
1228
1219
|
this.createRequestId(),
|
|
1229
1220
|
{ ...s, postEvent: this.postEvent }
|
|
1230
|
-
), i =
|
|
1221
|
+
), i = b(ft(n, p()), "CloudStorageData").parse(r);
|
|
1231
1222
|
return Array.isArray(t) ? i : i[t];
|
|
1232
1223
|
}
|
|
1233
1224
|
/**
|
|
@@ -1245,10 +1236,10 @@ class Ye extends ht {
|
|
|
1245
1236
|
);
|
|
1246
1237
|
}
|
|
1247
1238
|
}
|
|
1248
|
-
const
|
|
1249
|
-
({ createRequestId: e, postEvent: t, version: s }) => new
|
|
1239
|
+
const Xe = d(
|
|
1240
|
+
({ createRequestId: e, postEvent: t, version: s }) => new Ze(s, e, t)
|
|
1250
1241
|
);
|
|
1251
|
-
class
|
|
1242
|
+
class ts extends ct {
|
|
1252
1243
|
constructor(t, s) {
|
|
1253
1244
|
super(t, {
|
|
1254
1245
|
impactOccurred: "web_app_trigger_haptic_feedback",
|
|
@@ -1290,10 +1281,10 @@ class Xe extends ht {
|
|
|
1290
1281
|
this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
|
|
1291
1282
|
}
|
|
1292
1283
|
}
|
|
1293
|
-
const
|
|
1294
|
-
({ version: e, postEvent: t }) => new
|
|
1284
|
+
const es = d(
|
|
1285
|
+
({ version: e, postEvent: t }) => new ts(e, t)
|
|
1295
1286
|
);
|
|
1296
|
-
class
|
|
1287
|
+
class ss {
|
|
1297
1288
|
constructor(t) {
|
|
1298
1289
|
this.initData = t;
|
|
1299
1290
|
}
|
|
@@ -1366,13 +1357,13 @@ class es {
|
|
|
1366
1357
|
return this.initData.user;
|
|
1367
1358
|
}
|
|
1368
1359
|
}
|
|
1369
|
-
const
|
|
1370
|
-
({ initData: e }) => e ? new
|
|
1360
|
+
const ns = d(
|
|
1361
|
+
({ initData: e }) => e ? new ss(e) : void 0
|
|
1371
1362
|
);
|
|
1372
|
-
function
|
|
1373
|
-
return
|
|
1363
|
+
function Zs(e) {
|
|
1364
|
+
return Dt().parse(e);
|
|
1374
1365
|
}
|
|
1375
|
-
class
|
|
1366
|
+
class rs extends V {
|
|
1376
1367
|
constructor(t, s, n) {
|
|
1377
1368
|
super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
|
|
1378
1369
|
}
|
|
@@ -1402,7 +1393,7 @@ class ns extends D {
|
|
|
1402
1393
|
}
|
|
1403
1394
|
this.isOpened = !0;
|
|
1404
1395
|
try {
|
|
1405
|
-
return (await
|
|
1396
|
+
return (await f({
|
|
1406
1397
|
method: "web_app_open_invoice",
|
|
1407
1398
|
event: "invoice_closed",
|
|
1408
1399
|
params: { slug: n },
|
|
@@ -1416,12 +1407,12 @@ class ns extends D {
|
|
|
1416
1407
|
}
|
|
1417
1408
|
}
|
|
1418
1409
|
}
|
|
1419
|
-
const
|
|
1420
|
-
({ version: e, postEvent: t }) => new
|
|
1410
|
+
const is = d(
|
|
1411
|
+
({ version: e, postEvent: t }) => new rs(!1, e, t)
|
|
1421
1412
|
);
|
|
1422
|
-
class
|
|
1413
|
+
class os extends nt {
|
|
1423
1414
|
constructor({ postEvent: t, ...s }) {
|
|
1424
|
-
super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? v("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ?
|
|
1415
|
+
super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? v("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? U("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
|
|
1425
1416
|
}
|
|
1426
1417
|
/**
|
|
1427
1418
|
* The MainButton background color.
|
|
@@ -1550,7 +1541,7 @@ class is extends rt {
|
|
|
1550
1541
|
return this.get("textColor");
|
|
1551
1542
|
}
|
|
1552
1543
|
}
|
|
1553
|
-
const
|
|
1544
|
+
const as = d(
|
|
1554
1545
|
"mainButton",
|
|
1555
1546
|
({
|
|
1556
1547
|
postEvent: e,
|
|
@@ -1563,11 +1554,11 @@ const os = d(
|
|
|
1563
1554
|
textColor: t.buttonTextColor || "#ffffff",
|
|
1564
1555
|
bgColor: t.buttonColor || "#000000"
|
|
1565
1556
|
}
|
|
1566
|
-
}) => new
|
|
1557
|
+
}) => new os({ ...s, postEvent: e })
|
|
1567
1558
|
);
|
|
1568
|
-
function
|
|
1569
|
-
return
|
|
1570
|
-
contact:
|
|
1559
|
+
function cs() {
|
|
1560
|
+
return it({
|
|
1561
|
+
contact: b({
|
|
1571
1562
|
userId: {
|
|
1572
1563
|
type: P(),
|
|
1573
1564
|
from: "user_id"
|
|
@@ -1586,24 +1577,24 @@ function as() {
|
|
|
1586
1577
|
}
|
|
1587
1578
|
}),
|
|
1588
1579
|
authDate: {
|
|
1589
|
-
type:
|
|
1580
|
+
type: Nt(),
|
|
1590
1581
|
from: "auth_date"
|
|
1591
1582
|
},
|
|
1592
1583
|
hash: p()
|
|
1593
1584
|
}, "RequestedContact");
|
|
1594
1585
|
}
|
|
1595
|
-
function
|
|
1586
|
+
function Kt(e, t) {
|
|
1596
1587
|
return (s) => {
|
|
1597
1588
|
const [n, r] = t[s];
|
|
1598
1589
|
return x(n, r, e);
|
|
1599
1590
|
};
|
|
1600
1591
|
}
|
|
1601
|
-
function
|
|
1592
|
+
function hs(e) {
|
|
1602
1593
|
return new Promise((t) => {
|
|
1603
1594
|
setTimeout(t, e);
|
|
1604
1595
|
});
|
|
1605
1596
|
}
|
|
1606
|
-
class
|
|
1597
|
+
class ps extends V {
|
|
1607
1598
|
constructor({ postEvent: t, createRequestId: s, version: n, botInline: r, ...i }) {
|
|
1608
1599
|
super(i, n, {
|
|
1609
1600
|
requestPhoneAccess: "web_app_request_phone",
|
|
@@ -1613,7 +1604,7 @@ class hs extends D {
|
|
|
1613
1604
|
setBackgroundColor: "web_app_set_background_color"
|
|
1614
1605
|
}), 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;
|
|
1615
1606
|
const o = this.supports.bind(this);
|
|
1616
|
-
this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam =
|
|
1607
|
+
this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = Kt(n, {
|
|
1617
1608
|
"setHeaderColor.color": ["web_app_set_header_color", "color"]
|
|
1618
1609
|
});
|
|
1619
1610
|
}
|
|
@@ -1624,7 +1615,7 @@ class hs extends D {
|
|
|
1624
1615
|
async getRequestedContact({
|
|
1625
1616
|
timeout: t = 1e4
|
|
1626
1617
|
} = {}) {
|
|
1627
|
-
return
|
|
1618
|
+
return cs().parse(
|
|
1628
1619
|
await A(
|
|
1629
1620
|
"getRequestedContact",
|
|
1630
1621
|
{},
|
|
@@ -1642,9 +1633,10 @@ class hs extends D {
|
|
|
1642
1633
|
}
|
|
1643
1634
|
/**
|
|
1644
1635
|
* Closes the Mini App.
|
|
1636
|
+
* @param returnBack - should the application be wrapped into the bottom bar.
|
|
1645
1637
|
*/
|
|
1646
|
-
close() {
|
|
1647
|
-
this.postEvent("web_app_close");
|
|
1638
|
+
close(t) {
|
|
1639
|
+
this.postEvent("web_app_close", { return_back: t });
|
|
1648
1640
|
}
|
|
1649
1641
|
/**
|
|
1650
1642
|
* The Mini App header color.
|
|
@@ -1661,7 +1653,7 @@ class hs extends D {
|
|
|
1661
1653
|
return this.botInline;
|
|
1662
1654
|
}
|
|
1663
1655
|
/**
|
|
1664
|
-
* True if current Mini App background color is recognized as dark.
|
|
1656
|
+
* True if the current Mini App background color is recognized as dark.
|
|
1665
1657
|
*/
|
|
1666
1658
|
get isDark() {
|
|
1667
1659
|
return Ot(this.bgColor);
|
|
@@ -1693,15 +1685,15 @@ class hs extends D {
|
|
|
1693
1685
|
throw new Error("Access denied.");
|
|
1694
1686
|
const s = Date.now() + t;
|
|
1695
1687
|
let n = 50;
|
|
1696
|
-
return
|
|
1688
|
+
return It(async () => {
|
|
1697
1689
|
for (; Date.now() < s; ) {
|
|
1698
1690
|
try {
|
|
1699
1691
|
return await this.getRequestedContact();
|
|
1700
1692
|
} catch {
|
|
1701
1693
|
}
|
|
1702
|
-
await
|
|
1694
|
+
await hs(n), n += 50;
|
|
1703
1695
|
}
|
|
1704
|
-
throw
|
|
1696
|
+
throw At(t);
|
|
1705
1697
|
}, t);
|
|
1706
1698
|
}
|
|
1707
1699
|
/**
|
|
@@ -1714,7 +1706,7 @@ class hs extends D {
|
|
|
1714
1706
|
* @see requestContact
|
|
1715
1707
|
*/
|
|
1716
1708
|
async requestPhoneAccess(t = {}) {
|
|
1717
|
-
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise =
|
|
1709
|
+
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = f({
|
|
1718
1710
|
...t,
|
|
1719
1711
|
method: "web_app_request_phone",
|
|
1720
1712
|
event: "phone_requested",
|
|
@@ -1726,7 +1718,7 @@ class hs extends D {
|
|
|
1726
1718
|
* @param options - additional options.
|
|
1727
1719
|
*/
|
|
1728
1720
|
async requestWriteAccess(t = {}) {
|
|
1729
|
-
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise =
|
|
1721
|
+
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = f({
|
|
1730
1722
|
...t,
|
|
1731
1723
|
method: "web_app_request_write_access",
|
|
1732
1724
|
event: "write_access_requested",
|
|
@@ -1784,7 +1776,7 @@ class hs extends D {
|
|
|
1784
1776
|
this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
|
|
1785
1777
|
}
|
|
1786
1778
|
}
|
|
1787
|
-
const
|
|
1779
|
+
const us = d(
|
|
1788
1780
|
"miniApp",
|
|
1789
1781
|
({
|
|
1790
1782
|
themeParams: e,
|
|
@@ -1794,9 +1786,9 @@ const ps = d(
|
|
|
1794
1786
|
headerColor: e.headerBgColor || "#000000"
|
|
1795
1787
|
},
|
|
1796
1788
|
...n
|
|
1797
|
-
}) => new
|
|
1789
|
+
}) => new ps({ ...n, ...s, botInline: t })
|
|
1798
1790
|
);
|
|
1799
|
-
function
|
|
1791
|
+
function ls(e) {
|
|
1800
1792
|
const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
|
|
1801
1793
|
let r;
|
|
1802
1794
|
if (s.length > 64)
|
|
@@ -1820,7 +1812,7 @@ function us(e) {
|
|
|
1820
1812
|
return { ...i, id: o };
|
|
1821
1813
|
}) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
|
|
1822
1814
|
}
|
|
1823
|
-
class
|
|
1815
|
+
class ds extends V {
|
|
1824
1816
|
constructor(t, s, n) {
|
|
1825
1817
|
super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
|
|
1826
1818
|
}
|
|
@@ -1849,11 +1841,11 @@ class ls extends D {
|
|
|
1849
1841
|
throw new Error("Popup is already opened.");
|
|
1850
1842
|
this.isOpened = !0;
|
|
1851
1843
|
try {
|
|
1852
|
-
const { button_id: s = null } = await
|
|
1844
|
+
const { button_id: s = null } = await f({
|
|
1853
1845
|
event: "popup_closed",
|
|
1854
1846
|
method: "web_app_open_popup",
|
|
1855
1847
|
postEvent: this.postEvent,
|
|
1856
|
-
params:
|
|
1848
|
+
params: ls(t)
|
|
1857
1849
|
});
|
|
1858
1850
|
return s;
|
|
1859
1851
|
} finally {
|
|
@@ -1861,10 +1853,10 @@ class ls extends D {
|
|
|
1861
1853
|
}
|
|
1862
1854
|
}
|
|
1863
1855
|
}
|
|
1864
|
-
const
|
|
1865
|
-
({ postEvent: e, version: t }) => new
|
|
1856
|
+
const _s = d(
|
|
1857
|
+
({ postEvent: e, version: t }) => new ds(!1, t, e)
|
|
1866
1858
|
);
|
|
1867
|
-
class
|
|
1859
|
+
class gs extends V {
|
|
1868
1860
|
constructor(t, s, n) {
|
|
1869
1861
|
super({ isOpened: t }, s, {
|
|
1870
1862
|
close: "web_app_close_scan_qr_popup",
|
|
@@ -1892,7 +1884,7 @@ class _s extends D {
|
|
|
1892
1884
|
const { text: s, capture: n } = (typeof t == "string" ? { text: t } : t) || {};
|
|
1893
1885
|
this.isOpened = !0;
|
|
1894
1886
|
try {
|
|
1895
|
-
const r = (await
|
|
1887
|
+
const r = (await f({
|
|
1896
1888
|
method: "web_app_open_scan_qr_popup",
|
|
1897
1889
|
event: ["qr_text_received", "scan_qr_popup_closed"],
|
|
1898
1890
|
postEvent: this.postEvent,
|
|
@@ -1908,15 +1900,15 @@ class _s extends D {
|
|
|
1908
1900
|
}
|
|
1909
1901
|
// TODO: Streaming mode, allowing to scan several QRs until closed.
|
|
1910
1902
|
}
|
|
1911
|
-
const
|
|
1912
|
-
({ version: e, postEvent: t }) => new
|
|
1903
|
+
const fs = d(
|
|
1904
|
+
({ version: e, postEvent: t }) => new gs(!1, e, t)
|
|
1913
1905
|
);
|
|
1914
|
-
class
|
|
1906
|
+
class ws extends rt {
|
|
1915
1907
|
constructor(t, s, n) {
|
|
1916
1908
|
super({ isVisible: t }, s, {
|
|
1917
1909
|
show: "web_app_setup_settings_button",
|
|
1918
1910
|
hide: "web_app_setup_settings_button"
|
|
1919
|
-
}), c(this, "on", (r, i) => r === "click" ? v("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ?
|
|
1911
|
+
}), c(this, "on", (r, i) => r === "click" ? v("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? U("settings_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
|
|
1920
1912
|
}
|
|
1921
1913
|
set isVisible(t) {
|
|
1922
1914
|
this.set("isVisible", t), this.postEvent("web_app_setup_settings_button", { is_visible: t });
|
|
@@ -1940,18 +1932,18 @@ class fs extends it {
|
|
|
1940
1932
|
this.isVisible = !0;
|
|
1941
1933
|
}
|
|
1942
1934
|
}
|
|
1943
|
-
const
|
|
1935
|
+
const ms = d(
|
|
1944
1936
|
"settingsButton",
|
|
1945
1937
|
({
|
|
1946
1938
|
version: e,
|
|
1947
1939
|
postEvent: t,
|
|
1948
1940
|
state: s = { isVisible: !1 }
|
|
1949
|
-
}) => new
|
|
1941
|
+
}) => new ws(s.isVisible, e, t)
|
|
1950
1942
|
);
|
|
1951
|
-
function
|
|
1952
|
-
return
|
|
1943
|
+
function zt(e) {
|
|
1944
|
+
return Vt().parse(e);
|
|
1953
1945
|
}
|
|
1954
|
-
class
|
|
1946
|
+
class bs extends at {
|
|
1955
1947
|
/**
|
|
1956
1948
|
* @since v6.10
|
|
1957
1949
|
*/
|
|
@@ -2022,7 +2014,7 @@ class ms extends ct {
|
|
|
2022
2014
|
*/
|
|
2023
2015
|
listen() {
|
|
2024
2016
|
return v("theme_changed", (t) => {
|
|
2025
|
-
this.set(
|
|
2017
|
+
this.set(zt(t.theme_params));
|
|
2026
2018
|
});
|
|
2027
2019
|
}
|
|
2028
2020
|
/**
|
|
@@ -2035,44 +2027,46 @@ class ms extends ct {
|
|
|
2035
2027
|
return this.get("textColor");
|
|
2036
2028
|
}
|
|
2037
2029
|
}
|
|
2038
|
-
const
|
|
2030
|
+
const vs = d(
|
|
2039
2031
|
"themeParams",
|
|
2040
2032
|
({ themeParams: e, state: t = e, addCleanup: s }) => {
|
|
2041
|
-
const n = new
|
|
2033
|
+
const n = new bs(t);
|
|
2042
2034
|
return s(n.listen()), n;
|
|
2043
2035
|
}
|
|
2044
2036
|
);
|
|
2045
|
-
function
|
|
2046
|
-
return
|
|
2037
|
+
function Xs(e = {}) {
|
|
2038
|
+
return f({
|
|
2047
2039
|
...e,
|
|
2048
2040
|
method: "web_app_request_theme",
|
|
2049
2041
|
event: "theme_changed"
|
|
2050
|
-
}).then(
|
|
2042
|
+
}).then(zt);
|
|
2043
|
+
}
|
|
2044
|
+
function q(e, t) {
|
|
2045
|
+
return e.startsWith(t) ? e : `${t}${e}`;
|
|
2051
2046
|
}
|
|
2052
|
-
|
|
2047
|
+
function N(e) {
|
|
2048
|
+
return new URL(
|
|
2049
|
+
typeof e == "string" ? e : `${e.pathname || ""}${q(e.search || "", "?")}${q(e.hash || "", "#")}`,
|
|
2050
|
+
"http://a"
|
|
2051
|
+
);
|
|
2052
|
+
}
|
|
2053
|
+
class ys extends ct {
|
|
2053
2054
|
constructor(t, s, n) {
|
|
2054
|
-
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam =
|
|
2055
|
+
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, {
|
|
2055
2056
|
"openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
|
|
2056
2057
|
});
|
|
2057
2058
|
}
|
|
2058
|
-
/**
|
|
2059
|
-
* Opens a link in an external browser. The Mini App will not be closed.
|
|
2060
|
-
*
|
|
2061
|
-
* Note that this method can be called only in response to the user
|
|
2062
|
-
* interaction with the Mini App interface (e.g. click inside the Mini App
|
|
2063
|
-
* or on the main button).
|
|
2064
|
-
* @param url - URL to be opened.
|
|
2065
|
-
* @param tryInstantView
|
|
2066
|
-
*/
|
|
2067
2059
|
openLink(t, s) {
|
|
2068
|
-
const n =
|
|
2060
|
+
const n = N(t).toString();
|
|
2069
2061
|
if (!x("web_app_open_link", this.version)) {
|
|
2070
2062
|
window.open(n, "_blank");
|
|
2071
2063
|
return;
|
|
2072
2064
|
}
|
|
2065
|
+
const r = typeof s == "boolean" ? { tryInstantView: s } : s || {};
|
|
2073
2066
|
this.postEvent("web_app_open_link", {
|
|
2074
2067
|
url: n,
|
|
2075
|
-
|
|
2068
|
+
try_browser: r.tryBrowser,
|
|
2069
|
+
try_instant_view: r.tryInstantView
|
|
2076
2070
|
});
|
|
2077
2071
|
}
|
|
2078
2072
|
/**
|
|
@@ -2100,12 +2094,12 @@ class vs extends ht {
|
|
|
2100
2094
|
async readTextFromClipboard() {
|
|
2101
2095
|
const t = this.createRequestId(), {
|
|
2102
2096
|
data: s = null
|
|
2103
|
-
} = await
|
|
2097
|
+
} = await f({
|
|
2104
2098
|
method: "web_app_read_text_from_clipboard",
|
|
2105
2099
|
event: "clipboard_text_received",
|
|
2106
2100
|
postEvent: this.postEvent,
|
|
2107
2101
|
params: { req_id: t },
|
|
2108
|
-
capture:
|
|
2102
|
+
capture: Rt(t)
|
|
2109
2103
|
});
|
|
2110
2104
|
return s;
|
|
2111
2105
|
}
|
|
@@ -2121,19 +2115,19 @@ class vs extends ht {
|
|
|
2121
2115
|
*/
|
|
2122
2116
|
shareURL(t, s) {
|
|
2123
2117
|
this.openTelegramLink(
|
|
2124
|
-
"https://t.me/share/url?" + new URLSearchParams({ url: t, text: s || "" }).toString()
|
|
2118
|
+
"https://t.me/share/url?" + new URLSearchParams({ url: t, text: s || "" }).toString().replace(/\+/g, "%20")
|
|
2125
2119
|
);
|
|
2126
2120
|
}
|
|
2127
2121
|
}
|
|
2128
|
-
const
|
|
2129
|
-
({ version: e, postEvent: t, createRequestId: s }) => new
|
|
2122
|
+
const Es = d(
|
|
2123
|
+
({ version: e, postEvent: t, createRequestId: s }) => new ys(e, s, t)
|
|
2130
2124
|
);
|
|
2131
|
-
async function
|
|
2125
|
+
async function Jt(e = {}) {
|
|
2132
2126
|
const {
|
|
2133
2127
|
is_expanded: t,
|
|
2134
2128
|
is_state_stable: s,
|
|
2135
2129
|
...n
|
|
2136
|
-
} = await
|
|
2130
|
+
} = await f({
|
|
2137
2131
|
...e,
|
|
2138
2132
|
method: "web_app_request_viewport",
|
|
2139
2133
|
event: "viewport_changed"
|
|
@@ -2143,7 +2137,7 @@ async function Ft(e = {}) {
|
|
|
2143
2137
|
function R(e) {
|
|
2144
2138
|
return e < 0 ? 0 : e;
|
|
2145
2139
|
}
|
|
2146
|
-
class
|
|
2140
|
+
class Ps extends at {
|
|
2147
2141
|
constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
|
|
2148
2142
|
super({
|
|
2149
2143
|
height: R(n),
|
|
@@ -2158,7 +2152,7 @@ class Es extends ct {
|
|
|
2158
2152
|
* @param options - options to request fresh data.
|
|
2159
2153
|
*/
|
|
2160
2154
|
async sync(t) {
|
|
2161
|
-
const { isStateStable: s, ...n } = await
|
|
2155
|
+
const { isStateStable: s, ...n } = await Jt(t);
|
|
2162
2156
|
this.set({
|
|
2163
2157
|
...n,
|
|
2164
2158
|
stableHeight: s ? n.height : this.get("stableHeight")
|
|
@@ -2250,7 +2244,7 @@ class Es extends ct {
|
|
|
2250
2244
|
return this.stableHeight === this.height;
|
|
2251
2245
|
}
|
|
2252
2246
|
}
|
|
2253
|
-
const
|
|
2247
|
+
const xs = d(
|
|
2254
2248
|
"viewport",
|
|
2255
2249
|
async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
|
|
2256
2250
|
let r = !1, i = 0, o = 0, a = 0;
|
|
@@ -2259,10 +2253,10 @@ const Ps = d(
|
|
|
2259
2253
|
else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
|
|
2260
2254
|
r = !0, i = window.innerHeight, o = window.innerWidth, a = window.innerHeight;
|
|
2261
2255
|
else {
|
|
2262
|
-
const u = await
|
|
2256
|
+
const u = await Jt({ timeout: 1e3, postEvent: s });
|
|
2263
2257
|
r = u.isExpanded, i = u.height, o = u.width, a = u.isStateStable ? i : 0;
|
|
2264
2258
|
}
|
|
2265
|
-
const h = new
|
|
2259
|
+
const h = new Ps({
|
|
2266
2260
|
postEvent: s,
|
|
2267
2261
|
height: i,
|
|
2268
2262
|
width: o,
|
|
@@ -2275,7 +2269,7 @@ const Ps = d(
|
|
|
2275
2269
|
function E(e, t) {
|
|
2276
2270
|
document.documentElement.style.setProperty(e, t);
|
|
2277
2271
|
}
|
|
2278
|
-
function
|
|
2272
|
+
function tn(e, t, s) {
|
|
2279
2273
|
s || (s = (a) => `--tg-${a}-color`);
|
|
2280
2274
|
const n = s("header"), r = s("bg"), i = () => {
|
|
2281
2275
|
const { headerColor: a } = e;
|
|
@@ -2292,7 +2286,7 @@ function Xs(e, t, s) {
|
|
|
2292
2286
|
];
|
|
2293
2287
|
return i(), () => o.forEach((a) => a());
|
|
2294
2288
|
}
|
|
2295
|
-
function
|
|
2289
|
+
function en(e, t) {
|
|
2296
2290
|
t || (t = (n) => `--tg-theme-${n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`);
|
|
2297
2291
|
const s = () => {
|
|
2298
2292
|
Object.entries(e.getState()).forEach(([n, r]) => {
|
|
@@ -2301,7 +2295,7 @@ function tn(e, t) {
|
|
|
2301
2295
|
};
|
|
2302
2296
|
return s(), e.on("change", s);
|
|
2303
2297
|
}
|
|
2304
|
-
function
|
|
2298
|
+
function sn(e, t) {
|
|
2305
2299
|
t || (t = (u) => `--tg-viewport-${u}`);
|
|
2306
2300
|
const [
|
|
2307
2301
|
s,
|
|
@@ -2314,10 +2308,10 @@ function en(e, t) {
|
|
|
2314
2308
|
];
|
|
2315
2309
|
return i(), o(), a(), () => h.forEach((u) => u());
|
|
2316
2310
|
}
|
|
2317
|
-
function
|
|
2311
|
+
function Cs(e = !0) {
|
|
2318
2312
|
const t = [
|
|
2319
2313
|
v("reload_iframe", () => {
|
|
2320
|
-
|
|
2314
|
+
O("iframe_will_reload"), window.location.reload();
|
|
2321
2315
|
})
|
|
2322
2316
|
], s = () => t.forEach((n) => n());
|
|
2323
2317
|
if (e) {
|
|
@@ -2329,29 +2323,29 @@ function xs(e = !0) {
|
|
|
2329
2323
|
() => document.head.removeChild(n)
|
|
2330
2324
|
);
|
|
2331
2325
|
}
|
|
2332
|
-
return
|
|
2326
|
+
return O("iframe_ready", { reload_supported: !0 }), s;
|
|
2333
2327
|
}
|
|
2334
|
-
function
|
|
2328
|
+
function nn() {
|
|
2335
2329
|
return typeof window > "u";
|
|
2336
2330
|
}
|
|
2337
|
-
async function
|
|
2338
|
-
if (
|
|
2331
|
+
async function rn() {
|
|
2332
|
+
if (St(window))
|
|
2339
2333
|
return !0;
|
|
2340
2334
|
try {
|
|
2341
|
-
return await
|
|
2335
|
+
return await f({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
2342
2336
|
} catch {
|
|
2343
2337
|
return !1;
|
|
2344
2338
|
}
|
|
2345
2339
|
}
|
|
2346
|
-
function
|
|
2347
|
-
const t = typeof e == "string" ?
|
|
2348
|
-
|
|
2340
|
+
function on(e) {
|
|
2341
|
+
const t = typeof e == "string" ? ot(e) : e;
|
|
2342
|
+
Wt(t);
|
|
2349
2343
|
function s(r) {
|
|
2350
2344
|
if (typeof r == "string")
|
|
2351
2345
|
try {
|
|
2352
|
-
const { eventType: i } =
|
|
2346
|
+
const { eventType: i } = xt(r);
|
|
2353
2347
|
i === "web_app_request_theme" && Y("theme_changed", {
|
|
2354
|
-
theme_params: JSON.parse(
|
|
2348
|
+
theme_params: JSON.parse(Ut(t.themeParams))
|
|
2355
2349
|
}), i === "web_app_request_viewport" && Y("viewport_changed", {
|
|
2356
2350
|
width: window.innerWidth,
|
|
2357
2351
|
height: window.innerHeight,
|
|
@@ -2361,14 +2355,14 @@ function rn(e) {
|
|
|
2361
2355
|
} catch {
|
|
2362
2356
|
}
|
|
2363
2357
|
}
|
|
2364
|
-
if (
|
|
2358
|
+
if (et()) {
|
|
2365
2359
|
const r = window.parent.postMessage.bind(window.parent);
|
|
2366
2360
|
window.parent.postMessage = (i) => {
|
|
2367
2361
|
s(i), r(i);
|
|
2368
2362
|
};
|
|
2369
2363
|
return;
|
|
2370
2364
|
}
|
|
2371
|
-
if (
|
|
2365
|
+
if (Ct(window)) {
|
|
2372
2366
|
const r = window.external.notify.bind(window.external);
|
|
2373
2367
|
window.external.notify = (i) => {
|
|
2374
2368
|
s(i), r(i);
|
|
@@ -2383,13 +2377,13 @@ function rn(e) {
|
|
|
2383
2377
|
}
|
|
2384
2378
|
};
|
|
2385
2379
|
}
|
|
2386
|
-
function
|
|
2380
|
+
function Ss(e) {
|
|
2387
2381
|
return e instanceof $;
|
|
2388
2382
|
}
|
|
2389
|
-
function
|
|
2390
|
-
return
|
|
2383
|
+
function an(e, t) {
|
|
2384
|
+
return Ss(e) && e.type === t;
|
|
2391
2385
|
}
|
|
2392
|
-
function
|
|
2386
|
+
function G(e, t) {
|
|
2393
2387
|
let s, n, r;
|
|
2394
2388
|
return typeof e == "string" ? s = e : (s = e.pathname === void 0 ? t : e.pathname, n = e.params, r = e.id), Object.freeze({
|
|
2395
2389
|
id: r || (Math.random() * 2 ** 14 | 0).toString(16),
|
|
@@ -2397,16 +2391,16 @@ function j(e, t) {
|
|
|
2397
2391
|
params: n
|
|
2398
2392
|
});
|
|
2399
2393
|
}
|
|
2400
|
-
class
|
|
2401
|
-
constructor(t, s, n =
|
|
2394
|
+
class Ts {
|
|
2395
|
+
constructor(t, s, n = O) {
|
|
2402
2396
|
if (c(this, "history"), c(this, "ee", new k()), 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)
|
|
2403
|
-
throw
|
|
2397
|
+
throw m(fe, "History should not be empty.");
|
|
2404
2398
|
if (s < 0 || s >= t.length)
|
|
2405
|
-
throw
|
|
2406
|
-
|
|
2399
|
+
throw m(
|
|
2400
|
+
we,
|
|
2407
2401
|
"Index should not be zero and higher or equal than history size."
|
|
2408
2402
|
);
|
|
2409
|
-
this.history = t.map((r) =>
|
|
2403
|
+
this.history = t.map((r) => G(r, ""));
|
|
2410
2404
|
}
|
|
2411
2405
|
/**
|
|
2412
2406
|
* Allows this navigator to control the `BackButton` visibility state. It also tracks the
|
|
@@ -2425,7 +2419,7 @@ class Ss {
|
|
|
2425
2419
|
* Prevents current navigator from controlling the BackButton visibility state.
|
|
2426
2420
|
*/
|
|
2427
2421
|
detach() {
|
|
2428
|
-
this.attached = !1,
|
|
2422
|
+
this.attached = !1, U("back_button_pressed", this.back);
|
|
2429
2423
|
}
|
|
2430
2424
|
/**
|
|
2431
2425
|
* Goes to the next history item.
|
|
@@ -2481,14 +2475,14 @@ class Ss {
|
|
|
2481
2475
|
* @param item - item to add.
|
|
2482
2476
|
*/
|
|
2483
2477
|
push(t) {
|
|
2484
|
-
this.hasNext && this.history.splice(this.index + 1), this.replaceAndMove(this.index + 1,
|
|
2478
|
+
this.hasNext && this.history.splice(this.index + 1), this.replaceAndMove(this.index + 1, G(t, this.current.pathname));
|
|
2485
2479
|
}
|
|
2486
2480
|
/**
|
|
2487
2481
|
* Replaces the current history item.
|
|
2488
2482
|
* @param item - item to replace the current item with.
|
|
2489
2483
|
*/
|
|
2490
2484
|
replace(t) {
|
|
2491
|
-
this.replaceAndMove(this.index,
|
|
2485
|
+
this.replaceAndMove(this.index, G(t, this.current.pathname));
|
|
2492
2486
|
}
|
|
2493
2487
|
/**
|
|
2494
2488
|
* Sets history item by the specified index.
|
|
@@ -2518,29 +2512,20 @@ class Ss {
|
|
|
2518
2512
|
this.postEvent("web_app_setup_back_button", { is_visible: !!this.index });
|
|
2519
2513
|
}
|
|
2520
2514
|
}
|
|
2521
|
-
function
|
|
2515
|
+
function j({
|
|
2522
2516
|
params: e,
|
|
2523
2517
|
...t
|
|
2524
2518
|
}) {
|
|
2525
2519
|
return { ...e || { hash: "", search: "" }, ...t };
|
|
2526
2520
|
}
|
|
2527
|
-
function O(e, t) {
|
|
2528
|
-
return e.startsWith(t) ? e : `${t}${e}`;
|
|
2529
|
-
}
|
|
2530
|
-
function M(e) {
|
|
2531
|
-
return new URL(
|
|
2532
|
-
typeof e == "string" ? e : `${e.pathname || ""}${O(e.search || "", "?")}${O(e.hash || "", "#")}`,
|
|
2533
|
-
"http://a"
|
|
2534
|
-
);
|
|
2535
|
-
}
|
|
2536
2521
|
function B(e) {
|
|
2537
|
-
const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s =
|
|
2522
|
+
const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = N(e);
|
|
2538
2523
|
return `${t ? s.pathname : s.pathname.slice(1)}${s.search}${s.hash}`;
|
|
2539
2524
|
}
|
|
2540
2525
|
function K(e, t, s) {
|
|
2541
2526
|
let n, r;
|
|
2542
2527
|
typeof e == "string" ? n = e : (n = B(e), s = e.state, r = e.id);
|
|
2543
|
-
const { pathname: i, search: o, hash: a } = new URL(n, `http://a${
|
|
2528
|
+
const { pathname: i, search: o, hash: a } = new URL(n, `http://a${q(t, "/")}`);
|
|
2544
2529
|
return { id: r, pathname: i, params: { hash: a, search: o, state: s } };
|
|
2545
2530
|
}
|
|
2546
2531
|
async function I(e) {
|
|
@@ -2557,23 +2542,23 @@ async function I(e) {
|
|
|
2557
2542
|
})
|
|
2558
2543
|
]);
|
|
2559
2544
|
}
|
|
2560
|
-
async function
|
|
2545
|
+
async function Rs() {
|
|
2561
2546
|
if (window.history.length <= 1 || (window.history.pushState(null, ""), await I(1 - window.history.length)))
|
|
2562
2547
|
return;
|
|
2563
2548
|
let e = await I(-1);
|
|
2564
2549
|
for (; e; )
|
|
2565
2550
|
e = await I(-1);
|
|
2566
2551
|
}
|
|
2567
|
-
function
|
|
2568
|
-
return
|
|
2552
|
+
function Ft(e) {
|
|
2553
|
+
return N(e).pathname;
|
|
2569
2554
|
}
|
|
2570
|
-
const
|
|
2571
|
-
class
|
|
2555
|
+
const wt = 0, z = 1, J = 2;
|
|
2556
|
+
class Qt {
|
|
2572
2557
|
constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
|
|
2573
2558
|
c(this, "navigator"), c(this, "ee", new k()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
|
|
2574
2559
|
if (o === null)
|
|
2575
2560
|
return this.push(this.parsePath(window.location.href));
|
|
2576
|
-
o ===
|
|
2561
|
+
o === wt ? window.history.forward() : o === z && this.back(), o === J && this.forward();
|
|
2577
2562
|
}), c(this, "onNavigatorChange", async ({
|
|
2578
2563
|
to: o,
|
|
2579
2564
|
from: a,
|
|
@@ -2581,17 +2566,17 @@ class Yt {
|
|
|
2581
2566
|
}) => {
|
|
2582
2567
|
this.attached && await this.syncHistory(), this.ee.emit("change", {
|
|
2583
2568
|
delta: h,
|
|
2584
|
-
from:
|
|
2585
|
-
to:
|
|
2569
|
+
from: j(a),
|
|
2570
|
+
to: j(o),
|
|
2586
2571
|
navigator: this
|
|
2587
2572
|
});
|
|
2588
|
-
}), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new
|
|
2573
|
+
}), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new Ts(
|
|
2589
2574
|
t.map((o) => K(o, "/")),
|
|
2590
2575
|
s,
|
|
2591
2576
|
n
|
|
2592
2577
|
), this.navigator.on("change", (o) => {
|
|
2593
2578
|
this.onNavigatorChange(o);
|
|
2594
|
-
}), this.hashMode = r, this.base =
|
|
2579
|
+
}), this.hashMode = r, this.base = Ft(i || "");
|
|
2595
2580
|
}
|
|
2596
2581
|
/**
|
|
2597
2582
|
* Attaches current navigator to the browser history allowing navigator to manipulate it.
|
|
@@ -2675,7 +2660,7 @@ class Yt {
|
|
|
2675
2660
|
* Navigation history.
|
|
2676
2661
|
*/
|
|
2677
2662
|
get history() {
|
|
2678
|
-
return this.navigator.history.map(
|
|
2663
|
+
return this.navigator.history.map(j);
|
|
2679
2664
|
}
|
|
2680
2665
|
/**
|
|
2681
2666
|
* Path, including pathname, search and hash.
|
|
@@ -2718,8 +2703,8 @@ class Yt {
|
|
|
2718
2703
|
* // { pathname: '/tma', search: '?is=cool', hash: '#yeah' }
|
|
2719
2704
|
*/
|
|
2720
2705
|
parsePath(t) {
|
|
2721
|
-
let s =
|
|
2722
|
-
return this.hashMode && (s =
|
|
2706
|
+
let s = N(t);
|
|
2707
|
+
return this.hashMode && (s = N(s.hash.slice(1))), {
|
|
2723
2708
|
pathname: s.pathname,
|
|
2724
2709
|
search: s.search,
|
|
2725
2710
|
hash: s.hash
|
|
@@ -2739,8 +2724,8 @@ class Yt {
|
|
|
2739
2724
|
* @param value - path presented as string or URLLike.
|
|
2740
2725
|
*/
|
|
2741
2726
|
renderPath(t) {
|
|
2742
|
-
const s = (this.base.length === 1 ? "" : this.base) +
|
|
2743
|
-
return this.hashMode ?
|
|
2727
|
+
const s = (this.base.length === 1 ? "" : this.base) + q(B(t), "/");
|
|
2728
|
+
return this.hashMode ? q(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
|
|
2744
2729
|
}
|
|
2745
2730
|
/**
|
|
2746
2731
|
* Synchronizes current navigator state with browser history.
|
|
@@ -2748,7 +2733,7 @@ class Yt {
|
|
|
2748
2733
|
async syncHistory() {
|
|
2749
2734
|
window.removeEventListener("popstate", this.onPopState);
|
|
2750
2735
|
const { state: t } = this, s = this.renderPath(this);
|
|
2751
|
-
await
|
|
2736
|
+
await Rs(), this.hasPrev && this.hasNext ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s), window.history.pushState(J, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(J, ""), await I(-1)) : (window.history.replaceState(wt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
|
|
2752
2737
|
}
|
|
2753
2738
|
/**
|
|
2754
2739
|
* Current query parameters.
|
|
@@ -2766,34 +2751,34 @@ class Yt {
|
|
|
2766
2751
|
return (this.navigator.current.params || {}).state;
|
|
2767
2752
|
}
|
|
2768
2753
|
}
|
|
2769
|
-
function
|
|
2754
|
+
function As(e) {
|
|
2770
2755
|
e || (e = {});
|
|
2771
2756
|
const { href: t, hash: s } = window.location;
|
|
2772
2757
|
let n = B(
|
|
2773
2758
|
e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
|
|
2774
2759
|
);
|
|
2775
|
-
const r = e.base ?
|
|
2760
|
+
const r = e.base ? Ft(e.base) : void 0;
|
|
2776
2761
|
if (r) {
|
|
2777
2762
|
if (!n.startsWith(r))
|
|
2778
|
-
throw
|
|
2779
|
-
|
|
2763
|
+
throw m(
|
|
2764
|
+
me,
|
|
2780
2765
|
`Path "${n}" expected to be starting with "${r}"`
|
|
2781
2766
|
);
|
|
2782
2767
|
n = n.slice(r.length);
|
|
2783
2768
|
}
|
|
2784
|
-
return new
|
|
2769
|
+
return new Qt([n], 0, e);
|
|
2785
2770
|
}
|
|
2786
|
-
function
|
|
2771
|
+
function cn(e) {
|
|
2787
2772
|
const t = e.match(/#(.+)/);
|
|
2788
2773
|
return t ? t[1] : null;
|
|
2789
2774
|
}
|
|
2790
|
-
function
|
|
2775
|
+
function Is(e, t) {
|
|
2791
2776
|
if (Gt()) {
|
|
2792
2777
|
const s = sessionStorage.getItem(e);
|
|
2793
2778
|
if (s)
|
|
2794
2779
|
try {
|
|
2795
2780
|
const { index: n, history: r } = JSON.parse(s);
|
|
2796
|
-
return new
|
|
2781
|
+
return new Qt(
|
|
2797
2782
|
r,
|
|
2798
2783
|
n,
|
|
2799
2784
|
t
|
|
@@ -2802,34 +2787,34 @@ function As(e, t) {
|
|
|
2802
2787
|
console.error("Unable to restore hash navigator state.", n);
|
|
2803
2788
|
}
|
|
2804
2789
|
}
|
|
2805
|
-
return
|
|
2790
|
+
return As(t);
|
|
2806
2791
|
}
|
|
2807
|
-
function
|
|
2808
|
-
const s =
|
|
2792
|
+
function hn(e, t) {
|
|
2793
|
+
const s = Is(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
2809
2794
|
index: s.index,
|
|
2810
2795
|
history: s.history
|
|
2811
2796
|
}));
|
|
2812
2797
|
return s.on("change", n), n(), s;
|
|
2813
2798
|
}
|
|
2814
2799
|
function _(e) {
|
|
2815
|
-
return (t, s, ...n) => (r) =>
|
|
2800
|
+
return (t, s, ...n) => (r) => mt(s, pt(() => pt({
|
|
2816
2801
|
[t]: e(...n)
|
|
2817
2802
|
}, r)));
|
|
2818
2803
|
}
|
|
2819
|
-
const
|
|
2820
|
-
function
|
|
2821
|
-
const e =
|
|
2804
|
+
const Yt = te();
|
|
2805
|
+
function ks() {
|
|
2806
|
+
const e = ee(Yt);
|
|
2822
2807
|
if (!e)
|
|
2823
2808
|
throw new Error("useSDK was used outside of SDKProvider.");
|
|
2824
2809
|
return e;
|
|
2825
2810
|
}
|
|
2826
2811
|
function g(e) {
|
|
2827
2812
|
return (...t) => {
|
|
2828
|
-
const s =
|
|
2813
|
+
const s = ks()(e, ...t), n = () => s.signal();
|
|
2829
2814
|
return Object.defineProperty(n, "error", () => s.error), n;
|
|
2830
2815
|
};
|
|
2831
2816
|
}
|
|
2832
|
-
const
|
|
2817
|
+
const Os = g(We), pn = _(Os), qs = g(Ke), un = _(qs), Ns = g(Je), ln = _(Ns), Ds = g(Xe), dn = _(Ds), Vs = g(es), _n = _(Vs), Ms = g(ns), gn = _(Ms), Bs = g(is), fn = _(Bs), $s = g(as), wn = _($s), Ls = g(us), mn = _(Ls), Hs = g(_s), bn = _(Hs), Us = g(fs), vn = _(Us), Ws = g(ms), yn = _(Ws), Gs = g(vs), En = _(Gs), js = g(Es), Pn = _(js), Ks = g(xs), xn = _(Ks), Cn = (e) => {
|
|
2833
2818
|
const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
|
|
2834
2819
|
if (t.has(n))
|
|
2835
2820
|
return t.get(n);
|
|
@@ -2849,18 +2834,18 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2849
2834
|
}
|
|
2850
2835
|
let a;
|
|
2851
2836
|
Array.isArray(o) && ([o, a] = o);
|
|
2852
|
-
const [h] =
|
|
2837
|
+
const [h] = se(() => o), u = dt(() => {
|
|
2853
2838
|
if (h.state !== "ready")
|
|
2854
2839
|
return;
|
|
2855
2840
|
const l = h();
|
|
2856
2841
|
if (!l || !("on" in l))
|
|
2857
2842
|
return l;
|
|
2858
|
-
const
|
|
2843
|
+
const Zt = ne((M) => (M(l), l.on("change", () => M(l)))), Xt = Object.getPrototypeOf(l), W = {};
|
|
2859
2844
|
return new Proxy(l, {
|
|
2860
|
-
get(
|
|
2845
|
+
get(M, C) {
|
|
2861
2846
|
if (!(C in W)) {
|
|
2862
|
-
const
|
|
2863
|
-
W[C] =
|
|
2847
|
+
const ht = Reflect.getOwnPropertyDescriptor(Xt, C);
|
|
2848
|
+
W[C] = ht && "get" in ht ? dt(() => Zt()[C]) : () => Reflect.get(M, C);
|
|
2864
2849
|
}
|
|
2865
2850
|
return W[C]();
|
|
2866
2851
|
}
|
|
@@ -2878,13 +2863,13 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2878
2863
|
cleanup: a
|
|
2879
2864
|
});
|
|
2880
2865
|
};
|
|
2881
|
-
return
|
|
2882
|
-
|
|
2866
|
+
return ut(() => {
|
|
2867
|
+
ce(e.debug || !1);
|
|
2868
|
+
}), ut(() => {
|
|
2869
|
+
et() && lt(Cs(e.acceptCustomStyles));
|
|
2883
2870
|
}), lt(() => {
|
|
2884
|
-
nt() && dt(xs(e.acceptCustomStyles));
|
|
2885
|
-
}), dt(() => {
|
|
2886
2871
|
t.forEach((n) => n.cleanup && n.cleanup());
|
|
2887
|
-
}),
|
|
2872
|
+
}), mt(Yt.Provider, {
|
|
2888
2873
|
value: s,
|
|
2889
2874
|
get children() {
|
|
2890
2875
|
return e.children;
|
|
@@ -2893,138 +2878,138 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2893
2878
|
};
|
|
2894
2879
|
export {
|
|
2895
2880
|
ke as BackButton,
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2881
|
+
Ts as BasicNavigator,
|
|
2882
|
+
Ge as BiometryManager,
|
|
2883
|
+
Qt as BrowserNavigator,
|
|
2884
|
+
ze as ClosingBehavior,
|
|
2885
|
+
Ze as CloudStorage,
|
|
2886
|
+
me as ERR_INVALID_PATH_BASE,
|
|
2887
|
+
de as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
|
|
2888
|
+
ue as ERR_METHOD_PARAMETER_UNSUPPORTED,
|
|
2889
|
+
pe as ERR_METHOD_UNSUPPORTED,
|
|
2890
|
+
fe as ERR_NAVIGATION_HISTORY_EMPTY,
|
|
2891
|
+
we as ERR_NAVIGATION_INDEX_INVALID,
|
|
2892
|
+
Js as ERR_NAVIGATION_ITEM_INVALID,
|
|
2893
|
+
yt as ERR_PARSE,
|
|
2894
|
+
Fs as ERR_SSR_INIT,
|
|
2895
|
+
_e as ERR_TIMED_OUT,
|
|
2896
|
+
ge as ERR_UNEXPECTED_TYPE,
|
|
2897
|
+
le as ERR_UNKNOWN_ENV,
|
|
2913
2898
|
k as EventEmitter,
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2899
|
+
ts as HapticFeedback,
|
|
2900
|
+
ss as InitData,
|
|
2901
|
+
rs as Invoice,
|
|
2902
|
+
os as MainButton,
|
|
2903
|
+
ps as MiniApp,
|
|
2904
|
+
ds as Popup,
|
|
2905
|
+
gs as QRScanner,
|
|
2921
2906
|
$ as SDKError,
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2907
|
+
Cn as SDKProvider,
|
|
2908
|
+
ws as SettingsButton,
|
|
2909
|
+
bs as ThemeParams,
|
|
2910
|
+
ys as Utils,
|
|
2911
|
+
Ps as Viewport,
|
|
2912
|
+
Ye as array,
|
|
2913
|
+
tn as bindMiniAppCSSVars,
|
|
2914
|
+
en as bindThemeParamsCSSVars,
|
|
2915
|
+
sn as bindViewportCSSVars,
|
|
2931
2916
|
y as boolean,
|
|
2932
|
-
|
|
2917
|
+
Rt as captureSameReq,
|
|
2933
2918
|
Z as classNames,
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2919
|
+
Ce as compareVersions,
|
|
2920
|
+
As as createBrowserNavigatorFromLocation,
|
|
2921
|
+
Re as createPostEvent,
|
|
2922
|
+
N as createSafeURL,
|
|
2923
|
+
Nt as date,
|
|
2924
|
+
cn as getHash,
|
|
2925
|
+
Ft as getPathname,
|
|
2926
|
+
We as initBackButton,
|
|
2927
|
+
Ke as initBiometryManager,
|
|
2928
|
+
Je as initClosingBehavior,
|
|
2929
|
+
Xe as initCloudStorage,
|
|
2930
|
+
es as initHapticFeedback,
|
|
2931
|
+
ns as initInitData,
|
|
2932
|
+
is as initInvoice,
|
|
2933
|
+
as as initMainButton,
|
|
2934
|
+
us as initMiniApp,
|
|
2935
|
+
hn as initNavigator,
|
|
2936
|
+
_s as initPopup,
|
|
2937
|
+
fs as initQRScanner,
|
|
2938
|
+
ms as initSettingsButton,
|
|
2939
|
+
vs as initThemeParams,
|
|
2940
|
+
Es as initUtils,
|
|
2941
|
+
xs as initViewport,
|
|
2942
|
+
Cs as initWeb,
|
|
2958
2943
|
A as invokeCustomMethod,
|
|
2959
2944
|
Ot as isColorDark,
|
|
2960
|
-
|
|
2945
|
+
et as isIframe,
|
|
2961
2946
|
Gt as isPageReload,
|
|
2962
2947
|
st as isRGB,
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2948
|
+
Ae as isRGBShort,
|
|
2949
|
+
Ss as isSDKError,
|
|
2950
|
+
an as isSDKErrorOfType,
|
|
2951
|
+
nn as isSSR,
|
|
2952
|
+
rn as isTMA,
|
|
2953
|
+
b as json,
|
|
2954
|
+
Ys as mergeClassNames,
|
|
2955
|
+
on as mockTelegramEnv,
|
|
2971
2956
|
P as number,
|
|
2972
|
-
|
|
2957
|
+
U as off,
|
|
2973
2958
|
v as on,
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2959
|
+
Zs as parseInitData,
|
|
2960
|
+
ot as parseLaunchParams,
|
|
2961
|
+
zt as parseThemeParams,
|
|
2962
|
+
O as postEvent,
|
|
2963
|
+
f as request,
|
|
2979
2964
|
je as requestBiometryInfo,
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2965
|
+
Xs as requestThemeParams,
|
|
2966
|
+
Jt as requestViewport,
|
|
2967
|
+
Le as retrieveLaunchParams,
|
|
2968
|
+
qe as rgb,
|
|
2969
|
+
it as searchParams,
|
|
2970
|
+
$e as serializeLaunchParams,
|
|
2971
|
+
Ut as serializeThemeParams,
|
|
2987
2972
|
E as setCSSVar,
|
|
2988
|
-
|
|
2989
|
-
|
|
2973
|
+
ce as setDebug,
|
|
2974
|
+
Qs as setTargetOrigin,
|
|
2990
2975
|
p as string,
|
|
2991
|
-
|
|
2976
|
+
oe as subscribe,
|
|
2992
2977
|
x as supports,
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2978
|
+
Te as targetOrigin,
|
|
2979
|
+
kt as toRGB,
|
|
2980
|
+
vt as unsubscribe,
|
|
2996
2981
|
B as urlToPath,
|
|
2997
|
-
|
|
2982
|
+
Os as useBackButton,
|
|
2998
2983
|
qs as useBiometryManager,
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
2984
|
+
Ns as useClosingBehavior,
|
|
2985
|
+
Ds as useCloudStorage,
|
|
2986
|
+
Vs as useHapticFeedback,
|
|
2987
|
+
Ms as useInitData,
|
|
2988
|
+
Bs as useInvoice,
|
|
2989
|
+
$s as useMainButton,
|
|
2990
|
+
Ls as useMiniApp,
|
|
2991
|
+
Hs as usePopup,
|
|
3007
2992
|
Us as useQRScanner,
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
2993
|
+
ks as useSDK,
|
|
2994
|
+
Ws as useSettingsButton,
|
|
2995
|
+
Gs as useThemeParams,
|
|
3011
2996
|
js as useUtils,
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
2997
|
+
Ks as useViewport,
|
|
2998
|
+
pn as withBackButton,
|
|
2999
|
+
un as withBiometryManager,
|
|
3000
|
+
ln as withClosingBehavior,
|
|
3001
|
+
dn as withCloudStorage,
|
|
3002
|
+
_n as withHapticFeedback,
|
|
3003
|
+
gn as withInitData,
|
|
3004
|
+
fn as withInvoice,
|
|
3005
|
+
wn as withMainButton,
|
|
3006
|
+
mn as withMiniApp,
|
|
3007
|
+
bn as withPopup,
|
|
3008
|
+
vn as withQRScanner,
|
|
3009
|
+
yn as withSettingsButton,
|
|
3010
|
+
En as withThemeParams,
|
|
3011
|
+
It as withTimeout,
|
|
3012
|
+
Pn as withUtils,
|
|
3013
|
+
xn as withViewport
|
|
3029
3014
|
};
|
|
3030
3015
|
//# sourceMappingURL=index.js.map
|