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