@a4ui/core 0.22.0 → 0.24.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/dist/commerce.js CHANGED
@@ -1,78 +1,78 @@
1
- import { insert as l, createComponent as d, memo as I, effect as b, className as $, template as g, delegateEvents as S, setAttribute as y } from "solid-js/web";
2
- import { Show as h, For as k, createSignal as N, createMemo as C } from "solid-js";
3
- import { c as x } from "./cn-B6yFEsav.js";
4
- import { B as q, C as E, R, a as A, b as F } from "./Checkbox-DIzLQltI.js";
5
- import { Minus as M, Plus as P, Trash2 as U } from "lucide-solid";
6
- var j = /* @__PURE__ */ g('<span class="text-muted-foreground line-through">'), B = /* @__PURE__ */ g("<div><span>");
7
- const D = {
1
+ import { insert as n, createComponent as c, memo as k, effect as b, className as C, template as v, delegateEvents as A, setAttribute as w, setStyleProperty as j } from "solid-js/web";
2
+ import { Show as $, For as S, createSignal as B, createMemo as R } from "solid-js";
3
+ import { c as _ } from "./cn-B6yFEsav.js";
4
+ import { B as D, C as O, R as G, a as M, b as z, N as U, c as K } from "./NumberInput-enx_0iVh.js";
5
+ import { Minus as Q, Plus as V, Trash2 as X, X as Z, CreditCard as H } from "lucide-solid";
6
+ var J = /* @__PURE__ */ v('<span class="text-muted-foreground line-through">'), W = /* @__PURE__ */ v("<div><span>");
7
+ const Y = {
8
8
  sm: "text-sm",
9
9
  md: "text-lg",
10
10
  lg: "text-2xl"
11
11
  };
12
- function T(e) {
13
- const n = (a) => new Intl.NumberFormat(e.locale ?? "en-US", {
12
+ function L(e) {
13
+ const i = (s) => new Intl.NumberFormat(e.locale ?? "en-US", {
14
14
  style: "currency",
15
15
  currency: e.currency ?? "USD"
16
- }).format(a), r = () => (e.compareAt ?? 0) > e.amount, t = () => Math.round((1 - e.amount / e.compareAt) * 100);
16
+ }).format(s), o = () => (e.compareAt ?? 0) > e.amount, r = () => Math.round((1 - e.amount / e.compareAt) * 100);
17
17
  return (() => {
18
- var a = B(), o = a.firstChild;
19
- return l(o, () => n(e.amount)), l(a, d(h, {
18
+ var s = W(), d = s.firstChild;
19
+ return n(d, () => i(e.amount)), n(s, c($, {
20
20
  get when() {
21
- return r();
21
+ return o();
22
22
  },
23
23
  get children() {
24
24
  return [(() => {
25
- var u = j();
26
- return l(u, () => n(e.compareAt)), u;
27
- })(), d(q, {
25
+ var a = J();
26
+ return n(a, () => i(e.compareAt)), a;
27
+ })(), c(D, {
28
28
  tone: "danger",
29
29
  get children() {
30
- return ["-", I(() => t()), "%"];
30
+ return ["-", k(() => r()), "%"];
31
31
  }
32
32
  })];
33
33
  }
34
- }), null), b((u) => {
35
- var c = x("inline-flex items-center gap-2", e.class), s = x("font-bold text-foreground", D[e.size ?? "md"]);
36
- return c !== u.e && $(a, u.e = c), s !== u.t && $(o, u.t = s), u;
34
+ }), null), b((a) => {
35
+ var t = _("inline-flex items-center gap-2", e.class), u = _("font-bold text-foreground", Y[e.size ?? "md"]);
36
+ return t !== a.e && C(s, a.e = t), u !== a.t && C(d, a.t = u), a;
37
37
  }, {
38
38
  e: void 0,
39
39
  t: void 0
40
- }), a;
40
+ }), s;
41
41
  })();
42
42
  }
43
- var L = /* @__PURE__ */ g('<div><button type=button aria-label="Decrease quantity"class="grid h-8 w-8 place-items-center hover:bg-muted disabled:opacity-40"></button><span class="grid min-w-[2.5rem] place-items-center tabular-nums"></span><button type=button aria-label="Increase quantity"class="grid h-8 w-8 place-items-center hover:bg-muted disabled:opacity-40">');
44
- function z(e) {
45
- const n = () => e.min ?? 0, r = () => e.max ?? Number.MAX_SAFE_INTEGER, t = (u) => Math.min(r(), Math.max(n(), u)), a = () => e.onChange(t(e.value - 1)), o = () => e.onChange(t(e.value + 1));
43
+ var p = /* @__PURE__ */ v('<div><button type=button aria-label="Decrease quantity"class="grid h-8 w-8 place-items-center hover:bg-muted disabled:opacity-40"></button><span class="grid min-w-[2.5rem] place-items-center tabular-nums"></span><button type=button aria-label="Increase quantity"class="grid h-8 w-8 place-items-center hover:bg-muted disabled:opacity-40">');
44
+ function ee(e) {
45
+ const i = () => e.min ?? 0, o = () => e.max ?? Number.MAX_SAFE_INTEGER, r = (a) => Math.min(o(), Math.max(i(), a)), s = () => e.onChange(r(e.value - 1)), d = () => e.onChange(r(e.value + 1));
46
46
  return (() => {
47
- var u = L(), c = u.firstChild, s = c.nextSibling, f = s.nextSibling;
48
- return c.$$click = a, l(c, d(M, {
47
+ var a = p(), t = a.firstChild, u = t.nextSibling, f = u.nextSibling;
48
+ return t.$$click = s, n(t, c(Q, {
49
49
  class: "h-4 w-4"
50
- })), l(s, () => e.value), f.$$click = o, l(f, d(P, {
50
+ })), n(u, () => e.value), f.$$click = d, n(f, c(V, {
51
51
  class: "h-4 w-4"
52
- })), b((i) => {
53
- var m = x("inline-flex items-stretch rounded-md border border-input", e.class), v = e.disabled || e.value <= n(), _ = e.disabled || e.value >= r();
54
- return m !== i.e && $(u, i.e = m), v !== i.t && (c.disabled = i.t = v), _ !== i.a && (f.disabled = i.a = _), i;
52
+ })), b((l) => {
53
+ var g = _("inline-flex items-stretch rounded-md border border-input", e.class), h = e.disabled || e.value <= i(), m = e.disabled || e.value >= o();
54
+ return g !== l.e && C(a, l.e = g), h !== l.t && (t.disabled = l.t = h), m !== l.a && (f.disabled = l.a = m), l;
55
55
  }, {
56
56
  e: void 0,
57
57
  t: void 0,
58
58
  a: void 0
59
- }), u;
59
+ }), a;
60
60
  })();
61
61
  }
62
- S(["click"]);
63
- var G = /* @__PURE__ */ g("<span>"), O = /* @__PURE__ */ g('<div class="relative aspect-square overflow-hidden rounded-lg bg-muted"><img loading=lazy class="h-full w-full object-cover">', !0, !1, !1), Q = /* @__PURE__ */ g('<span class="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">'), X = /* @__PURE__ */ g('<span class="w-fit rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground">'), Z = /* @__PURE__ */ g('<div class="mt-3 flex flex-1 flex-col gap-1.5"><p class="line-clamp-1 font-medium text-foreground">');
64
- const H = {
62
+ A(["click"]);
63
+ var te = /* @__PURE__ */ v("<span>"), ne = /* @__PURE__ */ v('<div class="relative aspect-square overflow-hidden rounded-lg bg-muted"><img loading=lazy class="h-full w-full object-cover">', !0, !1, !1), le = /* @__PURE__ */ v('<span class="text-[11px] font-medium uppercase tracking-wide text-muted-foreground">'), re = /* @__PURE__ */ v('<span class="w-fit rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground">'), ae = /* @__PURE__ */ v('<div class="mt-3 flex flex-1 flex-col gap-1.5"><p class="line-clamp-1 font-medium text-foreground">');
64
+ const ie = {
65
65
  sale: "bg-destructive text-destructive-foreground",
66
66
  new: "bg-primary text-primary-foreground",
67
67
  featured: "bg-accent text-accent-foreground"
68
68
  };
69
- function J(e, n) {
70
- if (n) return n;
71
- const r = (e ?? "").toLowerCase();
72
- return /sale|off|%|deal/.test(r) ? "sale" : /new/.test(r) ? "new" : "featured";
69
+ function ue(e, i) {
70
+ if (i) return i;
71
+ const o = (e ?? "").toLowerCase();
72
+ return /sale|off|%|deal/.test(o) ? "sale" : /new/.test(o) ? "new" : "featured";
73
73
  }
74
- function de(e) {
75
- return d(E, {
74
+ function De(e) {
75
+ return c(O, {
76
76
  glass: !0,
77
77
  glow: !0,
78
78
  get tilt() {
@@ -82,50 +82,50 @@ function de(e) {
82
82
  return e.spotlight;
83
83
  },
84
84
  get class() {
85
- return x("flex h-full flex-col overflow-hidden p-4", e.class);
85
+ return _("flex h-full flex-col overflow-hidden p-4", e.class);
86
86
  },
87
87
  get children() {
88
88
  return [(() => {
89
- var n = O(), r = n.firstChild;
90
- return l(n, d(h, {
89
+ var i = ne(), o = i.firstChild;
90
+ return n(i, c($, {
91
91
  get when() {
92
92
  return e.badge;
93
93
  },
94
94
  get children() {
95
- var t = G();
96
- return l(t, () => e.badge), b(() => $(t, x("absolute -right-9 top-3.5 w-32 rotate-45 py-1 text-center text-[11px] font-semibold uppercase tracking-wide shadow-md", H[J(e.badge, e.badgeTone)]))), t;
95
+ var r = te();
96
+ return n(r, () => e.badge), b(() => C(r, _("absolute -right-9 top-3.5 w-32 rotate-45 py-1 text-center text-[11px] font-semibold uppercase tracking-wide shadow-md", ie[ue(e.badge, e.badgeTone)]))), r;
97
97
  }
98
- }), null), b((t) => {
99
- var a = e.image, o = e.title;
100
- return a !== t.e && y(r, "src", t.e = a), o !== t.t && y(r, "alt", t.t = o), t;
98
+ }), null), b((r) => {
99
+ var s = e.image, d = e.title;
100
+ return s !== r.e && w(o, "src", r.e = s), d !== r.t && w(o, "alt", r.t = d), r;
101
101
  }, {
102
102
  e: void 0,
103
103
  t: void 0
104
- }), n;
104
+ }), i;
105
105
  })(), (() => {
106
- var n = Z(), r = n.firstChild;
107
- return l(n, d(h, {
106
+ var i = ae(), o = i.firstChild;
107
+ return n(i, c($, {
108
108
  get when() {
109
109
  return e.brand;
110
110
  },
111
111
  get children() {
112
- var t = Q();
113
- return l(t, () => e.brand), t;
112
+ var r = le();
113
+ return n(r, () => e.brand), r;
114
114
  }
115
- }), r), l(r, () => e.title), l(n, d(h, {
115
+ }), o), n(o, () => e.title), n(i, c($, {
116
116
  get when() {
117
117
  return e.category;
118
118
  },
119
119
  get children() {
120
- var t = X();
121
- return l(t, () => e.category), t;
120
+ var r = re();
121
+ return n(r, () => e.category), r;
122
122
  }
123
- }), null), l(n, d(h, {
123
+ }), null), n(i, c($, {
124
124
  get when() {
125
125
  return e.rating !== void 0;
126
126
  },
127
127
  get children() {
128
- return d(R, {
128
+ return c(G, {
129
129
  get value() {
130
130
  return e.rating;
131
131
  },
@@ -133,7 +133,7 @@ function de(e) {
133
133
  max: 5
134
134
  });
135
135
  }
136
- }), null), l(n, d(T, {
136
+ }), null), n(i, c(L, {
137
137
  get amount() {
138
138
  return e.price;
139
139
  },
@@ -146,55 +146,55 @@ function de(e) {
146
146
  get locale() {
147
147
  return e.locale;
148
148
  }
149
- }), null), l(n, d(h, {
149
+ }), null), n(i, c($, {
150
150
  get when() {
151
151
  return e.onAddToCart;
152
152
  },
153
153
  get children() {
154
- return d(A, {
154
+ return c(M, {
155
155
  class: "mt-auto w-full",
156
- onClick: (t) => {
157
- var a;
158
- t.stopPropagation(), (a = e.onAddToCart) == null || a.call(e);
156
+ onClick: (r) => {
157
+ var s;
158
+ r.stopPropagation(), (s = e.onAddToCart) == null || s.call(e);
159
159
  },
160
160
  children: "Add to cart"
161
161
  });
162
162
  }
163
- }), null), n;
163
+ }), null), i;
164
164
  })()];
165
165
  }
166
166
  });
167
167
  }
168
- var K = /* @__PURE__ */ g("<div>");
169
- function oe(e) {
168
+ var ce = /* @__PURE__ */ v("<div>");
169
+ function Le(e) {
170
170
  return (() => {
171
- var n = K();
172
- return l(n, () => e.children), b(() => $(n, x("grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4", e.class))), n;
171
+ var i = ce();
172
+ return n(i, () => e.children), b(() => C(i, _("grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4", e.class))), i;
173
173
  })();
174
174
  }
175
- var V = /* @__PURE__ */ g('<img class="h-16 w-16 shrink-0 rounded-md bg-muted object-cover">'), W = /* @__PURE__ */ g('<button type=button aria-label="Remove item"class="text-muted-foreground hover:text-foreground">'), Y = /* @__PURE__ */ g('<div><div class="min-w-[8rem] flex-1"><p class="line-clamp-1 font-medium text-foreground"></p></div><span class="min-w-[4rem] text-right font-medium tabular-nums text-foreground">');
176
- function se(e) {
177
- const n = () => e.price * e.quantity, r = (t) => new Intl.NumberFormat(e.locale ?? "en-US", {
175
+ var de = /* @__PURE__ */ v('<img class="h-16 w-16 shrink-0 rounded-md bg-muted object-cover">'), oe = /* @__PURE__ */ v('<button type=button aria-label="Remove item"class="text-muted-foreground hover:text-foreground">'), se = /* @__PURE__ */ v('<div><div class="min-w-[8rem] flex-1"><p class="line-clamp-1 font-medium text-foreground"></p></div><span class="min-w-[4rem] text-right font-medium tabular-nums text-foreground">');
176
+ function Oe(e) {
177
+ const i = () => e.price * e.quantity, o = (r) => new Intl.NumberFormat(e.locale ?? "en-US", {
178
178
  style: "currency",
179
179
  currency: e.currency ?? "USD"
180
- }).format(t);
180
+ }).format(r);
181
181
  return (() => {
182
- var t = Y(), a = t.firstChild, o = a.firstChild, u = a.nextSibling;
183
- return l(t, d(h, {
182
+ var r = se(), s = r.firstChild, d = s.firstChild, a = s.nextSibling;
183
+ return n(r, c($, {
184
184
  get when() {
185
185
  return e.image;
186
186
  },
187
187
  get children() {
188
- var c = V();
189
- return b((s) => {
190
- var f = e.image, i = e.title;
191
- return f !== s.e && y(c, "src", s.e = f), i !== s.t && y(c, "alt", s.t = i), s;
188
+ var t = de();
189
+ return b((u) => {
190
+ var f = e.image, l = e.title;
191
+ return f !== u.e && w(t, "src", u.e = f), l !== u.t && w(t, "alt", u.t = l), u;
192
192
  }, {
193
193
  e: void 0,
194
194
  t: void 0
195
- }), c;
195
+ }), t;
196
196
  }
197
- }), a), l(o, () => e.title), l(a, d(T, {
197
+ }), s), n(d, () => e.title), n(s, c(L, {
198
198
  get amount() {
199
199
  return e.price;
200
200
  },
@@ -205,129 +205,444 @@ function se(e) {
205
205
  return e.locale;
206
206
  },
207
207
  size: "sm"
208
- }), null), l(t, d(z, {
208
+ }), null), n(r, c(ee, {
209
209
  get value() {
210
210
  return e.quantity;
211
211
  },
212
- onChange: (c) => {
213
- var s;
214
- return (s = e.onQuantityChange) == null ? void 0 : s.call(e, c);
212
+ onChange: (t) => {
213
+ var u;
214
+ return (u = e.onQuantityChange) == null ? void 0 : u.call(e, t);
215
215
  },
216
216
  min: 1
217
- }), u), l(u, () => r(n())), l(t, d(h, {
217
+ }), a), n(a, () => o(i())), n(r, c($, {
218
218
  get when() {
219
219
  return e.onRemove;
220
220
  },
221
221
  get children() {
222
- var c = W();
223
- return c.$$click = () => {
224
- var s;
225
- return (s = e.onRemove) == null ? void 0 : s.call(e);
226
- }, l(c, d(U, {
222
+ var t = oe();
223
+ return t.$$click = () => {
224
+ var u;
225
+ return (u = e.onRemove) == null ? void 0 : u.call(e);
226
+ }, n(t, c(X, {
227
227
  class: "h-4 w-4"
228
- })), c;
228
+ })), t;
229
229
  }
230
- }), null), b(() => $(t, x("flex flex-wrap items-center gap-4", e.class))), t;
230
+ }), null), b(() => C(r, _("flex flex-wrap items-center gap-4", e.class))), r;
231
231
  })();
232
232
  }
233
- S(["click"]);
234
- var p = /* @__PURE__ */ g('<div><div class="my-3 border-t border-border"></div><div class="flex items-center justify-between text-base font-bold text-foreground"><span>Total</span><span class=tabular-nums>'), ee = /* @__PURE__ */ g('<div class="flex items-center justify-between py-1 text-sm"><span class=text-muted-foreground></span><span class="tabular-nums text-foreground">');
235
- function me(e) {
236
- const n = (r) => new Intl.NumberFormat(e.locale ?? "en-US", {
233
+ A(["click"]);
234
+ var me = /* @__PURE__ */ v('<div><div class="my-3 border-t border-border"></div><div class="flex items-center justify-between text-base font-bold text-foreground"><span>Total</span><span class=tabular-nums>'), ge = /* @__PURE__ */ v('<div class="flex items-center justify-between py-1 text-sm"><span class=text-muted-foreground></span><span class="tabular-nums text-foreground">');
235
+ function Ge(e) {
236
+ const i = (o) => new Intl.NumberFormat(e.locale ?? "en-US", {
237
237
  style: "currency",
238
238
  currency: e.currency ?? "USD"
239
- }).format(r);
239
+ }).format(o);
240
240
  return (() => {
241
- var r = p(), t = r.firstChild, a = t.nextSibling, o = a.firstChild, u = o.nextSibling;
242
- return l(r, d(k, {
241
+ var o = me(), r = o.firstChild, s = r.nextSibling, d = s.firstChild, a = d.nextSibling;
242
+ return n(o, c(S, {
243
243
  get each() {
244
244
  return e.lines;
245
245
  },
246
- children: (c) => (() => {
247
- var s = ee(), f = s.firstChild, i = f.nextSibling;
248
- return l(f, () => c.label), l(i, () => n(c.amount)), s;
246
+ children: (t) => (() => {
247
+ var u = ge(), f = u.firstChild, l = f.nextSibling;
248
+ return n(f, () => t.label), n(l, () => i(t.amount)), u;
249
249
  })()
250
- }), t), l(u, () => n(e.total)), l(r, d(h, {
250
+ }), r), n(a, () => i(e.total)), n(o, c($, {
251
251
  get when() {
252
252
  return e.onCheckout;
253
253
  },
254
254
  get children() {
255
- return d(A, {
255
+ return c(M, {
256
256
  class: "mt-4 w-full",
257
257
  onClick: () => {
258
- var c;
259
- return (c = e.onCheckout) == null ? void 0 : c.call(e);
258
+ var t;
259
+ return (t = e.onCheckout) == null ? void 0 : t.call(e);
260
260
  },
261
261
  get children() {
262
262
  return e.checkoutLabel ?? "Checkout";
263
263
  }
264
264
  });
265
265
  }
266
- }), null), b(() => $(r, x("card glow-edge rounded-xl p-5 text-card-foreground", e.class))), r;
266
+ }), null), b(() => C(o, _("card glow-edge rounded-xl p-5 text-card-foreground", e.class))), o;
267
267
  })();
268
268
  }
269
- var te = /* @__PURE__ */ g('<div><p class="text-sm font-semibold text-foreground"></p><div class=space-y-1.5>'), ne = /* @__PURE__ */ g('<span class="text-xs text-muted-foreground">'), re = /* @__PURE__ */ g('<div class="flex items-center justify-between gap-2">');
270
- function ge(e) {
271
- const n = (r, t) => {
272
- const a = e.selected.slice(), o = a.indexOf(r);
273
- t ? o === -1 && a.push(r) : o !== -1 && a.splice(o, 1), e.onChange(a);
269
+ var fe = /* @__PURE__ */ v('<div><p class="text-sm font-semibold text-foreground"></p><div class=space-y-1.5>'), ve = /* @__PURE__ */ v('<span class="text-xs text-muted-foreground">'), he = /* @__PURE__ */ v('<div class="flex items-center justify-between gap-2">');
270
+ function q(e) {
271
+ const i = (o, r) => {
272
+ const s = e.selected.slice(), d = s.indexOf(o);
273
+ r ? d === -1 && s.push(o) : d !== -1 && s.splice(d, 1), e.onChange(s);
274
274
  };
275
275
  return (() => {
276
- var r = te(), t = r.firstChild, a = t.nextSibling;
277
- return l(t, () => e.title), l(a, d(k, {
276
+ var o = fe(), r = o.firstChild, s = r.nextSibling;
277
+ return n(r, () => e.title), n(s, c(S, {
278
278
  get each() {
279
279
  return e.options;
280
280
  },
281
- children: (o) => (() => {
282
- var u = re();
283
- return l(u, d(F, {
281
+ children: (d) => (() => {
282
+ var a = he();
283
+ return n(a, c(z, {
284
284
  get checked() {
285
- return e.selected.includes(o.value);
285
+ return e.selected.includes(d.value);
286
286
  },
287
- onChange: (c) => n(o.value, c),
287
+ onChange: (t) => i(d.value, t),
288
288
  get label() {
289
- return o.label;
289
+ return d.label;
290
290
  }
291
- }), null), l(u, d(h, {
291
+ }), null), n(a, c($, {
292
292
  get when() {
293
- return o.count != null;
293
+ return d.count != null;
294
294
  },
295
295
  get children() {
296
- var c = ne();
297
- return l(c, () => o.count), c;
296
+ var t = ve();
297
+ return n(t, () => d.count), t;
298
+ }
299
+ }), null), a;
300
+ })()
301
+ })), b(() => C(o, _("space-y-2", e.class))), o;
302
+ })();
303
+ }
304
+ var xe = /* @__PURE__ */ v('<div class=space-y-2><p class="text-sm font-semibold text-foreground">'), $e = /* @__PURE__ */ v('<p class="text-sm text-muted-foreground"> results'), be = /* @__PURE__ */ v('<div class="flex flex-wrap gap-2">'), _e = /* @__PURE__ */ v('<div><div class="flex items-center justify-between gap-2">'), Ce = /* @__PURE__ */ v('<span class="inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs"><button type=button class="text-muted-foreground hover:text-foreground">'), we = /* @__PURE__ */ v('<div class=space-y-2><div class="flex items-center justify-between"><p class="text-sm font-semibold text-foreground">Price</p><p class="text-xs text-muted-foreground">$<!> – $</p></div><div class="flex items-center gap-2"><span class="text-sm text-muted-foreground">–');
305
+ function ye(e) {
306
+ const [i, o] = B(e.section.defaultOpen ?? !0);
307
+ return c($, {
308
+ get when() {
309
+ return e.section.collapsible ?? !0;
310
+ },
311
+ get fallback() {
312
+ return (() => {
313
+ var r = xe(), s = r.firstChild;
314
+ return n(s, () => e.section.title), n(r, c(q, {
315
+ title: "",
316
+ get options() {
317
+ return e.section.options;
318
+ },
319
+ get selected() {
320
+ return e.selected;
321
+ },
322
+ get onChange() {
323
+ return e.onChange;
324
+ }
325
+ }), null), r;
326
+ })();
327
+ },
328
+ get children() {
329
+ return c(K, {
330
+ get open() {
331
+ return i();
332
+ },
333
+ onOpenChange: o,
334
+ get title() {
335
+ return e.section.title;
336
+ },
337
+ get children() {
338
+ return c(q, {
339
+ title: "",
340
+ get options() {
341
+ return e.section.options;
342
+ },
343
+ get selected() {
344
+ return e.selected;
345
+ },
346
+ get onChange() {
347
+ return e.onChange;
348
+ }
349
+ });
350
+ }
351
+ });
352
+ }
353
+ });
354
+ }
355
+ function ze(e) {
356
+ const i = () => {
357
+ const d = [];
358
+ for (const a of e.sections) {
359
+ const t = e.selected[a.key] ?? [];
360
+ for (const u of t) {
361
+ const f = a.options.find((l) => l.value === u);
362
+ d.push({
363
+ sectionKey: a.key,
364
+ value: u,
365
+ label: (f == null ? void 0 : f.label) ?? u
366
+ });
367
+ }
368
+ }
369
+ return d;
370
+ }, o = (d) => {
371
+ const a = e.selected[d.sectionKey] ?? [];
372
+ e.onChange(d.sectionKey, a.filter((t) => t !== d.value));
373
+ }, r = (d) => {
374
+ if (!e.price || !e.onPriceChange) return;
375
+ const a = Math.min(d, e.price.value[1]);
376
+ e.onPriceChange([a, e.price.value[1]]);
377
+ }, s = (d) => {
378
+ if (!e.price || !e.onPriceChange) return;
379
+ const a = Math.max(d, e.price.value[0]);
380
+ e.onPriceChange([e.price.value[0], a]);
381
+ };
382
+ return (() => {
383
+ var d = _e(), a = d.firstChild;
384
+ return n(a, c($, {
385
+ get when() {
386
+ return e.resultCount != null;
387
+ },
388
+ get children() {
389
+ var t = $e(), u = t.firstChild;
390
+ return n(t, () => e.resultCount, u), t;
391
+ }
392
+ }), null), n(a, c($, {
393
+ get when() {
394
+ return e.onClearAll;
395
+ },
396
+ get children() {
397
+ return c(M, {
398
+ variant: "ghost",
399
+ class: "ml-auto h-auto px-2 py-1 text-xs",
400
+ onClick: () => {
401
+ var t;
402
+ return (t = e.onClearAll) == null ? void 0 : t.call(e);
403
+ },
404
+ children: "Clear all"
405
+ });
406
+ }
407
+ }), null), n(d, c($, {
408
+ get when() {
409
+ return i().length > 0;
410
+ },
411
+ get children() {
412
+ var t = be();
413
+ return n(t, c(S, {
414
+ get each() {
415
+ return i();
416
+ },
417
+ children: (u) => (() => {
418
+ var f = Ce(), l = f.firstChild;
419
+ return n(f, () => u.label, l), l.$$click = () => o(u), n(l, c(Z, {
420
+ class: "h-3 w-3"
421
+ })), b(() => w(l, "aria-label", `Remove ${u.label}`)), f;
422
+ })()
423
+ })), t;
424
+ }
425
+ }), null), n(d, c($, {
426
+ get when() {
427
+ return e.price;
428
+ },
429
+ children: (t) => (() => {
430
+ var u = we(), f = u.firstChild, l = f.firstChild, g = l.nextSibling, h = g.firstChild, m = h.nextSibling;
431
+ m.nextSibling;
432
+ var x = f.nextSibling, y = x.firstChild;
433
+ return n(g, () => t().value[0], m), n(g, () => t().value[1], null), n(x, c(U, {
434
+ get value() {
435
+ return t().value[0];
436
+ },
437
+ onChange: r,
438
+ get min() {
439
+ return t().min;
440
+ },
441
+ get max() {
442
+ return t().value[1];
443
+ }
444
+ }), y), n(x, c(U, {
445
+ get value() {
446
+ return t().value[1];
447
+ },
448
+ onChange: s,
449
+ get min() {
450
+ return t().value[0];
451
+ },
452
+ get max() {
453
+ return t().max;
298
454
  }
299
455
  }), null), u;
300
456
  })()
301
- })), b(() => $(r, x("space-y-2", e.class))), r;
457
+ }), null), n(d, c(S, {
458
+ get each() {
459
+ return e.sections;
460
+ },
461
+ children: (t) => c(ye, {
462
+ section: t,
463
+ get selected() {
464
+ return e.selected[t.key] ?? [];
465
+ },
466
+ onChange: (u) => e.onChange(t.key, u)
467
+ })
468
+ }), null), b(() => C(d, _("space-y-5", e.class))), d;
469
+ })();
470
+ }
471
+ A(["click"]);
472
+ var Se = /* @__PURE__ */ v('<span class="text-muted-foreground line-through">'), ke = /* @__PURE__ */ v('<span class="inline-flex items-center gap-1 text-sm text-muted-foreground">As low as <!>/mo'), Ae = /* @__PURE__ */ v('<div><div class="flex flex-wrap items-center gap-2"><span>'), Me = /* @__PURE__ */ v('<span class="text-sm text-muted-foreground"> after code '), Pe = /* @__PURE__ */ v('<div class="flex flex-wrap items-center gap-2"><span class="inline-flex items-center gap-1 rounded-md border border-dashed border-primary/50 px-2 py-0.5 text-xs font-mono text-primary"> ');
473
+ const Te = {
474
+ md: "text-xl",
475
+ lg: "text-3xl"
476
+ };
477
+ function Ke(e) {
478
+ const i = (t) => new Intl.NumberFormat(e.locale ?? "en-US", {
479
+ style: "currency",
480
+ currency: e.currency ?? "USD"
481
+ }).format(t), o = () => (e.compareAt ?? 0) > e.amount, r = () => e.compareAt - e.amount, s = () => Math.round((1 - e.amount / e.compareAt) * 100), d = () => {
482
+ var u;
483
+ const t = ((u = e.coupon) == null ? void 0 : u.amount) ?? 0;
484
+ return Math.max(0, e.amount - t);
485
+ }, a = () => {
486
+ const t = e.financing, u = t.apr ?? 0;
487
+ if (u > 0) {
488
+ const f = u / 12, l = t.months, g = e.amount * f / (1 - (1 + f) ** -l);
489
+ return Math.round(g * 100) / 100;
490
+ }
491
+ return Math.round(e.amount / t.months * 100) / 100;
492
+ };
493
+ return (() => {
494
+ var t = Ae(), u = t.firstChild, f = u.firstChild;
495
+ return n(f, () => i(e.amount)), n(u, c($, {
496
+ get when() {
497
+ return o();
498
+ },
499
+ get children() {
500
+ return [(() => {
501
+ var l = Se();
502
+ return n(l, () => i(e.compareAt)), l;
503
+ })(), c(D, {
504
+ tone: "danger",
505
+ get children() {
506
+ return ["Save ", k(() => i(r())), " (-", k(() => s()), "%)"];
507
+ }
508
+ })];
509
+ }
510
+ }), null), n(t, c($, {
511
+ get when() {
512
+ return e.coupon;
513
+ },
514
+ children: (l) => (() => {
515
+ var g = Pe(), h = g.firstChild, m = h.firstChild;
516
+ return n(h, () => l().label ?? "Coupon", m), n(h, () => l().code, null), n(g, c($, {
517
+ get when() {
518
+ return l().amount !== void 0;
519
+ },
520
+ get children() {
521
+ var x = Me(), y = x.firstChild;
522
+ return n(x, () => i(d()), y), n(x, () => l().code, null), x;
523
+ }
524
+ }), null), g;
525
+ })()
526
+ }), null), n(t, c($, {
527
+ get when() {
528
+ return e.financing;
529
+ },
530
+ get children() {
531
+ var l = ke(), g = l.firstChild, h = g.nextSibling;
532
+ return h.nextSibling, n(l, c(H, {
533
+ class: "h-4 w-4"
534
+ }), g), n(l, () => i(a()), h), l;
535
+ }
536
+ }), null), n(t, c($, {
537
+ get when() {
538
+ return e.note;
539
+ },
540
+ get children() {
541
+ return e.note;
542
+ }
543
+ }), null), b((l) => {
544
+ var g = _("flex flex-col gap-1", e.class), h = _("font-bold text-foreground", Te[e.size ?? "lg"]);
545
+ return g !== l.e && C(t, l.e = g), h !== l.t && C(f, l.t = h), l;
546
+ }, {
547
+ e: void 0,
548
+ t: void 0
549
+ }), t;
550
+ })();
551
+ }
552
+ var Ee = /* @__PURE__ */ v('<span class="text-sm text-muted-foreground"> / '), Ie = /* @__PURE__ */ v('<div><div class="flex items-end justify-between gap-2"><span class="font-semibold text-foreground"></span></div><div class="relative mt-2 h-2 w-full rounded-full bg-muted"role=meter><div class="absolute h-2 rounded-full bg-gradient-to-r from-primary/40 to-primary"></div><div class="absolute -top-1 h-4 w-4 -translate-x-1/2 rounded-full border-2 border-background bg-primary shadow"></div></div><div class="flex items-center justify-between text-xs text-muted-foreground">'), Ne = /* @__PURE__ */ v("<span>");
553
+ const Fe = [{
554
+ min: 10,
555
+ label: "Brand New"
556
+ }, {
557
+ min: 9,
558
+ label: "Excellent"
559
+ }, {
560
+ min: 7,
561
+ label: "Very Good"
562
+ }, {
563
+ min: 5,
564
+ label: "Good"
565
+ }, {
566
+ min: 1,
567
+ label: "Fair"
568
+ }];
569
+ function Qe(e) {
570
+ const i = () => e.min ?? 1, o = () => e.max ?? 10, r = () => (e.tiers ?? Fe).slice().sort((a, t) => a.min - t.min), s = () => {
571
+ const a = o() - i();
572
+ return a <= 0 ? 0 : Math.max(0, Math.min(100, (e.value - i()) / a * 100));
573
+ }, d = () => {
574
+ const a = r();
575
+ let t = a[0];
576
+ for (const u of a)
577
+ u.min <= e.value && (t = u);
578
+ return t;
579
+ };
580
+ return (() => {
581
+ var a = Ie(), t = a.firstChild, u = t.firstChild, f = t.nextSibling, l = f.firstChild, g = l.nextSibling, h = f.nextSibling;
582
+ return n(u, () => {
583
+ var m;
584
+ return (m = d()) == null ? void 0 : m.label;
585
+ }), n(t, c($, {
586
+ get when() {
587
+ return e.showValue ?? !0;
588
+ },
589
+ get children() {
590
+ var m = Ee(), x = m.firstChild;
591
+ return n(m, () => e.value, x), n(m, o, null), m;
592
+ }
593
+ }), null), n(h, c(S, {
594
+ get each() {
595
+ return [r()[0], r()[r().length - 1]];
596
+ },
597
+ children: (m) => (() => {
598
+ var x = Ne();
599
+ return n(x, () => m == null ? void 0 : m.label), x;
600
+ })()
601
+ })), b((m) => {
602
+ var F;
603
+ var x = _("flex flex-col gap-2", e.class), y = i(), P = o(), T = e.value, E = ((F = d()) == null ? void 0 : F.label) ?? "Condition", I = `${s()}%`, N = `${s()}%`;
604
+ return x !== m.e && C(a, m.e = x), y !== m.t && w(f, "aria-valuemin", m.t = y), P !== m.a && w(f, "aria-valuemax", m.a = P), T !== m.o && w(f, "aria-valuenow", m.o = T), E !== m.i && w(f, "aria-label", m.i = E), I !== m.n && j(l, "width", m.n = I), N !== m.s && j(g, "left", m.s = N), m;
605
+ }, {
606
+ e: void 0,
607
+ t: void 0,
608
+ a: void 0,
609
+ o: void 0,
610
+ i: void 0,
611
+ n: void 0,
612
+ s: void 0
613
+ }), a;
302
614
  })();
303
615
  }
304
- function fe(e = []) {
305
- const [n, r] = N(e), t = (i, m = 1) => {
306
- r((v) => v.find((w) => w.product.id === i.id) ? v.map(
307
- (w) => w.product.id === i.id ? { ...w, qty: w.qty + m } : w
308
- ) : [...v, { product: i, qty: m }]);
309
- }, a = (i) => {
310
- r((m) => m.filter((v) => v.product.id !== i));
311
- }, o = (i, m) => {
312
- if (m <= 0) {
313
- a(i);
616
+ function Ve(e = []) {
617
+ const [i, o] = B(e), r = (l, g = 1) => {
618
+ o((h) => h.find((x) => x.product.id === l.id) ? h.map(
619
+ (x) => x.product.id === l.id ? { ...x, qty: x.qty + g } : x
620
+ ) : [...h, { product: l, qty: g }]);
621
+ }, s = (l) => {
622
+ o((g) => g.filter((h) => h.product.id !== l));
623
+ }, d = (l, g) => {
624
+ if (g <= 0) {
625
+ s(l);
314
626
  return;
315
627
  }
316
- r((v) => v.map((_) => _.product.id === i ? { ..._, qty: m } : _));
317
- }, u = () => {
318
- r([]);
319
- }, c = C(() => n().reduce((i, m) => i + m.qty, 0)), s = C(
320
- () => n().reduce((i, m) => i + m.product.price * m.qty, 0)
628
+ o((h) => h.map((m) => m.product.id === l ? { ...m, qty: g } : m));
629
+ }, a = () => {
630
+ o([]);
631
+ }, t = R(() => i().reduce((l, g) => l + g.qty, 0)), u = R(
632
+ () => i().reduce((l, g) => l + g.product.price * g.qty, 0)
321
633
  );
322
- return { items: n, add: t, remove: a, setQty: o, clear: u, count: c, subtotal: s, has: (i) => n().some((m) => m.product.id === i) };
634
+ return { items: i, add: r, remove: s, setQty: d, clear: a, count: t, subtotal: u, has: (l) => i().some((g) => g.product.id === l) };
323
635
  }
324
636
  export {
325
- se as CartLine,
326
- me as CartSummary,
327
- ge as FilterGroup,
328
- T as PriceTag,
329
- de as ProductCard,
330
- oe as ProductGrid,
331
- z as QuantityStepper,
332
- fe as createCart
637
+ Oe as CartLine,
638
+ Ge as CartSummary,
639
+ Qe as ConditionScale,
640
+ ze as FacetSidebar,
641
+ q as FilterGroup,
642
+ Ke as PriceBlock,
643
+ L as PriceTag,
644
+ De as ProductCard,
645
+ Le as ProductGrid,
646
+ ee as QuantityStepper,
647
+ Ve as createCart
333
648
  };