@tma.js/sdk-solid 2.1.5 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +179 -164
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { createComponent as
|
|
1
|
+
import { createComponent as bt, mergeProps as ut, createContext as ee, useContext as se, createEffect as dt, onCleanup as lt, createResource as ne, createMemo as _t, from as re } from "solid-js";
|
|
2
2
|
var ie = Object.defineProperty, oe = (e, t, s) => t in e ? ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (oe(e, typeof t != "symbol" ? t + "" : t, s), s);
|
|
3
|
-
function
|
|
3
|
+
function vt(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 =
|
|
10
|
+
function yt(e) {
|
|
11
|
+
const t = U(), { count: s } = t;
|
|
12
12
|
t.unsubscribe(e), s && !t.count && Se();
|
|
13
13
|
}
|
|
14
14
|
function ae(e) {
|
|
15
|
-
return
|
|
15
|
+
return U().subscribe(e), () => yt(e);
|
|
16
16
|
}
|
|
17
17
|
class ce {
|
|
18
18
|
constructor(t, s = {}) {
|
|
@@ -59,16 +59,16 @@ const X = new ce("SDK", {
|
|
|
59
59
|
textColor: "white"
|
|
60
60
|
});
|
|
61
61
|
let F = !1;
|
|
62
|
-
const
|
|
62
|
+
const gt = ({ name: e, payload: t }) => {
|
|
63
63
|
X.log("Event received:", t ? { name: e, payload: t } : { name: e });
|
|
64
64
|
};
|
|
65
65
|
function he(e) {
|
|
66
|
-
F !== e && (F = e, e ? ae(
|
|
66
|
+
F !== e && (F = e, e ? ae(gt) : yt(gt));
|
|
67
67
|
}
|
|
68
68
|
function pe(...e) {
|
|
69
69
|
F && X.log(...e);
|
|
70
70
|
}
|
|
71
|
-
class
|
|
71
|
+
class k {
|
|
72
72
|
constructor() {
|
|
73
73
|
c(this, "listeners", /* @__PURE__ */ new Map()), c(this, "listenersCount", 0), c(this, "subscribeListeners", []);
|
|
74
74
|
}
|
|
@@ -141,7 +141,7 @@ class O {
|
|
|
141
141
|
function Q(e, t, s) {
|
|
142
142
|
return window.addEventListener(e, t, s), () => window.removeEventListener(e, t, s);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function tt(...e) {
|
|
145
145
|
let t = !1;
|
|
146
146
|
const s = [...e];
|
|
147
147
|
return [
|
|
@@ -190,10 +190,10 @@ class L {
|
|
|
190
190
|
return this.isOptional = !0, this;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function R(e, t) {
|
|
194
194
|
return () => new L(e, !1, t);
|
|
195
195
|
}
|
|
196
|
-
const y =
|
|
196
|
+
const y = R((e) => {
|
|
197
197
|
if (typeof e == "boolean")
|
|
198
198
|
return e;
|
|
199
199
|
const t = String(e);
|
|
@@ -225,7 +225,7 @@ function Pt(e, t) {
|
|
|
225
225
|
}
|
|
226
226
|
return s;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function et(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();
|
|
@@ -233,11 +233,11 @@ function tt(e) {
|
|
|
233
233
|
}
|
|
234
234
|
function f(e, t) {
|
|
235
235
|
return new L((s) => {
|
|
236
|
-
const n =
|
|
236
|
+
const n = et(s);
|
|
237
237
|
return Pt(e, (r) => n[r]);
|
|
238
238
|
}, !1, t);
|
|
239
239
|
}
|
|
240
|
-
const P =
|
|
240
|
+
const P = R((e) => {
|
|
241
241
|
if (typeof e == "number")
|
|
242
242
|
return e;
|
|
243
243
|
if (typeof e == "string") {
|
|
@@ -247,7 +247,7 @@ const P = T((e) => {
|
|
|
247
247
|
}
|
|
248
248
|
throw S();
|
|
249
249
|
}, "number");
|
|
250
|
-
function
|
|
250
|
+
function st(e) {
|
|
251
251
|
return /^#[\da-f]{6}$/i.test(e);
|
|
252
252
|
}
|
|
253
253
|
function ve(e) {
|
|
@@ -255,7 +255,7 @@ function ve(e) {
|
|
|
255
255
|
}
|
|
256
256
|
function xt(e) {
|
|
257
257
|
const t = e.replace(/\s/g, "").toLowerCase();
|
|
258
|
-
if (
|
|
258
|
+
if (st(t))
|
|
259
259
|
return t;
|
|
260
260
|
if (ve(t)) {
|
|
261
261
|
let n = "#";
|
|
@@ -271,11 +271,11 @@ function xt(e) {
|
|
|
271
271
|
return n + (i.length === 1 ? "0" : "") + i;
|
|
272
272
|
}, "#");
|
|
273
273
|
}
|
|
274
|
-
const p =
|
|
274
|
+
const p = R((e) => {
|
|
275
275
|
if (typeof e == "string" || typeof e == "number")
|
|
276
276
|
return e.toString();
|
|
277
277
|
throw S();
|
|
278
|
-
}, "string"), Ct =
|
|
278
|
+
}, "string"), Ct = R((e) => xt(p().parse(e)), "rgb");
|
|
279
279
|
function St(e) {
|
|
280
280
|
return f({
|
|
281
281
|
eventType: p(),
|
|
@@ -336,7 +336,7 @@ const Pe = {
|
|
|
336
336
|
theme_changed: f({
|
|
337
337
|
theme_params: (e) => {
|
|
338
338
|
const t = Ct().optional();
|
|
339
|
-
return Object.entries(
|
|
339
|
+
return Object.entries(et(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
|
|
340
340
|
}
|
|
341
341
|
}),
|
|
342
342
|
viewport_changed: f({
|
|
@@ -348,11 +348,11 @@ const Pe = {
|
|
|
348
348
|
write_access_requested: f({ status: p() })
|
|
349
349
|
};
|
|
350
350
|
function xe() {
|
|
351
|
-
const e = new
|
|
351
|
+
const e = new k(), t = new k();
|
|
352
352
|
t.subscribe((n) => {
|
|
353
353
|
e.emit("event", { name: n.event, payload: n.args[0] });
|
|
354
354
|
}), Ee();
|
|
355
|
-
const [, s] =
|
|
355
|
+
const [, s] = tt(
|
|
356
356
|
// Don't forget to remove created handlers.
|
|
357
357
|
ye,
|
|
358
358
|
// Add "resize" event listener to make sure, we always have fresh viewport information.
|
|
@@ -409,7 +409,7 @@ function xe() {
|
|
|
409
409
|
}
|
|
410
410
|
}, s];
|
|
411
411
|
}
|
|
412
|
-
const [Ce, Se] =
|
|
412
|
+
const [Ce, Se] = vt(
|
|
413
413
|
(e) => {
|
|
414
414
|
const [t, s] = xe(), n = t.off.bind(t);
|
|
415
415
|
return t.off = (r, i) => {
|
|
@@ -419,19 +419,19 @@ const [Ce, Se] = bt(
|
|
|
419
419
|
},
|
|
420
420
|
([, e]) => e()
|
|
421
421
|
);
|
|
422
|
-
function
|
|
422
|
+
function U() {
|
|
423
423
|
return Ce()[0];
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
|
|
425
|
+
function H(e, t) {
|
|
426
|
+
U().off(e, t);
|
|
427
427
|
}
|
|
428
428
|
function v(e, t, s) {
|
|
429
|
-
return
|
|
429
|
+
return U().on(e, t, s);
|
|
430
430
|
}
|
|
431
431
|
function N(e) {
|
|
432
432
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Re(e, t) {
|
|
435
435
|
const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
|
|
436
436
|
for (let i = 0; i < r; i += 1) {
|
|
437
437
|
const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
|
|
@@ -441,7 +441,7 @@ function Te(e, t) {
|
|
|
441
441
|
return 0;
|
|
442
442
|
}
|
|
443
443
|
function b(e, t) {
|
|
444
|
-
return
|
|
444
|
+
return Re(e, t) <= 0;
|
|
445
445
|
}
|
|
446
446
|
function x(e, t, s) {
|
|
447
447
|
if (typeof s == "string") {
|
|
@@ -494,13 +494,13 @@ function x(e, t, s) {
|
|
|
494
494
|
].includes(e);
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function Rt(e) {
|
|
498
498
|
return "external" in e && N(e.external) && "notify" in e.external && typeof e.external.notify == "function";
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function Tt(e) {
|
|
501
501
|
return "TelegramWebviewProxy" in e && N(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function nt() {
|
|
504
504
|
try {
|
|
505
505
|
return window.self !== window.top;
|
|
506
506
|
} catch {
|
|
@@ -511,22 +511,22 @@ let At = "https://web.telegram.org";
|
|
|
511
511
|
function Fs(e) {
|
|
512
512
|
At = e;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function Te() {
|
|
515
515
|
return At;
|
|
516
516
|
}
|
|
517
517
|
function q(e, t, s) {
|
|
518
518
|
let n = {}, r;
|
|
519
519
|
t === void 0 && s === void 0 ? n = {} : t !== void 0 && s !== void 0 ? (n = s, r = t) : t !== void 0 && ("targetOrigin" in t ? n = t : r = t);
|
|
520
|
-
const { targetOrigin: i =
|
|
521
|
-
if (pe("Posting event:", r ? { event: e, data: r } : { event: e }),
|
|
520
|
+
const { targetOrigin: i = Te() } = n;
|
|
521
|
+
if (pe("Posting event:", r ? { event: e, data: r } : { event: e }), nt()) {
|
|
522
522
|
window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
|
|
523
523
|
return;
|
|
524
524
|
}
|
|
525
|
-
if (
|
|
525
|
+
if (Rt(window)) {
|
|
526
526
|
window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
|
|
527
527
|
return;
|
|
528
528
|
}
|
|
529
|
-
if (
|
|
529
|
+
if (Tt(window)) {
|
|
530
530
|
window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
|
|
531
531
|
return;
|
|
532
532
|
}
|
|
@@ -553,7 +553,7 @@ function Ae(e) {
|
|
|
553
553
|
function It(e) {
|
|
554
554
|
return ({ req_id: t }) => t === e;
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function kt(e) {
|
|
557
557
|
return m(ge, `Timeout reached: ${e}ms`);
|
|
558
558
|
}
|
|
559
559
|
function qt(e, t) {
|
|
@@ -561,28 +561,24 @@ function qt(e, t) {
|
|
|
561
561
|
typeof e == "function" ? e() : e,
|
|
562
562
|
new Promise((s, n) => {
|
|
563
563
|
setTimeout(() => {
|
|
564
|
-
n(
|
|
564
|
+
n(kt(t));
|
|
565
565
|
}, t);
|
|
566
566
|
})
|
|
567
567
|
]);
|
|
568
568
|
}
|
|
569
569
|
async function w(e) {
|
|
570
570
|
let t;
|
|
571
|
-
const s = new Promise((
|
|
572
|
-
t =
|
|
573
|
-
}), {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
postEvent: o = q,
|
|
578
|
-
timeout: a
|
|
579
|
-
} = e, h = (Array.isArray(r) ? r : [r]).map(
|
|
580
|
-
(u) => v(u, (d) => (!i || i(d)) && t(d))
|
|
571
|
+
const s = new Promise((a) => {
|
|
572
|
+
t = a;
|
|
573
|
+
}), { event: n, capture: r, timeout: i } = e, [, o] = tt(
|
|
574
|
+
...(Array.isArray(n) ? n : [n]).map(
|
|
575
|
+
(a) => v(a, (h) => (!r || r(h)) && t(h))
|
|
576
|
+
)
|
|
581
577
|
);
|
|
582
578
|
try {
|
|
583
|
-
return
|
|
579
|
+
return (e.postEvent || q)(e.method, e.params), await (i ? qt(s, i) : s);
|
|
584
580
|
} finally {
|
|
585
|
-
|
|
581
|
+
o();
|
|
586
582
|
}
|
|
587
583
|
}
|
|
588
584
|
async function A(e, t, s, n = {}) {
|
|
@@ -620,7 +616,7 @@ function Qs(...e) {
|
|
|
620
616
|
i.length && (t[n] = i);
|
|
621
617
|
}), t), {});
|
|
622
618
|
}
|
|
623
|
-
function
|
|
619
|
+
function Ot(e) {
|
|
624
620
|
const t = xt(e);
|
|
625
621
|
return Math.sqrt(
|
|
626
622
|
[0.299, 0.587, 0.114].reduce((s, n, r) => {
|
|
@@ -631,7 +627,7 @@ function kt(e) {
|
|
|
631
627
|
}
|
|
632
628
|
class Ie {
|
|
633
629
|
constructor(t) {
|
|
634
|
-
c(this, "ee", new
|
|
630
|
+
c(this, "ee", new k()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
|
|
635
631
|
}
|
|
636
632
|
/**
|
|
637
633
|
* Clones current state and returns its copy.
|
|
@@ -650,7 +646,7 @@ class Ie {
|
|
|
650
646
|
return this.state[t];
|
|
651
647
|
}
|
|
652
648
|
}
|
|
653
|
-
class
|
|
649
|
+
class rt {
|
|
654
650
|
constructor(t) {
|
|
655
651
|
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);
|
|
656
652
|
}
|
|
@@ -658,17 +654,17 @@ class nt {
|
|
|
658
654
|
function Nt(e, t) {
|
|
659
655
|
return (s) => x(t[s], e);
|
|
660
656
|
}
|
|
661
|
-
class
|
|
657
|
+
class it extends rt {
|
|
662
658
|
constructor(t, s, n) {
|
|
663
659
|
super(t), c(this, "supports"), this.supports = Nt(s, n);
|
|
664
660
|
}
|
|
665
661
|
}
|
|
666
|
-
class
|
|
662
|
+
class ke extends it {
|
|
667
663
|
constructor(t, s, n) {
|
|
668
664
|
super({ isVisible: t }, s, {
|
|
669
665
|
show: "web_app_setup_back_button",
|
|
670
666
|
hide: "web_app_setup_back_button"
|
|
671
|
-
}), c(this, "on", (r, i) => r === "click" ? v("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ?
|
|
667
|
+
}), c(this, "on", (r, i) => r === "click" ? v("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? H("back_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
|
|
672
668
|
}
|
|
673
669
|
set isVisible(t) {
|
|
674
670
|
this.set("isVisible", t), this.postEvent("web_app_setup_back_button", { is_visible: t });
|
|
@@ -692,8 +688,8 @@ class Oe extends rt {
|
|
|
692
688
|
this.isVisible = !0;
|
|
693
689
|
}
|
|
694
690
|
}
|
|
695
|
-
const Dt =
|
|
696
|
-
function
|
|
691
|
+
const Dt = R((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
|
|
692
|
+
function ot(e, t) {
|
|
697
693
|
return new L((s) => {
|
|
698
694
|
if (typeof s != "string" && !(s instanceof URLSearchParams))
|
|
699
695
|
throw S();
|
|
@@ -713,7 +709,7 @@ const qe = f({
|
|
|
713
709
|
from: "photo_url"
|
|
714
710
|
},
|
|
715
711
|
username: p().optional()
|
|
716
|
-
}, "Chat").optional(),
|
|
712
|
+
}, "Chat").optional(), ft = f({
|
|
717
713
|
addedToAttachmentMenu: {
|
|
718
714
|
type: y().optional(),
|
|
719
715
|
from: "added_to_attachment_menu"
|
|
@@ -750,7 +746,7 @@ const qe = f({
|
|
|
750
746
|
username: p().optional()
|
|
751
747
|
}, "User").optional();
|
|
752
748
|
function Vt() {
|
|
753
|
-
return
|
|
749
|
+
return ot({
|
|
754
750
|
authDate: {
|
|
755
751
|
type: Dt(),
|
|
756
752
|
from: "auth_date"
|
|
@@ -773,29 +769,29 @@ function Vt() {
|
|
|
773
769
|
type: p().optional(),
|
|
774
770
|
from: "query_id"
|
|
775
771
|
},
|
|
776
|
-
receiver:
|
|
772
|
+
receiver: ft,
|
|
777
773
|
startParam: {
|
|
778
774
|
type: p().optional(),
|
|
779
775
|
from: "start_param"
|
|
780
776
|
},
|
|
781
|
-
user:
|
|
777
|
+
user: ft
|
|
782
778
|
}, "InitData");
|
|
783
779
|
}
|
|
784
|
-
function
|
|
780
|
+
function Oe(e) {
|
|
785
781
|
return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
786
782
|
}
|
|
787
783
|
function Ne(e) {
|
|
788
784
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
789
785
|
}
|
|
790
|
-
const Mt =
|
|
786
|
+
const Mt = R(
|
|
791
787
|
(e) => {
|
|
792
788
|
const t = Ct().optional();
|
|
793
|
-
return Object.entries(
|
|
789
|
+
return Object.entries(et(e)).reduce((s, [n, r]) => (s[Oe(n)] = t.parse(r), s), {});
|
|
794
790
|
},
|
|
795
791
|
"ThemeParams"
|
|
796
792
|
);
|
|
797
|
-
function
|
|
798
|
-
return
|
|
793
|
+
function at(e) {
|
|
794
|
+
return ot({
|
|
799
795
|
botInline: {
|
|
800
796
|
type: y().optional(),
|
|
801
797
|
from: "tgWebAppBotInline"
|
|
@@ -831,7 +827,7 @@ function ot(e) {
|
|
|
831
827
|
}).parse(e);
|
|
832
828
|
}
|
|
833
829
|
function Bt(e) {
|
|
834
|
-
return
|
|
830
|
+
return at(
|
|
835
831
|
e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
|
|
836
832
|
);
|
|
837
833
|
}
|
|
@@ -850,10 +846,10 @@ function Ve() {
|
|
|
850
846
|
function Lt(e) {
|
|
851
847
|
return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
|
|
852
848
|
}
|
|
853
|
-
function
|
|
849
|
+
function Ut(e, t) {
|
|
854
850
|
sessionStorage.setItem(Lt(e), JSON.stringify(t));
|
|
855
851
|
}
|
|
856
|
-
function
|
|
852
|
+
function Ht(e) {
|
|
857
853
|
const t = sessionStorage.getItem(Lt(e));
|
|
858
854
|
try {
|
|
859
855
|
return t ? JSON.parse(t) : void 0;
|
|
@@ -861,7 +857,7 @@ function Ut(e) {
|
|
|
861
857
|
}
|
|
862
858
|
}
|
|
863
859
|
function Me() {
|
|
864
|
-
return
|
|
860
|
+
return at(Ht("launchParams") || "");
|
|
865
861
|
}
|
|
866
862
|
function Wt(e) {
|
|
867
863
|
return JSON.stringify(
|
|
@@ -883,7 +879,7 @@ function Be(e) {
|
|
|
883
879
|
return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams", Wt(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();
|
|
884
880
|
}
|
|
885
881
|
function jt(e) {
|
|
886
|
-
|
|
882
|
+
Ut("launchParams", Be(e));
|
|
887
883
|
}
|
|
888
884
|
function $e() {
|
|
889
885
|
for (const e of [
|
|
@@ -910,26 +906,26 @@ function Le() {
|
|
|
910
906
|
let e = 0;
|
|
911
907
|
return () => (e += 1).toString();
|
|
912
908
|
}
|
|
913
|
-
const [
|
|
909
|
+
const [Ue] = vt(Le);
|
|
914
910
|
function l(e, t) {
|
|
915
911
|
return () => {
|
|
916
912
|
const s = $e(), n = {
|
|
917
913
|
...s,
|
|
918
914
|
postEvent: Ae(s.version),
|
|
919
|
-
createRequestId:
|
|
915
|
+
createRequestId: Ue()
|
|
920
916
|
};
|
|
921
917
|
if (typeof e == "function")
|
|
922
918
|
return e(n);
|
|
923
|
-
const [r, i, o] =
|
|
919
|
+
const [r, i, o] = tt(), a = t({
|
|
924
920
|
...n,
|
|
925
921
|
// State should only be passed only in case, current page was reloaded. If we don't add
|
|
926
922
|
// this check, state restoration will work improperly in the web version of Telegram,
|
|
927
923
|
// when we are always working in the same "session" (tab).
|
|
928
|
-
state: Gt() ?
|
|
924
|
+
state: Gt() ? Ht(e) : void 0,
|
|
929
925
|
addCleanup: r
|
|
930
926
|
}), h = (u) => (o || r(
|
|
931
927
|
u.on("change", (d) => {
|
|
932
|
-
|
|
928
|
+
Ut(e, d);
|
|
933
929
|
})
|
|
934
930
|
), u);
|
|
935
931
|
return [
|
|
@@ -938,12 +934,12 @@ function l(e, t) {
|
|
|
938
934
|
];
|
|
939
935
|
};
|
|
940
936
|
}
|
|
941
|
-
const
|
|
937
|
+
const He = l("backButton", ({
|
|
942
938
|
postEvent: e,
|
|
943
939
|
version: t,
|
|
944
940
|
state: s = { isVisible: !1 }
|
|
945
|
-
}) => new
|
|
946
|
-
class D extends
|
|
941
|
+
}) => new ke(s.isVisible, t, e));
|
|
942
|
+
class D extends it {
|
|
947
943
|
constructor() {
|
|
948
944
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
949
945
|
}
|
|
@@ -1099,12 +1095,12 @@ const Ge = l(
|
|
|
1099
1095
|
postEvent: e
|
|
1100
1096
|
})
|
|
1101
1097
|
);
|
|
1102
|
-
class
|
|
1098
|
+
class ct extends rt {
|
|
1103
1099
|
constructor() {
|
|
1104
1100
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
1105
1101
|
}
|
|
1106
1102
|
}
|
|
1107
|
-
class Ke extends
|
|
1103
|
+
class Ke extends ct {
|
|
1108
1104
|
constructor(t, s) {
|
|
1109
1105
|
super({ isConfirmationNeeded: t }), this.postEvent = s;
|
|
1110
1106
|
}
|
|
@@ -1138,7 +1134,7 @@ const ze = l(
|
|
|
1138
1134
|
state: t = { isConfirmationNeeded: !1 }
|
|
1139
1135
|
}) => new Ke(t.isConfirmationNeeded, e)
|
|
1140
1136
|
);
|
|
1141
|
-
class
|
|
1137
|
+
class ht {
|
|
1142
1138
|
constructor(t, s) {
|
|
1143
1139
|
c(this, "supports"), this.supports = Nt(t, s);
|
|
1144
1140
|
}
|
|
@@ -1176,10 +1172,10 @@ class Fe extends L {
|
|
|
1176
1172
|
function Qe(e) {
|
|
1177
1173
|
return new Fe((t) => t, !1, e);
|
|
1178
1174
|
}
|
|
1179
|
-
function
|
|
1175
|
+
function wt(e, t) {
|
|
1180
1176
|
return Object.fromEntries(e.map((s) => [s, t]));
|
|
1181
1177
|
}
|
|
1182
|
-
class Ye extends
|
|
1178
|
+
class Ye extends ht {
|
|
1183
1179
|
constructor(t, s, n) {
|
|
1184
1180
|
super(t, {
|
|
1185
1181
|
delete: "web_app_invoke_custom_method",
|
|
@@ -1219,13 +1215,13 @@ class Ye extends ct {
|
|
|
1219
1215
|
async get(t, s = {}) {
|
|
1220
1216
|
const n = Array.isArray(t) ? t : [t];
|
|
1221
1217
|
if (!n.length)
|
|
1222
|
-
return
|
|
1218
|
+
return wt(n, "");
|
|
1223
1219
|
const r = await A(
|
|
1224
1220
|
"getStorageValues",
|
|
1225
1221
|
{ keys: n },
|
|
1226
1222
|
this.createRequestId(),
|
|
1227
1223
|
{ ...s, postEvent: this.postEvent }
|
|
1228
|
-
), i = f(
|
|
1224
|
+
), i = f(wt(n, p()), "CloudStorageData").parse(r);
|
|
1229
1225
|
return Array.isArray(t) ? i : i[t];
|
|
1230
1226
|
}
|
|
1231
1227
|
/**
|
|
@@ -1246,7 +1242,7 @@ class Ye extends ct {
|
|
|
1246
1242
|
const Ze = l(
|
|
1247
1243
|
({ createRequestId: e, postEvent: t, version: s }) => new Ye(s, e, t)
|
|
1248
1244
|
);
|
|
1249
|
-
class Xe extends
|
|
1245
|
+
class Xe extends ht {
|
|
1250
1246
|
constructor(t, s) {
|
|
1251
1247
|
super(t, {
|
|
1252
1248
|
impactOccurred: "web_app_trigger_haptic_feedback",
|
|
@@ -1417,9 +1413,9 @@ class ns extends D {
|
|
|
1417
1413
|
const rs = l(
|
|
1418
1414
|
({ version: e, postEvent: t }) => new ns(!1, e, t)
|
|
1419
1415
|
);
|
|
1420
|
-
class is extends
|
|
1416
|
+
class is extends rt {
|
|
1421
1417
|
constructor({ postEvent: t, ...s }) {
|
|
1422
|
-
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" ?
|
|
1418
|
+
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" ? H("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
|
|
1423
1419
|
}
|
|
1424
1420
|
/**
|
|
1425
1421
|
* The MainButton background color.
|
|
@@ -1564,7 +1560,7 @@ const os = l(
|
|
|
1564
1560
|
}) => new is({ ...s, postEvent: e })
|
|
1565
1561
|
);
|
|
1566
1562
|
function as() {
|
|
1567
|
-
return
|
|
1563
|
+
return ot({
|
|
1568
1564
|
contact: f({
|
|
1569
1565
|
userId: {
|
|
1570
1566
|
type: P(),
|
|
@@ -1662,7 +1658,7 @@ class hs extends D {
|
|
|
1662
1658
|
* True if current Mini App background color is recognized as dark.
|
|
1663
1659
|
*/
|
|
1664
1660
|
get isDark() {
|
|
1665
|
-
return
|
|
1661
|
+
return Ot(this.bgColor);
|
|
1666
1662
|
}
|
|
1667
1663
|
/**
|
|
1668
1664
|
* Informs the Telegram app that the Mini App is ready to be displayed.
|
|
@@ -1699,7 +1695,7 @@ class hs extends D {
|
|
|
1699
1695
|
}
|
|
1700
1696
|
await cs(n), n += 50;
|
|
1701
1697
|
}
|
|
1702
|
-
throw
|
|
1698
|
+
throw kt(t);
|
|
1703
1699
|
}, t);
|
|
1704
1700
|
}
|
|
1705
1701
|
/**
|
|
@@ -1754,7 +1750,7 @@ class hs extends D {
|
|
|
1754
1750
|
* @param color - color key or RGB color.
|
|
1755
1751
|
*/
|
|
1756
1752
|
setHeaderColor(t) {
|
|
1757
|
-
this.postEvent("web_app_set_header_color",
|
|
1753
|
+
this.postEvent("web_app_set_header_color", st(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
|
|
1758
1754
|
}
|
|
1759
1755
|
/**
|
|
1760
1756
|
* Updates current Mini App background color.
|
|
@@ -1884,37 +1880,36 @@ class _s extends D {
|
|
|
1884
1880
|
get isOpened() {
|
|
1885
1881
|
return this.get("isOpened");
|
|
1886
1882
|
}
|
|
1887
|
-
/**
|
|
1888
|
-
* Opens scanner with specified title shown to user. Method returns promise
|
|
1889
|
-
* with scanned QR content in case, it was scanned. It will contain null in
|
|
1890
|
-
* case, scanner was closed.
|
|
1891
|
-
* @param text - title to display.
|
|
1892
|
-
*/
|
|
1893
1883
|
async open(t) {
|
|
1894
1884
|
if (this.isOpened)
|
|
1895
1885
|
throw new Error("QR scanner is already opened.");
|
|
1886
|
+
const { text: s, capture: n } = (typeof t == "string" ? { text: t } : t) || {};
|
|
1896
1887
|
this.isOpened = !0;
|
|
1897
1888
|
try {
|
|
1898
|
-
|
|
1889
|
+
const r = (await w({
|
|
1899
1890
|
method: "web_app_open_scan_qr_popup",
|
|
1900
1891
|
event: ["qr_text_received", "scan_qr_popup_closed"],
|
|
1901
1892
|
postEvent: this.postEvent,
|
|
1902
|
-
params: { text:
|
|
1893
|
+
params: { text: s },
|
|
1894
|
+
capture(i) {
|
|
1895
|
+
return i.event === "scan_qr_popup_closed" || !n || n(i.payload);
|
|
1896
|
+
}
|
|
1903
1897
|
}) || {}).data || null;
|
|
1904
|
-
|
|
1905
|
-
|
|
1898
|
+
return r && this.close(), r;
|
|
1899
|
+
} catch (r) {
|
|
1900
|
+
throw this.isOpened = !1, r;
|
|
1906
1901
|
}
|
|
1907
1902
|
}
|
|
1908
1903
|
}
|
|
1909
1904
|
const gs = l(
|
|
1910
1905
|
({ version: e, postEvent: t }) => new _s(!1, e, t)
|
|
1911
1906
|
);
|
|
1912
|
-
class fs extends
|
|
1907
|
+
class fs extends it {
|
|
1913
1908
|
constructor(t, s, n) {
|
|
1914
1909
|
super({ isVisible: t }, s, {
|
|
1915
1910
|
show: "web_app_setup_settings_button",
|
|
1916
1911
|
hide: "web_app_setup_settings_button"
|
|
1917
|
-
}), c(this, "on", (r, i) => r === "click" ? v("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ?
|
|
1912
|
+
}), c(this, "on", (r, i) => r === "click" ? v("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? H("settings_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
|
|
1918
1913
|
}
|
|
1919
1914
|
set isVisible(t) {
|
|
1920
1915
|
this.set("isVisible", t), this.postEvent("web_app_setup_settings_button", { is_visible: t });
|
|
@@ -1949,7 +1944,7 @@ const ws = l(
|
|
|
1949
1944
|
function Jt(e) {
|
|
1950
1945
|
return Mt().parse(e);
|
|
1951
1946
|
}
|
|
1952
|
-
class ms extends
|
|
1947
|
+
class ms extends ct {
|
|
1953
1948
|
/**
|
|
1954
1949
|
* @since v6.10
|
|
1955
1950
|
*/
|
|
@@ -1988,7 +1983,7 @@ class ms extends at {
|
|
|
1988
1983
|
* value is calculated according to theme bg color.
|
|
1989
1984
|
*/
|
|
1990
1985
|
get isDark() {
|
|
1991
|
-
return !this.bgColor ||
|
|
1986
|
+
return !this.bgColor || Ot(this.bgColor);
|
|
1992
1987
|
}
|
|
1993
1988
|
get linkColor() {
|
|
1994
1989
|
return this.get("linkColor");
|
|
@@ -2041,7 +2036,7 @@ function Zs(e = {}) {
|
|
|
2041
2036
|
event: "theme_changed"
|
|
2042
2037
|
}).then(Jt);
|
|
2043
2038
|
}
|
|
2044
|
-
class vs extends
|
|
2039
|
+
class vs extends ht {
|
|
2045
2040
|
constructor(t, s, n) {
|
|
2046
2041
|
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = zt(t, {
|
|
2047
2042
|
"openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
|
|
@@ -2074,7 +2069,7 @@ class vs extends ct {
|
|
|
2074
2069
|
* @throws {Error} URL has not allowed hostname.
|
|
2075
2070
|
*/
|
|
2076
2071
|
openTelegramLink(t) {
|
|
2077
|
-
const { hostname: s, pathname: n, search: r } = new URL(t,
|
|
2072
|
+
const { hostname: s, pathname: n, search: r } = new URL(t, "https://t.me");
|
|
2078
2073
|
if (s !== "t.me")
|
|
2079
2074
|
throw new Error(`URL has not allowed hostname: ${s}. Only "t.me" is allowed`);
|
|
2080
2075
|
if (!x("web_app_open_tg_link", this.version)) {
|
|
@@ -2101,6 +2096,20 @@ class vs extends ct {
|
|
|
2101
2096
|
});
|
|
2102
2097
|
return s;
|
|
2103
2098
|
}
|
|
2099
|
+
/**
|
|
2100
|
+
* Shares specified URL with the passed to the chats, selected by user. After being called,
|
|
2101
|
+
* it closes the mini application.
|
|
2102
|
+
*
|
|
2103
|
+
* This method uses Telegram's Share Links.
|
|
2104
|
+
* @param url - URL to share.
|
|
2105
|
+
* @param text - text to append after the URL.
|
|
2106
|
+
* @see https://core.telegram.org/api/links#share-links
|
|
2107
|
+
*/
|
|
2108
|
+
shareURL(t, s) {
|
|
2109
|
+
this.openTelegramLink(
|
|
2110
|
+
"https://t.me/share?" + new URLSearchParams({ url: t, text: s || "" }).toString()
|
|
2111
|
+
);
|
|
2112
|
+
}
|
|
2104
2113
|
}
|
|
2105
2114
|
const ys = l(
|
|
2106
2115
|
({ version: e, postEvent: t, createRequestId: s }) => new vs(e, s, t)
|
|
@@ -2117,16 +2126,16 @@ async function Ft(e = {}) {
|
|
|
2117
2126
|
});
|
|
2118
2127
|
return { ...n, isExpanded: t, isStateStable: s };
|
|
2119
2128
|
}
|
|
2120
|
-
function
|
|
2129
|
+
function T(e) {
|
|
2121
2130
|
return e < 0 ? 0 : e;
|
|
2122
2131
|
}
|
|
2123
|
-
class Es extends
|
|
2132
|
+
class Es extends ct {
|
|
2124
2133
|
constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
|
|
2125
2134
|
super({
|
|
2126
|
-
height:
|
|
2135
|
+
height: T(n),
|
|
2127
2136
|
isExpanded: i,
|
|
2128
|
-
stableHeight:
|
|
2129
|
-
width:
|
|
2137
|
+
stableHeight: T(s),
|
|
2138
|
+
width: T(r)
|
|
2130
2139
|
}), c(this, "postEvent"), this.postEvent = t;
|
|
2131
2140
|
}
|
|
2132
2141
|
/**
|
|
@@ -2188,11 +2197,11 @@ class Es extends at {
|
|
|
2188
2197
|
width: n,
|
|
2189
2198
|
is_expanded: r,
|
|
2190
2199
|
is_state_stable: i
|
|
2191
|
-
} = t, o =
|
|
2200
|
+
} = t, o = T(s);
|
|
2192
2201
|
this.set({
|
|
2193
2202
|
height: o,
|
|
2194
2203
|
isExpanded: r,
|
|
2195
|
-
width:
|
|
2204
|
+
width: T(n),
|
|
2196
2205
|
...i ? { stableHeight: o } : {}
|
|
2197
2206
|
});
|
|
2198
2207
|
});
|
|
@@ -2256,7 +2265,7 @@ function Xs(e, t, s) {
|
|
|
2256
2265
|
s || (s = (a) => `--tg-${a}-color`);
|
|
2257
2266
|
const n = s("header"), r = s("bg"), i = () => {
|
|
2258
2267
|
const { headerColor: a } = e;
|
|
2259
|
-
if (
|
|
2268
|
+
if (st(a))
|
|
2260
2269
|
E(n, a);
|
|
2261
2270
|
else {
|
|
2262
2271
|
const { bgColor: h, secondaryBgColor: u } = t;
|
|
@@ -2312,7 +2321,7 @@ function sn() {
|
|
|
2312
2321
|
return typeof window > "u";
|
|
2313
2322
|
}
|
|
2314
2323
|
async function nn() {
|
|
2315
|
-
if (
|
|
2324
|
+
if (Tt(window))
|
|
2316
2325
|
return !0;
|
|
2317
2326
|
try {
|
|
2318
2327
|
return await w({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
@@ -2321,7 +2330,7 @@ async function nn() {
|
|
|
2321
2330
|
}
|
|
2322
2331
|
}
|
|
2323
2332
|
function rn(e) {
|
|
2324
|
-
const t = typeof e == "string" ?
|
|
2333
|
+
const t = typeof e == "string" ? at(e) : e;
|
|
2325
2334
|
jt(t);
|
|
2326
2335
|
function s(r) {
|
|
2327
2336
|
if (typeof r == "string")
|
|
@@ -2338,14 +2347,14 @@ function rn(e) {
|
|
|
2338
2347
|
} catch {
|
|
2339
2348
|
}
|
|
2340
2349
|
}
|
|
2341
|
-
if (
|
|
2350
|
+
if (nt()) {
|
|
2342
2351
|
const r = window.parent.postMessage.bind(window.parent);
|
|
2343
2352
|
window.parent.postMessage = (i) => {
|
|
2344
2353
|
s(i), r(i);
|
|
2345
2354
|
};
|
|
2346
2355
|
return;
|
|
2347
2356
|
}
|
|
2348
|
-
if (
|
|
2357
|
+
if (Rt(window)) {
|
|
2349
2358
|
const r = window.external.notify.bind(window.external);
|
|
2350
2359
|
window.external.notify = (i) => {
|
|
2351
2360
|
s(i), r(i);
|
|
@@ -2376,7 +2385,7 @@ function j(e, t) {
|
|
|
2376
2385
|
}
|
|
2377
2386
|
class Ss {
|
|
2378
2387
|
constructor(t, s, n = q) {
|
|
2379
|
-
if (c(this, "history"), c(this, "ee", new
|
|
2388
|
+
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)
|
|
2380
2389
|
throw m(we, "History should not be empty.");
|
|
2381
2390
|
if (s < 0 || s >= t.length)
|
|
2382
2391
|
throw m(
|
|
@@ -2402,7 +2411,7 @@ class Ss {
|
|
|
2402
2411
|
* Prevents current navigator from controlling the BackButton visibility state.
|
|
2403
2412
|
*/
|
|
2404
2413
|
detach() {
|
|
2405
|
-
this.attached = !1,
|
|
2414
|
+
this.attached = !1, H("back_button_pressed", this.back);
|
|
2406
2415
|
}
|
|
2407
2416
|
/**
|
|
2408
2417
|
* Goes to the next history item.
|
|
@@ -2501,12 +2510,12 @@ function G({
|
|
|
2501
2510
|
}) {
|
|
2502
2511
|
return { ...e || { hash: "", search: "" }, ...t };
|
|
2503
2512
|
}
|
|
2504
|
-
function
|
|
2513
|
+
function O(e, t) {
|
|
2505
2514
|
return e.startsWith(t) ? e : `${t}${e}`;
|
|
2506
2515
|
}
|
|
2507
2516
|
function M(e) {
|
|
2508
2517
|
return new URL(
|
|
2509
|
-
typeof e == "string" ? e : `${e.pathname || ""}${
|
|
2518
|
+
typeof e == "string" ? e : `${e.pathname || ""}${O(e.search || "", "?")}${O(e.hash || "", "#")}`,
|
|
2510
2519
|
"http://a"
|
|
2511
2520
|
);
|
|
2512
2521
|
}
|
|
@@ -2517,7 +2526,7 @@ function B(e) {
|
|
|
2517
2526
|
function K(e, t, s) {
|
|
2518
2527
|
let n, r;
|
|
2519
2528
|
typeof e == "string" ? n = e : (n = B(e), s = e.state, r = e.id);
|
|
2520
|
-
const { pathname: i, search: o, hash: a } = new URL(n, `http://a${
|
|
2529
|
+
const { pathname: i, search: o, hash: a } = new URL(n, `http://a${O(t, "/")}`);
|
|
2521
2530
|
return { id: r, pathname: i, params: { hash: a, search: o, state: s } };
|
|
2522
2531
|
}
|
|
2523
2532
|
async function I(e) {
|
|
@@ -2534,7 +2543,7 @@ async function I(e) {
|
|
|
2534
2543
|
})
|
|
2535
2544
|
]);
|
|
2536
2545
|
}
|
|
2537
|
-
async function
|
|
2546
|
+
async function Rs() {
|
|
2538
2547
|
if (window.history.length <= 1 || (window.history.pushState(null, ""), await I(1 - window.history.length)))
|
|
2539
2548
|
return;
|
|
2540
2549
|
let e = await I(-1);
|
|
@@ -2544,13 +2553,13 @@ async function Ts() {
|
|
|
2544
2553
|
function Qt(e) {
|
|
2545
2554
|
return M(e).pathname;
|
|
2546
2555
|
}
|
|
2547
|
-
const
|
|
2556
|
+
const mt = 0, z = 1, J = 2;
|
|
2548
2557
|
class Yt {
|
|
2549
2558
|
constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
|
|
2550
|
-
c(this, "navigator"), c(this, "ee", new
|
|
2559
|
+
c(this, "navigator"), c(this, "ee", new k()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
|
|
2551
2560
|
if (o === null)
|
|
2552
2561
|
return this.push(this.parsePath(window.location.href));
|
|
2553
|
-
o ===
|
|
2562
|
+
o === mt ? window.history.forward() : o === z && this.back(), o === J && this.forward();
|
|
2554
2563
|
}), c(this, "onNavigatorChange", async ({
|
|
2555
2564
|
to: o,
|
|
2556
2565
|
from: a,
|
|
@@ -2566,7 +2575,9 @@ class Yt {
|
|
|
2566
2575
|
t.map((o) => K(o, "/")),
|
|
2567
2576
|
s,
|
|
2568
2577
|
n
|
|
2569
|
-
), this.navigator.on("change",
|
|
2578
|
+
), this.navigator.on("change", (o) => {
|
|
2579
|
+
this.onNavigatorChange(o);
|
|
2580
|
+
}), this.hashMode = r, this.base = Qt(i || "");
|
|
2570
2581
|
}
|
|
2571
2582
|
/**
|
|
2572
2583
|
* Attaches current navigator to the browser history allowing navigator to manipulate it.
|
|
@@ -2714,8 +2725,8 @@ class Yt {
|
|
|
2714
2725
|
* @param value - path presented as string or URLLike.
|
|
2715
2726
|
*/
|
|
2716
2727
|
renderPath(t) {
|
|
2717
|
-
const s = (this.base.length === 1 ? "" : this.base) +
|
|
2718
|
-
return this.hashMode ?
|
|
2728
|
+
const s = (this.base.length === 1 ? "" : this.base) + O(B(t), "/");
|
|
2729
|
+
return this.hashMode ? O(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
|
|
2719
2730
|
}
|
|
2720
2731
|
/**
|
|
2721
2732
|
* Synchronizes current navigator state with browser history.
|
|
@@ -2723,7 +2734,7 @@ class Yt {
|
|
|
2723
2734
|
async syncHistory() {
|
|
2724
2735
|
window.removeEventListener("popstate", this.onPopState);
|
|
2725
2736
|
const { state: t } = this, s = this.renderPath(this);
|
|
2726
|
-
await
|
|
2737
|
+
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(mt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
|
|
2727
2738
|
}
|
|
2728
2739
|
/**
|
|
2729
2740
|
* Current query parameters.
|
|
@@ -2741,7 +2752,7 @@ class Yt {
|
|
|
2741
2752
|
return (this.navigator.current.params || {}).state;
|
|
2742
2753
|
}
|
|
2743
2754
|
}
|
|
2744
|
-
function
|
|
2755
|
+
function Ts(e) {
|
|
2745
2756
|
e || (e = {});
|
|
2746
2757
|
const { href: t, hash: s } = window.location;
|
|
2747
2758
|
let n = B(
|
|
@@ -2768,12 +2779,16 @@ function As(e, t) {
|
|
|
2768
2779
|
if (s)
|
|
2769
2780
|
try {
|
|
2770
2781
|
const { index: n, history: r } = JSON.parse(s);
|
|
2771
|
-
return new Yt(
|
|
2782
|
+
return new Yt(
|
|
2783
|
+
r,
|
|
2784
|
+
n,
|
|
2785
|
+
t
|
|
2786
|
+
);
|
|
2772
2787
|
} catch (n) {
|
|
2773
2788
|
console.error("Unable to restore hash navigator state.", n);
|
|
2774
2789
|
}
|
|
2775
2790
|
}
|
|
2776
|
-
return
|
|
2791
|
+
return Ts(t);
|
|
2777
2792
|
}
|
|
2778
2793
|
function cn(e, t) {
|
|
2779
2794
|
const s = As(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
@@ -2783,7 +2798,7 @@ function cn(e, t) {
|
|
|
2783
2798
|
return s.on("change", n), n(), s;
|
|
2784
2799
|
}
|
|
2785
2800
|
function _(e) {
|
|
2786
|
-
return (t, s, ...n) => (r) =>
|
|
2801
|
+
return (t, s, ...n) => (r) => bt(s, ut(() => ut({
|
|
2787
2802
|
[t]: e(...n)
|
|
2788
2803
|
}, r)));
|
|
2789
2804
|
}
|
|
@@ -2800,7 +2815,7 @@ function g(e) {
|
|
|
2800
2815
|
return Object.defineProperty(n, "error", () => s.error), n;
|
|
2801
2816
|
};
|
|
2802
2817
|
}
|
|
2803
|
-
const
|
|
2818
|
+
const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns = g(Ze), dn = _(Ns), Ds = g(ts), ln = _(Ds), Vs = g(ss), _n = _(Vs), Ms = g(rs), gn = _(Ms), Bs = g(os), fn = _(Bs), $s = g(ps), wn = _($s), Ls = g(ls), mn = _(Ls), Us = g(gs), bn = _(Us), Hs = g(ws), vn = _(Hs), Ws = g(bs), yn = _(Ws), js = g(ys), En = _(js), Gs = g(Ps), Pn = _(Gs), xn = (e) => {
|
|
2804
2819
|
const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
|
|
2805
2820
|
if (t.has(n))
|
|
2806
2821
|
return t.get(n);
|
|
@@ -2820,7 +2835,7 @@ const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns
|
|
|
2820
2835
|
}
|
|
2821
2836
|
let a;
|
|
2822
2837
|
Array.isArray(o) && ([o, a] = o);
|
|
2823
|
-
const [h] = ne(() => o), u =
|
|
2838
|
+
const [h] = ne(() => o), u = _t(() => {
|
|
2824
2839
|
if (h.state !== "ready")
|
|
2825
2840
|
return;
|
|
2826
2841
|
const d = h();
|
|
@@ -2830,8 +2845,8 @@ const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns
|
|
|
2830
2845
|
return new Proxy(d, {
|
|
2831
2846
|
get(V, C) {
|
|
2832
2847
|
if (!(C in W)) {
|
|
2833
|
-
const
|
|
2834
|
-
W[C] =
|
|
2848
|
+
const pt = Reflect.getOwnPropertyDescriptor(te, C);
|
|
2849
|
+
W[C] = pt && "get" in pt ? _t(() => Xt()[C]) : () => Reflect.get(V, C);
|
|
2835
2850
|
}
|
|
2836
2851
|
return W[C]();
|
|
2837
2852
|
}
|
|
@@ -2849,13 +2864,13 @@ const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns
|
|
|
2849
2864
|
cleanup: a
|
|
2850
2865
|
});
|
|
2851
2866
|
};
|
|
2852
|
-
return
|
|
2867
|
+
return dt(() => {
|
|
2853
2868
|
he(e.debug || !1);
|
|
2854
|
-
}), ut(() => {
|
|
2855
|
-
st() && dt(xs(e.acceptCustomStyles));
|
|
2856
2869
|
}), dt(() => {
|
|
2870
|
+
nt() && lt(xs(e.acceptCustomStyles));
|
|
2871
|
+
}), lt(() => {
|
|
2857
2872
|
t.forEach((n) => n.cleanup && n.cleanup());
|
|
2858
|
-
}),
|
|
2873
|
+
}), bt(Zt.Provider, {
|
|
2859
2874
|
value: s,
|
|
2860
2875
|
get children() {
|
|
2861
2876
|
return e.children;
|
|
@@ -2863,7 +2878,7 @@ const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns
|
|
|
2863
2878
|
});
|
|
2864
2879
|
};
|
|
2865
2880
|
export {
|
|
2866
|
-
|
|
2881
|
+
ke as BackButton,
|
|
2867
2882
|
Ss as BasicNavigator,
|
|
2868
2883
|
We as BiometryManager,
|
|
2869
2884
|
Yt as BrowserNavigator,
|
|
@@ -2881,7 +2896,7 @@ export {
|
|
|
2881
2896
|
ge as ERR_TIMED_OUT,
|
|
2882
2897
|
fe as ERR_UNEXPECTED_TYPE,
|
|
2883
2898
|
le as ERR_UNKNOWN_ENV,
|
|
2884
|
-
|
|
2899
|
+
k as EventEmitter,
|
|
2885
2900
|
Xe as HapticFeedback,
|
|
2886
2901
|
es as InitData,
|
|
2887
2902
|
ns as Invoice,
|
|
@@ -2902,14 +2917,14 @@ export {
|
|
|
2902
2917
|
y as boolean,
|
|
2903
2918
|
It as captureSameReq,
|
|
2904
2919
|
Z as classNames,
|
|
2905
|
-
|
|
2906
|
-
|
|
2920
|
+
Re as compareVersions,
|
|
2921
|
+
Ts as createBrowserNavigatorFromLocation,
|
|
2907
2922
|
Ae as createPostEvent,
|
|
2908
2923
|
M as createSafeURL,
|
|
2909
2924
|
Dt as date,
|
|
2910
2925
|
an as getHash,
|
|
2911
2926
|
Qt as getPathname,
|
|
2912
|
-
|
|
2927
|
+
He as initBackButton,
|
|
2913
2928
|
Ge as initBiometryManager,
|
|
2914
2929
|
ze as initClosingBehavior,
|
|
2915
2930
|
Ze as initCloudStorage,
|
|
@@ -2927,10 +2942,10 @@ export {
|
|
|
2927
2942
|
Ps as initViewport,
|
|
2928
2943
|
xs as initWeb,
|
|
2929
2944
|
A as invokeCustomMethod,
|
|
2930
|
-
|
|
2931
|
-
|
|
2945
|
+
Ot as isColorDark,
|
|
2946
|
+
nt as isIframe,
|
|
2932
2947
|
Gt as isPageReload,
|
|
2933
|
-
|
|
2948
|
+
st as isRGB,
|
|
2934
2949
|
ve as isRGBShort,
|
|
2935
2950
|
Cs as isSDKError,
|
|
2936
2951
|
on as isSDKErrorOfType,
|
|
@@ -2940,10 +2955,10 @@ export {
|
|
|
2940
2955
|
Qs as mergeClassNames,
|
|
2941
2956
|
rn as mockTelegramEnv,
|
|
2942
2957
|
P as number,
|
|
2943
|
-
|
|
2958
|
+
H as off,
|
|
2944
2959
|
v as on,
|
|
2945
2960
|
Ys as parseInitData,
|
|
2946
|
-
|
|
2961
|
+
at as parseLaunchParams,
|
|
2947
2962
|
Jt as parseThemeParams,
|
|
2948
2963
|
q as postEvent,
|
|
2949
2964
|
w as request,
|
|
@@ -2952,7 +2967,7 @@ export {
|
|
|
2952
2967
|
Ft as requestViewport,
|
|
2953
2968
|
$e as retrieveLaunchParams,
|
|
2954
2969
|
Ct as rgb,
|
|
2955
|
-
|
|
2970
|
+
ot as searchParams,
|
|
2956
2971
|
Be as serializeLaunchParams,
|
|
2957
2972
|
Wt as serializeThemeParams,
|
|
2958
2973
|
E as setCSSVar,
|
|
@@ -2961,13 +2976,13 @@ export {
|
|
|
2961
2976
|
p as string,
|
|
2962
2977
|
ae as subscribe,
|
|
2963
2978
|
x as supports,
|
|
2964
|
-
|
|
2979
|
+
Te as targetOrigin,
|
|
2965
2980
|
xt as toRGB,
|
|
2966
|
-
|
|
2981
|
+
yt as unsubscribe,
|
|
2967
2982
|
B as urlToPath,
|
|
2968
|
-
|
|
2983
|
+
ks as useBackButton,
|
|
2969
2984
|
qs as useBiometryManager,
|
|
2970
|
-
|
|
2985
|
+
Os as useClosingBehavior,
|
|
2971
2986
|
Ns as useCloudStorage,
|
|
2972
2987
|
Ds as useHapticFeedback,
|
|
2973
2988
|
Vs as useInitData,
|
|
@@ -2975,9 +2990,9 @@ export {
|
|
|
2975
2990
|
Bs as useMainButton,
|
|
2976
2991
|
$s as useMiniApp,
|
|
2977
2992
|
Ls as usePopup,
|
|
2978
|
-
|
|
2993
|
+
Us as useQRScanner,
|
|
2979
2994
|
Is as useSDK,
|
|
2980
|
-
|
|
2995
|
+
Hs as useSettingsButton,
|
|
2981
2996
|
Ws as useThemeParams,
|
|
2982
2997
|
js as useUtils,
|
|
2983
2998
|
Gs as useViewport,
|