@gengage/assistant-fe 0.6.35 → 0.6.37

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.
Files changed (39) hide show
  1. package/dist/chat/catalog.d.ts +13 -0
  2. package/dist/chat/components/ChatDrawer.d.ts +2 -2
  3. package/dist/chat/components/InlineQuestionButtons.d.ts +3 -0
  4. package/dist/chat/components/KvkkBanner.d.ts +0 -2
  5. package/dist/chat/kvkk.d.ts +11 -5
  6. package/dist/chat/runtime.d.ts +2 -0
  7. package/dist/chat/types.d.ts +14 -0
  8. package/dist/{chat-CIfQyuBl.js → chat-CJzuUZxy.js} +42 -38
  9. package/dist/chat-runtime.js +1 -1
  10. package/dist/chat.iife.js +21 -21
  11. package/dist/chat.js +2 -2
  12. package/dist/common/overlay.d.ts +2 -0
  13. package/dist/common/transport.d.ts +1 -0
  14. package/dist/{common-C-lXfS-s.js → common-CvcP5qMC.js} +2 -2
  15. package/dist/common.js +7 -7
  16. package/dist/{connection-warning-DrXU9qN9.js → connection-warning-DuejADTP.js} +1 -1
  17. package/dist/{fastIntent-Diz6Vo0W.js → fastIntent-DpWJneEN.js} +1 -1
  18. package/dist/index.js +12 -12
  19. package/dist/{native-webview-BcwGKkDe.js → native-webview-Ch9lsx7E.js} +1 -1
  20. package/dist/native.iife.js +18 -18
  21. package/dist/native.js +1 -1
  22. package/dist/{overlay-cF2SjxYU.js → overlay-CPLLn1eK.js} +7 -7
  23. package/dist/overlay.js +1 -1
  24. package/dist/qna-runtime.js +1 -1
  25. package/dist/qna.iife.js +8 -8
  26. package/dist/qna.js +1 -1
  27. package/dist/{request-response-cache-DmnzO4Hu.js → request-response-cache-Cv8CiBwQ.js} +240 -214
  28. package/dist/{runtime-D0v-KyzN.js → runtime-BVd67coj.js} +1147 -1113
  29. package/dist/{runtime-CiO-HX8B.js → runtime-Bq0nExwG.js} +3 -3
  30. package/dist/{runtime-hci1VRsa.js → runtime-i_FHHBlZ.js} +3 -3
  31. package/dist/{simbut-D-IPkTT8.js → simbut-BzrDBfBk.js} +1 -1
  32. package/dist/simbut.iife.js +1 -1
  33. package/dist/simbut.js +1 -1
  34. package/dist/{simrel-BjMCvCdo.js → simrel-DUVViZ9p.js} +1 -1
  35. package/dist/simrel-runtime.js +1 -1
  36. package/dist/simrel.iife.js +9 -9
  37. package/dist/simrel.js +2 -2
  38. package/dist/{widget-base-_HBDf5VH.js → widget-base-EWFE_HAI.js} +1 -1
  39. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { i as W } from "./widget-base-_HBDf5VH.js";
2
- var J = ({ element: e, renderElement: t }) => {
1
+ import { i as X } from "./widget-base-EWFE_HAI.js";
2
+ var Z = ({ element: e, renderElement: t }) => {
3
3
  if (!e.children || e.children.length === 0) return null;
4
4
  const r = document.createElement("div");
5
5
  for (const o of e.children) {
@@ -8,10 +8,10 @@ var J = ({ element: e, renderElement: t }) => {
8
8
  }
9
9
  return r;
10
10
  };
11
- function ft(e) {
11
+ function mt(e) {
12
12
  const t = document.createElement("div");
13
13
  if (t.className = e.containerClassName, !e.spec.elements[e.spec.root]) return t;
14
- const r = e.unknownRenderer ?? J, o = (s) => {
14
+ const r = e.unknownRenderer ?? Z, o = (s) => {
15
15
  const i = e.spec.elements[s];
16
16
  if (!i) return null;
17
17
  const a = e.registry[i.type];
@@ -31,17 +31,17 @@ function ft(e) {
31
31
  }, n = o(e.spec.root);
32
32
  return n && t.appendChild(n), t;
33
33
  }
34
- function yt(e, t) {
34
+ function _t(e, t) {
35
35
  if (!t) return e;
36
36
  const r = { ...e };
37
37
  for (const [o, n] of Object.entries(t))
38
38
  n && (r[o] = n);
39
39
  return r;
40
40
  }
41
- function v(e) {
41
+ function j(e) {
42
42
  return typeof e == "object" && e !== null && typeof e.type == "string";
43
43
  }
44
- function Q(e) {
44
+ function ee(e) {
45
45
  const t = [];
46
46
  let r = 0, o = !1, n = !1, s = 0;
47
47
  for (let i = 0; i < e.length; i++) {
@@ -62,7 +62,7 @@ function Q(e) {
62
62
  }
63
63
  return t.length > 0 ? t : [e];
64
64
  }
65
- function j(e, t) {
65
+ function B(e, t) {
66
66
  const r = e.trim();
67
67
  if (!r || r.startsWith(":")) return !1;
68
68
  const o = r.startsWith("data: ") ? r.slice(6) : r;
@@ -70,13 +70,13 @@ function j(e, t) {
70
70
  return t.onDone?.(), !0;
71
71
  try {
72
72
  const n = JSON.parse(o);
73
- return v(n) ? (W("stream", `event: ${n.type}`, n), t.onEvent(n), n.type === "done" ? (t.onDone?.(), !0) : !1) : !1;
73
+ return j(n) ? (X("stream", `event: ${n.type}`, n), t.onEvent(n), n.type === "done" ? (t.onDone?.(), !0) : !1) : !1;
74
74
  } catch {
75
- const n = Q(o);
75
+ const n = ee(o);
76
76
  if (n.length > 1) {
77
77
  for (const s of n) try {
78
78
  const i = JSON.parse(s);
79
- if (!v(i)) continue;
79
+ if (!j(i)) continue;
80
80
  if (t.onEvent(i), i.type === "done")
81
81
  return t.onDone?.(), !0;
82
82
  } catch {
@@ -86,7 +86,7 @@ function j(e, t) {
86
86
  return !1;
87
87
  }
88
88
  }
89
- async function Y(e, t) {
89
+ async function te(e, t) {
90
90
  if (!e.ok) {
91
91
  t.onError?.(/* @__PURE__ */ new Error(`HTTP ${e.status}: ${e.statusText}`));
92
92
  return;
@@ -116,9 +116,9 @@ async function Y(e, t) {
116
116
  const f = n.split(`
117
117
  `);
118
118
  n = f.pop() ?? "";
119
- for (const d of f) if (j(d, t)) return;
119
+ for (const d of f) if (B(d, t)) return;
120
120
  }
121
- if (n.trim() && j(n, t))
121
+ if (n.trim() && B(n, t))
122
122
  return;
123
123
  } catch (c) {
124
124
  if (c instanceof DOMException && c.name === "AbortError") return;
@@ -128,8 +128,8 @@ async function Y(e, t) {
128
128
  }
129
129
  t.onDone?.();
130
130
  }
131
- function gt(e, t, r) {
132
- const o = new AbortController(), n = r.signal ? X([r.signal, o.signal]) : o.signal;
131
+ function ht(e, t, r) {
132
+ const o = new AbortController(), n = r.signal ? re([r.signal, o.signal]) : o.signal;
133
133
  return fetch(e, {
134
134
  method: "POST",
135
135
  headers: {
@@ -138,14 +138,14 @@ function gt(e, t, r) {
138
138
  },
139
139
  body: JSON.stringify(t),
140
140
  signal: n
141
- }).then((s) => Y(s, {
141
+ }).then((s) => te(s, {
142
142
  ...r,
143
143
  signal: n
144
144
  })).catch((s) => {
145
145
  s instanceof DOMException && s.name === "AbortError" || r.onError?.(s instanceof Error ? s : new Error(String(s)));
146
146
  }), o;
147
147
  }
148
- function X(e) {
148
+ function re(e) {
149
149
  const t = new AbortController(), r = [];
150
150
  for (const o of e) {
151
151
  if (o.aborted)
@@ -157,122 +157,122 @@ function X(e) {
157
157
  for (const o of r) o();
158
158
  }, { once: !0 }), t.signal;
159
159
  }
160
- var M = 3, Z = (e, t) => {
160
+ var M = 3, oe = (e, t) => {
161
161
  const r = e.replace(/\s+/g, " ").trim().replace(/^[,.;:!?•-]+|[,.;:!?•-]+$/g, "");
162
162
  if (!r) return "";
163
163
  const o = t?.stripLeadingStopWords ? r.replace(/^(?:daha|için)\s+/i, "").trim() : r;
164
164
  return o ? o.split(/\s+/).slice(0, 3).join(" ").trim() : "";
165
- }, T = (e, t) => e ? e.split(/[•,;:/()]|(?:\sve\s)|(?:\sand\s)|(?:\sile\s)|(?:\sfor\s)|(?:\swith\s)/i).map((r) => Z(r, t)).filter(Boolean) : [];
166
- function ee(e) {
167
- const t = (e.display_keywords ?? []).flatMap((n) => T(n, { stripLeadingStopWords: !0 })), r = t.filter((n, s) => t.indexOf(n) === s);
165
+ }, C = (e, t) => e ? e.split(/[•,;:/()]|(?:\sve\s)|(?:\sand\s)|(?:\sile\s)|(?:\sfor\s)|(?:\swith\s)/i).map((r) => oe(r, t)).filter(Boolean) : [];
166
+ function ne(e) {
167
+ const t = (e.display_keywords ?? []).flatMap((n) => C(n, { stripLeadingStopWords: !0 })), r = t.filter((n, s) => t.indexOf(n) === s);
168
168
  if (r.length > 0) return r.slice(0, M);
169
- const o = [...T(e.chosen_attribute, { stripLeadingStopWords: !0 }), ...T(e.short_name)];
169
+ const o = [...C(e.chosen_attribute, { stripLeadingStopWords: !0 }), ...C(e.short_name)];
170
170
  return o.filter((n, s) => o.indexOf(n) === s).slice(0, M);
171
171
  }
172
- function te(e) {
173
- return ee(e).join(" • ");
172
+ function se(e) {
173
+ return ne(e).join(" • ");
174
174
  }
175
- function re(e) {
175
+ function ie(e) {
176
176
  return e === "beauty_consulting" || e === "account_expert";
177
177
  }
178
- function C(...e) {
178
+ function I(...e) {
179
179
  for (const t of e) {
180
180
  if (typeof t != "string") continue;
181
181
  const r = t.trim();
182
182
  if (r.length > 0) return r;
183
183
  }
184
184
  }
185
- function I(e) {
185
+ function D(e) {
186
186
  return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.trim().length > 0).map((t) => t.trim()) : [];
187
187
  }
188
188
  function z(e) {
189
- const t = { ...e }, r = C(t.sku), o = I(t.group_skus);
189
+ const t = { ...e }, r = I(t.sku), o = D(t.group_skus);
190
190
  if (r ? t.sku = r : delete t.sku, o.length > 0 ? t.group_skus = o : delete t.group_skus, r || o.length > 0) delete t.image_url;
191
191
  else {
192
- const n = C(t.image_url);
192
+ const n = I(t.image_url);
193
193
  n ? t.image_url = n : delete t.image_url;
194
194
  }
195
195
  return t;
196
196
  }
197
- function mt(e) {
197
+ function bt(e) {
198
198
  if (typeof e.type != "string") return null;
199
- if (oe(e)) return e;
199
+ if (ae(e)) return e;
200
200
  const t = e;
201
201
  switch (t.type) {
202
202
  case "outputText":
203
- return ne(t);
203
+ return ce(t);
204
204
  case "suggestedActions":
205
- return se(t);
205
+ return ue(t);
206
206
  case "productList":
207
- return ie(t);
207
+ return de(t);
208
208
  case "productDetails":
209
- return ae(t);
209
+ return le(t);
210
210
  case "productDetailsSimilars":
211
- return ce(t);
211
+ return pe(t);
212
212
  case "comparisonTable":
213
- return ue(t);
214
- case "context":
215
213
  return fe(t);
214
+ case "context":
215
+ return _e(t);
216
216
  case "chatStreamEnd":
217
- return ye();
217
+ return he();
218
218
  case "loading":
219
- return ge(t);
219
+ return be(t);
220
220
  case "panelLoading":
221
- return me(t);
221
+ return ke(t);
222
222
  case "similarLoading":
223
- return _e(t);
223
+ return Ae(t);
224
224
  case "redirect":
225
- return he(t);
225
+ return we(t);
226
226
  case "error":
227
- return be(t);
227
+ return Se(t);
228
228
  case "dummy":
229
- return ke(t);
229
+ return xe(t);
230
230
  case "launcherAction":
231
- return Ae(t);
231
+ return Pe(t);
232
232
  case "text":
233
- return L(t);
233
+ return O(t);
234
234
  case "productItem":
235
- return we(t);
235
+ return Ee(t);
236
236
  case "text_image":
237
- return H(t);
237
+ return F(t);
238
238
  case "quick_qna":
239
- return U(t);
239
+ return K(t);
240
240
  case "reviewHighlights":
241
- return Se(t);
241
+ return Te(t);
242
242
  case "aiProductSuggestions":
243
- return Ee(t);
243
+ return De(t);
244
244
  case "aiProductGroupings":
245
- return Te(t);
245
+ return Ne(t);
246
246
  case "aiSuggestedSearches":
247
- return Ie(t);
247
+ return Le(t);
248
248
  case "prosAndCons":
249
- return xe(t);
249
+ return Ce(t);
250
250
  case "getGroundingReview":
251
- return De(t);
251
+ return Oe(t);
252
252
  case "voice":
253
- return Re(t);
253
+ return ve(t);
254
254
  case "visitorDataResponse":
255
- return Pe(t);
255
+ return Ie(t);
256
256
  case "productListPreview":
257
- return Ne();
257
+ return qe();
258
258
  case "groupList":
259
- return Le(t);
259
+ return je(t);
260
260
  case "formGetInfo":
261
261
  case "formTestDrive":
262
262
  case "formServiceRequest":
263
263
  case "launchFormPage":
264
- return qe(t);
264
+ return Be(t);
265
265
  case "launcherContent":
266
- return ve(t);
266
+ return ze(t);
267
267
  case "handoff":
268
- return Oe(t);
268
+ return Me(t);
269
269
  case "uiSpec":
270
- return $e(t);
270
+ return We(t);
271
271
  default:
272
272
  return null;
273
273
  }
274
274
  }
275
- function oe(e) {
275
+ function ae(e) {
276
276
  const t = e.type;
277
277
  if (typeof t != "string") return !1;
278
278
  switch (t) {
@@ -298,7 +298,7 @@ function oe(e) {
298
298
  return !1;
299
299
  }
300
300
  }
301
- function ne(e) {
301
+ function ce(e) {
302
302
  const t = l(e.payload.text, e.payload.plain_text) ?? "", r = l(e.payload.plain_text, e.payload.text) ?? t;
303
303
  if (e.payload.is_error) return {
304
304
  type: "error",
@@ -318,23 +318,23 @@ function ne(e) {
318
318
  const a = e.payload.render_hint;
319
319
  return typeof a == "string" && a && (o.renderHint = a), e.payload.kvkk === !0 && (o.kvkk = !0), o;
320
320
  }
321
- function se(e) {
322
- return G((e.payload.actions ?? []).map((t) => {
321
+ function ue(e) {
322
+ return V((e.payload.actions ?? []).map((t) => {
323
323
  const r = l(t.title) ?? "", o = k(t.requestDetails, r), n = o ? {
324
324
  label: r,
325
325
  action: o
326
326
  } : null;
327
327
  return n ? (typeof t.icon == "string" && (n.icon = t.icon), typeof t.image == "string" && (n.image = t.image), n) : null;
328
- }).filter(P), "chat");
328
+ }).filter(E), "chat");
329
329
  }
330
- function ie(e) {
330
+ function de(e) {
331
331
  const t = Array.isArray(e.payload.grouped_assignment) ? e.payload.grouped_assignment : [], r = (Array.isArray(e.payload.style_variations) ? e.payload.style_variations : []).map((a) => {
332
332
  const c = l(a.style_label);
333
333
  if (!c) return null;
334
334
  const p = l(a.style_mood), _ = l(a.image_url ?? void 0), u = (Array.isArray(a.product_list) ? a.product_list : []).map((f) => {
335
335
  const d = b(f);
336
- return d ? O(b(d.product_detail) ?? b(d.product) ?? d) : null;
337
- }).filter(P), m = Array.isArray(a.recommendation_groups) ? a.recommendation_groups.map((f) => ({
336
+ return d ? v(b(d.product_detail) ?? b(d.product) ?? d) : null;
337
+ }).filter(E), m = Array.isArray(a.recommendation_groups) ? a.recommendation_groups.map((f) => ({
338
338
  label: l(f.label) ?? "",
339
339
  reason: l(f.reason) ?? "",
340
340
  skus: Array.isArray(f.skus) ? f.skus.filter((d) => typeof d == "string" && d.trim().length > 0) : []
@@ -347,7 +347,7 @@ function ie(e) {
347
347
  product_list: u,
348
348
  recommendation_groups: m
349
349
  };
350
- }).filter(P), o = e.payload.product_list ?? [], n = re(e.payload.source) && r.length > 0 ? r[0].product_list : null, s = n ? Me(n, "chat") : t.length > 0 ? je(t, o, "chat") ?? D(o, "chat") : D(o, "chat");
350
+ }).filter(E), o = e.payload.product_list ?? [], n = ie(e.payload.source) && r.length > 0 ? r[0].product_list : null, s = n ? Ue(n, "chat") : t.length > 0 ? He(t, o, "chat") ?? N(o, "chat") : N(o, "chat");
351
351
  s.panelHint = "panel";
352
352
  const i = s.spec.elements[s.spec.root];
353
353
  if (i) {
@@ -361,9 +361,9 @@ function ie(e) {
361
361
  }
362
362
  return s;
363
363
  }
364
- function ae(e) {
364
+ function le(e) {
365
365
  const t = e.payload.productDetails;
366
- if (!t) return Be("chat");
366
+ if (!t) return $e("chat");
367
367
  const r = S(t);
368
368
  return {
369
369
  type: "ui_spec",
@@ -381,8 +381,8 @@ function ae(e) {
381
381
  panelHint: "panel"
382
382
  };
383
383
  }
384
- function ce(e) {
385
- const t = D(e.payload.similarProducts ?? [], "chat"), r = t.spec.elements[t.spec.root];
384
+ function pe(e) {
385
+ const t = N(e.payload.similarProducts ?? [], "chat"), r = t.spec.elements[t.spec.root];
386
386
  return r && (r.props = {
387
387
  ...r.props,
388
388
  similarsAppend: !0
@@ -391,7 +391,7 @@ function ce(e) {
391
391
  panelHint: "panel"
392
392
  };
393
393
  }
394
- function ue(e) {
394
+ function fe(e) {
395
395
  const t = e.payload.multiple_product_details ?? [], r = e.payload, o = {
396
396
  key_differences: r.key_differences,
397
397
  recommended_choice: r.recommended_choice,
@@ -408,13 +408,13 @@ function ue(e) {
408
408
  const h = S(g);
409
409
  i.push(h);
410
410
  }
411
- const a = de(n, i, o, s);
411
+ const a = ye(n, i, o, s);
412
412
  let c;
413
413
  o?.recommended_choice_sku ? c = o.recommended_choice_sku : o?.winner_product && o.winner_product.length > 0 && (c = o.winner_product[0]?.product_detail?.sku ?? o.winner_product[0]?.sku);
414
414
  const p = c ? i.find((g) => g.sku === c) ?? i[0] : i[0], _ = [];
415
415
  if (Array.isArray(o?.key_differences))
416
416
  for (const g of o.key_differences) typeof g == "string" && _.push(g);
417
- const u = $(o?.special_considerations), m = o?.recommended_choice, f = o?.winner_hits, d = {};
417
+ const u = W(o?.special_considerations), m = o?.recommended_choice, f = o?.winner_hits, d = {};
418
418
  for (const g of i) {
419
419
  const h = g.sku;
420
420
  h && (d[h] = {
@@ -442,7 +442,7 @@ function ue(e) {
442
442
  panelHint: "panel"
443
443
  };
444
444
  }
445
- function de(e, t, r, o) {
445
+ function ye(e, t, r, o) {
446
446
  if (!e) return [];
447
447
  const n = Object.entries(e);
448
448
  if (n.length === 0) return [];
@@ -460,13 +460,13 @@ function de(e, t, r, o) {
460
460
  }
461
461
  return f;
462
462
  }
463
- const i = e, a = t.map((u) => String(u.sku ?? "")).filter((u) => u.length > 0), c = r.criteria_view ?? r.criteria_view_short ?? {}, p = (o && o.length > 0 ? o : r.compared_field_names && r.compared_field_names.length > 0 ? r.compared_field_names : le(i)).filter((u) => u !== "name" && u !== "name_short" && !u.endsWith("_short")), _ = [];
463
+ const i = e, a = t.map((u) => String(u.sku ?? "")).filter((u) => u.length > 0), c = r.criteria_view ?? r.criteria_view_short ?? {}, p = (o && o.length > 0 ? o : r.compared_field_names && r.compared_field_names.length > 0 ? r.compared_field_names : ge(i)).filter((u) => u !== "name" && u !== "name_short" && !u.endsWith("_short")), _ = [];
464
464
  for (const u of p) {
465
465
  const m = a.map((d) => {
466
466
  const y = i[d];
467
467
  if (!y || typeof y != "object") return "";
468
468
  const g = y[`${u}_short`], h = y[u];
469
- return pe(g ?? h);
469
+ return me(g ?? h);
470
470
  });
471
471
  if (m.every((d) => d.length === 0)) continue;
472
472
  const f = c[u] ?? u;
@@ -477,7 +477,7 @@ function de(e, t, r, o) {
477
477
  }
478
478
  return _;
479
479
  }
480
- function le(e) {
480
+ function ge(e) {
481
481
  const t = [], r = /* @__PURE__ */ new Set();
482
482
  for (const o of Object.values(e))
483
483
  if (!(!o || typeof o != "object"))
@@ -485,10 +485,10 @@ function le(e) {
485
485
  r.has(n) || (r.add(n), t.push(n));
486
486
  return t;
487
487
  }
488
- function pe(e) {
488
+ function me(e) {
489
489
  return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : "";
490
490
  }
491
- function fe(e) {
491
+ function _e(e) {
492
492
  return {
493
493
  type: "metadata",
494
494
  sessionId: "",
@@ -500,10 +500,10 @@ function fe(e) {
500
500
  }
501
501
  };
502
502
  }
503
- function ye() {
503
+ function he() {
504
504
  return { type: "done" };
505
505
  }
506
- function ge(e) {
506
+ function be(e) {
507
507
  return {
508
508
  type: "metadata",
509
509
  sessionId: "",
@@ -516,7 +516,7 @@ function ge(e) {
516
516
  }
517
517
  };
518
518
  }
519
- function me(e) {
519
+ function ke(e) {
520
520
  return {
521
521
  type: "metadata",
522
522
  sessionId: "",
@@ -529,7 +529,7 @@ function me(e) {
529
529
  }
530
530
  };
531
531
  }
532
- function _e(e) {
532
+ function Ae(e) {
533
533
  return {
534
534
  type: "metadata",
535
535
  sessionId: "",
@@ -542,7 +542,7 @@ function _e(e) {
542
542
  }
543
543
  };
544
544
  }
545
- function he(e) {
545
+ function we(e) {
546
546
  const t = l(e.payload.url);
547
547
  return t ? {
548
548
  type: "action",
@@ -561,14 +561,14 @@ function he(e) {
561
561
  }
562
562
  };
563
563
  }
564
- function be(e) {
564
+ function Se(e) {
565
565
  return {
566
566
  type: "error",
567
567
  code: "BACKEND_ERROR",
568
568
  message: l(e.payload?.text, e.payload?.message, e.payload?.error) ?? "Backend returned an error"
569
569
  };
570
570
  }
571
- function ke(e) {
571
+ function xe(e) {
572
572
  return {
573
573
  type: "metadata",
574
574
  sessionId: "",
@@ -576,11 +576,11 @@ function ke(e) {
576
576
  meta: { noop: !0 }
577
577
  };
578
578
  }
579
- function Ae(e) {
579
+ function Pe(e) {
580
580
  const t = e.payload ?? {};
581
581
  if (Array.isArray(t.action_list)) {
582
582
  const n = { action_list: t.action_list }, s = typeof t.type == "string" ? t.type : void 0, i = typeof t.theme == "string" ? t.theme : void 0;
583
- return s !== void 0 && (n.type = s), i !== void 0 && (n.theme = i), U({
583
+ return s !== void 0 && (n.type = s), i !== void 0 && (n.theme = i), K({
584
584
  type: "quick_qna",
585
585
  payload: n
586
586
  });
@@ -588,7 +588,7 @@ function Ae(e) {
588
588
  const r = b(t.action);
589
589
  if (r) {
590
590
  const n = { action: r }, s = typeof t.text == "string" ? t.text : void 0, i = typeof t.image_url == "string" ? t.image_url : void 0, a = typeof t.theme == "string" ? t.theme : void 0;
591
- return s !== void 0 && (n.text = s), i !== void 0 && (n.image_url = i), a !== void 0 && (n.theme = a), H({
591
+ return s !== void 0 && (n.text = s), i !== void 0 && (n.image_url = i), a !== void 0 && (n.theme = a), F({
592
592
  type: "text_image",
593
593
  payload: n
594
594
  });
@@ -596,7 +596,7 @@ function Ae(e) {
596
596
  const o = typeof t.text == "string" ? t.text : "";
597
597
  if (o) {
598
598
  const n = { text: o }, s = typeof t.type == "string" ? t.type : void 0, i = typeof t.theme == "string" ? t.theme : void 0, a = b(t.payload) ?? void 0;
599
- return s !== void 0 && (n.type = s), a !== void 0 && (n.payload = a), i !== void 0 && (n.theme = i), L({
599
+ return s !== void 0 && (n.type = s), a !== void 0 && (n.payload = a), i !== void 0 && (n.theme = i), O({
600
600
  type: "text",
601
601
  payload: n
602
602
  });
@@ -608,7 +608,7 @@ function Ae(e) {
608
608
  meta: { launcherAction: t }
609
609
  };
610
610
  }
611
- function L(e) {
611
+ function O(e) {
612
612
  const t = { text: l(e.payload.text) ?? "" };
613
613
  return typeof e.payload.theme == "string" && (t.theme = e.payload.theme), e.payload.payload !== void 0 && (t.payload = e.payload.payload), {
614
614
  type: "ui_spec",
@@ -622,10 +622,10 @@ function L(e) {
622
622
  }
623
623
  };
624
624
  }
625
- function we(e) {
626
- return ze(e.payload, "qna");
625
+ function Ee(e) {
626
+ return Ge(e.payload, "qna");
627
627
  }
628
- function H(e) {
628
+ function F(e) {
629
629
  const t = l(e.payload.text) ?? "", r = k(e.payload.action, t);
630
630
  if (r) {
631
631
  const n = {
@@ -645,21 +645,21 @@ function H(e) {
645
645
  };
646
646
  }
647
647
  const o = { text: t };
648
- return typeof e.payload.theme == "string" && (o.theme = e.payload.theme), L({
648
+ return typeof e.payload.theme == "string" && (o.theme = e.payload.theme), O({
649
649
  type: "text",
650
650
  payload: o
651
651
  });
652
652
  }
653
- function U(e) {
654
- return G((e.payload.action_list ?? []).map((t) => {
653
+ function K(e) {
654
+ return V((e.payload.action_list ?? []).map((t) => {
655
655
  const r = l(t.title) ?? "", o = k(t.requestDetails, r), n = o ? {
656
656
  label: r,
657
657
  action: o
658
658
  } : null;
659
659
  return n ? (typeof t.icon == "string" && (n.icon = t.icon), typeof t.image == "string" && (n.image = t.image), n) : null;
660
- }).filter(P), "qna");
660
+ }).filter(E), "qna");
661
661
  }
662
- function Se(e) {
662
+ function Te(e) {
663
663
  const t = { reviews: (e.payload.reviews ?? []).map((r) => {
664
664
  const o = {};
665
665
  return typeof r.review_class == "string" && (o.review_class = r.review_class), typeof r.review_text == "string" && (o.review_text = r.review_text), (typeof r.review_rating == "string" || typeof r.review_rating == "number") && (o.review_rating = r.review_rating), typeof r.review_tag == "string" && (o.review_tag = r.review_tag), o;
@@ -676,7 +676,7 @@ function Se(e) {
676
676
  }
677
677
  };
678
678
  }
679
- function xe(e) {
679
+ function Ce(e) {
680
680
  const t = {};
681
681
  return Array.isArray(e.payload.pros) && (t.pros = e.payload.pros), Array.isArray(e.payload.cons) && (t.cons = e.payload.cons), typeof e.payload.product_name == "string" && (t.productName = e.payload.product_name), {
682
682
  type: "ui_spec",
@@ -690,7 +690,7 @@ function xe(e) {
690
690
  }
691
691
  };
692
692
  }
693
- function Pe(e) {
693
+ function Ie(e) {
694
694
  return {
695
695
  type: "metadata",
696
696
  sessionId: "",
@@ -698,12 +698,12 @@ function Pe(e) {
698
698
  meta: { visitorDataResponse: e.payload }
699
699
  };
700
700
  }
701
- function Ee(e) {
701
+ function De(e) {
702
702
  const t = e.payload.product_suggestions ?? [], r = [];
703
703
  for (let o = 0; o < t.length; o++) {
704
704
  const n = t[o];
705
705
  if (!n) continue;
706
- const s = He(n);
706
+ const s = Fe(n);
707
707
  if (!s) continue;
708
708
  const i = { product: s }, a = k(n.requestDetails, s.name);
709
709
  a && (i.action = a), typeof n.role == "string" && (i.role = n.role), typeof n.reason == "string" && (i.reason = n.reason), typeof n.review_highlight == "string" && (i.reviewHighlight = n.review_highlight), Array.isArray(n.labels) && (i.labels = n.labels), typeof n.expert_quality_score == "number" && (i.expertQualityScore = n.expert_quality_score), r.push(i);
@@ -725,15 +725,15 @@ function Ee(e) {
725
725
  }
726
726
  };
727
727
  }
728
- function Te(e) {
728
+ function Ne(e) {
729
729
  const t = e.payload.product_groupings ?? [], r = [], o = [];
730
730
  for (let n = 0; n < t.length; n++) {
731
731
  const s = t[n];
732
732
  if (!s) continue;
733
- const i = l(s.name) ?? "", a = l(s.description), c = l(s.highlight), p = Array.isArray(s.labels) ? $(s.labels) : [], _ = l(s.sku, s.repr_sku), u = l(s.image, s.repr_image), m = Ce(s, i, _), f = (Array.isArray(s.group_products) ? s.group_products : []).map((g) => {
733
+ const i = l(s.name) ?? "", a = l(s.description), c = l(s.highlight), p = Array.isArray(s.labels) ? W(s.labels) : [], _ = l(s.sku, s.repr_sku), u = l(s.image, s.repr_image), m = Re(s, i, _), f = (Array.isArray(s.group_products) ? s.group_products : []).map((g) => {
734
734
  const h = b(g);
735
- return h ? O(h) : null;
736
- }).filter(P), d = u ?? l(...f.map((g) => g.imageUrl));
735
+ return h ? v(h) : null;
736
+ }).filter(E), d = u ?? l(...f.map((g) => g.imageUrl));
737
737
  if (i && f.length > 0) {
738
738
  const g = {
739
739
  groupName: i,
@@ -776,13 +776,13 @@ function Te(e) {
776
776
  }
777
777
  };
778
778
  }
779
- function Ce(e, t, r) {
779
+ function Re(e, t, r) {
780
780
  const o = b(e.requestDetails);
781
781
  if (o) {
782
782
  if (o.type !== "findSimilar") return k(o, t);
783
783
  const i = { ...b(o.payload) ?? {} };
784
- r && !C(i.sku) && (i.sku = r);
785
- const a = I(e.group_skus);
784
+ r && !I(i.sku) && (i.sku = r);
785
+ const a = D(e.group_skus);
786
786
  return a.length > 0 && (i.group_skus = a), k({
787
787
  ...o,
788
788
  payload: z(i)
@@ -790,13 +790,13 @@ function Ce(e, t, r) {
790
790
  }
791
791
  const n = {};
792
792
  r && (n.sku = r);
793
- const s = I(e.group_skus);
793
+ const s = D(e.group_skus);
794
794
  return s.length > 0 && (n.group_skus = s), Object.keys(n).length === 0 ? null : k({
795
795
  type: "findSimilar",
796
796
  payload: z(n)
797
797
  }, t);
798
798
  }
799
- function Ie(e) {
799
+ function Le(e) {
800
800
  const t = e.payload.suggested_searches ?? [], r = [];
801
801
  for (let o = 0; o < t.length; o++) {
802
802
  const n = t[o];
@@ -817,7 +817,7 @@ function Ie(e) {
817
817
  action: f
818
818
  }, y = l(n.detailed_user_message);
819
819
  y && y !== s && (d.detailedMessage = y);
820
- const g = te(n);
820
+ const g = se(n);
821
821
  g && g !== s && g !== (y ?? "") && (d.whyDifferent = g), typeof n.image == "string" && (d.image = n.image), r.push(d);
822
822
  }
823
823
  return r.length === 0 ? {
@@ -837,7 +837,7 @@ function Ie(e) {
837
837
  }
838
838
  };
839
839
  }
840
- function De(e) {
840
+ function Oe(e) {
841
841
  const t = e.payload, r = k(t.requestDetails ?? t.request_details, l(t.review_count, t.reviewCount, t.text, t.title) ?? "Show product reviews");
842
842
  if (!r) return {
843
843
  type: "metadata",
@@ -858,7 +858,7 @@ function De(e) {
858
858
  }
859
859
  };
860
860
  }
861
- function Ne() {
861
+ function qe() {
862
862
  return {
863
863
  type: "metadata",
864
864
  sessionId: "",
@@ -866,7 +866,7 @@ function Ne() {
866
866
  meta: { analyzeAnimation: !0 }
867
867
  };
868
868
  }
869
- function Re(e) {
869
+ function ve(e) {
870
870
  return {
871
871
  type: "metadata",
872
872
  sessionId: "",
@@ -874,7 +874,7 @@ function Re(e) {
874
874
  meta: { voice: e.payload }
875
875
  };
876
876
  }
877
- function Le(e) {
877
+ function je(e) {
878
878
  const t = e.payload.group_list ?? [], r = [];
879
879
  for (const n of t) {
880
880
  const s = n.group_name ?? "", i = (n.product_list ?? []).map(S);
@@ -906,7 +906,7 @@ function Le(e) {
906
906
  panelHint: "panel"
907
907
  };
908
908
  }
909
- function qe(e) {
909
+ function Be(e) {
910
910
  return {
911
911
  type: "metadata",
912
912
  sessionId: "",
@@ -917,7 +917,7 @@ function qe(e) {
917
917
  }
918
918
  };
919
919
  }
920
- function Oe(e) {
920
+ function Me(e) {
921
921
  const t = {};
922
922
  return typeof e.payload?.summary == "string" && (t.summary = e.payload.summary), Array.isArray(e.payload?.products_discussed) && (t.products_discussed = e.payload.products_discussed), typeof e.payload?.user_sentiment == "string" && (t.user_sentiment = e.payload.user_sentiment), {
923
923
  type: "ui_spec",
@@ -931,7 +931,7 @@ function Oe(e) {
931
931
  }
932
932
  };
933
933
  }
934
- function ve(e) {
934
+ function ze(e) {
935
935
  return {
936
936
  type: "metadata",
937
937
  sessionId: "",
@@ -953,7 +953,7 @@ function q(e, t) {
953
953
  props: r
954
954
  };
955
955
  }
956
- function G(e, t) {
956
+ function V(e, t) {
957
957
  const r = {}, o = [];
958
958
  for (let n = 0; n < e.length; n++) {
959
959
  const s = e[n];
@@ -988,7 +988,7 @@ function G(e, t) {
988
988
  }
989
989
  };
990
990
  }
991
- function D(e, t) {
991
+ function N(e, t) {
992
992
  const r = {}, o = [];
993
993
  for (let n = 0; n < e.length; n++) {
994
994
  const s = e[n];
@@ -1009,7 +1009,7 @@ function D(e, t) {
1009
1009
  }
1010
1010
  };
1011
1011
  }
1012
- function je(e, t, r) {
1012
+ function He(e, t, r) {
1013
1013
  const o = /* @__PURE__ */ new Map();
1014
1014
  for (const p of t)
1015
1015
  p?.sku && o.set(p.sku, p);
@@ -1024,8 +1024,8 @@ function je(e, t, r) {
1024
1024
  const g = o.get(y);
1025
1025
  if (!g) continue;
1026
1026
  n.add(y);
1027
- const h = `product-${p}-${d}`, V = S(g);
1028
- i.push(h), f.push(h), s[h] = q(V, c), c += 1;
1027
+ const h = `product-${p}-${d}`, Y = S(g);
1028
+ i.push(h), f.push(h), s[h] = q(Y, c), c += 1;
1029
1029
  }
1030
1030
  f.length > 0 && a.push({
1031
1031
  title: u,
@@ -1048,7 +1048,7 @@ function je(e, t, r) {
1048
1048
  }
1049
1049
  });
1050
1050
  }
1051
- function Me(e, t) {
1051
+ function Ue(e, t) {
1052
1052
  const r = {}, o = [];
1053
1053
  for (let n = 0; n < e.length; n++) {
1054
1054
  const s = e[n];
@@ -1069,7 +1069,7 @@ function Me(e, t) {
1069
1069
  }
1070
1070
  };
1071
1071
  }
1072
- function ze(e, t) {
1072
+ function Ge(e, t) {
1073
1073
  return {
1074
1074
  type: "ui_spec",
1075
1075
  widget: t,
@@ -1085,7 +1085,7 @@ function ze(e, t) {
1085
1085
  }
1086
1086
  };
1087
1087
  }
1088
- function Be(e) {
1088
+ function $e(e) {
1089
1089
  return {
1090
1090
  type: "ui_spec",
1091
1091
  widget: e,
@@ -1099,11 +1099,11 @@ function Be(e) {
1099
1099
  }
1100
1100
  };
1101
1101
  }
1102
- function He(e) {
1102
+ function Fe(e) {
1103
1103
  const t = l(e.sku), r = l(e.short_name), o = { ...b(e.product_item) ?? e }, n = l(e.discount_reason, e.discountReason);
1104
- return n && !l(o.discount_reason, o.discountReason) && (o.discount_reason = n), O(o, t, r);
1104
+ return n && !l(o.discount_reason, o.discountReason) && (o.discount_reason = n), v(o, t, r);
1105
1105
  }
1106
- function O(e, t, r) {
1106
+ function v(e, t, r) {
1107
1107
  const o = l(e.sku, t), n = l(e.name, r);
1108
1108
  if (!o || !n) return null;
1109
1109
  const s = {
@@ -1113,7 +1113,7 @@ function O(e, t, r) {
1113
1113
  i && (s.brand = i);
1114
1114
  const a = l(e.url);
1115
1115
  a && (s.url = a);
1116
- const c = Ue(e.images);
1116
+ const c = Ke(e.images);
1117
1117
  if (c.length > 0) s.images = c;
1118
1118
  else {
1119
1119
  const y = l(e.image, e.image_url, e.imageUrl);
@@ -1152,10 +1152,10 @@ function l(...e) {
1152
1152
  if (r.length > 0) return r;
1153
1153
  }
1154
1154
  }
1155
- function Ue(e) {
1155
+ function Ke(e) {
1156
1156
  return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.length > 0) : [];
1157
1157
  }
1158
- function $(e) {
1158
+ function W(e) {
1159
1159
  if (typeof e == "string") {
1160
1160
  const t = e.trim();
1161
1161
  return t ? [t] : [];
@@ -1171,10 +1171,10 @@ function x(e) {
1171
1171
  if (Number.isFinite(r)) return r;
1172
1172
  }
1173
1173
  }
1174
- function P(e) {
1174
+ function E(e) {
1175
1175
  return e != null;
1176
1176
  }
1177
- var Ge = /* @__PURE__ */ new Set([
1177
+ var Ve = /* @__PURE__ */ new Set([
1178
1178
  "sku",
1179
1179
  "name",
1180
1180
  "brand",
@@ -1212,13 +1212,13 @@ function S(e) {
1212
1212
  p && (c.imageUrl = p), e.images && e.images.length > 1 && (c.images = e.images), r != null && r > 0 && (c.price = String(r)), o != null && o > 0 && (c.originalPrice = String(o)), n !== void 0 && (c.discountPercent = n), s !== void 0 && (c.brand = s), e.rating !== void 0 && (c.rating = e.rating), e.review_count !== void 0 && (c.reviewCount = e.review_count), e.cart_code !== void 0 && (c.cartCode = e.cart_code), e.in_stock !== void 0 && (c.inStock = e.in_stock), e.variants && e.variants.length > 0 && (c.variants = e.variants), e.discount_reason !== void 0 && (c.discountReason = e.discount_reason), e.promotions && e.promotions.length > 0 && (c.promotions = e.promotions), e.description !== void 0 && (c.description = e.description), e.description_html !== void 0 && (c.descriptionHtml = e.description_html), e.features && e.features.length > 0 && (c.features = e.features), e.specifications !== void 0 && (c.specifications = e.specifications), e.facet_hits && (c.facetHits = e.facet_hits), e.category_names && e.category_names.length > 0 && (c.categoryNames = e.category_names), e.short_name !== void 0 && (c.shortName = e.short_name);
1213
1213
  const _ = e, u = {};
1214
1214
  let m = !1;
1215
- for (const f of Object.keys(_)) Ge.has(f) || (u[f] = _[f], m = !0);
1215
+ for (const f of Object.keys(_)) Ve.has(f) || (u[f] = _[f], m = !0);
1216
1216
  return m && (c.extras = u), c;
1217
1217
  }
1218
- function _t(e) {
1218
+ function kt(e) {
1219
1219
  return e.results.map(S);
1220
1220
  }
1221
- function ht(e) {
1221
+ function At(e) {
1222
1222
  return e.product_groupings.map((t) => {
1223
1223
  const r = {
1224
1224
  name: t.name,
@@ -1227,7 +1227,7 @@ function ht(e) {
1227
1227
  return t.highlight !== void 0 && (r.highlight = t.highlight), r;
1228
1228
  });
1229
1229
  }
1230
- function $e(e) {
1230
+ function We(e) {
1231
1231
  const t = e.payload.type, { type: r, ...o } = e.payload;
1232
1232
  return {
1233
1233
  type: "ui_spec",
@@ -1241,142 +1241,165 @@ function $e(e) {
1241
1241
  }
1242
1242
  };
1243
1243
  }
1244
- var Fe = {
1244
+ var Je = {
1245
1245
  process_action: "/process_action",
1246
1246
  launcher_action: "/launcher_action",
1247
1247
  similar_products: "/similar_products",
1248
1248
  product_groupings: "/product_groupings"
1249
1249
  };
1250
- function Ke(e) {
1250
+ function Qe(e) {
1251
1251
  if (e === void 0) throw new Error("[gengage] middlewareUrl is required. Pass your Gengage backend URL in widget config.");
1252
1252
  const t = e.trim();
1253
1253
  return t === "" ? "" : t.replace(/\/+$/, "");
1254
1254
  }
1255
- function bt(e, t) {
1256
- return `${Ke(t?.middlewareUrl)}/chat${Fe[e]}`;
1255
+ function wt(e, t) {
1256
+ return `${Qe(t?.middlewareUrl)}/chat${Je[e]}`;
1257
1257
  }
1258
- var Ve = 7200 * 1e3, F = 200, We = 5 * 1024 * 1024, Je = "gengage_request_response_cache", Qe = 1, w = "responses", Ye = /* @__PURE__ */ new Set(["addToCart", "like"]), A = /* @__PURE__ */ new Map(), B = null;
1259
- async function kt(e, t = {}, r = {}) {
1260
- const o = Xe(e, t);
1258
+ var Ye = 7200 * 1e3, J = 200, Xe = 5 * 1024 * 1024, Ze = "gengage_request_response_cache", et = 1, w = "responses", tt = /* @__PURE__ */ new Set(["addToCart", "like"]), A = /* @__PURE__ */ new Map(), H = null;
1259
+ async function St(e, t = {}, r = {}) {
1260
+ const o = rt(e, t);
1261
1261
  if (!o) return fetch(e, t);
1262
- const n = Date.now(), s = await et(o, n);
1263
- if (s) return ot(s);
1262
+ const n = Date.now(), s = await it(o, n);
1263
+ if (s) return ut(s);
1264
1264
  const i = await fetch(e, t);
1265
- return i.ok && tt(o, i.clone(), n, {
1266
- ttlMs: r.ttlMs ?? Ve,
1267
- maxEntries: r.maxEntries ?? F,
1268
- maxBodyBytes: r.maxBodyBytes ?? We
1265
+ return i.ok && at(o, i.clone(), n, {
1266
+ ttlMs: r.ttlMs ?? Ye,
1267
+ maxEntries: r.maxEntries ?? J,
1268
+ maxBodyBytes: r.maxBodyBytes ?? Xe
1269
1269
  }), i;
1270
1270
  }
1271
- function Xe(e, t = {}) {
1271
+ function rt(e, t = {}) {
1272
1272
  if (typeof Request < "u" && e instanceof Request) return null;
1273
1273
  const r = String(t.method || "GET").toUpperCase();
1274
- return r !== "POST" || typeof t.body != "string" || Ze(t.body) ? null : `rr:${dt(ut({
1274
+ if (r !== "POST" || typeof t.body != "string") return null;
1275
+ const o = ot(t.body);
1276
+ if (nt(o)) return null;
1277
+ const n = st(o);
1278
+ if (n) {
1279
+ const s = P(o?.action);
1280
+ return `rr:${$(G({
1281
+ url: String(e),
1282
+ method: r,
1283
+ headers: U(t.headers),
1284
+ type: o?.type ?? s?.type ?? "",
1285
+ account_id: o?.account_id ?? o?.accountId ?? "",
1286
+ locale: o?.locale ?? "",
1287
+ outputLanguage: P(o?.meta)?.outputLanguage ?? "",
1288
+ cache_key: n
1289
+ }))}`;
1290
+ }
1291
+ return `rr:${$(G({
1275
1292
  url: String(e),
1276
1293
  method: r,
1277
- headers: nt(t.headers),
1294
+ headers: U(t.headers),
1278
1295
  body: t.body
1279
1296
  }))}`;
1280
1297
  }
1281
- function Ze(e) {
1298
+ function ot(e) {
1282
1299
  try {
1283
1300
  const t = JSON.parse(e);
1284
- if (!t || typeof t != "object" || Array.isArray(t)) return !1;
1285
- const r = t.type;
1286
- return typeof r == "string" && Ye.has(r);
1301
+ return !t || typeof t != "object" || Array.isArray(t) ? null : t;
1287
1302
  } catch {
1288
- return !1;
1303
+ return null;
1289
1304
  }
1290
1305
  }
1291
- async function et(e, t) {
1306
+ function nt(e) {
1307
+ const t = e?.type;
1308
+ return typeof t == "string" && tt.has(t);
1309
+ }
1310
+ function st(e) {
1311
+ const t = (P(e?.payload) ?? P(P(e?.action)?.payload))?.cache_key;
1312
+ return typeof t == "string" && t.trim().length > 0 ? t.trim() : null;
1313
+ }
1314
+ async function it(e, t) {
1292
1315
  const r = A.get(e);
1293
1316
  if (r) if (r.expiresAt <= t) A.delete(e);
1294
1317
  else
1295
- return r.lastAccessedAt = t, A.delete(e), A.set(e, r), N(r), r;
1296
- const o = await it(e);
1297
- return o ? o.expiresAt <= t ? (A.delete(e), at(e), null) : (o.lastAccessedAt = t, A.set(e, o), N(o), K(F), o) : null;
1318
+ return r.lastAccessedAt = t, A.delete(e), A.set(e, r), R(r), r;
1319
+ const o = await lt(e);
1320
+ return o ? o.expiresAt <= t ? (A.delete(e), pt(e), null) : (o.lastAccessedAt = t, A.set(e, o), R(o), Q(J), o) : null;
1298
1321
  }
1299
- async function tt(e, t, r, o) {
1322
+ async function at(e, t, r, o) {
1300
1323
  try {
1301
1324
  const n = await t.text();
1302
- if (lt(n) > o.maxBodyBytes || rt(n)) return;
1325
+ if (yt(n) > o.maxBodyBytes || ct(n)) return;
1303
1326
  const s = {
1304
1327
  key: e,
1305
1328
  status: t.status,
1306
1329
  statusText: t.statusText,
1307
- headers: st(t.headers),
1330
+ headers: dt(t.headers),
1308
1331
  body: n,
1309
1332
  createdAt: r,
1310
1333
  expiresAt: r + o.ttlMs,
1311
1334
  lastAccessedAt: r
1312
1335
  };
1313
- A.set(e, s), K(o.maxEntries), await N(s), await ct(o.maxEntries, r);
1336
+ A.set(e, s), Q(o.maxEntries), await R(s), await ft(o.maxEntries, r);
1314
1337
  } catch {
1315
1338
  }
1316
1339
  }
1317
- function rt(e) {
1340
+ function ct(e) {
1318
1341
  return /"_error"\s*:/u.test(e) || /"type"\s*:\s*"error"/u.test(e);
1319
1342
  }
1320
- function ot(e) {
1343
+ function ut(e) {
1321
1344
  return new Response(e.body, {
1322
1345
  status: e.status,
1323
1346
  statusText: e.statusText,
1324
1347
  headers: new Headers(e.headers)
1325
1348
  });
1326
1349
  }
1327
- function nt(e) {
1350
+ function U(e) {
1328
1351
  const t = new Headers(e), r = [];
1329
1352
  return t.forEach((o, n) => {
1330
1353
  const s = n.toLowerCase();
1331
1354
  s !== "authorization" && s !== "cookie" && r.push([s, o]);
1332
1355
  }), r.sort(([o], [n]) => o.localeCompare(n));
1333
1356
  }
1334
- function st(e) {
1357
+ function dt(e) {
1335
1358
  const t = [];
1336
1359
  return e.forEach((r, o) => {
1337
1360
  const n = o.toLowerCase();
1338
1361
  n !== "set-cookie" && t.push([n, r]);
1339
1362
  }), t.sort(([r], [o]) => r.localeCompare(o));
1340
1363
  }
1341
- function K(e) {
1364
+ function Q(e) {
1342
1365
  for (; A.size > e; ) {
1343
1366
  const t = [...A.values()].sort((r, o) => r.lastAccessedAt - o.lastAccessedAt)[0];
1344
1367
  if (!t) break;
1345
1368
  A.delete(t.key);
1346
1369
  }
1347
1370
  }
1348
- async function E() {
1349
- return typeof indexedDB > "u" ? null : (B ??= new Promise((e) => {
1350
- const t = indexedDB.open(Je, Qe);
1371
+ async function T() {
1372
+ return typeof indexedDB > "u" ? null : (H ??= new Promise((e) => {
1373
+ const t = indexedDB.open(Ze, et);
1351
1374
  t.onupgradeneeded = () => {
1352
1375
  const r = t.result;
1353
1376
  r.objectStoreNames.contains(w) || r.createObjectStore(w, { keyPath: "key" }).createIndex("lastAccessedAt", "lastAccessedAt", { unique: !1 });
1354
1377
  }, t.onsuccess = () => e(t.result), t.onerror = () => e(null), t.onblocked = () => e(null);
1355
- }), B);
1378
+ }), H);
1356
1379
  }
1357
- async function it(e) {
1358
- const t = await E();
1380
+ async function lt(e) {
1381
+ const t = await T();
1359
1382
  return t ? new Promise((r) => {
1360
1383
  const o = t.transaction(w, "readonly"), n = o.objectStore(w).get(e);
1361
1384
  n.onsuccess = () => r(n.result ?? null), n.onerror = () => r(null), o.onerror = () => r(null);
1362
1385
  }) : null;
1363
1386
  }
1364
- async function N(e) {
1365
- const t = await E();
1387
+ async function R(e) {
1388
+ const t = await T();
1366
1389
  t && await new Promise((r) => {
1367
1390
  const o = t.transaction(w, "readwrite");
1368
1391
  o.objectStore(w).put(e), o.oncomplete = () => r(), o.onerror = () => r(), o.onabort = () => r();
1369
1392
  });
1370
1393
  }
1371
- async function at(e) {
1372
- const t = await E();
1394
+ async function pt(e) {
1395
+ const t = await T();
1373
1396
  t && await new Promise((r) => {
1374
1397
  const o = t.transaction(w, "readwrite");
1375
1398
  o.objectStore(w).delete(e), o.oncomplete = () => r(), o.onerror = () => r(), o.onabort = () => r();
1376
1399
  });
1377
1400
  }
1378
- async function ct(e, t) {
1379
- const r = await E();
1401
+ async function ft(e, t) {
1402
+ const r = await T();
1380
1403
  r && await new Promise((o) => {
1381
1404
  const n = r.transaction(w, "readwrite"), s = n.objectStore(w), i = [], a = s.openCursor();
1382
1405
  a.onsuccess = () => {
@@ -1390,37 +1413,40 @@ async function ct(e, t) {
1390
1413
  }, a.onerror = () => o(), n.oncomplete = () => o(), n.onerror = () => o(), n.onabort = () => o();
1391
1414
  });
1392
1415
  }
1393
- function ut(e) {
1394
- return JSON.stringify(R(e));
1416
+ function G(e) {
1417
+ return JSON.stringify(L(e));
1395
1418
  }
1396
- function R(e) {
1397
- return Array.isArray(e) ? e.map(R) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => [t, R(r)]));
1419
+ function P(e) {
1420
+ return e && typeof e == "object" && !Array.isArray(e) ? e : null;
1398
1421
  }
1399
- function dt(e) {
1422
+ function L(e) {
1423
+ return Array.isArray(e) ? e.map(L) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => [t, L(r)]));
1424
+ }
1425
+ function $(e) {
1400
1426
  let t = 14695981039346656037n;
1401
1427
  const r = 1099511628211n;
1402
1428
  for (let o = 0; o < e.length; o += 1)
1403
1429
  t ^= BigInt(e.charCodeAt(o)), t = BigInt.asUintN(64, t * r);
1404
1430
  return t.toString(16).padStart(16, "0");
1405
1431
  }
1406
- function lt(e) {
1432
+ function yt(e) {
1407
1433
  return typeof TextEncoder < "u" ? new TextEncoder().encode(e).byteLength : e.length;
1408
1434
  }
1409
1435
  export {
1410
- ht as a,
1436
+ At as a,
1411
1437
  z as c,
1412
- te as d,
1413
- Y as f,
1414
- ft as g,
1415
- J as h,
1416
- mt as i,
1417
- re as l,
1418
- yt as m,
1419
- bt as n,
1420
- _t as o,
1421
- gt as p,
1422
- Ke as r,
1438
+ se as d,
1439
+ te as f,
1440
+ mt as g,
1441
+ Z as h,
1442
+ bt as i,
1443
+ ie as l,
1444
+ _t as m,
1445
+ wt as n,
1446
+ kt as o,
1447
+ ht as p,
1448
+ Qe as r,
1423
1449
  S as s,
1424
- kt as t,
1425
- ee as u
1450
+ St as t,
1451
+ ne as u
1426
1452
  };