@blocklet/list 0.13.39 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.es.js +615 -572
  2. package/package.json +3 -3
package/lib/index.es.js CHANGED
@@ -1,56 +1,56 @@
1
- import { jsx as t, jsxs as p, Fragment as F } from "react/jsx-runtime";
2
- import { styled as D, useTheme as be } from "@arcblock/ux/lib/Theme";
3
- import { Global as xe, css as we } from "@emotion/react";
4
- import { ErrorFallback as K } from "@arcblock/ux/lib/ErrorBoundary";
5
- import { Button as Z, useTheme as Ge, useMediaQuery as N, Drawer as Qe, Box as S, Stack as P, FormControlLabel as ke, Checkbox as ve, Typography as T, CircularProgress as ee, Link as Xe, Grid as pe, MenuList as Ye, SvgIcon as Je, Popper as Ke, Grow as Ze, Paper as et, ClickAwayListener as tt, MenuItem as rt, OutlinedInput as ot, InputAdornment as me } from "@mui/material";
6
- import { ErrorBoundary as nt } from "react-error-boundary";
7
- import lt from "@iconify-icons/tabler/compass";
8
- import { Icon as Ce } from "@iconify/react";
9
- import Se from "@mui/icons-material/Close";
10
- import { createContext as Be, useState as q, useMemo as E, useContext as Re, useCallback as J, useEffect as j, memo as at, forwardRef as it, useRef as U, createElement as st, Fragment as ct } from "react";
11
- import Pe from "axios";
12
- import dt from "lodash/orderBy";
1
+ import { jsx as t, jsxs as m, Fragment as F } from "react/jsx-runtime";
2
+ import { styled as D, useTheme as xe } from "@arcblock/ux/lib/Theme";
3
+ import { Global as we, css as ke } from "@emotion/react";
4
+ import { ErrorFallback as Z } from "@arcblock/ux/lib/ErrorBoundary";
5
+ import { Button as ee, useTheme as Xe, useMediaQuery as N, Drawer as Ye, Box as S, CircularProgress as te, MenuList as Je, SvgIcon as Ke, Popper as Ze, Grow as et, Paper as tt, ClickAwayListener as rt, MenuItem as ot, Stack as I, FormControlLabel as ve, Checkbox as Ce, Typography as L, Link as nt, Grid as me, OutlinedInput as lt, InputAdornment as he } from "@mui/material";
6
+ import { ErrorBoundary as at } from "react-error-boundary";
7
+ import it from "@iconify-icons/tabler/compass";
8
+ import { Icon as Se } from "@iconify/react";
9
+ import Be from "@mui/icons-material/Close";
10
+ import { createContext as Re, useState as q, useMemo as E, useContext as Pe, useCallback as K, useEffect as j, forwardRef as st, useRef as U, memo as ct, createElement as dt, Fragment as ut } from "react";
11
+ import Te from "axios";
12
+ import pt from "lodash/orderBy";
13
13
  import i from "prop-types";
14
- import { useInfiniteScroll as ut, useRequest as te, useReactive as pt, useDebounceFn as mt } from "ahooks";
15
- import ht from "lodash/omitBy";
16
- import ft from "json-stable-stringify";
14
+ import { useInfiniteScroll as mt, useRequest as re, useReactive as ht, useDebounceFn as ft } from "ahooks";
15
+ import gt from "lodash/omitBy";
16
+ import yt from "json-stable-stringify";
17
17
  import "lodash/cloneDeep";
18
- import gt from "color";
19
- import he from "flat";
20
- import Te from "@mui/material/Box";
21
- import yt from "@arcblock/ux/lib/Avatar";
22
- import bt from "@iconify-icons/tabler/cloud-download";
23
- import xt from "@mui/icons-material/ChevronLeft";
24
- import wt from "@mui/icons-material/ChevronRight";
25
- import kt from "react-image-gallery";
18
+ import bt from "color";
19
+ import fe from "flat";
20
+ import xt from "@mui/icons-material/KeyboardArrowDown";
21
+ import wt from "lodash/isEmpty";
22
+ import Ie from "@mui/material/Box";
23
+ import kt from "@arcblock/ux/lib/Avatar";
24
+ import vt from "@iconify-icons/tabler/cloud-download";
25
+ import Ct from "@mui/icons-material/ChevronLeft";
26
+ import St from "@mui/icons-material/ChevronRight";
27
+ import Bt from "react-image-gallery";
26
28
  import "react-image-gallery/styles/css/image-gallery.css";
27
- import vt from "@mui/icons-material/KeyboardArrowDown";
28
- import Ct from "lodash/isEmpty";
29
- import St from "@arcblock/ux/lib/Empty";
30
- import Bt from "react-infinite-scroll-hook";
31
- import Ie from "@mui/material/Typography";
32
- import Rt from "@mui/icons-material/Menu";
33
- import { createRoot as Pt } from "react-dom/client";
34
- import { autocomplete as Tt } from "@algolia/autocomplete-js";
35
- import { useHotkeys as It } from "react-hotkeys-hook";
36
- import { joinURL as Lt } from "ufo";
37
- import zt from "@mui/icons-material/Search";
29
+ import Rt from "@arcblock/ux/lib/Empty";
30
+ import Pt from "react-infinite-scroll-hook";
31
+ import Le from "@mui/material/Typography";
32
+ import Tt from "@mui/icons-material/Menu";
33
+ import { createRoot as It } from "react-dom/client";
34
+ import { autocomplete as Lt } from "@algolia/autocomplete-js";
35
+ import { useHotkeys as $t } from "react-hotkeys-hook";
36
+ import { joinURL as zt } from "ufo";
37
+ import _t from "@mui/icons-material/Search";
38
38
  import "@algolia/autocomplete-theme-classic/dist/theme.css";
39
- const Le = Be({
39
+ const $e = Re({
40
40
  open: !1,
41
41
  toggleOpen: (e) => {
42
42
  }
43
43
  });
44
- function $t({ children: e }) {
45
- const [r, o] = q(!1), n = (l) => {
46
- o(l ?? !l);
47
- }, a = E(() => ({ open: r, toggleOpen: n }), [r]);
48
- return /* @__PURE__ */ t(Le.Provider, { value: a, children: e });
44
+ function At({ children: e }) {
45
+ const [o, r] = q(!1), n = (l) => {
46
+ r(l ?? !l);
47
+ }, a = E(() => ({ open: o, toggleOpen: n }), [o]);
48
+ return /* @__PURE__ */ t($e.Provider, { value: a, children: e });
49
49
  }
50
- function re() {
51
- return Re(Le);
50
+ function oe() {
51
+ return Pe($e);
52
52
  }
53
- const R = {
53
+ const T = {
54
54
  nameAsc: "title",
55
55
  nameDesc: "title",
56
56
  popularity: "stats.downloads",
@@ -64,23 +64,29 @@ const R = {
64
64
  explorePath: "/api/blocklets/explore",
65
65
  exploreDidsPath: "/api/blocklets/dids",
66
66
  cacheSize: 100
67
- }, _t = (e, r, o, n) => ut(
67
+ }, Ft = (e, o, r, n) => mt(
68
68
  async (a) => {
69
- a || (o.currentPage = o.defaultCurrentPage);
70
- const { currentPage: l, pageSize: m } = o, d = { ...r, sortBy: R[r.sortBy], page: l, pageSize: m };
69
+ a || (r.currentPage = r.defaultCurrentPage);
70
+ const { currentPage: l, pageSize: d } = r, u = {
71
+ ...o,
72
+ category: o.category === "All" ? "" : o.category,
73
+ sortBy: T[o.sortBy],
74
+ page: l,
75
+ pageSize: d
76
+ };
71
77
  n(null);
72
- const { data: s = {} } = await e.get(R.blockletsPath, { params: d });
73
- return o.currentPage++, { page: l, pageSize: m, list: (s == null ? void 0 : s.dataList) || [], total: (s == null ? void 0 : s.total) || 0 };
78
+ const { data: s = {} } = await e.get(T.blockletsPath, { params: u });
79
+ return r.currentPage++, { page: l, pageSize: d, list: (s == null ? void 0 : s.dataList) || [], total: (s == null ? void 0 : s.total) || 0 };
74
80
  },
75
81
  {
76
82
  isNoMore: (a) => a ? a.page * a.pageSize >= a.total : !1,
77
- reloadDeps: [e, ft(r)],
83
+ reloadDeps: [e, yt(o)],
78
84
  onError: n
79
85
  }
80
- ), Ft = (e) => te(
86
+ ), Dt = (e) => re(
81
87
  async () => {
82
- const { data: r } = await e.get(R.categoriesPath);
83
- return Array.isArray(r) ? r : [];
88
+ const { data: o } = await e.get(T.categoriesPath);
89
+ return Array.isArray(o) ? o : [];
84
90
  },
85
91
  { manual: !0 }
86
92
  ), ze = {
@@ -107,7 +113,7 @@ const R = {
107
113
  showResourcesSwitch: i.bool,
108
114
  showCategory: i.bool,
109
115
  tagFilters: i.array
110
- }, $e = {
116
+ }, _e = {
111
117
  locale: "zh",
112
118
  filters: {},
113
119
  serverVersion: "",
@@ -123,7 +129,7 @@ const R = {
123
129
  showResourcesSwitch: !1,
124
130
  showCategory: !0,
125
131
  tagFilters: []
126
- }, At = (e) => [
132
+ }, Ae = (e) => [
127
133
  {
128
134
  name: e("sort.popularity"),
129
135
  value: "popularity"
@@ -136,22 +142,22 @@ const R = {
136
142
  // name: t('sort.rating'),
137
143
  // value: 'rating',
138
144
  // },
139
- ], Dt = (e) => [
145
+ ], Et = (e) => [
140
146
  { name: e("blocklet.free"), value: "free" },
141
147
  { name: e("blocklet.payment"), value: "payment" }
142
- ], Et = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), Mt = (e, r) => (
148
+ ], Mt = (e = [], o = "en") => e.map((r) => ({ name: r.locales[o] || r.locales.en, value: r._id })), Nt = (e, o) => (
143
149
  // eslint-disable-next-line no-prototype-builtins
144
- e == null ? void 0 : e.replace(/{(\w*)}/g, (o, n) => r.hasOwnProperty(n) ? r[n] : "")
145
- ), Nt = () => window.innerWidth <= 600, Ot = (e) => gt(e).rgb().object();
146
- function qt(e, r) {
147
- let o;
150
+ e == null ? void 0 : e.replace(/{(\w*)}/g, (r, n) => o.hasOwnProperty(n) ? o[n] : "")
151
+ ), Ot = () => window.innerWidth <= 600, qt = (e) => bt(e).rgb().object();
152
+ function jt(e, o) {
153
+ let r;
148
154
  return function(...a) {
149
- return o && clearTimeout(o), new Promise((l) => {
150
- o = setTimeout(() => l(e(...a)), r);
155
+ return r && clearTimeout(r), new Promise((l) => {
156
+ r = setTimeout(() => l(e(...a)), o);
151
157
  });
152
158
  };
153
159
  }
154
- const jt = qt((e) => Promise.resolve(e), 300), Vt = {
160
+ const Vt = jt((e) => Promise.resolve(e), 300), Wt = {
155
161
  common: {
156
162
  title: "Blocklet Store",
157
163
  searchStore: "Search Blocklet",
@@ -199,7 +205,7 @@ const jt = qt((e) => Promise.resolve(e), 300), Vt = {
199
205
  autocomplete: {
200
206
  expandResult: 'View all search results for "{name}"'
201
207
  }
202
- }, Wt = {
208
+ }, Ut = {
203
209
  common: {
204
210
  title: "Blocklet 商店",
205
211
  searchStore: "搜索 Blocklet",
@@ -247,16 +253,16 @@ const jt = qt((e) => Promise.resolve(e), 300), Vt = {
247
253
  autocomplete: {
248
254
  expandResult: "查看 “{name}” 的所有搜索结果"
249
255
  }
250
- }, Y = {
251
- en: he(Vt),
252
- zh: he(Wt)
253
- }, _e = (e, r) => {
254
- const o = {};
255
- return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
256
- }, Ut = (e) => (r, o) => {
257
- const n = Y[e] ? Y[e][r] : Y.en[r];
258
- return Mt(n, o) || r;
259
- }, Fe = {
256
+ }, J = {
257
+ en: fe(Wt),
258
+ zh: fe(Ut)
259
+ }, Fe = (e, o) => {
260
+ const r = {};
261
+ return e && (r["x-blocklet-server-version"] = e), o && (r["x-blocklet-store-version"] = o), r;
262
+ }, Ht = (e) => (o, r) => {
263
+ const n = J[e] ? J[e][o] : J.en[o];
264
+ return Nt(n, r) || o;
265
+ }, De = {
260
266
  errors: {
261
267
  fetchBlockletsError: null,
262
268
  fetchCategoriesError: null
@@ -275,6 +281,7 @@ const jt = qt((e) => Promise.resolve(e), 300), Vt = {
275
281
  filters: {},
276
282
  selectedCategory: void 0,
277
283
  categoryList: [],
284
+ total: 0,
278
285
  blockletRender: () => null,
279
286
  locale: "en",
280
287
  categoryOptions: [],
@@ -309,138 +316,143 @@ const jt = qt((e) => Promise.resolve(e), 300), Vt = {
309
316
  developerName: "",
310
317
  handleSearchSelect: () => {
311
318
  }
312
- }, Ae = Be(Fe), { Provider: Ht, Consumer: Hr } = Ae;
313
- function oe({
319
+ }, Ee = Re(De), { Provider: Gt, Consumer: Qr } = Ee;
320
+ function ne({
314
321
  filters: e,
315
- children: r,
316
- endpoint: o,
322
+ children: o,
323
+ endpoint: r,
317
324
  locale: n,
318
325
  blockletRender: a,
319
326
  onFilterChange: l,
320
- onSearchSelect: m,
321
- extraFilter: d,
327
+ onSearchSelect: d,
328
+ extraFilter: u,
322
329
  wrapChildren: s,
323
- baseSearch: k,
330
+ baseSearch: v,
324
331
  serverVersion: f,
325
- storeVersion: g,
332
+ storeVersion: y,
326
333
  fetchCategoryDelay: c,
327
- showResourcesSwitch: x,
328
- showCategory: w,
329
- tagFilters: v
334
+ showResourcesSwitch: w,
335
+ showCategory: k,
336
+ tagFilters: x
330
337
  }) {
331
- const z = _e(f, g), y = E(() => Pe.create({ baseURL: o, headers: z }), [o]), u = { sortBy: "popularity", sortDirection: "desc", ...e }, C = u.category, $ = pt({
332
- currentPage: R.currentPage,
333
- pageSize: Nt() ? R.mobilePageSize : R.pageSize,
334
- defaultCurrentPage: R.defaultCurrentPage
335
- }), [_, L] = q(null), I = _t(y, u, $, L), {
336
- data: Q = [],
337
- error: je,
338
- loading: Ve,
338
+ var ue;
339
+ const z = Fe(f, y), b = E(() => Te.create({ baseURL: r, headers: z }), [r]), h = { sortBy: "popularity", sortDirection: "desc", ...e }, C = h.category, _ = ht({
340
+ currentPage: T.currentPage,
341
+ pageSize: Ot() ? T.mobilePageSize : T.pageSize,
342
+ defaultCurrentPage: T.defaultCurrentPage
343
+ }), [A, $] = q(null), R = Ft(b, h, _, $), {
344
+ data: X = [],
345
+ error: We,
346
+ loading: Ue,
339
347
  run: se
340
- } = Ft(y), X = E(() => dt(Q, [(h) => h.name], ["asc"]), [Q]), ce = E(() => {
341
- var h;
342
- return d(((h = I.data) == null ? void 0 : h.list) || []);
343
- }, [I.data, d]), de = J(Ut(n), [n]), We = E(() => Et(X, n), [X, n]), Ue = Dt(de), He = {
344
- errors: { fetchBlockletsError: _, fetchCategoriesError: je },
348
+ } = Dt(b), Y = E(() => {
349
+ const p = pt(X, [(P) => P.name], ["asc"]), g = p.findIndex((P) => P.name === "All" || P.locales.en === "All");
350
+ return g > -1 ? [{ ...p[g], _id: "All" }, ...p.slice(0, g), ...p.slice(g + 1)] : p;
351
+ }, [X]), ce = E(() => {
352
+ var p;
353
+ return u(((p = R.data) == null ? void 0 : p.list) || []);
354
+ }, [R.data, u]), de = K(Ht(n), [n]), He = E(() => Mt(Y, n), [Y, n]), Ge = Et(de), Qe = {
355
+ errors: { fetchBlockletsError: A, fetchCategoriesError: We },
345
356
  loadings: {
346
- fetchBlockletsLoading: I.loading,
347
- fetchCategoriesLoading: Ve,
348
- loadingMore: I.loadingMore
357
+ fetchBlockletsLoading: R.loading,
358
+ fetchCategoriesLoading: Ue,
359
+ loadingMore: R.loadingMore
349
360
  },
350
- endpoint: o,
361
+ endpoint: r,
351
362
  blockletList: ce,
363
+ total: ((ue = R.data) == null ? void 0 : ue.total) || 0,
352
364
  wrapChildren: s,
353
365
  t: de,
354
- storeVersion: g,
366
+ storeVersion: y,
355
367
  serverVersion: f,
356
- filters: u,
368
+ filters: h,
357
369
  selectedCategory: C,
358
- categoryList: X,
370
+ categoryList: Y,
359
371
  blockletRender: a,
360
372
  locale: n,
361
- categoryOptions: We,
362
- priceOptions: Ue,
363
- storeApi: y,
364
- baseSearch: k,
365
- showResourcesSwitch: x,
366
- showCategory: w,
367
- tagFilters: v,
368
- hasNextPage: !I.noMore,
373
+ categoryOptions: He,
374
+ priceOptions: Ge,
375
+ storeApi: b,
376
+ baseSearch: v,
377
+ showResourcesSwitch: w,
378
+ showCategory: k,
379
+ tagFilters: x,
380
+ hasNextPage: !R.noMore,
369
381
  onFilterChange: l,
370
- cleanFilter: (h) => {
371
- const b = h ? ht(u, (A, M) => h == null ? void 0 : h.includes(M)) : {};
372
- l(b);
382
+ cleanFilter: (p) => {
383
+ const g = p ? gt(h, (P, M) => p == null ? void 0 : p.includes(M)) : {};
384
+ l(g);
373
385
  },
374
- handleSort: (h) => {
375
- const b = { ...u, sortBy: h, sortDirection: h === "nameAsc" ? "asc" : "desc" };
376
- l(b);
386
+ handleSort: (p) => {
387
+ const g = { ...h, sortBy: p, sortDirection: p === "nameAsc" ? "asc" : "desc" };
388
+ l(g);
377
389
  },
378
- handleKeyword: (h) => {
379
- const b = { ...u, keyword: h || void 0 };
380
- l(b);
390
+ handleKeyword: (p) => {
391
+ const g = { ...h, category: void 0, keyword: p || void 0 };
392
+ l(g);
381
393
  },
382
- handlePrice: (h) => {
383
- const b = { ...u, price: h === u.price ? void 0 : h };
384
- l(b);
394
+ handlePrice: (p) => {
395
+ const g = { ...h, price: p === h.price ? void 0 : p };
396
+ l(g);
385
397
  },
386
- handleCategory: (h) => {
387
- const b = h === "all" || h === u.category ? "" : h, A = { ...u, category: b };
388
- l(A);
398
+ handleCategory: (p) => {
399
+ const g = p === "all" || p === h.category ? "" : p, P = { ...h, category: g };
400
+ l(P);
389
401
  },
390
- handleDeveloper: (h) => {
391
- const b = { ...u, owner: h || void 0 };
392
- l(b);
402
+ handleDeveloper: (p) => {
403
+ const g = { ...h, owner: p || void 0 };
404
+ l(g);
393
405
  },
394
- handlePage: (h) => {
395
- const b = { ...u, currentPage: h };
396
- l(b);
406
+ handlePage: (p) => {
407
+ const g = { ...h, currentPage: p };
408
+ l(g);
397
409
  },
398
410
  handleSwitchShowResources: () => {
399
- const h = { ...u };
400
- l(h);
411
+ const p = { ...h };
412
+ l(p);
401
413
  },
402
- loadMore: I.loadMore,
403
- getCategoryLocale: (h) => {
404
- if (!h)
414
+ loadMore: R.loadMore,
415
+ getCategoryLocale: (p) => {
416
+ if (!p)
405
417
  return null;
406
- const b = Q.find((A) => A._id === h);
407
- return b ? b.locales[n] || b.locales.en : null;
418
+ const g = X.find((P) => P._id === p);
419
+ return g ? g.locales[n] || g.locales.en : null;
408
420
  },
409
421
  get developerName() {
410
- var b, A;
411
- return ((A = (b = ce.find((M) => {
412
- var ue;
413
- return ((ue = M == null ? void 0 : M.owner) == null ? void 0 : ue.did) === u.owner;
414
- })) == null ? void 0 : b.owner) == null ? void 0 : A.name) || "";
422
+ var g, P;
423
+ return ((P = (g = ce.find((M) => {
424
+ var pe;
425
+ return ((pe = M == null ? void 0 : M.owner) == null ? void 0 : pe.did) === h.owner;
426
+ })) == null ? void 0 : g.owner) == null ? void 0 : P.name) || "";
415
427
  },
416
- handleSearchSelect: m
428
+ handleSearchSelect: d
417
429
  };
418
430
  return j(() => {
419
431
  setTimeout(se, c || 0);
420
- }, [o, se, c]), /* @__PURE__ */ t(Ht, { value: He, children: r });
432
+ }, [r, se, c]), /* @__PURE__ */ t(Gt, { value: Qe, children: o });
421
433
  }
422
- oe.propTypes = {
434
+ ne.propTypes = {
423
435
  ...ze,
424
436
  children: i.any.isRequired
425
437
  };
426
- oe.defaultProps = $e;
438
+ ne.defaultProps = _e;
427
439
  function B() {
428
- const e = Re(Ae);
429
- return e || Fe;
440
+ const e = Pe(Ee);
441
+ return e || De;
430
442
  }
431
- function De({
443
+ function Me({
432
444
  children: e,
433
- onClick: r,
434
- size: o = 32
445
+ onClick: o,
446
+ size: r = 32
435
447
  }) {
436
448
  return /* @__PURE__ */ t(
437
- Z,
449
+ ee,
438
450
  {
439
- onClick: r,
451
+ onClick: o,
440
452
  variant: "outlined",
441
453
  sx: {
442
- minWidth: o,
443
- height: o,
454
+ minWidth: r,
455
+ height: r,
444
456
  p: 0,
445
457
  borderColor: "divider",
446
458
  "&:hover": {
@@ -453,59 +465,225 @@ function De({
453
465
  }
454
466
  );
455
467
  }
456
- function V(e, r) {
457
- return e === void 0 ? r : e;
468
+ function V(e, o) {
469
+ return e === void 0 ? o : e;
458
470
  }
459
471
  function G({
460
472
  xs: e,
461
- sm: r,
462
- md: o,
473
+ sm: o,
474
+ md: r,
463
475
  lg: n,
464
476
  xl: a,
465
477
  exact: l
466
478
  }) {
467
- const m = Ge(), d = N(m.breakpoints.down("sm")), s = N(m.breakpoints.between("sm", "md")), k = N(m.breakpoints.between("md", "lg")), f = N(m.breakpoints.between("lg", "xl"));
479
+ const d = Xe(), u = N(d.breakpoints.down("sm")), s = N(d.breakpoints.between("sm", "md")), v = N(d.breakpoints.between("md", "lg")), f = N(d.breakpoints.between("lg", "xl"));
468
480
  if (l)
469
- return d ? e || null : s ? r || null : k ? o || null : f ? n || null : a || null;
470
- let g = e;
471
- return d || (g = V(r, g), s) || (g = V(o, g), k) || (g = V(n, g), f) ? g : V(a, g);
481
+ return u ? e || null : s ? o || null : v ? r || null : f ? n || null : a || null;
482
+ let y = e;
483
+ return u || (y = V(o, y), s) || (y = V(r, y), v) || (y = V(n, y), f) ? y : V(a, y);
472
484
  }
473
- function Gt({ children: e }) {
474
- const { open: r, toggleOpen: o } = re();
485
+ function Qt({ children: e }) {
486
+ const { open: o, toggleOpen: r } = oe();
475
487
  return /* @__PURE__ */ t(
476
488
  G,
477
489
  {
478
- xs: /* @__PURE__ */ t(Qe, { open: r, onClose: () => o(!1), children: e }),
490
+ xs: /* @__PURE__ */ t(Ye, { open: o, onClose: () => r(!1), children: e }),
479
491
  md: /* @__PURE__ */ t(S, { children: e })
480
492
  }
481
493
  );
482
494
  }
483
- function Ee() {
484
- const { filters: e, handlePrice: r, t: o } = B();
485
- return /* @__PURE__ */ t(P, { direction: "row", alignItems: "center", width: { xs: "100%", md: "auto" }, justifyContent: "space-between", children: /* @__PURE__ */ t(
486
- ke,
487
- {
488
- control: /* @__PURE__ */ t(
489
- ve,
495
+ const Xt = D(ee)`
496
+ border-radius: 4px;
497
+ `, le = st(({ children: e, rounded: o, loading: r, disabled: n, ...a }, l) => /* @__PURE__ */ t(
498
+ Xt,
499
+ {
500
+ ref: l,
501
+ disableElevation: !0,
502
+ disabled: n || r,
503
+ ...a,
504
+ startIcon: r && /* @__PURE__ */ t(te, { size: "1em" }),
505
+ children: e
506
+ }
507
+ ));
508
+ le.propTypes = {
509
+ children: i.any,
510
+ rounded: i.bool,
511
+ loading: i.bool,
512
+ disabled: i.bool
513
+ };
514
+ le.defaultProps = {
515
+ children: null,
516
+ rounded: !1,
517
+ loading: !1,
518
+ disabled: !1
519
+ };
520
+ function Q({ title: e, value: o, icon: r, prepend: n, options: a, onChange: l, itemRender: d, ...u }) {
521
+ const s = U(null), v = xe(), [f, y] = q(!1), [c, w] = q(o !== null ? o : ""), k = N(v.breakpoints.down("sm"));
522
+ j(() => {
523
+ w(o !== null ? o : "");
524
+ }, [o]);
525
+ const x = K(() => {
526
+ y(!1);
527
+ }, []), z = K(() => {
528
+ y(!0);
529
+ }, []);
530
+ function b(C) {
531
+ w(C.value), l(C.value), k && x();
532
+ }
533
+ function h(C) {
534
+ return C === c;
535
+ }
536
+ return /* @__PURE__ */ m(F, { children: [
537
+ /* @__PURE__ */ m(
538
+ Yt,
539
+ {
540
+ ref: s,
541
+ onClick: z,
542
+ variant: "outlined",
543
+ size: "small",
544
+ className: ["my-select__selector", wt(c) ? "" : "my-select__selector--active"].join(" "),
545
+ sx: { minWidth: "auto" },
546
+ ...u,
547
+ children: [
548
+ /* @__PURE__ */ t("div", { className: "my-select__icon", children: r }),
549
+ e,
550
+ /* @__PURE__ */ t(Ke, { className: "my-select__arrowdown", component: xt, fontSize: "small" })
551
+ ]
552
+ }
553
+ ),
554
+ /* @__PURE__ */ t(Ze, { open: f, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: C, placement: _ }) => /* @__PURE__ */ t(et, { ...C, sx: { transformOrigin: _ === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(tt, { children: /* @__PURE__ */ t(rt, { onClickAway: x, children: /* @__PURE__ */ m(Jt, { autoFocusItem: f, onMouseEnter: z, onMouseLeave: x, children: [
555
+ n,
556
+ a.map((A) => d ? d(A) : /* @__PURE__ */ t(
557
+ ot,
490
558
  {
491
- checked: e.price === "free",
492
- size: "small",
493
- sx: { "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.lighter" } },
494
- onChange: (n) => r(n.target.checked ? "free" : "")
495
- }
496
- ),
497
- label: o("blocklet.free")
559
+ onClick: () => b(A),
560
+ className: [
561
+ "my-select__option",
562
+ h(A.value) ? "my-select__option--active" : ""
563
+ ].join(" "),
564
+ children: A.name
565
+ },
566
+ A.value
567
+ ))
568
+ ] }) }) }) }) })
569
+ ] });
570
+ }
571
+ Q.propTypes = {
572
+ options: i.array.isRequired,
573
+ value: i.oneOfType([i.string, i.number, i.array]),
574
+ onChange: i.func,
575
+ itemRender: i.func,
576
+ title: i.string.isRequired,
577
+ icon: i.any,
578
+ prepend: i.any
579
+ };
580
+ Q.defaultProps = {
581
+ value: null,
582
+ icon: null,
583
+ prepend: null,
584
+ itemRender: null,
585
+ onChange: () => {
586
+ }
587
+ };
588
+ const Yt = D(le)`
589
+ border: 1px solid #f0f0f0;
590
+ padding: 6px 8px 6px 12px;
591
+ font-weight: ${(e) => e.theme.typography.fontWeightRegular};
592
+ font-size: 14px;
593
+ color: #666;
594
+ line-height: 1;
595
+ text-transform: none;
596
+ & + & {
597
+ margin-left: 10px;
598
+ }
599
+ &.my-select__selector--active {
600
+ &,
601
+ .my-select__arrowdown,
602
+ .my-select__icon svg {
603
+ color: ${(e) => e.theme.palette.primary.main};
604
+ }
605
+ }
606
+ .my-select__arrowdown {
607
+ color: #999;
608
+ font-size: 14px;
609
+ margin-left: 6px;
610
+ }
611
+ .my-select__icon {
612
+ font-size: 0;
613
+ svg {
614
+ color: #999;
615
+ font-size: 18px;
616
+ margin-right: 3px;
617
+ }
618
+ }
619
+ `, Jt = D(Je)`
620
+ .my-select__option__icon {
621
+ color: transparent;
622
+ font-size: 14px;
623
+ margin: 0 3px 0 -5px;
624
+ }
625
+ .my-select__option {
626
+ font-size: 14px;
627
+ color: #999;
628
+ }
629
+ .my-select__option--active {
630
+ &,
631
+ .my-select__option__icon {
632
+ color: ${(e) => e.theme.palette.primary.main};
633
+ }
634
+ }
635
+ `;
636
+ function Ne() {
637
+ var d;
638
+ const { filters: e, handleSort: o, handlePrice: r, t: n } = B(), a = Ae(n), l = ((d = a.find((u) => u.value === e.sortBy)) == null ? void 0 : d.name) || n("sort.sort");
639
+ return /* @__PURE__ */ m(
640
+ I,
641
+ {
642
+ direction: { xs: "row", md: "column" },
643
+ alignItems: { xs: "center", md: "flex-start" },
644
+ gap: { xs: 1, md: 2 },
645
+ width: { xs: "100%", md: "auto" },
646
+ justifyContent: "space-between",
647
+ children: [
648
+ /* @__PURE__ */ t(
649
+ ve,
650
+ {
651
+ control: /* @__PURE__ */ t(
652
+ Ce,
653
+ {
654
+ checked: e.price === "free",
655
+ size: "small",
656
+ sx: { "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.lighter" } },
657
+ onChange: (u) => r(u.target.checked ? "free" : "")
658
+ }
659
+ ),
660
+ label: n("blocklet.free")
661
+ }
662
+ ),
663
+ /* @__PURE__ */ t(
664
+ Q,
665
+ {
666
+ value: e.sortBy,
667
+ options: a,
668
+ title: l,
669
+ onChange: o,
670
+ icon: null,
671
+ prepend: null,
672
+ itemRender: null
673
+ }
674
+ )
675
+ ]
498
676
  }
499
- ) });
677
+ );
500
678
  }
501
- function Qt() {
502
- const { selectedCategory: e, handleCategory: r, t: o, categoryOptions: n, filters: a, cleanFilter: l, loadings: m } = B(), { toggleOpen: d } = re();
503
- return /* @__PURE__ */ p(Gt, { children: [
679
+ function Kt() {
680
+ const { selectedCategory: e, handleCategory: o, t: r, categoryOptions: n, filters: a, cleanFilter: l, loadings: d } = B(), { toggleOpen: u } = oe();
681
+ return /* @__PURE__ */ m(Qt, { children: [
504
682
  /* @__PURE__ */ t(
505
683
  G,
506
684
  {
507
- xs: /* @__PURE__ */ p(
508
- P,
685
+ xs: /* @__PURE__ */ m(
686
+ I,
509
687
  {
510
688
  direction: "row",
511
689
  justifyContent: "space-between",
@@ -516,8 +694,8 @@ function Qt() {
516
694
  borderBottom: 1,
517
695
  borderColor: "divider",
518
696
  children: [
519
- /* @__PURE__ */ t(De, { onClick: () => d(!1), children: /* @__PURE__ */ t(Se, {}) }),
520
- /* @__PURE__ */ t(T, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: "Categories" })
697
+ /* @__PURE__ */ t(Me, { onClick: () => u(!1), children: /* @__PURE__ */ t(Be, {}) }),
698
+ /* @__PURE__ */ t(L, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: "Categories" })
521
699
  ]
522
700
  }
523
701
  ),
@@ -525,32 +703,32 @@ function Qt() {
525
703
  }
526
704
  ),
527
705
  /* @__PURE__ */ t(
528
- P,
706
+ I,
529
707
  {
530
- visibility: m.fetchCategoriesLoading ? "hidden" : "visible",
708
+ visibility: d.fetchCategoriesLoading ? "hidden" : "visible",
531
709
  width: { xs: 268, md: 200 },
532
710
  boxSizing: "content-box",
533
711
  p: { xs: 2, md: 0 },
534
712
  pr: { md: 6 },
535
- children: a.keyword ? /* @__PURE__ */ t(Ee, {}) : /* @__PURE__ */ p(F, { children: [
536
- /* @__PURE__ */ p(S, { display: "flex", alignItems: "center", gap: 1, children: [
537
- /* @__PURE__ */ t(Ce, { icon: lt }),
713
+ children: a.keyword ? /* @__PURE__ */ t(Ne, {}) : /* @__PURE__ */ m(F, { children: [
714
+ /* @__PURE__ */ m(S, { display: "flex", alignItems: "center", gap: 1, children: [
715
+ /* @__PURE__ */ t(Se, { icon: it }),
538
716
  /* @__PURE__ */ t(
539
- T,
717
+ L,
540
718
  {
541
719
  variant: "body1",
542
720
  color: e ? "text.lighter" : "text.primary",
543
721
  fontWeight: e ? void 0 : "fontWeightMedium",
544
722
  sx: { cursor: "pointer" },
545
723
  onClick: () => {
546
- d(!1), l();
724
+ u(!1), l();
547
725
  },
548
- children: o("explore.title")
726
+ children: r("explore.title")
549
727
  }
550
728
  )
551
729
  ] }),
552
- !!n.length && /* @__PURE__ */ t(P, { pt: 3, mt: 3, borderTop: 1, borderColor: "divider", gap: 2, children: n.map((s) => /* @__PURE__ */ t(
553
- T,
730
+ !!n.length && /* @__PURE__ */ t(I, { pt: 3, mt: 3, borderTop: 1, borderColor: "divider", gap: 2, children: n.map((s) => /* @__PURE__ */ t(
731
+ L,
554
732
  {
555
733
  variant: "body1",
556
734
  title: s.name,
@@ -559,7 +737,7 @@ function Qt() {
559
737
  color: e === s.value ? "text.primary" : "text.lighter",
560
738
  textTransform: "capitalize",
561
739
  onClick: () => {
562
- e === s.value ? l() : r(s.value), d(!1);
740
+ e === s.value ? l() : o(s.value), u(!1);
563
741
  },
564
742
  children: s.name
565
743
  },
@@ -570,50 +748,50 @@ function Qt() {
570
748
  )
571
749
  ] });
572
750
  }
573
- function Me() {
574
- const { endpoint: e, serverVersion: r, storeVersion: o } = B(), n = _e(r, o), a = E(() => Pe.create({
751
+ function Oe() {
752
+ const { endpoint: e, serverVersion: o, storeVersion: r } = B(), n = Fe(o, r), a = E(() => Te.create({
575
753
  baseURL: e,
576
754
  headers: n
577
755
  }), [e]);
578
756
  return {
579
757
  get: async (l) => {
580
- const { data: m } = await a.get(l);
581
- return m;
582
- },
583
- post: async (l, m) => {
584
- const { data: d } = await a.post(l, m);
758
+ const { data: d } = await a.get(l);
585
759
  return d;
760
+ },
761
+ post: async (l, d) => {
762
+ const { data: u } = await a.post(l, d);
763
+ return u;
586
764
  }
587
765
  };
588
766
  }
589
- const Ne = at(function(r) {
590
- return /* @__PURE__ */ t(Te, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(ee, {}) });
767
+ const qe = ct(function(o) {
768
+ return /* @__PURE__ */ t(Ie, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...o, children: /* @__PURE__ */ t(te, {}) });
591
769
  });
592
- function fe({
770
+ function ge({
593
771
  icon: e,
594
- children: r,
595
- maxWidth: o = 100,
772
+ children: o,
773
+ maxWidth: r = 100,
596
774
  title: n
597
775
  }) {
598
- return (r === 0 || r) && /* @__PURE__ */ p(P, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
776
+ return (o === 0 || o) && /* @__PURE__ */ m(I, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: r, overflow: "hidden" }, children: [
599
777
  e,
600
778
  /* @__PURE__ */ t(
601
- T,
779
+ L,
602
780
  {
603
781
  flex: 1,
604
782
  variant: "body2",
605
783
  sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
606
- title: n || (typeof r == "string" ? r : void 0),
607
- children: r
784
+ title: n || (typeof o == "string" ? o : void 0),
785
+ children: o
608
786
  }
609
787
  )
610
788
  ] });
611
789
  }
612
- const ge = 292;
613
- function Xt() {
614
- var f, g;
615
- const { t: e } = B(), { post: r } = Me(), o = ((g = (f = window.blocklet) == null ? void 0 : f.preferences) == null ? void 0 : g.homeBanner) || [], { data: n = [] } = te(async () => {
616
- const c = await r(R.exploreDidsPath, { didList: o.map((x) => x.did) });
790
+ const ye = 292;
791
+ function Zt() {
792
+ var f, y;
793
+ const { t: e } = B(), { post: o } = Oe(), r = ((y = (f = window.blocklet) == null ? void 0 : f.preferences) == null ? void 0 : y.homeBanner) || [], { data: n = [] } = re(async () => {
794
+ const c = await o(T.exploreDidsPath, { didList: r.map((w) => w.did) });
617
795
  return Array.isArray(c) ? c : [];
618
796
  }), a = {
619
797
  position: "absolute",
@@ -623,10 +801,10 @@ function Xt() {
623
801
  cursor: "pointer",
624
802
  color: "text.lighter"
625
803
  };
626
- return o.length > 0 ? /* @__PURE__ */ p(F, { children: [
627
- /* @__PURE__ */ t(T, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
628
- /* @__PURE__ */ t(S, { height: { xs: "auto", md: ge }, position: "relative", bgcolor: "#F0F7FF", borderRadius: 3, children: /* @__PURE__ */ t(
629
- kt,
804
+ return r.length > 0 ? /* @__PURE__ */ m(F, { children: [
805
+ /* @__PURE__ */ t(L, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
806
+ /* @__PURE__ */ t(S, { height: { xs: "auto", md: ye }, position: "relative", bgcolor: "#F0F7FF", borderRadius: 3, children: /* @__PURE__ */ t(
807
+ Bt,
630
808
  {
631
809
  showNav: !0,
632
810
  autoPlay: !0,
@@ -637,16 +815,17 @@ function Xt() {
637
815
  showBullets: !1,
638
816
  showThumbnails: !1,
639
817
  showFullscreenButton: !1,
640
- renderLeftNav: (c) => /* @__PURE__ */ t(S, { onClick: c, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(xt, { sx: { ...a, left: 5 } }) }),
641
- renderRightNav: (c) => /* @__PURE__ */ t(S, { onClick: c, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(wt, { sx: { ...a, right: 5 } }) }),
642
- items: o.map((c, x) => ({
818
+ renderLeftNav: (c) => /* @__PURE__ */ t(S, { onClick: c, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(Ct, { sx: { ...a, left: 5 } }) }),
819
+ renderRightNav: (c) => /* @__PURE__ */ t(S, { onClick: c, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(St, { sx: { ...a, right: 5 } }) }),
820
+ items: r.map((c, w) => ({
643
821
  original: c.did,
644
822
  renderItem: () => {
645
- const w = n[x];
646
- return /* @__PURE__ */ p(
647
- P,
823
+ var x;
824
+ const k = n[w] || {};
825
+ return /* @__PURE__ */ m(
826
+ I,
648
827
  {
649
- height: { xs: "auto", md: ge },
828
+ height: { xs: "auto", md: ye },
650
829
  display: "flex",
651
830
  direction: { xs: "column", md: "row" },
652
831
  justifyContent: "center",
@@ -654,14 +833,14 @@ function Xt() {
654
833
  p: { xs: 2, md: 5 },
655
834
  gap: { xs: 2, md: 5 },
656
835
  children: [
657
- l(c.cover || w.screenshots[0]),
658
- /* @__PURE__ */ p(P, { flex: 1, height: "100%", gap: 3, children: [
659
- /* @__PURE__ */ p(S, { flex: 1, children: [
660
- m(c.name || w.title || c.name),
661
- d(c.desc || w.description)
836
+ l(c.cover || tr(c.did, (x = k.screenshots) == null ? void 0 : x[0])),
837
+ /* @__PURE__ */ m(I, { flex: 1, height: "100%", gap: 3, children: [
838
+ /* @__PURE__ */ m(S, { flex: 1, children: [
839
+ d(c.name || k.title || c.name),
840
+ u(c.desc || k.description)
662
841
  ] }),
663
- w && s(w, c.baseNum),
664
- k(c.link, c.did)
842
+ k.did && s(k, c.baseNum),
843
+ v(c.link, c.did)
665
844
  ] })
666
845
  ]
667
846
  }
@@ -674,12 +853,12 @@ function Xt() {
674
853
  function l(c) {
675
854
  return /* @__PURE__ */ t(S, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", children: /* @__PURE__ */ t("img", { src: c, alt: "", style: { width: "100%", height: "100%", objectFit: "cover" } }) });
676
855
  }
677
- function m(c) {
678
- return /* @__PURE__ */ t(T, { variant: "h2", width: "100%", children: c });
679
- }
680
856
  function d(c) {
857
+ return /* @__PURE__ */ t(L, { variant: "h2", width: "100%", children: c });
858
+ }
859
+ function u(c) {
681
860
  return /* @__PURE__ */ t(
682
- T,
861
+ L,
683
862
  {
684
863
  variant: "body2",
685
864
  color: "text.secondary",
@@ -699,16 +878,16 @@ function Xt() {
699
878
  }
700
879
  );
701
880
  }
702
- function s(c, x = 0) {
703
- const { did: w, owner: v, stats: z } = c;
704
- return /* @__PURE__ */ p(S, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
705
- /* @__PURE__ */ t(fe, { icon: /* @__PURE__ */ t(yt, { src: v.avatar, did: w, size: 20, variant: "circle" }), children: v.fullName }),
706
- /* @__PURE__ */ t(fe, { icon: /* @__PURE__ */ t(Ce, { icon: bt }), title: `${z.downloads + x}`, children: Yt(z.downloads + x) })
881
+ function s(c, w = 0) {
882
+ const { did: k, owner: x, stats: z } = c;
883
+ return /* @__PURE__ */ m(S, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
884
+ /* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(kt, { src: x.avatar, did: k, size: 20, variant: "circle" }), children: x.fullName }),
885
+ /* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(Se, { icon: vt }), title: `${z.downloads + w}`, children: er(z.downloads + w) })
707
886
  ] });
708
887
  }
709
- function k(c, x) {
710
- return /* @__PURE__ */ t(Xe, { href: c || `/blocklets/${x}`, align: "left", width: 100, children: /* @__PURE__ */ t(
711
- Z,
888
+ function v(c, w) {
889
+ return /* @__PURE__ */ t(nt, { href: c || `/blocklets/${w}`, align: "left", width: 100, children: /* @__PURE__ */ t(
890
+ ee,
712
891
  {
713
892
  variant: "outlined",
714
893
  size: "small",
@@ -723,176 +902,35 @@ function Xt() {
723
902
  ) });
724
903
  }
725
904
  }
726
- const Yt = (e) => Number.isNaN(e) ? 0 : e < 1e3 ? e : e < 1e6 ? `${(e / 1e3).toFixed(1)}k` : e < 1e9 ? `${(e / 1e6).toFixed(1)}m` : `${(e / 1e9).toFixed(1)}b`;
727
- function Jt({ title: e, blocklets: r }) {
728
- const { blockletRender: o, serverVersion: n } = B();
729
- return /* @__PURE__ */ p(S, { mt: 3, children: [
730
- /* @__PURE__ */ t(T, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
731
- /* @__PURE__ */ t(pe, { container: !0, spacing: 2, children: r.map((a) => /* @__PURE__ */ t(pe, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": a.did, children: /* @__PURE__ */ t(S, { padding: "1px", children: o({ blocklet: a, blocklets: r, serverVersion: n }) }) }, a.did)) })
905
+ const er = (e) => Number.isNaN(e) ? 0 : e < 1e3 ? e : e < 1e6 ? `${(e / 1e3).toFixed(1)}k` : e < 1e9 ? `${(e / 1e6).toFixed(1)}m` : `${(e / 1e9).toFixed(1)}b`, tr = (e, o) => e && o ? `/assets/${e}/screenshots/${o}` : "";
906
+ function rr({ title: e, blocklets: o }) {
907
+ const { blockletRender: r, serverVersion: n } = B();
908
+ return /* @__PURE__ */ m(S, { mt: 3, children: [
909
+ /* @__PURE__ */ t(L, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
910
+ /* @__PURE__ */ t(me, { container: !0, spacing: 2, children: o.map((a) => /* @__PURE__ */ t(me, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": a.did, children: /* @__PURE__ */ t(S, { padding: "1px", children: r({ blocklet: a, blocklets: o, serverVersion: n }) }) }, a.did)) })
732
911
  ] });
733
912
  }
734
- function Kt() {
735
- const { get: e } = Me(), { t: r } = B(), {
736
- data: o = [],
913
+ function or() {
914
+ const { get: e } = Oe(), { t: o } = B(), {
915
+ data: r = [],
737
916
  error: n,
738
917
  loading: a
739
- } = te(async () => {
740
- const l = await e(R.explorePath);
918
+ } = re(async () => {
919
+ const l = await e(T.explorePath);
741
920
  return Array.isArray(l) ? l : [];
742
921
  });
743
- return n ? /* @__PURE__ */ t(K, { error: new Error(`Failed to fetch blocklets from ${R.explorePath}`) }) : a ? /* @__PURE__ */ t(Ne, { mt: 15 }) : /* @__PURE__ */ p(F, { children: [
744
- /* @__PURE__ */ t(Xt, {}),
745
- o.map(
746
- (l) => l.blocklets.length > 0 ? /* @__PURE__ */ t(Jt, { title: r(`explore.${l.type}`), blocklets: l.blocklets }, l.type) : null
922
+ return n ? /* @__PURE__ */ t(Z, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : a ? /* @__PURE__ */ t(qe, { mt: 15 }) : /* @__PURE__ */ m(F, { children: [
923
+ /* @__PURE__ */ t(Zt, {}),
924
+ r.map(
925
+ (l) => l.blocklets.length > 0 ? /* @__PURE__ */ t(rr, { title: o(`explore.${l.type}`), blocklets: l.blocklets }, l.type) : null
747
926
  )
748
927
  ] });
749
928
  }
750
- const Zt = D(Z)`
751
- border-radius: 4px;
752
- `, ne = it(({ children: e, rounded: r, loading: o, disabled: n, ...a }, l) => /* @__PURE__ */ t(
753
- Zt,
754
- {
755
- ref: l,
756
- disableElevation: !0,
757
- disabled: n || o,
758
- ...a,
759
- startIcon: o && /* @__PURE__ */ t(ee, { size: "1em" }),
760
- children: e
761
- }
762
- ));
763
- ne.propTypes = {
764
- children: i.any,
765
- rounded: i.bool,
766
- loading: i.bool,
767
- disabled: i.bool
768
- };
769
- ne.defaultProps = {
770
- children: null,
771
- rounded: !1,
772
- loading: !1,
773
- disabled: !1
774
- };
775
- function le({ title: e, value: r, icon: o, prepend: n, options: a, onChange: l, itemRender: m, ...d }) {
776
- const s = U(null), k = be(), [f, g] = q(!1), [c, x] = q(r !== null ? r : ""), w = N(k.breakpoints.down("sm"));
777
- j(() => {
778
- x(r !== null ? r : "");
779
- }, [r]);
780
- const v = J(() => {
781
- g(!1);
782
- }, []), z = J(() => {
783
- g(!0);
784
- }, []);
785
- function y(C) {
786
- x(C.value), l(C.value), w && v();
787
- }
788
- function u(C) {
789
- return C === c;
790
- }
791
- return /* @__PURE__ */ p(F, { children: [
792
- /* @__PURE__ */ p(
793
- er,
794
- {
795
- ref: s,
796
- onClick: z,
797
- variant: "outlined",
798
- size: "small",
799
- className: ["my-select__selector", Ct(c) ? "" : "my-select__selector--active"].join(" "),
800
- sx: { minWidth: "auto" },
801
- ...d,
802
- children: [
803
- /* @__PURE__ */ t("div", { className: "my-select__icon", children: o }),
804
- e,
805
- /* @__PURE__ */ t(Je, { className: "my-select__arrowdown", component: vt, fontSize: "small" })
806
- ]
807
- }
808
- ),
809
- /* @__PURE__ */ t(Ke, { open: f, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: C, placement: $ }) => /* @__PURE__ */ t(Ze, { ...C, sx: { transformOrigin: $ === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(et, { children: /* @__PURE__ */ t(tt, { onClickAway: v, children: /* @__PURE__ */ p(tr, { autoFocusItem: f, onMouseEnter: z, onMouseLeave: v, children: [
810
- n,
811
- a.map((_) => m ? m(_) : /* @__PURE__ */ t(
812
- rt,
813
- {
814
- onClick: () => y(_),
815
- className: [
816
- "my-select__option",
817
- u(_.value) ? "my-select__option--active" : ""
818
- ].join(" "),
819
- children: _.name
820
- },
821
- _.value
822
- ))
823
- ] }) }) }) }) })
824
- ] });
825
- }
826
- le.propTypes = {
827
- options: i.array.isRequired,
828
- value: i.oneOfType([i.string, i.number, i.array]),
829
- onChange: i.func,
830
- itemRender: i.func,
831
- title: i.string.isRequired,
832
- icon: i.any,
833
- prepend: i.any
834
- };
835
- le.defaultProps = {
836
- value: null,
837
- icon: null,
838
- prepend: null,
839
- itemRender: null,
840
- onChange: () => {
841
- }
842
- };
843
- const er = D(ne)`
844
- border: 1px solid #f0f0f0;
845
- padding: 6px 8px 6px 12px;
846
- font-weight: ${(e) => e.theme.typography.fontWeightRegular};
847
- font-size: 14px;
848
- color: #666;
849
- line-height: 1;
850
- text-transform: none;
851
- & + & {
852
- margin-left: 10px;
853
- }
854
- &.my-select__selector--active {
855
- &,
856
- .my-select__arrowdown,
857
- .my-select__icon svg {
858
- color: ${(e) => e.theme.palette.primary.main};
859
- }
860
- }
861
- .my-select__arrowdown {
862
- color: #999;
863
- font-size: 14px;
864
- margin-left: 6px;
865
- }
866
- .my-select__icon {
867
- font-size: 0;
868
- svg {
869
- color: #999;
870
- font-size: 18px;
871
- margin-right: 3px;
872
- }
873
- }
874
- `, tr = D(Ye)`
875
- .my-select__option__icon {
876
- color: transparent;
877
- font-size: 14px;
878
- margin: 0 3px 0 -5px;
879
- }
880
- .my-select__option {
881
- font-size: 14px;
882
- color: #999;
883
- }
884
- .my-select__option--active {
885
- &,
886
- .my-select__option__icon {
887
- color: ${(e) => e.theme.palette.primary.main};
888
- }
889
- }
890
- `;
891
- function rr() {
892
- var d;
893
- const { filters: e, handleSort: r, handlePrice: o, t: n, getCategoryLocale: a } = B(), l = At(n), m = ((d = l.find((s) => s.value === e.sortBy)) == null ? void 0 : d.name) || n("sort.sort");
894
- return /* @__PURE__ */ p(
895
- P,
929
+ function nr() {
930
+ var u;
931
+ const { filters: e, handleSort: o, handlePrice: r, t: n, getCategoryLocale: a } = B(), l = Ae(n), d = ((u = l.find((s) => s.value === e.sortBy)) == null ? void 0 : u.name) || n("sort.sort");
932
+ return /* @__PURE__ */ m(
933
+ I,
896
934
  {
897
935
  direction: { xs: "column", md: "row" },
898
936
  alignItems: { xs: "flex-start", md: "center" },
@@ -902,30 +940,30 @@ function rr() {
902
940
  px: 0,
903
941
  pb: 3,
904
942
  children: [
905
- /* @__PURE__ */ t(T, { variant: "h2", textTransform: "capitalize", children: a(e.category) }),
906
- /* @__PURE__ */ p(P, { direction: "row", alignItems: "center", width: { xs: "100%", md: "auto" }, justifyContent: "space-between", children: [
943
+ /* @__PURE__ */ t(L, { variant: "h2", textTransform: "capitalize", children: a(e.category) }),
944
+ /* @__PURE__ */ m(I, { direction: "row", alignItems: "center", width: { xs: "100%", md: "auto" }, justifyContent: "space-between", children: [
907
945
  /* @__PURE__ */ t(
908
- ke,
946
+ ve,
909
947
  {
910
948
  control: /* @__PURE__ */ t(
911
- ve,
949
+ Ce,
912
950
  {
913
951
  checked: e.price === "free",
914
952
  size: "small",
915
953
  sx: { "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.lighter" } },
916
- onChange: (s) => o(s.target.checked ? "free" : "")
954
+ onChange: (s) => r(s.target.checked ? "free" : "")
917
955
  }
918
956
  ),
919
957
  label: n("blocklet.free")
920
958
  }
921
959
  ),
922
960
  /* @__PURE__ */ t(
923
- le,
961
+ Q,
924
962
  {
925
963
  value: e.sortBy,
926
964
  options: l,
927
- title: m,
928
- onChange: r,
965
+ title: d,
966
+ onChange: o,
929
967
  icon: null,
930
968
  prepend: null,
931
969
  itemRender: null
@@ -936,17 +974,17 @@ function rr() {
936
974
  }
937
975
  );
938
976
  }
939
- function ye() {
977
+ function be() {
940
978
  const { t: e } = B();
941
- return /* @__PURE__ */ t(Ie, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
979
+ return /* @__PURE__ */ t(Le, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
942
980
  }
943
- function O({ filterTip: e, keywordTip: r }) {
944
- const { t: o, locale: n } = B(), a = () => n === "zh" ? "、" : " , ";
945
- return /* @__PURE__ */ p(Te, { className: "tips", children: [
946
- /* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
947
- e && /* @__PURE__ */ t("span", { children: o("blocklet.filterTip") }),
948
- e && r && a(),
949
- r && /* @__PURE__ */ t("span", { children: o("blocklet.keywordTip") })
981
+ function O({ filterTip: e, keywordTip: o }) {
982
+ const { t: r, locale: n } = B(), a = () => n === "zh" ? "、" : " , ";
983
+ return /* @__PURE__ */ m(Ie, { className: "tips", children: [
984
+ /* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: r("blocklet.emptyTip") }),
985
+ e && /* @__PURE__ */ t("span", { children: r("blocklet.filterTip") }),
986
+ e && o && a(),
987
+ o && /* @__PURE__ */ t("span", { children: r("blocklet.keywordTip") })
950
988
  ] });
951
989
  }
952
990
  O.propTypes = {
@@ -957,16 +995,16 @@ O.defaultProps = {
957
995
  filterTip: !1,
958
996
  keywordTip: !1
959
997
  };
960
- function H({ primaryStart: e, primaryEnd: r, filter: o }) {
961
- return /* @__PURE__ */ p(Ie, { variant: "subtitle2", children: [
998
+ function H({ primaryStart: e, primaryEnd: o, filter: r }) {
999
+ return /* @__PURE__ */ m(Le, { variant: "subtitle2", children: [
962
1000
  /* @__PURE__ */ t("span", { children: e }),
963
- /* @__PURE__ */ p("span", { className: "primary", children: [
1001
+ /* @__PURE__ */ m("span", { className: "primary", children: [
964
1002
  " ",
965
- o,
1003
+ r,
966
1004
  " "
967
1005
  ] }),
968
- /* @__PURE__ */ p("span", { children: [
969
- r,
1006
+ /* @__PURE__ */ m("span", { children: [
1007
+ o,
970
1008
  " "
971
1009
  ] })
972
1010
  ] });
@@ -976,80 +1014,80 @@ H.propTypes = {
976
1014
  primaryEnd: i.string.isRequired,
977
1015
  filter: i.string.isRequired
978
1016
  };
979
- function Oe({ blocklets: e, ...r }) {
1017
+ function je({ blocklets: e, ...o }) {
980
1018
  const {
981
- blockletRender: o,
1019
+ blockletRender: r,
982
1020
  errors: n,
983
1021
  loadings: a,
984
1022
  selectedCategory: l,
985
- getCategoryLocale: m,
986
- filters: d,
1023
+ getCategoryLocale: d,
1024
+ filters: u,
987
1025
  t: s,
988
- serverVersion: k,
1026
+ serverVersion: v,
989
1027
  hasNextPage: f,
990
- loadMore: g,
1028
+ loadMore: y,
991
1029
  endpoint: c
992
- } = B(), x = !!l || !!d.price, [w] = Bt({
1030
+ } = B(), w = !!l || !!u.price, [k] = Pt({
993
1031
  loading: a.fetchBlockletsLoading || a.loadingMore,
994
1032
  hasNextPage: f,
995
- onLoadMore: g
1033
+ onLoadMore: y
996
1034
  });
997
1035
  if (n.fetchBlockletsError)
998
1036
  return /* @__PURE__ */ t(
999
- K,
1037
+ Z,
1000
1038
  {
1001
1039
  error: new Error(`Failed to fetch blocklets from ${c}: ${n.fetchBlockletsError.message}`)
1002
1040
  }
1003
1041
  );
1004
1042
  if (a.fetchBlockletsLoading)
1005
- return /* @__PURE__ */ t(Ne, { mt: 15 });
1006
- if (d.keyword && x && e.length === 0)
1007
- return /* @__PURE__ */ p(W, { children: [
1043
+ return /* @__PURE__ */ t(qe, { mt: 15 });
1044
+ if (u.keyword && w && e.length === 0)
1045
+ return /* @__PURE__ */ m(W, { children: [
1008
1046
  /* @__PURE__ */ t(
1009
1047
  H,
1010
1048
  {
1011
1049
  primaryStart: s("blocklet.noBlockletPart1"),
1012
1050
  primaryEnd: s("blocklet.noBlockletPart2"),
1013
- filter: d.keyword
1051
+ filter: u.keyword
1014
1052
  }
1015
1053
  ),
1016
1054
  /* @__PURE__ */ t(O, { keywordTip: !0, filterTip: !0 })
1017
1055
  ] });
1018
- if (d.keyword && e.length === 0)
1019
- return /* @__PURE__ */ p(W, { children: [
1056
+ if (u.keyword && e.length === 0)
1057
+ return /* @__PURE__ */ m(W, { children: [
1020
1058
  /* @__PURE__ */ t(
1021
1059
  H,
1022
1060
  {
1023
1061
  primaryStart: s("blocklet.noBlockletPart1"),
1024
1062
  primaryEnd: s("blocklet.noBlockletPart2"),
1025
- filter: d.keyword
1063
+ filter: u.keyword
1026
1064
  }
1027
1065
  ),
1028
1066
  /* @__PURE__ */ t(O, { keywordTip: !0 })
1029
1067
  ] });
1030
- if (x && e.length === 0) {
1031
- const v = m(l);
1032
- return /* @__PURE__ */ p(W, { children: [
1033
- v ? /* @__PURE__ */ t(
1068
+ if (w && e.length === 0) {
1069
+ const x = d(l);
1070
+ return /* @__PURE__ */ m(W, { children: [
1071
+ x ? /* @__PURE__ */ t(
1034
1072
  H,
1035
1073
  {
1036
1074
  primaryStart: s("blocklet.noCategoryResults1"),
1037
1075
  primaryEnd: s("blocklet.noCategoryResults2"),
1038
- filter: v
1076
+ filter: x
1039
1077
  }
1040
- ) : /* @__PURE__ */ t(ye, {}),
1078
+ ) : /* @__PURE__ */ t(be, {}),
1041
1079
  /* @__PURE__ */ t(O, { filterTip: !0 })
1042
1080
  ] });
1043
1081
  }
1044
- return e.length === 0 ? /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(ye, {}) }) : /* @__PURE__ */ p(F, { children: [
1045
- /* @__PURE__ */ t(S, { display: "grid", gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr" }, p: "2px", ...r, gap: 2, children: e.map((v) => /* @__PURE__ */ t(S, { "data-blocklet-did": v.did, children: o({ blocklet: v, blocklets: e, serverVersion: k }) }, v.did)) }),
1046
- f && /* @__PURE__ */ t(S, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: w, children: /* @__PURE__ */ t(ee, {}) })
1082
+ return e.length === 0 ? /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(be, {}) }) : /* @__PURE__ */ m(F, { children: [
1083
+ /* @__PURE__ */ t(S, { display: "grid", gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr" }, p: "2px", ...o, gap: 2, children: e.map((x) => /* @__PURE__ */ t(S, { "data-blocklet-did": x.did, children: r({ blocklet: x, blocklets: e, serverVersion: v }) }, x.did)) }),
1084
+ f && /* @__PURE__ */ t(S, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: k, children: /* @__PURE__ */ t(te, {}) })
1047
1085
  ] });
1048
1086
  }
1049
- Oe.propTypes = {
1087
+ je.propTypes = {
1050
1088
  blocklets: i.array.isRequired
1051
1089
  };
1052
- const W = D(St)`
1090
+ const W = D(Rt)`
1053
1091
  text-align: center;
1054
1092
  margin-top: 100px;
1055
1093
  .primary {
@@ -1059,38 +1097,38 @@ const W = D(St)`
1059
1097
  margin-top: ${(e) => e.theme.spacing(1)};
1060
1098
  }
1061
1099
  `;
1062
- function ae({ onSelect: e, wrapChildren: r }) {
1063
- const o = U(null), n = U(null), a = U(null), { storeApi: l, blockletRender: m, filters: d, endpoint: s, handleKeyword: k, t: f, serverVersion: g } = B(), c = async (y) => {
1064
- const { data: u } = await l.get(R.blockletsPath, { params: y }), C = u.dataList || [];
1065
- return C.length > 0 && C.unshift({ type: "more-result", total: u.total || 0 }), C;
1066
- }, x = (y) => {
1067
- k(y.state.query), y.setIsOpen(!1);
1068
- }, w = () => {
1069
- o.current && setTimeout(() => {
1070
- const y = o.current.querySelector("input.bl-autocomplete-input");
1071
- y && y.focus();
1100
+ function ae({ onSelect: e, wrapChildren: o }) {
1101
+ const r = U(null), n = U(null), a = U(null), { storeApi: l, blockletRender: d, filters: u, endpoint: s, handleKeyword: v, t: f, serverVersion: y } = B(), c = async (b) => {
1102
+ const { data: h } = await l.get(T.blockletsPath, { params: b }), C = h.dataList || [];
1103
+ return C.length > 0 && C.unshift({ type: "more-result", total: h.total || 0 }), C;
1104
+ }, w = (b) => {
1105
+ v(b.state.query), b.setIsOpen(!1);
1106
+ }, k = () => {
1107
+ r.current && setTimeout(() => {
1108
+ const b = r.current.querySelector("input.bl-autocomplete-input");
1109
+ b && b.focus();
1072
1110
  });
1073
- }, v = (y) => {
1074
- y.setIsOpen(!1), w();
1075
- }, z = ({ prevState: y, state: u }) => {
1076
- y.query !== u.query && (u.query || (k(), w()));
1111
+ }, x = (b) => {
1112
+ b.setIsOpen(!1), k();
1113
+ }, z = ({ prevState: b, state: h }) => {
1114
+ b.query !== h.query && (h.query || (v(), k()));
1077
1115
  };
1078
- return It(
1116
+ return $t(
1079
1117
  "ctrl + k, command + k",
1080
- (y) => (y.stopPropagation(), y.preventDefault(), w(), !1),
1118
+ (b) => (b.stopPropagation(), b.preventDefault(), k(), !1),
1081
1119
  { enableOnTags: ["INPUT"] }
1082
1120
  ), j(() => {
1083
- w();
1121
+ k();
1084
1122
  }, [s]), j(() => {
1085
- if (!o.current)
1123
+ if (!r.current)
1086
1124
  return;
1087
- const y = Tt({
1088
- container: o.current,
1089
- renderer: { createElement: st, Fragment: ct, render: () => {
1125
+ const b = Lt({
1126
+ container: r.current,
1127
+ renderer: { createElement: dt, Fragment: ut, render: () => {
1090
1128
  } },
1091
- render({ children: u }, C) {
1092
- var $;
1093
- (!n.current || a.current !== C) && (a.current = C, ($ = n.current) == null || $.unmount(), n.current = Pt(C)), n.current.render(r(u));
1129
+ render({ children: h }, C) {
1130
+ var _;
1131
+ (!n.current || a.current !== C) && (a.current = C, (_ = n.current) == null || _.unmount(), n.current = It(C)), n.current.render(o(h));
1094
1132
  },
1095
1133
  autoFocus: !0,
1096
1134
  openOnFocus: !1,
@@ -1111,44 +1149,43 @@ function ae({ onSelect: e, wrapChildren: r }) {
1111
1149
  },
1112
1150
  placeholder: f("common.searchStore"),
1113
1151
  initialState: {
1114
- query: d.keyword
1152
+ query: u.keyword
1115
1153
  },
1116
- onStateChange(u) {
1117
- z(u);
1154
+ onStateChange(h) {
1155
+ z(h);
1118
1156
  },
1119
- onSubmit: x,
1120
- onReset(u) {
1121
- v(u);
1157
+ onSubmit: w,
1158
+ onReset(h) {
1159
+ x(h);
1122
1160
  },
1123
- getSources({ query: u, state: C, ...$ }) {
1124
- const _ = {
1125
- ...d,
1126
- sortBy: R[d.sortBy],
1161
+ getSources({ query: h, state: C, ..._ }) {
1162
+ const A = {
1163
+ sortBy: T.nameDesc,
1127
1164
  page: 1,
1128
1165
  pageSize: 10,
1129
- keyword: u
1166
+ keyword: h
1130
1167
  };
1131
- return jt([
1168
+ return Vt([
1132
1169
  {
1133
1170
  sourceId: "blocklets",
1134
1171
  getItems() {
1135
- return c(_);
1172
+ return c(A);
1136
1173
  },
1137
1174
  // 选中后填充 搜索框中值
1138
- getItemInputValue({ item: L }) {
1139
- return L.type === "more-result" ? u : L.title;
1175
+ getItemInputValue({ item: $ }) {
1176
+ return $.type === "more-result" ? h : $.title;
1140
1177
  },
1141
1178
  // 选中或者点击自动完成列表中的 item 时触发
1142
- onSelect({ event: L, item: I }) {
1143
- return I.type === "more-result" ? ($.setIsOpen(!1), k(u)) : L.type === "keydown" ? k(I.title) : e({
1144
- blocklet: I,
1145
- detailUrl: Lt(s, "/blocklets", I.did),
1179
+ onSelect({ event: $, item: R }) {
1180
+ return R.type === "more-result" ? (_.setIsOpen(!1), v(h)) : $.type === "keydown" ? v(R.title) : e({
1181
+ blocklet: R,
1182
+ detailUrl: zt(s, "/blocklets", R.did),
1146
1183
  storeUrl: s
1147
1184
  });
1148
1185
  },
1149
1186
  templates: {
1150
- item({ item: L }) {
1151
- return L.type === "more-result" ? /* @__PURE__ */ t("div", { children: f("autocomplete.expandResult", { name: u, number: L.total.toLocaleString() }) }) : m({ blocklet: L, autocompleteSetters: $, serverVersion: g });
1187
+ item({ item: $ }) {
1188
+ return $.type === "more-result" ? /* @__PURE__ */ t("div", { children: f("autocomplete.expandResult", { name: h, number: $.total.toLocaleString() }) }) : d({ blocklet: $, autocompleteSetters: _, serverVersion: y });
1152
1189
  },
1153
1190
  noResults() {
1154
1191
  return f("blocklet.noResults");
@@ -1159,22 +1196,28 @@ function ae({ onSelect: e, wrapChildren: r }) {
1159
1196
  }
1160
1197
  });
1161
1198
  return () => {
1162
- y.destroy();
1199
+ b.destroy();
1163
1200
  };
1164
- }, [d, m]), /* @__PURE__ */ p(F, { children: [
1201
+ }, [u, d]), /* @__PURE__ */ m(F, { children: [
1165
1202
  /* @__PURE__ */ t(
1166
- xe,
1203
+ we,
1167
1204
  {
1168
- styles: we`
1205
+ styles: (b) => ke`
1169
1206
  .bl-autocomplete-detached-container {
1170
1207
  .bl-autocomplete-detached-cancel {
1171
1208
  white-space: nowrap;
1172
1209
  }
1173
1210
  }
1211
+ .bl-autocomplete-panel {
1212
+ @media (min-width: ${b.breakpoints.values.md}px) {
1213
+ min-width: 450px;
1214
+ left: unset !important;
1215
+ }
1216
+ }
1174
1217
  `
1175
1218
  }
1176
1219
  ),
1177
- /* @__PURE__ */ t("div", { className: "bl-search-container", ref: o })
1220
+ /* @__PURE__ */ t("div", { className: "bl-search-container", ref: r })
1178
1221
  ] });
1179
1222
  }
1180
1223
  ae.propTypes = {
@@ -1184,29 +1227,29 @@ ae.propTypes = {
1184
1227
  ae.defaultProps = {
1185
1228
  wrapChildren: (e) => e
1186
1229
  };
1187
- function ie({ placeholder: e, ...r }) {
1188
- const { filters: o, handleKeyword: n } = B(), [a, l] = q(o.keyword || ""), m = mt(n, { wait: 300 }), d = (k) => {
1189
- const { value: f } = k.target;
1190
- l(f), m.run(f);
1230
+ function ie({ placeholder: e, ...o }) {
1231
+ const { filters: r, handleKeyword: n } = B(), [a, l] = q(r.keyword || ""), d = ft(n, { wait: 300 }), u = (v) => {
1232
+ const { value: f } = v.target;
1233
+ l(f), d.run(f);
1191
1234
  }, s = () => {
1192
1235
  l(""), n();
1193
1236
  };
1194
1237
  return j(() => {
1195
- l(o.keyword || "");
1196
- }, [o.keyword]), /* @__PURE__ */ t(
1197
- or,
1238
+ l(r.keyword || "");
1239
+ }, [r.keyword]), /* @__PURE__ */ t(
1240
+ lr,
1198
1241
  {
1199
1242
  inputProps: {
1200
1243
  "data-cy": "search-blocklet"
1201
1244
  },
1202
- startAdornment: /* @__PURE__ */ t(me, { position: "start", children: /* @__PURE__ */ t(nr, {}) }),
1203
- onChange: d,
1245
+ startAdornment: /* @__PURE__ */ t(he, { position: "start", children: /* @__PURE__ */ t(ar, {}) }),
1246
+ onChange: u,
1204
1247
  placeholder: e,
1205
1248
  value: a,
1206
1249
  title: e,
1207
1250
  "data-cy": "search",
1208
- endAdornment: a && /* @__PURE__ */ t(me, { position: "end", children: /* @__PURE__ */ t(lr, { "data-cy": "search-delete", onClick: s }) }),
1209
- ...r
1251
+ endAdornment: a && /* @__PURE__ */ t(he, { position: "end", children: /* @__PURE__ */ t(ir, { "data-cy": "search-delete", onClick: s }) }),
1252
+ ...o
1210
1253
  }
1211
1254
  );
1212
1255
  }
@@ -1216,7 +1259,7 @@ ie.propTypes = {
1216
1259
  ie.defaultProps = {
1217
1260
  placeholder: "Type to search..."
1218
1261
  };
1219
- const or = D(ot)`
1262
+ const lr = D(lt)`
1220
1263
  background-color: ${(e) => e.theme.palette.grey[50]};
1221
1264
  font-size: 14px;
1222
1265
  border-radius: 6px;
@@ -1233,21 +1276,21 @@ const or = D(ot)`
1233
1276
  color: transparent;
1234
1277
  }
1235
1278
  }
1236
- `, nr = D(zt)`
1279
+ `, ar = D(_t)`
1237
1280
  color: ${(e) => e.theme.palette.grey[500]};
1238
1281
  font-size: 28px;
1239
1282
  @media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
1240
1283
  font-size: 24px;
1241
1284
  }
1242
- `, lr = D(Se)`
1285
+ `, ir = D(Be)`
1243
1286
  color: ${(e) => e.theme.palette.grey[500]};
1244
1287
  font-size: 16px;
1245
1288
  cursor: pointer;
1246
1289
  `;
1247
- function ar() {
1248
- const { filters: e, handleSearchSelect: r, t: o, wrapChildren: n, baseSearch: a } = B(), { toggleOpen: l } = re(), m = !!e.keyword;
1249
- return /* @__PURE__ */ p(
1250
- P,
1290
+ function sr() {
1291
+ const { filters: e, handleSearchSelect: o, t: r, wrapChildren: n, baseSearch: a } = B(), { toggleOpen: l } = oe(), d = !!e.keyword;
1292
+ return /* @__PURE__ */ m(
1293
+ I,
1251
1294
  {
1252
1295
  direction: "row",
1253
1296
  alignItems: "center",
@@ -1261,66 +1304,66 @@ function ar() {
1261
1304
  /* @__PURE__ */ t(
1262
1305
  G,
1263
1306
  {
1264
- xs: !m && /* @__PURE__ */ t(De, { onClick: () => l(!0), children: /* @__PURE__ */ t(Rt, {}) }),
1265
- md: /* @__PURE__ */ t(T, { variant: "h1", children: o("common.title") })
1307
+ xs: !d && /* @__PURE__ */ t(Me, { onClick: () => l(!0), children: /* @__PURE__ */ t(Tt, {}) }),
1308
+ md: /* @__PURE__ */ t(L, { variant: "h1", children: r("common.title") })
1266
1309
  }
1267
1310
  ),
1268
1311
  /* @__PURE__ */ t(
1269
1312
  S,
1270
1313
  {
1271
- width: { xs: m ? "100%" : 300, md: 300 },
1314
+ width: { xs: d ? "100%" : 300, md: 300 },
1272
1315
  className: "filter-bar",
1273
1316
  sx: {
1274
1317
  "& .bl-autocomplete-form": { borderRadius: 2 },
1275
1318
  "& .aa-SubmitButton, & .aa-LoadingIndicator": { width: "auto", pl: 1.5, pr: 1 },
1276
1319
  "& .aa-SubmitIcon, & .aa-LoadingIcon": { height: 16, width: 16 }
1277
1320
  },
1278
- children: a ? /* @__PURE__ */ t(ie, { className: "bl-search-container", placeholder: o("common.searchStore"), sx: { pl: 1.5 } }) : /* @__PURE__ */ t(ae, { onSelect: r, wrapChildren: n })
1321
+ children: a ? /* @__PURE__ */ t(ie, { className: "bl-search-container", placeholder: r("common.searchStore"), sx: { pl: 1.5 } }) : /* @__PURE__ */ t(ae, { onSelect: o, wrapChildren: n })
1279
1322
  }
1280
1323
  )
1281
1324
  ]
1282
1325
  }
1283
1326
  );
1284
1327
  }
1285
- function ir() {
1286
- const { blockletList: e, filters: r, t: o } = B(), n = r.category || r.keyword || r.price;
1287
- return /* @__PURE__ */ t($t, { children: /* @__PURE__ */ p(nt, { FallbackComponent: K, children: [
1288
- /* @__PURE__ */ t(ar, {}),
1289
- /* @__PURE__ */ p(S, { display: "flex", height: "100%", children: [
1290
- /* @__PURE__ */ t(Qt, {}),
1291
- /* @__PURE__ */ t(P, { height: "100%", position: "relative", flex: 1, overflow: "auto", children: n ? /* @__PURE__ */ p(F, { children: [
1292
- r.keyword ? /* @__PURE__ */ p(F, { children: [
1293
- /* @__PURE__ */ t(G, { xs: /* @__PURE__ */ t(Ee, {}), md: null }),
1294
- a()
1295
- ] }) : /* @__PURE__ */ t(rr, {}),
1296
- /* @__PURE__ */ t(Oe, { blocklets: e, height: "100%" })
1297
- ] }) : /* @__PURE__ */ t(Kt, {}) })
1328
+ function cr() {
1329
+ const { blockletList: e, total: o, filters: r, t: n } = B(), a = r.category || r.keyword || r.price;
1330
+ return /* @__PURE__ */ t(At, { children: /* @__PURE__ */ m(at, { FallbackComponent: Z, children: [
1331
+ /* @__PURE__ */ t(sr, {}),
1332
+ /* @__PURE__ */ m(S, { display: "flex", height: "100%", children: [
1333
+ /* @__PURE__ */ t(Kt, {}),
1334
+ /* @__PURE__ */ t(I, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: a ? /* @__PURE__ */ m(F, { children: [
1335
+ r.keyword ? /* @__PURE__ */ m(F, { children: [
1336
+ /* @__PURE__ */ t(G, { xs: /* @__PURE__ */ t(Ne, {}), md: null }),
1337
+ l()
1338
+ ] }) : /* @__PURE__ */ t(nr, {}),
1339
+ /* @__PURE__ */ t(je, { blocklets: e, height: "100%" })
1340
+ ] }) : /* @__PURE__ */ t(or, {}) })
1298
1341
  ] })
1299
1342
  ] }) });
1300
- function a() {
1301
- return /* @__PURE__ */ p(P, { direction: "row", alignItems: "center", justifyContent: "space-between", mb: 2, mt: { xs: 2, md: 0 }, children: [
1302
- /* @__PURE__ */ t(T, { variant: "h3", children: o("blocklet.search", { keyword: r.keyword }) }),
1303
- /* @__PURE__ */ t(T, { variant: "body1", color: "text.lighter", fontSize: 13, children: o("blocklet.resultCount", { count: e.length }) })
1343
+ function l() {
1344
+ return /* @__PURE__ */ m(I, { direction: "row", alignItems: "center", justifyContent: "space-between", mb: 2, mt: { xs: 2, md: 0 }, children: [
1345
+ /* @__PURE__ */ t(L, { variant: "h3", children: n("blocklet.search", { keyword: r.keyword }) }),
1346
+ /* @__PURE__ */ t(L, { variant: "body1", color: "text.lighter", fontSize: 13, children: n("blocklet.resultCount", { count: o }) })
1304
1347
  ] });
1305
1348
  }
1306
1349
  }
1307
- function qe(e) {
1308
- const r = be(), o = Ot(r.palette.primary.main), n = {
1309
- autocomplete: we`
1350
+ function Ve(e) {
1351
+ const o = xe(), r = qt(o.palette.primary.main), n = {
1352
+ autocomplete: ke`
1310
1353
  :root {
1311
- --aa-detached-media-query: (max-width: ${r.breakpoints.values.md}px) !important;
1312
- --aa-detached-modal-media-query: (min-width: ${r.breakpoints.values.md}px) !important;
1313
- --aa-detached-modal-max-width: ${r.breakpoints.values.md}px !important;
1314
- --aa-selected-color-rgb: ${o.r}, ${o.g}, ${o.b} !important;
1315
- --aa-primary-color-rgb: ${o.r}, ${o.g}, ${o.b} !important;
1354
+ --aa-detached-media-query: (max-width: ${o.breakpoints.values.md}px) !important;
1355
+ --aa-detached-modal-media-query: (min-width: ${o.breakpoints.values.md}px) !important;
1356
+ --aa-detached-modal-max-width: ${o.breakpoints.values.md}px !important;
1357
+ --aa-selected-color-rgb: ${r.r}, ${r.g}, ${r.b} !important;
1358
+ --aa-primary-color-rgb: ${r.r}, ${r.g}, ${r.b} !important;
1316
1359
  --aa-input-background-color-rgb: 250, 250, 250 !important;
1317
1360
  }
1318
1361
  .bl-autocomplete-panel {
1319
- z-index: ${r.zIndex.modal};
1362
+ z-index: ${o.zIndex.modal};
1320
1363
  }
1321
1364
  .bl-autocomplete-label {
1322
1365
  .aa-SubmitIcon {
1323
- color: ${r.palette.grey[500]} !important;
1366
+ color: ${o.palette.grey[500]} !important;
1324
1367
  }
1325
1368
  }
1326
1369
  .bl-autocomplete-form {
@@ -1336,21 +1379,21 @@ function qe(e) {
1336
1379
  box-shadow: none !important;
1337
1380
  }
1338
1381
  .aa-SubmitIcon {
1339
- color: ${r.palette.grey[500]} !important;
1382
+ color: ${o.palette.grey[500]} !important;
1340
1383
  }
1341
1384
  }
1342
1385
  .aa-Panel .arcblock-blocklet button {
1343
- border: 1px solid rgba(${o.r}, ${o.g}, ${o.b}, 0.5);
1386
+ border: 1px solid rgba(${r.r}, ${r.g}, ${r.b}, 0.5);
1344
1387
  }
1345
1388
  `
1346
1389
  };
1347
- return /* @__PURE__ */ p(oe, { ...e, children: [
1348
- /* @__PURE__ */ t(xe, { styles: n.autocomplete }),
1349
- /* @__PURE__ */ t(ir, {})
1390
+ return /* @__PURE__ */ m(ne, { ...e, children: [
1391
+ /* @__PURE__ */ t(we, { styles: n.autocomplete }),
1392
+ /* @__PURE__ */ t(cr, {})
1350
1393
  ] });
1351
1394
  }
1352
- qe.propTypes = ze;
1353
- qe.defaultProps = $e;
1395
+ Ve.propTypes = ze;
1396
+ Ve.defaultProps = _e;
1354
1397
  export {
1355
- qe as default
1398
+ Ve as default
1356
1399
  };