@chaibuilder/sdk 1.2.64 → 1.2.65

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 (78) hide show
  1. package/dist/CanvasArea-fSdH_RiN.cjs +1 -0
  2. package/dist/{CanvasArea-kB6ky_uL.js → CanvasArea-ut5yknzX.js} +58 -54
  3. package/dist/{CodeEditor-37od44Ou.js → CodeEditor-Qff4q7sx.js} +1 -1
  4. package/dist/{CurrentPage-bHq9Uusr.js → CurrentPage-jHSVy3hq.js} +38 -26
  5. package/dist/CurrentPage-p_AM4lrF.cjs +1 -0
  6. package/dist/{PagesPanel-wIPAyjJK.js → PagesPanel-U3InJ9Db.js} +20 -8
  7. package/dist/PagesPanel-wqDb4D-x.cjs +1 -0
  8. package/dist/{ProjectPanel-L-SlDizV.js → ProjectPanel-XODJTO4J.js} +36 -24
  9. package/dist/ProjectPanel-fWESzHr6.cjs +1 -0
  10. package/dist/{SidePanels-UQj0XTnb.js → SidePanels-ijaUKSek.js} +96 -82
  11. package/dist/SidePanels-lrMQqc0h.cjs +1 -0
  12. package/dist/Topbar-RrCDxd0i.cjs +1 -0
  13. package/dist/{Topbar-1O05wogM.js → Topbar-vHlnfxPs.js} +45 -30
  14. package/dist/UILibrariesPanel-7btHgBD0.cjs +1 -0
  15. package/dist/{UILibrariesPanel-vshiYI6G.js → UILibrariesPanel-NVUMUPUj.js} +85 -65
  16. package/dist/{UnsplashImages-Eq7hprBO.js → UnsplashImages-UkHihhA5.js} +18 -18
  17. package/dist/{UploadImages-lco2Tea3.js → UploadImages-HtuJZJlo.js} +1 -1
  18. package/dist/add-page-modal-RwIj1FxH.cjs +1 -0
  19. package/dist/{add-page-modal-qr7rvJzN.js → add-page-modal-TOfMfmPA.js} +33 -24
  20. package/dist/{confirm-alert-P6TAevaP.js → confirm-alert-eIp2cAkc.js} +1 -1
  21. package/dist/core.cjs +1 -1
  22. package/dist/core.d.ts +7 -8
  23. package/dist/core.js +74 -59
  24. package/dist/{delete-page-modal-55oioI9i.js → delete-page-modal-4bxjpVBD.js} +33 -21
  25. package/dist/delete-page-modal-qYDZmpgT.cjs +1 -0
  26. package/dist/email.cjs +1 -1
  27. package/dist/email.js +20 -5
  28. package/dist/{form-5ke_lZv8.js → form-NAzFjGs0.js} +9 -9
  29. package/dist/html-to-json-NqRjgFqp.cjs +1 -0
  30. package/dist/html-to-json-l_mw5y-e.js +243 -0
  31. package/dist/{index-6w-6HYBd.cjs → index--k2M8kzI.cjs} +1 -1
  32. package/dist/{index-audsIPBC.cjs → index-5XyNUAjc.cjs} +81 -22
  33. package/dist/{index-b33n_-zO.js → index-C7mB4XFm.js} +117 -117
  34. package/dist/{index-fnkMn4Pk.js → index-YZhtVcj_.js} +4 -4
  35. package/dist/{index-wRAIA8zZ.js → index-lFgDm1oa.js} +48587 -45055
  36. package/dist/lib.cjs +2 -2
  37. package/dist/lib.js +22 -22
  38. package/dist/page-viewer-4wrnWnK0.js +124 -0
  39. package/dist/page-viewer-ra0GLx1p.cjs +1 -0
  40. package/dist/{project-general-setting-NEkNjf7V.js → project-general-setting-IwZUkYF3.js} +18 -9
  41. package/dist/project-general-setting-lFjTUhHD.cjs +1 -0
  42. package/dist/{project-seo-setting-YmspOYsF.js → project-seo-setting-e1fTqVsd.js} +2 -2
  43. package/dist/{single-page-detail-jHzoDP7B.js → single-page-detail-ZNWFKqLW.js} +64 -55
  44. package/dist/single-page-detail-g55Anu7R.cjs +1 -0
  45. package/dist/studio.cjs +1 -1
  46. package/dist/studio.js +18 -6
  47. package/dist/style.css +2 -2
  48. package/dist/ui.js +67 -67
  49. package/package.json +1 -1
  50. package/dist/AddBlocks-6dJmFSgk.js +0 -142
  51. package/dist/AddBlocks-doCNVVbk.cjs +0 -1
  52. package/dist/CanvasArea-kdnkFfKR.cjs +0 -1
  53. package/dist/CurrentPage-Ekl5Cwbv.cjs +0 -1
  54. package/dist/PagesPanel-SMHrEmCb.cjs +0 -1
  55. package/dist/ProjectPanel-YruLal65.cjs +0 -1
  56. package/dist/Settings-WXkCyhAv.js +0 -2380
  57. package/dist/Settings-_5VHcgFC.cjs +0 -1
  58. package/dist/SidePanels-UeIZB3e1.cjs +0 -1
  59. package/dist/StaticCanvas-7C52tXAv.js +0 -749
  60. package/dist/StaticCanvas-ll9VTXI5.cjs +0 -60
  61. package/dist/ThemeConfigPanel-_86vVxLz.cjs +0 -1
  62. package/dist/ThemeConfigPanel-gw8B2zvx.js +0 -194
  63. package/dist/Topbar-gb17oHdJ.cjs +0 -1
  64. package/dist/UILibrariesPanel-03Y3F3A_.cjs +0 -1
  65. package/dist/add-page-modal-rOKavDFX.cjs +0 -1
  66. package/dist/atoms-KQpaDRnF.cjs +0 -1
  67. package/dist/atoms-Oomqut88.js +0 -6
  68. package/dist/delete-page-modal-wdAiMVnL.cjs +0 -1
  69. package/dist/html-to-json-_01DXd-a.js +0 -192
  70. package/dist/html-to-json-ndxaXRT8.cjs +0 -1
  71. package/dist/index-e0c8PmRQ.js +0 -205
  72. package/dist/index-gi1LIOCw.cjs +0 -1
  73. package/dist/page-viewer-t44DP65U.js +0 -112
  74. package/dist/page-viewer-wU7T0f48.cjs +0 -1
  75. package/dist/plugin-2hf9pCRy.cjs +0 -1
  76. package/dist/plugin-wDnsBVPp.js +0 -54
  77. package/dist/project-general-setting-87cX9vvO.cjs +0 -1
  78. package/dist/single-page-detail-27UjWK8L.cjs +0 -1
@@ -1,16 +1,15 @@
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 u, useEffect as W, useMemo as Y, memo as $, lazy as j, Suspense as v } from "react";
4
- import { useAtom as M } from "jotai";
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";
3
+ import f, { useState as p, useEffect as Y, useMemo as Z, memo as W, lazy as v, Suspense as j } from "react";
4
+ import { useAtom as O } from "jotai";
5
+ import { filter as N, map as B, isNull as X, find as $, isEmpty as q, values as G, each as Q, get as ee } from "lodash-es";
6
+ import { ah as M, aj as H, ad as U, ae as F, af 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, b8 as de, a0 as me, ba as xe, bw as pe, bx as he, by as ue, bz as fe, bA as K, ai as je, T as ve, v as ge, w as be, bB as E, h as w, aO as ye, B as x, a3 as z, aX as Ne, aY as we, aZ as L, bC as I } from "./index-C7mB4XFm.js";
7
+ import { ListTreeIcon as P, PaletteIcon as ke, DatabaseIcon as Ce } from "lucide-react";
8
8
  import { getChaiDataProviders as De, useChaiBlocks as Te } from "@chaibuilder/runtime";
9
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";
10
+ import { E as Ae, J as Pe, a as _e, d as Se } from "./index-lFgDm1oa.js";
12
11
  import { O as o } from "./MODIFIERS-fd5XOmum.js";
13
- import { c as Ke } from "./Functions-7jnEwJyw.js";
12
+ import { c as Be } from "./Functions-7jnEwJyw.js";
14
13
  import "./_commonjsHelpers-UyOWmZb0.js";
15
14
  import "@radix-ui/react-toggle";
16
15
  import "class-variance-authority";
@@ -43,29 +42,44 @@ import "tree-model";
43
42
  import "i18next";
44
43
  import "react-arborist";
45
44
  import "./index-VBXQixVm.js";
45
+ import "prop-types";
46
+ import "react-hotkeys-hook";
47
+ import "@floating-ui/dom";
46
48
  import "@floating-ui/react-dom";
47
49
  import "flagged";
48
- import "react-hotkeys-hook";
49
- const Be = ({ provider: s, onClose: a }) => {
50
- const { t: l } = g(), [t, h] = u(null);
51
- return W(() => {
50
+ import "@tailwindcss/typography";
51
+ import "@tailwindcss/forms";
52
+ import "@tailwindcss/aspect-ratio";
53
+ import "tailwindcss-palette-generator";
54
+ import "./html-to-json-l_mw5y-e.js";
55
+ import "himalaya";
56
+ import "lodash";
57
+ import "react-wrap-balancer";
58
+ import "@rjsf/core";
59
+ import "@rjsf/validator-ajv8";
60
+ import "react-autosuggest";
61
+ import "fuse.js";
62
+ import "./controls-yjgoZzB6.js";
63
+ const Ke = ({ provider: s, onClose: a }) => {
64
+ const { t } = g(), [l, h] = p(null);
65
+ return Y(() => {
52
66
  s && (s.mockFn ? s.mockFn : s.dataFn)().then((c) => h(c));
53
- }, [s]), s ? /* @__PURE__ */ e.jsx(O, { onOpenChange: (d) => d ? "" : a(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
67
+ }, [s]), s ? /* @__PURE__ */ e.jsx(M, { onOpenChange: (d) => d ? "" : a(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
54
68
  /* @__PURE__ */ e.jsxs(U, { children: [
55
69
  /* @__PURE__ */ e.jsxs(F, { children: [
56
- l("data_provider"),
70
+ t("data_provider"),
57
71
  ": ",
58
72
  s.name
59
73
  ] }),
60
74
  /* @__PURE__ */ e.jsx(se, { children: s.description })
61
75
  ] }),
62
- /* @__PURE__ */ e.jsx(Se, { children: /* @__PURE__ */ e.jsx(
63
- Ae,
76
+ /* @__PURE__ */ e.jsx(Ae, { children: /* @__PURE__ */ e.jsx(
77
+ Pe,
64
78
  {
65
- data: t,
79
+ data: l,
66
80
  shouldExpandNode: _e,
67
81
  style: {
68
- ...Pe,
82
+ ...Se,
69
83
  container: "max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
70
84
  stringValue: "text-orange-600",
71
85
  label: "text-green-900 font-semibold pr-1 tracking-wider"
@@ -77,52 +91,52 @@ const Be = ({ provider: s, onClose: a }) => {
77
91
  function Ee({
78
92
  children: s,
79
93
  name: a,
80
- onRemove: l
94
+ onRemove: t
81
95
  }) {
82
- const { t } = g();
96
+ const { t: l } = g();
83
97
  return /* @__PURE__ */ e.jsxs(re, { children: [
84
98
  /* @__PURE__ */ e.jsx(ie, { asChild: !0, children: s }),
85
- /* @__PURE__ */ e.jsxs(le, { children: [
86
- /* @__PURE__ */ e.jsxs(te, { children: [
99
+ /* @__PURE__ */ e.jsxs(te, { children: [
100
+ /* @__PURE__ */ e.jsxs(le, { children: [
87
101
  /* @__PURE__ */ e.jsx(
88
102
  ae,
89
103
  {
90
- dangerouslySetInnerHTML: { __html: t("remove_provider_confirmation").replace("{name}", a) }
104
+ dangerouslySetInnerHTML: { __html: l("remove_provider_confirmation").replace("{name}", a) }
91
105
  }
92
106
  ),
93
- /* @__PURE__ */ e.jsx(oe, { children: t("remove_provider_warning") })
107
+ /* @__PURE__ */ e.jsx(oe, { children: l("remove_provider_warning") })
94
108
  ] }),
95
109
  /* @__PURE__ */ e.jsxs(ne, { children: [
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") })
110
+ /* @__PURE__ */ e.jsx(ce, { children: l("cancel") }),
111
+ /* @__PURE__ */ e.jsx(de, { onClick: t, className: "bg-red-600 hover:bg-red-700", children: l("remove") })
98
112
  ] })
99
113
  ] })
100
114
  ] });
101
115
  }
102
116
  const ze = () => {
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
- a.map((r) => K(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
107
- (r) => !Z(r)
117
+ const { t: s } = g(), a = Z(() => De(), []), [t, l] = me(), [, h] = O(xe), [d, c] = p(
118
+ N(a, (r) => B(t, "providerKey").includes(r.providerKey))
119
+ ), [k, u] = p(""), [C, b] = p(null), D = N(
120
+ a.map((r) => B(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
121
+ (r) => !X(r)
108
122
  ), T = (r) => {
109
- const m = q(a, { providerKey: r });
110
- c((i) => [...i, m]), t((i) => [...i, { providerKey: m.providerKey, args: {} }]), p(""), h("UNSAVED");
123
+ const m = $(a, { providerKey: r });
124
+ c((i) => [...i, m]), l((i) => [...i, { providerKey: m.providerKey, args: {} }]), u(""), h("UNSAVED");
111
125
  }, y = (r) => {
112
- c((m) => N(m, (i) => i.providerKey !== r.providerKey)), t((m) => N(m, (i) => i.providerKey !== r.providerKey)), h("UNSAVED");
126
+ c((m) => N(m, (i) => i.providerKey !== r.providerKey)), l((m) => N(m, (i) => i.providerKey !== r.providerKey)), h("UNSAVED");
113
127
  }, n = (r) => b(r);
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: [
128
+ return q(a) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
115
129
  s("no_data_providers"),
116
130
  /* @__PURE__ */ e.jsx("br", {}),
117
131
  /* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: s("learn_more") })
118
132
  ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
119
133
  /* @__PURE__ */ e.jsx("br", {}),
120
134
  /* @__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(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") }) }),
135
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(pe, { value: k, onValueChange: (r) => T(r), children: [
136
+ /* @__PURE__ */ e.jsx(he, { className: "w-full", children: /* @__PURE__ */ e.jsx(ue, { placeholder: s("select_provider") }) }),
123
137
  /* @__PURE__ */ e.jsxs(fe, { children: [
124
- /* @__PURE__ */ e.jsx(B, { value: "", children: s("choose") }),
125
- D.map((r) => /* @__PURE__ */ e.jsx(B, { value: r.value, children: r.label }, r.value))
138
+ /* @__PURE__ */ e.jsx(K, { value: "", children: s("choose") }),
139
+ D.map((r) => /* @__PURE__ */ e.jsx(K, { value: r.value, children: r.label }, r.value))
126
140
  ] })
127
141
  ] }) }),
128
142
  /* @__PURE__ */ e.jsx("br", {}),
@@ -199,54 +213,54 @@ const ze = () => {
199
213
  },
200
214
  r.providerKey
201
215
  )) }),
202
- /* @__PURE__ */ e.jsx(Be, { onClose: () => b(null), provider: C })
216
+ /* @__PURE__ */ e.jsx(Ke, { onClose: () => b(null), provider: C })
203
217
  ] })
204
218
  ] });
205
- }, Le = $(() => {
219
+ }, Le = W(() => {
206
220
  const { t: s } = g(), a = {
207
221
  "ctrl + Z": "Undo",
208
222
  "ctrl + Y": "Redo",
209
223
  "ctrl + D": "Duplicate"
210
- }, l = {
224
+ }, t = {
211
225
  // "ctrl + /": "Rename block",
212
226
  "ctrl + S": "Save page",
213
227
  esc: "Deselect blocks",
214
228
  del: "Delete block"
215
229
  };
216
- return /* @__PURE__ */ e.jsxs(O, { children: [
217
- /* @__PURE__ */ e.jsx(ve, { children: /* @__PURE__ */ e.jsxs(je, { children: [
230
+ return /* @__PURE__ */ e.jsxs(M, { children: [
231
+ /* @__PURE__ */ e.jsx(je, { children: /* @__PURE__ */ e.jsxs(ve, { children: [
218
232
  /* @__PURE__ */ e.jsx(ge, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { className: "flex w-10 items-center justify-center", children: /* @__PURE__ */ e.jsx(R, {}) }) }),
219
233
  /* @__PURE__ */ e.jsx(be, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
220
234
  ] }) }),
221
235
  /* @__PURE__ */ e.jsxs(H, { className: "sm:max-w-[525px]", children: [
222
236
  /* @__PURE__ */ e.jsx(U, { children: /* @__PURE__ */ e.jsx(F, { children: s("Keyboard shortcuts") }) }),
223
237
  /* @__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((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)) })
238
+ /* @__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: [
239
+ /* @__PURE__ */ e.jsx(E, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
240
+ /* @__PURE__ */ e.jsx("div", { children: s(a[l]) })
241
+ ] }, l)) }),
242
+ /* @__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: [
243
+ /* @__PURE__ */ e.jsx(E, { variant: "outline", className: "border border-gray-600 p-1 px-2", children: s(l) }),
244
+ /* @__PURE__ */ e.jsx("div", { children: s(t[l]) })
245
+ ] }, l)) })
232
246
  ] }) })
233
247
  ] })
234
248
  ] });
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, {}) }) });
249
+ }), Ie = v(() => import("./index-lFgDm1oa.js").then((s) => s.g)), _ = v(() => import("./index-lFgDm1oa.js").then((s) => s.f)), Ve = v(() => import("./index-lFgDm1oa.js").then((s) => s.h)), Oe = v(() => import("./index-C7mB4XFm.js").then((s) => s.cw)), Me = v(() => import("./UILibrariesPanel-NVUMUPUj.js")), He = () => /* @__PURE__ */ e.jsx("div", { className: "w-72", children: /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-full w-full animate-pulse rounded-md bg-gray-100" }), children: /* @__PURE__ */ e.jsx(Ie, {}) }) });
236
250
  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 = {
251
+ const $s = () => {
252
+ const s = w("sideBarComponents.top", []), a = w("sideBarComponents.bottom", []), [t, l] = O(ye), [h, d] = p(t), [c, k] = p(null), { t: u } = g(), C = w("uiLibraries", []), b = Te(), D = G(b).find((i) => i.category === "custom") !== void 0, T = C.length > 0 || D, y = {
239
253
  "add-blocks": He,
240
- [o]: P,
254
+ [o]: _,
241
255
  "theme-configuration": Ve,
242
- images: Me,
243
- "ui-libraries": Oe
256
+ images: Oe,
257
+ "ui-libraries": Me
244
258
  };
245
259
  Q(s, ({ name: i, panel: A }) => {
246
260
  y[i] = A;
247
261
  });
248
262
  const n = (i) => {
249
- clearTimeout(V), l !== o && i === o ? V = setTimeout(() => t(o), 500) : d(i), t(i);
263
+ clearTimeout(V), t !== o && i === o ? V = setTimeout(() => l(o), 500) : d(i), l(i);
250
264
  }, r = w("dataBindingSupport", !1);
251
265
  function m() {
252
266
  const i = setTimeout(() => {
@@ -255,7 +269,7 @@ const Ls = () => {
255
269
  k(i);
256
270
  }
257
271
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
258
- l !== o ? /* @__PURE__ */ e.jsx(
272
+ t !== o ? /* @__PURE__ */ e.jsx(
259
273
  "div",
260
274
  {
261
275
  onMouseEnter: m,
@@ -271,7 +285,7 @@ const Ls = () => {
271
285
  {
272
286
  onClick: () => n("add-blocks"),
273
287
  size: "sm",
274
- variant: l === "add-blocks" ? "default" : "outline",
288
+ variant: t === "add-blocks" ? "default" : "outline",
275
289
  children: /* @__PURE__ */ e.jsx(S, { className: "text-xl" })
276
290
  }
277
291
  ),
@@ -280,7 +294,7 @@ const Ls = () => {
280
294
  {
281
295
  onClick: () => n("ui-libraries"),
282
296
  size: "sm",
283
- variant: l === "ui-libraries" ? "default" : "outline",
297
+ variant: t === "ui-libraries" ? "default" : "outline",
284
298
  children: /* @__PURE__ */ e.jsx(J, { className: "text-xl" })
285
299
  }
286
300
  )
@@ -289,7 +303,7 @@ const Ls = () => {
289
303
  {
290
304
  onClick: () => n("add-blocks"),
291
305
  size: "sm",
292
- variant: l === "add-blocks" ? "default" : "outline",
306
+ variant: t === "add-blocks" ? "default" : "outline",
293
307
  children: /* @__PURE__ */ e.jsx(S, { className: "text-xl" })
294
308
  }
295
309
  ),
@@ -298,8 +312,8 @@ const Ls = () => {
298
312
  {
299
313
  onClick: () => n(o),
300
314
  size: "sm",
301
- variant: l === o ? "default" : "outline",
302
- children: /* @__PURE__ */ e.jsx(_, { className: "w-4" })
315
+ variant: t === o ? "default" : "outline",
316
+ children: /* @__PURE__ */ e.jsx(P, { className: "w-4" })
303
317
  }
304
318
  ),
305
319
  /* @__PURE__ */ e.jsx(
@@ -307,18 +321,18 @@ const Ls = () => {
307
321
  {
308
322
  onClick: () => n("theme-configuration"),
309
323
  size: "sm",
310
- variant: l === "theme-configuration" ? "default" : "outline",
324
+ variant: t === "theme-configuration" ? "default" : "outline",
311
325
  children: /* @__PURE__ */ e.jsx(ke, { className: "w-4 max-w-[40px] text-xs" })
312
326
  }
313
327
  ),
314
328
  f.Children.toArray(
315
- s.map(({ name: i, icon: A }) => /* @__PURE__ */ e.jsx(v, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
329
+ s.map(({ name: i, icon: A }) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
316
330
  x,
317
331
  {
318
332
  onClick: () => n(i),
319
333
  size: "sm",
320
334
  className: "w-10",
321
- variant: l === i ? "default" : "outline",
335
+ variant: t === i ? "default" : "outline",
322
336
  children: /* @__PURE__ */ e.jsx(A, {})
323
337
  }
324
338
  ) }))
@@ -327,16 +341,16 @@ const Ls = () => {
327
341
  /* @__PURE__ */ e.jsxs("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2", children: [
328
342
  /* @__PURE__ */ e.jsx(Le, {}),
329
343
  f.Children.toArray(
330
- a.map((i) => /* @__PURE__ */ e.jsx(v, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(i, {}) }))
344
+ a.map((i) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(z, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(i, {}) }))
331
345
  )
332
346
  ] })
333
347
  ] }),
334
- l !== o ? /* @__PURE__ */ e.jsx(
348
+ t !== o ? /* @__PURE__ */ e.jsx(
335
349
  "div",
336
350
  {
337
351
  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
352
  children: /* @__PURE__ */ e.jsx(
339
- v,
353
+ j,
340
354
  {
341
355
  fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 bg-white p-4", children: [
342
356
  /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
@@ -346,13 +360,13 @@ const Ls = () => {
346
360
  children: /* @__PURE__ */ e.jsx(
347
361
  "div",
348
362
  {
349
- className: Ke(
363
+ className: Be(
350
364
  "relative z-[100] h-full max-h-full overflow-y-auto overflow-x-hidden border-r bg-background p-1 shadow-md"
351
365
  ),
352
366
  onMouseEnter: () => {
353
367
  c && clearTimeout(c);
354
368
  },
355
- children: f.createElement(ee(y, l, () => /* @__PURE__ */ e.jsx("div", {})))
369
+ children: f.createElement(ee(y, t, () => /* @__PURE__ */ e.jsx("div", {})))
356
370
  }
357
371
  )
358
372
  }
@@ -360,7 +374,7 @@ const Ls = () => {
360
374
  }
361
375
  ) : null,
362
376
  /* @__PURE__ */ e.jsx("div", { className: "h-full w-60 border-r p-1", children: /* @__PURE__ */ e.jsx(
363
- v,
377
+ j,
364
378
  {
365
379
  fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-2 p-4", children: [
366
380
  /* @__PURE__ */ e.jsx("div", { className: "h-6 w-1/2 bg-gray-300" }),
@@ -370,29 +384,29 @@ const Ls = () => {
370
384
  children: r ? /* @__PURE__ */ e.jsxs(Ne, { defaultValue: o, className: "flex h-full w-full flex-col py-1", children: [
371
385
  /* @__PURE__ */ e.jsxs(we, { className: "mx-1 grid h-10 grid-cols-2", children: [
372
386
  /* @__PURE__ */ e.jsxs(L, { value: o, children: [
373
- /* @__PURE__ */ e.jsx(_, { className: "mr-2 h-3" }),
387
+ /* @__PURE__ */ e.jsx(P, { className: "mr-2 h-3" }),
374
388
  " ",
375
- p("Outline")
389
+ u("Outline")
376
390
  ] }),
377
391
  /* @__PURE__ */ e.jsxs(L, { value: "data-provider", children: [
378
392
  /* @__PURE__ */ e.jsx(Ce, { className: "mr-2 w-3" }),
379
- p("Data")
393
+ u("Data")
380
394
  ] })
381
395
  ] }),
382
- /* @__PURE__ */ e.jsx(I, { value: o, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: f.createElement(P) }),
396
+ /* @__PURE__ */ e.jsx(I, { value: o, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: f.createElement(_) }),
383
397
  /* @__PURE__ */ e.jsx(I, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(ze, {}) })
384
398
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
385
399
  /* @__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(_, { className: "mr-2 h-3" }),
400
+ /* @__PURE__ */ e.jsx(P, { className: "mr-2 h-3" }),
387
401
  " ",
388
- p("Outline")
402
+ u("Outline")
389
403
  ] }),
390
- /* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2", children: f.createElement(P) })
404
+ /* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2", children: f.createElement(_) })
391
405
  ] })
392
406
  }
393
407
  ) })
394
408
  ] });
395
409
  };
396
410
  export {
397
- Ls as default
411
+ $s as default
398
412
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),b=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"),R=require("./index-5XyNUAjc.cjs"),a=require("./MODIFIERS-mVmfEGgo.cjs"),P=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("prop-types");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./html-to-json-NqRjgFqp.cjs");require("himalaya");require("lodash");require("react-wrap-balancer");require("@rjsf/core");require("@rjsf/validator-ajv8");require("react-autosuggest");require("fuse.js");require("./controls-rRZhz0vu.cjs");const I=({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(R.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(R.JsonView,{data:l,shouldExpandNode:R.allExpanded,style:{...R.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 _({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 K=()=>{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))),[N,h]=i.useState(""),[y,f]=i.useState(null),q=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:N,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")}),q.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(_,{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(I,{onClose:()=>f(null),provider:y})]})]})},L=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(b.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))})]})})]})]})}),B=i.lazy(()=>Promise.resolve().then(()=>require("./index-5XyNUAjc.cjs")).then(t=>t.AddBlocks)),T=i.lazy(()=>Promise.resolve().then(()=>require("./index-5XyNUAjc.cjs")).then(t=>t.ListTree$1)),A=i.lazy(()=>Promise.resolve().then(()=>require("./index-5XyNUAjc.cjs")).then(t=>t.ThemeConfigPanel$1)),O=i.lazy(()=>Promise.resolve().then(()=>require("./index-aeDphKpP.cjs")).then(t=>t.ImagesPanel)),U=i.lazy(()=>Promise.resolve().then(()=>require("./UILibrariesPanel-7btHgBD0.cjs"))),z=()=>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(B,{})})});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,N]=i.useState(null),{t:h}=v.useTranslation(),y=s.useBuilderProp("uiLibraries",[]),f=S.useChaiBlocks(),q=u.values(f).find(n=>n.category==="custom")!==void 0,w=y.length>0||q,g={"add-blocks":z,[a.OUTLINE_KEY]:T,"theme-configuration":A,images:O,"ui-libraries":U};u.each(t,({name:n,panel:k})=>{g[n]=k});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);N(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(b.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(b.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(b.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:k})=>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(k,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(L,{}),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:P.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(T)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(K,{})})]}):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=Y;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),i=require("react"),a=require("@radix-ui/react-icons"),r=require("./index-aeDphKpP.cjs"),p=require("./index-5XyNUAjc.cjs"),l=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");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("i18next");require("react-arborist");require("lucide-react");require("./index--mLLy7QQ.cjs");require("prop-types");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./html-to-json-NqRjgFqp.cjs");require("himalaya");require("lodash");require("react-wrap-balancer");require("@rjsf/core");require("@rjsf/validator-ajv8");require("react-autosuggest");require("fuse.js");require("./controls-rRZhz0vu.cjs");const m=()=>r.useBuilderProp("languages",["en"]),j=()=>m().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Select,{children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(a.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(r.SelectContent,{children:e.jsxRuntimeExports.jsxs(r.SelectGroup,{children:[e.jsxRuntimeExports.jsx(r.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),d=()=>{const{savePage:u,saveState:s}=r.useSavePage(),{t:n}=l.useTranslation(),x=r.useBuilderProp("hideSaveButton",!1),t=i.useMemo(()=>{switch(s){case"SAVING":return"animate-pulse bg-gray-300 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[s]);if(x)return null;const o=e.jsxRuntimeExports.jsxs(r.Button,{disabled:s==="SAVING",onClick:c=>{c.preventDefault(),u()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${t}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(p.FaCircleCheck,{className:"text-lg"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:s==="SAVING"?"Saving...":n(s==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},q=function(){const s=r.useBuilderProp("previewComponent"),[,n]=r.usePreviewMode(),{t:x}=l.useTranslation();return s?e.jsxRuntimeExports.jsxs(r.Button,{onClick:t=>{t.preventDefault(),n(!0)},className:"flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(a.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:x("Preview")})]}):null},h=()=>{const u=r.useBuilderProp("topBarComponents.left",[]),s=r.useBuilderProp("topBarComponents.center",[]),n=r.useBuilderProp("topBarComponents.right",[]),x=r.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:i.Children.toArray(u.map(t=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:i.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(j,{}),e.jsxRuntimeExports.jsx(q,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),x?e.jsxRuntimeExports.jsx(d,{}):null,i.Children.toArray(n.map(t=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=h;
@@ -1,8 +1,8 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import l, { useMemo as h, Suspense as c } from "react";
2
+ import l, { useMemo as h, Suspense as m } from "react";
3
3
  import { FontFamilyIcon as j, EyeOpenIcon as f } from "@radix-ui/react-icons";
4
- import { h as r, bs as g, bt as v, bu as b, bv as N, bz as S, bA as w, bw as o, ad as y, B as p, _ as C, $ as m, bB as B } from "./index-b33n_-zO.js";
5
- import { b as A } from "./index-wRAIA8zZ.js";
4
+ import { h as s, bw as g, bx as v, by as b, bz as N, bD as S, bE as w, bA as n, b9 as y, B as c, a2 as C, a3 as p, bF as B } from "./index-C7mB4XFm.js";
5
+ import { F as A } from "./index-lFgDm1oa.js";
6
6
  import { useTranslation as x } from "react-i18next";
7
7
  import "./_commonjsHelpers-UyOWmZb0.js";
8
8
  import "@radix-ui/react-toggle";
@@ -42,10 +42,25 @@ import "i18next";
42
42
  import "react-arborist";
43
43
  import "lucide-react";
44
44
  import "./index-VBXQixVm.js";
45
+ import "prop-types";
46
+ import "react-hotkeys-hook";
47
+ import "@floating-ui/dom";
45
48
  import "@floating-ui/react-dom";
46
49
  import "flagged";
47
- import "react-hotkeys-hook";
48
- const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(g, { children: [
50
+ import "@tailwindcss/typography";
51
+ import "@tailwindcss/forms";
52
+ import "@tailwindcss/aspect-ratio";
53
+ import "tailwindcss-palette-generator";
54
+ import "./html-to-json-l_mw5y-e.js";
55
+ import "himalaya";
56
+ import "lodash";
57
+ import "react-wrap-balancer";
58
+ import "@rjsf/core";
59
+ import "@rjsf/validator-ajv8";
60
+ import "react-autosuggest";
61
+ import "fuse.js";
62
+ import "./controls-yjgoZzB6.js";
63
+ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(g, { children: [
49
64
  /* @__PURE__ */ e.jsx(v, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
50
65
  b,
51
66
  {
@@ -57,14 +72,14 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
57
72
  ) }),
58
73
  /* @__PURE__ */ e.jsx(N, { children: /* @__PURE__ */ e.jsxs(S, { children: [
59
74
  /* @__PURE__ */ e.jsx(w, { children: "Fruits" }),
60
- /* @__PURE__ */ e.jsx(o, { value: "apple", children: "Apple" }),
61
- /* @__PURE__ */ e.jsx(o, { value: "banana", children: "Banana" }),
62
- /* @__PURE__ */ e.jsx(o, { value: "blueberry", children: "Blueberry" }),
63
- /* @__PURE__ */ e.jsx(o, { value: "grapes", children: "Grapes" }),
64
- /* @__PURE__ */ e.jsx(o, { value: "pineapple", children: "Pineapple" })
75
+ /* @__PURE__ */ e.jsx(n, { value: "apple", children: "Apple" }),
76
+ /* @__PURE__ */ e.jsx(n, { value: "banana", children: "Banana" }),
77
+ /* @__PURE__ */ e.jsx(n, { value: "blueberry", children: "Blueberry" }),
78
+ /* @__PURE__ */ e.jsx(n, { value: "grapes", children: "Grapes" }),
79
+ /* @__PURE__ */ e.jsx(n, { value: "pineapple", children: "Pineapple" })
65
80
  ] }) })
66
- ] }) }), I = () => {
67
- const { savePage: n, saveState: t } = y(), { t: a } = x(), i = r("hideSaveButton", !1), s = h(() => {
81
+ ] }) }), E = () => {
82
+ const { savePage: i, saveState: t } = y(), { t: a } = x(), o = s("hideSaveButton", !1), r = h(() => {
68
83
  switch (t) {
69
84
  case "SAVING":
70
85
  return "animate-pulse bg-gray-300 text-gray-900";
@@ -74,16 +89,16 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
74
89
  return "bg-gray-200 text-gray-500 hover:bg-gray-100";
75
90
  }
76
91
  }, [t]);
77
- if (i)
92
+ if (o)
78
93
  return null;
79
94
  const u = /* @__PURE__ */ e.jsxs(
80
- p,
95
+ c,
81
96
  {
82
97
  disabled: t === "SAVING",
83
98
  onClick: (d) => {
84
- d.preventDefault(), n();
99
+ d.preventDefault(), i();
85
100
  },
86
- className: `flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${s}`,
101
+ className: `flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${r}`,
87
102
  size: "sm",
88
103
  variant: "outline",
89
104
  children: [
@@ -93,43 +108,43 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
93
108
  }
94
109
  );
95
110
  return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: u });
96
- }, V = function() {
97
- const t = r("previewComponent"), [, a] = C(), { t: i } = x();
111
+ }, F = function() {
112
+ const t = s("previewComponent"), [, a] = C(), { t: o } = x();
98
113
  return t ? /* @__PURE__ */ e.jsxs(
99
- p,
114
+ c,
100
115
  {
101
- onClick: (s) => {
102
- s.preventDefault(), a(!0);
116
+ onClick: (r) => {
117
+ r.preventDefault(), a(!0);
103
118
  },
104
119
  className: "flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",
105
120
  size: "sm",
106
121
  variant: "outline",
107
122
  children: [
108
123
  /* @__PURE__ */ e.jsx(f, { className: "text-xs" }),
109
- /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: i("Preview") })
124
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: o("Preview") })
110
125
  ]
111
126
  }
112
127
  ) : null;
113
- }, Ce = () => {
114
- const n = r("topBarComponents.left", []), t = r("topBarComponents.center", []), a = r("topBarComponents.right", []), i = r("editable", !0);
128
+ }, Re = () => {
129
+ const i = s("topBarComponents.left", []), t = s("topBarComponents.center", []), a = s("topBarComponents.right", []), o = s("editable", !0);
115
130
  return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
116
131
  /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children: l.Children.toArray(
117
- n.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
132
+ i.map((r) => /* @__PURE__ */ e.jsx(m, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
118
133
  ) }) }),
119
134
  /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: l.Children.toArray(
120
- t.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
135
+ t.map((r) => /* @__PURE__ */ e.jsx(m, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
121
136
  ) }),
122
137
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
123
138
  /* @__PURE__ */ e.jsx(k, {}),
124
- /* @__PURE__ */ e.jsx(V, {}),
139
+ /* @__PURE__ */ e.jsx(F, {}),
125
140
  /* @__PURE__ */ e.jsx(B, { orientation: "vertical" }),
126
- i ? /* @__PURE__ */ e.jsx(I, {}) : null,
141
+ o ? /* @__PURE__ */ e.jsx(E, {}) : null,
127
142
  l.Children.toArray(
128
- a.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
143
+ a.map((r) => /* @__PURE__ */ e.jsx(m, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
129
144
  )
130
145
  ] })
131
146
  ] });
132
147
  };
133
148
  export {
134
- Ce as default
149
+ Re as default
135
150
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("lodash-es"),f=require("react"),s=require("./index-aeDphKpP.cjs"),y=require("@chaibuilder/runtime"),I=require("lucide-react"),q=require("jotai"),C=require("./Functions-N3yhPYKY.cjs"),B=require("@radix-ui/react-icons"),L=require("./MODIFIERS-mVmfEGgo.cjs"),S=require("react-i18next"),T=require("./index-5XyNUAjc.cjs"),A=require("clsx"),P=require("flagged");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");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("prop-types");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./html-to-json-NqRjgFqp.cjs");require("himalaya");require("lodash");require("react-wrap-balancer");require("@rjsf/core");require("@rjsf/validator-ajv8");require("react-autosuggest");require("fuse.js");require("./controls-rRZhz0vu.cjs");function O(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(i,o,l.get?l:{enumerable:!0,get:()=>t[o]})}}return i.default=t,Object.freeze(i)}const D=O(f);function _({uiLibraries:t,library:i,setLibrary:o}){var p;const[l,x]=D.useState(!1),{t:n}=S.useTranslation();return i?e.jsxRuntimeExports.jsxs(s.Popover,{open:l,onOpenChange:x,children:[e.jsxRuntimeExports.jsx(s.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("span",{children:n("Choose Library")}),e.jsxRuntimeExports.jsxs(s.Button,{variant:"outline",size:"sm",role:"combobox","aria-expanded":l,className:"w-[200px] justify-between",children:[i?(p=t.find(u=>u.uuid===i))==null?void 0:p.name:n("Select library"),e.jsxRuntimeExports.jsx(B.CaretSortIcon,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})]})}),e.jsxRuntimeExports.jsx(s.PopoverContent,{className:"w-[200px] p-0",children:e.jsxRuntimeExports.jsxs(s.Command,{children:[e.jsxRuntimeExports.jsx(s.CommandInput,{placeholder:"Search library...",className:"h-9"}),e.jsxRuntimeExports.jsxs(s.CommandList,{children:[e.jsxRuntimeExports.jsx(s.CommandEmpty,{children:"No library found."}),e.jsxRuntimeExports.jsx(s.CommandGroup,{children:t.map(u=>e.jsxRuntimeExports.jsxs(s.CommandItem,{value:u.uuid,onSelect:j=>{o(j),x(!1)},children:[u.name,e.jsxRuntimeExports.jsx(B.CheckIcon,{className:C.cn("ml-auto h-4 w-4",i===u.uuid?"opacity-100":"opacity-0")})]},u.uuid))})]})]})})]}):null}const M=({block:t,closePopover:i,library:o})=>{const[l,x]=f.useState(!1),n=s.useBuilderProp("getUILibraryBlock",r.noop),{addCoreBlock:p,addPredefinedBlock:u}=s.useAddBlock(),[j,E]=s.useSelectedBlockIds(),[,R]=s.useHighlightBlockId(),g=r.get(t,"name",r.get(t,"label")),b=P.useFeature("dnd"),[,k]=q.useAtom(T.draggedBlockAtom),a=c=>{const m=r.has(c,"styles_attrs.data-page-section");return c._type==="Box"&&m},v=f.useCallback(async c=>{if(c.stopPropagation(),r.has(t,"component")){p(t,r.first(j)),i();return}x(!0);const m=await n(o,t);let h=r.first(j);a(r.first(m))&&(h=null),r.isEmpty(m)||u(y.syncBlocksWithDefaults(m),h),i()},[t]),d=async c=>{const m=await n(o,t);let h=r.first(j);if(a(r.first(m))&&(h=null),!r.isEmpty(m)){const N={blocks:m,uiLibrary:!0,parent:h};if(c.dataTransfer.setData("text/plain",JSON.stringify(N)),t.preview){const w=new Image;w.src=t.preview,w.onload=()=>{c.dataTransfer.setDragImage(w,0,0)}}else c.dataTransfer.setDragImage(new Image,0,0);k(N),setTimeout(()=>{E([]),R(null),i()},200)}};return e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{onClick:l?()=>{}:v,draggable:b?"true":"false",onDragStart:d,className:A("relative mt-2 cursor-pointer overflow-hidden rounded-md border border-gray-300 bg-white duration-200 hover:border-blue-500 hover:shadow-xl"),children:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black/70",children:[e.jsxRuntimeExports.jsx(I.Loader,{className:"animate-spin",size:15,color:"white"}),e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[25px] w-full rounded-md",alt:g}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:g})})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:g})})]})},U=q.atom({}),z=t=>{const[i,o]=q.useAtom(U),l=s.useBuilderProp("getUILibraryBlocks",r.noop),x=r.get(i,`${t==null?void 0:t.uuid}.blocks`,[]),n=r.get(i,`${t==null?void 0:t.uuid}.loading`,!1);return f.useEffect(()=>{(async()=>{if(n||x.length>0||!t)return;o(u=>({...u,[t==null?void 0:t.uuid]:{loading:!0,blocks:[]}}));const p=await l(t);o(u=>({...u,[t==null?void 0:t.uuid]:{loading:!1,blocks:p||[]}}))})()},[t,x,n]),{data:x,isLoading:n}},F=s.atomWithStorage("_selectedLibrary",null),G=()=>{const[t,i]=q.useAtom(F),o=s.useBuilderProp("uiLibraries",[]),l=y.useChaiBlocks(),x=r.values(l).filter(d=>d.category==="custom"),n=o.find(d=>d.uuid===t)||r.first(o),{data:p,isLoading:u}=z(n),j=r.groupBy([...p,...x],"group"),[E,R]=f.useState("Hero"),[,g]=q.useAtom(s.activePanelAtom),b=r.get(j,E,[]),{t:k}=S.useTranslation(),a=f.useRef(null),v=d=>{a.current&&(clearTimeout(a.current),a.current=null),a.current=setTimeout(()=>{a.current&&R(d)},300)};return u?e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-full w-full"}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full w-[460px] flex-col overflow-hidden bg-background",children:[n!=null&&n.uuid?e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex h-fit flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"flex w-full flex-col items-baseline truncate px-1 text-sm font-semibold xl:flex-col",children:e.jsxRuntimeExports.jsx(_,{library:n==null?void 0:n.uuid,setLibrary:i,uiLibraries:o})})})}):null,e.jsxRuntimeExports.jsxs("div",{className:"flex h-[95%] border-t border-gray-300 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex h-full w-40 flex-col gap-1 px-1",children:f.Children.toArray(r.map(j,(d,c)=>e.jsxRuntimeExports.jsxs("div",{onMouseEnter:()=>v(c),onMouseLeave:()=>clearTimeout(a.current),onClick:()=>R(c),className:C.cn("flex w-full cursor-pointer items-center justify-between rounded-md p-1 text-sm transition-all ease-in-out hover:bg-gray-200",c===E?"bg-blue-500 text-white hover:bg-blue-600":""),children:[e.jsxRuntimeExports.jsx("span",{children:r.capitalize(c)}),e.jsxRuntimeExports.jsx(B.CaretRightIcon,{className:"ml-2 h-5 w-5"})]},c)))}),e.jsxRuntimeExports.jsxs(s.ScrollArea,{onMouseEnter:()=>a.current?clearTimeout(a.current):null,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",children:[e.jsxRuntimeExports.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:k("Click on a block to add it to the page")}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2 px-2",children:f.Children.toArray(b.map(d=>e.jsxRuntimeExports.jsx(M,{block:d,library:n,closePopover:()=>g(L.OUTLINE_KEY)})))}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{})]})]})]})})},H=()=>e.jsxRuntimeExports.jsx(G,{});exports.default=H;