@askdialog/dialog-vue 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,33 @@
1
- var se = Object.defineProperty;
2
- var re = (t, e, o) => e in t ? se(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var K = (t, e, o) => re(t, typeof e != "symbol" ? e + "" : e, o);
4
- import { defineComponent as y, createElementBlock as v, openBlock as p, createElementVNode as l, toDisplayString as I, Fragment as x, renderList as X, createVNode as D, createBlock as M, ref as A, withDirectives as Z, withKeys as ie, vModelText as J, onMounted as H, watch as q, renderSlot as ae, computed as T, withCtx as ce, createCommentVNode as N, withModifiers as le, createTextVNode as ue, onUnmounted as ee, Teleport as de, normalizeStyle as pe, unref as B, shallowRef as _e } from "vue";
5
- const he = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur"]), fe = (t) => t !== void 0 && he.has(t.trim().toLowerCase().slice(0, 2)), ge = (t) => fe(t) ? "rtl" : "ltr";
6
- var U;
1
+ var re = Object.defineProperty;
2
+ var ie = (t, e, o) => e in t ? re(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var F = (t, e, o) => ie(t, typeof e != "symbol" ? e + "" : e, o);
4
+ import { defineComponent as w, createElementBlock as m, openBlock as _, createElementVNode as d, toDisplayString as R, Fragment as O, renderList as Z, createVNode as A, createBlock as x, ref as y, withDirectives as J, withKeys as ae, vModelText as ee, onMounted as K, watch as U, renderSlot as ce, computed as T, withCtx as le, createCommentVNode as M, withModifiers as de, onUnmounted as te, Teleport as ue, normalizeStyle as pe, unref as V, shallowRef as _e } from "vue";
5
+ const he = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur"]), fe = (t) => t !== void 0 && he.has(t.trim().toLowerCase().slice(0, 2)), ge = (t) => fe(t) ? "rtl" : "ltr", ve = (t) => {
6
+ try {
7
+ return new Intl.Locale(t).language;
8
+ } catch {
9
+ return t;
10
+ }
11
+ };
12
+ var N;
7
13
  (function(t) {
8
14
  t.OPEN_ASSISTANT = "open_assistant", t.CLOSE_ASSISTANT = "close_assistant", t.SEND_MESSAGE = "PRODUCT_QUESTION", t.SEND_GENERIC_QUESTION = "GENERIC_QUESTION", t.TRACK_ADD_TO_CART = "TRACK_ADD_TO_CART", t.TRACK_SUBMIT_CHECKOUT = "TRACK_SUBMIT_CHECKOUT", t.TRACK_VIEW_SEARCH_RESULTS = "TRACK_VIEW_SEARCH_RESULTS", t.TRACK_SELECT_SEARCH_RESULT = "TRACK_SELECT_SEARCH_RESULT";
9
- })(U || (U = {}));
10
- var G;
15
+ })(N || (N = {}));
16
+ var j;
11
17
  (function(t) {
12
18
  t.USER_OPENED_ASSISTANT = "userOpenedAssistant", t.USER_CLOSED_ASSISTANT = "userClosedAssistant", t.USER_SENT_MESSAGE = "userSentMessage", t.USER_CLICKED_ON_PRODUCT_CARD = "userClickedOnProductCard", t.USER_OPENED_RECOMMENDATION = "userOpenedRecommendation", t.USER_ADDED_TO_CART = "userAddedToCart", t.USER_SEND_POSITIVE_FEEDBACK = "userSendPositiveFeedback", t.USER_SEND_NEGATIVE_FEEDBACK = "userSendNegativeFeedback";
13
- })(G || (G = {}));
14
- U.TRACK_ADD_TO_CART, U.TRACK_SUBMIT_CHECKOUT, U.TRACK_VIEW_SEARCH_RESULTS, U.TRACK_SELECT_SEARCH_RESULT;
15
- class ve extends Error {
19
+ })(j || (j = {}));
20
+ N.TRACK_ADD_TO_CART, N.TRACK_SUBMIT_CHECKOUT, N.TRACK_VIEW_SEARCH_RESULTS, N.TRACK_SELECT_SEARCH_RESULT;
21
+ class me extends Error {
16
22
  constructor({ status: o, code: n, message: a }) {
17
23
  super(a);
18
- K(this, "status");
19
- K(this, "code");
24
+ F(this, "status");
25
+ F(this, "code");
20
26
  this.name = "DialogSearchError", this.status = o, this.code = n;
21
27
  }
22
28
  }
23
- const Q = "multiple installation methods detected:", me = () => typeof window > "u" ? void 0 : window, te = () => {
24
- const t = me();
29
+ const Se = (t, e) => `${t}_${ve(e)}`, Q = "multiple installation methods detected:", Ce = () => typeof window > "u" ? void 0 : window, oe = () => {
30
+ const t = Ce();
25
31
  if (t !== void 0)
26
32
  return t.dialog = t.dialog ?? {}, t.dialog.audit = t.dialog.audit ?? {
27
33
  methods: [],
@@ -29,109 +35,107 @@ const Q = "multiple installation methods detected:", me = () => typeof window >
29
35
  capabilities: [],
30
36
  warnings: []
31
37
  }, t.dialog.audit;
32
- }, Se = (t) => {
38
+ }, be = (t) => {
33
39
  if (t.warnings = t.warnings.filter((e) => !e.startsWith(Q)), t.methods.length >= 2) {
34
40
  const e = t.methods.map((o) => o.method).join(", ");
35
41
  t.warnings.push(`${Q} ${e}`);
36
42
  }
37
- }, Ce = (t, e) => e === void 0 ? t : {
43
+ }, Ee = (t, e) => e === void 0 ? t : {
38
44
  version: (t == null ? void 0 : t.version) ?? e.version,
39
45
  commit: (t == null ? void 0 : t.commit) ?? e.commit
40
- }, oe = (t) => {
41
- const e = te();
46
+ }, ne = (t) => {
47
+ const e = oe();
42
48
  if (e === void 0)
43
49
  return;
44
50
  const o = e.methods.find((n) => n.method === t.method);
45
51
  if (o === void 0) {
46
- e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), Se(e);
52
+ e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), be(e);
47
53
  return;
48
54
  }
49
- o.version = o.version ?? t.version, o.build = Ce(o.build, t.build), o.source = o.source ?? t.source;
50
- }, be = (t) => {
51
- const e = te();
55
+ o.version = o.version ?? t.version, o.build = Ee(o.build, t.build), o.source = o.source ?? t.source;
56
+ }, Ie = (t) => {
57
+ const e = oe();
52
58
  e !== void 0 && (e.capabilities.includes(t) || e.capabilities.push(t));
53
- }, w = {
59
+ }, k = {
54
60
  IDLE: "idle",
55
61
  LOADING: "loading",
56
62
  SUCCESS: "success",
57
63
  /** The request succeeded with zero hits — distinct from `success` so views render a no-results state. */
58
64
  EMPTY: "empty",
59
65
  ERROR: "error"
60
- }, Ee = 0.5, Re = 500, Te = 1500, ye = 100;
61
- function Ie({ emit: t, visibilityThreshold: e = Ee, dwellMs: o = Re, idleFlushMs: n = Te, maxItemsPerEvent: a = ye }) {
62
- let r, i = [];
63
- const s = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
66
+ }, we = 0.5, Te = 500, Re = 1500, ke = 100;
67
+ function ye({ emit: t, visibilityThreshold: e = we, dwellMs: o = Te, idleFlushMs: n = Re, maxItemsPerEvent: a = ke }) {
68
+ let s, r = [];
69
+ const i = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
64
70
  let u;
65
- const d = () => {
66
- clearTimeout(u), !(r === void 0 || i.length === 0) && (t({ ...r, items: i }), i = []);
67
- }, S = (h) => {
68
- if (r === void 0)
71
+ const p = () => {
72
+ clearTimeout(u), !(s === void 0 || r.length === 0) && (t({ ...s, items: r }), r = []);
73
+ }, S = (f) => {
74
+ if (s === void 0)
69
75
  return;
70
- const C = `${r.query_id}:${h.product_id}`;
71
- if (!s.has(C)) {
72
- if (s.add(C), i.push(h), i.length >= a) {
73
- d();
76
+ const C = `${s.query_id}:${f.product_id}`;
77
+ if (!i.has(C)) {
78
+ if (i.add(C), r.push(f), r.length >= a) {
79
+ p();
74
80
  return;
75
81
  }
76
- clearTimeout(u), u = setTimeout(d, n);
82
+ clearTimeout(u), u = setTimeout(p, n);
77
83
  }
78
- }, E = (h) => {
79
- const C = f.get(h);
80
- C !== void 0 && (clearTimeout(C), f.delete(h));
81
- }, c = new IntersectionObserver((h) => {
82
- for (const C of h) {
83
- const g = _.get(C.target);
84
- g !== void 0 && (C.intersectionRatio >= e ? f.has(C.target) || f.set(C.target, setTimeout(() => {
85
- f.delete(C.target), S(g);
84
+ }, E = (f) => {
85
+ const C = h.get(f);
86
+ C !== void 0 && (clearTimeout(C), h.delete(f));
87
+ }, c = new IntersectionObserver((f) => {
88
+ for (const C of f) {
89
+ const g = l.get(C.target);
90
+ g !== void 0 && (C.intersectionRatio >= e ? h.has(C.target) || h.set(C.target, setTimeout(() => {
91
+ h.delete(C.target), S(g);
86
92
  }, o)) : E(C.target));
87
93
  }
88
94
  }, { threshold: e }), b = () => {
89
95
  c.disconnect();
90
- for (const h of f.values())
91
- clearTimeout(h);
92
- f.clear(), _.clear();
93
- }, R = () => {
94
- d();
95
- }, L = (h) => {
96
- if (h.persisted) {
97
- s.clear();
98
- for (const C of _.keys())
96
+ for (const f of h.values())
97
+ clearTimeout(f);
98
+ h.clear(), l.clear();
99
+ }, I = () => {
100
+ p();
101
+ }, L = (f) => {
102
+ if (f.persisted) {
103
+ i.clear();
104
+ for (const C of l.keys())
99
105
  E(C), c.unobserve(C), c.observe(C);
100
106
  }
101
107
  };
102
- return window.addEventListener("pagehide", R), window.addEventListener("pageshow", L), {
103
- setContext(h) {
104
- d(), r !== void 0 && r.query_id !== h.query_id && s.clear(), r = h, b();
108
+ return window.addEventListener("pagehide", I), window.addEventListener("pageshow", L), {
109
+ setContext(f) {
110
+ p(), i.clear(), s = f, b();
105
111
  },
106
- observe(h, C) {
107
- _.set(h, C), c.observe(h);
112
+ observe(f, C) {
113
+ l.set(f, C), c.observe(f);
108
114
  },
109
- forceImpression(h) {
110
- S(h), d();
115
+ forceImpression(f) {
116
+ S(f), p();
111
117
  },
112
- flush: d,
118
+ flush: p,
113
119
  disconnect() {
114
- d(), b(), window.removeEventListener("pagehide", R), window.removeEventListener("pageshow", L);
120
+ p(), b(), window.removeEventListener("pagehide", I), window.removeEventListener("pageshow", L);
115
121
  }
116
122
  };
117
123
  }
118
- const j = (t, e) => ({
119
- product_id: t.hits[e].product.id,
124
+ const W = (t, e) => ({
125
+ product_id: t.hits[e].objectID,
120
126
  // 1-based and absolute across pages (page 2, first item, 20/page → 21).
121
127
  position: t.page * t.hitsPerPage + e + 1
122
128
  });
123
- function ke(t) {
129
+ function Le(t) {
124
130
  let e, o;
125
- const n = () => (e ?? (e = Ie({
131
+ const n = () => (e ?? (e = ye({
126
132
  emit: t.trackViewSearchResults
127
133
  })), e);
128
134
  return {
129
135
  onResponse(a) {
130
136
  o = {
131
- // Straight off the response: the controller resends the previous
132
- // queryId while the query text is unchanged, so the id is stable
133
- // across pagination and rotates with the query.
134
- query_id: a.queryId,
137
+ query_id: a.queryID,
138
+ index: a.index,
135
139
  surface: t.surface,
136
140
  // The storefront search API is lexical-only today.
137
141
  search_type: "lexical",
@@ -141,117 +145,118 @@ function ke(t) {
141
145
  query_length: [...a.query].length
142
146
  }, n().setContext(o), a.nbHits === 0 && t.trackViewSearchResults({ ...o, items: [] });
143
147
  },
144
- observeResult(a, r, i) {
145
- n().observe(a, j(r, i));
148
+ observeResult(a, s, r) {
149
+ n().observe(a, W(s, r));
146
150
  },
147
- select(a, r) {
151
+ select(a, s) {
148
152
  if (o === void 0)
149
153
  return;
150
- const i = j(a, r);
151
- n().forceImpression(i), t.trackSelectSearchResult({ ...o, items: [i] });
154
+ const r = W(a, s);
155
+ n().forceImpression(r), t.trackSelectSearchResult({ ...o, items: [r] });
152
156
  },
153
157
  dispose() {
154
158
  e == null || e.disconnect();
155
159
  }
156
160
  };
157
161
  }
158
- const we = 250, Ae = 12, Le = 2, W = {
159
- status: w.IDLE,
162
+ const Ae = 250, $e = 12, De = 2, Y = {
163
+ status: k.IDLE,
160
164
  query: "",
161
165
  page: 0,
162
166
  response: void 0,
163
167
  error: void 0
164
168
  };
165
- function $e({ search: t, analytics: e, navigate: o, debounceMs: n = we, hitsPerPage: a = Ae, locale: r, countryCode: i }) {
166
- let s = W;
167
- const _ = /* @__PURE__ */ new Set(), f = ke(e);
168
- let u, d, S, E = 0, c = !1;
169
+ function Pe({ search: t, analytics: e, navigate: o, debounceMs: n = Ae, hitsPerPage: a = $e, locale: s }) {
170
+ const r = Se("products", s);
171
+ let i = Y;
172
+ const l = /* @__PURE__ */ new Set(), h = Le(e);
173
+ let u, p, S, E = 0, c = !1;
169
174
  const b = (g) => {
170
- s = { ...s, ...g };
171
- for (const m of _)
172
- m(s);
173
- }, R = () => {
175
+ i = { ...i, ...g };
176
+ for (const v of l)
177
+ v(i);
178
+ }, I = () => {
174
179
  clearTimeout(u), S == null || S.abort(), S = void 0;
175
- }, L = (g, m) => {
176
- const k = { query: g, page: m, hitsPerPage: a };
177
- r !== void 0 && (k.locale = r), i !== void 0 && (k.countryCode = i);
178
- const $ = s.response;
179
- return ($ == null ? void 0 : $.query) === g && (k.queryId = $.queryId), k;
180
- }, h = async (g, m) => {
181
- R(), S = new AbortController();
182
- const k = ++E, $ = L(g, m);
183
- b({ status: w.LOADING, query: g, page: m });
180
+ }, L = (g, v) => ({
181
+ requests: [{ indexName: r, query: g, page: v, hitsPerPage: a }]
182
+ }), f = async (g, v) => {
183
+ I(), S = new AbortController();
184
+ const $ = ++E, q = L(g, v);
185
+ b({ status: k.LOADING, query: g, page: v });
184
186
  try {
185
- const P = await t($, {
187
+ const P = await t(q, {
186
188
  signal: S.signal
187
189
  });
188
- if (k !== E)
190
+ if ($ !== E)
189
191
  return;
190
- f.onResponse(P), b({
191
- status: P.nbHits === 0 ? w.EMPTY : w.SUCCESS,
192
- response: P,
192
+ const B = P.results.find((se) => se.index === r);
193
+ if (B === void 0)
194
+ throw new Error(`Dialog search returned no ${r} entry`);
195
+ h.onResponse(B), b({
196
+ status: B.nbHits === 0 ? k.EMPTY : k.SUCCESS,
197
+ response: B,
193
198
  error: void 0
194
199
  });
195
200
  } catch (P) {
196
- if (P instanceof DOMException && P.name === "AbortError" || k !== E)
201
+ if (P instanceof DOMException && P.name === "AbortError" || $ !== E)
197
202
  return;
198
- b({ status: w.ERROR, error: P, response: void 0 });
203
+ b({ status: k.ERROR, error: P, response: void 0 });
199
204
  }
200
205
  }, C = (g) => {
201
- const m = g.trim();
202
- if (R(), d = void 0, [...m].length < Le) {
203
- E += 1, b(W);
206
+ const v = g.trim();
207
+ if (I(), p = void 0, [...v].length < De) {
208
+ E += 1, b(Y);
204
209
  return;
205
210
  }
206
- return m;
211
+ return v;
207
212
  };
208
213
  return {
209
214
  setQuery(g) {
210
- const m = c ? void 0 : C(g);
211
- m !== void 0 && (d = m, u = setTimeout(() => {
212
- d = void 0, h(m, 0);
215
+ const v = c ? void 0 : C(g);
216
+ v !== void 0 && (p = v, u = setTimeout(() => {
217
+ p = void 0, f(v, 0);
213
218
  }, n));
214
219
  },
215
220
  submit(g) {
216
- const m = c ? void 0 : C(g);
217
- m !== void 0 && h(m, 0);
221
+ const v = c ? void 0 : C(g);
222
+ v !== void 0 && f(v, 0);
218
223
  },
219
224
  setPage(g) {
220
225
  if (!c) {
221
- if (d !== void 0) {
222
- const m = d;
223
- d = void 0, h(m, 0);
226
+ if (p !== void 0) {
227
+ const v = p;
228
+ p = void 0, f(v, 0);
224
229
  return;
225
230
  }
226
- s.query !== "" && h(s.query, g);
231
+ i.query !== "" && f(i.query, g);
227
232
  }
228
233
  },
229
234
  retry() {
230
- c || s.status !== w.ERROR || h(s.query, s.page);
235
+ c || i.status !== k.ERROR || f(i.query, i.page);
231
236
  },
232
- observeResult(g, m) {
233
- s.response !== void 0 && f.observeResult(g, s.response, m);
237
+ observeResult(g, v) {
238
+ i.response !== void 0 && h.observeResult(g, i.response, v);
234
239
  },
235
- selectResult(g, m) {
236
- const k = s.response;
237
- if (k === void 0)
240
+ selectResult(g, v) {
241
+ const $ = i.response;
242
+ if ($ === void 0)
238
243
  return !1;
239
- f.select(k, g);
240
- const $ = k.hits[g].product.url;
241
- return ((m == null ? void 0 : m.navigate) ?? !0) && o !== void 0 && $ !== void 0 ? (o($, k.hits[g]), !0) : !1;
244
+ h.select($, g);
245
+ const q = $.hits[g].url;
246
+ return ((v == null ? void 0 : v.navigate) ?? !0) && o !== void 0 && q !== void 0 ? (o(q, $.hits[g]), !0) : !1;
242
247
  },
243
248
  subscribe(g) {
244
- return _.add(g), () => {
245
- _.delete(g);
249
+ return l.add(g), () => {
250
+ l.delete(g);
246
251
  };
247
252
  },
248
- getState: () => s,
253
+ getState: () => i,
249
254
  dispose() {
250
- c = !0, R(), E += 1, d = void 0, _.clear(), f.dispose();
255
+ c = !0, I(), E += 1, p = void 0, l.clear(), h.dispose();
251
256
  }
252
257
  };
253
258
  }
254
- const De = { class: "dialog-block-header-container" }, Pe = { class: "dialog-block-title" }, Ne = { class: "dialog-block-description" }, Oe = /* @__PURE__ */ y({
259
+ const Ne = { class: "dialog-block-header-container" }, Oe = { class: "dialog-block-title" }, xe = { class: "dialog-block-description" }, Ue = /* @__PURE__ */ w({
255
260
  __name: "DialogBlockHeader",
256
261
  props: {
257
262
  title: {},
@@ -259,32 +264,32 @@ const De = { class: "dialog-block-header-container" }, Pe = { class: "dialog-blo
259
264
  },
260
265
  setup(t) {
261
266
  const e = t;
262
- return (o, n) => (p(), v("div", De, [
263
- l("div", Pe, I(e.title ?? "Your expert"), 1),
264
- l("div", Ne, I(e.description ?? "A question about this product?"), 1)
267
+ return (o, n) => (_(), m("div", Ne, [
268
+ d("div", Oe, R(e.title ?? "Your expert"), 1),
269
+ d("div", xe, R(e.description ?? "A question about this product?"), 1)
265
270
  ]));
266
271
  }
267
- }), O = (t, e) => {
272
+ }), D = (t, e) => {
268
273
  const o = t.__vccOpts || t;
269
274
  for (const [n, a] of e)
270
275
  o[n] = a;
271
276
  return o;
272
- }, Ue = /* @__PURE__ */ O(Oe, [["__scopeId", "data-v-28e6dda7"]]), xe = {
277
+ }, Me = /* @__PURE__ */ D(Ue, [["__scopeId", "data-v-28e6dda7"]]), qe = {
273
278
  width: "20",
274
279
  height: "20",
275
280
  viewBox: "0 0 20 20",
276
281
  fill: "none",
277
282
  xmlns: "http://www.w3.org/2000/svg"
278
- }, Me = { "clip-path": "url(#clip0_466_934)" }, qe = ["stroke"], Be = ["stroke"], Ve = /* @__PURE__ */ y({
283
+ }, Be = { "clip-path": "url(#clip0_466_934)" }, Ve = ["stroke"], He = ["stroke"], Ke = /* @__PURE__ */ w({
279
284
  __name: "AiStarsIcon",
280
285
  props: {
281
286
  color: {}
282
287
  },
283
288
  setup(t) {
284
289
  const e = t;
285
- return (o, n) => (p(), v("svg", xe, [
286
- l("g", Me, [
287
- l("path", {
290
+ return (o, n) => (_(), m("svg", qe, [
291
+ d("g", Be, [
292
+ d("path", {
288
293
  d: `M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
289
294
  12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
290
295
  13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
@@ -299,8 +304,8 @@ const De = { class: "dialog-block-header-container" }, Pe = { class: "dialog-blo
299
304
  "stroke-width": "1.5",
300
305
  "stroke-linecap": "round",
301
306
  "stroke-linejoin": "round"
302
- }, null, 8, qe),
303
- l("path", {
307
+ }, null, 8, Ve),
308
+ d("path", {
304
309
  d: `M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
305
310
  5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
306
311
  6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
@@ -315,11 +320,11 @@ const De = { class: "dialog-block-header-container" }, Pe = { class: "dialog-blo
315
320
  "stroke-width": "1.5",
316
321
  "stroke-linecap": "round",
317
322
  "stroke-linejoin": "round"
318
- }, null, 8, Be)
323
+ }, null, 8, He)
319
324
  ]),
320
- n[0] || (n[0] = l("defs", null, [
321
- l("clipPath", { id: "clip0_466_934" }, [
322
- l("rect", {
325
+ n[0] || (n[0] = d("defs", null, [
326
+ d("clipPath", { id: "clip0_466_934" }, [
327
+ d("rect", {
323
328
  width: "20",
324
329
  height: "20",
325
330
  fill: "white"
@@ -328,7 +333,7 @@ const De = { class: "dialog-block-header-container" }, Pe = { class: "dialog-blo
328
333
  ], -1))
329
334
  ]));
330
335
  }
331
- }), He = ["onClick"], Ke = { class: "dialog-block-suggestions-item-label" }, Fe = /* @__PURE__ */ y({
336
+ }), Fe = ["onClick"], Ge = { class: "dialog-block-suggestions-item-label" }, je = /* @__PURE__ */ w({
332
337
  __name: "DialogBlockSuggestions",
333
338
  props: {
334
339
  client: {},
@@ -347,27 +352,27 @@ const De = { class: "dialog-block-header-container" }, Pe = { class: "dialog-blo
347
352
  fromQuestionSuggestion: !0
348
353
  });
349
354
  };
350
- return (n, a) => (p(!0), v(x, null, X(e.questions, (r) => (p(), v("button", {
351
- key: r.question,
355
+ return (n, a) => (_(!0), m(O, null, Z(e.questions, (s) => (_(), m("button", {
356
+ key: s.question,
352
357
  class: "dialog-block-suggestions-item",
353
- onClick: (i) => o(r.question)
358
+ onClick: (r) => o(s.question)
354
359
  }, [
355
- D(Ve, {
360
+ A(Ke, {
356
361
  class: "dialog-block-suggestions-item-icon",
357
362
  color: e.client.theme.primaryColor
358
363
  }, null, 8, ["color"]),
359
- l("span", Ke, I(r.question), 1)
360
- ], 8, He))), 128));
364
+ d("span", Ge, R(s.question), 1)
365
+ ], 8, Fe))), 128));
361
366
  }
362
- }), Ge = /* @__PURE__ */ O(Fe, [["__scopeId", "data-v-db34d4b4"]]), Qe = {};
363
- function je(t, e) {
364
- return p(), v(x, null, [
365
- e[0] || (e[0] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
366
- e[1] || (e[1] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
367
- e[2] || (e[2] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
367
+ }), Qe = /* @__PURE__ */ D(je, [["__scopeId", "data-v-db34d4b4"]]), We = {};
368
+ function Ye(t, e) {
369
+ return _(), m(O, null, [
370
+ e[0] || (e[0] = d("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
371
+ e[1] || (e[1] = d("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
372
+ e[2] || (e[2] = d("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
368
373
  ], 64);
369
374
  }
370
- const We = /* @__PURE__ */ O(Qe, [["render", je], ["__scopeId", "data-v-26a64b58"]]), Ye = { class: "dialog-block-suggestions-container" }, ze = /* @__PURE__ */ y({
375
+ const ze = /* @__PURE__ */ D(We, [["render", Ye], ["__scopeId", "data-v-26a64b58"]]), Xe = { class: "dialog-block-suggestions-container" }, Ze = /* @__PURE__ */ w({
371
376
  __name: "DialogBlockSuggestionsContainer",
372
377
  props: {
373
378
  client: {},
@@ -379,8 +384,8 @@ const We = /* @__PURE__ */ O(Qe, [["render", je], ["__scopeId", "data-v-26a64b58
379
384
  },
380
385
  setup(t) {
381
386
  const e = t;
382
- return (o, n) => (p(), v("div", Ye, [
383
- e.isLoading || !e.questions ? (p(), M(We, { key: 0 })) : (p(), M(Ge, {
387
+ return (o, n) => (_(), m("div", Xe, [
388
+ e.isLoading || !e.questions ? (_(), x(ze, { key: 0 })) : (_(), x(Qe, {
384
389
  key: 1,
385
390
  client: e.client,
386
391
  questions: e.questions,
@@ -390,30 +395,30 @@ const We = /* @__PURE__ */ O(Qe, [["render", je], ["__scopeId", "data-v-26a64b58
390
395
  }, null, 8, ["client", "questions", "product-id", "product-title", "selected-variant-id"]))
391
396
  ]));
392
397
  }
393
- }), Xe = /* @__PURE__ */ O(ze, [["__scopeId", "data-v-18c9e78b"]]), Ze = {
398
+ }), Je = /* @__PURE__ */ D(Ze, [["__scopeId", "data-v-18c9e78b"]]), et = {
394
399
  width: "20",
395
400
  height: "20",
396
401
  viewBox: "0 0 20 20",
397
402
  fill: "none",
398
403
  xmlns: "http://www.w3.org/2000/svg"
399
- }, Je = ["stroke"], et = /* @__PURE__ */ y({
404
+ }, tt = ["stroke"], ot = /* @__PURE__ */ w({
400
405
  __name: "ArrowIcon",
401
406
  props: {
402
407
  color: {}
403
408
  },
404
409
  setup(t) {
405
410
  const e = t;
406
- return (o, n) => (p(), v("svg", Ze, [
407
- l("path", {
411
+ return (o, n) => (_(), m("svg", et, [
412
+ d("path", {
408
413
  d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
409
414
  stroke: e.color || "#ffffff",
410
415
  "stroke-width": "1.5",
411
416
  "stroke-linecap": "round",
412
417
  "stroke-linejoin": "round"
413
- }, null, 8, Je)
418
+ }, null, 8, tt)
414
419
  ]));
415
420
  }
416
- }), tt = ["placeholder"], ot = ["disabled"], nt = /* @__PURE__ */ y({
421
+ }), nt = ["placeholder"], st = ["disabled"], rt = /* @__PURE__ */ w({
417
422
  __name: "DialogInput",
418
423
  props: {
419
424
  client: {},
@@ -423,93 +428,93 @@ const We = /* @__PURE__ */ O(Qe, [["render", je], ["__scopeId", "data-v-26a64b58
423
428
  selectedVariantId: {}
424
429
  },
425
430
  setup(t) {
426
- const e = t, o = A(), n = A(""), a = () => {
427
- var i;
428
- (i = o.value) == null || i.focus();
429
- }, r = () => {
430
- const i = n.value;
431
- i.trim() && (e.client.sendProductMessage({
431
+ const e = t, o = y(), n = y(""), a = () => {
432
+ var r;
433
+ (r = o.value) == null || r.focus();
434
+ }, s = () => {
435
+ const r = n.value;
436
+ r.trim() && (e.client.sendProductMessage({
432
437
  productId: e.productId,
433
438
  productTitle: e.productTitle,
434
439
  selectedVariantId: e.selectedVariantId,
435
- question: i,
440
+ question: r,
436
441
  fromQuestionSuggestion: !0
437
442
  }), n.value = "");
438
443
  };
439
- return (i, s) => (p(), v("div", {
444
+ return (r, i) => (_(), m("div", {
440
445
  class: "dialog-input-wrapper",
441
446
  onClick: a
442
447
  }, [
443
- Z(l("input", {
448
+ J(d("input", {
444
449
  id: "dialog-ask-anything-input-ai-input",
445
450
  ref_key: "inputRef",
446
451
  ref: o,
447
- "onUpdate:modelValue": s[0] || (s[0] = (_) => n.value = _),
452
+ "onUpdate:modelValue": i[0] || (i[0] = (l) => n.value = l),
448
453
  class: "dialog-ask-anything-input-ai-input",
449
454
  placeholder: e.placeholder ?? "Ask anything...",
450
- onKeydown: ie(r, ["enter"])
451
- }, null, 40, tt), [
452
- [J, n.value]
455
+ onKeydown: ae(s, ["enter"])
456
+ }, null, 40, nt), [
457
+ [ee, n.value]
453
458
  ]),
454
- l("button", {
459
+ d("button", {
455
460
  id: "send-message-button-ai-input",
456
461
  class: "dialog-input-submit",
457
462
  disabled: !n.value.trim(),
458
- onClick: r
463
+ onClick: s
459
464
  }, [
460
- D(et, {
465
+ A(ot, {
461
466
  color: e.client.theme.ctaTextColor
462
467
  }, null, 8, ["color"])
463
- ], 8, ot)
468
+ ], 8, st)
464
469
  ]));
465
470
  }
466
- }), st = /* @__PURE__ */ O(nt, [["__scopeId", "data-v-4f5901c9"]]), rt = /* @__PURE__ */ y({
471
+ }), it = /* @__PURE__ */ D(rt, [["__scopeId", "data-v-4f5901c9"]]), at = /* @__PURE__ */ w({
467
472
  __name: "ThemeProvider",
468
473
  props: {
469
474
  theme: {}
470
475
  },
471
476
  setup(t) {
472
- const e = t, o = document.body, n = (r) => r.replace(/([A-Z])/g, "-$1").toLowerCase(), a = (r) => {
473
- r && Object.keys(r).forEach((i) => {
474
- const s = i, _ = n(i);
475
- if (r[s] !== void 0) {
476
- if (typeof r[s] == "object") {
477
- Object.keys(r[s]).forEach((f) => {
478
- var d;
479
- const u = f;
477
+ const e = t, o = document.body, n = (s) => s.replace(/([A-Z])/g, "-$1").toLowerCase(), a = (s) => {
478
+ s && Object.keys(s).forEach((r) => {
479
+ const i = r, l = n(r);
480
+ if (s[i] !== void 0) {
481
+ if (typeof s[i] == "object") {
482
+ Object.keys(s[i]).forEach((h) => {
483
+ var p;
484
+ const u = h;
480
485
  if (u !== void 0) {
481
- const S = n(f), E = r[s];
486
+ const S = n(h), E = s[i];
482
487
  o.style.setProperty(
483
- `--dialog-theme-${_}-${S}`,
484
- (d = E[u]) == null ? void 0 : d.toString()
488
+ `--dialog-theme-${l}-${S}`,
489
+ (p = E[u]) == null ? void 0 : p.toString()
485
490
  );
486
491
  }
487
492
  });
488
493
  return;
489
494
  }
490
- if (s === "ctaBorderType") {
491
- const f = r[s] === "rounded" ? "24px" : "0";
492
- o.style.setProperty(`--dialog-theme-${_}`, f);
495
+ if (i === "ctaBorderType") {
496
+ const h = s[i] === "rounded" ? "24px" : "0";
497
+ o.style.setProperty(`--dialog-theme-${l}`, h);
493
498
  return;
494
499
  }
495
500
  o.style.setProperty(
496
- `--dialog-theme-${_}`,
497
- r[s].toString()
501
+ `--dialog-theme-${l}`,
502
+ s[i].toString()
498
503
  );
499
504
  }
500
505
  });
501
506
  };
502
- return H(() => {
507
+ return K(() => {
503
508
  e.theme && a(e.theme);
504
- }), q(
509
+ }), U(
505
510
  () => e.theme,
506
- (r) => {
507
- r && a(r);
511
+ (s) => {
512
+ s && a(s);
508
513
  },
509
514
  { deep: !0 }
510
- ), (r, i) => ae(r.$slots, "default");
515
+ ), (s, r) => ce(s.$slots, "default");
511
516
  }
512
- }), it = ["dir"], at = /* @__PURE__ */ y({
517
+ }), ct = ["dir"], lt = /* @__PURE__ */ w({
513
518
  __name: "DialogProductBlock",
514
519
  props: {
515
520
  client: {},
@@ -520,62 +525,62 @@ const We = /* @__PURE__ */ O(Qe, [["render", je], ["__scopeId", "data-v-26a64b58
520
525
  },
521
526
  setup(t) {
522
527
  const e = t;
523
- H(() => {
524
- oe({
528
+ K(() => {
529
+ ne({
525
530
  method: "vue",
526
- version: "3.4.0"
527
- }), be("pdp-block");
531
+ version: "3.5.0"
532
+ }), Ie("pdp-block");
528
533
  });
529
- const o = A(!0), n = A(void 0), a = A(0), r = T(() => {
534
+ const o = y(!0), n = y(void 0), a = y(0), s = T(() => {
530
535
  var u;
531
536
  return o.value ? "" : (u = n.value) == null ? void 0 : u.assistantName;
532
- }), i = T(() => {
537
+ }), r = T(() => {
533
538
  var u;
534
539
  return o.value ? "" : (u = n.value) == null ? void 0 : u.description;
535
- }), s = T(() => {
540
+ }), i = T(() => {
536
541
  var u;
537
542
  return o.value ? "" : (u = n.value) == null ? void 0 : u.inputPlaceholder;
538
- }), _ = T(
543
+ }), l = T(
539
544
  () => {
540
545
  var u;
541
546
  return ge(
542
547
  (u = e.client.getLocalizationInformations()) == null ? void 0 : u.languageCode
543
548
  );
544
549
  }
545
- ), f = async () => {
550
+ ), h = async () => {
546
551
  const u = ++a.value;
547
552
  o.value = !0, n.value = void 0;
548
553
  try {
549
- const d = await e.client.getSuggestions(e.productId);
550
- u === a.value && (n.value = d);
551
- } catch (d) {
552
- console.error("error", d);
554
+ const p = await e.client.getSuggestions(e.productId);
555
+ u === a.value && (n.value = p);
556
+ } catch (p) {
557
+ console.error("error", p);
553
558
  } finally {
554
559
  u === a.value && (o.value = !1);
555
560
  }
556
561
  };
557
- return q(
562
+ return U(
558
563
  () => [e.client, e.productId],
559
564
  () => {
560
- f();
565
+ h();
561
566
  },
562
567
  { immediate: !0 }
563
- ), (u, d) => (p(), M(rt, {
568
+ ), (u, p) => (_(), x(at, {
564
569
  theme: e.client.theme
565
570
  }, {
566
- default: ce(() => {
571
+ default: le(() => {
567
572
  var S;
568
573
  return [
569
- l("div", {
574
+ d("div", {
570
575
  id: "dialog-instant",
571
576
  class: "dialog-block-container",
572
- dir: _.value
577
+ dir: l.value
573
578
  }, [
574
- D(Ue, {
575
- title: r.value,
576
- description: i.value
579
+ A(Me, {
580
+ title: s.value,
581
+ description: r.value
577
582
  }, null, 8, ["title", "description"]),
578
- D(Xe, {
583
+ A(Je, {
579
584
  client: e.client,
580
585
  questions: (S = n.value) == null ? void 0 : S.questions,
581
586
  "is-loading": o.value,
@@ -583,21 +588,21 @@ const We = /* @__PURE__ */ O(Qe, [["render", je], ["__scopeId", "data-v-26a64b58
583
588
  "product-title": e.productTitle,
584
589
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
585
590
  }, null, 8, ["client", "questions", "is-loading", "product-id", "product-title", "selected-variant-id"]),
586
- e.enableInput ? (p(), M(st, {
591
+ e.enableInput ? (_(), x(it, {
587
592
  key: 0,
588
593
  client: e.client,
589
- placeholder: s.value,
594
+ placeholder: i.value,
590
595
  "product-id": e.productId,
591
596
  "product-title": e.productTitle,
592
597
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
593
- }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : N("", !0)
594
- ], 8, it)
598
+ }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : M("", !0)
599
+ ], 8, ct)
595
600
  ];
596
601
  }),
597
602
  _: 1
598
603
  }, 8, ["theme"]));
599
604
  }
600
- }), jt = /* @__PURE__ */ O(at, [["__scopeId", "data-v-c57aa677"]]), ct = {}, lt = {
605
+ }), Wt = /* @__PURE__ */ D(lt, [["__scopeId", "data-v-c57aa677"]]), dt = {}, ut = {
601
606
  width: "16",
602
607
  height: "16",
603
608
  viewBox: "0 0 16 16",
@@ -605,9 +610,9 @@ const We = /* @__PURE__ */ O(Qe, [["render", je], ["__scopeId", "data-v-26a64b58
605
610
  xmlns: "http://www.w3.org/2000/svg",
606
611
  "aria-hidden": "true"
607
612
  };
608
- function ut(t, e) {
609
- return p(), v("svg", lt, e[0] || (e[0] = [
610
- l("path", {
613
+ function pt(t, e) {
614
+ return _(), m("svg", ut, e[0] || (e[0] = [
615
+ d("path", {
611
616
  d: "M8 13V3M8 3L3 8M8 3L13 8",
612
617
  stroke: "currentColor",
613
618
  "stroke-width": "1.5",
@@ -616,28 +621,28 @@ function ut(t, e) {
616
621
  }, null, -1)
617
622
  ]));
618
623
  }
619
- const dt = /* @__PURE__ */ O(ct, [["render", ut]]), pt = {
624
+ const _t = /* @__PURE__ */ D(dt, [["render", pt]]), ht = {
620
625
  width: "16",
621
626
  height: "16",
622
627
  viewBox: "0 0 12 12",
623
628
  fill: "none",
624
629
  xmlns: "http://www.w3.org/2000/svg",
625
630
  "aria-hidden": "true"
626
- }, _t = ["fill"], ht = "M5.3217 0.588255C5.63241 -0.196084 6.36759 -0.196085 6.6783 0.588254C6.98901 1.37259 7.68193 2.82807 8.42693 3.57307C9.17193 4.31807 10.6274 5.01099 11.4117 5.3217C12.1961 5.63241 12.1961 6.36759 11.4117 6.6783C10.6274 6.98901 9.17193 7.68193 8.42693 8.42693C7.68193 9.17193 6.98901 10.6274 6.6783 11.4117C6.36759 12.1961 5.63241 12.1961 5.3217 11.4117C5.01099 10.6274 4.31807 9.17193 3.57307 8.42693C2.82808 7.68193 1.37259 6.98901 0.588255 6.6783C-0.196084 6.36759 -0.196085 5.63241 0.588254 5.3217C1.37259 5.01099 2.82807 4.31807 3.57307 3.57307C4.31807 2.82808 5.01099 1.37259 5.3217 0.588255Z", ft = /* @__PURE__ */ y({
631
+ }, ft = ["fill"], gt = "M5.3217 0.588255C5.63241 -0.196084 6.36759 -0.196085 6.6783 0.588254C6.98901 1.37259 7.68193 2.82807 8.42693 3.57307C9.17193 4.31807 10.6274 5.01099 11.4117 5.3217C12.1961 5.63241 12.1961 6.36759 11.4117 6.6783C10.6274 6.98901 9.17193 7.68193 8.42693 8.42693C7.68193 9.17193 6.98901 10.6274 6.6783 11.4117C6.36759 12.1961 5.63241 12.1961 5.3217 11.4117C5.01099 10.6274 4.31807 9.17193 3.57307 8.42693C2.82808 7.68193 1.37259 6.98901 0.588255 6.6783C-0.196084 6.36759 -0.196085 5.63241 0.588254 5.3217C1.37259 5.01099 2.82807 4.31807 3.57307 3.57307C4.31807 2.82808 5.01099 1.37259 5.3217 0.588255Z", vt = /* @__PURE__ */ w({
627
632
  __name: "ShurikenIcon",
628
633
  props: {
629
634
  color: {}
630
635
  },
631
636
  setup(t) {
632
637
  const e = t;
633
- return (o, n) => (p(), v("svg", pt, [
634
- l("path", {
635
- d: ht,
638
+ return (o, n) => (_(), m("svg", ht, [
639
+ d("path", {
640
+ d: gt,
636
641
  fill: e.color || "currentColor"
637
- }, null, 8, _t)
642
+ }, null, 8, ft)
638
643
  ]));
639
644
  }
640
- }), gt = { class: "dialog-search-bar-field" }, vt = { class: "dialog-search-bar-icon" }, mt = ["aria-label", "placeholder", "autofocus"], St = ["aria-label"], Wt = /* @__PURE__ */ y({
645
+ }), mt = { class: "dialog-search-bar-field" }, St = { class: "dialog-search-bar-icon" }, Ct = ["aria-label", "placeholder", "autofocus"], bt = ["aria-label"], Yt = /* @__PURE__ */ w({
641
646
  __name: "DialogSearchBar",
642
647
  props: {
643
648
  controller: {},
@@ -646,22 +651,22 @@ const dt = /* @__PURE__ */ O(ct, [["render", ut]]), pt = {
646
651
  submitAriaLabel: { default: "Search" }
647
652
  },
648
653
  setup(t) {
649
- const e = t, o = A(""), n = () => {
654
+ const e = t, o = y(""), n = () => {
650
655
  e.controller.setQuery(o.value);
651
656
  }, a = () => {
652
657
  e.controller.submit(o.value);
653
658
  };
654
- return (r, i) => (p(), v("form", {
659
+ return (s, r) => (_(), m("form", {
655
660
  class: "dialog-search-bar",
656
661
  role: "search",
657
- onSubmit: le(a, ["prevent"])
662
+ onSubmit: de(a, ["prevent"])
658
663
  }, [
659
- l("div", gt, [
660
- l("span", vt, [
661
- D(ft)
664
+ d("div", mt, [
665
+ d("span", St, [
666
+ A(vt)
662
667
  ]),
663
- Z(l("input", {
664
- "onUpdate:modelValue": i[0] || (i[0] = (s) => o.value = s),
668
+ J(d("input", {
669
+ "onUpdate:modelValue": r[0] || (r[0] = (i) => o.value = i),
665
670
  type: "text",
666
671
  name: "dialog-search-query",
667
672
  class: "dialog-search-bar-input",
@@ -669,24 +674,24 @@ const dt = /* @__PURE__ */ O(ct, [["render", ut]]), pt = {
669
674
  placeholder: e.placeholder,
670
675
  autofocus: e.autoFocus,
671
676
  onInput: n
672
- }, null, 40, mt), [
673
- [J, o.value]
677
+ }, null, 40, Ct), [
678
+ [ee, o.value]
674
679
  ])
675
680
  ]),
676
- l("button", {
681
+ d("button", {
677
682
  type: "submit",
678
683
  class: "dialog-search-bar-submit",
679
684
  "aria-label": e.submitAriaLabel
680
685
  }, [
681
- D(dt)
682
- ], 8, St)
686
+ A(_t)
687
+ ], 8, bt)
683
688
  ], 32));
684
689
  }
685
- }), Ct = {
690
+ }), Et = {
686
691
  key: 0,
687
692
  "aria-label": "Search results pages",
688
693
  class: "dialog-search-pagination"
689
- }, bt = ["disabled"], Et = ["disabled"], Rt = /* @__PURE__ */ y({
694
+ }, It = ["disabled"], wt = ["disabled"], Tt = /* @__PURE__ */ w({
690
695
  __name: "DialogSearchPagination",
691
696
  props: {
692
697
  controller: {},
@@ -694,87 +699,70 @@ const dt = /* @__PURE__ */ O(ct, [["render", ut]]), pt = {
694
699
  },
695
700
  setup(t) {
696
701
  const e = t, o = T(() => e.state.response);
697
- return (n, a) => o.value !== void 0 && o.value.nbPages > 1 ? (p(), v("nav", Ct, [
698
- l("button", {
702
+ return (n, a) => o.value !== void 0 && o.value.nbPages > 1 ? (_(), m("nav", Et, [
703
+ d("button", {
699
704
  type: "button",
700
705
  disabled: o.value.page === 0,
701
- onClick: a[0] || (a[0] = (r) => e.controller.setPage(o.value.page - 1))
702
- }, " Previous ", 8, bt),
703
- l("span", null, " Page " + I(o.value.page + 1) + " / " + I(o.value.nbPages), 1),
704
- l("button", {
706
+ onClick: a[0] || (a[0] = (s) => e.controller.setPage(o.value.page - 1))
707
+ }, " Previous ", 8, It),
708
+ d("span", null, " Page " + R(o.value.page + 1) + " / " + R(o.value.nbPages), 1),
709
+ d("button", {
705
710
  type: "button",
706
711
  disabled: o.value.page >= o.value.nbPages - 1,
707
- onClick: a[1] || (a[1] = (r) => e.controller.setPage(o.value.page + 1))
708
- }, " Next ", 8, Et)
709
- ])) : N("", !0);
712
+ onClick: a[1] || (a[1] = (s) => e.controller.setPage(o.value.page + 1))
713
+ }, " Next ", 8, wt)
714
+ ])) : M("", !0);
710
715
  }
711
- }), F = ({ amount: t, currencyCode: e }, o) => new Intl.NumberFormat(o, {
716
+ }), G = ({ amount: t, currencyCode: e }, o) => e === void 0 ? new Intl.NumberFormat(o).format(Number(t)) : new Intl.NumberFormat(o, {
712
717
  style: "currency",
713
718
  currency: e
714
- }).format(Number(t)), ne = ({ min: t, max: e }, o) => t.amount === e.amount ? F(t, o) : `${F(t, o)} – ${F(e, o)}`, Tt = (t, e) => {
719
+ }).format(Number(t)), Rt = ({ min: t, max: e }, o) => t.amount === e.amount ? G(t, o) : `${G(t, o)} – ${G(e, o)}`, kt = (t, e) => {
715
720
  if (t === void 0)
716
721
  return "";
717
722
  try {
718
- return ne(t, e);
719
- } catch {
720
- return "";
721
- }
722
- }, yt = (t, e) => {
723
- const o = t.priceRange, n = t.compareAtPriceRange;
724
- if (o === void 0 || n === void 0 || Number(n.min.amount) <= Number(o.min.amount))
725
- return "";
726
- try {
727
- return ne(n, e);
723
+ return Rt(t, e);
728
724
  } catch {
729
725
  return "";
730
726
  }
731
- }, It = (t) => {
727
+ }, yt = (t) => {
732
728
  try {
733
729
  const { protocol: e } = new URL(t, window.location.href);
734
730
  return e === "http:" || e === "https:" ? t : void 0;
735
731
  } catch {
736
732
  return;
737
733
  }
738
- }, kt = { class: "dialog-search-card-image" }, wt = ["src", "alt"], At = { class: "dialog-search-card-info" }, Lt = { class: "dialog-search-card-title" }, $t = {
734
+ }, Lt = { class: "dialog-search-card-image" }, At = ["src", "alt"], $t = { class: "dialog-search-card-info" }, Dt = { class: "dialog-search-card-title" }, Pt = {
739
735
  key: 0,
740
736
  class: "dialog-search-card-price"
741
- }, Dt = {
742
- key: 0,
743
- class: "dialog-search-card-compare-at"
744
- }, Y = /* @__PURE__ */ y({
737
+ }, z = /* @__PURE__ */ w({
745
738
  __name: "DialogSearchProductCardContent",
746
739
  props: {
747
740
  hit: {},
748
741
  locale: {}
749
742
  },
750
743
  setup(t) {
751
- const e = t, o = T(() => e.hit.product.title ?? e.hit.product.id), n = T(
752
- () => Tt(e.hit.product.priceRange, e.locale)
753
- ), a = T(
754
- () => yt(e.hit.product, e.locale)
744
+ const e = t, o = T(() => e.hit.title ?? e.hit.objectID), n = T(
745
+ () => kt(e.hit.priceRange, e.locale)
755
746
  );
756
- return (r, i) => (p(), v(x, null, [
757
- l("div", kt, [
758
- e.hit.product.imageUrl !== void 0 ? (p(), v("img", {
747
+ return (a, s) => (_(), m(O, null, [
748
+ d("div", Lt, [
749
+ e.hit.imageUrl !== void 0 ? (_(), m("img", {
759
750
  key: 0,
760
- src: e.hit.product.imageUrl,
751
+ src: e.hit.imageUrl,
761
752
  alt: o.value,
762
753
  loading: "lazy"
763
- }, null, 8, wt)) : N("", !0)
754
+ }, null, 8, At)) : M("", !0)
764
755
  ]),
765
- l("div", At, [
766
- l("p", Lt, I(o.value), 1),
767
- n.value !== "" ? (p(), v("p", $t, [
768
- ue(I(n.value), 1),
769
- a.value !== "" ? (p(), v("s", Dt, I(" " + a.value), 1)) : N("", !0)
770
- ])) : N("", !0)
756
+ d("div", $t, [
757
+ d("p", Dt, R(o.value), 1),
758
+ n.value !== "" ? (_(), m("p", Pt, R(n.value), 1)) : M("", !0)
771
759
  ])
772
760
  ], 64));
773
761
  }
774
- }), Pt = {
762
+ }), Nt = {
775
763
  key: 0,
776
764
  class: "dialog-search-card-body"
777
- }, Nt = ["href"], Ot = /* @__PURE__ */ y({
765
+ }, Ot = ["href"], xt = /* @__PURE__ */ w({
778
766
  __name: "DialogSearchProductCard",
779
767
  props: {
780
768
  controller: {},
@@ -783,130 +771,130 @@ const dt = /* @__PURE__ */ O(ct, [["render", ut]]), pt = {
783
771
  locale: {}
784
772
  },
785
773
  setup(t) {
786
- const e = t, o = A();
787
- q(
774
+ const e = t, o = y();
775
+ U(
788
776
  () => e.hit,
789
777
  () => {
790
778
  o.value !== void 0 && e.controller.observeResult(o.value, e.index);
791
779
  },
792
780
  { immediate: !0, flush: "post" }
793
781
  );
794
- const n = (i) => {
795
- const s = i.metaKey || i.ctrlKey || i.shiftKey || i.altKey;
796
- e.controller.selectResult(e.index, { navigate: !s }) && i.preventDefault();
797
- }, a = (i) => {
798
- i.button === 1 && e.controller.selectResult(e.index, { navigate: !1 });
799
- }, r = T(
800
- () => e.hit.product.url === void 0 ? void 0 : It(e.hit.product.url)
782
+ const n = (r) => {
783
+ const i = r.metaKey || r.ctrlKey || r.shiftKey || r.altKey;
784
+ e.controller.selectResult(e.index, { navigate: !i }) && r.preventDefault();
785
+ }, a = (r) => {
786
+ r.button === 1 && e.controller.selectResult(e.index, { navigate: !1 });
787
+ }, s = T(
788
+ () => e.hit.url === void 0 ? void 0 : yt(e.hit.url)
801
789
  );
802
- return (i, s) => (p(), v("li", {
790
+ return (r, i) => (_(), m("li", {
803
791
  ref_key: "cardRef",
804
792
  ref: o,
805
793
  class: "dialog-search-card"
806
794
  }, [
807
- r.value === void 0 ? (p(), v("div", Pt, [
808
- D(Y, {
795
+ s.value === void 0 ? (_(), m("div", Nt, [
796
+ A(z, {
809
797
  hit: e.hit,
810
798
  locale: e.locale
811
799
  }, null, 8, ["hit", "locale"])
812
- ])) : (p(), v("a", {
800
+ ])) : (_(), m("a", {
813
801
  key: 1,
814
802
  class: "dialog-search-card-body",
815
- href: r.value,
803
+ href: s.value,
816
804
  onClick: n,
817
805
  onAuxclick: a
818
806
  }, [
819
- D(Y, {
807
+ A(z, {
820
808
  hit: e.hit,
821
809
  locale: e.locale
822
810
  }, null, 8, ["hit", "locale"])
823
- ], 40, Nt))
811
+ ], 40, Ot))
824
812
  ], 512));
825
813
  }
826
814
  }), Ut = (t) => {
827
- const e = A(), o = A(void 0), n = A(0);
828
- return q(
815
+ const e = y(), o = y(void 0), n = y(0);
816
+ return U(
829
817
  t,
830
- (a, r, i) => {
818
+ (a, s, r) => {
831
819
  if (!a)
832
820
  return;
833
- const s = () => {
834
- const _ = e.value;
835
- if (_ === void 0)
821
+ const i = () => {
822
+ const l = e.value;
823
+ if (l === void 0)
836
824
  return;
837
- const f = _.previousElementSibling ?? _, { top: u, bottom: d, left: S, width: E } = f.getBoundingClientRect();
825
+ const h = l.previousElementSibling ?? l, { top: u, bottom: p, left: S, width: E } = h.getBoundingClientRect();
838
826
  n.value = window.innerHeight;
839
827
  const c = o.value;
840
- (c === void 0 || c.top !== u || c.bottom !== d || c.left !== S || c.width !== E) && (o.value = { top: u, bottom: d, left: S, width: E });
828
+ (c === void 0 || c.top !== u || c.bottom !== p || c.left !== S || c.width !== E) && (o.value = { top: u, bottom: p, left: S, width: E });
841
829
  };
842
- s(), window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), i(() => {
843
- window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
830
+ i(), window.addEventListener("scroll", i, !0), window.addEventListener("resize", i), r(() => {
831
+ window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", i);
844
832
  });
845
833
  },
846
834
  { immediate: !0, flush: "post" }
847
835
  ), { anchorRef: e, rect: o, viewportHeight: n };
848
- }, xt = (t, e) => {
849
- const o = A(!1), n = A(), a = T(
850
- () => t.value.status !== w.IDLE && !o.value
836
+ }, Mt = (t, e) => {
837
+ const o = y(!1), n = y(), a = T(
838
+ () => t.value.status !== k.IDLE && !o.value
851
839
  );
852
- q(
840
+ U(
853
841
  () => t.value.query,
854
842
  () => {
855
843
  o.value = !1;
856
844
  }
857
- ), q(
845
+ ), U(
858
846
  a,
859
- (i, s, _) => {
860
- if (!i)
847
+ (r, i, l) => {
848
+ if (!r)
861
849
  return;
862
- const f = (u) => {
863
- var b, R;
864
- const d = u.target;
865
- if (!(d instanceof Node))
850
+ const h = (u) => {
851
+ var b, I;
852
+ const p = u.target;
853
+ if (!(p instanceof Node))
866
854
  return;
867
- const S = (b = e.value) == null ? void 0 : b.previousElementSibling, E = ((R = n.value) == null ? void 0 : R.contains(d)) ?? !1, c = (S == null ? void 0 : S.contains(d)) ?? !1;
855
+ const S = (b = e.value) == null ? void 0 : b.previousElementSibling, E = ((I = n.value) == null ? void 0 : I.contains(p)) ?? !1, c = (S == null ? void 0 : S.contains(p)) ?? !1;
868
856
  !E && !c && (o.value = !0);
869
857
  };
870
- document.addEventListener("pointerdown", f), _(
871
- () => document.removeEventListener("pointerdown", f)
858
+ document.addEventListener("pointerdown", h), l(
859
+ () => document.removeEventListener("pointerdown", h)
872
860
  );
873
861
  },
874
862
  { immediate: !0 }
875
863
  );
876
- const r = () => {
864
+ const s = () => {
877
865
  o.value = !1;
878
866
  };
879
- return H(() => {
880
- var i, s;
881
- (s = (i = e.value) == null ? void 0 : i.previousElementSibling) == null || s.addEventListener(
867
+ return K(() => {
868
+ var r, i;
869
+ (i = (r = e.value) == null ? void 0 : r.previousElementSibling) == null || i.addEventListener(
882
870
  "focusin",
883
- r
871
+ s
884
872
  );
885
- }), ee(() => {
886
- var i, s;
887
- (s = (i = e.value) == null ? void 0 : i.previousElementSibling) == null || s.removeEventListener(
873
+ }), te(() => {
874
+ var r, i;
875
+ (i = (r = e.value) == null ? void 0 : r.previousElementSibling) == null || i.removeEventListener(
888
876
  "focusin",
889
- r
877
+ s
890
878
  );
891
879
  }), { isOpen: a, panelRef: n };
892
- }, Mt = {
880
+ }, qt = {
893
881
  key: 0,
894
882
  role: "status",
895
883
  class: "dialog-search-status"
896
- }, qt = {
884
+ }, Bt = {
897
885
  key: 1,
898
886
  class: "dialog-search-error"
899
- }, Bt = {
887
+ }, Vt = {
900
888
  role: "alert",
901
889
  class: "dialog-search-status dialog-search-status-error"
902
- }, Vt = {
890
+ }, Ht = {
903
891
  key: 2,
904
892
  role: "status",
905
893
  class: "dialog-search-status"
906
- }, Ht = {
894
+ }, Kt = {
907
895
  role: "status",
908
896
  class: "dialog-search-status"
909
- }, Kt = { class: "dialog-search-results" }, V = 8, z = 16, Ft = 200, Yt = /* @__PURE__ */ y({
897
+ }, Ft = { class: "dialog-search-results" }, H = 8, X = 16, Gt = 200, zt = /* @__PURE__ */ w({
910
898
  __name: "DialogSearchResults",
911
899
  props: {
912
900
  controller: {},
@@ -914,94 +902,100 @@ const dt = /* @__PURE__ */ O(ct, [["render", ut]]), pt = {
914
902
  locale: {}
915
903
  },
916
904
  setup(t) {
917
- const e = t, o = (c) => c instanceof ve ? `Search failed (${c.status}${c.code ? ` ${c.code}` : ""}): ${c.message}` : "Search failed: network error. Check your connection and try again.", n = (c, b) => c.bottom > 0 && c.top < b, a = (c, b) => {
918
- const R = b - c.bottom - V - z, L = c.top - V - z, h = { left: `${c.left}px`, width: `${c.width}px` };
919
- return R < Ft && L > R ? {
920
- ...h,
921
- bottom: `${b - c.top + V}px`,
905
+ const e = t, o = (c) => c instanceof me ? `Search failed (${c.status}${c.code ? ` ${c.code}` : ""}): ${c.message}` : "Search failed: network error. Check your connection and try again.", n = (c, b) => c.bottom > 0 && c.top < b, a = (c, b) => {
906
+ const I = b - c.bottom - H - X, L = c.top - H - X, f = { left: `${c.left}px`, width: `${c.width}px` };
907
+ return I < Gt && L > I ? {
908
+ ...f,
909
+ bottom: `${b - c.top + H}px`,
922
910
  maxHeight: `${Math.max(L, 0)}px`
923
911
  } : {
924
- ...h,
925
- top: `${c.bottom + V}px`,
926
- maxHeight: `${Math.max(R, 0)}px`
912
+ ...f,
913
+ top: `${c.bottom + H}px`,
914
+ maxHeight: `${Math.max(I, 0)}px`
927
915
  };
928
- }, r = T(() => e.state), i = T(() => e.state.status !== w.IDLE), { anchorRef: s, rect: _, viewportHeight: f } = Ut(i), { isOpen: u, panelRef: d } = xt(r, s), S = T(
929
- () => u.value && _.value !== void 0 && n(_.value, f.value)
916
+ }, s = T(() => e.state), r = T(() => e.state.status !== k.IDLE), { anchorRef: i, rect: l, viewportHeight: h } = Ut(r), { isOpen: u, panelRef: p } = Mt(s, i), S = T(
917
+ () => u.value && l.value !== void 0 && n(l.value, h.value)
930
918
  ), E = T(
931
- () => _.value === void 0 ? void 0 : a(_.value, f.value)
919
+ () => l.value === void 0 ? void 0 : a(l.value, h.value)
932
920
  );
933
921
  return (c, b) => {
934
- var R;
935
- return p(), v(x, null, [
936
- l("div", {
922
+ var I;
923
+ return _(), m(O, null, [
924
+ d("div", {
937
925
  ref_key: "anchorRef",
938
- ref: s
926
+ ref: i
939
927
  }, null, 512),
940
- S.value ? (p(), M(de, {
928
+ S.value ? (_(), x(ue, {
941
929
  key: 0,
942
930
  to: "body"
943
931
  }, [
944
- l("div", {
932
+ d("div", {
945
933
  ref_key: "panelRef",
946
- ref: d,
934
+ ref: p,
947
935
  class: "dialog-search-panel",
948
936
  style: pe(E.value)
949
937
  }, [
950
- e.state.status === B(w).LOADING ? (p(), v("p", Mt, " Searching “" + I(e.state.query) + "”… ", 1)) : e.state.status === B(w).ERROR ? (p(), v("div", qt, [
951
- l("p", Bt, I(o(e.state.error)), 1),
952
- l("button", {
938
+ e.state.status === V(k).LOADING ? (_(), m("p", qt, " Searching “" + R(e.state.query) + "”… ", 1)) : e.state.status === V(k).ERROR ? (_(), m("div", Bt, [
939
+ d("p", Vt, R(o(e.state.error)), 1),
940
+ d("button", {
953
941
  type: "button",
954
942
  class: "dialog-search-retry",
955
943
  onClick: b[0] || (b[0] = (L) => e.controller.retry())
956
944
  }, " Retry ")
957
- ])) : e.state.status === B(w).EMPTY ? (p(), v("p", Vt, " No products match “" + I((R = e.state.response) == null ? void 0 : R.query) + "”. ", 1)) : e.state.status === B(w).SUCCESS && e.state.response !== void 0 ? (p(), v(x, { key: 3 }, [
958
- l("p", Ht, I(e.state.response.nbHits) + " result" + I(e.state.response.nbHits > 1 ? "s" : ""), 1),
959
- l("ul", Kt, [
960
- (p(!0), v(x, null, X(e.state.response.hits, (L, h) => (p(), M(Ot, {
961
- key: L.id,
945
+ ])) : e.state.status === V(k).EMPTY ? (_(), m("p", Ht, " No products match “" + R((I = e.state.response) == null ? void 0 : I.query) + "”. ", 1)) : e.state.status === V(k).SUCCESS && e.state.response !== void 0 ? (_(), m(O, { key: 3 }, [
946
+ d("p", Kt, R(e.state.response.nbHits) + " result" + R(e.state.response.nbHits > 1 ? "s" : ""), 1),
947
+ d("ul", Ft, [
948
+ (_(!0), m(O, null, Z(e.state.response.hits, (L, f) => (_(), x(xt, {
949
+ key: L.objectID,
962
950
  controller: e.controller,
963
951
  hit: L,
964
- index: h,
952
+ index: f,
965
953
  locale: e.locale
966
954
  }, null, 8, ["controller", "hit", "index", "locale"]))), 128))
967
955
  ]),
968
- D(Rt, {
956
+ A(Tt, {
969
957
  controller: e.controller,
970
958
  state: e.state
971
959
  }, null, 8, ["controller", "state"])
972
- ], 64)) : N("", !0)
960
+ ], 64)) : M("", !0)
973
961
  ], 4)
974
- ])) : N("", !0)
962
+ ])) : M("", !0)
975
963
  ], 64);
976
964
  };
977
965
  }
978
- }), zt = (t) => {
979
- const { client: e, surface: o = "search_page", ...n } = t, a = $e({
980
- search: (s, _) => e.search(s, _),
966
+ }), Xt = (t) => {
967
+ const {
968
+ client: e,
969
+ surface: o = "search_page",
970
+ locale: n = e.locale,
971
+ ...a
972
+ } = t, s = Pe({
973
+ search: (l, h) => e.search(l, h),
974
+ locale: n,
981
975
  analytics: {
982
976
  surface: o,
983
- trackViewSearchResults: (s) => e.trackViewSearchResults(s),
984
- trackSelectSearchResult: (s) => e.trackSelectSearchResult(s)
977
+ trackViewSearchResults: (l) => e.trackViewSearchResults(l),
978
+ trackSelectSearchResult: (l) => e.trackSelectSearchResult(l)
985
979
  },
986
- ...n
987
- }), r = _e(a.getState()), i = a.subscribe(() => {
988
- r.value = a.getState();
980
+ ...a
981
+ }), r = _e(s.getState()), i = s.subscribe(() => {
982
+ r.value = s.getState();
989
983
  });
990
- return H(() => {
991
- oe({
984
+ return K(() => {
985
+ ne({
992
986
  method: "vue",
993
- version: "3.4.0"
987
+ version: "3.5.0"
994
988
  });
995
- }), ee(() => {
996
- i(), a.dispose();
997
- }), { controller: a, state: r };
989
+ }), te(() => {
990
+ i(), s.dispose();
991
+ }), { controller: s, state: r };
998
992
  };
999
993
  export {
1000
- st as DialogInput,
1001
- jt as DialogProductBlock,
1002
- Wt as DialogSearchBar,
1003
- Rt as DialogSearchPagination,
1004
- Ot as DialogSearchProductCard,
1005
- Yt as DialogSearchResults,
1006
- zt as useDialogSearch
994
+ it as DialogInput,
995
+ Wt as DialogProductBlock,
996
+ Yt as DialogSearchBar,
997
+ Tt as DialogSearchPagination,
998
+ xt as DialogSearchProductCard,
999
+ zt as DialogSearchResults,
1000
+ Xt as useDialogSearch
1007
1001
  };