tanya-chatbot 0.3.7 → 0.3.8
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/tanya-chatbot.cjs.js +10 -10
- package/dist/tanya-chatbot.cjs.js.map +1 -1
- package/dist/tanya-chatbot.es.js +143 -146
- package/dist/tanya-chatbot.es.js.map +1 -1
- package/package.json +1 -1
package/dist/tanya-chatbot.es.js
CHANGED
|
@@ -126,33 +126,30 @@ const st = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
|
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
async function Ot() {
|
|
129
|
-
var
|
|
130
|
-
const e = "access_token_" +
|
|
131
|
-
console.log(
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
)
|
|
137
|
-
return console.log("access token found in local storage"), { access_token: o, expires_in: r };
|
|
138
|
-
const { serverUrl: l } = st(), s = JSON.parse(
|
|
129
|
+
var g;
|
|
130
|
+
const t = q(), e = "access_token_" + t, r = "expires_in_" + t, o = localStorage.getItem(r), n = localStorage.getItem(e);
|
|
131
|
+
console.log(n);
|
|
132
|
+
const s = ((g = JSON.parse(sessionStorage.getItem("customerData") || "{}")) == null ? void 0 : g.isGuest) || !0;
|
|
133
|
+
if (o && n && (/* @__PURE__ */ new Date()).getTime() < parseInt(o))
|
|
134
|
+
return console.log("access token found in local storage"), { access_token: n, expires_in: o };
|
|
135
|
+
const { serverUrl: l } = st(), d = JSON.parse(
|
|
139
136
|
sessionStorage.getItem("customerData") || "{}"
|
|
140
|
-
).dwsid,
|
|
137
|
+
).dwsid, i = JSON.parse(
|
|
141
138
|
sessionStorage.getItem("customerData") || "{}"
|
|
142
139
|
).usrRef;
|
|
143
140
|
try {
|
|
144
|
-
const
|
|
145
|
-
`${l}sc-api/${
|
|
141
|
+
const w = s ? "unregister-auth" : "register-auth", S = await E.get(
|
|
142
|
+
`${l}sc-api/${w}?dwsid=${d}&email=${i}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}&siteId=${q()}&token=true`,
|
|
146
143
|
{
|
|
147
144
|
withCredentials: !0
|
|
148
145
|
}
|
|
149
146
|
);
|
|
150
|
-
return localStorage.setItem(e,
|
|
151
|
-
|
|
152
|
-
String((/* @__PURE__ */ new Date()).getTime() +
|
|
153
|
-
), localStorage.setItem("isGuest",
|
|
154
|
-
} catch (
|
|
155
|
-
console.log(
|
|
147
|
+
return localStorage.setItem(e, S.data.access_token), localStorage.setItem(
|
|
148
|
+
r,
|
|
149
|
+
String((/* @__PURE__ */ new Date()).getTime() + S.data.expires_in * 1e3)
|
|
150
|
+
), localStorage.setItem("isGuest", s ? "true" : "false"), S.data;
|
|
151
|
+
} catch (w) {
|
|
152
|
+
console.log(w);
|
|
156
153
|
}
|
|
157
154
|
}
|
|
158
155
|
const Z = () => sessionStorage.getItem("Host"), q = () => sessionStorage.getItem("SiteId"), tt = () => sessionStorage.getItem("pubCfg"), et = () => sessionStorage.getItem("envRef"), rt = () => sessionStorage.getItem("orgRef"), be = async (t) => {
|
|
@@ -195,13 +192,13 @@ const Z = () => sessionStorage.getItem("Host"), q = () => sessionStorage.getItem
|
|
|
195
192
|
if (!t) throw new Error("customerId is required");
|
|
196
193
|
const e = await qe(), { customer_token: r } = await Me(
|
|
197
194
|
e
|
|
198
|
-
), { serverUrl: o, basePath: n } = st(),
|
|
195
|
+
), { serverUrl: o, basePath: n } = st(), l = (await Ot()).access_token;
|
|
199
196
|
return (await E.get(
|
|
200
197
|
`${o}${n}/get-interest?baseUrl=${Z()}&customerId=${t}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
|
|
201
198
|
{
|
|
202
199
|
headers: {
|
|
203
200
|
"Content-Type": "application/json",
|
|
204
|
-
Authorization: `Bearer ${
|
|
201
|
+
Authorization: `Bearer ${l}`
|
|
205
202
|
}
|
|
206
203
|
}
|
|
207
204
|
)).data;
|
|
@@ -231,11 +228,11 @@ function Cr() {
|
|
|
231
228
|
const _r = ({
|
|
232
229
|
product: t
|
|
233
230
|
}) => {
|
|
234
|
-
const e = Ae(), r = Cr(), [o, n] = P(0),
|
|
231
|
+
const e = Ae(), r = Cr(), [o, n] = P(0), s = () => {
|
|
235
232
|
n(
|
|
236
233
|
(i) => i + r >= t.length ? 0 : i + r
|
|
237
234
|
);
|
|
238
|
-
},
|
|
235
|
+
}, l = () => {
|
|
239
236
|
n(
|
|
240
237
|
(i) => i - r < 0 ? t.length - (t.length % r || r) : i - r
|
|
241
238
|
);
|
|
@@ -247,7 +244,7 @@ const _r = ({
|
|
|
247
244
|
(t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
|
|
248
245
|
"button",
|
|
249
246
|
{
|
|
250
|
-
onClick:
|
|
247
|
+
onClick: l,
|
|
251
248
|
className: "absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",
|
|
252
249
|
style: {
|
|
253
250
|
height: "30px",
|
|
@@ -258,7 +255,7 @@ const _r = ({
|
|
|
258
255
|
}
|
|
259
256
|
),
|
|
260
257
|
/* @__PURE__ */ a("div", { className: "flex gap-5 justify-center flex-1 overflow-hidden", children: t.slice(o, o + r).map((i) => {
|
|
261
|
-
var g, w,
|
|
258
|
+
var g, w, S, C;
|
|
262
259
|
return /* @__PURE__ */ u(
|
|
263
260
|
"div",
|
|
264
261
|
{
|
|
@@ -298,7 +295,7 @@ const _r = ({
|
|
|
298
295
|
zIndex: 50
|
|
299
296
|
},
|
|
300
297
|
children: i != null && i.productName ? i.productName : i != null && i.product_name ? i.product_name : ke(
|
|
301
|
-
xe((
|
|
298
|
+
xe((S = i == null ? void 0 : i.name) == null ? void 0 : S["en-US"]),
|
|
302
299
|
60
|
|
303
300
|
) || "Product"
|
|
304
301
|
}
|
|
@@ -307,7 +304,7 @@ const _r = ({
|
|
|
307
304
|
/* @__PURE__ */ u("div", { className: " flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1", children: [
|
|
308
305
|
/* @__PURE__ */ a("p", { children: kr(
|
|
309
306
|
i != null && i.price ? Number(i == null ? void 0 : i.price) : ve(i).centAmount || 0,
|
|
310
|
-
(
|
|
307
|
+
(C = ve(i)) == null ? void 0 : C.currencyCode
|
|
311
308
|
) }),
|
|
312
309
|
/* @__PURE__ */ u("p", { className: "text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate", children: [
|
|
313
310
|
"$",
|
|
@@ -325,7 +322,7 @@ const _r = ({
|
|
|
325
322
|
(t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
|
|
326
323
|
"button",
|
|
327
324
|
{
|
|
328
|
-
onClick:
|
|
325
|
+
onClick: s,
|
|
329
326
|
className: "absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",
|
|
330
327
|
style: {
|
|
331
328
|
height: "30px",
|
|
@@ -377,14 +374,14 @@ const _r = ({
|
|
|
377
374
|
}
|
|
378
375
|
}
|
|
379
376
|
)).data;
|
|
380
|
-
} catch (
|
|
381
|
-
return E.isAxiosError(
|
|
377
|
+
} catch (s) {
|
|
378
|
+
return E.isAxiosError(s) ? console.error("Error creating basket:", s.response || s.message) : console.error("Unexpected error:", s), null;
|
|
382
379
|
}
|
|
383
380
|
}, Vt = async (t, e, r) => {
|
|
384
|
-
const { serverUrl: o, basePath: n } = st(),
|
|
381
|
+
const { serverUrl: o, basePath: n } = st(), s = `${o}`;
|
|
385
382
|
try {
|
|
386
|
-
const
|
|
387
|
-
`${
|
|
383
|
+
const l = await E.post(
|
|
384
|
+
`${s}${n}/basket/add-product/${t}?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
|
|
388
385
|
e,
|
|
389
386
|
{
|
|
390
387
|
headers: {
|
|
@@ -393,21 +390,21 @@ const _r = ({
|
|
|
393
390
|
}
|
|
394
391
|
}
|
|
395
392
|
);
|
|
396
|
-
return
|
|
397
|
-
} catch (
|
|
398
|
-
return E.isAxiosError(
|
|
393
|
+
return l.status === 200 && l.data ? l.data : null;
|
|
394
|
+
} catch (l) {
|
|
395
|
+
return E.isAxiosError(l) ? console.error(
|
|
399
396
|
"Error adding products to basket:",
|
|
400
|
-
|
|
401
|
-
) : console.error("Unexpected error:",
|
|
397
|
+
l.response || l.message
|
|
398
|
+
) : console.error("Unexpected error:", l), null;
|
|
402
399
|
}
|
|
403
400
|
}, Re = async ({
|
|
404
401
|
basketId: t,
|
|
405
402
|
customer_token: e
|
|
406
403
|
}) => {
|
|
407
|
-
var
|
|
404
|
+
var s;
|
|
408
405
|
const { serverUrl: r, basePath: o } = st(), n = `${r}`;
|
|
409
406
|
try {
|
|
410
|
-
const
|
|
407
|
+
const l = await E.get(
|
|
411
408
|
`${n}${o}/basket/${t}?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
|
|
412
409
|
{
|
|
413
410
|
headers: {
|
|
@@ -416,9 +413,9 @@ const _r = ({
|
|
|
416
413
|
}
|
|
417
414
|
}
|
|
418
415
|
);
|
|
419
|
-
return { status:
|
|
420
|
-
} catch (
|
|
421
|
-
return E.isAxiosError(
|
|
416
|
+
return { status: l.status, data: l.data };
|
|
417
|
+
} catch (l) {
|
|
418
|
+
return E.isAxiosError(l) ? { status: (s = l.response) == null ? void 0 : s.status, data: null } : { status: null, data: null };
|
|
422
419
|
}
|
|
423
420
|
}, Rt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Fr = 300 * 1e3, Ft = "1.0.0";
|
|
424
421
|
const xt = (t) => {
|
|
@@ -439,12 +436,12 @@ const xt = (t) => {
|
|
|
439
436
|
console.error("Error storing token:", e);
|
|
440
437
|
}
|
|
441
438
|
}, Ce = 300, Nr = () => {
|
|
442
|
-
var d, i, g, w,
|
|
439
|
+
var d, i, g, w, S, C;
|
|
443
440
|
const t = Ae(), e = Mt((_) => _.product.product), r = Mt((_) => _.store.store), [o, n] = P(!!e);
|
|
444
441
|
if (bt(() => {
|
|
445
442
|
n(!!e);
|
|
446
443
|
}, [e]), !e) return null;
|
|
447
|
-
const
|
|
444
|
+
const s = async () => {
|
|
448
445
|
var _, j, M, H, lt, vt, Pt, ot, kt, St, ct, $t, zt, Ct, O, dt;
|
|
449
446
|
console.log(e, "the prod");
|
|
450
447
|
try {
|
|
@@ -547,7 +544,7 @@ const xt = (t) => {
|
|
|
547
544
|
autoClose: 3e3
|
|
548
545
|
}));
|
|
549
546
|
}
|
|
550
|
-
},
|
|
547
|
+
}, l = () => {
|
|
551
548
|
e && (window.location.href = e.c_pdpUrl);
|
|
552
549
|
};
|
|
553
550
|
return console.log(e, "the prod"), /* @__PURE__ */ u(re, { children: [
|
|
@@ -640,14 +637,14 @@ const xt = (t) => {
|
|
|
640
637
|
/* @__PURE__ */ u("div", { className: "mt-4 flex flex-col gap-2 w-full p-2", children: [
|
|
641
638
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center gap-2", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2 text-left font-nunitoSans", children: [
|
|
642
639
|
/* @__PURE__ */ u("div", { className: "text-[#323135] font-bold", children: [
|
|
643
|
-
((
|
|
640
|
+
((S = e == null ? void 0 : e.rating) == null ? void 0 : S.rate) || 0,
|
|
644
641
|
" /",
|
|
645
642
|
" ",
|
|
646
643
|
/* @__PURE__ */ a("span", { className: "text-[#68656E]", children: "5" })
|
|
647
644
|
] }),
|
|
648
645
|
/* @__PURE__ */ a("div", { className: "text-[#323135] font-semibold text-sm", children: "Overall Rating" }),
|
|
649
646
|
/* @__PURE__ */ u("div", { className: "text-[#68656E] font-semibold text-sm", children: [
|
|
650
|
-
((
|
|
647
|
+
((C = e == null ? void 0 : e.rating) == null ? void 0 : C.count) || 0,
|
|
651
648
|
" ratings"
|
|
652
649
|
] })
|
|
653
650
|
] }) }),
|
|
@@ -678,7 +675,7 @@ const xt = (t) => {
|
|
|
678
675
|
{
|
|
679
676
|
className: "rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer",
|
|
680
677
|
style: { backgroundColor: r.tanyaThemeColor },
|
|
681
|
-
onClick:
|
|
678
|
+
onClick: s,
|
|
682
679
|
children: "Add to Cart"
|
|
683
680
|
}
|
|
684
681
|
),
|
|
@@ -687,7 +684,7 @@ const xt = (t) => {
|
|
|
687
684
|
{
|
|
688
685
|
className: "rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer mb-16",
|
|
689
686
|
style: { backgroundColor: r.tanyaThemeColor },
|
|
690
|
-
onClick:
|
|
687
|
+
onClick: l,
|
|
691
688
|
children: "View more"
|
|
692
689
|
}
|
|
693
690
|
)
|
|
@@ -715,15 +712,15 @@ const xt = (t) => {
|
|
|
715
712
|
"Niece/Nephew": "his/her niece/nephew",
|
|
716
713
|
"My Friends": "his/her friends",
|
|
717
714
|
Others: "others"
|
|
718
|
-
}, o = It(null), n = It(null),
|
|
715
|
+
}, o = It(null), n = It(null), s = It(null), l = It(null), [d, i] = P(null), [g, w] = P(!1), [S, C] = P(!1), [_, j] = P(!1), [M, H] = P(!1), [lt, vt] = P(!1), [Pt, ot] = P(!1), [kt, St] = P(""), [ct, $t] = P(""), zt = (c) => ({
|
|
719
716
|
id: c.id,
|
|
720
717
|
title: c.name,
|
|
721
718
|
image: c.image ?? "",
|
|
722
719
|
price: c.price ?? 0
|
|
723
720
|
}), [Ct, O] = P([]), dt = It(null), p = Mt((c) => c.store.store), _t = Mt((c) => c.product.product), nt = () => {
|
|
724
|
-
j(!0), setTimeout(() =>
|
|
721
|
+
j(!0), setTimeout(() => C(!0), 10);
|
|
725
722
|
}, Jt = () => {
|
|
726
|
-
|
|
723
|
+
C(!1), setTimeout(() => j(!1), 300);
|
|
727
724
|
};
|
|
728
725
|
bt(() => {
|
|
729
726
|
g ? nt() : Jt();
|
|
@@ -850,7 +847,7 @@ const xt = (t) => {
|
|
|
850
847
|
}, J = async (c) => {
|
|
851
848
|
const k = c || kt.trim();
|
|
852
849
|
if (k) {
|
|
853
|
-
vt(!0), St(""), o.current = null, n.current = null,
|
|
850
|
+
vt(!0), St(""), o.current = null, n.current = null, s.current = null, l.current = null, O((b) => [
|
|
854
851
|
...b,
|
|
855
852
|
{
|
|
856
853
|
query: k,
|
|
@@ -944,9 +941,9 @@ const xt = (t) => {
|
|
|
944
941
|
)
|
|
945
942
|
), !o.current || n.current == null)) {
|
|
946
943
|
const f = y[0];
|
|
947
|
-
o.current = String((f == null ? void 0 : f.product_name) ?? ""),
|
|
944
|
+
o.current = String((f == null ? void 0 : f.product_name) ?? ""), s.current = f.image.link, n.current = f.product_id;
|
|
948
945
|
const x = typeof (f == null ? void 0 : f.price) == "number" ? f.price : void 0;
|
|
949
|
-
|
|
946
|
+
l.current = typeof x == "number" && Number.isFinite(x) ? x : null;
|
|
950
947
|
}
|
|
951
948
|
}
|
|
952
949
|
} else
|
|
@@ -972,8 +969,8 @@ const xt = (t) => {
|
|
|
972
969
|
productSnapshot: {
|
|
973
970
|
id: n.current,
|
|
974
971
|
name: o.current,
|
|
975
|
-
image:
|
|
976
|
-
price:
|
|
972
|
+
image: s.current,
|
|
973
|
+
price: l.current ?? null,
|
|
977
974
|
points: 0,
|
|
978
975
|
quantity: 1
|
|
979
976
|
}
|
|
@@ -1166,9 +1163,9 @@ const xt = (t) => {
|
|
|
1166
1163
|
top-0 right-0
|
|
1167
1164
|
transition-transform duration-300 ease-in-out
|
|
1168
1165
|
lg:transform
|
|
1169
|
-
${
|
|
1166
|
+
${S ? "lg:translate-x-0" : "lg:translate-x-full"}
|
|
1170
1167
|
// For mobile: animate from bottom
|
|
1171
|
-
${
|
|
1168
|
+
${S ? "translate-y-0" : "translate-y-full"}
|
|
1172
1169
|
lg:translate-y-0
|
|
1173
1170
|
`,
|
|
1174
1171
|
style: {
|
|
@@ -1648,7 +1645,7 @@ var Q = function() {
|
|
|
1648
1645
|
return Q = Object.assign || function(e) {
|
|
1649
1646
|
for (var r, o = 1, n = arguments.length; o < n; o++) {
|
|
1650
1647
|
r = arguments[o];
|
|
1651
|
-
for (var
|
|
1648
|
+
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
|
|
1652
1649
|
}
|
|
1653
1650
|
return e;
|
|
1654
1651
|
}, Q.apply(this, arguments);
|
|
@@ -1808,15 +1805,15 @@ const Lr = () => class {
|
|
|
1808
1805
|
return F.slots[this.id];
|
|
1809
1806
|
}
|
|
1810
1807
|
withValue(e, r, o, n) {
|
|
1811
|
-
const
|
|
1808
|
+
const s = {
|
|
1812
1809
|
__proto__: null,
|
|
1813
1810
|
[this.id]: e
|
|
1814
|
-
},
|
|
1815
|
-
F = { parent:
|
|
1811
|
+
}, l = F;
|
|
1812
|
+
F = { parent: l, slots: s };
|
|
1816
1813
|
try {
|
|
1817
1814
|
return r.apply(n, o);
|
|
1818
1815
|
} finally {
|
|
1819
|
-
F =
|
|
1816
|
+
F = l;
|
|
1820
1817
|
}
|
|
1821
1818
|
}
|
|
1822
1819
|
// Capture the current context and wrap a callback function so that it
|
|
@@ -1997,8 +1994,8 @@ function Ze(t, e, r) {
|
|
|
1997
1994
|
se(t), n && n.call(o);
|
|
1998
1995
|
break;
|
|
1999
1996
|
}
|
|
2000
|
-
} catch (
|
|
2001
|
-
yt(
|
|
1997
|
+
} catch (s) {
|
|
1998
|
+
yt(s);
|
|
2002
1999
|
}
|
|
2003
2000
|
t._state === "closed" ? Qe(t) : t._state === "running" && (t._state = "ready");
|
|
2004
2001
|
}
|
|
@@ -2029,8 +2026,8 @@ var Rr = /* @__PURE__ */ (function() {
|
|
|
2029
2026
|
var n = new Yr(this);
|
|
2030
2027
|
try {
|
|
2031
2028
|
this._cleanup = o.call(void 0, n);
|
|
2032
|
-
} catch (
|
|
2033
|
-
n.error(
|
|
2029
|
+
} catch (s) {
|
|
2030
|
+
n.error(s);
|
|
2034
2031
|
}
|
|
2035
2032
|
this._state === "initializing" && (this._state = "ready");
|
|
2036
2033
|
}
|
|
@@ -2075,104 +2072,104 @@ var Rr = /* @__PURE__ */ (function() {
|
|
|
2075
2072
|
}), new Rr(o, this._subscriber);
|
|
2076
2073
|
}, e.forEach = function(o) {
|
|
2077
2074
|
var n = this;
|
|
2078
|
-
return new Promise(function(
|
|
2075
|
+
return new Promise(function(s, l) {
|
|
2079
2076
|
if (typeof o != "function") {
|
|
2080
|
-
|
|
2077
|
+
l(new TypeError(o + " is not a function"));
|
|
2081
2078
|
return;
|
|
2082
2079
|
}
|
|
2083
2080
|
function d() {
|
|
2084
|
-
i.unsubscribe(),
|
|
2081
|
+
i.unsubscribe(), s();
|
|
2085
2082
|
}
|
|
2086
2083
|
var i = n.subscribe({
|
|
2087
2084
|
next: function(g) {
|
|
2088
2085
|
try {
|
|
2089
2086
|
o(g, d);
|
|
2090
2087
|
} catch (w) {
|
|
2091
|
-
|
|
2088
|
+
l(w), i.unsubscribe();
|
|
2092
2089
|
}
|
|
2093
2090
|
},
|
|
2094
|
-
error:
|
|
2095
|
-
complete:
|
|
2091
|
+
error: l,
|
|
2092
|
+
complete: s
|
|
2096
2093
|
});
|
|
2097
2094
|
});
|
|
2098
2095
|
}, e.map = function(o) {
|
|
2099
2096
|
var n = this;
|
|
2100
2097
|
if (typeof o != "function") throw new TypeError(o + " is not a function");
|
|
2101
|
-
var
|
|
2102
|
-
return new
|
|
2098
|
+
var s = Nt(this);
|
|
2099
|
+
return new s(function(l) {
|
|
2103
2100
|
return n.subscribe({
|
|
2104
2101
|
next: function(d) {
|
|
2105
2102
|
try {
|
|
2106
2103
|
d = o(d);
|
|
2107
2104
|
} catch (i) {
|
|
2108
|
-
return
|
|
2105
|
+
return l.error(i);
|
|
2109
2106
|
}
|
|
2110
|
-
|
|
2107
|
+
l.next(d);
|
|
2111
2108
|
},
|
|
2112
2109
|
error: function(d) {
|
|
2113
|
-
|
|
2110
|
+
l.error(d);
|
|
2114
2111
|
},
|
|
2115
2112
|
complete: function() {
|
|
2116
|
-
|
|
2113
|
+
l.complete();
|
|
2117
2114
|
}
|
|
2118
2115
|
});
|
|
2119
2116
|
});
|
|
2120
2117
|
}, e.filter = function(o) {
|
|
2121
2118
|
var n = this;
|
|
2122
2119
|
if (typeof o != "function") throw new TypeError(o + " is not a function");
|
|
2123
|
-
var
|
|
2124
|
-
return new
|
|
2120
|
+
var s = Nt(this);
|
|
2121
|
+
return new s(function(l) {
|
|
2125
2122
|
return n.subscribe({
|
|
2126
2123
|
next: function(d) {
|
|
2127
2124
|
try {
|
|
2128
2125
|
if (!o(d)) return;
|
|
2129
2126
|
} catch (i) {
|
|
2130
|
-
return
|
|
2127
|
+
return l.error(i);
|
|
2131
2128
|
}
|
|
2132
|
-
|
|
2129
|
+
l.next(d);
|
|
2133
2130
|
},
|
|
2134
2131
|
error: function(d) {
|
|
2135
|
-
|
|
2132
|
+
l.error(d);
|
|
2136
2133
|
},
|
|
2137
2134
|
complete: function() {
|
|
2138
|
-
|
|
2135
|
+
l.complete();
|
|
2139
2136
|
}
|
|
2140
2137
|
});
|
|
2141
2138
|
});
|
|
2142
2139
|
}, e.reduce = function(o) {
|
|
2143
2140
|
var n = this;
|
|
2144
2141
|
if (typeof o != "function") throw new TypeError(o + " is not a function");
|
|
2145
|
-
var
|
|
2146
|
-
return new
|
|
2142
|
+
var s = Nt(this), l = arguments.length > 1, d = !1, i = arguments[1], g = i;
|
|
2143
|
+
return new s(function(w) {
|
|
2147
2144
|
return n.subscribe({
|
|
2148
|
-
next: function(
|
|
2149
|
-
var
|
|
2150
|
-
if (d = !0, !
|
|
2145
|
+
next: function(S) {
|
|
2146
|
+
var C = !d;
|
|
2147
|
+
if (d = !0, !C || l)
|
|
2151
2148
|
try {
|
|
2152
|
-
g = o(g,
|
|
2149
|
+
g = o(g, S);
|
|
2153
2150
|
} catch (_) {
|
|
2154
2151
|
return w.error(_);
|
|
2155
2152
|
}
|
|
2156
2153
|
else
|
|
2157
|
-
g =
|
|
2154
|
+
g = S;
|
|
2158
2155
|
},
|
|
2159
|
-
error: function(
|
|
2160
|
-
w.error(
|
|
2156
|
+
error: function(S) {
|
|
2157
|
+
w.error(S);
|
|
2161
2158
|
},
|
|
2162
2159
|
complete: function() {
|
|
2163
|
-
if (!d && !
|
|
2160
|
+
if (!d && !l) return w.error(new TypeError("Cannot reduce an empty sequence"));
|
|
2164
2161
|
w.next(g), w.complete();
|
|
2165
2162
|
}
|
|
2166
2163
|
});
|
|
2167
2164
|
});
|
|
2168
2165
|
}, e.concat = function() {
|
|
2169
|
-
for (var o = this, n = arguments.length,
|
|
2170
|
-
l
|
|
2166
|
+
for (var o = this, n = arguments.length, s = new Array(n), l = 0; l < n; l++)
|
|
2167
|
+
s[l] = arguments[l];
|
|
2171
2168
|
var d = Nt(this);
|
|
2172
2169
|
return new d(function(i) {
|
|
2173
2170
|
var g, w = 0;
|
|
2174
|
-
function C
|
|
2175
|
-
g =
|
|
2171
|
+
function S(C) {
|
|
2172
|
+
g = C.subscribe({
|
|
2176
2173
|
next: function(_) {
|
|
2177
2174
|
i.next(_);
|
|
2178
2175
|
},
|
|
@@ -2180,50 +2177,50 @@ var Rr = /* @__PURE__ */ (function() {
|
|
|
2180
2177
|
i.error(_);
|
|
2181
2178
|
},
|
|
2182
2179
|
complete: function() {
|
|
2183
|
-
w ===
|
|
2180
|
+
w === s.length ? (g = void 0, i.complete()) : S(d.from(s[w++]));
|
|
2184
2181
|
}
|
|
2185
2182
|
});
|
|
2186
2183
|
}
|
|
2187
|
-
return
|
|
2184
|
+
return S(o), function() {
|
|
2188
2185
|
g && (g.unsubscribe(), g = void 0);
|
|
2189
2186
|
};
|
|
2190
2187
|
});
|
|
2191
2188
|
}, e.flatMap = function(o) {
|
|
2192
2189
|
var n = this;
|
|
2193
2190
|
if (typeof o != "function") throw new TypeError(o + " is not a function");
|
|
2194
|
-
var
|
|
2195
|
-
return new
|
|
2191
|
+
var s = Nt(this);
|
|
2192
|
+
return new s(function(l) {
|
|
2196
2193
|
var d = [], i = n.subscribe({
|
|
2197
2194
|
next: function(w) {
|
|
2198
2195
|
if (o)
|
|
2199
2196
|
try {
|
|
2200
2197
|
w = o(w);
|
|
2201
|
-
} catch (
|
|
2202
|
-
return
|
|
2198
|
+
} catch (C) {
|
|
2199
|
+
return l.error(C);
|
|
2203
2200
|
}
|
|
2204
|
-
var
|
|
2205
|
-
next: function(
|
|
2206
|
-
|
|
2201
|
+
var S = s.from(w).subscribe({
|
|
2202
|
+
next: function(C) {
|
|
2203
|
+
l.next(C);
|
|
2207
2204
|
},
|
|
2208
|
-
error: function(
|
|
2209
|
-
|
|
2205
|
+
error: function(C) {
|
|
2206
|
+
l.error(C);
|
|
2210
2207
|
},
|
|
2211
2208
|
complete: function() {
|
|
2212
|
-
var
|
|
2213
|
-
|
|
2209
|
+
var C = d.indexOf(S);
|
|
2210
|
+
C >= 0 && d.splice(C, 1), g();
|
|
2214
2211
|
}
|
|
2215
2212
|
});
|
|
2216
|
-
d.push(
|
|
2213
|
+
d.push(S);
|
|
2217
2214
|
},
|
|
2218
2215
|
error: function(w) {
|
|
2219
|
-
|
|
2216
|
+
l.error(w);
|
|
2220
2217
|
},
|
|
2221
2218
|
complete: function() {
|
|
2222
2219
|
g();
|
|
2223
2220
|
}
|
|
2224
2221
|
});
|
|
2225
2222
|
function g() {
|
|
2226
|
-
i.closed && d.length === 0 &&
|
|
2223
|
+
i.closed && d.length === 0 && l.complete();
|
|
2227
2224
|
}
|
|
2228
2225
|
return function() {
|
|
2229
2226
|
d.forEach(function(w) {
|
|
@@ -2236,19 +2233,19 @@ var Rr = /* @__PURE__ */ (function() {
|
|
|
2236
2233
|
}, t.from = function(o) {
|
|
2237
2234
|
var n = typeof this == "function" ? this : t;
|
|
2238
2235
|
if (o == null) throw new TypeError(o + " is not an object");
|
|
2239
|
-
var
|
|
2240
|
-
if (
|
|
2241
|
-
var
|
|
2242
|
-
if (Object(
|
|
2243
|
-
return Hr(
|
|
2244
|
-
return
|
|
2236
|
+
var s = Kt(o, ie);
|
|
2237
|
+
if (s) {
|
|
2238
|
+
var l = s.call(o);
|
|
2239
|
+
if (Object(l) !== l) throw new TypeError(l + " is not an object");
|
|
2240
|
+
return Hr(l) && l.constructor === n ? l : new n(function(d) {
|
|
2241
|
+
return l.subscribe(d);
|
|
2245
2242
|
});
|
|
2246
2243
|
}
|
|
2247
|
-
if (fe("iterator") && (
|
|
2244
|
+
if (fe("iterator") && (s = Kt(o, Mr), s))
|
|
2248
2245
|
return new n(function(d) {
|
|
2249
2246
|
qt(function() {
|
|
2250
2247
|
if (!d.closed) {
|
|
2251
|
-
for (var i = Ur(
|
|
2248
|
+
for (var i = Ur(s.call(o)), g; !(g = i()).done; ) {
|
|
2252
2249
|
var w = g.value;
|
|
2253
2250
|
if (d.next(w), d.closed) return;
|
|
2254
2251
|
}
|
|
@@ -2268,10 +2265,10 @@ var Rr = /* @__PURE__ */ (function() {
|
|
|
2268
2265
|
});
|
|
2269
2266
|
throw new TypeError(o + " is not observable");
|
|
2270
2267
|
}, t.of = function() {
|
|
2271
|
-
for (var o = arguments.length, n = new Array(o),
|
|
2272
|
-
n[
|
|
2273
|
-
var
|
|
2274
|
-
return new
|
|
2268
|
+
for (var o = arguments.length, n = new Array(o), s = 0; s < o; s++)
|
|
2269
|
+
n[s] = arguments[s];
|
|
2270
|
+
var l = typeof this == "function" ? this : t;
|
|
2271
|
+
return new l(function(d) {
|
|
2275
2272
|
qt(function() {
|
|
2276
2273
|
if (!d.closed) {
|
|
2277
2274
|
for (var i = 0; i < n.length; ++i)
|
|
@@ -2332,8 +2329,8 @@ function Jr(t) {
|
|
|
2332
2329
|
return t;
|
|
2333
2330
|
}
|
|
2334
2331
|
function Wr(t, e) {
|
|
2335
|
-
var r = Q({}, t), o = function(
|
|
2336
|
-
typeof
|
|
2332
|
+
var r = Q({}, t), o = function(s) {
|
|
2333
|
+
typeof s == "function" ? r = Q(Q({}, r), s(r)) : r = Q(Q({}, r), s);
|
|
2337
2334
|
}, n = function() {
|
|
2338
2335
|
return Q({}, r);
|
|
2339
2336
|
};
|
|
@@ -2385,28 +2382,28 @@ var tr = (
|
|
|
2385
2382
|
return r.concat(o);
|
|
2386
2383
|
});
|
|
2387
2384
|
}, t.split = function(e, r, o) {
|
|
2388
|
-
var n = Et(r),
|
|
2389
|
-
return Ut(n) && Ut(
|
|
2390
|
-
return e(d) ? n.request(d) || N.of() :
|
|
2391
|
-
}) :
|
|
2392
|
-
return e(d) ? n.request(d, i) || N.of() :
|
|
2393
|
-
}), Object.assign(
|
|
2385
|
+
var n = Et(r), s = Et(o || new t(je)), l;
|
|
2386
|
+
return Ut(n) && Ut(s) ? l = new t(function(d) {
|
|
2387
|
+
return e(d) ? n.request(d) || N.of() : s.request(d) || N.of();
|
|
2388
|
+
}) : l = new t(function(d, i) {
|
|
2389
|
+
return e(d) ? n.request(d, i) || N.of() : s.request(d, i) || N.of();
|
|
2390
|
+
}), Object.assign(l, { left: n, right: s });
|
|
2394
2391
|
}, t.execute = function(e, r) {
|
|
2395
2392
|
return e.request(Wr(r.context, Gr(Jr(r)))) || N.of();
|
|
2396
2393
|
}, t.concat = function(e, r) {
|
|
2397
2394
|
var o = Et(e);
|
|
2398
2395
|
if (Ut(o))
|
|
2399
2396
|
return globalThis.__DEV__ !== !1 && Zt.warn(47, o), o;
|
|
2400
|
-
var n = Et(r),
|
|
2401
|
-
return Ut(n) ?
|
|
2402
|
-
return o.request(
|
|
2397
|
+
var n = Et(r), s;
|
|
2398
|
+
return Ut(n) ? s = new t(function(l) {
|
|
2399
|
+
return o.request(l, function(d) {
|
|
2403
2400
|
return n.request(d) || N.of();
|
|
2404
2401
|
}) || N.of();
|
|
2405
|
-
}) :
|
|
2406
|
-
return o.request(
|
|
2402
|
+
}) : s = new t(function(l, d) {
|
|
2403
|
+
return o.request(l, function(i) {
|
|
2407
2404
|
return n.request(i, d) || N.of();
|
|
2408
2405
|
}) || N.of();
|
|
2409
|
-
}), Object.assign(
|
|
2406
|
+
}), Object.assign(s, { left: o, right: n });
|
|
2410
2407
|
}, t.prototype.split = function(e, r, o) {
|
|
2411
2408
|
return this.concat(t.split(e, r, o || new t(je)));
|
|
2412
2409
|
}, t.prototype.concat = function(e) {
|
|
@@ -2428,17 +2425,17 @@ function ro(t) {
|
|
|
2428
2425
|
return new tr(function(e, r) {
|
|
2429
2426
|
var o = Or(e, []);
|
|
2430
2427
|
return new N(function(n) {
|
|
2431
|
-
var
|
|
2428
|
+
var s, l = !1;
|
|
2432
2429
|
return Promise.resolve(o).then(function(d) {
|
|
2433
2430
|
return t(d, e.getContext());
|
|
2434
2431
|
}).then(e.setContext).then(function() {
|
|
2435
|
-
|
|
2432
|
+
l || (s = r(e).subscribe({
|
|
2436
2433
|
next: n.next.bind(n),
|
|
2437
2434
|
error: n.error.bind(n),
|
|
2438
2435
|
complete: n.complete.bind(n)
|
|
2439
2436
|
}));
|
|
2440
2437
|
}).catch(n.error.bind(n)), function() {
|
|
2441
|
-
|
|
2438
|
+
l = !0, s && s.unsubscribe();
|
|
2442
2439
|
};
|
|
2443
2440
|
});
|
|
2444
2441
|
});
|