@tma.js/sdk-solid 2.1.2 → 2.1.4

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 ft, mergeProps as ct, createContext as Ft, useContext as Yt, createEffect as ht, onCleanup as Zt, createResource as Xt, createMemo as pt, from as te } from "solid-js";
2
- var ee = Object.defineProperty, se = (e, t, s) => t in e ? ee(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (se(e, typeof t != "symbol" ? t + "" : t, s), s);
3
- function mt(e, t) {
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) {
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 wt(e) {
11
- const t = W(), { count: s } = t;
12
- t.unsubscribe(e), s && !t.count && Ce();
10
+ function mt(e) {
11
+ const t = U(), { count: s } = t;
12
+ t.unsubscribe(e), s && !t.count && Pe();
13
13
  }
14
- function ne(e) {
15
- return W().subscribe(e), () => wt(e);
14
+ function se(e) {
15
+ return U().subscribe(e), () => mt(e);
16
16
  }
17
- class re {
17
+ class ne {
18
18
  constructor(t, s = {}) {
19
19
  this.scope = t, this.options = s;
20
20
  }
@@ -54,21 +54,21 @@ class re {
54
54
  this.print("log", ...t);
55
55
  }
56
56
  }
57
- const $ = new re("SDK", {
57
+ const Z = new ne("SDK", {
58
58
  bgColor: "forestgreen",
59
59
  textColor: "white"
60
60
  });
61
- let Y = !1;
62
- const ut = ({ event: e, args: [t] }) => {
63
- $.log("Event received:", t === void 0 ? { name: e } : { name: e, data: t });
61
+ let F = !1;
62
+ const ut = ({ name: e, payload: t }) => {
63
+ Z.log("Event received:", t ? { name: e, payload: t } : { name: e });
64
64
  };
65
- function ie(e) {
66
- Y !== e && (Y = e, e ? ne(ut) : wt(ut));
65
+ function re(e) {
66
+ F !== e && (F = e, e ? se(ut) : mt(ut));
67
67
  }
68
- function oe(...e) {
69
- Y && $.log(...e);
68
+ function ie(...e) {
69
+ F && Z.log(...e);
70
70
  }
71
- class L {
71
+ class O {
72
72
  constructor() {
73
73
  c(this, "listeners", /* @__PURE__ */ new Map()), c(this, "listenersCount", 0), c(this, "subscribeListeners", []);
74
74
  }
@@ -138,22 +138,33 @@ class L {
138
138
  }
139
139
  }
140
140
  }
141
- function Z(e, t, s) {
141
+ function Q(e, t, s) {
142
142
  return window.addEventListener(e, t, s), () => window.removeEventListener(e, t, s);
143
143
  }
144
- class U extends Error {
144
+ function bt(...e) {
145
+ let t = !1;
146
+ const s = [...e];
147
+ return [
148
+ (n) => !t && s.push(n),
149
+ () => {
150
+ t || (t = !0, s.forEach((n) => n()));
151
+ },
152
+ t
153
+ ];
154
+ }
155
+ class $ extends Error {
145
156
  constructor(t, s, n) {
146
- super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, U.prototype);
157
+ super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, $.prototype);
147
158
  }
148
159
  }
149
- function m(e, t, s) {
150
- return new U(e, t, s);
160
+ function b(e, t, s) {
161
+ return new $(e, t, s);
151
162
  }
152
- const ae = "ERR_METHOD_UNSUPPORTED", ce = "ERR_METHOD_PARAMETER_UNSUPPORTED", he = "ERR_UNKNOWN_ENV", pe = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", ue = "ERR_TIMED_OUT", de = "ERR_UNEXPECTED_TYPE", bt = "ERR_PARSE", le = "ERR_NAVIGATION_LIST_EMPTY", _e = "ERR_NAVIGATION_CURSOR_INVALID", Qs = "ERR_NAVIGATION_ITEM_INVALID", vt = "ERR_SSR_INIT", ge = "ERR_INVALID_PATH_BASE";
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";
153
164
  function S() {
154
- return m(de, "Value has unexpected type");
165
+ return b(ue, "Value has unexpected type");
155
166
  }
156
- class H {
167
+ class L {
157
168
  constructor(t, s, n) {
158
169
  this.parser = t, this.isOptional = s, this.type = n;
159
170
  }
@@ -168,8 +179,8 @@ class H {
168
179
  try {
169
180
  return this.parser(t);
170
181
  } catch (s) {
171
- throw m(
172
- bt,
182
+ throw b(
183
+ wt,
173
184
  `Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
174
185
  s
175
186
  );
@@ -180,9 +191,9 @@ class H {
180
191
  }
181
192
  }
182
193
  function R(e, t) {
183
- return () => new H(e, !1, t);
194
+ return () => new L(e, !1, t);
184
195
  }
185
- const v = R((e) => {
196
+ const y = R((e) => {
186
197
  if (typeof e == "boolean")
187
198
  return e;
188
199
  const t = String(e);
@@ -192,7 +203,7 @@ const v = R((e) => {
192
203
  return !1;
193
204
  throw S();
194
205
  }, "boolean");
195
- function yt(e, t) {
206
+ function vt(e, t) {
196
207
  const s = {};
197
208
  for (const n in e) {
198
209
  const r = e[n];
@@ -209,21 +220,21 @@ function yt(e, t) {
209
220
  const a = o(t(i));
210
221
  a !== void 0 && (s[n] = a);
211
222
  } catch (a) {
212
- throw m(bt, `Unable to parse field "${n}"`, a);
223
+ throw b(wt, `Unable to parse field "${n}"`, a);
213
224
  }
214
225
  }
215
226
  return s;
216
227
  }
217
- function tt(e) {
228
+ function X(e) {
218
229
  let t = e;
219
230
  if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
220
231
  throw S();
221
232
  return t;
222
233
  }
223
- function g(e, t) {
224
- return new H((s) => {
225
- const n = tt(s);
226
- return yt(e, (r) => n[r]);
234
+ function f(e, t) {
235
+ return new L((s) => {
236
+ const n = X(s);
237
+ return vt(e, (r) => n[r]);
227
238
  }, !1, t);
228
239
  }
229
240
  const P = R((e) => {
@@ -236,17 +247,17 @@ const P = R((e) => {
236
247
  }
237
248
  throw S();
238
249
  }, "number");
239
- function et(e) {
250
+ function tt(e) {
240
251
  return /^#[\da-f]{6}$/i.test(e);
241
252
  }
242
- function fe(e) {
253
+ function ge(e) {
243
254
  return /^#[\da-f]{3}$/i.test(e);
244
255
  }
245
- function Et(e) {
256
+ function yt(e) {
246
257
  const t = e.replace(/\s/g, "").toLowerCase();
247
- if (et(t))
258
+ if (tt(t))
248
259
  return t;
249
- if (fe(t)) {
260
+ if (ge(t)) {
250
261
  let n = "#";
251
262
  for (let r = 0; r < 3; r += 1)
252
263
  n += t[1 + r].repeat(2);
@@ -264,14 +275,14 @@ const p = R((e) => {
264
275
  if (typeof e == "string" || typeof e == "number")
265
276
  return e.toString();
266
277
  throw S();
267
- }, "string"), Pt = R((e) => Et(p().parse(e)), "rgb");
268
- function me(e) {
269
- return g({
278
+ }, "string"), Et = R((e) => yt(p().parse(e)), "rgb");
279
+ function fe(e) {
280
+ return f({
270
281
  eventType: p(),
271
282
  eventData: (t) => t
272
283
  }).parse(e);
273
284
  }
274
- function we() {
285
+ function me() {
275
286
  ["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
276
287
  delete window[e];
277
288
  });
@@ -283,7 +294,7 @@ function be(e, t) {
283
294
  source: window.parent
284
295
  }));
285
296
  }
286
- function ve() {
297
+ function we() {
287
298
  [
288
299
  ["TelegramGameProxy_receiveEvent"],
289
300
  // Windows Phone.
@@ -302,60 +313,55 @@ function ve() {
302
313
  });
303
314
  });
304
315
  }
305
- const ye = g({
306
- button_id: (e) => e == null ? void 0 : p().parse(e)
307
- }), Ee = {
308
- clipboard_text_received: g({
316
+ const ve = {
317
+ clipboard_text_received: f({
309
318
  req_id: p(),
310
319
  data: (e) => e === null ? e : p().optional().parse(e)
311
320
  }),
312
- custom_method_invoked: g({
321
+ custom_method_invoked: f({
313
322
  req_id: p(),
314
323
  result: (e) => e,
315
324
  error: p().optional()
316
325
  }),
317
- invoice_closed: g({
318
- slug: p(),
319
- status: p()
320
- }),
321
- phone_requested: g({
322
- status: p()
323
- }),
326
+ invoice_closed: f({ slug: p(), status: p() }),
327
+ phone_requested: f({ status: p() }),
324
328
  popup_closed: {
325
- parse: (e) => ye.parse(e ?? {})
329
+ parse(e) {
330
+ return f({
331
+ button_id: (t) => t == null ? void 0 : p().parse(t)
332
+ }).parse(e ?? {});
333
+ }
326
334
  },
327
- qr_text_received: g({
328
- data: p().optional()
329
- }),
330
- theme_changed: g({
335
+ qr_text_received: f({ data: p().optional() }),
336
+ theme_changed: f({
331
337
  theme_params: (e) => {
332
- const t = Pt().optional();
333
- return Object.entries(tt(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
338
+ const t = Et().optional();
339
+ return Object.entries(X(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
334
340
  }
335
341
  }),
336
- viewport_changed: g({
342
+ viewport_changed: f({
337
343
  height: P(),
338
344
  width: (e) => e == null ? window.innerWidth : P().parse(e),
339
- is_state_stable: v(),
340
- is_expanded: v()
345
+ is_state_stable: y(),
346
+ is_expanded: y()
341
347
  }),
342
- write_access_requested: g({
343
- status: p()
344
- })
348
+ write_access_requested: f({ status: p() })
345
349
  };
346
- function Pe() {
347
- const e = new L();
348
- ve();
349
- let t = [
350
+ function ye() {
351
+ const e = new O(), t = new O();
352
+ t.subscribe((n) => {
353
+ e.emit("event", { name: n.event, payload: n.args[0] });
354
+ }), we();
355
+ const [, s] = bt(
350
356
  // Don't forget to remove created handlers.
351
- we,
357
+ me,
352
358
  // Add "resize" event listener to make sure, we always have fresh viewport information.
353
359
  // Desktop version of Telegram is sometimes not sending the viewport_changed
354
360
  // event. For example, when the MainButton is shown. That's why we should
355
361
  // add our own listener to make sure, viewport information is always fresh.
356
362
  // Issue: https://github.com/Telegram-Mini-Apps/tma.js/issues/10
357
- Z("resize", () => {
358
- e.emit("viewport_changed", {
363
+ Q("resize", () => {
364
+ t.emit("viewport_changed", {
359
365
  width: window.innerWidth,
360
366
  height: window.innerHeight,
361
367
  is_state_stable: !0,
@@ -364,37 +370,48 @@ function Pe() {
364
370
  }),
365
371
  // Add listener, which handles events sent from the Telegram web application and also events
366
372
  // generated by the local emitEvent function.
367
- Z("message", (s) => {
368
- if (s.source !== window.parent)
373
+ Q("message", (n) => {
374
+ if (n.source !== window.parent)
369
375
  return;
370
- let n;
376
+ let r;
371
377
  try {
372
- n = me(s.data);
378
+ r = fe(n.data);
373
379
  } catch {
374
380
  return;
375
381
  }
376
- const { eventType: r, eventData: i } = n, o = Ee[r];
382
+ const { eventType: i, eventData: o } = r, a = ve[i];
377
383
  try {
378
- const a = o ? o.parse(i) : i;
379
- e.emit(...a ? [r, a] : [r]);
380
- } catch (a) {
381
- $.error(
382
- `An error occurred processing the "${r}" event from the Telegram application. Please, file an issue here: https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose`,
383
- n,
384
- a
384
+ const h = a ? a.parse(o) : o;
385
+ t.emit(...h ? [i, h] : [i]);
386
+ } catch (h) {
387
+ Z.error(
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
+ r,
390
+ h
385
391
  );
386
392
  }
387
393
  }),
388
- // Clear emitter bound events.
389
- () => e.clear()
390
- ];
391
- return [e, () => {
392
- t.forEach((s) => s()), t = [];
393
- }];
394
+ // Clear emitters.
395
+ () => e.clear(),
396
+ () => t.clear()
397
+ );
398
+ return [{
399
+ on: t.on.bind(t),
400
+ off: t.off.bind(t),
401
+ subscribe(n) {
402
+ return e.on("event", n);
403
+ },
404
+ unsubscribe(n) {
405
+ e.off("event", n);
406
+ },
407
+ get count() {
408
+ return t.count + e.count;
409
+ }
410
+ }, s];
394
411
  }
395
- const [xe, Ce] = mt(
412
+ const [Ee, Pe] = ft(
396
413
  (e) => {
397
- const [t, s] = Pe(), n = t.off.bind(t);
414
+ const [t, s] = ye(), n = t.off.bind(t);
398
415
  return t.off = (r, i) => {
399
416
  const { count: o } = t;
400
417
  n(r, i), o && !t.count && e();
@@ -402,19 +419,19 @@ const [xe, Ce] = mt(
402
419
  },
403
420
  ([, e]) => e()
404
421
  );
405
- function W() {
406
- return xe()[0];
422
+ function U() {
423
+ return Ee()[0];
407
424
  }
408
- function j(e, t) {
409
- W().off(e, t);
425
+ function H(e, t) {
426
+ U().off(e, t);
410
427
  }
411
- function b(e, t, s) {
412
- return W().on(e, t, s);
428
+ function v(e, t, s) {
429
+ return U().on(e, t, s);
413
430
  }
414
- function q(e) {
431
+ function D(e) {
415
432
  return typeof e == "object" && e !== null && !Array.isArray(e);
416
433
  }
417
- function Se(e, t) {
434
+ function xe(e, t) {
418
435
  const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
419
436
  for (let i = 0; i < r; i += 1) {
420
437
  const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
@@ -424,9 +441,9 @@ function Se(e, t) {
424
441
  return 0;
425
442
  }
426
443
  function w(e, t) {
427
- return Se(e, t) <= 0;
444
+ return xe(e, t) <= 0;
428
445
  }
429
- function C(e, t, s) {
446
+ function x(e, t, s) {
430
447
  if (typeof s == "string") {
431
448
  if (e === "web_app_open_link" && t === "try_instant_view")
432
449
  return w("6.4", s);
@@ -477,79 +494,79 @@ function C(e, t, s) {
477
494
  ].includes(e);
478
495
  }
479
496
  }
480
- function Re(e) {
481
- return "external" in e && q(e.external) && "notify" in e.external && typeof e.external.notify == "function";
497
+ function Ce(e) {
498
+ return "external" in e && D(e.external) && "notify" in e.external && typeof e.external.notify == "function";
482
499
  }
483
- function xt(e) {
484
- return "TelegramWebviewProxy" in e && q(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
500
+ function Pt(e) {
501
+ return "TelegramWebviewProxy" in e && D(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
485
502
  }
486
- function Ct() {
503
+ function xt() {
487
504
  try {
488
505
  return window.self !== window.top;
489
506
  } catch {
490
507
  return !0;
491
508
  }
492
509
  }
493
- let St = "https://web.telegram.org";
510
+ let Ct = "https://web.telegram.org";
494
511
  function Fs(e) {
495
- St = e;
512
+ Ct = e;
496
513
  }
497
- function Ae() {
498
- return St;
514
+ function Se() {
515
+ return Ct;
499
516
  }
500
517
  function k(e, t, s) {
501
518
  let n = {}, r;
502
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);
503
- const { targetOrigin: i = Ae() } = n;
504
- if (oe("Posting event:", r ? { event: e, data: r } : { event: e }), Ct()) {
520
+ const { targetOrigin: i = Se() } = n;
521
+ if (ie("Posting event:", r ? { event: e, data: r } : { event: e }), xt()) {
505
522
  window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
506
523
  return;
507
524
  }
508
- if (Re(window)) {
525
+ if (Ce(window)) {
509
526
  window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
510
527
  return;
511
528
  }
512
- if (xt(window)) {
529
+ if (Pt(window)) {
513
530
  window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
514
531
  return;
515
532
  }
516
- throw m(
517
- he,
533
+ throw b(
534
+ ce,
518
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."
519
536
  );
520
537
  }
521
- function Te(e) {
538
+ function Re(e) {
522
539
  return (t, s) => {
523
- if (!C(t, e))
524
- throw m(ae, `Method "${t}" is unsupported in Mini Apps version ${e}`);
525
- if (q(s)) {
540
+ if (!x(t, e))
541
+ throw b(oe, `Method "${t}" is unsupported in Mini Apps version ${e}`);
542
+ if (D(s)) {
526
543
  let n;
527
- 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 && !C(t, n, e))
528
- throw m(
529
- ce,
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,
530
547
  `Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
531
548
  );
532
549
  }
533
550
  return k(t, s);
534
551
  };
535
552
  }
536
- function Rt(e) {
553
+ function St(e) {
537
554
  return ({ req_id: t }) => t === e;
538
555
  }
539
- function At(e) {
540
- return m(ue, `Timeout reached: ${e}ms`);
556
+ function Rt(e) {
557
+ return b(pe, `Timeout reached: ${e}ms`);
541
558
  }
542
559
  function Tt(e, t) {
543
560
  return Promise.race([
544
561
  typeof e == "function" ? e() : e,
545
562
  new Promise((s, n) => {
546
563
  setTimeout(() => {
547
- n(At(t));
564
+ n(Rt(t));
548
565
  }, t);
549
566
  })
550
567
  ]);
551
568
  }
552
- async function f(e) {
569
+ async function m(e) {
553
570
  let t;
554
571
  const s = new Promise((u) => {
555
572
  t = u;
@@ -560,7 +577,7 @@ async function f(e) {
560
577
  postEvent: o = k,
561
578
  timeout: a
562
579
  } = e, h = (Array.isArray(r) ? r : [r]).map(
563
- (u) => b(u, (N) => (!i || i(N)) && t(N))
580
+ (u) => v(u, (l) => (!i || i(l)) && t(l))
564
581
  );
565
582
  try {
566
583
  return o(n, e.params), await (a ? Tt(s, a) : s);
@@ -568,11 +585,11 @@ async function f(e) {
568
585
  h.forEach((u) => u());
569
586
  }
570
587
  }
571
- async function T(e, t, s, n = {}) {
588
+ async function A(e, t, s, n = {}) {
572
589
  const {
573
590
  result: r,
574
591
  error: i
575
- } = await f({
592
+ } = await m({
576
593
  ...n,
577
594
  method: "web_app_invoke_custom_method",
578
595
  event: "custom_method_invoked",
@@ -581,30 +598,30 @@ async function T(e, t, s, n = {}) {
581
598
  params: t,
582
599
  req_id: s
583
600
  },
584
- capture: Rt(s)
601
+ capture: St(s)
585
602
  });
586
603
  if (i)
587
- throw m(pe, i);
604
+ throw b(he, i);
588
605
  return r;
589
606
  }
590
- function X(...e) {
607
+ function Y(...e) {
591
608
  return e.map((t) => {
592
609
  if (typeof t == "string")
593
610
  return t;
594
- if (q(t))
595
- return X(Object.entries(t).map((s) => s[1] && s[0]));
611
+ if (D(t))
612
+ return Y(Object.entries(t).map((s) => s[1] && s[0]));
596
613
  if (Array.isArray(t))
597
- return X(...t);
614
+ return Y(...t);
598
615
  }).filter(Boolean).join(" ");
599
616
  }
600
- function Ys(...e) {
601
- return e.reduce((t, s) => (q(s) && Object.entries(s).forEach(([n, r]) => {
602
- const i = X(t[n], r);
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);
603
620
  i.length && (t[n] = i);
604
621
  }), t), {});
605
622
  }
606
- function It(e) {
607
- const t = Et(e);
623
+ function At(e) {
624
+ const t = yt(e);
608
625
  return Math.sqrt(
609
626
  [0.299, 0.587, 0.114].reduce((s, n, r) => {
610
627
  const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
@@ -612,9 +629,9 @@ function It(e) {
612
629
  }, 0)
613
630
  ) < 120;
614
631
  }
615
- class Ie {
632
+ class Te {
616
633
  constructor(t) {
617
- c(this, "ee", new L()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
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;
618
635
  }
619
636
  /**
620
637
  * Clones current state and returns its copy.
@@ -633,25 +650,25 @@ class Ie {
633
650
  return this.state[t];
634
651
  }
635
652
  }
636
- class st {
653
+ class et {
637
654
  constructor(t) {
638
- 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);
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);
639
656
  }
640
657
  }
641
- function kt(e, t) {
642
- return (s) => C(t[s], e);
658
+ function It(e, t) {
659
+ return (s) => x(t[s], e);
643
660
  }
644
- class nt extends st {
661
+ class st extends et {
645
662
  constructor(t, s, n) {
646
- super(t), c(this, "supports"), this.supports = kt(s, n);
663
+ super(t), c(this, "supports"), this.supports = It(s, n);
647
664
  }
648
665
  }
649
- class ke extends nt {
666
+ class Ae extends st {
650
667
  constructor(t, s, n) {
651
668
  super({ isVisible: t }, s, {
652
669
  show: "web_app_setup_back_button",
653
670
  hide: "web_app_setup_back_button"
654
- }), c(this, "on", (r, i) => r === "click" ? b("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? j("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" ? H("back_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
655
672
  }
656
673
  set isVisible(t) {
657
674
  this.set("isVisible", t), this.postEvent("web_app_setup_back_button", { is_visible: t });
@@ -675,22 +692,19 @@ class ke extends nt {
675
692
  this.isVisible = !0;
676
693
  }
677
694
  }
678
- function E() {
679
- return typeof window > "u";
680
- }
681
695
  const Ot = R((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
682
- function rt(e, t) {
683
- return new H((s) => {
696
+ function nt(e, t) {
697
+ return new L((s) => {
684
698
  if (typeof s != "string" && !(s instanceof URLSearchParams))
685
699
  throw S();
686
700
  const n = typeof s == "string" ? new URLSearchParams(s) : s;
687
- return yt(e, (r) => {
701
+ return vt(e, (r) => {
688
702
  const i = n.get(r);
689
703
  return i === null ? void 0 : i;
690
704
  });
691
705
  }, !1, t);
692
706
  }
693
- const Oe = g({
707
+ const Ie = f({
694
708
  id: P(),
695
709
  type: p(),
696
710
  title: p(),
@@ -699,13 +713,13 @@ const Oe = g({
699
713
  from: "photo_url"
700
714
  },
701
715
  username: p().optional()
702
- }, "Chat").optional(), dt = g({
716
+ }, "Chat").optional(), lt = f({
703
717
  addedToAttachmentMenu: {
704
- type: v().optional(),
718
+ type: y().optional(),
705
719
  from: "added_to_attachment_menu"
706
720
  },
707
721
  allowsWriteToPm: {
708
- type: v().optional(),
722
+ type: y().optional(),
709
723
  from: "allows_write_to_pm"
710
724
  },
711
725
  firstName: {
@@ -714,11 +728,11 @@ const Oe = g({
714
728
  },
715
729
  id: P(),
716
730
  isBot: {
717
- type: v().optional(),
731
+ type: y().optional(),
718
732
  from: "is_bot"
719
733
  },
720
734
  isPremium: {
721
- type: v().optional(),
735
+ type: y().optional(),
722
736
  from: "is_premium"
723
737
  },
724
738
  languageCode: {
@@ -735,8 +749,8 @@ const Oe = g({
735
749
  },
736
750
  username: p().optional()
737
751
  }, "User").optional();
738
- function qt() {
739
- return rt({
752
+ function kt() {
753
+ return nt({
740
754
  authDate: {
741
755
  type: Ot(),
742
756
  from: "auth_date"
@@ -745,7 +759,7 @@ function qt() {
745
759
  type: P().optional(),
746
760
  from: "can_send_after"
747
761
  },
748
- chat: Oe,
762
+ chat: Ie,
749
763
  chatInstance: {
750
764
  type: p().optional(),
751
765
  from: "chat_instance"
@@ -759,35 +773,35 @@ function qt() {
759
773
  type: p().optional(),
760
774
  from: "query_id"
761
775
  },
762
- receiver: dt,
776
+ receiver: lt,
763
777
  startParam: {
764
778
  type: p().optional(),
765
779
  from: "start_param"
766
780
  },
767
- user: dt
781
+ user: lt
768
782
  }, "InitData");
769
783
  }
770
- function qe(e) {
784
+ function Oe(e) {
771
785
  return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
772
786
  }
773
- function De(e) {
787
+ function ke(e) {
774
788
  return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
775
789
  }
776
- const Dt = R(
790
+ const qt = R(
777
791
  (e) => {
778
- const t = Pt().optional();
779
- return Object.entries(tt(e)).reduce((s, [n, r]) => (s[qe(n)] = t.parse(r), s), {});
792
+ const t = Et().optional();
793
+ return Object.entries(X(e)).reduce((s, [n, r]) => (s[Oe(n)] = t.parse(r), s), {});
780
794
  },
781
795
  "ThemeParams"
782
796
  );
783
- function Nt(e) {
784
- return rt({
797
+ function Dt(e) {
798
+ return nt({
785
799
  botInline: {
786
- type: v().optional(),
800
+ type: y().optional(),
787
801
  from: "tgWebAppBotInline"
788
802
  },
789
803
  initData: {
790
- type: qt().optional(),
804
+ type: kt().optional(),
791
805
  from: "tgWebAppData"
792
806
  },
793
807
  initDataRaw: {
@@ -799,7 +813,7 @@ function Nt(e) {
799
813
  from: "tgWebAppPlatform"
800
814
  },
801
815
  showSettings: {
802
- type: v().optional(),
816
+ type: y().optional(),
803
817
  from: "tgWebAppShowSettings"
804
818
  },
805
819
  startParam: {
@@ -807,7 +821,7 @@ function Nt(e) {
807
821
  from: "tgWebAppStartParam"
808
822
  },
809
823
  themeParams: {
810
- type: Dt(),
824
+ type: qt(),
811
825
  from: "tgWebAppThemeParams"
812
826
  },
813
827
  version: {
@@ -816,47 +830,47 @@ function Nt(e) {
816
830
  }
817
831
  }).parse(e);
818
832
  }
819
- function Vt(e) {
820
- return Nt(
833
+ function Nt(e) {
834
+ return Dt(
821
835
  e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
822
836
  );
823
837
  }
824
- function Ne() {
825
- return Vt(window.location.href);
838
+ function qe() {
839
+ return Nt(window.location.href);
826
840
  }
827
- function Mt() {
841
+ function Vt() {
828
842
  return performance.getEntriesByType("navigation")[0];
829
843
  }
830
- function Ve() {
831
- const e = Mt();
844
+ function De() {
845
+ const e = Vt();
832
846
  if (!e)
833
847
  throw new Error("Unable to get first navigation entry.");
834
- return Vt(e.name);
848
+ return Nt(e.name);
835
849
  }
836
- function Bt(e) {
850
+ function Mt(e) {
837
851
  return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
838
852
  }
839
- function $t(e, t) {
840
- sessionStorage.setItem(Bt(e), JSON.stringify(t));
853
+ function Bt(e, t) {
854
+ sessionStorage.setItem(Mt(e), JSON.stringify(t));
841
855
  }
842
- function Lt(e) {
843
- const t = sessionStorage.getItem(Bt(e));
856
+ function $t(e) {
857
+ const t = sessionStorage.getItem(Mt(e));
844
858
  try {
845
859
  return t ? JSON.parse(t) : void 0;
846
860
  } catch {
847
861
  }
848
862
  }
849
- function Me() {
850
- return Nt(Lt("launchParams") || "");
863
+ function Ne() {
864
+ return Dt($t("launchParams") || "");
851
865
  }
852
- function Be(e) {
866
+ function Ve(e) {
853
867
  return JSON.stringify(
854
868
  Object.fromEntries(
855
- Object.entries(e).map(([t, s]) => [De(t), s])
869
+ Object.entries(e).map(([t, s]) => [ke(t), s])
856
870
  )
857
871
  );
858
872
  }
859
- function $e(e) {
873
+ function Me(e) {
860
874
  const {
861
875
  initDataRaw: t,
862
876
  themeParams: s,
@@ -866,71 +880,75 @@ function $e(e) {
866
880
  startParam: o,
867
881
  botInline: a
868
882
  } = e, h = new URLSearchParams();
869
- return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams", Be(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", 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();
870
884
  }
871
- function Le(e) {
872
- $t("launchParams", $e(e));
885
+ function Be(e) {
886
+ Bt("launchParams", Me(e));
873
887
  }
874
- function Ue() {
888
+ function $e() {
875
889
  for (const e of [
876
890
  // Try to retrieve launch parameters from the current location. This method can return
877
891
  // nothing in case, location was changed and then page was reloaded.
878
- Ne,
892
+ qe,
879
893
  // Then, try using the lower level API - window.performance.
880
- Ve,
894
+ De,
881
895
  // Finally, try to extract launch parameters from the session storage.
882
- Me
896
+ Ne
883
897
  ])
884
898
  try {
885
899
  const t = e();
886
- return Le(t), t;
900
+ return Be(t), t;
887
901
  } catch {
888
902
  }
889
903
  throw new Error("Unable to retrieve launch parameters from any known source.");
890
904
  }
891
- function Ut() {
892
- const e = Mt();
905
+ function Lt() {
906
+ const e = Vt();
893
907
  return !!(e && e.type === "reload");
894
908
  }
895
- function He() {
909
+ function Le() {
896
910
  let e = 0;
897
911
  return () => (e += 1).toString();
898
912
  }
899
- const [We] = mt(He);
913
+ const [Ue] = ft(Le);
900
914
  function d(e, t) {
901
- return ({ ssr: s } = {}) => {
902
- const n = E() ? {
903
- version: "6.0",
904
- themeParams: {},
905
- platform: "unknown",
906
- ...s || {}
907
- } : Ue(), r = {
908
- ...n,
909
- postEvent: E() ? () => null : Te(n.version),
910
- createRequestId: We()
915
+ return () => {
916
+ const s = $e(), n = {
917
+ ...s,
918
+ postEvent: Re(s.version),
919
+ createRequestId: Ue()
911
920
  };
912
- if (E() || typeof e == "function")
913
- return typeof e == "function" ? e(r) : t(r);
914
- const i = t({
915
- ...r,
916
- state: Ut() ? Lt(e) : void 0
917
- }), o = (a) => (a.on("change", (h) => {
918
- $t(e, h);
919
- }), a);
920
- return i instanceof Promise ? i.then(o) : o(i);
921
+ if (typeof e == "function")
922
+ return e(n);
923
+ const [r, i, o] = bt(), a = t({
924
+ ...n,
925
+ // State should only be passed only in case, current page was reloaded. If we don't add
926
+ // this check, state restoration will work improperly in the web version of Telegram,
927
+ // when we are always working in the same "session" (tab).
928
+ state: Lt() ? $t(e) : void 0,
929
+ addCleanup: r
930
+ }), h = (u) => (o || r(
931
+ u.on("change", (l) => {
932
+ Bt(e, l);
933
+ })
934
+ ), u);
935
+ return [
936
+ a instanceof Promise ? a.then(h) : h(a),
937
+ i
938
+ ];
921
939
  };
922
940
  }
923
- const je = d("backButton", ({
941
+ const He = d("backButton", ({
924
942
  postEvent: e,
925
943
  version: t,
926
944
  state: s = { isVisible: !1 }
927
- }) => new ke(s.isVisible, t, e));
928
- class D extends nt {
945
+ }) => new Ae(s.isVisible, t, e));
946
+ class N extends st {
929
947
  constructor() {
930
948
  super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
931
949
  }
932
950
  }
933
- function Ht(e) {
951
+ function Ut(e) {
934
952
  const t = e.available ? e : {
935
953
  available: !1,
936
954
  device_id: "",
@@ -948,7 +966,7 @@ function Ht(e) {
948
966
  accessGranted: t.access_granted
949
967
  };
950
968
  }
951
- class lt extends D {
969
+ class We extends N {
952
970
  constructor({ postEvent: t, version: s, ...n }) {
953
971
  super(n, s, {
954
972
  auth: "web_app_biometry_request_auth",
@@ -985,7 +1003,7 @@ class lt extends D {
985
1003
  reason: t,
986
1004
  ...s
987
1005
  }) {
988
- return this.authPromise || (this.authPromise = f({
1006
+ return this.authPromise || (this.authPromise = m({
989
1007
  ...s,
990
1008
  method: "web_app_biometry_request_auth",
991
1009
  event: "biometry_auth_requested",
@@ -1019,14 +1037,14 @@ class lt extends D {
1019
1037
  * @returns Promise with true, if access was granted.
1020
1038
  */
1021
1039
  requestAccess({ reason: t, ...s } = {}) {
1022
- return this.accessPromise || (this.accessPromise = f({
1040
+ return this.accessPromise || (this.accessPromise = m({
1023
1041
  ...s,
1024
1042
  postEvent: this.postEvent,
1025
1043
  method: "web_app_biometry_request_access",
1026
1044
  event: "biometry_info_received",
1027
1045
  params: { reason: t || "" }
1028
1046
  }).then((n) => {
1029
- const r = Ht(n);
1047
+ const r = Ut(n);
1030
1048
  return this.set(r), r.accessGranted;
1031
1049
  }).finally(() => this.accessPromise = void 0)), this.accessPromise;
1032
1050
  }
@@ -1048,7 +1066,7 @@ class lt extends D {
1048
1066
  */
1049
1067
  async updateToken({ token: t, ...s } = {}) {
1050
1068
  return ["removed", "updated"].includes(
1051
- (await f({
1069
+ (await m({
1052
1070
  ...s,
1053
1071
  postEvent: this.postEvent,
1054
1072
  method: "web_app_biometry_update_token",
@@ -1058,35 +1076,35 @@ class lt extends D {
1058
1076
  );
1059
1077
  }
1060
1078
  }
1061
- async function Ge(e) {
1062
- return Ht(
1063
- await f({
1079
+ async function je(e) {
1080
+ return Ut(
1081
+ await m({
1064
1082
  ...e || {},
1065
1083
  method: "web_app_biometry_get_info",
1066
1084
  event: "biometry_info_received"
1067
1085
  })
1068
1086
  );
1069
1087
  }
1070
- const ze = d("biometryManager", async ({ postEvent: e, version: t, state: s }) => {
1071
- if (s)
1072
- return new lt({ ...s, version: t, postEvent: e });
1073
- if (E())
1074
- throw m(
1075
- vt,
1076
- "BiometryManager cannot be instantiated on the server side without passing the ssr.state object."
1077
- );
1078
- return new lt({
1079
- ...await Ge({ timeout: 1e3 }),
1088
+ const Ge = d(
1089
+ "biometryManager",
1090
+ async ({ postEvent: e, version: t, state: s }) => new We({
1091
+ ...s || x("web_app_biometry_get_info", t) ? s || await je({ timeout: 1e3 }) : {
1092
+ available: !1,
1093
+ accessGranted: !1,
1094
+ accessRequested: !1,
1095
+ tokenSaved: !1,
1096
+ deviceId: ""
1097
+ },
1080
1098
  version: t,
1081
1099
  postEvent: e
1082
- });
1083
- });
1084
- class it extends st {
1100
+ })
1101
+ );
1102
+ class rt extends et {
1085
1103
  constructor() {
1086
1104
  super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
1087
1105
  }
1088
1106
  }
1089
- class Ke extends it {
1107
+ class Ke extends rt {
1090
1108
  constructor(t, s) {
1091
1109
  super({ isConfirmationNeeded: t }), this.postEvent = s;
1092
1110
  }
@@ -1113,16 +1131,19 @@ class Ke extends it {
1113
1131
  this.isConfirmationNeeded = !0;
1114
1132
  }
1115
1133
  }
1116
- const Je = d("closingBehavior", ({
1117
- postEvent: e,
1118
- state: t = { isConfirmationNeeded: !1 }
1119
- }) => new Ke(t.isConfirmationNeeded, e));
1120
- class ot {
1134
+ const ze = d(
1135
+ "closingBehavior",
1136
+ ({
1137
+ postEvent: e,
1138
+ state: t = { isConfirmationNeeded: !1 }
1139
+ }) => new Ke(t.isConfirmationNeeded, e)
1140
+ );
1141
+ class it {
1121
1142
  constructor(t, s) {
1122
- c(this, "supports"), this.supports = kt(t, s);
1143
+ c(this, "supports"), this.supports = It(t, s);
1123
1144
  }
1124
1145
  }
1125
- function Qe(e) {
1146
+ function Je(e) {
1126
1147
  if (Array.isArray(e))
1127
1148
  return e;
1128
1149
  if (typeof e == "string")
@@ -1134,9 +1155,9 @@ function Qe(e) {
1134
1155
  }
1135
1156
  throw S();
1136
1157
  }
1137
- class Fe extends H {
1158
+ class Fe extends L {
1138
1159
  constructor(t, s, n) {
1139
- super(Qe, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
1160
+ super(Je, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
1140
1161
  }
1141
1162
  /**
1142
1163
  * Attempts to parse passed value
@@ -1152,13 +1173,13 @@ class Fe extends H {
1152
1173
  return this.itemParser = typeof t == "function" ? t : t.parse.bind(t), this;
1153
1174
  }
1154
1175
  }
1155
- function Ye(e) {
1176
+ function Qe(e) {
1156
1177
  return new Fe((t) => t, !1, e);
1157
1178
  }
1158
- function _t(e, t) {
1179
+ function dt(e, t) {
1159
1180
  return Object.fromEntries(e.map((s) => [s, t]));
1160
1181
  }
1161
- class Ze extends ot {
1182
+ class Ye extends it {
1162
1183
  constructor(t, s, n) {
1163
1184
  super(t, {
1164
1185
  delete: "web_app_invoke_custom_method",
@@ -1174,7 +1195,7 @@ class Ze extends ot {
1174
1195
  */
1175
1196
  async delete(t, s = {}) {
1176
1197
  const n = Array.isArray(t) ? t : [t];
1177
- n.length && await T(
1198
+ n.length && await A(
1178
1199
  "deleteStorageValues",
1179
1200
  { keys: n },
1180
1201
  this.createRequestId(),
@@ -1186,8 +1207,8 @@ class Ze extends ot {
1186
1207
  * @param options - request execution options.
1187
1208
  */
1188
1209
  async getKeys(t = {}) {
1189
- return Ye().of(p()).parse(
1190
- await T(
1210
+ return Qe().of(p()).parse(
1211
+ await A(
1191
1212
  "getStorageKeys",
1192
1213
  {},
1193
1214
  this.createRequestId(),
@@ -1198,13 +1219,13 @@ class Ze extends ot {
1198
1219
  async get(t, s = {}) {
1199
1220
  const n = Array.isArray(t) ? t : [t];
1200
1221
  if (!n.length)
1201
- return _t(n, "");
1202
- const r = await T(
1222
+ return dt(n, "");
1223
+ const r = await A(
1203
1224
  "getStorageValues",
1204
1225
  { keys: n },
1205
1226
  this.createRequestId(),
1206
1227
  { ...s, postEvent: this.postEvent }
1207
- ), i = g(_t(n, p()), "CloudStorageData").parse(r);
1228
+ ), i = f(dt(n, p()), "CloudStorageData").parse(r);
1208
1229
  return Array.isArray(t) ? i : i[t];
1209
1230
  }
1210
1231
  /**
@@ -1214,7 +1235,7 @@ class Ze extends ot {
1214
1235
  * @param options - request execution options.
1215
1236
  */
1216
1237
  async set(t, s, n = {}) {
1217
- await T(
1238
+ await A(
1218
1239
  "saveStorageValue",
1219
1240
  { key: t, value: s },
1220
1241
  this.createRequestId(),
@@ -1222,10 +1243,10 @@ class Ze extends ot {
1222
1243
  );
1223
1244
  }
1224
1245
  }
1225
- const Xe = d(
1226
- ({ createRequestId: e, postEvent: t, version: s }) => new Ze(s, e, t)
1246
+ const Ze = d(
1247
+ ({ createRequestId: e, postEvent: t, version: s }) => new Ye(s, e, t)
1227
1248
  );
1228
- class ts extends ot {
1249
+ class Xe extends it {
1229
1250
  constructor(t, s) {
1230
1251
  super(t, {
1231
1252
  impactOccurred: "web_app_trigger_haptic_feedback",
@@ -1267,10 +1288,10 @@ class ts extends ot {
1267
1288
  this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
1268
1289
  }
1269
1290
  }
1270
- const es = d(
1271
- ({ version: e, postEvent: t }) => new ts(e, t)
1291
+ const ts = d(
1292
+ ({ version: e, postEvent: t }) => new Xe(e, t)
1272
1293
  );
1273
- class ss {
1294
+ class es {
1274
1295
  constructor(t) {
1275
1296
  this.initData = t;
1276
1297
  }
@@ -1343,13 +1364,13 @@ class ss {
1343
1364
  return this.initData.user;
1344
1365
  }
1345
1366
  }
1346
- const ns = d(
1347
- ({ initData: e }) => e ? new ss(e) : void 0
1367
+ const ss = d(
1368
+ ({ initData: e }) => e ? new es(e) : void 0
1348
1369
  );
1349
- function Zs(e) {
1350
- return qt().parse(e);
1370
+ function Ys(e) {
1371
+ return kt().parse(e);
1351
1372
  }
1352
- class rs extends D {
1373
+ class ns extends N {
1353
1374
  constructor(t, s, n) {
1354
1375
  super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
1355
1376
  }
@@ -1379,7 +1400,7 @@ class rs extends D {
1379
1400
  }
1380
1401
  this.isOpened = !0;
1381
1402
  try {
1382
- return (await f({
1403
+ return (await m({
1383
1404
  method: "web_app_open_invoice",
1384
1405
  event: "invoice_closed",
1385
1406
  params: { slug: n },
@@ -1393,12 +1414,18 @@ class rs extends D {
1393
1414
  }
1394
1415
  }
1395
1416
  }
1396
- const is = d(
1397
- ({ version: e, postEvent: t }) => new rs(!1, e, t)
1417
+ const rs = d(
1418
+ ({ version: e, postEvent: t }) => new ns(!1, e, t)
1398
1419
  );
1399
- class os extends st {
1420
+ class is extends et {
1400
1421
  constructor({ postEvent: t, ...s }) {
1401
- super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? b("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? j("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" ? H("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
1423
+ }
1424
+ /**
1425
+ * The MainButton background color.
1426
+ */
1427
+ get bgColor() {
1428
+ return this.get("bgColor");
1402
1429
  }
1403
1430
  /**
1404
1431
  * Sends current local state to the Telegram application.
@@ -1409,10 +1436,35 @@ class os extends st {
1409
1436
  is_active: this.isEnabled,
1410
1437
  is_progress_visible: this.isLoaderVisible,
1411
1438
  text: this.text,
1412
- color: this.backgroundColor,
1439
+ color: this.bgColor,
1413
1440
  text_color: this.textColor
1414
1441
  });
1415
1442
  }
1443
+ /**
1444
+ * Disables the MainButton.
1445
+ * @see Does not work on Android: https://github.com/Telegram-Mini-Apps/issues/issues/1
1446
+ */
1447
+ disable() {
1448
+ return this.isEnabled = !1, this;
1449
+ }
1450
+ /**
1451
+ * Enables the MainButton.
1452
+ */
1453
+ enable() {
1454
+ return this.isEnabled = !0, this;
1455
+ }
1456
+ /**
1457
+ * Hides the MainButton.
1458
+ */
1459
+ hide() {
1460
+ return this.isVisible = !1, this;
1461
+ }
1462
+ /**
1463
+ * Hides the MainButton loading indicator.
1464
+ */
1465
+ hideLoader() {
1466
+ return this.isLoaderVisible = !1, this;
1467
+ }
1416
1468
  set isEnabled(t) {
1417
1469
  this.setParams({ isEnabled: t });
1418
1470
  }
@@ -1440,49 +1492,6 @@ class os extends st {
1440
1492
  get isVisible() {
1441
1493
  return this.get("isVisible");
1442
1494
  }
1443
- /**
1444
- * The MainButton background color.
1445
- */
1446
- get backgroundColor() {
1447
- return this.get("backgroundColor");
1448
- }
1449
- /**
1450
- * The MainButton text.
1451
- */
1452
- get text() {
1453
- return this.get("text");
1454
- }
1455
- /**
1456
- * The MainButton text color.
1457
- */
1458
- get textColor() {
1459
- return this.get("textColor");
1460
- }
1461
- /**
1462
- * Disables the MainButton.
1463
- * @see Does not work on Android: https://github.com/Telegram-Mini-Apps/issues/issues/1
1464
- */
1465
- disable() {
1466
- return this.isEnabled = !1, this;
1467
- }
1468
- /**
1469
- * Enables the MainButton.
1470
- */
1471
- enable() {
1472
- return this.isEnabled = !0, this;
1473
- }
1474
- /**
1475
- * Hides the MainButton.
1476
- */
1477
- hide() {
1478
- return this.isVisible = !1, this;
1479
- }
1480
- /**
1481
- * Hides the MainButton loading indicator.
1482
- */
1483
- hideLoader() {
1484
- return this.isLoaderVisible = !1, this;
1485
- }
1486
1495
  /**
1487
1496
  * Shows the MainButton.
1488
1497
  *
@@ -1514,10 +1523,10 @@ class os extends st {
1514
1523
  }
1515
1524
  /**
1516
1525
  * Updates current Main Button color.
1517
- * @param backgroundColor - color to set.
1526
+ * @param bgColor - color to set.
1518
1527
  */
1519
- setBackgroundColor(t) {
1520
- return this.setParams({ backgroundColor: t });
1528
+ setBgColor(t) {
1529
+ return this.setParams({ bgColor: t });
1521
1530
  }
1522
1531
  /**
1523
1532
  * Allows setting multiple Main Button parameters.
@@ -1526,22 +1535,37 @@ class os extends st {
1526
1535
  setParams(t) {
1527
1536
  return this.set(t), this.commit(), this;
1528
1537
  }
1538
+ /**
1539
+ * The MainButton text.
1540
+ */
1541
+ get text() {
1542
+ return this.get("text");
1543
+ }
1544
+ /**
1545
+ * The MainButton text color.
1546
+ */
1547
+ get textColor() {
1548
+ return this.get("textColor");
1549
+ }
1529
1550
  }
1530
- const as = d("mainButton", ({
1531
- postEvent: e,
1532
- themeParams: t,
1533
- state: s = {
1534
- isVisible: !1,
1535
- isEnabled: !1,
1536
- text: "",
1537
- isLoaderVisible: !1,
1538
- textColor: t.buttonTextColor || "#ffffff",
1539
- backgroundColor: t.buttonColor || "#000000"
1540
- }
1541
- }) => new os({ ...s, postEvent: e }));
1542
- function cs() {
1543
- return rt({
1544
- contact: g({
1551
+ const os = d(
1552
+ "mainButton",
1553
+ ({
1554
+ postEvent: e,
1555
+ themeParams: t,
1556
+ state: s = {
1557
+ isVisible: !1,
1558
+ isEnabled: !1,
1559
+ text: "",
1560
+ isLoaderVisible: !1,
1561
+ textColor: t.buttonTextColor || "#ffffff",
1562
+ bgColor: t.buttonColor || "#000000"
1563
+ }
1564
+ }) => new is({ ...s, postEvent: e })
1565
+ );
1566
+ function as() {
1567
+ return nt({
1568
+ contact: f({
1545
1569
  userId: {
1546
1570
  type: P(),
1547
1571
  from: "user_id"
@@ -1566,18 +1590,18 @@ function cs() {
1566
1590
  hash: p()
1567
1591
  }, "RequestedContact");
1568
1592
  }
1569
- function Wt(e, t) {
1593
+ function Ht(e, t) {
1570
1594
  return (s) => {
1571
1595
  const [n, r] = t[s];
1572
- return C(n, r, e);
1596
+ return x(n, r, e);
1573
1597
  };
1574
1598
  }
1575
- function hs(e) {
1599
+ function cs(e) {
1576
1600
  return new Promise((t) => {
1577
1601
  setTimeout(t, e);
1578
1602
  });
1579
1603
  }
1580
- class ps extends D {
1604
+ class hs extends N {
1581
1605
  constructor({ postEvent: t, createRequestId: s, version: n, botInline: r, ...i }) {
1582
1606
  super(i, n, {
1583
1607
  requestPhoneAccess: "web_app_request_phone",
@@ -1587,7 +1611,7 @@ class ps extends D {
1587
1611
  setBackgroundColor: "web_app_set_background_color"
1588
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;
1589
1613
  const o = this.supports.bind(this);
1590
- this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = Wt(n, {
1614
+ this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = Ht(n, {
1591
1615
  "setHeaderColor.color": ["web_app_set_header_color", "color"]
1592
1616
  });
1593
1617
  }
@@ -1598,8 +1622,8 @@ class ps extends D {
1598
1622
  async getRequestedContact({
1599
1623
  timeout: t = 1e4
1600
1624
  } = {}) {
1601
- return cs().parse(
1602
- await T(
1625
+ return as().parse(
1626
+ await A(
1603
1627
  "getRequestedContact",
1604
1628
  {},
1605
1629
  this.createRequestId(),
@@ -1638,7 +1662,7 @@ class ps extends D {
1638
1662
  * True if current Mini App background color is recognized as dark.
1639
1663
  */
1640
1664
  get isDark() {
1641
- return It(this.bgColor);
1665
+ return At(this.bgColor);
1642
1666
  }
1643
1667
  /**
1644
1668
  * Informs the Telegram app that the Mini App is ready to be displayed.
@@ -1673,9 +1697,9 @@ class ps extends D {
1673
1697
  return await this.getRequestedContact();
1674
1698
  } catch {
1675
1699
  }
1676
- await hs(n), n += 50;
1700
+ await cs(n), n += 50;
1677
1701
  }
1678
- throw At(t);
1702
+ throw Rt(t);
1679
1703
  }, t);
1680
1704
  }
1681
1705
  /**
@@ -1688,7 +1712,7 @@ class ps extends D {
1688
1712
  * @see requestContact
1689
1713
  */
1690
1714
  async requestPhoneAccess(t = {}) {
1691
- return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = f({
1715
+ return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = m({
1692
1716
  ...t,
1693
1717
  method: "web_app_request_phone",
1694
1718
  event: "phone_requested",
@@ -1700,7 +1724,7 @@ class ps extends D {
1700
1724
  * @param options - additional options.
1701
1725
  */
1702
1726
  async requestWriteAccess(t = {}) {
1703
- return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = f({
1727
+ return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = m({
1704
1728
  ...t,
1705
1729
  method: "web_app_request_write_access",
1706
1730
  event: "write_access_requested",
@@ -1730,7 +1754,7 @@ class ps extends D {
1730
1754
  * @param color - color key or RGB color.
1731
1755
  */
1732
1756
  setHeaderColor(t) {
1733
- this.postEvent("web_app_set_header_color", et(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
1757
+ this.postEvent("web_app_set_header_color", tt(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
1734
1758
  }
1735
1759
  /**
1736
1760
  * Updates current Mini App background color.
@@ -1758,16 +1782,19 @@ class ps extends D {
1758
1782
  this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
1759
1783
  }
1760
1784
  }
1761
- const us = d("miniApp", ({
1762
- themeParams: e,
1763
- botInline: t = !1,
1764
- state: s = {
1765
- bgColor: e.bgColor || "#ffffff",
1766
- headerColor: e.headerBgColor || "#000000"
1767
- },
1768
- ...n
1769
- }) => new ps({ ...n, ...s, botInline: t }));
1770
- function ds(e) {
1785
+ const ps = d(
1786
+ "miniApp",
1787
+ ({
1788
+ themeParams: e,
1789
+ botInline: t = !1,
1790
+ state: s = {
1791
+ bgColor: e.bgColor || "#ffffff",
1792
+ headerColor: e.headerBgColor || "#000000"
1793
+ },
1794
+ ...n
1795
+ }) => new hs({ ...n, ...s, botInline: t })
1796
+ );
1797
+ function us(e) {
1771
1798
  const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
1772
1799
  let r;
1773
1800
  if (s.length > 64)
@@ -1791,7 +1818,7 @@ function ds(e) {
1791
1818
  return { ...i, id: o };
1792
1819
  }) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
1793
1820
  }
1794
- class ls extends D {
1821
+ class ls extends N {
1795
1822
  constructor(t, s, n) {
1796
1823
  super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
1797
1824
  }
@@ -1820,11 +1847,11 @@ class ls extends D {
1820
1847
  throw new Error("Popup is already opened.");
1821
1848
  this.isOpened = !0;
1822
1849
  try {
1823
- const { button_id: s = null } = await f({
1850
+ const { button_id: s = null } = await m({
1824
1851
  event: "popup_closed",
1825
1852
  method: "web_app_open_popup",
1826
1853
  postEvent: this.postEvent,
1827
- params: ds(t)
1854
+ params: us(t)
1828
1855
  });
1829
1856
  return s;
1830
1857
  } finally {
@@ -1832,10 +1859,10 @@ class ls extends D {
1832
1859
  }
1833
1860
  }
1834
1861
  }
1835
- const _s = d(
1862
+ const ds = d(
1836
1863
  ({ postEvent: e, version: t }) => new ls(!1, t, e)
1837
1864
  );
1838
- class gs extends D {
1865
+ class _s extends N {
1839
1866
  constructor(t, s, n) {
1840
1867
  super({ isOpened: t }, s, {
1841
1868
  close: "web_app_close_scan_qr_popup",
@@ -1868,7 +1895,7 @@ class gs extends D {
1868
1895
  throw new Error("QR scanner is already opened.");
1869
1896
  this.isOpened = !0;
1870
1897
  try {
1871
- return (await f({
1898
+ return (await m({
1872
1899
  method: "web_app_open_scan_qr_popup",
1873
1900
  event: ["qr_text_received", "scan_qr_popup_closed"],
1874
1901
  postEvent: this.postEvent,
@@ -1879,15 +1906,15 @@ class gs extends D {
1879
1906
  }
1880
1907
  }
1881
1908
  }
1882
- const fs = d(
1883
- ({ version: e, postEvent: t }) => new gs(!1, e, t)
1909
+ const gs = d(
1910
+ ({ version: e, postEvent: t }) => new _s(!1, e, t)
1884
1911
  );
1885
- class ms extends nt {
1912
+ class fs extends st {
1886
1913
  constructor(t, s, n) {
1887
1914
  super({ isVisible: t }, s, {
1888
1915
  show: "web_app_setup_settings_button",
1889
1916
  hide: "web_app_setup_settings_button"
1890
- }), c(this, "on", (r, i) => r === "click" ? b("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? j("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" ? H("settings_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
1891
1918
  }
1892
1919
  set isVisible(t) {
1893
1920
  this.set("isVisible", t), this.postEvent("web_app_setup_settings_button", { is_visible: t });
@@ -1911,15 +1938,18 @@ class ms extends nt {
1911
1938
  this.isVisible = !0;
1912
1939
  }
1913
1940
  }
1914
- const ws = d("settingsButton", ({
1915
- version: e,
1916
- postEvent: t,
1917
- state: s = { isVisible: !1 }
1918
- }) => new ms(s.isVisible, e, t));
1919
- function jt(e) {
1920
- return Dt().parse(e);
1941
+ const ms = d(
1942
+ "settingsButton",
1943
+ ({
1944
+ version: e,
1945
+ postEvent: t,
1946
+ state: s = { isVisible: !1 }
1947
+ }) => new fs(s.isVisible, e, t)
1948
+ );
1949
+ function Wt(e) {
1950
+ return qt().parse(e);
1921
1951
  }
1922
- class bs extends it {
1952
+ class bs extends rt {
1923
1953
  /**
1924
1954
  * @since v6.10
1925
1955
  */
@@ -1958,7 +1988,7 @@ class bs extends it {
1958
1988
  * value is calculated according to theme bg color.
1959
1989
  */
1960
1990
  get isDark() {
1961
- return !this.bgColor || It(this.bgColor);
1991
+ return !this.bgColor || At(this.bgColor);
1962
1992
  }
1963
1993
  get linkColor() {
1964
1994
  return this.get("linkColor");
@@ -1983,8 +2013,8 @@ class bs extends it {
1983
2013
  * @returns Function to stop listening.
1984
2014
  */
1985
2015
  listen() {
1986
- return b("theme_changed", (t) => {
1987
- this.set(jt(t.theme_params));
2016
+ return v("theme_changed", (t) => {
2017
+ this.set(Wt(t.theme_params));
1988
2018
  });
1989
2019
  }
1990
2020
  /**
@@ -1997,20 +2027,23 @@ class bs extends it {
1997
2027
  return this.get("textColor");
1998
2028
  }
1999
2029
  }
2000
- const vs = d("themeParams", ({ themeParams: e, state: t = e }) => {
2001
- const s = new bs(t);
2002
- return E() || s.listen(), s;
2003
- });
2004
- function Xs(e = {}) {
2005
- return f({
2030
+ const ws = d(
2031
+ "themeParams",
2032
+ ({ themeParams: e, state: t = e, addCleanup: s }) => {
2033
+ const n = new bs(t);
2034
+ return s(n.listen()), n;
2035
+ }
2036
+ );
2037
+ function Zs(e = {}) {
2038
+ return m({
2006
2039
  ...e,
2007
2040
  method: "web_app_request_theme",
2008
2041
  event: "theme_changed"
2009
- }).then(jt);
2042
+ }).then(Wt);
2010
2043
  }
2011
- class ys extends ot {
2044
+ class vs extends it {
2012
2045
  constructor(t, s, n) {
2013
- super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = Wt(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 = Ht(t, {
2014
2047
  "openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
2015
2048
  });
2016
2049
  }
@@ -2025,7 +2058,7 @@ class ys extends ot {
2025
2058
  */
2026
2059
  openLink(t, s) {
2027
2060
  const n = new URL(t, window.location.href).toString();
2028
- if (!C("web_app_open_link", this.version)) {
2061
+ if (!x("web_app_open_link", this.version)) {
2029
2062
  window.open(n, "_blank");
2030
2063
  return;
2031
2064
  }
@@ -2044,7 +2077,7 @@ class ys extends ot {
2044
2077
  const { hostname: s, pathname: n, search: r } = new URL(t, window.location.href);
2045
2078
  if (s !== "t.me")
2046
2079
  throw new Error(`URL has not allowed hostname: ${s}. Only "t.me" is allowed`);
2047
- if (!C("web_app_open_tg_link", this.version)) {
2080
+ if (!x("web_app_open_tg_link", this.version)) {
2048
2081
  window.location.href = t;
2049
2082
  return;
2050
2083
  }
@@ -2059,41 +2092,41 @@ class ys extends ot {
2059
2092
  async readTextFromClipboard() {
2060
2093
  const t = this.createRequestId(), {
2061
2094
  data: s = null
2062
- } = await f({
2095
+ } = await m({
2063
2096
  method: "web_app_read_text_from_clipboard",
2064
2097
  event: "clipboard_text_received",
2065
2098
  postEvent: this.postEvent,
2066
2099
  params: { req_id: t },
2067
- capture: Rt(t)
2100
+ capture: St(t)
2068
2101
  });
2069
2102
  return s;
2070
2103
  }
2071
2104
  }
2072
- const Es = d(
2073
- ({ version: e, postEvent: t, createRequestId: s }) => new ys(e, s, t)
2105
+ const ys = d(
2106
+ ({ version: e, postEvent: t, createRequestId: s }) => new vs(e, s, t)
2074
2107
  );
2075
- async function Gt(e = {}) {
2108
+ async function jt(e = {}) {
2076
2109
  const {
2077
2110
  is_expanded: t,
2078
2111
  is_state_stable: s,
2079
2112
  ...n
2080
- } = await f({
2113
+ } = await m({
2081
2114
  ...e,
2082
2115
  method: "web_app_request_viewport",
2083
2116
  event: "viewport_changed"
2084
2117
  });
2085
2118
  return { ...n, isExpanded: t, isStateStable: s };
2086
2119
  }
2087
- function A(e) {
2120
+ function T(e) {
2088
2121
  return e < 0 ? 0 : e;
2089
2122
  }
2090
- class zt extends it {
2123
+ class Es extends rt {
2091
2124
  constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
2092
2125
  super({
2093
- height: A(n),
2126
+ height: T(n),
2094
2127
  isExpanded: i,
2095
- stableHeight: A(s),
2096
- width: A(r)
2128
+ stableHeight: T(s),
2129
+ width: T(r)
2097
2130
  }), c(this, "postEvent"), this.postEvent = t;
2098
2131
  }
2099
2132
  /**
@@ -2102,7 +2135,7 @@ class zt extends it {
2102
2135
  * @param options - options to request fresh data.
2103
2136
  */
2104
2137
  async sync(t) {
2105
- const { isStateStable: s, ...n } = await Gt(t);
2138
+ const { isStateStable: s, ...n } = await jt(t);
2106
2139
  this.set({
2107
2140
  ...n,
2108
2141
  stableHeight: s ? n.height : this.get("stableHeight")
@@ -2149,17 +2182,17 @@ class zt extends it {
2149
2182
  * @returns Function to stop listening.
2150
2183
  */
2151
2184
  listen() {
2152
- return b("viewport_changed", (t) => {
2185
+ return v("viewport_changed", (t) => {
2153
2186
  const {
2154
2187
  height: s,
2155
2188
  width: n,
2156
2189
  is_expanded: r,
2157
2190
  is_state_stable: i
2158
- } = t, o = A(s);
2191
+ } = t, o = T(s);
2159
2192
  this.set({
2160
2193
  height: o,
2161
2194
  isExpanded: r,
2162
- width: A(n),
2195
+ width: T(n),
2163
2196
  ...i ? { stableHeight: o } : {}
2164
2197
  });
2165
2198
  });
@@ -2194,99 +2227,80 @@ class zt extends it {
2194
2227
  return this.stableHeight === this.height;
2195
2228
  }
2196
2229
  }
2197
- async function Ps(e, t = {}) {
2198
- const {
2199
- height: s,
2200
- width: n,
2201
- isExpanded: r,
2202
- isStateStable: i
2203
- } = await Gt({ ...t, postEvent: e });
2204
- return new zt({
2205
- postEvent: e,
2206
- height: s,
2207
- width: n,
2208
- isExpanded: r,
2209
- stableHeight: i ? s : 0
2210
- });
2211
- }
2212
- function xs({
2213
- state: e,
2214
- platform: t,
2215
- postEvent: s
2216
- }) {
2217
- let n = !1, r = 0, i = 0, o = 0;
2218
- return e ? (n = e.isExpanded, r = e.height, i = e.width, o = e.stableHeight) : ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t) && (n = !0, r = window.innerHeight, i = window.innerWidth, o = window.innerHeight), new zt({
2219
- postEvent: s,
2220
- height: r,
2221
- width: i,
2222
- stableHeight: o,
2223
- isExpanded: n
2224
- });
2225
- }
2226
- const Cs = d(
2230
+ const Ps = d(
2227
2231
  "viewport",
2228
- async (e) => {
2229
- if (E() && !e.state)
2230
- throw m(
2231
- vt,
2232
- "Viewport cannot be instantiated on the server side without passing the ssr.state object."
2233
- );
2234
- let t = xs(e);
2235
- return E() || (t.width === 0 && await Ps(e.postEvent, { timeout: 1e3 }).then((s) => t = s).catch((s) => $.error("Unable to sync viewport state", s)), t.listen()), t;
2232
+ async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
2233
+ let r = !1, i = 0, o = 0, a = 0;
2234
+ if (e)
2235
+ r = e.isExpanded, i = e.height, o = e.width, a = e.stableHeight;
2236
+ else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
2237
+ r = !0, i = window.innerHeight, o = window.innerWidth, a = window.innerHeight;
2238
+ else {
2239
+ const u = await jt({ timeout: 1e3, postEvent: s });
2240
+ r = u.isExpanded, i = u.height, o = u.width, a = u.isStateStable ? i : 0;
2241
+ }
2242
+ const h = new Es({
2243
+ postEvent: s,
2244
+ height: i,
2245
+ width: o,
2246
+ stableHeight: a,
2247
+ isExpanded: r
2248
+ });
2249
+ return n(h.listen()), h;
2236
2250
  }
2237
2251
  );
2238
- function y(e, t) {
2252
+ function E(e, t) {
2239
2253
  document.documentElement.style.setProperty(e, t);
2240
2254
  }
2241
- function tn(e, t, s) {
2255
+ function Xs(e, t, s) {
2242
2256
  s || (s = (a) => `--tg-${a}-color`);
2243
2257
  const n = s("header"), r = s("bg"), i = () => {
2244
2258
  const { headerColor: a } = e;
2245
- if (et(a))
2246
- y(n, a);
2259
+ if (tt(a))
2260
+ E(n, a);
2247
2261
  else {
2248
2262
  const { bgColor: h, secondaryBgColor: u } = t;
2249
- a === "bg_color" && h ? y(n, h) : a === "secondary_bg_color" && u && y(n, u);
2263
+ a === "bg_color" && h ? E(n, h) : a === "secondary_bg_color" && u && E(n, u);
2250
2264
  }
2251
- y(r, e.bgColor);
2265
+ E(r, e.bgColor);
2252
2266
  }, o = [
2253
2267
  t.on("change", i),
2254
2268
  e.on("change", i)
2255
2269
  ];
2256
2270
  return i(), () => o.forEach((a) => a());
2257
2271
  }
2258
- function en(e, t) {
2272
+ function tn(e, t) {
2259
2273
  t || (t = (n) => `--tg-theme-${n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`);
2260
2274
  const s = () => {
2261
2275
  Object.entries(e.getState()).forEach(([n, r]) => {
2262
- r && y(t(n), r);
2276
+ r && E(t(n), r);
2263
2277
  });
2264
2278
  };
2265
2279
  return s(), e.on("change", s);
2266
2280
  }
2267
- function sn(e, t) {
2281
+ function en(e, t) {
2268
2282
  t || (t = (u) => `--tg-viewport-${u}`);
2269
2283
  const [
2270
2284
  s,
2271
2285
  n,
2272
2286
  r
2273
- ] = ["height", "width", "stable-height"].map((u) => t(u)), i = () => y(s, `${e.height}px`), o = () => y(n, `${e.width}px`), a = () => y(r, `${e.stableHeight}px`), h = [
2287
+ ] = ["height", "width", "stable-height"].map((u) => t(u)), i = () => E(s, `${e.height}px`), o = () => E(n, `${e.width}px`), a = () => E(r, `${e.stableHeight}px`), h = [
2274
2288
  e.on("change:height", i),
2275
2289
  e.on("change:width", o),
2276
2290
  e.on("change:stableHeight", a)
2277
2291
  ];
2278
2292
  return i(), o(), a(), () => h.forEach((u) => u());
2279
2293
  }
2280
- function Ss(e = !0) {
2294
+ function xs(e = !0) {
2281
2295
  const t = [
2282
- b("reload_iframe", () => {
2296
+ v("reload_iframe", () => {
2283
2297
  k("iframe_will_reload"), window.location.reload();
2284
2298
  })
2285
2299
  ], s = () => t.forEach((n) => n());
2286
2300
  if (e) {
2287
2301
  const n = document.createElement("style");
2288
2302
  n.id = "telegram-custom-styles", document.head.appendChild(n), t.push(
2289
- b("set_custom_style", (r) => {
2303
+ v("set_custom_style", (r) => {
2290
2304
  n.innerHTML = r;
2291
2305
  }),
2292
2306
  () => document.head.removeChild(n)
@@ -2294,22 +2308,25 @@ function Ss(e = !0) {
2294
2308
  }
2295
2309
  return k("iframe_ready", { reload_supported: !0 }), s;
2296
2310
  }
2311
+ function sn() {
2312
+ return typeof window > "u";
2313
+ }
2297
2314
  async function nn() {
2298
- if (xt(window))
2315
+ if (Pt(window))
2299
2316
  return !0;
2300
2317
  try {
2301
- return await f({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
2318
+ return await m({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
2302
2319
  } catch {
2303
2320
  return !1;
2304
2321
  }
2305
2322
  }
2306
- function Rs(e) {
2307
- return e instanceof U;
2323
+ function Cs(e) {
2324
+ return e instanceof $;
2308
2325
  }
2309
2326
  function rn(e, t) {
2310
- return Rs(e) && e.type === t;
2327
+ return Cs(e) && e.type === t;
2311
2328
  }
2312
- function z(e, t) {
2329
+ function j(e, t) {
2313
2330
  let s, n, r;
2314
2331
  return typeof e == "string" ? s = e : (s = e.pathname === void 0 ? t : e.pathname, n = e.params, r = e.id), Object.freeze({
2315
2332
  id: r || (Math.random() * 2 ** 14 | 0).toString(16),
@@ -2317,23 +2334,23 @@ function z(e, t) {
2317
2334
  params: n
2318
2335
  });
2319
2336
  }
2320
- class As {
2337
+ class Ss {
2321
2338
  constructor(t, s, n = k) {
2322
- if (c(this, "history"), c(this, "ee", new L()), 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)
2323
- throw m(le, "History should not be empty.");
2339
+ 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.");
2324
2341
  if (s < 0 || s >= t.length)
2325
- throw m(
2326
- _e,
2342
+ throw b(
2343
+ de,
2327
2344
  "Index should not be zero and higher or equal than history size."
2328
2345
  );
2329
- this.history = t.map((r) => z(r, ""));
2346
+ this.history = t.map((r) => j(r, ""));
2330
2347
  }
2331
2348
  /**
2332
2349
  * Allows this navigator to control the `BackButton` visibility state. It also tracks the
2333
2350
  * `BackButton` clicks and calls the `back` method.
2334
2351
  */
2335
2352
  attach() {
2336
- this.attached || (this.attached = !0, this.sync(), b("back_button_pressed", this.back));
2353
+ this.attached || (this.attached = !0, this.sync(), v("back_button_pressed", this.back));
2337
2354
  }
2338
2355
  /**
2339
2356
  * Currently active history item.
@@ -2345,7 +2362,7 @@ class As {
2345
2362
  * Prevents current navigator from controlling the BackButton visibility state.
2346
2363
  */
2347
2364
  detach() {
2348
- this.attached = !1, j("back_button_pressed", this.back);
2365
+ this.attached = !1, H("back_button_pressed", this.back);
2349
2366
  }
2350
2367
  /**
2351
2368
  * Goes to the next history item.
@@ -2401,14 +2418,14 @@ class As {
2401
2418
  * @param item - item to add.
2402
2419
  */
2403
2420
  push(t) {
2404
- this.hasNext && this.history.splice(this.index + 1), this.replaceAndMove(this.index + 1, z(t, this.current.pathname));
2421
+ this.hasNext && this.history.splice(this.index + 1), this.replaceAndMove(this.index + 1, j(t, this.current.pathname));
2405
2422
  }
2406
2423
  /**
2407
2424
  * Replaces the current history item.
2408
2425
  * @param item - item to replace the current item with.
2409
2426
  */
2410
2427
  replace(t) {
2411
- this.replaceAndMove(this.index, z(t, this.current.pathname));
2428
+ this.replaceAndMove(this.index, j(t, this.current.pathname));
2412
2429
  }
2413
2430
  /**
2414
2431
  * Sets history item by the specified index.
@@ -2438,18 +2455,18 @@ class As {
2438
2455
  this.postEvent("web_app_setup_back_button", { is_visible: !!this.index });
2439
2456
  }
2440
2457
  }
2441
- function K({
2458
+ function G({
2442
2459
  params: e,
2443
2460
  ...t
2444
2461
  }) {
2445
2462
  return { ...e || { hash: "", search: "" }, ...t };
2446
2463
  }
2447
- function O(e, t) {
2464
+ function q(e, t) {
2448
2465
  return e.startsWith(t) ? e : `${t}${e}`;
2449
2466
  }
2450
2467
  function M(e) {
2451
2468
  return new URL(
2452
- typeof e == "string" ? e : `${e.pathname || ""}${O(e.search || "", "?")}${O(e.hash || "", "#")}`,
2469
+ typeof e == "string" ? e : `${e.pathname || ""}${q(e.search || "", "?")}${q(e.hash || "", "#")}`,
2453
2470
  "http://a"
2454
2471
  );
2455
2472
  }
@@ -2457,16 +2474,16 @@ function B(e) {
2457
2474
  const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = M(e);
2458
2475
  return `${t ? s.pathname : s.pathname.slice(1)}${s.search}${s.hash}`;
2459
2476
  }
2460
- function J(e, t, s) {
2477
+ function K(e, t, s) {
2461
2478
  let n, r;
2462
2479
  typeof e == "string" ? n = e : (n = B(e), s = e.state, r = e.id);
2463
- const { pathname: i, search: o, hash: a } = new URL(n, `http://a${O(t, "/")}`);
2480
+ const { pathname: i, search: o, hash: a } = new URL(n, `http://a${q(t, "/")}`);
2464
2481
  return { id: r, pathname: i, params: { hash: a, search: o, state: s } };
2465
2482
  }
2466
2483
  async function I(e) {
2467
2484
  return e === 0 ? !0 : Promise.race([
2468
2485
  new Promise((t) => {
2469
- const s = Z("popstate", () => {
2486
+ const s = Q("popstate", () => {
2470
2487
  s(), t(!0);
2471
2488
  });
2472
2489
  window.history.go(e);
@@ -2477,23 +2494,23 @@ async function I(e) {
2477
2494
  })
2478
2495
  ]);
2479
2496
  }
2480
- async function Ts() {
2497
+ async function Rs() {
2481
2498
  if (window.history.length <= 1 || (window.history.pushState(null, ""), await I(1 - window.history.length)))
2482
2499
  return;
2483
2500
  let e = await I(-1);
2484
2501
  for (; e; )
2485
2502
  e = await I(-1);
2486
2503
  }
2487
- function Kt(e) {
2504
+ function Gt(e) {
2488
2505
  return M(e).pathname;
2489
2506
  }
2490
- const gt = 0, Q = 1, F = 2;
2491
- class Jt {
2492
- constructor(t, s, { postEvent: n, hashMode: r, base: i } = {}) {
2493
- c(this, "navigator"), c(this, "ee", new L()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
2507
+ const _t = 0, z = 1, J = 2;
2508
+ class Kt {
2509
+ constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
2510
+ c(this, "navigator"), c(this, "ee", new O()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
2494
2511
  if (o === null)
2495
2512
  return this.push(this.parsePath(window.location.href));
2496
- o === gt ? window.history.forward() : o === Q && this.back(), o === F && this.forward();
2513
+ o === _t ? window.history.forward() : o === z && this.back(), o === J && this.forward();
2497
2514
  }), c(this, "onNavigatorChange", async ({
2498
2515
  to: o,
2499
2516
  from: a,
@@ -2501,15 +2518,15 @@ class Jt {
2501
2518
  }) => {
2502
2519
  this.attached && await this.syncHistory(), this.ee.emit("change", {
2503
2520
  delta: h,
2504
- from: K(a),
2505
- to: K(o),
2521
+ from: G(a),
2522
+ to: G(o),
2506
2523
  navigator: this
2507
2524
  });
2508
- }), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new As(
2509
- t.map((o) => J(o, "/")),
2525
+ }), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new Ss(
2526
+ t.map((o) => K(o, "/")),
2510
2527
  s,
2511
2528
  n
2512
- ), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = Kt(i || "");
2529
+ ), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = Gt(i || "");
2513
2530
  }
2514
2531
  /**
2515
2532
  * Attaches current navigator to the browser history allowing navigator to manipulate it.
@@ -2593,7 +2610,7 @@ class Jt {
2593
2610
  * Navigation history.
2594
2611
  */
2595
2612
  get history() {
2596
- return this.navigator.history.map(K);
2613
+ return this.navigator.history.map(G);
2597
2614
  }
2598
2615
  /**
2599
2616
  * Path, including pathname, search and hash.
@@ -2644,11 +2661,11 @@ class Jt {
2644
2661
  };
2645
2662
  }
2646
2663
  push(t, s) {
2647
- const n = J(t, this.path), { state: r = s } = n.params;
2664
+ const n = K(t, this.path), { state: r = s } = n.params;
2648
2665
  this.navigator.push({ ...n, params: { ...n.params, state: r } });
2649
2666
  }
2650
2667
  replace(t, s) {
2651
- const n = J(t, this.path), { state: r = s } = n.params;
2668
+ const n = K(t, this.path), { state: r = s } = n.params;
2652
2669
  this.navigator.replace({ ...n, params: { ...n.params, state: r } });
2653
2670
  }
2654
2671
  /**
@@ -2657,8 +2674,8 @@ class Jt {
2657
2674
  * @param value - path presented as string or URLLike.
2658
2675
  */
2659
2676
  renderPath(t) {
2660
- const s = (this.base.length === 1 ? "" : this.base) + O(B(t), "/");
2661
- return this.hashMode ? O(s.slice(1), this.hashMode === "default" ? "#" : "#/") : s;
2677
+ const s = (this.base.length === 1 ? "" : this.base) + q(B(t), "/");
2678
+ return this.hashMode ? q(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
2662
2679
  }
2663
2680
  /**
2664
2681
  * Synchronizes current navigator state with browser history.
@@ -2666,7 +2683,7 @@ class Jt {
2666
2683
  async syncHistory() {
2667
2684
  window.removeEventListener("popstate", this.onPopState);
2668
2685
  const { state: t } = this, s = this.renderPath(this);
2669
- await Ts(), this.hasPrev && this.hasNext ? (window.history.replaceState(Q, ""), window.history.pushState(t, "", s), window.history.pushState(F, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(Q, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(F, ""), await I(-1)) : (window.history.replaceState(gt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
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);
2670
2687
  }
2671
2688
  /**
2672
2689
  * Current query parameters.
@@ -2684,109 +2701,121 @@ class Jt {
2684
2701
  return (this.navigator.current.params || {}).state;
2685
2702
  }
2686
2703
  }
2687
- function Is(e) {
2704
+ function Ts(e) {
2688
2705
  e || (e = {});
2689
2706
  const { href: t, hash: s } = window.location;
2690
2707
  let n = B(
2691
- e.hashMode ? s.includes("?") ? s.slice(1) : `?${s.slice(1)}` : t
2708
+ e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
2692
2709
  );
2693
- const r = e.base ? Kt(e.base) : void 0;
2710
+ const r = e.base ? Gt(e.base) : void 0;
2694
2711
  if (r) {
2695
2712
  if (!n.startsWith(r))
2696
- throw m(
2697
- ge,
2713
+ throw b(
2714
+ _e,
2698
2715
  `Path "${n}" expected to be starting with "${r}"`
2699
2716
  );
2700
2717
  n = n.slice(r.length);
2701
2718
  }
2702
- return new Jt([n], 0, e);
2719
+ return new Kt([n], 0, e);
2703
2720
  }
2704
2721
  function on(e) {
2705
2722
  const t = e.match(/#(.+)/);
2706
2723
  return t ? t[1] : null;
2707
2724
  }
2708
- function ks(e, t) {
2709
- if (Ut()) {
2725
+ function As(e, t) {
2726
+ if (Lt()) {
2710
2727
  const s = sessionStorage.getItem(e);
2711
2728
  if (s)
2712
2729
  try {
2713
2730
  const { index: n, history: r } = JSON.parse(s);
2714
- return new Jt(r, n, t);
2731
+ return new Kt(r, n, t);
2715
2732
  } catch (n) {
2716
2733
  console.error("Unable to restore hash navigator state.", n);
2717
2734
  }
2718
2735
  }
2719
- return Is(t);
2736
+ return Ts(t);
2720
2737
  }
2721
2738
  function an(e, t) {
2722
- const s = ks(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2739
+ const s = As(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2723
2740
  index: s.index,
2724
2741
  history: s.history
2725
2742
  }));
2726
2743
  return s.on("change", n), n(), s;
2727
2744
  }
2728
- function l(e) {
2729
- return (t, s, ...n) => (r) => ft(s, ct(() => ct({
2745
+ function _(e) {
2746
+ return (t, s, ...n) => (r) => gt(s, at(() => at({
2730
2747
  [t]: e(...n)
2731
2748
  }, r)));
2732
2749
  }
2733
- const Qt = Ft();
2734
- function Os() {
2735
- const e = Yt(Qt);
2750
+ const zt = Qt();
2751
+ function Is() {
2752
+ const e = Yt(zt);
2736
2753
  if (!e)
2737
2754
  throw new Error("useSDK was used outside of SDKProvider.");
2738
2755
  return e;
2739
2756
  }
2740
- function _(e) {
2741
- return (...t) => Os()(e, ...t);
2757
+ function g(e) {
2758
+ return (...t) => {
2759
+ const s = Is()(e, ...t), n = () => s.signal();
2760
+ return Object.defineProperty(n, "error", () => s.error), n;
2761
+ };
2742
2762
  }
2743
- const qs = _(je), cn = l(qs), Ds = _(ze), hn = l(Ds), Ns = _(Je), pn = l(Ns), Vs = _(Xe), un = l(Vs), Ms = _(es), dn = l(Ms), Bs = _(ns), ln = l(Bs), $s = _(is), _n = l($s), Ls = _(as), gn = l(Ls), Us = _(us), fn = l(Us), Hs = _(_s), mn = l(Hs), Ws = _(fs), wn = l(Ws), js = _(ws), bn = l(js), Gs = _(vs), vn = l(Gs), zs = _(Es), yn = l(zs), Ks = _(Cs), En = l(Ks), Pn = (e) => {
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) => {
2744
2764
  const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
2745
2765
  if (t.has(n))
2746
2766
  return t.get(n);
2747
- const [i] = Xt(() => {
2748
- try {
2749
- return n(...r);
2750
- } catch (h) {
2751
- return [h];
2752
- }
2753
- }), o = pt(() => {
2754
- if (i.error)
2755
- return [i.error];
2756
- if (i.state !== "ready")
2767
+ function i(l) {
2768
+ return t.set(n, l), l;
2769
+ }
2770
+ let o;
2771
+ try {
2772
+ o = n(...r);
2773
+ } catch (l) {
2774
+ return i({
2775
+ error: l,
2776
+ signal: () => {
2777
+ throw l;
2778
+ }
2779
+ });
2780
+ }
2781
+ let a;
2782
+ Array.isArray(o) && ([o, a] = o);
2783
+ const [h] = Zt(() => o), u = pt(() => {
2784
+ if (h.state !== "ready")
2757
2785
  return;
2758
- const h = i();
2759
- if (Array.isArray(h) || !h || !("on" in h))
2760
- return h;
2761
- const u = te((V) => (V(h), h.on("change", () => V(h)))), N = Object.getPrototypeOf(h), G = {};
2762
- return new Proxy(h, {
2763
- get(V, x) {
2764
- if (!(x in G)) {
2765
- const at = Reflect.getOwnPropertyDescriptor(N, x);
2766
- G[x] = at && "get" in at ? pt(() => u()[x]) : () => Reflect.get(V, x);
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, {
2791
+ get(V, C) {
2792
+ 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);
2767
2795
  }
2768
- return G[x]();
2796
+ return W[C]();
2769
2797
  }
2770
2798
  });
2771
2799
  });
2772
- function a() {
2773
- const h = o();
2774
- if (Array.isArray(h))
2775
- throw h[0];
2776
- return h;
2777
- }
2778
- return Object.defineProperty(a, "error", {
2779
- get() {
2780
- const h = o();
2781
- return Array.isArray(h) ? h[0] : void 0;
2782
- }
2783
- }), t.set(n, a), a;
2800
+ return i({
2801
+ signal() {
2802
+ if (h.error)
2803
+ throw h.error;
2804
+ return u();
2805
+ },
2806
+ get error() {
2807
+ return h.error;
2808
+ },
2809
+ cleanup: a
2810
+ });
2784
2811
  };
2785
- return ht(() => {
2786
- ie(e.debug || !1);
2812
+ return ct(() => {
2813
+ re(e.debug || !1);
2814
+ }), ct(() => {
2815
+ xt() && ht(xs(e.acceptCustomStyles));
2787
2816
  }), ht(() => {
2788
- Ct() && Zt(Ss(e.acceptCustomStyles));
2789
- }), ft(Qt.Provider, {
2817
+ t.forEach((n) => n.cleanup && n.cleanup());
2818
+ }), gt(zt.Provider, {
2790
2819
  value: s,
2791
2820
  get children() {
2792
2821
  return e.children;
@@ -2794,135 +2823,135 @@ const qs = _(je), cn = l(qs), Ds = _(ze), hn = l(Ds), Ns = _(Je), pn = l(Ns), Vs
2794
2823
  });
2795
2824
  };
2796
2825
  export {
2797
- ke as BackButton,
2798
- As as BasicNavigator,
2799
- lt as BiometryManager,
2800
- Jt as BrowserNavigator,
2826
+ Ae as BackButton,
2827
+ Ss as BasicNavigator,
2828
+ We as BiometryManager,
2829
+ Kt as BrowserNavigator,
2801
2830
  Ke as ClosingBehavior,
2802
- Ze as CloudStorage,
2803
- ge as ERR_INVALID_PATH_BASE,
2804
- pe as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
2805
- ce as ERR_METHOD_PARAMETER_UNSUPPORTED,
2806
- ae as ERR_METHOD_UNSUPPORTED,
2831
+ 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,
2807
2836
  le as ERR_NAVIGATION_HISTORY_EMPTY,
2808
- _e as ERR_NAVIGATION_INDEX_INVALID,
2809
- Qs as ERR_NAVIGATION_ITEM_INVALID,
2810
- bt as ERR_PARSE,
2811
- vt as ERR_SSR_INIT,
2812
- ue as ERR_TIMED_OUT,
2813
- de as ERR_UNEXPECTED_TYPE,
2814
- he as ERR_UNKNOWN_ENV,
2815
- L as EventEmitter,
2816
- ts as HapticFeedback,
2817
- ss as InitData,
2818
- rs as Invoice,
2819
- os as MainButton,
2820
- ps as MiniApp,
2837
+ de as ERR_NAVIGATION_INDEX_INVALID,
2838
+ zs as ERR_NAVIGATION_ITEM_INVALID,
2839
+ wt as ERR_PARSE,
2840
+ Js as ERR_SSR_INIT,
2841
+ pe as ERR_TIMED_OUT,
2842
+ ue as ERR_UNEXPECTED_TYPE,
2843
+ ce as ERR_UNKNOWN_ENV,
2844
+ O as EventEmitter,
2845
+ Xe as HapticFeedback,
2846
+ es as InitData,
2847
+ ns as Invoice,
2848
+ is as MainButton,
2849
+ hs as MiniApp,
2821
2850
  ls as Popup,
2822
- gs as QRScanner,
2823
- U as SDKError,
2851
+ _s as QRScanner,
2852
+ $ as SDKError,
2824
2853
  Pn as SDKProvider,
2825
- ms as SettingsButton,
2854
+ fs as SettingsButton,
2826
2855
  bs as ThemeParams,
2827
- ys as Utils,
2828
- zt as Viewport,
2829
- Ye as array,
2830
- tn as bindMiniAppCSSVars,
2831
- en as bindThemeParamsCSSVars,
2832
- sn as bindViewportCSSVars,
2833
- v as boolean,
2834
- Rt as captureSameReq,
2835
- X as classNames,
2836
- Se as compareVersions,
2837
- Is as createBrowserNavigatorFromLocation,
2838
- Te as createPostEvent,
2856
+ vs as Utils,
2857
+ Es as Viewport,
2858
+ Qe as array,
2859
+ Xs as bindMiniAppCSSVars,
2860
+ tn as bindThemeParamsCSSVars,
2861
+ en as bindViewportCSSVars,
2862
+ y as boolean,
2863
+ St as captureSameReq,
2864
+ Y as classNames,
2865
+ xe as compareVersions,
2866
+ Ts as createBrowserNavigatorFromLocation,
2867
+ Re as createPostEvent,
2839
2868
  M as createSafeURL,
2840
2869
  Ot as date,
2841
2870
  on as getHash,
2842
- Kt as getPathname,
2843
- je as initBackButton,
2844
- ze as initBiometryManager,
2845
- Je as initClosingBehavior,
2846
- Xe as initCloudStorage,
2847
- es as initHapticFeedback,
2848
- ns as initInitData,
2849
- is as initInvoice,
2850
- as as initMainButton,
2851
- us as initMiniApp,
2871
+ Gt as getPathname,
2872
+ He as initBackButton,
2873
+ Ge as initBiometryManager,
2874
+ ze as initClosingBehavior,
2875
+ Ze as initCloudStorage,
2876
+ ts as initHapticFeedback,
2877
+ ss as initInitData,
2878
+ rs as initInvoice,
2879
+ os as initMainButton,
2880
+ ps as initMiniApp,
2852
2881
  an as initNavigator,
2853
- _s as initPopup,
2854
- fs as initQRScanner,
2855
- ws as initSettingsButton,
2856
- vs as initThemeParams,
2857
- Es as initUtils,
2858
- Cs as initViewport,
2859
- Ss as initWeb,
2860
- T as invokeCustomMethod,
2861
- It as isColorDark,
2862
- Ct as isIframe,
2863
- Ut as isPageReload,
2864
- et as isRGB,
2865
- fe as isRGBShort,
2866
- Rs as isSDKError,
2882
+ ds as initPopup,
2883
+ gs as initQRScanner,
2884
+ ms as initSettingsButton,
2885
+ ws as initThemeParams,
2886
+ ys as initUtils,
2887
+ Ps as initViewport,
2888
+ xs as initWeb,
2889
+ A as invokeCustomMethod,
2890
+ At as isColorDark,
2891
+ xt as isIframe,
2892
+ Lt as isPageReload,
2893
+ tt as isRGB,
2894
+ ge as isRGBShort,
2895
+ Cs as isSDKError,
2867
2896
  rn as isSDKErrorOfType,
2868
- E as isSSR,
2897
+ sn as isSSR,
2869
2898
  nn as isTMA,
2870
- g as json,
2871
- Ys as mergeClassNames,
2899
+ f as json,
2900
+ Qs as mergeClassNames,
2872
2901
  P as number,
2873
- j as off,
2874
- b as on,
2875
- Zs as parseInitData,
2876
- Nt as parseLaunchParams,
2877
- jt as parseThemeParams,
2902
+ H as off,
2903
+ v as on,
2904
+ Ys as parseInitData,
2905
+ Dt as parseLaunchParams,
2906
+ Wt as parseThemeParams,
2878
2907
  k as postEvent,
2879
- f as request,
2880
- Ge as requestBiometryInfo,
2881
- Xs as requestThemeParams,
2882
- Gt as requestViewport,
2883
- Ue as retrieveLaunchParams,
2884
- Pt as rgb,
2885
- rt as searchParams,
2886
- $e as serializeLaunchParams,
2887
- Be as serializeThemeParams,
2888
- y as setCSSVar,
2889
- ie as setDebug,
2908
+ m as request,
2909
+ je as requestBiometryInfo,
2910
+ Zs as requestThemeParams,
2911
+ jt as requestViewport,
2912
+ $e as retrieveLaunchParams,
2913
+ Et as rgb,
2914
+ nt as searchParams,
2915
+ Me as serializeLaunchParams,
2916
+ Ve as serializeThemeParams,
2917
+ E as setCSSVar,
2918
+ re as setDebug,
2890
2919
  Fs as setTargetOrigin,
2891
2920
  p as string,
2892
- ne as subscribe,
2893
- C as supports,
2894
- Ae as targetOrigin,
2895
- Et as toRGB,
2896
- wt as unsubscribe,
2921
+ se as subscribe,
2922
+ x as supports,
2923
+ Se as targetOrigin,
2924
+ yt as toRGB,
2925
+ mt as unsubscribe,
2897
2926
  B as urlToPath,
2898
- qs as useBackButton,
2899
- Ds as useBiometryManager,
2900
- Ns as useClosingBehavior,
2901
- Vs as useCloudStorage,
2902
- Ms as useHapticFeedback,
2903
- Bs as useInitData,
2904
- $s as useInvoice,
2905
- Ls as useMainButton,
2906
- Us as useMiniApp,
2907
- Hs as usePopup,
2908
- Ws as useQRScanner,
2909
- Os as useSDK,
2910
- js as useSettingsButton,
2911
- Gs as useThemeParams,
2912
- zs as useUtils,
2913
- Ks as useViewport,
2927
+ Os as useBackButton,
2928
+ ks as useBiometryManager,
2929
+ qs as useClosingBehavior,
2930
+ Ds as useCloudStorage,
2931
+ Ns as useHapticFeedback,
2932
+ Vs as useInitData,
2933
+ Ms as useInvoice,
2934
+ Bs as useMainButton,
2935
+ $s as useMiniApp,
2936
+ Ls as usePopup,
2937
+ Us as useQRScanner,
2938
+ Is as useSDK,
2939
+ Hs as useSettingsButton,
2940
+ Ws as useThemeParams,
2941
+ js as useUtils,
2942
+ Gs as useViewport,
2914
2943
  cn as withBackButton,
2915
2944
  hn as withBiometryManager,
2916
2945
  pn as withClosingBehavior,
2917
2946
  un as withCloudStorage,
2918
- dn as withHapticFeedback,
2919
- ln as withInitData,
2947
+ ln as withHapticFeedback,
2948
+ dn as withInitData,
2920
2949
  _n as withInvoice,
2921
2950
  gn as withMainButton,
2922
2951
  fn as withMiniApp,
2923
2952
  mn as withPopup,
2924
- wn as withQRScanner,
2925
- bn as withSettingsButton,
2953
+ bn as withQRScanner,
2954
+ wn as withSettingsButton,
2926
2955
  vn as withThemeParams,
2927
2956
  Tt as withTimeout,
2928
2957
  yn as withUtils,