@tma.js/sdk 1.4.9 → 1.5.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.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  var Re = Object.defineProperty;
2
2
  var Ie = (r, e, t) => e in r ? Re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var o = (r, e, t) => (Ie(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- class ue {
4
+ class he {
5
5
  constructor(e, t) {
6
6
  this.prefix = e, this.enabled = t;
7
7
  }
@@ -56,53 +56,53 @@ class ue {
56
56
  this.print("warn", ...e);
57
57
  }
58
58
  }
59
- let pe = "https://web.telegram.org";
60
- const q = new ue("[SDK]", !1);
61
- function Zt(r) {
59
+ let ue = "https://web.telegram.org";
60
+ const k = new he("[SDK]", !1);
61
+ function Qt(r) {
62
62
  if (r) {
63
- q.enable();
63
+ k.enable();
64
64
  return;
65
65
  }
66
- q.disable();
66
+ k.disable();
67
67
  }
68
- function Kt(r) {
69
- pe = r;
68
+ function Zt(r) {
69
+ ue = r;
70
70
  }
71
- function Le() {
72
- return pe;
71
+ function Te() {
72
+ return ue;
73
73
  }
74
- function le() {
74
+ function pe() {
75
75
  try {
76
76
  return window.self !== window.top;
77
77
  } catch {
78
78
  return !0;
79
79
  }
80
80
  }
81
- function R(r) {
81
+ function M(r) {
82
82
  return typeof r == "object" && r !== null && !Array.isArray(r);
83
83
  }
84
- function Te(r) {
85
- return "external" in r && R(r.external) && "notify" in r.external && typeof r.external.notify == "function";
86
- }
87
84
  function $e(r) {
88
- return "TelegramWebviewProxy" in r && R(r.TelegramWebviewProxy) && "postEvent" in r.TelegramWebviewProxy && typeof r.TelegramWebviewProxy.postEvent == "function";
85
+ return "external" in r && M(r.external) && "notify" in r.external && typeof r.external.notify == "function";
86
+ }
87
+ function Le(r) {
88
+ return "TelegramWebviewProxy" in r && M(r.TelegramWebviewProxy) && "postEvent" in r.TelegramWebviewProxy && typeof r.TelegramWebviewProxy.postEvent == "function";
89
89
  }
90
90
  function d(r, e, t) {
91
91
  let s = {}, n;
92
92
  e === void 0 && t === void 0 ? s = {} : e !== void 0 && t !== void 0 ? (s = t, n = e) : e !== void 0 && ("targetOrigin" in e ? s = e : n = e);
93
- const { targetOrigin: i = Le() } = s;
94
- if (q.log(`Calling method "${r}"`, n), le()) {
93
+ const { targetOrigin: i = Te() } = s;
94
+ if (k.log(`Calling method "${r}"`, n), pe()) {
95
95
  window.parent.postMessage(JSON.stringify({
96
96
  eventType: r,
97
97
  eventData: n
98
98
  }), i);
99
99
  return;
100
100
  }
101
- if (Te(window)) {
101
+ if ($e(window)) {
102
102
  window.external.notify(JSON.stringify({ eventType: r, eventData: n }));
103
103
  return;
104
104
  }
105
- if ($e(window)) {
105
+ if (Le(window)) {
106
106
  window.TelegramWebviewProxy.postEvent(r, JSON.stringify(n));
107
107
  return;
108
108
  }
@@ -119,15 +119,15 @@ function Be(r, e) {
119
119
  }
120
120
  return 0;
121
121
  }
122
- function P(r, e) {
122
+ function v(r, e) {
123
123
  return Be(r, e) <= 0;
124
124
  }
125
- function I(r, e, t) {
125
+ function A(r, e, t) {
126
126
  if (typeof t == "string") {
127
127
  if (r === "web_app_open_link" && e === "try_instant_view")
128
- return P("6.4", t);
128
+ return v("6.4", t);
129
129
  if (r === "web_app_set_header_color" && e === "color")
130
- return P("6.9", t);
130
+ return v("6.9", t);
131
131
  }
132
132
  switch (r) {
133
133
  case "web_app_open_tg_link":
@@ -136,60 +136,63 @@ function I(r, e, t) {
136
136
  case "web_app_set_background_color":
137
137
  case "web_app_set_header_color":
138
138
  case "web_app_trigger_haptic_feedback":
139
- return P("6.1", e);
139
+ return v("6.1", e);
140
140
  case "web_app_open_popup":
141
- return P("6.2", e);
141
+ return v("6.2", e);
142
142
  case "web_app_close_scan_qr_popup":
143
143
  case "web_app_open_scan_qr_popup":
144
144
  case "web_app_read_text_from_clipboard":
145
- return P("6.4", e);
145
+ return v("6.4", e);
146
146
  case "web_app_switch_inline_query":
147
- return P("6.7", e);
147
+ return v("6.7", e);
148
148
  case "web_app_invoke_custom_method":
149
149
  case "web_app_request_write_access":
150
150
  case "web_app_request_phone":
151
- return P("6.9", e);
151
+ return v("6.9", e);
152
152
  case "web_app_setup_settings_button":
153
- return P("6.10", e);
153
+ return v("6.10", e);
154
154
  default:
155
155
  return !0;
156
156
  }
157
157
  }
158
- class Y extends Error {
158
+ class Z extends Error {
159
159
  constructor(e, t) {
160
- super(`Method "${e}" is unsupported in the Mini Apps version ${t}.`), Object.setPrototypeOf(this, Y.prototype);
160
+ super(`Method "${e}" is unsupported in the Mini Apps version ${t}.`), Object.setPrototypeOf(this, Z.prototype);
161
161
  }
162
162
  }
163
- class X extends Error {
163
+ class K extends Error {
164
164
  constructor(e, t, s) {
165
- super(`Parameter "${t}" in method "${e}" is unsupported in the Mini Apps version ${s}.`), Object.setPrototypeOf(this, X.prototype);
165
+ super(`Parameter "${t}" in method "${e}" is unsupported in the Mini Apps version ${s}.`), Object.setPrototypeOf(this, K.prototype);
166
166
  }
167
167
  }
168
- function De(r) {
168
+ function Oe(r) {
169
169
  return (e, t) => {
170
- if (!I(e, r))
171
- throw new Y(e, r);
172
- if (R(t)) {
170
+ if (!A(e, r))
171
+ throw new Z(e, r);
172
+ if (M(t)) {
173
173
  let s;
174
- if (e === "web_app_open_link" && "try_instant_view" in t ? s = "try_instant_view" : e === "web_app_set_header_color" && "color" in t && (s = "color"), s && !I(e, s, r))
175
- throw new X(e, s, r);
174
+ if (e === "web_app_open_link" && "try_instant_view" in t ? s = "try_instant_view" : e === "web_app_set_header_color" && "color" in t && (s = "color"), s && !A(e, s, r))
175
+ throw new K(e, s, r);
176
176
  }
177
177
  return d(e, t);
178
178
  };
179
179
  }
180
- class F extends Error {
180
+ function le(r) {
181
+ return ({ req_id: e }) => e === r;
182
+ }
183
+ class G extends Error {
181
184
  constructor(t, { cause: s, type: n } = {}) {
182
185
  super(`Unable to parse value${n ? ` as ${n}` : ""}`, { cause: s });
183
186
  /**
184
187
  * Parser name.
185
188
  */
186
189
  o(this, "type");
187
- this.value = t, Object.setPrototypeOf(this, F.prototype), this.type = n;
190
+ this.value = t, Object.setPrototypeOf(this, G.prototype), this.type = n;
188
191
  }
189
192
  }
190
- class j extends Error {
193
+ class U extends Error {
191
194
  constructor(e, { cause: t, type: s } = {}) {
192
- super(`Unable to parse field "${e}"${s ? ` as ${s}` : ""}`, { cause: t }), Object.setPrototypeOf(this, j.prototype);
195
+ super(`Unable to parse field "${e}"${s ? ` as ${s}` : ""}`, { cause: t }), Object.setPrototypeOf(this, U.prototype);
193
196
  }
194
197
  }
195
198
  function de(r, e) {
@@ -210,25 +213,25 @@ function de(r, e) {
210
213
  try {
211
214
  c = a(u);
212
215
  } catch (p) {
213
- throw p instanceof F ? new j(i, {
216
+ throw p instanceof G ? new U(i, {
214
217
  type: p.type,
215
218
  cause: p
216
- }) : new j(i, { cause: p });
219
+ }) : new U(i, { cause: p });
217
220
  }
218
221
  c !== void 0 && (t[s] = c);
219
222
  }
220
223
  return t;
221
224
  }
222
- function L() {
225
+ function V() {
223
226
  return new TypeError("Value has unexpected type");
224
227
  }
225
- function ee(r) {
228
+ function Y(r) {
226
229
  let e = r;
227
230
  if (typeof e == "string" && (e = JSON.parse(e)), typeof e != "object" || e === null || Array.isArray(e))
228
- throw L();
231
+ throw V();
229
232
  return e;
230
233
  }
231
- class z {
234
+ class j {
232
235
  constructor(e, t, s) {
233
236
  this.parser = e, this.isOptional = t, this.type = s;
234
237
  }
@@ -237,7 +240,7 @@ class z {
237
240
  try {
238
241
  return this.parser(e);
239
242
  } catch (t) {
240
- throw new F(e, { type: this.type, cause: t });
243
+ throw new G(e, { type: this.type, cause: t });
241
244
  }
242
245
  }
243
246
  optional() {
@@ -245,33 +248,33 @@ class z {
245
248
  }
246
249
  }
247
250
  function f(r, e) {
248
- return new z((t) => {
249
- const s = ee(t);
251
+ return new j((t) => {
252
+ const s = Y(t);
250
253
  return de(r, (n) => s[n]);
251
254
  }, !1, e);
252
255
  }
253
- function T(r, e) {
254
- return () => new z(r, !1, e);
256
+ function R(r, e) {
257
+ return () => new j(r, !1, e);
255
258
  }
256
- const h = T((r) => {
259
+ const h = R((r) => {
257
260
  if (typeof r == "string" || typeof r == "number")
258
261
  return r.toString();
259
- throw L();
260
- }, "string"), We = f({
261
- eventType: h(),
262
- eventData: (r) => r
263
- });
264
- function Oe(r) {
265
- return We.parse(r);
262
+ throw V();
263
+ }, "string");
264
+ function De(r) {
265
+ return f({
266
+ eventType: h(),
267
+ eventData: (e) => e
268
+ }).parse(r);
266
269
  }
267
- function He(r, e) {
270
+ function We(r, e) {
268
271
  window.dispatchEvent(new MessageEvent("message", {
269
272
  data: JSON.stringify({ eventType: r, eventData: e }),
270
273
  // We specify window.parent to imitate the case, it sent us this event.
271
274
  source: window.parent
272
275
  }));
273
276
  }
274
- function Ne() {
277
+ function He() {
275
278
  const r = window;
276
279
  "TelegramGameProxy_receiveEvent" in r || [
277
280
  ["TelegramGameProxy_receiveEvent"],
@@ -284,66 +287,66 @@ function Ne() {
284
287
  let t = r;
285
288
  e.forEach((s, n, i) => {
286
289
  if (n === i.length - 1) {
287
- t[s] = He;
290
+ t[s] = We;
288
291
  return;
289
292
  }
290
293
  s in t || (t[s] = {}), t = t[s];
291
294
  });
292
295
  });
293
296
  }
294
- function Ue(r) {
295
- Ne(), window.addEventListener("message", (e) => {
297
+ function Ne(r) {
298
+ He(), window.addEventListener("message", (e) => {
296
299
  if (e.source === window.parent)
297
300
  try {
298
- const { eventType: t, eventData: s } = Oe(e.data);
301
+ const { eventType: t, eventData: s } = De(e.data);
299
302
  r(t, s);
300
303
  } catch {
301
304
  }
302
305
  });
303
306
  }
304
- function Me() {
307
+ function Ue() {
305
308
  return f({
306
309
  req_id: h(),
307
310
  data: (r) => r === null ? r : h().optional().parse(r)
308
311
  });
309
312
  }
310
- function Ge() {
313
+ function Me() {
311
314
  return f({
312
315
  req_id: h(),
313
316
  result: (r) => r,
314
317
  error: h().optional()
315
318
  });
316
319
  }
317
- function je() {
320
+ function Ge() {
318
321
  return f({
319
322
  slug: h(),
320
323
  status: h()
321
324
  });
322
325
  }
323
- function Fe() {
326
+ function je() {
324
327
  return f({ status: h() });
325
328
  }
326
- function ze() {
329
+ function Fe() {
327
330
  return f({
328
331
  button_id: (r) => r == null ? void 0 : h().parse(r)
329
332
  });
330
333
  }
331
- function Je() {
334
+ function ze() {
332
335
  return f({
333
336
  data: h().optional()
334
337
  });
335
338
  }
336
- function te(r) {
339
+ function X(r) {
337
340
  return /^#[\da-f]{6}$/i.test(r);
338
341
  }
339
- function Qe(r) {
342
+ function Je(r) {
340
343
  return /^#[\da-f]{3}$/i.test(r);
341
344
  }
342
345
  function fe(r) {
343
346
  const e = r.replace(/\s/g, "").toLowerCase();
344
- if (te(e))
347
+ if (X(e))
345
348
  return e;
346
- if (Qe(e)) {
349
+ if (Je(e)) {
347
350
  let s = "#";
348
351
  for (let n = 0; n < 3; n += 1)
349
352
  s += e[1 + n].repeat(2);
@@ -357,16 +360,16 @@ function fe(r) {
357
360
  return s + (i.length === 1 ? "0" : "") + i;
358
361
  }, "#");
359
362
  }
360
- const ge = T((r) => fe(h().parse(r)), "rgb");
361
- function Ze() {
363
+ const ge = R((r) => fe(h().parse(r)), "rgb");
364
+ function Qe() {
362
365
  return f({
363
366
  theme_params: (r) => {
364
367
  const e = ge().optional();
365
- return Object.entries(ee(r)).reduce((t, [s, n]) => (t[s] = e.parse(n), t), {});
368
+ return Object.entries(Y(r)).reduce((t, [s, n]) => (t[s] = e.parse(n), t), {});
366
369
  }
367
370
  });
368
371
  }
369
- const k = T((r) => {
372
+ const P = R((r) => {
370
373
  if (typeof r == "boolean")
371
374
  return r;
372
375
  const e = String(r);
@@ -374,8 +377,8 @@ const k = T((r) => {
374
377
  return !0;
375
378
  if (e === "0" || e === "false")
376
379
  return !1;
377
- throw L();
378
- }, "boolean"), A = T((r) => {
380
+ throw V();
381
+ }, "boolean"), x = R((r) => {
379
382
  if (typeof r == "number")
380
383
  return r;
381
384
  if (typeof r == "string") {
@@ -383,17 +386,17 @@ const k = T((r) => {
383
386
  if (!Number.isNaN(e))
384
387
  return e;
385
388
  }
386
- throw L();
389
+ throw V();
387
390
  }, "number");
388
- function Ke() {
391
+ function Ze() {
389
392
  return f({
390
- height: A(),
391
- width: (r) => r == null ? window.innerWidth : A().parse(r),
392
- is_state_stable: k(),
393
- is_expanded: k()
393
+ height: x(),
394
+ width: (r) => r == null ? window.innerWidth : x().parse(r),
395
+ is_state_stable: P(),
396
+ is_expanded: P()
394
397
  });
395
398
  }
396
- function Ye() {
399
+ function Ke() {
397
400
  return f({ status: h() });
398
401
  }
399
402
  class w {
@@ -478,9 +481,9 @@ class w {
478
481
  }
479
482
  }
480
483
  }
481
- function Xe() {
484
+ function Ye() {
482
485
  const r = new w(), e = (t, ...s) => {
483
- q.log("Emitting processed event:", t, ...s), r.emit(t, ...s);
486
+ k.log("Emitting processed event:", t, ...s), r.emit(t, ...s);
484
487
  };
485
488
  return window.addEventListener("resize", () => {
486
489
  e("viewport_changed", {
@@ -489,33 +492,33 @@ function Xe() {
489
492
  is_state_stable: !0,
490
493
  is_expanded: !0
491
494
  });
492
- }), Ue((t, s) => {
493
- q.log("Received raw event:", t, s);
495
+ }), Ne((t, s) => {
496
+ k.log("Received raw event:", t, s);
494
497
  try {
495
498
  switch (t) {
496
499
  case "viewport_changed":
497
- return e(t, Ke().parse(s));
498
- case "theme_changed":
499
500
  return e(t, Ze().parse(s));
501
+ case "theme_changed":
502
+ return e(t, Qe().parse(s));
500
503
  case "popup_closed":
501
504
  return (
502
505
  // Sent on desktop.
503
- s == null ? e(t, {}) : e(t, ze().parse(s))
506
+ s == null ? e(t, {}) : e(t, Fe().parse(s))
504
507
  );
505
508
  case "set_custom_style":
506
509
  return e(t, h().parse(s));
507
510
  case "qr_text_received":
508
- return e(t, Je().parse(s));
511
+ return e(t, ze().parse(s));
509
512
  case "clipboard_text_received":
510
- return e(t, Me().parse(s));
513
+ return e(t, Ue().parse(s));
511
514
  case "invoice_closed":
512
- return e(t, je().parse(s));
515
+ return e(t, Ge().parse(s));
513
516
  case "phone_requested":
514
- return e("phone_requested", Fe().parse(s));
517
+ return e("phone_requested", je().parse(s));
515
518
  case "custom_method_invoked":
516
- return e("custom_method_invoked", Ge().parse(s));
519
+ return e("custom_method_invoked", Me().parse(s));
517
520
  case "write_access_requested":
518
- return e("write_access_requested", Ye().parse(s));
521
+ return e("write_access_requested", Ke().parse(s));
519
522
  case "main_button_pressed":
520
523
  case "back_button_pressed":
521
524
  case "settings_button_pressed":
@@ -526,88 +529,98 @@ function Xe() {
526
529
  return e(t, s);
527
530
  }
528
531
  } catch (n) {
529
- q.error("Error processing event:", n);
532
+ k.error("Error processing event:", n);
530
533
  }
531
534
  }), r;
532
535
  }
533
- const Q = "telegram-mini-apps-cached-emitter";
534
- function U() {
536
+ const z = "telegram-mini-apps-cached-emitter";
537
+ function W() {
535
538
  const r = window;
536
- return r[Q] === void 0 && (r[Q] = Xe()), r[Q];
539
+ return r[z] === void 0 && (r[z] = Ye()), r[z];
537
540
  }
538
- function $(r, e) {
539
- U().off(r, e);
541
+ function I(r, e) {
542
+ W().off(r, e);
540
543
  }
541
- function y(r, e) {
542
- return U().on(r, e), () => $(r, e);
544
+ function E(r, e) {
545
+ return W().on(r, e), () => I(r, e);
543
546
  }
544
- class J extends Error {
547
+ class F extends Error {
545
548
  constructor(e) {
546
- super(`Async call timeout exceeded. Timeout: ${e}`), Object.setPrototypeOf(this, J.prototype);
549
+ super(`Async call timeout exceeded. Timeout: ${e}`), Object.setPrototypeOf(this, F.prototype);
547
550
  }
548
551
  }
549
- function et(r) {
552
+ function Xe(r) {
550
553
  return new Promise((e, t) => {
551
- setTimeout(t, r, new J(r));
554
+ setTimeout(t, r, new F(r));
552
555
  });
553
556
  }
554
557
  function we(r, e) {
555
558
  return Promise.race([
556
- r(),
557
- et(e)
559
+ typeof r == "function" ? r() : r,
560
+ Xe(e)
558
561
  ]);
559
562
  }
560
- function m(r, e, t, s) {
561
- let n, i, a, c;
562
- typeof e == "string" || Array.isArray(e) ? (a = Array.isArray(e) ? e : [e], n = t) : (i = e, a = Array.isArray(t) ? t : [t], n = s), R(i) && typeof i.req_id == "string" && (c = i.req_id);
563
- const { postEvent: u = d, timeout: p } = n || {}, g = n && "capture" in n ? n.capture : null, _ = () => new Promise((V, l) => {
564
- const C = a.map((v) => y(v, (M) => {
565
- c && (!R(M) || M.req_id !== c) || typeof g == "function" && !g(M) || (x(), V(M));
566
- })), x = () => C.forEach((v) => v());
567
- try {
568
- u(r, i);
569
- } catch (v) {
570
- x(), l(v);
571
- }
572
- });
573
- return typeof p == "number" ? we(_, p) : _();
563
+ async function y(r, e, t) {
564
+ let s;
565
+ const n = new Promise((b) => {
566
+ s = b;
567
+ }), i = e ? {
568
+ ...t,
569
+ event: e,
570
+ method: r
571
+ } : r, {
572
+ method: a,
573
+ event: c,
574
+ capture: u,
575
+ postEvent: p = d,
576
+ timeout: g
577
+ } = i, _ = (Array.isArray(c) ? c : [c]).map(
578
+ (b) => E(b, (l) => (!u || u(l)) && s(l))
579
+ );
580
+ try {
581
+ return p(a, i.params), await (g ? we(n, g) : n);
582
+ } finally {
583
+ _.forEach((b) => b());
584
+ }
574
585
  }
575
- async function H(r, e, t, s = {}) {
576
- const { result: n, error: i } = await m(
577
- "web_app_invoke_custom_method",
578
- {
586
+ async function O(r, e, t, s = {}) {
587
+ const {
588
+ result: n,
589
+ error: i
590
+ } = await y("web_app_invoke_custom_method", "custom_method_invoked", {
591
+ ...s,
592
+ params: {
579
593
  method: r,
580
594
  params: e,
581
595
  req_id: t
582
596
  },
583
- "custom_method_invoked",
584
- s
585
- );
597
+ capture: le(t)
598
+ });
586
599
  if (i)
587
600
  throw new Error(i);
588
601
  return n;
589
602
  }
590
- function Yt(r, e) {
591
- return U().once(r, e), () => $(r, e);
603
+ function Kt(r, e) {
604
+ return W().once(r, e), () => I(r, e);
592
605
  }
593
- function tt(r) {
594
- U().unsubscribe(r);
606
+ function et(r) {
607
+ W().unsubscribe(r);
595
608
  }
596
- function Xt(r) {
597
- return U().subscribe(r), () => tt(r);
609
+ function Yt(r) {
610
+ return W().subscribe(r), () => et(r);
598
611
  }
599
- function ne(r, e) {
612
+ function se(r, e) {
600
613
  return r + (r.length > 0 && e.length > 0 ? ` ${e}` : e);
601
614
  }
602
- function rt(...r) {
615
+ function tt(...r) {
603
616
  return r.reduce((e, t) => {
604
617
  let s = "";
605
- return typeof t == "string" ? s = t : typeof t == "object" && t !== null && (s = Object.entries(t).reduce((n, [i, a]) => a ? ne(n, i) : n, "")), ne(e, s);
618
+ return typeof t == "string" ? s = t : typeof t == "object" && t !== null && (s = Object.entries(t).reduce((n, [i, a]) => a ? se(n, i) : n, "")), se(e, s);
606
619
  }, "");
607
620
  }
608
- function er(...r) {
609
- return r.reduce((e, t) => (R(t) && Object.entries(t).forEach(([s, n]) => {
610
- const i = rt(e[s], n);
621
+ function Xt(...r) {
622
+ return r.reduce((e, t) => (M(t) && Object.entries(t).forEach(([s, n]) => {
623
+ const i = tt(e[s], n);
611
624
  i.length > 0 && (e[s] = i);
612
625
  }), e), {});
613
626
  }
@@ -620,7 +633,7 @@ function _e(r) {
620
633
  }, 0)
621
634
  ) < 120;
622
635
  }
623
- class b {
636
+ class m {
624
637
  constructor(e, t) {
625
638
  this.state = e, this.ee = t;
626
639
  }
@@ -650,6 +663,56 @@ class b {
650
663
  return this.state[e];
651
664
  }
652
665
  }
666
+ function C(r, e) {
667
+ return (t) => A(e[t], r);
668
+ }
669
+ class rt {
670
+ constructor(e, t, s = d) {
671
+ o(this, "ee", new w());
672
+ o(this, "state");
673
+ /**
674
+ * Adds event listener.
675
+ * @param event - event name.
676
+ * @param listener - event listener.
677
+ */
678
+ o(this, "on", (e, t) => e === "click" ? E("back_button_pressed", t) : this.ee.on(e, t));
679
+ /**
680
+ * Removes event listener.
681
+ * @param event - event name.
682
+ * @param listener - event listener.
683
+ */
684
+ o(this, "off", (e, t) => e === "click" ? I("back_button_pressed", t) : this.ee.off(e, t));
685
+ /**
686
+ * Checks if specified method is supported by current component.
687
+ */
688
+ o(this, "supports");
689
+ this.postEvent = s, this.state = new m({ isVisible: e }, this.ee), this.supports = C(t, {
690
+ show: "web_app_setup_back_button",
691
+ hide: "web_app_setup_back_button"
692
+ });
693
+ }
694
+ set isVisible(e) {
695
+ this.state.set("isVisible", e), this.postEvent("web_app_setup_back_button", { is_visible: e });
696
+ }
697
+ /**
698
+ * True if BackButton is currently visible.
699
+ */
700
+ get isVisible() {
701
+ return this.state.get("isVisible");
702
+ }
703
+ /**
704
+ * Hides the BackButton.
705
+ */
706
+ hide() {
707
+ this.isVisible = !1;
708
+ }
709
+ /**
710
+ * Shows the BackButton.
711
+ */
712
+ show() {
713
+ this.isVisible = !0;
714
+ }
715
+ }
653
716
  class st {
654
717
  constructor(e, t = d) {
655
718
  o(this, "ee", new w());
@@ -662,7 +725,7 @@ class st {
662
725
  * Removes event listener.
663
726
  */
664
727
  o(this, "off", this.ee.off.bind(this.ee));
665
- this.postEvent = t, this.state = new b({ isConfirmationNeeded: e }, this.ee);
728
+ this.postEvent = t, this.state = new m({ isConfirmationNeeded: e }, this.ee);
666
729
  }
667
730
  set isConfirmationNeeded(e) {
668
731
  this.state.set("isConfirmationNeeded", e), this.postEvent("web_app_setup_closing_behavior", { need_confirmation: e });
@@ -699,9 +762,9 @@ function nt(r) {
699
762
  return e;
700
763
  } catch {
701
764
  }
702
- throw L();
765
+ throw V();
703
766
  }
704
- class it extends z {
767
+ class it extends j {
705
768
  constructor(t, s, n) {
706
769
  super(nt, s, n);
707
770
  o(this, "itemParser");
@@ -718,10 +781,7 @@ class it extends z {
718
781
  function ot(r) {
719
782
  return new it((e) => e, !1, r);
720
783
  }
721
- function E(r, e) {
722
- return (t) => I(e[t], r);
723
- }
724
- function ie(r, e) {
784
+ function ne(r, e) {
725
785
  return r.reduce((t, s) => (t[s] = e, t), {});
726
786
  }
727
787
  class at {
@@ -730,7 +790,7 @@ class at {
730
790
  * Checks if specified method is supported by current component.
731
791
  */
732
792
  o(this, "supports");
733
- this.createRequestId = t, this.postEvent = s, this.supports = E(e, {
793
+ this.createRequestId = t, this.postEvent = s, this.supports = C(e, {
734
794
  delete: "web_app_invoke_custom_method",
735
795
  get: "web_app_invoke_custom_method",
736
796
  getKeys: "web_app_invoke_custom_method",
@@ -744,7 +804,7 @@ class at {
744
804
  */
745
805
  async delete(e, t = {}) {
746
806
  const s = Array.isArray(e) ? e : [e];
747
- s.length !== 0 && await H(
807
+ s.length !== 0 && await O(
748
808
  "deleteStorageValues",
749
809
  { keys: s },
750
810
  this.createRequestId(),
@@ -756,7 +816,7 @@ class at {
756
816
  * @param options - request execution options.
757
817
  */
758
818
  async getKeys(e = {}) {
759
- const t = await H(
819
+ const t = await O(
760
820
  "getStorageKeys",
761
821
  {},
762
822
  this.createRequestId(),
@@ -767,10 +827,10 @@ class at {
767
827
  async get(e, t = {}) {
768
828
  const s = Array.isArray(e) ? e : [e];
769
829
  if (s.length === 0)
770
- return ie(s, "");
830
+ return ne(s, "");
771
831
  const n = f(
772
- ie(s, h())
773
- ), i = await H(
832
+ ne(s, h())
833
+ ), i = await O(
774
834
  "getStorageValues",
775
835
  { keys: s },
776
836
  this.createRequestId(),
@@ -785,7 +845,7 @@ class at {
785
845
  * @param options - request execution options.
786
846
  */
787
847
  async set(e, t, s = {}) {
788
- await H(
848
+ await O(
789
849
  "saveStorageValue",
790
850
  { key: e, value: t },
791
851
  this.createRequestId(),
@@ -799,7 +859,7 @@ class ct {
799
859
  * Checks if specified method is supported by current component.
800
860
  */
801
861
  o(this, "supports");
802
- this.postEvent = t, this.supports = E(e, {
862
+ this.postEvent = t, this.supports = C(e, {
803
863
  impactOccurred: "web_app_trigger_haptic_feedback",
804
864
  notificationOccurred: "web_app_trigger_haptic_feedback",
805
865
  selectionChanged: "web_app_trigger_haptic_feedback"
@@ -841,7 +901,7 @@ class ct {
841
901
  }
842
902
  function ht() {
843
903
  return f({
844
- id: A(),
904
+ id: x(),
845
905
  type: h(),
846
906
  title: h(),
847
907
  photoUrl: {
@@ -924,27 +984,27 @@ class ut {
924
984
  return this.initData.user;
925
985
  }
926
986
  }
927
- function oe() {
987
+ function ie() {
928
988
  return f({
929
989
  addedToAttachmentMenu: {
930
- type: k().optional(),
990
+ type: P().optional(),
931
991
  from: "added_to_attachment_menu"
932
992
  },
933
993
  allowsWriteToPm: {
934
- type: k().optional(),
994
+ type: P().optional(),
935
995
  from: "allows_write_to_pm"
936
996
  },
937
997
  firstName: {
938
998
  type: h(),
939
999
  from: "first_name"
940
1000
  },
941
- id: A(),
1001
+ id: x(),
942
1002
  isBot: {
943
- type: k().optional(),
1003
+ type: P().optional(),
944
1004
  from: "is_bot"
945
1005
  },
946
1006
  isPremium: {
947
- type: k().optional(),
1007
+ type: P().optional(),
948
1008
  from: "is_premium"
949
1009
  },
950
1010
  languageCode: {
@@ -962,11 +1022,11 @@ function oe() {
962
1022
  username: h().optional()
963
1023
  }, "User");
964
1024
  }
965
- const be = T((r) => r instanceof Date ? r : new Date(A().parse(r) * 1e3), "Date");
966
- function re(r, e) {
967
- return new z((t) => {
1025
+ const be = R((r) => r instanceof Date ? r : new Date(x().parse(r) * 1e3), "Date");
1026
+ function ee(r, e) {
1027
+ return new j((t) => {
968
1028
  if (typeof t != "string" && !(t instanceof URLSearchParams))
969
- throw L();
1029
+ throw V();
970
1030
  const s = typeof t == "string" ? new URLSearchParams(t) : t;
971
1031
  return de(r, (n) => {
972
1032
  const i = s.get(n);
@@ -975,13 +1035,13 @@ function re(r, e) {
975
1035
  }, !1, e);
976
1036
  }
977
1037
  function me() {
978
- return re({
1038
+ return ee({
979
1039
  authDate: {
980
1040
  type: be(),
981
1041
  from: "auth_date"
982
1042
  },
983
1043
  canSendAfter: {
984
- type: A().optional(),
1044
+ type: x().optional(),
985
1045
  from: "can_send_after"
986
1046
  },
987
1047
  chat: ht().optional(),
@@ -998,15 +1058,15 @@ function me() {
998
1058
  type: h().optional(),
999
1059
  from: "query_id"
1000
1060
  },
1001
- receiver: oe().optional(),
1061
+ receiver: ie().optional(),
1002
1062
  startParam: {
1003
1063
  type: h().optional(),
1004
1064
  from: "start_param"
1005
1065
  },
1006
- user: oe().optional()
1066
+ user: ie().optional()
1007
1067
  }, "InitData");
1008
1068
  }
1009
- function tr(r) {
1069
+ function er(r) {
1010
1070
  return me().parse(r);
1011
1071
  }
1012
1072
  function pt(r) {
@@ -1034,7 +1094,7 @@ class lt {
1034
1094
  * Checks if specified method is supported by current component.
1035
1095
  */
1036
1096
  o(this, "supports");
1037
- this.postEvent = t, this.state = new b({ isOpened: !1 }, this.ee), this.supports = E(e, { open: "web_app_open_invoice" });
1097
+ this.postEvent = t, this.state = new m({ isOpened: !1 }, this.ee), this.supports = C(e, { open: "web_app_open_invoice" });
1038
1098
  }
1039
1099
  set isOpened(e) {
1040
1100
  this.state.set("isOpened", e);
@@ -1051,17 +1111,13 @@ class lt {
1051
1111
  const s = t ? pt(e) : e;
1052
1112
  this.isOpened = !0;
1053
1113
  try {
1054
- return (await m(
1055
- "web_app_open_invoice",
1056
- { slug: s },
1057
- "invoice_closed",
1058
- {
1059
- postEvent: this.postEvent,
1060
- capture(i) {
1061
- return s === i.slug;
1062
- }
1114
+ return (await y("web_app_open_invoice", "invoice_closed", {
1115
+ params: { slug: s },
1116
+ postEvent: this.postEvent,
1117
+ capture(i) {
1118
+ return s === i.slug;
1063
1119
  }
1064
- )).status;
1120
+ })).status;
1065
1121
  } finally {
1066
1122
  this.isOpened = !1;
1067
1123
  }
@@ -1081,14 +1137,14 @@ class dt {
1081
1137
  // FIXME: Event 'main_button_pressed' is still being received on Android
1082
1138
  // even if the main button is disabled.
1083
1139
  // Issue: https://github.com/Telegram-Mini-Apps/tma.js/issues/3
1084
- e === "click" ? y("main_button_pressed", t) : this.ee.on(e, t)
1140
+ e === "click" ? E("main_button_pressed", t) : this.ee.on(e, t)
1085
1141
  ));
1086
1142
  /**
1087
1143
  * Removes event listener.
1088
1144
  * @param event - event name.
1089
1145
  * @param listener - event listener.
1090
1146
  */
1091
- o(this, "off", (e, t) => e === "click" ? $("main_button_pressed", t) : this.ee.off(e, t));
1147
+ o(this, "off", (e, t) => e === "click" ? I("main_button_pressed", t) : this.ee.off(e, t));
1092
1148
  const {
1093
1149
  postEvent: t = d,
1094
1150
  text: s,
@@ -1098,7 +1154,7 @@ class dt {
1098
1154
  isVisible: c,
1099
1155
  isLoaderVisible: u
1100
1156
  } = e;
1101
- this.postEvent = t, this.state = new b({
1157
+ this.postEvent = t, this.state = new m({
1102
1158
  backgroundColor: i,
1103
1159
  isEnabled: a,
1104
1160
  isVisible: c,
@@ -1232,10 +1288,10 @@ class dt {
1232
1288
  return this.state.set(e), this.commit(), this;
1233
1289
  }
1234
1290
  }
1235
- const ft = re({
1291
+ const ft = ee({
1236
1292
  contact: f({
1237
1293
  userId: {
1238
- type: A(),
1294
+ type: x(),
1239
1295
  from: "user_id"
1240
1296
  },
1241
1297
  phoneNumber: {
@@ -1260,7 +1316,7 @@ const ft = re({
1260
1316
  function ye(r, e) {
1261
1317
  return (t) => {
1262
1318
  const [s, n] = e[t];
1263
- return I(s, n, r);
1319
+ return A(s, n, r);
1264
1320
  };
1265
1321
  }
1266
1322
  function gt(r) {
@@ -1300,14 +1356,14 @@ class wt {
1300
1356
  version: i,
1301
1357
  botInline: a,
1302
1358
  createRequestId: c
1303
- } = e, u = E(i, {
1359
+ } = e, u = C(i, {
1304
1360
  requestPhoneAccess: "web_app_request_phone",
1305
1361
  requestWriteAccess: "web_app_request_write_access",
1306
1362
  switchInlineQuery: "web_app_switch_inline_query",
1307
1363
  setHeaderColor: "web_app_set_header_color",
1308
1364
  setBackgroundColor: "web_app_set_background_color"
1309
1365
  });
1310
- this.postEvent = t, this.botInline = a, this.createRequestId = c, this.supports = (p) => !(!u(p) || p === "switchInlineQuery" && !a), this.state = new b({ backgroundColor: n, headerColor: s }, this.ee), this.supportsParam = ye(i, {
1366
+ this.postEvent = t, this.botInline = a, this.createRequestId = c, this.supports = (p) => !(!u(p) || p === "switchInlineQuery" && !a), this.state = new m({ backgroundColor: n, headerColor: s }, this.ee), this.supportsParam = ye(i, {
1311
1367
  "setHeaderColor.color": ["web_app_set_header_color", "color"]
1312
1368
  });
1313
1369
  }
@@ -1315,7 +1371,7 @@ class wt {
1315
1371
  * Attempts to get requested contact.
1316
1372
  */
1317
1373
  async getRequestedContact() {
1318
- return H(
1374
+ return O(
1319
1375
  "getRequestedContact",
1320
1376
  {},
1321
1377
  this.createRequestId(),
@@ -1417,7 +1473,7 @@ class wt {
1417
1473
  requestPhoneAccess(e = {}) {
1418
1474
  if (this.requestingPhoneAccess)
1419
1475
  throw new Error("Phone access is already being requested.");
1420
- return this.requestingPhoneAccess = !0, m("web_app_request_phone", "phone_requested", {
1476
+ return this.requestingPhoneAccess = !0, y("web_app_request_phone", "phone_requested", {
1421
1477
  ...e,
1422
1478
  postEvent: this.postEvent
1423
1479
  }).then((t) => t.status).finally(() => {
@@ -1431,7 +1487,7 @@ class wt {
1431
1487
  requestWriteAccess(e = {}) {
1432
1488
  if (this.requestingWriteAccess)
1433
1489
  throw new Error("Write access is already being requested.");
1434
- return this.requestingWriteAccess = !0, m("web_app_request_write_access", "write_access_requested", {
1490
+ return this.requestingWriteAccess = !0, y("web_app_request_write_access", "write_access_requested", {
1435
1491
  ...e,
1436
1492
  postEvent: this.postEvent
1437
1493
  }).then((t) => t.status).finally(() => {
@@ -1458,7 +1514,7 @@ class wt {
1458
1514
  * @param color - color key or RGB color.
1459
1515
  */
1460
1516
  setHeaderColor(e) {
1461
- this.postEvent("web_app_set_header_color", te(e) ? { color: e } : { color_key: e }), this.state.set("headerColor", e);
1517
+ this.postEvent("web_app_set_header_color", X(e) ? { color: e } : { color_key: e }), this.state.set("headerColor", e);
1462
1518
  }
1463
1519
  /**
1464
1520
  * Updates current Mini App background color.
@@ -1526,7 +1582,7 @@ class bt {
1526
1582
  * Checks if specified method is supported by current component.
1527
1583
  */
1528
1584
  o(this, "supports");
1529
- this.postEvent = t, this.state = new b({ isOpened: !1 }, this.ee), this.supports = E(e, { open: "web_app_open_popup" });
1585
+ this.postEvent = t, this.state = new m({ isOpened: !1 }, this.ee), this.supports = C(e, { open: "web_app_open_popup" });
1530
1586
  }
1531
1587
  set isOpened(e) {
1532
1588
  this.state.set("isOpened", e);
@@ -1553,12 +1609,10 @@ class bt {
1553
1609
  open(e) {
1554
1610
  if (this.isOpened)
1555
1611
  throw new Error("Popup is already opened.");
1556
- return this.isOpened = !0, m(
1557
- "web_app_open_popup",
1558
- _t(e),
1559
- "popup_closed",
1560
- { postEvent: this.postEvent }
1561
- ).then(({ button_id: t = null }) => t).finally(() => {
1612
+ return this.isOpened = !0, y("web_app_open_popup", "popup_closed", {
1613
+ postEvent: this.postEvent,
1614
+ params: _t(e)
1615
+ }).then(({ button_id: t = null }) => t).finally(() => {
1562
1616
  this.isOpened = !1;
1563
1617
  });
1564
1618
  }
@@ -1579,7 +1633,7 @@ class mt {
1579
1633
  * Checks if specified method is supported by current component.
1580
1634
  */
1581
1635
  o(this, "supports");
1582
- this.postEvent = t, this.state = new b({ isOpened: !1 }, this.ee), this.supports = E(e, {
1636
+ this.postEvent = t, this.state = new m({ isOpened: !1 }, this.ee), this.supports = C(e, {
1583
1637
  close: "web_app_close_scan_qr_popup",
1584
1638
  open: "web_app_open_scan_qr_popup"
1585
1639
  });
@@ -1610,11 +1664,13 @@ class mt {
1610
1664
  throw new Error("QR scanner is already opened.");
1611
1665
  this.isOpened = !0;
1612
1666
  try {
1613
- const t = await m(
1667
+ const t = await y(
1614
1668
  "web_app_open_scan_qr_popup",
1615
- { text: e },
1616
1669
  ["qr_text_received", "scan_qr_popup_closed"],
1617
- { postEvent: this.postEvent }
1670
+ {
1671
+ postEvent: this.postEvent,
1672
+ params: { text: e }
1673
+ }
1618
1674
  );
1619
1675
  return typeof t == "object" && typeof t.data == "string" ? t.data : null;
1620
1676
  } finally {
@@ -1631,18 +1687,18 @@ class yt {
1631
1687
  * @param event - event name.
1632
1688
  * @param listener - event listener.
1633
1689
  */
1634
- o(this, "on", (e, t) => e === "click" ? y("settings_button_pressed", t) : this.ee.on(e, t));
1690
+ o(this, "on", (e, t) => e === "click" ? E("settings_button_pressed", t) : this.ee.on(e, t));
1635
1691
  /**
1636
1692
  * Removes event listener.
1637
1693
  * @param event - event name.
1638
1694
  * @param listener - event listener.
1639
1695
  */
1640
- o(this, "off", (e, t) => e === "click" ? $("settings_button_pressed", t) : this.ee.off(e, t));
1696
+ o(this, "off", (e, t) => e === "click" ? I("settings_button_pressed", t) : this.ee.off(e, t));
1641
1697
  /**
1642
1698
  * Checks if specified method is supported by current component.
1643
1699
  */
1644
1700
  o(this, "supports");
1645
- this.postEvent = s, this.state = new b({ isVisible: e }, this.ee), this.supports = E(t, {
1701
+ this.postEvent = s, this.state = new m({ isVisible: e }, this.ee), this.supports = C(t, {
1646
1702
  show: "web_app_setup_settings_button",
1647
1703
  hide: "web_app_setup_settings_button"
1648
1704
  });
@@ -1675,18 +1731,18 @@ function Et(r) {
1675
1731
  function Ct(r) {
1676
1732
  return r.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`).replace(/(^|_)background/, (e, t) => `${t}bg`);
1677
1733
  }
1678
- const Ee = T(
1734
+ const Ee = R(
1679
1735
  (r) => {
1680
1736
  const e = ge().optional();
1681
- return Object.entries(ee(r)).reduce((t, [s, n]) => (t[Et(s)] = e.parse(n), t), {});
1737
+ return Object.entries(Y(r)).reduce((t, [s, n]) => (t[Et(s)] = e.parse(n), t), {});
1682
1738
  },
1683
1739
  "ThemeParams"
1684
1740
  );
1685
1741
  function Ce(r) {
1686
1742
  return Ee().parse(r);
1687
1743
  }
1688
- function rr(r = {}) {
1689
- return m("web_app_request_theme", "theme_changed", r).then(Ce);
1744
+ function tr(r) {
1745
+ return y("web_app_request_theme", "theme_changed", r).then(Ce);
1690
1746
  }
1691
1747
  function vt(r) {
1692
1748
  return JSON.stringify(
@@ -1705,7 +1761,7 @@ class Pt {
1705
1761
  * Removes event listener.
1706
1762
  */
1707
1763
  o(this, "off", this.ee.off.bind(this.ee));
1708
- this.state = new b(e, this.ee);
1764
+ this.state = new m(e, this.ee);
1709
1765
  }
1710
1766
  /**
1711
1767
  * @since v6.10
@@ -1777,7 +1833,7 @@ class Pt {
1777
1833
  * @returns Function to stop listening.
1778
1834
  */
1779
1835
  listen() {
1780
- return y("theme_changed", (e) => {
1836
+ return E("theme_changed", (e) => {
1781
1837
  this.state.set(Ce(e.theme_params));
1782
1838
  });
1783
1839
  }
@@ -1791,7 +1847,7 @@ class Pt {
1791
1847
  return this.get("textColor");
1792
1848
  }
1793
1849
  }
1794
- class kt {
1850
+ class St {
1795
1851
  constructor(e, t, s = d) {
1796
1852
  /**
1797
1853
  * Checks if specified method is supported by current component.
@@ -1801,7 +1857,7 @@ class kt {
1801
1857
  * Checks if specified method parameter is supported by current component.
1802
1858
  */
1803
1859
  o(this, "supportsParam");
1804
- this.version = e, this.createRequestId = t, this.postEvent = s, this.supports = E(e, {
1860
+ this.version = e, this.createRequestId = t, this.postEvent = s, this.supports = C(e, {
1805
1861
  readTextFromClipboard: "web_app_read_text_from_clipboard"
1806
1862
  }), this.supportsParam = ye(e, {
1807
1863
  "openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
@@ -1818,7 +1874,7 @@ class kt {
1818
1874
  */
1819
1875
  openLink(e, t) {
1820
1876
  const s = new URL(e, window.location.href).toString();
1821
- if (!I("web_app_open_link", this.version)) {
1877
+ if (!A("web_app_open_link", this.version)) {
1822
1878
  window.open(s, "_blank");
1823
1879
  return;
1824
1880
  }
@@ -1841,7 +1897,7 @@ class kt {
1841
1897
  } = new URL(e, window.location.href);
1842
1898
  if (t !== "t.me")
1843
1899
  throw new Error(`URL has not allowed hostname: ${t}. Only "t.me" is allowed`);
1844
- if (!I("web_app_open_tg_link", this.version)) {
1900
+ if (!A("web_app_open_tg_link", this.version)) {
1845
1901
  window.location.href = e;
1846
1902
  return;
1847
1903
  }
@@ -1853,20 +1909,22 @@ class kt {
1853
1909
  * - Value in clipboard is not text
1854
1910
  * - Access to clipboard is not allowed
1855
1911
  */
1856
- readTextFromClipboard() {
1857
- return m(
1858
- "web_app_read_text_from_clipboard",
1859
- { req_id: this.createRequestId() },
1860
- "clipboard_text_received",
1861
- { postEvent: this.postEvent }
1862
- ).then(({ data: e = null }) => e);
1912
+ async readTextFromClipboard() {
1913
+ const e = this.createRequestId(), {
1914
+ data: t = null
1915
+ } = await y("web_app_read_text_from_clipboard", "clipboard_text_received", {
1916
+ postEvent: this.postEvent,
1917
+ params: { req_id: e },
1918
+ capture: le(e)
1919
+ });
1920
+ return t;
1863
1921
  }
1864
1922
  }
1865
- function St(r) {
1923
+ function kt(r) {
1866
1924
  return ["macos", "tdesktop", "unigram", "web", "weba"].includes(r);
1867
1925
  }
1868
1926
  async function ve(r) {
1869
- const e = await m("web_app_request_viewport", "viewport_changed", r);
1927
+ const e = await y("web_app_request_viewport", "viewport_changed", r);
1870
1928
  return {
1871
1929
  height: e.height,
1872
1930
  width: e.width,
@@ -1874,7 +1932,7 @@ async function ve(r) {
1874
1932
  isStateStable: e.is_state_stable
1875
1933
  };
1876
1934
  }
1877
- function W(r) {
1935
+ function L(r) {
1878
1936
  return r < 0 ? 0 : r;
1879
1937
  }
1880
1938
  class xt {
@@ -1897,11 +1955,11 @@ class xt {
1897
1955
  stableHeight: i,
1898
1956
  postEvent: a = d
1899
1957
  } = e;
1900
- this.postEvent = a, this.state = new b({
1901
- height: W(t),
1958
+ this.postEvent = a, this.state = new m({
1959
+ height: L(t),
1902
1960
  isExpanded: s,
1903
- stableHeight: W(i),
1904
- width: W(n)
1961
+ stableHeight: L(i),
1962
+ width: L(n)
1905
1963
  }, this.ee);
1906
1964
  }
1907
1965
  /**
@@ -1960,16 +2018,16 @@ class xt {
1960
2018
  * @returns Function to stop listening.
1961
2019
  */
1962
2020
  listen() {
1963
- return y("viewport_changed", (e) => {
2021
+ return E("viewport_changed", (e) => {
1964
2022
  const {
1965
2023
  height: t,
1966
2024
  width: s,
1967
2025
  is_expanded: n,
1968
2026
  is_state_stable: i
1969
2027
  } = e, a = {
1970
- height: W(t),
2028
+ height: L(t),
1971
2029
  isExpanded: n,
1972
- width: W(s)
2030
+ width: L(s)
1973
2031
  };
1974
2032
  i && (a.stableHeight = a.height), this.state.set(a);
1975
2033
  });
@@ -2017,7 +2075,7 @@ function qt(r, e) {
2017
2075
  backgroundColor: n,
2018
2076
  secondaryBackgroundColor: i
2019
2077
  } = e;
2020
- if (te(r.headerColor)) {
2078
+ if (X(r.headerColor)) {
2021
2079
  S("--tg-header-color", r.headerColor);
2022
2080
  return;
2023
2081
  }
@@ -2041,82 +2099,35 @@ function At(r) {
2041
2099
  };
2042
2100
  r.on("change", e), e();
2043
2101
  }
2044
- function ae(r) {
2102
+ function oe(r) {
2045
2103
  const e = () => S("--tg-viewport-height", `${r.height}px`), t = () => S("--tg-viewport-width", `${r.width}px`), s = () => S("--tg-viewport-stable-height", `${r.stableHeight}px`);
2046
2104
  r.on("change:height", e), r.on("change:width", t), r.on("change:stableHeight", s), e(), t(), s();
2047
2105
  }
2048
2106
  function Vt() {
2049
2107
  const r = document.createElement("style");
2050
- r.id = "telegram-custom-styles", document.head.appendChild(r), y("set_custom_style", (e) => {
2108
+ r.id = "telegram-custom-styles", document.head.appendChild(r), E("set_custom_style", (e) => {
2051
2109
  r.innerHTML = e;
2052
2110
  });
2053
2111
  }
2054
- class Rt {
2055
- constructor(e, t, s = d) {
2056
- o(this, "ee", new w());
2057
- o(this, "state");
2058
- /**
2059
- * Adds event listener.
2060
- * @param event - event name.
2061
- * @param listener - event listener.
2062
- */
2063
- o(this, "on", (e, t) => e === "click" ? y("back_button_pressed", t) : this.ee.on(e, t));
2064
- /**
2065
- * Removes event listener.
2066
- * @param event - event name.
2067
- * @param listener - event listener.
2068
- */
2069
- o(this, "off", (e, t) => e === "click" ? $("back_button_pressed", t) : this.ee.off(e, t));
2070
- /**
2071
- * Checks if specified method is supported by current component.
2072
- */
2073
- o(this, "supports");
2074
- this.postEvent = s, this.state = new b({ isVisible: e }, this.ee), this.supports = E(t, {
2075
- show: "web_app_setup_back_button",
2076
- hide: "web_app_setup_back_button"
2077
- });
2078
- }
2079
- set isVisible(e) {
2080
- this.state.set("isVisible", e), this.postEvent("web_app_setup_back_button", { is_visible: e });
2081
- }
2082
- /**
2083
- * True if BackButton is currently visible.
2084
- */
2085
- get isVisible() {
2086
- return this.state.get("isVisible");
2087
- }
2088
- /**
2089
- * Hides the BackButton.
2090
- */
2091
- hide() {
2092
- this.isVisible = !1;
2093
- }
2094
- /**
2095
- * Shows the BackButton.
2096
- */
2097
- show() {
2098
- this.isVisible = !0;
2099
- }
2100
- }
2101
2112
  function Pe(r) {
2102
2113
  return `telegram-mini-apps-${r}`;
2103
2114
  }
2104
- function B(r, e) {
2115
+ function T(r, e) {
2105
2116
  sessionStorage.setItem(Pe(r), JSON.stringify(e));
2106
2117
  }
2107
- function D(r) {
2118
+ function $(r) {
2108
2119
  const e = sessionStorage.getItem(Pe(r));
2109
2120
  return e ? JSON.parse(e) : null;
2110
2121
  }
2111
- function It(r, e, t) {
2112
- const { isVisible: s = !1 } = r ? D("back-button") || {} : {}, n = new Rt(s, e, t);
2122
+ function Rt(r, e, t) {
2123
+ const { isVisible: s = !1 } = r ? $("back-button") || {} : {}, n = new rt(s, e, t);
2113
2124
  return n.on("change", () => {
2114
- B("back-button", { isVisible: n.isVisible });
2125
+ T("back-button", { isVisible: n.isVisible });
2115
2126
  }), n;
2116
2127
  }
2117
- function Lt(r, e) {
2118
- const { isConfirmationNeeded: t = !1 } = r ? D("closing-behavior") || {} : {}, s = new st(t, e);
2119
- return s.on("change", () => B("closing-behavior", {
2128
+ function It(r, e) {
2129
+ const { isConfirmationNeeded: t = !1 } = r ? $("closing-behavior") || {} : {}, s = new st(t, e);
2130
+ return s.on("change", () => T("closing-behavior", {
2120
2131
  isConfirmationNeeded: s.isConfirmationNeeded
2121
2132
  })), s;
2122
2133
  }
@@ -2128,7 +2139,7 @@ function Tt(r, e, t, s) {
2128
2139
  isLoaderVisible: c = !1,
2129
2140
  textColor: u = t,
2130
2141
  text: p = ""
2131
- } = r ? D("main-button") || {} : {}, g = new dt({
2142
+ } = r ? $("main-button") || {} : {}, g = new dt({
2132
2143
  backgroundColor: n,
2133
2144
  isEnabled: i,
2134
2145
  isLoaderVisible: c,
@@ -2136,7 +2147,7 @@ function Tt(r, e, t, s) {
2136
2147
  postEvent: s,
2137
2148
  text: p,
2138
2149
  textColor: u
2139
- }), _ = () => B("main-button", {
2150
+ }), _ = () => T("main-button", {
2140
2151
  backgroundColor: g.backgroundColor,
2141
2152
  isEnabled: g.isEnabled,
2142
2153
  isLoaderVisible: g.isLoaderVisible,
@@ -2150,48 +2161,48 @@ function $t(r, e, t, s, n, i) {
2150
2161
  const {
2151
2162
  backgroundColor: a = e,
2152
2163
  headerColor: c = "bg_color"
2153
- } = r ? D("mini-app") || {} : {}, u = new wt({
2164
+ } = r ? $("mini-app") || {} : {}, u = new wt({
2154
2165
  headerColor: c,
2155
2166
  backgroundColor: a,
2156
2167
  version: t,
2157
2168
  botInline: s,
2158
2169
  createRequestId: n,
2159
2170
  postEvent: i
2160
- }), p = () => B("mini-app", {
2171
+ }), p = () => T("mini-app", {
2161
2172
  backgroundColor: u.backgroundColor,
2162
2173
  headerColor: u.headerColor
2163
2174
  });
2164
2175
  return u.on("change", p), u;
2165
2176
  }
2166
- function Bt() {
2177
+ function Lt() {
2167
2178
  let r = 0;
2168
2179
  return () => (r += 1, r.toString());
2169
2180
  }
2170
- function Dt(r, e, t) {
2171
- const { isVisible: s = !1 } = r ? D("settings-button") || {} : {}, n = new yt(s, e, t);
2181
+ function Bt(r, e, t) {
2182
+ const { isVisible: s = !1 } = r ? $("settings-button") || {} : {}, n = new yt(s, e, t);
2172
2183
  return n.on("change", () => {
2173
- B("settings-button", { isVisible: n.isVisible });
2184
+ T("settings-button", { isVisible: n.isVisible });
2174
2185
  }), n;
2175
2186
  }
2176
- function Wt(r) {
2187
+ function Ot(r) {
2177
2188
  const e = new Pt(r);
2178
2189
  return e.listen(), e;
2179
2190
  }
2180
- function G(r) {
2191
+ function N(r) {
2181
2192
  const e = new xt(r);
2182
- return e.on("change", () => B("viewport", {
2193
+ return e.on("change", () => T("viewport", {
2183
2194
  height: e.height,
2184
2195
  isExpanded: e.isExpanded,
2185
2196
  stableHeight: e.stableHeight,
2186
2197
  width: e.width
2187
2198
  })), e.listen(), e;
2188
2199
  }
2189
- function Ot(r, e, t, s) {
2190
- const n = r ? D("viewport") : null;
2200
+ function Dt(r, e, t, s) {
2201
+ const n = r ? $("viewport") : null;
2191
2202
  if (n)
2192
- return G({ ...n, postEvent: t });
2193
- if (St(e))
2194
- return G({
2203
+ return N({ ...n, postEvent: t });
2204
+ if (kt(e))
2205
+ return N({
2195
2206
  height: window.innerHeight,
2196
2207
  isExpanded: !0,
2197
2208
  postEvent: t,
@@ -2202,12 +2213,12 @@ function Ot(r, e, t, s) {
2202
2213
  return ve({
2203
2214
  postEvent: t,
2204
2215
  timeout: 5e3
2205
- }).then(({ height: a, isStateStable: c, ...u }) => G({
2216
+ }).then(({ height: a, isStateStable: c, ...u }) => N({
2206
2217
  ...u,
2207
2218
  height: a,
2208
2219
  stableHeight: c ? a : 0
2209
2220
  }));
2210
- const i = G({
2221
+ const i = N({
2211
2222
  width: 0,
2212
2223
  height: 0,
2213
2224
  isExpanded: !1,
@@ -2218,21 +2229,21 @@ function Ot(r, e, t, s) {
2218
2229
  console.error("Unable to actualize viewport state", a);
2219
2230
  }), i;
2220
2231
  }
2221
- function Ht(r) {
2232
+ function Wt(r) {
2222
2233
  return typeof r == "object" ? r : r ? {
2223
2234
  themeParams: !0,
2224
2235
  viewport: !0,
2225
2236
  miniApp: !0
2226
2237
  } : {};
2227
2238
  }
2228
- function ce(r, e, t, s) {
2229
- const n = Ht(r);
2230
- n.miniApp && qt(e, t), n.themeParams && At(t), n.viewport && (s instanceof Promise ? s.then(ae) : ae(s));
2239
+ function ae(r, e, t, s) {
2240
+ const n = Wt(r);
2241
+ n.miniApp && qt(e, t), n.themeParams && At(t), n.viewport && (s instanceof Promise ? s.then(oe) : oe(s));
2231
2242
  }
2232
- function Nt() {
2233
- return re({
2243
+ function Ht() {
2244
+ return ee({
2234
2245
  botInline: {
2235
- type: k().optional(),
2246
+ type: P().optional(),
2236
2247
  from: "tgWebAppBotInline"
2237
2248
  },
2238
2249
  initData: {
@@ -2248,7 +2259,7 @@ function Nt() {
2248
2259
  from: "tgWebAppPlatform"
2249
2260
  },
2250
2261
  showSettings: {
2251
- type: k().optional(),
2262
+ type: P().optional(),
2252
2263
  from: "tgWebAppShowSettings"
2253
2264
  },
2254
2265
  startParam: {
@@ -2265,26 +2276,26 @@ function Nt() {
2265
2276
  }
2266
2277
  }, "LaunchParams");
2267
2278
  }
2268
- function ke(r) {
2269
- return Nt().parse(r);
2270
- }
2271
2279
  function Se(r) {
2280
+ return Ht().parse(r);
2281
+ }
2282
+ function ke(r) {
2272
2283
  const e = r.includes("?") ? r.replace("#", "&").slice(r.indexOf("?") + 1) : r.slice(r.indexOf("#") + 1);
2273
- return ke(e);
2284
+ return Se(e);
2274
2285
  }
2275
- function Ut() {
2276
- return Se(window.location.href);
2286
+ function Nt() {
2287
+ return ke(window.location.href);
2277
2288
  }
2278
2289
  function xe() {
2279
2290
  return performance.getEntriesByType("navigation")[0];
2280
2291
  }
2281
- function Mt() {
2292
+ function Ut() {
2282
2293
  const r = xe();
2283
2294
  if (!r)
2284
2295
  throw new Error("Unable to get first navigation entry.");
2285
- return Se(r.name);
2296
+ return ke(r.name);
2286
2297
  }
2287
- function Gt(r) {
2298
+ function Mt(r) {
2288
2299
  const {
2289
2300
  initDataRaw: e,
2290
2301
  themeParams: t,
@@ -2297,36 +2308,36 @@ function Gt(r) {
2297
2308
  return e && u.set("tgWebAppData", e), u.set("tgWebAppPlatform", s), u.set("tgWebAppThemeParams", vt(t)), u.set("tgWebAppVersion", n), a && u.set("tgWebAppStartParam", n), typeof i == "boolean" && u.set("tgWebAppShowSettings", i ? "1" : "0"), typeof c == "boolean" && u.set("tgWebAppBotInline", c ? "1" : "0"), u.toString();
2298
2309
  }
2299
2310
  const qe = "telegram-mini-apps-launch-params";
2300
- function jt() {
2301
- return ke(sessionStorage.getItem(qe) || "");
2311
+ function Gt() {
2312
+ return Se(sessionStorage.getItem(qe) || "");
2302
2313
  }
2303
- function Ft(r) {
2304
- sessionStorage.setItem(qe, Gt(r));
2314
+ function jt(r) {
2315
+ sessionStorage.setItem(qe, Mt(r));
2305
2316
  }
2306
- function se() {
2317
+ function te() {
2307
2318
  const r = [];
2308
2319
  for (const e of [
2309
2320
  // Try to retrieve launch parameters from the current location. This method can return
2310
2321
  // nothing in case, location was changed and then page was reloaded.
2311
- Ut,
2322
+ Nt,
2312
2323
  // Then, try using the lower level API - window.performance.
2313
- Mt,
2324
+ Ut,
2314
2325
  // Finally, try to extract launch parameters from the session storage.
2315
- jt
2326
+ Gt
2316
2327
  ])
2317
2328
  try {
2318
2329
  const t = e();
2319
- return Ft(t), t;
2330
+ return jt(t), t;
2320
2331
  } catch (t) {
2321
2332
  r.push(t);
2322
2333
  }
2323
- throw q.error("Unable to extract launch parameters. Received errors:", r), new Error("Unable to retrieve launch parameters from any known source.");
2334
+ throw k.error("Unable to extract launch parameters. Received errors:", r), new Error("Unable to retrieve launch parameters from any known source.");
2324
2335
  }
2325
2336
  function Ae() {
2326
2337
  var r;
2327
2338
  return ((r = xe()) == null ? void 0 : r.type) === "reload";
2328
2339
  }
2329
- function sr(r = {}) {
2340
+ function rr(r = {}) {
2330
2341
  const {
2331
2342
  async: e = !1,
2332
2343
  complete: t = e,
@@ -2341,15 +2352,15 @@ function sr(r = {}) {
2341
2352
  platform: u,
2342
2353
  themeParams: p,
2343
2354
  botInline: g = !1
2344
- } = se(), _ = Ae(), V = Bt(), l = De(c);
2345
- le() && (n && Vt(), l("iframe_ready", { reload_supported: !0 }), y("reload_iframe", () => {
2355
+ } = te(), _ = Ae(), b = Lt(), l = Oe(c);
2356
+ pe() && (n && Vt(), l("iframe_ready", { reload_supported: !0 }), E("reload_iframe", () => {
2346
2357
  l("iframe_will_reload"), window.location.reload();
2347
2358
  }));
2348
- const C = {
2349
- backButton: It(_, c, l),
2350
- closingBehavior: Lt(_, l),
2351
- cloudStorage: new at(c, V, l),
2352
- createRequestId: V,
2359
+ const q = {
2360
+ backButton: Rt(_, c, l),
2361
+ closingBehavior: It(_, l),
2362
+ cloudStorage: new at(c, b, l),
2363
+ createRequestId: b,
2353
2364
  hapticFeedback: new ct(c, l),
2354
2365
  invoice: new lt(c, l),
2355
2366
  mainButton: Tt(
@@ -2363,55 +2374,55 @@ function sr(r = {}) {
2363
2374
  p.backgroundColor || "#ffffff",
2364
2375
  c,
2365
2376
  g,
2366
- V,
2377
+ b,
2367
2378
  l
2368
2379
  ),
2369
2380
  popup: new bt(c, l),
2370
2381
  postEvent: l,
2371
2382
  qrScanner: new mt(c, l),
2372
- settingsButton: Dt(_, c, l),
2373
- themeParams: Wt(p),
2374
- utils: new kt(c, V, l),
2383
+ settingsButton: Bt(_, c, l),
2384
+ themeParams: Ot(p),
2385
+ utils: new St(c, b, l),
2375
2386
  ...i ? {
2376
2387
  initData: new ut(i),
2377
2388
  initDataRaw: a
2378
2389
  } : {}
2379
- }, x = Ot(_, u, l, t);
2380
- return x instanceof Promise || t ? Promise.resolve(x).then((v) => (ce(
2390
+ }, H = Dt(_, u, l, t);
2391
+ return H instanceof Promise || t ? Promise.resolve(H).then((re) => (ae(
2381
2392
  s,
2382
- C.miniApp,
2383
- C.themeParams,
2384
- v
2385
- ), { ...C, viewport: v })) : (ce(
2393
+ q.miniApp,
2394
+ q.themeParams,
2395
+ re
2396
+ ), { ...q, viewport: re })) : (ae(
2386
2397
  s,
2387
- C.miniApp,
2388
- C.themeParams,
2389
- x
2390
- ), { ...C, viewport: x });
2398
+ q.miniApp,
2399
+ q.themeParams,
2400
+ H
2401
+ ), { ...q, viewport: H });
2391
2402
  } catch (i) {
2392
2403
  if (t)
2393
2404
  return Promise.reject(i);
2394
2405
  throw i;
2395
2406
  }
2396
2407
  }
2397
- function nr() {
2408
+ function sr() {
2398
2409
  return {
2399
- launchParams: se(),
2410
+ launchParams: te(),
2400
2411
  isPageReload: Ae()
2401
2412
  };
2402
2413
  }
2403
- function ir() {
2414
+ function nr() {
2404
2415
  try {
2405
- return se(), !0;
2416
+ return te(), !0;
2406
2417
  } catch {
2407
2418
  return !1;
2408
2419
  }
2409
2420
  }
2410
- function or(r) {
2421
+ function ir(r) {
2411
2422
  const e = r.match(/#(.+)/);
2412
2423
  return e ? e[1] : null;
2413
2424
  }
2414
- async function N(r) {
2425
+ async function D(r) {
2415
2426
  return r === 0 ? !0 : Promise.race([
2416
2427
  new Promise((e) => {
2417
2428
  window.addEventListener("popstate", function t() {
@@ -2424,17 +2435,17 @@ async function N(r) {
2424
2435
  })
2425
2436
  ]);
2426
2437
  }
2427
- async function zt() {
2428
- if (window.history.length <= 1 || (window.history.pushState(null, ""), await N(1 - window.history.length)))
2438
+ async function Ft() {
2439
+ if (window.history.length <= 1 || (window.history.pushState(null, ""), await D(1 - window.history.length)))
2429
2440
  return;
2430
- let e = await N(-1);
2441
+ let e = await D(-1);
2431
2442
  for (; e; )
2432
- e = await N(-1);
2443
+ e = await D(-1);
2433
2444
  }
2434
- function O(r, e) {
2445
+ function B(r, e) {
2435
2446
  return r.startsWith(e) ? r : `${e}${r}`;
2436
2447
  }
2437
- class Jt {
2448
+ class zt {
2438
2449
  constructor(e, t, {
2439
2450
  debug: s = !1,
2440
2451
  loggerPrefix: n = "Navigator"
@@ -2449,11 +2460,11 @@ class Jt {
2449
2460
  if (!i.startsWith("/") && i.length > 0)
2450
2461
  throw new Error('Pathname should start with "/"');
2451
2462
  return {
2452
- pathname: O(i, "/"),
2453
- search: a ? O(a, "?") : "",
2454
- hash: c ? O(c, "#") : ""
2463
+ pathname: B(i, "/"),
2464
+ search: a ? B(a, "?") : "",
2465
+ hash: c ? B(c, "#") : ""
2455
2466
  };
2456
- }), this.logger = new ue(`[${n}]`, s);
2467
+ }), this.logger = new he(`[${n}]`, s);
2457
2468
  }
2458
2469
  /**
2459
2470
  * Converts entry to the navigation entry.
@@ -2469,7 +2480,7 @@ class Jt {
2469
2480
  search: c,
2470
2481
  hash: u
2471
2482
  } = e;
2472
- t = a + (c ? O(c, "?") : "") + (u ? O(u, "#") : "");
2483
+ t = a + (c ? B(c, "?") : "") + (u ? B(u, "#") : "");
2473
2484
  }
2474
2485
  const {
2475
2486
  pathname: s,
@@ -2633,8 +2644,8 @@ class Jt {
2633
2644
  return this.entry.search;
2634
2645
  }
2635
2646
  }
2636
- const he = 0, Z = 1, K = 2;
2637
- class Ve extends Jt {
2647
+ const ce = 0, J = 1, Q = 2;
2648
+ class Ve extends zt {
2638
2649
  constructor(t, s, n = {}) {
2639
2650
  super(t, s, {
2640
2651
  ...n,
@@ -2649,13 +2660,13 @@ class Ve extends Jt {
2649
2660
  o(this, "onPopState", async ({ state: t }) => {
2650
2661
  if (this.logger.log('"popstate" event received. State:', t), t === null)
2651
2662
  return this.push(window.location.hash.slice(1));
2652
- if (t === he) {
2663
+ if (t === ce) {
2653
2664
  this.logger.log("Void reached. Moving history forward"), window.history.forward();
2654
2665
  return;
2655
2666
  }
2656
- if (t === Z)
2667
+ if (t === J)
2657
2668
  return this.back();
2658
- if (t === K)
2669
+ if (t === Q)
2659
2670
  return this.forward();
2660
2671
  });
2661
2672
  o(this, "back", () => super.back());
@@ -2698,7 +2709,7 @@ class Ve extends Jt {
2698
2709
  async syncHistory() {
2699
2710
  window.removeEventListener("popstate", this.onPopState);
2700
2711
  const t = `#${this.path}`;
2701
- await zt(), d("web_app_setup_back_button", { is_visible: this.canGoBack }), this.canGoBack && this.canGoForward ? (this.logger.log("Setting up history: [<-, *, ->]"), window.history.replaceState(Z, ""), window.history.pushState(null, "", t), window.history.pushState(K, ""), await N(-1)) : this.canGoBack ? (this.logger.log("Setting up history: [<-, *]"), window.history.replaceState(Z, ""), window.history.pushState(null, "", t)) : this.canGoForward ? (this.logger.log("Setting up history: [*, ->]"), window.history.replaceState(null, t), window.history.pushState(K, ""), await N(-1)) : (this.logger.log("Setting up history: [~, *]"), window.history.replaceState(he, ""), window.history.pushState(null, "", t)), window.addEventListener("popstate", this.onPopState);
2712
+ await Ft(), d("web_app_setup_back_button", { is_visible: this.canGoBack }), this.canGoBack && this.canGoForward ? (this.logger.log("Setting up history: [<-, *, ->]"), window.history.replaceState(J, ""), window.history.pushState(null, "", t), window.history.pushState(Q, ""), await D(-1)) : this.canGoBack ? (this.logger.log("Setting up history: [<-, *]"), window.history.replaceState(J, ""), window.history.pushState(null, "", t)) : this.canGoForward ? (this.logger.log("Setting up history: [*, ->]"), window.history.replaceState(null, t), window.history.pushState(Q, ""), await D(-1)) : (this.logger.log("Setting up history: [~, *]"), window.history.replaceState(ce, ""), window.history.pushState(null, "", t)), window.addEventListener("popstate", this.onPopState);
2702
2713
  }
2703
2714
  emitChanged(t, s) {
2704
2715
  this.ee.emit("change", {
@@ -2712,19 +2723,20 @@ class Ve extends Jt {
2712
2723
  */
2713
2724
  async attach() {
2714
2725
  if (!this.attached)
2715
- return this.logger.log("Attaching", this), this.attached = !0, y("back_button_pressed", this.back), this.syncHistory();
2726
+ return this.logger.log("Attaching", this), this.attached = !0, E("back_button_pressed", this.back), this.syncHistory();
2716
2727
  }
2717
2728
  /**
2718
2729
  * Detaches current navigator from the browser history.
2719
2730
  */
2720
2731
  detach() {
2721
- this.attached && (this.logger.log("Detaching", this), this.attached = !1, window.removeEventListener("popstate", this.onPopState), $("back_button_pressed", this.back));
2732
+ this.attached && (this.logger.log("Detaching", this), this.attached = !1, window.removeEventListener("popstate", this.onPopState), I("back_button_pressed", this.back));
2722
2733
  }
2723
2734
  }
2724
- function ar(r) {
2725
- return r instanceof J;
2735
+ function or(r) {
2736
+ return r instanceof F;
2726
2737
  }
2727
2738
  export {
2739
+ rt as BackButton,
2728
2740
  st as ClosingBehavior,
2729
2741
  at as CloudStorage,
2730
2742
  ct as HapticFeedback,
@@ -2732,72 +2744,72 @@ export {
2732
2744
  ut as InitData,
2733
2745
  lt as Invoice,
2734
2746
  dt as MainButton,
2735
- Y as MethodUnsupportedError,
2747
+ Z as MethodUnsupportedError,
2736
2748
  wt as MiniApp,
2737
- Jt as Navigator,
2738
- X as ParameterUnsupportedError,
2739
- F as ParseError,
2740
- j as ParseSchemaFieldError,
2749
+ zt as Navigator,
2750
+ K as ParameterUnsupportedError,
2751
+ G as ParseError,
2752
+ U as ParseSchemaFieldError,
2741
2753
  bt as Popup,
2742
2754
  mt as QRScanner,
2743
2755
  yt as SettingsButton,
2744
2756
  Pt as ThemeParams,
2745
- J as TimeoutError,
2746
- kt as Utils,
2757
+ F as TimeoutError,
2758
+ St as Utils,
2747
2759
  xt as Viewport,
2748
2760
  ot as array,
2749
2761
  qt as bindMiniAppCSSVars,
2750
2762
  At as bindThemeCSSVars,
2751
- ae as bindViewportCSSVars,
2752
- k as boolean,
2763
+ oe as bindViewportCSSVars,
2764
+ P as boolean,
2753
2765
  ht as chatParser,
2754
- rt as classNames,
2766
+ tt as classNames,
2755
2767
  Be as compareVersions,
2756
- De as createPostEvent,
2768
+ Oe as createPostEvent,
2757
2769
  be as date,
2758
- or as getHash,
2759
- sr as init,
2770
+ ir as getHash,
2771
+ rr as init,
2760
2772
  me as initDataParser,
2761
- H as invokeCustomMethod,
2773
+ O as invokeCustomMethod,
2762
2774
  _e as isColorDark,
2763
- le as isIframe,
2775
+ pe as isIframe,
2764
2776
  Ae as isPageReload,
2765
- te as isRGB,
2766
- Qe as isRGBShort,
2767
- R as isRecord,
2768
- St as isStableViewportPlatform,
2769
- ir as isTMA,
2770
- ar as isTimeoutError,
2777
+ X as isRGB,
2778
+ Je as isRGBShort,
2779
+ M as isRecord,
2780
+ kt as isStableViewportPlatform,
2781
+ nr as isTMA,
2782
+ or as isTimeoutError,
2771
2783
  f as json,
2772
- Nt as launchParamsParser,
2773
- er as mergeClassNames,
2774
- A as number,
2775
- $ as off,
2776
- y as on,
2777
- Yt as once,
2778
- tr as parseInitData,
2779
- ke as parseLaunchParams,
2780
- Oe as parseMessage,
2784
+ Ht as launchParamsParser,
2785
+ Xt as mergeClassNames,
2786
+ x as number,
2787
+ I as off,
2788
+ E as on,
2789
+ Kt as once,
2790
+ er as parseInitData,
2791
+ Se as parseLaunchParams,
2792
+ De as parseMessage,
2781
2793
  Ce as parseThemeParams,
2782
2794
  d as postEvent,
2783
- m as request,
2784
- rr as requestThemeParams,
2795
+ y as request,
2796
+ tr as requestThemeParams,
2785
2797
  ve as requestViewport,
2786
- nr as retrieveLaunchData,
2787
- se as retrieveLaunchParams,
2798
+ sr as retrieveLaunchData,
2799
+ te as retrieveLaunchParams,
2788
2800
  ge as rgb,
2789
- re as searchParams,
2790
- Gt as serializeLaunchParams,
2801
+ ee as searchParams,
2802
+ Mt as serializeLaunchParams,
2791
2803
  vt as serializeThemeParams,
2792
2804
  S as setCSSVar,
2793
- Zt as setDebug,
2794
- Kt as setTargetOrigin,
2805
+ Qt as setDebug,
2806
+ Zt as setTargetOrigin,
2795
2807
  h as string,
2796
- Xt as subscribe,
2797
- I as supports,
2808
+ Yt as subscribe,
2809
+ A as supports,
2798
2810
  Ee as themeParamsParser,
2799
2811
  fe as toRGB,
2800
- tt as unsubscribe,
2801
- oe as userParser,
2812
+ et as unsubscribe,
2813
+ ie as userParser,
2802
2814
  we as withTimeout
2803
2815
  };