@chaibuilder/sdk 1.0.22 → 1.0.24

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