@tma.js/sdk 2.5.1 → 2.6.0

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.js CHANGED
@@ -1,6 +1,6 @@
1
- var Ot = Object.defineProperty;
2
- var Ut = (e, t, s) => t in e ? Ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var c = (e, t, s) => Ut(e, typeof t != "symbol" ? t + "" : t, s);
1
+ var Ut = Object.defineProperty;
2
+ var Ot = (e, t, s) => t in e ? Ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var c = (e, t, s) => Ot(e, typeof t != "symbol" ? t + "" : t, s);
4
4
  function at(e, t) {
5
5
  let s;
6
6
  const n = () => {
@@ -9,11 +9,11 @@ function at(e, t) {
9
9
  return [() => s === void 0 ? s = e(n) : s, n];
10
10
  }
11
11
  function ct(e) {
12
- const t = M(), { count: s } = t;
12
+ const t = L(), { count: s } = t;
13
13
  t.unsubscribe(e), s && !t.count && ae();
14
14
  }
15
15
  function Ht(e) {
16
- return M().subscribe(e), () => ct(e);
16
+ return L().subscribe(e), () => ct(e);
17
17
  }
18
18
  class Gt {
19
19
  constructor(t, s = {}) {
@@ -69,7 +69,7 @@ function Ye(e) {
69
69
  function jt(...e) {
70
70
  H && F.log(...e);
71
71
  }
72
- class R {
72
+ class T {
73
73
  constructor() {
74
74
  c(this, "listeners", /* @__PURE__ */ new Map());
75
75
  c(this, "listenersCount", 0);
@@ -160,14 +160,14 @@ class D extends Error {
160
160
  super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, D.prototype);
161
161
  }
162
162
  }
163
- function f(e, t, s) {
163
+ function g(e, t, s) {
164
164
  return new D(e, t, s);
165
165
  }
166
166
  const zt = "ERR_METHOD_UNSUPPORTED", Ft = "ERR_METHOD_PARAMETER_UNSUPPORTED", Jt = "ERR_UNKNOWN_ENV", Qt = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", Yt = "ERR_TIMED_OUT", Zt = "ERR_UNEXPECTED_TYPE", ht = "ERR_PARSE", Kt = "ERR_NAVIGATION_LIST_EMPTY", Xt = "ERR_NAVIGATION_CURSOR_INVALID", Ze = "ERR_NAVIGATION_ITEM_INVALID", Ke = "ERR_SSR_INIT", te = "ERR_INVALID_PATH_BASE";
167
167
  function E() {
168
- return f(Zt, "Value has unexpected type");
168
+ return g(Zt, "Value has unexpected type");
169
169
  }
170
- class V {
170
+ class M {
171
171
  constructor(t, s, n) {
172
172
  this.parser = t, this.isOptional = s, this.type = n;
173
173
  }
@@ -182,7 +182,7 @@ class V {
182
182
  try {
183
183
  return this.parser(t);
184
184
  } catch (s) {
185
- throw f(
185
+ throw g(
186
186
  ht,
187
187
  `Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
188
188
  s
@@ -193,10 +193,10 @@ class V {
193
193
  return this.isOptional = !0, this;
194
194
  }
195
195
  }
196
- function P(e, t) {
197
- return () => new V(e, !1, t);
196
+ function x(e, t) {
197
+ return () => new M(e, !1, t);
198
198
  }
199
- const b = P((e) => {
199
+ const w = x((e) => {
200
200
  if (typeof e == "boolean")
201
201
  return e;
202
202
  const t = String(e);
@@ -223,7 +223,7 @@ function pt(e, t) {
223
223
  const a = o(t(i));
224
224
  a !== void 0 && (s[n] = a);
225
225
  } catch (a) {
226
- throw f(ht, `Unable to parse field "${n}"`, a);
226
+ throw g(ht, `Unable to parse field "${n}"`, a);
227
227
  }
228
228
  }
229
229
  return s;
@@ -235,12 +235,12 @@ function Q(e) {
235
235
  return t;
236
236
  }
237
237
  function d(e, t) {
238
- return new V((s) => {
238
+ return new M((s) => {
239
239
  const n = Q(s);
240
240
  return pt(e, (r) => n[r]);
241
241
  }, !1, t);
242
242
  }
243
- const y = P((e) => {
243
+ const y = x((e) => {
244
244
  if (typeof e == "number")
245
245
  return e;
246
246
  if (typeof e == "string") {
@@ -274,11 +274,11 @@ function ut(e) {
274
274
  return n + (i.length === 1 ? "0" : "") + i;
275
275
  }, "#");
276
276
  }
277
- const h = P((e) => {
277
+ const h = x((e) => {
278
278
  if (typeof e == "string" || typeof e == "number")
279
279
  return e.toString();
280
280
  throw E();
281
- }, "string"), lt = P((e) => ut(h().parse(e)), "rgb");
281
+ }, "string"), lt = x((e) => ut(h().parse(e)), "rgb");
282
282
  function dt(e) {
283
283
  return d({
284
284
  eventType: h(),
@@ -345,13 +345,13 @@ const re = {
345
345
  viewport_changed: d({
346
346
  height: y(),
347
347
  width: (e) => e == null ? window.innerWidth : y().parse(e),
348
- is_state_stable: b(),
349
- is_expanded: b()
348
+ is_state_stable: w(),
349
+ is_expanded: w()
350
350
  }),
351
351
  write_access_requested: d({ status: h() })
352
352
  };
353
353
  function ie() {
354
- const e = new R(), t = new R();
354
+ const e = new T(), t = new T();
355
355
  t.subscribe((n) => {
356
356
  e.emit("event", { name: n.event, payload: n.args[0] });
357
357
  }), ne();
@@ -422,14 +422,14 @@ const [oe, ae] = at(
422
422
  },
423
423
  ([, e]) => e()
424
424
  );
425
- function M() {
425
+ function L() {
426
426
  return oe()[0];
427
427
  }
428
- function L(e, t) {
429
- M().off(e, t);
428
+ function V(e, t) {
429
+ L().off(e, t);
430
430
  }
431
- function w(e, t, s) {
432
- return M().on(e, t, s);
431
+ function b(e, t, s) {
432
+ return L().on(e, t, s);
433
433
  }
434
434
  function I(e) {
435
435
  return typeof e == "object" && e !== null && !Array.isArray(e);
@@ -443,15 +443,21 @@ function ce(e, t) {
443
443
  }
444
444
  return 0;
445
445
  }
446
- function g(e, t) {
446
+ function f(e, t) {
447
447
  return ce(e, t) <= 0;
448
448
  }
449
449
  function v(e, t, s) {
450
450
  if (typeof s == "string") {
451
- if (e === "web_app_open_link" && t === "try_instant_view")
452
- return g("6.4", s);
451
+ if (e === "web_app_open_link") {
452
+ if (t === "try_instant_view")
453
+ return f("6.4", s);
454
+ if (t === "try_browser")
455
+ return f("7.6", s);
456
+ }
453
457
  if (e === "web_app_set_header_color" && t === "color")
454
- return g("6.9", s);
458
+ return f("6.9", s);
459
+ if (e === "web_app_close" && t === "return_back")
460
+ return f("7.6", s);
455
461
  }
456
462
  switch (e) {
457
463
  case "web_app_open_tg_link":
@@ -460,27 +466,27 @@ function v(e, t, s) {
460
466
  case "web_app_set_background_color":
461
467
  case "web_app_set_header_color":
462
468
  case "web_app_trigger_haptic_feedback":
463
- return g("6.1", t);
469
+ return f("6.1", t);
464
470
  case "web_app_open_popup":
465
- return g("6.2", t);
471
+ return f("6.2", t);
466
472
  case "web_app_close_scan_qr_popup":
467
473
  case "web_app_open_scan_qr_popup":
468
474
  case "web_app_read_text_from_clipboard":
469
- return g("6.4", t);
475
+ return f("6.4", t);
470
476
  case "web_app_switch_inline_query":
471
- return g("6.7", t);
477
+ return f("6.7", t);
472
478
  case "web_app_invoke_custom_method":
473
479
  case "web_app_request_write_access":
474
480
  case "web_app_request_phone":
475
- return g("6.9", t);
481
+ return f("6.9", t);
476
482
  case "web_app_setup_settings_button":
477
- return g("6.10", t);
483
+ return f("6.10", t);
478
484
  case "web_app_biometry_get_info":
479
485
  case "web_app_biometry_open_settings":
480
486
  case "web_app_biometry_request_access":
481
487
  case "web_app_biometry_request_auth":
482
488
  case "web_app_biometry_update_token":
483
- return g("7.2", t);
489
+ return f("7.2", t);
484
490
  default:
485
491
  return [
486
492
  "iframe_ready",
@@ -510,14 +516,14 @@ function gt() {
510
516
  return !0;
511
517
  }
512
518
  }
513
- let wt = "https://web.telegram.org";
519
+ let bt = "https://web.telegram.org";
514
520
  function Xe(e) {
515
- wt = e;
521
+ bt = e;
516
522
  }
517
523
  function he() {
518
- return wt;
524
+ return bt;
519
525
  }
520
- function T(e, t, s) {
526
+ function R(e, t, s) {
521
527
  let n = {}, r;
522
528
  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);
523
529
  const { targetOrigin: i = he() } = n;
@@ -533,7 +539,7 @@ function T(e, t, s) {
533
539
  window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
534
540
  return;
535
541
  }
536
- throw f(
542
+ throw g(
537
543
  Jt,
538
544
  "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."
539
545
  );
@@ -541,23 +547,23 @@ function T(e, t, s) {
541
547
  function pe(e) {
542
548
  return (t, s) => {
543
549
  if (!v(t, e))
544
- throw f(zt, `Method "${t}" is unsupported in Mini Apps version ${e}`);
550
+ throw g(zt, `Method "${t}" is unsupported in Mini Apps version ${e}`);
545
551
  if (I(s)) {
546
552
  let n;
547
553
  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 && !v(t, n, e))
548
- throw f(
554
+ throw g(
549
555
  Ft,
550
556
  `Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
551
557
  );
552
558
  }
553
- return T(t, s);
559
+ return R(t, s);
554
560
  };
555
561
  }
556
- function bt(e) {
562
+ function wt(e) {
557
563
  return ({ req_id: t }) => t === e;
558
564
  }
559
565
  function mt(e) {
560
- return f(Yt, `Timeout reached: ${e}ms`);
566
+ return g(Yt, `Timeout reached: ${e}ms`);
561
567
  }
562
568
  function yt(e, t) {
563
569
  return Promise.race([
@@ -575,11 +581,11 @@ async function _(e) {
575
581
  t = a;
576
582
  }), { event: n, capture: r, timeout: i } = e, [, o] = J(
577
583
  ...(Array.isArray(n) ? n : [n]).map(
578
- (a) => w(a, (p) => (!r || r(p)) && t(p))
584
+ (a) => b(a, (p) => (!r || r(p)) && t(p))
579
585
  )
580
586
  );
581
587
  try {
582
- return (e.postEvent || T)(e.method, e.params), await (i ? yt(s, i) : s);
588
+ return (e.postEvent || R)(e.method, e.params), await (i ? yt(s, i) : s);
583
589
  } finally {
584
590
  o();
585
591
  }
@@ -597,10 +603,10 @@ async function S(e, t, s, n = {}) {
597
603
  params: t,
598
604
  req_id: s
599
605
  },
600
- capture: bt(s)
606
+ capture: wt(s)
601
607
  });
602
608
  if (i)
603
- throw f(Qt, i);
609
+ throw g(Qt, i);
604
610
  return r;
605
611
  }
606
612
  function z(...e) {
@@ -630,7 +636,7 @@ function vt(e) {
630
636
  }
631
637
  class ue {
632
638
  constructor(t) {
633
- c(this, "ee", new R());
639
+ c(this, "ee", new T());
634
640
  /**
635
641
  * Adds new event listener.
636
642
  */
@@ -700,13 +706,13 @@ class le extends K {
700
706
  * @param event - event to listen.
701
707
  * @param listener - listener to add.
702
708
  */
703
- c(this, "on", (s, n) => s === "click" ? w("back_button_pressed", n) : this.state.on(s, n));
709
+ c(this, "on", (s, n) => s === "click" ? b("back_button_pressed", n) : this.state.on(s, n));
704
710
  /**
705
711
  * Removes the event listener.
706
712
  * @param event - event to listen.
707
713
  * @param listener - listener to remove.
708
714
  */
709
- c(this, "off", (s, n) => s === "click" ? L("back_button_pressed", n) : this.state.off(s, n));
715
+ c(this, "off", (s, n) => s === "click" ? V("back_button_pressed", n) : this.state.off(s, n));
710
716
  this.postEvent = r;
711
717
  }
712
718
  set isVisible(s) {
@@ -731,9 +737,9 @@ class le extends K {
731
737
  this.isVisible = !0;
732
738
  }
733
739
  }
734
- const Pt = P((e) => e instanceof Date ? e : new Date(y().parse(e) * 1e3), "Date");
740
+ const xt = x((e) => e instanceof Date ? e : new Date(y().parse(e) * 1e3), "Date");
735
741
  function X(e, t) {
736
- return new V((s) => {
742
+ return new M((s) => {
737
743
  if (typeof s != "string" && !(s instanceof URLSearchParams))
738
744
  throw E();
739
745
  const n = typeof s == "string" ? new URLSearchParams(s) : s;
@@ -754,11 +760,11 @@ const de = d({
754
760
  username: h().optional()
755
761
  }, "Chat").optional(), rt = d({
756
762
  addedToAttachmentMenu: {
757
- type: b().optional(),
763
+ type: w().optional(),
758
764
  from: "added_to_attachment_menu"
759
765
  },
760
766
  allowsWriteToPm: {
761
- type: b().optional(),
767
+ type: w().optional(),
762
768
  from: "allows_write_to_pm"
763
769
  },
764
770
  firstName: {
@@ -767,11 +773,11 @@ const de = d({
767
773
  },
768
774
  id: y(),
769
775
  isBot: {
770
- type: b().optional(),
776
+ type: w().optional(),
771
777
  from: "is_bot"
772
778
  },
773
779
  isPremium: {
774
- type: b().optional(),
780
+ type: w().optional(),
775
781
  from: "is_premium"
776
782
  },
777
783
  languageCode: {
@@ -788,10 +794,10 @@ const de = d({
788
794
  },
789
795
  username: h().optional()
790
796
  }, "User").optional();
791
- function xt() {
797
+ function Pt() {
792
798
  return X({
793
799
  authDate: {
794
- type: Pt(),
800
+ type: xt(),
795
801
  from: "auth_date"
796
802
  },
797
803
  canSendAfter: {
@@ -826,7 +832,7 @@ function _e(e) {
826
832
  function fe(e) {
827
833
  return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
828
834
  }
829
- const St = P(
835
+ const St = x(
830
836
  (e) => {
831
837
  const t = lt().optional();
832
838
  return Object.entries(Q(e)).reduce((s, [n, r]) => (s[_e(n)] = t.parse(r), s), {});
@@ -836,11 +842,11 @@ const St = P(
836
842
  function tt(e) {
837
843
  return X({
838
844
  botInline: {
839
- type: b().optional(),
845
+ type: w().optional(),
840
846
  from: "tgWebAppBotInline"
841
847
  },
842
848
  initData: {
843
- type: xt().optional(),
849
+ type: Pt().optional(),
844
850
  from: "tgWebAppData"
845
851
  },
846
852
  initDataRaw: {
@@ -852,7 +858,7 @@ function tt(e) {
852
858
  from: "tgWebAppPlatform"
853
859
  },
854
860
  showSettings: {
855
- type: b().optional(),
861
+ type: w().optional(),
856
862
  from: "tgWebAppShowSettings"
857
863
  },
858
864
  startParam: {
@@ -877,29 +883,29 @@ function Ct(e) {
877
883
  function ge() {
878
884
  return Ct(window.location.href);
879
885
  }
880
- function Rt() {
886
+ function Tt() {
881
887
  return performance.getEntriesByType("navigation")[0];
882
888
  }
883
- function we() {
884
- const e = Rt();
889
+ function be() {
890
+ const e = Tt();
885
891
  if (!e)
886
892
  throw new Error("Unable to get first navigation entry.");
887
893
  return Ct(e.name);
888
894
  }
889
- function Tt(e) {
895
+ function Rt(e) {
890
896
  return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
891
897
  }
892
898
  function At(e, t) {
893
- sessionStorage.setItem(Tt(e), JSON.stringify(t));
899
+ sessionStorage.setItem(Rt(e), JSON.stringify(t));
894
900
  }
895
901
  function It(e) {
896
- const t = sessionStorage.getItem(Tt(e));
902
+ const t = sessionStorage.getItem(Rt(e));
897
903
  try {
898
904
  return t ? JSON.parse(t) : void 0;
899
905
  } catch {
900
906
  }
901
907
  }
902
- function be() {
908
+ function we() {
903
909
  return tt(It("launchParams") || "");
904
910
  }
905
911
  function qt(e) {
@@ -930,9 +936,9 @@ function ye() {
930
936
  // nothing in case, location was changed and then page was reloaded.
931
937
  ge,
932
938
  // Then, try using the lower level API - window.performance.
933
- we,
939
+ be,
934
940
  // Finally, try to extract launch parameters from the session storage.
935
- be
941
+ we
936
942
  ])
937
943
  try {
938
944
  const t = e();
@@ -942,7 +948,7 @@ function ye() {
942
948
  throw new Error("Unable to retrieve launch parameters from any known source.");
943
949
  }
944
950
  function Nt() {
945
- const e = Rt();
951
+ const e = Tt();
946
952
  return !!(e && e.type === "reload");
947
953
  }
948
954
  function ve() {
@@ -1013,7 +1019,7 @@ function Dt(e) {
1013
1019
  accessGranted: t.access_granted
1014
1020
  };
1015
1021
  }
1016
- class Pe extends q {
1022
+ class xe extends q {
1017
1023
  constructor({ postEvent: s, version: n, ...r }) {
1018
1024
  super(r, n, {
1019
1025
  auth: "web_app_biometry_request_auth",
@@ -1127,7 +1133,7 @@ class Pe extends q {
1127
1133
  );
1128
1134
  }
1129
1135
  }
1130
- async function xe(e) {
1136
+ async function Pe(e) {
1131
1137
  return Dt(
1132
1138
  await _({
1133
1139
  ...e || {},
@@ -1138,8 +1144,8 @@ async function xe(e) {
1138
1144
  }
1139
1145
  const ss = l(
1140
1146
  "biometryManager",
1141
- async ({ postEvent: e, version: t, state: s }) => new Pe({
1142
- ...s || v("web_app_biometry_get_info", t) ? s || await xe({ timeout: 1e3 }) : {
1147
+ async ({ postEvent: e, version: t, state: s }) => new xe({
1148
+ ...s || v("web_app_biometry_get_info", t) ? s || await Pe({ timeout: 1e3 }) : {
1143
1149
  available: !1,
1144
1150
  accessGranted: !1,
1145
1151
  accessRequested: !1,
@@ -1218,7 +1224,7 @@ function Ce(e) {
1218
1224
  }
1219
1225
  throw E();
1220
1226
  }
1221
- class Re extends V {
1227
+ class Te extends M {
1222
1228
  constructor(s, n, r) {
1223
1229
  super(Ce, n, r);
1224
1230
  c(this, "itemParser");
@@ -1238,8 +1244,8 @@ class Re extends V {
1238
1244
  return this.itemParser = typeof s == "function" ? s : s.parse.bind(s), this;
1239
1245
  }
1240
1246
  }
1241
- function Te(e) {
1242
- return new Re((t) => t, !1, e);
1247
+ function Re(e) {
1248
+ return new Te((t) => t, !1, e);
1243
1249
  }
1244
1250
  function it(e, t) {
1245
1251
  return Object.fromEntries(e.map((s) => [s, t]));
@@ -1272,7 +1278,7 @@ class Ae extends st {
1272
1278
  * @param options - request execution options.
1273
1279
  */
1274
1280
  async getKeys(t = {}) {
1275
- return Te().of(h()).parse(
1281
+ return Re().of(h()).parse(
1276
1282
  await S(
1277
1283
  "getStorageKeys",
1278
1284
  {},
@@ -1433,7 +1439,7 @@ const os = l(
1433
1439
  ({ initData: e }) => e ? new qe(e) : void 0
1434
1440
  );
1435
1441
  function as(e) {
1436
- return xt().parse(e);
1442
+ return Pt().parse(e);
1437
1443
  }
1438
1444
  class ke extends q {
1439
1445
  constructor(t, s, n) {
@@ -1491,13 +1497,13 @@ class Ne extends Z {
1491
1497
  * @param event - event to listen.
1492
1498
  * @param listener - listener to add.
1493
1499
  */
1494
- c(this, "on", (s, n) => s === "click" ? w("main_button_pressed", n) : this.state.on(s, n));
1500
+ c(this, "on", (s, n) => s === "click" ? b("main_button_pressed", n) : this.state.on(s, n));
1495
1501
  /**
1496
1502
  * Removes the event listener.
1497
1503
  * @param event - event to listen.
1498
1504
  * @param listener - listener to remove.
1499
1505
  */
1500
- c(this, "off", (s, n) => s === "click" ? L("main_button_pressed", n) : this.state.off(s, n));
1506
+ c(this, "off", (s, n) => s === "click" ? V("main_button_pressed", n) : this.state.off(s, n));
1501
1507
  this.postEvent = s;
1502
1508
  }
1503
1509
  /**
@@ -1663,24 +1669,24 @@ function De() {
1663
1669
  }
1664
1670
  }),
1665
1671
  authDate: {
1666
- type: Pt(),
1672
+ type: xt(),
1667
1673
  from: "auth_date"
1668
1674
  },
1669
1675
  hash: h()
1670
1676
  }, "RequestedContact");
1671
1677
  }
1672
- function Vt(e, t) {
1678
+ function Mt(e, t) {
1673
1679
  return (s) => {
1674
1680
  const [n, r] = t[s];
1675
1681
  return v(n, r, e);
1676
1682
  };
1677
1683
  }
1678
- function Ve(e) {
1684
+ function Me(e) {
1679
1685
  return new Promise((t) => {
1680
1686
  setTimeout(t, e);
1681
1687
  });
1682
1688
  }
1683
- class Me extends q {
1689
+ class Le extends q {
1684
1690
  constructor({ postEvent: s, createRequestId: n, version: r, botInline: i, ...o }) {
1685
1691
  super(o, r, {
1686
1692
  requestPhoneAccess: "web_app_request_phone",
@@ -1700,7 +1706,7 @@ class Me extends q {
1700
1706
  c(this, "supportsParam");
1701
1707
  this.createRequestId = n, this.postEvent = s, this.botInline = i;
1702
1708
  const a = this.supports.bind(this);
1703
- this.supports = (p) => a(p) ? p !== "switchInlineQuery" || i : !1, this.supportsParam = Vt(r, {
1709
+ this.supports = (p) => a(p) ? p !== "switchInlineQuery" || i : !1, this.supportsParam = Mt(r, {
1704
1710
  "setHeaderColor.color": ["web_app_set_header_color", "color"]
1705
1711
  });
1706
1712
  }
@@ -1786,7 +1792,7 @@ class Me extends q {
1786
1792
  return await this.getRequestedContact();
1787
1793
  } catch {
1788
1794
  }
1789
- await Ve(i), i += 50;
1795
+ await Me(i), i += 50;
1790
1796
  }
1791
1797
  throw mt(s);
1792
1798
  }, s);
@@ -1881,9 +1887,9 @@ const ps = l(
1881
1887
  headerColor: e.headerBgColor || "#000000"
1882
1888
  },
1883
1889
  ...n
1884
- }) => new Me({ ...n, ...s, botInline: t })
1890
+ }) => new Le({ ...n, ...s, botInline: t })
1885
1891
  );
1886
- function Le(e) {
1892
+ function Ve(e) {
1887
1893
  const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
1888
1894
  let r;
1889
1895
  if (s.length > 64)
@@ -1940,7 +1946,7 @@ class $e extends q {
1940
1946
  event: "popup_closed",
1941
1947
  method: "web_app_open_popup",
1942
1948
  postEvent: this.postEvent,
1943
- params: Le(t)
1949
+ params: Ve(t)
1944
1950
  });
1945
1951
  return s;
1946
1952
  } finally {
@@ -2008,13 +2014,13 @@ class We extends K {
2008
2014
  * @param event - event to listen.
2009
2015
  * @param listener - listener to add.
2010
2016
  */
2011
- c(this, "on", (s, n) => s === "click" ? w("settings_button_pressed", n) : this.state.on(s, n));
2017
+ c(this, "on", (s, n) => s === "click" ? b("settings_button_pressed", n) : this.state.on(s, n));
2012
2018
  /**
2013
2019
  * Removes the event listener.
2014
2020
  * @param event - event to listen.
2015
2021
  * @param listener - listener to remove.
2016
2022
  */
2017
- c(this, "off", (s, n) => s === "click" ? L("settings_button_pressed", n) : this.state.off(s, n));
2023
+ c(this, "off", (s, n) => s === "click" ? V("settings_button_pressed", n) : this.state.off(s, n));
2018
2024
  this.postEvent = r;
2019
2025
  }
2020
2026
  set isVisible(s) {
@@ -2047,10 +2053,10 @@ const ds = l(
2047
2053
  state: s = { isVisible: !1 }
2048
2054
  }) => new We(s.isVisible, e, t)
2049
2055
  );
2050
- function Mt(e) {
2056
+ function Lt(e) {
2051
2057
  return St().parse(e);
2052
2058
  }
2053
- class Oe extends et {
2059
+ class Ue extends et {
2054
2060
  /**
2055
2061
  * @since v6.10
2056
2062
  */
@@ -2109,13 +2115,19 @@ class Oe extends et {
2109
2115
  get sectionHeaderTextColor() {
2110
2116
  return this.get("sectionHeaderTextColor");
2111
2117
  }
2118
+ /**
2119
+ * @since v7.6
2120
+ */
2121
+ get sectionSeparatorColor() {
2122
+ return this.get("sectionHeaderTextColor");
2123
+ }
2112
2124
  /**
2113
2125
  * Starts listening to the external theme changes and applies them.
2114
2126
  * @returns Function to stop listening.
2115
2127
  */
2116
2128
  listen() {
2117
- return w("theme_changed", (t) => {
2118
- this.set(Mt(t.theme_params));
2129
+ return b("theme_changed", (t) => {
2130
+ this.set(Lt(t.theme_params));
2119
2131
  });
2120
2132
  }
2121
2133
  /**
@@ -2131,7 +2143,7 @@ class Oe extends et {
2131
2143
  const _s = l(
2132
2144
  "themeParams",
2133
2145
  ({ themeParams: e, state: t = e, addCleanup: s }) => {
2134
- const n = new Oe(t);
2146
+ const n = new Ue(t);
2135
2147
  return s(n.listen()), n;
2136
2148
  }
2137
2149
  );
@@ -2140,16 +2152,16 @@ function fs(e = {}) {
2140
2152
  ...e,
2141
2153
  method: "web_app_request_theme",
2142
2154
  event: "theme_changed"
2143
- }).then(Mt);
2155
+ }).then(Lt);
2144
2156
  }
2145
- class Ue extends st {
2157
+ class Oe extends st {
2146
2158
  constructor(s, n, r) {
2147
2159
  super(s, { readTextFromClipboard: "web_app_read_text_from_clipboard" });
2148
2160
  /**
2149
2161
  * Checks if specified method parameter is supported by current component.
2150
2162
  */
2151
2163
  c(this, "supportsParam");
2152
- this.version = s, this.createRequestId = n, this.postEvent = r, this.supportsParam = Vt(s, {
2164
+ this.version = s, this.createRequestId = n, this.postEvent = r, this.supportsParam = Mt(s, {
2153
2165
  "openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
2154
2166
  });
2155
2167
  }
@@ -2203,7 +2215,7 @@ class Ue extends st {
2203
2215
  event: "clipboard_text_received",
2204
2216
  postEvent: this.postEvent,
2205
2217
  params: { req_id: s },
2206
- capture: bt(s)
2218
+ capture: wt(s)
2207
2219
  });
2208
2220
  return n;
2209
2221
  }
@@ -2224,9 +2236,9 @@ class Ue extends st {
2224
2236
  }
2225
2237
  }
2226
2238
  const gs = l(
2227
- ({ version: e, postEvent: t, createRequestId: s }) => new Ue(e, s, t)
2239
+ ({ version: e, postEvent: t, createRequestId: s }) => new Oe(e, s, t)
2228
2240
  );
2229
- async function Lt(e = {}) {
2241
+ async function Vt(e = {}) {
2230
2242
  const {
2231
2243
  is_expanded: t,
2232
2244
  is_state_stable: s,
@@ -2238,16 +2250,16 @@ async function Lt(e = {}) {
2238
2250
  });
2239
2251
  return { ...n, isExpanded: t, isStateStable: s };
2240
2252
  }
2241
- function x(e) {
2253
+ function P(e) {
2242
2254
  return e < 0 ? 0 : e;
2243
2255
  }
2244
2256
  class He extends et {
2245
2257
  constructor({ postEvent: s, stableHeight: n, height: r, width: i, isExpanded: o }) {
2246
2258
  super({
2247
- height: x(r),
2259
+ height: P(r),
2248
2260
  isExpanded: o,
2249
- stableHeight: x(n),
2250
- width: x(i)
2261
+ stableHeight: P(n),
2262
+ width: P(i)
2251
2263
  });
2252
2264
  c(this, "postEvent");
2253
2265
  this.postEvent = s;
@@ -2258,7 +2270,7 @@ class He extends et {
2258
2270
  * @param options - options to request fresh data.
2259
2271
  */
2260
2272
  async sync(s) {
2261
- const { isStateStable: n, ...r } = await Lt(s);
2273
+ const { isStateStable: n, ...r } = await Vt(s);
2262
2274
  this.set({
2263
2275
  ...r,
2264
2276
  stableHeight: n ? r.height : this.get("stableHeight")
@@ -2305,17 +2317,17 @@ class He extends et {
2305
2317
  * @returns Function to stop listening.
2306
2318
  */
2307
2319
  listen() {
2308
- return w("viewport_changed", (s) => {
2320
+ return b("viewport_changed", (s) => {
2309
2321
  const {
2310
2322
  height: n,
2311
2323
  width: r,
2312
2324
  is_expanded: i,
2313
2325
  is_state_stable: o
2314
- } = s, a = x(n);
2326
+ } = s, a = P(n);
2315
2327
  this.set({
2316
2328
  height: a,
2317
2329
  isExpanded: i,
2318
- width: x(r),
2330
+ width: P(r),
2319
2331
  ...o ? { stableHeight: a } : {}
2320
2332
  });
2321
2333
  });
@@ -2350,7 +2362,7 @@ class He extends et {
2350
2362
  return this.stableHeight === this.height;
2351
2363
  }
2352
2364
  }
2353
- const ws = l(
2365
+ const bs = l(
2354
2366
  "viewport",
2355
2367
  async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
2356
2368
  let r = !1, i = 0, o = 0, a = 0;
@@ -2359,7 +2371,7 @@ const ws = l(
2359
2371
  else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
2360
2372
  r = !0, i = window.innerHeight, o = window.innerWidth, a = window.innerHeight;
2361
2373
  else {
2362
- const u = await Lt({ timeout: 1e3, postEvent: s });
2374
+ const u = await Vt({ timeout: 1e3, postEvent: s });
2363
2375
  r = u.isExpanded, i = u.height, o = u.width, a = u.isStateStable ? i : 0;
2364
2376
  }
2365
2377
  const p = new He({
@@ -2375,7 +2387,7 @@ const ws = l(
2375
2387
  function m(e, t) {
2376
2388
  document.documentElement.style.setProperty(e, t);
2377
2389
  }
2378
- function bs(e, t, s) {
2390
+ function ws(e, t, s) {
2379
2391
  s || (s = (a) => `--tg-${a}-color`);
2380
2392
  const n = s("header"), r = s("bg"), i = () => {
2381
2393
  const { headerColor: a } = e;
@@ -2416,25 +2428,25 @@ function ys(e, t) {
2416
2428
  }
2417
2429
  function vs(e = !0) {
2418
2430
  const t = [
2419
- w("reload_iframe", () => {
2420
- T("iframe_will_reload"), window.location.reload();
2431
+ b("reload_iframe", () => {
2432
+ R("iframe_will_reload"), window.location.reload();
2421
2433
  })
2422
2434
  ], s = () => t.forEach((n) => n());
2423
2435
  if (e) {
2424
2436
  const n = document.createElement("style");
2425
2437
  n.id = "telegram-custom-styles", document.head.appendChild(n), t.push(
2426
- w("set_custom_style", (r) => {
2438
+ b("set_custom_style", (r) => {
2427
2439
  n.innerHTML = r;
2428
2440
  }),
2429
2441
  () => document.head.removeChild(n)
2430
2442
  );
2431
2443
  }
2432
- return T("iframe_ready", { reload_supported: !0 }), s;
2444
+ return R("iframe_ready", { reload_supported: !0 }), s;
2433
2445
  }
2434
2446
  function Es() {
2435
2447
  return typeof window > "u";
2436
2448
  }
2437
- async function Ps() {
2449
+ async function xs() {
2438
2450
  if (ft(window))
2439
2451
  return !0;
2440
2452
  try {
@@ -2443,7 +2455,7 @@ async function Ps() {
2443
2455
  return !1;
2444
2456
  }
2445
2457
  }
2446
- function xs(e) {
2458
+ function Ps(e) {
2447
2459
  const t = typeof e == "string" ? tt(e) : e;
2448
2460
  kt(t);
2449
2461
  function s(r) {
@@ -2498,12 +2510,12 @@ function $(e, t) {
2498
2510
  });
2499
2511
  }
2500
2512
  class je {
2501
- constructor(t, s, n = T) {
2513
+ constructor(t, s, n = R) {
2502
2514
  /**
2503
2515
  * Navigation history.
2504
2516
  */
2505
2517
  c(this, "history");
2506
- c(this, "ee", new R());
2518
+ c(this, "ee", new T());
2507
2519
  /**
2508
2520
  * True, if current navigator is currently attached.
2509
2521
  */
@@ -2521,9 +2533,9 @@ class je {
2521
2533
  */
2522
2534
  c(this, "off", this.ee.off.bind(this.ee));
2523
2535
  if (this._index = s, this.postEvent = n, t.length === 0)
2524
- throw f(Kt, "History should not be empty.");
2536
+ throw g(Kt, "History should not be empty.");
2525
2537
  if (s < 0 || s >= t.length)
2526
- throw f(
2538
+ throw g(
2527
2539
  Xt,
2528
2540
  "Index should not be zero and higher or equal than history size."
2529
2541
  );
@@ -2534,7 +2546,7 @@ class je {
2534
2546
  * `BackButton` clicks and calls the `back` method.
2535
2547
  */
2536
2548
  attach() {
2537
- this.attached || (this.attached = !0, this.sync(), w("back_button_pressed", this.back));
2549
+ this.attached || (this.attached = !0, this.sync(), b("back_button_pressed", this.back));
2538
2550
  }
2539
2551
  /**
2540
2552
  * Currently active history item.
@@ -2546,7 +2558,7 @@ class je {
2546
2558
  * Prevents current navigator from controlling the BackButton visibility state.
2547
2559
  */
2548
2560
  detach() {
2549
- this.attached = !1, L("back_button_pressed", this.back);
2561
+ this.attached = !1, V("back_button_pressed", this.back);
2550
2562
  }
2551
2563
  /**
2552
2564
  * Goes to the next history item.
@@ -2688,11 +2700,11 @@ async function ze() {
2688
2700
  function $t(e) {
2689
2701
  return k(e).pathname;
2690
2702
  }
2691
- const ot = 0, O = 1, U = 2;
2703
+ const ot = 0, U = 1, O = 2;
2692
2704
  class Bt {
2693
2705
  constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
2694
2706
  c(this, "navigator");
2695
- c(this, "ee", new R());
2707
+ c(this, "ee", new T());
2696
2708
  c(this, "hashMode");
2697
2709
  c(this, "base");
2698
2710
  /**
@@ -2706,7 +2718,7 @@ class Bt {
2706
2718
  c(this, "onPopState", ({ state: t }) => {
2707
2719
  if (t === null)
2708
2720
  return this.push(this.parsePath(window.location.href));
2709
- t === ot ? window.history.forward() : t === O && this.back(), t === U && this.forward();
2721
+ t === ot ? window.history.forward() : t === U && this.back(), t === O && this.forward();
2710
2722
  });
2711
2723
  /**
2712
2724
  * Underlying navigator change event listener.
@@ -2894,7 +2906,7 @@ class Bt {
2894
2906
  async syncHistory() {
2895
2907
  window.removeEventListener("popstate", this.onPopState);
2896
2908
  const { state: t } = this, s = this.renderPath(this);
2897
- await ze(), this.hasPrev && this.hasNext ? (window.history.replaceState(O, ""), window.history.pushState(t, "", s), window.history.pushState(U, ""), await C(-1)) : this.hasPrev ? (window.history.replaceState(O, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(U, ""), await C(-1)) : (window.history.replaceState(ot, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
2909
+ await ze(), this.hasPrev && this.hasNext ? (window.history.replaceState(U, ""), window.history.pushState(t, "", s), window.history.pushState(O, ""), await C(-1)) : this.hasPrev ? (window.history.replaceState(U, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(O, ""), await C(-1)) : (window.history.replaceState(ot, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
2898
2910
  }
2899
2911
  /**
2900
2912
  * Current query parameters.
@@ -2921,7 +2933,7 @@ function Fe(e) {
2921
2933
  const r = e.base ? $t(e.base) : void 0;
2922
2934
  if (r) {
2923
2935
  if (!n.startsWith(r))
2924
- throw f(
2936
+ throw g(
2925
2937
  te,
2926
2938
  `Path "${n}" expected to be starting with "${r}"`
2927
2939
  );
@@ -2950,7 +2962,7 @@ function Je(e, t) {
2950
2962
  }
2951
2963
  return Fe(t);
2952
2964
  }
2953
- function Rs(e, t) {
2965
+ function Ts(e, t) {
2954
2966
  const s = Je(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2955
2967
  index: s.index,
2956
2968
  history: s.history
@@ -2960,7 +2972,7 @@ function Rs(e, t) {
2960
2972
  export {
2961
2973
  le as BackButton,
2962
2974
  je as BasicNavigator,
2963
- Pe as BiometryManager,
2975
+ xe as BiometryManager,
2964
2976
  Bt as BrowserNavigator,
2965
2977
  Se as ClosingBehavior,
2966
2978
  Ae as CloudStorage,
@@ -2976,31 +2988,31 @@ export {
2976
2988
  Yt as ERR_TIMED_OUT,
2977
2989
  Zt as ERR_UNEXPECTED_TYPE,
2978
2990
  Jt as ERR_UNKNOWN_ENV,
2979
- R as EventEmitter,
2991
+ T as EventEmitter,
2980
2992
  Ie as HapticFeedback,
2981
2993
  qe as InitData,
2982
2994
  ke as Invoice,
2983
2995
  Ne as MainButton,
2984
- Me as MiniApp,
2996
+ Le as MiniApp,
2985
2997
  $e as Popup,
2986
2998
  Be as QRScanner,
2987
2999
  D as SDKError,
2988
3000
  We as SettingsButton,
2989
- Oe as ThemeParams,
2990
- Ue as Utils,
3001
+ Ue as ThemeParams,
3002
+ Oe as Utils,
2991
3003
  He as Viewport,
2992
- Te as array,
2993
- bs as bindMiniAppCSSVars,
3004
+ Re as array,
3005
+ ws as bindMiniAppCSSVars,
2994
3006
  ms as bindThemeParamsCSSVars,
2995
3007
  ys as bindViewportCSSVars,
2996
- b as boolean,
2997
- bt as captureSameReq,
3008
+ w as boolean,
3009
+ wt as captureSameReq,
2998
3010
  z as classNames,
2999
3011
  ce as compareVersions,
3000
3012
  Fe as createBrowserNavigatorFromLocation,
3001
3013
  pe as createPostEvent,
3002
3014
  k as createSafeURL,
3003
- Pt as date,
3015
+ xt as date,
3004
3016
  Cs as getHash,
3005
3017
  $t as getPathname,
3006
3018
  es as initBackButton,
@@ -3012,13 +3024,13 @@ export {
3012
3024
  cs as initInvoice,
3013
3025
  hs as initMainButton,
3014
3026
  ps as initMiniApp,
3015
- Rs as initNavigator,
3027
+ Ts as initNavigator,
3016
3028
  us as initPopup,
3017
3029
  ls as initQRScanner,
3018
3030
  ds as initSettingsButton,
3019
3031
  _s as initThemeParams,
3020
3032
  gs as initUtils,
3021
- ws as initViewport,
3033
+ bs as initViewport,
3022
3034
  vs as initWeb,
3023
3035
  S as invokeCustomMethod,
3024
3036
  vt as isColorDark,
@@ -3029,21 +3041,21 @@ export {
3029
3041
  Ge as isSDKError,
3030
3042
  Ss as isSDKErrorOfType,
3031
3043
  Es as isSSR,
3032
- Ps as isTMA,
3044
+ xs as isTMA,
3033
3045
  d as json,
3034
3046
  ts as mergeClassNames,
3035
- xs as mockTelegramEnv,
3047
+ Ps as mockTelegramEnv,
3036
3048
  y as number,
3037
- L as off,
3038
- w as on,
3049
+ V as off,
3050
+ b as on,
3039
3051
  as as parseInitData,
3040
3052
  tt as parseLaunchParams,
3041
- Mt as parseThemeParams,
3042
- T as postEvent,
3053
+ Lt as parseThemeParams,
3054
+ R as postEvent,
3043
3055
  _ as request,
3044
- xe as requestBiometryInfo,
3056
+ Pe as requestBiometryInfo,
3045
3057
  fs as requestThemeParams,
3046
- Lt as requestViewport,
3058
+ Vt as requestViewport,
3047
3059
  ye as retrieveLaunchParams,
3048
3060
  lt as rgb,
3049
3061
  X as searchParams,