@askdialog/dialog-react 2.7.0 → 2.9.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.
- package/README.md +8 -9
- package/dist/components/DialogProductBlock/DialogAskSomethingElse.d.ts +12 -0
- package/dist/components/DialogProductBlock/DialogProductBlock.d.ts +1 -0
- package/dist/components/DialogProductBlock/inputMessages.d.ts +1 -0
- package/dist/components/DialogSearch/DialogSearchProductCard.d.ts +2 -2
- package/dist/components/DialogSearch/DialogSearchProducts.d.ts +2 -2
- package/dist/components/DialogSearch/searchDisplay.d.ts +8 -3
- package/dist/components/DialogSearch/useDialogSearch.d.ts +4 -4
- package/dist/dialog-react.css +1 -1
- package/dist/dialog-react.js +376 -336
- package/dist/dialog-react.umd.cjs +1 -1
- package/package.json +3 -3
package/dist/dialog-react.js
CHANGED
|
@@ -1,14 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef as b, useState as v, useEffect as f, useMemo as
|
|
3
|
-
import { registerDialogInstallation as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as n, jsxs as p, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as b, useState as v, useEffect as f, useMemo as S, useLayoutEffect as V, useCallback as P, useSyncExternalStore as K } from "react";
|
|
3
|
+
import { registerDialogInstallation as M, addAuditCapability as F, resolveTextDirection as U, SearchStatus as L, DialogSearchError as Q, createSearchController as W } from "@askdialog/dialog-sdk";
|
|
4
|
+
import { createPortal as Z } from "react-dom";
|
|
5
|
+
const R = {
|
|
6
|
+
en: {
|
|
7
|
+
placeholder: "Ask the AI a question",
|
|
8
|
+
aiDisclosure: "You're chatting with an AI assistant. It can make mistakes, so please double-check important information",
|
|
9
|
+
askSomethingElse: "Ask something else"
|
|
10
|
+
},
|
|
11
|
+
fr: {
|
|
12
|
+
placeholder: "Posez une question à l'IA",
|
|
13
|
+
aiDisclosure: "Vous discutez avec un assistant IA. Il peut se tromper, pensez à vérifier les informations importantes",
|
|
14
|
+
askSomethingElse: "Posez une autre question"
|
|
15
|
+
},
|
|
16
|
+
es: {
|
|
17
|
+
placeholder: "Haz una pregunta a la IA",
|
|
18
|
+
aiDisclosure: "Estás chateando con un asistente de IA. Puede cometer errores, así que verifica la información importante",
|
|
19
|
+
askSomethingElse: "Pregunta otra cosa"
|
|
20
|
+
}
|
|
21
|
+
}, _ = (e) => {
|
|
22
|
+
var o;
|
|
23
|
+
const t = ((o = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : o.toLowerCase()) ?? "en";
|
|
24
|
+
return R[t] ?? R.en;
|
|
25
|
+
}, X = ({
|
|
26
|
+
client: e,
|
|
27
|
+
questions: t,
|
|
28
|
+
disabled: o,
|
|
29
|
+
productId: s,
|
|
30
|
+
productTitle: r,
|
|
31
|
+
selectedVariantId: a
|
|
32
|
+
}) => /* @__PURE__ */ n(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
type: "button",
|
|
36
|
+
className: "dialog-ask-something-else",
|
|
37
|
+
disabled: o,
|
|
38
|
+
onClick: () => {
|
|
39
|
+
e.openAssistantWithSuggestions({
|
|
40
|
+
questions: t ?? [],
|
|
41
|
+
product: {
|
|
42
|
+
id: s,
|
|
43
|
+
title: r,
|
|
44
|
+
selectedVariantId: a
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
children: _(e.locale).askSomethingElse
|
|
49
|
+
}
|
|
50
|
+
), G = ({
|
|
6
51
|
title: e = "Your expert",
|
|
7
52
|
description: t = "A question about this product?"
|
|
8
|
-
}) => /* @__PURE__ */
|
|
53
|
+
}) => /* @__PURE__ */ p("div", { className: "dialog-block-header-container", children: [
|
|
9
54
|
/* @__PURE__ */ n("div", { className: "dialog-block-title", children: e }),
|
|
10
55
|
/* @__PURE__ */ n("div", { className: "dialog-block-description", children: t })
|
|
11
|
-
] }),
|
|
56
|
+
] }), Y = ({ color: e = "#181825" }) => /* @__PURE__ */ p(
|
|
12
57
|
"svg",
|
|
13
58
|
{
|
|
14
59
|
width: "20",
|
|
@@ -17,7 +62,7 @@ const Q = ({
|
|
|
17
62
|
fill: "none",
|
|
18
63
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19
64
|
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ p("g", { clipPath: "url(#clip0_466_934)", children: [
|
|
21
66
|
/* @__PURE__ */ n(
|
|
22
67
|
"path",
|
|
23
68
|
{
|
|
@@ -42,55 +87,55 @@ const Q = ({
|
|
|
42
87
|
/* @__PURE__ */ n("defs", { children: /* @__PURE__ */ n("clipPath", { id: "clip0_466_934", children: /* @__PURE__ */ n("rect", { width: "20", height: "20", fill: "white" }) }) })
|
|
43
88
|
]
|
|
44
89
|
}
|
|
45
|
-
),
|
|
90
|
+
), J = ({
|
|
46
91
|
client: e,
|
|
47
92
|
questions: t,
|
|
48
|
-
productId:
|
|
93
|
+
productId: o,
|
|
49
94
|
productTitle: s,
|
|
50
|
-
selectedVariantId:
|
|
95
|
+
selectedVariantId: r
|
|
51
96
|
}) => {
|
|
52
|
-
const
|
|
97
|
+
const a = (l) => {
|
|
53
98
|
e.sendProductMessage({
|
|
54
|
-
productId:
|
|
99
|
+
productId: o,
|
|
55
100
|
productTitle: s,
|
|
56
|
-
selectedVariantId:
|
|
101
|
+
selectedVariantId: r,
|
|
57
102
|
question: l,
|
|
58
103
|
fromQuestionSuggestion: !0
|
|
59
104
|
});
|
|
60
105
|
};
|
|
61
|
-
return /* @__PURE__ */ n(C, { children: t.map((l) => /* @__PURE__ */
|
|
106
|
+
return /* @__PURE__ */ n(C, { children: t.map((l) => /* @__PURE__ */ p(
|
|
62
107
|
"button",
|
|
63
108
|
{
|
|
64
109
|
className: "dialog-block-suggestions-item",
|
|
65
|
-
onClick: () =>
|
|
110
|
+
onClick: () => a(l.question),
|
|
66
111
|
children: [
|
|
67
|
-
/* @__PURE__ */ n(
|
|
112
|
+
/* @__PURE__ */ n(Y, { color: e.theme.primaryColor }),
|
|
68
113
|
/* @__PURE__ */ n("span", { className: "dialog-block-suggestions-item-label", children: l.question })
|
|
69
114
|
]
|
|
70
115
|
},
|
|
71
116
|
l.question
|
|
72
117
|
)) });
|
|
73
|
-
},
|
|
118
|
+
}, ee = () => /* @__PURE__ */ p(C, { children: [
|
|
74
119
|
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" }),
|
|
75
120
|
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" }),
|
|
76
121
|
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" })
|
|
77
|
-
] }),
|
|
122
|
+
] }), te = ({
|
|
78
123
|
client: e,
|
|
79
124
|
questions: t,
|
|
80
|
-
isLoading:
|
|
125
|
+
isLoading: o,
|
|
81
126
|
productId: s,
|
|
82
|
-
productTitle:
|
|
83
|
-
selectedVariantId:
|
|
84
|
-
}) => /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-container", children:
|
|
85
|
-
|
|
127
|
+
productTitle: r,
|
|
128
|
+
selectedVariantId: a
|
|
129
|
+
}) => /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-container", children: o || !t ? /* @__PURE__ */ n(ee, {}) : /* @__PURE__ */ n(
|
|
130
|
+
J,
|
|
86
131
|
{
|
|
87
132
|
client: e,
|
|
88
133
|
questions: t,
|
|
89
134
|
productId: s,
|
|
90
|
-
productTitle:
|
|
91
|
-
selectedVariantId:
|
|
135
|
+
productTitle: r,
|
|
136
|
+
selectedVariantId: a
|
|
92
137
|
}
|
|
93
|
-
) }),
|
|
138
|
+
) }), se = ({ color: e = "#ffffff" }) => /* @__PURE__ */ n(
|
|
94
139
|
"svg",
|
|
95
140
|
{
|
|
96
141
|
width: "20",
|
|
@@ -109,57 +154,40 @@ const Q = ({
|
|
|
109
154
|
}
|
|
110
155
|
)
|
|
111
156
|
}
|
|
112
|
-
),
|
|
113
|
-
en: {
|
|
114
|
-
placeholder: "Ask the AI a question",
|
|
115
|
-
aiDisclosure: "You're chatting with an AI assistant. It can make mistakes, so please double-check important information"
|
|
116
|
-
},
|
|
117
|
-
fr: {
|
|
118
|
-
placeholder: "Posez une question à l'IA",
|
|
119
|
-
aiDisclosure: "Vous discutez avec un assistant IA. Il peut se tromper, pensez à vérifier les informations importantes"
|
|
120
|
-
},
|
|
121
|
-
es: {
|
|
122
|
-
placeholder: "Haz una pregunta a la IA",
|
|
123
|
-
aiDisclosure: "Estás chateando con un asistente de IA. Puede cometer errores, así que verifica la información importante"
|
|
124
|
-
}
|
|
125
|
-
}, ee = (e) => {
|
|
126
|
-
var r;
|
|
127
|
-
const t = ((r = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : r.toLowerCase()) ?? "en";
|
|
128
|
-
return E[t] ?? E.en;
|
|
129
|
-
}, te = ({
|
|
157
|
+
), oe = ({
|
|
130
158
|
client: e,
|
|
131
159
|
productId: t,
|
|
132
|
-
productTitle:
|
|
160
|
+
productTitle: o,
|
|
133
161
|
selectedVariantId: s
|
|
134
162
|
}) => {
|
|
135
|
-
const
|
|
163
|
+
const r = b(null), [a, l] = v(""), i = _(e.locale), c = () => {
|
|
136
164
|
var d;
|
|
137
|
-
(d =
|
|
165
|
+
(d = r.current) == null || d.focus();
|
|
138
166
|
}, u = () => {
|
|
139
|
-
const d =
|
|
167
|
+
const d = a;
|
|
140
168
|
d.trim() && (e.sendProductMessage({
|
|
141
169
|
productId: t,
|
|
142
|
-
productTitle:
|
|
170
|
+
productTitle: o,
|
|
143
171
|
selectedVariantId: s,
|
|
144
172
|
question: d,
|
|
145
173
|
fromQuestionSuggestion: !0
|
|
146
174
|
}), l(""));
|
|
147
|
-
},
|
|
175
|
+
}, m = (d) => {
|
|
148
176
|
d.key === "Enter" && u();
|
|
149
177
|
};
|
|
150
|
-
return /* @__PURE__ */
|
|
151
|
-
/* @__PURE__ */
|
|
178
|
+
return /* @__PURE__ */ p("div", { className: "dialog-input-container", children: [
|
|
179
|
+
/* @__PURE__ */ p("div", { className: "dialog-input-wrapper", onClick: c, children: [
|
|
152
180
|
/* @__PURE__ */ n(
|
|
153
181
|
"input",
|
|
154
182
|
{
|
|
155
183
|
id: "dialog-ask-anything-input-ai-input",
|
|
156
|
-
ref:
|
|
157
|
-
value:
|
|
184
|
+
ref: r,
|
|
185
|
+
value: a,
|
|
158
186
|
onChange: (d) => l(d.target.value),
|
|
159
187
|
className: "dialog-ask-anything-input-ai-input",
|
|
160
|
-
placeholder:
|
|
188
|
+
placeholder: i.placeholder,
|
|
161
189
|
"aria-describedby": "dialog-input-ai-disclosure",
|
|
162
|
-
onKeyDown:
|
|
190
|
+
onKeyDown: m
|
|
163
191
|
}
|
|
164
192
|
),
|
|
165
193
|
/* @__PURE__ */ n(
|
|
@@ -167,30 +195,30 @@ const Q = ({
|
|
|
167
195
|
{
|
|
168
196
|
id: "send-message-button-ai-input",
|
|
169
197
|
className: "dialog-input-submit",
|
|
170
|
-
disabled: !
|
|
198
|
+
disabled: !a.trim(),
|
|
171
199
|
onClick: u,
|
|
172
|
-
children: /* @__PURE__ */ n(
|
|
200
|
+
children: /* @__PURE__ */ n(se, { color: e.theme.ctaTextColor })
|
|
173
201
|
}
|
|
174
202
|
)
|
|
175
203
|
] }),
|
|
176
|
-
/* @__PURE__ */ n("p", { id: "dialog-input-ai-disclosure", className: "dialog-input-ai-disclosure", children:
|
|
204
|
+
/* @__PURE__ */ n("p", { id: "dialog-input-ai-disclosure", className: "dialog-input-ai-disclosure", children: i.aiDisclosure })
|
|
177
205
|
] });
|
|
178
|
-
},
|
|
206
|
+
}, I = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), ne = (e) => {
|
|
179
207
|
if (!e) return;
|
|
180
208
|
const t = document.body;
|
|
181
|
-
Object.keys(e).forEach((
|
|
182
|
-
const s =
|
|
209
|
+
Object.keys(e).forEach((o) => {
|
|
210
|
+
const s = o, r = I(o);
|
|
183
211
|
if (e[s] !== void 0) {
|
|
184
212
|
if (typeof e[s] == "object") {
|
|
185
213
|
Object.keys(e[s]).forEach(
|
|
186
|
-
(
|
|
187
|
-
var
|
|
188
|
-
const l =
|
|
214
|
+
(a) => {
|
|
215
|
+
var i;
|
|
216
|
+
const l = a;
|
|
189
217
|
if (l !== void 0) {
|
|
190
|
-
const c =
|
|
218
|
+
const c = I(a), u = e[s];
|
|
191
219
|
t.style.setProperty(
|
|
192
|
-
`--dialog-theme-${
|
|
193
|
-
(
|
|
220
|
+
`--dialog-theme-${r}-${c}`,
|
|
221
|
+
(i = u[l]) == null ? void 0 : i.toString()
|
|
194
222
|
);
|
|
195
223
|
}
|
|
196
224
|
}
|
|
@@ -198,98 +226,111 @@ const Q = ({
|
|
|
198
226
|
return;
|
|
199
227
|
}
|
|
200
228
|
if (s === "ctaBorderType") {
|
|
201
|
-
const
|
|
202
|
-
t.style.setProperty(`--dialog-theme-${
|
|
229
|
+
const a = e[s] === "rounded" ? "24px" : "0";
|
|
230
|
+
t.style.setProperty(`--dialog-theme-${r}`, a);
|
|
203
231
|
return;
|
|
204
232
|
}
|
|
205
233
|
t.style.setProperty(
|
|
206
|
-
`--dialog-theme-${
|
|
234
|
+
`--dialog-theme-${r}`,
|
|
207
235
|
e[s].toString()
|
|
208
236
|
);
|
|
209
237
|
}
|
|
210
238
|
});
|
|
211
239
|
}, re = ({ theme: e, children: t }) => (f(() => {
|
|
212
|
-
e &&
|
|
213
|
-
}, [e]), /* @__PURE__ */ n(C, { children: t })),
|
|
240
|
+
e && ne(e);
|
|
241
|
+
}, [e]), /* @__PURE__ */ n(C, { children: t })), ie = 2, ae = 5, Ze = ({
|
|
214
242
|
client: e,
|
|
215
243
|
productId: t,
|
|
216
|
-
productTitle:
|
|
244
|
+
productTitle: o,
|
|
217
245
|
selectedVariantId: s,
|
|
218
|
-
enableInput:
|
|
246
|
+
enableInput: r = !1
|
|
219
247
|
}) => {
|
|
220
|
-
|
|
248
|
+
var g;
|
|
249
|
+
const [a, l] = v(!0), [i, c] = v(
|
|
221
250
|
void 0
|
|
222
251
|
);
|
|
223
252
|
f(() => {
|
|
224
|
-
|
|
253
|
+
M({
|
|
225
254
|
method: "react",
|
|
226
|
-
version: "2.
|
|
227
|
-
}),
|
|
255
|
+
version: "2.9.0"
|
|
256
|
+
}), F("pdp-block");
|
|
228
257
|
}, []);
|
|
229
|
-
const u =
|
|
230
|
-
() =>
|
|
231
|
-
[
|
|
232
|
-
),
|
|
233
|
-
() =>
|
|
234
|
-
[
|
|
235
|
-
), d =
|
|
236
|
-
() =>
|
|
237
|
-
[
|
|
238
|
-
),
|
|
258
|
+
const u = S(
|
|
259
|
+
() => a ? "" : i == null ? void 0 : i.assistantName,
|
|
260
|
+
[i, a]
|
|
261
|
+
), m = S(
|
|
262
|
+
() => a ? "" : i == null ? void 0 : i.description,
|
|
263
|
+
[i, a]
|
|
264
|
+
), d = S(
|
|
265
|
+
() => a ? "" : i == null ? void 0 : i.inputPlaceholder,
|
|
266
|
+
[i, a]
|
|
267
|
+
), h = S(
|
|
239
268
|
() => {
|
|
240
|
-
var
|
|
241
|
-
return
|
|
269
|
+
var y;
|
|
270
|
+
return U((y = e.getLocalizationInformations()) == null ? void 0 : y.languageCode);
|
|
242
271
|
},
|
|
243
272
|
[e]
|
|
244
273
|
);
|
|
245
274
|
return f(() => {
|
|
246
|
-
let
|
|
275
|
+
let y = !0;
|
|
247
276
|
return (async () => {
|
|
248
277
|
l(!0), c(void 0);
|
|
249
278
|
try {
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
279
|
+
const E = await e.getSuggestions(t, {
|
|
280
|
+
limit: ae
|
|
281
|
+
});
|
|
282
|
+
y && c(E);
|
|
283
|
+
} catch (E) {
|
|
284
|
+
console.error("error", E);
|
|
254
285
|
} finally {
|
|
255
|
-
|
|
286
|
+
y && l(!1);
|
|
256
287
|
}
|
|
257
288
|
})(), () => {
|
|
258
|
-
|
|
289
|
+
y = !1;
|
|
259
290
|
};
|
|
260
|
-
}, [e, t]), /* @__PURE__ */ n(re, { theme: e.theme, children: /* @__PURE__ */
|
|
291
|
+
}, [e, t]), /* @__PURE__ */ n(re, { theme: e.theme, children: /* @__PURE__ */ p(
|
|
261
292
|
"div",
|
|
262
293
|
{
|
|
263
294
|
id: "dialog-instant",
|
|
264
295
|
className: "dialog-block-container",
|
|
265
|
-
dir:
|
|
296
|
+
dir: h,
|
|
266
297
|
children: [
|
|
267
|
-
/* @__PURE__ */ n(
|
|
298
|
+
/* @__PURE__ */ n(G, { title: u, description: m }),
|
|
268
299
|
/* @__PURE__ */ n(
|
|
269
|
-
|
|
300
|
+
te,
|
|
270
301
|
{
|
|
271
302
|
client: e,
|
|
272
|
-
questions:
|
|
273
|
-
isLoading:
|
|
303
|
+
questions: (g = i == null ? void 0 : i.questions) == null ? void 0 : g.slice(0, ie),
|
|
304
|
+
isLoading: a,
|
|
274
305
|
productId: t,
|
|
275
|
-
productTitle:
|
|
306
|
+
productTitle: o,
|
|
276
307
|
selectedVariantId: s
|
|
277
308
|
}
|
|
278
309
|
),
|
|
279
|
-
|
|
280
|
-
|
|
310
|
+
r ? /* @__PURE__ */ n(
|
|
311
|
+
oe,
|
|
281
312
|
{
|
|
282
313
|
client: e,
|
|
283
314
|
placeholder: d,
|
|
284
315
|
productId: t,
|
|
285
|
-
productTitle:
|
|
316
|
+
productTitle: o,
|
|
317
|
+
selectedVariantId: s
|
|
318
|
+
}
|
|
319
|
+
) : /* @__PURE__ */ n(
|
|
320
|
+
X,
|
|
321
|
+
{
|
|
322
|
+
client: e,
|
|
323
|
+
questions: i == null ? void 0 : i.questions,
|
|
324
|
+
disabled: a,
|
|
325
|
+
productId: t,
|
|
326
|
+
productTitle: o,
|
|
286
327
|
selectedVariantId: s
|
|
287
328
|
}
|
|
288
329
|
)
|
|
289
330
|
]
|
|
290
331
|
}
|
|
291
332
|
) });
|
|
292
|
-
},
|
|
333
|
+
}, ce = () => /* @__PURE__ */ n(
|
|
293
334
|
"svg",
|
|
294
335
|
{
|
|
295
336
|
width: 16,
|
|
@@ -309,7 +350,7 @@ const Q = ({
|
|
|
309
350
|
}
|
|
310
351
|
)
|
|
311
352
|
}
|
|
312
|
-
),
|
|
353
|
+
), le = "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", de = ({
|
|
313
354
|
color: e = "currentColor"
|
|
314
355
|
}) => /* @__PURE__ */ n(
|
|
315
356
|
"svg",
|
|
@@ -320,32 +361,32 @@ const Q = ({
|
|
|
320
361
|
fill: "none",
|
|
321
362
|
xmlns: "http://www.w3.org/2000/svg",
|
|
322
363
|
"aria-hidden": "true",
|
|
323
|
-
children: /* @__PURE__ */ n("path", { d:
|
|
364
|
+
children: /* @__PURE__ */ n("path", { d: le, fill: e })
|
|
324
365
|
}
|
|
325
|
-
),
|
|
366
|
+
), Xe = ({
|
|
326
367
|
controller: e,
|
|
327
368
|
placeholder: t = "Search products...",
|
|
328
|
-
autoFocus:
|
|
369
|
+
autoFocus: o = !1,
|
|
329
370
|
submitAriaLabel: s = "Search"
|
|
330
371
|
}) => {
|
|
331
|
-
const [
|
|
332
|
-
return /* @__PURE__ */
|
|
333
|
-
|
|
372
|
+
const [r, a] = v("");
|
|
373
|
+
return /* @__PURE__ */ p("form", { className: "dialog-search-bar", role: "search", onSubmit: (i) => {
|
|
374
|
+
i.preventDefault(), e.submit(r);
|
|
334
375
|
}, children: [
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */ n("span", { className: "dialog-search-bar-icon", children: /* @__PURE__ */ n(
|
|
376
|
+
/* @__PURE__ */ p("div", { className: "dialog-search-bar-field", children: [
|
|
377
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-bar-icon", children: /* @__PURE__ */ n(de, {}) }),
|
|
337
378
|
/* @__PURE__ */ n(
|
|
338
379
|
"input",
|
|
339
380
|
{
|
|
340
381
|
type: "text",
|
|
341
382
|
name: "dialog-search-query",
|
|
342
383
|
className: "dialog-search-bar-input",
|
|
343
|
-
value:
|
|
384
|
+
value: r,
|
|
344
385
|
"aria-label": t,
|
|
345
386
|
placeholder: t,
|
|
346
|
-
autoFocus:
|
|
347
|
-
onChange: (
|
|
348
|
-
i
|
|
387
|
+
autoFocus: o,
|
|
388
|
+
onChange: (i) => {
|
|
389
|
+
a(i.target.value), e.setQuery(i.target.value);
|
|
349
390
|
}
|
|
350
391
|
}
|
|
351
392
|
)
|
|
@@ -356,11 +397,11 @@ const Q = ({
|
|
|
356
397
|
type: "submit",
|
|
357
398
|
className: "dialog-search-bar-submit",
|
|
358
399
|
"aria-label": s,
|
|
359
|
-
children: /* @__PURE__ */ n(
|
|
400
|
+
children: /* @__PURE__ */ n(ce, {})
|
|
360
401
|
}
|
|
361
402
|
)
|
|
362
403
|
] });
|
|
363
|
-
},
|
|
404
|
+
}, ue = (e, t) => {
|
|
364
405
|
try {
|
|
365
406
|
return new Intl.NumberFormat(t).format(e);
|
|
366
407
|
} catch {
|
|
@@ -378,7 +419,7 @@ const Q = ({
|
|
|
378
419
|
seeAllLabel: (t) => t === 1 ? "See the result" : `See all ${e(t)} results`,
|
|
379
420
|
previous: "Previous",
|
|
380
421
|
next: "Next",
|
|
381
|
-
pageOf: (t,
|
|
422
|
+
pageOf: (t, o) => `Page ${e(t)} / ${e(o)}`
|
|
382
423
|
}),
|
|
383
424
|
fr: (e) => ({
|
|
384
425
|
searching: (t) => `Recherche de « ${t} »…`,
|
|
@@ -391,7 +432,7 @@ const Q = ({
|
|
|
391
432
|
seeAllLabel: (t) => t === 1 ? "Voir le résultat" : `Voir les ${e(t)} résultats`,
|
|
392
433
|
previous: "Précédent",
|
|
393
434
|
next: "Suivant",
|
|
394
|
-
pageOf: (t,
|
|
435
|
+
pageOf: (t, o) => `Page ${e(t)} / ${e(o)}`
|
|
395
436
|
}),
|
|
396
437
|
de: (e) => ({
|
|
397
438
|
searching: (t) => `Suche nach „${t}“…`,
|
|
@@ -404,7 +445,7 @@ const Q = ({
|
|
|
404
445
|
seeAllLabel: (t) => t === 1 ? "Das Ergebnis anzeigen" : `Alle ${e(t)} Ergebnisse anzeigen`,
|
|
405
446
|
previous: "Zurück",
|
|
406
447
|
next: "Weiter",
|
|
407
|
-
pageOf: (t,
|
|
448
|
+
pageOf: (t, o) => `Seite ${e(t)} / ${e(o)}`
|
|
408
449
|
}),
|
|
409
450
|
es: (e) => ({
|
|
410
451
|
searching: (t) => `Buscando «${t}»…`,
|
|
@@ -417,7 +458,7 @@ const Q = ({
|
|
|
417
458
|
seeAllLabel: (t) => t === 1 ? "Ver el resultado" : `Ver los ${e(t)} resultados`,
|
|
418
459
|
previous: "Anterior",
|
|
419
460
|
next: "Siguiente",
|
|
420
|
-
pageOf: (t,
|
|
461
|
+
pageOf: (t, o) => `Página ${e(t)} / ${e(o)}`
|
|
421
462
|
}),
|
|
422
463
|
it: (e) => ({
|
|
423
464
|
searching: (t) => `Ricerca di “${t}”…`,
|
|
@@ -430,123 +471,122 @@ const Q = ({
|
|
|
430
471
|
seeAllLabel: (t) => t === 1 ? "Vedi il risultato" : `Vedi tutti i ${e(t)} risultati`,
|
|
431
472
|
previous: "Precedente",
|
|
432
473
|
next: "Successivo",
|
|
433
|
-
pageOf: (t,
|
|
474
|
+
pageOf: (t, o) => `Pagina ${e(t)} / ${e(o)}`
|
|
434
475
|
})
|
|
435
|
-
},
|
|
476
|
+
}, T = (e) => {
|
|
436
477
|
var s;
|
|
437
478
|
const t = ((s = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : s.toLowerCase()) ?? "en";
|
|
438
|
-
return ($[t] ?? $.en)((
|
|
439
|
-
},
|
|
479
|
+
return ($[t] ?? $.en)((r) => ue(r, e));
|
|
480
|
+
}, O = (e) => e.status !== L.LOADING && e.response !== void 0 && e.response.nbPages > 1, he = ({
|
|
440
481
|
controller: e,
|
|
441
482
|
state: t,
|
|
442
|
-
locale:
|
|
483
|
+
locale: o
|
|
443
484
|
}) => {
|
|
444
485
|
const s = t.response;
|
|
445
|
-
if (s === void 0 || !
|
|
486
|
+
if (s === void 0 || !O(t))
|
|
446
487
|
return null;
|
|
447
|
-
const
|
|
448
|
-
return /* @__PURE__ */
|
|
488
|
+
const r = T(o);
|
|
489
|
+
return /* @__PURE__ */ p("nav", { "aria-label": "Search results pages", className: "dialog-search-pagination", children: [
|
|
449
490
|
/* @__PURE__ */ n(
|
|
450
491
|
"button",
|
|
451
492
|
{
|
|
452
493
|
type: "button",
|
|
453
494
|
disabled: s.page === 0,
|
|
454
495
|
onClick: () => e.setPage(s.page - 1),
|
|
455
|
-
children:
|
|
496
|
+
children: r.previous
|
|
456
497
|
}
|
|
457
498
|
),
|
|
458
|
-
/* @__PURE__ */ n("span", { children:
|
|
499
|
+
/* @__PURE__ */ n("span", { children: r.pageOf(s.page + 1, s.nbPages) }),
|
|
459
500
|
/* @__PURE__ */ n(
|
|
460
501
|
"button",
|
|
461
502
|
{
|
|
462
503
|
type: "button",
|
|
463
504
|
disabled: s.page >= s.nbPages - 1,
|
|
464
505
|
onClick: () => e.setPage(s.page + 1),
|
|
465
|
-
children:
|
|
506
|
+
children: r.next
|
|
466
507
|
}
|
|
467
508
|
)
|
|
468
509
|
] });
|
|
469
|
-
},
|
|
470
|
-
const
|
|
510
|
+
}, D = (e) => e.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/ẞ/gu, "ß").toUpperCase().toLowerCase().replace(/ς/g, "σ"), ge = (e, t) => {
|
|
511
|
+
const o = { before: "", match: e, after: "" }, s = D(t.trim());
|
|
471
512
|
if (s === "")
|
|
472
|
-
return
|
|
473
|
-
const
|
|
513
|
+
return o;
|
|
514
|
+
const r = [...e], a = [];
|
|
474
515
|
let l = "";
|
|
475
|
-
|
|
476
|
-
const
|
|
477
|
-
for (let
|
|
478
|
-
|
|
479
|
-
l +=
|
|
516
|
+
r.forEach((m, d) => {
|
|
517
|
+
const h = D(m);
|
|
518
|
+
for (let g = 0; g < h.length; g += 1)
|
|
519
|
+
a.push(d);
|
|
520
|
+
l += h;
|
|
480
521
|
});
|
|
481
|
-
const
|
|
482
|
-
if (
|
|
483
|
-
return
|
|
484
|
-
const c = i
|
|
522
|
+
const i = l.indexOf(s);
|
|
523
|
+
if (i === -1)
|
|
524
|
+
return o;
|
|
525
|
+
const c = a[i], u = a[i + s.length - 1] + 1;
|
|
485
526
|
return {
|
|
486
|
-
before:
|
|
487
|
-
match:
|
|
488
|
-
after:
|
|
527
|
+
before: r.slice(0, c).join(""),
|
|
528
|
+
match: r.slice(c, u).join(""),
|
|
529
|
+
after: r.slice(u).join("")
|
|
489
530
|
};
|
|
490
|
-
},
|
|
531
|
+
}, H = ({
|
|
491
532
|
title: e,
|
|
492
533
|
query: t
|
|
493
534
|
}) => {
|
|
494
|
-
const { before:
|
|
495
|
-
return /* @__PURE__ */
|
|
496
|
-
|
|
535
|
+
const { before: o, match: s, after: r } = ge(e, t);
|
|
536
|
+
return /* @__PURE__ */ p(C, { children: [
|
|
537
|
+
o !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: o }),
|
|
497
538
|
/* @__PURE__ */ n("span", { className: "dialog-search-match", children: s }),
|
|
498
|
-
|
|
539
|
+
r !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: r })
|
|
499
540
|
] });
|
|
500
|
-
},
|
|
501
|
-
style: "currency",
|
|
502
|
-
currency: t
|
|
503
|
-
}).format(Number(e)), ue = (e, t) => {
|
|
541
|
+
}, pe = ({ variants_min_price: e, currency: t }, o) => {
|
|
504
542
|
if (e === void 0)
|
|
505
543
|
return "";
|
|
506
544
|
try {
|
|
507
|
-
return
|
|
545
|
+
return t === void 0 ? new Intl.NumberFormat(o).format(e) : new Intl.NumberFormat(o, { style: "currency", currency: t }).format(
|
|
546
|
+
e
|
|
547
|
+
);
|
|
508
548
|
} catch {
|
|
509
549
|
return "";
|
|
510
550
|
}
|
|
511
|
-
},
|
|
551
|
+
}, me = (e) => e.product_image || e.image || void 0, fe = (e) => {
|
|
512
552
|
try {
|
|
513
553
|
const { protocol: t } = new URL(e, window.location.href);
|
|
514
554
|
return t === "http:" || t === "https:" ? e : void 0;
|
|
515
555
|
} catch {
|
|
516
556
|
return;
|
|
517
557
|
}
|
|
518
|
-
},
|
|
558
|
+
}, q = (e) => e.url === void 0 || e.url === "" ? void 0 : fe(e.url), B = (e) => e.title ?? e.handle ?? e.objectID, be = ({
|
|
519
559
|
controller: e,
|
|
520
560
|
hit: t,
|
|
521
|
-
index:
|
|
561
|
+
index: o,
|
|
522
562
|
locale: s,
|
|
523
|
-
query:
|
|
563
|
+
query: r = ""
|
|
524
564
|
}) => {
|
|
525
|
-
const
|
|
565
|
+
const a = b(null);
|
|
526
566
|
f(() => {
|
|
527
|
-
|
|
528
|
-
}, [e, t,
|
|
529
|
-
const l = (
|
|
530
|
-
const
|
|
531
|
-
e.selectResult(
|
|
532
|
-
},
|
|
533
|
-
|
|
534
|
-
}, c =
|
|
535
|
-
/* @__PURE__ */ n("span", { className: "dialog-search-product-thumb", "aria-hidden": !0, children:
|
|
536
|
-
/* @__PURE__ */ n("span", { className: "dialog-search-product-title", children: /* @__PURE__ */ n(
|
|
567
|
+
a.current !== null && e.observeResult(a.current, o);
|
|
568
|
+
}, [e, t, o]);
|
|
569
|
+
const l = (h) => {
|
|
570
|
+
const g = h.metaKey || h.ctrlKey || h.shiftKey || h.altKey;
|
|
571
|
+
e.selectResult(o, { navigate: !g }) && h.preventDefault();
|
|
572
|
+
}, i = (h) => {
|
|
573
|
+
h.button === 1 && e.selectResult(o, { navigate: !1 });
|
|
574
|
+
}, c = pe(t, s), u = q(t), m = me(t), d = /* @__PURE__ */ p(C, { children: [
|
|
575
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-product-thumb", "aria-hidden": !0, children: m !== void 0 && /* @__PURE__ */ n("img", { src: m, alt: "", loading: "lazy" }) }),
|
|
576
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-product-title", children: /* @__PURE__ */ n(H, { title: B(t), query: r }) }),
|
|
537
577
|
c !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-product-price", children: c })
|
|
538
578
|
] });
|
|
539
|
-
return /* @__PURE__ */ n("li", { ref:
|
|
579
|
+
return /* @__PURE__ */ n("li", { ref: a, className: "dialog-search-card", children: u === void 0 ? /* @__PURE__ */ n("div", { className: "dialog-search-product", children: d }) : /* @__PURE__ */ n(
|
|
540
580
|
"a",
|
|
541
581
|
{
|
|
542
582
|
className: "dialog-search-product",
|
|
543
583
|
href: u,
|
|
544
584
|
onClick: l,
|
|
545
|
-
onAuxClick:
|
|
546
|
-
children:
|
|
585
|
+
onAuxClick: i,
|
|
586
|
+
children: d
|
|
547
587
|
}
|
|
548
588
|
) });
|
|
549
|
-
},
|
|
589
|
+
}, ve = () => /* @__PURE__ */ n(
|
|
550
590
|
"svg",
|
|
551
591
|
{
|
|
552
592
|
width: 16,
|
|
@@ -557,7 +597,7 @@ const Q = ({
|
|
|
557
597
|
"aria-hidden": "true",
|
|
558
598
|
children: /* @__PURE__ */ n("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" })
|
|
559
599
|
}
|
|
560
|
-
),
|
|
600
|
+
), Ce = () => /* @__PURE__ */ n(
|
|
561
601
|
"svg",
|
|
562
602
|
{
|
|
563
603
|
width: 12,
|
|
@@ -568,98 +608,98 @@ const Q = ({
|
|
|
568
608
|
"aria-hidden": "true",
|
|
569
609
|
children: /* @__PURE__ */ n("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" })
|
|
570
610
|
}
|
|
571
|
-
),
|
|
572
|
-
const
|
|
573
|
-
return
|
|
574
|
-
}),
|
|
611
|
+
), j = (e) => (e ?? []).flatMap((t) => {
|
|
612
|
+
const o = q(t);
|
|
613
|
+
return o === void 0 ? [] : [{ collection: t, href: o }];
|
|
614
|
+
}), ye = ({
|
|
575
615
|
collections: e,
|
|
576
616
|
query: t,
|
|
577
|
-
messages:
|
|
617
|
+
messages: o
|
|
578
618
|
}) => {
|
|
579
|
-
const s =
|
|
580
|
-
return s.length === 0 ? null : /* @__PURE__ */
|
|
581
|
-
/* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */ n("p", { className: "dialog-search-label", children:
|
|
583
|
-
/* @__PURE__ */ n("span", { className: "dialog-search-count", children:
|
|
619
|
+
const s = j(e);
|
|
620
|
+
return s.length === 0 ? null : /* @__PURE__ */ p("aside", { className: "dialog-search-collections", children: [
|
|
621
|
+
/* @__PURE__ */ p("div", { className: "dialog-search-section-head", children: [
|
|
622
|
+
/* @__PURE__ */ n("p", { className: "dialog-search-label", children: o.collectionsLabel }),
|
|
623
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-count", children: o.collectionsCount(s.length) })
|
|
584
624
|
] }),
|
|
585
|
-
/* @__PURE__ */ n("ul", { className: "dialog-search-collection-list", children: s.map(({ collection:
|
|
586
|
-
/* @__PURE__ */ n("span", { className: "dialog-search-collection-thumb", "aria-hidden": !0, children:
|
|
587
|
-
/* @__PURE__ */ n("span", { className: "dialog-search-collection-title", children: /* @__PURE__ */ n(
|
|
588
|
-
/* @__PURE__ */ n("span", { className: "dialog-search-caret", children: /* @__PURE__ */ n(
|
|
589
|
-
] }) },
|
|
625
|
+
/* @__PURE__ */ n("ul", { className: "dialog-search-collection-list", children: s.map(({ collection: r, href: a }) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ p("a", { className: "dialog-search-collection", href: a, children: [
|
|
626
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-collection-thumb", "aria-hidden": !0, children: r.imageUrl !== void 0 && r.imageUrl !== "" && /* @__PURE__ */ n("img", { src: r.imageUrl, alt: "", loading: "lazy" }) }),
|
|
627
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-collection-title", children: /* @__PURE__ */ n(H, { title: B(r), query: t }) }),
|
|
628
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-caret", children: /* @__PURE__ */ n(Ce, {}) })
|
|
629
|
+
] }) }, r.objectID)) })
|
|
590
630
|
] });
|
|
591
|
-
},
|
|
631
|
+
}, Se = ({
|
|
592
632
|
controller: e,
|
|
593
633
|
response: t,
|
|
594
|
-
locale:
|
|
634
|
+
locale: o,
|
|
595
635
|
messages: s
|
|
596
|
-
}) => /* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */ n("div", { className: "dialog-search-section-head", children: /* @__PURE__ */
|
|
636
|
+
}) => /* @__PURE__ */ p("section", { className: "dialog-search-products", children: [
|
|
637
|
+
/* @__PURE__ */ n("div", { className: "dialog-search-section-head", children: /* @__PURE__ */ p("p", { className: "dialog-search-label", children: [
|
|
598
638
|
s.productsLabel,
|
|
599
639
|
t.nbHits > 0 && /* @__PURE__ */ n("span", { className: "dialog-search-label-count", children: ` · ${s.resultsCount(t.nbHits)}` })
|
|
600
640
|
] }) }),
|
|
601
|
-
/* @__PURE__ */ n("ul", { className: "dialog-search-results", children: t.hits.length === 0 ? /* @__PURE__ */ n("li", { className: "dialog-search-empty", role: "status", children: s.noResults }) : t.hits.map((
|
|
602
|
-
|
|
641
|
+
/* @__PURE__ */ n("ul", { className: "dialog-search-results", children: t.hits.length === 0 ? /* @__PURE__ */ n("li", { className: "dialog-search-empty", role: "status", children: s.noResults }) : t.hits.map((r, a) => /* @__PURE__ */ n(
|
|
642
|
+
be,
|
|
603
643
|
{
|
|
604
644
|
controller: e,
|
|
605
|
-
hit:
|
|
606
|
-
index:
|
|
607
|
-
locale:
|
|
645
|
+
hit: r,
|
|
646
|
+
index: a,
|
|
647
|
+
locale: o,
|
|
608
648
|
query: t.query
|
|
609
649
|
},
|
|
610
|
-
|
|
650
|
+
r.objectID
|
|
611
651
|
)) })
|
|
612
|
-
] }),
|
|
613
|
-
const
|
|
614
|
-
|
|
652
|
+
] }), k = 8, w = 16, we = 200, Le = 1440, ke = (e, t) => e.bottom > 0 && e.top < t, Ne = (e, t) => {
|
|
653
|
+
const o = Math.min(
|
|
654
|
+
Le,
|
|
615
655
|
t - 2 * w
|
|
616
|
-
), s = e.left + e.width / 2 -
|
|
656
|
+
), s = e.left + e.width / 2 - o / 2;
|
|
617
657
|
return { left: Math.min(
|
|
618
658
|
Math.max(s, w),
|
|
619
|
-
t - w -
|
|
620
|
-
), width:
|
|
621
|
-
},
|
|
622
|
-
const s =
|
|
623
|
-
return s <
|
|
624
|
-
...
|
|
625
|
-
bottom:
|
|
626
|
-
maxHeight: Math.max(
|
|
659
|
+
t - w - o
|
|
660
|
+
), width: o };
|
|
661
|
+
}, Ee = (e, t, o) => {
|
|
662
|
+
const s = o - e.bottom - k - w, r = e.top - k - w, a = Ne(e, t);
|
|
663
|
+
return s < we && r > s ? {
|
|
664
|
+
...a,
|
|
665
|
+
bottom: o - e.top + k,
|
|
666
|
+
maxHeight: Math.max(r, 0)
|
|
627
667
|
} : {
|
|
628
|
-
...
|
|
629
|
-
top: e.bottom +
|
|
668
|
+
...a,
|
|
669
|
+
top: e.bottom + k,
|
|
630
670
|
maxHeight: Math.max(s, 0)
|
|
631
671
|
};
|
|
632
|
-
},
|
|
672
|
+
}, Pe = (e) => {
|
|
633
673
|
const t = e.trim().replace(/^#/, "");
|
|
634
674
|
if (!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t))
|
|
635
675
|
return;
|
|
636
|
-
const
|
|
676
|
+
const o = t.length <= 4 ? [...t].map((s) => s + s).join("") : t;
|
|
637
677
|
return [0, 2, 4].map(
|
|
638
|
-
(s) => Number.parseInt(
|
|
678
|
+
(s) => Number.parseInt(o.slice(s, s + 2), 16)
|
|
639
679
|
);
|
|
640
|
-
},
|
|
680
|
+
}, Ae = (e) => {
|
|
641
681
|
const t = /^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(e);
|
|
642
682
|
if (t !== null)
|
|
643
683
|
return [t[1], t[2], t[3]].map(Number);
|
|
644
|
-
},
|
|
684
|
+
}, xe = (e) => {
|
|
645
685
|
if (typeof document > "u")
|
|
646
686
|
return;
|
|
647
687
|
const t = document.createElement("span");
|
|
648
688
|
if (t.style.color = e, t.style.color === "")
|
|
649
689
|
return;
|
|
650
690
|
document.body.appendChild(t);
|
|
651
|
-
const
|
|
652
|
-
return t.remove(),
|
|
653
|
-
},
|
|
691
|
+
const o = Ae(getComputedStyle(t).color);
|
|
692
|
+
return t.remove(), o;
|
|
693
|
+
}, Re = (e) => Pe(e) ?? xe(e), Ie = (e) => {
|
|
654
694
|
const t = e / 255;
|
|
655
695
|
return t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
|
|
656
|
-
},
|
|
657
|
-
const t =
|
|
696
|
+
}, z = (e) => {
|
|
697
|
+
const t = Re(e);
|
|
658
698
|
if (t === void 0)
|
|
659
699
|
return;
|
|
660
|
-
const [
|
|
661
|
-
return 0.2126 *
|
|
662
|
-
},
|
|
700
|
+
const [o, s, r] = t.map(Ie);
|
|
701
|
+
return 0.2126 * o + 0.7152 * s + 0.0722 * r;
|
|
702
|
+
}, $e = "#181825", De = "#ffffff", Me = "straight", A = 0.5, x = {
|
|
663
703
|
light: {
|
|
664
704
|
panel: "#ffffff",
|
|
665
705
|
side: "#fafbfc",
|
|
@@ -678,7 +718,7 @@ const Q = ({
|
|
|
678
718
|
hover: "#242830",
|
|
679
719
|
thumb: "#2b2f38"
|
|
680
720
|
}
|
|
681
|
-
},
|
|
721
|
+
}, _e = {
|
|
682
722
|
rectangle: {
|
|
683
723
|
"r-panel": "4px",
|
|
684
724
|
"r-item": "4px",
|
|
@@ -691,79 +731,79 @@ const Q = ({
|
|
|
691
731
|
"r-thumb": "8px",
|
|
692
732
|
"r-btn": "10px"
|
|
693
733
|
}
|
|
694
|
-
}, N = (e) => e === void 0 || e.trim() === "" ? void 0 : e.trim(),
|
|
695
|
-
const t = e === void 0 ? void 0 :
|
|
696
|
-
return t === void 0 ? "light" : t <
|
|
697
|
-
},
|
|
698
|
-
const
|
|
699
|
-
return
|
|
700
|
-
},
|
|
701
|
-
const t =
|
|
702
|
-
...
|
|
703
|
-
|
|
734
|
+
}, N = (e) => e === void 0 || e.trim() === "" ? void 0 : e.trim(), Te = (e) => {
|
|
735
|
+
const t = e === void 0 ? void 0 : z(e);
|
|
736
|
+
return t === void 0 ? "light" : t < A ? "dark" : "light";
|
|
737
|
+
}, Oe = (e, t) => {
|
|
738
|
+
const o = z(e);
|
|
739
|
+
return o === void 0 ? x[t].text : (t === "light" ? o < A : o >= A) ? e : x[t].text;
|
|
740
|
+
}, He = (e) => {
|
|
741
|
+
const t = Te(N(e == null ? void 0 : e.backgroundColor)), o = (e == null ? void 0 : e.ctaBorderType) === Me ? "rectangle" : "rectangle-rounded", s = N(e == null ? void 0 : e.primaryColor) ?? $e, r = N(e == null ? void 0 : e.fontFamily), a = {
|
|
742
|
+
...x[t],
|
|
743
|
+
..._e[o],
|
|
704
744
|
primary: s,
|
|
705
|
-
accent:
|
|
706
|
-
"cta-text": N(e == null ? void 0 : e.ctaTextColor) ??
|
|
707
|
-
...
|
|
745
|
+
accent: Oe(s, t),
|
|
746
|
+
"cta-text": N(e == null ? void 0 : e.ctaTextColor) ?? De,
|
|
747
|
+
...r === void 0 ? {} : { font: r }
|
|
708
748
|
};
|
|
709
749
|
return Object.fromEntries(
|
|
710
|
-
Object.entries(
|
|
750
|
+
Object.entries(a).map(([l, i]) => [`--dso-${l}`, i])
|
|
711
751
|
);
|
|
712
|
-
},
|
|
713
|
-
const t = b(null), [
|
|
714
|
-
return
|
|
752
|
+
}, qe = (e) => {
|
|
753
|
+
const t = b(null), [o, s] = v(void 0), [r, a] = v({ width: 0, height: 0 });
|
|
754
|
+
return V(() => {
|
|
715
755
|
if (!e)
|
|
716
756
|
return;
|
|
717
757
|
const l = () => {
|
|
718
|
-
const
|
|
719
|
-
if (
|
|
758
|
+
const i = t.current;
|
|
759
|
+
if (i === null)
|
|
720
760
|
return;
|
|
721
|
-
const c =
|
|
722
|
-
|
|
723
|
-
(
|
|
761
|
+
const c = i.previousElementSibling ?? i, { top: u, bottom: m, left: d, width: h } = c.getBoundingClientRect();
|
|
762
|
+
a(
|
|
763
|
+
(g) => g.width === window.innerWidth && g.height === window.innerHeight ? g : { width: window.innerWidth, height: window.innerHeight }
|
|
724
764
|
), s(
|
|
725
|
-
(
|
|
765
|
+
(g) => g !== void 0 && g.top === u && g.bottom === m && g.left === d && g.width === h ? g : { top: u, bottom: m, left: d, width: h }
|
|
726
766
|
);
|
|
727
767
|
};
|
|
728
768
|
return l(), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), () => {
|
|
729
769
|
window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l);
|
|
730
770
|
};
|
|
731
|
-
}, [e]), { anchorRef: t, rect:
|
|
732
|
-
},
|
|
733
|
-
const [
|
|
771
|
+
}, [e]), { anchorRef: t, rect: o, viewport: r };
|
|
772
|
+
}, Be = (e, t) => {
|
|
773
|
+
const [o, s] = v(!1), r = b(null), a = e.status !== L.IDLE && !o;
|
|
734
774
|
return f(() => {
|
|
735
775
|
s(!1);
|
|
736
776
|
}, [e.query]), f(() => {
|
|
737
|
-
if (!
|
|
777
|
+
if (!a)
|
|
738
778
|
return;
|
|
739
|
-
const l = (
|
|
740
|
-
var
|
|
741
|
-
const c =
|
|
779
|
+
const l = (i) => {
|
|
780
|
+
var h, g;
|
|
781
|
+
const c = i.target;
|
|
742
782
|
if (!(c instanceof Node))
|
|
743
783
|
return;
|
|
744
|
-
const u = (
|
|
745
|
-
!
|
|
784
|
+
const u = (h = t.current) == null ? void 0 : h.previousElementSibling, m = ((g = r.current) == null ? void 0 : g.contains(c)) ?? !1, d = (u == null ? void 0 : u.contains(c)) ?? !1;
|
|
785
|
+
!m && !d && s(!0);
|
|
746
786
|
};
|
|
747
787
|
return document.addEventListener("pointerdown", l), () => document.removeEventListener("pointerdown", l);
|
|
748
|
-
}, [
|
|
788
|
+
}, [a, t]), f(() => {
|
|
749
789
|
var c;
|
|
750
790
|
const l = (c = t.current) == null ? void 0 : c.previousElementSibling;
|
|
751
791
|
if (l == null)
|
|
752
792
|
return;
|
|
753
|
-
const
|
|
754
|
-
return l.addEventListener("focusin",
|
|
755
|
-
}, [t]), { isOpen:
|
|
756
|
-
},
|
|
757
|
-
var
|
|
758
|
-
const { controller:
|
|
759
|
-
if (l ===
|
|
760
|
-
return /* @__PURE__ */
|
|
793
|
+
const i = () => s(!1);
|
|
794
|
+
return l.addEventListener("focusin", i), () => l.removeEventListener("focusin", i);
|
|
795
|
+
}, [t]), { isOpen: a, panelRef: r };
|
|
796
|
+
}, je = (e) => e instanceof Q ? `Search failed (${e.status}${e.code ? ` ${e.code}` : ""}): ${e.message}` : "Search failed: network error. Check your connection and try again.", ze = (e, t) => {
|
|
797
|
+
var h, g;
|
|
798
|
+
const { controller: o, state: s, locale: r, seeAllHref: a } = e, { status: l, response: i } = s;
|
|
799
|
+
if (l === L.ERROR)
|
|
800
|
+
return /* @__PURE__ */ p("div", { className: "dialog-search-error", children: [
|
|
761
801
|
/* @__PURE__ */ n(
|
|
762
802
|
"p",
|
|
763
803
|
{
|
|
764
804
|
role: "alert",
|
|
765
805
|
className: "dialog-search-status dialog-search-status-error",
|
|
766
|
-
children:
|
|
806
|
+
children: je(s.error)
|
|
767
807
|
}
|
|
768
808
|
),
|
|
769
809
|
/* @__PURE__ */ n(
|
|
@@ -771,98 +811,98 @@ const Q = ({
|
|
|
771
811
|
{
|
|
772
812
|
type: "button",
|
|
773
813
|
className: "dialog-search-retry",
|
|
774
|
-
onClick: () =>
|
|
814
|
+
onClick: () => o.retry(),
|
|
775
815
|
children: t.retry
|
|
776
816
|
}
|
|
777
817
|
)
|
|
778
818
|
] });
|
|
779
|
-
if (
|
|
819
|
+
if (i === void 0)
|
|
780
820
|
return /* @__PURE__ */ n("p", { role: "status", className: "dialog-search-status", children: t.searching(s.query) });
|
|
781
|
-
const c = ((
|
|
782
|
-
return /* @__PURE__ */
|
|
783
|
-
/* @__PURE__ */
|
|
821
|
+
const c = ((g = (h = s.sections) == null ? void 0 : h.collections) == null ? void 0 : g.hits) ?? [], u = j(c).length > 0, m = a !== void 0 && i.nbHits > 0, d = !m && O(s);
|
|
822
|
+
return /* @__PURE__ */ p(C, { children: [
|
|
823
|
+
/* @__PURE__ */ p(
|
|
784
824
|
"div",
|
|
785
825
|
{
|
|
786
826
|
className: `dialog-search-body${u ? "" : " dialog-search-body--no-collections"}`,
|
|
787
827
|
children: [
|
|
788
828
|
/* @__PURE__ */ n(
|
|
789
|
-
|
|
829
|
+
ye,
|
|
790
830
|
{
|
|
791
831
|
collections: c,
|
|
792
|
-
query:
|
|
832
|
+
query: i.query,
|
|
793
833
|
messages: t
|
|
794
834
|
}
|
|
795
835
|
),
|
|
796
836
|
/* @__PURE__ */ n(
|
|
797
|
-
|
|
837
|
+
Se,
|
|
798
838
|
{
|
|
799
|
-
controller:
|
|
800
|
-
response:
|
|
801
|
-
locale:
|
|
839
|
+
controller: o,
|
|
840
|
+
response: i,
|
|
841
|
+
locale: r,
|
|
802
842
|
messages: t
|
|
803
843
|
}
|
|
804
844
|
)
|
|
805
845
|
]
|
|
806
846
|
}
|
|
807
847
|
),
|
|
808
|
-
(
|
|
809
|
-
t.seeAllLabel(
|
|
810
|
-
/* @__PURE__ */ n(
|
|
848
|
+
(m || d) && /* @__PURE__ */ n("div", { className: "dialog-search-footer", children: m ? /* @__PURE__ */ p("a", { className: "dialog-search-cta", href: a(i.query), children: [
|
|
849
|
+
t.seeAllLabel(i.nbHits),
|
|
850
|
+
/* @__PURE__ */ n(ve, {})
|
|
811
851
|
] }) : /* @__PURE__ */ n(
|
|
812
|
-
|
|
852
|
+
he,
|
|
813
853
|
{
|
|
814
|
-
controller:
|
|
854
|
+
controller: o,
|
|
815
855
|
state: s,
|
|
816
|
-
locale:
|
|
856
|
+
locale: r
|
|
817
857
|
}
|
|
818
858
|
) })
|
|
819
859
|
] });
|
|
820
|
-
},
|
|
821
|
-
const { state: t, locale:
|
|
822
|
-
() =>
|
|
860
|
+
}, Ge = (e) => {
|
|
861
|
+
const { state: t, locale: o, theme: s, layout: r = "list" } = e, a = t.status !== L.IDLE, { anchorRef: l, rect: i, viewport: c } = qe(a), { isOpen: u, panelRef: m } = Be(t, l), d = T(o), h = S(
|
|
862
|
+
() => He(s),
|
|
823
863
|
[s]
|
|
824
864
|
);
|
|
825
|
-
return /* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ p(C, { children: [
|
|
826
866
|
/* @__PURE__ */ n("div", { ref: l }),
|
|
827
|
-
u &&
|
|
867
|
+
u && i !== void 0 && ke(i, c.height) && Z(
|
|
828
868
|
/* @__PURE__ */ n(
|
|
829
869
|
"div",
|
|
830
870
|
{
|
|
831
|
-
ref:
|
|
832
|
-
className: `dialog-search-panel dialog-search-panel--${
|
|
871
|
+
ref: m,
|
|
872
|
+
className: `dialog-search-panel dialog-search-panel--${r}`,
|
|
833
873
|
style: {
|
|
834
|
-
...
|
|
835
|
-
...
|
|
874
|
+
...Ee(i, c.width, c.height),
|
|
875
|
+
...h
|
|
836
876
|
},
|
|
837
|
-
children:
|
|
877
|
+
children: ze(e, d)
|
|
838
878
|
}
|
|
839
879
|
),
|
|
840
880
|
document.body
|
|
841
881
|
)
|
|
842
882
|
] });
|
|
843
|
-
},
|
|
844
|
-
status:
|
|
883
|
+
}, Ve = {
|
|
884
|
+
status: L.IDLE,
|
|
845
885
|
query: "",
|
|
846
886
|
page: 0
|
|
847
|
-
},
|
|
887
|
+
}, Ye = (e) => {
|
|
848
888
|
const t = b(e);
|
|
849
889
|
t.current = e;
|
|
850
|
-
const
|
|
851
|
-
if (
|
|
852
|
-
const { client: c, surface: u = "search_page", ...
|
|
853
|
-
|
|
854
|
-
search: (d,
|
|
890
|
+
const o = b(void 0), s = P(() => {
|
|
891
|
+
if (o.current === void 0) {
|
|
892
|
+
const { client: c, surface: u = "search_page", ...m } = t.current;
|
|
893
|
+
o.current = W({
|
|
894
|
+
search: (d, h) => c.search(d, h),
|
|
855
895
|
analytics: {
|
|
856
896
|
surface: u,
|
|
857
897
|
trackViewSearchResults: (d) => c.trackViewSearchResults(d),
|
|
858
898
|
trackSelectSearchResult: (d) => c.trackSelectSearchResult(d)
|
|
859
899
|
},
|
|
860
|
-
...
|
|
900
|
+
...m
|
|
861
901
|
});
|
|
862
902
|
}
|
|
863
|
-
return
|
|
864
|
-
}, []),
|
|
865
|
-
|
|
903
|
+
return o.current;
|
|
904
|
+
}, []), r = b(void 0);
|
|
905
|
+
r.current ?? (r.current = {
|
|
866
906
|
setQuery: (c) => s().setQuery(c),
|
|
867
907
|
submit: (c) => s().submit(c),
|
|
868
908
|
setPage: (c) => s().setPage(c),
|
|
@@ -874,37 +914,37 @@ const Q = ({
|
|
|
874
914
|
// Create a replacement on next access after disposal.
|
|
875
915
|
dispose: () => {
|
|
876
916
|
var c;
|
|
877
|
-
(c =
|
|
917
|
+
(c = o.current) == null || c.dispose(), o.current = void 0;
|
|
878
918
|
}
|
|
879
919
|
}), f(() => {
|
|
880
|
-
|
|
920
|
+
M({
|
|
881
921
|
method: "react",
|
|
882
|
-
version: "2.
|
|
922
|
+
version: "2.9.0"
|
|
883
923
|
});
|
|
884
924
|
const c = s();
|
|
885
925
|
return () => {
|
|
886
|
-
c.dispose(),
|
|
926
|
+
c.dispose(), o.current === c && (o.current = void 0);
|
|
887
927
|
};
|
|
888
928
|
}, [s]);
|
|
889
|
-
const
|
|
929
|
+
const a = P(
|
|
890
930
|
(c) => s().subscribe(c),
|
|
891
931
|
[s]
|
|
892
932
|
), l = P(
|
|
893
933
|
() => s().getState(),
|
|
894
934
|
[s]
|
|
895
|
-
),
|
|
896
|
-
|
|
935
|
+
), i = K(
|
|
936
|
+
a,
|
|
897
937
|
l,
|
|
898
|
-
() =>
|
|
938
|
+
() => Ve
|
|
899
939
|
);
|
|
900
|
-
return { controller:
|
|
940
|
+
return { controller: r.current, state: i, theme: e.client.theme };
|
|
901
941
|
};
|
|
902
942
|
export {
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
943
|
+
oe as DialogInput,
|
|
944
|
+
Ze as DialogProductBlock,
|
|
945
|
+
Xe as DialogSearchBar,
|
|
946
|
+
he as DialogSearchPagination,
|
|
947
|
+
be as DialogSearchProductCard,
|
|
948
|
+
Ge as DialogSearchResults,
|
|
949
|
+
Ye as useDialogSearch
|
|
910
950
|
};
|