@askdialog/dialog-react 2.8.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 +6 -6
- 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.js +252 -253
- package/dist/dialog-react.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/dialog-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n, jsxs as p, Fragment as C } from "react/jsx-runtime";
|
|
2
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
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
4
|
import { createPortal as Z } from "react-dom";
|
|
@@ -18,23 +18,23 @@ const R = {
|
|
|
18
18
|
aiDisclosure: "Estás chateando con un asistente de IA. Puede cometer errores, así que verifica la información importante",
|
|
19
19
|
askSomethingElse: "Pregunta otra cosa"
|
|
20
20
|
}
|
|
21
|
-
},
|
|
22
|
-
var
|
|
23
|
-
const t = ((
|
|
21
|
+
}, _ = (e) => {
|
|
22
|
+
var o;
|
|
23
|
+
const t = ((o = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : o.toLowerCase()) ?? "en";
|
|
24
24
|
return R[t] ?? R.en;
|
|
25
25
|
}, X = ({
|
|
26
26
|
client: e,
|
|
27
27
|
questions: t,
|
|
28
|
-
disabled:
|
|
28
|
+
disabled: o,
|
|
29
29
|
productId: s,
|
|
30
30
|
productTitle: r,
|
|
31
31
|
selectedVariantId: a
|
|
32
|
-
}) => /* @__PURE__ */
|
|
32
|
+
}) => /* @__PURE__ */ n(
|
|
33
33
|
"button",
|
|
34
34
|
{
|
|
35
35
|
type: "button",
|
|
36
36
|
className: "dialog-ask-something-else",
|
|
37
|
-
disabled:
|
|
37
|
+
disabled: o,
|
|
38
38
|
onClick: () => {
|
|
39
39
|
e.openAssistantWithSuggestions({
|
|
40
40
|
questions: t ?? [],
|
|
@@ -45,15 +45,15 @@ const R = {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
},
|
|
48
|
-
children:
|
|
48
|
+
children: _(e.locale).askSomethingElse
|
|
49
49
|
}
|
|
50
50
|
), G = ({
|
|
51
51
|
title: e = "Your expert",
|
|
52
52
|
description: t = "A question about this product?"
|
|
53
|
-
}) => /* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
] }), Y = ({ color: e = "#181825" }) => /* @__PURE__ */
|
|
53
|
+
}) => /* @__PURE__ */ p("div", { className: "dialog-block-header-container", children: [
|
|
54
|
+
/* @__PURE__ */ n("div", { className: "dialog-block-title", children: e }),
|
|
55
|
+
/* @__PURE__ */ n("div", { className: "dialog-block-description", children: t })
|
|
56
|
+
] }), Y = ({ color: e = "#181825" }) => /* @__PURE__ */ p(
|
|
57
57
|
"svg",
|
|
58
58
|
{
|
|
59
59
|
width: "20",
|
|
@@ -62,8 +62,8 @@ const R = {
|
|
|
62
62
|
fill: "none",
|
|
63
63
|
xmlns: "http://www.w3.org/2000/svg",
|
|
64
64
|
children: [
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ p("g", { clipPath: "url(#clip0_466_934)", children: [
|
|
66
|
+
/* @__PURE__ */ n(
|
|
67
67
|
"path",
|
|
68
68
|
{
|
|
69
69
|
d: "M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011 12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684 13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559 15.5689 7.00388 15.7167C6.83375 15.8478 6.68124 16.0003 6.55011 16.1704C6.40232 16.3622 6.2917 16.5834 6.07046 17.0259L5.41675 18.3333L4.76303 17.0259C4.54179 16.5834 4.43117 16.3622 4.28339 16.1704C4.15225 16.0003 3.99974 15.8478 3.82962 15.7167C3.6379 15.5689 3.41666 15.4583 2.97418 15.237L1.66675 14.5833L2.97418 13.9296C3.41666 13.7084 3.6379 13.5977 3.82962 13.45C3.99974 13.3188 4.15225 13.1663 4.28339 12.9962C4.43117 12.8045 4.54179 12.5832 4.76303 12.1408L5.41675 10.8333Z",
|
|
@@ -73,7 +73,7 @@ const R = {
|
|
|
73
73
|
strokeLinejoin: "round"
|
|
74
74
|
}
|
|
75
75
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ n(
|
|
77
77
|
"path",
|
|
78
78
|
{
|
|
79
79
|
d: "M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175 5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687 6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632 8.83469 14.6062 9.01742C14.3785 9.17937 14.1795 9.37836 14.0175 9.60612C13.8348 9.8631 13.7173 10.1686 13.4823 10.7796L12.5001 13.3333L11.5179 10.7796C11.2829 10.1686 11.1654 9.8631 10.9827 9.60612C10.8207 9.37836 10.6217 9.17937 10.3939 9.01742C10.137 8.83469 9.83145 8.71718 9.22043 8.48217L6.66675 7.49999L9.22043 6.5178C9.83145 6.28279 10.137 6.16529 10.3939 5.98256C10.6217 5.82061 10.8207 5.62162 10.9827 5.39386C11.1654 5.13688 11.2829 4.83136 11.5179 4.22034L12.5001 1.66666Z",
|
|
@@ -84,49 +84,49 @@ const R = {
|
|
|
84
84
|
}
|
|
85
85
|
)
|
|
86
86
|
] }),
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ n("defs", { children: /* @__PURE__ */ n("clipPath", { id: "clip0_466_934", children: /* @__PURE__ */ n("rect", { width: "20", height: "20", fill: "white" }) }) })
|
|
88
88
|
]
|
|
89
89
|
}
|
|
90
90
|
), J = ({
|
|
91
91
|
client: e,
|
|
92
92
|
questions: t,
|
|
93
|
-
productId:
|
|
93
|
+
productId: o,
|
|
94
94
|
productTitle: s,
|
|
95
95
|
selectedVariantId: r
|
|
96
96
|
}) => {
|
|
97
|
-
const a = (
|
|
97
|
+
const a = (l) => {
|
|
98
98
|
e.sendProductMessage({
|
|
99
|
-
productId:
|
|
99
|
+
productId: o,
|
|
100
100
|
productTitle: s,
|
|
101
101
|
selectedVariantId: r,
|
|
102
|
-
question:
|
|
102
|
+
question: l,
|
|
103
103
|
fromQuestionSuggestion: !0
|
|
104
104
|
});
|
|
105
105
|
};
|
|
106
|
-
return /* @__PURE__ */
|
|
106
|
+
return /* @__PURE__ */ n(C, { children: t.map((l) => /* @__PURE__ */ p(
|
|
107
107
|
"button",
|
|
108
108
|
{
|
|
109
109
|
className: "dialog-block-suggestions-item",
|
|
110
|
-
onClick: () => a(
|
|
110
|
+
onClick: () => a(l.question),
|
|
111
111
|
children: [
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ n(Y, { color: e.theme.primaryColor }),
|
|
113
|
+
/* @__PURE__ */ n("span", { className: "dialog-block-suggestions-item-label", children: l.question })
|
|
114
114
|
]
|
|
115
115
|
},
|
|
116
|
-
|
|
116
|
+
l.question
|
|
117
117
|
)) });
|
|
118
|
-
}, ee = () => /* @__PURE__ */
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
/* @__PURE__ */
|
|
118
|
+
}, ee = () => /* @__PURE__ */ p(C, { children: [
|
|
119
|
+
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" }),
|
|
120
|
+
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" }),
|
|
121
|
+
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" })
|
|
122
122
|
] }), te = ({
|
|
123
123
|
client: e,
|
|
124
124
|
questions: t,
|
|
125
|
-
isLoading:
|
|
125
|
+
isLoading: o,
|
|
126
126
|
productId: s,
|
|
127
127
|
productTitle: r,
|
|
128
128
|
selectedVariantId: a
|
|
129
|
-
}) => /* @__PURE__ */
|
|
129
|
+
}) => /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-container", children: o || !t ? /* @__PURE__ */ n(ee, {}) : /* @__PURE__ */ n(
|
|
130
130
|
J,
|
|
131
131
|
{
|
|
132
132
|
client: e,
|
|
@@ -135,7 +135,7 @@ const R = {
|
|
|
135
135
|
productTitle: r,
|
|
136
136
|
selectedVariantId: a
|
|
137
137
|
}
|
|
138
|
-
) }), se = ({ color: e = "#ffffff" }) => /* @__PURE__ */
|
|
138
|
+
) }), se = ({ color: e = "#ffffff" }) => /* @__PURE__ */ n(
|
|
139
139
|
"svg",
|
|
140
140
|
{
|
|
141
141
|
width: "20",
|
|
@@ -143,7 +143,7 @@ const R = {
|
|
|
143
143
|
viewBox: "0 0 20 20",
|
|
144
144
|
fill: "none",
|
|
145
145
|
xmlns: "http://www.w3.org/2000/svg",
|
|
146
|
-
children: /* @__PURE__ */
|
|
146
|
+
children: /* @__PURE__ */ n(
|
|
147
147
|
"path",
|
|
148
148
|
{
|
|
149
149
|
d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
|
|
@@ -154,71 +154,71 @@ const R = {
|
|
|
154
154
|
}
|
|
155
155
|
)
|
|
156
156
|
}
|
|
157
|
-
),
|
|
157
|
+
), oe = ({
|
|
158
158
|
client: e,
|
|
159
159
|
productId: t,
|
|
160
|
-
productTitle:
|
|
160
|
+
productTitle: o,
|
|
161
161
|
selectedVariantId: s
|
|
162
162
|
}) => {
|
|
163
|
-
const r = b(null), [a,
|
|
163
|
+
const r = b(null), [a, l] = v(""), i = _(e.locale), c = () => {
|
|
164
164
|
var d;
|
|
165
165
|
(d = r.current) == null || d.focus();
|
|
166
166
|
}, u = () => {
|
|
167
167
|
const d = a;
|
|
168
168
|
d.trim() && (e.sendProductMessage({
|
|
169
169
|
productId: t,
|
|
170
|
-
productTitle:
|
|
170
|
+
productTitle: o,
|
|
171
171
|
selectedVariantId: s,
|
|
172
172
|
question: d,
|
|
173
173
|
fromQuestionSuggestion: !0
|
|
174
|
-
}),
|
|
175
|
-
},
|
|
174
|
+
}), l(""));
|
|
175
|
+
}, m = (d) => {
|
|
176
176
|
d.key === "Enter" && u();
|
|
177
177
|
};
|
|
178
|
-
return /* @__PURE__ */
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */
|
|
178
|
+
return /* @__PURE__ */ p("div", { className: "dialog-input-container", children: [
|
|
179
|
+
/* @__PURE__ */ p("div", { className: "dialog-input-wrapper", onClick: c, children: [
|
|
180
|
+
/* @__PURE__ */ n(
|
|
181
181
|
"input",
|
|
182
182
|
{
|
|
183
183
|
id: "dialog-ask-anything-input-ai-input",
|
|
184
184
|
ref: r,
|
|
185
185
|
value: a,
|
|
186
|
-
onChange: (d) =>
|
|
186
|
+
onChange: (d) => l(d.target.value),
|
|
187
187
|
className: "dialog-ask-anything-input-ai-input",
|
|
188
188
|
placeholder: i.placeholder,
|
|
189
189
|
"aria-describedby": "dialog-input-ai-disclosure",
|
|
190
|
-
onKeyDown:
|
|
190
|
+
onKeyDown: m
|
|
191
191
|
}
|
|
192
192
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ n(
|
|
194
194
|
"button",
|
|
195
195
|
{
|
|
196
196
|
id: "send-message-button-ai-input",
|
|
197
197
|
className: "dialog-input-submit",
|
|
198
198
|
disabled: !a.trim(),
|
|
199
199
|
onClick: u,
|
|
200
|
-
children: /* @__PURE__ */
|
|
200
|
+
children: /* @__PURE__ */ n(se, { color: e.theme.ctaTextColor })
|
|
201
201
|
}
|
|
202
202
|
)
|
|
203
203
|
] }),
|
|
204
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ n("p", { id: "dialog-input-ai-disclosure", className: "dialog-input-ai-disclosure", children: i.aiDisclosure })
|
|
205
205
|
] });
|
|
206
|
-
}, I = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(),
|
|
206
|
+
}, I = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), ne = (e) => {
|
|
207
207
|
if (!e) return;
|
|
208
208
|
const t = document.body;
|
|
209
|
-
Object.keys(e).forEach((
|
|
210
|
-
const s =
|
|
209
|
+
Object.keys(e).forEach((o) => {
|
|
210
|
+
const s = o, r = I(o);
|
|
211
211
|
if (e[s] !== void 0) {
|
|
212
212
|
if (typeof e[s] == "object") {
|
|
213
213
|
Object.keys(e[s]).forEach(
|
|
214
214
|
(a) => {
|
|
215
215
|
var i;
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
218
|
-
const
|
|
216
|
+
const l = a;
|
|
217
|
+
if (l !== void 0) {
|
|
218
|
+
const c = I(a), u = e[s];
|
|
219
219
|
t.style.setProperty(
|
|
220
|
-
`--dialog-theme-${r}-${
|
|
221
|
-
(i = u[
|
|
220
|
+
`--dialog-theme-${r}-${c}`,
|
|
221
|
+
(i = u[l]) == null ? void 0 : i.toString()
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -237,34 +237,34 @@ const R = {
|
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
}, re = ({ theme: e, children: t }) => (f(() => {
|
|
240
|
-
e &&
|
|
241
|
-
}, [e]), /* @__PURE__ */
|
|
240
|
+
e && ne(e);
|
|
241
|
+
}, [e]), /* @__PURE__ */ n(C, { children: t })), ie = 2, ae = 5, Ze = ({
|
|
242
242
|
client: e,
|
|
243
243
|
productId: t,
|
|
244
|
-
productTitle:
|
|
244
|
+
productTitle: o,
|
|
245
245
|
selectedVariantId: s,
|
|
246
246
|
enableInput: r = !1
|
|
247
247
|
}) => {
|
|
248
248
|
var g;
|
|
249
|
-
const [a,
|
|
249
|
+
const [a, l] = v(!0), [i, c] = v(
|
|
250
250
|
void 0
|
|
251
251
|
);
|
|
252
252
|
f(() => {
|
|
253
253
|
M({
|
|
254
254
|
method: "react",
|
|
255
|
-
version: "2.
|
|
255
|
+
version: "2.9.0"
|
|
256
256
|
}), F("pdp-block");
|
|
257
257
|
}, []);
|
|
258
258
|
const u = S(
|
|
259
259
|
() => a ? "" : i == null ? void 0 : i.assistantName,
|
|
260
260
|
[i, a]
|
|
261
|
-
),
|
|
261
|
+
), m = S(
|
|
262
262
|
() => a ? "" : i == null ? void 0 : i.description,
|
|
263
263
|
[i, a]
|
|
264
264
|
), d = S(
|
|
265
265
|
() => a ? "" : i == null ? void 0 : i.inputPlaceholder,
|
|
266
266
|
[i, a]
|
|
267
|
-
),
|
|
267
|
+
), h = S(
|
|
268
268
|
() => {
|
|
269
269
|
var y;
|
|
270
270
|
return U((y = e.getLocalizationInformations()) == null ? void 0 : y.languageCode);
|
|
@@ -274,63 +274,63 @@ const R = {
|
|
|
274
274
|
return f(() => {
|
|
275
275
|
let y = !0;
|
|
276
276
|
return (async () => {
|
|
277
|
-
|
|
277
|
+
l(!0), c(void 0);
|
|
278
278
|
try {
|
|
279
279
|
const E = await e.getSuggestions(t, {
|
|
280
280
|
limit: ae
|
|
281
281
|
});
|
|
282
|
-
y &&
|
|
282
|
+
y && c(E);
|
|
283
283
|
} catch (E) {
|
|
284
284
|
console.error("error", E);
|
|
285
285
|
} finally {
|
|
286
|
-
y &&
|
|
286
|
+
y && l(!1);
|
|
287
287
|
}
|
|
288
288
|
})(), () => {
|
|
289
289
|
y = !1;
|
|
290
290
|
};
|
|
291
|
-
}, [e, t]), /* @__PURE__ */
|
|
291
|
+
}, [e, t]), /* @__PURE__ */ n(re, { theme: e.theme, children: /* @__PURE__ */ p(
|
|
292
292
|
"div",
|
|
293
293
|
{
|
|
294
294
|
id: "dialog-instant",
|
|
295
295
|
className: "dialog-block-container",
|
|
296
|
-
dir:
|
|
296
|
+
dir: h,
|
|
297
297
|
children: [
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
-
/* @__PURE__ */
|
|
298
|
+
/* @__PURE__ */ n(G, { title: u, description: m }),
|
|
299
|
+
/* @__PURE__ */ n(
|
|
300
300
|
te,
|
|
301
301
|
{
|
|
302
302
|
client: e,
|
|
303
303
|
questions: (g = i == null ? void 0 : i.questions) == null ? void 0 : g.slice(0, ie),
|
|
304
304
|
isLoading: a,
|
|
305
305
|
productId: t,
|
|
306
|
-
productTitle:
|
|
306
|
+
productTitle: o,
|
|
307
307
|
selectedVariantId: s
|
|
308
308
|
}
|
|
309
309
|
),
|
|
310
|
-
r ? /* @__PURE__ */
|
|
311
|
-
|
|
310
|
+
r ? /* @__PURE__ */ n(
|
|
311
|
+
oe,
|
|
312
312
|
{
|
|
313
313
|
client: e,
|
|
314
314
|
placeholder: d,
|
|
315
315
|
productId: t,
|
|
316
|
-
productTitle:
|
|
316
|
+
productTitle: o,
|
|
317
317
|
selectedVariantId: s
|
|
318
318
|
}
|
|
319
|
-
) : /* @__PURE__ */
|
|
319
|
+
) : /* @__PURE__ */ n(
|
|
320
320
|
X,
|
|
321
321
|
{
|
|
322
322
|
client: e,
|
|
323
323
|
questions: i == null ? void 0 : i.questions,
|
|
324
324
|
disabled: a,
|
|
325
325
|
productId: t,
|
|
326
|
-
productTitle:
|
|
326
|
+
productTitle: o,
|
|
327
327
|
selectedVariantId: s
|
|
328
328
|
}
|
|
329
329
|
)
|
|
330
330
|
]
|
|
331
331
|
}
|
|
332
332
|
) });
|
|
333
|
-
},
|
|
333
|
+
}, ce = () => /* @__PURE__ */ n(
|
|
334
334
|
"svg",
|
|
335
335
|
{
|
|
336
336
|
width: 16,
|
|
@@ -339,7 +339,7 @@ const R = {
|
|
|
339
339
|
fill: "none",
|
|
340
340
|
xmlns: "http://www.w3.org/2000/svg",
|
|
341
341
|
"aria-hidden": "true",
|
|
342
|
-
children: /* @__PURE__ */
|
|
342
|
+
children: /* @__PURE__ */ n(
|
|
343
343
|
"path",
|
|
344
344
|
{
|
|
345
345
|
d: "M8 13V3M8 3L3 8M8 3L13 8",
|
|
@@ -350,9 +350,9 @@ const R = {
|
|
|
350
350
|
}
|
|
351
351
|
)
|
|
352
352
|
}
|
|
353
|
-
),
|
|
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 = ({
|
|
354
354
|
color: e = "currentColor"
|
|
355
|
-
}) => /* @__PURE__ */
|
|
355
|
+
}) => /* @__PURE__ */ n(
|
|
356
356
|
"svg",
|
|
357
357
|
{
|
|
358
358
|
width: 16,
|
|
@@ -361,21 +361,21 @@ const R = {
|
|
|
361
361
|
fill: "none",
|
|
362
362
|
xmlns: "http://www.w3.org/2000/svg",
|
|
363
363
|
"aria-hidden": "true",
|
|
364
|
-
children: /* @__PURE__ */
|
|
364
|
+
children: /* @__PURE__ */ n("path", { d: le, fill: e })
|
|
365
365
|
}
|
|
366
366
|
), Xe = ({
|
|
367
367
|
controller: e,
|
|
368
368
|
placeholder: t = "Search products...",
|
|
369
|
-
autoFocus:
|
|
369
|
+
autoFocus: o = !1,
|
|
370
370
|
submitAriaLabel: s = "Search"
|
|
371
371
|
}) => {
|
|
372
372
|
const [r, a] = v("");
|
|
373
|
-
return /* @__PURE__ */
|
|
373
|
+
return /* @__PURE__ */ p("form", { className: "dialog-search-bar", role: "search", onSubmit: (i) => {
|
|
374
374
|
i.preventDefault(), e.submit(r);
|
|
375
375
|
}, children: [
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
/* @__PURE__ */
|
|
378
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ p("div", { className: "dialog-search-bar-field", children: [
|
|
377
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-bar-icon", children: /* @__PURE__ */ n(de, {}) }),
|
|
378
|
+
/* @__PURE__ */ n(
|
|
379
379
|
"input",
|
|
380
380
|
{
|
|
381
381
|
type: "text",
|
|
@@ -384,20 +384,20 @@ const R = {
|
|
|
384
384
|
value: r,
|
|
385
385
|
"aria-label": t,
|
|
386
386
|
placeholder: t,
|
|
387
|
-
autoFocus:
|
|
387
|
+
autoFocus: o,
|
|
388
388
|
onChange: (i) => {
|
|
389
389
|
a(i.target.value), e.setQuery(i.target.value);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
)
|
|
393
393
|
] }),
|
|
394
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ n(
|
|
395
395
|
"button",
|
|
396
396
|
{
|
|
397
397
|
type: "submit",
|
|
398
398
|
className: "dialog-search-bar-submit",
|
|
399
399
|
"aria-label": s,
|
|
400
|
-
children: /* @__PURE__ */
|
|
400
|
+
children: /* @__PURE__ */ n(ce, {})
|
|
401
401
|
}
|
|
402
402
|
)
|
|
403
403
|
] });
|
|
@@ -419,7 +419,7 @@ const R = {
|
|
|
419
419
|
seeAllLabel: (t) => t === 1 ? "See the result" : `See all ${e(t)} results`,
|
|
420
420
|
previous: "Previous",
|
|
421
421
|
next: "Next",
|
|
422
|
-
pageOf: (t,
|
|
422
|
+
pageOf: (t, o) => `Page ${e(t)} / ${e(o)}`
|
|
423
423
|
}),
|
|
424
424
|
fr: (e) => ({
|
|
425
425
|
searching: (t) => `Recherche de « ${t} »…`,
|
|
@@ -432,7 +432,7 @@ const R = {
|
|
|
432
432
|
seeAllLabel: (t) => t === 1 ? "Voir le résultat" : `Voir les ${e(t)} résultats`,
|
|
433
433
|
previous: "Précédent",
|
|
434
434
|
next: "Suivant",
|
|
435
|
-
pageOf: (t,
|
|
435
|
+
pageOf: (t, o) => `Page ${e(t)} / ${e(o)}`
|
|
436
436
|
}),
|
|
437
437
|
de: (e) => ({
|
|
438
438
|
searching: (t) => `Suche nach „${t}“…`,
|
|
@@ -445,7 +445,7 @@ const R = {
|
|
|
445
445
|
seeAllLabel: (t) => t === 1 ? "Das Ergebnis anzeigen" : `Alle ${e(t)} Ergebnisse anzeigen`,
|
|
446
446
|
previous: "Zurück",
|
|
447
447
|
next: "Weiter",
|
|
448
|
-
pageOf: (t,
|
|
448
|
+
pageOf: (t, o) => `Seite ${e(t)} / ${e(o)}`
|
|
449
449
|
}),
|
|
450
450
|
es: (e) => ({
|
|
451
451
|
searching: (t) => `Buscando «${t}»…`,
|
|
@@ -458,7 +458,7 @@ const R = {
|
|
|
458
458
|
seeAllLabel: (t) => t === 1 ? "Ver el resultado" : `Ver los ${e(t)} resultados`,
|
|
459
459
|
previous: "Anterior",
|
|
460
460
|
next: "Siguiente",
|
|
461
|
-
pageOf: (t,
|
|
461
|
+
pageOf: (t, o) => `Página ${e(t)} / ${e(o)}`
|
|
462
462
|
}),
|
|
463
463
|
it: (e) => ({
|
|
464
464
|
searching: (t) => `Ricerca di “${t}”…`,
|
|
@@ -471,23 +471,23 @@ const R = {
|
|
|
471
471
|
seeAllLabel: (t) => t === 1 ? "Vedi il risultato" : `Vedi tutti i ${e(t)} risultati`,
|
|
472
472
|
previous: "Precedente",
|
|
473
473
|
next: "Successivo",
|
|
474
|
-
pageOf: (t,
|
|
474
|
+
pageOf: (t, o) => `Pagina ${e(t)} / ${e(o)}`
|
|
475
475
|
})
|
|
476
|
-
},
|
|
476
|
+
}, T = (e) => {
|
|
477
477
|
var s;
|
|
478
478
|
const t = ((s = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : s.toLowerCase()) ?? "en";
|
|
479
479
|
return ($[t] ?? $.en)((r) => ue(r, e));
|
|
480
|
-
},
|
|
480
|
+
}, O = (e) => e.status !== L.LOADING && e.response !== void 0 && e.response.nbPages > 1, he = ({
|
|
481
481
|
controller: e,
|
|
482
482
|
state: t,
|
|
483
|
-
locale:
|
|
483
|
+
locale: o
|
|
484
484
|
}) => {
|
|
485
485
|
const s = t.response;
|
|
486
|
-
if (s === void 0 || !
|
|
486
|
+
if (s === void 0 || !O(t))
|
|
487
487
|
return null;
|
|
488
|
-
const r =
|
|
489
|
-
return /* @__PURE__ */
|
|
490
|
-
/* @__PURE__ */
|
|
488
|
+
const r = T(o);
|
|
489
|
+
return /* @__PURE__ */ p("nav", { "aria-label": "Search results pages", className: "dialog-search-pagination", children: [
|
|
490
|
+
/* @__PURE__ */ n(
|
|
491
491
|
"button",
|
|
492
492
|
{
|
|
493
493
|
type: "button",
|
|
@@ -496,8 +496,8 @@ const R = {
|
|
|
496
496
|
children: r.previous
|
|
497
497
|
}
|
|
498
498
|
),
|
|
499
|
-
/* @__PURE__ */
|
|
500
|
-
/* @__PURE__ */
|
|
499
|
+
/* @__PURE__ */ n("span", { children: r.pageOf(s.page + 1, s.nbPages) }),
|
|
500
|
+
/* @__PURE__ */ n(
|
|
501
501
|
"button",
|
|
502
502
|
{
|
|
503
503
|
type: "button",
|
|
@@ -508,48 +508,47 @@ const R = {
|
|
|
508
508
|
)
|
|
509
509
|
] });
|
|
510
510
|
}, D = (e) => e.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/ẞ/gu, "ß").toUpperCase().toLowerCase().replace(/ς/g, "σ"), ge = (e, t) => {
|
|
511
|
-
const
|
|
511
|
+
const o = { before: "", match: e, after: "" }, s = D(t.trim());
|
|
512
512
|
if (s === "")
|
|
513
|
-
return
|
|
513
|
+
return o;
|
|
514
514
|
const r = [...e], a = [];
|
|
515
|
-
let
|
|
516
|
-
r.forEach((
|
|
517
|
-
const
|
|
518
|
-
for (let g = 0; g <
|
|
515
|
+
let l = "";
|
|
516
|
+
r.forEach((m, d) => {
|
|
517
|
+
const h = D(m);
|
|
518
|
+
for (let g = 0; g < h.length; g += 1)
|
|
519
519
|
a.push(d);
|
|
520
|
-
|
|
520
|
+
l += h;
|
|
521
521
|
});
|
|
522
|
-
const i =
|
|
522
|
+
const i = l.indexOf(s);
|
|
523
523
|
if (i === -1)
|
|
524
|
-
return
|
|
525
|
-
const
|
|
524
|
+
return o;
|
|
525
|
+
const c = a[i], u = a[i + s.length - 1] + 1;
|
|
526
526
|
return {
|
|
527
|
-
before: r.slice(0,
|
|
528
|
-
match: r.slice(
|
|
527
|
+
before: r.slice(0, c).join(""),
|
|
528
|
+
match: r.slice(c, u).join(""),
|
|
529
529
|
after: r.slice(u).join("")
|
|
530
530
|
};
|
|
531
531
|
}, H = ({
|
|
532
532
|
title: e,
|
|
533
533
|
query: t
|
|
534
534
|
}) => {
|
|
535
|
-
const { before:
|
|
536
|
-
return /* @__PURE__ */
|
|
537
|
-
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
r !== "" && /* @__PURE__ */
|
|
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 }),
|
|
538
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-match", children: s }),
|
|
539
|
+
r !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: r })
|
|
540
540
|
] });
|
|
541
|
-
}, pe = ({
|
|
542
|
-
style: "currency",
|
|
543
|
-
currency: t
|
|
544
|
-
}).format(Number(e)), me = (e, t) => {
|
|
541
|
+
}, pe = ({ variants_min_price: e, currency: t }, o) => {
|
|
545
542
|
if (e === void 0)
|
|
546
543
|
return "";
|
|
547
544
|
try {
|
|
548
|
-
return
|
|
545
|
+
return t === void 0 ? new Intl.NumberFormat(o).format(e) : new Intl.NumberFormat(o, { style: "currency", currency: t }).format(
|
|
546
|
+
e
|
|
547
|
+
);
|
|
549
548
|
} catch {
|
|
550
549
|
return "";
|
|
551
550
|
}
|
|
552
|
-
}, fe = (e) => {
|
|
551
|
+
}, me = (e) => e.product_image || e.image || void 0, fe = (e) => {
|
|
553
552
|
try {
|
|
554
553
|
const { protocol: t } = new URL(e, window.location.href);
|
|
555
554
|
return t === "http:" || t === "https:" ? e : void 0;
|
|
@@ -559,35 +558,35 @@ const R = {
|
|
|
559
558
|
}, q = (e) => e.url === void 0 || e.url === "" ? void 0 : fe(e.url), B = (e) => e.title ?? e.handle ?? e.objectID, be = ({
|
|
560
559
|
controller: e,
|
|
561
560
|
hit: t,
|
|
562
|
-
index:
|
|
561
|
+
index: o,
|
|
563
562
|
locale: s,
|
|
564
563
|
query: r = ""
|
|
565
564
|
}) => {
|
|
566
565
|
const a = b(null);
|
|
567
566
|
f(() => {
|
|
568
|
-
a.current !== null && e.observeResult(a.current,
|
|
569
|
-
}, [e, t,
|
|
570
|
-
const
|
|
571
|
-
const
|
|
572
|
-
e.selectResult(
|
|
573
|
-
}, i = (
|
|
574
|
-
|
|
575
|
-
},
|
|
576
|
-
/* @__PURE__ */
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
|
|
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 }) }),
|
|
577
|
+
c !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-product-price", children: c })
|
|
579
578
|
] });
|
|
580
|
-
return /* @__PURE__ */
|
|
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(
|
|
581
580
|
"a",
|
|
582
581
|
{
|
|
583
582
|
className: "dialog-search-product",
|
|
584
583
|
href: u,
|
|
585
|
-
onClick:
|
|
584
|
+
onClick: l,
|
|
586
585
|
onAuxClick: i,
|
|
587
|
-
children:
|
|
586
|
+
children: d
|
|
588
587
|
}
|
|
589
588
|
) });
|
|
590
|
-
}, ve = () => /* @__PURE__ */
|
|
589
|
+
}, ve = () => /* @__PURE__ */ n(
|
|
591
590
|
"svg",
|
|
592
591
|
{
|
|
593
592
|
width: 16,
|
|
@@ -596,9 +595,9 @@ const R = {
|
|
|
596
595
|
fill: "currentColor",
|
|
597
596
|
xmlns: "http://www.w3.org/2000/svg",
|
|
598
597
|
"aria-hidden": "true",
|
|
599
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
600
599
|
}
|
|
601
|
-
), Ce = () => /* @__PURE__ */
|
|
600
|
+
), Ce = () => /* @__PURE__ */ n(
|
|
602
601
|
"svg",
|
|
603
602
|
{
|
|
604
603
|
width: 12,
|
|
@@ -607,63 +606,63 @@ const R = {
|
|
|
607
606
|
fill: "currentColor",
|
|
608
607
|
xmlns: "http://www.w3.org/2000/svg",
|
|
609
608
|
"aria-hidden": "true",
|
|
610
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
611
610
|
}
|
|
612
611
|
), j = (e) => (e ?? []).flatMap((t) => {
|
|
613
|
-
const
|
|
614
|
-
return
|
|
612
|
+
const o = q(t);
|
|
613
|
+
return o === void 0 ? [] : [{ collection: t, href: o }];
|
|
615
614
|
}), ye = ({
|
|
616
615
|
collections: e,
|
|
617
616
|
query: t,
|
|
618
|
-
messages:
|
|
617
|
+
messages: o
|
|
619
618
|
}) => {
|
|
620
619
|
const s = j(e);
|
|
621
|
-
return s.length === 0 ? null : /* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
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) })
|
|
625
624
|
] }),
|
|
626
|
-
/* @__PURE__ */
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
/* @__PURE__ */
|
|
629
|
-
/* @__PURE__ */
|
|
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, {}) })
|
|
630
629
|
] }) }, r.objectID)) })
|
|
631
630
|
] });
|
|
632
631
|
}, Se = ({
|
|
633
632
|
controller: e,
|
|
634
633
|
response: t,
|
|
635
|
-
locale:
|
|
634
|
+
locale: o,
|
|
636
635
|
messages: s
|
|
637
|
-
}) => /* @__PURE__ */
|
|
638
|
-
/* @__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: [
|
|
639
638
|
s.productsLabel,
|
|
640
|
-
t.nbHits > 0 && /* @__PURE__ */
|
|
639
|
+
t.nbHits > 0 && /* @__PURE__ */ n("span", { className: "dialog-search-label-count", children: ` · ${s.resultsCount(t.nbHits)}` })
|
|
641
640
|
] }) }),
|
|
642
|
-
/* @__PURE__ */
|
|
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(
|
|
643
642
|
be,
|
|
644
643
|
{
|
|
645
644
|
controller: e,
|
|
646
645
|
hit: r,
|
|
647
646
|
index: a,
|
|
648
|
-
locale:
|
|
647
|
+
locale: o,
|
|
649
648
|
query: t.query
|
|
650
649
|
},
|
|
651
650
|
r.objectID
|
|
652
651
|
)) })
|
|
653
652
|
] }), k = 8, w = 16, we = 200, Le = 1440, ke = (e, t) => e.bottom > 0 && e.top < t, Ne = (e, t) => {
|
|
654
|
-
const
|
|
653
|
+
const o = Math.min(
|
|
655
654
|
Le,
|
|
656
655
|
t - 2 * w
|
|
657
|
-
), s = e.left + e.width / 2 -
|
|
656
|
+
), s = e.left + e.width / 2 - o / 2;
|
|
658
657
|
return { left: Math.min(
|
|
659
658
|
Math.max(s, w),
|
|
660
|
-
t - w -
|
|
661
|
-
), width:
|
|
662
|
-
}, Ee = (e, t,
|
|
663
|
-
const s =
|
|
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);
|
|
664
663
|
return s < we && r > s ? {
|
|
665
664
|
...a,
|
|
666
|
-
bottom:
|
|
665
|
+
bottom: o - e.top + k,
|
|
667
666
|
maxHeight: Math.max(r, 0)
|
|
668
667
|
} : {
|
|
669
668
|
...a,
|
|
@@ -674,9 +673,9 @@ const R = {
|
|
|
674
673
|
const t = e.trim().replace(/^#/, "");
|
|
675
674
|
if (!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t))
|
|
676
675
|
return;
|
|
677
|
-
const
|
|
676
|
+
const o = t.length <= 4 ? [...t].map((s) => s + s).join("") : t;
|
|
678
677
|
return [0, 2, 4].map(
|
|
679
|
-
(s) => Number.parseInt(
|
|
678
|
+
(s) => Number.parseInt(o.slice(s, s + 2), 16)
|
|
680
679
|
);
|
|
681
680
|
}, Ae = (e) => {
|
|
682
681
|
const t = /^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(e);
|
|
@@ -689,8 +688,8 @@ const R = {
|
|
|
689
688
|
if (t.style.color = e, t.style.color === "")
|
|
690
689
|
return;
|
|
691
690
|
document.body.appendChild(t);
|
|
692
|
-
const
|
|
693
|
-
return t.remove(),
|
|
691
|
+
const o = Ae(getComputedStyle(t).color);
|
|
692
|
+
return t.remove(), o;
|
|
694
693
|
}, Re = (e) => Pe(e) ?? xe(e), Ie = (e) => {
|
|
695
694
|
const t = e / 255;
|
|
696
695
|
return t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
|
|
@@ -698,8 +697,8 @@ const R = {
|
|
|
698
697
|
const t = Re(e);
|
|
699
698
|
if (t === void 0)
|
|
700
699
|
return;
|
|
701
|
-
const [
|
|
702
|
-
return 0.2126 *
|
|
700
|
+
const [o, s, r] = t.map(Ie);
|
|
701
|
+
return 0.2126 * o + 0.7152 * s + 0.0722 * r;
|
|
703
702
|
}, $e = "#181825", De = "#ffffff", Me = "straight", A = 0.5, x = {
|
|
704
703
|
light: {
|
|
705
704
|
panel: "#ffffff",
|
|
@@ -719,7 +718,7 @@ const R = {
|
|
|
719
718
|
hover: "#242830",
|
|
720
719
|
thumb: "#2b2f38"
|
|
721
720
|
}
|
|
722
|
-
},
|
|
721
|
+
}, _e = {
|
|
723
722
|
rectangle: {
|
|
724
723
|
"r-panel": "4px",
|
|
725
724
|
"r-item": "4px",
|
|
@@ -732,74 +731,74 @@ const R = {
|
|
|
732
731
|
"r-thumb": "8px",
|
|
733
732
|
"r-btn": "10px"
|
|
734
733
|
}
|
|
735
|
-
}, N = (e) => e === void 0 || e.trim() === "" ? void 0 : e.trim(),
|
|
734
|
+
}, N = (e) => e === void 0 || e.trim() === "" ? void 0 : e.trim(), Te = (e) => {
|
|
736
735
|
const t = e === void 0 ? void 0 : z(e);
|
|
737
736
|
return t === void 0 ? "light" : t < A ? "dark" : "light";
|
|
738
|
-
},
|
|
739
|
-
const
|
|
740
|
-
return
|
|
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;
|
|
741
740
|
}, He = (e) => {
|
|
742
|
-
const t =
|
|
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 = {
|
|
743
742
|
...x[t],
|
|
744
|
-
...
|
|
743
|
+
..._e[o],
|
|
745
744
|
primary: s,
|
|
746
|
-
accent:
|
|
745
|
+
accent: Oe(s, t),
|
|
747
746
|
"cta-text": N(e == null ? void 0 : e.ctaTextColor) ?? De,
|
|
748
747
|
...r === void 0 ? {} : { font: r }
|
|
749
748
|
};
|
|
750
749
|
return Object.fromEntries(
|
|
751
|
-
Object.entries(a).map(([
|
|
750
|
+
Object.entries(a).map(([l, i]) => [`--dso-${l}`, i])
|
|
752
751
|
);
|
|
753
752
|
}, qe = (e) => {
|
|
754
|
-
const t = b(null), [
|
|
753
|
+
const t = b(null), [o, s] = v(void 0), [r, a] = v({ width: 0, height: 0 });
|
|
755
754
|
return V(() => {
|
|
756
755
|
if (!e)
|
|
757
756
|
return;
|
|
758
|
-
const
|
|
757
|
+
const l = () => {
|
|
759
758
|
const i = t.current;
|
|
760
759
|
if (i === null)
|
|
761
760
|
return;
|
|
762
|
-
const
|
|
761
|
+
const c = i.previousElementSibling ?? i, { top: u, bottom: m, left: d, width: h } = c.getBoundingClientRect();
|
|
763
762
|
a(
|
|
764
763
|
(g) => g.width === window.innerWidth && g.height === window.innerHeight ? g : { width: window.innerWidth, height: window.innerHeight }
|
|
765
764
|
), s(
|
|
766
|
-
(g) => g !== void 0 && g.top === u && g.bottom ===
|
|
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 }
|
|
767
766
|
);
|
|
768
767
|
};
|
|
769
|
-
return
|
|
770
|
-
window.removeEventListener("scroll",
|
|
768
|
+
return l(), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), () => {
|
|
769
|
+
window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l);
|
|
771
770
|
};
|
|
772
|
-
}, [e]), { anchorRef: t, rect:
|
|
771
|
+
}, [e]), { anchorRef: t, rect: o, viewport: r };
|
|
773
772
|
}, Be = (e, t) => {
|
|
774
|
-
const [
|
|
773
|
+
const [o, s] = v(!1), r = b(null), a = e.status !== L.IDLE && !o;
|
|
775
774
|
return f(() => {
|
|
776
775
|
s(!1);
|
|
777
776
|
}, [e.query]), f(() => {
|
|
778
777
|
if (!a)
|
|
779
778
|
return;
|
|
780
|
-
const
|
|
781
|
-
var
|
|
782
|
-
const
|
|
783
|
-
if (!(
|
|
779
|
+
const l = (i) => {
|
|
780
|
+
var h, g;
|
|
781
|
+
const c = i.target;
|
|
782
|
+
if (!(c instanceof Node))
|
|
784
783
|
return;
|
|
785
|
-
const u = (
|
|
786
|
-
!
|
|
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);
|
|
787
786
|
};
|
|
788
|
-
return document.addEventListener("pointerdown",
|
|
787
|
+
return document.addEventListener("pointerdown", l), () => document.removeEventListener("pointerdown", l);
|
|
789
788
|
}, [a, t]), f(() => {
|
|
790
|
-
var
|
|
791
|
-
const
|
|
792
|
-
if (
|
|
789
|
+
var c;
|
|
790
|
+
const l = (c = t.current) == null ? void 0 : c.previousElementSibling;
|
|
791
|
+
if (l == null)
|
|
793
792
|
return;
|
|
794
793
|
const i = () => s(!1);
|
|
795
|
-
return
|
|
794
|
+
return l.addEventListener("focusin", i), () => l.removeEventListener("focusin", i);
|
|
796
795
|
}, [t]), { isOpen: a, panelRef: r };
|
|
797
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) => {
|
|
798
|
-
var
|
|
799
|
-
const { controller:
|
|
800
|
-
if (
|
|
801
|
-
return /* @__PURE__ */
|
|
802
|
-
/* @__PURE__ */
|
|
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: [
|
|
801
|
+
/* @__PURE__ */ n(
|
|
803
802
|
"p",
|
|
804
803
|
{
|
|
805
804
|
role: "alert",
|
|
@@ -807,37 +806,37 @@ const R = {
|
|
|
807
806
|
children: je(s.error)
|
|
808
807
|
}
|
|
809
808
|
),
|
|
810
|
-
/* @__PURE__ */
|
|
809
|
+
/* @__PURE__ */ n(
|
|
811
810
|
"button",
|
|
812
811
|
{
|
|
813
812
|
type: "button",
|
|
814
813
|
className: "dialog-search-retry",
|
|
815
|
-
onClick: () =>
|
|
814
|
+
onClick: () => o.retry(),
|
|
816
815
|
children: t.retry
|
|
817
816
|
}
|
|
818
817
|
)
|
|
819
818
|
] });
|
|
820
819
|
if (i === void 0)
|
|
821
|
-
return /* @__PURE__ */
|
|
822
|
-
const
|
|
823
|
-
return /* @__PURE__ */
|
|
824
|
-
/* @__PURE__ */
|
|
820
|
+
return /* @__PURE__ */ n("p", { role: "status", className: "dialog-search-status", children: t.searching(s.query) });
|
|
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(
|
|
825
824
|
"div",
|
|
826
825
|
{
|
|
827
826
|
className: `dialog-search-body${u ? "" : " dialog-search-body--no-collections"}`,
|
|
828
827
|
children: [
|
|
829
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ n(
|
|
830
829
|
ye,
|
|
831
830
|
{
|
|
832
|
-
collections:
|
|
831
|
+
collections: c,
|
|
833
832
|
query: i.query,
|
|
834
833
|
messages: t
|
|
835
834
|
}
|
|
836
835
|
),
|
|
837
|
-
/* @__PURE__ */
|
|
836
|
+
/* @__PURE__ */ n(
|
|
838
837
|
Se,
|
|
839
838
|
{
|
|
840
|
-
controller:
|
|
839
|
+
controller: o,
|
|
841
840
|
response: i,
|
|
842
841
|
locale: r,
|
|
843
842
|
messages: t
|
|
@@ -846,34 +845,34 @@ const R = {
|
|
|
846
845
|
]
|
|
847
846
|
}
|
|
848
847
|
),
|
|
849
|
-
(
|
|
848
|
+
(m || d) && /* @__PURE__ */ n("div", { className: "dialog-search-footer", children: m ? /* @__PURE__ */ p("a", { className: "dialog-search-cta", href: a(i.query), children: [
|
|
850
849
|
t.seeAllLabel(i.nbHits),
|
|
851
|
-
/* @__PURE__ */
|
|
852
|
-
] }) : /* @__PURE__ */
|
|
850
|
+
/* @__PURE__ */ n(ve, {})
|
|
851
|
+
] }) : /* @__PURE__ */ n(
|
|
853
852
|
he,
|
|
854
853
|
{
|
|
855
|
-
controller:
|
|
854
|
+
controller: o,
|
|
856
855
|
state: s,
|
|
857
856
|
locale: r
|
|
858
857
|
}
|
|
859
858
|
) })
|
|
860
859
|
] });
|
|
861
860
|
}, Ge = (e) => {
|
|
862
|
-
const { state: t, locale:
|
|
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(
|
|
863
862
|
() => He(s),
|
|
864
863
|
[s]
|
|
865
864
|
);
|
|
866
|
-
return /* @__PURE__ */
|
|
867
|
-
/* @__PURE__ */
|
|
868
|
-
u && i !== void 0 && ke(i,
|
|
869
|
-
/* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ p(C, { children: [
|
|
866
|
+
/* @__PURE__ */ n("div", { ref: l }),
|
|
867
|
+
u && i !== void 0 && ke(i, c.height) && Z(
|
|
868
|
+
/* @__PURE__ */ n(
|
|
870
869
|
"div",
|
|
871
870
|
{
|
|
872
|
-
ref:
|
|
871
|
+
ref: m,
|
|
873
872
|
className: `dialog-search-panel dialog-search-panel--${r}`,
|
|
874
873
|
style: {
|
|
875
|
-
...Ee(i,
|
|
876
|
-
...
|
|
874
|
+
...Ee(i, c.width, c.height),
|
|
875
|
+
...h
|
|
877
876
|
},
|
|
878
877
|
children: ze(e, d)
|
|
879
878
|
}
|
|
@@ -888,60 +887,60 @@ const R = {
|
|
|
888
887
|
}, Ye = (e) => {
|
|
889
888
|
const t = b(e);
|
|
890
889
|
t.current = e;
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
const { client:
|
|
894
|
-
|
|
895
|
-
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),
|
|
896
895
|
analytics: {
|
|
897
896
|
surface: u,
|
|
898
|
-
trackViewSearchResults: (d) =>
|
|
899
|
-
trackSelectSearchResult: (d) =>
|
|
897
|
+
trackViewSearchResults: (d) => c.trackViewSearchResults(d),
|
|
898
|
+
trackSelectSearchResult: (d) => c.trackSelectSearchResult(d)
|
|
900
899
|
},
|
|
901
|
-
...
|
|
900
|
+
...m
|
|
902
901
|
});
|
|
903
902
|
}
|
|
904
|
-
return
|
|
903
|
+
return o.current;
|
|
905
904
|
}, []), r = b(void 0);
|
|
906
905
|
r.current ?? (r.current = {
|
|
907
|
-
setQuery: (
|
|
908
|
-
submit: (
|
|
909
|
-
setPage: (
|
|
906
|
+
setQuery: (c) => s().setQuery(c),
|
|
907
|
+
submit: (c) => s().submit(c),
|
|
908
|
+
setPage: (c) => s().setPage(c),
|
|
910
909
|
retry: () => s().retry(),
|
|
911
|
-
observeResult: (
|
|
912
|
-
selectResult: (
|
|
913
|
-
subscribe: (
|
|
910
|
+
observeResult: (c, u) => s().observeResult(c, u),
|
|
911
|
+
selectResult: (c, u) => s().selectResult(c, u),
|
|
912
|
+
subscribe: (c) => s().subscribe(c),
|
|
914
913
|
getState: () => s().getState(),
|
|
915
914
|
// Create a replacement on next access after disposal.
|
|
916
915
|
dispose: () => {
|
|
917
|
-
var
|
|
918
|
-
(
|
|
916
|
+
var c;
|
|
917
|
+
(c = o.current) == null || c.dispose(), o.current = void 0;
|
|
919
918
|
}
|
|
920
919
|
}), f(() => {
|
|
921
920
|
M({
|
|
922
921
|
method: "react",
|
|
923
|
-
version: "2.
|
|
922
|
+
version: "2.9.0"
|
|
924
923
|
});
|
|
925
|
-
const
|
|
924
|
+
const c = s();
|
|
926
925
|
return () => {
|
|
927
|
-
|
|
926
|
+
c.dispose(), o.current === c && (o.current = void 0);
|
|
928
927
|
};
|
|
929
928
|
}, [s]);
|
|
930
929
|
const a = P(
|
|
931
|
-
(
|
|
930
|
+
(c) => s().subscribe(c),
|
|
932
931
|
[s]
|
|
933
|
-
),
|
|
932
|
+
), l = P(
|
|
934
933
|
() => s().getState(),
|
|
935
934
|
[s]
|
|
936
935
|
), i = K(
|
|
937
936
|
a,
|
|
938
|
-
|
|
937
|
+
l,
|
|
939
938
|
() => Ve
|
|
940
939
|
);
|
|
941
940
|
return { controller: r.current, state: i, theme: e.client.theme };
|
|
942
941
|
};
|
|
943
942
|
export {
|
|
944
|
-
|
|
943
|
+
oe as DialogInput,
|
|
945
944
|
Ze as DialogProductBlock,
|
|
946
945
|
Xe as DialogSearchBar,
|
|
947
946
|
he as DialogSearchPagination,
|