@chaibuilder/sdk 1.2.63 → 1.2.64

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 (54) hide show
  1. package/dist/AddBlocks-6dJmFSgk.js +142 -0
  2. package/dist/AddBlocks-doCNVVbk.cjs +1 -0
  3. package/dist/{CanvasArea-DvfLxy0w.js → CanvasArea-kB6ky_uL.js} +4 -4
  4. package/dist/{CanvasArea-hGLbDJlM.cjs → CanvasArea-kdnkFfKR.cjs} +1 -1
  5. package/dist/{CodeEditor-QPwyZNgA.js → CodeEditor-37od44Ou.js} +1 -1
  6. package/dist/{CurrentPage-fMCaBGwl.cjs → CurrentPage-Ekl5Cwbv.cjs} +1 -1
  7. package/dist/{CurrentPage-rOUX01kk.js → CurrentPage-bHq9Uusr.js} +3 -3
  8. package/dist/{PagesPanel-ZCZjs7Bi.cjs → PagesPanel-SMHrEmCb.cjs} +1 -1
  9. package/dist/{PagesPanel-6P4VkMP-.js → PagesPanel-wIPAyjJK.js} +4 -4
  10. package/dist/{ProjectPanel-Cn3teDRW.js → ProjectPanel-L-SlDizV.js} +4 -4
  11. package/dist/{ProjectPanel-XSVWRr6v.cjs → ProjectPanel-YruLal65.cjs} +1 -1
  12. package/dist/{Settings-dbB2VPAj.js → Settings-WXkCyhAv.js} +16 -14
  13. package/dist/{Settings-Amh8Mtm7.cjs → Settings-_5VHcgFC.cjs} +1 -1
  14. package/dist/{SidePanels-_Im6sF4f.js → SidePanels-UQj0XTnb.js} +72 -72
  15. package/dist/{SidePanels-5adH7U3T.cjs → SidePanels-UeIZB3e1.cjs} +1 -1
  16. package/dist/{StaticCanvas-goU42OMU.js → StaticCanvas-7C52tXAv.js} +42 -42
  17. package/dist/{StaticCanvas-fDhBK35X.cjs → StaticCanvas-ll9VTXI5.cjs} +1 -1
  18. package/dist/ThemeConfigPanel-_86vVxLz.cjs +1 -0
  19. package/dist/{ThemeConfigPanel-aEN4tTYi.js → ThemeConfigPanel-gw8B2zvx.js} +59 -56
  20. package/dist/{Topbar-SuY-S0im.js → Topbar-1O05wogM.js} +2 -2
  21. package/dist/{Topbar-ag6qdgbe.cjs → Topbar-gb17oHdJ.cjs} +1 -1
  22. package/dist/{UILibrariesPanel-RI9mo293.js → UILibrariesPanel-vshiYI6G.js} +18 -18
  23. package/dist/{UnsplashImages-dasLGrBn.js → UnsplashImages-Eq7hprBO.js} +5 -5
  24. package/dist/{UploadImages-Gh2AQpk1.js → UploadImages-lco2Tea3.js} +7 -7
  25. package/dist/{add-page-modal-zCiyvKEa.js → add-page-modal-qr7rvJzN.js} +6 -6
  26. package/dist/{add-page-modal-80cVOM7i.cjs → add-page-modal-rOKavDFX.cjs} +1 -1
  27. package/dist/{confirm-alert-9XYi0a4k.js → confirm-alert-P6TAevaP.js} +1 -1
  28. package/dist/core.cjs +1 -1
  29. package/dist/core.d.ts +6 -2
  30. package/dist/core.js +15 -15
  31. package/dist/{delete-page-modal-pzagU_6y.js → delete-page-modal-55oioI9i.js} +3 -3
  32. package/dist/{delete-page-modal-foPRP--l.cjs → delete-page-modal-wdAiMVnL.cjs} +1 -1
  33. package/dist/email.cjs +1 -1
  34. package/dist/email.js +2 -2
  35. package/dist/{form-EjiQiiEY.js → form-5ke_lZv8.js} +1 -1
  36. package/dist/{index-DzAuS11k.cjs → index-6w-6HYBd.cjs} +1 -1
  37. package/dist/{index-BbW1Uw_k.cjs → index-audsIPBC.cjs} +1 -1
  38. package/dist/{index-bscJUvUx.js → index-b33n_-zO.js} +60 -60
  39. package/dist/{index-qSbpzIA4.js → index-fnkMn4Pk.js} +3 -3
  40. package/dist/{index-EEcKvBh3.js → index-wRAIA8zZ.js} +5 -5
  41. package/dist/{page-viewer-Z1wXyzzc.js → page-viewer-t44DP65U.js} +9 -9
  42. package/dist/{page-viewer-XFTCHu_2.cjs → page-viewer-wU7T0f48.cjs} +1 -1
  43. package/dist/{project-general-setting-HV3X_wHI.cjs → project-general-setting-87cX9vvO.cjs} +1 -1
  44. package/dist/{project-general-setting-5B7s5swF.js → project-general-setting-NEkNjf7V.js} +4 -4
  45. package/dist/{project-seo-setting-aAGnwBrw.js → project-seo-setting-YmspOYsF.js} +2 -2
  46. package/dist/{single-page-detail-6C1WP3s5.cjs → single-page-detail-27UjWK8L.cjs} +1 -1
  47. package/dist/{single-page-detail-Yr0EbBJJ.js → single-page-detail-jHzoDP7B.js} +10 -10
  48. package/dist/studio.cjs +1 -1
  49. package/dist/studio.js +3 -3
  50. package/dist/ui.js +10 -10
  51. package/package.json +1 -1
  52. package/dist/AddBlocks-4wpxOF2K.cjs +0 -1
  53. package/dist/AddBlocks-ChNxwRrx.js +0 -142
  54. package/dist/ThemeConfigPanel-N6l317II.cjs +0 -1
@@ -1,14 +1,14 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import { KeyboardIcon as R, PlusIcon as S, Component2Icon as J } from "@radix-ui/react-icons";
3
- import f, { useState as h, useEffect as W, useMemo as Z, memo as $, lazy as v, Suspense as y } from "react";
3
+ import f, { useState as u, useEffect as W, useMemo as Y, memo as $, lazy as j, Suspense as v } from "react";
4
4
  import { useAtom as M } from "jotai";
5
- import { filter as N, map as K, isNull as Y, find as q, isEmpty as X, values as G, each as Q, get as ee } from "lodash-es";
6
- import { aZ as O, a$ as H, aV as U, aW as F, aX as se, A as re, a as ie, b as te, c as le, d as ae, e as oe, f as ne, g as ce, ac as de, a2 as me, ae as xe, bs as he, bt as ue, bu as pe, bv as fe, bw as B, a_ as ve, T as je, v as ge, w as be, bx as E, h as w, bf as ye, B as x, $ as z, bo as Ne, bp as we, bq as L, by as V } from "./index-bscJUvUx.js";
7
- import { ListTreeIcon as A, PaletteIcon as ke, DatabaseIcon as Ce } from "lucide-react";
5
+ import { filter as N, map as K, isNull as Z, find as q, isEmpty as X, values as G, each as Q, get as ee } from "lodash-es";
6
+ import { a_ as O, b0 as H, aW as U, aX as F, aY as se, A as re, a as ie, b as le, c as te, d as ae, e as oe, f as ne, g as ce, ac as de, a2 as me, ae as xe, bs as ue, bt as he, bu as pe, bv as fe, bw as B, a$ as ve, T as je, v as ge, w as be, bx as E, h as w, bf as ye, B as x, $ as z, bo as Ne, bp as we, bq as L, by as I } from "./index-b33n_-zO.js";
7
+ import { ListTreeIcon as _, PaletteIcon as ke, DatabaseIcon as Ce } from "lucide-react";
8
8
  import { getChaiDataProviders as De, useChaiBlocks as Te } from "@chaibuilder/runtime";
9
- import { useTranslation as j } from "react-i18next";
10
- import { J as _e, a as Ae, d as Pe } from "./index-e0c8PmRQ.js";
11
- import { E as Se } from "./index-EEcKvBh3.js";
9
+ import { useTranslation as g } from "react-i18next";
10
+ import { J as Ae, a as _e, d as Pe } from "./index-e0c8PmRQ.js";
11
+ import { E as Se } from "./index-wRAIA8zZ.js";
12
12
  import { O as o } from "./MODIFIERS-fd5XOmum.js";
13
13
  import { c as Ke } from "./Functions-7jnEwJyw.js";
14
14
  import "./_commonjsHelpers-UyOWmZb0.js";
@@ -47,23 +47,23 @@ import "@floating-ui/react-dom";
47
47
  import "flagged";
48
48
  import "react-hotkeys-hook";
49
49
  const Be = ({ provider: s, onClose: a }) => {
50
- const { t } = j(), [l, u] = h(null);
50
+ const { t: l } = g(), [t, h] = u(null);
51
51
  return W(() => {
52
- s && (s.mockFn ? s.mockFn : s.dataFn)().then((c) => u(c));
52
+ s && (s.mockFn ? s.mockFn : s.dataFn)().then((c) => h(c));
53
53
  }, [s]), s ? /* @__PURE__ */ e.jsx(O, { onOpenChange: (d) => d ? "" : a(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
54
54
  /* @__PURE__ */ e.jsxs(U, { children: [
55
55
  /* @__PURE__ */ e.jsxs(F, { children: [
56
- t("data_provider"),
56
+ l("data_provider"),
57
57
  ": ",
58
58
  s.name
59
59
  ] }),
60
60
  /* @__PURE__ */ e.jsx(se, { children: s.description })
61
61
  ] }),
62
62
  /* @__PURE__ */ e.jsx(Se, { children: /* @__PURE__ */ e.jsx(
63
- _e,
63
+ Ae,
64
64
  {
65
- data: l,
66
- shouldExpandNode: Ae,
65
+ data: t,
66
+ shouldExpandNode: _e,
67
67
  style: {
68
68
  ...Pe,
69
69
  container: "max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
@@ -77,40 +77,40 @@ const Be = ({ provider: s, onClose: a }) => {
77
77
  function Ee({
78
78
  children: s,
79
79
  name: a,
80
- onRemove: t
80
+ onRemove: l
81
81
  }) {
82
- const { t: l } = j();
82
+ const { t } = g();
83
83
  return /* @__PURE__ */ e.jsxs(re, { children: [
84
84
  /* @__PURE__ */ e.jsx(ie, { asChild: !0, children: s }),
85
- /* @__PURE__ */ e.jsxs(te, { children: [
86
- /* @__PURE__ */ e.jsxs(le, { children: [
85
+ /* @__PURE__ */ e.jsxs(le, { children: [
86
+ /* @__PURE__ */ e.jsxs(te, { children: [
87
87
  /* @__PURE__ */ e.jsx(
88
88
  ae,
89
89
  {
90
- dangerouslySetInnerHTML: { __html: l("remove_provider_confirmation").replace("{name}", a) }
90
+ dangerouslySetInnerHTML: { __html: t("remove_provider_confirmation").replace("{name}", a) }
91
91
  }
92
92
  ),
93
- /* @__PURE__ */ e.jsx(oe, { children: l("remove_provider_warning") })
93
+ /* @__PURE__ */ e.jsx(oe, { children: t("remove_provider_warning") })
94
94
  ] }),
95
95
  /* @__PURE__ */ e.jsxs(ne, { children: [
96
- /* @__PURE__ */ e.jsx(ce, { children: l("cancel") }),
97
- /* @__PURE__ */ e.jsx(de, { onClick: t, className: "bg-red-600 hover:bg-red-700", children: l("remove") })
96
+ /* @__PURE__ */ e.jsx(ce, { children: t("cancel") }),
97
+ /* @__PURE__ */ e.jsx(de, { onClick: l, className: "bg-red-600 hover:bg-red-700", children: t("remove") })
98
98
  ] })
99
99
  ] })
100
100
  ] });
101
101
  }
102
102
  const ze = () => {
103
- const { t: s } = j(), a = Z(() => De(), []), [t, l] = me(), [, u] = M(xe), [d, c] = h(
104
- N(a, (r) => K(t, "providerKey").includes(r.providerKey))
105
- ), [k, p] = h(""), [C, g] = h(null), D = N(
103
+ const { t: s } = g(), a = Y(() => De(), []), [l, t] = me(), [, h] = M(xe), [d, c] = u(
104
+ N(a, (r) => K(l, "providerKey").includes(r.providerKey))
105
+ ), [k, p] = u(""), [C, b] = u(null), D = N(
106
106
  a.map((r) => K(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
107
- (r) => !Y(r)
107
+ (r) => !Z(r)
108
108
  ), T = (r) => {
109
109
  const m = q(a, { providerKey: r });
110
- c((i) => [...i, m]), l((i) => [...i, { providerKey: m.providerKey, args: {} }]), p(""), u("UNSAVED");
111
- }, b = (r) => {
112
- c((m) => N(m, (i) => i.providerKey !== r.providerKey)), l((m) => N(m, (i) => i.providerKey !== r.providerKey)), u("UNSAVED");
113
- }, n = (r) => g(r);
110
+ c((i) => [...i, m]), t((i) => [...i, { providerKey: m.providerKey, args: {} }]), p(""), h("UNSAVED");
111
+ }, y = (r) => {
112
+ c((m) => N(m, (i) => i.providerKey !== r.providerKey)), t((m) => N(m, (i) => i.providerKey !== r.providerKey)), h("UNSAVED");
113
+ }, n = (r) => b(r);
114
114
  return X(a) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
115
115
  s("no_data_providers"),
116
116
  /* @__PURE__ */ e.jsx("br", {}),
@@ -118,8 +118,8 @@ const ze = () => {
118
118
  ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
119
119
  /* @__PURE__ */ e.jsx("br", {}),
120
120
  /* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: s("add_data_providers") }) }),
121
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(he, { value: k, onValueChange: (r) => T(r), children: [
122
- /* @__PURE__ */ e.jsx(ue, { className: "w-full", children: /* @__PURE__ */ e.jsx(pe, { placeholder: s("select_provider") }) }),
121
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(ue, { value: k, onValueChange: (r) => T(r), children: [
122
+ /* @__PURE__ */ e.jsx(he, { className: "w-full", children: /* @__PURE__ */ e.jsx(pe, { placeholder: s("select_provider") }) }),
123
123
  /* @__PURE__ */ e.jsxs(fe, { children: [
124
124
  /* @__PURE__ */ e.jsx(B, { value: "", children: s("choose") }),
125
125
  D.map((r) => /* @__PURE__ */ e.jsx(B, { value: r.value, children: r.label }, r.value))
@@ -171,7 +171,7 @@ const ze = () => {
171
171
  ]
172
172
  }
173
173
  ),
174
- /* @__PURE__ */ e.jsx(Ee, { onRemove: () => b(r), name: r.name, children: /* @__PURE__ */ e.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
174
+ /* @__PURE__ */ e.jsx(Ee, { onRemove: () => y(r), name: r.name, children: /* @__PURE__ */ e.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
175
175
  /* @__PURE__ */ e.jsxs(
176
176
  "svg",
177
177
  {
@@ -199,15 +199,15 @@ const ze = () => {
199
199
  },
200
200
  r.providerKey
201
201
  )) }),
202
- /* @__PURE__ */ e.jsx(Be, { onClose: () => g(null), provider: C })
202
+ /* @__PURE__ */ e.jsx(Be, { onClose: () => b(null), provider: C })
203
203
  ] })
204
204
  ] });
205
205
  }, Le = $(() => {
206
- const { t: s } = j(), a = {
206
+ const { t: s } = g(), a = {
207
207
  "ctrl + Z": "Undo",
208
208
  "ctrl + Y": "Redo",
209
209
  "ctrl + D": "Duplicate"
210
- }, t = {
210
+ }, l = {
211
211
  // "ctrl + /": "Rename block",
212
212
  "ctrl + S": "Save page",
213
213
  esc: "Deselect blocks",
@@ -221,32 +221,32 @@ const ze = () => {
221
221
  /* @__PURE__ */ e.jsxs(H, { className: "sm:max-w-[525px]", children: [
222
222
  /* @__PURE__ */ e.jsx(U, { children: /* @__PURE__ */ e.jsx(F, { children: s("Keyboard shortcuts") }) }),
223
223
  /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2", children: [
224
- /* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(a).map((l) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
225
- /* @__PURE__ */ e.jsx(E, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
226
- /* @__PURE__ */ e.jsx("div", { children: s(a[l]) })
227
- ] }, l)) }),
228
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(t).map((l) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
229
- /* @__PURE__ */ e.jsx(E, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
230
- /* @__PURE__ */ e.jsx("div", { children: s(t[l]) })
231
- ] }, l)) })
224
+ /* @__PURE__ */ e.jsx("div", { className: "mr-8 flex flex-col space-y-2 border-r border-gray-200", children: Object.keys(a).map((t) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
225
+ /* @__PURE__ */ e.jsx(E, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(t) }),
226
+ /* @__PURE__ */ e.jsx("div", { children: s(a[t]) })
227
+ ] }, t)) }),
228
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: Object.keys(l).map((t) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-4", children: [
229
+ /* @__PURE__ */ e.jsx(E, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(t) }),
230
+ /* @__PURE__ */ e.jsx("div", { children: s(l[t]) })
231
+ ] }, t)) })
232
232
  ] }) })
233
233
  ] })
234
234
  ] });
235
- }), Ve = v(() => import("./AddBlocks-ChNxwRrx.js")), P = v(() => import("./index-EEcKvBh3.js").then((s) => s.h)), Ie = v(() => import("./ThemeConfigPanel-aEN4tTYi.js")), Me = v(() => import("./index-bscJUvUx.js").then((s) => s.cw)), Oe = v(() => import("./UILibrariesPanel-RI9mo293.js"));
236
- let I = null;
237
- const zs = () => {
238
- const s = w("sideBarComponents.top", []), a = w("sideBarComponents.bottom", []), [t, l] = M(ye), [u, d] = h(t), [c, k] = h(null), { t: p } = j(), C = w("uiLibraries", []), g = Te(), D = G(g).find((i) => i.category === "custom") !== void 0, T = C.length > 0 || D, b = {
239
- "add-blocks": Ve,
235
+ }), Ie = j(() => import("./AddBlocks-6dJmFSgk.js")), P = j(() => import("./index-wRAIA8zZ.js").then((s) => s.h)), Ve = j(() => import("./ThemeConfigPanel-gw8B2zvx.js")), Me = j(() => import("./index-b33n_-zO.js").then((s) => s.cw)), Oe = j(() => import("./UILibrariesPanel-vshiYI6G.js")), He = () => /* @__PURE__ */ e.jsx("div", { className: "w-72", children: /* @__PURE__ */ e.jsx(v, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-full w-full animate-pulse rounded-md bg-gray-100" }), children: /* @__PURE__ */ e.jsx(Ie, {}) }) });
236
+ let V = null;
237
+ const Ls = () => {
238
+ const s = w("sideBarComponents.top", []), a = w("sideBarComponents.bottom", []), [l, t] = M(ye), [h, d] = u(l), [c, k] = u(null), { t: p } = g(), C = w("uiLibraries", []), b = Te(), D = G(b).find((i) => i.category === "custom") !== void 0, T = C.length > 0 || D, y = {
239
+ "add-blocks": He,
240
240
  [o]: P,
241
- "theme-configuration": Ie,
241
+ "theme-configuration": Ve,
242
242
  images: Me,
243
243
  "ui-libraries": Oe
244
244
  };
245
- Q(s, ({ name: i, panel: _ }) => {
246
- b[i] = _;
245
+ Q(s, ({ name: i, panel: A }) => {
246
+ y[i] = A;
247
247
  });
248
248
  const n = (i) => {
249
- clearTimeout(I), t !== o && i === o ? I = setTimeout(() => l(o), 500) : d(i), l(i);
249
+ clearTimeout(V), l !== o && i === o ? V = setTimeout(() => t(o), 500) : d(i), t(i);
250
250
  }, r = w("dataBindingSupport", !1);
251
251
  function m() {
252
252
  const i = setTimeout(() => {
@@ -255,7 +255,7 @@ const zs = () => {
255
255
  k(i);
256
256
  }
257
257
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
258
- t !== o ? /* @__PURE__ */ e.jsx(
258
+ l !== o ? /* @__PURE__ */ e.jsx(
259
259
  "div",
260
260
  {
261
261
  onMouseEnter: m,
@@ -271,7 +271,7 @@ const zs = () => {
271
271
  {
272
272
  onClick: () => n("add-blocks"),
273
273
  size: "sm",
274
- variant: t === "add-blocks" ? "default" : "outline",
274
+ variant: l === "add-blocks" ? "default" : "outline",
275
275
  children: /* @__PURE__ */ e.jsx(S, { className: "text-xl" })
276
276
  }
277
277
  ),
@@ -280,7 +280,7 @@ const zs = () => {
280
280
  {
281
281
  onClick: () => n("ui-libraries"),
282
282
  size: "sm",
283
- variant: t === "ui-libraries" ? "default" : "outline",
283
+ variant: l === "ui-libraries" ? "default" : "outline",
284
284
  children: /* @__PURE__ */ e.jsx(J, { className: "text-xl" })
285
285
  }
286
286
  )
@@ -289,7 +289,7 @@ const zs = () => {
289
289
  {
290
290
  onClick: () => n("add-blocks"),
291
291
  size: "sm",
292
- variant: t === "add-blocks" ? "default" : "outline",
292
+ variant: l === "add-blocks" ? "default" : "outline",
293
293
  children: /* @__PURE__ */ e.jsx(S, { className: "text-xl" })
294
294
  }
295
295
  ),
@@ -298,8 +298,8 @@ const zs = () => {
298
298
  {
299
299
  onClick: () => n(o),
300
300
  size: "sm",
301
- variant: t === o ? "default" : "outline",
302
- children: /* @__PURE__ */ e.jsx(A, { className: "w-4" })
301
+ variant: l === o ? "default" : "outline",
302
+ children: /* @__PURE__ */ e.jsx(_, { className: "w-4" })
303
303
  }
304
304
  ),
305
305
  /* @__PURE__ */ e.jsx(
@@ -307,19 +307,19 @@ const zs = () => {
307
307
  {
308
308
  onClick: () => n("theme-configuration"),
309
309
  size: "sm",
310
- variant: t === "theme-configuration" ? "default" : "outline",
310
+ variant: l === "theme-configuration" ? "default" : "outline",
311
311
  children: /* @__PURE__ */ e.jsx(ke, { className: "w-4 max-w-[40px] text-xs" })
312
312
  }
313
313
  ),
314
314
  f.Children.toArray(
315
- s.map(({ name: i, icon: _ }) => /* @__PURE__ */ e.jsx(y, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
315
+ s.map(({ name: i, icon: A }) => /* @__PURE__ */ e.jsx(v, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
316
316
  x,
317
317
  {
318
318
  onClick: () => n(i),
319
319
  size: "sm",
320
320
  className: "w-10",
321
- variant: t === i ? "default" : "outline",
322
- children: /* @__PURE__ */ e.jsx(_, {})
321
+ variant: l === i ? "default" : "outline",
322
+ children: /* @__PURE__ */ e.jsx(A, {})
323
323
  }
324
324
  ) }))
325
325
  )
@@ -327,16 +327,16 @@ const zs = () => {
327
327
  /* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2", children: [
328
328
  /* @__PURE__ */ e.jsx(Le, {}),
329
329
  f.Children.toArray(
330
- a.map((i) => /* @__PURE__ */ e.jsx(y, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(i, {}) }))
330
+ a.map((i) => /* @__PURE__ */ e.jsx(v, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(i, {}) }))
331
331
  )
332
332
  ] })
333
333
  ] }),
334
- t !== o ? /* @__PURE__ */ e.jsx(
334
+ l !== o ? /* @__PURE__ */ e.jsx(
335
335
  "div",
336
336
  {
337
337
  className: "absolute left-14 z-[50] h-[100vh] w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",
338
338
  children: /* @__PURE__ */ e.jsx(
339
- y,
339
+ v,
340
340
  {
341
341
  fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 bg-white p-4", children: [
342
342
  /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
@@ -352,7 +352,7 @@ const zs = () => {
352
352
  onMouseEnter: () => {
353
353
  c && clearTimeout(c);
354
354
  },
355
- children: f.createElement(ee(b, t, () => /* @__PURE__ */ e.jsx("div", {})))
355
+ children: f.createElement(ee(y, l, () => /* @__PURE__ */ e.jsx("div", {})))
356
356
  }
357
357
  )
358
358
  }
@@ -360,7 +360,7 @@ const zs = () => {
360
360
  }
361
361
  ) : null,
362
362
  /* @__PURE__ */ e.jsx("div", { className: "h-full w-60 border-r p-1", children: /* @__PURE__ */ e.jsx(
363
- y,
363
+ v,
364
364
  {
365
365
  fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 p-4", children: [
366
366
  /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
@@ -370,7 +370,7 @@ const zs = () => {
370
370
  children: r ? /* @__PURE__ */ e.jsxs(Ne, { defaultValue: o, className: "flex h-full w-full flex-col py-1", children: [
371
371
  /* @__PURE__ */ e.jsxs(we, { className: "mx-1 grid h-10 grid-cols-2", children: [
372
372
  /* @__PURE__ */ e.jsxs(L, { value: o, children: [
373
- /* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
373
+ /* @__PURE__ */ e.jsx(_, { className: "mr-2 h-3" }),
374
374
  " ",
375
375
  p("Outline")
376
376
  ] }),
@@ -379,11 +379,11 @@ const zs = () => {
379
379
  p("Data")
380
380
  ] })
381
381
  ] }),
382
- /* @__PURE__ */ e.jsx(V, { value: o, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: f.createElement(P) }),
383
- /* @__PURE__ */ e.jsx(V, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(ze, {}) })
382
+ /* @__PURE__ */ e.jsx(I, { value: o, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: f.createElement(P) }),
383
+ /* @__PURE__ */ e.jsx(I, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(ze, {}) })
384
384
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
385
385
  /* @__PURE__ */ e.jsxs("div", { className: "sticky top-0 -m-1 flex h-fit items-center justify-center border-b bg-gray-100 py-2 pb-[9px] text-sm", children: [
386
- /* @__PURE__ */ e.jsx(A, { className: "mr-2 h-3" }),
386
+ /* @__PURE__ */ e.jsx(_, { className: "mr-2 h-3" }),
387
387
  " ",
388
388
  p("Outline")
389
389
  ] }),
@@ -394,5 +394,5 @@ const zs = () => {
394
394
  ] });
395
395
  };
396
396
  export {
397
- zs as default
397
+ Ls as default
398
398
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),R=require("@radix-ui/react-icons"),i=require("react"),D=require("jotai"),u=require("lodash-es"),s=require("./index-aeDphKpP.cjs"),E=require("lucide-react"),S=require("@chaibuilder/runtime"),v=require("react-i18next"),T=require("./index-gi1LIOCw.cjs"),P=require("./index-BbW1Uw_k.cjs"),a=require("./MODIFIERS-mVmfEGgo.cjs"),I=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.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("@react-hookz/web");require("tree-model");require("i18next");require("react-arborist");require("./index--mLLy7QQ.cjs");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");const _=({provider:t,onClose:x})=>{const{t:o}=v.useTranslation(),[l,p]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(d=>p(d))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:m=>m?"":x(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[o("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(P.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(T.JsonView,{data:l,shouldExpandNode:T.allExpanded,style:{...T.defaultStyles,container:"max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]})}):null};function K({children:t,name:x,onRemove:o}){const{t:l}=v.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:l("remove_provider_confirmation").replace("{name}",x)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:l("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:l("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:l("remove")})]})]})]})}const L=()=>{const{t}=v.useTranslation(),x=i.useMemo(()=>S.getChaiDataProviders(),[]),[o,l]=s.usePageDataProviders(),[,p]=D.useAtom(s.builderSaveStateAtom),[m,d]=i.useState(u.filter(x,r=>u.map(o,"providerKey").includes(r.providerKey))),[b,h]=i.useState(""),[N,f]=i.useState(null),y=u.filter(x.map(r=>u.map(m,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!u.isNull(r)),w=r=>{const j=u.find(x,{providerKey:r});d(n=>[...n,j]),l(n=>[...n,{providerKey:j.providerKey,args:{}}]),h(""),p("UNSAVED")},g=r=>{d(j=>u.filter(j,n=>n.providerKey!==r.providerKey)),l(j=>u.filter(j,n=>n.providerKey!==r.providerKey)),p("UNSAVED")},c=r=>f(r);return u.isEmpty(x)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 p-4 text-xs text-gray-500",children:[t("no_data_providers"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:t("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"mb-1.5 text-xs text-gray-500",children:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:b,onValueChange:r=>w(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),y.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${m.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:m.map(r=>e.jsxRuntimeExports.jsxs("div",{className:"w-full rounded-lg border bg-card text-card-foreground shadow-sm","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>c(r),className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(K,{onRemove:()=>g(r),name:r.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(_,{onClose:()=>f(null),provider:N})]})]})},B=i.memo(()=>{const{t}=v.useTranslation(),x={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return e.jsxRuntimeExports.jsxs(s.Dialog,{children:[e.jsxRuntimeExports.jsx(s.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"flex w-10 items-center justify-center",children:e.jsxRuntimeExports.jsx(R.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(s.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(s.DialogHeader,{children:e.jsxRuntimeExports.jsx(s.DialogTitle,{children:t("Keyboard shortcuts")})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[e.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-gray-200",children:Object.keys(x).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(x[l])})]},l))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(o[l])})]},l))})]})})]})]})}),A=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-4wpxOF2K.cjs"))),k=i.lazy(()=>Promise.resolve().then(()=>require("./index-BbW1Uw_k.cjs")).then(t=>t.ListTree$1)),O=i.lazy(()=>Promise.resolve().then(()=>require("./ThemeConfigPanel-N6l317II.cjs"))),U=i.lazy(()=>Promise.resolve().then(()=>require("./index-aeDphKpP.cjs")).then(t=>t.ImagesPanel)),z=i.lazy(()=>Promise.resolve().then(()=>require("./UILibrariesPanel-03Y3F3A_.cjs")));let C=null;const Y=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),x=s.useBuilderProp("sideBarComponents.bottom",[]),[o,l]=D.useAtom(s.activePanelAtom),[p,m]=i.useState(o),[d,b]=i.useState(null),{t:h}=v.useTranslation(),N=s.useBuilderProp("uiLibraries",[]),f=S.useChaiBlocks(),y=u.values(f).find(n=>n.category==="custom")!==void 0,w=N.length>0||y,g={"add-blocks":A,[a.OUTLINE_KEY]:k,"theme-configuration":O,images:U,"ui-libraries":z};u.each(t,({name:n,panel:q})=>{g[n]=q});const c=n=>{clearTimeout(C),o!==a.OUTLINE_KEY&&n===a.OUTLINE_KEY?C=setTimeout(()=>l(a.OUTLINE_KEY),500):m(n),l(n)},r=s.useBuilderProp("dataBindingSupport",!1);function j(){const n=setTimeout(()=>{d&&(c(a.OUTLINE_KEY),clearTimeout(d))},500);b(n)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:j,onClick:()=>c(a.OUTLINE_KEY),className:"fixed inset-0 z-[50] bg-black/20"}):null,e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[w?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-gray-200 p-1",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("ui-libraries"),size:"sm",variant:o==="ui-libraries"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.Component2Icon,{className:"text-xl"})})]}):e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c(a.OUTLINE_KEY),size:"sm",variant:o===a.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("theme-configuration"),size:"sm",variant:o==="theme-configuration"?"default":"outline",children:e.jsxRuntimeExports.jsx(E.PaletteIcon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:n,icon:q})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c(n),size:"sm",className:"w-10",variant:o===n?"default":"outline",children:e.jsxRuntimeExports.jsx(q,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(B,{}),i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]}),o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{className:"absolute left-14 z-[50] h-[100vh] w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:I.cn("relative z-[100] h-full max-h-full overflow-y-auto overflow-x-hidden border-r bg-background p-1 shadow-md"),onMouseEnter:()=>{d&&clearTimeout(d)},children:i.createElement(u.get(g,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}):null,e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:r?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:a.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:a.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(E.DatabaseIcon,{className:"mr-2 w-3"}),h("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:a.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(k)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(L,{})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"sticky top-0 -m-1 flex h-fit items-center justify-center border-b bg-gray-100 py-2 pb-[9px] text-sm",children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2",children:i.createElement(k)})]})})})]})};exports.default=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),g=require("@radix-ui/react-icons"),i=require("react"),D=require("jotai"),u=require("lodash-es"),s=require("./index-aeDphKpP.cjs"),E=require("lucide-react"),S=require("@chaibuilder/runtime"),v=require("react-i18next"),k=require("./index-gi1LIOCw.cjs"),P=require("./index-audsIPBC.cjs"),a=require("./MODIFIERS-mVmfEGgo.cjs"),I=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.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("@react-hookz/web");require("tree-model");require("i18next");require("react-arborist");require("./index--mLLy7QQ.cjs");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");const _=({provider:t,onClose:x})=>{const{t:o}=v.useTranslation(),[l,p]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(d=>p(d))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:m=>m?"":x(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[o("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(P.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(k.JsonView,{data:l,shouldExpandNode:k.allExpanded,style:{...k.defaultStyles,container:"max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]})}):null};function K({children:t,name:x,onRemove:o}){const{t:l}=v.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:l("remove_provider_confirmation").replace("{name}",x)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:l("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:l("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:l("remove")})]})]})]})}const L=()=>{const{t}=v.useTranslation(),x=i.useMemo(()=>S.getChaiDataProviders(),[]),[o,l]=s.usePageDataProviders(),[,p]=D.useAtom(s.builderSaveStateAtom),[m,d]=i.useState(u.filter(x,r=>u.map(o,"providerKey").includes(r.providerKey))),[b,h]=i.useState(""),[N,f]=i.useState(null),y=u.filter(x.map(r=>u.map(m,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!u.isNull(r)),w=r=>{const j=u.find(x,{providerKey:r});d(n=>[...n,j]),l(n=>[...n,{providerKey:j.providerKey,args:{}}]),h(""),p("UNSAVED")},R=r=>{d(j=>u.filter(j,n=>n.providerKey!==r.providerKey)),l(j=>u.filter(j,n=>n.providerKey!==r.providerKey)),p("UNSAVED")},c=r=>f(r);return u.isEmpty(x)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 p-4 text-xs text-gray-500",children:[t("no_data_providers"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:t("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"mb-1.5 text-xs text-gray-500",children:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:b,onValueChange:r=>w(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),y.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${m.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:m.map(r=>e.jsxRuntimeExports.jsxs("div",{className:"w-full rounded-lg border bg-card text-card-foreground shadow-sm","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>c(r),className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(K,{onRemove:()=>R(r),name:r.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(_,{onClose:()=>f(null),provider:N})]})]})},B=i.memo(()=>{const{t}=v.useTranslation(),x={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return e.jsxRuntimeExports.jsxs(s.Dialog,{children:[e.jsxRuntimeExports.jsx(s.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"flex w-10 items-center justify-center",children:e.jsxRuntimeExports.jsx(g.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(s.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(s.DialogHeader,{children:e.jsxRuntimeExports.jsx(s.DialogTitle,{children:t("Keyboard shortcuts")})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[e.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-gray-200",children:Object.keys(x).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(x[l])})]},l))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(o[l])})]},l))})]})})]})]})}),A=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-doCNVVbk.cjs"))),T=i.lazy(()=>Promise.resolve().then(()=>require("./index-audsIPBC.cjs")).then(t=>t.ListTree$1)),O=i.lazy(()=>Promise.resolve().then(()=>require("./ThemeConfigPanel-_86vVxLz.cjs"))),U=i.lazy(()=>Promise.resolve().then(()=>require("./index-aeDphKpP.cjs")).then(t=>t.ImagesPanel)),z=i.lazy(()=>Promise.resolve().then(()=>require("./UILibrariesPanel-03Y3F3A_.cjs"))),Y=()=>e.jsxRuntimeExports.jsx("div",{className:"w-72",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-full w-full animate-pulse rounded-md bg-gray-100"}),children:e.jsxRuntimeExports.jsx(A,{})})});let C=null;const V=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),x=s.useBuilderProp("sideBarComponents.bottom",[]),[o,l]=D.useAtom(s.activePanelAtom),[p,m]=i.useState(o),[d,b]=i.useState(null),{t:h}=v.useTranslation(),N=s.useBuilderProp("uiLibraries",[]),f=S.useChaiBlocks(),y=u.values(f).find(n=>n.category==="custom")!==void 0,w=N.length>0||y,R={"add-blocks":Y,[a.OUTLINE_KEY]:T,"theme-configuration":O,images:U,"ui-libraries":z};u.each(t,({name:n,panel:q})=>{R[n]=q});const c=n=>{clearTimeout(C),o!==a.OUTLINE_KEY&&n===a.OUTLINE_KEY?C=setTimeout(()=>l(a.OUTLINE_KEY),500):m(n),l(n)},r=s.useBuilderProp("dataBindingSupport",!1);function j(){const n=setTimeout(()=>{d&&(c(a.OUTLINE_KEY),clearTimeout(d))},500);b(n)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:j,onClick:()=>c(a.OUTLINE_KEY),className:"fixed inset-0 z-[50] bg-black/20"}):null,e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[w?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-gray-200 p-1",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(g.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("ui-libraries"),size:"sm",variant:o==="ui-libraries"?"default":"outline",children:e.jsxRuntimeExports.jsx(g.Component2Icon,{className:"text-xl"})})]}):e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(g.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c(a.OUTLINE_KEY),size:"sm",variant:o===a.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c("theme-configuration"),size:"sm",variant:o==="theme-configuration"?"default":"outline",children:e.jsxRuntimeExports.jsx(E.PaletteIcon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:n,icon:q})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>c(n),size:"sm",className:"w-10",variant:o===n?"default":"outline",children:e.jsxRuntimeExports.jsx(q,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(B,{}),i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]}),o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{className:"absolute left-14 z-[50] h-[100vh] w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:I.cn("relative z-[100] h-full max-h-full overflow-y-auto overflow-x-hidden border-r bg-background p-1 shadow-md"),onMouseEnter:()=>{d&&clearTimeout(d)},children:i.createElement(u.get(R,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}):null,e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:r?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:a.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:a.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(E.DatabaseIcon,{className:"mr-2 w-3"}),h("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:a.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(T)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(L,{})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"sticky top-0 -m-1 flex h-fit items-center justify-center border-b bg-gray-100 py-2 pb-[9px] text-sm",children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2",children:i.createElement(T)})]})})})]})};exports.default=V;