@blocklet/list 0.14.13 → 0.14.15
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/lib/index.es.js +467 -432
- package/package.json +3 -3
package/lib/index.es.js
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { styled as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { ErrorFallback as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { ErrorBoundary as
|
|
10
|
-
import
|
|
11
|
-
import { Icon as
|
|
12
|
-
import
|
|
1
|
+
import { jsx as t, jsxs as h, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { styled as K, useTheme as me } from "@arcblock/ux/lib/Theme";
|
|
3
|
+
import Ye from "@mui/material/styles/createTheme";
|
|
4
|
+
import Ze from "@mui/material/styles/ThemeProvider";
|
|
5
|
+
import Je from "lodash/merge";
|
|
6
|
+
import { ErrorFallback as fe } from "@arcblock/ux/lib/ErrorBoundary";
|
|
7
|
+
import y from "@mui/material/Box";
|
|
8
|
+
import P from "@mui/material/Stack";
|
|
9
|
+
import { ErrorBoundary as et } from "react-error-boundary";
|
|
10
|
+
import tt from "@iconify-icons/tabler/compass";
|
|
11
|
+
import { Icon as Ae } from "@iconify/react";
|
|
12
|
+
import ge from "@mui/icons-material/Close";
|
|
13
13
|
import w from "@mui/material/Typography";
|
|
14
|
-
import { createContext as
|
|
15
|
-
import { createAxios as
|
|
16
|
-
import
|
|
17
|
-
import { useRequest as
|
|
18
|
-
import
|
|
14
|
+
import { createContext as Fe, useState as E, useMemo as H, useContext as Ee, useCallback as he, useEffect as U, forwardRef as rt, useRef as pe, memo as ot } from "react";
|
|
15
|
+
import { createAxios as Le } from "@blocklet/js-sdk";
|
|
16
|
+
import nt from "lodash/orderBy";
|
|
17
|
+
import { useRequest as ee, useDebounceFn as Oe, useInfiniteScroll as lt, useReactive as it } from "ahooks";
|
|
18
|
+
import ne from "lodash/omitBy";
|
|
19
19
|
import "color";
|
|
20
20
|
import "lodash/cloneDeep";
|
|
21
|
-
import { parseURL as
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
21
|
+
import { parseURL as at, parseQuery as st, parseFilename as ct, stringifyParsedURL as dt, withQuery as xe, joinURL as ke } from "ufo";
|
|
22
|
+
import ve from "flat";
|
|
23
|
+
import te from "@mui/material/Button";
|
|
24
|
+
import ut from "@mui/material/styles/useTheme";
|
|
25
|
+
import j from "@mui/material/useMediaQuery";
|
|
26
|
+
import ht from "@mui/material/Drawer";
|
|
27
|
+
import _e from "@mui/material/Checkbox";
|
|
28
|
+
import ze from "@mui/material/FormControlLabel";
|
|
29
|
+
import pt from "@mui/icons-material/Check";
|
|
30
|
+
import mt from "@mui/icons-material/KeyboardArrowDown";
|
|
31
|
+
import ft from "@mui/material/ClickAwayListener";
|
|
32
|
+
import gt from "@mui/material/Grow";
|
|
33
|
+
import Me from "@mui/material/MenuItem";
|
|
34
|
+
import Ne from "@mui/material/MenuList";
|
|
35
|
+
import xt from "@mui/material/Paper";
|
|
36
|
+
import yt from "@mui/material/Popper";
|
|
37
|
+
import wt from "@mui/material/SvgIcon";
|
|
38
|
+
import bt from "lodash/isEmpty";
|
|
39
|
+
import re from "@mui/material/CircularProgress";
|
|
40
|
+
import De from "@arcblock/ux/lib/Avatar";
|
|
41
|
+
import kt from "@iconify-icons/tabler/cloud-download";
|
|
42
|
+
import vt from "@mui/icons-material/ChevronLeft";
|
|
43
|
+
import Ct from "@mui/icons-material/ChevronRight";
|
|
44
|
+
import z from "@mui/material/Skeleton";
|
|
45
|
+
import St from "react-image-gallery";
|
|
46
|
+
import It from "@arcblock/ux/lib/Img";
|
|
47
47
|
import "react-image-gallery/styles/css/image-gallery.css";
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
import
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import Me from "@mui/material/OutlinedInput";
|
|
48
|
+
import Ce from "@mui/material/Grid";
|
|
49
|
+
import Bt from "react-infinite-scroll-hook";
|
|
50
|
+
import Se from "@mui/material/Chip";
|
|
51
|
+
import J from "@mui/icons-material/Search";
|
|
52
|
+
import Rt from "@mui/material/Autocomplete";
|
|
53
|
+
import Tt from "@mui/material/Dialog";
|
|
54
|
+
import We from "@mui/material/OutlinedInput";
|
|
56
55
|
import Pt from "@mui/material/TextField";
|
|
57
|
-
import { useHotkeys as
|
|
58
|
-
import
|
|
59
|
-
import
|
|
60
|
-
import
|
|
56
|
+
import { useHotkeys as At } from "react-hotkeys-hook";
|
|
57
|
+
import Ie from "@mui/material/InputAdornment";
|
|
58
|
+
import Ft from "@arcblock/ux/lib/Empty";
|
|
59
|
+
import Et from "json-stable-stringify";
|
|
61
60
|
import Lt from "@mui/icons-material/Menu";
|
|
62
|
-
|
|
61
|
+
import { Card as Ot, Box as le, Skeleton as O } from "@mui/material";
|
|
62
|
+
const $e = Fe({
|
|
63
63
|
open: !1,
|
|
64
64
|
toggleOpen: (e) => {
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
-
function
|
|
68
|
-
const [r, o] =
|
|
67
|
+
function _t({ children: e }) {
|
|
68
|
+
const [r, o] = E(!1), n = (a) => {
|
|
69
69
|
o(a ?? !a);
|
|
70
|
-
}, i =
|
|
71
|
-
return /* @__PURE__ */ t(
|
|
70
|
+
}, i = H(() => ({ open: r, toggleOpen: n }), [r]);
|
|
71
|
+
return /* @__PURE__ */ t($e.Provider, { value: i, children: e });
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
return
|
|
73
|
+
function ye() {
|
|
74
|
+
return Ee($e);
|
|
75
75
|
}
|
|
76
|
-
const
|
|
76
|
+
const T = {
|
|
77
77
|
nameAsc: "title",
|
|
78
78
|
nameDesc: "title",
|
|
79
79
|
popularity: "stats.downloads",
|
|
@@ -87,14 +87,14 @@ const P = {
|
|
|
87
87
|
explorePath: "/api/blocklets/explore",
|
|
88
88
|
exploreDidsPath: "/api/blocklets/dids",
|
|
89
89
|
cacheSize: 100
|
|
90
|
-
},
|
|
90
|
+
}, zt = (e) => ee(
|
|
91
91
|
async () => {
|
|
92
|
-
const { data: r } = await e.get(
|
|
92
|
+
const { data: r } = await e.get(T.categoriesPath);
|
|
93
93
|
return Array.isArray(r) ? r : [];
|
|
94
94
|
},
|
|
95
95
|
{ manual: !0 }
|
|
96
96
|
);
|
|
97
|
-
function
|
|
97
|
+
function Mt(e, r) {
|
|
98
98
|
const o = { sortBy: "popularity", sortDirection: "desc", ...e }, {
|
|
99
99
|
onFilterChange: n,
|
|
100
100
|
onSearchSelect: i = (l) => {
|
|
@@ -104,17 +104,17 @@ function Et(e, r) {
|
|
|
104
104
|
} = r;
|
|
105
105
|
!o.category && !a && (o.category = "All");
|
|
106
106
|
const c = (l) => {
|
|
107
|
-
const
|
|
108
|
-
n(
|
|
107
|
+
const p = { ...o, ...l };
|
|
108
|
+
n(ne(p, (d) => d === "" || d === void 0));
|
|
109
109
|
};
|
|
110
110
|
return {
|
|
111
111
|
filters: e,
|
|
112
112
|
cleanFilter: (l) => {
|
|
113
|
-
const
|
|
114
|
-
n(
|
|
113
|
+
const p = l ? ne(o, (d, g) => l.includes(g)) : {};
|
|
114
|
+
n(ne(p, (d) => d === "" || d === void 0));
|
|
115
115
|
},
|
|
116
|
-
handleSort: (l,
|
|
117
|
-
c({ sortBy: l, sortDirection:
|
|
116
|
+
handleSort: (l, p) => {
|
|
117
|
+
c({ sortBy: l, sortDirection: p || l === "nameAsc" ? "asc" : "desc" });
|
|
118
118
|
},
|
|
119
119
|
handleKeyword: (l) => {
|
|
120
120
|
c({ category: void 0, keyword: l || void 0 });
|
|
@@ -139,7 +139,7 @@ function Et(e, r) {
|
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
const
|
|
142
|
+
const Nt = (e, r, o) => e && r || !o, je = (e) => [
|
|
143
143
|
{
|
|
144
144
|
name: e("sort.popularity"),
|
|
145
145
|
value: "popularity"
|
|
@@ -152,25 +152,25 @@ const zt = (e, r, o) => e && r || !o, De = (e) => [
|
|
|
152
152
|
// name: t('sort.rating'),
|
|
153
153
|
// value: 'rating',
|
|
154
154
|
// },
|
|
155
|
-
],
|
|
155
|
+
], He = (e, r, o) => {
|
|
156
156
|
var d, g;
|
|
157
|
-
const n =
|
|
158
|
-
if ((d =
|
|
159
|
-
return i.imageFilter ?
|
|
157
|
+
const n = at(e), i = st(n.search);
|
|
158
|
+
if ((d = ct(e, { strict: !0 })) == null ? void 0 : d.endsWith(".gif"))
|
|
159
|
+
return i.imageFilter ? dt({ ...n, search: "" }) : e;
|
|
160
160
|
if (i.imageFilter)
|
|
161
161
|
return e;
|
|
162
|
-
const c = o || ((g = window.blocklet) == null ? void 0 : g.version), { w: l, h } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
|
|
163
|
-
return
|
|
164
|
-
...l ||
|
|
162
|
+
const c = o || ((g = window.blocklet) == null ? void 0 : g.version), { w: l, h: p } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
|
|
163
|
+
return xe(e, {
|
|
164
|
+
...l || p ? { imageFilter: "resize", w: l, h: p } : {},
|
|
165
165
|
v: c
|
|
166
166
|
});
|
|
167
|
-
},
|
|
167
|
+
}, Dt = (e) => [
|
|
168
168
|
{ name: e("blocklet.free"), value: "free" },
|
|
169
169
|
{ name: e("blocklet.payment"), value: "payment" }
|
|
170
|
-
],
|
|
170
|
+
], Wt = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), $t = (e, r) => (
|
|
171
171
|
// eslint-disable-next-line no-prototype-builtins
|
|
172
172
|
e == null ? void 0 : e.replace(/{(\w*)}/g, (o, n) => r.hasOwnProperty(n) ? r[n] : "")
|
|
173
|
-
),
|
|
173
|
+
), jt = () => window.innerWidth <= 600, Ht = {
|
|
174
174
|
common: {
|
|
175
175
|
title: "Blocklet Store",
|
|
176
176
|
searchStore: "Search Blocklet",
|
|
@@ -206,6 +206,8 @@ const zt = (e, r, o) => e && r || !o, De = (e) => [
|
|
|
206
206
|
noResults: "No blocklet found.",
|
|
207
207
|
free: "Free",
|
|
208
208
|
search: 'Results for "{keyword}"',
|
|
209
|
+
authorTag: "Blocklet by {name}",
|
|
210
|
+
resourceTag: "Extensions for {name}",
|
|
209
211
|
resultCount: "{count} Blocklets",
|
|
210
212
|
emptyTip: "Tips:",
|
|
211
213
|
filterTip: "Appropriately reduce the filter conditions",
|
|
@@ -219,7 +221,7 @@ const zt = (e, r, o) => e && r || !o, De = (e) => [
|
|
|
219
221
|
autocomplete: {
|
|
220
222
|
expandResult: 'View all search results for "{name}"'
|
|
221
223
|
}
|
|
222
|
-
},
|
|
224
|
+
}, Ut = {
|
|
223
225
|
common: {
|
|
224
226
|
title: "Blocklet 商店",
|
|
225
227
|
searchStore: "搜索 Blocklet",
|
|
@@ -255,6 +257,8 @@ const zt = (e, r, o) => e && r || !o, De = (e) => [
|
|
|
255
257
|
noResults: "未搜索到 Blocklet",
|
|
256
258
|
free: "免费",
|
|
257
259
|
search: '搜索 "{keyword}" 的结果',
|
|
260
|
+
authorTag: "{name} 的 Blocklet",
|
|
261
|
+
resourceTag: "{name} 的拓展",
|
|
258
262
|
resultCount: "{count} 个 Blocklet",
|
|
259
263
|
emptyTip: "建议:",
|
|
260
264
|
filterTip: "适当减少筛选条件",
|
|
@@ -268,16 +272,16 @@ const zt = (e, r, o) => e && r || !o, De = (e) => [
|
|
|
268
272
|
autocomplete: {
|
|
269
273
|
expandResult: "查看 “{name}” 的所有搜索结果"
|
|
270
274
|
}
|
|
271
|
-
},
|
|
272
|
-
en:
|
|
273
|
-
zh:
|
|
274
|
-
},
|
|
275
|
+
}, ie = {
|
|
276
|
+
en: ve(Ht),
|
|
277
|
+
zh: ve(Ut)
|
|
278
|
+
}, Ue = (e, r) => {
|
|
275
279
|
const o = {};
|
|
276
280
|
return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
|
|
277
|
-
},
|
|
278
|
-
const n =
|
|
279
|
-
return
|
|
280
|
-
},
|
|
281
|
+
}, Vt = (e) => (r, o) => {
|
|
282
|
+
const n = ie[e] ? ie[e][r] : ie.en[r];
|
|
283
|
+
return $t(n, o) || r;
|
|
284
|
+
}, Ve = {
|
|
281
285
|
errors: {
|
|
282
286
|
fetchCategoriesError: null
|
|
283
287
|
},
|
|
@@ -329,8 +333,8 @@ const zt = (e, r, o) => e && r || !o, De = (e) => [
|
|
|
329
333
|
handlePage: () => {
|
|
330
334
|
}
|
|
331
335
|
}
|
|
332
|
-
},
|
|
333
|
-
function
|
|
336
|
+
}, Ge = Fe(Ve), { Provider: Gt, Consumer: Ro } = Ge;
|
|
337
|
+
function qt(e) {
|
|
334
338
|
const {
|
|
335
339
|
locale: r = "zh",
|
|
336
340
|
filters: o = {},
|
|
@@ -340,35 +344,35 @@ function Vt(e) {
|
|
|
340
344
|
minItemWidth: a = 350,
|
|
341
345
|
queryFilter: c = !0,
|
|
342
346
|
layout: l = {},
|
|
343
|
-
wrapChildren:
|
|
347
|
+
wrapChildren: p = (R) => R,
|
|
344
348
|
extraFilter: d = (R) => R,
|
|
345
349
|
baseSearch: g = !1,
|
|
346
|
-
fetchCategoryDelay:
|
|
350
|
+
fetchCategoryDelay: m = 0,
|
|
347
351
|
showResourcesSwitch: f = !1,
|
|
348
352
|
showCategory: k = !0,
|
|
349
|
-
tagFilters:
|
|
350
|
-
children:
|
|
351
|
-
storeVersion:
|
|
353
|
+
tagFilters: S = [],
|
|
354
|
+
children: B,
|
|
355
|
+
storeVersion: v,
|
|
352
356
|
onSearchSelect: u = () => {
|
|
353
357
|
},
|
|
354
|
-
endpoint:
|
|
355
|
-
blockletRender:
|
|
356
|
-
} = e, A =
|
|
357
|
-
data:
|
|
358
|
-
error:
|
|
359
|
-
loading:
|
|
360
|
-
run:
|
|
361
|
-
} =
|
|
362
|
-
const R =
|
|
358
|
+
endpoint: C,
|
|
359
|
+
blockletRender: x
|
|
360
|
+
} = e, A = Ue(n, v), F = H(() => Le({ baseURL: C, headers: A }), [C]), L = Mt(o, { onFilterChange: i, emptyCategory: !l.showExplore, onSearchSelect: u }), [M, V] = E(""), {
|
|
361
|
+
data: G = [],
|
|
362
|
+
error: oe,
|
|
363
|
+
loading: X,
|
|
364
|
+
run: Q
|
|
365
|
+
} = zt(F), $ = H(() => {
|
|
366
|
+
const R = nt(G, [(D) => D.name], ["asc"]), _ = R.findIndex((D) => D.name === "All" || D.locales.en === "All");
|
|
363
367
|
return _ > -1 ? [{ ...R[_], _id: "All" }, ...R.slice(0, _), ...R.slice(_ + 1)] : R;
|
|
364
|
-
}, [
|
|
365
|
-
search:
|
|
366
|
-
errors: { fetchCategoriesError:
|
|
368
|
+
}, [G]), q = he(Vt(r), [r]), s = H(() => Wt($, r), [$, r]), b = Dt(q), N = {
|
|
369
|
+
search: L,
|
|
370
|
+
errors: { fetchCategoriesError: oe },
|
|
367
371
|
loadings: {
|
|
368
|
-
fetchCategoriesLoading:
|
|
372
|
+
fetchCategoriesLoading: X
|
|
369
373
|
},
|
|
370
374
|
extraFilter: d,
|
|
371
|
-
endpoint:
|
|
375
|
+
endpoint: C,
|
|
372
376
|
queryFilter: c,
|
|
373
377
|
layout: {
|
|
374
378
|
showExplore: l.showExplore ?? !1,
|
|
@@ -377,13 +381,13 @@ function Vt(e) {
|
|
|
377
381
|
showSearch: l.showSearch ?? !0
|
|
378
382
|
},
|
|
379
383
|
minItemWidth: a,
|
|
380
|
-
wrapChildren:
|
|
381
|
-
t:
|
|
382
|
-
storeVersion:
|
|
384
|
+
wrapChildren: p,
|
|
385
|
+
t: q,
|
|
386
|
+
storeVersion: v,
|
|
383
387
|
serverVersion: n,
|
|
384
|
-
selectedCategory:
|
|
385
|
-
categoryList:
|
|
386
|
-
blockletRender:
|
|
388
|
+
selectedCategory: L.filters.category || (l.showExplore ? "" : "All"),
|
|
389
|
+
categoryList: $,
|
|
390
|
+
blockletRender: x,
|
|
387
391
|
locale: r,
|
|
388
392
|
categoryOptions: s,
|
|
389
393
|
priceOptions: b,
|
|
@@ -391,35 +395,35 @@ function Vt(e) {
|
|
|
391
395
|
baseSearch: g,
|
|
392
396
|
showResourcesSwitch: f,
|
|
393
397
|
showCategory: k,
|
|
394
|
-
tagFilters:
|
|
398
|
+
tagFilters: S,
|
|
395
399
|
onFilterChange: i,
|
|
396
400
|
getCategoryLocale: (R) => {
|
|
397
401
|
if (!R)
|
|
398
402
|
return null;
|
|
399
|
-
const _ =
|
|
403
|
+
const _ = G.find((D) => D._id === R || D.locales.en === "All");
|
|
400
404
|
return _ ? _.locales[r] || _.locales.en : null;
|
|
401
405
|
},
|
|
402
406
|
get developerName() {
|
|
403
|
-
return
|
|
407
|
+
return M;
|
|
404
408
|
},
|
|
405
|
-
updateDeveloperName:
|
|
409
|
+
updateDeveloperName: V
|
|
406
410
|
};
|
|
407
|
-
return
|
|
408
|
-
setTimeout(
|
|
409
|
-
}, [
|
|
411
|
+
return U(() => {
|
|
412
|
+
setTimeout(Q, m || 0);
|
|
413
|
+
}, [C, Q, m]), /* @__PURE__ */ t(Gt, { value: N, children: B });
|
|
410
414
|
}
|
|
411
415
|
function I() {
|
|
412
|
-
const e =
|
|
413
|
-
return e ||
|
|
416
|
+
const e = Ee(Ge);
|
|
417
|
+
return e || Ve;
|
|
414
418
|
}
|
|
415
|
-
function
|
|
419
|
+
function qe({
|
|
416
420
|
children: e,
|
|
417
421
|
onClick: r,
|
|
418
422
|
size: o = 32,
|
|
419
423
|
...n
|
|
420
424
|
}) {
|
|
421
425
|
return /* @__PURE__ */ t(
|
|
422
|
-
|
|
426
|
+
te,
|
|
423
427
|
{
|
|
424
428
|
...n,
|
|
425
429
|
onClick: r,
|
|
@@ -442,10 +446,10 @@ function Ue({
|
|
|
442
446
|
}
|
|
443
447
|
);
|
|
444
448
|
}
|
|
445
|
-
function
|
|
449
|
+
function Y(e, r) {
|
|
446
450
|
return e === void 0 ? r : e;
|
|
447
451
|
}
|
|
448
|
-
function
|
|
452
|
+
function we({
|
|
449
453
|
xs: e,
|
|
450
454
|
sm: r,
|
|
451
455
|
md: o,
|
|
@@ -453,86 +457,86 @@ function ye({
|
|
|
453
457
|
xl: i,
|
|
454
458
|
exact: a
|
|
455
459
|
}) {
|
|
456
|
-
const c =
|
|
460
|
+
const c = ut(), l = j(c.breakpoints.down("sm")), p = j(c.breakpoints.between("sm", "md")), d = j(c.breakpoints.between("md", "lg")), g = j(c.breakpoints.between("lg", "xl"));
|
|
457
461
|
if (a)
|
|
458
|
-
return l ? e || null :
|
|
459
|
-
let
|
|
460
|
-
return l || (
|
|
462
|
+
return l ? e || null : p ? r || null : d ? o || null : g ? n || null : i || null;
|
|
463
|
+
let m = e;
|
|
464
|
+
return l || (m = Y(r, m), p) || (m = Y(o, m), d) || (m = Y(n, m), g) ? m : Y(i, m);
|
|
461
465
|
}
|
|
462
|
-
function
|
|
463
|
-
const { open: r, toggleOpen: o } =
|
|
466
|
+
function Kt({ children: e }) {
|
|
467
|
+
const { open: r, toggleOpen: o } = ye();
|
|
464
468
|
return /* @__PURE__ */ t(
|
|
465
|
-
|
|
469
|
+
we,
|
|
466
470
|
{
|
|
467
|
-
xs: /* @__PURE__ */ t(
|
|
468
|
-
md: /* @__PURE__ */ t(
|
|
471
|
+
xs: /* @__PURE__ */ t(ht, { open: r, onClose: () => o(!1), children: e }),
|
|
472
|
+
md: /* @__PURE__ */ t(y, { children: e })
|
|
469
473
|
}
|
|
470
474
|
);
|
|
471
475
|
}
|
|
472
|
-
const
|
|
473
|
-
|
|
476
|
+
const Xt = rt(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
|
|
477
|
+
te,
|
|
474
478
|
{
|
|
475
479
|
ref: n,
|
|
476
480
|
disableElevation: !0,
|
|
477
481
|
disabled: r || e,
|
|
478
482
|
...o,
|
|
479
483
|
sx: [{ borderRadius: "4px" }, ...Array.isArray(o.sx) ? o.sx : [o.sx]],
|
|
480
|
-
startIcon: e && /* @__PURE__ */ t(
|
|
484
|
+
startIcon: e && /* @__PURE__ */ t(re, { size: "1em" })
|
|
481
485
|
}
|
|
482
486
|
));
|
|
483
|
-
function
|
|
484
|
-
var
|
|
485
|
-
const a =
|
|
486
|
-
|
|
487
|
+
function Ke({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
|
|
488
|
+
var v;
|
|
489
|
+
const a = pe(null), c = me(), [l, p] = E(!1), [d, g] = E(e !== null ? e : ""), m = j(c.breakpoints.down("sm"));
|
|
490
|
+
U(() => {
|
|
487
491
|
g(e !== null ? e : "");
|
|
488
492
|
}, [e]);
|
|
489
|
-
const f =
|
|
490
|
-
|
|
491
|
-
}, []), k =
|
|
492
|
-
|
|
493
|
+
const f = he(() => {
|
|
494
|
+
p(!1);
|
|
495
|
+
}, []), k = he(() => {
|
|
496
|
+
p(!0);
|
|
493
497
|
}, []);
|
|
494
|
-
function C(u) {
|
|
495
|
-
g(u.value), o(u.value), p && f();
|
|
496
|
-
}
|
|
497
498
|
function S(u) {
|
|
499
|
+
g(u.value), o(u.value), m && f();
|
|
500
|
+
}
|
|
501
|
+
function B(u) {
|
|
498
502
|
return u === d;
|
|
499
503
|
}
|
|
500
|
-
return /* @__PURE__ */
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
|
|
504
|
+
return /* @__PURE__ */ h(W, { children: [
|
|
505
|
+
/* @__PURE__ */ h(
|
|
506
|
+
Qt,
|
|
503
507
|
{
|
|
504
508
|
ref: a,
|
|
505
509
|
onClick: k,
|
|
506
510
|
variant: "outlined",
|
|
507
511
|
size: "small",
|
|
508
|
-
className: ["my-select__selector",
|
|
512
|
+
className: ["my-select__selector", bt(d) ? "" : "my-select__selector--active"].join(" "),
|
|
509
513
|
sx: { minWidth: "auto", color: "text.primary" },
|
|
510
514
|
...i,
|
|
511
515
|
children: [
|
|
512
|
-
((
|
|
513
|
-
/* @__PURE__ */ t(
|
|
516
|
+
((v = r.find((u) => u.value === d)) == null ? void 0 : v.name) || n,
|
|
517
|
+
/* @__PURE__ */ t(wt, { className: "my-select__arrowdown", component: mt, fontSize: "small" })
|
|
514
518
|
]
|
|
515
519
|
}
|
|
516
520
|
),
|
|
517
|
-
/* @__PURE__ */ t(
|
|
518
|
-
|
|
521
|
+
/* @__PURE__ */ t(yt, { open: l, anchorEl: a.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: u, placement: C }) => /* @__PURE__ */ t(
|
|
522
|
+
gt,
|
|
519
523
|
{
|
|
520
524
|
...u,
|
|
521
|
-
style: { transformOrigin:
|
|
522
|
-
children: /* @__PURE__ */ t(
|
|
525
|
+
style: { transformOrigin: C === "bottom" ? "center top" : "center bottom" },
|
|
526
|
+
children: /* @__PURE__ */ t(xt, { children: /* @__PURE__ */ t(ft, { onClickAway: f, children: /* @__PURE__ */ t(Yt, { autoFocusItem: l, onMouseEnter: k, onMouseLeave: f, children: r.map((x) => /* @__PURE__ */ h(Me, { onClick: () => S(x), children: [
|
|
523
527
|
/* @__PURE__ */ t(
|
|
524
|
-
|
|
528
|
+
pt,
|
|
525
529
|
{
|
|
526
|
-
sx: { mr: 1, fontSize: 16, visibility:
|
|
530
|
+
sx: { mr: 1, fontSize: 16, visibility: B(x.value) ? "visible" : "hidden" }
|
|
527
531
|
}
|
|
528
532
|
),
|
|
529
|
-
|
|
530
|
-
] },
|
|
533
|
+
x.name
|
|
534
|
+
] }, x.value)) }) }) })
|
|
531
535
|
}
|
|
532
536
|
) })
|
|
533
537
|
] });
|
|
534
538
|
}
|
|
535
|
-
const
|
|
539
|
+
const Qt = K(Xt)`
|
|
536
540
|
border: 1px solid #f0f0f0;
|
|
537
541
|
padding: 6px 8px 6px 12px;
|
|
538
542
|
font-weight: ${(e) => e.theme.typography.fontWeightRegular};
|
|
@@ -560,7 +564,7 @@ const Kt = q(qt)`
|
|
|
560
564
|
margin-right: 3px;
|
|
561
565
|
}
|
|
562
566
|
}
|
|
563
|
-
`,
|
|
567
|
+
`, Yt = K(Ne)`
|
|
564
568
|
.my-select__option__icon {
|
|
565
569
|
color: transparent;
|
|
566
570
|
font-size: 14px;
|
|
@@ -577,10 +581,10 @@ const Kt = q(qt)`
|
|
|
577
581
|
}
|
|
578
582
|
}
|
|
579
583
|
`;
|
|
580
|
-
function
|
|
581
|
-
const { search: e, t: r } = I(), { filters: o, handleSort: n, handlePrice: i } = e, a =
|
|
582
|
-
return /* @__PURE__ */
|
|
583
|
-
|
|
584
|
+
function Xe() {
|
|
585
|
+
const { search: e, t: r } = I(), { filters: o, handleSort: n, handlePrice: i } = e, a = je(r);
|
|
586
|
+
return /* @__PURE__ */ h(
|
|
587
|
+
P,
|
|
584
588
|
{
|
|
585
589
|
direction: { xs: "row", md: "column" },
|
|
586
590
|
alignItems: { xs: "center", md: "flex-start" },
|
|
@@ -589,10 +593,10 @@ function Ge() {
|
|
|
589
593
|
justifyContent: "space-between",
|
|
590
594
|
children: [
|
|
591
595
|
/* @__PURE__ */ t(
|
|
592
|
-
|
|
596
|
+
ze,
|
|
593
597
|
{
|
|
594
598
|
control: /* @__PURE__ */ t(
|
|
595
|
-
|
|
599
|
+
_e,
|
|
596
600
|
{
|
|
597
601
|
checked: o.price === "free",
|
|
598
602
|
size: "small",
|
|
@@ -604,7 +608,7 @@ function Ge() {
|
|
|
604
608
|
}
|
|
605
609
|
),
|
|
606
610
|
/* @__PURE__ */ t(
|
|
607
|
-
|
|
611
|
+
Ke,
|
|
608
612
|
{
|
|
609
613
|
value: o.sortBy || a[0].value,
|
|
610
614
|
options: a,
|
|
@@ -616,18 +620,18 @@ function Ge() {
|
|
|
616
620
|
}
|
|
617
621
|
);
|
|
618
622
|
}
|
|
619
|
-
function
|
|
620
|
-
const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings: i, layout: a, baseSearch: c } = I(), { filters: l, handleCategory:
|
|
621
|
-
|
|
623
|
+
function Zt() {
|
|
624
|
+
const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings: i, layout: a, baseSearch: c } = I(), { filters: l, handleCategory: p, cleanFilter: d } = r, { toggleOpen: g } = ye();
|
|
625
|
+
U(() => {
|
|
622
626
|
g(!1);
|
|
623
627
|
}, [Object.values(l).join("")]);
|
|
624
|
-
const
|
|
625
|
-
return a.showCategory ? /* @__PURE__ */
|
|
628
|
+
const m = Nt(c, a.showSearch, l.keyword);
|
|
629
|
+
return a.showCategory ? /* @__PURE__ */ h(Kt, { children: [
|
|
626
630
|
/* @__PURE__ */ t(
|
|
627
|
-
|
|
631
|
+
we,
|
|
628
632
|
{
|
|
629
|
-
xs: /* @__PURE__ */
|
|
630
|
-
|
|
633
|
+
xs: /* @__PURE__ */ h(
|
|
634
|
+
P,
|
|
631
635
|
{
|
|
632
636
|
direction: "row",
|
|
633
637
|
justifyContent: "space-between",
|
|
@@ -638,7 +642,7 @@ function Qt() {
|
|
|
638
642
|
borderBottom: 1,
|
|
639
643
|
borderColor: "divider",
|
|
640
644
|
children: [
|
|
641
|
-
/* @__PURE__ */ t(
|
|
645
|
+
/* @__PURE__ */ t(qe, { onClick: () => g(!1), children: /* @__PURE__ */ t(ge, {}) }),
|
|
642
646
|
/* @__PURE__ */ t(w, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: o("common.category") })
|
|
643
647
|
]
|
|
644
648
|
}
|
|
@@ -647,16 +651,16 @@ function Qt() {
|
|
|
647
651
|
}
|
|
648
652
|
),
|
|
649
653
|
/* @__PURE__ */ t(
|
|
650
|
-
|
|
654
|
+
P,
|
|
651
655
|
{
|
|
652
656
|
visibility: i.fetchCategoriesLoading ? "hidden" : "visible",
|
|
653
657
|
width: { xs: 268, md: 200 },
|
|
654
658
|
boxSizing: "content-box",
|
|
655
659
|
p: { xs: 2, md: 0 },
|
|
656
660
|
pr: { md: 6 },
|
|
657
|
-
children:
|
|
658
|
-
a.showExplore && /* @__PURE__ */
|
|
659
|
-
/* @__PURE__ */ t(
|
|
661
|
+
children: m ? /* @__PURE__ */ h(W, { children: [
|
|
662
|
+
a.showExplore && /* @__PURE__ */ h(y, { display: "flex", alignItems: "center", gap: 1, mb: 3, pb: 3, borderBottom: 1, borderColor: "divider", children: [
|
|
663
|
+
/* @__PURE__ */ t(Ae, { icon: tt }),
|
|
660
664
|
/* @__PURE__ */ t(
|
|
661
665
|
w,
|
|
662
666
|
{
|
|
@@ -671,7 +675,7 @@ function Qt() {
|
|
|
671
675
|
}
|
|
672
676
|
)
|
|
673
677
|
] }),
|
|
674
|
-
!!n.length && /* @__PURE__ */ t(
|
|
678
|
+
!!n.length && /* @__PURE__ */ t(P, { gap: 2, children: n.map((f) => /* @__PURE__ */ t(
|
|
675
679
|
w,
|
|
676
680
|
{
|
|
677
681
|
variant: "body1",
|
|
@@ -681,19 +685,19 @@ function Qt() {
|
|
|
681
685
|
color: e === f.value ? "text.primary" : "text.lighter",
|
|
682
686
|
textTransform: "capitalize",
|
|
683
687
|
onClick: () => {
|
|
684
|
-
e === f.value ? d() :
|
|
688
|
+
e === f.value ? d() : p(f.value), g(!1);
|
|
685
689
|
},
|
|
686
690
|
children: f.name
|
|
687
691
|
},
|
|
688
692
|
f.value
|
|
689
693
|
)) })
|
|
690
|
-
] }) : /* @__PURE__ */ t(
|
|
694
|
+
] }) : /* @__PURE__ */ t(Xe, {})
|
|
691
695
|
}
|
|
692
696
|
)
|
|
693
697
|
] }) : null;
|
|
694
698
|
}
|
|
695
|
-
function
|
|
696
|
-
const { endpoint: e, serverVersion: r, storeVersion: o } = I(), n =
|
|
699
|
+
function be() {
|
|
700
|
+
const { endpoint: e, serverVersion: r, storeVersion: o } = I(), n = Ue(r, o), i = H(() => Le({
|
|
697
701
|
baseURL: e,
|
|
698
702
|
headers: n
|
|
699
703
|
}), [e]);
|
|
@@ -708,19 +712,19 @@ function xe() {
|
|
|
708
712
|
}
|
|
709
713
|
};
|
|
710
714
|
}
|
|
711
|
-
const
|
|
712
|
-
return /* @__PURE__ */ t(
|
|
715
|
+
const Qe = ot(function(r) {
|
|
716
|
+
return /* @__PURE__ */ t(y, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(re, {}) });
|
|
713
717
|
});
|
|
714
|
-
function
|
|
715
|
-
return e ? /* @__PURE__ */ t(
|
|
718
|
+
function Jt({ showSkeleton: e, ...r }) {
|
|
719
|
+
return e ? /* @__PURE__ */ t(z, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(It, { ...r });
|
|
716
720
|
}
|
|
717
|
-
function
|
|
721
|
+
function Be({
|
|
718
722
|
icon: e,
|
|
719
723
|
children: r,
|
|
720
724
|
maxWidth: o = 100,
|
|
721
725
|
title: n
|
|
722
726
|
}) {
|
|
723
|
-
return (r === 0 || r) && /* @__PURE__ */
|
|
727
|
+
return (r === 0 || r) && /* @__PURE__ */ h(P, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
|
|
724
728
|
e,
|
|
725
729
|
/* @__PURE__ */ t(
|
|
726
730
|
w,
|
|
@@ -734,18 +738,18 @@ function Ce({
|
|
|
734
738
|
)
|
|
735
739
|
] });
|
|
736
740
|
}
|
|
737
|
-
const
|
|
738
|
-
function
|
|
739
|
-
var
|
|
740
|
-
const { t: e, search: r } = I(), { get: o } =
|
|
741
|
+
const ae = 292, er = 210, tr = 338;
|
|
742
|
+
function rr() {
|
|
743
|
+
var B, v;
|
|
744
|
+
const { t: e, search: r } = I(), { get: o } = be(), n = me(), i = j(n.breakpoints.down("md")), a = ((v = (B = window.blocklet) == null ? void 0 : B.preferences) == null ? void 0 : v.homeBanner) || [], {
|
|
741
745
|
data: c = [],
|
|
742
746
|
error: l,
|
|
743
|
-
loading:
|
|
744
|
-
} =
|
|
747
|
+
loading: p
|
|
748
|
+
} = ee(async () => {
|
|
745
749
|
const u = await o(
|
|
746
|
-
|
|
750
|
+
xe(T.blockletsPath, { didList: a.map((C) => C.did).join(",") })
|
|
747
751
|
);
|
|
748
|
-
return u != null && u.dataList ? a.map((
|
|
752
|
+
return u != null && u.dataList ? a.map((C) => u.dataList.find((x) => x.did === C.did)) : [];
|
|
749
753
|
});
|
|
750
754
|
l && console.error("Get Banner Blocklets error:", l);
|
|
751
755
|
const d = {
|
|
@@ -756,31 +760,31 @@ function er() {
|
|
|
756
760
|
cursor: "pointer",
|
|
757
761
|
color: "text.lighter"
|
|
758
762
|
};
|
|
759
|
-
return !l && a.length > 0 ? /* @__PURE__ */
|
|
763
|
+
return !l && a.length > 0 ? /* @__PURE__ */ h(W, { children: [
|
|
760
764
|
/* @__PURE__ */ t(w, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
|
|
761
765
|
/* @__PURE__ */ t(
|
|
762
|
-
|
|
766
|
+
y,
|
|
763
767
|
{
|
|
764
|
-
height: { xs: "auto", md:
|
|
768
|
+
height: { xs: "auto", md: ae },
|
|
765
769
|
position: "relative",
|
|
766
770
|
border: 1,
|
|
767
771
|
borderColor: "divider",
|
|
768
772
|
borderRadius: 3,
|
|
769
773
|
overflow: "hidden",
|
|
770
|
-
children:
|
|
771
|
-
/* @__PURE__ */ t(
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */ t(
|
|
774
|
-
/* @__PURE__ */ t(
|
|
775
|
-
/* @__PURE__ */ t(
|
|
776
|
-
/* @__PURE__ */
|
|
777
|
-
/* @__PURE__ */ t(
|
|
778
|
-
/* @__PURE__ */ t(
|
|
774
|
+
children: p ? /* @__PURE__ */ h(y, { p: 5, display: "flex", gap: 5, height: ae, alignItems: "center", justifyContent: "center", children: [
|
|
775
|
+
/* @__PURE__ */ t(z, { variant: "rounded", height: er, width: tr }),
|
|
776
|
+
/* @__PURE__ */ h(y, { flex: 1, height: "100%", children: [
|
|
777
|
+
/* @__PURE__ */ t(z, { variant: "text", height: 50, width: 100 }),
|
|
778
|
+
/* @__PURE__ */ t(z, { variant: "text", height: 40, width: "100%" }),
|
|
779
|
+
/* @__PURE__ */ t(z, { variant: "text", height: 40, width: 300 }),
|
|
780
|
+
/* @__PURE__ */ h(y, { display: "flex", gap: 1, my: 2, children: [
|
|
781
|
+
/* @__PURE__ */ t(z, { variant: "circular", height: 20, width: 20 }),
|
|
782
|
+
/* @__PURE__ */ t(z, { variant: "text", height: 20, width: 50 })
|
|
779
783
|
] }),
|
|
780
|
-
/* @__PURE__ */ t(
|
|
784
|
+
/* @__PURE__ */ t(z, { variant: "rounded", height: 30, width: 100 })
|
|
781
785
|
] })
|
|
782
786
|
] }) : /* @__PURE__ */ t(
|
|
783
|
-
|
|
787
|
+
St,
|
|
784
788
|
{
|
|
785
789
|
showNav: !0,
|
|
786
790
|
autoPlay: !0,
|
|
@@ -791,17 +795,17 @@ function er() {
|
|
|
791
795
|
showBullets: !1,
|
|
792
796
|
showThumbnails: !1,
|
|
793
797
|
showFullscreenButton: !1,
|
|
794
|
-
renderLeftNav: (u) => /* @__PURE__ */ t(
|
|
795
|
-
renderRightNav: (u) => /* @__PURE__ */ t(
|
|
796
|
-
items: a.map((u,
|
|
798
|
+
renderLeftNav: (u) => /* @__PURE__ */ t(y, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(vt, { sx: { ...d, left: 5 } }) }),
|
|
799
|
+
renderRightNav: (u) => /* @__PURE__ */ t(y, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(Ct, { sx: { ...d, right: 5 } }) }),
|
|
800
|
+
items: a.map((u, C) => ({
|
|
797
801
|
original: u.did,
|
|
798
802
|
renderItem: () => {
|
|
799
|
-
var
|
|
800
|
-
const
|
|
801
|
-
return /* @__PURE__ */
|
|
802
|
-
|
|
803
|
+
var L;
|
|
804
|
+
const x = c[C] || {}, A = u.cover || nr(u.did, (L = x.screenshots) == null ? void 0 : L[0]), F = He(A, { h: 400, w: 700 });
|
|
805
|
+
return /* @__PURE__ */ h(
|
|
806
|
+
P,
|
|
803
807
|
{
|
|
804
|
-
height: { xs: "auto", md:
|
|
808
|
+
height: { xs: "auto", md: ae },
|
|
805
809
|
sx: {
|
|
806
810
|
cursor: "pointer",
|
|
807
811
|
"&::before": {
|
|
@@ -823,17 +827,17 @@ function er() {
|
|
|
823
827
|
justifyContent: "center",
|
|
824
828
|
alignItems: { xs: "flex-start", md: "center" },
|
|
825
829
|
p: { xs: 2, md: 5 },
|
|
826
|
-
onClick: () => r.handleSearchSelect(
|
|
830
|
+
onClick: () => r.handleSearchSelect(x),
|
|
827
831
|
gap: { xs: 2, md: 5 },
|
|
828
832
|
children: [
|
|
829
833
|
g(F),
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
832
|
-
|
|
833
|
-
f(u.desc ||
|
|
834
|
+
/* @__PURE__ */ h(P, { flex: 1, height: "100%", gap: 3, children: [
|
|
835
|
+
/* @__PURE__ */ h(y, { flex: 1, children: [
|
|
836
|
+
m(u.name || x.title || u.name),
|
|
837
|
+
f(u.desc || x.description)
|
|
834
838
|
] }),
|
|
835
|
-
|
|
836
|
-
|
|
839
|
+
x.did && k(x, u.baseNum),
|
|
840
|
+
S(x)
|
|
837
841
|
] })
|
|
838
842
|
]
|
|
839
843
|
}
|
|
@@ -846,10 +850,10 @@ function er() {
|
|
|
846
850
|
)
|
|
847
851
|
] }) : null;
|
|
848
852
|
function g(u) {
|
|
849
|
-
return /* @__PURE__ */ t(
|
|
850
|
-
|
|
853
|
+
return /* @__PURE__ */ t(y, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", position: "relative", children: /* @__PURE__ */ t(
|
|
854
|
+
Jt,
|
|
851
855
|
{
|
|
852
|
-
showSkeleton:
|
|
856
|
+
showSkeleton: p,
|
|
853
857
|
src: u,
|
|
854
858
|
alt: "",
|
|
855
859
|
width: i ? void 0 : 338,
|
|
@@ -858,7 +862,7 @@ function er() {
|
|
|
858
862
|
}
|
|
859
863
|
) });
|
|
860
864
|
}
|
|
861
|
-
function
|
|
865
|
+
function m(u) {
|
|
862
866
|
return /* @__PURE__ */ t(w, { variant: "h2", width: "100%", children: u });
|
|
863
867
|
}
|
|
864
868
|
function f(u) {
|
|
@@ -885,16 +889,16 @@ function er() {
|
|
|
885
889
|
}
|
|
886
890
|
);
|
|
887
891
|
}
|
|
888
|
-
function k(u,
|
|
889
|
-
const { did:
|
|
890
|
-
return /* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */ t(
|
|
892
|
-
/* @__PURE__ */ t(
|
|
892
|
+
function k(u, C = 0) {
|
|
893
|
+
const { did: x, owner: A, stats: F } = u;
|
|
894
|
+
return /* @__PURE__ */ h(y, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
|
|
895
|
+
/* @__PURE__ */ t(Be, { icon: /* @__PURE__ */ t(De, { src: A.avatar, did: x, size: 20, variant: "circle" }), children: A.fullName }),
|
|
896
|
+
/* @__PURE__ */ t(Be, { icon: /* @__PURE__ */ t(Ae, { icon: kt }), title: `${F.downloads + C}`, children: or(F.downloads + C) })
|
|
893
897
|
] });
|
|
894
898
|
}
|
|
895
|
-
function
|
|
899
|
+
function S(u) {
|
|
896
900
|
return /* @__PURE__ */ t(
|
|
897
|
-
|
|
901
|
+
te,
|
|
898
902
|
{
|
|
899
903
|
variant: "outlined",
|
|
900
904
|
size: "small",
|
|
@@ -912,32 +916,32 @@ function er() {
|
|
|
912
916
|
);
|
|
913
917
|
}
|
|
914
918
|
}
|
|
915
|
-
const
|
|
916
|
-
function
|
|
919
|
+
const or = (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`, nr = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
|
|
920
|
+
function lr({ title: e, blocklets: r }) {
|
|
917
921
|
const { blockletRender: o, serverVersion: n } = I();
|
|
918
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ h(y, { mt: 3, children: [
|
|
919
923
|
/* @__PURE__ */ t(w, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
920
|
-
/* @__PURE__ */ t(
|
|
924
|
+
/* @__PURE__ */ t(Ce, { container: !0, spacing: 2, children: r.map((i) => /* @__PURE__ */ t(Ce, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": i.did, children: /* @__PURE__ */ t(y, { padding: "1px", children: o({ blocklet: i, blocklets: r, serverVersion: n }) }) }, i.did)) })
|
|
921
925
|
] });
|
|
922
926
|
}
|
|
923
|
-
function
|
|
924
|
-
const { get: e } =
|
|
927
|
+
function ir() {
|
|
928
|
+
const { get: e } = be(), { t: r } = I(), {
|
|
925
929
|
data: o = [],
|
|
926
930
|
error: n,
|
|
927
931
|
loading: i
|
|
928
|
-
} =
|
|
929
|
-
const a = await e(
|
|
932
|
+
} = ee(async () => {
|
|
933
|
+
const a = await e(T.explorePath);
|
|
930
934
|
return Array.isArray(a) ? a : [];
|
|
931
935
|
});
|
|
932
|
-
return n ? /* @__PURE__ */ t(
|
|
933
|
-
/* @__PURE__ */ t(
|
|
936
|
+
return n ? /* @__PURE__ */ t(fe, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : i ? /* @__PURE__ */ t(Qe, { mt: 15 }) : /* @__PURE__ */ h(W, { children: [
|
|
937
|
+
/* @__PURE__ */ t(rr, {}),
|
|
934
938
|
o.map(
|
|
935
|
-
(a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(
|
|
939
|
+
(a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(lr, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
|
|
936
940
|
)
|
|
937
941
|
] });
|
|
938
942
|
}
|
|
939
|
-
const
|
|
940
|
-
function
|
|
943
|
+
const se = "__FREE_TEXT__", Re = "__NO_RESULT__", ce = 40;
|
|
944
|
+
function ar({
|
|
941
945
|
endpoint: e,
|
|
942
946
|
t: r,
|
|
943
947
|
locale: o,
|
|
@@ -946,13 +950,13 @@ function lr({
|
|
|
946
950
|
handleSearchSelect: a,
|
|
947
951
|
...c
|
|
948
952
|
}) {
|
|
949
|
-
const l =
|
|
953
|
+
const l = pe(null), p = pe(!1), [d, g] = E(!1), [m, f] = E(""), [k, S] = E(!1), B = be(), [v, u] = E(!1), C = async (s) => {
|
|
950
954
|
u(!0);
|
|
951
|
-
const b = await
|
|
955
|
+
const b = await B.get(ke(e, xe(T.blockletsPath, s)));
|
|
952
956
|
return u(!1), b.dataList || [];
|
|
953
|
-
}, { data:
|
|
954
|
-
(s) => s ?
|
|
955
|
-
sortBy:
|
|
957
|
+
}, { data: x, run: A } = ee(
|
|
958
|
+
(s) => s ? C({
|
|
959
|
+
sortBy: T.nameDesc,
|
|
956
960
|
page: 1,
|
|
957
961
|
pageSize: 10,
|
|
958
962
|
keyword: s,
|
|
@@ -962,23 +966,23 @@ function lr({
|
|
|
962
966
|
manual: !0
|
|
963
967
|
}
|
|
964
968
|
);
|
|
965
|
-
|
|
969
|
+
U(() => {
|
|
966
970
|
u(!0), A(n.keyword), f(n.keyword || "");
|
|
967
|
-
}, [n.keyword, A]),
|
|
971
|
+
}, [n.keyword, A]), At(
|
|
968
972
|
"ctrl + k, command + k",
|
|
969
973
|
(s) => {
|
|
970
|
-
var b,
|
|
971
|
-
return s.stopPropagation(), s.preventDefault(), (
|
|
974
|
+
var b, N;
|
|
975
|
+
return s.stopPropagation(), s.preventDefault(), (N = (b = l.current) == null ? void 0 : b.querySelector("input")) == null || N.focus(), !1;
|
|
972
976
|
},
|
|
973
977
|
{ enableOnTags: ["INPUT"] }
|
|
974
978
|
);
|
|
975
|
-
const F =
|
|
976
|
-
let
|
|
977
|
-
return
|
|
978
|
-
/* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
979
|
+
const F = Oe((s) => A(s), { wait: 300 }), L = { name: se, title: m, did: "" };
|
|
980
|
+
let M = [];
|
|
981
|
+
return m && (v ? M = [L] : x != null && x.length ? M = [L, ...x] : M = [{ name: Re, title: r("blocklet.noResults"), did: "" }]), /* @__PURE__ */ h(W, { children: [
|
|
982
|
+
/* @__PURE__ */ h(Tt, { fullScreen: !0, open: k, sx: { display: { md: "none" } }, children: [
|
|
983
|
+
/* @__PURE__ */ h(y, { p: 2, pb: 0, display: "flex", alignItems: "center", gap: 2, children: [
|
|
980
984
|
/* @__PURE__ */ t(
|
|
981
|
-
|
|
985
|
+
We,
|
|
982
986
|
{
|
|
983
987
|
fullWidth: !0,
|
|
984
988
|
sx: {
|
|
@@ -998,45 +1002,45 @@ function lr({
|
|
|
998
1002
|
autoFocus: !0,
|
|
999
1003
|
placeholder: r("common.searchStore"),
|
|
1000
1004
|
className: "bl-autocomplete-input",
|
|
1001
|
-
value:
|
|
1002
|
-
onChange: (s) =>
|
|
1003
|
-
startAdornment:
|
|
1004
|
-
endAdornment:
|
|
1005
|
+
value: m,
|
|
1006
|
+
onChange: (s) => V(s.target.value),
|
|
1007
|
+
startAdornment: $(k),
|
|
1008
|
+
endAdornment: q()
|
|
1005
1009
|
}
|
|
1006
1010
|
),
|
|
1007
1011
|
/* @__PURE__ */ t(
|
|
1008
|
-
|
|
1012
|
+
te,
|
|
1009
1013
|
{
|
|
1010
1014
|
variant: "outlined",
|
|
1011
1015
|
onClick: () => {
|
|
1012
|
-
|
|
1016
|
+
S(!1), f(n.keyword || "");
|
|
1013
1017
|
},
|
|
1014
1018
|
children: r("common.cancel")
|
|
1015
1019
|
}
|
|
1016
1020
|
)
|
|
1017
1021
|
] }),
|
|
1018
|
-
/* @__PURE__ */ t(
|
|
1022
|
+
/* @__PURE__ */ t(Ne, { sx: { p: 0.5 }, children: M.map((s) => X(s)) })
|
|
1019
1023
|
] }),
|
|
1020
1024
|
/* @__PURE__ */ t(
|
|
1021
|
-
|
|
1025
|
+
J,
|
|
1022
1026
|
{
|
|
1023
1027
|
sx: { display: { sx: "block", md: "none" }, fontSize: 28, color: "text.lighter" },
|
|
1024
|
-
onClick: () =>
|
|
1028
|
+
onClick: () => S(!0)
|
|
1025
1029
|
}
|
|
1026
1030
|
),
|
|
1027
1031
|
/* @__PURE__ */ t(
|
|
1028
|
-
|
|
1032
|
+
Rt,
|
|
1029
1033
|
{
|
|
1030
1034
|
ref: l,
|
|
1031
|
-
open: !!
|
|
1035
|
+
open: !!m && d,
|
|
1032
1036
|
size: "small",
|
|
1033
1037
|
onOpen: () => g(!0),
|
|
1034
1038
|
onClose: (s, b) => {
|
|
1035
|
-
g(!1), b === "selectOption" && !
|
|
1039
|
+
g(!1), b === "selectOption" && !p.current && i(m);
|
|
1036
1040
|
},
|
|
1037
1041
|
disableClearable: !0,
|
|
1038
|
-
inputValue:
|
|
1039
|
-
onInputChange: (s, b) =>
|
|
1042
|
+
inputValue: m,
|
|
1043
|
+
onInputChange: (s, b) => V(b),
|
|
1040
1044
|
isOptionEqualToValue: (s, b) => s.name === b.name,
|
|
1041
1045
|
getOptionLabel: (s) => s.title,
|
|
1042
1046
|
getOptionKey: (s) => s.name,
|
|
@@ -1062,17 +1066,17 @@ function lr({
|
|
|
1062
1066
|
autoFocus: !0,
|
|
1063
1067
|
placeholder: r("common.searchStore"),
|
|
1064
1068
|
className: "bl-autocomplete-input",
|
|
1065
|
-
value:
|
|
1066
|
-
startAdornment:
|
|
1067
|
-
endAdornment:
|
|
1069
|
+
value: m,
|
|
1070
|
+
startAdornment: $(d),
|
|
1071
|
+
endAdornment: q()
|
|
1068
1072
|
}
|
|
1069
1073
|
}
|
|
1070
1074
|
),
|
|
1071
1075
|
filterOptions: (s) => s,
|
|
1072
1076
|
...c,
|
|
1073
|
-
options:
|
|
1074
|
-
renderOption: (s, b) =>
|
|
1075
|
-
value:
|
|
1077
|
+
options: M,
|
|
1078
|
+
renderOption: (s, b) => X(b),
|
|
1079
|
+
value: L,
|
|
1076
1080
|
sx: [
|
|
1077
1081
|
{
|
|
1078
1082
|
bgcolor: "#F9FAFB",
|
|
@@ -1092,43 +1096,39 @@ function lr({
|
|
|
1092
1096
|
}
|
|
1093
1097
|
)
|
|
1094
1098
|
] });
|
|
1095
|
-
function
|
|
1096
|
-
u(!0), f(s),
|
|
1099
|
+
function V(s) {
|
|
1100
|
+
u(!0), f(s), p.current = !1, F.run(s);
|
|
1097
1101
|
}
|
|
1098
|
-
function
|
|
1099
|
-
|
|
1102
|
+
function G() {
|
|
1103
|
+
S(!1), f(""), V(""), i("");
|
|
1100
1104
|
}
|
|
1101
|
-
function
|
|
1102
|
-
s != null && s.did ? (
|
|
1105
|
+
function oe(s) {
|
|
1106
|
+
s != null && s.did ? (S(!1), p.current = !0, f(""), a(s)) : s.name === se && (S(!1), i(m));
|
|
1103
1107
|
}
|
|
1104
|
-
function
|
|
1105
|
-
var b,
|
|
1106
|
-
return /* @__PURE__ */
|
|
1107
|
-
|
|
1108
|
+
function X(s) {
|
|
1109
|
+
var b, N;
|
|
1110
|
+
return /* @__PURE__ */ h(
|
|
1111
|
+
Me,
|
|
1108
1112
|
{
|
|
1109
1113
|
sx: { display: "flex", alignItems: "center", gap: 1, p: 1.5, borderRadius: "8px" },
|
|
1110
|
-
onClick: () =>
|
|
1114
|
+
onClick: () => oe(s),
|
|
1111
1115
|
children: [
|
|
1112
|
-
|
|
1113
|
-
/* @__PURE__ */
|
|
1114
|
-
/* @__PURE__ */
|
|
1115
|
-
|
|
1116
|
-
" ",
|
|
1117
|
-
/* @__PURE__ */ t(It, { sx: { color: "#D97706", fontSize: 16, display: "none" } })
|
|
1118
|
-
] }),
|
|
1119
|
-
/* @__PURE__ */ t(w, { sx: { color: "text.lighter" }, fontSize: "13px", children: ((M = (b = s.category) == null ? void 0 : b.locales) == null ? void 0 : M[o || "en"]) || "" })
|
|
1116
|
+
Q(s),
|
|
1117
|
+
/* @__PURE__ */ h(w, { variant: "body1", children: [
|
|
1118
|
+
/* @__PURE__ */ t(w, { fontWeight: "fontWeightMedium", display: "flex", alignItems: "center", gap: 1, children: s.title }),
|
|
1119
|
+
/* @__PURE__ */ t(w, { sx: { color: "text.lighter" }, fontSize: "13px", children: ((N = (b = s.category) == null ? void 0 : b.locales) == null ? void 0 : N[o || "en"]) || "" })
|
|
1120
1120
|
] })
|
|
1121
1121
|
]
|
|
1122
1122
|
},
|
|
1123
1123
|
s.did
|
|
1124
1124
|
);
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1127
|
-
if ([
|
|
1126
|
+
function Q(s) {
|
|
1127
|
+
if ([se, Re].includes(s.name))
|
|
1128
1128
|
return /* @__PURE__ */ t(
|
|
1129
|
-
|
|
1129
|
+
y,
|
|
1130
1130
|
{
|
|
1131
|
-
width:
|
|
1131
|
+
width: ce,
|
|
1132
1132
|
p: "6px",
|
|
1133
1133
|
display: "flex",
|
|
1134
1134
|
justifyContent: "center",
|
|
@@ -1136,46 +1136,46 @@ function lr({
|
|
|
1136
1136
|
color: "text.lighter",
|
|
1137
1137
|
bgcolor: "#F1F3F5",
|
|
1138
1138
|
borderRadius: "8px",
|
|
1139
|
-
children: /* @__PURE__ */ t(
|
|
1139
|
+
children: /* @__PURE__ */ t(J, { sx: { fontSize: 28 } })
|
|
1140
1140
|
}
|
|
1141
1141
|
);
|
|
1142
1142
|
let b = "";
|
|
1143
|
-
return s.logo && (b =
|
|
1143
|
+
return s.logo && (b = ke(e, "assets", s.did, He(s.logo, ce, s.version))), /* @__PURE__ */ t(De, { src: b, size: ce, style: { borderRadius: "8px", overflow: "hidden" } });
|
|
1144
1144
|
}
|
|
1145
|
-
function
|
|
1146
|
-
return /* @__PURE__ */ t(
|
|
1145
|
+
function $(s = !0) {
|
|
1146
|
+
return /* @__PURE__ */ t(y, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.lighter" }, children: s && m && v ? /* @__PURE__ */ t(re, { color: "inherit", size: 16 }) : /* @__PURE__ */ t(J, { sx: { fontSize: 16, cursor: "default" } }) });
|
|
1147
1147
|
}
|
|
1148
|
-
function
|
|
1149
|
-
return
|
|
1148
|
+
function q() {
|
|
1149
|
+
return m ? /* @__PURE__ */ t(y, { sx: { display: "flex", alignItems: "center", color: "text.lighter" }, children: /* @__PURE__ */ t(ge, { sx: { fontSize: 20, cursor: "pointer" }, onClick: () => G() }) }) : null;
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
1152
|
-
function
|
|
1153
|
-
const { search: o } = I(), { filters: n, handleKeyword: i } = o, [a, c] =
|
|
1154
|
-
const { value:
|
|
1155
|
-
c(
|
|
1152
|
+
function sr({ placeholder: e = "Type to search...", ...r }) {
|
|
1153
|
+
const { search: o } = I(), { filters: n, handleKeyword: i } = o, [a, c] = E(n.keyword || ""), l = Oe(i, { wait: 300 }), p = (g) => {
|
|
1154
|
+
const { value: m } = g.target;
|
|
1155
|
+
c(m), l.run(m);
|
|
1156
1156
|
}, d = () => {
|
|
1157
1157
|
c(""), i("");
|
|
1158
1158
|
};
|
|
1159
|
-
return
|
|
1159
|
+
return U(() => {
|
|
1160
1160
|
c(n.keyword || "");
|
|
1161
1161
|
}, [n.keyword]), /* @__PURE__ */ t(
|
|
1162
|
-
|
|
1162
|
+
cr,
|
|
1163
1163
|
{
|
|
1164
1164
|
inputProps: {
|
|
1165
1165
|
"data-cy": "search-blocklet"
|
|
1166
1166
|
},
|
|
1167
|
-
startAdornment: /* @__PURE__ */ t(
|
|
1168
|
-
onChange:
|
|
1167
|
+
startAdornment: /* @__PURE__ */ t(Ie, { position: "start", children: /* @__PURE__ */ t(dr, {}) }),
|
|
1168
|
+
onChange: p,
|
|
1169
1169
|
placeholder: e,
|
|
1170
1170
|
value: a,
|
|
1171
1171
|
title: e,
|
|
1172
1172
|
"data-cy": "search",
|
|
1173
|
-
endAdornment: a && /* @__PURE__ */ t(
|
|
1173
|
+
endAdornment: a && /* @__PURE__ */ t(Ie, { position: "end", children: /* @__PURE__ */ t(ur, { "data-cy": "search-delete", onClick: d }) }),
|
|
1174
1174
|
...r
|
|
1175
1175
|
}
|
|
1176
1176
|
);
|
|
1177
1177
|
}
|
|
1178
|
-
const
|
|
1178
|
+
const cr = K(We)`
|
|
1179
1179
|
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
1180
1180
|
font-size: 14px;
|
|
1181
1181
|
border-radius: 6px;
|
|
@@ -1192,21 +1192,21 @@ const ar = q(Me)`
|
|
|
1192
1192
|
color: transparent;
|
|
1193
1193
|
}
|
|
1194
1194
|
}
|
|
1195
|
-
`,
|
|
1195
|
+
`, dr = K(J)`
|
|
1196
1196
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1197
1197
|
font-size: 28px;
|
|
1198
1198
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
1199
1199
|
font-size: 24px;
|
|
1200
1200
|
}
|
|
1201
|
-
`,
|
|
1201
|
+
`, ur = K(ge)`
|
|
1202
1202
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1203
1203
|
font-size: 16px;
|
|
1204
1204
|
cursor: pointer;
|
|
1205
1205
|
`;
|
|
1206
|
-
function
|
|
1207
|
-
const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: i, developerName: a, showResourcesSwitch: c, layout: l, baseSearch:
|
|
1208
|
-
return /* @__PURE__ */
|
|
1209
|
-
|
|
1206
|
+
function hr() {
|
|
1207
|
+
const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: i, developerName: a, showResourcesSwitch: c, layout: l, baseSearch: p } = I(), { filters: d, handleSort: g, handlePrice: m, handleDeveloper: f, handleSwitchShowResources: k, cleanFilter: S } = e, B = je(r);
|
|
1208
|
+
return /* @__PURE__ */ h(
|
|
1209
|
+
P,
|
|
1210
1210
|
{
|
|
1211
1211
|
className: "filter-bar",
|
|
1212
1212
|
direction: { xs: "column", md: "row" },
|
|
@@ -1219,8 +1219,8 @@ function dr() {
|
|
|
1219
1219
|
pb: 3,
|
|
1220
1220
|
children: [
|
|
1221
1221
|
/* @__PURE__ */ t(w, { variant: "h2", textTransform: "capitalize", children: i(d.category) }),
|
|
1222
|
-
/* @__PURE__ */
|
|
1223
|
-
|
|
1222
|
+
/* @__PURE__ */ h(
|
|
1223
|
+
P,
|
|
1224
1224
|
{
|
|
1225
1225
|
flex: 1,
|
|
1226
1226
|
direction: "row",
|
|
@@ -1229,8 +1229,8 @@ function dr() {
|
|
|
1229
1229
|
justifyContent: { xs: "space-between", md: "flex-end" },
|
|
1230
1230
|
gap: 2,
|
|
1231
1231
|
children: [
|
|
1232
|
-
l.showSearch ? /* @__PURE__ */ t(
|
|
1233
|
-
|
|
1232
|
+
l.showSearch ? /* @__PURE__ */ t(y, { flex: 1, children: p ? /* @__PURE__ */ t(sr, {}) : /* @__PURE__ */ t(
|
|
1233
|
+
ar,
|
|
1234
1234
|
{
|
|
1235
1235
|
locale: n,
|
|
1236
1236
|
endpoint: o,
|
|
@@ -1246,30 +1246,45 @@ function dr() {
|
|
|
1246
1246
|
handleSearchSelect: e.handleSearchSelect
|
|
1247
1247
|
}
|
|
1248
1248
|
) }) : null,
|
|
1249
|
-
d.owner && a && /* @__PURE__ */ t(
|
|
1249
|
+
d.owner && a && /* @__PURE__ */ t(
|
|
1250
|
+
Se,
|
|
1251
|
+
{
|
|
1252
|
+
label: r("blocklet.authorTag", { name: a }),
|
|
1253
|
+
size: "small",
|
|
1254
|
+
onDelete: () => f("")
|
|
1255
|
+
}
|
|
1256
|
+
),
|
|
1257
|
+
d.resourceDid && d.resourceBlocklet && /* @__PURE__ */ t(
|
|
1258
|
+
Se,
|
|
1259
|
+
{
|
|
1260
|
+
label: r("blocklet.resourceTag", { name: d.resourceBlocklet }),
|
|
1261
|
+
size: "small",
|
|
1262
|
+
onDelete: () => S(["resourceDid", "resourceBlocklet", "showResources"])
|
|
1263
|
+
}
|
|
1264
|
+
),
|
|
1250
1265
|
c ? /* @__PURE__ */ t(
|
|
1251
|
-
|
|
1266
|
+
Te,
|
|
1252
1267
|
{
|
|
1253
1268
|
checked: d.showResources === "true",
|
|
1254
|
-
onChange: (
|
|
1269
|
+
onChange: (v) => k(v ? "true" : ""),
|
|
1255
1270
|
label: r("common.showResources")
|
|
1256
1271
|
}
|
|
1257
1272
|
) : null,
|
|
1258
1273
|
/* @__PURE__ */ t(
|
|
1259
|
-
|
|
1274
|
+
Te,
|
|
1260
1275
|
{
|
|
1261
1276
|
checked: d.price === "free",
|
|
1262
|
-
onChange: (
|
|
1277
|
+
onChange: (v) => m(v ? "free" : ""),
|
|
1263
1278
|
label: r("blocklet.free")
|
|
1264
1279
|
}
|
|
1265
1280
|
),
|
|
1266
1281
|
/* @__PURE__ */ t(
|
|
1267
|
-
|
|
1282
|
+
Ke,
|
|
1268
1283
|
{
|
|
1269
|
-
value: d.sortBy ||
|
|
1270
|
-
options:
|
|
1284
|
+
value: d.sortBy || B[0].value,
|
|
1285
|
+
options: B,
|
|
1271
1286
|
placeholder: r("sort.sort"),
|
|
1272
|
-
onChange: (
|
|
1287
|
+
onChange: (v) => g(v)
|
|
1273
1288
|
}
|
|
1274
1289
|
)
|
|
1275
1290
|
]
|
|
@@ -1279,17 +1294,17 @@ function dr() {
|
|
|
1279
1294
|
}
|
|
1280
1295
|
);
|
|
1281
1296
|
}
|
|
1282
|
-
function
|
|
1297
|
+
function Te({
|
|
1283
1298
|
checked: e,
|
|
1284
1299
|
onChange: r,
|
|
1285
1300
|
label: o
|
|
1286
1301
|
}) {
|
|
1287
1302
|
return /* @__PURE__ */ t(
|
|
1288
|
-
|
|
1303
|
+
ze,
|
|
1289
1304
|
{
|
|
1290
1305
|
sx: { m: 0 },
|
|
1291
1306
|
control: /* @__PURE__ */ t(
|
|
1292
|
-
|
|
1307
|
+
_e,
|
|
1293
1308
|
{
|
|
1294
1309
|
checked: e,
|
|
1295
1310
|
size: "small",
|
|
@@ -1301,115 +1316,115 @@ function Ie({
|
|
|
1301
1316
|
}
|
|
1302
1317
|
);
|
|
1303
1318
|
}
|
|
1304
|
-
function
|
|
1305
|
-
return /* @__PURE__ */
|
|
1306
|
-
/* @__PURE__ */ t(
|
|
1319
|
+
function Z({ children: e }) {
|
|
1320
|
+
return /* @__PURE__ */ h(y, { display: "flex", mt: 2, flexDirection: "column", alignItems: "center", justifyContent: "center", color: "text.lighter", children: [
|
|
1321
|
+
/* @__PURE__ */ t(Ft, {}),
|
|
1307
1322
|
e
|
|
1308
1323
|
] });
|
|
1309
1324
|
}
|
|
1310
|
-
function
|
|
1325
|
+
function Pe() {
|
|
1311
1326
|
const { t: e } = I();
|
|
1312
1327
|
return /* @__PURE__ */ t(w, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
1313
1328
|
}
|
|
1314
|
-
function
|
|
1329
|
+
function de({ filterTip: e, keywordTip: r }) {
|
|
1315
1330
|
const { t: o, locale: n } = I(), i = () => n === "zh" ? "、" : " , ";
|
|
1316
|
-
return /* @__PURE__ */
|
|
1331
|
+
return /* @__PURE__ */ h(y, { mt: 1, display: "flex", children: [
|
|
1317
1332
|
/* @__PURE__ */ t(w, { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
|
|
1318
1333
|
e && /* @__PURE__ */ t(w, { children: o("blocklet.filterTip") }),
|
|
1319
1334
|
e && r && i(),
|
|
1320
1335
|
r && /* @__PURE__ */ t(w, { children: o("blocklet.keywordTip") })
|
|
1321
1336
|
] });
|
|
1322
1337
|
}
|
|
1323
|
-
function
|
|
1338
|
+
function ue({
|
|
1324
1339
|
primaryStart: e,
|
|
1325
1340
|
primaryEnd: r,
|
|
1326
1341
|
filter: o
|
|
1327
1342
|
}) {
|
|
1328
|
-
return /* @__PURE__ */
|
|
1343
|
+
return /* @__PURE__ */ h(w, { variant: "subtitle2", display: "flex", gap: 0.5, mx: 0.5, children: [
|
|
1329
1344
|
/* @__PURE__ */ t(w, { children: e }),
|
|
1330
1345
|
/* @__PURE__ */ t(w, { color: "primary", children: o }),
|
|
1331
|
-
/* @__PURE__ */
|
|
1346
|
+
/* @__PURE__ */ h(w, { children: [
|
|
1332
1347
|
r,
|
|
1333
1348
|
" "
|
|
1334
1349
|
] })
|
|
1335
1350
|
] });
|
|
1336
1351
|
}
|
|
1337
|
-
function
|
|
1352
|
+
function pr() {
|
|
1338
1353
|
const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = I(), { filters: i } = r, a = !!n || !!i.price;
|
|
1339
1354
|
if (i.keyword && a)
|
|
1340
|
-
return /* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ h(Z, { children: [
|
|
1341
1356
|
/* @__PURE__ */ t(
|
|
1342
|
-
|
|
1357
|
+
ue,
|
|
1343
1358
|
{
|
|
1344
1359
|
primaryStart: e("blocklet.noBlockletPart1"),
|
|
1345
1360
|
primaryEnd: e("blocklet.noBlockletPart2"),
|
|
1346
1361
|
filter: i.keyword
|
|
1347
1362
|
}
|
|
1348
1363
|
),
|
|
1349
|
-
/* @__PURE__ */ t(
|
|
1364
|
+
/* @__PURE__ */ t(de, { keywordTip: !0, filterTip: !0 })
|
|
1350
1365
|
] });
|
|
1351
1366
|
if (i.keyword)
|
|
1352
|
-
return /* @__PURE__ */
|
|
1367
|
+
return /* @__PURE__ */ h(Z, { children: [
|
|
1353
1368
|
/* @__PURE__ */ t(
|
|
1354
|
-
|
|
1369
|
+
ue,
|
|
1355
1370
|
{
|
|
1356
1371
|
primaryStart: e("blocklet.noBlockletPart1"),
|
|
1357
1372
|
primaryEnd: e("blocklet.noBlockletPart2"),
|
|
1358
1373
|
filter: i.keyword
|
|
1359
1374
|
}
|
|
1360
1375
|
),
|
|
1361
|
-
/* @__PURE__ */ t(
|
|
1376
|
+
/* @__PURE__ */ t(de, { keywordTip: !0 })
|
|
1362
1377
|
] });
|
|
1363
1378
|
if (a) {
|
|
1364
1379
|
const c = o(n);
|
|
1365
|
-
return /* @__PURE__ */
|
|
1380
|
+
return /* @__PURE__ */ h(Z, { children: [
|
|
1366
1381
|
c ? /* @__PURE__ */ t(
|
|
1367
|
-
|
|
1382
|
+
ue,
|
|
1368
1383
|
{
|
|
1369
1384
|
primaryStart: e("blocklet.noCategoryResults1"),
|
|
1370
1385
|
primaryEnd: e("blocklet.noCategoryResults2"),
|
|
1371
1386
|
filter: c
|
|
1372
1387
|
}
|
|
1373
|
-
) : /* @__PURE__ */ t(
|
|
1374
|
-
/* @__PURE__ */ t(
|
|
1388
|
+
) : /* @__PURE__ */ t(Pe, {}),
|
|
1389
|
+
/* @__PURE__ */ t(de, { filterTip: !0 })
|
|
1375
1390
|
] });
|
|
1376
1391
|
}
|
|
1377
|
-
return /* @__PURE__ */ t(
|
|
1392
|
+
return /* @__PURE__ */ t(Z, { children: /* @__PURE__ */ t(Pe, {}) });
|
|
1378
1393
|
}
|
|
1379
|
-
const
|
|
1394
|
+
const mr = (e, r, o, n) => lt(
|
|
1380
1395
|
async (i) => {
|
|
1381
1396
|
i || (o.currentPage = o.defaultCurrentPage);
|
|
1382
1397
|
const { currentPage: a, pageSize: c } = o, l = {
|
|
1383
1398
|
...r,
|
|
1384
1399
|
category: r.category === "All" ? "" : r.category,
|
|
1385
|
-
sortBy:
|
|
1400
|
+
sortBy: T[r.sortBy],
|
|
1386
1401
|
page: a,
|
|
1387
1402
|
pageSize: c
|
|
1388
1403
|
};
|
|
1389
1404
|
n(null);
|
|
1390
|
-
const { data:
|
|
1391
|
-
return o.currentPage++, { page: a, pageSize: c, list: (
|
|
1405
|
+
const { data: p = {} } = await e.get(T.blockletsPath, { params: l });
|
|
1406
|
+
return o.currentPage++, { page: a, pageSize: c, list: (p == null ? void 0 : p.dataList) || [], total: (p == null ? void 0 : p.total) || 0 };
|
|
1392
1407
|
},
|
|
1393
1408
|
{
|
|
1394
1409
|
isNoMore: (i) => i ? i.page * i.pageSize >= i.total : !1,
|
|
1395
|
-
reloadDeps: [e,
|
|
1410
|
+
reloadDeps: [e, Et(r)],
|
|
1396
1411
|
onError: n
|
|
1397
1412
|
}
|
|
1398
1413
|
);
|
|
1399
|
-
function
|
|
1400
|
-
var
|
|
1401
|
-
const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: i } = I(), { filters: a } = r, c =
|
|
1402
|
-
currentPage:
|
|
1403
|
-
pageSize:
|
|
1404
|
-
defaultCurrentPage:
|
|
1405
|
-
}), [l,
|
|
1414
|
+
function fr() {
|
|
1415
|
+
var m;
|
|
1416
|
+
const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: i } = I(), { filters: a } = r, c = it({
|
|
1417
|
+
currentPage: T.currentPage,
|
|
1418
|
+
pageSize: jt() ? T.mobilePageSize : T.pageSize,
|
|
1419
|
+
defaultCurrentPage: T.defaultCurrentPage
|
|
1420
|
+
}), [l, p] = E(null), d = mr(e, a, c, p), g = H(
|
|
1406
1421
|
() => {
|
|
1407
1422
|
var f, k;
|
|
1408
1423
|
return o ? o(((f = d.data) == null ? void 0 : f.list) || []) : ((k = d.data) == null ? void 0 : k.list) || [];
|
|
1409
1424
|
},
|
|
1410
1425
|
[d.data, o]
|
|
1411
1426
|
);
|
|
1412
|
-
return
|
|
1427
|
+
return U(() => {
|
|
1413
1428
|
const f = g.find((k) => k.owner.did === a.owner);
|
|
1414
1429
|
i((f == null ? void 0 : f.owner.fullName) || (f == null ? void 0 : f.author.name) || "");
|
|
1415
1430
|
}, [a.owner, g, i]), {
|
|
@@ -1417,7 +1432,7 @@ function pr() {
|
|
|
1417
1432
|
fetchBlockletsError: l,
|
|
1418
1433
|
loadMore: d.loadMore,
|
|
1419
1434
|
hasNextPage: !d.noMore,
|
|
1420
|
-
total: ((
|
|
1435
|
+
total: ((m = d.data) == null ? void 0 : m.total) || 0,
|
|
1421
1436
|
loadings: {
|
|
1422
1437
|
fetchBlockletsLoading: d.loading,
|
|
1423
1438
|
loadingMore: d.loadingMore
|
|
@@ -1428,41 +1443,41 @@ function pr() {
|
|
|
1428
1443
|
}
|
|
1429
1444
|
};
|
|
1430
1445
|
}
|
|
1431
|
-
function
|
|
1432
|
-
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: i, minItemWidth: a, layout: c, baseSearch: l } = I(), { filters:
|
|
1446
|
+
function gr() {
|
|
1447
|
+
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: i, minItemWidth: a, layout: c, baseSearch: l } = I(), { filters: p } = r, { blocklets: d, errors: g, loadMore: m, loadings: f, hasNextPage: k, total: S } = fr(), [B] = Bt({
|
|
1433
1448
|
loading: f.fetchBlockletsLoading || f.loadingMore,
|
|
1434
1449
|
hasNextPage: k,
|
|
1435
|
-
onLoadMore:
|
|
1450
|
+
onLoadMore: m
|
|
1436
1451
|
});
|
|
1437
1452
|
if (g.fetchBlockletsError) {
|
|
1438
|
-
const
|
|
1439
|
-
return /* @__PURE__ */ t(
|
|
1453
|
+
const x = new Error(`Failed to fetch blocklets from ${o}: ${g.fetchBlockletsError.message}`);
|
|
1454
|
+
return /* @__PURE__ */ t(fe, { error: x });
|
|
1440
1455
|
}
|
|
1441
|
-
const
|
|
1442
|
-
return /* @__PURE__ */
|
|
1443
|
-
|
|
1444
|
-
/* @__PURE__ */ t(
|
|
1445
|
-
|
|
1456
|
+
const v = l && c.showSearch || !p.keyword;
|
|
1457
|
+
return /* @__PURE__ */ h(W, { children: [
|
|
1458
|
+
v ? /* @__PURE__ */ t(hr, {}) : /* @__PURE__ */ h(W, { children: [
|
|
1459
|
+
/* @__PURE__ */ t(we, { xs: /* @__PURE__ */ t(Xe, {}), md: null }),
|
|
1460
|
+
C()
|
|
1446
1461
|
] }),
|
|
1447
1462
|
u(),
|
|
1448
|
-
!f.fetchBlockletsLoading && k && /* @__PURE__ */ t(
|
|
1463
|
+
!f.fetchBlockletsLoading && k && /* @__PURE__ */ t(y, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: B, children: /* @__PURE__ */ t(re, {}) })
|
|
1449
1464
|
] });
|
|
1450
1465
|
function u() {
|
|
1451
|
-
return f.fetchBlockletsLoading ? /* @__PURE__ */ t(
|
|
1452
|
-
|
|
1466
|
+
return f.fetchBlockletsLoading ? /* @__PURE__ */ t(Qe, { mt: 15 }) : d.length ? /* @__PURE__ */ t(
|
|
1467
|
+
y,
|
|
1453
1468
|
{
|
|
1454
1469
|
className: "blocklet-list",
|
|
1455
1470
|
display: "grid",
|
|
1456
1471
|
gridTemplateColumns: `repeat(auto-fill, minmax(${a}px, 1fr))`,
|
|
1457
1472
|
p: "2px",
|
|
1458
1473
|
gap: 2,
|
|
1459
|
-
children: d.map((
|
|
1474
|
+
children: d.map((x) => /* @__PURE__ */ t(y, { "data-blocklet-did": x.did, sx: { minWidth: a }, children: n({ blocklet: x, blocklets: d, serverVersion: i }) }, x.did))
|
|
1460
1475
|
}
|
|
1461
|
-
) : /* @__PURE__ */ t(
|
|
1476
|
+
) : /* @__PURE__ */ t(pr, {});
|
|
1462
1477
|
}
|
|
1463
|
-
function
|
|
1464
|
-
return /* @__PURE__ */
|
|
1465
|
-
|
|
1478
|
+
function C() {
|
|
1479
|
+
return /* @__PURE__ */ h(
|
|
1480
|
+
P,
|
|
1466
1481
|
{
|
|
1467
1482
|
direction: "row",
|
|
1468
1483
|
className: "search-result-title",
|
|
@@ -1471,16 +1486,16 @@ function mr() {
|
|
|
1471
1486
|
mb: 2,
|
|
1472
1487
|
mt: { xs: 2, md: 0 },
|
|
1473
1488
|
children: [
|
|
1474
|
-
/* @__PURE__ */ t(w, { variant: "h3", children: e("blocklet.search", { keyword:
|
|
1475
|
-
/* @__PURE__ */ t(w, { variant: "body1", color: "text.lighter", fontSize: 13, children: e("blocklet.resultCount", { count:
|
|
1489
|
+
/* @__PURE__ */ t(w, { variant: "h3", children: e("blocklet.search", { keyword: p.keyword }) }),
|
|
1490
|
+
/* @__PURE__ */ t(w, { variant: "body1", color: "text.lighter", fontSize: 13, children: e("blocklet.resultCount", { count: S }) })
|
|
1476
1491
|
]
|
|
1477
1492
|
}
|
|
1478
1493
|
);
|
|
1479
1494
|
}
|
|
1480
1495
|
}
|
|
1481
|
-
function
|
|
1482
|
-
const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } =
|
|
1483
|
-
return /* @__PURE__ */
|
|
1496
|
+
function xr() {
|
|
1497
|
+
const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } = ye();
|
|
1498
|
+
return /* @__PURE__ */ h(
|
|
1484
1499
|
w,
|
|
1485
1500
|
{
|
|
1486
1501
|
variant: "body1",
|
|
@@ -1490,25 +1505,44 @@ function fr() {
|
|
|
1490
1505
|
py: 2,
|
|
1491
1506
|
fontWeight: "fontWeightMedium",
|
|
1492
1507
|
children: [
|
|
1493
|
-
/* @__PURE__ */ t(
|
|
1508
|
+
/* @__PURE__ */ t(qe, { onClick: () => n(!0), children: /* @__PURE__ */ t(Lt, {}) }),
|
|
1494
1509
|
o(r) || e("common.category")
|
|
1495
1510
|
]
|
|
1496
1511
|
}
|
|
1497
1512
|
);
|
|
1498
1513
|
}
|
|
1499
|
-
function
|
|
1514
|
+
function yr() {
|
|
1500
1515
|
const { search: e, layout: r } = I(), { filters: o } = e, n = o.category || o.keyword || o.price;
|
|
1501
|
-
return /* @__PURE__ */ t(
|
|
1502
|
-
/* @__PURE__ */ t(
|
|
1503
|
-
/* @__PURE__ */
|
|
1504
|
-
/* @__PURE__ */ t(
|
|
1505
|
-
/* @__PURE__ */ t(
|
|
1516
|
+
return /* @__PURE__ */ t(_t, { children: /* @__PURE__ */ h(et, { FallbackComponent: fe, children: [
|
|
1517
|
+
/* @__PURE__ */ t(xr, {}),
|
|
1518
|
+
/* @__PURE__ */ h(y, { display: "flex", height: "100%", className: "list-container", pt: { xs: 0, md: 5 }, children: [
|
|
1519
|
+
/* @__PURE__ */ t(Zt, {}),
|
|
1520
|
+
/* @__PURE__ */ t(P, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(ir, {}) : /* @__PURE__ */ t(gr, {}) })
|
|
1506
1521
|
] })
|
|
1507
1522
|
] }) });
|
|
1508
1523
|
}
|
|
1509
|
-
function
|
|
1510
|
-
|
|
1511
|
-
|
|
1524
|
+
function To(e) {
|
|
1525
|
+
return /* @__PURE__ */ h(Ot, { variant: "outlined", ...e, sx: { maxWidth: 400, borderRadius: "8px", p: { xs: 2, md: 3 }, ...e.sx }, children: [
|
|
1526
|
+
/* @__PURE__ */ h(le, { display: "flex", alignItems: "center", gap: 2, pb: 1, children: [
|
|
1527
|
+
/* @__PURE__ */ h(le, { display: "flex", alignItems: "center", gap: 2, flex: 1, children: [
|
|
1528
|
+
/* @__PURE__ */ t(O, { variant: "rounded", width: 48, height: 48 }),
|
|
1529
|
+
/* @__PURE__ */ t(O, { variant: "text", width: 60, height: 28 })
|
|
1530
|
+
] }),
|
|
1531
|
+
/* @__PURE__ */ t(O, { variant: "text", width: 70, height: 40 })
|
|
1532
|
+
] }),
|
|
1533
|
+
/* @__PURE__ */ t(O, { variant: "text", width: "100%", height: 24 }),
|
|
1534
|
+
/* @__PURE__ */ t(O, { variant: "text", width: "90%", height: 24 }),
|
|
1535
|
+
/* @__PURE__ */ h(le, { display: "flex", alignItems: "center", gap: 1, pt: 1.5, children: [
|
|
1536
|
+
/* @__PURE__ */ t(O, { variant: "rounded", width: 24, height: 24 }),
|
|
1537
|
+
/* @__PURE__ */ t(O, { variant: "text", width: "15%", height: 20 }),
|
|
1538
|
+
/* @__PURE__ */ t(O, { variant: "rounded", width: 24, height: 24, sx: { ml: 1 } }),
|
|
1539
|
+
/* @__PURE__ */ t(O, { variant: "text", width: "15%", height: 20 })
|
|
1540
|
+
] })
|
|
1541
|
+
] });
|
|
1542
|
+
}
|
|
1543
|
+
function Po(e) {
|
|
1544
|
+
const r = me(), o = Ye(
|
|
1545
|
+
Je({
|
|
1512
1546
|
...r,
|
|
1513
1547
|
typography: {
|
|
1514
1548
|
h1: {
|
|
@@ -1536,11 +1570,12 @@ function Bo(e) {
|
|
|
1536
1570
|
}
|
|
1537
1571
|
})
|
|
1538
1572
|
);
|
|
1539
|
-
return /* @__PURE__ */ t(
|
|
1573
|
+
return /* @__PURE__ */ t(Ze, { theme: o, children: /* @__PURE__ */ t(qt, { ...e, children: /* @__PURE__ */ t(yr, {}) }) });
|
|
1540
1574
|
}
|
|
1541
1575
|
export {
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1576
|
+
ar as Autocomplete,
|
|
1577
|
+
To as CardSkeleton,
|
|
1578
|
+
Jt as Image,
|
|
1579
|
+
Po as default,
|
|
1580
|
+
Mt as useSearch
|
|
1546
1581
|
};
|