@tma.js/sdk 0.12.9 → 0.13.1
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/dts/components/ThemeParams/ThemeParams.d.ts +2 -2
- package/dist/dts/env.d.ts +6 -4
- package/dist/dts/index.d.ts +0 -1
- package/dist/dts/init/creators/index.d.ts +0 -1
- package/dist/dts/supports.d.ts +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +262 -276
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/components/ThemeParams/ThemeParams.ts +16 -4
- package/src/env.ts +12 -7
- package/src/index.ts +0 -1
- package/src/init/creators/index.ts +0 -1
- package/src/init/init.ts +16 -56
- package/src/supports.ts +4 -4
- package/dist/dts/init/creators/createPostEvent.d.ts +0 -7
- package/dist/dts/launch-params.d.ts +0 -6
- package/src/init/creators/createPostEvent.ts +0 -36
- package/src/launch-params.ts +0 -28
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (s, t, e) => (
|
|
4
|
-
import {
|
|
1
|
+
var ot = Object.defineProperty;
|
|
2
|
+
var nt = (s, t, e) => t in s ? ot(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var i = (s, t, e) => (nt(s, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import { retrieveLaunchData as z, parse as rt } from "@tma.js/launch-params";
|
|
5
5
|
import { EventEmitter as w } from "@tma.js/event-emitter";
|
|
6
|
-
import { supports as
|
|
7
|
-
import { array as
|
|
8
|
-
import { parse as
|
|
9
|
-
import { isColorDark as
|
|
10
|
-
import { compareVersions as
|
|
11
|
-
function
|
|
12
|
-
return (e) =>
|
|
6
|
+
import { supports as P, postEvent as g, on as E, off as W, request as f, setDebug as it, setTargetOrigin as at, createPostEvent as ct, isIframe as ht } from "@tma.js/bridge";
|
|
7
|
+
import { array as ut, string as U, json as lt } from "@tma.js/parsing";
|
|
8
|
+
import { parse as D } from "@tma.js/theme-params";
|
|
9
|
+
import { isColorDark as K, isRGB as pt } from "@tma.js/colors";
|
|
10
|
+
import { compareVersions as dt, withTimeout as gt } from "@tma.js/utils";
|
|
11
|
+
function C(s, t) {
|
|
12
|
+
return (e) => P(t[e], s);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function bt(s, t) {
|
|
15
15
|
return (e) => {
|
|
16
16
|
const [o, n] = t[e];
|
|
17
|
-
return
|
|
17
|
+
return P(o, n, s);
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
class
|
|
20
|
+
class m {
|
|
21
21
|
constructor(t, e) {
|
|
22
22
|
this.state = t, this.ee = e;
|
|
23
23
|
}
|
|
@@ -40,7 +40,7 @@ class f {
|
|
|
40
40
|
return this.state[t];
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class _t {
|
|
44
44
|
constructor(t, e, o = g) {
|
|
45
45
|
i(this, "ee", new w());
|
|
46
46
|
i(this, "state");
|
|
@@ -49,7 +49,7 @@ class Ct {
|
|
|
49
49
|
* @param event - event name.
|
|
50
50
|
* @param listener - event listener.
|
|
51
51
|
*/
|
|
52
|
-
i(this, "on", (t, e) => t === "click" ?
|
|
52
|
+
i(this, "on", (t, e) => t === "click" ? E("back_button_pressed", e) : this.ee.on(t, e));
|
|
53
53
|
/**
|
|
54
54
|
* Removes event listener.
|
|
55
55
|
* @param event - event name.
|
|
@@ -57,14 +57,14 @@ class Ct {
|
|
|
57
57
|
*/
|
|
58
58
|
i(this, "off", (t, e) => {
|
|
59
59
|
if (t === "click")
|
|
60
|
-
return
|
|
60
|
+
return W("back_button_pressed", e);
|
|
61
61
|
this.ee.off(t, e);
|
|
62
62
|
});
|
|
63
63
|
/**
|
|
64
64
|
* Checks if specified method is supported by current component.
|
|
65
65
|
*/
|
|
66
66
|
i(this, "supports");
|
|
67
|
-
this.postEvent = o, this.state = new
|
|
67
|
+
this.postEvent = o, this.state = new m({ isVisible: t }, this.ee), this.supports = C(e, {
|
|
68
68
|
show: "web_app_setup_back_button",
|
|
69
69
|
hide: "web_app_setup_back_button"
|
|
70
70
|
});
|
|
@@ -91,7 +91,7 @@ class Ct {
|
|
|
91
91
|
this.isVisible = !0;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
class
|
|
94
|
+
class ft {
|
|
95
95
|
constructor(t, e = g) {
|
|
96
96
|
i(this, "ee", new w());
|
|
97
97
|
i(this, "state");
|
|
@@ -103,7 +103,7 @@ class vt {
|
|
|
103
103
|
* Removes event listener.
|
|
104
104
|
*/
|
|
105
105
|
i(this, "off", this.ee.off.bind(this.ee));
|
|
106
|
-
this.postEvent = e, this.state = new
|
|
106
|
+
this.postEvent = e, this.state = new m({ isConfirmationNeeded: t }, this.ee);
|
|
107
107
|
}
|
|
108
108
|
set isConfirmationNeeded(t) {
|
|
109
109
|
this.state.set("isConfirmationNeeded", t), this.postEvent("web_app_setup_closing_behavior", { need_confirmation: t });
|
|
@@ -130,17 +130,17 @@ class vt {
|
|
|
130
130
|
this.isConfirmationNeeded = !0;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
const
|
|
134
|
-
function
|
|
133
|
+
const mt = ut().of(U());
|
|
134
|
+
function L(s, t) {
|
|
135
135
|
return s.reduce((e, o) => (e[o] = t, e), {});
|
|
136
136
|
}
|
|
137
|
-
class
|
|
137
|
+
class wt {
|
|
138
138
|
constructor(t, e, o = g) {
|
|
139
139
|
/**
|
|
140
140
|
* Checks if specified method is supported by current component.
|
|
141
141
|
*/
|
|
142
142
|
i(this, "supports");
|
|
143
|
-
this.createRequestId = e, this.postEvent = o, this.supports =
|
|
143
|
+
this.createRequestId = e, this.postEvent = o, this.supports = C(t, {
|
|
144
144
|
deleteKeys: "web_app_invoke_custom_method",
|
|
145
145
|
getKeys: "web_app_invoke_custom_method",
|
|
146
146
|
getValues: "web_app_invoke_custom_method",
|
|
@@ -154,7 +154,7 @@ class Et {
|
|
|
154
154
|
* @param options - execution options.
|
|
155
155
|
*/
|
|
156
156
|
async invokeCustomMethod(t, e, o = {}) {
|
|
157
|
-
const { result: n, error: r } = await
|
|
157
|
+
const { result: n, error: r } = await f(
|
|
158
158
|
"web_app_invoke_custom_method",
|
|
159
159
|
{ method: t, params: e, req_id: this.createRequestId() },
|
|
160
160
|
"custom_method_invoked",
|
|
@@ -178,7 +178,7 @@ class Et {
|
|
|
178
178
|
*/
|
|
179
179
|
async getKeys(t) {
|
|
180
180
|
const e = await this.invokeCustomMethod("getStorageKeys", {}, t);
|
|
181
|
-
return
|
|
181
|
+
return mt.parse(e);
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
184
|
* Returns map, where key is one of the specified in keys argument, and value is according
|
|
@@ -188,9 +188,9 @@ class Et {
|
|
|
188
188
|
*/
|
|
189
189
|
async getValues(t, e) {
|
|
190
190
|
if (t.length === 0)
|
|
191
|
-
return
|
|
192
|
-
const o =
|
|
193
|
-
|
|
191
|
+
return L(t, "");
|
|
192
|
+
const o = lt(
|
|
193
|
+
L(t, U())
|
|
194
194
|
// fixme
|
|
195
195
|
), n = await this.invokeCustomMethod("getStorageValues", { keys: t }, e);
|
|
196
196
|
return o.parse(n);
|
|
@@ -205,13 +205,13 @@ class Et {
|
|
|
205
205
|
await this.invokeCustomMethod("saveStorageValue", { key: t, value: e }, o);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
class
|
|
208
|
+
class Ct {
|
|
209
209
|
constructor(t, e = g) {
|
|
210
210
|
/**
|
|
211
211
|
* Checks if specified method is supported by current component.
|
|
212
212
|
*/
|
|
213
213
|
i(this, "supports");
|
|
214
|
-
this.postEvent = e, this.supports =
|
|
214
|
+
this.postEvent = e, this.supports = C(t, {
|
|
215
215
|
impactOccurred: "web_app_trigger_haptic_feedback",
|
|
216
216
|
notificationOccurred: "web_app_trigger_haptic_feedback",
|
|
217
217
|
selectionChanged: "web_app_trigger_haptic_feedback"
|
|
@@ -248,29 +248,29 @@ class kt {
|
|
|
248
248
|
this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
class
|
|
251
|
+
class vt {
|
|
252
252
|
constructor(t, e, o = {}) {
|
|
253
253
|
i(this, "state");
|
|
254
254
|
const {
|
|
255
255
|
chat: n = null,
|
|
256
256
|
canSendAfter: r = null,
|
|
257
257
|
chatType: a = null,
|
|
258
|
-
chatInstance:
|
|
259
|
-
user:
|
|
260
|
-
queryId:
|
|
261
|
-
receiver:
|
|
262
|
-
startParam:
|
|
258
|
+
chatInstance: h = null,
|
|
259
|
+
user: c = null,
|
|
260
|
+
queryId: l = null,
|
|
261
|
+
receiver: u = null,
|
|
262
|
+
startParam: p = null
|
|
263
263
|
} = o;
|
|
264
|
-
this.state = new
|
|
264
|
+
this.state = new m({
|
|
265
265
|
authDate: t,
|
|
266
266
|
canSendAfter: r === null ? null : new Date(t.getTime() + r * 1e3),
|
|
267
267
|
chat: n,
|
|
268
268
|
chatType: a,
|
|
269
|
-
chatInstance:
|
|
270
|
-
user:
|
|
271
|
-
queryId:
|
|
272
|
-
receiver:
|
|
273
|
-
startParam:
|
|
269
|
+
chatInstance: h,
|
|
270
|
+
user: c,
|
|
271
|
+
queryId: l,
|
|
272
|
+
receiver: u,
|
|
273
|
+
startParam: p,
|
|
274
274
|
hash: e
|
|
275
275
|
});
|
|
276
276
|
}
|
|
@@ -347,8 +347,8 @@ class xt {
|
|
|
347
347
|
return this.state.get("user");
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
class
|
|
351
|
-
constructor(t, e, o, n, r, a,
|
|
350
|
+
class yt {
|
|
351
|
+
constructor(t, e, o, n, r, a, h = g) {
|
|
352
352
|
i(this, "ee", new w());
|
|
353
353
|
i(this, "state");
|
|
354
354
|
/**
|
|
@@ -359,7 +359,7 @@ class Vt {
|
|
|
359
359
|
* @param event - event name.
|
|
360
360
|
* @param listener - event listener.
|
|
361
361
|
*/
|
|
362
|
-
i(this, "on", (t, e) => t === "click" ?
|
|
362
|
+
i(this, "on", (t, e) => t === "click" ? E("main_button_pressed", e) : this.ee.on(t, e));
|
|
363
363
|
/**
|
|
364
364
|
* Removes event listener.
|
|
365
365
|
* @param event - event name.
|
|
@@ -367,10 +367,10 @@ class Vt {
|
|
|
367
367
|
*/
|
|
368
368
|
i(this, "off", (t, e) => {
|
|
369
369
|
if (t === "click")
|
|
370
|
-
return
|
|
370
|
+
return W("main_button_pressed", e);
|
|
371
371
|
this.ee.off(t, e);
|
|
372
372
|
});
|
|
373
|
-
this.postEvent =
|
|
373
|
+
this.postEvent = h, this.state = new m({
|
|
374
374
|
backgroundColor: t,
|
|
375
375
|
isEnabled: e,
|
|
376
376
|
isVisible: o,
|
|
@@ -512,7 +512,7 @@ class Vt {
|
|
|
512
512
|
return this.state.set("backgroundColor", t), this.commit(), this;
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function kt(s) {
|
|
516
516
|
const t = s.message.trim(), e = (s.title || "").trim(), o = s.buttons || [];
|
|
517
517
|
let n;
|
|
518
518
|
if (e.length > 64)
|
|
@@ -526,17 +526,17 @@ function St(s) {
|
|
|
526
526
|
if (a.length > 64)
|
|
527
527
|
throw new Error(`Button ID has incorrect size: ${a}`);
|
|
528
528
|
if (r.type === void 0 || r.type === "default" || r.type === "destructive") {
|
|
529
|
-
const
|
|
530
|
-
if (
|
|
531
|
-
const
|
|
532
|
-
throw new Error(`Button text with type "${
|
|
529
|
+
const h = r.text.trim();
|
|
530
|
+
if (h.length === 0 || h.length > 64) {
|
|
531
|
+
const c = r.type || "default";
|
|
532
|
+
throw new Error(`Button text with type "${c}" has incorrect size: ${r.text.length}`);
|
|
533
533
|
}
|
|
534
|
-
return { ...r, text:
|
|
534
|
+
return { ...r, text: h, id: a };
|
|
535
535
|
}
|
|
536
536
|
return { ...r, id: a };
|
|
537
537
|
}), { title: e, message: t, buttons: n };
|
|
538
538
|
}
|
|
539
|
-
class
|
|
539
|
+
class Et {
|
|
540
540
|
constructor(t, e = g) {
|
|
541
541
|
i(this, "ee", new w());
|
|
542
542
|
i(this, "state");
|
|
@@ -552,7 +552,7 @@ class Pt {
|
|
|
552
552
|
* Checks if specified method is supported by current component.
|
|
553
553
|
*/
|
|
554
554
|
i(this, "supports");
|
|
555
|
-
this.postEvent = e, this.state = new
|
|
555
|
+
this.postEvent = e, this.state = new m({ isOpened: !1 }, this.ee), this.supports = C(t, { open: "web_app_open_popup" });
|
|
556
556
|
}
|
|
557
557
|
/**
|
|
558
558
|
* Shows whether popup is currently opened.
|
|
@@ -578,9 +578,9 @@ class Pt {
|
|
|
578
578
|
throw new Error("Popup is already opened.");
|
|
579
579
|
this.state.set("isOpened", !0);
|
|
580
580
|
try {
|
|
581
|
-
const { button_id: e = null } = await
|
|
581
|
+
const { button_id: e = null } = await f(
|
|
582
582
|
"web_app_open_popup",
|
|
583
|
-
|
|
583
|
+
kt(t),
|
|
584
584
|
"popup_closed",
|
|
585
585
|
{ postEvent: this.postEvent }
|
|
586
586
|
);
|
|
@@ -590,7 +590,7 @@ class Pt {
|
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
class
|
|
593
|
+
class xt {
|
|
594
594
|
constructor(t, e = g) {
|
|
595
595
|
i(this, "ee", new w());
|
|
596
596
|
i(this, "state");
|
|
@@ -606,7 +606,7 @@ class qt {
|
|
|
606
606
|
* Checks if specified method is supported by current component.
|
|
607
607
|
*/
|
|
608
608
|
i(this, "supports");
|
|
609
|
-
this.postEvent = e, this.state = new
|
|
609
|
+
this.postEvent = e, this.state = new m({ isOpened: !1 }, this.ee), this.supports = C(t, {
|
|
610
610
|
close: "web_app_close_scan_qr_popup",
|
|
611
611
|
open: "web_app_open_scan_qr_popup"
|
|
612
612
|
});
|
|
@@ -637,7 +637,7 @@ class qt {
|
|
|
637
637
|
throw new Error("QR scanner is already opened.");
|
|
638
638
|
this.isOpened = !0;
|
|
639
639
|
try {
|
|
640
|
-
const e = await
|
|
640
|
+
const e = await f(
|
|
641
641
|
"web_app_open_scan_qr_popup",
|
|
642
642
|
{ text: t },
|
|
643
643
|
["qr_text_received", "scan_qr_popup_closed"],
|
|
@@ -649,27 +649,39 @@ class qt {
|
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function M(s) {
|
|
653
653
|
const {
|
|
654
|
-
|
|
655
|
-
|
|
654
|
+
accentTextColor: t = null,
|
|
655
|
+
backgroundColor: e = null,
|
|
656
656
|
buttonColor: o = null,
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
657
|
+
buttonTextColor: n = null,
|
|
658
|
+
destructiveTextColor: r = null,
|
|
659
|
+
headerBackgroundColor: a = null,
|
|
660
|
+
hintColor: h = null,
|
|
661
|
+
linkColor: c = null,
|
|
662
|
+
secondaryBackgroundColor: l = null,
|
|
663
|
+
sectionBackgroundColor: u = null,
|
|
664
|
+
sectionHeaderTextColor: p = null,
|
|
665
|
+
subtitleTextColor: b = null,
|
|
666
|
+
textColor: S = null
|
|
661
667
|
} = s;
|
|
662
668
|
return {
|
|
663
|
-
|
|
664
|
-
|
|
669
|
+
accentTextColor: t,
|
|
670
|
+
backgroundColor: e,
|
|
665
671
|
buttonColor: o,
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
672
|
+
buttonTextColor: n,
|
|
673
|
+
destructiveTextColor: r,
|
|
674
|
+
headerBackgroundColor: a,
|
|
675
|
+
hintColor: h,
|
|
676
|
+
linkColor: c,
|
|
677
|
+
secondaryBackgroundColor: l,
|
|
678
|
+
sectionBackgroundColor: u,
|
|
679
|
+
sectionHeaderTextColor: p,
|
|
680
|
+
subtitleTextColor: b,
|
|
681
|
+
textColor: S
|
|
670
682
|
};
|
|
671
683
|
}
|
|
672
|
-
class
|
|
684
|
+
class q {
|
|
673
685
|
constructor(t) {
|
|
674
686
|
i(this, "ee", new w());
|
|
675
687
|
i(this, "state");
|
|
@@ -681,7 +693,7 @@ class P {
|
|
|
681
693
|
* Removes event listener.
|
|
682
694
|
*/
|
|
683
695
|
i(this, "off", this.ee.off.bind(this.ee));
|
|
684
|
-
this.state = new
|
|
696
|
+
this.state = new m(M(t), this.ee);
|
|
685
697
|
}
|
|
686
698
|
/**
|
|
687
699
|
* Requests fresh information about current theme.
|
|
@@ -690,11 +702,11 @@ class P {
|
|
|
690
702
|
* @param options - method options.
|
|
691
703
|
*/
|
|
692
704
|
static async request(t = {}) {
|
|
693
|
-
const { timeout: e = 1e3, ...o } = t, n = await
|
|
705
|
+
const { timeout: e = 1e3, ...o } = t, n = await f("web_app_request_theme", "theme_changed", {
|
|
694
706
|
...o,
|
|
695
707
|
timeout: e
|
|
696
708
|
});
|
|
697
|
-
return
|
|
709
|
+
return D(n.theme_params);
|
|
698
710
|
}
|
|
699
711
|
/**
|
|
700
712
|
* Synchronizes specified instance of ThemeParams with the actual value in the native
|
|
@@ -702,8 +714,8 @@ class P {
|
|
|
702
714
|
* @param themeParams - ThemeParams instance.
|
|
703
715
|
*/
|
|
704
716
|
static sync(t) {
|
|
705
|
-
|
|
706
|
-
t.state.set(
|
|
717
|
+
E("theme_changed", (e) => {
|
|
718
|
+
t.state.set(M(D(e.theme_params)));
|
|
707
719
|
});
|
|
708
720
|
}
|
|
709
721
|
/**
|
|
@@ -712,7 +724,7 @@ class P {
|
|
|
712
724
|
* @param options - method options.
|
|
713
725
|
*/
|
|
714
726
|
static async synced(t) {
|
|
715
|
-
const e = await this.request(t), o = new
|
|
727
|
+
const e = await this.request(t), o = new q(e);
|
|
716
728
|
return this.sync(o), o;
|
|
717
729
|
}
|
|
718
730
|
/**
|
|
@@ -744,7 +756,7 @@ class P {
|
|
|
744
756
|
* value is calculated according to theme background color.
|
|
745
757
|
*/
|
|
746
758
|
get isDark() {
|
|
747
|
-
return this.backgroundColor === null ||
|
|
759
|
+
return this.backgroundColor === null || K(this.backgroundColor);
|
|
748
760
|
}
|
|
749
761
|
/**
|
|
750
762
|
* Returns current link color.
|
|
@@ -765,7 +777,7 @@ class P {
|
|
|
765
777
|
return this.state.get("textColor");
|
|
766
778
|
}
|
|
767
779
|
}
|
|
768
|
-
function
|
|
780
|
+
function y(s) {
|
|
769
781
|
return s < 0 ? 0 : s;
|
|
770
782
|
}
|
|
771
783
|
class k {
|
|
@@ -780,11 +792,11 @@ class k {
|
|
|
780
792
|
* Removes event listener.
|
|
781
793
|
*/
|
|
782
794
|
i(this, "off", this.ee.off.bind(this.ee));
|
|
783
|
-
this.postEvent = r, this.state = new
|
|
784
|
-
height:
|
|
795
|
+
this.postEvent = r, this.state = new m({
|
|
796
|
+
height: y(t),
|
|
785
797
|
isExpanded: n,
|
|
786
|
-
stableHeight:
|
|
787
|
-
width:
|
|
798
|
+
stableHeight: y(o),
|
|
799
|
+
width: y(e)
|
|
788
800
|
}, this.ee);
|
|
789
801
|
}
|
|
790
802
|
/**
|
|
@@ -799,7 +811,7 @@ class k {
|
|
|
799
811
|
is_expanded: n,
|
|
800
812
|
is_state_stable: r,
|
|
801
813
|
...a
|
|
802
|
-
} = await
|
|
814
|
+
} = await f("web_app_request_viewport", "viewport_changed", {
|
|
803
815
|
...o,
|
|
804
816
|
timeout: e
|
|
805
817
|
});
|
|
@@ -811,18 +823,18 @@ class k {
|
|
|
811
823
|
* @param viewport - Viewport instance.
|
|
812
824
|
*/
|
|
813
825
|
static sync(t) {
|
|
814
|
-
|
|
826
|
+
E("viewport_changed", (e) => {
|
|
815
827
|
const {
|
|
816
828
|
height: o,
|
|
817
829
|
width: n,
|
|
818
830
|
is_expanded: r,
|
|
819
831
|
is_state_stable: a
|
|
820
|
-
} = e,
|
|
832
|
+
} = e, h = y(o);
|
|
821
833
|
t.state.set({
|
|
822
|
-
height:
|
|
834
|
+
height: h,
|
|
823
835
|
isExpanded: r,
|
|
824
|
-
width:
|
|
825
|
-
stableHeight: a ?
|
|
836
|
+
width: y(n),
|
|
837
|
+
stableHeight: a ? h : void 0
|
|
826
838
|
});
|
|
827
839
|
});
|
|
828
840
|
}
|
|
@@ -911,7 +923,7 @@ class k {
|
|
|
911
923
|
return this.stableHeight === this.height;
|
|
912
924
|
}
|
|
913
925
|
}
|
|
914
|
-
function
|
|
926
|
+
function I(s) {
|
|
915
927
|
const t = document.createElement("a");
|
|
916
928
|
if (t.href = s, t.protocol !== "http:" && t.protocol !== "https:")
|
|
917
929
|
throw Error(
|
|
@@ -919,7 +931,7 @@ function T(s) {
|
|
|
919
931
|
);
|
|
920
932
|
return t.href;
|
|
921
933
|
}
|
|
922
|
-
class
|
|
934
|
+
class Vt {
|
|
923
935
|
constructor(t, e, o, n, r, a = g) {
|
|
924
936
|
i(this, "ee", new w());
|
|
925
937
|
i(this, "state");
|
|
@@ -939,17 +951,17 @@ class Ot {
|
|
|
939
951
|
* Checks if specified method parameter is supported by current component.
|
|
940
952
|
*/
|
|
941
953
|
i(this, "supportsParam");
|
|
942
|
-
this.currentVersion = o, this.currentPlatform = n, this.createRequestId = r, this.postEvent = a, this.state = new
|
|
954
|
+
this.currentVersion = o, this.currentPlatform = n, this.createRequestId = r, this.postEvent = a, this.state = new m({
|
|
943
955
|
backgroundColor: e,
|
|
944
956
|
headerColor: t
|
|
945
|
-
}, this.ee), this.supports =
|
|
957
|
+
}, this.ee), this.supports = C(o, {
|
|
946
958
|
openInvoice: "web_app_open_invoice",
|
|
947
959
|
readTextFromClipboard: "web_app_read_text_from_clipboard",
|
|
948
960
|
setHeaderColor: "web_app_set_header_color",
|
|
949
961
|
setBackgroundColor: "web_app_set_background_color",
|
|
950
962
|
requestPhoneAccess: "web_app_request_phone",
|
|
951
963
|
requestWriteAccess: "web_app_request_write_access"
|
|
952
|
-
}), this.supportsParam =
|
|
964
|
+
}), this.supportsParam = bt(o, {
|
|
953
965
|
"setHeaderColor.color": ["web_app_set_header_color", "color"],
|
|
954
966
|
"openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
|
|
955
967
|
});
|
|
@@ -965,7 +977,7 @@ class Ot {
|
|
|
965
977
|
* computed based on the current background color.
|
|
966
978
|
*/
|
|
967
979
|
get colorScheme() {
|
|
968
|
-
return
|
|
980
|
+
return K(this.backgroundColor) ? "dark" : "light";
|
|
969
981
|
}
|
|
970
982
|
/**
|
|
971
983
|
* Closes the Mini App.
|
|
@@ -985,7 +997,7 @@ class Ot {
|
|
|
985
997
|
* @param version - compared version.
|
|
986
998
|
*/
|
|
987
999
|
isVersionAtLeast(t) {
|
|
988
|
-
return
|
|
1000
|
+
return dt(t, this.version) >= 0;
|
|
989
1001
|
}
|
|
990
1002
|
/**
|
|
991
1003
|
* Opens a link in an external browser. The Mini App will not be closed.
|
|
@@ -997,8 +1009,8 @@ class Ot {
|
|
|
997
1009
|
* @param tryInstantView
|
|
998
1010
|
*/
|
|
999
1011
|
openLink(t, e) {
|
|
1000
|
-
const o =
|
|
1001
|
-
if (!
|
|
1012
|
+
const o = I(t);
|
|
1013
|
+
if (!P("web_app_open_link", this.version)) {
|
|
1002
1014
|
window.open(o, "_blank");
|
|
1003
1015
|
return;
|
|
1004
1016
|
}
|
|
@@ -1014,10 +1026,10 @@ class Ot {
|
|
|
1014
1026
|
* @throws {Error} URL has not allowed hostname.
|
|
1015
1027
|
*/
|
|
1016
1028
|
openTelegramLink(t) {
|
|
1017
|
-
const { hostname: e, pathname: o, search: n } = new URL(
|
|
1029
|
+
const { hostname: e, pathname: o, search: n } = new URL(I(t));
|
|
1018
1030
|
if (e !== "t.me")
|
|
1019
1031
|
throw new Error(`URL has not allowed hostname: ${e}. Only "t.me" is allowed`);
|
|
1020
|
-
if (!
|
|
1032
|
+
if (!P("web_app_open_tg_link", this.version)) {
|
|
1021
1033
|
window.location.href = t;
|
|
1022
1034
|
return;
|
|
1023
1035
|
}
|
|
@@ -1029,16 +1041,16 @@ class Ot {
|
|
|
1029
1041
|
* @param url - invoice URL.
|
|
1030
1042
|
*/
|
|
1031
1043
|
async openInvoice(t) {
|
|
1032
|
-
const { hostname: e, pathname: o } = new URL(
|
|
1044
|
+
const { hostname: e, pathname: o } = new URL(I(t));
|
|
1033
1045
|
if (e !== "t.me")
|
|
1034
1046
|
throw new Error(`Incorrect hostname: ${e}`);
|
|
1035
1047
|
const n = o.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
|
|
1036
1048
|
if (n === null)
|
|
1037
1049
|
throw new Error('Link pathname has incorrect format. Expected to receive "/invoice/slug" or "/$slug"');
|
|
1038
1050
|
const [, , r] = n;
|
|
1039
|
-
return (await
|
|
1051
|
+
return (await f("web_app_open_invoice", { slug: r }, "invoice_closed", {
|
|
1040
1052
|
postEvent: this.postEvent,
|
|
1041
|
-
capture: ({ slug:
|
|
1053
|
+
capture: ({ slug: h }) => r === h
|
|
1042
1054
|
})).status;
|
|
1043
1055
|
}
|
|
1044
1056
|
/**
|
|
@@ -1067,7 +1079,7 @@ class Ot {
|
|
|
1067
1079
|
* - Access to clipboard is not allowed
|
|
1068
1080
|
*/
|
|
1069
1081
|
async readTextFromClipboard() {
|
|
1070
|
-
const { data: t = null } = await
|
|
1082
|
+
const { data: t = null } = await f(
|
|
1071
1083
|
"web_app_read_text_from_clipboard",
|
|
1072
1084
|
{ req_id: this.createRequestId() },
|
|
1073
1085
|
"clipboard_text_received",
|
|
@@ -1079,7 +1091,7 @@ class Ot {
|
|
|
1079
1091
|
* Requests current user phone access.
|
|
1080
1092
|
*/
|
|
1081
1093
|
async requestPhoneAccess() {
|
|
1082
|
-
const { status: t } = await
|
|
1094
|
+
const { status: t } = await f("web_app_request_phone", "phone_requested", {
|
|
1083
1095
|
postEvent: this.postEvent
|
|
1084
1096
|
});
|
|
1085
1097
|
return t;
|
|
@@ -1088,7 +1100,7 @@ class Ot {
|
|
|
1088
1100
|
* Requests write message access to current user.
|
|
1089
1101
|
*/
|
|
1090
1102
|
async requestWriteAccess() {
|
|
1091
|
-
const { status: t } = await
|
|
1103
|
+
const { status: t } = await f("web_app_request_write_access", "write_access_requested", {
|
|
1092
1104
|
postEvent: this.postEvent
|
|
1093
1105
|
});
|
|
1094
1106
|
return t;
|
|
@@ -1118,7 +1130,7 @@ class Ot {
|
|
|
1118
1130
|
* @param color - color key or RGB color.
|
|
1119
1131
|
*/
|
|
1120
1132
|
setHeaderColor(t) {
|
|
1121
|
-
this.postEvent("web_app_set_header_color",
|
|
1133
|
+
this.postEvent("web_app_set_header_color", pt(t) ? { color: t } : { color_key: t }), this.state.set("headerColor", t);
|
|
1122
1134
|
}
|
|
1123
1135
|
/**
|
|
1124
1136
|
* Updates current application background color.
|
|
@@ -1139,26 +1151,26 @@ class Ot {
|
|
|
1139
1151
|
return this.currentVersion;
|
|
1140
1152
|
}
|
|
1141
1153
|
}
|
|
1142
|
-
class
|
|
1154
|
+
class F extends Error {
|
|
1143
1155
|
constructor(t, e) {
|
|
1144
|
-
super(`Method "${t}" is not supported in the Mini Apps version ${e}.`), Object.setPrototypeOf(this,
|
|
1156
|
+
super(`Method "${t}" is not supported in the Mini Apps version ${e}.`), Object.setPrototypeOf(this, F.prototype);
|
|
1145
1157
|
}
|
|
1146
1158
|
}
|
|
1147
|
-
class
|
|
1159
|
+
class j extends Error {
|
|
1148
1160
|
constructor(t, e, o) {
|
|
1149
|
-
super(`Parameter "${e}" in method "${t}" is not supported in the Mini Apps version ${o}.`), Object.setPrototypeOf(this,
|
|
1161
|
+
super(`Parameter "${e}" in method "${t}" is not supported in the Mini Apps version ${o}.`), Object.setPrototypeOf(this, j.prototype);
|
|
1150
1162
|
}
|
|
1151
1163
|
}
|
|
1152
|
-
function
|
|
1164
|
+
function J(s, t) {
|
|
1153
1165
|
document.documentElement.style.setProperty(s, t);
|
|
1154
1166
|
}
|
|
1155
|
-
function
|
|
1156
|
-
t !== null &&
|
|
1167
|
+
function _(s, t) {
|
|
1168
|
+
t !== null && J(s, t);
|
|
1157
1169
|
}
|
|
1158
|
-
function
|
|
1159
|
-
|
|
1170
|
+
function N(s, t) {
|
|
1171
|
+
J(s, `${t}px`);
|
|
1160
1172
|
}
|
|
1161
|
-
function
|
|
1173
|
+
function St(s) {
|
|
1162
1174
|
const {
|
|
1163
1175
|
backgroundColor: t,
|
|
1164
1176
|
buttonTextColor: e,
|
|
@@ -1166,241 +1178,215 @@ function Bt(s) {
|
|
|
1166
1178
|
hintColor: n,
|
|
1167
1179
|
buttonColor: r,
|
|
1168
1180
|
linkColor: a,
|
|
1169
|
-
textColor:
|
|
1181
|
+
textColor: h
|
|
1170
1182
|
} = s;
|
|
1171
|
-
|
|
1183
|
+
_("--tg-theme-bg-color", t), _("--tg-theme-button-color", r), _("--tg-theme-button-text-color", e), _("--tg-theme-hint-color", n), _("--tg-theme-link-color", a), _("--tg-theme-secondary-bg-color", o), _("--tg-theme-text-color", h);
|
|
1172
1184
|
}
|
|
1173
|
-
function
|
|
1185
|
+
function Pt(s, t) {
|
|
1174
1186
|
const { backgroundColor: e, secondaryBackgroundColor: o } = t, { backgroundColor: n, headerColor: r } = s;
|
|
1175
|
-
|
|
1187
|
+
_("--tg-bg-color", n), _("--tg-header-color", r === "bg_color" ? e : o);
|
|
1176
1188
|
}
|
|
1177
|
-
function
|
|
1178
|
-
const t = () =>
|
|
1189
|
+
function qt(s) {
|
|
1190
|
+
const t = () => St(s);
|
|
1179
1191
|
s.on("changed", t), t();
|
|
1180
1192
|
}
|
|
1181
|
-
function
|
|
1182
|
-
const e = () =>
|
|
1193
|
+
function Ot(s, t) {
|
|
1194
|
+
const e = () => Pt(s, t);
|
|
1183
1195
|
t.on("changed", e), s.on("backgroundColorChanged", e), s.on("headerColorChanged", e), e();
|
|
1184
1196
|
}
|
|
1185
|
-
function
|
|
1197
|
+
function Tt(s) {
|
|
1186
1198
|
const t = () => {
|
|
1187
|
-
|
|
1199
|
+
N("--tg-viewport-height", s.height);
|
|
1188
1200
|
}, e = () => {
|
|
1189
|
-
|
|
1201
|
+
N("--tg-viewport-stable-height", s.stableHeight);
|
|
1190
1202
|
};
|
|
1191
1203
|
s.on("heightChanged", t), s.on("stableHeightChanged", e), t(), e();
|
|
1192
1204
|
}
|
|
1193
|
-
function
|
|
1205
|
+
function Bt(s) {
|
|
1194
1206
|
return typeof s == "boolean" ? s ? { themeParams: !0, viewport: !0, webApp: !0 } : {} : s;
|
|
1195
1207
|
}
|
|
1196
|
-
function
|
|
1208
|
+
function G(s) {
|
|
1197
1209
|
return `telegram-mini-apps-${s}`;
|
|
1198
1210
|
}
|
|
1199
|
-
function
|
|
1200
|
-
sessionStorage.setItem(
|
|
1211
|
+
function x(s, t) {
|
|
1212
|
+
sessionStorage.setItem(G(s), JSON.stringify(t));
|
|
1201
1213
|
}
|
|
1202
|
-
function
|
|
1203
|
-
const t = sessionStorage.getItem(
|
|
1214
|
+
function V(s) {
|
|
1215
|
+
const t = sessionStorage.getItem(G(s));
|
|
1204
1216
|
return t ? JSON.parse(t) : null;
|
|
1205
1217
|
}
|
|
1206
|
-
function
|
|
1207
|
-
const { isVisible: o = !1 } = s ?
|
|
1218
|
+
function It(s, t, e) {
|
|
1219
|
+
const { isVisible: o = !1 } = s ? V("back-button") || {} : {}, n = new _t(o, t, e);
|
|
1208
1220
|
return n.on("isVisibleChanged", () => {
|
|
1209
|
-
|
|
1221
|
+
x("back-button", { isVisible: n.isVisible });
|
|
1210
1222
|
}), n;
|
|
1211
1223
|
}
|
|
1212
|
-
function
|
|
1213
|
-
const { isConfirmationNeeded: e = !1 } = s ?
|
|
1214
|
-
return o.on("isConfirmationNeededChanged", () =>
|
|
1224
|
+
function $t(s, t) {
|
|
1225
|
+
const { isConfirmationNeeded: e = !1 } = s ? V("closing-behavior") || {} : {}, o = new ft(e, t);
|
|
1226
|
+
return o.on("isConfirmationNeededChanged", () => x("closing-behavior", {
|
|
1215
1227
|
isConfirmationNeeded: o.isConfirmationNeeded
|
|
1216
1228
|
})), o;
|
|
1217
1229
|
}
|
|
1218
|
-
function
|
|
1230
|
+
function At(s, t, e, o) {
|
|
1219
1231
|
const {
|
|
1220
1232
|
backgroundColor: n = t,
|
|
1221
1233
|
isEnabled: r = !1,
|
|
1222
1234
|
isVisible: a = !1,
|
|
1223
|
-
isProgressVisible:
|
|
1224
|
-
textColor:
|
|
1225
|
-
text:
|
|
1226
|
-
} = s ?
|
|
1235
|
+
isProgressVisible: h = !1,
|
|
1236
|
+
textColor: c = e,
|
|
1237
|
+
text: l = ""
|
|
1238
|
+
} = s ? V("main-button") || {} : {}, u = new yt(
|
|
1227
1239
|
n,
|
|
1228
1240
|
r,
|
|
1229
1241
|
a,
|
|
1242
|
+
h,
|
|
1243
|
+
l,
|
|
1230
1244
|
c,
|
|
1231
|
-
p,
|
|
1232
|
-
u,
|
|
1233
1245
|
o
|
|
1234
|
-
),
|
|
1235
|
-
backgroundColor:
|
|
1236
|
-
isEnabled:
|
|
1237
|
-
isVisible:
|
|
1238
|
-
isProgressVisible:
|
|
1239
|
-
text:
|
|
1240
|
-
textColor:
|
|
1246
|
+
), p = () => x("main-button", {
|
|
1247
|
+
backgroundColor: u.backgroundColor,
|
|
1248
|
+
isEnabled: u.isEnabled,
|
|
1249
|
+
isVisible: u.isVisible,
|
|
1250
|
+
isProgressVisible: u.isProgressVisible,
|
|
1251
|
+
text: u.text,
|
|
1252
|
+
textColor: u.textColor
|
|
1241
1253
|
});
|
|
1242
|
-
return
|
|
1254
|
+
return u.on("backgroundColorChanged", p), u.on("isEnabledChanged", p), u.on("isVisibleChanged", p), u.on("isProgressVisibleChanged", p), u.on("textColorChanged", p), u.on("textChanged", p), u;
|
|
1243
1255
|
}
|
|
1244
|
-
function
|
|
1245
|
-
return s ? (e, o) => {
|
|
1246
|
-
if (!C(e, t))
|
|
1247
|
-
throw new I(e, t);
|
|
1248
|
-
return ft(o) && ht(e, o).forEach((n) => {
|
|
1249
|
-
if (!C(e, n, t))
|
|
1250
|
-
throw new $(e, n, t);
|
|
1251
|
-
}), g(e, o);
|
|
1252
|
-
} : g;
|
|
1253
|
-
}
|
|
1254
|
-
function Mt() {
|
|
1256
|
+
function Ht() {
|
|
1255
1257
|
let s = 0;
|
|
1256
1258
|
return () => (s += 1, s.toString());
|
|
1257
1259
|
}
|
|
1258
|
-
function
|
|
1259
|
-
const t = new
|
|
1260
|
-
return
|
|
1260
|
+
function Rt(s) {
|
|
1261
|
+
const t = new q(s);
|
|
1262
|
+
return q.sync(t), t;
|
|
1261
1263
|
}
|
|
1262
|
-
async function
|
|
1264
|
+
async function Dt(s, t, e) {
|
|
1263
1265
|
const {
|
|
1264
1266
|
height: o = window.innerHeight,
|
|
1265
1267
|
stableHeight: n = window.innerHeight,
|
|
1266
1268
|
width: r = window.innerWidth,
|
|
1267
1269
|
isExpanded: a = !1
|
|
1268
|
-
} = s ?
|
|
1269
|
-
const
|
|
1270
|
-
return k.sync(
|
|
1271
|
-
})() : await k.synced({ postEvent: e }),
|
|
1272
|
-
height:
|
|
1273
|
-
isExpanded:
|
|
1274
|
-
stableHeight:
|
|
1275
|
-
width:
|
|
1270
|
+
} = s ? V("viewport") || {} : {}, c = t === "macos" || t === "web" ? (() => {
|
|
1271
|
+
const u = new k(o, r, n, a, e);
|
|
1272
|
+
return k.sync(u), u;
|
|
1273
|
+
})() : await k.synced({ postEvent: e }), l = () => x("viewport", {
|
|
1274
|
+
height: c.height,
|
|
1275
|
+
isExpanded: c.isExpanded,
|
|
1276
|
+
stableHeight: c.stableHeight,
|
|
1277
|
+
width: c.width
|
|
1276
1278
|
});
|
|
1277
|
-
return
|
|
1279
|
+
return c.on("heightChanged", l), c.on("isExpandedChanged", l), c.on("stableHeightChanged", l), c.on("widthChanged", l), c;
|
|
1278
1280
|
}
|
|
1279
|
-
function
|
|
1281
|
+
function Lt(s, t, e, o, n, r) {
|
|
1280
1282
|
const {
|
|
1281
1283
|
backgroundColor: a = t,
|
|
1282
|
-
headerColor:
|
|
1283
|
-
} = s ?
|
|
1284
|
-
|
|
1284
|
+
headerColor: h = "bg_color"
|
|
1285
|
+
} = s ? V("web-app") || {} : {}, c = new Vt(
|
|
1286
|
+
h,
|
|
1285
1287
|
a,
|
|
1286
1288
|
e,
|
|
1287
1289
|
o,
|
|
1288
1290
|
n,
|
|
1289
1291
|
r
|
|
1290
|
-
),
|
|
1291
|
-
backgroundColor:
|
|
1292
|
-
headerColor:
|
|
1292
|
+
), l = () => x("web-app", {
|
|
1293
|
+
backgroundColor: c.backgroundColor,
|
|
1294
|
+
headerColor: c.headerColor
|
|
1293
1295
|
});
|
|
1294
|
-
return
|
|
1296
|
+
return c.on("backgroundColorChanged", l), c.on("headerColorChanged", l), c;
|
|
1295
1297
|
}
|
|
1296
|
-
function
|
|
1297
|
-
let s;
|
|
1298
|
-
try {
|
|
1299
|
-
return W(window.location.hash.slice(1));
|
|
1300
|
-
} catch (e) {
|
|
1301
|
-
s = e;
|
|
1302
|
-
}
|
|
1303
|
-
const t = F();
|
|
1304
|
-
if (t)
|
|
1305
|
-
return t;
|
|
1306
|
-
throw new Error("Unable to extract launch params", { cause: s });
|
|
1307
|
-
}
|
|
1308
|
-
function Ft() {
|
|
1309
|
-
return window.performance.getEntriesByType("navigation").some((s) => s.type === "reload");
|
|
1310
|
-
}
|
|
1311
|
-
function Kt(s, t) {
|
|
1312
|
-
var e, o;
|
|
1313
|
-
return s ? ((e = s.initData) == null ? void 0 : e.hash) === ((o = t.initData) == null ? void 0 : o.hash) : !1;
|
|
1314
|
-
}
|
|
1315
|
-
async function jt(s = {}) {
|
|
1298
|
+
async function Mt(s = {}) {
|
|
1316
1299
|
const {
|
|
1317
1300
|
checkCompat: t = !0,
|
|
1318
1301
|
cssVars: e = !1,
|
|
1319
1302
|
acceptScrollbarStyle: o = !0,
|
|
1320
1303
|
acceptCustomStyles: n = o,
|
|
1321
1304
|
targetOrigin: r,
|
|
1322
|
-
|
|
1323
|
-
|
|
1305
|
+
launchParams: a,
|
|
1306
|
+
debug: h = !1
|
|
1324
1307
|
} = s;
|
|
1325
|
-
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
initData:
|
|
1330
|
-
initDataRaw:
|
|
1331
|
-
version:
|
|
1332
|
-
platform:
|
|
1333
|
-
themeParams:
|
|
1334
|
-
} =
|
|
1335
|
-
backgroundColor:
|
|
1336
|
-
buttonColor:
|
|
1337
|
-
buttonTextColor:
|
|
1338
|
-
} =
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1308
|
+
h && it(h), typeof r == "string" && at(r);
|
|
1309
|
+
const { launchParams: c, isPageReload: l } = z({
|
|
1310
|
+
currentLaunchParams: typeof a == "string" || a instanceof URLSearchParams ? rt(a) : a
|
|
1311
|
+
}), {
|
|
1312
|
+
initData: u,
|
|
1313
|
+
initDataRaw: p,
|
|
1314
|
+
version: b,
|
|
1315
|
+
platform: S,
|
|
1316
|
+
themeParams: $
|
|
1317
|
+
} = c, {
|
|
1318
|
+
backgroundColor: Q = "#ffffff",
|
|
1319
|
+
buttonColor: Z = "#000000",
|
|
1320
|
+
buttonTextColor: X = "#ffffff"
|
|
1321
|
+
} = $, A = Ht(), d = t ? ct(b) : g, O = Rt($), H = Lt(
|
|
1322
|
+
l,
|
|
1323
|
+
Q,
|
|
1324
|
+
b,
|
|
1325
|
+
S,
|
|
1342
1326
|
A,
|
|
1343
|
-
R,
|
|
1344
1327
|
d
|
|
1345
1328
|
), {
|
|
1346
|
-
themeParams:
|
|
1347
|
-
viewport:
|
|
1348
|
-
webApp:
|
|
1349
|
-
} =
|
|
1350
|
-
|
|
1351
|
-
const
|
|
1352
|
-
if (
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1355
|
-
|
|
1329
|
+
themeParams: Y,
|
|
1330
|
+
viewport: tt,
|
|
1331
|
+
webApp: et
|
|
1332
|
+
} = Bt(e);
|
|
1333
|
+
et && Ot(H, O), Y && qt(O);
|
|
1334
|
+
const R = await Dt(l, S, d);
|
|
1335
|
+
if (tt && Tt(R), n && ht()) {
|
|
1336
|
+
const v = document.createElement("style");
|
|
1337
|
+
v.id = "telegram-custom-styles", document.head.appendChild(v), E("set_custom_style", (B) => {
|
|
1338
|
+
v.innerHTML = B;
|
|
1356
1339
|
}), d("iframe_ready");
|
|
1357
1340
|
}
|
|
1358
|
-
const
|
|
1359
|
-
backButton:
|
|
1360
|
-
closingBehavior:
|
|
1361
|
-
cloudStorage: new
|
|
1362
|
-
haptic: new
|
|
1363
|
-
mainButton:
|
|
1364
|
-
popup: new
|
|
1341
|
+
const T = {
|
|
1342
|
+
backButton: It(l, b, d),
|
|
1343
|
+
closingBehavior: $t(l, d),
|
|
1344
|
+
cloudStorage: new wt(b, A, d),
|
|
1345
|
+
haptic: new Ct(b, d),
|
|
1346
|
+
mainButton: At(l, Z, X, d),
|
|
1347
|
+
popup: new Et(b, d),
|
|
1365
1348
|
postEvent: d,
|
|
1366
|
-
qrScanner: new
|
|
1367
|
-
themeParams:
|
|
1368
|
-
viewport:
|
|
1369
|
-
webApp:
|
|
1349
|
+
qrScanner: new xt(b, d),
|
|
1350
|
+
themeParams: O,
|
|
1351
|
+
viewport: R,
|
|
1352
|
+
webApp: H
|
|
1370
1353
|
};
|
|
1371
|
-
if (
|
|
1372
|
-
const { authDate:
|
|
1373
|
-
|
|
1354
|
+
if (u !== void 0) {
|
|
1355
|
+
const { authDate: v, hash: B, ...st } = u;
|
|
1356
|
+
T.initData = new vt(v, B, st), T.initDataRaw = p;
|
|
1374
1357
|
}
|
|
1375
|
-
return
|
|
1358
|
+
return T;
|
|
1376
1359
|
}
|
|
1377
|
-
function
|
|
1378
|
-
return
|
|
1360
|
+
function Qt(s = {}) {
|
|
1361
|
+
return gt(Mt(s), s.timeout || 1e3);
|
|
1379
1362
|
}
|
|
1380
|
-
function
|
|
1363
|
+
function Nt() {
|
|
1381
1364
|
try {
|
|
1382
|
-
return
|
|
1365
|
+
return z(), !0;
|
|
1383
1366
|
} catch {
|
|
1384
1367
|
return !1;
|
|
1385
1368
|
}
|
|
1386
1369
|
}
|
|
1370
|
+
function Zt() {
|
|
1371
|
+
return Nt();
|
|
1372
|
+
}
|
|
1387
1373
|
export {
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1374
|
+
_t as BackButton,
|
|
1375
|
+
ft as ClosingBehaviour,
|
|
1376
|
+
wt as CloudStorage,
|
|
1377
|
+
Ct as HapticFeedback,
|
|
1378
|
+
vt as InitData,
|
|
1379
|
+
yt as MainButton,
|
|
1380
|
+
F as MethodNotSupportedError,
|
|
1381
|
+
j as ParameterUnsupportedError,
|
|
1382
|
+
Et as Popup,
|
|
1383
|
+
xt as QRScanner,
|
|
1384
|
+
q as ThemeParams,
|
|
1399
1385
|
k as Viewport,
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1386
|
+
Vt as WebApp,
|
|
1387
|
+
I as formatURL,
|
|
1388
|
+
Qt as init,
|
|
1389
|
+
Nt as isTMA,
|
|
1390
|
+
Zt as isTWA
|
|
1405
1391
|
};
|
|
1406
1392
|
//# sourceMappingURL=index.mjs.map
|