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