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