@tma.js/sdk-react 2.1.3 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dts/SDKProvider/SDKProvider.types.d.ts +3 -4
- package/dist/dts/createHOCs.d.ts +6 -10
- package/dist/dts/createHooks.d.ts +6 -7
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +750 -731
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
var
|
|
4
|
-
function
|
|
1
|
+
import { jsx as mt } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as te, useContext as ee, useState as bt, useEffect as S, useMemo as vt, useRef as dt, useCallback as se } from "react";
|
|
3
|
+
var ne = Object.defineProperty, re = (e, t, s) => t in e ? ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (re(e, typeof t != "symbol" ? t + "" : t, s), s);
|
|
4
|
+
function yt(e, t) {
|
|
5
5
|
let s;
|
|
6
6
|
const n = () => {
|
|
7
7
|
s !== void 0 && t && t(s), s = void 0;
|
|
8
8
|
};
|
|
9
9
|
return [() => s === void 0 ? s = e(n) : s, n];
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
const t =
|
|
13
|
-
t.unsubscribe(e), s && !t.count &&
|
|
11
|
+
function Et(e) {
|
|
12
|
+
const t = j(), { count: s } = t;
|
|
13
|
+
t.unsubscribe(e), s && !t.count && Ce();
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
function ie(e) {
|
|
16
|
+
return j().subscribe(e), () => Et(e);
|
|
17
17
|
}
|
|
18
|
-
class
|
|
18
|
+
class oe {
|
|
19
19
|
constructor(t, s = {}) {
|
|
20
20
|
this.scope = t, this.options = s;
|
|
21
21
|
}
|
|
@@ -31,12 +31,12 @@ class ae {
|
|
|
31
31
|
second: "2-digit",
|
|
32
32
|
fractionalSecondDigits: 3,
|
|
33
33
|
timeZone: "UTC"
|
|
34
|
-
}).format(n), { textColor: i, bgColor:
|
|
34
|
+
}).format(n), { textColor: i, bgColor: o } = this.options, a = "font-weight: bold;padding: 0 5px;border-radius:5px";
|
|
35
35
|
console[t](
|
|
36
36
|
`%c${r}%c / %c${this.scope}`,
|
|
37
|
-
`${
|
|
37
|
+
`${a};background-color: lightblue;color:black`,
|
|
38
38
|
"",
|
|
39
|
-
`${
|
|
39
|
+
`${a};${i ? `color:${i};` : ""}${o ? `background-color:${o}` : ""}`,
|
|
40
40
|
...s
|
|
41
41
|
);
|
|
42
42
|
}
|
|
@@ -55,21 +55,21 @@ class ae {
|
|
|
55
55
|
this.print("log", ...t);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
const st = new
|
|
58
|
+
const st = new oe("SDK", {
|
|
59
59
|
bgColor: "forestgreen",
|
|
60
60
|
textColor: "white"
|
|
61
61
|
});
|
|
62
62
|
let X = !1;
|
|
63
|
-
const
|
|
64
|
-
st.log("Event received:", t
|
|
63
|
+
const _t = ({ name: e, payload: t }) => {
|
|
64
|
+
st.log("Event received:", t ? { name: e, payload: t } : { name: e });
|
|
65
65
|
};
|
|
66
|
-
function
|
|
67
|
-
X !== e && (X = e, e ?
|
|
66
|
+
function ae(e) {
|
|
67
|
+
X !== e && (X = e, e ? ie(_t) : Et(_t));
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function ce(...e) {
|
|
70
70
|
X && st.log(...e);
|
|
71
71
|
}
|
|
72
|
-
class
|
|
72
|
+
class N {
|
|
73
73
|
constructor() {
|
|
74
74
|
c(this, "listeners", /* @__PURE__ */ new Map()), c(this, "listenersCount", 0), c(this, "subscribeListeners", []);
|
|
75
75
|
}
|
|
@@ -142,19 +142,30 @@ class H {
|
|
|
142
142
|
function tt(e, t, s) {
|
|
143
143
|
return window.addEventListener(e, t, s), () => window.removeEventListener(e, t, s);
|
|
144
144
|
}
|
|
145
|
+
function Pt(...e) {
|
|
146
|
+
let t = !1;
|
|
147
|
+
const s = [...e];
|
|
148
|
+
return [
|
|
149
|
+
(n) => !t && s.push(n),
|
|
150
|
+
() => {
|
|
151
|
+
t || (t = !0, s.forEach((n) => n()));
|
|
152
|
+
},
|
|
153
|
+
t
|
|
154
|
+
];
|
|
155
|
+
}
|
|
145
156
|
class W extends Error {
|
|
146
157
|
constructor(t, s, n) {
|
|
147
158
|
super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, W.prototype);
|
|
148
159
|
}
|
|
149
160
|
}
|
|
150
|
-
function
|
|
161
|
+
function m(e, t, s) {
|
|
151
162
|
return new W(e, t, s);
|
|
152
163
|
}
|
|
153
|
-
const
|
|
154
|
-
function
|
|
155
|
-
return
|
|
164
|
+
const he = "ERR_METHOD_UNSUPPORTED", pe = "ERR_METHOD_PARAMETER_UNSUPPORTED", ue = "ERR_UNKNOWN_ENV", le = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", de = "ERR_TIMED_OUT", _e = "ERR_UNEXPECTED_TYPE", Rt = "ERR_PARSE", ge = "ERR_NAVIGATION_LIST_EMPTY", we = "ERR_NAVIGATION_CURSOR_INVALID", dn = "ERR_NAVIGATION_ITEM_INVALID", _n = "ERR_SSR_INIT", fe = "ERR_INVALID_PATH_BASE";
|
|
165
|
+
function T() {
|
|
166
|
+
return m(_e, "Value has unexpected type");
|
|
156
167
|
}
|
|
157
|
-
class
|
|
168
|
+
class G {
|
|
158
169
|
constructor(t, s, n) {
|
|
159
170
|
this.parser = t, this.isOptional = s, this.type = n;
|
|
160
171
|
}
|
|
@@ -169,8 +180,8 @@ class j {
|
|
|
169
180
|
try {
|
|
170
181
|
return this.parser(t);
|
|
171
182
|
} catch (s) {
|
|
172
|
-
throw
|
|
173
|
-
|
|
183
|
+
throw m(
|
|
184
|
+
Rt,
|
|
174
185
|
`Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
|
|
175
186
|
s
|
|
176
187
|
);
|
|
@@ -180,10 +191,10 @@ class j {
|
|
|
180
191
|
return this.isOptional = !0, this;
|
|
181
192
|
}
|
|
182
193
|
}
|
|
183
|
-
function
|
|
184
|
-
return () => new
|
|
194
|
+
function A(e, t) {
|
|
195
|
+
return () => new G(e, !1, t);
|
|
185
196
|
}
|
|
186
|
-
const P =
|
|
197
|
+
const P = A((e) => {
|
|
187
198
|
if (typeof e == "boolean")
|
|
188
199
|
return e;
|
|
189
200
|
const t = String(e);
|
|
@@ -191,26 +202,26 @@ const P = T((e) => {
|
|
|
191
202
|
return !0;
|
|
192
203
|
if (t === "0" || t === "false")
|
|
193
204
|
return !1;
|
|
194
|
-
throw
|
|
205
|
+
throw T();
|
|
195
206
|
}, "boolean");
|
|
196
|
-
function
|
|
207
|
+
function xt(e, t) {
|
|
197
208
|
const s = {};
|
|
198
209
|
for (const n in e) {
|
|
199
210
|
const r = e[n];
|
|
200
211
|
if (!r)
|
|
201
212
|
continue;
|
|
202
|
-
let i,
|
|
213
|
+
let i, o;
|
|
203
214
|
if (typeof r == "function" || "parse" in r)
|
|
204
|
-
i = n,
|
|
215
|
+
i = n, o = typeof r == "function" ? r : r.parse.bind(r);
|
|
205
216
|
else {
|
|
206
|
-
const { type:
|
|
207
|
-
i = r.from || n,
|
|
217
|
+
const { type: a } = r;
|
|
218
|
+
i = r.from || n, o = typeof a == "function" ? a : a.parse.bind(a);
|
|
208
219
|
}
|
|
209
220
|
try {
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
} catch (
|
|
213
|
-
throw
|
|
221
|
+
const a = o(t(i));
|
|
222
|
+
a !== void 0 && (s[n] = a);
|
|
223
|
+
} catch (a) {
|
|
224
|
+
throw m(Rt, `Unable to parse field "${n}"`, a);
|
|
214
225
|
}
|
|
215
226
|
}
|
|
216
227
|
return s;
|
|
@@ -218,16 +229,16 @@ function Ct(e, t) {
|
|
|
218
229
|
function nt(e) {
|
|
219
230
|
let t = e;
|
|
220
231
|
if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
|
|
221
|
-
throw
|
|
232
|
+
throw T();
|
|
222
233
|
return t;
|
|
223
234
|
}
|
|
224
|
-
function
|
|
225
|
-
return new
|
|
235
|
+
function g(e, t) {
|
|
236
|
+
return new G((s) => {
|
|
226
237
|
const n = nt(s);
|
|
227
|
-
return
|
|
238
|
+
return xt(e, (r) => n[r]);
|
|
228
239
|
}, !1, t);
|
|
229
240
|
}
|
|
230
|
-
const x =
|
|
241
|
+
const x = A((e) => {
|
|
231
242
|
if (typeof e == "number")
|
|
232
243
|
return e;
|
|
233
244
|
if (typeof e == "string") {
|
|
@@ -235,19 +246,19 @@ const x = T((e) => {
|
|
|
235
246
|
if (!Number.isNaN(t))
|
|
236
247
|
return t;
|
|
237
248
|
}
|
|
238
|
-
throw
|
|
249
|
+
throw T();
|
|
239
250
|
}, "number");
|
|
240
251
|
function rt(e) {
|
|
241
252
|
return /^#[\da-f]{6}$/i.test(e);
|
|
242
253
|
}
|
|
243
|
-
function
|
|
254
|
+
function me(e) {
|
|
244
255
|
return /^#[\da-f]{3}$/i.test(e);
|
|
245
256
|
}
|
|
246
|
-
function
|
|
257
|
+
function Ct(e) {
|
|
247
258
|
const t = e.replace(/\s/g, "").toLowerCase();
|
|
248
259
|
if (rt(t))
|
|
249
260
|
return t;
|
|
250
|
-
if (
|
|
261
|
+
if (me(t)) {
|
|
251
262
|
let n = "#";
|
|
252
263
|
for (let r = 0; r < 3; r += 1)
|
|
253
264
|
n += t[1 + r].repeat(2);
|
|
@@ -261,30 +272,30 @@ function St(e) {
|
|
|
261
272
|
return n + (i.length === 1 ? "0" : "") + i;
|
|
262
273
|
}, "#");
|
|
263
274
|
}
|
|
264
|
-
const
|
|
275
|
+
const p = A((e) => {
|
|
265
276
|
if (typeof e == "string" || typeof e == "number")
|
|
266
277
|
return e.toString();
|
|
267
|
-
throw
|
|
268
|
-
}, "string"),
|
|
269
|
-
function
|
|
270
|
-
return
|
|
271
|
-
eventType:
|
|
278
|
+
throw T();
|
|
279
|
+
}, "string"), St = A((e) => Ct(p().parse(e)), "rgb");
|
|
280
|
+
function be(e) {
|
|
281
|
+
return g({
|
|
282
|
+
eventType: p(),
|
|
272
283
|
eventData: (t) => t
|
|
273
284
|
}).parse(e);
|
|
274
285
|
}
|
|
275
|
-
function
|
|
286
|
+
function ve() {
|
|
276
287
|
["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
|
|
277
288
|
delete window[e];
|
|
278
289
|
});
|
|
279
290
|
}
|
|
280
|
-
function
|
|
291
|
+
function ye(e, t) {
|
|
281
292
|
window.dispatchEvent(new MessageEvent("message", {
|
|
282
293
|
data: JSON.stringify({ eventType: e, eventData: t }),
|
|
283
294
|
// We specify window.parent to imitate the case, the parent iframe sent us this event.
|
|
284
295
|
source: window.parent
|
|
285
296
|
}));
|
|
286
297
|
}
|
|
287
|
-
function
|
|
298
|
+
function Ee() {
|
|
288
299
|
[
|
|
289
300
|
["TelegramGameProxy_receiveEvent"],
|
|
290
301
|
// Windows Phone.
|
|
@@ -296,67 +307,62 @@ function Pe() {
|
|
|
296
307
|
let t = window;
|
|
297
308
|
e.forEach((s, n, r) => {
|
|
298
309
|
if (n === r.length - 1) {
|
|
299
|
-
t[s] =
|
|
310
|
+
t[s] = ye;
|
|
300
311
|
return;
|
|
301
312
|
}
|
|
302
313
|
s in t || (t[s] = {}), t = t[s];
|
|
303
314
|
});
|
|
304
315
|
});
|
|
305
316
|
}
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
req_id: h(),
|
|
311
|
-
data: (e) => e === null ? e : h().optional().parse(e)
|
|
317
|
+
const Pe = {
|
|
318
|
+
clipboard_text_received: g({
|
|
319
|
+
req_id: p(),
|
|
320
|
+
data: (e) => e === null ? e : p().optional().parse(e)
|
|
312
321
|
}),
|
|
313
|
-
custom_method_invoked:
|
|
314
|
-
req_id:
|
|
322
|
+
custom_method_invoked: g({
|
|
323
|
+
req_id: p(),
|
|
315
324
|
result: (e) => e,
|
|
316
|
-
error:
|
|
317
|
-
}),
|
|
318
|
-
invoice_closed: w({
|
|
319
|
-
slug: h(),
|
|
320
|
-
status: h()
|
|
321
|
-
}),
|
|
322
|
-
phone_requested: w({
|
|
323
|
-
status: h()
|
|
325
|
+
error: p().optional()
|
|
324
326
|
}),
|
|
327
|
+
invoice_closed: g({ slug: p(), status: p() }),
|
|
328
|
+
phone_requested: g({ status: p() }),
|
|
325
329
|
popup_closed: {
|
|
326
|
-
parse
|
|
330
|
+
parse(e) {
|
|
331
|
+
return g({
|
|
332
|
+
button_id: (t) => t == null ? void 0 : p().parse(t)
|
|
333
|
+
}).parse(e ?? {});
|
|
334
|
+
}
|
|
327
335
|
},
|
|
328
|
-
qr_text_received:
|
|
329
|
-
|
|
330
|
-
}),
|
|
331
|
-
theme_changed: w({
|
|
336
|
+
qr_text_received: g({ data: p().optional() }),
|
|
337
|
+
theme_changed: g({
|
|
332
338
|
theme_params: (e) => {
|
|
333
|
-
const t =
|
|
339
|
+
const t = St().optional();
|
|
334
340
|
return Object.entries(nt(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
|
|
335
341
|
}
|
|
336
342
|
}),
|
|
337
|
-
viewport_changed:
|
|
343
|
+
viewport_changed: g({
|
|
338
344
|
height: x(),
|
|
339
345
|
width: (e) => e == null ? window.innerWidth : x().parse(e),
|
|
340
346
|
is_state_stable: P(),
|
|
341
347
|
is_expanded: P()
|
|
342
348
|
}),
|
|
343
|
-
write_access_requested:
|
|
344
|
-
status: h()
|
|
345
|
-
})
|
|
349
|
+
write_access_requested: g({ status: p() })
|
|
346
350
|
};
|
|
347
|
-
function
|
|
348
|
-
const e = new
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
function Re() {
|
|
352
|
+
const e = new N(), t = new N();
|
|
353
|
+
t.subscribe((n) => {
|
|
354
|
+
e.emit("event", { name: n.event, payload: n.args[0] });
|
|
355
|
+
}), Ee();
|
|
356
|
+
const [, s] = Pt(
|
|
351
357
|
// Don't forget to remove created handlers.
|
|
352
|
-
|
|
358
|
+
ve,
|
|
353
359
|
// Add "resize" event listener to make sure, we always have fresh viewport information.
|
|
354
360
|
// Desktop version of Telegram is sometimes not sending the viewport_changed
|
|
355
361
|
// event. For example, when the MainButton is shown. That's why we should
|
|
356
362
|
// add our own listener to make sure, viewport information is always fresh.
|
|
357
363
|
// Issue: https://github.com/Telegram-Mini-Apps/tma.js/issues/10
|
|
358
364
|
tt("resize", () => {
|
|
359
|
-
|
|
365
|
+
t.emit("viewport_changed", {
|
|
360
366
|
width: window.innerWidth,
|
|
361
367
|
height: window.innerHeight,
|
|
362
368
|
is_state_stable: !0,
|
|
@@ -365,67 +371,78 @@ function Ce() {
|
|
|
365
371
|
}),
|
|
366
372
|
// Add listener, which handles events sent from the Telegram web application and also events
|
|
367
373
|
// generated by the local emitEvent function.
|
|
368
|
-
tt("message", (
|
|
369
|
-
if (
|
|
374
|
+
tt("message", (n) => {
|
|
375
|
+
if (n.source !== window.parent)
|
|
370
376
|
return;
|
|
371
|
-
let
|
|
377
|
+
let r;
|
|
372
378
|
try {
|
|
373
|
-
|
|
379
|
+
r = be(n.data);
|
|
374
380
|
} catch {
|
|
375
381
|
return;
|
|
376
382
|
}
|
|
377
|
-
const { eventType:
|
|
383
|
+
const { eventType: i, eventData: o } = r, a = Pe[i];
|
|
378
384
|
try {
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
} catch (
|
|
385
|
+
const u = a ? a.parse(o) : o;
|
|
386
|
+
t.emit(...u ? [i, u] : [i]);
|
|
387
|
+
} catch (u) {
|
|
382
388
|
st.error(
|
|
383
|
-
`An error occurred processing the "${
|
|
384
|
-
|
|
385
|
-
|
|
389
|
+
`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`,
|
|
390
|
+
r,
|
|
391
|
+
u
|
|
386
392
|
);
|
|
387
393
|
}
|
|
388
394
|
}),
|
|
389
|
-
// Clear
|
|
390
|
-
() => e.clear()
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
+
// Clear emitters.
|
|
396
|
+
() => e.clear(),
|
|
397
|
+
() => t.clear()
|
|
398
|
+
);
|
|
399
|
+
return [{
|
|
400
|
+
on: t.on.bind(t),
|
|
401
|
+
off: t.off.bind(t),
|
|
402
|
+
subscribe(n) {
|
|
403
|
+
return e.on("event", n);
|
|
404
|
+
},
|
|
405
|
+
unsubscribe(n) {
|
|
406
|
+
e.off("event", n);
|
|
407
|
+
},
|
|
408
|
+
get count() {
|
|
409
|
+
return t.count + e.count;
|
|
410
|
+
}
|
|
411
|
+
}, s];
|
|
395
412
|
}
|
|
396
|
-
const [
|
|
413
|
+
const [xe, Ce] = yt(
|
|
397
414
|
(e) => {
|
|
398
|
-
const [t, s] =
|
|
415
|
+
const [t, s] = Re(), n = t.off.bind(t);
|
|
399
416
|
return t.off = (r, i) => {
|
|
400
|
-
const { count:
|
|
401
|
-
n(r, i),
|
|
417
|
+
const { count: o } = t;
|
|
418
|
+
n(r, i), o && !t.count && e();
|
|
402
419
|
}, [t, s];
|
|
403
420
|
},
|
|
404
421
|
([, e]) => e()
|
|
405
422
|
);
|
|
406
|
-
function
|
|
407
|
-
return
|
|
423
|
+
function j() {
|
|
424
|
+
return xe()[0];
|
|
408
425
|
}
|
|
409
426
|
function z(e, t) {
|
|
410
|
-
|
|
427
|
+
j().off(e, t);
|
|
411
428
|
}
|
|
412
429
|
function E(e, t, s) {
|
|
413
|
-
return
|
|
430
|
+
return j().on(e, t, s);
|
|
414
431
|
}
|
|
415
432
|
function V(e) {
|
|
416
433
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
417
434
|
}
|
|
418
|
-
function
|
|
435
|
+
function Se(e, t) {
|
|
419
436
|
const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
|
|
420
437
|
for (let i = 0; i < r; i += 1) {
|
|
421
|
-
const
|
|
422
|
-
if (
|
|
423
|
-
return
|
|
438
|
+
const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
|
|
439
|
+
if (o !== a)
|
|
440
|
+
return o > a ? 1 : -1;
|
|
424
441
|
}
|
|
425
442
|
return 0;
|
|
426
443
|
}
|
|
427
444
|
function y(e, t) {
|
|
428
|
-
return
|
|
445
|
+
return Se(e, t) <= 0;
|
|
429
446
|
}
|
|
430
447
|
function C(e, t, s) {
|
|
431
448
|
if (typeof s == "string") {
|
|
@@ -478,13 +495,13 @@ function C(e, t, s) {
|
|
|
478
495
|
].includes(e);
|
|
479
496
|
}
|
|
480
497
|
}
|
|
481
|
-
function
|
|
498
|
+
function Te(e) {
|
|
482
499
|
return "external" in e && V(e.external) && "notify" in e.external && typeof e.external.notify == "function";
|
|
483
500
|
}
|
|
484
|
-
function
|
|
501
|
+
function Tt(e) {
|
|
485
502
|
return "TelegramWebviewProxy" in e && V(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
|
|
486
503
|
}
|
|
487
|
-
function
|
|
504
|
+
function At() {
|
|
488
505
|
try {
|
|
489
506
|
return window.self !== window.top;
|
|
490
507
|
} catch {
|
|
@@ -492,55 +509,55 @@ function kt() {
|
|
|
492
509
|
}
|
|
493
510
|
}
|
|
494
511
|
let It = "https://web.telegram.org";
|
|
495
|
-
function
|
|
512
|
+
function gn(e) {
|
|
496
513
|
It = e;
|
|
497
514
|
}
|
|
498
|
-
function
|
|
515
|
+
function Ae() {
|
|
499
516
|
return It;
|
|
500
517
|
}
|
|
501
|
-
function
|
|
518
|
+
function B(e, t, s) {
|
|
502
519
|
let n = {}, r;
|
|
503
520
|
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);
|
|
504
|
-
const { targetOrigin: i =
|
|
505
|
-
if (
|
|
521
|
+
const { targetOrigin: i = Ae() } = n;
|
|
522
|
+
if (ce("Posting event:", r ? { event: e, data: r } : { event: e }), At()) {
|
|
506
523
|
window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
|
|
507
524
|
return;
|
|
508
525
|
}
|
|
509
|
-
if (
|
|
526
|
+
if (Te(window)) {
|
|
510
527
|
window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
|
|
511
528
|
return;
|
|
512
529
|
}
|
|
513
|
-
if (
|
|
530
|
+
if (Tt(window)) {
|
|
514
531
|
window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
|
|
515
532
|
return;
|
|
516
533
|
}
|
|
517
|
-
throw
|
|
518
|
-
|
|
534
|
+
throw m(
|
|
535
|
+
ue,
|
|
519
536
|
"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."
|
|
520
537
|
);
|
|
521
538
|
}
|
|
522
|
-
function
|
|
539
|
+
function Ie(e) {
|
|
523
540
|
return (t, s) => {
|
|
524
541
|
if (!C(t, e))
|
|
525
|
-
throw
|
|
542
|
+
throw m(he, `Method "${t}" is unsupported in Mini Apps version ${e}`);
|
|
526
543
|
if (V(s)) {
|
|
527
544
|
let n;
|
|
528
545
|
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))
|
|
529
|
-
throw
|
|
530
|
-
|
|
546
|
+
throw m(
|
|
547
|
+
pe,
|
|
531
548
|
`Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
|
|
532
549
|
);
|
|
533
550
|
}
|
|
534
|
-
return
|
|
551
|
+
return B(t, s);
|
|
535
552
|
};
|
|
536
553
|
}
|
|
537
|
-
function
|
|
554
|
+
function kt(e) {
|
|
538
555
|
return ({ req_id: t }) => t === e;
|
|
539
556
|
}
|
|
540
557
|
function qt(e) {
|
|
541
|
-
return
|
|
558
|
+
return m(de, `Timeout reached: ${e}ms`);
|
|
542
559
|
}
|
|
543
|
-
function
|
|
560
|
+
function Ot(e, t) {
|
|
544
561
|
return Promise.race([
|
|
545
562
|
typeof e == "function" ? e() : e,
|
|
546
563
|
new Promise((s, n) => {
|
|
@@ -550,30 +567,30 @@ function Dt(e, t) {
|
|
|
550
567
|
})
|
|
551
568
|
]);
|
|
552
569
|
}
|
|
553
|
-
async function
|
|
570
|
+
async function w(e) {
|
|
554
571
|
let t;
|
|
555
|
-
const s = new Promise((
|
|
556
|
-
t =
|
|
572
|
+
const s = new Promise((h) => {
|
|
573
|
+
t = h;
|
|
557
574
|
}), {
|
|
558
575
|
method: n,
|
|
559
576
|
event: r,
|
|
560
577
|
capture: i,
|
|
561
|
-
postEvent:
|
|
562
|
-
timeout:
|
|
563
|
-
} = e,
|
|
564
|
-
(
|
|
578
|
+
postEvent: o = B,
|
|
579
|
+
timeout: a
|
|
580
|
+
} = e, u = (Array.isArray(r) ? r : [r]).map(
|
|
581
|
+
(h) => E(h, (v) => (!i || i(v)) && t(v))
|
|
565
582
|
);
|
|
566
583
|
try {
|
|
567
|
-
return
|
|
584
|
+
return o(n, e.params), await (a ? Ot(s, a) : s);
|
|
568
585
|
} finally {
|
|
569
|
-
|
|
586
|
+
u.forEach((h) => h());
|
|
570
587
|
}
|
|
571
588
|
}
|
|
572
|
-
async function
|
|
589
|
+
async function O(e, t, s, n = {}) {
|
|
573
590
|
const {
|
|
574
591
|
result: r,
|
|
575
592
|
error: i
|
|
576
|
-
} = await
|
|
593
|
+
} = await w({
|
|
577
594
|
...n,
|
|
578
595
|
method: "web_app_invoke_custom_method",
|
|
579
596
|
event: "custom_method_invoked",
|
|
@@ -582,10 +599,10 @@ async function q(e, t, s, n = {}) {
|
|
|
582
599
|
params: t,
|
|
583
600
|
req_id: s
|
|
584
601
|
},
|
|
585
|
-
capture:
|
|
602
|
+
capture: kt(s)
|
|
586
603
|
});
|
|
587
604
|
if (i)
|
|
588
|
-
throw
|
|
605
|
+
throw m(le, i);
|
|
589
606
|
return r;
|
|
590
607
|
}
|
|
591
608
|
function et(...e) {
|
|
@@ -598,14 +615,14 @@ function et(...e) {
|
|
|
598
615
|
return et(...t);
|
|
599
616
|
}).filter(Boolean).join(" ");
|
|
600
617
|
}
|
|
601
|
-
function
|
|
618
|
+
function wn(...e) {
|
|
602
619
|
return e.reduce((t, s) => (V(s) && Object.entries(s).forEach(([n, r]) => {
|
|
603
620
|
const i = et(t[n], r);
|
|
604
621
|
i.length && (t[n] = i);
|
|
605
622
|
}), t), {});
|
|
606
623
|
}
|
|
607
|
-
function
|
|
608
|
-
const t =
|
|
624
|
+
function Dt(e) {
|
|
625
|
+
const t = Ct(e);
|
|
609
626
|
return Math.sqrt(
|
|
610
627
|
[0.299, 0.587, 0.114].reduce((s, n, r) => {
|
|
611
628
|
const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
|
|
@@ -613,9 +630,9 @@ function Nt(e) {
|
|
|
613
630
|
}, 0)
|
|
614
631
|
) < 120;
|
|
615
632
|
}
|
|
616
|
-
class
|
|
633
|
+
class ke {
|
|
617
634
|
constructor(t) {
|
|
618
|
-
c(this, "ee", new
|
|
635
|
+
c(this, "ee", new N()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
|
|
619
636
|
}
|
|
620
637
|
/**
|
|
621
638
|
* Clones current state and returns its copy.
|
|
@@ -636,18 +653,18 @@ class qe {
|
|
|
636
653
|
}
|
|
637
654
|
class it {
|
|
638
655
|
constructor(t) {
|
|
639
|
-
c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new
|
|
656
|
+
c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new ke(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);
|
|
640
657
|
}
|
|
641
658
|
}
|
|
642
|
-
function
|
|
659
|
+
function Nt(e, t) {
|
|
643
660
|
return (s) => C(t[s], e);
|
|
644
661
|
}
|
|
645
662
|
class ot extends it {
|
|
646
663
|
constructor(t, s, n) {
|
|
647
|
-
super(t), c(this, "supports"), this.supports =
|
|
664
|
+
super(t), c(this, "supports"), this.supports = Nt(s, n);
|
|
648
665
|
}
|
|
649
666
|
}
|
|
650
|
-
class
|
|
667
|
+
class qe extends ot {
|
|
651
668
|
constructor(t, s, n) {
|
|
652
669
|
super({ isVisible: t }, s, {
|
|
653
670
|
show: "web_app_setup_back_button",
|
|
@@ -676,28 +693,28 @@ class De extends ot {
|
|
|
676
693
|
this.isVisible = !0;
|
|
677
694
|
}
|
|
678
695
|
}
|
|
679
|
-
const
|
|
696
|
+
const Bt = A((e) => e instanceof Date ? e : new Date(x().parse(e) * 1e3), "Date");
|
|
680
697
|
function at(e, t) {
|
|
681
|
-
return new
|
|
698
|
+
return new G((s) => {
|
|
682
699
|
if (typeof s != "string" && !(s instanceof URLSearchParams))
|
|
683
|
-
throw
|
|
700
|
+
throw T();
|
|
684
701
|
const n = typeof s == "string" ? new URLSearchParams(s) : s;
|
|
685
|
-
return
|
|
702
|
+
return xt(e, (r) => {
|
|
686
703
|
const i = n.get(r);
|
|
687
704
|
return i === null ? void 0 : i;
|
|
688
705
|
});
|
|
689
706
|
}, !1, t);
|
|
690
707
|
}
|
|
691
|
-
const
|
|
708
|
+
const Oe = g({
|
|
692
709
|
id: x(),
|
|
693
|
-
type:
|
|
694
|
-
title:
|
|
710
|
+
type: p(),
|
|
711
|
+
title: p(),
|
|
695
712
|
photoUrl: {
|
|
696
|
-
type:
|
|
713
|
+
type: p().optional(),
|
|
697
714
|
from: "photo_url"
|
|
698
715
|
},
|
|
699
|
-
username:
|
|
700
|
-
}, "Chat").optional(),
|
|
716
|
+
username: p().optional()
|
|
717
|
+
}, "Chat").optional(), gt = g({
|
|
701
718
|
addedToAttachmentMenu: {
|
|
702
719
|
type: P().optional(),
|
|
703
720
|
from: "added_to_attachment_menu"
|
|
@@ -707,7 +724,7 @@ const Ne = w({
|
|
|
707
724
|
from: "allows_write_to_pm"
|
|
708
725
|
},
|
|
709
726
|
firstName: {
|
|
710
|
-
type:
|
|
727
|
+
type: p(),
|
|
711
728
|
from: "first_name"
|
|
712
729
|
},
|
|
713
730
|
id: x(),
|
|
@@ -720,65 +737,65 @@ const Ne = w({
|
|
|
720
737
|
from: "is_premium"
|
|
721
738
|
},
|
|
722
739
|
languageCode: {
|
|
723
|
-
type:
|
|
740
|
+
type: p().optional(),
|
|
724
741
|
from: "language_code"
|
|
725
742
|
},
|
|
726
743
|
lastName: {
|
|
727
|
-
type:
|
|
744
|
+
type: p().optional(),
|
|
728
745
|
from: "last_name"
|
|
729
746
|
},
|
|
730
747
|
photoUrl: {
|
|
731
|
-
type:
|
|
748
|
+
type: p().optional(),
|
|
732
749
|
from: "photo_url"
|
|
733
750
|
},
|
|
734
|
-
username:
|
|
751
|
+
username: p().optional()
|
|
735
752
|
}, "User").optional();
|
|
736
753
|
function Mt() {
|
|
737
754
|
return at({
|
|
738
755
|
authDate: {
|
|
739
|
-
type:
|
|
756
|
+
type: Bt(),
|
|
740
757
|
from: "auth_date"
|
|
741
758
|
},
|
|
742
759
|
canSendAfter: {
|
|
743
760
|
type: x().optional(),
|
|
744
761
|
from: "can_send_after"
|
|
745
762
|
},
|
|
746
|
-
chat:
|
|
763
|
+
chat: Oe,
|
|
747
764
|
chatInstance: {
|
|
748
|
-
type:
|
|
765
|
+
type: p().optional(),
|
|
749
766
|
from: "chat_instance"
|
|
750
767
|
},
|
|
751
768
|
chatType: {
|
|
752
|
-
type:
|
|
769
|
+
type: p().optional(),
|
|
753
770
|
from: "chat_type"
|
|
754
771
|
},
|
|
755
|
-
hash:
|
|
772
|
+
hash: p(),
|
|
756
773
|
queryId: {
|
|
757
|
-
type:
|
|
774
|
+
type: p().optional(),
|
|
758
775
|
from: "query_id"
|
|
759
776
|
},
|
|
760
|
-
receiver:
|
|
777
|
+
receiver: gt,
|
|
761
778
|
startParam: {
|
|
762
|
-
type:
|
|
779
|
+
type: p().optional(),
|
|
763
780
|
from: "start_param"
|
|
764
781
|
},
|
|
765
|
-
user:
|
|
782
|
+
user: gt
|
|
766
783
|
}, "InitData");
|
|
767
784
|
}
|
|
768
|
-
function
|
|
785
|
+
function De(e) {
|
|
769
786
|
return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
770
787
|
}
|
|
771
|
-
function
|
|
788
|
+
function Ne(e) {
|
|
772
789
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
773
790
|
}
|
|
774
|
-
const
|
|
791
|
+
const Vt = A(
|
|
775
792
|
(e) => {
|
|
776
|
-
const t =
|
|
777
|
-
return Object.entries(nt(e)).reduce((s, [n, r]) => (s[
|
|
793
|
+
const t = St().optional();
|
|
794
|
+
return Object.entries(nt(e)).reduce((s, [n, r]) => (s[De(n)] = t.parse(r), s), {});
|
|
778
795
|
},
|
|
779
796
|
"ThemeParams"
|
|
780
797
|
);
|
|
781
|
-
function
|
|
798
|
+
function $t(e) {
|
|
782
799
|
return at({
|
|
783
800
|
botInline: {
|
|
784
801
|
type: P().optional(),
|
|
@@ -789,11 +806,11 @@ function Lt(e) {
|
|
|
789
806
|
from: "tgWebAppData"
|
|
790
807
|
},
|
|
791
808
|
initDataRaw: {
|
|
792
|
-
type:
|
|
809
|
+
type: p().optional(),
|
|
793
810
|
from: "tgWebAppData"
|
|
794
811
|
},
|
|
795
812
|
platform: {
|
|
796
|
-
type:
|
|
813
|
+
type: p(),
|
|
797
814
|
from: "tgWebAppPlatform"
|
|
798
815
|
},
|
|
799
816
|
showSettings: {
|
|
@@ -801,149 +818,138 @@ function Lt(e) {
|
|
|
801
818
|
from: "tgWebAppShowSettings"
|
|
802
819
|
},
|
|
803
820
|
startParam: {
|
|
804
|
-
type:
|
|
821
|
+
type: p().optional(),
|
|
805
822
|
from: "tgWebAppStartParam"
|
|
806
823
|
},
|
|
807
824
|
themeParams: {
|
|
808
|
-
type:
|
|
825
|
+
type: Vt(),
|
|
809
826
|
from: "tgWebAppThemeParams"
|
|
810
827
|
},
|
|
811
828
|
version: {
|
|
812
|
-
type:
|
|
829
|
+
type: p(),
|
|
813
830
|
from: "tgWebAppVersion"
|
|
814
831
|
}
|
|
815
832
|
}).parse(e);
|
|
816
833
|
}
|
|
817
|
-
function
|
|
818
|
-
return
|
|
834
|
+
function Lt(e) {
|
|
835
|
+
return $t(
|
|
819
836
|
e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
|
|
820
837
|
);
|
|
821
838
|
}
|
|
822
|
-
function
|
|
823
|
-
return
|
|
839
|
+
function Be() {
|
|
840
|
+
return Lt(window.location.href);
|
|
824
841
|
}
|
|
825
842
|
function Ht() {
|
|
826
843
|
return performance.getEntriesByType("navigation")[0];
|
|
827
844
|
}
|
|
828
|
-
function
|
|
845
|
+
function Me() {
|
|
829
846
|
const e = Ht();
|
|
830
847
|
if (!e)
|
|
831
848
|
throw new Error("Unable to get first navigation entry.");
|
|
832
|
-
return
|
|
849
|
+
return Lt(e.name);
|
|
833
850
|
}
|
|
834
|
-
function
|
|
851
|
+
function Ut(e) {
|
|
835
852
|
return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
|
|
836
853
|
}
|
|
837
|
-
function
|
|
838
|
-
sessionStorage.setItem(
|
|
854
|
+
function Wt(e, t) {
|
|
855
|
+
sessionStorage.setItem(Ut(e), JSON.stringify(t));
|
|
839
856
|
}
|
|
840
857
|
function Gt(e) {
|
|
841
|
-
const t = sessionStorage.getItem(
|
|
858
|
+
const t = sessionStorage.getItem(Ut(e));
|
|
842
859
|
try {
|
|
843
860
|
return t ? JSON.parse(t) : void 0;
|
|
844
861
|
} catch {
|
|
845
862
|
}
|
|
846
863
|
}
|
|
847
|
-
function
|
|
848
|
-
return
|
|
864
|
+
function Ve() {
|
|
865
|
+
return $t(Gt("launchParams") || "");
|
|
849
866
|
}
|
|
850
|
-
function
|
|
867
|
+
function $e(e) {
|
|
851
868
|
return JSON.stringify(
|
|
852
869
|
Object.fromEntries(
|
|
853
|
-
Object.entries(e).map(([t, s]) => [
|
|
870
|
+
Object.entries(e).map(([t, s]) => [Ne(t), s])
|
|
854
871
|
)
|
|
855
872
|
);
|
|
856
873
|
}
|
|
857
|
-
function
|
|
874
|
+
function Le(e) {
|
|
858
875
|
const {
|
|
859
876
|
initDataRaw: t,
|
|
860
877
|
themeParams: s,
|
|
861
878
|
platform: n,
|
|
862
879
|
version: r,
|
|
863
880
|
showSettings: i,
|
|
864
|
-
startParam:
|
|
865
|
-
botInline:
|
|
866
|
-
} = e,
|
|
867
|
-
return
|
|
881
|
+
startParam: o,
|
|
882
|
+
botInline: a
|
|
883
|
+
} = e, u = new URLSearchParams();
|
|
884
|
+
return u.set("tgWebAppPlatform", n), u.set("tgWebAppThemeParams", $e(s)), u.set("tgWebAppVersion", r), t && u.set("tgWebAppData", t), o && u.set("tgWebAppStartParam", o), typeof i == "boolean" && u.set("tgWebAppShowSettings", i ? "1" : "0"), typeof a == "boolean" && u.set("tgWebAppBotInline", a ? "1" : "0"), u.toString();
|
|
868
885
|
}
|
|
869
|
-
function
|
|
870
|
-
|
|
886
|
+
function He(e) {
|
|
887
|
+
Wt("launchParams", Le(e));
|
|
871
888
|
}
|
|
872
|
-
function
|
|
889
|
+
function jt() {
|
|
873
890
|
for (const e of [
|
|
874
891
|
// Try to retrieve launch parameters from the current location. This method can return
|
|
875
892
|
// nothing in case, location was changed and then page was reloaded.
|
|
876
|
-
|
|
893
|
+
Be,
|
|
877
894
|
// Then, try using the lower level API - window.performance.
|
|
878
|
-
|
|
895
|
+
Me,
|
|
879
896
|
// Finally, try to extract launch parameters from the session storage.
|
|
880
|
-
|
|
897
|
+
Ve
|
|
881
898
|
])
|
|
882
899
|
try {
|
|
883
900
|
const t = e();
|
|
884
|
-
return
|
|
901
|
+
return He(t), t;
|
|
885
902
|
} catch {
|
|
886
903
|
}
|
|
887
904
|
throw new Error("Unable to retrieve launch parameters from any known source.");
|
|
888
905
|
}
|
|
889
|
-
function
|
|
906
|
+
function zt() {
|
|
890
907
|
const e = Ht();
|
|
891
908
|
return !!(e && e.type === "reload");
|
|
892
909
|
}
|
|
893
|
-
function
|
|
910
|
+
function Ue() {
|
|
894
911
|
let e = 0;
|
|
895
912
|
return () => (e += 1).toString();
|
|
896
913
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
const t = [];
|
|
900
|
-
return [
|
|
901
|
-
(s) => !e && t.push(s),
|
|
902
|
-
() => {
|
|
903
|
-
e || (e = !0, t.forEach((s) => s()));
|
|
904
|
-
},
|
|
905
|
-
e
|
|
906
|
-
];
|
|
907
|
-
}
|
|
908
|
-
const [ze] = Pt(je);
|
|
909
|
-
function d(e, t) {
|
|
914
|
+
const [We] = yt(Ue);
|
|
915
|
+
function l(e, t) {
|
|
910
916
|
return () => {
|
|
911
|
-
const s =
|
|
917
|
+
const s = jt(), n = {
|
|
912
918
|
...s,
|
|
913
|
-
postEvent:
|
|
914
|
-
createRequestId:
|
|
919
|
+
postEvent: Ie(s.version),
|
|
920
|
+
createRequestId: We()
|
|
915
921
|
};
|
|
916
922
|
if (typeof e == "function")
|
|
917
923
|
return e(n);
|
|
918
|
-
const [r, i,
|
|
924
|
+
const [r, i, o] = Pt(), a = t({
|
|
919
925
|
...n,
|
|
920
926
|
// State should only be passed only in case, current page was reloaded. If we don't add
|
|
921
927
|
// this check, state restoration will work improperly in the web version of Telegram,
|
|
922
928
|
// when we are always working in the same "session" (tab).
|
|
923
|
-
state:
|
|
929
|
+
state: zt() ? Gt(e) : void 0,
|
|
924
930
|
addCleanup: r
|
|
925
|
-
}),
|
|
926
|
-
|
|
927
|
-
|
|
931
|
+
}), u = (h) => (o || r(
|
|
932
|
+
h.on("change", (v) => {
|
|
933
|
+
Wt(e, v);
|
|
928
934
|
})
|
|
929
|
-
),
|
|
935
|
+
), h);
|
|
930
936
|
return [
|
|
931
|
-
|
|
937
|
+
a instanceof Promise ? a.then(u) : u(a),
|
|
932
938
|
i
|
|
933
939
|
];
|
|
934
940
|
};
|
|
935
941
|
}
|
|
936
|
-
const
|
|
942
|
+
const Ge = l("backButton", ({
|
|
937
943
|
postEvent: e,
|
|
938
944
|
version: t,
|
|
939
945
|
state: s = { isVisible: !1 }
|
|
940
|
-
}) => new
|
|
941
|
-
class
|
|
946
|
+
}) => new qe(s.isVisible, t, e));
|
|
947
|
+
class $ extends ot {
|
|
942
948
|
constructor() {
|
|
943
949
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
944
950
|
}
|
|
945
951
|
}
|
|
946
|
-
function
|
|
952
|
+
function Kt(e) {
|
|
947
953
|
const t = e.available ? e : {
|
|
948
954
|
available: !1,
|
|
949
955
|
device_id: "",
|
|
@@ -961,7 +967,7 @@ function Jt(e) {
|
|
|
961
967
|
accessGranted: t.access_granted
|
|
962
968
|
};
|
|
963
969
|
}
|
|
964
|
-
class
|
|
970
|
+
class je extends $ {
|
|
965
971
|
constructor({ postEvent: t, version: s, ...n }) {
|
|
966
972
|
super(n, s, {
|
|
967
973
|
auth: "web_app_biometry_request_auth",
|
|
@@ -998,7 +1004,7 @@ class Je extends M {
|
|
|
998
1004
|
reason: t,
|
|
999
1005
|
...s
|
|
1000
1006
|
}) {
|
|
1001
|
-
return this.authPromise || (this.authPromise =
|
|
1007
|
+
return this.authPromise || (this.authPromise = w({
|
|
1002
1008
|
...s,
|
|
1003
1009
|
method: "web_app_biometry_request_auth",
|
|
1004
1010
|
event: "biometry_auth_requested",
|
|
@@ -1032,14 +1038,14 @@ class Je extends M {
|
|
|
1032
1038
|
* @returns Promise with true, if access was granted.
|
|
1033
1039
|
*/
|
|
1034
1040
|
requestAccess({ reason: t, ...s } = {}) {
|
|
1035
|
-
return this.accessPromise || (this.accessPromise =
|
|
1041
|
+
return this.accessPromise || (this.accessPromise = w({
|
|
1036
1042
|
...s,
|
|
1037
1043
|
postEvent: this.postEvent,
|
|
1038
1044
|
method: "web_app_biometry_request_access",
|
|
1039
1045
|
event: "biometry_info_received",
|
|
1040
1046
|
params: { reason: t || "" }
|
|
1041
1047
|
}).then((n) => {
|
|
1042
|
-
const r =
|
|
1048
|
+
const r = Kt(n);
|
|
1043
1049
|
return this.set(r), r.accessGranted;
|
|
1044
1050
|
}).finally(() => this.accessPromise = void 0)), this.accessPromise;
|
|
1045
1051
|
}
|
|
@@ -1061,7 +1067,7 @@ class Je extends M {
|
|
|
1061
1067
|
*/
|
|
1062
1068
|
async updateToken({ token: t, ...s } = {}) {
|
|
1063
1069
|
return ["removed", "updated"].includes(
|
|
1064
|
-
(await
|
|
1070
|
+
(await w({
|
|
1065
1071
|
...s,
|
|
1066
1072
|
postEvent: this.postEvent,
|
|
1067
1073
|
method: "web_app_biometry_update_token",
|
|
@@ -1071,19 +1077,25 @@ class Je extends M {
|
|
|
1071
1077
|
);
|
|
1072
1078
|
}
|
|
1073
1079
|
}
|
|
1074
|
-
async function
|
|
1075
|
-
return
|
|
1076
|
-
await
|
|
1080
|
+
async function ze(e) {
|
|
1081
|
+
return Kt(
|
|
1082
|
+
await w({
|
|
1077
1083
|
...e || {},
|
|
1078
1084
|
method: "web_app_biometry_get_info",
|
|
1079
1085
|
event: "biometry_info_received"
|
|
1080
1086
|
})
|
|
1081
1087
|
);
|
|
1082
1088
|
}
|
|
1083
|
-
const
|
|
1089
|
+
const Ke = l(
|
|
1084
1090
|
"biometryManager",
|
|
1085
|
-
async ({ postEvent: e, version: t, state: s }) => new
|
|
1086
|
-
...s || await
|
|
1091
|
+
async ({ postEvent: e, version: t, state: s }) => new je({
|
|
1092
|
+
...s || C("web_app_biometry_get_info", t) ? s || await ze({ timeout: 1e3 }) : {
|
|
1093
|
+
available: !1,
|
|
1094
|
+
accessGranted: !1,
|
|
1095
|
+
accessRequested: !1,
|
|
1096
|
+
tokenSaved: !1,
|
|
1097
|
+
deviceId: ""
|
|
1098
|
+
},
|
|
1087
1099
|
version: t,
|
|
1088
1100
|
postEvent: e
|
|
1089
1101
|
})
|
|
@@ -1093,7 +1105,7 @@ class ct extends it {
|
|
|
1093
1105
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
1094
1106
|
}
|
|
1095
1107
|
}
|
|
1096
|
-
class
|
|
1108
|
+
class Je extends ct {
|
|
1097
1109
|
constructor(t, s) {
|
|
1098
1110
|
super({ isConfirmationNeeded: t }), this.postEvent = s;
|
|
1099
1111
|
}
|
|
@@ -1120,19 +1132,19 @@ class Ye extends ct {
|
|
|
1120
1132
|
this.isConfirmationNeeded = !0;
|
|
1121
1133
|
}
|
|
1122
1134
|
}
|
|
1123
|
-
const
|
|
1135
|
+
const Fe = l(
|
|
1124
1136
|
"closingBehavior",
|
|
1125
1137
|
({
|
|
1126
1138
|
postEvent: e,
|
|
1127
1139
|
state: t = { isConfirmationNeeded: !1 }
|
|
1128
|
-
}) => new
|
|
1140
|
+
}) => new Je(t.isConfirmationNeeded, e)
|
|
1129
1141
|
);
|
|
1130
1142
|
class ht {
|
|
1131
1143
|
constructor(t, s) {
|
|
1132
|
-
c(this, "supports"), this.supports =
|
|
1144
|
+
c(this, "supports"), this.supports = Nt(t, s);
|
|
1133
1145
|
}
|
|
1134
1146
|
}
|
|
1135
|
-
function
|
|
1147
|
+
function Qe(e) {
|
|
1136
1148
|
if (Array.isArray(e))
|
|
1137
1149
|
return e;
|
|
1138
1150
|
if (typeof e == "string")
|
|
@@ -1142,11 +1154,11 @@ function Xe(e) {
|
|
|
1142
1154
|
return t;
|
|
1143
1155
|
} catch {
|
|
1144
1156
|
}
|
|
1145
|
-
throw
|
|
1157
|
+
throw T();
|
|
1146
1158
|
}
|
|
1147
|
-
class
|
|
1159
|
+
class Ye extends G {
|
|
1148
1160
|
constructor(t, s, n) {
|
|
1149
|
-
super(
|
|
1161
|
+
super(Qe, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
|
|
1150
1162
|
}
|
|
1151
1163
|
/**
|
|
1152
1164
|
* Attempts to parse passed value
|
|
@@ -1162,13 +1174,13 @@ class ts extends j {
|
|
|
1162
1174
|
return this.itemParser = typeof t == "function" ? t : t.parse.bind(t), this;
|
|
1163
1175
|
}
|
|
1164
1176
|
}
|
|
1165
|
-
function
|
|
1166
|
-
return new
|
|
1177
|
+
function Ze(e) {
|
|
1178
|
+
return new Ye((t) => t, !1, e);
|
|
1167
1179
|
}
|
|
1168
|
-
function
|
|
1180
|
+
function wt(e, t) {
|
|
1169
1181
|
return Object.fromEntries(e.map((s) => [s, t]));
|
|
1170
1182
|
}
|
|
1171
|
-
class
|
|
1183
|
+
class Xe extends ht {
|
|
1172
1184
|
constructor(t, s, n) {
|
|
1173
1185
|
super(t, {
|
|
1174
1186
|
delete: "web_app_invoke_custom_method",
|
|
@@ -1184,7 +1196,7 @@ class ss extends ht {
|
|
|
1184
1196
|
*/
|
|
1185
1197
|
async delete(t, s = {}) {
|
|
1186
1198
|
const n = Array.isArray(t) ? t : [t];
|
|
1187
|
-
n.length && await
|
|
1199
|
+
n.length && await O(
|
|
1188
1200
|
"deleteStorageValues",
|
|
1189
1201
|
{ keys: n },
|
|
1190
1202
|
this.createRequestId(),
|
|
@@ -1196,8 +1208,8 @@ class ss extends ht {
|
|
|
1196
1208
|
* @param options - request execution options.
|
|
1197
1209
|
*/
|
|
1198
1210
|
async getKeys(t = {}) {
|
|
1199
|
-
return
|
|
1200
|
-
await
|
|
1211
|
+
return Ze().of(p()).parse(
|
|
1212
|
+
await O(
|
|
1201
1213
|
"getStorageKeys",
|
|
1202
1214
|
{},
|
|
1203
1215
|
this.createRequestId(),
|
|
@@ -1208,13 +1220,13 @@ class ss extends ht {
|
|
|
1208
1220
|
async get(t, s = {}) {
|
|
1209
1221
|
const n = Array.isArray(t) ? t : [t];
|
|
1210
1222
|
if (!n.length)
|
|
1211
|
-
return
|
|
1212
|
-
const r = await
|
|
1223
|
+
return wt(n, "");
|
|
1224
|
+
const r = await O(
|
|
1213
1225
|
"getStorageValues",
|
|
1214
1226
|
{ keys: n },
|
|
1215
1227
|
this.createRequestId(),
|
|
1216
1228
|
{ ...s, postEvent: this.postEvent }
|
|
1217
|
-
), i =
|
|
1229
|
+
), i = g(wt(n, p()), "CloudStorageData").parse(r);
|
|
1218
1230
|
return Array.isArray(t) ? i : i[t];
|
|
1219
1231
|
}
|
|
1220
1232
|
/**
|
|
@@ -1224,7 +1236,7 @@ class ss extends ht {
|
|
|
1224
1236
|
* @param options - request execution options.
|
|
1225
1237
|
*/
|
|
1226
1238
|
async set(t, s, n = {}) {
|
|
1227
|
-
await
|
|
1239
|
+
await O(
|
|
1228
1240
|
"saveStorageValue",
|
|
1229
1241
|
{ key: t, value: s },
|
|
1230
1242
|
this.createRequestId(),
|
|
@@ -1232,10 +1244,10 @@ class ss extends ht {
|
|
|
1232
1244
|
);
|
|
1233
1245
|
}
|
|
1234
1246
|
}
|
|
1235
|
-
const
|
|
1236
|
-
({ createRequestId: e, postEvent: t, version: s }) => new
|
|
1247
|
+
const ts = l(
|
|
1248
|
+
({ createRequestId: e, postEvent: t, version: s }) => new Xe(s, e, t)
|
|
1237
1249
|
);
|
|
1238
|
-
class
|
|
1250
|
+
class es extends ht {
|
|
1239
1251
|
constructor(t, s) {
|
|
1240
1252
|
super(t, {
|
|
1241
1253
|
impactOccurred: "web_app_trigger_haptic_feedback",
|
|
@@ -1277,10 +1289,10 @@ class rs extends ht {
|
|
|
1277
1289
|
this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
|
|
1278
1290
|
}
|
|
1279
1291
|
}
|
|
1280
|
-
const
|
|
1281
|
-
({ version: e, postEvent: t }) => new
|
|
1292
|
+
const ss = l(
|
|
1293
|
+
({ version: e, postEvent: t }) => new es(e, t)
|
|
1282
1294
|
);
|
|
1283
|
-
class
|
|
1295
|
+
class ns {
|
|
1284
1296
|
constructor(t) {
|
|
1285
1297
|
this.initData = t;
|
|
1286
1298
|
}
|
|
@@ -1353,13 +1365,13 @@ class os {
|
|
|
1353
1365
|
return this.initData.user;
|
|
1354
1366
|
}
|
|
1355
1367
|
}
|
|
1356
|
-
const
|
|
1357
|
-
({ initData: e }) => e ? new
|
|
1368
|
+
const rs = l(
|
|
1369
|
+
({ initData: e }) => e ? new ns(e) : void 0
|
|
1358
1370
|
);
|
|
1359
|
-
function
|
|
1371
|
+
function fn(e) {
|
|
1360
1372
|
return Mt().parse(e);
|
|
1361
1373
|
}
|
|
1362
|
-
class
|
|
1374
|
+
class is extends $ {
|
|
1363
1375
|
constructor(t, s, n) {
|
|
1364
1376
|
super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
|
|
1365
1377
|
}
|
|
@@ -1382,14 +1394,14 @@ class cs extends M {
|
|
|
1382
1394
|
const { hostname: r, pathname: i } = new URL(t, window.location.href);
|
|
1383
1395
|
if (r !== "t.me")
|
|
1384
1396
|
throw new Error(`Incorrect hostname: ${r}`);
|
|
1385
|
-
const
|
|
1386
|
-
if (!
|
|
1397
|
+
const o = i.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
|
|
1398
|
+
if (!o)
|
|
1387
1399
|
throw new Error('Link pathname has incorrect format. Expected to receive "/invoice/{slug}" or "/${slug}"');
|
|
1388
|
-
[, , n] =
|
|
1400
|
+
[, , n] = o;
|
|
1389
1401
|
}
|
|
1390
1402
|
this.isOpened = !0;
|
|
1391
1403
|
try {
|
|
1392
|
-
return (await
|
|
1404
|
+
return (await w({
|
|
1393
1405
|
method: "web_app_open_invoice",
|
|
1394
1406
|
event: "invoice_closed",
|
|
1395
1407
|
params: { slug: n },
|
|
@@ -1403,13 +1415,19 @@ class cs extends M {
|
|
|
1403
1415
|
}
|
|
1404
1416
|
}
|
|
1405
1417
|
}
|
|
1406
|
-
const
|
|
1407
|
-
({ version: e, postEvent: t }) => new
|
|
1418
|
+
const os = l(
|
|
1419
|
+
({ version: e, postEvent: t }) => new is(!1, e, t)
|
|
1408
1420
|
);
|
|
1409
|
-
class
|
|
1421
|
+
class as extends it {
|
|
1410
1422
|
constructor({ postEvent: t, ...s }) {
|
|
1411
1423
|
super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? E("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? z("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
|
|
1412
1424
|
}
|
|
1425
|
+
/**
|
|
1426
|
+
* The MainButton background color.
|
|
1427
|
+
*/
|
|
1428
|
+
get bgColor() {
|
|
1429
|
+
return this.get("bgColor");
|
|
1430
|
+
}
|
|
1413
1431
|
/**
|
|
1414
1432
|
* Sends current local state to the Telegram application.
|
|
1415
1433
|
*/
|
|
@@ -1419,10 +1437,35 @@ class ps extends it {
|
|
|
1419
1437
|
is_active: this.isEnabled,
|
|
1420
1438
|
is_progress_visible: this.isLoaderVisible,
|
|
1421
1439
|
text: this.text,
|
|
1422
|
-
color: this.
|
|
1440
|
+
color: this.bgColor,
|
|
1423
1441
|
text_color: this.textColor
|
|
1424
1442
|
});
|
|
1425
1443
|
}
|
|
1444
|
+
/**
|
|
1445
|
+
* Disables the MainButton.
|
|
1446
|
+
* @see Does not work on Android: https://github.com/Telegram-Mini-Apps/issues/issues/1
|
|
1447
|
+
*/
|
|
1448
|
+
disable() {
|
|
1449
|
+
return this.isEnabled = !1, this;
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Enables the MainButton.
|
|
1453
|
+
*/
|
|
1454
|
+
enable() {
|
|
1455
|
+
return this.isEnabled = !0, this;
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* Hides the MainButton.
|
|
1459
|
+
*/
|
|
1460
|
+
hide() {
|
|
1461
|
+
return this.isVisible = !1, this;
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1464
|
+
* Hides the MainButton loading indicator.
|
|
1465
|
+
*/
|
|
1466
|
+
hideLoader() {
|
|
1467
|
+
return this.isLoaderVisible = !1, this;
|
|
1468
|
+
}
|
|
1426
1469
|
set isEnabled(t) {
|
|
1427
1470
|
this.setParams({ isEnabled: t });
|
|
1428
1471
|
}
|
|
@@ -1450,49 +1493,6 @@ class ps extends it {
|
|
|
1450
1493
|
get isVisible() {
|
|
1451
1494
|
return this.get("isVisible");
|
|
1452
1495
|
}
|
|
1453
|
-
/**
|
|
1454
|
-
* The MainButton background color.
|
|
1455
|
-
*/
|
|
1456
|
-
get backgroundColor() {
|
|
1457
|
-
return this.get("backgroundColor");
|
|
1458
|
-
}
|
|
1459
|
-
/**
|
|
1460
|
-
* The MainButton text.
|
|
1461
|
-
*/
|
|
1462
|
-
get text() {
|
|
1463
|
-
return this.get("text");
|
|
1464
|
-
}
|
|
1465
|
-
/**
|
|
1466
|
-
* The MainButton text color.
|
|
1467
|
-
*/
|
|
1468
|
-
get textColor() {
|
|
1469
|
-
return this.get("textColor");
|
|
1470
|
-
}
|
|
1471
|
-
/**
|
|
1472
|
-
* Disables the MainButton.
|
|
1473
|
-
* @see Does not work on Android: https://github.com/Telegram-Mini-Apps/issues/issues/1
|
|
1474
|
-
*/
|
|
1475
|
-
disable() {
|
|
1476
|
-
return this.isEnabled = !1, this;
|
|
1477
|
-
}
|
|
1478
|
-
/**
|
|
1479
|
-
* Enables the MainButton.
|
|
1480
|
-
*/
|
|
1481
|
-
enable() {
|
|
1482
|
-
return this.isEnabled = !0, this;
|
|
1483
|
-
}
|
|
1484
|
-
/**
|
|
1485
|
-
* Hides the MainButton.
|
|
1486
|
-
*/
|
|
1487
|
-
hide() {
|
|
1488
|
-
return this.isVisible = !1, this;
|
|
1489
|
-
}
|
|
1490
|
-
/**
|
|
1491
|
-
* Hides the MainButton loading indicator.
|
|
1492
|
-
*/
|
|
1493
|
-
hideLoader() {
|
|
1494
|
-
return this.isLoaderVisible = !1, this;
|
|
1495
|
-
}
|
|
1496
1496
|
/**
|
|
1497
1497
|
* Shows the MainButton.
|
|
1498
1498
|
*
|
|
@@ -1524,10 +1524,10 @@ class ps extends it {
|
|
|
1524
1524
|
}
|
|
1525
1525
|
/**
|
|
1526
1526
|
* Updates current Main Button color.
|
|
1527
|
-
* @param
|
|
1527
|
+
* @param bgColor - color to set.
|
|
1528
1528
|
*/
|
|
1529
|
-
|
|
1530
|
-
return this.setParams({
|
|
1529
|
+
setBgColor(t) {
|
|
1530
|
+
return this.setParams({ bgColor: t });
|
|
1531
1531
|
}
|
|
1532
1532
|
/**
|
|
1533
1533
|
* Allows setting multiple Main Button parameters.
|
|
@@ -1536,8 +1536,20 @@ class ps extends it {
|
|
|
1536
1536
|
setParams(t) {
|
|
1537
1537
|
return this.set(t), this.commit(), this;
|
|
1538
1538
|
}
|
|
1539
|
+
/**
|
|
1540
|
+
* The MainButton text.
|
|
1541
|
+
*/
|
|
1542
|
+
get text() {
|
|
1543
|
+
return this.get("text");
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* The MainButton text color.
|
|
1547
|
+
*/
|
|
1548
|
+
get textColor() {
|
|
1549
|
+
return this.get("textColor");
|
|
1550
|
+
}
|
|
1539
1551
|
}
|
|
1540
|
-
const
|
|
1552
|
+
const cs = l(
|
|
1541
1553
|
"mainButton",
|
|
1542
1554
|
({
|
|
1543
1555
|
postEvent: e,
|
|
@@ -1548,49 +1560,49 @@ const us = d(
|
|
|
1548
1560
|
text: "",
|
|
1549
1561
|
isLoaderVisible: !1,
|
|
1550
1562
|
textColor: t.buttonTextColor || "#ffffff",
|
|
1551
|
-
|
|
1563
|
+
bgColor: t.buttonColor || "#000000"
|
|
1552
1564
|
}
|
|
1553
|
-
}) => new
|
|
1565
|
+
}) => new as({ ...s, postEvent: e })
|
|
1554
1566
|
);
|
|
1555
|
-
function
|
|
1567
|
+
function hs() {
|
|
1556
1568
|
return at({
|
|
1557
|
-
contact:
|
|
1569
|
+
contact: g({
|
|
1558
1570
|
userId: {
|
|
1559
1571
|
type: x(),
|
|
1560
1572
|
from: "user_id"
|
|
1561
1573
|
},
|
|
1562
1574
|
phoneNumber: {
|
|
1563
|
-
type:
|
|
1575
|
+
type: p(),
|
|
1564
1576
|
from: "phone_number"
|
|
1565
1577
|
},
|
|
1566
1578
|
firstName: {
|
|
1567
|
-
type:
|
|
1579
|
+
type: p(),
|
|
1568
1580
|
from: "first_name"
|
|
1569
1581
|
},
|
|
1570
1582
|
lastName: {
|
|
1571
|
-
type:
|
|
1583
|
+
type: p().optional(),
|
|
1572
1584
|
from: "last_name"
|
|
1573
1585
|
}
|
|
1574
1586
|
}),
|
|
1575
1587
|
authDate: {
|
|
1576
|
-
type:
|
|
1588
|
+
type: Bt(),
|
|
1577
1589
|
from: "auth_date"
|
|
1578
1590
|
},
|
|
1579
|
-
hash:
|
|
1591
|
+
hash: p()
|
|
1580
1592
|
}, "RequestedContact");
|
|
1581
1593
|
}
|
|
1582
|
-
function
|
|
1594
|
+
function Jt(e, t) {
|
|
1583
1595
|
return (s) => {
|
|
1584
1596
|
const [n, r] = t[s];
|
|
1585
1597
|
return C(n, r, e);
|
|
1586
1598
|
};
|
|
1587
1599
|
}
|
|
1588
|
-
function
|
|
1600
|
+
function ps(e) {
|
|
1589
1601
|
return new Promise((t) => {
|
|
1590
1602
|
setTimeout(t, e);
|
|
1591
1603
|
});
|
|
1592
1604
|
}
|
|
1593
|
-
class
|
|
1605
|
+
class us extends $ {
|
|
1594
1606
|
constructor({ postEvent: t, createRequestId: s, version: n, botInline: r, ...i }) {
|
|
1595
1607
|
super(i, n, {
|
|
1596
1608
|
requestPhoneAccess: "web_app_request_phone",
|
|
@@ -1599,8 +1611,8 @@ class _s extends M {
|
|
|
1599
1611
|
setHeaderColor: "web_app_set_header_color",
|
|
1600
1612
|
setBackgroundColor: "web_app_set_background_color"
|
|
1601
1613
|
}), 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;
|
|
1602
|
-
const
|
|
1603
|
-
this.supports = (
|
|
1614
|
+
const o = this.supports.bind(this);
|
|
1615
|
+
this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = Jt(n, {
|
|
1604
1616
|
"setHeaderColor.color": ["web_app_set_header_color", "color"]
|
|
1605
1617
|
});
|
|
1606
1618
|
}
|
|
@@ -1611,8 +1623,8 @@ class _s extends M {
|
|
|
1611
1623
|
async getRequestedContact({
|
|
1612
1624
|
timeout: t = 1e4
|
|
1613
1625
|
} = {}) {
|
|
1614
|
-
return
|
|
1615
|
-
await
|
|
1626
|
+
return hs().parse(
|
|
1627
|
+
await O(
|
|
1616
1628
|
"getRequestedContact",
|
|
1617
1629
|
{},
|
|
1618
1630
|
this.createRequestId(),
|
|
@@ -1651,7 +1663,7 @@ class _s extends M {
|
|
|
1651
1663
|
* True if current Mini App background color is recognized as dark.
|
|
1652
1664
|
*/
|
|
1653
1665
|
get isDark() {
|
|
1654
|
-
return
|
|
1666
|
+
return Dt(this.bgColor);
|
|
1655
1667
|
}
|
|
1656
1668
|
/**
|
|
1657
1669
|
* Informs the Telegram app that the Mini App is ready to be displayed.
|
|
@@ -1680,13 +1692,13 @@ class _s extends M {
|
|
|
1680
1692
|
throw new Error("Access denied.");
|
|
1681
1693
|
const s = Date.now() + t;
|
|
1682
1694
|
let n = 50;
|
|
1683
|
-
return
|
|
1695
|
+
return Ot(async () => {
|
|
1684
1696
|
for (; Date.now() < s; ) {
|
|
1685
1697
|
try {
|
|
1686
1698
|
return await this.getRequestedContact();
|
|
1687
1699
|
} catch {
|
|
1688
1700
|
}
|
|
1689
|
-
await
|
|
1701
|
+
await ps(n), n += 50;
|
|
1690
1702
|
}
|
|
1691
1703
|
throw qt(t);
|
|
1692
1704
|
}, t);
|
|
@@ -1701,7 +1713,7 @@ class _s extends M {
|
|
|
1701
1713
|
* @see requestContact
|
|
1702
1714
|
*/
|
|
1703
1715
|
async requestPhoneAccess(t = {}) {
|
|
1704
|
-
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise =
|
|
1716
|
+
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = w({
|
|
1705
1717
|
...t,
|
|
1706
1718
|
method: "web_app_request_phone",
|
|
1707
1719
|
event: "phone_requested",
|
|
@@ -1713,7 +1725,7 @@ class _s extends M {
|
|
|
1713
1725
|
* @param options - additional options.
|
|
1714
1726
|
*/
|
|
1715
1727
|
async requestWriteAccess(t = {}) {
|
|
1716
|
-
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise =
|
|
1728
|
+
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = w({
|
|
1717
1729
|
...t,
|
|
1718
1730
|
method: "web_app_request_write_access",
|
|
1719
1731
|
event: "write_access_requested",
|
|
@@ -1771,7 +1783,7 @@ class _s extends M {
|
|
|
1771
1783
|
this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
|
|
1772
1784
|
}
|
|
1773
1785
|
}
|
|
1774
|
-
const
|
|
1786
|
+
const ls = l(
|
|
1775
1787
|
"miniApp",
|
|
1776
1788
|
({
|
|
1777
1789
|
themeParams: e,
|
|
@@ -1781,9 +1793,9 @@ const gs = d(
|
|
|
1781
1793
|
headerColor: e.headerBgColor || "#000000"
|
|
1782
1794
|
},
|
|
1783
1795
|
...n
|
|
1784
|
-
}) => new
|
|
1796
|
+
}) => new us({ ...n, ...s, botInline: t })
|
|
1785
1797
|
);
|
|
1786
|
-
function
|
|
1798
|
+
function ds(e) {
|
|
1787
1799
|
const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
|
|
1788
1800
|
let r;
|
|
1789
1801
|
if (s.length > 64)
|
|
@@ -1793,21 +1805,21 @@ function ws(e) {
|
|
|
1793
1805
|
if (n.length > 3)
|
|
1794
1806
|
throw new Error(`Buttons have incorrect size: ${n.length}`);
|
|
1795
1807
|
return n.length ? r = n.map((i) => {
|
|
1796
|
-
const { id:
|
|
1797
|
-
if (
|
|
1798
|
-
throw new Error(`Button ID has incorrect size: ${
|
|
1808
|
+
const { id: o = "" } = i;
|
|
1809
|
+
if (o.length > 64)
|
|
1810
|
+
throw new Error(`Button ID has incorrect size: ${o}`);
|
|
1799
1811
|
if (!i.type || i.type === "default" || i.type === "destructive") {
|
|
1800
|
-
const
|
|
1801
|
-
if (!
|
|
1802
|
-
const
|
|
1803
|
-
throw new Error(`Button text with type "${
|
|
1812
|
+
const a = i.text.trim();
|
|
1813
|
+
if (!a.length || a.length > 64) {
|
|
1814
|
+
const u = i.type || "default";
|
|
1815
|
+
throw new Error(`Button text with type "${u}" has incorrect size: ${i.text.length}`);
|
|
1804
1816
|
}
|
|
1805
|
-
return { ...i, text:
|
|
1817
|
+
return { ...i, text: a, id: o };
|
|
1806
1818
|
}
|
|
1807
|
-
return { ...i, id:
|
|
1819
|
+
return { ...i, id: o };
|
|
1808
1820
|
}) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
|
|
1809
1821
|
}
|
|
1810
|
-
class
|
|
1822
|
+
class _s extends $ {
|
|
1811
1823
|
constructor(t, s, n) {
|
|
1812
1824
|
super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
|
|
1813
1825
|
}
|
|
@@ -1836,11 +1848,11 @@ class fs extends M {
|
|
|
1836
1848
|
throw new Error("Popup is already opened.");
|
|
1837
1849
|
this.isOpened = !0;
|
|
1838
1850
|
try {
|
|
1839
|
-
const { button_id: s = null } = await
|
|
1851
|
+
const { button_id: s = null } = await w({
|
|
1840
1852
|
event: "popup_closed",
|
|
1841
1853
|
method: "web_app_open_popup",
|
|
1842
1854
|
postEvent: this.postEvent,
|
|
1843
|
-
params:
|
|
1855
|
+
params: ds(t)
|
|
1844
1856
|
});
|
|
1845
1857
|
return s;
|
|
1846
1858
|
} finally {
|
|
@@ -1848,10 +1860,10 @@ class fs extends M {
|
|
|
1848
1860
|
}
|
|
1849
1861
|
}
|
|
1850
1862
|
}
|
|
1851
|
-
const
|
|
1852
|
-
({ postEvent: e, version: t }) => new
|
|
1863
|
+
const gs = l(
|
|
1864
|
+
({ postEvent: e, version: t }) => new _s(!1, t, e)
|
|
1853
1865
|
);
|
|
1854
|
-
class
|
|
1866
|
+
class ws extends $ {
|
|
1855
1867
|
constructor(t, s, n) {
|
|
1856
1868
|
super({ isOpened: t }, s, {
|
|
1857
1869
|
close: "web_app_close_scan_qr_popup",
|
|
@@ -1884,7 +1896,7 @@ class bs extends M {
|
|
|
1884
1896
|
throw new Error("QR scanner is already opened.");
|
|
1885
1897
|
this.isOpened = !0;
|
|
1886
1898
|
try {
|
|
1887
|
-
return (await
|
|
1899
|
+
return (await w({
|
|
1888
1900
|
method: "web_app_open_scan_qr_popup",
|
|
1889
1901
|
event: ["qr_text_received", "scan_qr_popup_closed"],
|
|
1890
1902
|
postEvent: this.postEvent,
|
|
@@ -1895,10 +1907,10 @@ class bs extends M {
|
|
|
1895
1907
|
}
|
|
1896
1908
|
}
|
|
1897
1909
|
}
|
|
1898
|
-
const
|
|
1899
|
-
({ version: e, postEvent: t }) => new
|
|
1910
|
+
const fs = l(
|
|
1911
|
+
({ version: e, postEvent: t }) => new ws(!1, e, t)
|
|
1900
1912
|
);
|
|
1901
|
-
class
|
|
1913
|
+
class ms extends ot {
|
|
1902
1914
|
constructor(t, s, n) {
|
|
1903
1915
|
super({ isVisible: t }, s, {
|
|
1904
1916
|
show: "web_app_setup_settings_button",
|
|
@@ -1927,18 +1939,18 @@ class ys extends ot {
|
|
|
1927
1939
|
this.isVisible = !0;
|
|
1928
1940
|
}
|
|
1929
1941
|
}
|
|
1930
|
-
const
|
|
1942
|
+
const bs = l(
|
|
1931
1943
|
"settingsButton",
|
|
1932
1944
|
({
|
|
1933
1945
|
version: e,
|
|
1934
1946
|
postEvent: t,
|
|
1935
1947
|
state: s = { isVisible: !1 }
|
|
1936
|
-
}) => new
|
|
1948
|
+
}) => new ms(s.isVisible, e, t)
|
|
1937
1949
|
);
|
|
1938
1950
|
function Ft(e) {
|
|
1939
|
-
return
|
|
1951
|
+
return Vt().parse(e);
|
|
1940
1952
|
}
|
|
1941
|
-
class
|
|
1953
|
+
class vs extends ct {
|
|
1942
1954
|
/**
|
|
1943
1955
|
* @since v6.10
|
|
1944
1956
|
*/
|
|
@@ -1977,7 +1989,7 @@ class Ps extends ct {
|
|
|
1977
1989
|
* value is calculated according to theme bg color.
|
|
1978
1990
|
*/
|
|
1979
1991
|
get isDark() {
|
|
1980
|
-
return !this.bgColor ||
|
|
1992
|
+
return !this.bgColor || Dt(this.bgColor);
|
|
1981
1993
|
}
|
|
1982
1994
|
get linkColor() {
|
|
1983
1995
|
return this.get("linkColor");
|
|
@@ -2016,23 +2028,23 @@ class Ps extends ct {
|
|
|
2016
2028
|
return this.get("textColor");
|
|
2017
2029
|
}
|
|
2018
2030
|
}
|
|
2019
|
-
const
|
|
2031
|
+
const ys = l(
|
|
2020
2032
|
"themeParams",
|
|
2021
2033
|
({ themeParams: e, state: t = e, addCleanup: s }) => {
|
|
2022
|
-
const n = new
|
|
2034
|
+
const n = new vs(t);
|
|
2023
2035
|
return s(n.listen()), n;
|
|
2024
2036
|
}
|
|
2025
2037
|
);
|
|
2026
|
-
function
|
|
2027
|
-
return
|
|
2038
|
+
function mn(e = {}) {
|
|
2039
|
+
return w({
|
|
2028
2040
|
...e,
|
|
2029
2041
|
method: "web_app_request_theme",
|
|
2030
2042
|
event: "theme_changed"
|
|
2031
2043
|
}).then(Ft);
|
|
2032
2044
|
}
|
|
2033
|
-
class
|
|
2045
|
+
class Es extends ht {
|
|
2034
2046
|
constructor(t, s, n) {
|
|
2035
|
-
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam =
|
|
2047
|
+
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = Jt(t, {
|
|
2036
2048
|
"openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
|
|
2037
2049
|
});
|
|
2038
2050
|
}
|
|
@@ -2081,41 +2093,41 @@ class xs extends ht {
|
|
|
2081
2093
|
async readTextFromClipboard() {
|
|
2082
2094
|
const t = this.createRequestId(), {
|
|
2083
2095
|
data: s = null
|
|
2084
|
-
} = await
|
|
2096
|
+
} = await w({
|
|
2085
2097
|
method: "web_app_read_text_from_clipboard",
|
|
2086
2098
|
event: "clipboard_text_received",
|
|
2087
2099
|
postEvent: this.postEvent,
|
|
2088
2100
|
params: { req_id: t },
|
|
2089
|
-
capture:
|
|
2101
|
+
capture: kt(t)
|
|
2090
2102
|
});
|
|
2091
2103
|
return s;
|
|
2092
2104
|
}
|
|
2093
2105
|
}
|
|
2094
|
-
const
|
|
2095
|
-
({ version: e, postEvent: t, createRequestId: s }) => new
|
|
2106
|
+
const Ps = l(
|
|
2107
|
+
({ version: e, postEvent: t, createRequestId: s }) => new Es(e, s, t)
|
|
2096
2108
|
);
|
|
2097
|
-
async function
|
|
2109
|
+
async function Qt(e = {}) {
|
|
2098
2110
|
const {
|
|
2099
2111
|
is_expanded: t,
|
|
2100
2112
|
is_state_stable: s,
|
|
2101
2113
|
...n
|
|
2102
|
-
} = await
|
|
2114
|
+
} = await w({
|
|
2103
2115
|
...e,
|
|
2104
2116
|
method: "web_app_request_viewport",
|
|
2105
2117
|
event: "viewport_changed"
|
|
2106
2118
|
});
|
|
2107
2119
|
return { ...n, isExpanded: t, isStateStable: s };
|
|
2108
2120
|
}
|
|
2109
|
-
function
|
|
2121
|
+
function q(e) {
|
|
2110
2122
|
return e < 0 ? 0 : e;
|
|
2111
2123
|
}
|
|
2112
|
-
class
|
|
2124
|
+
class Rs extends ct {
|
|
2113
2125
|
constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
|
|
2114
2126
|
super({
|
|
2115
|
-
height:
|
|
2127
|
+
height: q(n),
|
|
2116
2128
|
isExpanded: i,
|
|
2117
|
-
stableHeight:
|
|
2118
|
-
width:
|
|
2129
|
+
stableHeight: q(s),
|
|
2130
|
+
width: q(r)
|
|
2119
2131
|
}), c(this, "postEvent"), this.postEvent = t;
|
|
2120
2132
|
}
|
|
2121
2133
|
/**
|
|
@@ -2124,7 +2136,7 @@ class Ss extends ct {
|
|
|
2124
2136
|
* @param options - options to request fresh data.
|
|
2125
2137
|
*/
|
|
2126
2138
|
async sync(t) {
|
|
2127
|
-
const { isStateStable: s, ...n } = await
|
|
2139
|
+
const { isStateStable: s, ...n } = await Qt(t);
|
|
2128
2140
|
this.set({
|
|
2129
2141
|
...n,
|
|
2130
2142
|
stableHeight: s ? n.height : this.get("stableHeight")
|
|
@@ -2177,12 +2189,12 @@ class Ss extends ct {
|
|
|
2177
2189
|
width: n,
|
|
2178
2190
|
is_expanded: r,
|
|
2179
2191
|
is_state_stable: i
|
|
2180
|
-
} = t,
|
|
2192
|
+
} = t, o = q(s);
|
|
2181
2193
|
this.set({
|
|
2182
|
-
height:
|
|
2194
|
+
height: o,
|
|
2183
2195
|
isExpanded: r,
|
|
2184
|
-
width:
|
|
2185
|
-
...i ? { stableHeight:
|
|
2196
|
+
width: q(n),
|
|
2197
|
+
...i ? { stableHeight: o } : {}
|
|
2186
2198
|
});
|
|
2187
2199
|
});
|
|
2188
2200
|
}
|
|
@@ -2216,49 +2228,49 @@ class Ss extends ct {
|
|
|
2216
2228
|
return this.stableHeight === this.height;
|
|
2217
2229
|
}
|
|
2218
2230
|
}
|
|
2219
|
-
const
|
|
2231
|
+
const xs = l(
|
|
2220
2232
|
"viewport",
|
|
2221
2233
|
async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
|
|
2222
|
-
let r = !1, i = 0,
|
|
2234
|
+
let r = !1, i = 0, o = 0, a = 0;
|
|
2223
2235
|
if (e)
|
|
2224
|
-
r = e.isExpanded, i = e.height,
|
|
2236
|
+
r = e.isExpanded, i = e.height, o = e.width, a = e.stableHeight;
|
|
2225
2237
|
else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
|
|
2226
|
-
r = !0, i = window.innerHeight,
|
|
2238
|
+
r = !0, i = window.innerHeight, o = window.innerWidth, a = window.innerHeight;
|
|
2227
2239
|
else {
|
|
2228
|
-
const
|
|
2229
|
-
r =
|
|
2240
|
+
const h = await Qt({ timeout: 1e3, postEvent: s });
|
|
2241
|
+
r = h.isExpanded, i = h.height, o = h.width, a = h.isStateStable ? i : 0;
|
|
2230
2242
|
}
|
|
2231
|
-
const
|
|
2243
|
+
const u = new Rs({
|
|
2232
2244
|
postEvent: s,
|
|
2233
2245
|
height: i,
|
|
2234
|
-
width:
|
|
2235
|
-
stableHeight:
|
|
2246
|
+
width: o,
|
|
2247
|
+
stableHeight: a,
|
|
2236
2248
|
isExpanded: r
|
|
2237
2249
|
});
|
|
2238
|
-
return n(
|
|
2250
|
+
return n(u.listen()), u;
|
|
2239
2251
|
}
|
|
2240
2252
|
);
|
|
2241
2253
|
function R(e, t) {
|
|
2242
2254
|
document.documentElement.style.setProperty(e, t);
|
|
2243
2255
|
}
|
|
2244
|
-
function
|
|
2245
|
-
s || (s = (
|
|
2256
|
+
function bn(e, t, s) {
|
|
2257
|
+
s || (s = (a) => `--tg-${a}-color`);
|
|
2246
2258
|
const n = s("header"), r = s("bg"), i = () => {
|
|
2247
|
-
const { headerColor:
|
|
2248
|
-
if (rt(
|
|
2249
|
-
R(n,
|
|
2259
|
+
const { headerColor: a } = e;
|
|
2260
|
+
if (rt(a))
|
|
2261
|
+
R(n, a);
|
|
2250
2262
|
else {
|
|
2251
|
-
const { bgColor:
|
|
2252
|
-
|
|
2263
|
+
const { bgColor: u, secondaryBgColor: h } = t;
|
|
2264
|
+
a === "bg_color" && u ? R(n, u) : a === "secondary_bg_color" && h && R(n, h);
|
|
2253
2265
|
}
|
|
2254
2266
|
R(r, e.bgColor);
|
|
2255
|
-
},
|
|
2267
|
+
}, o = [
|
|
2256
2268
|
t.on("change", i),
|
|
2257
2269
|
e.on("change", i)
|
|
2258
2270
|
];
|
|
2259
|
-
return i(), () =>
|
|
2271
|
+
return i(), () => o.forEach((a) => a());
|
|
2260
2272
|
}
|
|
2261
|
-
function
|
|
2273
|
+
function vn(e, t) {
|
|
2262
2274
|
t || (t = (n) => `--tg-theme-${n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`);
|
|
2263
2275
|
const s = () => {
|
|
2264
2276
|
Object.entries(e.getState()).forEach(([n, r]) => {
|
|
@@ -2267,23 +2279,23 @@ function Pn(e, t) {
|
|
|
2267
2279
|
};
|
|
2268
2280
|
return s(), e.on("change", s);
|
|
2269
2281
|
}
|
|
2270
|
-
function
|
|
2271
|
-
t || (t = (
|
|
2282
|
+
function yn(e, t) {
|
|
2283
|
+
t || (t = (h) => `--tg-viewport-${h}`);
|
|
2272
2284
|
const [
|
|
2273
2285
|
s,
|
|
2274
2286
|
n,
|
|
2275
2287
|
r
|
|
2276
|
-
] = ["height", "width", "stable-height"].map((
|
|
2288
|
+
] = ["height", "width", "stable-height"].map((h) => t(h)), i = () => R(s, `${e.height}px`), o = () => R(n, `${e.width}px`), a = () => R(r, `${e.stableHeight}px`), u = [
|
|
2277
2289
|
e.on("change:height", i),
|
|
2278
|
-
e.on("change:width",
|
|
2279
|
-
e.on("change:stableHeight",
|
|
2290
|
+
e.on("change:width", o),
|
|
2291
|
+
e.on("change:stableHeight", a)
|
|
2280
2292
|
];
|
|
2281
|
-
return i(),
|
|
2293
|
+
return i(), o(), a(), () => u.forEach((h) => h());
|
|
2282
2294
|
}
|
|
2283
|
-
function
|
|
2295
|
+
function Cs(e = !0) {
|
|
2284
2296
|
const t = [
|
|
2285
2297
|
E("reload_iframe", () => {
|
|
2286
|
-
|
|
2298
|
+
B("iframe_will_reload"), window.location.reload();
|
|
2287
2299
|
})
|
|
2288
2300
|
], s = () => t.forEach((n) => n());
|
|
2289
2301
|
if (e) {
|
|
@@ -2295,25 +2307,25 @@ function As(e = !0) {
|
|
|
2295
2307
|
() => document.head.removeChild(n)
|
|
2296
2308
|
);
|
|
2297
2309
|
}
|
|
2298
|
-
return
|
|
2310
|
+
return B("iframe_ready", { reload_supported: !0 }), s;
|
|
2299
2311
|
}
|
|
2300
|
-
function
|
|
2312
|
+
function Ss() {
|
|
2301
2313
|
return typeof window > "u";
|
|
2302
2314
|
}
|
|
2303
|
-
async function
|
|
2304
|
-
if (
|
|
2315
|
+
async function En() {
|
|
2316
|
+
if (Tt(window))
|
|
2305
2317
|
return !0;
|
|
2306
2318
|
try {
|
|
2307
|
-
return await
|
|
2319
|
+
return await w({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
2308
2320
|
} catch {
|
|
2309
2321
|
return !1;
|
|
2310
2322
|
}
|
|
2311
2323
|
}
|
|
2312
|
-
function
|
|
2324
|
+
function Ts(e) {
|
|
2313
2325
|
return e instanceof W;
|
|
2314
2326
|
}
|
|
2315
|
-
function
|
|
2316
|
-
return
|
|
2327
|
+
function Pn(e, t) {
|
|
2328
|
+
return Ts(e) && e.type === t;
|
|
2317
2329
|
}
|
|
2318
2330
|
function J(e, t) {
|
|
2319
2331
|
let s, n, r;
|
|
@@ -2323,13 +2335,13 @@ function J(e, t) {
|
|
|
2323
2335
|
params: n
|
|
2324
2336
|
});
|
|
2325
2337
|
}
|
|
2326
|
-
class
|
|
2327
|
-
constructor(t, s, n =
|
|
2328
|
-
if (c(this, "history"), c(this, "ee", new
|
|
2329
|
-
throw
|
|
2338
|
+
class As {
|
|
2339
|
+
constructor(t, s, n = B) {
|
|
2340
|
+
if (c(this, "history"), c(this, "ee", new N()), 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)
|
|
2341
|
+
throw m(ge, "History should not be empty.");
|
|
2330
2342
|
if (s < 0 || s >= t.length)
|
|
2331
|
-
throw
|
|
2332
|
-
|
|
2343
|
+
throw m(
|
|
2344
|
+
we,
|
|
2333
2345
|
"Index should not be zero and higher or equal than history size."
|
|
2334
2346
|
);
|
|
2335
2347
|
this.history = t.map((r) => J(r, ""));
|
|
@@ -2444,30 +2456,30 @@ class Os {
|
|
|
2444
2456
|
this.postEvent("web_app_setup_back_button", { is_visible: !!this.index });
|
|
2445
2457
|
}
|
|
2446
2458
|
}
|
|
2447
|
-
function
|
|
2459
|
+
function F({
|
|
2448
2460
|
params: e,
|
|
2449
2461
|
...t
|
|
2450
2462
|
}) {
|
|
2451
2463
|
return { ...e || { hash: "", search: "" }, ...t };
|
|
2452
2464
|
}
|
|
2453
|
-
function
|
|
2465
|
+
function M(e, t) {
|
|
2454
2466
|
return e.startsWith(t) ? e : `${t}${e}`;
|
|
2455
2467
|
}
|
|
2456
|
-
function
|
|
2468
|
+
function H(e) {
|
|
2457
2469
|
return new URL(
|
|
2458
|
-
typeof e == "string" ? e : `${e.pathname || ""}${
|
|
2470
|
+
typeof e == "string" ? e : `${e.pathname || ""}${M(e.search || "", "?")}${M(e.hash || "", "#")}`,
|
|
2459
2471
|
"http://a"
|
|
2460
2472
|
);
|
|
2461
2473
|
}
|
|
2462
2474
|
function U(e) {
|
|
2463
|
-
const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s =
|
|
2475
|
+
const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = H(e);
|
|
2464
2476
|
return `${t ? s.pathname : s.pathname.slice(1)}${s.search}${s.hash}`;
|
|
2465
2477
|
}
|
|
2466
|
-
function
|
|
2478
|
+
function Q(e, t, s) {
|
|
2467
2479
|
let n, r;
|
|
2468
2480
|
typeof e == "string" ? n = e : (n = U(e), s = e.state, r = e.id);
|
|
2469
|
-
const { pathname: i, search:
|
|
2470
|
-
return { id: r, pathname: i, params: { hash:
|
|
2481
|
+
const { pathname: i, search: o, hash: a } = new URL(n, `http://a${M(t, "/")}`);
|
|
2482
|
+
return { id: r, pathname: i, params: { hash: a, search: o, state: s } };
|
|
2471
2483
|
}
|
|
2472
2484
|
async function D(e) {
|
|
2473
2485
|
return e === 0 ? !0 : Promise.race([
|
|
@@ -2483,39 +2495,39 @@ async function D(e) {
|
|
|
2483
2495
|
})
|
|
2484
2496
|
]);
|
|
2485
2497
|
}
|
|
2486
|
-
async function
|
|
2498
|
+
async function Is() {
|
|
2487
2499
|
if (window.history.length <= 1 || (window.history.pushState(null, ""), await D(1 - window.history.length)))
|
|
2488
2500
|
return;
|
|
2489
2501
|
let e = await D(-1);
|
|
2490
2502
|
for (; e; )
|
|
2491
2503
|
e = await D(-1);
|
|
2492
2504
|
}
|
|
2493
|
-
function
|
|
2494
|
-
return
|
|
2505
|
+
function Yt(e) {
|
|
2506
|
+
return H(e).pathname;
|
|
2495
2507
|
}
|
|
2496
|
-
const
|
|
2497
|
-
class
|
|
2508
|
+
const ft = 0, Y = 1, Z = 2;
|
|
2509
|
+
class Zt {
|
|
2498
2510
|
constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
|
|
2499
|
-
c(this, "navigator"), c(this, "ee", new
|
|
2500
|
-
if (
|
|
2511
|
+
c(this, "navigator"), c(this, "ee", new N()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
|
|
2512
|
+
if (o === null)
|
|
2501
2513
|
return this.push(this.parsePath(window.location.href));
|
|
2502
|
-
|
|
2514
|
+
o === ft ? window.history.forward() : o === Y && this.back(), o === Z && this.forward();
|
|
2503
2515
|
}), c(this, "onNavigatorChange", async ({
|
|
2504
|
-
to:
|
|
2505
|
-
from:
|
|
2506
|
-
delta:
|
|
2516
|
+
to: o,
|
|
2517
|
+
from: a,
|
|
2518
|
+
delta: u
|
|
2507
2519
|
}) => {
|
|
2508
2520
|
this.attached && await this.syncHistory(), this.ee.emit("change", {
|
|
2509
|
-
delta:
|
|
2510
|
-
from:
|
|
2511
|
-
to:
|
|
2521
|
+
delta: u,
|
|
2522
|
+
from: F(a),
|
|
2523
|
+
to: F(o),
|
|
2512
2524
|
navigator: this
|
|
2513
2525
|
});
|
|
2514
|
-
}), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new
|
|
2515
|
-
t.map((
|
|
2526
|
+
}), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new As(
|
|
2527
|
+
t.map((o) => Q(o, "/")),
|
|
2516
2528
|
s,
|
|
2517
2529
|
n
|
|
2518
|
-
), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base =
|
|
2530
|
+
), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = Yt(i || "");
|
|
2519
2531
|
}
|
|
2520
2532
|
/**
|
|
2521
2533
|
* Attaches current navigator to the browser history allowing navigator to manipulate it.
|
|
@@ -2599,7 +2611,7 @@ class Xt {
|
|
|
2599
2611
|
* Navigation history.
|
|
2600
2612
|
*/
|
|
2601
2613
|
get history() {
|
|
2602
|
-
return this.navigator.history.map(
|
|
2614
|
+
return this.navigator.history.map(F);
|
|
2603
2615
|
}
|
|
2604
2616
|
/**
|
|
2605
2617
|
* Path, including pathname, search and hash.
|
|
@@ -2642,19 +2654,19 @@ class Xt {
|
|
|
2642
2654
|
* // { pathname: '/tma', search: '?is=cool', hash: '#yeah' }
|
|
2643
2655
|
*/
|
|
2644
2656
|
parsePath(t) {
|
|
2645
|
-
let s =
|
|
2646
|
-
return this.hashMode && (s =
|
|
2657
|
+
let s = H(t);
|
|
2658
|
+
return this.hashMode && (s = H(s.hash.slice(1))), {
|
|
2647
2659
|
pathname: s.pathname,
|
|
2648
2660
|
search: s.search,
|
|
2649
2661
|
hash: s.hash
|
|
2650
2662
|
};
|
|
2651
2663
|
}
|
|
2652
2664
|
push(t, s) {
|
|
2653
|
-
const n =
|
|
2665
|
+
const n = Q(t, this.path), { state: r = s } = n.params;
|
|
2654
2666
|
this.navigator.push({ ...n, params: { ...n.params, state: r } });
|
|
2655
2667
|
}
|
|
2656
2668
|
replace(t, s) {
|
|
2657
|
-
const n =
|
|
2669
|
+
const n = Q(t, this.path), { state: r = s } = n.params;
|
|
2658
2670
|
this.navigator.replace({ ...n, params: { ...n.params, state: r } });
|
|
2659
2671
|
}
|
|
2660
2672
|
/**
|
|
@@ -2663,8 +2675,8 @@ class Xt {
|
|
|
2663
2675
|
* @param value - path presented as string or URLLike.
|
|
2664
2676
|
*/
|
|
2665
2677
|
renderPath(t) {
|
|
2666
|
-
const s = (this.base.length === 1 ? "" : this.base) +
|
|
2667
|
-
return this.hashMode ?
|
|
2678
|
+
const s = (this.base.length === 1 ? "" : this.base) + M(U(t), "/");
|
|
2679
|
+
return this.hashMode ? M(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
|
|
2668
2680
|
}
|
|
2669
2681
|
/**
|
|
2670
2682
|
* Synchronizes current navigator state with browser history.
|
|
@@ -2672,7 +2684,7 @@ class Xt {
|
|
|
2672
2684
|
async syncHistory() {
|
|
2673
2685
|
window.removeEventListener("popstate", this.onPopState);
|
|
2674
2686
|
const { state: t } = this, s = this.renderPath(this);
|
|
2675
|
-
await
|
|
2687
|
+
await Is(), this.hasPrev && this.hasNext ? (window.history.replaceState(Y, ""), window.history.pushState(t, "", s), window.history.pushState(Z, ""), await D(-1)) : this.hasPrev ? (window.history.replaceState(Y, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(Z, ""), await D(-1)) : (window.history.replaceState(ft, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
|
|
2676
2688
|
}
|
|
2677
2689
|
/**
|
|
2678
2690
|
* Current query parameters.
|
|
@@ -2690,74 +2702,79 @@ class Xt {
|
|
|
2690
2702
|
return (this.navigator.current.params || {}).state;
|
|
2691
2703
|
}
|
|
2692
2704
|
}
|
|
2693
|
-
function
|
|
2705
|
+
function ks(e) {
|
|
2694
2706
|
e || (e = {});
|
|
2695
2707
|
const { href: t, hash: s } = window.location;
|
|
2696
2708
|
let n = U(
|
|
2697
2709
|
e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
|
|
2698
2710
|
);
|
|
2699
|
-
const r = e.base ?
|
|
2711
|
+
const r = e.base ? Yt(e.base) : void 0;
|
|
2700
2712
|
if (r) {
|
|
2701
2713
|
if (!n.startsWith(r))
|
|
2702
|
-
throw
|
|
2703
|
-
|
|
2714
|
+
throw m(
|
|
2715
|
+
fe,
|
|
2704
2716
|
`Path "${n}" expected to be starting with "${r}"`
|
|
2705
2717
|
);
|
|
2706
2718
|
n = n.slice(r.length);
|
|
2707
2719
|
}
|
|
2708
|
-
return new
|
|
2720
|
+
return new Zt([n], 0, e);
|
|
2709
2721
|
}
|
|
2710
|
-
function
|
|
2722
|
+
function Rn(e) {
|
|
2711
2723
|
const t = e.match(/#(.+)/);
|
|
2712
2724
|
return t ? t[1] : null;
|
|
2713
2725
|
}
|
|
2714
|
-
function
|
|
2715
|
-
if (
|
|
2726
|
+
function qs(e, t) {
|
|
2727
|
+
if (zt()) {
|
|
2716
2728
|
const s = sessionStorage.getItem(e);
|
|
2717
2729
|
if (s)
|
|
2718
2730
|
try {
|
|
2719
2731
|
const { index: n, history: r } = JSON.parse(s);
|
|
2720
|
-
return new
|
|
2732
|
+
return new Zt(r, n, t);
|
|
2721
2733
|
} catch (n) {
|
|
2722
2734
|
console.error("Unable to restore hash navigator state.", n);
|
|
2723
2735
|
}
|
|
2724
2736
|
}
|
|
2725
|
-
return
|
|
2737
|
+
return ks(t);
|
|
2726
2738
|
}
|
|
2727
|
-
function
|
|
2728
|
-
const s =
|
|
2739
|
+
function xn(e, t) {
|
|
2740
|
+
const s = qs(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
2729
2741
|
index: s.index,
|
|
2730
2742
|
history: s.history
|
|
2731
2743
|
}));
|
|
2732
2744
|
return s.on("change", n), n(), s;
|
|
2733
2745
|
}
|
|
2734
|
-
function
|
|
2746
|
+
function d(e, t) {
|
|
2735
2747
|
function s(n) {
|
|
2736
|
-
return (
|
|
2737
|
-
|
|
2738
|
-
|
|
2748
|
+
return function(i, o, a) {
|
|
2749
|
+
return (u) => {
|
|
2750
|
+
const h = {
|
|
2751
|
+
...u,
|
|
2752
|
+
[i]: n(o)
|
|
2753
|
+
};
|
|
2754
|
+
return /* @__PURE__ */ mt(a, { ...h });
|
|
2755
|
+
};
|
|
2739
2756
|
};
|
|
2740
2757
|
}
|
|
2741
2758
|
return [s(e), s(t)];
|
|
2742
2759
|
}
|
|
2743
|
-
const
|
|
2744
|
-
function
|
|
2745
|
-
const e =
|
|
2760
|
+
const Xt = te(void 0);
|
|
2761
|
+
function Os() {
|
|
2762
|
+
const e = ee(Xt);
|
|
2746
2763
|
if (!e)
|
|
2747
2764
|
throw new Error("useSDK was used outside the SDKProvider.");
|
|
2748
2765
|
return e;
|
|
2749
2766
|
}
|
|
2750
|
-
function
|
|
2767
|
+
function _(e) {
|
|
2751
2768
|
function t(n) {
|
|
2752
|
-
const r =
|
|
2769
|
+
const r = Os(), [i, o] = bt(
|
|
2753
2770
|
n ? void 0 : () => {
|
|
2754
|
-
if (
|
|
2771
|
+
if (Ss())
|
|
2755
2772
|
throw new Error("Using hooks on the server side, you must explicitly specify ssr = true option");
|
|
2756
2773
|
return r.use(e);
|
|
2757
2774
|
}
|
|
2758
2775
|
);
|
|
2759
|
-
return
|
|
2760
|
-
|
|
2776
|
+
return S(() => {
|
|
2777
|
+
o(r.use(e));
|
|
2761
2778
|
}, [r]), i;
|
|
2762
2779
|
}
|
|
2763
2780
|
function s(n) {
|
|
@@ -2770,246 +2787,248 @@ function g(e) {
|
|
|
2770
2787
|
}
|
|
2771
2788
|
return [t, s];
|
|
2772
2789
|
}
|
|
2773
|
-
const [
|
|
2774
|
-
|
|
2790
|
+
const [Ds, Ns] = _(Ge), [Cn, Sn] = d(
|
|
2791
|
+
Ds,
|
|
2792
|
+
Ns
|
|
2793
|
+
), [Bs, Ms] = _(Ke), [Tn, An] = d(
|
|
2794
|
+
Bs,
|
|
2775
2795
|
Ms
|
|
2776
|
-
), [$s
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
), [
|
|
2780
|
-
|
|
2796
|
+
), [Vs, $s] = _(Fe), [In, kn] = d(
|
|
2797
|
+
Vs,
|
|
2798
|
+
$s
|
|
2799
|
+
), [Ls, Hs] = _(ts), [qn, On] = d(
|
|
2800
|
+
Ls,
|
|
2781
2801
|
Hs
|
|
2782
|
-
), [
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
), [Gs, zs] =
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
), [
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
const n = _t(!0), r = _t(/* @__PURE__ */ new Map()), [i, a] = yt([]), o = gt(() => a([]), []), p = gt(
|
|
2798
|
-
(l) => {
|
|
2799
|
-
n.current && (l && l(r.current), o());
|
|
2802
|
+
), [Us, Ws] = _(ss), [Dn, Nn] = d(
|
|
2803
|
+
Us,
|
|
2804
|
+
Ws
|
|
2805
|
+
), [Gs, js] = _(rs), [Bn, Mn] = d(Gs, js), [zs, Ks] = _(os), [Vn, $n] = d(zs, Ks), [Js, Fs] = _(cs), [Ln, Hn] = d(Js, Fs), [Qs, Ys] = _(ls), [Un, Wn] = d(Qs, Ys), [Zs, Xs] = _(gs), [Gn, jn] = d(Zs, Xs), [tn, en] = _(fs), [zn, Kn] = d(tn, en), [sn, nn] = _(bs), [Jn, Fn] = d(
|
|
2806
|
+
sn,
|
|
2807
|
+
nn
|
|
2808
|
+
), [rn, on] = _(ys), [Qn, Yn] = d(rn, on);
|
|
2809
|
+
function Zn() {
|
|
2810
|
+
return vt(jt, []);
|
|
2811
|
+
}
|
|
2812
|
+
const [an, cn] = _(Ps), [Xn, tr] = d(an, cn), [hn, pn] = _(xs), [er, sr] = d(hn, pn);
|
|
2813
|
+
function nr({ children: e, acceptCustomStyles: t, debug: s }) {
|
|
2814
|
+
const n = dt(!0), [r, i] = bt(/* @__PURE__ */ new Map()), o = dt(r), a = se(
|
|
2815
|
+
(h) => {
|
|
2816
|
+
n.current && i((v) => (h && h(v), new Map(v)));
|
|
2800
2817
|
},
|
|
2801
|
-
[
|
|
2802
|
-
), u =
|
|
2803
|
-
use(
|
|
2804
|
-
const
|
|
2805
|
-
if (
|
|
2806
|
-
return
|
|
2807
|
-
let
|
|
2818
|
+
[]
|
|
2819
|
+
), u = vt(() => ({
|
|
2820
|
+
use(h, ...v) {
|
|
2821
|
+
const pt = r.get(h);
|
|
2822
|
+
if (pt)
|
|
2823
|
+
return pt;
|
|
2824
|
+
let b, K;
|
|
2808
2825
|
try {
|
|
2809
|
-
|
|
2810
|
-
} catch (
|
|
2811
|
-
K =
|
|
2826
|
+
b = h(...v);
|
|
2827
|
+
} catch (f) {
|
|
2828
|
+
K = f;
|
|
2812
2829
|
}
|
|
2813
|
-
function
|
|
2814
|
-
return
|
|
2830
|
+
function L(f) {
|
|
2831
|
+
return r.set(h, f), f;
|
|
2815
2832
|
}
|
|
2816
2833
|
if (K)
|
|
2817
|
-
return
|
|
2818
|
-
let
|
|
2819
|
-
if (Array.isArray(
|
|
2820
|
-
return
|
|
2821
|
-
function
|
|
2822
|
-
if ("on" in
|
|
2823
|
-
const k =
|
|
2824
|
-
|
|
2825
|
-
|
|
2834
|
+
return L({ error: K });
|
|
2835
|
+
let I;
|
|
2836
|
+
if (Array.isArray(b) && (I = b[1], b = b[0]), !b)
|
|
2837
|
+
return L({ result: b, cleanup: I });
|
|
2838
|
+
function ut(f) {
|
|
2839
|
+
if ("on" in f) {
|
|
2840
|
+
const k = f.on("change", () => a()), lt = I;
|
|
2841
|
+
I = () => {
|
|
2842
|
+
lt && lt(), k();
|
|
2826
2843
|
};
|
|
2827
2844
|
}
|
|
2828
|
-
return { result:
|
|
2845
|
+
return { result: f, cleanup: I };
|
|
2829
2846
|
}
|
|
2830
|
-
return
|
|
2831
|
-
(
|
|
2832
|
-
(
|
|
2833
|
-
),
|
|
2847
|
+
return b instanceof Promise ? (b.then(
|
|
2848
|
+
(f) => a((k) => k.set(h, ut(f))),
|
|
2849
|
+
(f) => a((k) => k.set(h, { error: f }))
|
|
2850
|
+
), L({})) : L(ut(b));
|
|
2834
2851
|
}
|
|
2835
|
-
}), [
|
|
2836
|
-
return
|
|
2837
|
-
if (kt())
|
|
2838
|
-
return As(t);
|
|
2839
|
-
}, [t]), O(() => {
|
|
2840
|
-
ce(s || !1);
|
|
2841
|
-
}, [s]), O(() => () => {
|
|
2852
|
+
}), [r]);
|
|
2853
|
+
return S(() => (n.current = !0, () => {
|
|
2842
2854
|
n.current = !1;
|
|
2843
|
-
}, []),
|
|
2844
|
-
|
|
2845
|
-
|
|
2855
|
+
}), []), S(() => {
|
|
2856
|
+
if (At())
|
|
2857
|
+
return Cs(t);
|
|
2858
|
+
}, [t]), S(() => {
|
|
2859
|
+
ae(s || !1);
|
|
2860
|
+
}, [s]), S(() => {
|
|
2861
|
+
o.current = r;
|
|
2862
|
+
}, [r]), S(() => () => {
|
|
2863
|
+
o.current.forEach((h) => {
|
|
2864
|
+
"cleanup" in h && h.cleanup && h.cleanup();
|
|
2846
2865
|
});
|
|
2847
|
-
}, [
|
|
2866
|
+
}, []), /* @__PURE__ */ mt(Xt.Provider, { value: u, children: e });
|
|
2848
2867
|
}
|
|
2849
2868
|
export {
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2869
|
+
qe as BackButton,
|
|
2870
|
+
As as BasicNavigator,
|
|
2871
|
+
je as BiometryManager,
|
|
2872
|
+
Zt as BrowserNavigator,
|
|
2873
|
+
Je as ClosingBehavior,
|
|
2874
|
+
Xe as CloudStorage,
|
|
2875
|
+
fe as ERR_INVALID_PATH_BASE,
|
|
2876
|
+
le as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
|
|
2877
|
+
pe as ERR_METHOD_PARAMETER_UNSUPPORTED,
|
|
2878
|
+
he as ERR_METHOD_UNSUPPORTED,
|
|
2879
|
+
ge as ERR_NAVIGATION_HISTORY_EMPTY,
|
|
2880
|
+
we as ERR_NAVIGATION_INDEX_INVALID,
|
|
2881
|
+
dn as ERR_NAVIGATION_ITEM_INVALID,
|
|
2882
|
+
Rt as ERR_PARSE,
|
|
2883
|
+
_n as ERR_SSR_INIT,
|
|
2884
|
+
de as ERR_TIMED_OUT,
|
|
2885
|
+
_e as ERR_UNEXPECTED_TYPE,
|
|
2886
|
+
ue as ERR_UNKNOWN_ENV,
|
|
2887
|
+
N as EventEmitter,
|
|
2888
|
+
es as HapticFeedback,
|
|
2889
|
+
ns as InitData,
|
|
2890
|
+
is as Invoice,
|
|
2891
|
+
as as MainButton,
|
|
2892
|
+
us as MiniApp,
|
|
2893
|
+
_s as Popup,
|
|
2894
|
+
ws as QRScanner,
|
|
2876
2895
|
W as SDKError,
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2896
|
+
nr as SDKProvider,
|
|
2897
|
+
ms as SettingsButton,
|
|
2898
|
+
vs as ThemeParams,
|
|
2899
|
+
Es as Utils,
|
|
2900
|
+
Rs as Viewport,
|
|
2901
|
+
Ze as array,
|
|
2902
|
+
bn as bindMiniAppCSSVars,
|
|
2903
|
+
vn as bindThemeParamsCSSVars,
|
|
2904
|
+
yn as bindViewportCSSVars,
|
|
2886
2905
|
P as boolean,
|
|
2887
|
-
|
|
2906
|
+
kt as captureSameReq,
|
|
2888
2907
|
et as classNames,
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2908
|
+
Se as compareVersions,
|
|
2909
|
+
ks as createBrowserNavigatorFromLocation,
|
|
2910
|
+
Ie as createPostEvent,
|
|
2911
|
+
H as createSafeURL,
|
|
2912
|
+
Bt as date,
|
|
2913
|
+
Rn as getHash,
|
|
2914
|
+
Yt as getPathname,
|
|
2915
|
+
Ge as initBackButton,
|
|
2916
|
+
Ke as initBiometryManager,
|
|
2917
|
+
Fe as initClosingBehavior,
|
|
2918
|
+
ts as initCloudStorage,
|
|
2919
|
+
ss as initHapticFeedback,
|
|
2920
|
+
rs as initInitData,
|
|
2921
|
+
os as initInvoice,
|
|
2922
|
+
cs as initMainButton,
|
|
2923
|
+
ls as initMiniApp,
|
|
2924
|
+
xn as initNavigator,
|
|
2925
|
+
gs as initPopup,
|
|
2926
|
+
fs as initQRScanner,
|
|
2927
|
+
bs as initSettingsButton,
|
|
2928
|
+
ys as initThemeParams,
|
|
2929
|
+
Ps as initUtils,
|
|
2930
|
+
xs as initViewport,
|
|
2931
|
+
Cs as initWeb,
|
|
2932
|
+
O as invokeCustomMethod,
|
|
2933
|
+
Dt as isColorDark,
|
|
2934
|
+
At as isIframe,
|
|
2935
|
+
zt as isPageReload,
|
|
2917
2936
|
rt as isRGB,
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2937
|
+
me as isRGBShort,
|
|
2938
|
+
Ts as isSDKError,
|
|
2939
|
+
Pn as isSDKErrorOfType,
|
|
2940
|
+
Ss as isSSR,
|
|
2941
|
+
En as isTMA,
|
|
2942
|
+
g as json,
|
|
2943
|
+
wn as mergeClassNames,
|
|
2925
2944
|
x as number,
|
|
2926
2945
|
z as off,
|
|
2927
2946
|
E as on,
|
|
2928
|
-
|
|
2929
|
-
|
|
2947
|
+
fn as parseInitData,
|
|
2948
|
+
$t as parseLaunchParams,
|
|
2930
2949
|
Ft as parseThemeParams,
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2950
|
+
B as postEvent,
|
|
2951
|
+
w as request,
|
|
2952
|
+
ze as requestBiometryInfo,
|
|
2953
|
+
mn as requestThemeParams,
|
|
2954
|
+
Qt as requestViewport,
|
|
2955
|
+
jt as retrieveLaunchParams,
|
|
2956
|
+
St as rgb,
|
|
2938
2957
|
at as searchParams,
|
|
2939
|
-
|
|
2940
|
-
|
|
2958
|
+
Le as serializeLaunchParams,
|
|
2959
|
+
$e as serializeThemeParams,
|
|
2941
2960
|
R as setCSSVar,
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2961
|
+
ae as setDebug,
|
|
2962
|
+
gn as setTargetOrigin,
|
|
2963
|
+
p as string,
|
|
2964
|
+
ie as subscribe,
|
|
2946
2965
|
C as supports,
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2966
|
+
Ae as targetOrigin,
|
|
2967
|
+
Ct as toRGB,
|
|
2968
|
+
Et as unsubscribe,
|
|
2950
2969
|
U as urlToPath,
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
2970
|
+
Ns as useBackButton,
|
|
2971
|
+
Ds as useBackButtonRaw,
|
|
2972
|
+
Ms as useBiometryManager,
|
|
2973
|
+
Bs as useBiometryManagerRaw,
|
|
2974
|
+
$s as useClosingBehavior,
|
|
2975
|
+
Vs as useClosingBehaviorRaw,
|
|
2976
|
+
Hs as useCloudStorage,
|
|
2977
|
+
Ls as useCloudStorageRaw,
|
|
2978
|
+
Ws as useHapticFeedback,
|
|
2979
|
+
Us as useHapticFeedbackRaw,
|
|
2980
|
+
js as useInitData,
|
|
2981
|
+
Gs as useInitDataRaw,
|
|
2982
|
+
Ks as useInvoice,
|
|
2983
|
+
zs as useInvoiceRaw,
|
|
2984
|
+
Zn as useLaunchParams,
|
|
2985
|
+
Fs as useMainButton,
|
|
2986
|
+
Js as useMainButtonRaw,
|
|
2987
|
+
Ys as useMiniApp,
|
|
2988
|
+
Qs as useMiniAppRaw,
|
|
2989
|
+
Xs as usePopup,
|
|
2990
|
+
Zs as usePopupRaw,
|
|
2991
|
+
en as useQRScanner,
|
|
2992
|
+
tn as useQRScannerRaw,
|
|
2993
|
+
Os as useSDK,
|
|
2994
|
+
nn as useSettingsButton,
|
|
2995
|
+
sn as useSettingsButtonRaw,
|
|
2996
|
+
on as useThemeParams,
|
|
2997
|
+
rn as useThemeParamsRaw,
|
|
2998
|
+
cn as useUtils,
|
|
2999
|
+
an as useUtilsRaw,
|
|
3000
|
+
pn as useViewport,
|
|
3001
|
+
hn as useViewportRaw,
|
|
3002
|
+
Sn as withBackButton,
|
|
3003
|
+
Cn as withBackButtonRaw,
|
|
3004
|
+
An as withBiometryManager,
|
|
3005
|
+
Tn as withBiometryManagerRaw,
|
|
3006
|
+
kn as withClosingBehavior,
|
|
3007
|
+
In as withClosingBehaviorRaw,
|
|
3008
|
+
On as withCloudStorage,
|
|
3009
|
+
qn as withCloudStorageRaw,
|
|
3010
|
+
Nn as withHapticFeedback,
|
|
3011
|
+
Dn as withHapticFeedbackRaw,
|
|
3012
|
+
Mn as withInitData,
|
|
3013
|
+
Bn as withInitDataRaw,
|
|
3014
|
+
$n as withInvoice,
|
|
3015
|
+
Vn as withInvoiceRaw,
|
|
3016
|
+
Hn as withMainButton,
|
|
3017
|
+
Ln as withMainButtonRaw,
|
|
3018
|
+
Wn as withMiniApp,
|
|
3019
|
+
Un as withMiniAppRaw,
|
|
3020
|
+
jn as withPopup,
|
|
3021
|
+
Gn as withPopupRaw,
|
|
3022
|
+
Kn as withQRScanner,
|
|
3023
|
+
zn as withQRScannerRaw,
|
|
3024
|
+
Fn as withSettingsButton,
|
|
3025
|
+
Jn as withSettingsButtonRaw,
|
|
3026
|
+
Yn as withThemeParams,
|
|
3027
|
+
Qn as withThemeParamsRaw,
|
|
3028
|
+
Ot as withTimeout,
|
|
3029
|
+
tr as withUtils,
|
|
3030
|
+
Xn as withUtilsRaw,
|
|
3031
|
+
sr as withViewport,
|
|
3032
|
+
er as withViewportRaw
|
|
3014
3033
|
};
|
|
3015
3034
|
//# sourceMappingURL=index.js.map
|