@tma.js/sdk 2.5.0 → 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), 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
  }
@@ -2215,17 +2227,18 @@ class Ue extends st {
2215
2227
  * @param url - URL to share.
2216
2228
  * @param text - text to append after the URL.
2217
2229
  * @see https://core.telegram.org/api/links#share-links
2230
+ * @see https://core.telegram.org/widgets/share#custom-buttons
2218
2231
  */
2219
2232
  shareURL(s, n) {
2220
2233
  this.openTelegramLink(
2221
- "https://t.me/share?" + new URLSearchParams({ url: s, text: n || "" }).toString()
2234
+ "https://t.me/share/url?" + new URLSearchParams({ url: s, text: n || "" }).toString()
2222
2235
  );
2223
2236
  }
2224
2237
  }
2225
2238
  const gs = l(
2226
- ({ version: e, postEvent: t, createRequestId: s }) => new Ue(e, s, t)
2239
+ ({ version: e, postEvent: t, createRequestId: s }) => new Oe(e, s, t)
2227
2240
  );
2228
- async function Lt(e = {}) {
2241
+ async function Vt(e = {}) {
2229
2242
  const {
2230
2243
  is_expanded: t,
2231
2244
  is_state_stable: s,
@@ -2237,16 +2250,16 @@ async function Lt(e = {}) {
2237
2250
  });
2238
2251
  return { ...n, isExpanded: t, isStateStable: s };
2239
2252
  }
2240
- function x(e) {
2253
+ function P(e) {
2241
2254
  return e < 0 ? 0 : e;
2242
2255
  }
2243
2256
  class He extends et {
2244
2257
  constructor({ postEvent: s, stableHeight: n, height: r, width: i, isExpanded: o }) {
2245
2258
  super({
2246
- height: x(r),
2259
+ height: P(r),
2247
2260
  isExpanded: o,
2248
- stableHeight: x(n),
2249
- width: x(i)
2261
+ stableHeight: P(n),
2262
+ width: P(i)
2250
2263
  });
2251
2264
  c(this, "postEvent");
2252
2265
  this.postEvent = s;
@@ -2257,7 +2270,7 @@ class He extends et {
2257
2270
  * @param options - options to request fresh data.
2258
2271
  */
2259
2272
  async sync(s) {
2260
- const { isStateStable: n, ...r } = await Lt(s);
2273
+ const { isStateStable: n, ...r } = await Vt(s);
2261
2274
  this.set({
2262
2275
  ...r,
2263
2276
  stableHeight: n ? r.height : this.get("stableHeight")
@@ -2304,17 +2317,17 @@ class He extends et {
2304
2317
  * @returns Function to stop listening.
2305
2318
  */
2306
2319
  listen() {
2307
- return w("viewport_changed", (s) => {
2320
+ return b("viewport_changed", (s) => {
2308
2321
  const {
2309
2322
  height: n,
2310
2323
  width: r,
2311
2324
  is_expanded: i,
2312
2325
  is_state_stable: o
2313
- } = s, a = x(n);
2326
+ } = s, a = P(n);
2314
2327
  this.set({
2315
2328
  height: a,
2316
2329
  isExpanded: i,
2317
- width: x(r),
2330
+ width: P(r),
2318
2331
  ...o ? { stableHeight: a } : {}
2319
2332
  });
2320
2333
  });
@@ -2349,7 +2362,7 @@ class He extends et {
2349
2362
  return this.stableHeight === this.height;
2350
2363
  }
2351
2364
  }
2352
- const ws = l(
2365
+ const bs = l(
2353
2366
  "viewport",
2354
2367
  async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
2355
2368
  let r = !1, i = 0, o = 0, a = 0;
@@ -2358,7 +2371,7 @@ const ws = l(
2358
2371
  else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
2359
2372
  r = !0, i = window.innerHeight, o = window.innerWidth, a = window.innerHeight;
2360
2373
  else {
2361
- const u = await Lt({ timeout: 1e3, postEvent: s });
2374
+ const u = await Vt({ timeout: 1e3, postEvent: s });
2362
2375
  r = u.isExpanded, i = u.height, o = u.width, a = u.isStateStable ? i : 0;
2363
2376
  }
2364
2377
  const p = new He({
@@ -2374,7 +2387,7 @@ const ws = l(
2374
2387
  function m(e, t) {
2375
2388
  document.documentElement.style.setProperty(e, t);
2376
2389
  }
2377
- function bs(e, t, s) {
2390
+ function ws(e, t, s) {
2378
2391
  s || (s = (a) => `--tg-${a}-color`);
2379
2392
  const n = s("header"), r = s("bg"), i = () => {
2380
2393
  const { headerColor: a } = e;
@@ -2415,25 +2428,25 @@ function ys(e, t) {
2415
2428
  }
2416
2429
  function vs(e = !0) {
2417
2430
  const t = [
2418
- w("reload_iframe", () => {
2419
- T("iframe_will_reload"), window.location.reload();
2431
+ b("reload_iframe", () => {
2432
+ R("iframe_will_reload"), window.location.reload();
2420
2433
  })
2421
2434
  ], s = () => t.forEach((n) => n());
2422
2435
  if (e) {
2423
2436
  const n = document.createElement("style");
2424
2437
  n.id = "telegram-custom-styles", document.head.appendChild(n), t.push(
2425
- w("set_custom_style", (r) => {
2438
+ b("set_custom_style", (r) => {
2426
2439
  n.innerHTML = r;
2427
2440
  }),
2428
2441
  () => document.head.removeChild(n)
2429
2442
  );
2430
2443
  }
2431
- return T("iframe_ready", { reload_supported: !0 }), s;
2444
+ return R("iframe_ready", { reload_supported: !0 }), s;
2432
2445
  }
2433
2446
  function Es() {
2434
2447
  return typeof window > "u";
2435
2448
  }
2436
- async function Ps() {
2449
+ async function xs() {
2437
2450
  if (ft(window))
2438
2451
  return !0;
2439
2452
  try {
@@ -2442,7 +2455,7 @@ async function Ps() {
2442
2455
  return !1;
2443
2456
  }
2444
2457
  }
2445
- function xs(e) {
2458
+ function Ps(e) {
2446
2459
  const t = typeof e == "string" ? tt(e) : e;
2447
2460
  kt(t);
2448
2461
  function s(r) {
@@ -2497,12 +2510,12 @@ function $(e, t) {
2497
2510
  });
2498
2511
  }
2499
2512
  class je {
2500
- constructor(t, s, n = T) {
2513
+ constructor(t, s, n = R) {
2501
2514
  /**
2502
2515
  * Navigation history.
2503
2516
  */
2504
2517
  c(this, "history");
2505
- c(this, "ee", new R());
2518
+ c(this, "ee", new T());
2506
2519
  /**
2507
2520
  * True, if current navigator is currently attached.
2508
2521
  */
@@ -2520,9 +2533,9 @@ class je {
2520
2533
  */
2521
2534
  c(this, "off", this.ee.off.bind(this.ee));
2522
2535
  if (this._index = s, this.postEvent = n, t.length === 0)
2523
- throw f(Kt, "History should not be empty.");
2536
+ throw g(Kt, "History should not be empty.");
2524
2537
  if (s < 0 || s >= t.length)
2525
- throw f(
2538
+ throw g(
2526
2539
  Xt,
2527
2540
  "Index should not be zero and higher or equal than history size."
2528
2541
  );
@@ -2533,7 +2546,7 @@ class je {
2533
2546
  * `BackButton` clicks and calls the `back` method.
2534
2547
  */
2535
2548
  attach() {
2536
- 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));
2537
2550
  }
2538
2551
  /**
2539
2552
  * Currently active history item.
@@ -2545,7 +2558,7 @@ class je {
2545
2558
  * Prevents current navigator from controlling the BackButton visibility state.
2546
2559
  */
2547
2560
  detach() {
2548
- this.attached = !1, L("back_button_pressed", this.back);
2561
+ this.attached = !1, V("back_button_pressed", this.back);
2549
2562
  }
2550
2563
  /**
2551
2564
  * Goes to the next history item.
@@ -2687,11 +2700,11 @@ async function ze() {
2687
2700
  function $t(e) {
2688
2701
  return k(e).pathname;
2689
2702
  }
2690
- const ot = 0, O = 1, U = 2;
2703
+ const ot = 0, U = 1, O = 2;
2691
2704
  class Bt {
2692
2705
  constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
2693
2706
  c(this, "navigator");
2694
- c(this, "ee", new R());
2707
+ c(this, "ee", new T());
2695
2708
  c(this, "hashMode");
2696
2709
  c(this, "base");
2697
2710
  /**
@@ -2705,7 +2718,7 @@ class Bt {
2705
2718
  c(this, "onPopState", ({ state: t }) => {
2706
2719
  if (t === null)
2707
2720
  return this.push(this.parsePath(window.location.href));
2708
- 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();
2709
2722
  });
2710
2723
  /**
2711
2724
  * Underlying navigator change event listener.
@@ -2893,7 +2906,7 @@ class Bt {
2893
2906
  async syncHistory() {
2894
2907
  window.removeEventListener("popstate", this.onPopState);
2895
2908
  const { state: t } = this, s = this.renderPath(this);
2896
- 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);
2897
2910
  }
2898
2911
  /**
2899
2912
  * Current query parameters.
@@ -2920,7 +2933,7 @@ function Fe(e) {
2920
2933
  const r = e.base ? $t(e.base) : void 0;
2921
2934
  if (r) {
2922
2935
  if (!n.startsWith(r))
2923
- throw f(
2936
+ throw g(
2924
2937
  te,
2925
2938
  `Path "${n}" expected to be starting with "${r}"`
2926
2939
  );
@@ -2949,7 +2962,7 @@ function Je(e, t) {
2949
2962
  }
2950
2963
  return Fe(t);
2951
2964
  }
2952
- function Rs(e, t) {
2965
+ function Ts(e, t) {
2953
2966
  const s = Je(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2954
2967
  index: s.index,
2955
2968
  history: s.history
@@ -2959,7 +2972,7 @@ function Rs(e, t) {
2959
2972
  export {
2960
2973
  le as BackButton,
2961
2974
  je as BasicNavigator,
2962
- Pe as BiometryManager,
2975
+ xe as BiometryManager,
2963
2976
  Bt as BrowserNavigator,
2964
2977
  Se as ClosingBehavior,
2965
2978
  Ae as CloudStorage,
@@ -2975,31 +2988,31 @@ export {
2975
2988
  Yt as ERR_TIMED_OUT,
2976
2989
  Zt as ERR_UNEXPECTED_TYPE,
2977
2990
  Jt as ERR_UNKNOWN_ENV,
2978
- R as EventEmitter,
2991
+ T as EventEmitter,
2979
2992
  Ie as HapticFeedback,
2980
2993
  qe as InitData,
2981
2994
  ke as Invoice,
2982
2995
  Ne as MainButton,
2983
- Me as MiniApp,
2996
+ Le as MiniApp,
2984
2997
  $e as Popup,
2985
2998
  Be as QRScanner,
2986
2999
  D as SDKError,
2987
3000
  We as SettingsButton,
2988
- Oe as ThemeParams,
2989
- Ue as Utils,
3001
+ Ue as ThemeParams,
3002
+ Oe as Utils,
2990
3003
  He as Viewport,
2991
- Te as array,
2992
- bs as bindMiniAppCSSVars,
3004
+ Re as array,
3005
+ ws as bindMiniAppCSSVars,
2993
3006
  ms as bindThemeParamsCSSVars,
2994
3007
  ys as bindViewportCSSVars,
2995
- b as boolean,
2996
- bt as captureSameReq,
3008
+ w as boolean,
3009
+ wt as captureSameReq,
2997
3010
  z as classNames,
2998
3011
  ce as compareVersions,
2999
3012
  Fe as createBrowserNavigatorFromLocation,
3000
3013
  pe as createPostEvent,
3001
3014
  k as createSafeURL,
3002
- Pt as date,
3015
+ xt as date,
3003
3016
  Cs as getHash,
3004
3017
  $t as getPathname,
3005
3018
  es as initBackButton,
@@ -3011,13 +3024,13 @@ export {
3011
3024
  cs as initInvoice,
3012
3025
  hs as initMainButton,
3013
3026
  ps as initMiniApp,
3014
- Rs as initNavigator,
3027
+ Ts as initNavigator,
3015
3028
  us as initPopup,
3016
3029
  ls as initQRScanner,
3017
3030
  ds as initSettingsButton,
3018
3031
  _s as initThemeParams,
3019
3032
  gs as initUtils,
3020
- ws as initViewport,
3033
+ bs as initViewport,
3021
3034
  vs as initWeb,
3022
3035
  S as invokeCustomMethod,
3023
3036
  vt as isColorDark,
@@ -3028,21 +3041,21 @@ export {
3028
3041
  Ge as isSDKError,
3029
3042
  Ss as isSDKErrorOfType,
3030
3043
  Es as isSSR,
3031
- Ps as isTMA,
3044
+ xs as isTMA,
3032
3045
  d as json,
3033
3046
  ts as mergeClassNames,
3034
- xs as mockTelegramEnv,
3047
+ Ps as mockTelegramEnv,
3035
3048
  y as number,
3036
- L as off,
3037
- w as on,
3049
+ V as off,
3050
+ b as on,
3038
3051
  as as parseInitData,
3039
3052
  tt as parseLaunchParams,
3040
- Mt as parseThemeParams,
3041
- T as postEvent,
3053
+ Lt as parseThemeParams,
3054
+ R as postEvent,
3042
3055
  _ as request,
3043
- xe as requestBiometryInfo,
3056
+ Pe as requestBiometryInfo,
3044
3057
  fs as requestThemeParams,
3045
- Lt as requestViewport,
3058
+ Vt as requestViewport,
3046
3059
  ye as retrieveLaunchParams,
3047
3060
  lt as rgb,
3048
3061
  X as searchParams,