@askdialog/dialog-vue 3.6.0 → 3.7.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.
Files changed (25) hide show
  1. package/README.md +21 -4
  2. package/dist/components/DialogSearch/DialogSearchCollections.vue.d.ts +9 -0
  3. package/dist/components/DialogSearch/DialogSearchPagination.vue.d.ts +1 -0
  4. package/dist/components/DialogSearch/DialogSearchProductCard.vue.d.ts +6 -1
  5. package/dist/components/DialogSearch/DialogSearchProducts.vue.d.ts +10 -0
  6. package/dist/components/DialogSearch/DialogSearchResults.vue.d.ts +14 -2
  7. package/dist/components/DialogSearch/{DialogSearchProductCardContent.vue.d.ts → HighlightedTitle.vue.d.ts} +2 -3
  8. package/dist/components/DialogSearch/cssColor.d.ts +3 -0
  9. package/dist/components/DialogSearch/panelPlacement.d.ts +5 -0
  10. package/dist/components/DialogSearch/searchCollections.d.ts +6 -0
  11. package/dist/components/DialogSearch/searchDisplay.d.ts +5 -2
  12. package/dist/components/DialogSearch/searchLayout.d.ts +1 -0
  13. package/dist/components/DialogSearch/searchMessages.d.ts +14 -0
  14. package/dist/components/DialogSearch/searchPagination.d.ts +2 -0
  15. package/dist/components/DialogSearch/searchTheme.d.ts +3 -0
  16. package/dist/components/DialogSearch/titleHighlight.d.ts +6 -0
  17. package/dist/components/DialogSearch/useAnchorRect.d.ts +6 -1
  18. package/dist/components/DialogSearch/useDialogSearch.d.ts +8 -1
  19. package/dist/components/index.d.ts +1 -0
  20. package/dist/dialog-vue.css +1 -1
  21. package/dist/dialog-vue.js +854 -515
  22. package/dist/dialog-vue.umd.cjs +3 -3
  23. package/dist/icons/ArrowRightIcon.vue.d.ts +2 -0
  24. package/dist/icons/CaretRightIcon.vue.d.ts +2 -0
  25. package/package.json +2 -2
@@ -1,33 +1,33 @@
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;
1
+ var Se = Object.defineProperty;
2
+ var Ce = (t, e, o) => e in t ? Se(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var j = (t, e, o) => Ce(t, typeof e != "symbol" ? e + "" : e, o);
4
+ import { defineComponent as w, createElementBlock as h, openBlock as c, createElementVNode as l, toDisplayString as E, Fragment as N, renderList as W, createVNode as I, createBlock as O, ref as k, withDirectives as re, withKeys as ye, vModelText as ae, onMounted as B, watch as q, renderSlot as Ee, computed as C, withCtx as ie, createCommentVNode as L, withModifiers as we, unref as K, resolveDynamicComponent as $e, mergeProps as Re, toHandlers as Te, createTextVNode as le, onUnmounted as ce, Teleport as Ie, normalizeStyle as ke, normalizeClass as Y, shallowRef as Le } from "vue";
5
+ const Ae = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur"]), xe = (t) => t !== void 0 && Ae.has(t.trim().toLowerCase().slice(0, 2)), De = (t) => xe(t) ? "rtl" : "ltr";
6
+ var M;
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
- })(x || (x = {}));
10
- var z;
9
+ })(M || (M = {}));
10
+ var J;
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
- })(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");
13
+ })(J || (J = {}));
14
+ M.TRACK_ADD_TO_CART, M.TRACK_SUBMIT_CHECKOUT, M.TRACK_VIEW_SEARCH_RESULTS, M.TRACK_SELECT_SEARCH_RESULT;
15
+ class Pe extends Error {
16
+ constructor({ status: o, code: s, message: r }) {
17
+ super(r);
18
+ j(this, "status");
19
+ j(this, "code");
20
20
  this.name = "DialogSearchError", this.status = o, this.code = s;
21
21
  }
22
22
  }
23
- const j = (t, e, o) => {
23
+ const X = (t, e, o) => {
24
24
  if (!/^[a-z]{2}$/.test(e))
25
25
  throw new Error("Search language must be a lowercase ISO 639-1 code.");
26
26
  if (!/^[A-Za-z]{3}$/.test(o))
27
27
  throw new Error("Search currency must be an ISO 4217 code.");
28
28
  return `${t}_${e}_${o.toLowerCase()}`;
29
- }, W = "multiple installation methods detected:", be = () => typeof window > "u" ? void 0 : window, ne = () => {
30
- const t = be();
29
+ }, ee = "multiple installation methods detected:", Oe = () => typeof window > "u" ? void 0 : window, ue = () => {
30
+ const t = Oe();
31
31
  if (t !== void 0)
32
32
  return t.dialog = t.dialog ?? {}, t.dialog.audit = t.dialog.audit ?? {
33
33
  methods: [],
@@ -35,264 +35,264 @@ const j = (t, e, o) => {
35
35
  capabilities: [],
36
36
  warnings: []
37
37
  }, t.dialog.audit;
38
- }, Ce = (t) => {
39
- if (t.warnings = t.warnings.filter((e) => !e.startsWith(W)), t.methods.length >= 2) {
38
+ }, Ne = (t) => {
39
+ if (t.warnings = t.warnings.filter((e) => !e.startsWith(ee)), t.methods.length >= 2) {
40
40
  const e = t.methods.map((o) => o.method).join(", ");
41
- t.warnings.push(`${W} ${e}`);
41
+ t.warnings.push(`${ee} ${e}`);
42
42
  }
43
- }, Ee = (t, e) => e === void 0 ? t : {
43
+ }, Me = (t, e) => e === void 0 ? t : {
44
44
  version: (t == null ? void 0 : t.version) ?? e.version,
45
45
  commit: (t == null ? void 0 : t.commit) ?? e.commit
46
- }, re = (t) => {
47
- const e = ne();
46
+ }, de = (t) => {
47
+ const e = ue();
48
48
  if (e === void 0)
49
49
  return;
50
50
  const o = e.methods.find((s) => s.method === t.method);
51
51
  if (o === void 0) {
52
- e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), Ce(e);
52
+ e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), Ne(e);
53
53
  return;
54
54
  }
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();
55
+ o.version = o.version ?? t.version, o.build = Me(o.build, t.build), o.source = o.source ?? t.source;
56
+ }, qe = (t) => {
57
+ const e = ue();
58
58
  e !== void 0 && (e.capabilities.includes(t) || e.capabilities.push(t));
59
- }, y = {
59
+ }, A = {
60
60
  IDLE: "idle",
61
61
  LOADING: "loading",
62
62
  SUCCESS: "success",
63
63
  /** Successful request with zero hits. */
64
64
  EMPTY: "empty",
65
65
  ERROR: "error"
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) => {
74
- if (r === void 0)
66
+ }, Ue = 0.5, He = 500, Ve = 1500, Be = 100;
67
+ function Ke({ emit: t, visibilityThreshold: e = Ue, dwellMs: o = He, idleFlushMs: s = Ve, maxItemsPerEvent: r = Be }) {
68
+ let n, i = [];
69
+ const a = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
70
+ let d;
71
+ const f = () => {
72
+ clearTimeout(d), !(n === void 0 || i.length === 0) && (t({ ...n, items: i }), i = []);
73
+ }, y = (m) => {
74
+ if (n === void 0)
75
75
  return;
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();
76
+ const v = `${n.query_id}:${m.product_id}`;
77
+ if (!a.has(v)) {
78
+ if (a.add(v), i.push(m), i.length >= r) {
79
+ f();
80
80
  return;
81
81
  }
82
- clearTimeout(l), l = setTimeout(h, s);
82
+ clearTimeout(d), d = setTimeout(f, s);
83
83
  }
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));
84
+ }, b = (m) => {
85
+ const v = u.get(m);
86
+ v !== void 0 && (clearTimeout(v), u.delete(m));
87
+ }, g = new IntersectionObserver((m) => {
88
+ for (const v of m) {
89
+ const p = _.get(v.target);
90
+ p !== void 0 && (v.intersectionRatio >= e ? u.has(v.target) || u.set(v.target, setTimeout(() => {
91
+ u.delete(v.target), y(p);
92
+ }, o)) : b(v.target));
93
93
  }
94
- }, { threshold: e }), b = () => {
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) {
94
+ }, { threshold: e }), $ = () => {
95
+ g.disconnect();
96
+ for (const m of u.values())
97
+ clearTimeout(m);
98
+ u.clear(), _.clear();
99
+ }, R = () => {
100
+ f();
101
+ }, T = (m) => {
102
+ if (m.persisted) {
103
103
  a.clear();
104
- for (const g of p.keys())
105
- w(g), d.unobserve(g), d.observe(g);
104
+ for (const v of _.keys())
105
+ b(v), g.unobserve(v), g.observe(v);
106
106
  }
107
107
  };
108
- return window.addEventListener("pagehide", C), window.addEventListener("pageshow", I), {
109
- setContext(f) {
110
- h(), a.clear(), r = f, b();
108
+ return window.addEventListener("pagehide", R), window.addEventListener("pageshow", T), {
109
+ setContext(m) {
110
+ f(), a.clear(), n = m, $();
111
111
  },
112
- observe(f, g) {
113
- p.set(f, g), d.observe(f);
112
+ observe(m, v) {
113
+ _.set(m, v), g.observe(m);
114
114
  },
115
- forceImpression(f) {
116
- S(f), h();
115
+ forceImpression(m) {
116
+ y(m), f();
117
117
  },
118
- flush: h,
118
+ flush: f,
119
119
  disconnect() {
120
- h(), b(), window.removeEventListener("pagehide", C), window.removeEventListener("pageshow", I);
120
+ f(), $(), window.removeEventListener("pagehide", R), window.removeEventListener("pageshow", T);
121
121
  }
122
122
  };
123
123
  }
124
- const Y = (t, e) => ({
124
+ const te = (t, e) => ({
125
125
  product_id: t.hits[e].objectID,
126
126
  // One-based position across all pages.
127
127
  position: t.page * t.hitsPerPage + e + 1
128
128
  });
129
- function $e(t) {
129
+ function Fe(t) {
130
130
  let e, o;
131
- const s = () => (e ?? (e = ye({
131
+ const s = () => (e ?? (e = Ke({
132
132
  emit: t.trackViewSearchResults
133
133
  })), e);
134
134
  return {
135
- onResponse(i) {
135
+ onResponse(r) {
136
136
  o = {
137
- query_id: i.queryID,
138
- index: i.index,
137
+ query_id: r.queryID,
138
+ index: r.index,
139
139
  surface: t.surface,
140
140
  search_type: "lexical",
141
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: [] });
142
+ page: r.page + 1,
143
+ total_hits: r.nbHits,
144
+ query_length: [...r.query].length
145
+ }, s().setContext(o), r.nbHits === 0 && t.trackViewSearchResults({ ...o, items: [] });
146
146
  },
147
- observeResult(i, r, n) {
148
- s().observe(i, Y(r, n));
147
+ observeResult(r, n, i) {
148
+ s().observe(r, te(n, i));
149
149
  },
150
- select(i, r) {
150
+ select(r, n) {
151
151
  if (o === void 0)
152
152
  return;
153
- const n = Y(i, r);
154
- s().forceImpression(n), t.trackSelectSearchResult({ ...o, items: [n] });
153
+ const i = te(r, n);
154
+ s().forceImpression(i), t.trackSelectSearchResult({ ...o, items: [i] });
155
155
  },
156
156
  dispose() {
157
157
  e == null || e.disconnect();
158
158
  }
159
159
  };
160
160
  }
161
- const Ae = 2, X = (t) => {
161
+ const je = 2, oe = (t) => {
162
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 }) => ({
163
+ return [...e].length >= je ? e : void 0;
164
+ }, ze = (t, e, o, { indexName: s, language: r, currency: n, hitsPerPage: i }) => ({
165
165
  requests: [
166
- { indexName: s, query: t, page: e, hitsPerPage: n },
166
+ { indexName: s, query: t, page: e, hitsPerPage: i },
167
167
  ...o.map((a) => ({
168
- indexName: j(a.index, i, r),
168
+ indexName: X(a.index, r, n),
169
169
  query: t,
170
170
  page: 0,
171
- hitsPerPage: a.hitsPerPage ?? n
171
+ hitsPerPage: a.hitsPerPage ?? i
172
172
  }))
173
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)
174
+ }), Ge = (t, e, { indexName: o, language: s, currency: r }) => {
175
+ const n = t.results.find((a) => a.index === o);
176
+ if (n === void 0)
177
177
  throw new Error(`Dialog search returned no ${o} entry`);
178
- const n = {};
178
+ const i = {};
179
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);
180
+ const _ = X(a.index, s, r), u = t.results.find((d) => d.index === _);
181
+ u !== void 0 && (i[a.index] = u);
182
182
  }
183
183
  return {
184
- response: r,
185
- sections: e.length === 0 ? void 0 : n
184
+ response: n,
185
+ sections: e.length === 0 ? void 0 : i
186
186
  };
187
- }, F = {
188
- status: y.IDLE,
187
+ }, z = {
188
+ status: A.IDLE,
189
189
  query: "",
190
190
  page: 0,
191
191
  response: void 0,
192
192
  sections: void 0,
193
193
  error: void 0
194
194
  };
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),
195
+ function Qe({ search: t, language: e, currency: o, analytics: s, navigate: r, debounceMs: n = 250, hitsPerPage: i = 12, sections: a = [] }) {
196
+ const _ = {
197
+ indexName: X("products", e, o),
198
198
  language: e,
199
199
  currency: o,
200
- hitsPerPage: n
200
+ hitsPerPage: i
201
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 });
202
+ let u = z;
203
+ const d = /* @__PURE__ */ new Set(), f = Fe(s);
204
+ let y, b, g, $ = 0, R = !1;
205
+ const T = (p) => {
206
+ u = { ...u, ...p };
207
+ for (const S of d)
208
+ S(u);
209
+ }, m = () => {
210
+ clearTimeout(y), b = void 0, $ += 1, g == null || g.abort(), g = void 0;
211
+ }, v = async (p, S) => {
212
+ m(), g = new AbortController();
213
+ const P = $;
214
+ T({ status: A.LOADING, query: p, page: S });
215
215
  try {
216
- const A = typeof a == "function" ? a() : a, Q = Le(m, E, A, p), ie = await t(Q, {
217
- signal: d.signal
216
+ const x = typeof a == "function" ? a() : a, Z = ze(p, S, x, _), be = await t(Z, {
217
+ signal: g.signal
218
218
  });
219
- if (D !== b)
219
+ if (P !== $)
220
220
  return;
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,
221
+ const F = Ge(be, x, _);
222
+ f.onResponse(F.response), T({
223
+ ...F,
224
+ status: F.response.nbHits === 0 ? A.EMPTY : A.SUCCESS,
225
225
  error: void 0
226
226
  });
227
- } catch (A) {
228
- if (A instanceof DOMException && A.name === "AbortError" || D !== b)
227
+ } catch (x) {
228
+ if (x instanceof DOMException && x.name === "AbortError" || P !== $)
229
229
  return;
230
- I({
231
- status: y.ERROR,
232
- error: A,
230
+ T({
231
+ status: A.ERROR,
232
+ error: x,
233
233
  response: void 0,
234
234
  sections: void 0
235
235
  });
236
236
  }
237
237
  };
238
238
  return {
239
- setQuery(m) {
240
- if (C)
239
+ setQuery(p) {
240
+ if (R)
241
241
  return;
242
- f();
243
- const E = X(m);
244
- if (E === void 0) {
245
- I(F);
242
+ m();
243
+ const S = oe(p);
244
+ if (S === void 0) {
245
+ T(z);
246
246
  return;
247
247
  }
248
- w = E, S = setTimeout(() => void g(E, 0), r);
248
+ b = S, y = setTimeout(() => void v(S, 0), n);
249
249
  },
250
- submit(m) {
251
- if (C)
250
+ submit(p) {
251
+ if (R)
252
252
  return;
253
- f();
254
- const E = X(m);
255
- if (E === void 0) {
256
- I(F);
253
+ m();
254
+ const S = oe(p);
255
+ if (S === void 0) {
256
+ T(z);
257
257
  return;
258
258
  }
259
- g(E, 0);
259
+ v(S, 0);
260
260
  },
261
- setPage(m) {
262
- if (!C) {
263
- if (w !== void 0) {
264
- g(w, 0);
261
+ setPage(p) {
262
+ if (!R) {
263
+ if (b !== void 0) {
264
+ v(b, 0);
265
265
  return;
266
266
  }
267
- c.query !== "" && g(c.query, m);
267
+ u.query !== "" && v(u.query, p);
268
268
  }
269
269
  },
270
270
  retry() {
271
- C || c.status !== y.ERROR || g(c.query, c.page);
271
+ R || u.status !== A.ERROR || v(u.query, u.page);
272
272
  },
273
- observeResult(m, E) {
274
- c.response !== void 0 && h.observeResult(m, c.response, E);
273
+ observeResult(p, S) {
274
+ u.response !== void 0 && f.observeResult(p, u.response, S);
275
275
  },
276
- selectResult(m, E) {
277
- const D = c.response;
278
- if (D === void 0)
276
+ selectResult(p, S) {
277
+ const P = u.response;
278
+ if (P === void 0)
279
279
  return !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;
280
+ f.select(P, p);
281
+ const x = P.hits[p].url;
282
+ return ((S == null ? void 0 : S.navigate) ?? !0) && r !== void 0 && x !== void 0 ? (r(x, P.hits[p]), !0) : !1;
283
283
  },
284
- subscribe(m) {
285
- return l.add(m), () => {
286
- l.delete(m);
284
+ subscribe(p) {
285
+ return d.add(p), () => {
286
+ d.delete(p);
287
287
  };
288
288
  },
289
- getState: () => c,
289
+ getState: () => u,
290
290
  dispose() {
291
- C = !0, f(), l.clear(), h.dispose();
291
+ R = !0, m(), d.clear(), f.dispose();
292
292
  }
293
293
  };
294
294
  }
295
- const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-block-title" }, Oe = { class: "dialog-block-description" }, Ue = /* @__PURE__ */ R({
295
+ const We = { class: "dialog-block-header-container" }, Xe = { class: "dialog-block-title" }, Ze = { class: "dialog-block-description" }, Ye = /* @__PURE__ */ w({
296
296
  __name: "DialogBlockHeader",
297
297
  props: {
298
298
  title: {},
@@ -300,32 +300,32 @@ const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-blo
300
300
  },
301
301
  setup(t) {
302
302
  const e = t;
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)
303
+ return (o, s) => (c(), h("div", We, [
304
+ l("div", Xe, E(e.title ?? "Your expert"), 1),
305
+ l("div", Ze, E(e.description ?? "A question about this product?"), 1)
306
306
  ]));
307
307
  }
308
- }), P = (t, e) => {
308
+ }), D = (t, e) => {
309
309
  const o = t.__vccOpts || t;
310
- for (const [s, i] of e)
311
- o[s] = i;
310
+ for (const [s, r] of e)
311
+ o[s] = r;
312
312
  return o;
313
- }, Me = /* @__PURE__ */ P(Ue, [["__scopeId", "data-v-28e6dda7"]]), qe = {
313
+ }, Je = /* @__PURE__ */ D(Ye, [["__scopeId", "data-v-28e6dda7"]]), et = {
314
314
  width: "20",
315
315
  height: "20",
316
316
  viewBox: "0 0 20 20",
317
317
  fill: "none",
318
318
  xmlns: "http://www.w3.org/2000/svg"
319
- }, Be = { "clip-path": "url(#clip0_466_934)" }, Ve = ["stroke"], Ke = ["stroke"], He = /* @__PURE__ */ R({
319
+ }, tt = { "clip-path": "url(#clip0_466_934)" }, ot = ["stroke"], st = ["stroke"], nt = /* @__PURE__ */ w({
320
320
  __name: "AiStarsIcon",
321
321
  props: {
322
322
  color: {}
323
323
  },
324
324
  setup(t) {
325
325
  const e = t;
326
- return (o, s) => (_(), v("svg", qe, [
327
- u("g", Be, [
328
- u("path", {
326
+ return (o, s) => (c(), h("svg", et, [
327
+ l("g", tt, [
328
+ l("path", {
329
329
  d: `M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
330
330
  12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
331
331
  13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
@@ -340,8 +340,8 @@ const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-blo
340
340
  "stroke-width": "1.5",
341
341
  "stroke-linecap": "round",
342
342
  "stroke-linejoin": "round"
343
- }, null, 8, Ve),
344
- u("path", {
343
+ }, null, 8, ot),
344
+ l("path", {
345
345
  d: `M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
346
346
  5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
347
347
  6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
@@ -356,11 +356,11 @@ const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-blo
356
356
  "stroke-width": "1.5",
357
357
  "stroke-linecap": "round",
358
358
  "stroke-linejoin": "round"
359
- }, null, 8, Ke)
359
+ }, null, 8, st)
360
360
  ]),
361
- s[0] || (s[0] = u("defs", null, [
362
- u("clipPath", { id: "clip0_466_934" }, [
363
- u("rect", {
361
+ s[0] || (s[0] = l("defs", null, [
362
+ l("clipPath", { id: "clip0_466_934" }, [
363
+ l("rect", {
364
364
  width: "20",
365
365
  height: "20",
366
366
  fill: "white"
@@ -369,7 +369,7 @@ const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-blo
369
369
  ], -1))
370
370
  ]));
371
371
  }
372
- }), Fe = ["onClick"], Ge = { class: "dialog-block-suggestions-item-label" }, je = /* @__PURE__ */ R({
372
+ }), rt = ["onClick"], at = { class: "dialog-block-suggestions-item-label" }, it = /* @__PURE__ */ w({
373
373
  __name: "DialogBlockSuggestions",
374
374
  props: {
375
375
  client: {},
@@ -388,27 +388,27 @@ const xe = { class: "dialog-block-header-container" }, Ne = { class: "dialog-blo
388
388
  fromQuestionSuggestion: !0
389
389
  });
390
390
  };
391
- return (s, i) => (_(!0), v(N, null, ee(e.questions, (r) => (_(), v("button", {
392
- key: r.question,
391
+ return (s, r) => (c(!0), h(N, null, W(e.questions, (n) => (c(), h("button", {
392
+ key: n.question,
393
393
  class: "dialog-block-suggestions-item",
394
- onClick: (n) => o(r.question)
394
+ onClick: (i) => o(n.question)
395
395
  }, [
396
- L(He, {
396
+ I(nt, {
397
397
  class: "dialog-block-suggestions-item-icon",
398
398
  color: e.client.theme.primaryColor
399
399
  }, null, 8, ["color"]),
400
- u("span", Ge, k(r.question), 1)
401
- ], 8, Fe))), 128));
400
+ l("span", at, E(n.question), 1)
401
+ ], 8, rt))), 128));
402
402
  }
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))
403
+ }), lt = /* @__PURE__ */ D(it, [["__scopeId", "data-v-db34d4b4"]]), ct = {};
404
+ function ut(t, e) {
405
+ return c(), h(N, null, [
406
+ e[0] || (e[0] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
407
+ e[1] || (e[1] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
408
+ e[2] || (e[2] = l("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
409
409
  ], 64);
410
410
  }
411
- const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58"]]), Xe = { class: "dialog-block-suggestions-container" }, Ze = /* @__PURE__ */ R({
411
+ const dt = /* @__PURE__ */ D(ct, [["render", ut], ["__scopeId", "data-v-26a64b58"]]), pt = { class: "dialog-block-suggestions-container" }, ht = /* @__PURE__ */ w({
412
412
  __name: "DialogBlockSuggestionsContainer",
413
413
  props: {
414
414
  client: {},
@@ -420,8 +420,8 @@ const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58
420
420
  },
421
421
  setup(t) {
422
422
  const e = t;
423
- return (o, s) => (_(), v("div", Xe, [
424
- e.isLoading || !e.questions ? (_(), O(Ye, { key: 0 })) : (_(), O(Qe, {
423
+ return (o, s) => (c(), h("div", pt, [
424
+ e.isLoading || !e.questions ? (c(), O(dt, { key: 0 })) : (c(), O(lt, {
425
425
  key: 1,
426
426
  client: e.client,
427
427
  questions: e.questions,
@@ -431,30 +431,30 @@ const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58
431
431
  }, null, 8, ["client", "questions", "product-id", "product-title", "selected-variant-id"]))
432
432
  ]));
433
433
  }
434
- }), Je = /* @__PURE__ */ P(Ze, [["__scopeId", "data-v-18c9e78b"]]), et = {
434
+ }), _t = /* @__PURE__ */ D(ht, [["__scopeId", "data-v-18c9e78b"]]), ft = {
435
435
  width: "20",
436
436
  height: "20",
437
437
  viewBox: "0 0 20 20",
438
438
  fill: "none",
439
439
  xmlns: "http://www.w3.org/2000/svg"
440
- }, tt = ["stroke"], ot = /* @__PURE__ */ R({
440
+ }, gt = ["stroke"], vt = /* @__PURE__ */ w({
441
441
  __name: "ArrowIcon",
442
442
  props: {
443
443
  color: {}
444
444
  },
445
445
  setup(t) {
446
446
  const e = t;
447
- return (o, s) => (_(), v("svg", et, [
448
- u("path", {
447
+ return (o, s) => (c(), h("svg", ft, [
448
+ l("path", {
449
449
  d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
450
450
  stroke: e.color || "#ffffff",
451
451
  "stroke-width": "1.5",
452
452
  "stroke-linecap": "round",
453
453
  "stroke-linejoin": "round"
454
- }, null, 8, tt)
454
+ }, null, 8, gt)
455
455
  ]));
456
456
  }
457
- }), st = ["placeholder"], nt = ["disabled"], rt = /* @__PURE__ */ R({
457
+ }), mt = ["placeholder"], bt = ["disabled"], St = /* @__PURE__ */ w({
458
458
  __name: "DialogInput",
459
459
  props: {
460
460
  client: {},
@@ -464,93 +464,93 @@ const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58
464
464
  selectedVariantId: {}
465
465
  },
466
466
  setup(t) {
467
- const e = t, o = $(), s = $(""), i = () => {
468
- var n;
469
- (n = o.value) == null || n.focus();
470
- }, r = () => {
471
- const n = s.value;
472
- n.trim() && (e.client.sendProductMessage({
467
+ const e = t, o = k(), s = k(""), r = () => {
468
+ var i;
469
+ (i = o.value) == null || i.focus();
470
+ }, n = () => {
471
+ const i = s.value;
472
+ i.trim() && (e.client.sendProductMessage({
473
473
  productId: e.productId,
474
474
  productTitle: e.productTitle,
475
475
  selectedVariantId: e.selectedVariantId,
476
- question: n,
476
+ question: i,
477
477
  fromQuestionSuggestion: !0
478
478
  }), s.value = "");
479
479
  };
480
- return (n, a) => (_(), v("div", {
480
+ return (i, a) => (c(), h("div", {
481
481
  class: "dialog-input-wrapper",
482
- onClick: i
482
+ onClick: r
483
483
  }, [
484
- te(u("input", {
484
+ re(l("input", {
485
485
  id: "dialog-ask-anything-input-ai-input",
486
486
  ref_key: "inputRef",
487
487
  ref: o,
488
- "onUpdate:modelValue": a[0] || (a[0] = (p) => s.value = p),
488
+ "onUpdate:modelValue": a[0] || (a[0] = (_) => s.value = _),
489
489
  class: "dialog-ask-anything-input-ai-input",
490
490
  placeholder: e.placeholder ?? "Ask anything...",
491
- onKeydown: le(r, ["enter"])
492
- }, null, 40, st), [
493
- [oe, s.value]
491
+ onKeydown: ye(n, ["enter"])
492
+ }, null, 40, mt), [
493
+ [ae, s.value]
494
494
  ]),
495
- u("button", {
495
+ l("button", {
496
496
  id: "send-message-button-ai-input",
497
497
  class: "dialog-input-submit",
498
498
  disabled: !s.value.trim(),
499
- onClick: r
499
+ onClick: n
500
500
  }, [
501
- L(ot, {
501
+ I(vt, {
502
502
  color: e.client.theme.ctaTextColor
503
503
  }, null, 8, ["color"])
504
- ], 8, nt)
504
+ ], 8, bt)
505
505
  ]));
506
506
  }
507
- }), it = /* @__PURE__ */ P(rt, [["__scopeId", "data-v-4f5901c9"]]), at = /* @__PURE__ */ R({
507
+ }), Ct = /* @__PURE__ */ D(St, [["__scopeId", "data-v-4f5901c9"]]), yt = /* @__PURE__ */ w({
508
508
  __name: "ThemeProvider",
509
509
  props: {
510
510
  theme: {}
511
511
  },
512
512
  setup(t) {
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];
513
+ const e = t, o = document.body, s = (n) => n.replace(/([A-Z])/g, "-$1").toLowerCase(), r = (n) => {
514
+ n && Object.keys(n).forEach((i) => {
515
+ const a = i, _ = s(i);
516
+ if (n[a] !== void 0) {
517
+ if (typeof n[a] == "object") {
518
+ Object.keys(n[a]).forEach((u) => {
519
+ var f;
520
+ const d = u;
521
+ if (d !== void 0) {
522
+ const y = s(u), b = n[a];
523
523
  o.style.setProperty(
524
- `--dialog-theme-${p}-${S}`,
525
- (h = w[l]) == null ? void 0 : h.toString()
524
+ `--dialog-theme-${_}-${y}`,
525
+ (f = b[d]) == null ? void 0 : f.toString()
526
526
  );
527
527
  }
528
528
  });
529
529
  return;
530
530
  }
531
531
  if (a === "ctaBorderType") {
532
- const c = r[a] === "rounded" ? "24px" : "0";
533
- o.style.setProperty(`--dialog-theme-${p}`, c);
532
+ const u = n[a] === "rounded" ? "24px" : "0";
533
+ o.style.setProperty(`--dialog-theme-${_}`, u);
534
534
  return;
535
535
  }
536
536
  o.style.setProperty(
537
- `--dialog-theme-${p}`,
538
- r[a].toString()
537
+ `--dialog-theme-${_}`,
538
+ n[a].toString()
539
539
  );
540
540
  }
541
541
  });
542
542
  };
543
- return V(() => {
544
- e.theme && i(e.theme);
545
- }), U(
543
+ return B(() => {
544
+ e.theme && r(e.theme);
545
+ }), q(
546
546
  () => e.theme,
547
- (r) => {
548
- r && i(r);
547
+ (n) => {
548
+ n && r(n);
549
549
  },
550
550
  { deep: !0 }
551
- ), (r, n) => de(r.$slots, "default");
551
+ ), (n, i) => Ee(n.$slots, "default");
552
552
  }
553
- }), ct = ["dir"], lt = /* @__PURE__ */ R({
553
+ }), Et = ["dir"], wt = /* @__PURE__ */ w({
554
554
  __name: "DialogProductBlock",
555
555
  props: {
556
556
  client: {},
@@ -561,84 +561,84 @@ const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58
561
561
  },
562
562
  setup(t) {
563
563
  const e = t;
564
- V(() => {
565
- re({
564
+ B(() => {
565
+ de({
566
566
  method: "vue",
567
- version: "3.6.0"
568
- }), we("pdp-block");
567
+ version: "3.7.0"
568
+ }), qe("pdp-block");
569
569
  });
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(
570
+ const o = k(!0), s = k(void 0), r = k(0), n = C(() => {
571
+ var d;
572
+ return o.value ? "" : (d = s.value) == null ? void 0 : d.assistantName;
573
+ }), i = C(() => {
574
+ var d;
575
+ return o.value ? "" : (d = s.value) == null ? void 0 : d.description;
576
+ }), a = C(() => {
577
+ var d;
578
+ return o.value ? "" : (d = s.value) == null ? void 0 : d.inputPlaceholder;
579
+ }), _ = C(
580
580
  () => {
581
- var l;
582
- return me(
583
- (l = e.client.getLocalizationInformations()) == null ? void 0 : l.languageCode
581
+ var d;
582
+ return De(
583
+ (d = e.client.getLocalizationInformations()) == null ? void 0 : d.languageCode
584
584
  );
585
585
  }
586
- ), c = async () => {
587
- const l = ++i.value;
586
+ ), u = async () => {
587
+ const d = ++r.value;
588
588
  o.value = !0, s.value = void 0;
589
589
  try {
590
- const h = await e.client.getSuggestions(e.productId);
591
- l === i.value && (s.value = h);
592
- } catch (h) {
593
- console.error("error", h);
590
+ const f = await e.client.getSuggestions(e.productId);
591
+ d === r.value && (s.value = f);
592
+ } catch (f) {
593
+ console.error("error", f);
594
594
  } finally {
595
- l === i.value && (o.value = !1);
595
+ d === r.value && (o.value = !1);
596
596
  }
597
597
  };
598
- return U(
598
+ return q(
599
599
  () => [e.client, e.productId],
600
600
  () => {
601
- c();
601
+ u();
602
602
  },
603
603
  { immediate: !0 }
604
- ), (l, h) => (_(), O(at, {
604
+ ), (d, f) => (c(), O(yt, {
605
605
  theme: e.client.theme
606
606
  }, {
607
- default: ue(() => {
608
- var S;
607
+ default: ie(() => {
608
+ var y;
609
609
  return [
610
- u("div", {
610
+ l("div", {
611
611
  id: "dialog-instant",
612
612
  class: "dialog-block-container",
613
- dir: p.value
613
+ dir: _.value
614
614
  }, [
615
- L(Me, {
616
- title: r.value,
617
- description: n.value
615
+ I(Je, {
616
+ title: n.value,
617
+ description: i.value
618
618
  }, null, 8, ["title", "description"]),
619
- L(Je, {
619
+ I(_t, {
620
620
  client: e.client,
621
- questions: (S = s.value) == null ? void 0 : S.questions,
621
+ questions: (y = s.value) == null ? void 0 : y.questions,
622
622
  "is-loading": o.value,
623
623
  "product-id": e.productId,
624
624
  "product-title": e.productTitle,
625
625
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
626
626
  }, null, 8, ["client", "questions", "is-loading", "product-id", "product-title", "selected-variant-id"]),
627
- e.enableInput ? (_(), O(it, {
627
+ e.enableInput ? (c(), O(Ct, {
628
628
  key: 0,
629
629
  client: e.client,
630
630
  placeholder: a.value,
631
631
  "product-id": e.productId,
632
632
  "product-title": e.productTitle,
633
633
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
634
- }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : M("", !0)
635
- ], 8, ct)
634
+ }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : L("", !0)
635
+ ], 8, Et)
636
636
  ];
637
637
  }),
638
638
  _: 1
639
639
  }, 8, ["theme"]));
640
640
  }
641
- }), zt = /* @__PURE__ */ P(lt, [["__scopeId", "data-v-c57aa677"]]), dt = {}, ut = {
641
+ }), Jo = /* @__PURE__ */ D(wt, [["__scopeId", "data-v-c57aa677"]]), $t = {}, Rt = {
642
642
  width: "16",
643
643
  height: "16",
644
644
  viewBox: "0 0 16 16",
@@ -646,9 +646,9 @@ const Ye = /* @__PURE__ */ P(ze, [["render", We], ["__scopeId", "data-v-26a64b58
646
646
  xmlns: "http://www.w3.org/2000/svg",
647
647
  "aria-hidden": "true"
648
648
  };
649
- function pt(t, e) {
650
- return _(), v("svg", ut, e[0] || (e[0] = [
651
- u("path", {
649
+ function Tt(t, e) {
650
+ return c(), h("svg", Rt, e[0] || (e[0] = [
651
+ l("path", {
652
652
  d: "M8 13V3M8 3L3 8M8 3L13 8",
653
653
  stroke: "currentColor",
654
654
  "stroke-width": "1.5",
@@ -657,28 +657,28 @@ function pt(t, e) {
657
657
  }, null, -1)
658
658
  ]));
659
659
  }
660
- const _t = /* @__PURE__ */ P(dt, [["render", pt]]), ht = {
660
+ const It = /* @__PURE__ */ D($t, [["render", Tt]]), kt = {
661
661
  width: "16",
662
662
  height: "16",
663
663
  viewBox: "0 0 12 12",
664
664
  fill: "none",
665
665
  xmlns: "http://www.w3.org/2000/svg",
666
666
  "aria-hidden": "true"
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({
667
+ }, Lt = ["fill"], At = "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", xt = /* @__PURE__ */ w({
668
668
  __name: "ShurikenIcon",
669
669
  props: {
670
670
  color: {}
671
671
  },
672
672
  setup(t) {
673
673
  const e = t;
674
- return (o, s) => (_(), v("svg", ht, [
675
- u("path", {
676
- d: gt,
674
+ return (o, s) => (c(), h("svg", kt, [
675
+ l("path", {
676
+ d: At,
677
677
  fill: e.color || "currentColor"
678
- }, null, 8, ft)
678
+ }, null, 8, Lt)
679
679
  ]));
680
680
  }
681
- }), mt = { class: "dialog-search-bar-field" }, St = { class: "dialog-search-bar-icon" }, bt = ["aria-label", "placeholder", "autofocus"], Ct = ["aria-label"], Wt = /* @__PURE__ */ R({
681
+ }), Dt = { class: "dialog-search-bar-field" }, Pt = { class: "dialog-search-bar-icon" }, Ot = ["aria-label", "placeholder", "autofocus"], Nt = ["aria-label"], es = /* @__PURE__ */ w({
682
682
  __name: "DialogSearchBar",
683
683
  props: {
684
684
  controller: {},
@@ -687,22 +687,22 @@ const _t = /* @__PURE__ */ P(dt, [["render", pt]]), ht = {
687
687
  submitAriaLabel: { default: "Search" }
688
688
  },
689
689
  setup(t) {
690
- const e = t, o = $(""), s = () => {
690
+ const e = t, o = k(""), s = () => {
691
691
  e.controller.setQuery(o.value);
692
- }, i = () => {
692
+ }, r = () => {
693
693
  e.controller.submit(o.value);
694
694
  };
695
- return (r, n) => (_(), v("form", {
695
+ return (n, i) => (c(), h("form", {
696
696
  class: "dialog-search-bar",
697
697
  role: "search",
698
- onSubmit: pe(i, ["prevent"])
698
+ onSubmit: we(r, ["prevent"])
699
699
  }, [
700
- u("div", mt, [
701
- u("span", St, [
702
- L(vt)
700
+ l("div", Dt, [
701
+ l("span", Pt, [
702
+ I(xt)
703
703
  ]),
704
- te(u("input", {
705
- "onUpdate:modelValue": n[0] || (n[0] = (a) => o.value = a),
704
+ re(l("input", {
705
+ "onUpdate:modelValue": i[0] || (i[0] = (a) => o.value = a),
706
706
  type: "text",
707
707
  name: "dialog-search-query",
708
708
  class: "dialog-search-bar-input",
@@ -710,322 +710,661 @@ const _t = /* @__PURE__ */ P(dt, [["render", pt]]), ht = {
710
710
  placeholder: e.placeholder,
711
711
  autofocus: e.autoFocus,
712
712
  onInput: s
713
- }, null, 40, bt), [
714
- [oe, o.value]
713
+ }, null, 40, Ot), [
714
+ [ae, o.value]
715
715
  ])
716
716
  ]),
717
- u("button", {
717
+ l("button", {
718
718
  type: "submit",
719
719
  class: "dialog-search-bar-submit",
720
720
  "aria-label": e.submitAriaLabel
721
721
  }, [
722
- L(_t)
723
- ], 8, Ct)
722
+ I(It)
723
+ ], 8, Nt)
724
724
  ], 32));
725
725
  }
726
- }), Et = {
726
+ }), Mt = (t, e) => {
727
+ try {
728
+ return new Intl.NumberFormat(e).format(t);
729
+ } catch {
730
+ return String(t);
731
+ }
732
+ }, se = {
733
+ en: (t) => ({
734
+ searching: (e) => `Searching “${e}”…`,
735
+ noResults: "No matching products",
736
+ retry: "Retry",
737
+ collectionsLabel: "Collections",
738
+ productsLabel: "Products",
739
+ collectionsCount: (e) => e === 1 ? "1 collection" : `${t(e)} collections`,
740
+ resultsCount: (e) => e === 1 ? "1 result" : `${t(e)} results`,
741
+ seeAllLabel: (e) => e === 1 ? "See the result" : `See all ${t(e)} results`,
742
+ previous: "Previous",
743
+ next: "Next",
744
+ pageOf: (e, o) => `Page ${t(e)} / ${t(o)}`
745
+ }),
746
+ fr: (t) => ({
747
+ searching: (e) => `Recherche de « ${e} »…`,
748
+ noResults: "Aucun produit correspondant",
749
+ retry: "Réessayer",
750
+ collectionsLabel: "Collections",
751
+ productsLabel: "Produits",
752
+ collectionsCount: (e) => e === 1 ? "1 collection" : `${t(e)} collections`,
753
+ resultsCount: (e) => e === 1 ? "1 résultat" : `${t(e)} résultats`,
754
+ seeAllLabel: (e) => e === 1 ? "Voir le résultat" : `Voir les ${t(e)} résultats`,
755
+ previous: "Précédent",
756
+ next: "Suivant",
757
+ pageOf: (e, o) => `Page ${t(e)} / ${t(o)}`
758
+ }),
759
+ de: (t) => ({
760
+ searching: (e) => `Suche nach „${e}“…`,
761
+ noResults: "Keine passenden Produkte",
762
+ retry: "Erneut versuchen",
763
+ collectionsLabel: "Kollektionen",
764
+ productsLabel: "Produkte",
765
+ collectionsCount: (e) => e === 1 ? "1 Kollektion" : `${t(e)} Kollektionen`,
766
+ resultsCount: (e) => e === 1 ? "1 Ergebnis" : `${t(e)} Ergebnisse`,
767
+ seeAllLabel: (e) => e === 1 ? "Das Ergebnis anzeigen" : `Alle ${t(e)} Ergebnisse anzeigen`,
768
+ previous: "Zurück",
769
+ next: "Weiter",
770
+ pageOf: (e, o) => `Seite ${t(e)} / ${t(o)}`
771
+ }),
772
+ es: (t) => ({
773
+ searching: (e) => `Buscando «${e}»…`,
774
+ noResults: "No hay productos que coincidan",
775
+ retry: "Reintentar",
776
+ collectionsLabel: "Colecciones",
777
+ productsLabel: "Productos",
778
+ collectionsCount: (e) => e === 1 ? "1 colección" : `${t(e)} colecciones`,
779
+ resultsCount: (e) => e === 1 ? "1 resultado" : `${t(e)} resultados`,
780
+ seeAllLabel: (e) => e === 1 ? "Ver el resultado" : `Ver los ${t(e)} resultados`,
781
+ previous: "Anterior",
782
+ next: "Siguiente",
783
+ pageOf: (e, o) => `Página ${t(e)} / ${t(o)}`
784
+ }),
785
+ it: (t) => ({
786
+ searching: (e) => `Ricerca di “${e}”…`,
787
+ noResults: "Nessun prodotto corrispondente",
788
+ retry: "Riprova",
789
+ collectionsLabel: "Collezioni",
790
+ productsLabel: "Prodotti",
791
+ collectionsCount: (e) => e === 1 ? "1 collezione" : `${t(e)} collezioni`,
792
+ resultsCount: (e) => e === 1 ? "1 risultato" : `${t(e)} risultati`,
793
+ seeAllLabel: (e) => e === 1 ? "Vedi il risultato" : `Vedi tutti i ${t(e)} risultati`,
794
+ previous: "Precedente",
795
+ next: "Successivo",
796
+ pageOf: (e, o) => `Pagina ${t(e)} / ${t(o)}`
797
+ })
798
+ }, pe = (t) => {
799
+ var s;
800
+ const e = ((s = t == null ? void 0 : t.split("-")[0]) == null ? void 0 : s.toLowerCase()) ?? "en";
801
+ return (se[e] ?? se.en)((r) => Mt(r, t));
802
+ }, he = (t) => t.status !== A.LOADING && t.response !== void 0 && t.response.nbPages > 1, qt = {
727
803
  key: 0,
728
804
  "aria-label": "Search results pages",
729
805
  class: "dialog-search-pagination"
730
- }, wt = ["disabled"], It = ["disabled"], Rt = /* @__PURE__ */ R({
806
+ }, Ut = ["disabled"], Ht = ["disabled"], Vt = /* @__PURE__ */ w({
731
807
  __name: "DialogSearchPagination",
732
808
  props: {
733
809
  controller: {},
734
- state: {}
810
+ state: {},
811
+ locale: {}
735
812
  },
736
813
  setup(t) {
737
- const e = t, o = T(() => e.state.response);
738
- return (s, i) => o.value !== void 0 && o.value.nbPages > 1 ? (_(), v("nav", Et, [
739
- u("button", {
814
+ const e = t, o = C(() => e.state.response), s = C(() => pe(e.locale));
815
+ return (r, n) => o.value !== void 0 && K(he)(e.state) ? (c(), h("nav", qt, [
816
+ l("button", {
740
817
  type: "button",
741
818
  disabled: o.value.page === 0,
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", {
819
+ onClick: n[0] || (n[0] = (i) => e.controller.setPage(o.value.page - 1))
820
+ }, E(s.value.previous), 9, Ut),
821
+ l("span", null, E(s.value.pageOf(o.value.page + 1, o.value.nbPages)), 1),
822
+ l("button", {
746
823
  type: "button",
747
824
  disabled: o.value.page >= o.value.nbPages - 1,
748
- onClick: i[1] || (i[1] = (r) => e.controller.setPage(o.value.page + 1))
749
- }, " Next ", 8, It)
750
- ])) : M("", !0);
825
+ onClick: n[1] || (n[1] = (i) => e.controller.setPage(o.value.page + 1))
826
+ }, E(s.value.next), 9, Ht)
827
+ ])) : L("", !0);
751
828
  }
752
- }), G = ({ amount: t, currencyCode: e }, o) => e === void 0 ? new Intl.NumberFormat(o).format(Number(t)) : new Intl.NumberFormat(o, {
829
+ }), ne = (t) => t.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/ẞ/gu, "ß").toUpperCase().toLowerCase().replace(/ς/g, "σ"), Bt = (t, e) => {
830
+ const o = { before: "", match: t, after: "" }, s = ne(e.trim());
831
+ if (s === "")
832
+ return o;
833
+ const r = [...t], n = [];
834
+ let i = "";
835
+ r.forEach((d, f) => {
836
+ const y = ne(d);
837
+ for (let b = 0; b < y.length; b += 1)
838
+ n.push(f);
839
+ i += y;
840
+ });
841
+ const a = i.indexOf(s);
842
+ if (a === -1)
843
+ return o;
844
+ const _ = n[a], u = n[a + s.length - 1] + 1;
845
+ return {
846
+ before: r.slice(0, _).join(""),
847
+ match: r.slice(_, u).join(""),
848
+ after: r.slice(u).join("")
849
+ };
850
+ }, Kt = {
851
+ key: 0,
852
+ class: "dialog-search-muted"
853
+ }, Ft = { class: "dialog-search-match" }, jt = {
854
+ key: 1,
855
+ class: "dialog-search-muted"
856
+ }, _e = /* @__PURE__ */ w({
857
+ __name: "HighlightedTitle",
858
+ props: {
859
+ title: {},
860
+ query: {}
861
+ },
862
+ setup(t) {
863
+ const e = t, o = C(() => Bt(e.title, e.query));
864
+ return (s, r) => (c(), h(N, null, [
865
+ o.value.before !== "" ? (c(), h("span", Kt, E(o.value.before), 1)) : L("", !0),
866
+ l("span", Ft, E(o.value.match), 1),
867
+ o.value.after !== "" ? (c(), h("span", jt, E(o.value.after), 1)) : L("", !0)
868
+ ], 64));
869
+ }
870
+ }), zt = ({ amount: t, currencyCode: e }, o) => e === void 0 ? new Intl.NumberFormat(o).format(Number(t)) : new Intl.NumberFormat(o, {
753
871
  style: "currency",
754
872
  currency: 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) => {
873
+ }).format(Number(t)), Gt = (t, e) => {
756
874
  if (t === void 0)
757
875
  return "";
758
876
  try {
759
- return Tt(t, e);
877
+ return zt(t.min, e);
760
878
  } catch {
761
879
  return "";
762
880
  }
763
- }, yt = (t) => {
881
+ }, Qt = (t) => {
764
882
  try {
765
883
  const { protocol: e } = new URL(t, window.location.href);
766
884
  return e === "http:" || e === "https:" ? t : void 0;
767
885
  } catch {
768
886
  return;
769
887
  }
770
- }, $t = { class: "dialog-search-card-image" }, At = ["src", "alt"], Lt = { class: "dialog-search-card-info" }, Dt = { class: "dialog-search-card-title" }, Pt = {
771
- key: 0,
772
- class: "dialog-search-card-price"
773
- }, Z = /* @__PURE__ */ R({
774
- __name: "DialogSearchProductCardContent",
775
- props: {
776
- hit: {},
777
- locale: {}
778
- },
779
- setup(t) {
780
- const e = t, o = T(() => e.hit.title ?? e.hit.objectID), s = T(
781
- () => kt(e.hit.priceRange, e.locale)
782
- );
783
- return (i, r) => (_(), v(N, null, [
784
- u("div", $t, [
785
- e.hit.imageUrl !== void 0 ? (_(), v("img", {
786
- key: 0,
787
- src: e.hit.imageUrl,
788
- alt: o.value,
789
- loading: "lazy"
790
- }, null, 8, At)) : M("", !0)
791
- ]),
792
- u("div", Lt, [
793
- u("p", Dt, k(o.value), 1),
794
- s.value !== "" ? (_(), v("p", Pt, k(s.value), 1)) : M("", !0)
795
- ])
796
- ], 64));
797
- }
798
- }), xt = {
888
+ }, fe = (t) => t.url === void 0 || t.url === "" ? void 0 : Qt(t.url), ge = (t) => t.title ?? t.handle ?? t.objectID, Wt = {
889
+ class: "dialog-search-product-thumb",
890
+ "aria-hidden": "true"
891
+ }, Xt = ["src"], Zt = { class: "dialog-search-product-title" }, Yt = {
799
892
  key: 0,
800
- class: "dialog-search-card-body"
801
- }, Nt = ["href"], Ot = /* @__PURE__ */ R({
893
+ class: "dialog-search-product-price"
894
+ }, Jt = /* @__PURE__ */ w({
802
895
  __name: "DialogSearchProductCard",
803
896
  props: {
804
897
  controller: {},
805
898
  hit: {},
806
899
  index: {},
807
- locale: {}
900
+ locale: { default: void 0 },
901
+ query: { default: "" }
808
902
  },
809
903
  setup(t) {
810
- const e = t, o = $();
811
- U(
904
+ const e = t, o = k();
905
+ q(
812
906
  () => e.hit,
813
907
  () => {
814
908
  o.value !== void 0 && e.controller.observeResult(o.value, e.index);
815
909
  },
816
910
  { immediate: !0, flush: "post" }
817
911
  );
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 });
823
- }, r = T(
824
- () => e.hit.url === void 0 ? void 0 : yt(e.hit.url)
825
- );
826
- return (n, a) => (_(), v("li", {
912
+ const s = C(() => fe(e.hit)), r = C(
913
+ () => Gt(e.hit.priceRange, e.locale)
914
+ ), n = (a) => {
915
+ const _ = a.metaKey || a.ctrlKey || a.shiftKey || a.altKey;
916
+ e.controller.selectResult(e.index, { navigate: !_ }) && a.preventDefault();
917
+ }, i = (a) => {
918
+ a.button === 1 && e.controller.selectResult(e.index, { navigate: !1 });
919
+ };
920
+ return (a, _) => (c(), h("li", {
827
921
  ref_key: "cardRef",
828
922
  ref: o,
829
923
  class: "dialog-search-card"
830
924
  }, [
831
- r.value === void 0 ? (_(), v("div", xt, [
832
- L(Z, {
833
- hit: e.hit,
834
- locale: e.locale
835
- }, null, 8, ["hit", "locale"])
836
- ])) : (_(), v("a", {
837
- key: 1,
838
- class: "dialog-search-card-body",
839
- href: r.value,
840
- onClick: s,
841
- onAuxclick: i
842
- }, [
843
- L(Z, {
844
- hit: e.hit,
845
- locale: e.locale
846
- }, null, 8, ["hit", "locale"])
847
- ], 40, Nt))
925
+ (c(), O($e(s.value === void 0 ? "div" : "a"), Re({
926
+ class: "dialog-search-product",
927
+ href: s.value
928
+ }, Te(
929
+ s.value === void 0 ? {} : { click: n, auxclick: i }
930
+ )), {
931
+ default: ie(() => [
932
+ l("span", Wt, [
933
+ e.hit.imageUrl !== void 0 && e.hit.imageUrl !== "" ? (c(), h("img", {
934
+ key: 0,
935
+ src: e.hit.imageUrl,
936
+ alt: "",
937
+ loading: "lazy"
938
+ }, null, 8, Xt)) : L("", !0)
939
+ ]),
940
+ l("span", Zt, [
941
+ I(_e, {
942
+ title: K(ge)(e.hit),
943
+ query: e.query
944
+ }, null, 8, ["title", "query"])
945
+ ]),
946
+ r.value !== "" ? (c(), h("span", Yt, E(r.value), 1)) : L("", !0)
947
+ ]),
948
+ _: 1
949
+ }, 16, ["href"]))
848
950
  ], 512));
849
951
  }
850
- }), Ut = (t) => {
851
- const e = $(), o = $(void 0), s = $(0);
852
- return U(
952
+ }), eo = {}, to = {
953
+ width: "16",
954
+ height: "16",
955
+ viewBox: "0 0 256 256",
956
+ fill: "currentColor",
957
+ xmlns: "http://www.w3.org/2000/svg",
958
+ "aria-hidden": "true"
959
+ };
960
+ function oo(t, e) {
961
+ return c(), h("svg", to, e[0] || (e[0] = [
962
+ l("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" }, null, -1)
963
+ ]));
964
+ }
965
+ const so = /* @__PURE__ */ D(eo, [["render", oo]]), no = {}, ro = {
966
+ width: "12",
967
+ height: "12",
968
+ viewBox: "0 0 256 256",
969
+ fill: "currentColor",
970
+ xmlns: "http://www.w3.org/2000/svg",
971
+ "aria-hidden": "true"
972
+ };
973
+ function ao(t, e) {
974
+ return c(), h("svg", ro, e[0] || (e[0] = [
975
+ l("path", { d: "M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z" }, null, -1)
976
+ ]));
977
+ }
978
+ const io = /* @__PURE__ */ D(no, [["render", ao]]), ve = (t) => (t ?? []).flatMap((e) => {
979
+ const o = fe(e);
980
+ return o === void 0 ? [] : [{ collection: e, href: o }];
981
+ }), lo = {
982
+ key: 0,
983
+ class: "dialog-search-collections"
984
+ }, co = { class: "dialog-search-section-head" }, uo = { class: "dialog-search-label" }, po = { class: "dialog-search-count" }, ho = { class: "dialog-search-collection-list" }, _o = ["href"], fo = {
985
+ class: "dialog-search-collection-thumb",
986
+ "aria-hidden": "true"
987
+ }, go = ["src"], vo = { class: "dialog-search-collection-title" }, mo = { class: "dialog-search-caret" }, bo = /* @__PURE__ */ w({
988
+ __name: "DialogSearchCollections",
989
+ props: {
990
+ collections: {},
991
+ query: {},
992
+ messages: {}
993
+ },
994
+ setup(t) {
995
+ const e = t, o = C(() => ve(e.collections));
996
+ return (s, r) => o.value.length > 0 ? (c(), h("aside", lo, [
997
+ l("div", co, [
998
+ l("p", uo, E(e.messages.collectionsLabel), 1),
999
+ l("span", po, E(e.messages.collectionsCount(o.value.length)), 1)
1000
+ ]),
1001
+ l("ul", ho, [
1002
+ (c(!0), h(N, null, W(o.value, ({ collection: n, href: i }) => (c(), h("li", {
1003
+ key: n.objectID
1004
+ }, [
1005
+ l("a", {
1006
+ class: "dialog-search-collection",
1007
+ href: i
1008
+ }, [
1009
+ l("span", fo, [
1010
+ n.imageUrl !== void 0 && n.imageUrl !== "" ? (c(), h("img", {
1011
+ key: 0,
1012
+ src: n.imageUrl,
1013
+ alt: "",
1014
+ loading: "lazy"
1015
+ }, null, 8, go)) : L("", !0)
1016
+ ]),
1017
+ l("span", vo, [
1018
+ I(_e, {
1019
+ title: K(ge)(n),
1020
+ query: e.query
1021
+ }, null, 8, ["title", "query"])
1022
+ ]),
1023
+ l("span", mo, [
1024
+ I(io)
1025
+ ])
1026
+ ], 8, _o)
1027
+ ]))), 128))
1028
+ ])
1029
+ ])) : L("", !0);
1030
+ }
1031
+ }), So = { class: "dialog-search-products" }, Co = { class: "dialog-search-section-head" }, yo = { class: "dialog-search-label" }, Eo = {
1032
+ key: 0,
1033
+ class: "dialog-search-label-count"
1034
+ }, wo = { class: "dialog-search-results" }, $o = {
1035
+ key: 0,
1036
+ class: "dialog-search-empty",
1037
+ role: "status"
1038
+ }, Ro = /* @__PURE__ */ w({
1039
+ __name: "DialogSearchProducts",
1040
+ props: {
1041
+ controller: {},
1042
+ response: {},
1043
+ locale: {},
1044
+ messages: {}
1045
+ },
1046
+ setup(t) {
1047
+ const e = t;
1048
+ return (o, s) => (c(), h("section", So, [
1049
+ l("div", Co, [
1050
+ l("p", yo, [
1051
+ le(E(e.messages.productsLabel), 1),
1052
+ e.response.nbHits > 0 ? (c(), h("span", Eo, " · " + E(e.messages.resultsCount(e.response.nbHits)), 1)) : L("", !0)
1053
+ ])
1054
+ ]),
1055
+ l("ul", wo, [
1056
+ e.response.hits.length === 0 ? (c(), h("li", $o, E(e.messages.noResults), 1)) : (c(!0), h(N, { key: 1 }, W(e.response.hits, (r, n) => (c(), O(Jt, {
1057
+ key: r.objectID,
1058
+ controller: e.controller,
1059
+ hit: r,
1060
+ index: n,
1061
+ locale: e.locale,
1062
+ query: e.response.query
1063
+ }, null, 8, ["controller", "hit", "index", "locale", "query"]))), 128))
1064
+ ])
1065
+ ]));
1066
+ }
1067
+ }), H = 8, U = 16, To = 200, Io = 1440, ko = (t, e) => t.bottom > 0 && t.top < e, Lo = (t, e) => {
1068
+ const o = Math.min(
1069
+ Io,
1070
+ e - 2 * U
1071
+ ), s = t.left + t.width / 2 - o / 2;
1072
+ return { left: `${Math.min(
1073
+ Math.max(s, U),
1074
+ e - U - o
1075
+ )}px`, width: `${o}px` };
1076
+ }, Ao = (t, e, o) => {
1077
+ const s = o - t.bottom - H - U, r = t.top - H - U, n = Lo(t, e);
1078
+ return s < To && r > s ? {
1079
+ ...n,
1080
+ bottom: `${o - t.top + H}px`,
1081
+ maxHeight: `${Math.max(r, 0)}px`
1082
+ } : {
1083
+ ...n,
1084
+ top: `${t.bottom + H}px`,
1085
+ maxHeight: `${Math.max(s, 0)}px`
1086
+ };
1087
+ }, xo = (t) => {
1088
+ const e = t.trim().replace(/^#/, "");
1089
+ if (!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e))
1090
+ return;
1091
+ const o = e.length <= 4 ? [...e].map((s) => s + s).join("") : e;
1092
+ return [0, 2, 4].map(
1093
+ (s) => Number.parseInt(o.slice(s, s + 2), 16)
1094
+ );
1095
+ }, Do = (t) => {
1096
+ const e = /^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(t);
1097
+ if (e !== null)
1098
+ return [e[1], e[2], e[3]].map(Number);
1099
+ }, Po = (t) => {
1100
+ if (typeof document > "u")
1101
+ return;
1102
+ const e = document.createElement("span");
1103
+ if (e.style.color = t, e.style.color === "")
1104
+ return;
1105
+ document.body.appendChild(e);
1106
+ const o = Do(getComputedStyle(e).color);
1107
+ return e.remove(), o;
1108
+ }, Oo = (t) => xo(t) ?? Po(t), No = (t) => {
1109
+ const e = t / 255;
1110
+ return e <= 0.03928 ? e / 12.92 : ((e + 0.055) / 1.055) ** 2.4;
1111
+ }, me = (t) => {
1112
+ const e = Oo(t);
1113
+ if (e === void 0)
1114
+ return;
1115
+ const [o, s, r] = e.map(No);
1116
+ return 0.2126 * o + 0.7152 * s + 0.0722 * r;
1117
+ }, Mo = "#181825", qo = "#ffffff", Uo = "straight", G = 0.5, Q = {
1118
+ light: {
1119
+ panel: "#ffffff",
1120
+ side: "#fafbfc",
1121
+ text: "#111827",
1122
+ "text-sec": "#6b7280",
1123
+ border: "#eceef2",
1124
+ hover: "#eef2f7",
1125
+ thumb: "#eef1f5"
1126
+ },
1127
+ dark: {
1128
+ panel: "#15171c",
1129
+ side: "#1b1e25",
1130
+ text: "#f3f4f6",
1131
+ "text-sec": "#9ca3af",
1132
+ border: "#2b2f38",
1133
+ hover: "#242830",
1134
+ thumb: "#2b2f38"
1135
+ }
1136
+ }, Ho = {
1137
+ rectangle: {
1138
+ "r-panel": "4px",
1139
+ "r-item": "4px",
1140
+ "r-thumb": "2px",
1141
+ "r-btn": "4px"
1142
+ },
1143
+ "rectangle-rounded": {
1144
+ "r-panel": "16px",
1145
+ "r-item": "10px",
1146
+ "r-thumb": "8px",
1147
+ "r-btn": "10px"
1148
+ }
1149
+ }, V = (t) => t === void 0 || t.trim() === "" ? void 0 : t.trim(), Vo = (t) => {
1150
+ const e = t === void 0 ? void 0 : me(t);
1151
+ return e === void 0 ? "light" : e < G ? "dark" : "light";
1152
+ }, Bo = (t, e) => {
1153
+ const o = me(t);
1154
+ return o === void 0 ? Q[e].text : (e === "light" ? o < G : o >= G) ? t : Q[e].text;
1155
+ }, Ko = (t) => {
1156
+ const e = Vo(V(t == null ? void 0 : t.backgroundColor)), o = (t == null ? void 0 : t.ctaBorderType) === Uo ? "rectangle" : "rectangle-rounded", s = V(t == null ? void 0 : t.primaryColor) ?? Mo, r = V(t == null ? void 0 : t.fontFamily), n = {
1157
+ ...Q[e],
1158
+ ...Ho[o],
1159
+ primary: s,
1160
+ accent: Bo(s, e),
1161
+ "cta-text": V(t == null ? void 0 : t.ctaTextColor) ?? qo,
1162
+ ...r === void 0 ? {} : { font: r }
1163
+ };
1164
+ return Object.fromEntries(
1165
+ Object.entries(n).map(([i, a]) => [`--dso-${i}`, a])
1166
+ );
1167
+ }, Fo = (t) => {
1168
+ const e = k(), o = k(void 0), s = k({ width: 0, height: 0 });
1169
+ return q(
853
1170
  t,
854
- (i, r, n) => {
855
- if (!i)
1171
+ (r, n, i) => {
1172
+ if (!r)
856
1173
  return;
857
1174
  const a = () => {
858
- const p = e.value;
859
- if (p === void 0)
1175
+ const _ = e.value;
1176
+ if (_ === void 0)
860
1177
  return;
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 });
1178
+ const u = _.previousElementSibling ?? _, { top: d, bottom: f, left: y, width: b } = u.getBoundingClientRect();
1179
+ (s.value.width !== window.innerWidth || s.value.height !== window.innerHeight) && (s.value = {
1180
+ width: window.innerWidth,
1181
+ height: window.innerHeight
1182
+ });
1183
+ const g = o.value;
1184
+ (g === void 0 || g.top !== d || g.bottom !== f || g.left !== y || g.width !== b) && (o.value = { top: d, bottom: f, left: y, width: b });
865
1185
  };
866
- a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), n(() => {
1186
+ a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), i(() => {
867
1187
  window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
868
1188
  });
869
1189
  },
870
1190
  { immediate: !0, flush: "post" }
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
1191
+ ), { anchorRef: e, rect: o, viewport: s };
1192
+ }, jo = (t, e) => {
1193
+ const o = k(!1), s = k(), r = C(
1194
+ () => t.value.status !== A.IDLE && !o.value
875
1195
  );
876
- U(
1196
+ q(
877
1197
  () => t.value.query,
878
1198
  () => {
879
1199
  o.value = !1;
880
1200
  }
881
- ), U(
882
- i,
883
- (n, a, p) => {
884
- if (!n)
1201
+ ), q(
1202
+ r,
1203
+ (i, a, _) => {
1204
+ if (!i)
885
1205
  return;
886
- const c = (l) => {
887
- var b, C;
888
- const h = l.target;
889
- if (!(h instanceof Node))
1206
+ const u = (d) => {
1207
+ var $, R;
1208
+ const f = d.target;
1209
+ if (!(f instanceof Node))
890
1210
  return;
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);
1211
+ const y = ($ = e.value) == null ? void 0 : $.previousElementSibling, b = ((R = s.value) == null ? void 0 : R.contains(f)) ?? !1, g = (y == null ? void 0 : y.contains(f)) ?? !1;
1212
+ !b && !g && (o.value = !0);
893
1213
  };
894
- document.addEventListener("pointerdown", c), p(
895
- () => document.removeEventListener("pointerdown", c)
1214
+ document.addEventListener("pointerdown", u), _(
1215
+ () => document.removeEventListener("pointerdown", u)
896
1216
  );
897
1217
  },
898
1218
  { immediate: !0 }
899
1219
  );
900
- const r = () => {
1220
+ const n = () => {
901
1221
  o.value = !1;
902
1222
  };
903
- return V(() => {
904
- var n, a;
905
- (a = (n = e.value) == null ? void 0 : n.previousElementSibling) == null || a.addEventListener(
1223
+ return B(() => {
1224
+ var i, a;
1225
+ (a = (i = e.value) == null ? void 0 : i.previousElementSibling) == null || a.addEventListener(
906
1226
  "focusin",
907
- r
1227
+ n
908
1228
  );
909
- }), se(() => {
910
- var n, a;
911
- (a = (n = e.value) == null ? void 0 : n.previousElementSibling) == null || a.removeEventListener(
1229
+ }), ce(() => {
1230
+ var i, a;
1231
+ (a = (i = e.value) == null ? void 0 : i.previousElementSibling) == null || a.removeEventListener(
912
1232
  "focusin",
913
- r
1233
+ n
914
1234
  );
915
- }), { isOpen: i, panelRef: s };
916
- }, qt = {
1235
+ }), { isOpen: r, panelRef: s };
1236
+ }, zo = {
917
1237
  key: 0,
918
- role: "status",
919
- class: "dialog-search-status"
920
- }, Bt = {
921
- key: 1,
922
1238
  class: "dialog-search-error"
923
- }, Vt = {
1239
+ }, Go = {
924
1240
  role: "alert",
925
1241
  class: "dialog-search-status dialog-search-status-error"
926
- }, Kt = {
927
- key: 2,
928
- role: "status",
929
- class: "dialog-search-status"
930
- }, Ht = {
1242
+ }, Qo = {
1243
+ key: 1,
931
1244
  role: "status",
932
1245
  class: "dialog-search-status"
933
- }, Ft = { class: "dialog-search-results" }, B = 8, J = 16, Gt = 200, Yt = /* @__PURE__ */ R({
1246
+ }, Wo = {
1247
+ key: 0,
1248
+ class: "dialog-search-footer"
1249
+ }, Xo = ["href"], ts = /* @__PURE__ */ w({
934
1250
  __name: "DialogSearchResults",
935
1251
  props: {
936
1252
  controller: {},
937
1253
  state: {},
938
- locale: {}
1254
+ locale: { default: void 0 },
1255
+ theme: { default: void 0 },
1256
+ layout: { default: "list" },
1257
+ seeAllHref: { type: Function, default: void 0 }
939
1258
  },
940
1259
  setup(t) {
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`
947
- } : {
948
- ...f,
949
- top: `${d.bottom + B}px`,
950
- maxHeight: `${Math.max(C, 0)}px`
951
- };
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)
1260
+ const e = t, o = (p) => p instanceof Pe ? `Search failed (${p.status}${p.code ? ` ${p.code}` : ""}): ${p.message}` : "Search failed: network error. Check your connection and try again.", s = C(() => e.state), r = C(() => e.state.status !== A.IDLE), { anchorRef: n, rect: i, viewport: a } = Fo(r), { isOpen: _, panelRef: u } = jo(s, n), d = C(
1261
+ () => _.value && i.value !== void 0 && ko(i.value, a.value.height)
1262
+ ), f = C(() => Ko(e.theme)), y = C(() => ({
1263
+ ...i.value === void 0 ? {} : Ao(i.value, a.value.width, a.value.height),
1264
+ ...f.value
1265
+ })), b = C(() => pe(e.locale)), g = C(() => e.state.response), $ = C(
1266
+ () => {
1267
+ var p, S;
1268
+ return ((S = (p = e.state.sections) == null ? void 0 : p.collections) == null ? void 0 : S.hits) ?? [];
1269
+ }
1270
+ ), R = C(
1271
+ () => ve($.value).length > 0
1272
+ ), T = C(
1273
+ () => e.seeAllHref !== void 0 && g.value !== void 0 && g.value.nbHits > 0
1274
+ ), m = C(() => !T.value && he(e.state)), v = C(
1275
+ () => {
1276
+ var p;
1277
+ return g.value === void 0 || (p = e.seeAllHref) == null ? void 0 : p.call(e, g.value.query);
1278
+ }
956
1279
  );
957
- return (d, b) => {
958
- var C;
959
- return _(), v(N, null, [
960
- u("div", {
961
- ref_key: "anchorRef",
962
- ref: a
963
- }, null, 512),
964
- S.value ? (_(), O(_e, {
965
- key: 0,
966
- to: "body"
1280
+ return (p, S) => (c(), h(N, null, [
1281
+ l("div", {
1282
+ ref_key: "anchorRef",
1283
+ ref: n
1284
+ }, null, 512),
1285
+ d.value ? (c(), O(Ie, {
1286
+ key: 0,
1287
+ to: "body"
1288
+ }, [
1289
+ l("div", {
1290
+ ref_key: "panelRef",
1291
+ ref: u,
1292
+ class: Y(["dialog-search-panel", `dialog-search-panel--${e.layout}`]),
1293
+ style: ke(y.value)
967
1294
  }, [
968
- u("div", {
969
- ref_key: "panelRef",
970
- ref: h,
971
- class: "dialog-search-panel",
972
- style: he(w.value)
973
- }, [
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", {
977
- type: "button",
978
- class: "dialog-search-retry",
979
- onClick: b[0] || (b[0] = (I) => e.controller.retry())
980
- }, " Retry ")
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,
986
- controller: e.controller,
987
- hit: I,
988
- index: f,
989
- locale: e.locale
990
- }, null, 8, ["controller", "hit", "index", "locale"]))), 128))
991
- ]),
992
- L(Rt, {
1295
+ e.state.status === K(A).ERROR ? (c(), h("div", zo, [
1296
+ l("p", Go, E(o(e.state.error)), 1),
1297
+ l("button", {
1298
+ type: "button",
1299
+ class: "dialog-search-retry",
1300
+ onClick: S[0] || (S[0] = (P) => e.controller.retry())
1301
+ }, E(b.value.retry), 1)
1302
+ ])) : g.value === void 0 ? (c(), h("p", Qo, E(b.value.searching(e.state.query)), 1)) : (c(), h(N, { key: 2 }, [
1303
+ l("div", {
1304
+ class: Y([
1305
+ "dialog-search-body",
1306
+ { "dialog-search-body--no-collections": !R.value }
1307
+ ])
1308
+ }, [
1309
+ I(bo, {
1310
+ collections: $.value,
1311
+ query: g.value.query,
1312
+ messages: b.value
1313
+ }, null, 8, ["collections", "query", "messages"]),
1314
+ I(Ro, {
993
1315
  controller: e.controller,
994
- state: e.state
995
- }, null, 8, ["controller", "state"])
996
- ], 64)) : M("", !0)
997
- ], 4)
998
- ])) : M("", !0)
999
- ], 64);
1000
- };
1316
+ response: g.value,
1317
+ locale: e.locale,
1318
+ messages: b.value
1319
+ }, null, 8, ["controller", "response", "locale", "messages"])
1320
+ ], 2),
1321
+ T.value || m.value ? (c(), h("div", Wo, [
1322
+ T.value ? (c(), h("a", {
1323
+ key: 0,
1324
+ class: "dialog-search-cta",
1325
+ href: v.value
1326
+ }, [
1327
+ le(E(b.value.seeAllLabel(g.value.nbHits)) + " ", 1),
1328
+ I(so)
1329
+ ], 8, Xo)) : (c(), O(Vt, {
1330
+ key: 1,
1331
+ controller: e.controller,
1332
+ state: e.state,
1333
+ locale: e.locale
1334
+ }, null, 8, ["controller", "state", "locale"]))
1335
+ ])) : L("", !0)
1336
+ ], 64))
1337
+ ], 6)
1338
+ ])) : L("", !0)
1339
+ ], 64));
1001
1340
  }
1002
- }), Xt = (t) => {
1003
- const { client: e, surface: o = "search_page", ...s } = t, i = Pe({
1004
- search: (a, p) => e.search(a, p),
1341
+ }), os = (t) => {
1342
+ const { client: e, surface: o = "search_page", ...s } = t, r = Qe({
1343
+ search: (a, _) => e.search(a, _),
1005
1344
  analytics: {
1006
1345
  surface: o,
1007
1346
  trackViewSearchResults: (a) => e.trackViewSearchResults(a),
1008
1347
  trackSelectSearchResult: (a) => e.trackSelectSearchResult(a)
1009
1348
  },
1010
1349
  ...s
1011
- }), r = fe(i.getState()), n = i.subscribe(() => {
1012
- r.value = i.getState();
1350
+ }), n = Le(r.getState()), i = r.subscribe(() => {
1351
+ n.value = r.getState();
1013
1352
  });
1014
- return V(() => {
1015
- re({
1353
+ return B(() => {
1354
+ de({
1016
1355
  method: "vue",
1017
- version: "3.6.0"
1356
+ version: "3.7.0"
1018
1357
  });
1019
- }), se(() => {
1020
- n(), i.dispose();
1021
- }), { controller: i, state: r };
1358
+ }), ce(() => {
1359
+ i(), r.dispose();
1360
+ }), { controller: r, state: n, theme: e.theme };
1022
1361
  };
1023
1362
  export {
1024
- it as DialogInput,
1025
- zt as DialogProductBlock,
1026
- Wt as DialogSearchBar,
1027
- Rt as DialogSearchPagination,
1028
- Ot as DialogSearchProductCard,
1029
- Yt as DialogSearchResults,
1030
- Xt as useDialogSearch
1363
+ Ct as DialogInput,
1364
+ Jo as DialogProductBlock,
1365
+ es as DialogSearchBar,
1366
+ Vt as DialogSearchPagination,
1367
+ Jt as DialogSearchProductCard,
1368
+ ts as DialogSearchResults,
1369
+ os as useDialogSearch
1031
1370
  };