@chaibuilder/sdk 1.2.61 → 1.2.62

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 (74) hide show
  1. package/README.md +1 -1
  2. package/dist/AddBlocks-Wja5xsTO.cjs +1 -0
  3. package/dist/{AddBlocks-L-3Io1jR.js → AddBlocks-ucNQHhx7.js} +18 -18
  4. package/dist/CanvasArea-1lUzUorh.js +975 -0
  5. package/dist/CanvasArea-dsxnMndK.cjs +60 -0
  6. package/dist/{CodeEditor-cY6z8D4N.js → CodeEditor-LeNocbY6.js} +1 -1
  7. package/dist/{CodeEditor-NuzOGqRn.cjs → CodeEditor-kk0bmQ3P.cjs} +1 -1
  8. package/dist/{CurrentPage-hoe1khi5.js → CurrentPage-huy7O-ih.js} +3 -3
  9. package/dist/{CurrentPage-_K-CIG12.cjs → CurrentPage-oPzQ-MY2.cjs} +1 -1
  10. package/dist/{ListTree-yoltG7gq.js → ListTree-5T-2KuBE.js} +1 -1
  11. package/dist/{ListTree-8jpTvI-s.cjs → ListTree-Fwl6Dtgc.cjs} +1 -1
  12. package/dist/{PagesPanel-ITbSJK04.cjs → PagesPanel-85U4O4ex.cjs} +1 -1
  13. package/dist/{PagesPanel-72BMvQe1.js → PagesPanel-IT7AmWMs.js} +4 -4
  14. package/dist/{ProjectPanel-2k7uFIr3.cjs → ProjectPanel-NiOqTkub.cjs} +1 -1
  15. package/dist/{ProjectPanel-Z5SIPEUd.js → ProjectPanel-hhxqbHEX.js} +4 -4
  16. package/dist/{Settings-ye3f6PLl.cjs → Settings-NqIs7PLQ.cjs} +1 -1
  17. package/dist/{Settings-vEsUk_p5.js → Settings-UO9zB4rm.js} +2 -2
  18. package/dist/{SidePanels-DPh7uRVD.js → SidePanels-2ZXeWnl7.js} +3 -3
  19. package/dist/{SidePanels-o_ItFCvJ.cjs → SidePanels-n5WUkXLw.cjs} +1 -1
  20. package/dist/{ThemeConfiguration-03I3INEI.cjs → ThemeConfiguration-UNRnCxnU.cjs} +1 -1
  21. package/dist/{ThemeConfiguration-e_4e_ZcS.js → ThemeConfiguration-VSQaQn9_.js} +4 -4
  22. package/dist/{Topbar-9ZZq8_wR.js → Topbar-Tkn___pR.js} +2 -2
  23. package/dist/{Topbar-z4-2S39X.cjs → Topbar-m48Xdj0O.cjs} +1 -1
  24. package/dist/UILibrariesPanel-0NMxbnSZ.js +215 -0
  25. package/dist/UILibrariesPanel-9V4REpxW.cjs +1 -0
  26. package/dist/{UnsplashImages-Y0TGxNbH.js → UnsplashImages-LU3fiooG.js} +1 -1
  27. package/dist/{UnsplashImages-5JbDig-S.cjs → UnsplashImages-fm761J9M.cjs} +1 -1
  28. package/dist/{UploadImages-f6wPPJxc.cjs → UploadImages-2_SIuRI7.cjs} +1 -1
  29. package/dist/{UploadImages-Dh35M55S.js → UploadImages-MjYi7gfH.js} +1 -1
  30. package/dist/{add-page-modal-j-TpEdWv.cjs → add-page-modal-QdlPDeMk.cjs} +1 -1
  31. package/dist/{add-page-modal-vQn_hxH5.js → add-page-modal-TWTjEGxY.js} +4 -4
  32. package/dist/{atoms-a0H_593V.cjs → atoms-KQpaDRnF.cjs} +1 -1
  33. package/dist/{atoms-ZOWyNoiC.js → atoms-Oomqut88.js} +2 -2
  34. package/dist/{confirm-alert-pGxJwZ2Q.js → confirm-alert-RNzVJyhU.js} +1 -1
  35. package/dist/{confirm-alert-C3wsf6lk.cjs → confirm-alert-gFBHhF1C.cjs} +1 -1
  36. package/dist/core.cjs +1 -1
  37. package/dist/core.js +2 -2
  38. package/dist/{delete-page-modal-PJR01Hk4.cjs → delete-page-modal-B5W3a1ZW.cjs} +1 -1
  39. package/dist/{delete-page-modal-IcqtlUoA.js → delete-page-modal-sUlXQ02P.js} +3 -3
  40. package/dist/email.cjs +1 -1
  41. package/dist/email.js +2 -2
  42. package/dist/{form-pya-o19L.js → form-c4b4A8Ap.js} +1 -1
  43. package/dist/{form-D9cWMUJ4.cjs → form-lqNXs-pv.cjs} +1 -1
  44. package/dist/{index-zP6-6HxK.js → index-0M3H1dVb.js} +3 -3
  45. package/dist/{index-TzLilp-0.js → index-SyrshOUV.js} +399 -402
  46. package/dist/{index-hHmusBAU.cjs → index-TKS5_SlD.cjs} +1 -1
  47. package/dist/{index-1OAjmTyp.js → index-WN67ca4z.js} +2 -2
  48. package/dist/{index-hdfBoPkh.cjs → index-afblGXKA.cjs} +2 -2
  49. package/dist/index-upb0eDoG.cjs +1 -0
  50. package/dist/lib.cjs +2 -2
  51. package/dist/lib.js +97 -146
  52. package/dist/{page-viewer-Y7vK77bu.js → page-viewer-qb3ot43w.js} +4 -4
  53. package/dist/{page-viewer-9PK_DG5o.cjs → page-viewer-v4K0Wkhx.cjs} +1 -1
  54. package/dist/plugin-2hf9pCRy.cjs +1 -0
  55. package/dist/plugin-wDnsBVPp.js +54 -0
  56. package/dist/{project-general-setting-z943m0_C.js → project-general-setting-LfoijnjK.js} +4 -4
  57. package/dist/{project-general-setting-7epnyvtg.cjs → project-general-setting-Q7hgQy5G.cjs} +1 -1
  58. package/dist/{project-seo-setting-rjrO9KDR.cjs → project-seo-setting-rjVkahzj.cjs} +1 -1
  59. package/dist/{project-seo-setting-PXJe5SSV.js → project-seo-setting-ztis1_yw.js} +2 -2
  60. package/dist/{single-page-detail-My6c05Vt.js → single-page-detail-Neoai4eq.js} +11 -11
  61. package/dist/{single-page-detail-lnU7gxgk.cjs → single-page-detail-tR7Qp9T4.cjs} +1 -1
  62. package/dist/studio.cjs +1 -1
  63. package/dist/studio.js +3 -3
  64. package/dist/ui.cjs +1 -1
  65. package/dist/ui.js +44 -44
  66. package/dist/web-blocks.cjs +1 -1
  67. package/dist/web-blocks.js +1 -1
  68. package/package.json +1 -1
  69. package/dist/AddBlocks-BtMNa99n.cjs +0 -1
  70. package/dist/CanvasArea-SgKI8O-Y.cjs +0 -59
  71. package/dist/CanvasArea-xq30AEQD.js +0 -978
  72. package/dist/UILibrariesPanel-LGbh-IZP.cjs +0 -1
  73. package/dist/UILibrariesPanel-PP4QDQRZ.js +0 -216
  74. package/dist/index-cH1CfTbV.cjs +0 -1
@@ -1,978 +0,0 @@
1
- var Rt = Object.defineProperty;
2
- var Ht = (t, e, n) => e in t ? Rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var L = (t, e, n) => (Ht(t, typeof e != "symbol" ? e + "" : e, n), n);
4
- import { j as s } from "./jsx-runtime-WbnYoNE9.js";
5
- import I, { createElement as lt, useCallback as q, useState as A, useEffect as C, Component as kt, Children as Pt, Suspense as Q, useRef as ct, useMemo as $t } from "react";
6
- import { map as O, includes as dt, toUpper as G, round as Ot, throttle as vt, has as V, isEmpty as D, first as J, omit as jt, pick as zt, get as h, isString as nt, memoize as Ut, each as Wt, find as qt, filter as wt, isNull as Vt } from "lodash-es";
7
- import { ResetIcon as pt, SunIcon as Kt, MobileIcon as ut, LaptopIcon as Yt, DesktopIcon as Xt, DotsVerticalIcon as Gt, EraserIcon as Zt, ZoomInIcon as Qt, DragHandleDots2Icon as Jt, ArrowUpIcon as te, CopyIcon as ee, TrashIcon as se } from "@radix-ui/react-icons";
8
- import { v as ne, B as K, aa as Ct, aR as _t, aS as oe, aT as ie, aU as re, a4 as Y, as as ae, h as z, E as le, F as ce, G as de, H as pe, I as ue, aV as me, aW as At, r as T, at as P, A as he, a as ge, b as fe, c as xe, d as ye, e as be, f as ke, g as ve, P as je, U as we, aX as Ce, a5 as St, aQ as W, aY as _e, a2 as Ae, ad as F, aZ as Bt, am as Se, a_ as U, a$ as Be, s as Ie, t as De, b0 as Te, b1 as Ee, X as Me, b2 as Ne, D as It, b3 as Le, b4 as Fe, b5 as Re, q as He, ai as Pe, b6 as $e, S as tt, $ as Oe } from "./index-TzLilp-0.js";
9
- import { a as ze, u as Ue, b as We, B as qe, E as Ve } from "./index-1OAjmTyp.js";
10
- import { useTranslation as ot } from "react-i18next";
11
- import { useAtom as b } from "jotai";
12
- import { SparklesIcon as Ke } from "lucide-react";
13
- import mt from "react-dom";
14
- import w from "prop-types";
15
- import { Quill as Ye } from "react-quill";
16
- import { d as it, a as Dt } from "./atoms-ZOWyNoiC.js";
17
- import { flip as Xe } from "@floating-ui/dom";
18
- import { useFloating as Ge, shift as Ze } from "@floating-ui/react-dom";
19
- import { useResizeObserver as Qe } from "@react-hookz/web";
20
- import { useFeature as Je } from "flagged";
21
- import ts from "@tailwindcss/typography";
22
- import es from "@tailwindcss/forms";
23
- import ss from "@tailwindcss/aspect-ratio";
24
- import ns from "tailwindcss-palette-generator";
25
- import { twMerge as os } from "tailwind-merge";
26
- import { S as ht, a as Tt } from "./MODIFIERS-fd5XOmum.js";
27
- import { getBlockComponent as is } from "@chaibuilder/runtime";
28
- import { includes as gt } from "lodash";
29
- import { Provider as rs } from "react-wrap-balancer";
30
- import { Resizable as as } from "re-resizable";
31
- import "./_commonjsHelpers-UyOWmZb0.js";
32
- import "@radix-ui/react-toggle";
33
- import "class-variance-authority";
34
- import "./utils-VpVqnC9m.js";
35
- import "clsx";
36
- import "@radix-ui/react-switch";
37
- import "@radix-ui/react-slot";
38
- import "@radix-ui/react-accordion";
39
- import "@radix-ui/react-alert-dialog";
40
- import "@radix-ui/react-dialog";
41
- import "@radix-ui/react-label";
42
- import "@radix-ui/react-scroll-area";
43
- import "@radix-ui/react-tabs";
44
- import "@radix-ui/react-tooltip";
45
- import "@radix-ui/react-popover";
46
- import "@radix-ui/react-menubar";
47
- import "@radix-ui/react-hover-card";
48
- import "@radix-ui/react-select";
49
- import "@radix-ui/react-dropdown-menu";
50
- import "@radix-ui/react-separator";
51
- import "@radix-ui/react-toast";
52
- import "cmdk";
53
- import "@radix-ui/react-context-menu";
54
- import "react-icons-picker";
55
- import "./Functions-7jnEwJyw.js";
56
- import "tree-model";
57
- import "i18next";
58
- import "react-hotkeys-hook";
59
- import "./index-VBXQixVm.js";
60
- const ls = () => {
61
- const { hasUndo: t, hasRedo: e, undo: n, redo: i } = ne();
62
- return /* @__PURE__ */ s.jsxs("div", { className: "flex items-center", children: [
63
- /* @__PURE__ */ s.jsx(K, { disabled: !t(), size: "sm", onClick: n, className: "rounded-full", variant: "ghost", children: /* @__PURE__ */ s.jsx(pt, {}) }),
64
- /* @__PURE__ */ s.jsx(K, { disabled: !e(), onClick: i, size: "sm", className: "rounded-full", variant: "ghost", children: /* @__PURE__ */ s.jsx(pt, { className: "rotate-180 scale-y-[-1] transform" }) })
65
- ] });
66
- };
67
- function cs() {
68
- const [t, e] = Ct();
69
- return /* @__PURE__ */ s.jsxs("div", { className: "flex items-center", children: [
70
- /* @__PURE__ */ s.jsx(Kt, { className: "size-4 shrink-0" }),
71
- /* @__PURE__ */ s.jsx(
72
- _t,
73
- {
74
- id: "dark-mode-switch",
75
- checked: t,
76
- onCheckedChange: () => {
77
- e(!t);
78
- },
79
- className: `${t ? "bg-violet-600" : "bg-violet-300"} relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,
80
- children: /* @__PURE__ */ s.jsx(
81
- "span",
82
- {
83
- "aria-hidden": "true",
84
- className: `${t ? "translate-x-5" : "translate-x-0"} pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`
85
- }
86
- )
87
- }
88
- ),
89
- /* @__PURE__ */ s.jsx(ze, { className: "size-4 ml-3 shrink-0" })
90
- ] });
91
- }
92
- const ft = ({ landscape: t = !1 }) => /* @__PURE__ */ s.jsxs(
93
- "svg",
94
- {
95
- className: t ? "rotate-90" : "",
96
- xmlns: "http://www.w3.org/2000/svg",
97
- viewBox: "0 0 13 13",
98
- xmlSpace: "preserve",
99
- width: 13,
100
- height: 13,
101
- children: [
102
- /* @__PURE__ */ s.jsx("g", { strokeWidth: 0 }),
103
- /* @__PURE__ */ s.jsx("g", { strokeLinecap: "round", strokeLinejoin: "round" }),
104
- /* @__PURE__ */ s.jsx(
105
- "path",
106
- {
107
- d: "M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",
108
- style: {
109
- fill: "#000"
110
- }
111
- }
112
- )
113
- ]
114
- }
115
- ), ds = [
116
- {
117
- title: "mobile_xs_title",
118
- content: "mobile_xs_content",
119
- breakpoint: "xs",
120
- icon: /* @__PURE__ */ s.jsx(ut, {}),
121
- width: 400
122
- },
123
- {
124
- title: "mobile_sm_title",
125
- content: "mobile_sm_content",
126
- breakpoint: "sm",
127
- icon: /* @__PURE__ */ s.jsx(ut, { className: "rotate-90" }),
128
- width: 640
129
- },
130
- {
131
- title: "tablet_md_title",
132
- content: "tablet_md_content",
133
- breakpoint: "md",
134
- icon: /* @__PURE__ */ s.jsx(ft, {}),
135
- width: 800
136
- },
137
- {
138
- title: "tablet_lg_title",
139
- content: "tablet_lg_content",
140
- breakpoint: "lg",
141
- icon: /* @__PURE__ */ s.jsx(ft, { landscape: !0 }),
142
- width: 1024
143
- },
144
- {
145
- title: "desktop_xl_title",
146
- content: "desktop_xl_content",
147
- breakpoint: "xl",
148
- icon: /* @__PURE__ */ s.jsx(Yt, {}),
149
- width: 1420
150
- },
151
- {
152
- title: "large_desktop_2xl_title",
153
- content: "large_desktop_2xl_content",
154
- breakpoint: "2xl",
155
- icon: /* @__PURE__ */ s.jsx(Xt, {}),
156
- width: 1920
157
- }
158
- ], xt = ({
159
- title: t,
160
- content: e,
161
- currentBreakpoint: n,
162
- breakpoint: i,
163
- width: a,
164
- icon: l,
165
- onClick: r
166
- }) => {
167
- const { t: o } = ot();
168
- return /* @__PURE__ */ s.jsxs(oe, { children: [
169
- /* @__PURE__ */ s.jsx(ie, { asChild: !0, children: /* @__PURE__ */ s.jsx(
170
- K,
171
- {
172
- onClick: () => r(a),
173
- size: "sm",
174
- variant: i === n ? "secondary" : "ghost",
175
- children: l
176
- }
177
- ) }),
178
- /* @__PURE__ */ s.jsx(re, { className: "w-52 border-border", children: /* @__PURE__ */ s.jsx("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ s.jsxs("div", { className: "space-y-1", children: [
179
- /* @__PURE__ */ s.jsx("h4", { className: "text-sm font-semibold", children: o(t) }),
180
- /* @__PURE__ */ s.jsx("p", { className: "text-xs", children: o(e) })
181
- ] }) }) })
182
- ] });
183
- }, ps = () => {
184
- const [, t, e] = Y(), [n, i] = ae(), { t: a } = ot(), l = z("breakpoints", ds), r = (o) => {
185
- n.includes(o) ? n.length > 2 && i(n.filter((c) => c !== o)) : i((c) => [...c, o]);
186
- };
187
- return l.length < 4 ? /* @__PURE__ */ s.jsx("div", { className: "flex items-center rounded-md", children: O(l, (o) => /* @__PURE__ */ lt(xt, { ...o, onClick: e, key: o.breakpoint, currentBreakpoint: t })) }) : /* @__PURE__ */ s.jsxs("div", { className: "flex items-center rounded-md", children: [
188
- O(
189
- l.filter((o) => dt(n, G(o.breakpoint))),
190
- (o) => /* @__PURE__ */ lt(xt, { ...o, onClick: e, key: o.breakpoint, currentBreakpoint: t })
191
- ),
192
- /* @__PURE__ */ s.jsxs(le, { children: [
193
- /* @__PURE__ */ s.jsx(ce, { asChild: !0, children: /* @__PURE__ */ s.jsx("span", { className: "cursor-pointer px-2.5 hover:opacity-80", children: /* @__PURE__ */ s.jsx(Gt, { className: "scale-90 transform" }) }) }),
194
- /* @__PURE__ */ s.jsxs(de, { className: "w-56 border-border text-xs", children: [
195
- /* @__PURE__ */ s.jsx(pe, { children: a("Breakpoints") }),
196
- /* @__PURE__ */ s.jsx(ue, {}),
197
- O(l, (o) => /* @__PURE__ */ s.jsx(
198
- me,
199
- {
200
- disabled: o.breakpoint === "xs",
201
- onCheckedChange: () => r(G(o.breakpoint)),
202
- checked: dt(n, G(o.breakpoint)),
203
- children: a(o.title)
204
- },
205
- o.breakpoint
206
- ))
207
- ] })
208
- ] })
209
- ] });
210
- }, us = () => {
211
- const { t } = ot(), { setNewBlocks: e } = At(), [, n] = T(), [, i] = P(), a = q(() => {
212
- e([]), n([]), i([]);
213
- }, [e]);
214
- return /* @__PURE__ */ s.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ s.jsxs(he, { children: [
215
- /* @__PURE__ */ s.jsx(ge, { asChild: !0, children: /* @__PURE__ */ s.jsxs(K, { size: "sm", variant: "ghost", className: "flex items-center gap-x-1", children: [
216
- /* @__PURE__ */ s.jsx(Zt, {}),
217
- " ",
218
- t("clear")
219
- ] }) }),
220
- /* @__PURE__ */ s.jsxs(fe, { className: "border-border", children: [
221
- /* @__PURE__ */ s.jsxs(xe, { children: [
222
- /* @__PURE__ */ s.jsx(ye, { children: t("clear_canvas_title") }),
223
- /* @__PURE__ */ s.jsx(be, { children: t("clear_canvas_description") })
224
- ] }),
225
- /* @__PURE__ */ s.jsxs(ke, { children: [
226
- /* @__PURE__ */ s.jsx(ve, { children: t("cancel") }),
227
- /* @__PURE__ */ s.jsx(je, { onClick: a, children: t("yes") })
228
- ] })
229
- ] })
230
- ] }) });
231
- }, ms = () => {
232
- const [t, e] = b(we);
233
- return z("askAiCallBack", null) ? /* @__PURE__ */ s.jsxs("div", { className: "flex items-center space-x-2", children: [
234
- /* @__PURE__ */ s.jsxs(Ce, { htmlFor: "ai-assistant", className: "flex items-center gap-x-1 text-sm text-yellow-600", children: [
235
- /* @__PURE__ */ s.jsx(Ke, { className: "w-4" }),
236
- "AI Assistant"
237
- ] }),
238
- /* @__PURE__ */ s.jsx(
239
- _t,
240
- {
241
- className: "scale-90",
242
- checked: t,
243
- onCheckedChange: (i) => {
244
- e(i);
245
- },
246
- id: "ai-assitantt"
247
- }
248
- )
249
- ] }) : null;
250
- }, hs = () => {
251
- const t = z("darkMode", !0), [e] = St();
252
- return /* @__PURE__ */ s.jsxs("div", { className: "flex h-10 items-center justify-between border-b bg-background/70 px-2", children: [
253
- /* @__PURE__ */ s.jsxs("div", { className: "flex h-full space-x-2", children: [
254
- /* @__PURE__ */ s.jsx(ps, {}),
255
- /* @__PURE__ */ s.jsx(W, { orientation: "vertical" }),
256
- t ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
257
- /* @__PURE__ */ s.jsx(cs, {}),
258
- /* @__PURE__ */ s.jsx(W, { orientation: "vertical" })
259
- ] }) : null,
260
- /* @__PURE__ */ s.jsxs("div", { className: "flex w-12 cursor-not-allowed items-center justify-center gap-x-1 space-x-0 font-medium text-gray-400", children: [
261
- /* @__PURE__ */ s.jsx(Qt, { className: "h-3.5 w-3.5 flex-shrink-0" }),
262
- " ",
263
- /* @__PURE__ */ s.jsxs("div", { className: "text-xs leading-3", children: [
264
- Ot(e, 0),
265
- "%"
266
- ] })
267
- ] }),
268
- /* @__PURE__ */ s.jsx(W, { orientation: "vertical" }),
269
- /* @__PURE__ */ s.jsx(ls, {})
270
- ] }),
271
- /* @__PURE__ */ s.jsxs("div", { className: "flex h-full items-center space-x-2", children: [
272
- /* @__PURE__ */ s.jsx(us, {}),
273
- /* @__PURE__ */ s.jsx(W, { orientation: "vertical" }),
274
- /* @__PURE__ */ s.jsx(ms, {})
275
- ] })
276
- ] });
277
- }, gs = `<!doctype html>
278
- <html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
279
- <head>
280
- <meta charset="UTF-8">
281
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
282
- <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
283
- <style>
284
- html { height: 100%; overflow:auto; }
285
- body { height: 100%; }
286
- .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
287
- .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
288
- body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
289
- -moz-user-select: none;-ms-user-select: none; user-select: none; }
290
- html{
291
- -ms-overflow-style: none; /* IE and Edge */
292
- scrollbar-width: none; /* Firefox */
293
- }
294
- /** IMPORTANT: Make fields content editable in SAFARI */
295
- [contenteditable] {-webkit-user-select: text;user-select: text;}
296
-
297
- html::-webkit-scrollbar { width: 0 !important }
298
- .aspect-auto{aspect-ratio: auto;}
299
- .aspect-square{aspect-ratio: 1/1;}
300
- .aspect-video{aspect-ratio: 16/9;}
301
- .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
302
- .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
303
- a{ pointer-events: none !important; }
304
- [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
305
- [contenteditable="true"] {
306
- outline: none;
307
- box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
308
- -webkit-user-select: text;
309
- -moz-user-select: text;
310
- user-select: text;
311
- }
312
- .frame-root .frame-content { height: 100%; }
313
- [data-drop="yes"] { outline: 2px dashed orange !important; outline-offset: -2px }
314
- [data-dnd="yes"] { pointer-events: auto !important}
315
- [data-dnd="no"] { pointer-events: none !important; }
316
- [data-dnd-dragged="yes"] { opacity: 0.6; pointer-events: none; }
317
- [data-dnd-dragged="no"] { opacity: 1; pointer-events: auto !important; }
318
- [force-show] { display: block !important; }
319
- </style>
320
- <style id="hidden-blocks"></style>
321
- <style id="selected-block"></style>
322
- <style id="selected-styling-block"></style>
323
- <style id="highlighted-block"></style>
324
- <style id="dragged-block"></style>
325
-
326
- </head>
327
- <body class="font-body antialiased h-full">
328
- <div class="frame-root h-full"></div>
329
- <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
330
- </body>
331
- </html>`, fs = (t) => {
332
- const [e] = Y(), [, n] = St(), [i, a] = A({}), l = q(() => {
333
- const { width: r, height: o } = t;
334
- if (r < e) {
335
- const c = parseFloat((r / e).toFixed(2).toString());
336
- let u = {};
337
- const m = o * c;
338
- o && (u = {
339
- // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
340
- height: 100 + (o - m) / m * 100 + "%"
341
- }), a({
342
- position: "relative",
343
- top: 0,
344
- transform: `scale(${c})`,
345
- transformOrigin: "top left",
346
- ...u,
347
- maxWidth: "none"
348
- }), n(c * 100);
349
- } else
350
- a({}), n(100);
351
- }, [e, t, n]);
352
- return C(() => {
353
- l();
354
- }, [e, t, n, l]), i;
355
- };
356
- let Et, Mt;
357
- typeof document < "u" && (Et = document);
358
- typeof window < "u" && (Mt = window);
359
- const Nt = I.createContext({ document: Et, window: Mt }), X = () => I.useContext(Nt), { Provider: xs, Consumer: Gn } = Nt;
360
- class Lt extends kt {
361
- componentDidMount() {
362
- this.props.contentDidMount();
363
- }
364
- componentDidUpdate() {
365
- this.props.contentDidUpdate();
366
- }
367
- render() {
368
- return Pt.only(this.props.children);
369
- }
370
- }
371
- L(Lt, "propTypes", {
372
- children: w.element.isRequired,
373
- contentDidMount: w.func.isRequired,
374
- contentDidUpdate: w.func.isRequired
375
- });
376
- class et extends kt {
377
- constructor(n, i) {
378
- super(n, i);
379
- L(this, "setRef", (n) => {
380
- this.nodeRef.current = n;
381
- const { forwardedRef: i } = this.props;
382
- typeof i == "function" ? i(n) : i && (i.current = n);
383
- });
384
- L(this, "handleLoad", () => {
385
- clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
386
- });
387
- // In certain situations on a cold cache DOMContentLoaded never gets called
388
- // fallback to an interval to check if that's the case
389
- L(this, "loadCheck", () => setInterval(() => {
390
- this.handleLoad();
391
- }, 500));
392
- this._isMounted = !1, this.nodeRef = I.createRef(), this.state = { iframeLoaded: !1 };
393
- }
394
- componentDidMount() {
395
- this._isMounted = !0, this.getDoc() && this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded", this.handleLoad);
396
- }
397
- componentWillUnmount() {
398
- this._isMounted = !1, this.nodeRef.current.removeEventListener("DOMContentLoaded", this.handleLoad);
399
- }
400
- getDoc() {
401
- return this.nodeRef.current ? this.nodeRef.current.contentDocument : null;
402
- }
403
- getMountTarget() {
404
- const n = this.getDoc();
405
- return this.props.mountTarget ? n.querySelector(this.props.mountTarget) : n.body.children[0];
406
- }
407
- renderFrameContents() {
408
- if (!this._isMounted)
409
- return null;
410
- const n = this.getDoc();
411
- if (!n)
412
- return null;
413
- const i = this.props.contentDidMount, a = this.props.contentDidUpdate, l = n.defaultView || n.parentView, r = /* @__PURE__ */ s.jsx(Lt, { contentDidMount: i, contentDidUpdate: a, children: /* @__PURE__ */ s.jsx(xs, { value: { document: n, window: l }, children: /* @__PURE__ */ s.jsx("div", { className: "frame-content", children: this.props.children }) }) }), o = this.getMountTarget();
414
- return [mt.createPortal(this.props.head, this.getDoc().head), mt.createPortal(r, o)];
415
- }
416
- render() {
417
- const n = {
418
- ...this.props,
419
- srcDoc: this.props.initialContent,
420
- children: void 0
421
- // The iframe isn't ready so we drop children from props here. #12, #17
422
- };
423
- return delete n.head, delete n.initialContent, delete n.mountTarget, delete n.contentDidMount, delete n.contentDidUpdate, delete n.forwardedRef, /* @__PURE__ */ s.jsx("iframe", { ...n, ref: this.setRef, onLoad: this.handleLoad, children: this.state.iframeLoaded && this.renderFrameContents() });
424
- }
425
- }
426
- // React warns when you render directly into the body since browser extensions
427
- // also inject into the body and can mess up React. For this reason
428
- // initialContent is expected to have a div inside of the body
429
- // element that we render react into.
430
- L(et, "propTypes", {
431
- style: w.object,
432
- // eslint-disable-line
433
- head: w.node,
434
- initialContent: w.string,
435
- mountTarget: w.string,
436
- contentDidMount: w.func,
437
- contentDidUpdate: w.func,
438
- children: w.oneOfType([w.element, w.arrayOf(w.element)])
439
- }), L(et, "defaultProps", {
440
- style: {},
441
- head: null,
442
- children: void 0,
443
- mountTarget: void 0,
444
- contentDidMount: () => {
445
- },
446
- contentDidUpdate: () => {
447
- },
448
- initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
449
- });
450
- const ys = I.forwardRef((t, e) => /* @__PURE__ */ s.jsx(et, { ...t, forwardedRef: e }));
451
- function rt(t) {
452
- const e = window.getComputedStyle(t), n = e.display;
453
- if (n === "flex" || n === "inline-flex") {
454
- const i = e.flexDirection;
455
- return i === "column" || i === "column-reverse" ? "vertical" : "horizontal";
456
- } else if (n === "grid") {
457
- const i = e.gridAutoFlow, a = e.gridTemplateRows, l = e.gridTemplateColumns;
458
- return i.includes("column") || a.split(" ").length > l.split(" ").length ? "vertical" : "horizontal";
459
- } else if (n === "block" || n === "inline-block")
460
- return "vertical";
461
- return "horizontal";
462
- }
463
- let x = null, S = [], H = null, Z = null;
464
- const yt = (t, e, n) => {
465
- if (!x || !t)
466
- return;
467
- const i = x == null ? void 0 : x.getElementById("placeholder"), a = S.map(([c]) => c), l = a.reduce(
468
- (c, u) => Math.abs(u - n) < Math.abs(c - n) ? u : c,
469
- 0
470
- ), r = a.indexOf(l);
471
- if (!S[r])
472
- return;
473
- const o = S[r];
474
- i.style.width = e === "vertical" ? o[2] + "px" : "2px", i.style.height = e === "vertical" ? "2px" : o[2] + "px", i.style.display = "block", e === "vertical" ? (i.style.top = o[0] + "px", i.style.left = o[1] + "px") : (i.style.top = o[1] + "px", i.style.left = o[0] + "px");
475
- };
476
- function bs(t, e) {
477
- let n = 0, i = 1 / 0;
478
- return e.forEach((a, l) => {
479
- const r = Math.abs(a[0] - t);
480
- r < i && (i = r, n = l);
481
- }), n;
482
- }
483
- const ks = (t) => {
484
- const n = rt(t) === "horizontal";
485
- S = [], Array.from(t.children).forEach((i, a) => {
486
- if (i.classList.contains("pointer-events-none"))
487
- return;
488
- const l = n ? i.offsetLeft : i.offsetTop, r = n ? [i.offsetTop, i.clientHeight] : [i.offsetLeft, i.clientWidth];
489
- if (S.push([l, r[0], r[1]]), a === t.children.length - 1) {
490
- const o = n ? i.offsetLeft + i.clientWidth : i.offsetTop + i.clientHeight;
491
- S.push([o, r[0], r[1]]);
492
- }
493
- });
494
- }, vs = vt((t) => {
495
- var a;
496
- const e = t.target, n = rt(e), i = (a = x == null ? void 0 : x.defaultView) == null ? void 0 : a.scrollY;
497
- n === "vertical" ? yt(e, n, t.clientY + i) : yt(e, n, t.clientX);
498
- }, 0);
499
- function bt() {
500
- const t = x == null ? void 0 : x.getElementById("placeholder");
501
- t.style.display = "none", js("pointer-none"), ws();
502
- }
503
- function js(t) {
504
- (x == null ? void 0 : x.querySelectorAll(`.${t}`)).forEach((n) => {
505
- n.classList.remove(t);
506
- });
507
- }
508
- function ws() {
509
- const t = x == null ? void 0 : x.querySelector('[data-drop="yes"]');
510
- t && t.removeAttribute("data-drop");
511
- }
512
- const Cs = () => {
513
- const { document: t } = X(), [e, n] = b(_e), { addCoreBlock: i } = Ae(), [, a] = F(), [, l] = T(), { moveBlocks: r } = At(), [, o] = b(Bt), [c, u] = b(it), [, m] = b(Dt), d = () => {
514
- bt(), n(!1), o(""), u(null), m(null), S = [];
515
- };
516
- return x = t, {
517
- isDragging: e,
518
- onDragOver: (p) => {
519
- p.preventDefault(), p.stopPropagation(), vs(p);
520
- },
521
- onDrop: (p) => {
522
- var B;
523
- H == null || H.classList.remove("drop-target");
524
- const g = H, k = rt(g) === "vertical" ? p.clientY + ((B = x == null ? void 0 : x.defaultView) == null ? void 0 : B.scrollY) : p.clientX;
525
- Z = bs(k, S);
526
- const v = c, j = g.getAttribute("data-block-id");
527
- if (v === H) {
528
- d();
529
- return;
530
- }
531
- if (!V(v, "_id")) {
532
- i(v, j === "canvas" ? null : j, Z), setTimeout(d, 300);
533
- return;
534
- }
535
- let _ = g.getAttribute("data-block-id");
536
- _ === null && (_ = p.target.parentElement.getAttribute("data-block-id")), r([v._id], _, Z), d(), setTimeout(bt, 300);
537
- },
538
- onDragEnter: (p) => {
539
- const g = p, y = g.target;
540
- H = y;
541
- const k = y.getAttribute("data-block-id");
542
- m(k), g.stopPropagation(), g.preventDefault(), S = [], ks(y), y.classList.add("drop-target"), n(!0), a(""), l([]);
543
- }
544
- };
545
- };
546
- function at(t) {
547
- return t.getAttribute("data-block-id") ? t : t.closest("[data-block-id]");
548
- }
549
- function _s(t) {
550
- t.container.innerHTML = "", t.container.parentNode.removeChild(t.container);
551
- var e = document.querySelector(".ql-toolbar");
552
- e && e.parentNode.removeChild(e), t = null;
553
- }
554
- const As = () => {
555
- const t = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], e = Se(), [, n] = F(), [i, a] = b(U);
556
- return (l) => {
557
- var d;
558
- if (i)
559
- return;
560
- const r = at(l.target), o = r.getAttribute("data-block-type");
561
- if (!o || !t.includes(o))
562
- return;
563
- const c = r.cloneNode(!0);
564
- r.style.display = "none", Array.from(c.attributes).forEach((p) => {
565
- p.name !== "class" && c.removeAttribute(p.name);
566
- }), o === "Text" && (c.style.display = "inline-block"), r.parentNode.insertBefore(c, r.nextSibling);
567
- const u = new Ye(c, { placeholder: "Type here..." });
568
- function m() {
569
- const p = u.getText(0, u.getLength());
570
- e([r.getAttribute("data-block-id")], { content: p }), r.removeAttribute("style"), c.removeEventListener("blur", m, !0), _s(u), a(""), n("");
571
- }
572
- c.addEventListener("blur", m, !0), c.addEventListener("keydown", (p) => {
573
- (p.key === "Enter" || p.key === "Escape") && m();
574
- }), u.focus(), (d = c.querySelector(".ql-clipboard")) == null || d.remove(), a(r.getAttribute("data-block-id"));
575
- };
576
- }, Ss = () => {
577
- const [, t] = P(), [e, n] = T(), [, i] = F(), [a] = b(U), [l] = b(Be);
578
- return (r) => {
579
- if (a)
580
- return;
581
- r.stopPropagation();
582
- const o = at(r.target);
583
- if (o != null && o.getAttribute("data-block-id") && (o == null ? void 0 : o.getAttribute("data-block-id")) === "container") {
584
- n([]), t([]), i("");
585
- return;
586
- }
587
- if (o != null && o.getAttribute("data-block-parent")) {
588
- const c = o.getAttribute("data-style-prop"), u = o.getAttribute("data-style-id"), m = o.getAttribute("data-block-parent");
589
- e.includes(m) || l == null || l.closeAll(), t([{ id: u, prop: c, blockId: m }]), n([m]);
590
- } else if (o != null && o.getAttribute("data-block-id")) {
591
- let c = o.getAttribute("data-block-id");
592
- e.includes(c) || l == null || l.closeAll(), t([]), n([c]);
593
- }
594
- i("");
595
- };
596
- }, Bs = vt((t, e) => {
597
- const n = at(t.target);
598
- n != null && n.getAttribute("data-style-id") && e(n.getAttribute("data-style-id"));
599
- }, 100), Is = () => {
600
- const [, t] = F(), [e] = b(U);
601
- return (n) => {
602
- e || Bs(n, t);
603
- };
604
- }, Ds = ({ children: t }) => {
605
- const { document: e } = X(), [n] = T(), [i, a] = P();
606
- C(() => {
607
- setTimeout(() => {
608
- if (!D(i))
609
- return;
610
- const u = Ft(e, J(n));
611
- if (u) {
612
- const m = u.getAttribute("data-style-prop");
613
- if (m) {
614
- const d = u.getAttribute("data-style-id"), p = u.getAttribute("data-block-parent");
615
- a([{ id: d, prop: m, blockId: p }]);
616
- }
617
- }
618
- }, 100);
619
- }, [e, n, a, i]);
620
- const l = As(), r = Ss(), o = Is(), c = Cs();
621
- return /* @__PURE__ */ s.jsx(
622
- "div",
623
- {
624
- "data-block-id": "canvas",
625
- id: "canvas",
626
- onClick: r,
627
- onDoubleClick: l,
628
- onMouseMove: o,
629
- ...jt(c, "isDragging"),
630
- className: "relative mb-5 h-full max-w-full px-1 " + (c.isDragging ? "dragging" : ""),
631
- children: t
632
- }
633
- );
634
- }, Ft = (t, e) => t.querySelector(`[data-block-id="${e}"]`), Ts = () => {
635
- const { document: t } = X();
636
- return Ue(t), null;
637
- }, Es = ({ block: t, label: e }) => {
638
- const [, n] = T(), [, i] = F(), [, a] = b(it), l = Je("dnd");
639
- return /* @__PURE__ */ s.jsxs(
640
- "div",
641
- {
642
- className: "mr-10 flex cursor-grab items-center space-x-1 px-1",
643
- draggable: l ? "true" : "false",
644
- onDragStart: (r) => {
645
- r.dataTransfer.setData("text/plain", JSON.stringify(zt(t, ["_id", "_type", "_name"]))), a(t), setTimeout(() => {
646
- n([]), i(null);
647
- }, 200);
648
- },
649
- children: [
650
- /* @__PURE__ */ s.jsx(Jt, {}),
651
- e
652
- ]
653
- }
654
- );
655
- }, Ms = ({ selectedBlockElement: t, block: e }) => {
656
- const n = Ie(), i = De(), [, a] = T(), [, l] = P(), [r] = b(U), { floatingStyles: o, refs: c, update: u } = Ge({
657
- placement: "top-start",
658
- middleware: [Ze(), Xe()],
659
- elements: {
660
- reference: t
661
- }
662
- });
663
- Qe(t, () => u(), t !== null);
664
- const m = h(e, "_parent", null), d = D(h(e, "_name", "")) ? h(e, "_type", "") : h(e, "_name", "");
665
- return !t || !e || r ? null : /* @__PURE__ */ s.jsx(s.Fragment, { children: /* @__PURE__ */ s.jsxs(
666
- "div",
667
- {
668
- role: "button",
669
- tabIndex: 0,
670
- ref: c.setFloating,
671
- style: o,
672
- onClick: (p) => {
673
- p.stopPropagation(), p.preventDefault();
674
- },
675
- onKeyDown: (p) => p.stopPropagation(),
676
- className: "z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
677
- children: [
678
- /* @__PURE__ */ s.jsx(Es, { label: d, block: e }),
679
- /* @__PURE__ */ s.jsxs("div", { className: "flex gap-2 px-1", children: [
680
- m && /* @__PURE__ */ s.jsx(
681
- te,
682
- {
683
- className: "hover:scale-105",
684
- onClick: () => {
685
- l([]), a([m]);
686
- }
687
- }
688
- ),
689
- Te(h(e, "_type", "")) ? /* @__PURE__ */ s.jsx(ee, { className: "hover:scale-105", onClick: () => i([e == null ? void 0 : e._id]) }) : null,
690
- Ee(h(e, "_type", "")) ? /* @__PURE__ */ s.jsx(se, { className: "hover:scale-105", onClick: () => n([e == null ? void 0 : e._id]) }) : null
691
- ] })
692
- ]
693
- }
694
- ) });
695
- }, Ns = ({ model: t }) => {
696
- const [e] = Me(), [n] = T(), [i] = Ct(), [a] = F(), [l] = P(), [r] = b(Bt), { document: o, window: c } = X(), [u] = A(o == null ? void 0 : o.getElementById("highlighted-block")), [m] = A(
697
- o == null ? void 0 : o.getElementById("selected-block")
698
- ), [d] = A(
699
- o == null ? void 0 : o.getElementById("selected-styling-block")
700
- ), [p] = A(o == null ? void 0 : o.getElementById("dragged-block"));
701
- C(() => {
702
- i ? o == null || o.documentElement.classList.add("dark") : o == null || o.documentElement.classList.remove("dark");
703
- }, [i, o]);
704
- const g = h(e, "headingFont", "DM Sans"), y = h(e, "bodyFont", "DM Sans");
705
- return C(() => {
706
- const k = h(e, "primaryColor", "#000"), v = h(e, "secondaryColor", "#FFF"), j = h(e, "bodyBgLightColor", "#fff"), _ = h(e, "bodyBgDarkColor", "#000"), B = h(e, "bodyTextDarkColor", "#000"), E = h(e, "bodyTextLightColor", "#fff"), R = ns([
707
- { color: k, name: "primary" },
708
- { color: v, name: "secondary" }
709
- ]), $ = {
710
- "bg-light": j,
711
- "bg-dark": _,
712
- "text-dark": B,
713
- "text-light": E
714
- }, f = h(e, "roundedCorners", "0");
715
- !c || !c.tailwind || (c.tailwind.config = {
716
- darkMode: "class",
717
- theme: {
718
- extend: {
719
- container: {
720
- center: !0,
721
- padding: "1rem",
722
- screens: {
723
- "2xl": "1400px"
724
- }
725
- },
726
- fontFamily: {
727
- heading: [g],
728
- body: [y]
729
- },
730
- borderRadius: {
731
- DEFAULT: `${f || "0"}px`
732
- },
733
- colors: { ...$, ...R }
734
- }
735
- },
736
- plugins: [ts, es, ss]
737
- });
738
- }, [e, c, g, y]), C(() => {
739
- m && (m.textContent = `${O(n, (k) => `[data-block-id="${k}"]`).join(",")}{
740
- outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
741
- }`);
742
- }, [n, m]), C(() => {
743
- if (!r) {
744
- p.textContent = "";
745
- return;
746
- }
747
- p.textContent = `[data-block-id="${r}"]{ pointer-events: none !important; opacity: 0.2 !important}`;
748
- }, [r]), C(() => {
749
- u && (u.textContent = a ? `[data-style-id="${a}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
750
- }, [a, n, u]), C(() => {
751
- d && (d.textContent = `${O(l, ({ id: k }) => `[data-style-id="${k}"]`).join(",")}{
752
- outline: 1px solid #42a1fc !important; outline-offset: -1px;
753
- }`);
754
- }, [l, d]), C(() => {
755
- const k = h(e, "bodyTextLightColor", "#64748b"), v = h(e, "bodyTextDarkColor", "#94a3b8"), j = h(e, "bodyBgLightColor", "#FFFFFF"), _ = h(e, "bodyBgDarkColor", "#0f172a");
756
- o.body.className = `font-body antialiased text-[${k}] bg-[${j}] dark:text-[${v}] dark:bg-[${_}]`;
757
- }, [e, o, t]), t === "page" ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
758
- g && /* @__PURE__ */ s.jsx(
759
- "link",
760
- {
761
- id: "heading-font",
762
- rel: "stylesheet",
763
- type: "text/css",
764
- href: `https://fonts.googleapis.com/css2?family=${g.replace(
765
- / /g,
766
- "+"
767
- )}:wght@300;400;500;600;700;800;900&display=swap`,
768
- media: "all"
769
- }
770
- ),
771
- y && g !== y && /* @__PURE__ */ s.jsx(
772
- "link",
773
- {
774
- id: "body-font",
775
- rel: "stylesheet",
776
- type: "text/css",
777
- href: `https://fonts.googleapis.com/css2?family=${y.replace(
778
- / /g,
779
- "+"
780
- )}:wght@300;400;500;600;700;800;900&display=swap`,
781
- media: "all"
782
- }
783
- ),
784
- g && /* @__PURE__ */ s.jsx("style", { children: `h1,h2,h3,h4,h5,h6{font-family: "${g}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}` })
785
- ] }) : null;
786
- }, Ls = () => b(Ne), Fs = (t, e) => {
787
- const n = ["xs", "sm", "md", "lg", "xl", "2xl"], i = n.indexOf(e), a = t.split(" ");
788
- let l = new Array(n.length).fill(!1);
789
- for (const r of a) {
790
- let [o, c] = r.split(":");
791
- c || (c = o, o = "xs");
792
- const u = n.indexOf(o);
793
- if (u <= i) {
794
- const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], d = ["hidden"];
795
- if (m.includes(c))
796
- for (let p = u; p < n.length; p++)
797
- l[p] = !0;
798
- else if (d.includes(c))
799
- for (let p = u; p < n.length; p++)
800
- l[p] = !1;
801
- }
802
- }
803
- return l[i];
804
- }, Rs = (t) => {
805
- const e = {};
806
- return Object.keys(t).forEach((n) => {
807
- nt(t[n]) && t[n].startsWith(ht) && (e[n] = t[n].replace(ht, "").split(","));
808
- }), e;
809
- }, Hs = Ut((t) => {
810
- const e = t.replace(Tt, "").split(",");
811
- return os(e[0], e[1]);
812
- });
813
- function Ps(t, e) {
814
- return h(t, `${e}_attrs`, {});
815
- }
816
- function $s(t, e) {
817
- const n = {};
818
- return Object.keys(t).forEach((i) => {
819
- if (nt(t[i]) && t[i].startsWith(Tt)) {
820
- const a = Hs(t[i]), l = Ps(t, i);
821
- n[i] = {
822
- className: a,
823
- "data-style-prop": i,
824
- "data-block-parent": t._id,
825
- "data-style-id": `${i}-${t._id}`,
826
- ...l
827
- };
828
- const r = V(l, "x-show") || V(l, "x-if");
829
- r && (n.__isHidden = r && !Fs(a, e));
830
- }
831
- }), n;
832
- }
833
- function Os(t, e) {
834
- const n = h(t, "_bindings", {});
835
- return D(n) ? { ...t } : (Wt(n, (i, a) => {
836
- nt(i) && h(e, i, null) && (t[a] = h(e, i, null));
837
- }), t);
838
- }
839
- function st({ blocks: t }) {
840
- const [e] = It(), [n] = b(Le), [i] = b(it), [a] = b(Dt), [, l] = Y(), [r] = Ls(), o = q((d) => $s(d, l), [l]), [c] = We(), [u] = b(U), m = q(
841
- (d) => d.reduce((p, g) => {
842
- const y = h(r, g, {});
843
- return { ...p, ...y };
844
- }, {}),
845
- [r, e]
846
- );
847
- return /* @__PURE__ */ s.jsx(s.Fragment, { children: I.Children.toArray(
848
- t.map((d, p) => {
849
- if (u === d._id)
850
- return null;
851
- const g = Rs(d), y = {};
852
- D(g) || Object.keys(g).forEach((R) => {
853
- y[R] = I.Children.toArray(
854
- g[R].map(($) => /* @__PURE__ */ s.jsx(st, { blocks: [qt(e, { _id: $ })] }))
855
- );
856
- });
857
- const k = wt(e, { _parent: d._id });
858
- y.children = k.length ? /* @__PURE__ */ s.jsx(st, { blocks: k }) : null;
859
- const v = is(d._type), j = h(v, "builderComponent", h(v, "component", null));
860
- if (Vt(j))
861
- return /* @__PURE__ */ s.jsx("noscript", { children: `<!-- ${d == null ? void 0 : d._type} not registered -->` });
862
- const _ = V(v, "getBlockStateFrom") ? v == null ? void 0 : v.getBlockStateFrom(d, e) : [], B = m(_), E = o(d);
863
- return h(E, "__isHidden", !1) && !gt(n, d._id) ? null : /* @__PURE__ */ s.jsx(Q, { children: I.createElement(j, {
864
- blockProps: {
865
- ...gt(n, d._id) ? { "force-show": "" } : {},
866
- "data-block-id": d._id,
867
- "data-block-type": d._type,
868
- ...i ? (
869
- // @ts-ignore
870
- {
871
- "data-dnd": Fe(d._type, i == null ? void 0 : i._type) ? "yes" : "no",
872
- "data-dnd-dragged": i._id === d._id ? "yes" : "no"
873
- }
874
- ) : {},
875
- ...a === d._id ? { "data-drop": "yes" } : {}
876
- },
877
- index: p,
878
- ...Os(d, c),
879
- ...jt(E, ["__isHidden"]),
880
- ...y,
881
- inBuilder: !0,
882
- blockState: B
883
- }) });
884
- })
885
- ) });
886
- }
887
- const zs = () => {
888
- const [t] = It(), e = D(t) ? null : /* @__PURE__ */ s.jsx(qe, { children: /* @__PURE__ */ s.jsx(st, { blocks: wt(t, (n) => D(n._parent)) }) });
889
- return /* @__PURE__ */ s.jsx(s.Fragment, { children: e });
890
- }, Us = (t, e) => t.querySelector(`[data-style-id="${e}"]`), Ws = () => {
891
- const [t] = b(Re), [e] = He(), [n] = Y(), [, i] = T(), a = Pe(), [, l] = F(), r = ct(null), o = ct(null), [c, u] = A({ width: 0, height: 0 }), m = fs(c), [d, p] = A(0), [g, y] = A([]), [, k] = A([]), [, v] = b($e), [j, _] = P(), B = z("loading", !1), E = z("htmlDir", "ltr");
892
- C(() => {
893
- const { clientWidth: f, clientHeight: M } = o.current;
894
- u({ width: f, height: M }), d === 0 && p(f);
895
- }, [o, n, d]);
896
- const R = (f, M = 0) => {
897
- const { top: N } = f.getBoundingClientRect();
898
- return N + M >= 0 && N - M <= window.innerHeight;
899
- };
900
- C(() => {
901
- var f, M;
902
- if (a && a.type !== "Multiple" && r.current) {
903
- const N = Ft(r.current.contentDocument, a._id);
904
- N && (R(N) || (M = (f = r.current) == null ? void 0 : f.contentWindow) == null || M.scrollTo({ top: N.offsetTop, behavior: "smooth" }), y([N]));
905
- }
906
- }, [a]), C(() => {
907
- if (!D(j) && r.current) {
908
- const f = Us(
909
- r.current.contentDocument,
910
- J(j).id
911
- );
912
- k(f ? [f] : [null]);
913
- } else
914
- k([null]);
915
- }, [j]);
916
- const $ = $t(() => {
917
- let f = gs;
918
- return f = f.replace("__HTML_DIR__", E), t === "offline" && (f = f.replace(
919
- "https://old.chaibuilder.com/offline/tailwind.cdn.js",
920
- "/offline/tailwind.cdn.js"
921
- ), f = f.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), f = f.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), f;
922
- }, [t]);
923
- return /* @__PURE__ */ s.jsx(
924
- "div",
925
- {
926
- onClick: () => {
927
- i([]), _([]);
928
- },
929
- onMouseLeave: () => setTimeout(() => l(""), 300),
930
- className: "relative mx-auto h-full w-full overflow-hidden",
931
- style: d > 0 && !D(m) ? { width: e ? "100%" : d } : {},
932
- ref: o,
933
- children: /* @__PURE__ */ s.jsxs(
934
- ys,
935
- {
936
- contentDidMount: () => v(r.current),
937
- ref: r,
938
- id: "canvas-iframe",
939
- style: { width: `${n}px`, ...m },
940
- className: "relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",
941
- initialContent: $,
942
- children: [
943
- /* @__PURE__ */ s.jsx(Ts, {}),
944
- /* @__PURE__ */ s.jsx(
945
- Ms,
946
- {
947
- block: a,
948
- selectedBlockElement: J(g)
949
- }
950
- ),
951
- /* @__PURE__ */ s.jsx(Ns, { model: "page" }),
952
- /* @__PURE__ */ s.jsx(rs, { children: /* @__PURE__ */ s.jsx(Ds, { children: B ? /* @__PURE__ */ s.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ s.jsx(tt, { className: "h-full" }) }) : /* @__PURE__ */ s.jsx(zs, {}) }) }),
953
- /* @__PURE__ */ s.jsx("br", {}),
954
- /* @__PURE__ */ s.jsx(
955
- "div",
956
- {
957
- id: "placeholder",
958
- className: "pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"
959
- }
960
- )
961
- ]
962
- }
963
- )
964
- }
965
- );
966
- }, qs = I.lazy(() => import("./CodeEditor-cY6z8D4N.js")), Zn = () => {
967
- const [t] = Oe();
968
- return /* @__PURE__ */ s.jsxs("div", { className: "flex h-full w-full flex-col", children: [
969
- /* @__PURE__ */ s.jsx(hs, {}),
970
- /* @__PURE__ */ s.jsxs("div", { className: "relative flex h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
971
- /* @__PURE__ */ s.jsx(Q, { fallback: /* @__PURE__ */ s.jsx(tt, { className: "h-full" }), children: /* @__PURE__ */ s.jsx(Ve, { children: /* @__PURE__ */ s.jsx(Ws, {}) }) }),
972
- t ? /* @__PURE__ */ s.jsx(Q, { fallback: /* @__PURE__ */ s.jsx(tt, { className: "h-full" }), children: /* @__PURE__ */ s.jsx(as, { enable: { top: !0, bottom: !1 }, className: "max-h-[400px] min-h-[200px]", children: /* @__PURE__ */ s.jsx(qs, {}) }) }) : null
973
- ] })
974
- ] });
975
- };
976
- export {
977
- Zn as default
978
- };