tanya-chatbot 0.3.6 → 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.
@@ -101,7 +101,7 @@ const st = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
101
101
  const t = "https://tanya-sfcc-server.vercel.app/";
102
102
  try {
103
103
  const e = await E.post(
104
- `${t}api/auth/token-bm-grant?baseUrl=${Z()}&siteId=${R()}`
104
+ `${t}api/auth/token-bm-grant?baseUrl=${Z()}&siteId=${q()}`
105
105
  );
106
106
  return e.status === 200 && e.data.access_token ? e.data.access_token : (console.error("Failed to fetch token:", e.data), null);
107
107
  } catch (e) {
@@ -111,7 +111,7 @@ const st = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
111
111
  const e = "https://tanya-sfcc-server.vercel.app/";
112
112
  try {
113
113
  const r = JSON.parse(sessionStorage.getItem("customerData") || "{}").dwsid, o = await E.post(
114
- `${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Z()}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
114
+ `${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
115
115
  {},
116
116
  {
117
117
  headers: {
@@ -126,31 +126,33 @@ const st = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
126
126
  }
127
127
  };
128
128
  async function Ot() {
129
- var s;
130
- const t = localStorage.getItem("expires_in"), e = localStorage.getItem("access_token"), r = ((s = JSON.parse(sessionStorage.getItem("customerData") || "{}")) == null ? void 0 : s.isGuest) || !0;
131
- if (t && e && (/* @__PURE__ */ new Date()).getTime() < parseInt(t) && (r === localStorage.getItem("isGuest") || !0))
132
- return console.log("access token found in local storage"), { access_token: e, expires_in: t };
133
- const { serverUrl: o } = st(), n = 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(
134
136
  sessionStorage.getItem("customerData") || "{}"
135
- ).dwsid, l = JSON.parse(
137
+ ).dwsid, i = JSON.parse(
136
138
  sessionStorage.getItem("customerData") || "{}"
137
139
  ).usrRef;
138
140
  try {
139
- const d = r ? "unregister-auth" : "register-auth", i = await E.get(
140
- `${o}sc-api/${d}?dwsid=${n}&email=${l}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}&siteId=${R()}&token=true`,
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`,
141
143
  {
142
144
  withCredentials: !0
143
145
  }
144
146
  );
145
- return localStorage.setItem("access_token", i.data.access_token), localStorage.setItem(
146
- "expires_in",
147
- String((/* @__PURE__ */ new Date()).getTime() + i.data.expires_in * 1e3)
148
- ), localStorage.setItem("isGuest", r ? "true" : "false"), i.data;
149
- } catch (d) {
150
- console.log(d);
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);
151
153
  }
152
154
  }
153
- const Z = () => sessionStorage.getItem("Host"), R = () => sessionStorage.getItem("SiteId"), tt = () => sessionStorage.getItem("pubCfg"), et = () => sessionStorage.getItem("envRef"), rt = () => sessionStorage.getItem("orgRef"), be = async (t) => {
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) => {
154
156
  console.log("fetching results");
155
157
  const { serverUrl: e, basePath: r } = st();
156
158
  let o = "";
@@ -161,7 +163,7 @@ const Z = () => sessionStorage.getItem("Host"), R = () => sessionStorage.getItem
161
163
  try {
162
164
  const n = Z();
163
165
  return (await E.get(
164
- `${e}${r}/search-sfcc?baseUrl=${n}&query=${t}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
166
+ `${e}${r}/search-sfcc?baseUrl=${n}&query=${t}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
165
167
  {
166
168
  headers: {
167
169
  "Content-Type": "application/json",
@@ -178,7 +180,7 @@ const Z = () => sessionStorage.getItem("Host"), R = () => sessionStorage.getItem
178
180
  console.log("calling access");
179
181
  const { access_token: n } = await Ot();
180
182
  return console.log(n), (await E.get(
181
- `${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
183
+ `${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
182
184
  {
183
185
  headers: {
184
186
  "Content-Type": "application/json",
@@ -190,13 +192,13 @@ const Z = () => sessionStorage.getItem("Host"), R = () => sessionStorage.getItem
190
192
  if (!t) throw new Error("customerId is required");
191
193
  const e = await qe(), { customer_token: r } = await Me(
192
194
  e
193
- ), { serverUrl: o, basePath: n } = st(), s = (await Ot()).access_token;
195
+ ), { serverUrl: o, basePath: n } = st(), l = (await Ot()).access_token;
194
196
  return (await E.get(
195
- `${o}${n}/get-interest?baseUrl=${Z()}&customerId=${t}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
197
+ `${o}${n}/get-interest?baseUrl=${Z()}&customerId=${t}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
196
198
  {
197
199
  headers: {
198
200
  "Content-Type": "application/json",
199
- Authorization: `Bearer ${s}`
201
+ Authorization: `Bearer ${l}`
200
202
  }
201
203
  }
202
204
  )).data;
@@ -226,23 +228,23 @@ function Cr() {
226
228
  const _r = ({
227
229
  product: t
228
230
  }) => {
229
- const e = Ae(), r = Cr(), [o, n] = P(0), l = () => {
231
+ const e = Ae(), r = Cr(), [o, n] = P(0), s = () => {
230
232
  n(
231
233
  (i) => i + r >= t.length ? 0 : i + r
232
234
  );
233
- }, s = () => {
235
+ }, l = () => {
234
236
  n(
235
237
  (i) => i - r < 0 ? t.length - (t.length % r || r) : i - r
236
238
  );
237
239
  }, d = async (i) => {
238
- const x = await He(i);
239
- e(oe(x));
240
+ const g = await He(i);
241
+ e(oe(g));
240
242
  };
241
243
  return /* @__PURE__ */ a("div", { className: "mt-2 overflow-x-hidden", children: /* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-4 relative", children: [
242
244
  (t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
243
245
  "button",
244
246
  {
245
- onClick: s,
247
+ onClick: l,
246
248
  className: "absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",
247
249
  style: {
248
250
  height: "30px",
@@ -253,7 +255,7 @@ const _r = ({
253
255
  }
254
256
  ),
255
257
  /* @__PURE__ */ a("div", { className: "flex gap-5 justify-center flex-1 overflow-hidden", children: t.slice(o, o + r).map((i) => {
256
- var x, b, C, S;
258
+ var g, w, S, C;
257
259
  return /* @__PURE__ */ u(
258
260
  "div",
259
261
  {
@@ -265,7 +267,7 @@ const _r = ({
265
267
  /* @__PURE__ */ a("div", { className: "w-full p-2 flex items-center justify-center bg-white", children: /* @__PURE__ */ a(
266
268
  "img",
267
269
  {
268
- src: ((x = ye(i)[0]) == null ? void 0 : x.link) || ye(i)[0] || // fallback if it's a string
270
+ src: ((g = ye(i)[0]) == null ? void 0 : g.link) || ye(i)[0] || // fallback if it's a string
269
271
  "https://via.placeholder.com/120",
270
272
  alt: i != null && i.productName ? i.productName : "Product",
271
273
  className: "w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"
@@ -278,7 +280,7 @@ const _r = ({
278
280
  children: [
279
281
  /* @__PURE__ */ u("div", { className: "relative inline-block group", children: [
280
282
  /* @__PURE__ */ a("div", { className: "w-full line-clamp-1 overflow-hidden text-ellipsis text-[#000000] font-medium font-nunitoSans", children: i != null && i.productName ? i.productName : i != null && i.product_name ? i.product_name : ke(
281
- xe((b = i == null ? void 0 : i.name) == null ? void 0 : b["en-US"]),
283
+ xe((w = i == null ? void 0 : i.name) == null ? void 0 : w["en-US"]),
282
284
  60
283
285
  ) || "Product" }),
284
286
  /* @__PURE__ */ a(
@@ -293,7 +295,7 @@ const _r = ({
293
295
  zIndex: 50
294
296
  },
295
297
  children: i != null && i.productName ? i.productName : i != null && i.product_name ? i.product_name : ke(
296
- xe((C = i == null ? void 0 : i.name) == null ? void 0 : C["en-US"]),
298
+ xe((S = i == null ? void 0 : i.name) == null ? void 0 : S["en-US"]),
297
299
  60
298
300
  ) || "Product"
299
301
  }
@@ -302,7 +304,7 @@ const _r = ({
302
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: [
303
305
  /* @__PURE__ */ a("p", { children: kr(
304
306
  i != null && i.price ? Number(i == null ? void 0 : i.price) : ve(i).centAmount || 0,
305
- (S = ve(i)) == null ? void 0 : S.currencyCode
307
+ (C = ve(i)) == null ? void 0 : C.currencyCode
306
308
  ) }),
307
309
  /* @__PURE__ */ u("p", { className: "text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate", children: [
308
310
  "$",
@@ -320,7 +322,7 @@ const _r = ({
320
322
  (t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
321
323
  "button",
322
324
  {
323
- onClick: l,
325
+ onClick: s,
324
326
  className: "absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",
325
327
  style: {
326
328
  height: "30px",
@@ -363,7 +365,7 @@ const _r = ({
363
365
  `, t);
364
366
  try {
365
367
  return (await E.post(
366
- `${n}${o}/basket/create?baseUrl=${Z()}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
368
+ `${n}${o}/basket/create?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
367
369
  e,
368
370
  {
369
371
  headers: {
@@ -372,14 +374,14 @@ const _r = ({
372
374
  }
373
375
  }
374
376
  )).data;
375
- } catch (l) {
376
- return E.isAxiosError(l) ? console.error("Error creating basket:", l.response || l.message) : console.error("Unexpected error:", l), null;
377
+ } catch (s) {
378
+ return E.isAxiosError(s) ? console.error("Error creating basket:", s.response || s.message) : console.error("Unexpected error:", s), null;
377
379
  }
378
380
  }, Vt = async (t, e, r) => {
379
- const { serverUrl: o, basePath: n } = st(), l = `${o}`;
381
+ const { serverUrl: o, basePath: n } = st(), s = `${o}`;
380
382
  try {
381
- const s = await E.post(
382
- `${l}${n}/basket/add-product/${t}?baseUrl=${Z()}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
383
+ const l = await E.post(
384
+ `${s}${n}/basket/add-product/${t}?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
383
385
  e,
384
386
  {
385
387
  headers: {
@@ -388,22 +390,22 @@ const _r = ({
388
390
  }
389
391
  }
390
392
  );
391
- return s.status === 200 && s.data ? s.data : null;
392
- } catch (s) {
393
- return E.isAxiosError(s) ? console.error(
393
+ return l.status === 200 && l.data ? l.data : null;
394
+ } catch (l) {
395
+ return E.isAxiosError(l) ? console.error(
394
396
  "Error adding products to basket:",
395
- s.response || s.message
396
- ) : console.error("Unexpected error:", s), null;
397
+ l.response || l.message
398
+ ) : console.error("Unexpected error:", l), null;
397
399
  }
398
400
  }, Re = async ({
399
401
  basketId: t,
400
402
  customer_token: e
401
403
  }) => {
402
- var l;
404
+ var s;
403
405
  const { serverUrl: r, basePath: o } = st(), n = `${r}`;
404
406
  try {
405
- const s = await E.get(
406
- `${n}${o}/basket/${t}?baseUrl=${Z()}&siteId=${R()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
407
+ const l = await E.get(
408
+ `${n}${o}/basket/${t}?baseUrl=${Z()}&siteId=${q()}&pubCfg=${tt()}&envRef=${et()}&orgRef=${rt()}`,
407
409
  {
408
410
  headers: {
409
411
  "Content-Type": "application/json",
@@ -411,9 +413,9 @@ const _r = ({
411
413
  }
412
414
  }
413
415
  );
414
- return { status: s.status, data: s.data };
415
- } catch (s) {
416
- return E.isAxiosError(s) ? { status: (l = s.response) == null ? void 0 : l.status, data: null } : { status: null, data: null };
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 };
417
419
  }
418
420
  }, Rt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Fr = 300 * 1e3, Ft = "1.0.0";
419
421
  const xt = (t) => {
@@ -434,16 +436,16 @@ const xt = (t) => {
434
436
  console.error("Error storing token:", e);
435
437
  }
436
438
  }, Ce = 300, Nr = () => {
437
- var d, i, x, b, C, S;
439
+ var d, i, g, w, S, C;
438
440
  const t = Ae(), e = Mt((_) => _.product.product), r = Mt((_) => _.store.store), [o, n] = P(!!e);
439
441
  if (bt(() => {
440
442
  n(!!e);
441
443
  }, [e]), !e) return null;
442
- const l = async () => {
443
- var _, j, q, M, lt, vt, Pt, ot, kt, St, ct, $t, zt, Ct, O, dt;
444
+ const s = async () => {
445
+ var _, j, M, H, lt, vt, Pt, ot, kt, St, ct, $t, zt, Ct, O, dt;
444
446
  console.log(e, "the prod");
445
447
  try {
446
- if (!((j = (_ = e == null ? void 0 : e.variants) == null ? void 0 : _[0]) != null && j.product_id) && !(e.type.item || e.type.bundle) && !((M = (q = e == null ? void 0 : e.variants) == null ? void 0 : q[0]) != null && M.productId)) {
448
+ if (!((j = (_ = e == null ? void 0 : e.variants) == null ? void 0 : _[0]) != null && j.product_id) && !(e.type.item || e.type.bundle) && !((H = (M = e == null ? void 0 : e.variants) == null ? void 0 : M[0]) != null && H.productId)) {
447
449
  U.error("Variants not available", {
448
450
  position: "bottom-right",
449
451
  autoClose: 1e3
@@ -459,12 +461,12 @@ const xt = (t) => {
459
461
  console.log(p, "the product data");
460
462
  const _t = JSON.parse(
461
463
  sessionStorage.getItem("customerData") || "{}"
462
- ), nt = (_t == null ? void 0 : _t.basketId) || localStorage.getItem(Rt), Kt = !1, jt = localStorage.getItem(Tt), Y = Date.now();
463
- if (!Kt || !jt || Y >= parseInt(jt)) {
464
+ ), nt = (_t == null ? void 0 : _t.basketId) || localStorage.getItem(Rt), Jt = !1, jt = localStorage.getItem(Tt), Y = Date.now();
465
+ if (!Jt || !jt || Y >= parseInt(jt)) {
464
466
  let $ = "";
465
467
  {
466
- const K = await Ot();
467
- console.log("token from auth data"), $ = "Bearer " + K.access_token;
468
+ const J = await Ot();
469
+ console.log("token from auth data"), $ = "Bearer " + J.access_token;
468
470
  }
469
471
  if (!$) {
470
472
  console.error("Failed to get customer_token");
@@ -472,17 +474,17 @@ const xt = (t) => {
472
474
  }
473
475
  const At = Y + 300 * 1e3;
474
476
  if (Yt($), localStorage.setItem(Tt, At.toString()), nt) {
475
- const K = await Re({
477
+ const J = await Re({
476
478
  basketId: nt,
477
479
  customer_token: $
478
480
  });
479
- if (console.log(nt, "basket id from customer"), K.status === 200 && K) {
480
- const G = await Vt(
481
+ if (console.log(nt, "basket id from customer"), J.status === 200 && J) {
482
+ const W = await Vt(
481
483
  nt,
482
484
  p,
483
485
  $
484
486
  );
485
- (((Pt = G == null ? void 0 : G.product_items) == null ? void 0 : Pt.length) > 0 || ((ot = G == null ? void 0 : G.productItems) == null ? void 0 : ot.length) > 0) && (U.success("Added to cart", {
487
+ (((Pt = W == null ? void 0 : W.product_items) == null ? void 0 : Pt.length) > 0 || ((ot = W == null ? void 0 : W.productItems) == null ? void 0 : ot.length) > 0) && (U.success("Added to cart", {
486
488
  position: "bottom-right",
487
489
  autoClose: 3e3,
488
490
  hideProgressBar: !1,
@@ -493,7 +495,7 @@ const xt = (t) => {
493
495
  return;
494
496
  }
495
497
  }
496
- const Gt = {
498
+ const Wt = {
497
499
  productItems: [
498
500
  {
499
501
  productId: ((kt = e.variants) == null ? void 0 : kt[0].product_id) || ((St = e.variants) == null ? void 0 : St[0].productId) || (e == null ? void 0 : e.id),
@@ -502,7 +504,7 @@ const xt = (t) => {
502
504
  ]
503
505
  };
504
506
  console.log("before create basket");
505
- const h = await Ve($, Gt);
507
+ const h = await Ve($, Wt);
506
508
  if (console.log(
507
509
  h,
508
510
  h == null ? void 0 : h.basket_id,
@@ -518,12 +520,12 @@ const xt = (t) => {
518
520
  ), xt(
519
521
  (h == null ? void 0 : h.basket_id) || (h == null ? void 0 : h.basketId)
520
522
  ), console.log("adding product to basket");
521
- const J = await Vt(
523
+ const K = await Vt(
522
524
  (h == null ? void 0 : h.basket_id) || (h == null ? void 0 : h.basketId),
523
525
  p,
524
526
  $
525
527
  );
526
- console.log("object added to basket"), (((ct = J == null ? void 0 : J.product_items) == null ? void 0 : ct.length) > 0 || (($t = J == null ? void 0 : J.productItems) == null ? void 0 : $t.length) > 0) && U.success("Added to cart", {
528
+ console.log("object added to basket"), (((ct = K == null ? void 0 : K.product_items) == null ? void 0 : ct.length) > 0 || (($t = K == null ? void 0 : K.productItems) == null ? void 0 : $t.length) > 0) && U.success("Added to cart", {
527
529
  position: "bottom-right",
528
530
  autoClose: 3e3,
529
531
  hideProgressBar: !1,
@@ -542,7 +544,7 @@ const xt = (t) => {
542
544
  autoClose: 3e3
543
545
  }));
544
546
  }
545
- }, s = () => {
547
+ }, l = () => {
546
548
  e && (window.location.href = e.c_pdpUrl);
547
549
  };
548
550
  return console.log(e, "the prod"), /* @__PURE__ */ u(re, { children: [
@@ -586,7 +588,7 @@ const xt = (t) => {
586
588
  /* @__PURE__ */ a("div", { className: "flex flex-row items-center justify-center w-[120px] h-[120px] my-5", children: /* @__PURE__ */ a(
587
589
  "img",
588
590
  {
589
- src: (b = (x = (i = (d = e.imageGroups) == null ? void 0 : d[0]) == null ? void 0 : i.images) == null ? void 0 : x[0]) == null ? void 0 : b.link,
591
+ src: (w = (g = (i = (d = e.imageGroups) == null ? void 0 : d[0]) == null ? void 0 : i.images) == null ? void 0 : g[0]) == null ? void 0 : w.link,
590
592
  alt: e.name,
591
593
  className: "rounded-[10px]"
592
594
  }
@@ -635,19 +637,19 @@ const xt = (t) => {
635
637
  /* @__PURE__ */ u("div", { className: "mt-4 flex flex-col gap-2 w-full p-2", children: [
636
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: [
637
639
  /* @__PURE__ */ u("div", { className: "text-[#323135] font-bold", children: [
638
- ((C = e == null ? void 0 : e.rating) == null ? void 0 : C.rate) || 0,
640
+ ((S = e == null ? void 0 : e.rating) == null ? void 0 : S.rate) || 0,
639
641
  " /",
640
642
  " ",
641
643
  /* @__PURE__ */ a("span", { className: "text-[#68656E]", children: "5" })
642
644
  ] }),
643
645
  /* @__PURE__ */ a("div", { className: "text-[#323135] font-semibold text-sm", children: "Overall Rating" }),
644
646
  /* @__PURE__ */ u("div", { className: "text-[#68656E] font-semibold text-sm", children: [
645
- ((S = e == null ? void 0 : e.rating) == null ? void 0 : S.count) || 0,
647
+ ((C = e == null ? void 0 : e.rating) == null ? void 0 : C.count) || 0,
646
648
  " ratings"
647
649
  ] })
648
650
  ] }) }),
649
651
  /* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((_, j) => {
650
- var q;
652
+ var M;
651
653
  return /* @__PURE__ */ a(
652
654
  ge,
653
655
  {
@@ -655,7 +657,7 @@ const xt = (t) => {
655
657
  width: "20",
656
658
  height: "20",
657
659
  className: `text-yellow-500
658
- ${((q = e == null ? void 0 : e.rating) == null ? void 0 : q.rate) > j ? "text-yellow-500" : "text-gray-300"}
660
+ ${((M = e == null ? void 0 : e.rating) == null ? void 0 : M.rate) > j ? "text-yellow-500" : "text-gray-300"}
659
661
  `
660
662
  },
661
663
  j
@@ -673,7 +675,7 @@ const xt = (t) => {
673
675
  {
674
676
  className: "rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer",
675
677
  style: { backgroundColor: r.tanyaThemeColor },
676
- onClick: l,
678
+ onClick: s,
677
679
  children: "Add to Cart"
678
680
  }
679
681
  ),
@@ -682,7 +684,7 @@ const xt = (t) => {
682
684
  {
683
685
  className: "rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer mb-16",
684
686
  style: { backgroundColor: r.tanyaThemeColor },
685
- onClick: s,
687
+ onClick: l,
686
688
  children: "View more"
687
689
  }
688
690
  )
@@ -710,19 +712,19 @@ const xt = (t) => {
710
712
  "Niece/Nephew": "his/her niece/nephew",
711
713
  "My Friends": "his/her friends",
712
714
  Others: "others"
713
- }, o = It(null), n = It(null), l = It(null), s = It(null), [d, i] = P(null), [x, b] = P(!1), [C, S] = P(!1), [_, j] = P(!1), [q, M] = P(!1), [lt, vt] = P(!1), [Pt, ot] = P(!1), [kt, St] = P(""), [ct, $t] = P(""), zt = (c) => ({
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) => ({
714
716
  id: c.id,
715
717
  title: c.name,
716
718
  image: c.image ?? "",
717
719
  price: c.price ?? 0
718
720
  }), [Ct, O] = P([]), dt = It(null), p = Mt((c) => c.store.store), _t = Mt((c) => c.product.product), nt = () => {
719
- j(!0), setTimeout(() => S(!0), 10);
720
- }, Kt = () => {
721
- S(!1), setTimeout(() => j(!1), 300);
721
+ j(!0), setTimeout(() => C(!0), 10);
722
+ }, Jt = () => {
723
+ C(!1), setTimeout(() => j(!1), 300);
722
724
  };
723
725
  bt(() => {
724
- x ? nt() : Kt();
725
- }, [x]);
726
+ g ? nt() : Jt();
727
+ }, [g]);
726
728
  const jt = (c) => {
727
729
  $t(r[c]);
728
730
  };
@@ -739,54 +741,54 @@ const xt = (t) => {
739
741
  client_id: "4i8rd70sgt961tc4dhskgf08c",
740
742
  client_secret: "bnsfq1220loh2cn2cm2ttn8fdhdpt0u8m1fgj8vfk2rn61aurjg",
741
743
  scope: "default-m2m-resource-server-8xzfzo/read"
742
- }), w = await fetch(c, {
744
+ }), b = await fetch(c, {
743
745
  method: "POST",
744
746
  headers: {
745
747
  "Content-Type": "application/x-www-form-urlencoded"
746
748
  },
747
749
  body: k
748
750
  });
749
- if (!w.ok)
751
+ if (!b.ok)
750
752
  throw new Error(
751
- `Token request failed! status: ${w.status}`
753
+ `Token request failed! status: ${b.status}`
752
754
  );
753
- const y = await w.json();
755
+ const y = await b.json();
754
756
  Y = y.access_token;
755
757
  const f = y.expires_in || 3600;
756
758
  return $ = Date.now() + (f - 60) * 1e3, Y;
757
759
  } catch (c) {
758
760
  return console.error("Error obtaining JWT token:", c), Y = null, $ = null, null;
759
761
  }
760
- }, Gt = async () => {
762
+ }, Wt = async () => {
761
763
  const c = await Ot();
762
764
  c != null && i(c);
763
765
  };
764
766
  bt(() => {
765
767
  if (t != null && t.siteId) {
766
- const { clientID: c, host: k, organizationID: w, shortCode: y, siteId: f } = t;
767
- sessionStorage.setItem("Host", k), sessionStorage.setItem("SiteId", f), sessionStorage.setItem("pubCfg", btoa(c)), sessionStorage.setItem("envRef", y), sessionStorage.setItem("orgRef", w);
768
+ const { clientID: c, host: k, organizationID: b, shortCode: y, siteId: f } = t;
769
+ sessionStorage.setItem("Host", k), sessionStorage.setItem("SiteId", f), sessionStorage.setItem("pubCfg", btoa(c)), sessionStorage.setItem("envRef", y), sessionStorage.setItem("orgRef", b);
768
770
  }
769
- Gt(), console.log("scapi environment v1");
771
+ Wt(), console.log("scapi environment v1");
770
772
  }, []);
771
773
  const h = async () => {
772
774
  const c = JSON.parse(
773
775
  sessionStorage.getItem("customerData") || "{}"
774
776
  ).customerId;
775
777
  return (await vr(c || "")).c_interests;
776
- }, J = async (c, k) => {
778
+ }, K = async (c, k) => {
777
779
  console.log("in secondary flow", Ft);
778
- const w = await h();
779
- if (console.log(w, "interests of customer", Ft), !!w)
780
+ const b = await h();
781
+ if (console.log(b, "interests of customer", Ft), !!b)
780
782
  try {
781
783
  O(
782
784
  (L) => L.map(
783
- (H, V) => V === L.length - 1 ? { ...H, secondaryLoading: !0 } : H
785
+ (V, R) => R === L.length - 1 ? { ...V, secondaryLoading: !0 } : V
784
786
  )
785
787
  );
786
788
  const y = await At();
787
789
  if (!y) throw new Error("Failed to fetch token");
788
- const f = localStorage.getItem("customerNumber"), g = localStorage.getItem("isLoggedIn"), ut = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
789
- registered: String(g || !1),
790
+ const f = localStorage.getItem("customerNumber"), x = localStorage.getItem("isLoggedIn"), ut = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
791
+ registered: String(x || !1),
790
792
  userId: String(f || (/* @__PURE__ */ new Date()).getTime())
791
793
  }).toString()}`, pt = JSON.stringify({
792
794
  flowId: "Q166PR519W",
@@ -795,7 +797,7 @@ const xt = (t) => {
795
797
  loyaltyPoints: "",
796
798
  productName: c,
797
799
  productPoints: String(k || 0),
798
- interests: w
800
+ interests: b
799
801
  }
800
802
  }), A = await fetch(ut, {
801
803
  signal: AbortSignal.timeout(3e4),
@@ -810,15 +812,15 @@ const xt = (t) => {
810
812
  const ft = A.body.getReader(), mt = new TextDecoder();
811
813
  let D = "";
812
814
  for (; ; ) {
813
- const { done: L, value: H } = await ft.read();
815
+ const { done: L, value: V } = await ft.read();
814
816
  if (L) break;
815
- D += mt.decode(H, { stream: !0 });
816
- const V = D.split(`
817
+ D += mt.decode(V, { stream: !0 });
818
+ const R = D.split(`
817
819
  `);
818
- D = V.pop() || "";
819
- for (const W of V)
820
- if (W.startsWith("data:")) {
821
- const m = W.slice(5).trim();
820
+ D = R.pop() || "";
821
+ for (const G of R)
822
+ if (G.startsWith("data:")) {
823
+ const m = G.slice(5).trim();
822
824
  try {
823
825
  const B = JSON.parse(m);
824
826
  B.index === 0 && O(
@@ -842,11 +844,11 @@ const xt = (t) => {
842
844
  } catch (y) {
843
845
  console.error("Secondary flow error:", y);
844
846
  }
845
- }, K = async (c) => {
847
+ }, J = async (c) => {
846
848
  const k = c || kt.trim();
847
849
  if (k) {
848
- vt(!0), St(""), o.current = null, n.current = null, l.current = null, s.current = null, O((w) => [
849
- ...w,
850
+ vt(!0), St(""), o.current = null, n.current = null, s.current = null, l.current = null, O((b) => [
851
+ ...b,
850
852
  {
851
853
  query: k,
852
854
  response: "Thinking for what suits you best...",
@@ -856,8 +858,8 @@ const xt = (t) => {
856
858
  }
857
859
  ]);
858
860
  try {
859
- const w = ct, y = localStorage.getItem("customerNumber"), f = localStorage.getItem("isLoggedIn"), g = await At();
860
- if (!g)
861
+ const b = ct, y = localStorage.getItem("customerNumber"), f = localStorage.getItem("isLoggedIn"), x = await At();
862
+ if (!x)
861
863
  throw new Error("Failed to obtain access token");
862
864
  const ut = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
863
865
  registered: String(f || !1),
@@ -867,14 +869,14 @@ const xt = (t) => {
867
869
  flowAliasId: "SZF9ZK1ATE",
868
870
  input: {
869
871
  userPrompt: k,
870
- whom: w
872
+ whom: b
871
873
  }
872
874
  }), A = await fetch(ut, {
873
875
  signal: AbortSignal.timeout(3e4),
874
876
  method: "POST",
875
877
  headers: {
876
878
  "Content-Type": "application/json",
877
- Authorization: `Bearer ${g}`
879
+ Authorization: `Bearer ${x}`
878
880
  },
879
881
  body: pt
880
882
  });
@@ -885,13 +887,13 @@ const xt = (t) => {
885
887
  let D = "", L = "";
886
888
  for (; ; ) {
887
889
  ot(!0);
888
- const { done: H, value: V } = await ft.read();
889
- if (H) break;
890
- D += mt.decode(V, { stream: !0 });
891
- const W = D.split(`
890
+ const { done: V, value: R } = await ft.read();
891
+ if (V) break;
892
+ D += mt.decode(R, { stream: !0 });
893
+ const G = D.split(`
892
894
  `);
893
- D = W.pop() || "";
894
- for (const m of W)
895
+ D = G.pop() || "";
896
+ for (const m of G)
895
897
  if (m.startsWith("data:")) {
896
898
  const B = m.slice(5).trim();
897
899
  try {
@@ -909,14 +911,14 @@ const xt = (t) => {
909
911
  }
910
912
  }
911
913
  }
912
- er(G(L));
913
- } catch (w) {
914
- console.error("Error sending message to Tanya:", w);
914
+ er(W(L));
915
+ } catch (b) {
916
+ console.error("Error sending message to Tanya:", b);
915
917
  } finally {
916
918
  vt(!1);
917
919
  }
918
920
  }
919
- }, G = (c) => {
921
+ }, W = (c) => {
920
922
  const k = c.match(
921
923
  /top five relevant product or category names are: (.*)/i
922
924
  ), f = (k ? k[1] : c).split(", ").map((z) => z.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi, "").trim());
@@ -925,35 +927,35 @@ const xt = (t) => {
925
927
  if (typeof c == "string") {
926
928
  console.log(c, "keywords");
927
929
  const k = c.split(",");
928
- for (const w of k) {
929
- const y = await be(w);
930
+ for (const b of k) {
931
+ const y = await be(b);
930
932
  if (ot(!1), (y == null ? void 0 : y.length) > 0 && (O(
931
933
  (f) => f.map(
932
- (g, z) => z === f.length - 1 ? {
933
- ...g,
934
+ (x, z) => z === f.length - 1 ? {
935
+ ...x,
934
936
  products: [
935
- ...g.products || [],
936
- { keyword: w, items: y, loading: !1 }
937
+ ...x.products || [],
938
+ { keyword: b, items: y, loading: !1 }
937
939
  ]
938
- } : g
940
+ } : x
939
941
  )
940
942
  ), !o.current || n.current == null)) {
941
943
  const f = y[0];
942
- o.current = String((f == null ? void 0 : f.product_name) ?? ""), l.current = f.image.link, n.current = f.product_id;
943
- const g = typeof (f == null ? void 0 : f.price) == "number" ? f.price : void 0;
944
- s.current = typeof g == "number" && Number.isFinite(g) ? g : null;
944
+ o.current = String((f == null ? void 0 : f.product_name) ?? ""), s.current = f.image.link, n.current = f.product_id;
945
+ const x = typeof (f == null ? void 0 : f.price) == "number" ? f.price : void 0;
946
+ l.current = typeof x == "number" && Number.isFinite(x) ? x : null;
945
947
  }
946
948
  }
947
949
  } else
948
950
  for (const k of c) {
949
- const w = await be(k);
950
- ot(!1), (w == null ? void 0 : w.length) > 0 && O(
951
+ const b = await be(k);
952
+ ot(!1), (b == null ? void 0 : b.length) > 0 && O(
951
953
  (y) => y.map(
952
- (f, g) => g === y.length - 1 ? {
954
+ (f, x) => x === y.length - 1 ? {
953
955
  ...f,
954
956
  products: [
955
957
  ...f.products || [],
956
- { keyword: k, items: w, loading: !1 }
958
+ { keyword: k, items: b, loading: !1 }
957
959
  ]
958
960
  } : f
959
961
  )
@@ -961,14 +963,14 @@ const xt = (t) => {
961
963
  }
962
964
  if (o.current) {
963
965
  O(
964
- (w) => w.map(
965
- (y, f) => f === w.length - 1 ? {
966
+ (b) => b.map(
967
+ (y, f) => f === b.length - 1 ? {
966
968
  ...y,
967
969
  productSnapshot: {
968
970
  id: n.current,
969
971
  name: o.current,
970
- image: l.current,
971
- price: s.current ?? null,
972
+ image: s.current,
973
+ price: l.current ?? null,
972
974
  points: 0,
973
975
  quantity: 1
974
976
  }
@@ -978,16 +980,16 @@ const xt = (t) => {
978
980
  const k = JSON.parse(
979
981
  sessionStorage.getItem("customerData") || "{}"
980
982
  );
981
- (k == null ? void 0 : k.isGuest) == !1 ? (console.log("running secondary flow", Ft), J(o.current, 0)) : console.log("not running secondary flow", Ft);
983
+ (k == null ? void 0 : k.isGuest) == !1 ? (console.log("running secondary flow", Ft), K(o.current, 0)) : console.log("not running secondary flow", Ft);
982
984
  }
983
985
  ot(!1);
984
986
  }, rr = async (c, k) => {
985
- var w, y, f, g, z, ut, pt, A, ft, mt, D, L, H, V, W;
986
- M(!0);
987
+ var b, y, f, x, z, ut, pt, A, ft, mt, D, L, V, R, G;
988
+ H(!0);
987
989
  try {
988
990
  const m = await He(c.id);
989
- if (!((y = (w = m == null ? void 0 : m.variants) == null ? void 0 : w[0]) != null && y.product_id || (g = (f = m == null ? void 0 : m.variants) == null ? void 0 : f[0]) != null && g.productId) && !(m.type.item || m.type.bundle)) {
990
- M(!1), U.error("Variants not found", {
991
+ if (!((y = (b = m == null ? void 0 : m.variants) == null ? void 0 : b[0]) != null && y.product_id || (x = (f = m == null ? void 0 : m.variants) == null ? void 0 : f[0]) != null && x.productId) && !(m.type.item || m.type.bundle)) {
992
+ H(!1), U.error("Variants not found", {
991
993
  position: "bottom-right",
992
994
  autoClose: 1e3
993
995
  }), console.error("No product variant found");
@@ -1019,19 +1021,19 @@ const xt = (t) => {
1019
1021
  customer_token: at
1020
1022
  });
1021
1023
  if (we.status === 200 && we) {
1022
- const Wt = await Vt(
1024
+ const Gt = await Vt(
1023
1025
  T,
1024
1026
  B,
1025
1027
  at
1026
1028
  );
1027
- ((pt = Wt == null ? void 0 : Wt.product_items) == null ? void 0 : pt.length) > 0 && (U.success("Added to cart", {
1029
+ ((pt = Gt == null ? void 0 : Gt.product_items) == null ? void 0 : pt.length) > 0 && (U.success("Added to cart", {
1028
1030
  position: "bottom-right",
1029
1031
  autoClose: 3e3,
1030
1032
  hideProgressBar: !1,
1031
1033
  closeOnClick: !0,
1032
1034
  pauseOnHover: !0,
1033
1035
  draggable: !0
1034
- }), Ht(T), M(!1));
1036
+ }), Ht(T), H(!1));
1035
1037
  return;
1036
1038
  }
1037
1039
  }
@@ -1049,7 +1051,7 @@ const xt = (t) => {
1049
1051
  v == null ? void 0 : v.basketId,
1050
1052
  "the basket response"
1051
1053
  ), !(v != null && v.basket_id || !(v != null && v.basketId))) {
1052
- M(!1), console.error("Failed to create basket");
1054
+ H(!1), console.error("Failed to create basket");
1053
1055
  return;
1054
1056
  }
1055
1057
  xt(
@@ -1070,22 +1072,22 @@ const xt = (t) => {
1070
1072
  }), Ht(v.basket_id || (v == null ? void 0 : v.basketId));
1071
1073
  }
1072
1074
  } catch (m) {
1073
- M(!1), console.error("Error adding to cart:", m), U.error("Failed to add product to cart", {
1075
+ H(!1), console.error("Error adding to cart:", m), U.error("Failed to add product to cart", {
1074
1076
  position: "bottom-right",
1075
1077
  autoClose: 3e3
1076
1078
  }), ((L = m == null ? void 0 : m.response) == null ? void 0 : L.status) === 404 || // Basket not found
1077
- ((H = m == null ? void 0 : m.response) == null ? void 0 : H.status) === 401 ? (((V = m == null ? void 0 : m.response) == null ? void 0 : V.status) === 404 && xt(null), ((W = m == null ? void 0 : m.response) == null ? void 0 : W.status) === 401 && (xt(null), Yt(null))) : (console.error("Failed to add product to basket:", m.message), U.error("Failed to add product to cart", {
1079
+ ((V = m == null ? void 0 : m.response) == null ? void 0 : V.status) === 401 ? (((R = m == null ? void 0 : m.response) == null ? void 0 : R.status) === 404 && xt(null), ((G = m == null ? void 0 : m.response) == null ? void 0 : G.status) === 401 && (xt(null), Yt(null))) : (console.error("Failed to add product to basket:", m.message), U.error("Failed to add product to cart", {
1078
1080
  position: "bottom-right",
1079
1081
  autoClose: 3e3
1080
1082
  }));
1081
1083
  }
1082
- M(!1);
1084
+ H(!1);
1083
1085
  };
1084
- return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(xr, { open: x, onOpenChange: b, children: [
1086
+ return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(xr, { open: g, onOpenChange: w, children: [
1085
1087
  /* @__PURE__ */ a(
1086
1088
  yr,
1087
1089
  {
1088
- onClick: () => b(!0),
1090
+ onClick: () => w(!0),
1089
1091
  style: {
1090
1092
  // background: storeDetails.tanyaThemeColor,
1091
1093
  },
@@ -1150,7 +1152,7 @@ const xt = (t) => {
1150
1152
  "div",
1151
1153
  {
1152
1154
  className: "fixed inset-0 z-40 bg-black/30",
1153
- onClick: () => b(!1)
1155
+ onClick: () => w(!1)
1154
1156
  }
1155
1157
  ),
1156
1158
  /* @__PURE__ */ u(
@@ -1161,9 +1163,9 @@ const xt = (t) => {
1161
1163
  top-0 right-0
1162
1164
  transition-transform duration-300 ease-in-out
1163
1165
  lg:transform
1164
- ${C ? "lg:translate-x-0" : "lg:translate-x-full"}
1166
+ ${S ? "lg:translate-x-0" : "lg:translate-x-full"}
1165
1167
  // For mobile: animate from bottom
1166
- ${C ? "translate-y-0" : "translate-y-full"}
1168
+ ${S ? "translate-y-0" : "translate-y-full"}
1167
1169
  lg:translate-y-0
1168
1170
  `,
1169
1171
  style: {
@@ -1241,7 +1243,7 @@ const xt = (t) => {
1241
1243
  gap: "1.25rem",
1242
1244
  margin: "0.75rem"
1243
1245
  },
1244
- children: /* @__PURE__ */ a("button", { onClick: () => b(!1), children: /* @__PURE__ */ u(
1246
+ children: /* @__PURE__ */ a("button", { onClick: () => w(!1), children: /* @__PURE__ */ u(
1245
1247
  "svg",
1246
1248
  {
1247
1249
  width: "24",
@@ -1324,7 +1326,7 @@ const xt = (t) => {
1324
1326
  }
1325
1327
  ),
1326
1328
  Ct.map((c, k) => {
1327
- var w, y;
1329
+ var b, y;
1328
1330
  return /* @__PURE__ */ u("div", { children: [
1329
1331
  /* @__PURE__ */ a("div", { className: "flex justify-end", children: /* @__PURE__ */ a("p", { className: "text-sm font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children: c.query }) }),
1330
1332
  c.response && c.response.includes("Thinking") ? /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
@@ -1344,7 +1346,7 @@ const xt = (t) => {
1344
1346
  }
1345
1347
  }
1346
1348
  ) }),
1347
- Pt && !c.response.includes("Thinking") && ((w = c.products) == null ? void 0 : w.length) == 0 && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-sm animate-pulse font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children: "Finding best products for you" }) }),
1349
+ Pt && !c.response.includes("Thinking") && ((b = c.products) == null ? void 0 : b.length) == 0 && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-sm animate-pulse font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children: "Finding best products for you" }) }),
1348
1350
  (c == null ? void 0 : c.products) && ((y = c == null ? void 0 : c.products) == null ? void 0 : y.length) > 0 && /* @__PURE__ */ a(
1349
1351
  Ir,
1350
1352
  {
@@ -1361,17 +1363,17 @@ const xt = (t) => {
1361
1363
  children: "Why not explore these inquiries..."
1362
1364
  }
1363
1365
  ),
1364
- c.potentialQuestions.split(",").map((f, g) => /* @__PURE__ */ a(
1366
+ c.potentialQuestions.split(",").map((f, x) => /* @__PURE__ */ a(
1365
1367
  "button",
1366
1368
  {
1367
1369
  className: `cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${p.themeDarkColor} m-1 rounded-xl px-2 py-1`,
1368
- onClick: () => K(f),
1370
+ onClick: () => J(f),
1369
1371
  style: {
1370
1372
  backgroundColor: p.tanyaThemeColorLight
1371
1373
  },
1372
1374
  children: f
1373
1375
  },
1374
- g
1376
+ x
1375
1377
  ))
1376
1378
  ] }),
1377
1379
  c.secondaryLoading && /* @__PURE__ */ a("div", { className: "mt-3 mb-4 px-4", children: /* @__PURE__ */ u(
@@ -1477,16 +1479,16 @@ const xt = (t) => {
1477
1479
  className: "px-3 py-1 text-sm",
1478
1480
  onClick: () => O(
1479
1481
  (f) => f.map(
1480
- (g, z) => z === k && g.productSnapshot ? {
1481
- ...g,
1482
+ (x, z) => z === k && x.productSnapshot ? {
1483
+ ...x,
1482
1484
  productSnapshot: {
1483
- ...g.productSnapshot,
1485
+ ...x.productSnapshot,
1484
1486
  quantity: Math.max(
1485
1487
  1,
1486
- g.productSnapshot.quantity - 1
1488
+ x.productSnapshot.quantity - 1
1487
1489
  )
1488
1490
  }
1489
- } : g
1491
+ } : x
1490
1492
  )
1491
1493
  ),
1492
1494
  style: {
@@ -1503,13 +1505,13 @@ const xt = (t) => {
1503
1505
  className: "px-3 py-1 text-sm",
1504
1506
  onClick: () => O(
1505
1507
  (f) => f.map(
1506
- (g, z) => z === k && g.productSnapshot ? {
1507
- ...g,
1508
+ (x, z) => z === k && x.productSnapshot ? {
1509
+ ...x,
1508
1510
  productSnapshot: {
1509
- ...g.productSnapshot,
1510
- quantity: g.productSnapshot.quantity + 1
1511
+ ...x.productSnapshot,
1512
+ quantity: x.productSnapshot.quantity + 1
1511
1513
  }
1512
- } : g
1514
+ } : x
1513
1515
  )
1514
1516
  ),
1515
1517
  style: {
@@ -1531,14 +1533,14 @@ const xt = (t) => {
1531
1533
  c.productSnapshot.quantity
1532
1534
  );
1533
1535
  },
1534
- disabled: q,
1536
+ disabled: M,
1535
1537
  className: "px-4 py-2 rounded-full font-medium",
1536
1538
  style: {
1537
1539
  background: p.tanyaThemeColor,
1538
1540
  color: (p == null ? void 0 : p.tanyaThemeContrastColor) || "#fff",
1539
- opacity: q ? 0.8 : 1
1541
+ opacity: M ? 0.8 : 1
1540
1542
  },
1541
- children: q ? "Adding..." : "Add to cart"
1543
+ children: M ? "Adding..." : "Add to cart"
1542
1544
  }
1543
1545
  )
1544
1546
  ] })
@@ -1570,7 +1572,7 @@ const xt = (t) => {
1570
1572
  autoFocus: !0,
1571
1573
  onChange: (c) => St(c.target.value),
1572
1574
  onKeyDown: (c) => {
1573
- c.key === "Enter" && !lt && K();
1575
+ c.key === "Enter" && !lt && J();
1574
1576
  }
1575
1577
  }
1576
1578
  ),
@@ -1580,7 +1582,7 @@ const xt = (t) => {
1580
1582
  type: "submit",
1581
1583
  disabled: lt,
1582
1584
  className: "p-3",
1583
- onClick: () => K(),
1585
+ onClick: () => J(),
1584
1586
  children: lt ? /* @__PURE__ */ a(
1585
1587
  "div",
1586
1588
  {
@@ -1643,7 +1645,7 @@ var Q = function() {
1643
1645
  return Q = Object.assign || function(e) {
1644
1646
  for (var r, o = 1, n = arguments.length; o < n; o++) {
1645
1647
  r = arguments[o];
1646
- for (var l in r) Object.prototype.hasOwnProperty.call(r, l) && (e[l] = r[l]);
1648
+ for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
1647
1649
  }
1648
1650
  return e;
1649
1651
  }, Q.apply(this, arguments);
@@ -1674,10 +1676,10 @@ function it(t, e) {
1674
1676
  if (!t)
1675
1677
  throw new Ye(e);
1676
1678
  }
1677
- var Je = ["debug", "log", "warn", "error", "silent"], $r = Je.indexOf("log");
1679
+ var Ke = ["debug", "log", "warn", "error", "silent"], $r = Ke.indexOf("log");
1678
1680
  function Lt(t) {
1679
1681
  return function() {
1680
- if (Je.indexOf(t) >= $r) {
1682
+ if (Ke.indexOf(t) >= $r) {
1681
1683
  var e = console[t] || console.log;
1682
1684
  return e.apply(console, arguments);
1683
1685
  }
@@ -1686,7 +1688,7 @@ function Lt(t) {
1686
1688
  (function(t) {
1687
1689
  t.debug = Lt("debug"), t.log = Lt("log"), t.warn = Lt("warn"), t.error = Lt("error");
1688
1690
  })(it || (it = {}));
1689
- var Ke = "3.14.0";
1691
+ var Je = "3.14.0";
1690
1692
  function wt(t) {
1691
1693
  try {
1692
1694
  return t();
@@ -1742,13 +1744,13 @@ var Zt = Object.assign(function(e, r) {
1742
1744
  warn: Bt(it.warn),
1743
1745
  error: Bt(it.error)
1744
1746
  });
1745
- function Ge(t) {
1747
+ function We(t) {
1746
1748
  for (var e = [], r = 1; r < arguments.length; r++)
1747
1749
  e[r - 1] = arguments[r];
1748
1750
  return new Ye(le(t, e) || ce(t, e));
1749
1751
  }
1750
- var Fe = Symbol.for("ApolloErrorMessageHandler_" + Ke);
1751
- function We(t) {
1752
+ var Fe = Symbol.for("ApolloErrorMessageHandler_" + Je);
1753
+ function Ge(t) {
1752
1754
  if (typeof t == "string")
1753
1755
  return t;
1754
1756
  try {
@@ -1759,14 +1761,14 @@ function We(t) {
1759
1761
  }
1760
1762
  function le(t, e) {
1761
1763
  if (e === void 0 && (e = []), !!t)
1762
- return ae[Fe] && ae[Fe](t, e.map(We));
1764
+ return ae[Fe] && ae[Fe](t, e.map(Ge));
1763
1765
  }
1764
1766
  function ce(t, e) {
1765
1767
  if (e === void 0 && (e = []), !!t)
1766
1768
  return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({
1767
- version: Ke,
1769
+ version: Je,
1768
1770
  message: t,
1769
- args: e.map(We)
1771
+ args: e.map(Ge)
1770
1772
  })));
1771
1773
  }
1772
1774
  function Ar(t) {
@@ -1803,15 +1805,15 @@ const Lr = () => class {
1803
1805
  return F.slots[this.id];
1804
1806
  }
1805
1807
  withValue(e, r, o, n) {
1806
- const l = {
1808
+ const s = {
1807
1809
  __proto__: null,
1808
1810
  [this.id]: e
1809
- }, s = F;
1810
- F = { parent: s, slots: l };
1811
+ }, l = F;
1812
+ F = { parent: l, slots: s };
1811
1813
  try {
1812
1814
  return r.apply(n, o);
1813
1815
  } finally {
1814
- F = s;
1816
+ F = l;
1815
1817
  }
1816
1818
  }
1817
1819
  // Capture the current context and wrap a callback function so that it
@@ -1922,7 +1924,7 @@ var pe = function() {
1922
1924
  };
1923
1925
  pe() && !fe("observable") && (Symbol.observable = Symbol("observable"));
1924
1926
  var Mr = me("iterator"), ie = me("observable"), Xe = me("species");
1925
- function Jt(t, e) {
1927
+ function Kt(t, e) {
1926
1928
  var r = t[e];
1927
1929
  if (r != null) {
1928
1930
  if (typeof r != "function") throw new TypeError(r + " is not a function");
@@ -1957,7 +1959,7 @@ function Qe(t) {
1957
1959
  if (typeof e == "function")
1958
1960
  e();
1959
1961
  else {
1960
- var r = Jt(e, "unsubscribe");
1962
+ var r = Kt(e, "unsubscribe");
1961
1963
  r && r.call(e);
1962
1964
  }
1963
1965
  } catch (o) {
@@ -1979,7 +1981,7 @@ function Ze(t, e, r) {
1979
1981
  t._state = "running";
1980
1982
  var o = t._observer;
1981
1983
  try {
1982
- var n = Jt(o, e);
1984
+ var n = Kt(o, e);
1983
1985
  switch (e) {
1984
1986
  case "next":
1985
1987
  n && n.call(o, r);
@@ -1992,8 +1994,8 @@ function Ze(t, e, r) {
1992
1994
  se(t), n && n.call(o);
1993
1995
  break;
1994
1996
  }
1995
- } catch (l) {
1996
- yt(l);
1997
+ } catch (s) {
1998
+ yt(s);
1997
1999
  }
1998
2000
  t._state === "closed" ? Qe(t) : t._state === "running" && (t._state = "ready");
1999
2001
  }
@@ -2024,8 +2026,8 @@ var Rr = /* @__PURE__ */ (function() {
2024
2026
  var n = new Yr(this);
2025
2027
  try {
2026
2028
  this._cleanup = o.call(void 0, n);
2027
- } catch (l) {
2028
- n.error(l);
2029
+ } catch (s) {
2030
+ n.error(s);
2029
2031
  }
2030
2032
  this._state === "initializing" && (this._state = "ready");
2031
2033
  }
@@ -2070,104 +2072,104 @@ var Rr = /* @__PURE__ */ (function() {
2070
2072
  }), new Rr(o, this._subscriber);
2071
2073
  }, e.forEach = function(o) {
2072
2074
  var n = this;
2073
- return new Promise(function(l, s) {
2075
+ return new Promise(function(s, l) {
2074
2076
  if (typeof o != "function") {
2075
- s(new TypeError(o + " is not a function"));
2077
+ l(new TypeError(o + " is not a function"));
2076
2078
  return;
2077
2079
  }
2078
2080
  function d() {
2079
- i.unsubscribe(), l();
2081
+ i.unsubscribe(), s();
2080
2082
  }
2081
2083
  var i = n.subscribe({
2082
- next: function(x) {
2084
+ next: function(g) {
2083
2085
  try {
2084
- o(x, d);
2085
- } catch (b) {
2086
- s(b), i.unsubscribe();
2086
+ o(g, d);
2087
+ } catch (w) {
2088
+ l(w), i.unsubscribe();
2087
2089
  }
2088
2090
  },
2089
- error: s,
2090
- complete: l
2091
+ error: l,
2092
+ complete: s
2091
2093
  });
2092
2094
  });
2093
2095
  }, e.map = function(o) {
2094
2096
  var n = this;
2095
2097
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2096
- var l = Nt(this);
2097
- return new l(function(s) {
2098
+ var s = Nt(this);
2099
+ return new s(function(l) {
2098
2100
  return n.subscribe({
2099
2101
  next: function(d) {
2100
2102
  try {
2101
2103
  d = o(d);
2102
2104
  } catch (i) {
2103
- return s.error(i);
2105
+ return l.error(i);
2104
2106
  }
2105
- s.next(d);
2107
+ l.next(d);
2106
2108
  },
2107
2109
  error: function(d) {
2108
- s.error(d);
2110
+ l.error(d);
2109
2111
  },
2110
2112
  complete: function() {
2111
- s.complete();
2113
+ l.complete();
2112
2114
  }
2113
2115
  });
2114
2116
  });
2115
2117
  }, e.filter = function(o) {
2116
2118
  var n = this;
2117
2119
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2118
- var l = Nt(this);
2119
- return new l(function(s) {
2120
+ var s = Nt(this);
2121
+ return new s(function(l) {
2120
2122
  return n.subscribe({
2121
2123
  next: function(d) {
2122
2124
  try {
2123
2125
  if (!o(d)) return;
2124
2126
  } catch (i) {
2125
- return s.error(i);
2127
+ return l.error(i);
2126
2128
  }
2127
- s.next(d);
2129
+ l.next(d);
2128
2130
  },
2129
2131
  error: function(d) {
2130
- s.error(d);
2132
+ l.error(d);
2131
2133
  },
2132
2134
  complete: function() {
2133
- s.complete();
2135
+ l.complete();
2134
2136
  }
2135
2137
  });
2136
2138
  });
2137
2139
  }, e.reduce = function(o) {
2138
2140
  var n = this;
2139
2141
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2140
- var l = Nt(this), s = arguments.length > 1, d = !1, i = arguments[1], x = i;
2141
- return new l(function(b) {
2142
+ var s = Nt(this), l = arguments.length > 1, d = !1, i = arguments[1], g = i;
2143
+ return new s(function(w) {
2142
2144
  return n.subscribe({
2143
- next: function(C) {
2144
- var S = !d;
2145
- if (d = !0, !S || s)
2145
+ next: function(S) {
2146
+ var C = !d;
2147
+ if (d = !0, !C || l)
2146
2148
  try {
2147
- x = o(x, C);
2149
+ g = o(g, S);
2148
2150
  } catch (_) {
2149
- return b.error(_);
2151
+ return w.error(_);
2150
2152
  }
2151
2153
  else
2152
- x = C;
2154
+ g = S;
2153
2155
  },
2154
- error: function(C) {
2155
- b.error(C);
2156
+ error: function(S) {
2157
+ w.error(S);
2156
2158
  },
2157
2159
  complete: function() {
2158
- if (!d && !s) return b.error(new TypeError("Cannot reduce an empty sequence"));
2159
- b.next(x), b.complete();
2160
+ if (!d && !l) return w.error(new TypeError("Cannot reduce an empty sequence"));
2161
+ w.next(g), w.complete();
2160
2162
  }
2161
2163
  });
2162
2164
  });
2163
2165
  }, e.concat = function() {
2164
- for (var o = this, n = arguments.length, l = new Array(n), s = 0; s < n; s++)
2165
- l[s] = arguments[s];
2166
+ for (var o = this, n = arguments.length, s = new Array(n), l = 0; l < n; l++)
2167
+ s[l] = arguments[l];
2166
2168
  var d = Nt(this);
2167
2169
  return new d(function(i) {
2168
- var x, b = 0;
2169
- function C(S) {
2170
- x = S.subscribe({
2170
+ var g, w = 0;
2171
+ function S(C) {
2172
+ g = C.subscribe({
2171
2173
  next: function(_) {
2172
2174
  i.next(_);
2173
2175
  },
@@ -2175,54 +2177,54 @@ var Rr = /* @__PURE__ */ (function() {
2175
2177
  i.error(_);
2176
2178
  },
2177
2179
  complete: function() {
2178
- b === l.length ? (x = void 0, i.complete()) : C(d.from(l[b++]));
2180
+ w === s.length ? (g = void 0, i.complete()) : S(d.from(s[w++]));
2179
2181
  }
2180
2182
  });
2181
2183
  }
2182
- return C(o), function() {
2183
- x && (x.unsubscribe(), x = void 0);
2184
+ return S(o), function() {
2185
+ g && (g.unsubscribe(), g = void 0);
2184
2186
  };
2185
2187
  });
2186
2188
  }, e.flatMap = function(o) {
2187
2189
  var n = this;
2188
2190
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2189
- var l = Nt(this);
2190
- return new l(function(s) {
2191
+ var s = Nt(this);
2192
+ return new s(function(l) {
2191
2193
  var d = [], i = n.subscribe({
2192
- next: function(b) {
2194
+ next: function(w) {
2193
2195
  if (o)
2194
2196
  try {
2195
- b = o(b);
2196
- } catch (S) {
2197
- return s.error(S);
2197
+ w = o(w);
2198
+ } catch (C) {
2199
+ return l.error(C);
2198
2200
  }
2199
- var C = l.from(b).subscribe({
2200
- next: function(S) {
2201
- s.next(S);
2201
+ var S = s.from(w).subscribe({
2202
+ next: function(C) {
2203
+ l.next(C);
2202
2204
  },
2203
- error: function(S) {
2204
- s.error(S);
2205
+ error: function(C) {
2206
+ l.error(C);
2205
2207
  },
2206
2208
  complete: function() {
2207
- var S = d.indexOf(C);
2208
- S >= 0 && d.splice(S, 1), x();
2209
+ var C = d.indexOf(S);
2210
+ C >= 0 && d.splice(C, 1), g();
2209
2211
  }
2210
2212
  });
2211
- d.push(C);
2213
+ d.push(S);
2212
2214
  },
2213
- error: function(b) {
2214
- s.error(b);
2215
+ error: function(w) {
2216
+ l.error(w);
2215
2217
  },
2216
2218
  complete: function() {
2217
- x();
2219
+ g();
2218
2220
  }
2219
2221
  });
2220
- function x() {
2221
- i.closed && d.length === 0 && s.complete();
2222
+ function g() {
2223
+ i.closed && d.length === 0 && l.complete();
2222
2224
  }
2223
2225
  return function() {
2224
- d.forEach(function(b) {
2225
- return b.unsubscribe();
2226
+ d.forEach(function(w) {
2227
+ return w.unsubscribe();
2226
2228
  }), i.unsubscribe();
2227
2229
  };
2228
2230
  });
@@ -2231,21 +2233,21 @@ var Rr = /* @__PURE__ */ (function() {
2231
2233
  }, t.from = function(o) {
2232
2234
  var n = typeof this == "function" ? this : t;
2233
2235
  if (o == null) throw new TypeError(o + " is not an object");
2234
- var l = Jt(o, ie);
2235
- if (l) {
2236
- var s = l.call(o);
2237
- if (Object(s) !== s) throw new TypeError(s + " is not an object");
2238
- return Hr(s) && s.constructor === n ? s : new n(function(d) {
2239
- return s.subscribe(d);
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);
2240
2242
  });
2241
2243
  }
2242
- if (fe("iterator") && (l = Jt(o, Mr), l))
2244
+ if (fe("iterator") && (s = Kt(o, Mr), s))
2243
2245
  return new n(function(d) {
2244
2246
  qt(function() {
2245
2247
  if (!d.closed) {
2246
- for (var i = Ur(l.call(o)), x; !(x = i()).done; ) {
2247
- var b = x.value;
2248
- if (d.next(b), d.closed) return;
2248
+ for (var i = Ur(s.call(o)), g; !(g = i()).done; ) {
2249
+ var w = g.value;
2250
+ if (d.next(w), d.closed) return;
2249
2251
  }
2250
2252
  d.complete();
2251
2253
  }
@@ -2263,10 +2265,10 @@ var Rr = /* @__PURE__ */ (function() {
2263
2265
  });
2264
2266
  throw new TypeError(o + " is not observable");
2265
2267
  }, t.of = function() {
2266
- for (var o = arguments.length, n = new Array(o), l = 0; l < o; l++)
2267
- n[l] = arguments[l];
2268
- var s = typeof this == "function" ? this : t;
2269
- return new s(function(d) {
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) {
2270
2272
  qt(function() {
2271
2273
  if (!d.closed) {
2272
2274
  for (var i = 0; i < n.length; ++i)
@@ -2289,7 +2291,7 @@ pe() && Object.defineProperty(N, Symbol("extensions"), {
2289
2291
  },
2290
2292
  configurable: !0
2291
2293
  });
2292
- function Jr(t) {
2294
+ function Kr(t) {
2293
2295
  var e, r = t.Symbol;
2294
2296
  if (typeof r == "function")
2295
2297
  if (r.observable)
@@ -2307,12 +2309,12 @@ function Jr(t) {
2307
2309
  }
2308
2310
  var gt;
2309
2311
  typeof self < "u" ? gt = self : typeof window < "u" ? gt = window : typeof global < "u" ? gt = global : typeof module < "u" ? gt = module : gt = Function("return this")();
2310
- Jr(gt);
2312
+ Kr(gt);
2311
2313
  var $e = N.prototype, ze = "@@observable";
2312
2314
  $e[ze] || ($e[ze] = function() {
2313
2315
  return this;
2314
2316
  });
2315
- function Kr(t) {
2317
+ function Jr(t) {
2316
2318
  for (var e = [
2317
2319
  "query",
2318
2320
  "operationName",
@@ -2322,13 +2324,13 @@ function Kr(t) {
2322
2324
  ], r = 0, o = Object.keys(t); r < o.length; r++) {
2323
2325
  var n = o[r];
2324
2326
  if (e.indexOf(n) < 0)
2325
- throw Ge(58, n);
2327
+ throw We(58, n);
2326
2328
  }
2327
2329
  return t;
2328
2330
  }
2329
- function Gr(t, e) {
2330
- var r = Q({}, t), o = function(l) {
2331
- typeof l == "function" ? r = Q(Q({}, r), l(r)) : r = Q(Q({}, r), l);
2331
+ function Wr(t, e) {
2332
+ var r = Q({}, t), o = function(s) {
2333
+ typeof s == "function" ? r = Q(Q({}, r), s(r)) : r = Q(Q({}, r), s);
2332
2334
  }, n = function() {
2333
2335
  return Q({}, r);
2334
2336
  };
@@ -2340,7 +2342,7 @@ function Gr(t, e) {
2340
2342
  value: n
2341
2343
  }), e;
2342
2344
  }
2343
- function Wr(t) {
2345
+ function Gr(t) {
2344
2346
  var e = {
2345
2347
  variables: t.variables || {},
2346
2348
  extensions: t.extensions || {},
@@ -2380,34 +2382,34 @@ var tr = (
2380
2382
  return r.concat(o);
2381
2383
  });
2382
2384
  }, t.split = function(e, r, o) {
2383
- var n = Et(r), l = Et(o || new t(je)), s;
2384
- return Ut(n) && Ut(l) ? s = new t(function(d) {
2385
- return e(d) ? n.request(d) || N.of() : l.request(d) || N.of();
2386
- }) : s = new t(function(d, i) {
2387
- return e(d) ? n.request(d, i) || N.of() : l.request(d, i) || N.of();
2388
- }), Object.assign(s, { left: n, right: l });
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 });
2389
2391
  }, t.execute = function(e, r) {
2390
- return e.request(Gr(r.context, Wr(Kr(r)))) || N.of();
2392
+ return e.request(Wr(r.context, Gr(Jr(r)))) || N.of();
2391
2393
  }, t.concat = function(e, r) {
2392
2394
  var o = Et(e);
2393
2395
  if (Ut(o))
2394
2396
  return globalThis.__DEV__ !== !1 && Zt.warn(47, o), o;
2395
- var n = Et(r), l;
2396
- return Ut(n) ? l = new t(function(s) {
2397
- return o.request(s, function(d) {
2397
+ var n = Et(r), s;
2398
+ return Ut(n) ? s = new t(function(l) {
2399
+ return o.request(l, function(d) {
2398
2400
  return n.request(d) || N.of();
2399
2401
  }) || N.of();
2400
- }) : l = new t(function(s, d) {
2401
- return o.request(s, function(i) {
2402
+ }) : s = new t(function(l, d) {
2403
+ return o.request(l, function(i) {
2402
2404
  return n.request(i, d) || N.of();
2403
2405
  }) || N.of();
2404
- }), Object.assign(l, { left: o, right: n });
2406
+ }), Object.assign(s, { left: o, right: n });
2405
2407
  }, t.prototype.split = function(e, r, o) {
2406
2408
  return this.concat(t.split(e, r, o || new t(je)));
2407
2409
  }, t.prototype.concat = function(e) {
2408
2410
  return t.concat(this, e);
2409
2411
  }, t.prototype.request = function(e, r) {
2410
- throw Ge(48);
2412
+ throw We(48);
2411
2413
  }, t.prototype.onError = function(e, r) {
2412
2414
  if (globalThis.__DEV__ !== !1 && eo("onError", function() {
2413
2415
  globalThis.__DEV__ !== !1 && Zt.warn(49);
@@ -2423,17 +2425,17 @@ function ro(t) {
2423
2425
  return new tr(function(e, r) {
2424
2426
  var o = Or(e, []);
2425
2427
  return new N(function(n) {
2426
- var l, s = !1;
2428
+ var s, l = !1;
2427
2429
  return Promise.resolve(o).then(function(d) {
2428
2430
  return t(d, e.getContext());
2429
2431
  }).then(e.setContext).then(function() {
2430
- s || (l = r(e).subscribe({
2432
+ l || (s = r(e).subscribe({
2431
2433
  next: n.next.bind(n),
2432
2434
  error: n.error.bind(n),
2433
2435
  complete: n.complete.bind(n)
2434
2436
  }));
2435
2437
  }).catch(n.error.bind(n)), function() {
2436
- s = !0, l && l.unsubscribe();
2438
+ l = !0, s && s.unsubscribe();
2437
2439
  };
2438
2440
  });
2439
2441
  });