@blocklet/pages-kit-inner-components 0.6.2 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/lib/cjs/add-component.js +420 -1
  2. package/lib/cjs/chunks/draft-data-D44_IEV2.js +1 -0
  3. package/lib/cjs/chunks/home-BYk01EUy.js +39 -0
  4. package/lib/cjs/chunks/index-BRgYwvuv.js +475 -0
  5. package/lib/cjs/chunks/publish-button-C8XPA4g_.js +1 -0
  6. package/lib/cjs/chunks/session-BRtsDvA-.js +1 -0
  7. package/lib/cjs/chunks/site-state-BlQzwACl.js +57 -0
  8. package/lib/cjs/chunks/state-B6BF5wJ-.js +1 -0
  9. package/lib/cjs/components.js +1 -0
  10. package/lib/cjs/home.js +1 -1
  11. package/lib/cjs/locales.js +3 -0
  12. package/lib/cjs/project-html.js +4 -4
  13. package/lib/cjs/resources.js +1 -1
  14. package/lib/cjs/setting.js +11 -0
  15. package/lib/cjs/site-state.js +1 -0
  16. package/lib/cjs/theme.js +1 -0
  17. package/lib/cjs/uploader.js +1 -0
  18. package/lib/es/add-component.js +1089 -2
  19. package/lib/es/chunks/{draft-data-bRUHvvzp.js → draft-data-CafrGKeh.js} +4 -5
  20. package/lib/es/chunks/home-DW8SdyfO.js +594 -0
  21. package/lib/es/chunks/index-D5gXPe_7.js +2326 -0
  22. package/lib/es/chunks/{publish-button-Ceet-m88.js → publish-button-XSZrDaTQ.js} +140 -158
  23. package/lib/es/chunks/session-C72Dq8zg.js +19 -0
  24. package/lib/es/chunks/{site-state-Bh8guIeX.js → site-state-BdLTu3Od.js} +201 -170
  25. package/lib/es/chunks/state-0gvZF3k2.js +573 -0
  26. package/lib/es/components.js +24 -0
  27. package/lib/es/home.js +28 -3
  28. package/lib/es/locales.js +1032 -0
  29. package/lib/es/project-html.js +155 -79
  30. package/lib/es/resources.js +137 -93
  31. package/lib/es/setting.js +2294 -0
  32. package/lib/es/site-state.js +48 -0
  33. package/lib/es/theme.js +484 -0
  34. package/lib/es/uploader.js +8 -0
  35. package/package.json +3 -3
  36. package/lib/cjs/chunks/draft-data-CfIMszE7.js +0 -1
  37. package/lib/cjs/chunks/home-DUjl5PbP.js +0 -6
  38. package/lib/cjs/chunks/publish-button-C522nNv6.js +0 -1
  39. package/lib/cjs/chunks/site-state-DDXqWF74.js +0 -57
  40. package/lib/cjs/chunks/state-CtNs8GrN.js +0 -1
  41. package/lib/es/chunks/home-VWWdvIPQ.js +0 -69
  42. package/lib/es/chunks/state-BdNIIXJP.js +0 -502
@@ -1,4 +1,1091 @@
1
- var e = AddComponent;
1
+ import { jsx as t, jsxs as y } from "react/jsx-runtime";
2
+ import { i as G, a as j, h as J, j as Z, k as ee, f as oe } from "./chunks/state-0gvZF3k2.js";
3
+ import W from "@arcblock/ux/lib/Empty";
4
+ import { useLocaleContext as F } from "@arcblock/ux/lib/Locale/context";
5
+ import { Icon as P } from "@iconify-icon/react";
6
+ import te from "@mui/icons-material/Check";
7
+ import { Box as n, styled as H, Dialog as re, DialogTitle as ie, TextField as ne, IconButton as ae, DialogContent as se, Tabs as le, Tab as pe, Grid as N, Card as de, CardMedia as ce, CardContent as me, Typography as V, DialogActions as ue, Button as $, Skeleton as fe } from "@mui/material";
8
+ import { useReactive as Q } from "ahooks";
9
+ import { createContext as L, useMemo as M, useEffect as A, useRef as S } from "react";
10
+ import { b as be, T as he, I as ge, B as xe } from "./chunks/index-D5gXPe_7.js";
11
+ import { styled as m } from "@arcblock/ux/lib/Theme";
12
+ import "@blocklet/pages-kit/builtin/color-picker";
13
+ import "@blocklet/pages-kit/utils/style";
14
+ import "@emotion/css";
15
+ import "lodash/without";
16
+ import { red as ye, pink as ve, purple as Ce, indigo as we, blue as ke, cyan as Te, teal as Ie, green as ze, lime as Re, yellow as Se, amber as Me, orange as _e, brown as Ee, grey as Ae, blueGrey as Le } from "@mui/material/colors";
17
+ import "@blocklet/pages-kit/builtin/uploader";
18
+ import "react-use";
19
+ import "lodash/cloneDeep";
20
+ import "@mui/icons-material";
21
+ import "react-dnd";
22
+ import "@arcblock/ux/lib/Tabs";
23
+ import "lodash/pick";
24
+ import "@mui/lab";
25
+ import "immer";
26
+ import "lodash/omit";
27
+ import "react-router-dom";
28
+ import "@arcblock/ux/lib/Button";
29
+ import "is-uri";
30
+ import "@arcblock/ux/lib/Toast";
31
+ import "@mui/material/Tooltip";
32
+ import "@mui/icons-material/KeyboardArrowLeft";
33
+ import Oe from "@mui/material/Box";
34
+ import "@mui/material/DialogTitle";
35
+ import "@mui/material/IconButton";
36
+ import "@mui/material/Dialog";
37
+ import "@mui/material/useMediaQuery";
38
+ import { css as Pe } from "@emotion/react";
39
+ import "@mui/material/Alert";
40
+ import "@mui/material/AlertTitle";
41
+ import "react-error-boundary";
42
+ import "ufo";
43
+ import "lodash/isEmpty";
44
+ import "yaml";
45
+ import "@mui/material/Typography";
46
+ import "joi";
47
+ import { createStatusApi as U, createTextCompletionApi as Ne } from "@blocklet/ai-kit/api";
48
+ import { createFetch as $e } from "@blocklet/js-sdk";
49
+ import "@mui/x-date-pickers";
50
+ import "@mui/x-date-pickers/AdapterDayjs";
51
+ import "@mui/x-date-pickers/LocalizationProvider";
52
+ import "circular-natal-horoscope-js/dist";
53
+ import X from "dayjs";
54
+ import De from "dayjs/plugin/timezone";
55
+ import Be from "dayjs/plugin/utc";
56
+ import "fast-deep-equal";
57
+ import "lodash/isNil";
58
+ import "tz-lookup";
59
+ import "@mui/icons-material/CheckCircleOutline";
60
+ import "lodash/uniq";
61
+ import "lodash/get";
62
+ import "lodash/set";
63
+ import { nextId as Y } from "@blocklet/pages-kit/utils/common";
64
+ import { CustomComponentRenderer as Ge } from "@blocklet/pages-kit/components";
65
+ ye[300], ve[300], Ce[300], // deepPurple['300'],
66
+ we[300], ke[300], // lightBlue['300'],
67
+ Te[300], Ie[300], ze[300], // lightGreen['300'],
68
+ Re[300], Se[300], Me[300], _e[300], // deepOrange['300'],
69
+ Ee[300], Ae[300], Le[300];
70
+ m(n)`
71
+ .color-item {
72
+ position: relative;
73
+ }
74
+ .color-item__checked {
75
+ position: absolute;
76
+ top: 0;
77
+ bottom: 0;
78
+ left: 0;
79
+ right: 0;
80
+ display: flex;
81
+ justify-content: center;
82
+ align-items: center;
83
+ color: rgba(255, 255, 255, 0.85);
84
+ }
85
+ .color-item__delete {
86
+ position: absolute;
87
+ top: 0;
88
+ right: 0;
89
+ }
90
+ `;
91
+ const E = 0.5;
92
+ H(n)`
93
+ display: flex;
94
+ align-items: center;
95
+ padding: 8px;
96
+ border-bottom: ${({ theme: i }) => `1px solid ${i.palette.divider}`};
97
+ user-select: none;
98
+ cursor: pointer;
99
+ position: relative;
100
+
101
+ :hover {
102
+ background-color: rgba(200, 200, 200, 0.3);
103
+ }
104
+
105
+ &.selected {
106
+ background-color: rgba(200, 200, 200, 0.3);
107
+ }
108
+
109
+ &.sub-selected {
110
+ background-color: rgba(200, 200, 200, 0.3);
111
+ }
112
+
113
+ &.disabledDrag {
114
+ cursor: default;
115
+ }
116
+
117
+ > .drag,
118
+ > .actions {
119
+ line-height: 1;
120
+
121
+ svg {
122
+ font-size: 16px;
123
+ vertical-align: middle;
124
+ }
125
+ }
126
+
127
+ > .drag {
128
+ cursor: grab;
129
+ opacity: ${E};
130
+ position: relative;
131
+
132
+ &.disabledDrag {
133
+ cursor: default;
134
+
135
+ &:has(.origin-drag-icon):after {
136
+ content: '';
137
+ position: absolute;
138
+ top: 50%;
139
+ left: 50%;
140
+ width: 120%;
141
+ height: 1px;
142
+ background-color: ${({ theme: i }) => i.palette.error.main};
143
+ transform: translate(-50%, -50%) rotate(-45deg);
144
+ z-index: 1;
145
+ }
146
+ }
147
+ }
148
+
149
+ > .actions {
150
+ display: flex;
151
+ align-items: center;
152
+ overflow: hidden;
153
+
154
+ > * {
155
+ margin-right: 0.5em;
156
+ opacity: 0;
157
+ display: inline-block;
158
+ cursor: pointer;
159
+ }
160
+
161
+ > .visible {
162
+ display: inline-block;
163
+ opacity: ${E};
164
+ }
165
+ }
166
+
167
+ &:hover {
168
+ > .actions {
169
+ > * {
170
+ display: inline-block;
171
+ opacity: ${E} !important;
172
+ }
173
+ }
174
+ }
175
+
176
+ > .name {
177
+ flex: 1;
178
+ overflow: hidden;
179
+ text-overflow: ellipsis;
180
+ padding: 0 4px;
181
+ font-size: 14px;
182
+ }
183
+ `;
184
+ H(n)`
185
+ position: relative;
186
+ border: 1px solid #c0c0c0;
187
+ min-height: 40px;
188
+ border-radius: 4px;
189
+ padding: 14px 14px;
190
+ .label-box__label {
191
+ left: 6px;
192
+ height: 1em;
193
+ padding: 0 6px;
194
+ line-height: 1;
195
+ }
196
+ .label-box__actions {
197
+ right: 6px;
198
+ }
199
+ .label-box__label,
200
+ .label-box__actions {
201
+ position: absolute;
202
+ background: ${({ theme: i }) => i.palette.background.default};
203
+ overflow: visible;
204
+ display: inline-block;
205
+ top: 0;
206
+ transform: translateY(-50%);
207
+ }
208
+ `;
209
+ const je = L({ embed: !1 }), { Provider: nt } = je;
210
+ L(void 0);
211
+ U({
212
+ axios: G,
213
+ path: "/api/ai/status"
214
+ });
215
+ U({
216
+ axios: G,
217
+ path: "/api/ai/agent-status"
218
+ });
219
+ Ne({
220
+ fetch: $e(),
221
+ path: "/api/ai/completions"
222
+ });
223
+ X.extend(Be);
224
+ X.extend(De);
225
+ m(n)`
226
+ flex-grow: 1;
227
+ display: flex;
228
+ flex-direction: column;
229
+
230
+ > .actions {
231
+ position: sticky;
232
+ bottom: 0px;
233
+ margin-top: 20px;
234
+ z-index: 1;
235
+
236
+ @media (max-height: 700px) {
237
+ position: static;
238
+ }
239
+
240
+ > .connect-tip {
241
+ font-weight: 600;
242
+ font-size: 14px;
243
+ line-height: 17px;
244
+ text-align: center;
245
+ color: #9397a1;
246
+ margin-bottom: 20px;
247
+ }
248
+
249
+ .submit {
250
+ height: 43px;
251
+ width: 100%;
252
+ background: linear-gradient(90deg, #45e4fa 0%, #8a45fa 52.08%, #fa45bc 100%);
253
+ border-radius: 30px;
254
+ box-shadow: none;
255
+ text-transform: none;
256
+ width: 100%;
257
+ border: 0;
258
+ margin: 0;
259
+ padding: 8.5px 14px;
260
+ font-size: 100%;
261
+
262
+ &.Mui-disabled {
263
+ color: rgba(0, 0, 0, 0.26);
264
+ background: rgba(0, 0, 0, 0.12);
265
+ }
266
+ }
267
+ }
268
+
269
+ .MuiFormHelperText-root {
270
+ font-style: normal;
271
+ font-weight: 500;
272
+ font-size: 12px;
273
+ line-height: 14px;
274
+ color: #9397a1;
275
+ margin: 0;
276
+ margin-top: 4px;
277
+ }
278
+
279
+ .MuiOutlinedInput-root {
280
+ background: #fbfbfb;
281
+ border-radius: 4px;
282
+
283
+ fieldset {
284
+ border: 1px solid #f6f6f6;
285
+ }
286
+
287
+ &:hover fieldset {
288
+ border: 1px solid #a482fe;
289
+ }
290
+
291
+ input {
292
+ width: 100%;
293
+ border: 0;
294
+ margin: 0;
295
+ border-radius: 4px;
296
+ padding: 8.5px 14px;
297
+ font-size: 100%;
298
+ }
299
+ }
300
+
301
+ .Mui-focused {
302
+ &.MuiFormLabel-root {
303
+ color: #a482fe;
304
+ }
305
+
306
+ &.MuiOutlinedInput-root {
307
+ fieldset {
308
+ border: 1px solid #a482fe;
309
+ }
310
+ }
311
+ }
312
+
313
+ .Mui-error {
314
+ &.MuiFormLabel-root {
315
+ color: #f16e6e;
316
+ }
317
+
318
+ &.MuiOutlinedInput-root + .MuiFormHelperText-root {
319
+ color: #f16e6e;
320
+ }
321
+
322
+ &.MuiOutlinedInput-root {
323
+ fieldset {
324
+ border: 1px solid #f16e6e;
325
+ }
326
+ }
327
+ }
328
+ `;
329
+ L({});
330
+ m(n)`
331
+ display: flex;
332
+ flex-direction: column;
333
+ flex: 1;
334
+
335
+ .lazy-image-wrapper {
336
+ border-radius: 12px;
337
+
338
+ img {
339
+ border-radius: 12px;
340
+ }
341
+ }
342
+ `;
343
+ m(n)`
344
+ background: #fbfbfb;
345
+ border: 1px solid #f6f6f6;
346
+ border-radius: 4px;
347
+
348
+ &:has(.selected) {
349
+ border: 1px solid #a482fe;
350
+ }
351
+
352
+ &:has(.Mui-focused) {
353
+ border: 1px solid #a482fe;
354
+ }
355
+
356
+ > .input {
357
+ padding: 12px;
358
+ font-weight: 500;
359
+ font-size: 16px;
360
+ line-height: 19px;
361
+ color: #25292f;
362
+ cursor: pointer;
363
+ }
364
+ `;
365
+ m(Oe)`
366
+ background: #f6f2ff;
367
+ margin-bottom: 20px;
368
+
369
+ .title {
370
+ font-style: normal;
371
+ font-weight: 700;
372
+ font-size: 24px;
373
+ line-height: 33px;
374
+ color: #25292f;
375
+ }
376
+
377
+ .subtitle {
378
+ font-style: normal;
379
+ font-weight: 500;
380
+ font-size: 16px;
381
+ line-height: 22px;
382
+ color: #9397a1;
383
+ margin-top: 4px;
384
+ }
385
+ `;
386
+ m(n)`
387
+ display: block;
388
+ padding: 16px;
389
+ text-decoration: none;
390
+ border-radius: 12px;
391
+ cursor: pointer;
392
+ box-shadow:
393
+ rgb(255, 255, 255) 0 0 0 0,
394
+ rgb(226, 232, 240) 0 0 0 1px,
395
+ rgba(0, 0, 0, 0.05) 0 1px 2px 0;
396
+ color: inherit;
397
+ height: 100%;
398
+ position: relative;
399
+
400
+ &:hover {
401
+ box-shadow:
402
+ rgb(255, 255, 255) 0 0 0 0,
403
+ rgb(203, 213, 225) 0 0 0 2px,
404
+ rgba(0, 0, 0, 0.1) 0 10px 15px -3px,
405
+ rgba(0, 0, 0, 0.1) 0 4px 6px -4px;
406
+ }
407
+
408
+ .description {
409
+ word-break: break-all;
410
+ text-overflow: ellipsis;
411
+ display: -webkit-box;
412
+ -webkit-box-orient: vertical;
413
+ -webkit-line-clamp: 2;
414
+ overflow: hidden;
415
+ }
416
+ `;
417
+ Pe`
418
+ .MuiMenu-root {
419
+ z-index: 13010 !important;
420
+ }
421
+ `;
422
+ m(n)`
423
+ display: flex;
424
+ flex-direction: column;
425
+ flex: 1;
426
+
427
+ .lazy-image-wrapper {
428
+ border-radius: 12px;
429
+
430
+ img {
431
+ border-radius: 12px;
432
+ }
433
+ }
434
+ `;
435
+ m(n)`
436
+ background: #fbfbfb;
437
+ border: 1px solid #f6f6f6;
438
+ border-radius: 4px;
439
+ position: relative;
440
+ cursor: pointer;
441
+
442
+ &:has(.selected) {
443
+ border: 1px solid #a482fe;
444
+ }
445
+
446
+ &:has(.Mui-focused) {
447
+ border: 1px solid #a482fe;
448
+ }
449
+
450
+ > .input {
451
+ padding: 12px;
452
+ font-weight: 500;
453
+ font-size: 16px;
454
+ line-height: 19px;
455
+ color: #25292f;
456
+ cursor: pointer;
457
+ }
458
+ `;
459
+ m(n)`
460
+ > .ai-button {
461
+ display: none;
462
+ z-index: 1;
463
+
464
+ &.active {
465
+ display: inline-flex;
466
+ }
467
+
468
+ .MuiCircularProgress-root {
469
+ position: absolute;
470
+ left: 0;
471
+ top: 0;
472
+ right: 0;
473
+ bottom: 0;
474
+ margin: auto;
475
+ }
476
+ }
477
+ `;
478
+ m(n)`
479
+ > .language-button {
480
+ display: none;
481
+ z-index: 1;
482
+
483
+ &.active {
484
+ display: inline-flex;
485
+ }
486
+
487
+ .MuiCircularProgress-root {
488
+ position: absolute;
489
+ left: 0;
490
+ top: 0;
491
+ right: 0;
492
+ bottom: 0;
493
+ margin: auto;
494
+ }
495
+ }
496
+ `;
497
+ m(n)`
498
+ position: relative;
499
+
500
+ .action {
501
+ position: absolute;
502
+ right: 4px;
503
+ top: 4px;
504
+ z-index: 1;
505
+ display: flex;
506
+ align-items: center;
507
+ }
508
+
509
+ &:hover {
510
+ .language-button {
511
+ display: inline-flex;
512
+ }
513
+ }
514
+
515
+ &:hover {
516
+ .ai-button {
517
+ display: inline-flex;
518
+ }
519
+ }
520
+ `;
521
+ Y();
522
+ const We = {
523
+ type: "default",
524
+ title: "Section CardList",
525
+ description: "This is Section CardList",
526
+ center: !0,
527
+ dark: !1,
528
+ background: "",
529
+ col: 3,
530
+ gap: 2,
531
+ align: "top",
532
+ textAlign: "left",
533
+ iconSize: 100,
534
+ padding: "normal",
535
+ list: [
536
+ {
537
+ id: Y(),
538
+ title: "Simplified Service Delivery",
539
+ description: "Block Server's Service Gateway makes networking easy with access to load balancing, SSL termination, automatic and customizable URL mapping, and redirects.",
540
+ image: "https://www.arcblock.io/static/ead0cabde7f2b7ff34db8f3e8ceca271/afc4b/builder.png"
541
+ }
542
+ ]
543
+ };
544
+ function Fe({
545
+ componentId: i,
546
+ locale: p,
547
+ components: l
548
+ }) {
549
+ const {
550
+ state: {
551
+ config: { defaultLocale: d }
552
+ },
553
+ localState: { customComponentPreviewerProperties: u }
554
+ } = j(), r = J();
555
+ return /* @__PURE__ */ t(
556
+ Ge,
557
+ {
558
+ componentId: i,
559
+ locale: p,
560
+ dev: {
561
+ mode: "draft",
562
+ components: l || r,
563
+ defaultLocale: d
564
+ },
565
+ properties: u?.[i] ?? {}
566
+ }
567
+ );
568
+ }
569
+ const D = 260, He = 5, K = "IGNORE_RENDER_BLOCKLET_TITLE", B = (i, p) => i ? Object.entries(i).map(([l, d]) => ({
570
+ id: l,
571
+ component: l,
572
+ name: d?.data?.name || d?.component?.name || l,
573
+ properties: d?.data || d.component,
574
+ previewImage: d?.data?.previewImage || null,
575
+ type: p,
576
+ blockletId: d?.blockletId,
577
+ blockletTitle: d?.blockletTitle
578
+ })) : [], Ve = [
579
+ {
580
+ id: "section",
581
+ name: "Section",
582
+ properties: be
583
+ },
584
+ {
585
+ id: "section-card-list",
586
+ name: "Section Card List",
587
+ properties: We
588
+ },
589
+ {
590
+ id: "toc",
591
+ name: "Toc",
592
+ properties: he
593
+ },
594
+ {
595
+ id: "iframe",
596
+ name: "Embed",
597
+ properties: ge
598
+ },
599
+ {
600
+ id: "layout-block",
601
+ name: "Section Layout",
602
+ properties: {}
603
+ }
604
+ ].map((i) => ({ ...i, type: "basic", component: i.id }));
605
+ function at({
606
+ state: i,
607
+ open: p,
608
+ onClose: l,
609
+ onSelect: d,
610
+ defaultTab: u,
611
+ title: r,
612
+ componentGroups: w,
613
+ components: f,
614
+ multiple: c = !1,
615
+ defaultSelected: b,
616
+ emptyText: z
617
+ }) {
618
+ const { t: s } = F(), e = Q({
619
+ selectedComponent: null,
620
+ activeTab: u,
621
+ searchQuery: ""
622
+ }), g = M(() => w || [
623
+ {
624
+ name: "basic",
625
+ label: s("maker.components.basicGroup"),
626
+ components: Ve
627
+ },
628
+ i && {
629
+ name: "custom",
630
+ label: s("maker.components.customGroup"),
631
+ components: B(Z(i), "custom")
632
+ },
633
+ i && {
634
+ name: "resource",
635
+ label: s("maker.components.resourceGroup"),
636
+ components: B(ee(i), "resource")
637
+ }
638
+ ].filter(Boolean), [w, s, i, p]), x = e.activeTab || g[0]?.name, k = () => {
639
+ e.selectedComponent && (d(e.selectedComponent), l());
640
+ }, _ = (o) => {
641
+ if (o) {
642
+ if (v(o)) {
643
+ c ? e.selectedComponent = e.selectedComponent.filter((a) => a.id !== o.id) : e.selectedComponent = null;
644
+ return;
645
+ }
646
+ if (c) {
647
+ const a = Array.isArray(e.selectedComponent) ? e.selectedComponent : [], h = a.some((R) => R.id === o.id);
648
+ e.selectedComponent = h ? a.filter((R) => R.id !== o.id) : [...a, o];
649
+ } else
650
+ e.selectedComponent = o;
651
+ }
652
+ }, v = (o) => e.selectedComponent ? c ? e.selectedComponent.some((a) => a.id === o.id) : e.selectedComponent.id === o.id : !1, C = g?.length === 0, T = M(() => {
653
+ const o = g.find((a) => a?.name === x)?.components || [];
654
+ return e.searchQuery ? o.filter((a) => a.name.toLowerCase().includes(e.searchQuery.toLowerCase())) : o;
655
+ }, [x, g, e.searchQuery]);
656
+ A(() => {
657
+ e.searchQuery = "", p && b ? e.selectedComponent = c ? Array.isArray(b) ? b : [b] : b : e.selectedComponent = null;
658
+ }, [p, b, c]);
659
+ const I = T?.length === 0, O = z || s(x === "resource" ? "maker.components.needAddResource" : "maker.components.noComponents"), q = M(() => T ? T.reduce(
660
+ (o, a) => {
661
+ const h = a.blockletId || K, R = a.blockletTitle || s("maker.components.defaultGroup");
662
+ return o[h] || (o[h] = {
663
+ title: R,
664
+ components: []
665
+ }), o[h].components.push(a), o;
666
+ },
667
+ {}
668
+ ) : {}, [T]);
669
+ return /* @__PURE__ */ y(
670
+ re,
671
+ {
672
+ open: p,
673
+ onClose: l,
674
+ maxWidth: "lg",
675
+ fullWidth: !0,
676
+ slotProps: {
677
+ paper: {
678
+ sx: {
679
+ height: "80vh",
680
+ maxHeight: "80vh",
681
+ display: "flex",
682
+ flexDirection: "column"
683
+ }
684
+ }
685
+ },
686
+ children: [
687
+ /* @__PURE__ */ y(ie, { className: "between", sx: { display: "flex", gap: 2 }, children: [
688
+ /* @__PURE__ */ t(n, { children: r || s("maker.components.addComponent") }),
689
+ /* @__PURE__ */ t(
690
+ ne,
691
+ {
692
+ size: "small",
693
+ placeholder: s("maker.components.searchComponent"),
694
+ value: e.searchQuery,
695
+ onChange: (o) => e.searchQuery = o.target.value,
696
+ sx: { flex: 1, maxWidth: 350 },
697
+ slotProps: {
698
+ input: {
699
+ startAdornment: /* @__PURE__ */ t(
700
+ P,
701
+ {
702
+ icon: "tabler:search",
703
+ style: {
704
+ marginRight: 8
705
+ }
706
+ }
707
+ )
708
+ }
709
+ }
710
+ }
711
+ ),
712
+ /* @__PURE__ */ t(ae, { size: "small", onClick: l, children: /* @__PURE__ */ t(n, { component: P, icon: "tabler:x", sx: { color: "text.primary" } }) })
713
+ ] }),
714
+ /* @__PURE__ */ y(
715
+ se,
716
+ {
717
+ sx: {
718
+ display: "flex",
719
+ gap: 2,
720
+ pl: "8px !important",
721
+ flex: 1,
722
+ overflow: "hidden"
723
+ },
724
+ children: [
725
+ !C && /* @__PURE__ */ t(n, { sx: { width: 150, borderRight: 1, borderColor: "divider" }, children: /* @__PURE__ */ t(
726
+ le,
727
+ {
728
+ orientation: "vertical",
729
+ value: x,
730
+ onChange: (o, a) => e.activeTab = a,
731
+ sx: {
732
+ "& .MuiTab-root": {
733
+ alignItems: "flex-start",
734
+ textAlign: "left",
735
+ minHeight: 48,
736
+ py: 1.5,
737
+ px: 2
738
+ }
739
+ },
740
+ children: g.map((o, a) => /* @__PURE__ */ t(pe, { label: o?.label, value: o?.name }, a))
741
+ }
742
+ ) }),
743
+ /* @__PURE__ */ t(
744
+ n,
745
+ {
746
+ sx: {
747
+ flex: 1,
748
+ overflowX: "hidden",
749
+ overflowY: "auto",
750
+ pr: 1
751
+ },
752
+ children: I ? /* @__PURE__ */ t(W, { children: O }) : /* @__PURE__ */ t(
753
+ Ue,
754
+ {
755
+ wrapperComponent: N,
756
+ wrapperComponentProps: {
757
+ container: !0,
758
+ spacing: 2,
759
+ sx: I ? {
760
+ height: "100%"
761
+ } : {}
762
+ },
763
+ groups: q,
764
+ emptyText: O,
765
+ renderItem: (o) => {
766
+ const a = v(o);
767
+ return /* @__PURE__ */ t(
768
+ N,
769
+ {
770
+ sx: {
771
+ width: "100%",
772
+ "& .add-component-card": {
773
+ boxShadow: "none",
774
+ border: 1,
775
+ borderColor: a ? "primary.main" : "grey.200",
776
+ "& .check-container": {
777
+ display: a ? "flex" : "none",
778
+ position: "absolute",
779
+ right: 0,
780
+ bottom: 0,
781
+ justifyContent: "flex-end",
782
+ alignItems: "flex-end",
783
+ width: 30,
784
+ height: 30,
785
+ overflow: "hidden",
786
+ transition: "all 0.3s ease",
787
+ color: "white",
788
+ "&::after": {
789
+ position: "absolute",
790
+ zIndex: 0,
791
+ display: "block",
792
+ width: 0,
793
+ height: 0,
794
+ borderTop: "transparent solid 15px",
795
+ borderLeft: "transparent solid 15px",
796
+ borderBottom: (h) => `solid 15px ${h.palette.primary.main}`,
797
+ borderRight: (h) => `solid 15px ${h.palette.primary.main}`,
798
+ transition: "all 0.1s ease",
799
+ content: '""'
800
+ },
801
+ "& .check-icon": {
802
+ position: "relative",
803
+ zIndex: 2,
804
+ margin: "0 1px 1px 0",
805
+ fontSize: 16,
806
+ transition: "all 0.2s ease"
807
+ }
808
+ }
809
+ }
810
+ },
811
+ size: {
812
+ xs: 12,
813
+ md: 6,
814
+ lg: 4
815
+ },
816
+ children: /* @__PURE__ */ y(
817
+ de,
818
+ {
819
+ className: "add-component-card",
820
+ sx: {
821
+ position: "relative",
822
+ width: "100%",
823
+ cursor: "pointer"
824
+ },
825
+ onClick: () => _(o),
826
+ children: [
827
+ /* @__PURE__ */ t(
828
+ ce,
829
+ {
830
+ sx: {
831
+ width: "100%",
832
+ height: D,
833
+ overflow: "auto",
834
+ position: "relative"
835
+ },
836
+ children: /* @__PURE__ */ t(
837
+ Qe,
838
+ {
839
+ components: f,
840
+ containerHeight: D,
841
+ component: o
842
+ },
843
+ o.id
844
+ )
845
+ }
846
+ ),
847
+ /* @__PURE__ */ t(
848
+ me,
849
+ {
850
+ sx: {
851
+ bgcolor: "background.paper",
852
+ borderTop: 1,
853
+ borderColor: a ? "primary.main" : "grey.200"
854
+ },
855
+ children: /* @__PURE__ */ t(
856
+ V,
857
+ {
858
+ variant: "body1",
859
+ noWrap: !0,
860
+ sx: {
861
+ fontWeight: "bold"
862
+ },
863
+ children: o.name
864
+ }
865
+ )
866
+ }
867
+ ),
868
+ /* @__PURE__ */ t(n, { className: "check-container", children: /* @__PURE__ */ t(te, { className: "check-icon" }) })
869
+ ]
870
+ }
871
+ )
872
+ },
873
+ o.id
874
+ );
875
+ }
876
+ }
877
+ )
878
+ }
879
+ )
880
+ ]
881
+ }
882
+ ),
883
+ /* @__PURE__ */ y(
884
+ ue,
885
+ {
886
+ sx: {
887
+ borderTop: 1,
888
+ borderColor: "divider",
889
+ p: 2
890
+ },
891
+ children: [
892
+ /* @__PURE__ */ t($, { onClick: l, variant: "outlined", children: s("common.cancel") }),
893
+ /* @__PURE__ */ t(
894
+ $,
895
+ {
896
+ onClick: k,
897
+ variant: "contained",
898
+ disabled: !e.selectedComponent || c && Array.isArray(e.selectedComponent) && e.selectedComponent.length === 0,
899
+ children: c && Array.isArray(e.selectedComponent) && e.selectedComponent.length > 0 ? s("common.addMultiple", { count: e.selectedComponent.length }) : s("common.add")
900
+ }
901
+ )
902
+ ]
903
+ }
904
+ )
905
+ ]
906
+ }
907
+ );
908
+ }
909
+ function Qe({
910
+ containerHeight: i,
911
+ component: p,
912
+ minScale: l = 0.1,
913
+ components: d
914
+ }) {
915
+ const { locale: u } = F(), r = Q({
916
+ scale: 1,
917
+ shouldScroll: !1,
918
+ isVisible: !1,
919
+ hadInit: !1
920
+ }), { currentPage: w } = j(), f = S(null), c = S(null), b = S(0), z = S(null);
921
+ A(() => {
922
+ const v = new IntersectionObserver(
923
+ ([C]) => {
924
+ r.isVisible = C.isIntersecting;
925
+ },
926
+ {
927
+ root: null,
928
+ rootMargin: "50px",
929
+ threshold: 0
930
+ }
931
+ );
932
+ return c.current && v.observe(c.current), () => v.disconnect();
933
+ }, []), A(() => {
934
+ const v = () => {
935
+ if (b.current += 1, b.current > He) {
936
+ C.disconnect();
937
+ return;
938
+ }
939
+ if (!p.previewImage && f.current) {
940
+ const T = f.current.scrollHeight, I = i / T;
941
+ I < l ? (r.scale = l, r.shouldScroll = !0) : I < 1 ? (r.scale = I, r.shouldScroll = !1) : (r.scale = 1, r.shouldScroll = !1);
942
+ }
943
+ z.current && clearTimeout(z.current), z.current = setTimeout(() => {
944
+ r.hadInit = !0;
945
+ }, 200);
946
+ }, C = new ResizeObserver(() => {
947
+ setTimeout(v, 20);
948
+ });
949
+ return f.current && r.isVisible && C.observe(f.current), () => {
950
+ C.disconnect();
951
+ };
952
+ }, [i, l, r.isVisible, p]);
953
+ const { id: s, type: e, component: g, properties: x, previewImage: k } = p, _ = M(() => r.isVisible ? k ? /* @__PURE__ */ t(
954
+ n,
955
+ {
956
+ component: "img",
957
+ loading: "lazy",
958
+ src: oe(k),
959
+ alt: p.name,
960
+ sx: {
961
+ width: "100%",
962
+ height: "100%",
963
+ objectFit: "cover",
964
+ borderRadius: 1,
965
+ cursor: "pointer"
966
+ }
967
+ },
968
+ s
969
+ ) : e === "basic" ? /* @__PURE__ */ t(
970
+ xe,
971
+ {
972
+ id: s,
973
+ type: g,
974
+ section: x,
975
+ config: {
976
+ ...x,
977
+ locale: u,
978
+ editing: !1,
979
+ dev: {
980
+ mode: "draft"
981
+ }
982
+ },
983
+ page: w
984
+ },
985
+ s
986
+ ) : /* @__PURE__ */ t(Fe, { componentId: s, locale: u, components: d }, s) : null, [s, e, g, x, u, k, r.isVisible]);
987
+ return /* @__PURE__ */ t(
988
+ n,
989
+ {
990
+ ref: c,
991
+ sx: {
992
+ position: "relative",
993
+ width: "100%",
994
+ height: "100%",
995
+ overflowX: "hidden",
996
+ overflowY: r.shouldScroll ? "auto" : "hidden",
997
+ transition: "all 0.3s ease"
998
+ },
999
+ children: /* @__PURE__ */ y(
1000
+ n,
1001
+ {
1002
+ sx: {
1003
+ transform: `scale(${r.scale})`,
1004
+ transformOrigin: "top left",
1005
+ width: `${100 / r.scale}%`,
1006
+ height: r.hadInit && r.shouldScroll ? "100%" : `${100 / r.scale}%`
1007
+ },
1008
+ children: [
1009
+ !r.hadInit && /* @__PURE__ */ t(fe, { variant: "rectangular", width: "100%", height: "100%" }),
1010
+ /* @__PURE__ */ t(
1011
+ n,
1012
+ {
1013
+ ref: f,
1014
+ sx: {
1015
+ width: "100%",
1016
+ height: k ? "100%" : "auto",
1017
+ pointerEvents: "none",
1018
+ opacity: r.hadInit ? 1 : 0
1019
+ },
1020
+ children: _
1021
+ }
1022
+ )
1023
+ ]
1024
+ }
1025
+ )
1026
+ }
1027
+ );
1028
+ }
1029
+ function Ue({
1030
+ groups: i,
1031
+ emptyText: p,
1032
+ renderItem: l,
1033
+ wrapperComponent: d = n,
1034
+ wrapperComponentProps: u = {
1035
+ display: "inline-flex",
1036
+ flexWrap: "wrap",
1037
+ gap: 1
1038
+ }
1039
+ }) {
1040
+ return /* @__PURE__ */ t(n, { children: Object.keys(i).length > 0 ? Object.entries(i).map(([r, { title: w, components: f }]) => /* @__PURE__ */ y(
1041
+ n,
1042
+ {
1043
+ sx: {
1044
+ mb: 3
1045
+ },
1046
+ children: [
1047
+ r !== K && /* @__PURE__ */ y(
1048
+ V,
1049
+ {
1050
+ className: "blocklet-title",
1051
+ variant: "subtitle2",
1052
+ sx: {
1053
+ mb: 2,
1054
+ fontWeight: 500,
1055
+ color: "text.primary",
1056
+ display: "flex",
1057
+ alignItems: "center",
1058
+ gap: 1
1059
+ },
1060
+ children: [
1061
+ /* @__PURE__ */ t(
1062
+ n,
1063
+ {
1064
+ component: "span",
1065
+ sx: {
1066
+ width: 4,
1067
+ height: 20,
1068
+ backgroundColor: "primary.main",
1069
+ borderRadius: 1,
1070
+ display: "inline-block"
1071
+ }
1072
+ }
1073
+ ),
1074
+ w
1075
+ ]
1076
+ }
1077
+ ),
1078
+ /* @__PURE__ */ t(d, { ...u, children: f.map((c) => l(c)) })
1079
+ ]
1080
+ },
1081
+ r
1082
+ )) : /* @__PURE__ */ t(W, { children: p }) });
1083
+ }
2
1084
  export {
3
- e as default
1085
+ at as AddComponent,
1086
+ Qe as AutoScaledComponentRenderer,
1087
+ Ve as BASIC_COMPONENT_LIST,
1088
+ Ue as GroupedComponentsList,
1089
+ at as default,
1090
+ B as formatComponent
4
1091
  };