@tma.js/sdk-solid 2.1.4 → 2.1.5

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,20 +1,20 @@
1
- import { createComponent as gt, mergeProps as at, createContext as Qt, useContext as Yt, createEffect as ct, onCleanup as ht, createResource as Zt, createMemo as pt, from as Xt } from "solid-js";
2
- var te = Object.defineProperty, ee = (e, t, s) => t in e ? te(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (ee(e, typeof t != "symbol" ? t + "" : t, s), s);
3
- function ft(e, t) {
1
+ import { createComponent as mt, mergeProps as pt, createContext as ee, useContext as se, createEffect as ut, onCleanup as dt, createResource as ne, createMemo as lt, from as re } from "solid-js";
2
+ var ie = Object.defineProperty, oe = (e, t, s) => t in e ? ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (oe(e, typeof t != "symbol" ? t + "" : t, s), s);
3
+ function bt(e, t) {
4
4
  let s;
5
5
  const n = () => {
6
6
  s !== void 0 && t && t(s), s = void 0;
7
7
  };
8
8
  return [() => s === void 0 ? s = e(n) : s, n];
9
9
  }
10
- function mt(e) {
11
- const t = U(), { count: s } = t;
12
- t.unsubscribe(e), s && !t.count && Pe();
10
+ function vt(e) {
11
+ const t = H(), { count: s } = t;
12
+ t.unsubscribe(e), s && !t.count && Se();
13
13
  }
14
- function se(e) {
15
- return U().subscribe(e), () => mt(e);
14
+ function ae(e) {
15
+ return H().subscribe(e), () => vt(e);
16
16
  }
17
- class ne {
17
+ class ce {
18
18
  constructor(t, s = {}) {
19
19
  this.scope = t, this.options = s;
20
20
  }
@@ -54,19 +54,19 @@ class ne {
54
54
  this.print("log", ...t);
55
55
  }
56
56
  }
57
- const Z = new ne("SDK", {
57
+ const X = new ce("SDK", {
58
58
  bgColor: "forestgreen",
59
59
  textColor: "white"
60
60
  });
61
61
  let F = !1;
62
- const ut = ({ name: e, payload: t }) => {
63
- Z.log("Event received:", t ? { name: e, payload: t } : { name: e });
62
+ const _t = ({ name: e, payload: t }) => {
63
+ X.log("Event received:", t ? { name: e, payload: t } : { name: e });
64
64
  };
65
- function re(e) {
66
- F !== e && (F = e, e ? se(ut) : mt(ut));
65
+ function he(e) {
66
+ F !== e && (F = e, e ? ae(_t) : vt(_t));
67
67
  }
68
- function ie(...e) {
69
- F && Z.log(...e);
68
+ function pe(...e) {
69
+ F && X.log(...e);
70
70
  }
71
71
  class O {
72
72
  constructor() {
@@ -141,7 +141,7 @@ class O {
141
141
  function Q(e, t, s) {
142
142
  return window.addEventListener(e, t, s), () => window.removeEventListener(e, t, s);
143
143
  }
144
- function bt(...e) {
144
+ function yt(...e) {
145
145
  let t = !1;
146
146
  const s = [...e];
147
147
  return [
@@ -157,12 +157,12 @@ class $ extends Error {
157
157
  super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, $.prototype);
158
158
  }
159
159
  }
160
- function b(e, t, s) {
160
+ function m(e, t, s) {
161
161
  return new $(e, t, s);
162
162
  }
163
- const oe = "ERR_METHOD_UNSUPPORTED", ae = "ERR_METHOD_PARAMETER_UNSUPPORTED", ce = "ERR_UNKNOWN_ENV", he = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", pe = "ERR_TIMED_OUT", ue = "ERR_UNEXPECTED_TYPE", wt = "ERR_PARSE", le = "ERR_NAVIGATION_LIST_EMPTY", de = "ERR_NAVIGATION_CURSOR_INVALID", zs = "ERR_NAVIGATION_ITEM_INVALID", Js = "ERR_SSR_INIT", _e = "ERR_INVALID_PATH_BASE";
163
+ const ue = "ERR_METHOD_UNSUPPORTED", de = "ERR_METHOD_PARAMETER_UNSUPPORTED", le = "ERR_UNKNOWN_ENV", _e = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", ge = "ERR_TIMED_OUT", fe = "ERR_UNEXPECTED_TYPE", Et = "ERR_PARSE", we = "ERR_NAVIGATION_LIST_EMPTY", me = "ERR_NAVIGATION_CURSOR_INVALID", zs = "ERR_NAVIGATION_ITEM_INVALID", Js = "ERR_SSR_INIT", be = "ERR_INVALID_PATH_BASE";
164
164
  function S() {
165
- return b(ue, "Value has unexpected type");
165
+ return m(fe, "Value has unexpected type");
166
166
  }
167
167
  class L {
168
168
  constructor(t, s, n) {
@@ -179,8 +179,8 @@ class L {
179
179
  try {
180
180
  return this.parser(t);
181
181
  } catch (s) {
182
- throw b(
183
- wt,
182
+ throw m(
183
+ Et,
184
184
  `Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
185
185
  s
186
186
  );
@@ -190,10 +190,10 @@ class L {
190
190
  return this.isOptional = !0, this;
191
191
  }
192
192
  }
193
- function R(e, t) {
193
+ function T(e, t) {
194
194
  return () => new L(e, !1, t);
195
195
  }
196
- const y = R((e) => {
196
+ const y = T((e) => {
197
197
  if (typeof e == "boolean")
198
198
  return e;
199
199
  const t = String(e);
@@ -203,7 +203,7 @@ const y = R((e) => {
203
203
  return !1;
204
204
  throw S();
205
205
  }, "boolean");
206
- function vt(e, t) {
206
+ function Pt(e, t) {
207
207
  const s = {};
208
208
  for (const n in e) {
209
209
  const r = e[n];
@@ -220,12 +220,12 @@ function vt(e, t) {
220
220
  const a = o(t(i));
221
221
  a !== void 0 && (s[n] = a);
222
222
  } catch (a) {
223
- throw b(wt, `Unable to parse field "${n}"`, a);
223
+ throw m(Et, `Unable to parse field "${n}"`, a);
224
224
  }
225
225
  }
226
226
  return s;
227
227
  }
228
- function X(e) {
228
+ function tt(e) {
229
229
  let t = e;
230
230
  if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
231
231
  throw S();
@@ -233,11 +233,11 @@ function X(e) {
233
233
  }
234
234
  function f(e, t) {
235
235
  return new L((s) => {
236
- const n = X(s);
237
- return vt(e, (r) => n[r]);
236
+ const n = tt(s);
237
+ return Pt(e, (r) => n[r]);
238
238
  }, !1, t);
239
239
  }
240
- const P = R((e) => {
240
+ const P = T((e) => {
241
241
  if (typeof e == "number")
242
242
  return e;
243
243
  if (typeof e == "string") {
@@ -247,17 +247,17 @@ const P = R((e) => {
247
247
  }
248
248
  throw S();
249
249
  }, "number");
250
- function tt(e) {
250
+ function et(e) {
251
251
  return /^#[\da-f]{6}$/i.test(e);
252
252
  }
253
- function ge(e) {
253
+ function ve(e) {
254
254
  return /^#[\da-f]{3}$/i.test(e);
255
255
  }
256
- function yt(e) {
256
+ function xt(e) {
257
257
  const t = e.replace(/\s/g, "").toLowerCase();
258
- if (tt(t))
258
+ if (et(t))
259
259
  return t;
260
- if (ge(t)) {
260
+ if (ve(t)) {
261
261
  let n = "#";
262
262
  for (let r = 0; r < 3; r += 1)
263
263
  n += t[1 + r].repeat(2);
@@ -271,30 +271,30 @@ function yt(e) {
271
271
  return n + (i.length === 1 ? "0" : "") + i;
272
272
  }, "#");
273
273
  }
274
- const p = R((e) => {
274
+ const p = T((e) => {
275
275
  if (typeof e == "string" || typeof e == "number")
276
276
  return e.toString();
277
277
  throw S();
278
- }, "string"), Et = R((e) => yt(p().parse(e)), "rgb");
279
- function fe(e) {
278
+ }, "string"), Ct = T((e) => xt(p().parse(e)), "rgb");
279
+ function St(e) {
280
280
  return f({
281
281
  eventType: p(),
282
282
  eventData: (t) => t
283
283
  }).parse(e);
284
284
  }
285
- function me() {
285
+ function ye() {
286
286
  ["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
287
287
  delete window[e];
288
288
  });
289
289
  }
290
- function be(e, t) {
290
+ function Y(e, t) {
291
291
  window.dispatchEvent(new MessageEvent("message", {
292
292
  data: JSON.stringify({ eventType: e, eventData: t }),
293
293
  // We specify window.parent to imitate the case, the parent iframe sent us this event.
294
294
  source: window.parent
295
295
  }));
296
296
  }
297
- function we() {
297
+ function Ee() {
298
298
  [
299
299
  ["TelegramGameProxy_receiveEvent"],
300
300
  // Windows Phone.
@@ -306,14 +306,14 @@ function we() {
306
306
  let t = window;
307
307
  e.forEach((s, n, r) => {
308
308
  if (n === r.length - 1) {
309
- t[s] = be;
309
+ t[s] = Y;
310
310
  return;
311
311
  }
312
312
  s in t || (t[s] = {}), t = t[s];
313
313
  });
314
314
  });
315
315
  }
316
- const ve = {
316
+ const Pe = {
317
317
  clipboard_text_received: f({
318
318
  req_id: p(),
319
319
  data: (e) => e === null ? e : p().optional().parse(e)
@@ -335,8 +335,8 @@ const ve = {
335
335
  qr_text_received: f({ data: p().optional() }),
336
336
  theme_changed: f({
337
337
  theme_params: (e) => {
338
- const t = Et().optional();
339
- return Object.entries(X(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
338
+ const t = Ct().optional();
339
+ return Object.entries(tt(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
340
340
  }
341
341
  }),
342
342
  viewport_changed: f({
@@ -347,14 +347,14 @@ const ve = {
347
347
  }),
348
348
  write_access_requested: f({ status: p() })
349
349
  };
350
- function ye() {
350
+ function xe() {
351
351
  const e = new O(), t = new O();
352
352
  t.subscribe((n) => {
353
353
  e.emit("event", { name: n.event, payload: n.args[0] });
354
- }), we();
355
- const [, s] = bt(
354
+ }), Ee();
355
+ const [, s] = yt(
356
356
  // Don't forget to remove created handlers.
357
- me,
357
+ ye,
358
358
  // Add "resize" event listener to make sure, we always have fresh viewport information.
359
359
  // Desktop version of Telegram is sometimes not sending the viewport_changed
360
360
  // event. For example, when the MainButton is shown. That's why we should
@@ -375,16 +375,16 @@ function ye() {
375
375
  return;
376
376
  let r;
377
377
  try {
378
- r = fe(n.data);
378
+ r = St(n.data);
379
379
  } catch {
380
380
  return;
381
381
  }
382
- const { eventType: i, eventData: o } = r, a = ve[i];
382
+ const { eventType: i, eventData: o } = r, a = Pe[i];
383
383
  try {
384
384
  const h = a ? a.parse(o) : o;
385
385
  t.emit(...h ? [i, h] : [i]);
386
386
  } catch (h) {
387
- Z.error(
387
+ X.error(
388
388
  `An error occurred processing the "${i}" event from the Telegram application. Please, file an issue here: https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose`,
389
389
  r,
390
390
  h
@@ -409,9 +409,9 @@ function ye() {
409
409
  }
410
410
  }, s];
411
411
  }
412
- const [Ee, Pe] = ft(
412
+ const [Ce, Se] = bt(
413
413
  (e) => {
414
- const [t, s] = ye(), n = t.off.bind(t);
414
+ const [t, s] = xe(), n = t.off.bind(t);
415
415
  return t.off = (r, i) => {
416
416
  const { count: o } = t;
417
417
  n(r, i), o && !t.count && e();
@@ -419,19 +419,19 @@ const [Ee, Pe] = ft(
419
419
  },
420
420
  ([, e]) => e()
421
421
  );
422
- function U() {
423
- return Ee()[0];
422
+ function H() {
423
+ return Ce()[0];
424
424
  }
425
- function H(e, t) {
426
- U().off(e, t);
425
+ function U(e, t) {
426
+ H().off(e, t);
427
427
  }
428
428
  function v(e, t, s) {
429
- return U().on(e, t, s);
429
+ return H().on(e, t, s);
430
430
  }
431
- function D(e) {
431
+ function N(e) {
432
432
  return typeof e == "object" && e !== null && !Array.isArray(e);
433
433
  }
434
- function xe(e, t) {
434
+ function Te(e, t) {
435
435
  const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
436
436
  for (let i = 0; i < r; i += 1) {
437
437
  const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
@@ -440,15 +440,15 @@ function xe(e, t) {
440
440
  }
441
441
  return 0;
442
442
  }
443
- function w(e, t) {
444
- return xe(e, t) <= 0;
443
+ function b(e, t) {
444
+ return Te(e, t) <= 0;
445
445
  }
446
446
  function x(e, t, s) {
447
447
  if (typeof s == "string") {
448
448
  if (e === "web_app_open_link" && t === "try_instant_view")
449
- return w("6.4", s);
449
+ return b("6.4", s);
450
450
  if (e === "web_app_set_header_color" && t === "color")
451
- return w("6.9", s);
451
+ return b("6.9", s);
452
452
  }
453
453
  switch (e) {
454
454
  case "web_app_open_tg_link":
@@ -457,27 +457,27 @@ function x(e, t, s) {
457
457
  case "web_app_set_background_color":
458
458
  case "web_app_set_header_color":
459
459
  case "web_app_trigger_haptic_feedback":
460
- return w("6.1", t);
460
+ return b("6.1", t);
461
461
  case "web_app_open_popup":
462
- return w("6.2", t);
462
+ return b("6.2", t);
463
463
  case "web_app_close_scan_qr_popup":
464
464
  case "web_app_open_scan_qr_popup":
465
465
  case "web_app_read_text_from_clipboard":
466
- return w("6.4", t);
466
+ return b("6.4", t);
467
467
  case "web_app_switch_inline_query":
468
- return w("6.7", t);
468
+ return b("6.7", t);
469
469
  case "web_app_invoke_custom_method":
470
470
  case "web_app_request_write_access":
471
471
  case "web_app_request_phone":
472
- return w("6.9", t);
472
+ return b("6.9", t);
473
473
  case "web_app_setup_settings_button":
474
- return w("6.10", t);
474
+ return b("6.10", t);
475
475
  case "web_app_biometry_get_info":
476
476
  case "web_app_biometry_open_settings":
477
477
  case "web_app_biometry_request_access":
478
478
  case "web_app_biometry_request_auth":
479
479
  case "web_app_biometry_update_token":
480
- return w("7.2", t);
480
+ return b("7.2", t);
481
481
  default:
482
482
  return [
483
483
  "iframe_ready",
@@ -494,79 +494,79 @@ function x(e, t, s) {
494
494
  ].includes(e);
495
495
  }
496
496
  }
497
- function Ce(e) {
498
- return "external" in e && D(e.external) && "notify" in e.external && typeof e.external.notify == "function";
497
+ function Tt(e) {
498
+ return "external" in e && N(e.external) && "notify" in e.external && typeof e.external.notify == "function";
499
499
  }
500
- function Pt(e) {
501
- return "TelegramWebviewProxy" in e && D(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
500
+ function Rt(e) {
501
+ return "TelegramWebviewProxy" in e && N(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
502
502
  }
503
- function xt() {
503
+ function st() {
504
504
  try {
505
505
  return window.self !== window.top;
506
506
  } catch {
507
507
  return !0;
508
508
  }
509
509
  }
510
- let Ct = "https://web.telegram.org";
510
+ let At = "https://web.telegram.org";
511
511
  function Fs(e) {
512
- Ct = e;
512
+ At = e;
513
513
  }
514
- function Se() {
515
- return Ct;
514
+ function Re() {
515
+ return At;
516
516
  }
517
- function k(e, t, s) {
517
+ function q(e, t, s) {
518
518
  let n = {}, r;
519
519
  t === void 0 && s === void 0 ? n = {} : t !== void 0 && s !== void 0 ? (n = s, r = t) : t !== void 0 && ("targetOrigin" in t ? n = t : r = t);
520
- const { targetOrigin: i = Se() } = n;
521
- if (ie("Posting event:", r ? { event: e, data: r } : { event: e }), xt()) {
520
+ const { targetOrigin: i = Re() } = n;
521
+ if (pe("Posting event:", r ? { event: e, data: r } : { event: e }), st()) {
522
522
  window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
523
523
  return;
524
524
  }
525
- if (Ce(window)) {
525
+ if (Tt(window)) {
526
526
  window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
527
527
  return;
528
528
  }
529
- if (Pt(window)) {
529
+ if (Rt(window)) {
530
530
  window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
531
531
  return;
532
532
  }
533
- throw b(
534
- ce,
533
+ throw m(
534
+ le,
535
535
  "Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside of Telegram application environment."
536
536
  );
537
537
  }
538
- function Re(e) {
538
+ function Ae(e) {
539
539
  return (t, s) => {
540
540
  if (!x(t, e))
541
- throw b(oe, `Method "${t}" is unsupported in Mini Apps version ${e}`);
542
- if (D(s)) {
541
+ throw m(ue, `Method "${t}" is unsupported in Mini Apps version ${e}`);
542
+ if (N(s)) {
543
543
  let n;
544
544
  if (t === "web_app_open_link" && "try_instant_view" in s ? n = "try_instant_view" : t === "web_app_set_header_color" && "color" in s && (n = "color"), n && !x(t, n, e))
545
- throw b(
546
- ae,
545
+ throw m(
546
+ de,
547
547
  `Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
548
548
  );
549
549
  }
550
- return k(t, s);
550
+ return q(t, s);
551
551
  };
552
552
  }
553
- function St(e) {
553
+ function It(e) {
554
554
  return ({ req_id: t }) => t === e;
555
555
  }
556
- function Rt(e) {
557
- return b(pe, `Timeout reached: ${e}ms`);
556
+ function Ot(e) {
557
+ return m(ge, `Timeout reached: ${e}ms`);
558
558
  }
559
- function Tt(e, t) {
559
+ function qt(e, t) {
560
560
  return Promise.race([
561
561
  typeof e == "function" ? e() : e,
562
562
  new Promise((s, n) => {
563
563
  setTimeout(() => {
564
- n(Rt(t));
564
+ n(Ot(t));
565
565
  }, t);
566
566
  })
567
567
  ]);
568
568
  }
569
- async function m(e) {
569
+ async function w(e) {
570
570
  let t;
571
571
  const s = new Promise((u) => {
572
572
  t = u;
@@ -574,13 +574,13 @@ async function m(e) {
574
574
  method: n,
575
575
  event: r,
576
576
  capture: i,
577
- postEvent: o = k,
577
+ postEvent: o = q,
578
578
  timeout: a
579
579
  } = e, h = (Array.isArray(r) ? r : [r]).map(
580
- (u) => v(u, (l) => (!i || i(l)) && t(l))
580
+ (u) => v(u, (d) => (!i || i(d)) && t(d))
581
581
  );
582
582
  try {
583
- return o(n, e.params), await (a ? Tt(s, a) : s);
583
+ return o(n, e.params), await (a ? qt(s, a) : s);
584
584
  } finally {
585
585
  h.forEach((u) => u());
586
586
  }
@@ -589,7 +589,7 @@ async function A(e, t, s, n = {}) {
589
589
  const {
590
590
  result: r,
591
591
  error: i
592
- } = await m({
592
+ } = await w({
593
593
  ...n,
594
594
  method: "web_app_invoke_custom_method",
595
595
  event: "custom_method_invoked",
@@ -598,30 +598,30 @@ async function A(e, t, s, n = {}) {
598
598
  params: t,
599
599
  req_id: s
600
600
  },
601
- capture: St(s)
601
+ capture: It(s)
602
602
  });
603
603
  if (i)
604
- throw b(he, i);
604
+ throw m(_e, i);
605
605
  return r;
606
606
  }
607
- function Y(...e) {
607
+ function Z(...e) {
608
608
  return e.map((t) => {
609
609
  if (typeof t == "string")
610
610
  return t;
611
- if (D(t))
612
- return Y(Object.entries(t).map((s) => s[1] && s[0]));
611
+ if (N(t))
612
+ return Z(Object.entries(t).map((s) => s[1] && s[0]));
613
613
  if (Array.isArray(t))
614
- return Y(...t);
614
+ return Z(...t);
615
615
  }).filter(Boolean).join(" ");
616
616
  }
617
617
  function Qs(...e) {
618
- return e.reduce((t, s) => (D(s) && Object.entries(s).forEach(([n, r]) => {
619
- const i = Y(t[n], r);
618
+ return e.reduce((t, s) => (N(s) && Object.entries(s).forEach(([n, r]) => {
619
+ const i = Z(t[n], r);
620
620
  i.length && (t[n] = i);
621
621
  }), t), {});
622
622
  }
623
- function At(e) {
624
- const t = yt(e);
623
+ function kt(e) {
624
+ const t = xt(e);
625
625
  return Math.sqrt(
626
626
  [0.299, 0.587, 0.114].reduce((s, n, r) => {
627
627
  const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
@@ -629,7 +629,7 @@ function At(e) {
629
629
  }, 0)
630
630
  ) < 120;
631
631
  }
632
- class Te {
632
+ class Ie {
633
633
  constructor(t) {
634
634
  c(this, "ee", new O()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
635
635
  }
@@ -650,25 +650,25 @@ class Te {
650
650
  return this.state[t];
651
651
  }
652
652
  }
653
- class et {
653
+ class nt {
654
654
  constructor(t) {
655
- c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new Te(t), this.set = this.state.set.bind(this.state), this.get = this.state.get.bind(this.state), this.clone = this.state.clone.bind(this.state);
655
+ c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new Ie(t), this.set = this.state.set.bind(this.state), this.get = this.state.get.bind(this.state), this.clone = this.state.clone.bind(this.state);
656
656
  }
657
657
  }
658
- function It(e, t) {
658
+ function Nt(e, t) {
659
659
  return (s) => x(t[s], e);
660
660
  }
661
- class st extends et {
661
+ class rt extends nt {
662
662
  constructor(t, s, n) {
663
- super(t), c(this, "supports"), this.supports = It(s, n);
663
+ super(t), c(this, "supports"), this.supports = Nt(s, n);
664
664
  }
665
665
  }
666
- class Ae extends st {
666
+ class Oe extends rt {
667
667
  constructor(t, s, n) {
668
668
  super({ isVisible: t }, s, {
669
669
  show: "web_app_setup_back_button",
670
670
  hide: "web_app_setup_back_button"
671
- }), c(this, "on", (r, i) => r === "click" ? v("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? H("back_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
671
+ }), c(this, "on", (r, i) => r === "click" ? v("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? U("back_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
672
672
  }
673
673
  set isVisible(t) {
674
674
  this.set("isVisible", t), this.postEvent("web_app_setup_back_button", { is_visible: t });
@@ -692,19 +692,19 @@ class Ae extends st {
692
692
  this.isVisible = !0;
693
693
  }
694
694
  }
695
- const Ot = R((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
696
- function nt(e, t) {
695
+ const Dt = T((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
696
+ function it(e, t) {
697
697
  return new L((s) => {
698
698
  if (typeof s != "string" && !(s instanceof URLSearchParams))
699
699
  throw S();
700
700
  const n = typeof s == "string" ? new URLSearchParams(s) : s;
701
- return vt(e, (r) => {
701
+ return Pt(e, (r) => {
702
702
  const i = n.get(r);
703
703
  return i === null ? void 0 : i;
704
704
  });
705
705
  }, !1, t);
706
706
  }
707
- const Ie = f({
707
+ const qe = f({
708
708
  id: P(),
709
709
  type: p(),
710
710
  title: p(),
@@ -713,7 +713,7 @@ const Ie = f({
713
713
  from: "photo_url"
714
714
  },
715
715
  username: p().optional()
716
- }, "Chat").optional(), lt = f({
716
+ }, "Chat").optional(), gt = f({
717
717
  addedToAttachmentMenu: {
718
718
  type: y().optional(),
719
719
  from: "added_to_attachment_menu"
@@ -749,17 +749,17 @@ const Ie = f({
749
749
  },
750
750
  username: p().optional()
751
751
  }, "User").optional();
752
- function kt() {
753
- return nt({
752
+ function Vt() {
753
+ return it({
754
754
  authDate: {
755
- type: Ot(),
755
+ type: Dt(),
756
756
  from: "auth_date"
757
757
  },
758
758
  canSendAfter: {
759
759
  type: P().optional(),
760
760
  from: "can_send_after"
761
761
  },
762
- chat: Ie,
762
+ chat: qe,
763
763
  chatInstance: {
764
764
  type: p().optional(),
765
765
  from: "chat_instance"
@@ -773,35 +773,35 @@ function kt() {
773
773
  type: p().optional(),
774
774
  from: "query_id"
775
775
  },
776
- receiver: lt,
776
+ receiver: gt,
777
777
  startParam: {
778
778
  type: p().optional(),
779
779
  from: "start_param"
780
780
  },
781
- user: lt
781
+ user: gt
782
782
  }, "InitData");
783
783
  }
784
- function Oe(e) {
784
+ function ke(e) {
785
785
  return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
786
786
  }
787
- function ke(e) {
787
+ function Ne(e) {
788
788
  return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
789
789
  }
790
- const qt = R(
790
+ const Mt = T(
791
791
  (e) => {
792
- const t = Et().optional();
793
- return Object.entries(X(e)).reduce((s, [n, r]) => (s[Oe(n)] = t.parse(r), s), {});
792
+ const t = Ct().optional();
793
+ return Object.entries(tt(e)).reduce((s, [n, r]) => (s[ke(n)] = t.parse(r), s), {});
794
794
  },
795
795
  "ThemeParams"
796
796
  );
797
- function Dt(e) {
798
- return nt({
797
+ function ot(e) {
798
+ return it({
799
799
  botInline: {
800
800
  type: y().optional(),
801
801
  from: "tgWebAppBotInline"
802
802
  },
803
803
  initData: {
804
- type: kt().optional(),
804
+ type: Vt().optional(),
805
805
  from: "tgWebAppData"
806
806
  },
807
807
  initDataRaw: {
@@ -821,7 +821,7 @@ function Dt(e) {
821
821
  from: "tgWebAppStartParam"
822
822
  },
823
823
  themeParams: {
824
- type: qt(),
824
+ type: Mt(),
825
825
  from: "tgWebAppThemeParams"
826
826
  },
827
827
  version: {
@@ -830,47 +830,47 @@ function Dt(e) {
830
830
  }
831
831
  }).parse(e);
832
832
  }
833
- function Nt(e) {
834
- return Dt(
833
+ function Bt(e) {
834
+ return ot(
835
835
  e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
836
836
  );
837
837
  }
838
- function qe() {
839
- return Nt(window.location.href);
838
+ function De() {
839
+ return Bt(window.location.href);
840
840
  }
841
- function Vt() {
841
+ function $t() {
842
842
  return performance.getEntriesByType("navigation")[0];
843
843
  }
844
- function De() {
845
- const e = Vt();
844
+ function Ve() {
845
+ const e = $t();
846
846
  if (!e)
847
847
  throw new Error("Unable to get first navigation entry.");
848
- return Nt(e.name);
848
+ return Bt(e.name);
849
849
  }
850
- function Mt(e) {
850
+ function Lt(e) {
851
851
  return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
852
852
  }
853
- function Bt(e, t) {
854
- sessionStorage.setItem(Mt(e), JSON.stringify(t));
853
+ function Ht(e, t) {
854
+ sessionStorage.setItem(Lt(e), JSON.stringify(t));
855
855
  }
856
- function $t(e) {
857
- const t = sessionStorage.getItem(Mt(e));
856
+ function Ut(e) {
857
+ const t = sessionStorage.getItem(Lt(e));
858
858
  try {
859
859
  return t ? JSON.parse(t) : void 0;
860
860
  } catch {
861
861
  }
862
862
  }
863
- function Ne() {
864
- return Dt($t("launchParams") || "");
863
+ function Me() {
864
+ return ot(Ut("launchParams") || "");
865
865
  }
866
- function Ve(e) {
866
+ function Wt(e) {
867
867
  return JSON.stringify(
868
868
  Object.fromEntries(
869
- Object.entries(e).map(([t, s]) => [ke(t), s])
869
+ Object.entries(e).map(([t, s]) => [Ne(t), s])
870
870
  )
871
871
  );
872
872
  }
873
- function Me(e) {
873
+ function Be(e) {
874
874
  const {
875
875
  initDataRaw: t,
876
876
  themeParams: s,
@@ -880,56 +880,56 @@ function Me(e) {
880
880
  startParam: o,
881
881
  botInline: a
882
882
  } = e, h = new URLSearchParams();
883
- return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams", Ve(s)), h.set("tgWebAppVersion", r), t && h.set("tgWebAppData", t), o && h.set("tgWebAppStartParam", o), typeof i == "boolean" && h.set("tgWebAppShowSettings", i ? "1" : "0"), typeof a == "boolean" && h.set("tgWebAppBotInline", a ? "1" : "0"), h.toString();
883
+ return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams", Wt(s)), h.set("tgWebAppVersion", r), t && h.set("tgWebAppData", t), o && h.set("tgWebAppStartParam", o), typeof i == "boolean" && h.set("tgWebAppShowSettings", i ? "1" : "0"), typeof a == "boolean" && h.set("tgWebAppBotInline", a ? "1" : "0"), h.toString();
884
884
  }
885
- function Be(e) {
886
- Bt("launchParams", Me(e));
885
+ function jt(e) {
886
+ Ht("launchParams", Be(e));
887
887
  }
888
888
  function $e() {
889
889
  for (const e of [
890
890
  // Try to retrieve launch parameters from the current location. This method can return
891
891
  // nothing in case, location was changed and then page was reloaded.
892
- qe,
893
- // Then, try using the lower level API - window.performance.
894
892
  De,
893
+ // Then, try using the lower level API - window.performance.
894
+ Ve,
895
895
  // Finally, try to extract launch parameters from the session storage.
896
- Ne
896
+ Me
897
897
  ])
898
898
  try {
899
899
  const t = e();
900
- return Be(t), t;
900
+ return jt(t), t;
901
901
  } catch {
902
902
  }
903
903
  throw new Error("Unable to retrieve launch parameters from any known source.");
904
904
  }
905
- function Lt() {
906
- const e = Vt();
905
+ function Gt() {
906
+ const e = $t();
907
907
  return !!(e && e.type === "reload");
908
908
  }
909
909
  function Le() {
910
910
  let e = 0;
911
911
  return () => (e += 1).toString();
912
912
  }
913
- const [Ue] = ft(Le);
914
- function d(e, t) {
913
+ const [He] = bt(Le);
914
+ function l(e, t) {
915
915
  return () => {
916
916
  const s = $e(), n = {
917
917
  ...s,
918
- postEvent: Re(s.version),
919
- createRequestId: Ue()
918
+ postEvent: Ae(s.version),
919
+ createRequestId: He()
920
920
  };
921
921
  if (typeof e == "function")
922
922
  return e(n);
923
- const [r, i, o] = bt(), a = t({
923
+ const [r, i, o] = yt(), a = t({
924
924
  ...n,
925
925
  // State should only be passed only in case, current page was reloaded. If we don't add
926
926
  // this check, state restoration will work improperly in the web version of Telegram,
927
927
  // when we are always working in the same "session" (tab).
928
- state: Lt() ? $t(e) : void 0,
928
+ state: Gt() ? Ut(e) : void 0,
929
929
  addCleanup: r
930
930
  }), h = (u) => (o || r(
931
- u.on("change", (l) => {
932
- Bt(e, l);
931
+ u.on("change", (d) => {
932
+ Ht(e, d);
933
933
  })
934
934
  ), u);
935
935
  return [
@@ -938,17 +938,17 @@ function d(e, t) {
938
938
  ];
939
939
  };
940
940
  }
941
- const He = d("backButton", ({
941
+ const Ue = l("backButton", ({
942
942
  postEvent: e,
943
943
  version: t,
944
944
  state: s = { isVisible: !1 }
945
- }) => new Ae(s.isVisible, t, e));
946
- class N extends st {
945
+ }) => new Oe(s.isVisible, t, e));
946
+ class D extends rt {
947
947
  constructor() {
948
948
  super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
949
949
  }
950
950
  }
951
- function Ut(e) {
951
+ function Kt(e) {
952
952
  const t = e.available ? e : {
953
953
  available: !1,
954
954
  device_id: "",
@@ -966,7 +966,7 @@ function Ut(e) {
966
966
  accessGranted: t.access_granted
967
967
  };
968
968
  }
969
- class We extends N {
969
+ class We extends D {
970
970
  constructor({ postEvent: t, version: s, ...n }) {
971
971
  super(n, s, {
972
972
  auth: "web_app_biometry_request_auth",
@@ -1003,7 +1003,7 @@ class We extends N {
1003
1003
  reason: t,
1004
1004
  ...s
1005
1005
  }) {
1006
- return this.authPromise || (this.authPromise = m({
1006
+ return this.authPromise || (this.authPromise = w({
1007
1007
  ...s,
1008
1008
  method: "web_app_biometry_request_auth",
1009
1009
  event: "biometry_auth_requested",
@@ -1037,14 +1037,14 @@ class We extends N {
1037
1037
  * @returns Promise with true, if access was granted.
1038
1038
  */
1039
1039
  requestAccess({ reason: t, ...s } = {}) {
1040
- return this.accessPromise || (this.accessPromise = m({
1040
+ return this.accessPromise || (this.accessPromise = w({
1041
1041
  ...s,
1042
1042
  postEvent: this.postEvent,
1043
1043
  method: "web_app_biometry_request_access",
1044
1044
  event: "biometry_info_received",
1045
1045
  params: { reason: t || "" }
1046
1046
  }).then((n) => {
1047
- const r = Ut(n);
1047
+ const r = Kt(n);
1048
1048
  return this.set(r), r.accessGranted;
1049
1049
  }).finally(() => this.accessPromise = void 0)), this.accessPromise;
1050
1050
  }
@@ -1066,7 +1066,7 @@ class We extends N {
1066
1066
  */
1067
1067
  async updateToken({ token: t, ...s } = {}) {
1068
1068
  return ["removed", "updated"].includes(
1069
- (await m({
1069
+ (await w({
1070
1070
  ...s,
1071
1071
  postEvent: this.postEvent,
1072
1072
  method: "web_app_biometry_update_token",
@@ -1077,15 +1077,15 @@ class We extends N {
1077
1077
  }
1078
1078
  }
1079
1079
  async function je(e) {
1080
- return Ut(
1081
- await m({
1080
+ return Kt(
1081
+ await w({
1082
1082
  ...e || {},
1083
1083
  method: "web_app_biometry_get_info",
1084
1084
  event: "biometry_info_received"
1085
1085
  })
1086
1086
  );
1087
1087
  }
1088
- const Ge = d(
1088
+ const Ge = l(
1089
1089
  "biometryManager",
1090
1090
  async ({ postEvent: e, version: t, state: s }) => new We({
1091
1091
  ...s || x("web_app_biometry_get_info", t) ? s || await je({ timeout: 1e3 }) : {
@@ -1099,12 +1099,12 @@ const Ge = d(
1099
1099
  postEvent: e
1100
1100
  })
1101
1101
  );
1102
- class rt extends et {
1102
+ class at extends nt {
1103
1103
  constructor() {
1104
1104
  super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
1105
1105
  }
1106
1106
  }
1107
- class Ke extends rt {
1107
+ class Ke extends at {
1108
1108
  constructor(t, s) {
1109
1109
  super({ isConfirmationNeeded: t }), this.postEvent = s;
1110
1110
  }
@@ -1131,16 +1131,16 @@ class Ke extends rt {
1131
1131
  this.isConfirmationNeeded = !0;
1132
1132
  }
1133
1133
  }
1134
- const ze = d(
1134
+ const ze = l(
1135
1135
  "closingBehavior",
1136
1136
  ({
1137
1137
  postEvent: e,
1138
1138
  state: t = { isConfirmationNeeded: !1 }
1139
1139
  }) => new Ke(t.isConfirmationNeeded, e)
1140
1140
  );
1141
- class it {
1141
+ class ct {
1142
1142
  constructor(t, s) {
1143
- c(this, "supports"), this.supports = It(t, s);
1143
+ c(this, "supports"), this.supports = Nt(t, s);
1144
1144
  }
1145
1145
  }
1146
1146
  function Je(e) {
@@ -1176,10 +1176,10 @@ class Fe extends L {
1176
1176
  function Qe(e) {
1177
1177
  return new Fe((t) => t, !1, e);
1178
1178
  }
1179
- function dt(e, t) {
1179
+ function ft(e, t) {
1180
1180
  return Object.fromEntries(e.map((s) => [s, t]));
1181
1181
  }
1182
- class Ye extends it {
1182
+ class Ye extends ct {
1183
1183
  constructor(t, s, n) {
1184
1184
  super(t, {
1185
1185
  delete: "web_app_invoke_custom_method",
@@ -1219,13 +1219,13 @@ class Ye extends it {
1219
1219
  async get(t, s = {}) {
1220
1220
  const n = Array.isArray(t) ? t : [t];
1221
1221
  if (!n.length)
1222
- return dt(n, "");
1222
+ return ft(n, "");
1223
1223
  const r = await A(
1224
1224
  "getStorageValues",
1225
1225
  { keys: n },
1226
1226
  this.createRequestId(),
1227
1227
  { ...s, postEvent: this.postEvent }
1228
- ), i = f(dt(n, p()), "CloudStorageData").parse(r);
1228
+ ), i = f(ft(n, p()), "CloudStorageData").parse(r);
1229
1229
  return Array.isArray(t) ? i : i[t];
1230
1230
  }
1231
1231
  /**
@@ -1243,10 +1243,10 @@ class Ye extends it {
1243
1243
  );
1244
1244
  }
1245
1245
  }
1246
- const Ze = d(
1246
+ const Ze = l(
1247
1247
  ({ createRequestId: e, postEvent: t, version: s }) => new Ye(s, e, t)
1248
1248
  );
1249
- class Xe extends it {
1249
+ class Xe extends ct {
1250
1250
  constructor(t, s) {
1251
1251
  super(t, {
1252
1252
  impactOccurred: "web_app_trigger_haptic_feedback",
@@ -1288,7 +1288,7 @@ class Xe extends it {
1288
1288
  this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
1289
1289
  }
1290
1290
  }
1291
- const ts = d(
1291
+ const ts = l(
1292
1292
  ({ version: e, postEvent: t }) => new Xe(e, t)
1293
1293
  );
1294
1294
  class es {
@@ -1364,13 +1364,13 @@ class es {
1364
1364
  return this.initData.user;
1365
1365
  }
1366
1366
  }
1367
- const ss = d(
1367
+ const ss = l(
1368
1368
  ({ initData: e }) => e ? new es(e) : void 0
1369
1369
  );
1370
1370
  function Ys(e) {
1371
- return kt().parse(e);
1371
+ return Vt().parse(e);
1372
1372
  }
1373
- class ns extends N {
1373
+ class ns extends D {
1374
1374
  constructor(t, s, n) {
1375
1375
  super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
1376
1376
  }
@@ -1400,7 +1400,7 @@ class ns extends N {
1400
1400
  }
1401
1401
  this.isOpened = !0;
1402
1402
  try {
1403
- return (await m({
1403
+ return (await w({
1404
1404
  method: "web_app_open_invoice",
1405
1405
  event: "invoice_closed",
1406
1406
  params: { slug: n },
@@ -1414,12 +1414,12 @@ class ns extends N {
1414
1414
  }
1415
1415
  }
1416
1416
  }
1417
- const rs = d(
1417
+ const rs = l(
1418
1418
  ({ version: e, postEvent: t }) => new ns(!1, e, t)
1419
1419
  );
1420
- class is extends et {
1420
+ class is extends nt {
1421
1421
  constructor({ postEvent: t, ...s }) {
1422
- super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? v("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? H("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
1422
+ super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? v("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? U("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
1423
1423
  }
1424
1424
  /**
1425
1425
  * The MainButton background color.
@@ -1548,7 +1548,7 @@ class is extends et {
1548
1548
  return this.get("textColor");
1549
1549
  }
1550
1550
  }
1551
- const os = d(
1551
+ const os = l(
1552
1552
  "mainButton",
1553
1553
  ({
1554
1554
  postEvent: e,
@@ -1564,7 +1564,7 @@ const os = d(
1564
1564
  }) => new is({ ...s, postEvent: e })
1565
1565
  );
1566
1566
  function as() {
1567
- return nt({
1567
+ return it({
1568
1568
  contact: f({
1569
1569
  userId: {
1570
1570
  type: P(),
@@ -1584,13 +1584,13 @@ function as() {
1584
1584
  }
1585
1585
  }),
1586
1586
  authDate: {
1587
- type: Ot(),
1587
+ type: Dt(),
1588
1588
  from: "auth_date"
1589
1589
  },
1590
1590
  hash: p()
1591
1591
  }, "RequestedContact");
1592
1592
  }
1593
- function Ht(e, t) {
1593
+ function zt(e, t) {
1594
1594
  return (s) => {
1595
1595
  const [n, r] = t[s];
1596
1596
  return x(n, r, e);
@@ -1601,7 +1601,7 @@ function cs(e) {
1601
1601
  setTimeout(t, e);
1602
1602
  });
1603
1603
  }
1604
- class hs extends N {
1604
+ class hs extends D {
1605
1605
  constructor({ postEvent: t, createRequestId: s, version: n, botInline: r, ...i }) {
1606
1606
  super(i, n, {
1607
1607
  requestPhoneAccess: "web_app_request_phone",
@@ -1611,7 +1611,7 @@ class hs extends N {
1611
1611
  setBackgroundColor: "web_app_set_background_color"
1612
1612
  }), c(this, "botInline"), c(this, "postEvent"), c(this, "createRequestId"), c(this, "requestPhoneAccessPromise"), c(this, "requestWriteAccessPromise"), c(this, "supportsParam"), this.createRequestId = s, this.postEvent = t, this.botInline = r;
1613
1613
  const o = this.supports.bind(this);
1614
- this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = Ht(n, {
1614
+ this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = zt(n, {
1615
1615
  "setHeaderColor.color": ["web_app_set_header_color", "color"]
1616
1616
  });
1617
1617
  }
@@ -1662,7 +1662,7 @@ class hs extends N {
1662
1662
  * True if current Mini App background color is recognized as dark.
1663
1663
  */
1664
1664
  get isDark() {
1665
- return At(this.bgColor);
1665
+ return kt(this.bgColor);
1666
1666
  }
1667
1667
  /**
1668
1668
  * Informs the Telegram app that the Mini App is ready to be displayed.
@@ -1691,7 +1691,7 @@ class hs extends N {
1691
1691
  throw new Error("Access denied.");
1692
1692
  const s = Date.now() + t;
1693
1693
  let n = 50;
1694
- return Tt(async () => {
1694
+ return qt(async () => {
1695
1695
  for (; Date.now() < s; ) {
1696
1696
  try {
1697
1697
  return await this.getRequestedContact();
@@ -1699,7 +1699,7 @@ class hs extends N {
1699
1699
  }
1700
1700
  await cs(n), n += 50;
1701
1701
  }
1702
- throw Rt(t);
1702
+ throw Ot(t);
1703
1703
  }, t);
1704
1704
  }
1705
1705
  /**
@@ -1712,7 +1712,7 @@ class hs extends N {
1712
1712
  * @see requestContact
1713
1713
  */
1714
1714
  async requestPhoneAccess(t = {}) {
1715
- return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = m({
1715
+ return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = w({
1716
1716
  ...t,
1717
1717
  method: "web_app_request_phone",
1718
1718
  event: "phone_requested",
@@ -1724,7 +1724,7 @@ class hs extends N {
1724
1724
  * @param options - additional options.
1725
1725
  */
1726
1726
  async requestWriteAccess(t = {}) {
1727
- return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = m({
1727
+ return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = w({
1728
1728
  ...t,
1729
1729
  method: "web_app_request_write_access",
1730
1730
  event: "write_access_requested",
@@ -1754,7 +1754,7 @@ class hs extends N {
1754
1754
  * @param color - color key or RGB color.
1755
1755
  */
1756
1756
  setHeaderColor(t) {
1757
- this.postEvent("web_app_set_header_color", tt(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
1757
+ this.postEvent("web_app_set_header_color", et(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
1758
1758
  }
1759
1759
  /**
1760
1760
  * Updates current Mini App background color.
@@ -1782,7 +1782,7 @@ class hs extends N {
1782
1782
  this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
1783
1783
  }
1784
1784
  }
1785
- const ps = d(
1785
+ const ps = l(
1786
1786
  "miniApp",
1787
1787
  ({
1788
1788
  themeParams: e,
@@ -1818,7 +1818,7 @@ function us(e) {
1818
1818
  return { ...i, id: o };
1819
1819
  }) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
1820
1820
  }
1821
- class ls extends N {
1821
+ class ds extends D {
1822
1822
  constructor(t, s, n) {
1823
1823
  super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
1824
1824
  }
@@ -1847,7 +1847,7 @@ class ls extends N {
1847
1847
  throw new Error("Popup is already opened.");
1848
1848
  this.isOpened = !0;
1849
1849
  try {
1850
- const { button_id: s = null } = await m({
1850
+ const { button_id: s = null } = await w({
1851
1851
  event: "popup_closed",
1852
1852
  method: "web_app_open_popup",
1853
1853
  postEvent: this.postEvent,
@@ -1859,10 +1859,10 @@ class ls extends N {
1859
1859
  }
1860
1860
  }
1861
1861
  }
1862
- const ds = d(
1863
- ({ postEvent: e, version: t }) => new ls(!1, t, e)
1862
+ const ls = l(
1863
+ ({ postEvent: e, version: t }) => new ds(!1, t, e)
1864
1864
  );
1865
- class _s extends N {
1865
+ class _s extends D {
1866
1866
  constructor(t, s, n) {
1867
1867
  super({ isOpened: t }, s, {
1868
1868
  close: "web_app_close_scan_qr_popup",
@@ -1895,7 +1895,7 @@ class _s extends N {
1895
1895
  throw new Error("QR scanner is already opened.");
1896
1896
  this.isOpened = !0;
1897
1897
  try {
1898
- return (await m({
1898
+ return (await w({
1899
1899
  method: "web_app_open_scan_qr_popup",
1900
1900
  event: ["qr_text_received", "scan_qr_popup_closed"],
1901
1901
  postEvent: this.postEvent,
@@ -1906,15 +1906,15 @@ class _s extends N {
1906
1906
  }
1907
1907
  }
1908
1908
  }
1909
- const gs = d(
1909
+ const gs = l(
1910
1910
  ({ version: e, postEvent: t }) => new _s(!1, e, t)
1911
1911
  );
1912
- class fs extends st {
1912
+ class fs extends rt {
1913
1913
  constructor(t, s, n) {
1914
1914
  super({ isVisible: t }, s, {
1915
1915
  show: "web_app_setup_settings_button",
1916
1916
  hide: "web_app_setup_settings_button"
1917
- }), c(this, "on", (r, i) => r === "click" ? v("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? H("settings_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
1917
+ }), c(this, "on", (r, i) => r === "click" ? v("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? U("settings_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
1918
1918
  }
1919
1919
  set isVisible(t) {
1920
1920
  this.set("isVisible", t), this.postEvent("web_app_setup_settings_button", { is_visible: t });
@@ -1938,7 +1938,7 @@ class fs extends st {
1938
1938
  this.isVisible = !0;
1939
1939
  }
1940
1940
  }
1941
- const ms = d(
1941
+ const ws = l(
1942
1942
  "settingsButton",
1943
1943
  ({
1944
1944
  version: e,
@@ -1946,10 +1946,10 @@ const ms = d(
1946
1946
  state: s = { isVisible: !1 }
1947
1947
  }) => new fs(s.isVisible, e, t)
1948
1948
  );
1949
- function Wt(e) {
1950
- return qt().parse(e);
1949
+ function Jt(e) {
1950
+ return Mt().parse(e);
1951
1951
  }
1952
- class bs extends rt {
1952
+ class ms extends at {
1953
1953
  /**
1954
1954
  * @since v6.10
1955
1955
  */
@@ -1988,7 +1988,7 @@ class bs extends rt {
1988
1988
  * value is calculated according to theme bg color.
1989
1989
  */
1990
1990
  get isDark() {
1991
- return !this.bgColor || At(this.bgColor);
1991
+ return !this.bgColor || kt(this.bgColor);
1992
1992
  }
1993
1993
  get linkColor() {
1994
1994
  return this.get("linkColor");
@@ -2014,7 +2014,7 @@ class bs extends rt {
2014
2014
  */
2015
2015
  listen() {
2016
2016
  return v("theme_changed", (t) => {
2017
- this.set(Wt(t.theme_params));
2017
+ this.set(Jt(t.theme_params));
2018
2018
  });
2019
2019
  }
2020
2020
  /**
@@ -2027,23 +2027,23 @@ class bs extends rt {
2027
2027
  return this.get("textColor");
2028
2028
  }
2029
2029
  }
2030
- const ws = d(
2030
+ const bs = l(
2031
2031
  "themeParams",
2032
2032
  ({ themeParams: e, state: t = e, addCleanup: s }) => {
2033
- const n = new bs(t);
2033
+ const n = new ms(t);
2034
2034
  return s(n.listen()), n;
2035
2035
  }
2036
2036
  );
2037
2037
  function Zs(e = {}) {
2038
- return m({
2038
+ return w({
2039
2039
  ...e,
2040
2040
  method: "web_app_request_theme",
2041
2041
  event: "theme_changed"
2042
- }).then(Wt);
2042
+ }).then(Jt);
2043
2043
  }
2044
- class vs extends it {
2044
+ class vs extends ct {
2045
2045
  constructor(t, s, n) {
2046
- super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = Ht(t, {
2046
+ super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = zt(t, {
2047
2047
  "openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
2048
2048
  });
2049
2049
  }
@@ -2092,41 +2092,41 @@ class vs extends it {
2092
2092
  async readTextFromClipboard() {
2093
2093
  const t = this.createRequestId(), {
2094
2094
  data: s = null
2095
- } = await m({
2095
+ } = await w({
2096
2096
  method: "web_app_read_text_from_clipboard",
2097
2097
  event: "clipboard_text_received",
2098
2098
  postEvent: this.postEvent,
2099
2099
  params: { req_id: t },
2100
- capture: St(t)
2100
+ capture: It(t)
2101
2101
  });
2102
2102
  return s;
2103
2103
  }
2104
2104
  }
2105
- const ys = d(
2105
+ const ys = l(
2106
2106
  ({ version: e, postEvent: t, createRequestId: s }) => new vs(e, s, t)
2107
2107
  );
2108
- async function jt(e = {}) {
2108
+ async function Ft(e = {}) {
2109
2109
  const {
2110
2110
  is_expanded: t,
2111
2111
  is_state_stable: s,
2112
2112
  ...n
2113
- } = await m({
2113
+ } = await w({
2114
2114
  ...e,
2115
2115
  method: "web_app_request_viewport",
2116
2116
  event: "viewport_changed"
2117
2117
  });
2118
2118
  return { ...n, isExpanded: t, isStateStable: s };
2119
2119
  }
2120
- function T(e) {
2120
+ function R(e) {
2121
2121
  return e < 0 ? 0 : e;
2122
2122
  }
2123
- class Es extends rt {
2123
+ class Es extends at {
2124
2124
  constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
2125
2125
  super({
2126
- height: T(n),
2126
+ height: R(n),
2127
2127
  isExpanded: i,
2128
- stableHeight: T(s),
2129
- width: T(r)
2128
+ stableHeight: R(s),
2129
+ width: R(r)
2130
2130
  }), c(this, "postEvent"), this.postEvent = t;
2131
2131
  }
2132
2132
  /**
@@ -2135,7 +2135,7 @@ class Es extends rt {
2135
2135
  * @param options - options to request fresh data.
2136
2136
  */
2137
2137
  async sync(t) {
2138
- const { isStateStable: s, ...n } = await jt(t);
2138
+ const { isStateStable: s, ...n } = await Ft(t);
2139
2139
  this.set({
2140
2140
  ...n,
2141
2141
  stableHeight: s ? n.height : this.get("stableHeight")
@@ -2188,11 +2188,11 @@ class Es extends rt {
2188
2188
  width: n,
2189
2189
  is_expanded: r,
2190
2190
  is_state_stable: i
2191
- } = t, o = T(s);
2191
+ } = t, o = R(s);
2192
2192
  this.set({
2193
2193
  height: o,
2194
2194
  isExpanded: r,
2195
- width: T(n),
2195
+ width: R(n),
2196
2196
  ...i ? { stableHeight: o } : {}
2197
2197
  });
2198
2198
  });
@@ -2227,7 +2227,7 @@ class Es extends rt {
2227
2227
  return this.stableHeight === this.height;
2228
2228
  }
2229
2229
  }
2230
- const Ps = d(
2230
+ const Ps = l(
2231
2231
  "viewport",
2232
2232
  async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
2233
2233
  let r = !1, i = 0, o = 0, a = 0;
@@ -2236,7 +2236,7 @@ const Ps = d(
2236
2236
  else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
2237
2237
  r = !0, i = window.innerHeight, o = window.innerWidth, a = window.innerHeight;
2238
2238
  else {
2239
- const u = await jt({ timeout: 1e3, postEvent: s });
2239
+ const u = await Ft({ timeout: 1e3, postEvent: s });
2240
2240
  r = u.isExpanded, i = u.height, o = u.width, a = u.isStateStable ? i : 0;
2241
2241
  }
2242
2242
  const h = new Es({
@@ -2256,7 +2256,7 @@ function Xs(e, t, s) {
2256
2256
  s || (s = (a) => `--tg-${a}-color`);
2257
2257
  const n = s("header"), r = s("bg"), i = () => {
2258
2258
  const { headerColor: a } = e;
2259
- if (tt(a))
2259
+ if (et(a))
2260
2260
  E(n, a);
2261
2261
  else {
2262
2262
  const { bgColor: h, secondaryBgColor: u } = t;
@@ -2294,7 +2294,7 @@ function en(e, t) {
2294
2294
  function xs(e = !0) {
2295
2295
  const t = [
2296
2296
  v("reload_iframe", () => {
2297
- k("iframe_will_reload"), window.location.reload();
2297
+ q("iframe_will_reload"), window.location.reload();
2298
2298
  })
2299
2299
  ], s = () => t.forEach((n) => n());
2300
2300
  if (e) {
@@ -2306,24 +2306,64 @@ function xs(e = !0) {
2306
2306
  () => document.head.removeChild(n)
2307
2307
  );
2308
2308
  }
2309
- return k("iframe_ready", { reload_supported: !0 }), s;
2309
+ return q("iframe_ready", { reload_supported: !0 }), s;
2310
2310
  }
2311
2311
  function sn() {
2312
2312
  return typeof window > "u";
2313
2313
  }
2314
2314
  async function nn() {
2315
- if (Pt(window))
2315
+ if (Rt(window))
2316
2316
  return !0;
2317
2317
  try {
2318
- return await m({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
2318
+ return await w({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
2319
2319
  } catch {
2320
2320
  return !1;
2321
2321
  }
2322
2322
  }
2323
+ function rn(e) {
2324
+ const t = typeof e == "string" ? ot(e) : e;
2325
+ jt(t);
2326
+ function s(r) {
2327
+ if (typeof r == "string")
2328
+ try {
2329
+ const { eventType: i } = St(r);
2330
+ i === "web_app_request_theme" && Y("theme_changed", {
2331
+ theme_params: JSON.parse(Wt(t.themeParams))
2332
+ }), i === "web_app_request_viewport" && Y("viewport_changed", {
2333
+ width: window.innerWidth,
2334
+ height: window.innerHeight,
2335
+ is_state_stable: !0,
2336
+ is_expanded: !0
2337
+ });
2338
+ } catch {
2339
+ }
2340
+ }
2341
+ if (st()) {
2342
+ const r = window.parent.postMessage.bind(window.parent);
2343
+ window.parent.postMessage = (i) => {
2344
+ s(i), r(i);
2345
+ };
2346
+ return;
2347
+ }
2348
+ if (Tt(window)) {
2349
+ const r = window.external.notify.bind(window.external);
2350
+ window.external.notify = (i) => {
2351
+ s(i), r(i);
2352
+ };
2353
+ return;
2354
+ }
2355
+ const n = window.TelegramWebviewProxy;
2356
+ window.TelegramWebviewProxy = {
2357
+ ...n || {},
2358
+ postEvent(...r) {
2359
+ s(JSON.stringify({ eventType: r[0], eventData: r[1] })), n && n.postEvent(...r);
2360
+ }
2361
+ };
2362
+ }
2323
2363
  function Cs(e) {
2324
2364
  return e instanceof $;
2325
2365
  }
2326
- function rn(e, t) {
2366
+ function on(e, t) {
2327
2367
  return Cs(e) && e.type === t;
2328
2368
  }
2329
2369
  function j(e, t) {
@@ -2335,12 +2375,12 @@ function j(e, t) {
2335
2375
  });
2336
2376
  }
2337
2377
  class Ss {
2338
- constructor(t, s, n = k) {
2378
+ constructor(t, s, n = q) {
2339
2379
  if (c(this, "history"), c(this, "ee", new O()), c(this, "attached", !1), c(this, "back", () => this.go(-1)), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this._index = s, this.postEvent = n, t.length === 0)
2340
- throw b(le, "History should not be empty.");
2380
+ throw m(we, "History should not be empty.");
2341
2381
  if (s < 0 || s >= t.length)
2342
- throw b(
2343
- de,
2382
+ throw m(
2383
+ me,
2344
2384
  "Index should not be zero and higher or equal than history size."
2345
2385
  );
2346
2386
  this.history = t.map((r) => j(r, ""));
@@ -2362,7 +2402,7 @@ class Ss {
2362
2402
  * Prevents current navigator from controlling the BackButton visibility state.
2363
2403
  */
2364
2404
  detach() {
2365
- this.attached = !1, H("back_button_pressed", this.back);
2405
+ this.attached = !1, U("back_button_pressed", this.back);
2366
2406
  }
2367
2407
  /**
2368
2408
  * Goes to the next history item.
@@ -2461,12 +2501,12 @@ function G({
2461
2501
  }) {
2462
2502
  return { ...e || { hash: "", search: "" }, ...t };
2463
2503
  }
2464
- function q(e, t) {
2504
+ function k(e, t) {
2465
2505
  return e.startsWith(t) ? e : `${t}${e}`;
2466
2506
  }
2467
2507
  function M(e) {
2468
2508
  return new URL(
2469
- typeof e == "string" ? e : `${e.pathname || ""}${q(e.search || "", "?")}${q(e.hash || "", "#")}`,
2509
+ typeof e == "string" ? e : `${e.pathname || ""}${k(e.search || "", "?")}${k(e.hash || "", "#")}`,
2470
2510
  "http://a"
2471
2511
  );
2472
2512
  }
@@ -2477,7 +2517,7 @@ function B(e) {
2477
2517
  function K(e, t, s) {
2478
2518
  let n, r;
2479
2519
  typeof e == "string" ? n = e : (n = B(e), s = e.state, r = e.id);
2480
- const { pathname: i, search: o, hash: a } = new URL(n, `http://a${q(t, "/")}`);
2520
+ const { pathname: i, search: o, hash: a } = new URL(n, `http://a${k(t, "/")}`);
2481
2521
  return { id: r, pathname: i, params: { hash: a, search: o, state: s } };
2482
2522
  }
2483
2523
  async function I(e) {
@@ -2494,23 +2534,23 @@ async function I(e) {
2494
2534
  })
2495
2535
  ]);
2496
2536
  }
2497
- async function Rs() {
2537
+ async function Ts() {
2498
2538
  if (window.history.length <= 1 || (window.history.pushState(null, ""), await I(1 - window.history.length)))
2499
2539
  return;
2500
2540
  let e = await I(-1);
2501
2541
  for (; e; )
2502
2542
  e = await I(-1);
2503
2543
  }
2504
- function Gt(e) {
2544
+ function Qt(e) {
2505
2545
  return M(e).pathname;
2506
2546
  }
2507
- const _t = 0, z = 1, J = 2;
2508
- class Kt {
2547
+ const wt = 0, z = 1, J = 2;
2548
+ class Yt {
2509
2549
  constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
2510
2550
  c(this, "navigator"), c(this, "ee", new O()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
2511
2551
  if (o === null)
2512
2552
  return this.push(this.parsePath(window.location.href));
2513
- o === _t ? window.history.forward() : o === z && this.back(), o === J && this.forward();
2553
+ o === wt ? window.history.forward() : o === z && this.back(), o === J && this.forward();
2514
2554
  }), c(this, "onNavigatorChange", async ({
2515
2555
  to: o,
2516
2556
  from: a,
@@ -2526,7 +2566,7 @@ class Kt {
2526
2566
  t.map((o) => K(o, "/")),
2527
2567
  s,
2528
2568
  n
2529
- ), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = Gt(i || "");
2569
+ ), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = Qt(i || "");
2530
2570
  }
2531
2571
  /**
2532
2572
  * Attaches current navigator to the browser history allowing navigator to manipulate it.
@@ -2674,8 +2714,8 @@ class Kt {
2674
2714
  * @param value - path presented as string or URLLike.
2675
2715
  */
2676
2716
  renderPath(t) {
2677
- const s = (this.base.length === 1 ? "" : this.base) + q(B(t), "/");
2678
- return this.hashMode ? q(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
2717
+ const s = (this.base.length === 1 ? "" : this.base) + k(B(t), "/");
2718
+ return this.hashMode ? k(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
2679
2719
  }
2680
2720
  /**
2681
2721
  * Synchronizes current navigator state with browser history.
@@ -2683,7 +2723,7 @@ class Kt {
2683
2723
  async syncHistory() {
2684
2724
  window.removeEventListener("popstate", this.onPopState);
2685
2725
  const { state: t } = this, s = this.renderPath(this);
2686
- await Rs(), this.hasPrev && this.hasNext ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s), window.history.pushState(J, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(J, ""), await I(-1)) : (window.history.replaceState(_t, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
2726
+ await Ts(), this.hasPrev && this.hasNext ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s), window.history.pushState(J, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(J, ""), await I(-1)) : (window.history.replaceState(wt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
2687
2727
  }
2688
2728
  /**
2689
2729
  * Current query parameters.
@@ -2701,41 +2741,41 @@ class Kt {
2701
2741
  return (this.navigator.current.params || {}).state;
2702
2742
  }
2703
2743
  }
2704
- function Ts(e) {
2744
+ function Rs(e) {
2705
2745
  e || (e = {});
2706
2746
  const { href: t, hash: s } = window.location;
2707
2747
  let n = B(
2708
2748
  e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
2709
2749
  );
2710
- const r = e.base ? Gt(e.base) : void 0;
2750
+ const r = e.base ? Qt(e.base) : void 0;
2711
2751
  if (r) {
2712
2752
  if (!n.startsWith(r))
2713
- throw b(
2714
- _e,
2753
+ throw m(
2754
+ be,
2715
2755
  `Path "${n}" expected to be starting with "${r}"`
2716
2756
  );
2717
2757
  n = n.slice(r.length);
2718
2758
  }
2719
- return new Kt([n], 0, e);
2759
+ return new Yt([n], 0, e);
2720
2760
  }
2721
- function on(e) {
2761
+ function an(e) {
2722
2762
  const t = e.match(/#(.+)/);
2723
2763
  return t ? t[1] : null;
2724
2764
  }
2725
2765
  function As(e, t) {
2726
- if (Lt()) {
2766
+ if (Gt()) {
2727
2767
  const s = sessionStorage.getItem(e);
2728
2768
  if (s)
2729
2769
  try {
2730
2770
  const { index: n, history: r } = JSON.parse(s);
2731
- return new Kt(r, n, t);
2771
+ return new Yt(r, n, t);
2732
2772
  } catch (n) {
2733
2773
  console.error("Unable to restore hash navigator state.", n);
2734
2774
  }
2735
2775
  }
2736
- return Ts(t);
2776
+ return Rs(t);
2737
2777
  }
2738
- function an(e, t) {
2778
+ function cn(e, t) {
2739
2779
  const s = As(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2740
2780
  index: s.index,
2741
2781
  history: s.history
@@ -2743,13 +2783,13 @@ function an(e, t) {
2743
2783
  return s.on("change", n), n(), s;
2744
2784
  }
2745
2785
  function _(e) {
2746
- return (t, s, ...n) => (r) => gt(s, at(() => at({
2786
+ return (t, s, ...n) => (r) => mt(s, pt(() => pt({
2747
2787
  [t]: e(...n)
2748
2788
  }, r)));
2749
2789
  }
2750
- const zt = Qt();
2790
+ const Zt = ee();
2751
2791
  function Is() {
2752
- const e = Yt(zt);
2792
+ const e = se(Zt);
2753
2793
  if (!e)
2754
2794
  throw new Error("useSDK was used outside of SDKProvider.");
2755
2795
  return e;
@@ -2760,38 +2800,38 @@ function g(e) {
2760
2800
  return Object.defineProperty(n, "error", () => s.error), n;
2761
2801
  };
2762
2802
  }
2763
- const Os = g(He), cn = _(Os), ks = g(Ge), hn = _(ks), qs = g(ze), pn = _(qs), Ds = g(Ze), un = _(Ds), Ns = g(ts), ln = _(Ns), Vs = g(ss), dn = _(Vs), Ms = g(rs), _n = _(Ms), Bs = g(os), gn = _(Bs), $s = g(ps), fn = _($s), Ls = g(ds), mn = _(Ls), Us = g(gs), bn = _(Us), Hs = g(ms), wn = _(Hs), Ws = g(ws), vn = _(Ws), js = g(ys), yn = _(js), Gs = g(Ps), En = _(Gs), Pn = (e) => {
2803
+ const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns = g(Ze), dn = _(Ns), Ds = g(ts), ln = _(Ds), Vs = g(ss), _n = _(Vs), Ms = g(rs), gn = _(Ms), Bs = g(os), fn = _(Bs), $s = g(ps), wn = _($s), Ls = g(ls), mn = _(Ls), Hs = g(gs), bn = _(Hs), Us = g(ws), vn = _(Us), Ws = g(bs), yn = _(Ws), js = g(ys), En = _(js), Gs = g(Ps), Pn = _(Gs), xn = (e) => {
2764
2804
  const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
2765
2805
  if (t.has(n))
2766
2806
  return t.get(n);
2767
- function i(l) {
2768
- return t.set(n, l), l;
2807
+ function i(d) {
2808
+ return t.set(n, d), d;
2769
2809
  }
2770
2810
  let o;
2771
2811
  try {
2772
2812
  o = n(...r);
2773
- } catch (l) {
2813
+ } catch (d) {
2774
2814
  return i({
2775
- error: l,
2815
+ error: d,
2776
2816
  signal: () => {
2777
- throw l;
2817
+ throw d;
2778
2818
  }
2779
2819
  });
2780
2820
  }
2781
2821
  let a;
2782
2822
  Array.isArray(o) && ([o, a] = o);
2783
- const [h] = Zt(() => o), u = pt(() => {
2823
+ const [h] = ne(() => o), u = lt(() => {
2784
2824
  if (h.state !== "ready")
2785
2825
  return;
2786
- const l = h();
2787
- if (!l || !("on" in l))
2788
- return l;
2789
- const Jt = Xt((V) => (V(l), l.on("change", () => V(l)))), Ft = Object.getPrototypeOf(l), W = {};
2790
- return new Proxy(l, {
2826
+ const d = h();
2827
+ if (!d || !("on" in d))
2828
+ return d;
2829
+ const Xt = re((V) => (V(d), d.on("change", () => V(d)))), te = Object.getPrototypeOf(d), W = {};
2830
+ return new Proxy(d, {
2791
2831
  get(V, C) {
2792
2832
  if (!(C in W)) {
2793
- const ot = Reflect.getOwnPropertyDescriptor(Ft, C);
2794
- W[C] = ot && "get" in ot ? pt(() => Jt()[C]) : () => Reflect.get(V, C);
2833
+ const ht = Reflect.getOwnPropertyDescriptor(te, C);
2834
+ W[C] = ht && "get" in ht ? lt(() => Xt()[C]) : () => Reflect.get(V, C);
2795
2835
  }
2796
2836
  return W[C]();
2797
2837
  }
@@ -2809,13 +2849,13 @@ const Os = g(He), cn = _(Os), ks = g(Ge), hn = _(ks), qs = g(ze), pn = _(qs), Ds
2809
2849
  cleanup: a
2810
2850
  });
2811
2851
  };
2812
- return ct(() => {
2813
- re(e.debug || !1);
2814
- }), ct(() => {
2815
- xt() && ht(xs(e.acceptCustomStyles));
2816
- }), ht(() => {
2852
+ return ut(() => {
2853
+ he(e.debug || !1);
2854
+ }), ut(() => {
2855
+ st() && dt(xs(e.acceptCustomStyles));
2856
+ }), dt(() => {
2817
2857
  t.forEach((n) => n.cleanup && n.cleanup());
2818
- }), gt(zt.Provider, {
2858
+ }), mt(Zt.Provider, {
2819
2859
  value: s,
2820
2860
  get children() {
2821
2861
  return e.children;
@@ -2823,36 +2863,36 @@ const Os = g(He), cn = _(Os), ks = g(Ge), hn = _(ks), qs = g(ze), pn = _(qs), Ds
2823
2863
  });
2824
2864
  };
2825
2865
  export {
2826
- Ae as BackButton,
2866
+ Oe as BackButton,
2827
2867
  Ss as BasicNavigator,
2828
2868
  We as BiometryManager,
2829
- Kt as BrowserNavigator,
2869
+ Yt as BrowserNavigator,
2830
2870
  Ke as ClosingBehavior,
2831
2871
  Ye as CloudStorage,
2832
- _e as ERR_INVALID_PATH_BASE,
2833
- he as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
2834
- ae as ERR_METHOD_PARAMETER_UNSUPPORTED,
2835
- oe as ERR_METHOD_UNSUPPORTED,
2836
- le as ERR_NAVIGATION_HISTORY_EMPTY,
2837
- de as ERR_NAVIGATION_INDEX_INVALID,
2872
+ be as ERR_INVALID_PATH_BASE,
2873
+ _e as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
2874
+ de as ERR_METHOD_PARAMETER_UNSUPPORTED,
2875
+ ue as ERR_METHOD_UNSUPPORTED,
2876
+ we as ERR_NAVIGATION_HISTORY_EMPTY,
2877
+ me as ERR_NAVIGATION_INDEX_INVALID,
2838
2878
  zs as ERR_NAVIGATION_ITEM_INVALID,
2839
- wt as ERR_PARSE,
2879
+ Et as ERR_PARSE,
2840
2880
  Js as ERR_SSR_INIT,
2841
- pe as ERR_TIMED_OUT,
2842
- ue as ERR_UNEXPECTED_TYPE,
2843
- ce as ERR_UNKNOWN_ENV,
2881
+ ge as ERR_TIMED_OUT,
2882
+ fe as ERR_UNEXPECTED_TYPE,
2883
+ le as ERR_UNKNOWN_ENV,
2844
2884
  O as EventEmitter,
2845
2885
  Xe as HapticFeedback,
2846
2886
  es as InitData,
2847
2887
  ns as Invoice,
2848
2888
  is as MainButton,
2849
2889
  hs as MiniApp,
2850
- ls as Popup,
2890
+ ds as Popup,
2851
2891
  _s as QRScanner,
2852
2892
  $ as SDKError,
2853
- Pn as SDKProvider,
2893
+ xn as SDKProvider,
2854
2894
  fs as SettingsButton,
2855
- bs as ThemeParams,
2895
+ ms as ThemeParams,
2856
2896
  vs as Utils,
2857
2897
  Es as Viewport,
2858
2898
  Qe as array,
@@ -2860,16 +2900,16 @@ export {
2860
2900
  tn as bindThemeParamsCSSVars,
2861
2901
  en as bindViewportCSSVars,
2862
2902
  y as boolean,
2863
- St as captureSameReq,
2864
- Y as classNames,
2865
- xe as compareVersions,
2866
- Ts as createBrowserNavigatorFromLocation,
2867
- Re as createPostEvent,
2903
+ It as captureSameReq,
2904
+ Z as classNames,
2905
+ Te as compareVersions,
2906
+ Rs as createBrowserNavigatorFromLocation,
2907
+ Ae as createPostEvent,
2868
2908
  M as createSafeURL,
2869
- Ot as date,
2870
- on as getHash,
2871
- Gt as getPathname,
2872
- He as initBackButton,
2909
+ Dt as date,
2910
+ an as getHash,
2911
+ Qt as getPathname,
2912
+ Ue as initBackButton,
2873
2913
  Ge as initBiometryManager,
2874
2914
  ze as initClosingBehavior,
2875
2915
  Ze as initCloudStorage,
@@ -2878,83 +2918,84 @@ export {
2878
2918
  rs as initInvoice,
2879
2919
  os as initMainButton,
2880
2920
  ps as initMiniApp,
2881
- an as initNavigator,
2882
- ds as initPopup,
2921
+ cn as initNavigator,
2922
+ ls as initPopup,
2883
2923
  gs as initQRScanner,
2884
- ms as initSettingsButton,
2885
- ws as initThemeParams,
2924
+ ws as initSettingsButton,
2925
+ bs as initThemeParams,
2886
2926
  ys as initUtils,
2887
2927
  Ps as initViewport,
2888
2928
  xs as initWeb,
2889
2929
  A as invokeCustomMethod,
2890
- At as isColorDark,
2891
- xt as isIframe,
2892
- Lt as isPageReload,
2893
- tt as isRGB,
2894
- ge as isRGBShort,
2930
+ kt as isColorDark,
2931
+ st as isIframe,
2932
+ Gt as isPageReload,
2933
+ et as isRGB,
2934
+ ve as isRGBShort,
2895
2935
  Cs as isSDKError,
2896
- rn as isSDKErrorOfType,
2936
+ on as isSDKErrorOfType,
2897
2937
  sn as isSSR,
2898
2938
  nn as isTMA,
2899
2939
  f as json,
2900
2940
  Qs as mergeClassNames,
2941
+ rn as mockTelegramEnv,
2901
2942
  P as number,
2902
- H as off,
2943
+ U as off,
2903
2944
  v as on,
2904
2945
  Ys as parseInitData,
2905
- Dt as parseLaunchParams,
2906
- Wt as parseThemeParams,
2907
- k as postEvent,
2908
- m as request,
2946
+ ot as parseLaunchParams,
2947
+ Jt as parseThemeParams,
2948
+ q as postEvent,
2949
+ w as request,
2909
2950
  je as requestBiometryInfo,
2910
2951
  Zs as requestThemeParams,
2911
- jt as requestViewport,
2952
+ Ft as requestViewport,
2912
2953
  $e as retrieveLaunchParams,
2913
- Et as rgb,
2914
- nt as searchParams,
2915
- Me as serializeLaunchParams,
2916
- Ve as serializeThemeParams,
2954
+ Ct as rgb,
2955
+ it as searchParams,
2956
+ Be as serializeLaunchParams,
2957
+ Wt as serializeThemeParams,
2917
2958
  E as setCSSVar,
2918
- re as setDebug,
2959
+ he as setDebug,
2919
2960
  Fs as setTargetOrigin,
2920
2961
  p as string,
2921
- se as subscribe,
2962
+ ae as subscribe,
2922
2963
  x as supports,
2923
- Se as targetOrigin,
2924
- yt as toRGB,
2925
- mt as unsubscribe,
2964
+ Re as targetOrigin,
2965
+ xt as toRGB,
2966
+ vt as unsubscribe,
2926
2967
  B as urlToPath,
2927
2968
  Os as useBackButton,
2928
- ks as useBiometryManager,
2929
- qs as useClosingBehavior,
2930
- Ds as useCloudStorage,
2931
- Ns as useHapticFeedback,
2969
+ qs as useBiometryManager,
2970
+ ks as useClosingBehavior,
2971
+ Ns as useCloudStorage,
2972
+ Ds as useHapticFeedback,
2932
2973
  Vs as useInitData,
2933
2974
  Ms as useInvoice,
2934
2975
  Bs as useMainButton,
2935
2976
  $s as useMiniApp,
2936
2977
  Ls as usePopup,
2937
- Us as useQRScanner,
2978
+ Hs as useQRScanner,
2938
2979
  Is as useSDK,
2939
- Hs as useSettingsButton,
2980
+ Us as useSettingsButton,
2940
2981
  Ws as useThemeParams,
2941
2982
  js as useUtils,
2942
2983
  Gs as useViewport,
2943
- cn as withBackButton,
2944
- hn as withBiometryManager,
2945
- pn as withClosingBehavior,
2946
- un as withCloudStorage,
2984
+ hn as withBackButton,
2985
+ pn as withBiometryManager,
2986
+ un as withClosingBehavior,
2987
+ dn as withCloudStorage,
2947
2988
  ln as withHapticFeedback,
2948
- dn as withInitData,
2949
- _n as withInvoice,
2950
- gn as withMainButton,
2951
- fn as withMiniApp,
2989
+ _n as withInitData,
2990
+ gn as withInvoice,
2991
+ fn as withMainButton,
2992
+ wn as withMiniApp,
2952
2993
  mn as withPopup,
2953
2994
  bn as withQRScanner,
2954
- wn as withSettingsButton,
2955
- vn as withThemeParams,
2956
- Tt as withTimeout,
2957
- yn as withUtils,
2958
- En as withViewport
2995
+ vn as withSettingsButton,
2996
+ yn as withThemeParams,
2997
+ qt as withTimeout,
2998
+ En as withUtils,
2999
+ Pn as withViewport
2959
3000
  };
2960
3001
  //# sourceMappingURL=index.js.map