@chaibuilder/sdk 1.2.57 → 1.2.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CanvasArea-7nhpzTI-.cjs +59 -0
- package/dist/{CanvasArea-8f_Ki3B7.js → CanvasArea-kMGTLtCw.js} +386 -371
- package/dist/{CurrentPage-nzo4lszx.js → CurrentPage-VksVpchp.js} +2 -2
- package/dist/{CurrentPage-7aEIhzQ0.cjs → CurrentPage-caSpOhR9.cjs} +1 -1
- package/dist/{ListTree-KUGhFsb_.js → ListTree-0iy8aBgI.js} +74 -53
- package/dist/{ListTree-A-097CZ-.cjs → ListTree-Njsk1AzL.cjs} +1 -1
- package/dist/{PagesPanel-hleqqZBo.js → PagesPanel-2AEsdqhe.js} +3 -3
- package/dist/{PagesPanel-L1mI3y_6.cjs → PagesPanel-tb0qtxz4.cjs} +1 -1
- package/dist/{ProjectPanel-RXEhYr0a.js → ProjectPanel-IHFBvE5H.js} +3 -3
- package/dist/{ProjectPanel-HTxa1kHv.cjs → ProjectPanel-gmBUq2NI.cjs} +1 -1
- package/dist/{Settings-b1ZuIn4y.js → Settings-r9IvIq0G.js} +2 -2
- package/dist/Settings-uVLt1oiz.cjs +1 -0
- package/dist/{SidePanels-6hZeCR5Z.js → SidePanels-2fD5UfH5.js} +3 -3
- package/dist/{SidePanels-_6WlMWq_.cjs → SidePanels-rhTLiLy6.cjs} +1 -1
- package/dist/{Topbar-WdGZIIZp.cjs → Topbar-1JTIu0uN.cjs} +1 -1
- package/dist/{Topbar-YfsC1DZ2.js → Topbar-x4gslZ4T.js} +1 -1
- package/dist/UILibrariesPanel-CaGLzB9c.cjs +1 -0
- package/dist/UILibrariesPanel-raxCToMd.js +216 -0
- package/dist/{add-page-modal-DA5P4pVu.cjs → add-page-modal-9e6JkoxV.cjs} +1 -1
- package/dist/{add-page-modal-CtMwNEsW.js → add-page-modal-DbmbwG7V.js} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-AvUZI9Tk.cjs → delete-page-modal-YtRcj7eK.cjs} +1 -1
- package/dist/{delete-page-modal-TMpN1Dvm.js → delete-page-modal-nIBA3zCg.js} +2 -2
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{index-sspgZwTk.cjs → index-5IJnVFyU.cjs} +1 -1
- package/dist/{index-zaKhyTQ6.cjs → index-7zSzDmAA.cjs} +1 -1
- package/dist/{index--hN9ZQsP.js → index-b4Wjumon.js} +2 -2
- package/dist/{index-IgLSTkN6.js → index-grcmKbfu.js} +1 -1
- package/dist/mockServiceWorker.js +18 -10
- package/dist/{page-viewer-2BMSxxfd.cjs → page-viewer-JySaivSD.cjs} +1 -1
- package/dist/{page-viewer-D8nsi13f.js → page-viewer-QxHe6m6V.js} +3 -3
- package/dist/{project-general-setting--0hX9Otn.cjs → project-general-setting-FqXwffxC.cjs} +1 -1
- package/dist/{project-general-setting-HGjTNFRx.js → project-general-setting-nSzmnyIU.js} +2 -2
- package/dist/{single-page-detail-7BpYAyMO.cjs → single-page-detail-F5J53NCW.cjs} +1 -1
- package/dist/{single-page-detail-eMnjt_Ih.js → single-page-detail-uSK1ExCH.js} +3 -3
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/package.json +1 -1
- package/dist/CanvasArea-UisRL54b.cjs +0 -56
- package/dist/Settings-7EMwx6zL.cjs +0 -1
- package/dist/UILibrariesPanel-5QxxXYg2.js +0 -191
- package/dist/UILibrariesPanel-r8nQzXQ-.cjs +0 -1
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
+
import { noop as S, has as y, first as p, isEmpty as I, get as B, values as P, groupBy as D, map as U, capitalize as _ } from "lodash-es";
|
|
3
|
+
import * as R from "react";
|
|
4
|
+
import L, { useState as T, useCallback as z, useEffect as G, useRef as O } from "react";
|
|
5
|
+
import { b8 as H, b9 as M, B as F, ba as J, bb as W, bc as $, bd as K, be as Y, bf as q, bg as Q, h as N, a2 as V, r as X, ad as Z, aF as ee, aG as te, aH as se, o as oe, aJ as re, S as ae, br as ne } from "./index-uLn8W3eR.js";
|
|
6
|
+
import { syncBlocksWithDefaults as ie, useChaiBlocks as le } from "@chaibuilder/runtime";
|
|
7
|
+
import { Loader as ce } from "lucide-react";
|
|
8
|
+
import { useAtom as j, atom as de } from "jotai";
|
|
9
|
+
import { c as A } from "./Functions-7jnEwJyw.js";
|
|
10
|
+
import { CaretSortIcon as me, CheckIcon as ue, CaretRightIcon as pe } from "@radix-ui/react-icons";
|
|
11
|
+
import { O as xe } from "./MODIFIERS-fd5XOmum.js";
|
|
12
|
+
import { useTranslation as E } from "react-i18next";
|
|
13
|
+
import { useFeature as fe } from "flagged";
|
|
14
|
+
import { d as he } from "./atoms-ZOWyNoiC.js";
|
|
15
|
+
import ge from "clsx";
|
|
16
|
+
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
17
|
+
import "@radix-ui/react-toggle";
|
|
18
|
+
import "class-variance-authority";
|
|
19
|
+
import "./utils-VpVqnC9m.js";
|
|
20
|
+
import "tailwind-merge";
|
|
21
|
+
import "@radix-ui/react-switch";
|
|
22
|
+
import "@radix-ui/react-slot";
|
|
23
|
+
import "@radix-ui/react-accordion";
|
|
24
|
+
import "@radix-ui/react-alert-dialog";
|
|
25
|
+
import "@radix-ui/react-dialog";
|
|
26
|
+
import "@radix-ui/react-label";
|
|
27
|
+
import "@radix-ui/react-scroll-area";
|
|
28
|
+
import "@radix-ui/react-tabs";
|
|
29
|
+
import "@radix-ui/react-tooltip";
|
|
30
|
+
import "@radix-ui/react-popover";
|
|
31
|
+
import "@radix-ui/react-menubar";
|
|
32
|
+
import "@radix-ui/react-hover-card";
|
|
33
|
+
import "@radix-ui/react-select";
|
|
34
|
+
import "@radix-ui/react-dropdown-menu";
|
|
35
|
+
import "@radix-ui/react-separator";
|
|
36
|
+
import "@radix-ui/react-toast";
|
|
37
|
+
import "cmdk";
|
|
38
|
+
import "@radix-ui/react-context-menu";
|
|
39
|
+
import "react-icons-picker";
|
|
40
|
+
import "react-dom";
|
|
41
|
+
import "react-quill";
|
|
42
|
+
import "@react-hookz/web";
|
|
43
|
+
import "tree-model";
|
|
44
|
+
function je({
|
|
45
|
+
uiLibraries: t,
|
|
46
|
+
library: n,
|
|
47
|
+
setLibrary: i
|
|
48
|
+
}) {
|
|
49
|
+
var m;
|
|
50
|
+
const [d, l] = R.useState(!1), { t: s } = E();
|
|
51
|
+
return n ? /* @__PURE__ */ e.jsxs(H, { open: d, onOpenChange: l, children: [
|
|
52
|
+
/* @__PURE__ */ e.jsx(M, { asChild: !0, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
53
|
+
/* @__PURE__ */ e.jsx("span", { children: s("Choose Library") }),
|
|
54
|
+
/* @__PURE__ */ e.jsxs(
|
|
55
|
+
F,
|
|
56
|
+
{
|
|
57
|
+
variant: "outline",
|
|
58
|
+
size: "sm",
|
|
59
|
+
role: "combobox",
|
|
60
|
+
"aria-expanded": d,
|
|
61
|
+
className: "w-[200px] justify-between",
|
|
62
|
+
children: [
|
|
63
|
+
n ? (m = t.find((a) => a.uuid === n)) == null ? void 0 : m.name : s("Select library"),
|
|
64
|
+
/* @__PURE__ */ e.jsx(me, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }) }),
|
|
69
|
+
/* @__PURE__ */ e.jsx(J, { className: "w-[200px] p-0", children: /* @__PURE__ */ e.jsxs(W, { children: [
|
|
70
|
+
/* @__PURE__ */ e.jsx($, { placeholder: "Search library...", className: "h-9" }),
|
|
71
|
+
/* @__PURE__ */ e.jsxs(K, { children: [
|
|
72
|
+
/* @__PURE__ */ e.jsx(Y, { children: "No library found." }),
|
|
73
|
+
/* @__PURE__ */ e.jsx(q, { children: t.map((a) => /* @__PURE__ */ e.jsxs(
|
|
74
|
+
Q,
|
|
75
|
+
{
|
|
76
|
+
value: a.uuid,
|
|
77
|
+
onSelect: (u) => {
|
|
78
|
+
i(u), l(!1);
|
|
79
|
+
},
|
|
80
|
+
children: [
|
|
81
|
+
a.name,
|
|
82
|
+
/* @__PURE__ */ e.jsx(
|
|
83
|
+
ue,
|
|
84
|
+
{
|
|
85
|
+
className: A("ml-auto h-4 w-4", n === a.uuid ? "opacity-100" : "opacity-0")
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
a.uuid
|
|
91
|
+
)) })
|
|
92
|
+
] })
|
|
93
|
+
] }) })
|
|
94
|
+
] }) : null;
|
|
95
|
+
}
|
|
96
|
+
const be = ({
|
|
97
|
+
block: t,
|
|
98
|
+
closePopover: n,
|
|
99
|
+
library: i
|
|
100
|
+
}) => {
|
|
101
|
+
const [d, l] = T(!1), s = N("getUILibraryBlock", S), { addCoreBlock: m, addPredefinedBlock: a } = V(), [u, f] = X(), [, h] = Z(), [, b] = j(he), k = fe("dnd"), g = (o) => {
|
|
102
|
+
const r = y(o, "styles_attrs.data-page-section");
|
|
103
|
+
return o._type === "Box" && r;
|
|
104
|
+
}, c = z(
|
|
105
|
+
async (o) => {
|
|
106
|
+
if (o.stopPropagation(), y(t, "component")) {
|
|
107
|
+
m(t, p(u)), n();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
l(!0);
|
|
111
|
+
const r = await s(i, t);
|
|
112
|
+
let x = p(u);
|
|
113
|
+
g(p(r)) && (x = null), I(r) || a(ie(r), x), n();
|
|
114
|
+
},
|
|
115
|
+
[t]
|
|
116
|
+
), w = async (o) => {
|
|
117
|
+
const r = await s(i, t);
|
|
118
|
+
let x = p(u);
|
|
119
|
+
if (g(p(r)) && (x = null), !I(r)) {
|
|
120
|
+
const C = { blocks: r, uiLibrary: !0, parent: x };
|
|
121
|
+
if (o.dataTransfer.setData("text/plain", JSON.stringify(C)), t.preview) {
|
|
122
|
+
const v = new Image();
|
|
123
|
+
v.src = t.preview, v.onload = () => {
|
|
124
|
+
o.dataTransfer.setDragImage(v, 0, 0);
|
|
125
|
+
};
|
|
126
|
+
} else
|
|
127
|
+
o.dataTransfer.setDragImage(new Image(), 0, 0);
|
|
128
|
+
b(C), setTimeout(() => {
|
|
129
|
+
f([]), h(null), n();
|
|
130
|
+
}, 200);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
return /* @__PURE__ */ e.jsxs(ee, { children: [
|
|
134
|
+
/* @__PURE__ */ e.jsx(te, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
onClick: d ? () => {
|
|
138
|
+
} : c,
|
|
139
|
+
draggable: !0,
|
|
140
|
+
onDragStart: w,
|
|
141
|
+
className: ge(
|
|
142
|
+
"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-gray-300 bg-white duration-200 hover:border-blue-500 hover:shadow-xl",
|
|
143
|
+
k ? "cursor-grab" : "cursor-pointer"
|
|
144
|
+
),
|
|
145
|
+
children: [
|
|
146
|
+
d && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black/70", children: [
|
|
147
|
+
/* @__PURE__ */ e.jsx(ce, { className: "animate-spin", size: 15, color: "white" }),
|
|
148
|
+
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
149
|
+
] }),
|
|
150
|
+
t.preview ? /* @__PURE__ */ e.jsx("img", { src: t.preview, className: "min-h-[25px] w-full rounded-md", alt: t.name }) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: t.name }) })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
) }),
|
|
154
|
+
/* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("p", { children: t.name }) })
|
|
155
|
+
] });
|
|
156
|
+
}, ke = de({}), we = (t) => {
|
|
157
|
+
const [n, i] = j(ke), d = N("getUILibraryBlocks", S), l = B(n, `${t == null ? void 0 : t.uuid}.blocks`, []), s = B(n, `${t == null ? void 0 : t.uuid}.loading`, !1);
|
|
158
|
+
return G(() => {
|
|
159
|
+
(async () => {
|
|
160
|
+
if (s || l.length > 0)
|
|
161
|
+
return;
|
|
162
|
+
i((a) => ({ ...a, [t == null ? void 0 : t.uuid]: { loading: !0, blocks: [] } }));
|
|
163
|
+
const m = await d(t);
|
|
164
|
+
i((a) => ({ ...a, [t == null ? void 0 : t.uuid]: { loading: !1, blocks: m || [] } }));
|
|
165
|
+
})();
|
|
166
|
+
}, [t, l, s]), { data: l, isLoading: s };
|
|
167
|
+
}, ve = oe("_selectedLibrary", null), Be = () => {
|
|
168
|
+
const [t, n] = j(ve), i = N("uiLibraries", []), d = le(), l = P(d).filter((o) => o.category === "custom"), s = i.find((o) => o.uuid === t) || p(i), { data: m, isLoading: a } = we(s), u = D([...m, ...l], "group"), [f, h] = T("Hero"), [, b] = j(re), k = B(u, f, []), { t: g } = E(), c = O(null), w = (o) => {
|
|
169
|
+
c.current && (clearTimeout(c.current), c.current = null), c.current = setTimeout(() => {
|
|
170
|
+
c.current && h(o);
|
|
171
|
+
}, 300);
|
|
172
|
+
};
|
|
173
|
+
return a ? /* @__PURE__ */ e.jsx(ae, { className: "h-full w-full" }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full w-[460px] flex-col overflow-hidden bg-background", children: [
|
|
174
|
+
s != null && s.uuid ? /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex h-fit flex-col", children: /* @__PURE__ */ e.jsx("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: /* @__PURE__ */ e.jsx("h1", { className: "flex w-full flex-col items-baseline truncate px-1 text-sm font-semibold xl:flex-col", children: /* @__PURE__ */ e.jsx(je, { library: s == null ? void 0 : s.uuid, setLibrary: n, uiLibraries: i }) }) }) }) : null,
|
|
175
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex h-[95%] border-t border-gray-300 pt-2", children: [
|
|
176
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex h-full w-40 flex-col gap-1 px-1", children: L.Children.toArray(
|
|
177
|
+
U(u, (o, r) => /* @__PURE__ */ e.jsxs(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
onMouseEnter: () => w(r),
|
|
181
|
+
onMouseLeave: () => clearTimeout(c.current),
|
|
182
|
+
onClick: () => h(r),
|
|
183
|
+
className: A(
|
|
184
|
+
"flex w-full cursor-pointer items-center justify-between rounded-md p-1 text-sm transition-all ease-in-out hover:bg-gray-200",
|
|
185
|
+
r === f ? "bg-blue-500 text-white hover:bg-blue-600" : ""
|
|
186
|
+
),
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ e.jsx("span", { children: _(r) }),
|
|
189
|
+
/* @__PURE__ */ e.jsx(pe, { className: "ml-2 h-5 w-5" })
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
r
|
|
193
|
+
))
|
|
194
|
+
) }),
|
|
195
|
+
/* @__PURE__ */ e.jsxs(
|
|
196
|
+
ne,
|
|
197
|
+
{
|
|
198
|
+
onMouseEnter: () => c.current ? clearTimeout(c.current) : null,
|
|
199
|
+
className: "z-10 -mt-2 flex h-full max-h-full w-[300px] flex-col gap-2 border-l border-gray-300 transition-all ease-linear",
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ e.jsx("div", { className: "sticky top-0 z-30 border-b border-gray-300 bg-gray-200 p-2 text-[9px] font-light leading-3 text-gray-500", children: g("Click on a block to add it to the page") }),
|
|
202
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2 px-2", children: L.Children.toArray(
|
|
203
|
+
k.map((o) => /* @__PURE__ */ e.jsx(be, { block: o, library: s, closePopover: () => b(xe) }))
|
|
204
|
+
) }),
|
|
205
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
206
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
207
|
+
/* @__PURE__ */ e.jsx("br", {})
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
] })
|
|
212
|
+
] }) });
|
|
213
|
+
}, ut = () => /* @__PURE__ */ e.jsx(Be, {});
|
|
214
|
+
export {
|
|
215
|
+
ut as default
|
|
216
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),x=require("react"),P=require("lodash-es"),t=require("./index-0FIxW0gR.cjs"),g=require("./controls-rRZhz0vu.cjs"),R=require("./form-G3PqS2Gc.cjs"),f=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),x=require("react"),P=require("lodash-es"),t=require("./index-0FIxW0gR.cjs"),g=require("./controls-rRZhz0vu.cjs"),R=require("./form-G3PqS2Gc.cjs"),f=require("./index-7zSzDmAA.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("react-i18next");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./index-5IJnVFyU.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");require("sonner");require("./html-to-json-ndxaXRT8.cjs");require("himalaya");require("lodash");const b=({closeModal:i})=>{var l,o;const u=f.useAddPage(),[r,m]=x.useState({name:"",slug:"",blocks:[],type:"STATIC",seoData:{},template:""}),p=()=>{u.mutate(r,{onSuccess:()=>i()})},j=({formData:n},s)=>{m(q=>{var d,c;const a={[s]:n[s]};return s==="name"?a.slug=P.kebabCase((d=n[s])==null?void 0:d.replace(/\d/g,"")):s==="slug"&&(a.slug=(c=n[s])==null?void 0:c.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_")),{...q,...a}})},h={name:g.g({title:"Page Name",default:r.name}),slug:g.g({title:"Page Slug",default:r.slug})};return e.jsxRuntimeExports.jsxs(t.DialogContent,{children:[e.jsxRuntimeExports.jsx("div",{className:"px-1 font-bold",children:"Add Page"}),e.jsxRuntimeExports.jsx(R.Form,{formData:r,properties:h,onChange:j,disabled:u.isPending}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-end",children:e.jsxRuntimeExports.jsx(t.Button,{type:"submit",disabled:!r.name||!r.slug||((l=r.name)==null?void 0:l.length)<2||((o=r.slug)==null?void 0:o.length)<2||u.isPending,onClick:p,children:"Add Page"})})]})},E=()=>{const[i,u]=x.useState(!1);return e.jsxRuntimeExports.jsxs(t.Dialog,{open:i,onOpenChange:()=>u(!i),children:[e.jsxRuntimeExports.jsx(t.DialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"link",className:"text-blue-500",onClick:()=>u(!i),children:"+ New Page"})}),i&&e.jsxRuntimeExports.jsx(b,{closeModal:()=>u(!i)})]})};exports.default=E;
|
|
@@ -4,7 +4,7 @@ import { kebabCase as j } from "lodash-es";
|
|
|
4
4
|
import { av as C, B as u, au as b, aE as A } from "./index-uLn8W3eR.js";
|
|
5
5
|
import { g } from "./controls-yjgoZzB6.js";
|
|
6
6
|
import { F as D } from "./form-MSL4CDff.js";
|
|
7
|
-
import { e as N } from "./index
|
|
7
|
+
import { e as N } from "./index-b4Wjumon.js";
|
|
8
8
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
10
10
|
import "class-variance-authority";
|
|
@@ -42,7 +42,7 @@ import "tree-model";
|
|
|
42
42
|
import "react-i18next";
|
|
43
43
|
import "@rjsf/core";
|
|
44
44
|
import "@rjsf/validator-ajv8";
|
|
45
|
-
import "./index-
|
|
45
|
+
import "./index-grcmKbfu.js";
|
|
46
46
|
import "i18next";
|
|
47
47
|
import "@floating-ui/react-dom";
|
|
48
48
|
import "flagged";
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-5IJnVFyU.cjs"),e=require("./index-0FIxW0gR.cjs"),r=require("react-i18next");require("i18next");require("./jsx-runtime-Z_BpKhVy.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("flagged");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@radix-ui/react-icons");require("react-hotkeys-hook");require("@chaibuilder/runtime");require("@react-hookz/web");require("lucide-react");require("./index--mLLy7QQ.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("tree-model");exports.ChaiBuilderEditor=s.ChaiBuilderEditor;exports.useActiveModal=e.useActiveModal;exports.useActivePanel=e.useActivePanel;exports.useAddBlock=e.useAddBlock;exports.useAddBlockParent=e.useAddBlockParent;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAllBlocks=e.useAllBlocks;exports.useBlocksStore=e.useBlocksStore;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useCodeEditor=e.useCodeEditor;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCopyToClipboard=e.useCopyToClipboard;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useGetPageData=e.useGetPageData;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;exports.useReadOnlyMode=e.useReadOnlyMode;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useSavePage=e.useSavePage;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUndoManager=e.useUndoManager;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>r.useTranslation});
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Z } from "./index-
|
|
1
|
+
import { C as Z } from "./index-grcmKbfu.js";
|
|
2
2
|
import { a1 as z, aq as J, a2 as K, ar as N, a3 as V, ap as Y, D as _, X as ss, h as es, u as as, a4 as os, a5 as ts, $ as rs, a6 as is, a7 as ps, a8 as ls, a9 as ms, aa as us, t as ds, ab as cs, ac as Bs, ad as ks, ae as ns, q as Cs, a0 as Ss, s as gs, af as Ps, Q as vs, ai as ys, ah as hs, ag as As, r as Is, ao as Ds, as as Ms, at as Rs, aj as fs, al as Us, ak as bs, v as xs, am as Ts, an as qs } from "./index-uLn8W3eR.js";
|
|
3
3
|
import { useTranslation as Hs } from "react-i18next";
|
|
4
4
|
import "i18next";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("./index-0FIxW0gR.cjs"),l=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("./index-0FIxW0gR.cjs"),l=require("./index-7zSzDmAA.cjs"),q=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("react-i18next");require("./index-5IJnVFyU.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");require("sonner");require("./html-to-json-ndxaXRT8.cjs");require("himalaya");require("lodash");const d=({pageData:i,projectData:t})=>{const n={},u=l.useDeletePage(),s=i.uuid===t.homepage,o=()=>{u.mutate(i,{onSuccess:()=>{n({uuid:t.homepage,slug:"/home"})}})};return e.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{disabled:s,children:e.jsxRuntimeExports.jsx("div",{className:`flex h-full items-center justify-center rounded-md border px-2 py-2 font-medium hover:bg-red-400 hover:text-white ${s?"cursor-not-allowed border-red-200 text-red-200":"cursor-pointer border-red-400 text-red-400"}`,children:e.jsxRuntimeExports.jsx(q.TrashIcon,{})})}),e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(r.AlertDialogTitle,{children:["Are you sure you want to delete ",e.jsxRuntimeExports.jsx("i",{className:"text-red-500",children:i.name})," page?"]}),e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"This action cannot be undone. This will permanently delete your page."}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:u.isPending,children:"Cancel"}),e.jsxRuntimeExports.jsx(r.Button,{variant:"destructive",onClick:o,disabled:u.isPending,children:"Yes, Delete"})]})]})]})};exports.default=d;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import { A as p, a as l, b as n, d, e as a, g as c, B as u } from "./index-uLn8W3eR.js";
|
|
3
|
-
import { h } from "./index
|
|
3
|
+
import { h } from "./index-b4Wjumon.js";
|
|
4
4
|
import { TrashIcon as x } from "@radix-ui/react-icons";
|
|
5
5
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
6
6
|
import "react";
|
|
@@ -38,7 +38,7 @@ import "jotai";
|
|
|
38
38
|
import "@react-hookz/web";
|
|
39
39
|
import "tree-model";
|
|
40
40
|
import "react-i18next";
|
|
41
|
-
import "./index-
|
|
41
|
+
import "./index-grcmKbfu.js";
|
|
42
42
|
import "i18next";
|
|
43
43
|
import "@floating-ui/react-dom";
|
|
44
44
|
import "flagged";
|
package/dist/email.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),q=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),q=require("./index-5IJnVFyU.cjs"),r=require("@radix-ui/react-icons"),o=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("i18next");require("react-i18next");require("./index-0FIxW0gR.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");const n=[{title:"Mobile",content:"Mobile email client",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{}),width:400},{title:"Email Client",content:"Content as seen inside an email client",breakpoint:"sm",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{className:"rotate-90"}),width:700}],s=i=>{const u={...i,filterChaiBlock:t=>o.includes(t.type,"Email/"),importHTMLSupport:!1,dataBindingSupport:!1,breakpoints:n};return e.jsxRuntimeExports.jsx(q.ChaiBuilderEditor,{...u})};exports.ChaiBuilderEmail=s;
|
package/dist/email.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as i } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { C as p } from "./index-
|
|
2
|
+
import { C as p } from "./index-grcmKbfu.js";
|
|
3
3
|
import { MobileIcon as t } from "@radix-ui/react-icons";
|
|
4
4
|
import { includes as e } from "lodash-es";
|
|
5
5
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
@@ -203,4 +203,4 @@ object-assign/index.js:
|
|
|
203
203
|
(c) Sindre Sorhus
|
|
204
204
|
@license MIT
|
|
205
205
|
*)
|
|
206
|
-
*/R();var Jr1=process.env.NODE_ENV!=="production"?Ur1:()=>null;function Yr1(){return new URLSearchParams(window.location.search).has("dnd")}function Xr1(){return new URLSearchParams(window.location.search).has("outline")}const Qr1={dnd:Yr1(),arborist:Xr1()};class XH extends u.Component{constructor(c){super(c),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?c1.jsxRuntimeExports.jsxs("div",{className:"h-full w-full rounded-md bg-red-200 p-4 text-red-500",id:"errorBoundary",children:[c1.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),c1.jsxRuntimeExports.jsx("p",{children:"Please try again later."})]}):this.props.children}}const _r1=()=>{const[t,c]=Y.usePreviewMode(),{t:e}=k9.useTranslation(),a=Y.useBuilderProp("previewComponent",null);return t?c1.jsxRuntimeExports.jsxs("div",{className:ey.cn("fixed inset-0 z-[999] bg-background",t?"block":"hidden"),children:[c1.jsxRuntimeExports.jsxs(Y.Button,{size:"sm",className:"absolute right-0 top-0 m-4 space-x-2",onClick:()=>c(!1),children:[c1.jsxRuntimeExports.jsx(y6.EyeClosedIcon,{}),c1.jsxRuntimeExports.jsx("span",{children:e("Close Preview")})]}),c1.jsxRuntimeExports.jsx("div",{children:a?c1.jsxRuntimeExports.jsx(u.Suspense,{fallback:c1.jsxRuntimeExports.jsx(Y.Skeleton,{className:"h-96 w-full"}),children:u.createElement(a)}):null})]}):null},$r1=()=>{const[t,c]=Y.useSelectedBlockIds(),e=Y.useRemoveBlocks(),a=Y.useDuplicateBlocks(),{undo:r,redo:n}=Y.useUndoManager();c6.useHotkeys("esc",()=>c([]),{},[c]),c6.useHotkeys("ctrl+d,command+d",()=>a(t),{preventDefault:!0},[t,a]),c6.useHotkeys("ctrl+z,command+z",()=>r(),{},[r]),c6.useHotkeys("ctrl+y,command+y",()=>n(),{},[n]),c6.useHotkeys("del, backspace",o=>{o.preventDefault(),e(t)},{},[t,e])},tn1=(t,c)=>{const e=[];let a=a2.find(t,{_id:c}),r=a2.get(a,"_parent","");for(;a2.isString(r)&&!a2.isEmpty(r);)e.push(a==null?void 0:a._parent),a=a2.find(t,{_id:r}),r=a==null?void 0:a._parent;return a2.flatten(e)},cn1=m4.atom([]),en1=()=>{const[t]=Y.useSelectedBlockIds(),c=m4.useAtomValue(Y.presentBlocksAtom),[,e]=m4.useAtom(cn1);u.useEffect(()=>{let a=[];const r=a2.first(t);a2.isString(r)&&(a=[r,...tn1(c,r)]),e(a)},[t,c,e])};const QH=()=>m4.useAtom(Y.chaiExternalDataAtom),an1=()=>u.useMemo(()=>ov.getChaiDataProviders(),[]),rn1=({children:t})=>{const[,c]=QH(),[e]=Y.usePageDataProviders(),a=an1();return u.useEffect(()=>(c({}),a2.each(e,r=>{const n=a2.find(a,{providerKey:r.providerKey});if(n){const o=(n==null?void 0:n.mockFn)||(n==null?void 0:n.dataFn);o&&o(r.args).then(l=>c(i=>({...i,[r.providerKey]:l})))}}),()=>{a2.each(e,r=>{c(n=>(delete n[r.providerKey],n))})}),[a,e,c]),c1.jsxRuntimeExports.jsx(c1.jsxRuntimeExports.Fragment,{children:t})};function nn1(t,c,e){e.push(a2.find(t,{_id:c}));const a=a2.filter(t,{_parent:c});for(const r of a)e.push(..._H(r._id,t));return e}const _H=(t,c)=>{let e=[];return e=a2.flattenDeep([...e,...nn1(c,t,e)]),e},on1=m4.atom(!1),Pa=()=>{const[t,c]=m4.useAtom(on1),[e,a]=u.useState(null),r=Y.useBuilderProp("askAiCallBack",null),n=Y.useStreamMultipleBlocksProps(),o=Y.useUpdateMultipleBlocksProps(),[l]=Y.useBlocksStore();return{askAi:u.useCallback(async(i,h,s,d)=>{if(r){c(!0),a(null);try{const v=i==="content"?a2.cloneDeep(_H(h,l)):[a2.cloneDeep(l.find(f=>f._id===h))];a2.set(v,"0._parent",null);const{blocks:g,error:p}=await r(i,s,v);if(p){a(p);return}i==="styles"?o(g):n(g)}catch(v){a(v)}finally{c(!1),d&&d()}}},[r,c,l,o,n]),loading:t,error:e}};function ln1(t){return T6.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"},child:[]}]})(t)}function in1(t){return T6.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"},child:[]}]})(t)}function $H(t){return T6.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"},child:[]}]})(t)}function sn1(t){return T6.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"},child:[]}]})(t)}function dn1(t){return T6.GenIcon({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V299.6l-94.7 94.7c-8.2 8.2-14 18.5-16.8 29.7l-15 60.1c-2.3 9.4-1.8 19 1.4 27.8H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"},child:[]}]})(t)}const hn1=[{name:"Improve writing",icon:dn1,prompt:"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."},{name:"Replace placeholder content",icon:in1,prompt:"Discard current placeholder content and replace with meaningful relevant content."},{name:"Fix grammar",icon:y6.CheckIcon,prompt:"Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors."},{name:"Make longer",icon:y6.ArrowUpIcon,prompt:"Make all text elements longer."},{name:"Make shorter",icon:y6.ArrowDownIcon,prompt:"Make all text elements shorter."},{name:"Add emojis",icon:e3.SmileIcon,prompt:"Add emojis to text elements if relevant."},{name:"Randomize",icon:e3.ShuffleIcon,prompt:"Randomize all text elements."}];function un1({onClick:t}){const{loading:c}=Pa();return c1.jsxRuntimeExports.jsx("div",{className:c?"pointer-events-none opacity-50":"",children:c1.jsxRuntimeExports.jsx("ul",{className:"space-y-2",children:hn1.map(({name:e,icon:a,subMenus:r,prompt:n})=>r?c1.jsxRuntimeExports.jsxs(Y.DropdownMenu,{children:[c1.jsxRuntimeExports.jsx(Y.DropdownMenuTrigger,{asChild:!0,children:c1.jsxRuntimeExports.jsxs("li",{className:"flex cursor-pointer items-center space-x-2 hover:bg-gray-100",children:[c1.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),c1.jsxRuntimeExports.jsx("span",{children:e})]},e)}),c1.jsxRuntimeExports.jsxs(Y.DropdownMenuContent,{children:[c1.jsxRuntimeExports.jsx(Y.DropdownMenuLabel,{children:"My Account"}),c1.jsxRuntimeExports.jsx(Y.DropdownMenuSeparator,{}),c1.jsxRuntimeExports.jsx(Y.DropdownMenuItem,{children:"Profile"}),c1.jsxRuntimeExports.jsx(Y.DropdownMenuItem,{children:"Billing"}),c1.jsxRuntimeExports.jsx(Y.DropdownMenuItem,{children:"Team"}),c1.jsxRuntimeExports.jsx(Y.DropdownMenuItem,{children:"Subscription"})]})]}):c1.jsxRuntimeExports.jsxs("li",{onClick:()=>t(n),className:"flex cursor-pointer items-center space-x-2 rounded p-1 pl-2 text-sm hover:bg-gray-100",children:[c1.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),c1.jsxRuntimeExports.jsx("span",{children:e})]},e))})})}const vn1=({blockId:t})=>{const{t:c}=k9.useTranslation(),{askAi:e,loading:a,error:r}=Pa(),[n,o]=u.useState(""),l=u.useRef(null);u.useEffect(()=>{var h;(h=l.current)==null||h.focus()},[]);const i=()=>{r||o("")};return t?c1.jsxRuntimeExports.jsxs("div",{className:"mt-4",children:[c1.jsxRuntimeExports.jsxs("h2",{className:"mb-2 text-xs font-semibold leading-none tracking-tight text-gray-500",children:[c("Ask AI")," (GPT-4o mini)"]}),c1.jsxRuntimeExports.jsx(Y.Textarea,{ref:l,value:n,onChange:h=>o(h.target.value),placeholder:c("Ask AI to edit content"),className:"w-full border border-gray-400 focus:border-0",rows:3,onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),e("content",t,n,i))}}),c1.jsxRuntimeExports.jsxs("div",{className:"my-2 flex items-center gap-2",children:[a?null:c1.jsxRuntimeExports.jsx(Y.Button,{disabled:n.trim().length<5||a,onClick:()=>e("content",t,n,i),variant:"default",className:"w-fit",size:"sm",children:a?c1.jsxRuntimeExports.jsxs(c1.jsxRuntimeExports.Fragment,{children:[c1.jsxRuntimeExports.jsx(e3.Loader,{className:"h-5 w-5 animate-spin"}),c("Generating... Please wait")]}):c("Edit with AI")}),a?c1.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[c1.jsxRuntimeExports.jsxs(Y.Skeleton,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[c1.jsxRuntimeExports.jsx($H,{className:"h-4 w-4 animate-spin text-gray-500"}),c1.jsxRuntimeExports.jsx("p",{className:"text-xs",children:c("Generating... Please wait")})]}),c1.jsxRuntimeExports.jsx(Y.Button,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:c("Stop")})]}):null]}),c1.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:r&&c1.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:r.message})}),c1.jsxRuntimeExports.jsx(un1,{onClick:h=>e("content",t,h,i)})]}):c1.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:c1.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[c1.jsxRuntimeExports.jsx(e3.SparklesIcon,{className:"mx-auto text-3xl"}),c1.jsxRuntimeExports.jsx("h1",{children:c("no_block_selected_for_ask_ai")})]})})},gn1=({onOpen:t})=>{const{t:c}=k9.useTranslation(),e=Y.useBuilderProp("aiContext",""),[a,r]=u.useState(e),n=u.useRef(null),o=Y.useBuilderProp("saveAiContextCallback",a2.noop),[l,i]=u.useState(!1),[h,s]=u.useState(null),[d,v]=u.useState(!1),{toast:g}=Y.useToast(),p=u.useRef(null);u.useEffect(()=>{e&&r(e)},[e]);const f=async()=>{try{i(!0),s(null),await o(a),g({title:c("AI Context updated"),description:c("You can now ask AI to edit your content"),variant:"default"}),p.current.click()}catch(m){s(m)}finally{i(!1)}};return c1.jsxRuntimeExports.jsx(Y.Accordion,{onValueChange:m=>{t(m!==""),v(m!=="")},type:"single",collapsible:!0,className:"rounded-md border bg-gray-100 px-2",children:c1.jsxRuntimeExports.jsxs(Y.AccordionItem,{value:"set-context",children:[c1.jsxRuntimeExports.jsx(Y.AccordionTrigger,{ref:p,hideArrow:!0,className:"py-1 hover:no-underline",children:c1.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-between",children:[c1.jsxRuntimeExports.jsx("span",{className:"font-semibold",children:c("AI Context")}),c1.jsxRuntimeExports.jsxs(Y.Button,{variant:"default",size:"sm",children:[c1.jsxRuntimeExports.jsx("span",{children:c(d?"Cancel":"Edit")})," ",d?c1.jsxRuntimeExports.jsx(y6.Cross2Icon,{className:"h-4 w-4"}):c1.jsxRuntimeExports.jsx(e3.EditIcon,{className:"h-4 w-4"})]})]})}),c1.jsxRuntimeExports.jsxs(Y.AccordionContent,{children:[c1.jsxRuntimeExports.jsx(Y.Textarea,{ref:n,value:a,onChange:m=>r(m.target.value),placeholder:c("Tell about this page. Eg: This page is about ..."),className:"w-full border border-gray-400 bg-background focus:border",rows:10,onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),f())}}),e.trim().length===0?c1.jsxRuntimeExports.jsx("p",{className:"mt-2 text-xs text-gray-500",children:c("Eg: This page is about an AI assistant app called Chai Studio. It allows users to create beautiful webpages and edit content with AI.")}):null,c1.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex items-center",children:[c1.jsxRuntimeExports.jsx(Y.Button,{disabled:a.trim().length<5,onClick:()=>f(),variant:"default",className:"w-fit",size:"sm",children:l?c1.jsxRuntimeExports.jsxs(c1.jsxRuntimeExports.Fragment,{children:[c1.jsxRuntimeExports.jsx(e3.Loader,{className:"h-5 w-5 animate-spin"}),c("Generating... Please wait")]}):c("Save")}),e.trim().length>0?c1.jsxRuntimeExports.jsxs(Y.AlertDialog,{children:[c1.jsxRuntimeExports.jsx(Y.AlertDialogTrigger,{asChild:!0,children:c1.jsxRuntimeExports.jsx(Y.Button,{disabled:e.trim().length===0,variant:"ghost",className:"w-fit",size:"sm",children:l?c1.jsxRuntimeExports.jsxs(c1.jsxRuntimeExports.Fragment,{children:[c1.jsxRuntimeExports.jsx(e3.Loader,{className:"h-5 w-5 animate-spin"}),c("Generating... Please wait")]}):c("Delete")})}),c1.jsxRuntimeExports.jsxs(Y.AlertDialogContent,{children:[c1.jsxRuntimeExports.jsxs(Y.AlertDialogHeader,{children:[c1.jsxRuntimeExports.jsx(Y.AlertDialogTitle,{children:c("Remove context?")}),c1.jsxRuntimeExports.jsx(Y.AlertDialogDescription,{})]}),c1.jsxRuntimeExports.jsxs(Y.AlertDialogFooter,{children:[c1.jsxRuntimeExports.jsx(Y.AlertDialogCancel,{children:c("Cancel")}),c1.jsxRuntimeExports.jsx(Y.AlertDialogAction,{onClick:()=>{r(""),f()},children:"Yes, Delete"})]})]})]}):null]}),c1.jsxRuntimeExports.jsx("div",{className:"mt-2 max-w-full",children:h&&c1.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:h.message})})]})]})})},fn1=()=>{const[t]=Y.useSelectedBlockIds(),[c,e]=u.useState(!1);return c1.jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 z-50 h-full w-full bg-background p-2",children:[c1.jsxRuntimeExports.jsx(gn1,{onOpen:a=>e(a)}),c?null:c1.jsxRuntimeExports.jsx(vn1,{blockId:a2.first(t)})]})},pn1=u.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-_6WlMWq_.cjs"))),mn1=u.lazy(()=>Promise.resolve().then(()=>require("./Topbar-WdGZIIZp.cjs"))),zn1=u.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-UisRL54b.cjs"))),Mn1=u.lazy(()=>Promise.resolve().then(()=>require("./Settings-7EMwx6zL.cjs"))),bn1=()=>{const{savePage:t}=Y.useSavePage(),c=Y.useBuilderProp("autoSaveSupport",!0),e=Y.useBuilderProp("autoSaveInterval",60);ay.useIntervalEffect(()=>{c&&t()},e*1e3)},Cn1=()=>{const[t]=m4.useAtom(Y.builderSaveStateAtom),[c]=m4.useAtom(Y.aiAssistantActiveAtom),e=n=>{Y.isDevelopment()||n.preventDefault()};$r1(),en1(),bn1(),u.useEffect(()=>(t!=="SAVED"?window.onbeforeunload=()=>"":window.onbeforeunload=null,()=>{window.onbeforeunload=null}),[t]);const a=Y.useBuilderProp("editable",!0),r=Y.useBuilderProp("nonEditableComponent",null);return c1.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-background text-foreground",children:c1.jsxRuntimeExports.jsxs(Y.TooltipProvider,{children:[c1.jsxRuntimeExports.jsxs("div",{onContextMenu:e,className:"flex h-screen flex-col overflow-hidden bg-background text-foreground",children:[c1.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:c1.jsxRuntimeExports.jsx(u.Suspense,{children:c1.jsxRuntimeExports.jsx(mn1,{})})}),c1.jsxRuntimeExports.jsxs("main",{className:"relative flex h-full flex-1 flex-row",children:[a?null:c1.jsxRuntimeExports.jsx("div",{className:"absolute inset-0 z-[500] flex h-full w-full items-center justify-center backdrop-blur-[2px]",children:c1.jsxRuntimeExports.jsx(u.Suspense,{children:u.createElement(r)})}),c1.jsxRuntimeExports.jsx("div",{className:"flex h-full max-h-full w-fit border-border",style:{maxHeight:"calc(100vh - 56px)"},children:c1.jsxRuntimeExports.jsx(u.Suspense,{children:c1.jsxRuntimeExports.jsx(pn1,{})})}),c1.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:c1.jsxRuntimeExports.jsx(u.Suspense,{children:c1.jsxRuntimeExports.jsx(zn1,{})})}),c1.jsxRuntimeExports.jsxs("div",{className:"relative flex h-[100%] w-[280px] min-w-[280px] border-l border-border pb-10",children:[c1.jsxRuntimeExports.jsx(u.Suspense,{children:c1.jsxRuntimeExports.jsx(Mn1,{})}),c?c1.jsxRuntimeExports.jsx(fn1,{}):null]})]})]}),c1.jsxRuntimeExports.jsx(_r1,{})]})})},ev=m4.getDefaultStore(),wn1=()=>c1.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen bg-gray-900 py-12 sm:py-16 lg:py-20 xl:hidden",children:c1.jsxRuntimeExports.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:c1.jsxRuntimeExports.jsxs("div",{className:"mx-auto max-w-md text-center",children:[c1.jsxRuntimeExports.jsx("img",{src:"https://fldwljgzcktqnysdkxnn.supabase.co/storage/v1/object/public/chaibuilder-blob-storage/175ac8d8-37fe-4707-bb4a-3c0cd6a6db75/gVH7O-Ir_400x400.png",alt:"Chai Builder",className:"mx-auto w-14 rounded-full"}),c1.jsxRuntimeExports.jsx("br",{}),c1.jsxRuntimeExports.jsx("h2",{className:"text-4xl font-bold text-white",children:"Screen too small"}),c1.jsxRuntimeExports.jsx("p",{className:"mt-6 text-sm font-medium leading-6 text-white text-opacity-70",children:"Please view this page on greater than 1280px screen width."})]})})});let Vn1=!1;const Hn1=t=>{Vn1=t};const yn1=t=>{const[,c]=Y.useBlocksStore(),[,e]=Y.useBrandingOptions(),a=Y.useBuilderReset();return u.useEffect(()=>{ev.set(Y.chaiBuilderPropsAtom,a2.omit(t,["blocks","subPages","brandingOptions","dataProviders"]))},[t]),u.useEffect(()=>{ev.set(Y.dataProvidersAtom,t.dataProviders||[])},[t.dataProviders]),u.useEffect(()=>{c(ov.syncBlocksWithDefaults(t.blocks||[])),a()},[t.blocks]),u.useEffect(()=>{av.changeLanguage(t.locale||"en")},[t.locale]),u.useEffect(()=>{Hn1(t.showDebugLogs)},[t.showDebugLogs]),u.useEffect(()=>{e(t.brandingOptions)},[t.brandingOptions,e]),c1.jsxRuntimeExports.jsx(Cn1,{})},Ln1=t=>{const c=t._flags||{};return c1.jsxRuntimeExports.jsxs(XH,{children:[c1.jsxRuntimeExports.jsxs(cy.FlagsProvider,{features:{...Qr1,...c},children:[c1.jsxRuntimeExports.jsx(Jr1,{}),c1.jsxRuntimeExports.jsx(wn1,{}),c1.jsxRuntimeExports.jsx(yn1,{...t})]}),c1.jsxRuntimeExports.jsx(Y.Toaster,{})]})};exports.BlocksExternalDataProvider=rn1;exports.ChaiBuilderEditor=Ln1;exports.ErrorBoundary=XH;exports.FaCircleCheck=sn1;exports.FaMoon=ln1;exports.FaSpinner=$H;exports.useAskAi=Pa;exports.useChaiExternalData=QH;
|
|
206
|
+
*/R();var Jr1=process.env.NODE_ENV!=="production"?Ur1:()=>null;function Yr1(){return new URLSearchParams(window.location.search).has("dnd")}function Xr1(){return new URLSearchParams(window.location.search).has("outline")}const Qr1={dnd:Yr1(),arborist:Xr1()};class XH extends u.Component{constructor(c){super(c),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?c1.jsxRuntimeExports.jsxs("div",{className:"h-full w-full rounded-md bg-red-200 p-4 text-red-500",id:"errorBoundary",children:[c1.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),c1.jsxRuntimeExports.jsx("p",{children:"Please try again later."})]}):this.props.children}}const _r1=()=>{const[t,c]=Y.usePreviewMode(),{t:e}=k9.useTranslation(),a=Y.useBuilderProp("previewComponent",null);return t?c1.jsxRuntimeExports.jsxs("div",{className:ey.cn("fixed inset-0 z-[999] bg-background",t?"block":"hidden"),children:[c1.jsxRuntimeExports.jsxs(Y.Button,{size:"sm",className:"absolute right-0 top-0 m-4 space-x-2",onClick:()=>c(!1),children:[c1.jsxRuntimeExports.jsx(y6.EyeClosedIcon,{}),c1.jsxRuntimeExports.jsx("span",{children:e("Close Preview")})]}),c1.jsxRuntimeExports.jsx("div",{children:a?c1.jsxRuntimeExports.jsx(u.Suspense,{fallback:c1.jsxRuntimeExports.jsx(Y.Skeleton,{className:"h-96 w-full"}),children:u.createElement(a)}):null})]}):null},$r1=()=>{const[t,c]=Y.useSelectedBlockIds(),e=Y.useRemoveBlocks(),a=Y.useDuplicateBlocks(),{undo:r,redo:n}=Y.useUndoManager();c6.useHotkeys("esc",()=>c([]),{},[c]),c6.useHotkeys("ctrl+d,command+d",()=>a(t),{preventDefault:!0},[t,a]),c6.useHotkeys("ctrl+z,command+z",()=>r(),{},[r]),c6.useHotkeys("ctrl+y,command+y",()=>n(),{},[n]),c6.useHotkeys("del, backspace",o=>{o.preventDefault(),e(t)},{},[t,e])},tn1=(t,c)=>{const e=[];let a=a2.find(t,{_id:c}),r=a2.get(a,"_parent","");for(;a2.isString(r)&&!a2.isEmpty(r);)e.push(a==null?void 0:a._parent),a=a2.find(t,{_id:r}),r=a==null?void 0:a._parent;return a2.flatten(e)},cn1=m4.atom([]),en1=()=>{const[t]=Y.useSelectedBlockIds(),c=m4.useAtomValue(Y.presentBlocksAtom),[,e]=m4.useAtom(cn1);u.useEffect(()=>{let a=[];const r=a2.first(t);a2.isString(r)&&(a=[r,...tn1(c,r)]),e(a)},[t,c,e])};const QH=()=>m4.useAtom(Y.chaiExternalDataAtom),an1=()=>u.useMemo(()=>ov.getChaiDataProviders(),[]),rn1=({children:t})=>{const[,c]=QH(),[e]=Y.usePageDataProviders(),a=an1();return u.useEffect(()=>(c({}),a2.each(e,r=>{const n=a2.find(a,{providerKey:r.providerKey});if(n){const o=(n==null?void 0:n.mockFn)||(n==null?void 0:n.dataFn);o&&o(r.args).then(l=>c(i=>({...i,[r.providerKey]:l})))}}),()=>{a2.each(e,r=>{c(n=>(delete n[r.providerKey],n))})}),[a,e,c]),c1.jsxRuntimeExports.jsx(c1.jsxRuntimeExports.Fragment,{children:t})};function nn1(t,c,e){e.push(a2.find(t,{_id:c}));const a=a2.filter(t,{_parent:c});for(const r of a)e.push(..._H(r._id,t));return e}const _H=(t,c)=>{let e=[];return e=a2.flattenDeep([...e,...nn1(c,t,e)]),e},on1=m4.atom(!1),Pa=()=>{const[t,c]=m4.useAtom(on1),[e,a]=u.useState(null),r=Y.useBuilderProp("askAiCallBack",null),n=Y.useStreamMultipleBlocksProps(),o=Y.useUpdateMultipleBlocksProps(),[l]=Y.useBlocksStore();return{askAi:u.useCallback(async(i,h,s,d)=>{if(r){c(!0),a(null);try{const v=i==="content"?a2.cloneDeep(_H(h,l)):[a2.cloneDeep(l.find(f=>f._id===h))];a2.set(v,"0._parent",null);const{blocks:g,error:p}=await r(i,s,v);if(p){a(p);return}i==="styles"?o(g):n(g)}catch(v){a(v)}finally{c(!1),d&&d()}}},[r,c,l,o,n]),loading:t,error:e}};function ln1(t){return T6.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"},child:[]}]})(t)}function in1(t){return T6.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"},child:[]}]})(t)}function $H(t){return T6.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"},child:[]}]})(t)}function sn1(t){return T6.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"},child:[]}]})(t)}function dn1(t){return T6.GenIcon({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V299.6l-94.7 94.7c-8.2 8.2-14 18.5-16.8 29.7l-15 60.1c-2.3 9.4-1.8 19 1.4 27.8H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"},child:[]}]})(t)}const hn1=[{name:"Improve writing",icon:dn1,prompt:"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."},{name:"Replace placeholder content",icon:in1,prompt:"Discard current placeholder content and replace with meaningful relevant content."},{name:"Fix grammar",icon:y6.CheckIcon,prompt:"Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors."},{name:"Make longer",icon:y6.ArrowUpIcon,prompt:"Make all text elements longer."},{name:"Make shorter",icon:y6.ArrowDownIcon,prompt:"Make all text elements shorter."},{name:"Add emojis",icon:e3.SmileIcon,prompt:"Add emojis to text elements if relevant."},{name:"Randomize",icon:e3.ShuffleIcon,prompt:"Randomize all text elements."}];function un1({onClick:t}){const{loading:c}=Pa();return c1.jsxRuntimeExports.jsx("div",{className:c?"pointer-events-none opacity-50":"",children:c1.jsxRuntimeExports.jsx("ul",{className:"space-y-2",children:hn1.map(({name:e,icon:a,subMenus:r,prompt:n})=>r?c1.jsxRuntimeExports.jsxs(Y.DropdownMenu,{children:[c1.jsxRuntimeExports.jsx(Y.DropdownMenuTrigger,{asChild:!0,children:c1.jsxRuntimeExports.jsxs("li",{className:"flex cursor-pointer items-center space-x-2 hover:bg-gray-100",children:[c1.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),c1.jsxRuntimeExports.jsx("span",{children:e})]},e)}),c1.jsxRuntimeExports.jsxs(Y.DropdownMenuContent,{children:[c1.jsxRuntimeExports.jsx(Y.DropdownMenuLabel,{children:"My Account"}),c1.jsxRuntimeExports.jsx(Y.DropdownMenuSeparator,{}),c1.jsxRuntimeExports.jsx(Y.DropdownMenuItem,{children:"Profile"}),c1.jsxRuntimeExports.jsx(Y.DropdownMenuItem,{children:"Billing"}),c1.jsxRuntimeExports.jsx(Y.DropdownMenuItem,{children:"Team"}),c1.jsxRuntimeExports.jsx(Y.DropdownMenuItem,{children:"Subscription"})]})]}):c1.jsxRuntimeExports.jsxs("li",{onClick:()=>t(n),className:"flex cursor-pointer items-center space-x-2 rounded p-1 pl-2 text-sm hover:bg-gray-100",children:[c1.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),c1.jsxRuntimeExports.jsx("span",{children:e})]},e))})})}const vn1=({blockId:t})=>{const{t:c}=k9.useTranslation(),{askAi:e,loading:a,error:r}=Pa(),[n,o]=u.useState(""),l=u.useRef(null);u.useEffect(()=>{var h;(h=l.current)==null||h.focus()},[]);const i=()=>{r||o("")};return t?c1.jsxRuntimeExports.jsxs("div",{className:"mt-4",children:[c1.jsxRuntimeExports.jsxs("h2",{className:"mb-2 text-xs font-semibold leading-none tracking-tight text-gray-500",children:[c("Ask AI")," (GPT-4o mini)"]}),c1.jsxRuntimeExports.jsx(Y.Textarea,{ref:l,value:n,onChange:h=>o(h.target.value),placeholder:c("Ask AI to edit content"),className:"w-full border border-gray-400 focus:border-0",rows:3,onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),e("content",t,n,i))}}),c1.jsxRuntimeExports.jsxs("div",{className:"my-2 flex items-center gap-2",children:[a?null:c1.jsxRuntimeExports.jsx(Y.Button,{disabled:n.trim().length<5||a,onClick:()=>e("content",t,n,i),variant:"default",className:"w-fit",size:"sm",children:a?c1.jsxRuntimeExports.jsxs(c1.jsxRuntimeExports.Fragment,{children:[c1.jsxRuntimeExports.jsx(e3.Loader,{className:"h-5 w-5 animate-spin"}),c("Generating... Please wait")]}):c("Edit with AI")}),a?c1.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[c1.jsxRuntimeExports.jsxs(Y.Skeleton,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[c1.jsxRuntimeExports.jsx($H,{className:"h-4 w-4 animate-spin text-gray-500"}),c1.jsxRuntimeExports.jsx("p",{className:"text-xs",children:c("Generating... Please wait")})]}),c1.jsxRuntimeExports.jsx(Y.Button,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:c("Stop")})]}):null]}),c1.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:r&&c1.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:r.message})}),c1.jsxRuntimeExports.jsx(un1,{onClick:h=>e("content",t,h,i)})]}):c1.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:c1.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[c1.jsxRuntimeExports.jsx(e3.SparklesIcon,{className:"mx-auto text-3xl"}),c1.jsxRuntimeExports.jsx("h1",{children:c("no_block_selected_for_ask_ai")})]})})},gn1=({onOpen:t})=>{const{t:c}=k9.useTranslation(),e=Y.useBuilderProp("aiContext",""),[a,r]=u.useState(e),n=u.useRef(null),o=Y.useBuilderProp("saveAiContextCallback",a2.noop),[l,i]=u.useState(!1),[h,s]=u.useState(null),[d,v]=u.useState(!1),{toast:g}=Y.useToast(),p=u.useRef(null);u.useEffect(()=>{e&&r(e)},[e]);const f=async()=>{try{i(!0),s(null),await o(a),g({title:c("AI Context updated"),description:c("You can now ask AI to edit your content"),variant:"default"}),p.current.click()}catch(m){s(m)}finally{i(!1)}};return c1.jsxRuntimeExports.jsx(Y.Accordion,{onValueChange:m=>{t(m!==""),v(m!=="")},type:"single",collapsible:!0,className:"rounded-md border bg-gray-100 px-2",children:c1.jsxRuntimeExports.jsxs(Y.AccordionItem,{value:"set-context",children:[c1.jsxRuntimeExports.jsx(Y.AccordionTrigger,{ref:p,hideArrow:!0,className:"py-1 hover:no-underline",children:c1.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-between",children:[c1.jsxRuntimeExports.jsx("span",{className:"font-semibold",children:c("AI Context")}),c1.jsxRuntimeExports.jsxs(Y.Button,{variant:"default",size:"sm",children:[c1.jsxRuntimeExports.jsx("span",{children:c(d?"Cancel":"Edit")})," ",d?c1.jsxRuntimeExports.jsx(y6.Cross2Icon,{className:"h-4 w-4"}):c1.jsxRuntimeExports.jsx(e3.EditIcon,{className:"h-4 w-4"})]})]})}),c1.jsxRuntimeExports.jsxs(Y.AccordionContent,{children:[c1.jsxRuntimeExports.jsx(Y.Textarea,{ref:n,value:a,onChange:m=>r(m.target.value),placeholder:c("Tell about this page. Eg: This page is about ..."),className:"w-full border border-gray-400 bg-background focus:border",rows:10,onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),f())}}),e.trim().length===0?c1.jsxRuntimeExports.jsx("p",{className:"mt-2 text-xs text-gray-500",children:c("Eg: This page is about an AI assistant app called Chai Studio. It allows users to create beautiful webpages and edit content with AI.")}):null,c1.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex items-center",children:[c1.jsxRuntimeExports.jsx(Y.Button,{disabled:a.trim().length<5,onClick:()=>f(),variant:"default",className:"w-fit",size:"sm",children:l?c1.jsxRuntimeExports.jsxs(c1.jsxRuntimeExports.Fragment,{children:[c1.jsxRuntimeExports.jsx(e3.Loader,{className:"h-5 w-5 animate-spin"}),c("Generating... Please wait")]}):c("Save")}),e.trim().length>0?c1.jsxRuntimeExports.jsxs(Y.AlertDialog,{children:[c1.jsxRuntimeExports.jsx(Y.AlertDialogTrigger,{asChild:!0,children:c1.jsxRuntimeExports.jsx(Y.Button,{disabled:e.trim().length===0,variant:"ghost",className:"w-fit",size:"sm",children:l?c1.jsxRuntimeExports.jsxs(c1.jsxRuntimeExports.Fragment,{children:[c1.jsxRuntimeExports.jsx(e3.Loader,{className:"h-5 w-5 animate-spin"}),c("Generating... Please wait")]}):c("Delete")})}),c1.jsxRuntimeExports.jsxs(Y.AlertDialogContent,{children:[c1.jsxRuntimeExports.jsxs(Y.AlertDialogHeader,{children:[c1.jsxRuntimeExports.jsx(Y.AlertDialogTitle,{children:c("Remove context?")}),c1.jsxRuntimeExports.jsx(Y.AlertDialogDescription,{})]}),c1.jsxRuntimeExports.jsxs(Y.AlertDialogFooter,{children:[c1.jsxRuntimeExports.jsx(Y.AlertDialogCancel,{children:c("Cancel")}),c1.jsxRuntimeExports.jsx(Y.AlertDialogAction,{onClick:()=>{r(""),f()},children:"Yes, Delete"})]})]})]}):null]}),c1.jsxRuntimeExports.jsx("div",{className:"mt-2 max-w-full",children:h&&c1.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:h.message})})]})]})})},fn1=()=>{const[t]=Y.useSelectedBlockIds(),[c,e]=u.useState(!1);return c1.jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 z-50 h-full w-full bg-background p-2",children:[c1.jsxRuntimeExports.jsx(gn1,{onOpen:a=>e(a)}),c?null:c1.jsxRuntimeExports.jsx(vn1,{blockId:a2.first(t)})]})},pn1=u.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-rhTLiLy6.cjs"))),mn1=u.lazy(()=>Promise.resolve().then(()=>require("./Topbar-1JTIu0uN.cjs"))),zn1=u.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-7nhpzTI-.cjs"))),Mn1=u.lazy(()=>Promise.resolve().then(()=>require("./Settings-uVLt1oiz.cjs"))),bn1=()=>{const{savePage:t}=Y.useSavePage(),c=Y.useBuilderProp("autoSaveSupport",!0),e=Y.useBuilderProp("autoSaveInterval",60);ay.useIntervalEffect(()=>{c&&t()},e*1e3)},Cn1=()=>{const[t]=m4.useAtom(Y.builderSaveStateAtom),[c]=m4.useAtom(Y.aiAssistantActiveAtom),e=n=>{Y.isDevelopment()||n.preventDefault()};$r1(),en1(),bn1(),u.useEffect(()=>(t!=="SAVED"?window.onbeforeunload=()=>"":window.onbeforeunload=null,()=>{window.onbeforeunload=null}),[t]);const a=Y.useBuilderProp("editable",!0),r=Y.useBuilderProp("nonEditableComponent",null);return c1.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-background text-foreground",children:c1.jsxRuntimeExports.jsxs(Y.TooltipProvider,{children:[c1.jsxRuntimeExports.jsxs("div",{onContextMenu:e,className:"flex h-screen flex-col overflow-hidden bg-background text-foreground",children:[c1.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:c1.jsxRuntimeExports.jsx(u.Suspense,{children:c1.jsxRuntimeExports.jsx(mn1,{})})}),c1.jsxRuntimeExports.jsxs("main",{className:"relative flex h-full flex-1 flex-row",children:[a?null:c1.jsxRuntimeExports.jsx("div",{className:"absolute inset-0 z-[500] flex h-full w-full items-center justify-center backdrop-blur-[2px]",children:c1.jsxRuntimeExports.jsx(u.Suspense,{children:u.createElement(r)})}),c1.jsxRuntimeExports.jsx("div",{className:"flex h-full max-h-full w-fit border-border",style:{maxHeight:"calc(100vh - 56px)"},children:c1.jsxRuntimeExports.jsx(u.Suspense,{children:c1.jsxRuntimeExports.jsx(pn1,{})})}),c1.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:c1.jsxRuntimeExports.jsx(u.Suspense,{children:c1.jsxRuntimeExports.jsx(zn1,{})})}),c1.jsxRuntimeExports.jsxs("div",{className:"relative flex h-[100%] w-[280px] min-w-[280px] border-l border-border pb-10",children:[c1.jsxRuntimeExports.jsx(u.Suspense,{children:c1.jsxRuntimeExports.jsx(Mn1,{})}),c?c1.jsxRuntimeExports.jsx(fn1,{}):null]})]})]}),c1.jsxRuntimeExports.jsx(_r1,{})]})})},ev=m4.getDefaultStore(),wn1=()=>c1.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen bg-gray-900 py-12 sm:py-16 lg:py-20 xl:hidden",children:c1.jsxRuntimeExports.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:c1.jsxRuntimeExports.jsxs("div",{className:"mx-auto max-w-md text-center",children:[c1.jsxRuntimeExports.jsx("img",{src:"https://fldwljgzcktqnysdkxnn.supabase.co/storage/v1/object/public/chaibuilder-blob-storage/175ac8d8-37fe-4707-bb4a-3c0cd6a6db75/gVH7O-Ir_400x400.png",alt:"Chai Builder",className:"mx-auto w-14 rounded-full"}),c1.jsxRuntimeExports.jsx("br",{}),c1.jsxRuntimeExports.jsx("h2",{className:"text-4xl font-bold text-white",children:"Screen too small"}),c1.jsxRuntimeExports.jsx("p",{className:"mt-6 text-sm font-medium leading-6 text-white text-opacity-70",children:"Please view this page on greater than 1280px screen width."})]})})});let Vn1=!1;const Hn1=t=>{Vn1=t};const yn1=t=>{const[,c]=Y.useBlocksStore(),[,e]=Y.useBrandingOptions(),a=Y.useBuilderReset();return u.useEffect(()=>{ev.set(Y.chaiBuilderPropsAtom,a2.omit(t,["blocks","subPages","brandingOptions","dataProviders"]))},[t]),u.useEffect(()=>{ev.set(Y.dataProvidersAtom,t.dataProviders||[])},[t.dataProviders]),u.useEffect(()=>{c(ov.syncBlocksWithDefaults(t.blocks||[])),a()},[t.blocks]),u.useEffect(()=>{av.changeLanguage(t.locale||"en")},[t.locale]),u.useEffect(()=>{Hn1(t.showDebugLogs)},[t.showDebugLogs]),u.useEffect(()=>{e(t.brandingOptions)},[t.brandingOptions,e]),c1.jsxRuntimeExports.jsx(Cn1,{})},Ln1=t=>{const c=t._flags||{};return c1.jsxRuntimeExports.jsxs(XH,{children:[c1.jsxRuntimeExports.jsxs(cy.FlagsProvider,{features:{...Qr1,...c},children:[c1.jsxRuntimeExports.jsx(Jr1,{}),c1.jsxRuntimeExports.jsx(wn1,{}),c1.jsxRuntimeExports.jsx(yn1,{...t})]}),c1.jsxRuntimeExports.jsx(Y.Toaster,{})]})};exports.BlocksExternalDataProvider=rn1;exports.ChaiBuilderEditor=Ln1;exports.ErrorBoundary=XH;exports.FaCircleCheck=sn1;exports.FaMoon=ln1;exports.FaSpinner=$H;exports.useAskAi=Pa;exports.useChaiExternalData=QH;
|