@tma.js/sdk-solid 2.1.8 → 2.1.9
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 +109 -97
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent as bt, mergeProps as ut, createContext as ee, useContext as se, createEffect as
|
|
1
|
+
import { createComponent as bt, mergeProps as ut, createContext as ee, useContext as se, createEffect as lt, onCleanup as dt, 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);
|
|
3
3
|
function vt(e, t) {
|
|
4
4
|
let s;
|
|
@@ -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 b(e, t, s) {
|
|
161
161
|
return new $(e, t, s);
|
|
162
162
|
}
|
|
163
|
-
const ue = "ERR_METHOD_UNSUPPORTED",
|
|
163
|
+
const ue = "ERR_METHOD_UNSUPPORTED", le = "ERR_METHOD_PARAMETER_UNSUPPORTED", de = "ERR_UNKNOWN_ENV", _e = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", ge = "ERR_TIMED_OUT", fe = "ERR_UNEXPECTED_TYPE", Et = "ERR_PARSE", we = "ERR_NAVIGATION_LIST_EMPTY", me = "ERR_NAVIGATION_CURSOR_INVALID", zs = "ERR_NAVIGATION_ITEM_INVALID", Js = "ERR_SSR_INIT", be = "ERR_INVALID_PATH_BASE";
|
|
164
164
|
function S() {
|
|
165
|
-
return
|
|
165
|
+
return b(fe, "Value has unexpected type");
|
|
166
166
|
}
|
|
167
167
|
class L {
|
|
168
168
|
constructor(t, s, n) {
|
|
@@ -179,7 +179,7 @@ class L {
|
|
|
179
179
|
try {
|
|
180
180
|
return this.parser(t);
|
|
181
181
|
} catch (s) {
|
|
182
|
-
throw
|
|
182
|
+
throw b(
|
|
183
183
|
Et,
|
|
184
184
|
`Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
|
|
185
185
|
s
|
|
@@ -190,10 +190,10 @@ class L {
|
|
|
190
190
|
return this.isOptional = !0, this;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function T(e, t) {
|
|
194
194
|
return () => new L(e, !1, t);
|
|
195
195
|
}
|
|
196
|
-
const y =
|
|
196
|
+
const y = T((e) => {
|
|
197
197
|
if (typeof e == "boolean")
|
|
198
198
|
return e;
|
|
199
199
|
const t = String(e);
|
|
@@ -220,7 +220,7 @@ 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 b(Et, `Unable to parse field "${n}"`, a);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
return s;
|
|
@@ -237,7 +237,7 @@ function f(e, t) {
|
|
|
237
237
|
return Pt(e, (r) => n[r]);
|
|
238
238
|
}, !1, t);
|
|
239
239
|
}
|
|
240
|
-
const P =
|
|
240
|
+
const P = T((e) => {
|
|
241
241
|
if (typeof e == "number")
|
|
242
242
|
return e;
|
|
243
243
|
if (typeof e == "string") {
|
|
@@ -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 = T((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 = T((e) => xt(p().parse(e)), "rgb");
|
|
279
279
|
function St(e) {
|
|
280
280
|
return f({
|
|
281
281
|
eventType: p(),
|
|
@@ -431,7 +431,7 @@ function v(e, t, s) {
|
|
|
431
431
|
function N(e) {
|
|
432
432
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Te(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);
|
|
@@ -440,15 +440,21 @@ function Re(e, t) {
|
|
|
440
440
|
}
|
|
441
441
|
return 0;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
return
|
|
443
|
+
function m(e, t) {
|
|
444
|
+
return Te(e, t) <= 0;
|
|
445
445
|
}
|
|
446
446
|
function x(e, t, s) {
|
|
447
447
|
if (typeof s == "string") {
|
|
448
|
-
if (e === "web_app_open_link"
|
|
449
|
-
|
|
448
|
+
if (e === "web_app_open_link") {
|
|
449
|
+
if (t === "try_instant_view")
|
|
450
|
+
return m("6.4", s);
|
|
451
|
+
if (t === "try_browser")
|
|
452
|
+
return m("7.6", s);
|
|
453
|
+
}
|
|
450
454
|
if (e === "web_app_set_header_color" && t === "color")
|
|
451
|
-
return
|
|
455
|
+
return m("6.9", s);
|
|
456
|
+
if (e === "web_app_close" && t === "return_back")
|
|
457
|
+
return m("7.6", s);
|
|
452
458
|
}
|
|
453
459
|
switch (e) {
|
|
454
460
|
case "web_app_open_tg_link":
|
|
@@ -457,27 +463,27 @@ function x(e, t, s) {
|
|
|
457
463
|
case "web_app_set_background_color":
|
|
458
464
|
case "web_app_set_header_color":
|
|
459
465
|
case "web_app_trigger_haptic_feedback":
|
|
460
|
-
return
|
|
466
|
+
return m("6.1", t);
|
|
461
467
|
case "web_app_open_popup":
|
|
462
|
-
return
|
|
468
|
+
return m("6.2", t);
|
|
463
469
|
case "web_app_close_scan_qr_popup":
|
|
464
470
|
case "web_app_open_scan_qr_popup":
|
|
465
471
|
case "web_app_read_text_from_clipboard":
|
|
466
|
-
return
|
|
472
|
+
return m("6.4", t);
|
|
467
473
|
case "web_app_switch_inline_query":
|
|
468
|
-
return
|
|
474
|
+
return m("6.7", t);
|
|
469
475
|
case "web_app_invoke_custom_method":
|
|
470
476
|
case "web_app_request_write_access":
|
|
471
477
|
case "web_app_request_phone":
|
|
472
|
-
return
|
|
478
|
+
return m("6.9", t);
|
|
473
479
|
case "web_app_setup_settings_button":
|
|
474
|
-
return
|
|
480
|
+
return m("6.10", t);
|
|
475
481
|
case "web_app_biometry_get_info":
|
|
476
482
|
case "web_app_biometry_open_settings":
|
|
477
483
|
case "web_app_biometry_request_access":
|
|
478
484
|
case "web_app_biometry_request_auth":
|
|
479
485
|
case "web_app_biometry_update_token":
|
|
480
|
-
return
|
|
486
|
+
return m("7.2", t);
|
|
481
487
|
default:
|
|
482
488
|
return [
|
|
483
489
|
"iframe_ready",
|
|
@@ -494,10 +500,10 @@ function x(e, t, s) {
|
|
|
494
500
|
].includes(e);
|
|
495
501
|
}
|
|
496
502
|
}
|
|
497
|
-
function
|
|
503
|
+
function Tt(e) {
|
|
498
504
|
return "external" in e && N(e.external) && "notify" in e.external && typeof e.external.notify == "function";
|
|
499
505
|
}
|
|
500
|
-
function
|
|
506
|
+
function Rt(e) {
|
|
501
507
|
return "TelegramWebviewProxy" in e && N(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
|
|
502
508
|
}
|
|
503
509
|
function nt() {
|
|
@@ -511,39 +517,39 @@ let At = "https://web.telegram.org";
|
|
|
511
517
|
function Fs(e) {
|
|
512
518
|
At = e;
|
|
513
519
|
}
|
|
514
|
-
function
|
|
520
|
+
function Re() {
|
|
515
521
|
return At;
|
|
516
522
|
}
|
|
517
523
|
function q(e, t, s) {
|
|
518
524
|
let n = {}, r;
|
|
519
525
|
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 =
|
|
526
|
+
const { targetOrigin: i = Re() } = n;
|
|
521
527
|
if (pe("Posting event:", r ? { event: e, data: r } : { event: e }), nt()) {
|
|
522
528
|
window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
|
|
523
529
|
return;
|
|
524
530
|
}
|
|
525
|
-
if (
|
|
531
|
+
if (Tt(window)) {
|
|
526
532
|
window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
|
|
527
533
|
return;
|
|
528
534
|
}
|
|
529
|
-
if (
|
|
535
|
+
if (Rt(window)) {
|
|
530
536
|
window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
|
|
531
537
|
return;
|
|
532
538
|
}
|
|
533
|
-
throw
|
|
534
|
-
|
|
539
|
+
throw b(
|
|
540
|
+
de,
|
|
535
541
|
"Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside of Telegram application environment."
|
|
536
542
|
);
|
|
537
543
|
}
|
|
538
544
|
function Ae(e) {
|
|
539
545
|
return (t, s) => {
|
|
540
546
|
if (!x(t, e))
|
|
541
|
-
throw
|
|
547
|
+
throw b(ue, `Method "${t}" is unsupported in Mini Apps version ${e}`);
|
|
542
548
|
if (N(s)) {
|
|
543
549
|
let n;
|
|
544
550
|
if (t === "web_app_open_link" && "try_instant_view" in s ? n = "try_instant_view" : t === "web_app_set_header_color" && "color" in s && (n = "color"), n && !x(t, n, e))
|
|
545
|
-
throw
|
|
546
|
-
|
|
551
|
+
throw b(
|
|
552
|
+
le,
|
|
547
553
|
`Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
|
|
548
554
|
);
|
|
549
555
|
}
|
|
@@ -554,7 +560,7 @@ function It(e) {
|
|
|
554
560
|
return ({ req_id: t }) => t === e;
|
|
555
561
|
}
|
|
556
562
|
function kt(e) {
|
|
557
|
-
return
|
|
563
|
+
return b(ge, `Timeout reached: ${e}ms`);
|
|
558
564
|
}
|
|
559
565
|
function qt(e, t) {
|
|
560
566
|
return Promise.race([
|
|
@@ -597,7 +603,7 @@ async function A(e, t, s, n = {}) {
|
|
|
597
603
|
capture: It(s)
|
|
598
604
|
});
|
|
599
605
|
if (i)
|
|
600
|
-
throw
|
|
606
|
+
throw b(_e, i);
|
|
601
607
|
return r;
|
|
602
608
|
}
|
|
603
609
|
function Z(...e) {
|
|
@@ -688,7 +694,7 @@ class ke extends it {
|
|
|
688
694
|
this.isVisible = !0;
|
|
689
695
|
}
|
|
690
696
|
}
|
|
691
|
-
const Dt =
|
|
697
|
+
const Dt = T((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
|
|
692
698
|
function ot(e, t) {
|
|
693
699
|
return new L((s) => {
|
|
694
700
|
if (typeof s != "string" && !(s instanceof URLSearchParams))
|
|
@@ -783,7 +789,7 @@ function Oe(e) {
|
|
|
783
789
|
function Ne(e) {
|
|
784
790
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
785
791
|
}
|
|
786
|
-
const Mt =
|
|
792
|
+
const Mt = T(
|
|
787
793
|
(e) => {
|
|
788
794
|
const t = Ct().optional();
|
|
789
795
|
return Object.entries(et(e)).reduce((s, [n, r]) => (s[Oe(n)] = t.parse(r), s), {});
|
|
@@ -907,7 +913,7 @@ function Le() {
|
|
|
907
913
|
return () => (e += 1).toString();
|
|
908
914
|
}
|
|
909
915
|
const [Ue] = vt(Le);
|
|
910
|
-
function
|
|
916
|
+
function d(e, t) {
|
|
911
917
|
return () => {
|
|
912
918
|
const s = $e(), n = {
|
|
913
919
|
...s,
|
|
@@ -924,8 +930,8 @@ function l(e, t) {
|
|
|
924
930
|
state: Gt() ? Ht(e) : void 0,
|
|
925
931
|
addCleanup: r
|
|
926
932
|
}), h = (u) => (o || r(
|
|
927
|
-
u.on("change", (
|
|
928
|
-
Ut(e,
|
|
933
|
+
u.on("change", (l) => {
|
|
934
|
+
Ut(e, l);
|
|
929
935
|
})
|
|
930
936
|
), u);
|
|
931
937
|
return [
|
|
@@ -934,7 +940,7 @@ function l(e, t) {
|
|
|
934
940
|
];
|
|
935
941
|
};
|
|
936
942
|
}
|
|
937
|
-
const He =
|
|
943
|
+
const He = d("backButton", ({
|
|
938
944
|
postEvent: e,
|
|
939
945
|
version: t,
|
|
940
946
|
state: s = { isVisible: !1 }
|
|
@@ -1081,7 +1087,7 @@ async function je(e) {
|
|
|
1081
1087
|
})
|
|
1082
1088
|
);
|
|
1083
1089
|
}
|
|
1084
|
-
const Ge =
|
|
1090
|
+
const Ge = d(
|
|
1085
1091
|
"biometryManager",
|
|
1086
1092
|
async ({ postEvent: e, version: t, state: s }) => new We({
|
|
1087
1093
|
...s || x("web_app_biometry_get_info", t) ? s || await je({ timeout: 1e3 }) : {
|
|
@@ -1127,7 +1133,7 @@ class Ke extends ct {
|
|
|
1127
1133
|
this.isConfirmationNeeded = !0;
|
|
1128
1134
|
}
|
|
1129
1135
|
}
|
|
1130
|
-
const ze =
|
|
1136
|
+
const ze = d(
|
|
1131
1137
|
"closingBehavior",
|
|
1132
1138
|
({
|
|
1133
1139
|
postEvent: e,
|
|
@@ -1239,7 +1245,7 @@ class Ye extends ht {
|
|
|
1239
1245
|
);
|
|
1240
1246
|
}
|
|
1241
1247
|
}
|
|
1242
|
-
const Ze =
|
|
1248
|
+
const Ze = d(
|
|
1243
1249
|
({ createRequestId: e, postEvent: t, version: s }) => new Ye(s, e, t)
|
|
1244
1250
|
);
|
|
1245
1251
|
class Xe extends ht {
|
|
@@ -1284,7 +1290,7 @@ class Xe extends ht {
|
|
|
1284
1290
|
this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
|
|
1285
1291
|
}
|
|
1286
1292
|
}
|
|
1287
|
-
const ts =
|
|
1293
|
+
const ts = d(
|
|
1288
1294
|
({ version: e, postEvent: t }) => new Xe(e, t)
|
|
1289
1295
|
);
|
|
1290
1296
|
class es {
|
|
@@ -1360,7 +1366,7 @@ class es {
|
|
|
1360
1366
|
return this.initData.user;
|
|
1361
1367
|
}
|
|
1362
1368
|
}
|
|
1363
|
-
const ss =
|
|
1369
|
+
const ss = d(
|
|
1364
1370
|
({ initData: e }) => e ? new es(e) : void 0
|
|
1365
1371
|
);
|
|
1366
1372
|
function Ys(e) {
|
|
@@ -1410,7 +1416,7 @@ class ns extends D {
|
|
|
1410
1416
|
}
|
|
1411
1417
|
}
|
|
1412
1418
|
}
|
|
1413
|
-
const rs =
|
|
1419
|
+
const rs = d(
|
|
1414
1420
|
({ version: e, postEvent: t }) => new ns(!1, e, t)
|
|
1415
1421
|
);
|
|
1416
1422
|
class is extends rt {
|
|
@@ -1544,7 +1550,7 @@ class is extends rt {
|
|
|
1544
1550
|
return this.get("textColor");
|
|
1545
1551
|
}
|
|
1546
1552
|
}
|
|
1547
|
-
const os =
|
|
1553
|
+
const os = d(
|
|
1548
1554
|
"mainButton",
|
|
1549
1555
|
({
|
|
1550
1556
|
postEvent: e,
|
|
@@ -1778,7 +1784,7 @@ class hs extends D {
|
|
|
1778
1784
|
this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
|
|
1779
1785
|
}
|
|
1780
1786
|
}
|
|
1781
|
-
const ps =
|
|
1787
|
+
const ps = d(
|
|
1782
1788
|
"miniApp",
|
|
1783
1789
|
({
|
|
1784
1790
|
themeParams: e,
|
|
@@ -1814,7 +1820,7 @@ function us(e) {
|
|
|
1814
1820
|
return { ...i, id: o };
|
|
1815
1821
|
}) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
|
|
1816
1822
|
}
|
|
1817
|
-
class
|
|
1823
|
+
class ls extends D {
|
|
1818
1824
|
constructor(t, s, n) {
|
|
1819
1825
|
super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
|
|
1820
1826
|
}
|
|
@@ -1855,8 +1861,8 @@ class ds extends D {
|
|
|
1855
1861
|
}
|
|
1856
1862
|
}
|
|
1857
1863
|
}
|
|
1858
|
-
const
|
|
1859
|
-
({ postEvent: e, version: t }) => new
|
|
1864
|
+
const ds = d(
|
|
1865
|
+
({ postEvent: e, version: t }) => new ls(!1, t, e)
|
|
1860
1866
|
);
|
|
1861
1867
|
class _s extends D {
|
|
1862
1868
|
constructor(t, s, n) {
|
|
@@ -1901,7 +1907,7 @@ class _s extends D {
|
|
|
1901
1907
|
}
|
|
1902
1908
|
}
|
|
1903
1909
|
}
|
|
1904
|
-
const gs =
|
|
1910
|
+
const gs = d(
|
|
1905
1911
|
({ version: e, postEvent: t }) => new _s(!1, e, t)
|
|
1906
1912
|
);
|
|
1907
1913
|
class fs extends it {
|
|
@@ -1933,7 +1939,7 @@ class fs extends it {
|
|
|
1933
1939
|
this.isVisible = !0;
|
|
1934
1940
|
}
|
|
1935
1941
|
}
|
|
1936
|
-
const ws =
|
|
1942
|
+
const ws = d(
|
|
1937
1943
|
"settingsButton",
|
|
1938
1944
|
({
|
|
1939
1945
|
version: e,
|
|
@@ -2003,6 +2009,12 @@ class ms extends ct {
|
|
|
2003
2009
|
get sectionHeaderTextColor() {
|
|
2004
2010
|
return this.get("sectionHeaderTextColor");
|
|
2005
2011
|
}
|
|
2012
|
+
/**
|
|
2013
|
+
* @since v7.6
|
|
2014
|
+
*/
|
|
2015
|
+
get sectionSeparatorColor() {
|
|
2016
|
+
return this.get("sectionHeaderTextColor");
|
|
2017
|
+
}
|
|
2006
2018
|
/**
|
|
2007
2019
|
* Starts listening to the external theme changes and applies them.
|
|
2008
2020
|
* @returns Function to stop listening.
|
|
@@ -2022,7 +2034,7 @@ class ms extends ct {
|
|
|
2022
2034
|
return this.get("textColor");
|
|
2023
2035
|
}
|
|
2024
2036
|
}
|
|
2025
|
-
const bs =
|
|
2037
|
+
const bs = d(
|
|
2026
2038
|
"themeParams",
|
|
2027
2039
|
({ themeParams: e, state: t = e, addCleanup: s }) => {
|
|
2028
2040
|
const n = new ms(t);
|
|
@@ -2112,7 +2124,7 @@ class vs extends ht {
|
|
|
2112
2124
|
);
|
|
2113
2125
|
}
|
|
2114
2126
|
}
|
|
2115
|
-
const ys =
|
|
2127
|
+
const ys = d(
|
|
2116
2128
|
({ version: e, postEvent: t, createRequestId: s }) => new vs(e, s, t)
|
|
2117
2129
|
);
|
|
2118
2130
|
async function Ft(e = {}) {
|
|
@@ -2127,16 +2139,16 @@ async function Ft(e = {}) {
|
|
|
2127
2139
|
});
|
|
2128
2140
|
return { ...n, isExpanded: t, isStateStable: s };
|
|
2129
2141
|
}
|
|
2130
|
-
function
|
|
2142
|
+
function R(e) {
|
|
2131
2143
|
return e < 0 ? 0 : e;
|
|
2132
2144
|
}
|
|
2133
2145
|
class Es extends ct {
|
|
2134
2146
|
constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
|
|
2135
2147
|
super({
|
|
2136
|
-
height:
|
|
2148
|
+
height: R(n),
|
|
2137
2149
|
isExpanded: i,
|
|
2138
|
-
stableHeight:
|
|
2139
|
-
width:
|
|
2150
|
+
stableHeight: R(s),
|
|
2151
|
+
width: R(r)
|
|
2140
2152
|
}), c(this, "postEvent"), this.postEvent = t;
|
|
2141
2153
|
}
|
|
2142
2154
|
/**
|
|
@@ -2198,11 +2210,11 @@ class Es extends ct {
|
|
|
2198
2210
|
width: n,
|
|
2199
2211
|
is_expanded: r,
|
|
2200
2212
|
is_state_stable: i
|
|
2201
|
-
} = t, o =
|
|
2213
|
+
} = t, o = R(s);
|
|
2202
2214
|
this.set({
|
|
2203
2215
|
height: o,
|
|
2204
2216
|
isExpanded: r,
|
|
2205
|
-
width:
|
|
2217
|
+
width: R(n),
|
|
2206
2218
|
...i ? { stableHeight: o } : {}
|
|
2207
2219
|
});
|
|
2208
2220
|
});
|
|
@@ -2237,7 +2249,7 @@ class Es extends ct {
|
|
|
2237
2249
|
return this.stableHeight === this.height;
|
|
2238
2250
|
}
|
|
2239
2251
|
}
|
|
2240
|
-
const Ps =
|
|
2252
|
+
const Ps = d(
|
|
2241
2253
|
"viewport",
|
|
2242
2254
|
async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
|
|
2243
2255
|
let r = !1, i = 0, o = 0, a = 0;
|
|
@@ -2322,7 +2334,7 @@ function sn() {
|
|
|
2322
2334
|
return typeof window > "u";
|
|
2323
2335
|
}
|
|
2324
2336
|
async function nn() {
|
|
2325
|
-
if (
|
|
2337
|
+
if (Rt(window))
|
|
2326
2338
|
return !0;
|
|
2327
2339
|
try {
|
|
2328
2340
|
return await w({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
@@ -2355,7 +2367,7 @@ function rn(e) {
|
|
|
2355
2367
|
};
|
|
2356
2368
|
return;
|
|
2357
2369
|
}
|
|
2358
|
-
if (
|
|
2370
|
+
if (Tt(window)) {
|
|
2359
2371
|
const r = window.external.notify.bind(window.external);
|
|
2360
2372
|
window.external.notify = (i) => {
|
|
2361
2373
|
s(i), r(i);
|
|
@@ -2387,9 +2399,9 @@ function j(e, t) {
|
|
|
2387
2399
|
class Ss {
|
|
2388
2400
|
constructor(t, s, n = q) {
|
|
2389
2401
|
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)
|
|
2390
|
-
throw
|
|
2402
|
+
throw b(we, "History should not be empty.");
|
|
2391
2403
|
if (s < 0 || s >= t.length)
|
|
2392
|
-
throw
|
|
2404
|
+
throw b(
|
|
2393
2405
|
me,
|
|
2394
2406
|
"Index should not be zero and higher or equal than history size."
|
|
2395
2407
|
);
|
|
@@ -2544,7 +2556,7 @@ async function I(e) {
|
|
|
2544
2556
|
})
|
|
2545
2557
|
]);
|
|
2546
2558
|
}
|
|
2547
|
-
async function
|
|
2559
|
+
async function Ts() {
|
|
2548
2560
|
if (window.history.length <= 1 || (window.history.pushState(null, ""), await I(1 - window.history.length)))
|
|
2549
2561
|
return;
|
|
2550
2562
|
let e = await I(-1);
|
|
@@ -2735,7 +2747,7 @@ class Yt {
|
|
|
2735
2747
|
async syncHistory() {
|
|
2736
2748
|
window.removeEventListener("popstate", this.onPopState);
|
|
2737
2749
|
const { state: t } = this, s = this.renderPath(this);
|
|
2738
|
-
await
|
|
2750
|
+
await Ts(), 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);
|
|
2739
2751
|
}
|
|
2740
2752
|
/**
|
|
2741
2753
|
* Current query parameters.
|
|
@@ -2753,7 +2765,7 @@ class Yt {
|
|
|
2753
2765
|
return (this.navigator.current.params || {}).state;
|
|
2754
2766
|
}
|
|
2755
2767
|
}
|
|
2756
|
-
function
|
|
2768
|
+
function Rs(e) {
|
|
2757
2769
|
e || (e = {});
|
|
2758
2770
|
const { href: t, hash: s } = window.location;
|
|
2759
2771
|
let n = B(
|
|
@@ -2762,7 +2774,7 @@ function Ts(e) {
|
|
|
2762
2774
|
const r = e.base ? Qt(e.base) : void 0;
|
|
2763
2775
|
if (r) {
|
|
2764
2776
|
if (!n.startsWith(r))
|
|
2765
|
-
throw
|
|
2777
|
+
throw b(
|
|
2766
2778
|
be,
|
|
2767
2779
|
`Path "${n}" expected to be starting with "${r}"`
|
|
2768
2780
|
);
|
|
@@ -2789,7 +2801,7 @@ function As(e, t) {
|
|
|
2789
2801
|
console.error("Unable to restore hash navigator state.", n);
|
|
2790
2802
|
}
|
|
2791
2803
|
}
|
|
2792
|
-
return
|
|
2804
|
+
return Rs(t);
|
|
2793
2805
|
}
|
|
2794
2806
|
function cn(e, t) {
|
|
2795
2807
|
const s = As(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
@@ -2816,21 +2828,21 @@ function g(e) {
|
|
|
2816
2828
|
return Object.defineProperty(n, "error", () => s.error), n;
|
|
2817
2829
|
};
|
|
2818
2830
|
}
|
|
2819
|
-
const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns = g(Ze),
|
|
2831
|
+
const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns = g(Ze), ln = _(Ns), Ds = g(ts), dn = _(Ds), Vs = g(ss), _n = _(Vs), Ms = g(rs), gn = _(Ms), Bs = g(os), fn = _(Bs), $s = g(ps), wn = _($s), Ls = g(ds), 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) => {
|
|
2820
2832
|
const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
|
|
2821
2833
|
if (t.has(n))
|
|
2822
2834
|
return t.get(n);
|
|
2823
|
-
function i(
|
|
2824
|
-
return t.set(n,
|
|
2835
|
+
function i(l) {
|
|
2836
|
+
return t.set(n, l), l;
|
|
2825
2837
|
}
|
|
2826
2838
|
let o;
|
|
2827
2839
|
try {
|
|
2828
2840
|
o = n(...r);
|
|
2829
|
-
} catch (
|
|
2841
|
+
} catch (l) {
|
|
2830
2842
|
return i({
|
|
2831
|
-
error:
|
|
2843
|
+
error: l,
|
|
2832
2844
|
signal: () => {
|
|
2833
|
-
throw
|
|
2845
|
+
throw l;
|
|
2834
2846
|
}
|
|
2835
2847
|
});
|
|
2836
2848
|
}
|
|
@@ -2839,11 +2851,11 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2839
2851
|
const [h] = ne(() => o), u = _t(() => {
|
|
2840
2852
|
if (h.state !== "ready")
|
|
2841
2853
|
return;
|
|
2842
|
-
const
|
|
2843
|
-
if (!
|
|
2844
|
-
return
|
|
2845
|
-
const Xt = re((V) => (V(
|
|
2846
|
-
return new Proxy(
|
|
2854
|
+
const l = h();
|
|
2855
|
+
if (!l || !("on" in l))
|
|
2856
|
+
return l;
|
|
2857
|
+
const Xt = re((V) => (V(l), l.on("change", () => V(l)))), te = Object.getPrototypeOf(l), W = {};
|
|
2858
|
+
return new Proxy(l, {
|
|
2847
2859
|
get(V, C) {
|
|
2848
2860
|
if (!(C in W)) {
|
|
2849
2861
|
const pt = Reflect.getOwnPropertyDescriptor(te, C);
|
|
@@ -2865,11 +2877,11 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2865
2877
|
cleanup: a
|
|
2866
2878
|
});
|
|
2867
2879
|
};
|
|
2868
|
-
return
|
|
2880
|
+
return lt(() => {
|
|
2869
2881
|
he(e.debug || !1);
|
|
2870
|
-
}), dt(() => {
|
|
2871
|
-
nt() && lt(xs(e.acceptCustomStyles));
|
|
2872
2882
|
}), lt(() => {
|
|
2883
|
+
nt() && dt(xs(e.acceptCustomStyles));
|
|
2884
|
+
}), dt(() => {
|
|
2873
2885
|
t.forEach((n) => n.cleanup && n.cleanup());
|
|
2874
2886
|
}), bt(Zt.Provider, {
|
|
2875
2887
|
value: s,
|
|
@@ -2887,7 +2899,7 @@ export {
|
|
|
2887
2899
|
Ye as CloudStorage,
|
|
2888
2900
|
be as ERR_INVALID_PATH_BASE,
|
|
2889
2901
|
_e as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
|
|
2890
|
-
|
|
2902
|
+
le as ERR_METHOD_PARAMETER_UNSUPPORTED,
|
|
2891
2903
|
ue as ERR_METHOD_UNSUPPORTED,
|
|
2892
2904
|
we as ERR_NAVIGATION_HISTORY_EMPTY,
|
|
2893
2905
|
me as ERR_NAVIGATION_INDEX_INVALID,
|
|
@@ -2896,14 +2908,14 @@ export {
|
|
|
2896
2908
|
Js as ERR_SSR_INIT,
|
|
2897
2909
|
ge as ERR_TIMED_OUT,
|
|
2898
2910
|
fe as ERR_UNEXPECTED_TYPE,
|
|
2899
|
-
|
|
2911
|
+
de as ERR_UNKNOWN_ENV,
|
|
2900
2912
|
k as EventEmitter,
|
|
2901
2913
|
Xe as HapticFeedback,
|
|
2902
2914
|
es as InitData,
|
|
2903
2915
|
ns as Invoice,
|
|
2904
2916
|
is as MainButton,
|
|
2905
2917
|
hs as MiniApp,
|
|
2906
|
-
|
|
2918
|
+
ls as Popup,
|
|
2907
2919
|
_s as QRScanner,
|
|
2908
2920
|
$ as SDKError,
|
|
2909
2921
|
xn as SDKProvider,
|
|
@@ -2918,8 +2930,8 @@ export {
|
|
|
2918
2930
|
y as boolean,
|
|
2919
2931
|
It as captureSameReq,
|
|
2920
2932
|
Z as classNames,
|
|
2921
|
-
|
|
2922
|
-
|
|
2933
|
+
Te as compareVersions,
|
|
2934
|
+
Rs as createBrowserNavigatorFromLocation,
|
|
2923
2935
|
Ae as createPostEvent,
|
|
2924
2936
|
M as createSafeURL,
|
|
2925
2937
|
Dt as date,
|
|
@@ -2935,7 +2947,7 @@ export {
|
|
|
2935
2947
|
os as initMainButton,
|
|
2936
2948
|
ps as initMiniApp,
|
|
2937
2949
|
cn as initNavigator,
|
|
2938
|
-
|
|
2950
|
+
ds as initPopup,
|
|
2939
2951
|
gs as initQRScanner,
|
|
2940
2952
|
ws as initSettingsButton,
|
|
2941
2953
|
bs as initThemeParams,
|
|
@@ -2977,7 +2989,7 @@ export {
|
|
|
2977
2989
|
p as string,
|
|
2978
2990
|
ae as subscribe,
|
|
2979
2991
|
x as supports,
|
|
2980
|
-
|
|
2992
|
+
Re as targetOrigin,
|
|
2981
2993
|
xt as toRGB,
|
|
2982
2994
|
yt as unsubscribe,
|
|
2983
2995
|
B as urlToPath,
|
|
@@ -3000,8 +3012,8 @@ export {
|
|
|
3000
3012
|
hn as withBackButton,
|
|
3001
3013
|
pn as withBiometryManager,
|
|
3002
3014
|
un as withClosingBehavior,
|
|
3003
|
-
|
|
3004
|
-
|
|
3015
|
+
ln as withCloudStorage,
|
|
3016
|
+
dn as withHapticFeedback,
|
|
3005
3017
|
_n as withInitData,
|
|
3006
3018
|
gn as withInvoice,
|
|
3007
3019
|
fn as withMainButton,
|