@chaibuilder/sdk 1.1.14 → 1.1.16

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 (58) hide show
  1. package/dist/AddBlocks-1DrS62uN.js +222 -0
  2. package/dist/AddBlocks-jqRRefXj.cjs +1 -0
  3. package/dist/BrandingOptions-TRVyCvVq.cjs +1 -0
  4. package/dist/{BrandingOptions-4qzTYdj5.js → BrandingOptions-zFJ28xmJ.js} +18 -19
  5. package/dist/CanvasArea-5oxRxEDL.cjs +59 -0
  6. package/dist/CanvasArea-j8iIkWN-.js +1438 -0
  7. package/dist/{CurrentPage-zxrdTVsG.cjs → CurrentPage-CsENtl7b.cjs} +1 -1
  8. package/dist/{CurrentPage-spjJpQSM.js → CurrentPage-cNRrM2vd.js} +1 -1
  9. package/dist/{Layers-QNAlCI4j.js → Layers-6Fa_6Vy2.js} +2 -2
  10. package/dist/{Layers-YyBChBtg.cjs → Layers-r6pP4nDP.cjs} +1 -1
  11. package/dist/MarkAsGlobalBlock-CDmEHNx7.cjs +1 -0
  12. package/dist/{MarkAsGlobalBlock-xOHhiMDl.js → MarkAsGlobalBlock-uhj0kGZo.js} +23 -23
  13. package/dist/{PagesPanel-BeJrveus.cjs → PagesPanel-UXqoXG-j.cjs} +1 -1
  14. package/dist/{PagesPanel--LI-BoSj.js → PagesPanel-s2qoPZc-.js} +2 -2
  15. package/dist/{ProjectPanel-VNj0jXca.js → ProjectPanel-9z6zVYBb.js} +2 -2
  16. package/dist/{ProjectPanel-MjcAymKT.cjs → ProjectPanel-izG3GYtn.cjs} +1 -1
  17. package/dist/Settings-iLeODb_n.js +2188 -0
  18. package/dist/Settings-olFxwKg4.cjs +1 -0
  19. package/dist/SidePanels-1QED7mo6.cjs +1 -0
  20. package/dist/{SidePanels-4lvmnnlw.js → SidePanels-CWAz1HdY.js} +125 -124
  21. package/dist/add-page-modal-rn0OScnT.cjs +1 -0
  22. package/dist/{add-page-modal-fZnKopNf.js → add-page-modal-vT0-45wi.js} +6 -7
  23. package/dist/controls-QnyBNkXG.cjs +36 -0
  24. package/dist/controls-kEuiMMDf.js +4600 -0
  25. package/dist/core.cjs +1 -1
  26. package/dist/core.js +1 -1
  27. package/dist/{delete-page-modal-P_KKu12n.cjs → delete-page-modal-EZ4gIG3s.cjs} +1 -1
  28. package/dist/{delete-page-modal-fRoXPfhG.js → delete-page-modal-hWmFarnh.js} +1 -1
  29. package/dist/index-Ge20J9Pa.cjs +206 -0
  30. package/dist/{index-CQz6j3ex.js → index-TWBwhGkh.js} +4957 -4262
  31. package/dist/mockServiceWorker.js +10 -18
  32. package/dist/{page-viewer-39ZtxLzx.js → page-viewer-TZC26UCW.js} +2 -2
  33. package/dist/{page-viewer-_lc8vqU4.cjs → page-viewer-yH4HdYhv.cjs} +1 -1
  34. package/dist/{project-general-setting-CCVuGyHh.js → project-general-setting-SjVbcwgp.js} +7 -8
  35. package/dist/project-general-setting-eEQDxjVm.cjs +1 -0
  36. package/dist/{project-seo-setting-Wo7E46w7.js → project-seo-setting-EhqUcTKy.js} +7 -8
  37. package/dist/project-seo-setting-N0OnBCvh.cjs +1 -0
  38. package/dist/single-page-detail-76T7ZZzC.cjs +1 -0
  39. package/dist/{single-page-detail-r1GJF00l.js → single-page-detail-ePzFhs8m.js} +47 -48
  40. package/dist/studio.cjs +1 -1
  41. package/dist/studio.js +1 -1
  42. package/package.json +3 -2
  43. package/dist/AddBlocks-AG_J7s2Z.cjs +0 -1
  44. package/dist/AddBlocks-FsdsASNp.js +0 -222
  45. package/dist/BrandingOptions-xBuqDpj0.cjs +0 -1
  46. package/dist/CanvasArea-4m1-c1yq.cjs +0 -59
  47. package/dist/CanvasArea-U3egqewu.js +0 -1434
  48. package/dist/MarkAsGlobalBlock-LXDkmFUr.cjs +0 -1
  49. package/dist/Settings-BrYkhn3H.cjs +0 -1
  50. package/dist/Settings-LZJwbkO6.js +0 -2189
  51. package/dist/SidePanels-_5oUp-eI.cjs +0 -1
  52. package/dist/add-page-modal-rWhPuGd9.cjs +0 -1
  53. package/dist/controls-G0puEH71.js +0 -120
  54. package/dist/controls-aHZq-q4b.cjs +0 -1
  55. package/dist/index-1Dr-VtaT.cjs +0 -206
  56. package/dist/project-general-setting-LEzDhwoq.cjs +0 -1
  57. package/dist/project-seo-setting-orwH-Ufg.cjs +0 -1
  58. package/dist/single-page-detail-jkDYF7lW.cjs +0 -1
@@ -1,1434 +0,0 @@
1
- var xt = Object.defineProperty;
2
- var bt = (e, t, n) => t in e ? xt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var J = (e, t, n) => (bt(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- import { j as r } from "./jsx-runtime-NV737rRe.js";
5
- import X, { createElement as wt, useCallback as we, useState as U, useEffect as _, Component as Ue, Children as kt, Suspense as ze, useRef as De, useMemo as jt, lazy as Ct } from "react";
6
- import { d as ie, c as Be, H as ue, I as Tt, J as Ye, K as ee, a as K, h as ae, o as St, B as It, g as O, i as ke, m as Et, f as Dt, j as Bt, b as Ke, A as Ot } from "./lodash-3gkdNK5u.js";
7
- import { ResetIcon as Oe, MobileIcon as Ae, LaptopIcon as At, DesktopIcon as Pt, DotsVerticalIcon as Rt, EraserIcon as Mt, ZoomInIcon as _t, DragHandleDots2Icon as Lt, ArrowUpIcon as Nt, CopyIcon as Ft, TrashIcon as $t } from "@radix-ui/react-icons";
8
- import { p as je, B as le, W as Je, aI as Wt, aJ as Ht, aK as qt, aL as Ut, aM as zt, R as Ce, ai as Yt, aN as Kt, aO as Jt, aP as Xt, aQ as Vt, aR as Zt, aS as Gt, w as Qt, j as W, aj as V, D as en, E as tn, F as nn, G as rn, H as sn, I as on, J as an, K as ln, ap as cn, L as dn, U as Xe, aH as oe, aT as un, _ as G, ab as pn, aU as re, ae as Te, m as Ve, n as fn, k as hn, o as gn, h as Ze, l as Ge, ag as mn, aV as yn, aW as Qe, aX as vn, aY as xn, x as bn, a as wn, aZ as kn, a_ as jn, a6 as Cn, a$ as Tn, i as Sn, S as et, aw as In } from "./index-0OqmBgqo.js";
9
- import { useTranslation as En } from "react-i18next";
10
- import { useAtom as F } from "jotai";
11
- import Pe from "react-dom";
12
- import { g as Dn, S as Re, a as tt } from "./MODIFIERS-MLfpKQY1.js";
13
- import { r as nt, u as Bn, B as On, E as An } from "./index-CQz6j3ex.js";
14
- import { Quill as Pn } from "react-quill";
15
- import { u as Rn } from "./useAddBlockByDrop-5QW86HjG.js";
16
- import { useFeature as rt } from "flagged";
17
- import { flip as Mn } from "@floating-ui/dom";
18
- import { useFloating as _n, shift as Ln } from "@floating-ui/react-dom";
19
- import { useResizeObserver as Nn } from "@react-hookz/web";
20
- import { tailwindcssPaletteGenerator as Fn } from "@bobthered/tailwindcss-palette-generator";
21
- import { Provider as $n } from "react-wrap-balancer";
22
- import { twMerge as Wn } from "tailwind-merge";
23
- import { getBlockComponent as Hn } from "@chaibuilder/runtime";
24
- import "@radix-ui/react-toggle";
25
- import "class-variance-authority";
26
- import "./utils-XsPKXMVo.js";
27
- import "clsx";
28
- import "@radix-ui/react-switch";
29
- import "@radix-ui/react-slot";
30
- import "@radix-ui/react-accordion";
31
- import "@radix-ui/react-alert-dialog";
32
- import "@radix-ui/react-dialog";
33
- import "@radix-ui/react-label";
34
- import "@radix-ui/react-scroll-area";
35
- import "@radix-ui/react-tabs";
36
- import "@radix-ui/react-tooltip";
37
- import "@radix-ui/react-popover";
38
- import "@radix-ui/react-menubar";
39
- import "@radix-ui/react-hover-card";
40
- import "@radix-ui/react-select";
41
- import "@radix-ui/react-dropdown-menu";
42
- import "@radix-ui/react-separator";
43
- import "@radix-ui/react-toast";
44
- import "cmdk";
45
- import "@radix-ui/react-context-menu";
46
- import "react-icons-picker";
47
- import "flat-to-nested";
48
- import "redux-undo";
49
- import "i18next";
50
- import "react-textarea-autosize";
51
- import "react-dnd";
52
- import "@minoru/react-dnd-treeview";
53
- import "react-hotkeys-hook";
54
- import "sonner";
55
- import "./html-to-json-Y5M0N8PH.js";
56
- import "himalaya";
57
- import "lucide-react";
58
- const qn = () => {
59
- const { undoCount: e, redoCount: t, undo: n, redo: i } = je();
60
- return /* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
61
- /* @__PURE__ */ r.jsx(le, { disabled: !e, size: "sm", onClick: n, className: "rounded-full", variant: "ghost", children: /* @__PURE__ */ r.jsx(Oe, {}) }),
62
- /* @__PURE__ */ r.jsx(le, { disabled: !t, onClick: i, size: "sm", className: "rounded-full", variant: "ghost", children: /* @__PURE__ */ r.jsx(Oe, { className: "rotate-180 scale-y-[-1] transform" }) })
63
- ] });
64
- };
65
- function Un() {
66
- const [e, t] = Je(), { t: n } = En();
67
- return /* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
68
- /* @__PURE__ */ r.jsx(Wt, { htmlFor: "dark-mode-switch", children: n("dark_mode") }),
69
- /* @__PURE__ */ r.jsxs(
70
- Ht,
71
- {
72
- id: "dark-mode-switch",
73
- checked: e,
74
- onCheckedChange: () => {
75
- t(!e);
76
- },
77
- className: `${e ? "bg-violet-600" : "bg-violet-300"}
78
- 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`,
79
- children: [
80
- /* @__PURE__ */ r.jsx("span", { className: "sr-only", children: "Use setting" }),
81
- /* @__PURE__ */ r.jsx(
82
- "span",
83
- {
84
- "aria-hidden": "true",
85
- className: `${e ? "translate-x-5" : "translate-x-0"}
86
- 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`
87
- }
88
- )
89
- ]
90
- }
91
- )
92
- ] });
93
- }
94
- const Me = ({ landscape: e = !1 }) => /* @__PURE__ */ r.jsxs(
95
- "svg",
96
- {
97
- className: e ? "rotate-90" : "",
98
- xmlns: "http://www.w3.org/2000/svg",
99
- viewBox: "0 0 13 13",
100
- xmlSpace: "preserve",
101
- width: 13,
102
- height: 13,
103
- children: [
104
- /* @__PURE__ */ r.jsx("g", { strokeWidth: 0 }),
105
- /* @__PURE__ */ r.jsx("g", { strokeLinecap: "round", strokeLinejoin: "round" }),
106
- /* @__PURE__ */ r.jsx(
107
- "path",
108
- {
109
- 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",
110
- style: {
111
- fill: "#000"
112
- }
113
- }
114
- )
115
- ]
116
- }
117
- ), _e = [
118
- {
119
- title: "Mobile (XS)",
120
- content: "Styles set here are applied to all screen unless edited at higher breakpoint",
121
- breakpoint: "xs",
122
- icon: /* @__PURE__ */ r.jsx(Ae, {}),
123
- width: 400
124
- },
125
- {
126
- title: "Mobile landscape (SM)",
127
- content: "Styles set here are applied at 640px and up unless edited at higher breakpoint",
128
- breakpoint: "sm",
129
- icon: /* @__PURE__ */ r.jsx(Ae, { className: "rotate-90" }),
130
- width: 640
131
- },
132
- {
133
- title: "Tablet (MD)",
134
- content: "Styles set here are applied at 768px and up",
135
- breakpoint: "md",
136
- icon: /* @__PURE__ */ r.jsx(Me, {}),
137
- width: 800
138
- },
139
- {
140
- title: "Tablet Landscape (LG)",
141
- content: "Styles set here are applied at 1024px and up unless edited at higher breakpoint",
142
- breakpoint: "lg",
143
- icon: /* @__PURE__ */ r.jsx(Me, { landscape: !0 }),
144
- width: 1024
145
- },
146
- {
147
- title: "Desktop (XL)",
148
- content: "Styles set here are applied at 1280px and up unless edited at higher breakpoint",
149
- breakpoint: "xl",
150
- icon: /* @__PURE__ */ r.jsx(At, {}),
151
- width: 1420
152
- },
153
- {
154
- title: "Large Desktop (2XL)",
155
- content: "Styles set here are applied at 1536px and up",
156
- breakpoint: "2xl",
157
- icon: /* @__PURE__ */ r.jsx(Pt, {}),
158
- width: 1920
159
- }
160
- ], zn = ({
161
- title: e,
162
- content: t,
163
- currentBreakpoint: n,
164
- breakpoint: i,
165
- width: l,
166
- icon: o,
167
- onClick: d
168
- }) => /* @__PURE__ */ r.jsxs(qt, { children: [
169
- /* @__PURE__ */ r.jsx(Ut, { asChild: !0, children: /* @__PURE__ */ r.jsx(
170
- le,
171
- {
172
- onClick: () => d(l),
173
- size: "sm",
174
- variant: i === n ? "secondary" : "ghost",
175
- children: o
176
- }
177
- ) }),
178
- /* @__PURE__ */ r.jsx(zt, { className: "w-52 border-border", children: /* @__PURE__ */ r.jsx("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ r.jsxs("div", { className: "space-y-1", children: [
179
- /* @__PURE__ */ r.jsx("h4", { className: "text-sm font-semibold", children: e }),
180
- /* @__PURE__ */ r.jsx("p", { className: "text-xs", children: t })
181
- ] }) }) })
182
- ] }), Yn = () => {
183
- const [, e, t] = Ce(), [n, i] = Yt(), l = (o) => {
184
- n.includes(o) ? n.length > 2 && i(n.filter((d) => d !== o)) : i((d) => [...d, o]);
185
- };
186
- return /* @__PURE__ */ r.jsxs("div", { className: "flex items-center rounded-md", children: [
187
- ie(
188
- _e.filter((o) => Be(n, ue(o.breakpoint))),
189
- (o) => /* @__PURE__ */ wt(zn, { ...o, onClick: t, key: o.breakpoint, currentBreakpoint: e })
190
- ),
191
- /* @__PURE__ */ r.jsxs(Kt, { children: [
192
- /* @__PURE__ */ r.jsx(Jt, { asChild: !0, children: /* @__PURE__ */ r.jsx("span", { className: "cursor-pointer px-2.5 hover:opacity-80", children: /* @__PURE__ */ r.jsx(Rt, { className: "scale-90 transform" }) }) }),
193
- /* @__PURE__ */ r.jsxs(Xt, { className: "w-56 border-border text-xs", children: [
194
- /* @__PURE__ */ r.jsx(Vt, { children: "Breakpoints" }),
195
- /* @__PURE__ */ r.jsx(Zt, {}),
196
- ie(_e, (o) => /* @__PURE__ */ r.jsx(
197
- Gt,
198
- {
199
- disabled: o.breakpoint === "xs",
200
- onCheckedChange: () => l(ue(o.breakpoint)),
201
- checked: Be(n, ue(o.breakpoint)),
202
- children: o.title
203
- },
204
- o.breakpoint
205
- ))
206
- ] })
207
- ] })
208
- ] });
209
- }, Kn = () => {
210
- const [e] = Qt(), { createSnapshot: t } = je(), [, n] = W(), [, i] = V(), l = we(() => {
211
- e([]), n([]), i([]), t();
212
- }, [e, t]);
213
- return /* @__PURE__ */ r.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ r.jsxs(en, { children: [
214
- /* @__PURE__ */ r.jsx(tn, { asChild: !0, children: /* @__PURE__ */ r.jsxs(le, { size: "sm", variant: "ghost", className: "flex items-center gap-x-1", children: [
215
- /* @__PURE__ */ r.jsx(Mt, {}),
216
- " Clear"
217
- ] }) }),
218
- /* @__PURE__ */ r.jsxs(nn, { className: "border-border", children: [
219
- /* @__PURE__ */ r.jsxs(rn, { children: [
220
- /* @__PURE__ */ r.jsx(sn, { children: "Clear whole canvas?" }),
221
- /* @__PURE__ */ r.jsx(on, { children: "Are you sure you want to clear the whole canvas?" })
222
- ] }),
223
- /* @__PURE__ */ r.jsxs(an, { children: [
224
- /* @__PURE__ */ r.jsx(ln, { children: "Cancel" }),
225
- /* @__PURE__ */ r.jsx(cn, { onClick: l, children: "Yes" })
226
- ] })
227
- ] })
228
- ] }) });
229
- }, Jn = () => {
230
- const e = dn("darkMode", !1), [t] = Xe();
231
- return /* @__PURE__ */ r.jsxs("div", { className: "flex h-10 items-center justify-between border-b bg-background/70 px-2", children: [
232
- /* @__PURE__ */ r.jsxs("div", { className: "flex h-full space-x-2", children: [
233
- e ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
234
- /* @__PURE__ */ r.jsx(Un, {}),
235
- /* @__PURE__ */ r.jsx(oe, { orientation: "vertical" })
236
- ] }) : null,
237
- /* @__PURE__ */ r.jsx(Yn, {}),
238
- /* @__PURE__ */ r.jsx(oe, { orientation: "vertical" }),
239
- /* @__PURE__ */ r.jsxs("div", { className: "flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium", children: [
240
- /* @__PURE__ */ r.jsx(_t, { className: "h-3.5 w-3.5 flex-shrink-0" }),
241
- " ",
242
- /* @__PURE__ */ r.jsxs("div", { className: "text-xs leading-3", children: [
243
- Tt(t, 0),
244
- "%"
245
- ] })
246
- ] }),
247
- /* @__PURE__ */ r.jsx(oe, { orientation: "vertical" }),
248
- /* @__PURE__ */ r.jsx(qn, {})
249
- ] }),
250
- /* @__PURE__ */ r.jsxs("div", { className: "flex h-full items-center space-x-2", children: [
251
- /* @__PURE__ */ r.jsx(oe, { orientation: "vertical" }),
252
- /* @__PURE__ */ r.jsx(Kn, {})
253
- ] })
254
- ] });
255
- }, Xn = `<!doctype html>
256
- <html class="scroll-smooth h-full overflow-y-auto">
257
- <head>
258
- <meta charset="UTF-8">
259
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
260
- <script src="https://old.chaibuilder.com/offline/tailwind.cdn.js"><\/script>
261
- <style>
262
- html { height: 100%; overflow:auto; }
263
- body { height: 100%; }
264
- .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
265
- .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
266
- body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
267
- -moz-user-select: none;-ms-user-select: none; user-select: none; }
268
- html{
269
- -ms-overflow-style: none; /* IE and Edge */
270
- scrollbar-width: none; /* Firefox */
271
- }
272
- /** IMPORTANT: Make fields content editable in SAFARI */
273
- [contenteditable] {-webkit-user-select: text;user-select: text;}
274
-
275
- html::-webkit-scrollbar { width: 0 !important }
276
- .aspect-auto{aspect-ratio: auto;}
277
- .aspect-square{aspect-ratio: 1/1;}
278
- .aspect-video{aspect-ratio: 16/9;}
279
- .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
280
- .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
281
- a{ pointer-events: none !important; }
282
- [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
283
- [contenteditable="true"] {
284
- outline: none;
285
- box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
286
- -webkit-user-select: text;
287
- -moz-user-select: text;
288
- user-select: text;
289
- }
290
- </style>
291
- <style id="hidden-blocks"></style>
292
- <style id="selected-block"></style>
293
- <style id="selected-styling-block"></style>
294
- <style id="highlighted-block"></style>
295
- <style id="dragged-block"></style>
296
-
297
- </head>
298
- <body class="font-body antialiased h-full">
299
- <div class="frame-root"></div>
300
- <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
301
- </body>
302
- </html>`, Vn = (e) => {
303
- const [t] = Ce(), [, n] = Xe(), [i, l] = U({}), o = we(() => {
304
- const { width: d, height: s } = e;
305
- if (d < t) {
306
- const u = parseFloat((d / t).toFixed(2).toString());
307
- let c = {};
308
- const f = s * u;
309
- s && (c = {
310
- // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
311
- height: 100 + (s - f) / f * 100 + "%"
312
- }), l({
313
- position: "relative",
314
- top: 0,
315
- transform: `scale(${u})`,
316
- transformOrigin: "top left",
317
- ...c,
318
- maxWidth: "none"
319
- }), n(u * 100);
320
- } else
321
- l({}), n(100);
322
- }, [t, e, n]);
323
- return _(() => {
324
- o();
325
- }, [t, e, n, o]), i;
326
- };
327
- var ce = { exports: {} };
328
- /*
329
- object-assign
330
- (c) Sindre Sorhus
331
- @license MIT
332
- */
333
- var pe, Le;
334
- function Zn() {
335
- if (Le)
336
- return pe;
337
- Le = 1;
338
- var e = Object.getOwnPropertySymbols, t = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
339
- function i(o) {
340
- if (o == null)
341
- throw new TypeError("Object.assign cannot be called with null or undefined");
342
- return Object(o);
343
- }
344
- function l() {
345
- try {
346
- if (!Object.assign)
347
- return !1;
348
- var o = new String("abc");
349
- if (o[5] = "de", Object.getOwnPropertyNames(o)[0] === "5")
350
- return !1;
351
- for (var d = {}, s = 0; s < 10; s++)
352
- d["_" + String.fromCharCode(s)] = s;
353
- var u = Object.getOwnPropertyNames(d).map(function(f) {
354
- return d[f];
355
- });
356
- if (u.join("") !== "0123456789")
357
- return !1;
358
- var c = {};
359
- return "abcdefghijklmnopqrst".split("").forEach(function(f) {
360
- c[f] = f;
361
- }), Object.keys(Object.assign({}, c)).join("") === "abcdefghijklmnopqrst";
362
- } catch {
363
- return !1;
364
- }
365
- }
366
- return pe = l() ? Object.assign : function(o, d) {
367
- for (var s, u = i(o), c, f = 1; f < arguments.length; f++) {
368
- s = Object(arguments[f]);
369
- for (var h in s)
370
- t.call(s, h) && (u[h] = s[h]);
371
- if (e) {
372
- c = e(s);
373
- for (var w = 0; w < c.length; w++)
374
- n.call(s, c[w]) && (u[c[w]] = s[c[w]]);
375
- }
376
- }
377
- return u;
378
- }, pe;
379
- }
380
- var fe, Ne;
381
- function Se() {
382
- if (Ne)
383
- return fe;
384
- Ne = 1;
385
- var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
386
- return fe = e, fe;
387
- }
388
- var he, Fe;
389
- function st() {
390
- return Fe || (Fe = 1, he = Function.call.bind(Object.prototype.hasOwnProperty)), he;
391
- }
392
- var ge, $e;
393
- function Gn() {
394
- if ($e)
395
- return ge;
396
- $e = 1;
397
- var e = function() {
398
- };
399
- if (process.env.NODE_ENV !== "production") {
400
- var t = Se(), n = {}, i = st();
401
- e = function(o) {
402
- var d = "Warning: " + o;
403
- typeof console < "u" && console.error(d);
404
- try {
405
- throw new Error(d);
406
- } catch {
407
- }
408
- };
409
- }
410
- function l(o, d, s, u, c) {
411
- if (process.env.NODE_ENV !== "production") {
412
- for (var f in o)
413
- if (i(o, f)) {
414
- var h;
415
- try {
416
- if (typeof o[f] != "function") {
417
- var w = Error(
418
- (u || "React class") + ": " + s + " type `" + f + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof o[f] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
419
- );
420
- throw w.name = "Invariant Violation", w;
421
- }
422
- h = o[f](d, f, u, s, null, t);
423
- } catch (P) {
424
- h = P;
425
- }
426
- if (h && !(h instanceof Error) && e(
427
- (u || "React class") + ": type specification of " + s + " `" + f + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof h + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
428
- ), h instanceof Error && !(h.message in n)) {
429
- n[h.message] = !0;
430
- var S = c ? c() : "";
431
- e(
432
- "Failed " + s + " type: " + h.message + (S ?? "")
433
- );
434
- }
435
- }
436
- }
437
- }
438
- return l.resetWarningCache = function() {
439
- process.env.NODE_ENV !== "production" && (n = {});
440
- }, ge = l, ge;
441
- }
442
- var me, We;
443
- function Qn() {
444
- if (We)
445
- return me;
446
- We = 1;
447
- var e = nt, t = Zn(), n = Se(), i = st(), l = Gn(), o = function() {
448
- };
449
- process.env.NODE_ENV !== "production" && (o = function(s) {
450
- var u = "Warning: " + s;
451
- typeof console < "u" && console.error(u);
452
- try {
453
- throw new Error(u);
454
- } catch {
455
- }
456
- });
457
- function d() {
458
- return null;
459
- }
460
- return me = function(s, u) {
461
- var c = typeof Symbol == "function" && Symbol.iterator, f = "@@iterator";
462
- function h(a) {
463
- var p = a && (c && a[c] || a[f]);
464
- if (typeof p == "function")
465
- return p;
466
- }
467
- var w = "<<anonymous>>", S = {
468
- array: D("array"),
469
- bigint: D("bigint"),
470
- bool: D("boolean"),
471
- func: D("function"),
472
- number: D("number"),
473
- object: D("object"),
474
- string: D("string"),
475
- symbol: D("symbol"),
476
- any: A(),
477
- arrayOf: k,
478
- element: N(),
479
- elementType: $(),
480
- instanceOf: B,
481
- node: ft(),
482
- objectOf: q,
483
- oneOf: H,
484
- oneOfType: pt,
485
- shape: ht,
486
- exact: gt
487
- };
488
- function P(a, p) {
489
- return a === p ? a !== 0 || 1 / a === 1 / p : a !== a && p !== p;
490
- }
491
- function x(a, p) {
492
- this.message = a, this.data = p && typeof p == "object" ? p : {}, this.stack = "";
493
- }
494
- x.prototype = Error.prototype;
495
- function E(a) {
496
- if (process.env.NODE_ENV !== "production")
497
- var p = {}, b = 0;
498
- function y(j, m, v, C, I, T, L) {
499
- if (C = C || w, T = T || v, L !== n) {
500
- if (u) {
501
- var R = new Error(
502
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
503
- );
504
- throw R.name = "Invariant Violation", R;
505
- } else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
506
- var Z = C + ":" + v;
507
- !p[Z] && // Avoid spamming the console because they are often not actionable except for lib authors
508
- b < 3 && (o(
509
- "You are manually calling a React.PropTypes validation function for the `" + T + "` prop on `" + C + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
510
- ), p[Z] = !0, b++);
511
- }
512
- }
513
- return m[v] == null ? j ? m[v] === null ? new x("The " + I + " `" + T + "` is marked as required " + ("in `" + C + "`, but its value is `null`.")) : new x("The " + I + " `" + T + "` is marked as required in " + ("`" + C + "`, but its value is `undefined`.")) : null : a(m, v, C, I, T);
514
- }
515
- var g = y.bind(null, !1);
516
- return g.isRequired = y.bind(null, !0), g;
517
- }
518
- function D(a) {
519
- function p(b, y, g, j, m, v) {
520
- var C = b[y], I = z(C);
521
- if (I !== a) {
522
- var T = Q(C);
523
- return new x(
524
- "Invalid " + j + " `" + m + "` of type " + ("`" + T + "` supplied to `" + g + "`, expected ") + ("`" + a + "`."),
525
- { expectedType: a }
526
- );
527
- }
528
- return null;
529
- }
530
- return E(p);
531
- }
532
- function A() {
533
- return E(d);
534
- }
535
- function k(a) {
536
- function p(b, y, g, j, m) {
537
- if (typeof a != "function")
538
- return new x("Property `" + m + "` of component `" + g + "` has invalid PropType notation inside arrayOf.");
539
- var v = b[y];
540
- if (!Array.isArray(v)) {
541
- var C = z(v);
542
- return new x("Invalid " + j + " `" + m + "` of type " + ("`" + C + "` supplied to `" + g + "`, expected an array."));
543
- }
544
- for (var I = 0; I < v.length; I++) {
545
- var T = a(v, I, g, j, m + "[" + I + "]", n);
546
- if (T instanceof Error)
547
- return T;
548
- }
549
- return null;
550
- }
551
- return E(p);
552
- }
553
- function N() {
554
- function a(p, b, y, g, j) {
555
- var m = p[b];
556
- if (!s(m)) {
557
- var v = z(m);
558
- return new x("Invalid " + g + " `" + j + "` of type " + ("`" + v + "` supplied to `" + y + "`, expected a single ReactElement."));
559
- }
560
- return null;
561
- }
562
- return E(a);
563
- }
564
- function $() {
565
- function a(p, b, y, g, j) {
566
- var m = p[b];
567
- if (!e.isValidElementType(m)) {
568
- var v = z(m);
569
- return new x("Invalid " + g + " `" + j + "` of type " + ("`" + v + "` supplied to `" + y + "`, expected a single ReactElement type."));
570
- }
571
- return null;
572
- }
573
- return E(a);
574
- }
575
- function B(a) {
576
- function p(b, y, g, j, m) {
577
- if (!(b[y] instanceof a)) {
578
- var v = a.name || w, C = vt(b[y]);
579
- return new x("Invalid " + j + " `" + m + "` of type " + ("`" + C + "` supplied to `" + g + "`, expected ") + ("instance of `" + v + "`."));
580
- }
581
- return null;
582
- }
583
- return E(p);
584
- }
585
- function H(a) {
586
- if (!Array.isArray(a))
587
- return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? o(
588
- "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
589
- ) : o("Invalid argument supplied to oneOf, expected an array.")), d;
590
- function p(b, y, g, j, m) {
591
- for (var v = b[y], C = 0; C < a.length; C++)
592
- if (P(v, a[C]))
593
- return null;
594
- var I = JSON.stringify(a, function(L, R) {
595
- var Z = Q(R);
596
- return Z === "symbol" ? String(R) : R;
597
- });
598
- return new x("Invalid " + j + " `" + m + "` of value `" + String(v) + "` " + ("supplied to `" + g + "`, expected one of " + I + "."));
599
- }
600
- return E(p);
601
- }
602
- function q(a) {
603
- function p(b, y, g, j, m) {
604
- if (typeof a != "function")
605
- return new x("Property `" + m + "` of component `" + g + "` has invalid PropType notation inside objectOf.");
606
- var v = b[y], C = z(v);
607
- if (C !== "object")
608
- return new x("Invalid " + j + " `" + m + "` of type " + ("`" + C + "` supplied to `" + g + "`, expected an object."));
609
- for (var I in v)
610
- if (i(v, I)) {
611
- var T = a(v, I, g, j, m + "." + I, n);
612
- if (T instanceof Error)
613
- return T;
614
- }
615
- return null;
616
- }
617
- return E(p);
618
- }
619
- function pt(a) {
620
- if (!Array.isArray(a))
621
- return process.env.NODE_ENV !== "production" && o("Invalid argument supplied to oneOfType, expected an instance of array."), d;
622
- for (var p = 0; p < a.length; p++) {
623
- var b = a[p];
624
- if (typeof b != "function")
625
- return o(
626
- "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + yt(b) + " at index " + p + "."
627
- ), d;
628
- }
629
- function y(g, j, m, v, C) {
630
- for (var I = [], T = 0; T < a.length; T++) {
631
- var L = a[T], R = L(g, j, m, v, C, n);
632
- if (R == null)
633
- return null;
634
- R.data && i(R.data, "expectedType") && I.push(R.data.expectedType);
635
- }
636
- var Z = I.length > 0 ? ", expected one of type [" + I.join(", ") + "]" : "";
637
- return new x("Invalid " + v + " `" + C + "` supplied to " + ("`" + m + "`" + Z + "."));
638
- }
639
- return E(y);
640
- }
641
- function ft() {
642
- function a(p, b, y, g, j) {
643
- return se(p[b]) ? null : new x("Invalid " + g + " `" + j + "` supplied to " + ("`" + y + "`, expected a ReactNode."));
644
- }
645
- return E(a);
646
- }
647
- function Ee(a, p, b, y, g) {
648
- return new x(
649
- (a || "React class") + ": " + p + " type `" + b + "." + y + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + g + "`."
650
- );
651
- }
652
- function ht(a) {
653
- function p(b, y, g, j, m) {
654
- var v = b[y], C = z(v);
655
- if (C !== "object")
656
- return new x("Invalid " + j + " `" + m + "` of type `" + C + "` " + ("supplied to `" + g + "`, expected `object`."));
657
- for (var I in a) {
658
- var T = a[I];
659
- if (typeof T != "function")
660
- return Ee(g, j, m, I, Q(T));
661
- var L = T(v, I, g, j, m + "." + I, n);
662
- if (L)
663
- return L;
664
- }
665
- return null;
666
- }
667
- return E(p);
668
- }
669
- function gt(a) {
670
- function p(b, y, g, j, m) {
671
- var v = b[y], C = z(v);
672
- if (C !== "object")
673
- return new x("Invalid " + j + " `" + m + "` of type `" + C + "` " + ("supplied to `" + g + "`, expected `object`."));
674
- var I = t({}, b[y], a);
675
- for (var T in I) {
676
- var L = a[T];
677
- if (i(a, T) && typeof L != "function")
678
- return Ee(g, j, m, T, Q(L));
679
- if (!L)
680
- return new x(
681
- "Invalid " + j + " `" + m + "` key `" + T + "` supplied to `" + g + "`.\nBad object: " + JSON.stringify(b[y], null, " ") + `
682
- Valid keys: ` + JSON.stringify(Object.keys(a), null, " ")
683
- );
684
- var R = L(v, T, g, j, m + "." + T, n);
685
- if (R)
686
- return R;
687
- }
688
- return null;
689
- }
690
- return E(p);
691
- }
692
- function se(a) {
693
- switch (typeof a) {
694
- case "number":
695
- case "string":
696
- case "undefined":
697
- return !0;
698
- case "boolean":
699
- return !a;
700
- case "object":
701
- if (Array.isArray(a))
702
- return a.every(se);
703
- if (a === null || s(a))
704
- return !0;
705
- var p = h(a);
706
- if (p) {
707
- var b = p.call(a), y;
708
- if (p !== a.entries) {
709
- for (; !(y = b.next()).done; )
710
- if (!se(y.value))
711
- return !1;
712
- } else
713
- for (; !(y = b.next()).done; ) {
714
- var g = y.value;
715
- if (g && !se(g[1]))
716
- return !1;
717
- }
718
- } else
719
- return !1;
720
- return !0;
721
- default:
722
- return !1;
723
- }
724
- }
725
- function mt(a, p) {
726
- return a === "symbol" ? !0 : p ? p["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && p instanceof Symbol : !1;
727
- }
728
- function z(a) {
729
- var p = typeof a;
730
- return Array.isArray(a) ? "array" : a instanceof RegExp ? "object" : mt(p, a) ? "symbol" : p;
731
- }
732
- function Q(a) {
733
- if (typeof a > "u" || a === null)
734
- return "" + a;
735
- var p = z(a);
736
- if (p === "object") {
737
- if (a instanceof Date)
738
- return "date";
739
- if (a instanceof RegExp)
740
- return "regexp";
741
- }
742
- return p;
743
- }
744
- function yt(a) {
745
- var p = Q(a);
746
- switch (p) {
747
- case "array":
748
- case "object":
749
- return "an " + p;
750
- case "boolean":
751
- case "date":
752
- case "regexp":
753
- return "a " + p;
754
- default:
755
- return p;
756
- }
757
- }
758
- function vt(a) {
759
- return !a.constructor || !a.constructor.name ? w : a.constructor.name;
760
- }
761
- return S.checkPropTypes = l, S.resetWarningCache = l.resetWarningCache, S.PropTypes = S, S;
762
- }, me;
763
- }
764
- var ye, He;
765
- function er() {
766
- if (He)
767
- return ye;
768
- He = 1;
769
- var e = Se();
770
- function t() {
771
- }
772
- function n() {
773
- }
774
- return n.resetWarningCache = t, ye = function() {
775
- function i(d, s, u, c, f, h) {
776
- if (h !== e) {
777
- var w = new Error(
778
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
779
- );
780
- throw w.name = "Invariant Violation", w;
781
- }
782
- }
783
- i.isRequired = i;
784
- function l() {
785
- return i;
786
- }
787
- var o = {
788
- array: i,
789
- bigint: i,
790
- bool: i,
791
- func: i,
792
- number: i,
793
- object: i,
794
- string: i,
795
- symbol: i,
796
- any: i,
797
- arrayOf: l,
798
- element: i,
799
- elementType: i,
800
- instanceOf: l,
801
- node: i,
802
- objectOf: l,
803
- oneOf: l,
804
- oneOfType: l,
805
- shape: l,
806
- exact: l,
807
- checkPropTypes: n,
808
- resetWarningCache: t
809
- };
810
- return o.PropTypes = o, o;
811
- }, ye;
812
- }
813
- var Os = ce.exports;
814
- if (process.env.NODE_ENV !== "production") {
815
- var tr = nt, nr = !0;
816
- ce.exports = Qn()(tr.isElement, nr);
817
- } else
818
- ce.exports = er()();
819
- var rr = ce.exports;
820
- const M = /* @__PURE__ */ Dn(rr);
821
- let ot, it;
822
- typeof document < "u" && (ot = document);
823
- typeof window < "u" && (it = window);
824
- const at = X.createContext({ document: ot, window: it }), de = () => X.useContext(at), { Provider: sr, Consumer: As } = at;
825
- class lt extends Ue {
826
- componentDidMount() {
827
- this.props.contentDidMount();
828
- }
829
- componentDidUpdate() {
830
- this.props.contentDidUpdate();
831
- }
832
- render() {
833
- return kt.only(this.props.children);
834
- }
835
- }
836
- J(lt, "propTypes", {
837
- children: M.element.isRequired,
838
- contentDidMount: M.func.isRequired,
839
- contentDidUpdate: M.func.isRequired
840
- });
841
- class xe extends Ue {
842
- constructor(n, i) {
843
- super(n, i);
844
- J(this, "setRef", (n) => {
845
- this.nodeRef.current = n;
846
- const { forwardedRef: i } = this.props;
847
- typeof i == "function" ? i(n) : i && (i.current = n);
848
- });
849
- J(this, "handleLoad", () => {
850
- clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
851
- });
852
- // In certain situations on a cold cache DOMContentLoaded never gets called
853
- // fallback to an interval to check if that's the case
854
- J(this, "loadCheck", () => setInterval(() => {
855
- this.handleLoad();
856
- }, 500));
857
- this._isMounted = !1, this.nodeRef = X.createRef(), this.state = { iframeLoaded: !1 };
858
- }
859
- componentDidMount() {
860
- this._isMounted = !0, this.getDoc() && this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded", this.handleLoad);
861
- }
862
- componentWillUnmount() {
863
- this._isMounted = !1, this.nodeRef.current.removeEventListener("DOMContentLoaded", this.handleLoad);
864
- }
865
- getDoc() {
866
- return this.nodeRef.current ? this.nodeRef.current.contentDocument : null;
867
- }
868
- getMountTarget() {
869
- const n = this.getDoc();
870
- return this.props.mountTarget ? n.querySelector(this.props.mountTarget) : n.body.children[0];
871
- }
872
- renderFrameContents() {
873
- if (!this._isMounted)
874
- return null;
875
- const n = this.getDoc();
876
- if (!n)
877
- return null;
878
- const i = this.props.contentDidMount, l = this.props.contentDidUpdate, o = n.defaultView || n.parentView, d = /* @__PURE__ */ r.jsx(lt, { contentDidMount: i, contentDidUpdate: l, children: /* @__PURE__ */ r.jsx(sr, { value: { document: n, window: o }, children: /* @__PURE__ */ r.jsx("div", { className: "frame-content", children: this.props.children }) }) }), s = this.getMountTarget();
879
- return [Pe.createPortal(this.props.head, this.getDoc().head), Pe.createPortal(d, s)];
880
- }
881
- render() {
882
- const n = {
883
- ...this.props,
884
- srcDoc: this.props.initialContent,
885
- children: void 0
886
- // The iframe isn't ready so we drop children from props here. #12, #17
887
- };
888
- return delete n.head, delete n.initialContent, delete n.mountTarget, delete n.contentDidMount, delete n.contentDidUpdate, delete n.forwardedRef, /* @__PURE__ */ r.jsx("iframe", { ...n, ref: this.setRef, onLoad: this.handleLoad, children: this.state.iframeLoaded && this.renderFrameContents() });
889
- }
890
- }
891
- // React warns when you render directly into the body since browser extensions
892
- // also inject into the body and can mess up React. For this reason
893
- // initialContent is expected to have a div inside of the body
894
- // element that we render react into.
895
- J(xe, "propTypes", {
896
- style: M.object,
897
- // eslint-disable-line
898
- head: M.node,
899
- initialContent: M.string,
900
- mountTarget: M.string,
901
- contentDidMount: M.func,
902
- contentDidUpdate: M.func,
903
- children: M.oneOfType([M.element, M.arrayOf(M.element)])
904
- }), J(xe, "defaultProps", {
905
- style: {},
906
- head: null,
907
- children: void 0,
908
- mountTarget: void 0,
909
- contentDidMount: () => {
910
- },
911
- contentDidUpdate: () => {
912
- },
913
- initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
914
- });
915
- const or = X.forwardRef((e, t) => /* @__PURE__ */ r.jsx(xe, { ...e, forwardedRef: t }));
916
- let Y = null, ne = [], te = null, ct = null;
917
- function ir(e) {
918
- const t = window.getComputedStyle(e), n = parseInt(t.paddingLeft, 10), i = parseInt(t.paddingTop, 10), l = parseInt(t.paddingRight, 10), o = parseInt(t.paddingBottom, 10);
919
- return { paddingLeft: n, paddingTop: i, paddingRight: l, paddingBottom: o };
920
- }
921
- const qe = (e, t, n) => {
922
- if (!Y)
923
- return;
924
- const i = e.getBoundingClientRect(), l = Y == null ? void 0 : Y.getElementById("placeholder"), { paddingLeft: o, paddingTop: d, paddingRight: s, paddingBottom: u } = ir(e);
925
- l.style.width = t === "vertical" ? i.width - o - s + "px" : "2px", l.style.height = t === "vertical" ? "2px" : i.height - d - u + "px", l.style.display = "block";
926
- const c = ne.reduce(
927
- (f, h) => Math.abs(h - n) < Math.abs(f - n) ? h : f
928
- );
929
- ct = ne.indexOf(c), t === "vertical" ? (l.style.top = e.offsetTop + c + "px", l.style.left = e.offsetLeft + o + "px") : (l.style.top = e.offsetTop + d + "px", l.style.left = e.offsetLeft + c + "px");
930
- }, ar = (e) => {
931
- const t = dt(e), n = window.getComputedStyle(e), i = t === "horizontal", l = parseInt(n.paddingLeft), o = parseInt(n.paddingTop);
932
- let d = i ? l : o;
933
- ne = [d], Array.from(e.children).forEach((s) => {
934
- const u = window.getComputedStyle(s), c = parseInt(
935
- i ? u.marginLeft + u.marginRight : u.marginTop + u.marginBottom
936
- ), f = i ? s.offsetWidth : s.offsetHeight;
937
- ne.push(d + f + c), d += f + c;
938
- });
939
- };
940
- function dt(e) {
941
- const t = window.getComputedStyle(e).display, n = window.getComputedStyle(e).flexDirection;
942
- if (t === "flex")
943
- return n === "column" || n === "column-reverse" ? "vertical" : "horizontal";
944
- if (t === "grid") {
945
- const i = window.getComputedStyle(e).gridTemplateRows, l = window.getComputedStyle(e).gridTemplateColumns;
946
- if (i.includes("auto"))
947
- return "vertical";
948
- if (l.includes("auto"))
949
- return "horizontal";
950
- }
951
- return t === "block" ? "vertical" : "horizontal";
952
- }
953
- const lr = Ye((e) => {
954
- const t = e.target, n = dt(t);
955
- if (n === "vertical") {
956
- const i = e.clientY - t.offsetTop;
957
- qe(t, n, i);
958
- } else {
959
- const i = e.clientX - t.offsetLeft;
960
- qe(t, n, i);
961
- }
962
- }, 200), cr = (e) => {
963
- e.preventDefault(), e.stopPropagation(), lr(e);
964
- };
965
- function ve() {
966
- const e = Y == null ? void 0 : Y.getElementById("placeholder");
967
- e.style.display = "none";
968
- }
969
- const dr = () => {
970
- const { document: e } = de(), [t, n] = F(un), i = Rn(), l = rt("dnd"), [, o] = G(), [, d] = W();
971
- return Y = e, {
972
- isDragging: t,
973
- "data-dnd": "branch",
974
- onDragOver: l ? cr : ee,
975
- onDrop: l ? (s) => {
976
- te == null || te.classList.remove("outline", "outline-green-300", "outline-2", "-outline-offset-2");
977
- const u = JSON.parse(s.dataTransfer.getData("text/plain"));
978
- let c = s.target.getAttribute("data-block-id");
979
- c === null && (c = s.target.parentElement.getAttribute("data-block-id")), i({ block: u, dropTargetId: c || null, relativeIndex: ct }), n(!1), ve(), setTimeout(() => {
980
- ve();
981
- }, 300);
982
- } : ee,
983
- onDragEnter: l ? (s) => {
984
- const u = s;
985
- te = u.target, u.stopPropagation(), u.preventDefault(), ne = [];
986
- const c = u.target;
987
- ar(c), c.classList.add("outline", "outline-green-300", "outline-2", "-outline-offset-2"), n(!0), o(""), d([]);
988
- } : ee,
989
- onDragLeave: l ? (s) => {
990
- const u = s;
991
- te = null, u.stopPropagation(), u.preventDefault(), u.target.classList.remove("outline", "outline-green-300", "outline-2", "-outline-offset-2");
992
- } : ee,
993
- onMouseOut: l ? () => {
994
- n(!1), ve();
995
- } : ee
996
- };
997
- };
998
- function Ie(e) {
999
- return e.getAttribute("data-block-id") ? e : e.closest("[data-block-id]");
1000
- }
1001
- function ur(e) {
1002
- e.container.innerHTML = "", e.container.parentNode.removeChild(e.container);
1003
- var t = document.querySelector(".ql-toolbar");
1004
- t && t.parentNode.removeChild(t), e = null;
1005
- }
1006
- const pr = () => {
1007
- const e = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], t = pn(), [, n] = W(), [, i] = G(), [l, o] = F(re);
1008
- return (d) => {
1009
- var w;
1010
- if (l)
1011
- return;
1012
- const s = Ie(d.target), u = s.getAttribute("data-block-type");
1013
- if (!u || !e.includes(u))
1014
- return;
1015
- const c = s.cloneNode(!0);
1016
- s.style.display = "none", Array.from(c.attributes).forEach((S) => {
1017
- S.name !== "class" && c.removeAttribute(S.name);
1018
- }), u === "Text" && (c.style.display = "inline-block"), s.parentNode.insertBefore(c, s.nextSibling);
1019
- const f = new Pn(c, { placeholder: "Type here..." });
1020
- function h() {
1021
- const S = f.getText(0, f.getLength());
1022
- t([s.getAttribute("data-block-id")], { content: S }), s.removeAttribute("style"), c.removeEventListener("blur", h, !0), ur(f), o(""), i("");
1023
- }
1024
- c.addEventListener("blur", h, !0), f.focus(), (w = c.querySelector(".ql-clipboard")) == null || w.remove(), n([]), o(s.getAttribute("data-block-id"));
1025
- };
1026
- }, fr = () => {
1027
- const [, e] = V(), [, t] = W(), [n] = F(re);
1028
- return (i) => {
1029
- if (n)
1030
- return;
1031
- i.stopPropagation();
1032
- const l = Ie(i.target);
1033
- if (l != null && l.getAttribute("data-block-parent")) {
1034
- const o = l.getAttribute("data-style-prop"), d = l.getAttribute("data-style-id"), s = l.getAttribute("data-block-parent");
1035
- e([{ id: d, prop: o, blockId: s }]), t([s]);
1036
- } else
1037
- l != null && l.getAttribute("data-block-id") && t([l.getAttribute("data-block-id")]);
1038
- };
1039
- }, hr = Ye((e, t) => {
1040
- const n = Ie(e.target);
1041
- n != null && n.getAttribute("data-style-id") && t(n.getAttribute("data-style-id"));
1042
- }, 100), gr = () => {
1043
- const [, e] = G(), [t] = F(re);
1044
- return (n) => {
1045
- t || hr(n, e);
1046
- };
1047
- }, mr = ({ children: e }) => {
1048
- const { document: t } = de(), [n] = W(), [i, l] = V();
1049
- _(() => {
1050
- setTimeout(() => {
1051
- if (!K(i))
1052
- return;
1053
- const c = ut(t, ae(n));
1054
- if (c) {
1055
- const f = c.getAttribute("data-style-prop");
1056
- if (f) {
1057
- const h = c.getAttribute("data-style-id"), w = c.getAttribute("data-block-parent");
1058
- l([{ id: h, prop: f, blockId: w }]);
1059
- }
1060
- }
1061
- }, 100);
1062
- }, [t, n, l, i]);
1063
- const o = pr(), d = fr(), s = gr(), u = dr();
1064
- return /* @__PURE__ */ r.jsx(
1065
- "div",
1066
- {
1067
- id: "canvas",
1068
- onClick: d,
1069
- onDoubleClick: o,
1070
- onMouseMove: s,
1071
- ...St(u, "isDragging"),
1072
- className: "relative mb-5 max-w-full " + (u.isDragging ? "dragging" : ""),
1073
- children: e
1074
- }
1075
- );
1076
- }, ut = (e, t) => e.querySelector(`[data-block-id="${t}"]`), yr = () => {
1077
- const { window: e } = de(), [t, n] = W(), i = Te(), [, l] = V(), { undo: o, redo: d } = je(), s = Ve(), [, u] = fn(), [, c] = hn(), { pasteBlocks: f } = gn(), [, h] = Ze(), w = Ge(), { savePage: S } = mn(), [P] = F(re), [, x] = F(yn), E = (A) => {
1078
- A.key === "Enter" && (A.preventDefault(), t.length === 1 && x(ae(t)));
1079
- }, D = (A) => {
1080
- const k = i.find((N) => N._id === A);
1081
- return k ? k._parent : null;
1082
- };
1083
- return _(() => {
1084
- const A = (k) => {
1085
- if (k.key === "Escape") {
1086
- n([]), l([]);
1087
- return;
1088
- }
1089
- if (E(k), !P && (k.key === "Delete" || k.key === "Backspace") && (k.preventDefault(), w(t)), k.ctrlKey || k.metaKey) {
1090
- if (k.key === "ArrowUp") {
1091
- k.preventDefault();
1092
- const N = t.length > 0 ? D(t[0]) : null;
1093
- N && n([N]);
1094
- }
1095
- if (["z", "y", "d", "x", "c", "p", "s", "v"].includes(k.key)) {
1096
- if (P && ["x", "z", "v"].includes(k.key))
1097
- return !0;
1098
- k.preventDefault();
1099
- }
1100
- k.key === "s" && (k.stopPropagation(), k.preventDefault(), S()), k.key === "z" && o(), k.key === "y" && d(), k.key === "d" && s(t), k.key === "x" && u(t), k.key === "c" && c(t), k.key === "v" && t.length > 0 && f(t[0]);
1101
- }
1102
- };
1103
- return e.removeEventListener("keydown", A), e.addEventListener("keydown", A), () => {
1104
- e.removeEventListener("keydown", A);
1105
- };
1106
- }, [
1107
- t,
1108
- n,
1109
- o,
1110
- w,
1111
- h,
1112
- d,
1113
- s,
1114
- u,
1115
- c,
1116
- f,
1117
- P,
1118
- S,
1119
- e
1120
- ]), null;
1121
- }, vr = ({ block: e, label: t }) => {
1122
- const [, n] = W(), [, i] = G(), [, l] = F(Qe), o = rt("dnd");
1123
- return /* @__PURE__ */ r.jsxs(
1124
- "div",
1125
- {
1126
- className: "mr-10 flex cursor-grab items-center space-x-1 px-1",
1127
- draggable: o ? "true" : "false",
1128
- onDragStart: (d) => {
1129
- d.dataTransfer.setData("text/plain", JSON.stringify(It(e, ["_id", "_type"]))), l(e._id), setTimeout(() => {
1130
- n([]), i(null);
1131
- }, 200);
1132
- },
1133
- children: [
1134
- /* @__PURE__ */ r.jsx(Lt, {}),
1135
- t
1136
- ]
1137
- }
1138
- );
1139
- }, xr = ({ selectedBlockElement: e, block: t }) => {
1140
- const n = Ge(), i = Ve(), [, l] = W(), [, o] = V(), { floatingStyles: d, refs: s, update: u } = _n({
1141
- placement: "top-start",
1142
- middleware: [Ln(), Mn()],
1143
- elements: {
1144
- reference: e
1145
- }
1146
- });
1147
- Nn(e, () => u(), e !== null);
1148
- const c = O(t, "_parent", null), f = K(O(t, "_name", "")) ? O(t, "_type", "") : O(t, "_name", "");
1149
- return !e || !t ? null : /* @__PURE__ */ r.jsxs(
1150
- "div",
1151
- {
1152
- role: "button",
1153
- tabIndex: 0,
1154
- ref: s.setFloating,
1155
- style: d,
1156
- onClick: (h) => {
1157
- h.stopPropagation(), h.preventDefault();
1158
- },
1159
- onKeyDown: (h) => h.stopPropagation(),
1160
- className: "z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
1161
- children: [
1162
- /* @__PURE__ */ r.jsx(vr, { label: f, block: t }),
1163
- /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2 px-1 ", children: [
1164
- c && /* @__PURE__ */ r.jsx(
1165
- Nt,
1166
- {
1167
- className: "hover:scale-105 ",
1168
- onClick: () => {
1169
- o([]), l([c]);
1170
- }
1171
- }
1172
- ),
1173
- vn(O(t, "_type", "")) ? /* @__PURE__ */ r.jsx(Ft, { className: "hover:scale-105 ", onClick: () => i([t == null ? void 0 : t._id]) }) : null,
1174
- xn(O(t, "_type", "")) ? /* @__PURE__ */ r.jsx($t, { className: "hover:scale-105 ", onClick: () => n([t == null ? void 0 : t._id]) }) : null
1175
- ] })
1176
- ]
1177
- }
1178
- );
1179
- }, br = ({ model: e }) => {
1180
- const [t] = bn(), [n] = W(), [i] = Je(), [l] = G(), [o] = V(), [d] = F(Qe), { document: s, window: u } = de(), [c] = U(s == null ? void 0 : s.getElementById("highlighted-block")), [f] = U(
1181
- s == null ? void 0 : s.getElementById("selected-block")
1182
- ), [h] = U(
1183
- s == null ? void 0 : s.getElementById("selected-styling-block")
1184
- ), [w] = U(s == null ? void 0 : s.getElementById("dragged-block"));
1185
- _(() => {
1186
- i ? s == null || s.documentElement.classList.add("dark") : s == null || s.documentElement.classList.remove("dark");
1187
- }, [i, s]);
1188
- const S = O(t, "headingFont", "DM Sans"), P = O(t, "bodyFont", "DM Sans");
1189
- return _(() => {
1190
- const x = O(t, "primaryColor", "#000"), E = O(t, "secondaryColor", "#FFF"), D = Fn({
1191
- colors: [x, E],
1192
- names: ["primary", "secondary"]
1193
- });
1194
- D.primary.DEFAULT = x, D.secondary.DEFAULT = E;
1195
- const A = O(t, "roundedCorners", "0");
1196
- !u || !u.tailwind || (u.tailwind.config = {
1197
- darkMode: "class",
1198
- theme: {
1199
- fontFamily: {
1200
- heading: [S],
1201
- body: [P]
1202
- },
1203
- extend: {
1204
- borderRadius: {
1205
- global: `${A || "0"}px`
1206
- },
1207
- colors: D
1208
- }
1209
- },
1210
- plugins: [
1211
- // @ts-ignore
1212
- u.tailwind.plugin.withOptions(({ prefix: k = "ui" } = {}) => ({ addVariant: N }) => {
1213
- for (const $ of ["open", "checked", "selected", "active", "disabled"])
1214
- N(`${k}-${$}`, [
1215
- `&[data-headlessui-state~="${$}"]`,
1216
- `:where([data-headlessui-state~="${$}"]) &`
1217
- ]), N(`${k}-not-${$}`, [
1218
- `&[data-headlessui-state]:not([data-headlessui-state~="${$}"])`,
1219
- `:where([data-headlessui-state]:not([data-headlessui-state~="${$}"])) &:not([data-headlessui-state])`
1220
- ]);
1221
- })
1222
- ]
1223
- });
1224
- }, [t, u, S, P]), _(() => {
1225
- f && (f.textContent = `${ie(n, (x) => `[data-block-id="${x}"]`).join(",")}{
1226
- outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
1227
- }`);
1228
- }, [n, f]), _(() => {
1229
- if (!d) {
1230
- w.textContent = "";
1231
- return;
1232
- }
1233
- w.textContent = `[data-block-id="${d}"]{ pointer-events: none !important; opacity: 0.2 !important}`;
1234
- }, [d]), _(() => {
1235
- c && (c.textContent = l ? `[data-style-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
1236
- }, [l, n, c]), _(() => {
1237
- h && (h.textContent = `${ie(o, ({ id: x }) => `[data-style-id="${x}"]`).join(",")}{
1238
- outline: 1px solid #42a1fc !important; outline-offset: -1px;
1239
- }`);
1240
- }, [o, h]), _(() => {
1241
- const x = O(t, "bodyTextLightColor", "#64748b"), E = O(t, "bodyTextDarkColor", "#94a3b8"), D = O(t, "bodyBgLightColor", "#FFFFFF"), A = O(t, "bodyBgDarkColor", "#0f172a");
1242
- s.body.className = `font-body antialiased text-[${x}] bg-[${D}] dark:text-[${E}] dark:bg-[${A}]`;
1243
- }, [t, s, e]), e === "page" ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1244
- S && /* @__PURE__ */ r.jsx(
1245
- "link",
1246
- {
1247
- id: "heading-font",
1248
- rel: "stylesheet",
1249
- type: "text/css",
1250
- href: `https://fonts.googleapis.com/css2?family=${S.replace(
1251
- / /g,
1252
- "+"
1253
- )}:wght@300;400;500;600;700;800;900&display=swap`,
1254
- media: "all"
1255
- }
1256
- ),
1257
- P && S !== P && /* @__PURE__ */ r.jsx(
1258
- "link",
1259
- {
1260
- id: "body-font",
1261
- rel: "stylesheet",
1262
- type: "text/css",
1263
- href: `https://fonts.googleapis.com/css2?family=${P.replace(
1264
- / /g,
1265
- "+"
1266
- )}:wght@300;400;500;600;700;800;900&display=swap`,
1267
- media: "all"
1268
- }
1269
- ),
1270
- S && /* @__PURE__ */ r.jsx("style", { children: `h1,h2,h3,h4,h5,h6{font-family: "${S}",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";}` })
1271
- ] }) : null;
1272
- }, wr = (e) => {
1273
- const t = {};
1274
- return Object.keys(e).forEach((n) => {
1275
- ke(e[n]) && e[n].startsWith(Re) && (t[n] = e[n].replace(Re, "").split(","));
1276
- }), t;
1277
- }, kr = Et((e) => {
1278
- const t = e.replace(tt, "").split(",");
1279
- return Wn(t[0], t[1]);
1280
- });
1281
- function jr(e, t) {
1282
- return O(e, `${t}_attrs`, {});
1283
- }
1284
- function Cr(e) {
1285
- const t = {};
1286
- return Object.keys(e).forEach((n) => {
1287
- if (ke(e[n]) && e[n].startsWith(tt)) {
1288
- const i = kr(e[n]);
1289
- t[n] = {
1290
- className: i,
1291
- "data-style-prop": n,
1292
- "data-block-parent": e._id,
1293
- "data-style-id": `${n}-${e._id}`,
1294
- ...jr(e, n)
1295
- };
1296
- }
1297
- }), t;
1298
- }
1299
- function Tr(e, t) {
1300
- const n = O(e, "_bindings", {});
1301
- return K(n) ? { ...e } : (Dt(n, (i, l) => {
1302
- ke(i) && O(t, i, null) && (e[l] = O(t, i, null));
1303
- }), e);
1304
- }
1305
- function be({ blocks: e }) {
1306
- const t = Te(), n = we((o) => Cr(o), []), [i] = Bn(), [l] = wn(re);
1307
- return /* @__PURE__ */ r.jsx(r.Fragment, { children: X.Children.toArray(
1308
- e.map((o, d) => {
1309
- if (l === o._id)
1310
- return null;
1311
- const s = wr(o), u = {};
1312
- K(s) || Object.keys(s).forEach((w) => {
1313
- u[w] = X.Children.toArray(
1314
- s[w].map((S) => /* @__PURE__ */ r.jsx(be, { blocks: [Bt(t, { _id: S })] }))
1315
- );
1316
- });
1317
- const c = Ke(t, { _parent: o._id });
1318
- u.children = c.length ? /* @__PURE__ */ r.jsx(be, { blocks: c }) : null;
1319
- const f = Hn(o._type), h = O(f, "component", null);
1320
- return Ot(h) ? /* @__PURE__ */ r.jsx("noscript", { children: `<!-- ${o == null ? void 0 : o._type} not registered -->` }) : /* @__PURE__ */ r.jsx(ze, { children: X.createElement(h, {
1321
- blockProps: {
1322
- "data-block-id": o._id,
1323
- "data-block-type": o._type,
1324
- "data-dnd": kn(o._type) ? "branch" : "leaf"
1325
- },
1326
- inBuilder: !0,
1327
- index: d,
1328
- ...Tr(o, i),
1329
- ...n(o),
1330
- ...u
1331
- }) });
1332
- })
1333
- ) });
1334
- }
1335
- const Sr = () => {
1336
- const e = Te();
1337
- return /* @__PURE__ */ r.jsx($n, { children: K(e) ? null : /* @__PURE__ */ r.jsx(On, { children: /* @__PURE__ */ r.jsx(be, { blocks: Ke(e, (t) => K(t._parent)) }) }) });
1338
- }, Ir = (e, t) => e.querySelector(`[data-style-id="${t}"]`), Er = () => {
1339
- const [e] = F(jn), [t] = Ze(), [n] = Ce(), [, i] = W(), l = Cn(), [, o] = G(), d = De(null), s = De(null), [u, c] = U({ width: 0, height: 0 }), f = Vn(u), [h, w] = U(0), [S, P] = U([]), [, x] = U([]), [, E] = F(Tn), [D, A] = V(), k = Sn("loadingCanvas", !1);
1340
- _(() => {
1341
- const { clientWidth: B, clientHeight: H } = s.current;
1342
- c({ width: B, height: H }), h === 0 && w(B);
1343
- }, [s, n, h]);
1344
- const N = (B, H = 0) => {
1345
- const { top: q } = B.getBoundingClientRect();
1346
- return q + H >= 0 && q - H <= window.innerHeight;
1347
- };
1348
- _(() => {
1349
- var B, H;
1350
- if (l && l.type !== "Multiple" && d.current) {
1351
- const q = ut(d.current.contentDocument, l._id);
1352
- q && (N(q) || (H = (B = d.current) == null ? void 0 : B.contentWindow) == null || H.scrollTo({ top: q.offsetTop, behavior: "smooth" }), P([q]));
1353
- }
1354
- }, [l]), _(() => {
1355
- if (!K(D) && d.current) {
1356
- const B = Ir(
1357
- d.current.contentDocument,
1358
- ae(D).id
1359
- );
1360
- x(B ? [B] : [null]);
1361
- } else
1362
- x([null]);
1363
- }, [D]);
1364
- const $ = jt(() => {
1365
- let B = Xn;
1366
- return e === "offline" && (B = B.replace(
1367
- "https://old.chaibuilder.com/offline/tailwind.cdn.js",
1368
- "/offline/tailwind.cdn.js"
1369
- ), B = B.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), B = B.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), B;
1370
- }, [e]);
1371
- return /* @__PURE__ */ r.jsx(
1372
- "div",
1373
- {
1374
- onClick: () => {
1375
- i([]), A([]);
1376
- },
1377
- onMouseLeave: () => setTimeout(() => o(""), 300),
1378
- className: "relative mx-auto overflow-hidden h-full w-full",
1379
- style: h > 0 && !K(f) ? { width: t ? "100%" : h } : {},
1380
- ref: s,
1381
- children: /* @__PURE__ */ r.jsxs(
1382
- or,
1383
- {
1384
- contentDidMount: () => E(d.current),
1385
- ref: d,
1386
- id: "canvas-iframe",
1387
- style: { width: `${n}px`, ...f },
1388
- className: "relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",
1389
- initialContent: $,
1390
- children: [
1391
- /* @__PURE__ */ r.jsx(yr, {}),
1392
- /* @__PURE__ */ r.jsx(
1393
- xr,
1394
- {
1395
- block: l,
1396
- selectedBlockElement: ae(S)
1397
- }
1398
- ),
1399
- /* @__PURE__ */ r.jsx(br, { model: "page" }),
1400
- /* @__PURE__ */ r.jsx(mr, { children: k ? /* @__PURE__ */ r.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ r.jsx(et, { className: "h-full" }) }) : /* @__PURE__ */ r.jsx(Sr, {}) }),
1401
- /* @__PURE__ */ r.jsx("br", {}),
1402
- /* @__PURE__ */ r.jsx("div", { id: "placeholder", className: "absolute bg-green-500 z-[99999] max-w-full transition-transform" })
1403
- ]
1404
- }
1405
- )
1406
- }
1407
- );
1408
- }, Dr = Ct(() => import("./AddBlocks-FsdsASNp.js")), Ps = () => {
1409
- const [e, t] = F(In);
1410
- return /* @__PURE__ */ r.jsxs("div", { className: "flex h-full w-full flex-col", children: [
1411
- /* @__PURE__ */ r.jsx(Jn, {}),
1412
- /* @__PURE__ */ r.jsxs("div", { className: "relative h-full overflow-hidden bg-slate-800/90 px-2 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px]", children: [
1413
- /* @__PURE__ */ r.jsx(ze, { fallback: /* @__PURE__ */ r.jsx(et, { className: "h-full" }), children: /* @__PURE__ */ r.jsx(An, { children: /* @__PURE__ */ r.jsx(Er, {}) }) }),
1414
- e ? /* @__PURE__ */ r.jsx(
1415
- "div",
1416
- {
1417
- onClick: () => t(!1),
1418
- className: "absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",
1419
- children: /* @__PURE__ */ r.jsx(
1420
- "div",
1421
- {
1422
- onClick: (n) => n.stopPropagation(),
1423
- className: "mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",
1424
- children: /* @__PURE__ */ r.jsx(Dr, {})
1425
- }
1426
- )
1427
- }
1428
- ) : null
1429
- ] })
1430
- ] });
1431
- };
1432
- export {
1433
- Ps as default
1434
- };