@chaibuilder/sdk 1.2.32 → 1.2.34

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 (103) hide show
  1. package/dist/{AddBlocks-0eVRNr1d.js → AddBlocks-RmEkZXdE.js} +37 -33
  2. package/dist/AddBlocks-XYCWUol8.cjs +1 -0
  3. package/dist/{BrandingOptions-yYAznnw2.js → BrandingOptions-TnzCIC7A.js} +37 -31
  4. package/dist/BrandingOptions-qnaKl27s.cjs +1 -0
  5. package/dist/CanvasArea-SeSRWHy0.js +1200 -0
  6. package/dist/CanvasArea-iIwERFUC.cjs +55 -0
  7. package/dist/ChaiBuilderEditor-YqEKonJ_.cjs +206 -0
  8. package/dist/{index-AJalHhkO.js → ChaiBuilderEditor-y1NxvXJ7.js} +24114 -20836
  9. package/dist/{CurrentPage-1v40uk8K.js → CurrentPage-9KDre_9q.js} +19 -19
  10. package/dist/CurrentPage-TNff16tH.cjs +1 -0
  11. package/dist/ListTree-GxCAsv2Y.cjs +1 -0
  12. package/dist/{ListTree-0ZrRreCs.js → ListTree-H2WaKwOs.js} +81 -76
  13. package/dist/PagesPanel-5DRsqV-G.cjs +1 -0
  14. package/dist/{PagesPanel-AxQX-BX2.js → PagesPanel-jHMmJEtv.js} +14 -14
  15. package/dist/ProjectPanel-CDnnGpVo.cjs +1 -0
  16. package/dist/{ProjectPanel-GYdge5v9.js → ProjectPanel-uxhq_D3j.js} +16 -16
  17. package/dist/Settings-nGnVavh4.cjs +1 -0
  18. package/dist/{Settings-9JAzGHau.js → Settings-yqZksAbO.js} +53 -53
  19. package/dist/{SidePanels-bLwsW29O.js → SidePanels-1gwirESt.js} +70 -70
  20. package/dist/SidePanels-33KNaSS3.cjs +1 -0
  21. package/dist/{Topbar-0Ql8pHVc.js → Topbar-NHF8D1di.js} +19 -14
  22. package/dist/Topbar-Wwdd9Flx.cjs +1 -0
  23. package/dist/{UnsplashImages-NYwOOgYa.js → UnsplashImages-LLu2wFeN.js} +26 -21
  24. package/dist/UnsplashImages-lnz6NfSD.cjs +1 -0
  25. package/dist/UploadImages-3nl_4mDf.cjs +1 -0
  26. package/dist/{UploadImages-vpZeW-YW.js → UploadImages-FtvaDyk9.js} +33 -27
  27. package/dist/{add-page-modal-hDyzsEU7.js → add-page-modal-V9DTBMmY.js} +22 -22
  28. package/dist/add-page-modal-sIZk552b.cjs +1 -0
  29. package/dist/confirm-alert-Uzq5XNGt.cjs +1 -0
  30. package/dist/{confirm-alert-FGQKKQJU.js → confirm-alert-sI4pItIN.js} +16 -10
  31. package/dist/{controls-OfJWSEqC.js → controls-VTdJhdSz.js} +44 -41
  32. package/dist/controls-jWJDao88.cjs +1 -0
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.d.ts +9 -0
  35. package/dist/core.js +46 -45
  36. package/dist/delete-page-modal-UminFzYh.cjs +1 -0
  37. package/dist/{delete-page-modal-KxeyBri2.js → delete-page-modal-XrIpujav.js} +15 -15
  38. package/dist/email-blocks.cjs +1 -1
  39. package/dist/email-blocks.js +1 -1
  40. package/dist/email.cjs +1 -1
  41. package/dist/email.d.ts +9 -0
  42. package/dist/email.js +18 -16
  43. package/dist/{form-77dY98bF.js → form-dQQ2tTRZ.js} +7 -7
  44. package/dist/form-q7lxaK3j.cjs +1 -0
  45. package/dist/functions-ge87TVcc.js +30 -0
  46. package/dist/functions-sBiIevFh.cjs +1 -0
  47. package/dist/{index-5zkCTSAM.js → index-OsS2_gM8.js} +28 -29
  48. package/dist/index-eYwpNzUl.cjs +1 -0
  49. package/dist/lib.cjs +2 -2
  50. package/dist/lib.d.ts +2 -0
  51. package/dist/lib.js +12 -10
  52. package/dist/{page-viewer-umQaut1j.js → page-viewer-AoJ5HU6j.js} +21 -21
  53. package/dist/page-viewer-FzhqSyNO.cjs +1 -0
  54. package/dist/project-general-setting-WzJ8U1OW.cjs +1 -0
  55. package/dist/{project-general-setting-uuCemMCU.js → project-general-setting-g3YJYszB.js} +24 -24
  56. package/dist/{project-seo-setting-asvbPQiI.js → project-seo-setting-1sLmV-wv.js} +26 -20
  57. package/dist/project-seo-setting-GuObNafp.cjs +1 -0
  58. package/dist/render.cjs +1 -1
  59. package/dist/render.d.ts +2 -0
  60. package/dist/render.js +55 -53
  61. package/dist/single-page-detail-WGars7Tl.cjs +1 -0
  62. package/dist/{single-page-detail-F6pKWyq1.js → single-page-detail-sQ3BH6Rc.js} +25 -25
  63. package/dist/studio.cjs +1 -1
  64. package/dist/studio.d.ts +9 -0
  65. package/dist/studio.js +13 -13
  66. package/dist/ui.cjs +1 -1
  67. package/dist/ui.js +153 -147
  68. package/dist/useCanvasSettings-QcsmJd9b.cjs +1 -0
  69. package/dist/{useCanvasSettings-ikt217kv.js → useCanvasSettings-XwFRrknO.js} +1 -1
  70. package/dist/web-blocks.cjs +4 -4
  71. package/dist/web-blocks.js +137 -113
  72. package/package.json +9 -3
  73. package/dist/AddBlocks-t0hKDSud.cjs +0 -1
  74. package/dist/BrandingOptions-NVmCxZfD.cjs +0 -1
  75. package/dist/CanvasArea-2b4oSjRx.js +0 -1177
  76. package/dist/CanvasArea-OzyCq6UU.cjs +0 -55
  77. package/dist/CurrentPage-YBMhEBZG.cjs +0 -1
  78. package/dist/ListTree-jPwxgI6R.cjs +0 -1
  79. package/dist/PagesPanel-ivEL9tIQ.cjs +0 -1
  80. package/dist/ProjectPanel-shgvg_yT.cjs +0 -1
  81. package/dist/Settings-MMwEBADN.cjs +0 -1
  82. package/dist/SidePanels-iaaRCUeQ.cjs +0 -1
  83. package/dist/Topbar-CkUhCnSW.cjs +0 -1
  84. package/dist/UnsplashImages-juwtWvXe.cjs +0 -1
  85. package/dist/UploadImages-4_jmnoVi.cjs +0 -1
  86. package/dist/add-page-modal-2ZPjc54F.cjs +0 -1
  87. package/dist/confirm-alert-QRxOc76t.cjs +0 -1
  88. package/dist/controls-KK2oLIa8.cjs +0 -1
  89. package/dist/delete-page-modal--N1nPPIL.cjs +0 -1
  90. package/dist/form-hT5dGoJH.cjs +0 -1
  91. package/dist/functions-I6BoMqqb.js +0 -21
  92. package/dist/functions-r3ExvGGf.cjs +0 -1
  93. package/dist/index-FPBudsRF.cjs +0 -1
  94. package/dist/index-JIcsKKoG.cjs +0 -1
  95. package/dist/index-YpnaudSM.js +0 -63
  96. package/dist/index-ecnGWzh9.cjs +0 -1
  97. package/dist/index-hH5SIZ29.js +0 -3116
  98. package/dist/index-sJ9Uc9UY.cjs +0 -206
  99. package/dist/page-viewer-k-g15j8B.cjs +0 -1
  100. package/dist/project-general-setting-1leAiCJQ.cjs +0 -1
  101. package/dist/project-seo-setting-kDBSOzgX.cjs +0 -1
  102. package/dist/single-page-detail-IFtVxwl5.cjs +0 -1
  103. package/dist/useCanvasSettings-Am2o80hW.cjs +0 -1
@@ -1,31 +1,34 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import { KeyboardIcon as U, PlusIcon as J, Half2Icon as W } from "@radix-ui/react-icons";
3
- import j, { useState as p, useEffect as Y, useMemo as Z, memo as q, lazy as w, Suspense as N } from "react";
2
+ import { KeyboardIcon as U, PlusIcon as J, Half2Icon as Z } from "@radix-ui/react-icons";
3
+ import j, { useState as h, useEffect as W, useMemo as Y, memo as $, lazy as w, Suspense as N } from "react";
4
4
  import { useAtom as O } from "jotai";
5
- import { filter as y, map as K, isNull as $, find as G, isEmpty as Q, each as X, get as ee } from "lodash-es";
6
- import { ad as M, ae as H, af as F, ag as R, ah as se, A as re, a as ae, b as le, c as ie, d as te, e as oe, f as ne, g as ce, ai as de, y as me, C as xe, aj as pe, ak as he, al as ue, am as fe, an as E, ao as je, ap as ve, aq as ge, B as v, ar as be, as as B, h as T, at as Ne, S as z, au as V, av as I, aw as A, ax as S } from "./index-hH5SIZ29.js";
7
- import { ListTreeIcon as _, DatabaseIcon as ye } from "lucide-react";
8
- import { getChaiDataProviders as we } from "@chaibuilder/runtime";
5
+ import { filter as y, map as K, isNull as q, find as G, isEmpty as Q, each as X, get as ee } from "lodash-es";
6
+ import { Z as M, _ as H, $ as F, a0 as R, a1 as se, a2 as re, A as ae, a as le, b as ie, c as te, d as oe, e as ne, f as ce, g as de, a3 as me, a4 as xe, a5 as he, a6 as pe, a7 as ue, a8 as fe, a9 as je, aa as E, ab as ve, ac as ge, ad as be, B as v, ae as Ne, af as B, h as T, ag as ye, ah as z, ai as V, aj as I, ak as _, al as A } from "./ChaiBuilderEditor-y1NxvXJ7.js";
7
+ import { ListTreeIcon as S, DatabaseIcon as we } from "lucide-react";
8
+ import { getChaiDataProviders as ke } from "@chaibuilder/runtime";
9
9
  import { useTranslation as g } from "react-i18next";
10
- import { J as ke, a as Ce, d as De } from "./index-e0c8PmRQ.js";
11
- import { E as Te } from "./index-AJalHhkO.js";
10
+ import { J as De, a as Ce, d as Te } from "./index-e0c8PmRQ.js";
12
11
  import { O as i } from "./STRINGS--j49GZJP.js";
13
- import { c as Ae } from "./Functions-7jnEwJyw.js";
12
+ import { c as _e } from "./Functions-7jnEwJyw.js";
14
13
  import "./_commonjsHelpers-UyOWmZb0.js";
14
+ import "clsx";
15
+ import "react-dom";
16
+ import "@radix-ui/react-scroll-area";
17
+ import "@floating-ui/react-dom";
18
+ import "i18next";
19
+ import "flagged";
15
20
  import "@react-hookz/web";
16
21
  import "./MODIFIERS-cBT31iqE.js";
17
- import "./Class-6Hz2KzYb.js";
18
- import "clsx";
19
- import "tailwind-merge";
20
22
  import "@radix-ui/react-toggle";
21
23
  import "class-variance-authority";
24
+ import "./Class-6Hz2KzYb.js";
25
+ import "tailwind-merge";
22
26
  import "@radix-ui/react-switch";
23
27
  import "@radix-ui/react-slot";
24
28
  import "@radix-ui/react-accordion";
25
29
  import "@radix-ui/react-alert-dialog";
26
30
  import "@radix-ui/react-dialog";
27
31
  import "@radix-ui/react-label";
28
- import "@radix-ui/react-scroll-area";
29
32
  import "@radix-ui/react-tabs";
30
33
  import "@radix-ui/react-tooltip";
31
34
  import "@radix-ui/react-popover";
@@ -38,16 +41,13 @@ import "@radix-ui/react-toast";
38
41
  import "cmdk";
39
42
  import "@radix-ui/react-context-menu";
40
43
  import "react-icons-picker";
41
- import "react-dom";
42
44
  import "react-quill";
43
- import "i18next";
44
- import "@floating-ui/react-dom";
45
- import "flagged";
46
45
  import "react-hotkeys-hook";
47
- const Se = ({ provider: s, onClose: o }) => {
48
- const { t: l } = g(), [a, h] = p(null);
49
- return Y(() => {
50
- s && (s.mockFn ? s.mockFn : s.dataFn)().then((n) => h(n));
46
+ import "lodash";
47
+ const Ae = ({ provider: s, onClose: o }) => {
48
+ const { t: l } = g(), [a, p] = h(null);
49
+ return W(() => {
50
+ s && (s.mockFn ? s.mockFn : s.dataFn)().then((n) => p(n));
51
51
  }, [s]), s ? /* @__PURE__ */ e.jsx(M, { onOpenChange: (d) => d ? "" : o(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
52
52
  /* @__PURE__ */ e.jsxs(F, { children: [
53
53
  /* @__PURE__ */ e.jsxs(R, { children: [
@@ -57,13 +57,13 @@ const Se = ({ provider: s, onClose: o }) => {
57
57
  ] }),
58
58
  /* @__PURE__ */ e.jsx(se, { children: s.description })
59
59
  ] }),
60
- /* @__PURE__ */ e.jsx(Te, { children: /* @__PURE__ */ e.jsx(
61
- ke,
60
+ /* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsx(
61
+ De,
62
62
  {
63
63
  data: a,
64
64
  shouldExpandNode: Ce,
65
65
  style: {
66
- ...De,
66
+ ...Te,
67
67
  container: "max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
68
68
  stringValue: "text-orange-600",
69
69
  label: "text-green-900 font-semibold pr-1 tracking-wider"
@@ -72,42 +72,42 @@ const Se = ({ provider: s, onClose: o }) => {
72
72
  ) })
73
73
  ] }) }) : null;
74
74
  };
75
- function _e({
75
+ function Se({
76
76
  children: s,
77
77
  name: o,
78
78
  onRemove: l
79
79
  }) {
80
80
  const { t: a } = g();
81
- return /* @__PURE__ */ e.jsxs(re, { children: [
82
- /* @__PURE__ */ e.jsx(ae, { asChild: !0, children: s }),
83
- /* @__PURE__ */ e.jsxs(le, { children: [
84
- /* @__PURE__ */ e.jsxs(ie, { children: [
81
+ return /* @__PURE__ */ e.jsxs(ae, { children: [
82
+ /* @__PURE__ */ e.jsx(le, { asChild: !0, children: s }),
83
+ /* @__PURE__ */ e.jsxs(ie, { children: [
84
+ /* @__PURE__ */ e.jsxs(te, { children: [
85
85
  /* @__PURE__ */ e.jsx(
86
- te,
86
+ oe,
87
87
  {
88
88
  dangerouslySetInnerHTML: { __html: a("remove_provider_confirmation").replace("{name}", o) }
89
89
  }
90
90
  ),
91
- /* @__PURE__ */ e.jsx(oe, { children: a("remove_provider_warning") })
91
+ /* @__PURE__ */ e.jsx(ne, { children: a("remove_provider_warning") })
92
92
  ] }),
93
- /* @__PURE__ */ e.jsxs(ne, { children: [
94
- /* @__PURE__ */ e.jsx(ce, { children: a("cancel") }),
95
- /* @__PURE__ */ e.jsx(de, { onClick: l, className: "bg-red-600 hover:bg-red-700", children: a("remove") })
93
+ /* @__PURE__ */ e.jsxs(ce, { children: [
94
+ /* @__PURE__ */ e.jsx(de, { children: a("cancel") }),
95
+ /* @__PURE__ */ e.jsx(me, { onClick: l, className: "bg-red-600 hover:bg-red-700", children: a("remove") })
96
96
  ] })
97
97
  ] })
98
98
  ] });
99
99
  }
100
100
  const Pe = () => {
101
- const { t: s } = g(), o = Z(() => we(), []), [l, a] = me(), [, h] = O(xe), [d, n] = p(
101
+ const { t: s } = g(), o = Y(() => ke(), []), [l, a] = xe(), [, p] = O(he), [d, n] = h(
102
102
  y(o, (r) => K(l, "providerKey").includes(r.providerKey))
103
- ), [k, u] = p(""), [b, c] = p(null), C = y(
103
+ ), [k, u] = h(""), [b, c] = h(null), D = y(
104
104
  o.map((r) => K(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
105
- (r) => !$(r)
106
- ), D = (r) => {
105
+ (r) => !q(r)
106
+ ), C = (r) => {
107
107
  const x = G(o, { providerKey: r });
108
- n((m) => [...m, x]), a((m) => [...m, { providerKey: x.providerKey, args: {} }]), u(""), h("UNSAVED");
108
+ n((m) => [...m, x]), a((m) => [...m, { providerKey: x.providerKey, args: {} }]), u(""), p("UNSAVED");
109
109
  }, t = (r) => {
110
- n((x) => y(x, (m) => m.providerKey !== r.providerKey)), a((x) => y(x, (m) => m.providerKey !== r.providerKey)), h("UNSAVED");
110
+ n((x) => y(x, (m) => m.providerKey !== r.providerKey)), a((x) => y(x, (m) => m.providerKey !== r.providerKey)), p("UNSAVED");
111
111
  }, f = (r) => c(r);
112
112
  return Q(o) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
113
113
  s("no_data_providers"),
@@ -116,11 +116,11 @@ const Pe = () => {
116
116
  ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
117
117
  /* @__PURE__ */ e.jsx("br", {}),
118
118
  /* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: s("add_data_providers") }) }),
119
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(pe, { value: k, onValueChange: (r) => D(r), children: [
120
- /* @__PURE__ */ e.jsx(he, { className: "w-full", children: /* @__PURE__ */ e.jsx(ue, { placeholder: s("select_provider") }) }),
121
- /* @__PURE__ */ e.jsxs(fe, { children: [
119
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(pe, { value: k, onValueChange: (r) => C(r), children: [
120
+ /* @__PURE__ */ e.jsx(ue, { className: "w-full", children: /* @__PURE__ */ e.jsx(fe, { placeholder: s("select_provider") }) }),
121
+ /* @__PURE__ */ e.jsxs(je, { children: [
122
122
  /* @__PURE__ */ e.jsx(E, { value: "", children: s("choose") }),
123
- C.map((r) => /* @__PURE__ */ e.jsx(E, { value: r.value, children: r.label }, r.value))
123
+ D.map((r) => /* @__PURE__ */ e.jsx(E, { value: r.value, children: r.label }, r.value))
124
124
  ] })
125
125
  ] }) }),
126
126
  /* @__PURE__ */ e.jsx("br", {}),
@@ -169,7 +169,7 @@ const Pe = () => {
169
169
  ]
170
170
  }
171
171
  ),
172
- /* @__PURE__ */ e.jsx(_e, { onRemove: () => t(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: [
172
+ /* @__PURE__ */ e.jsx(Se, { onRemove: () => t(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: [
173
173
  /* @__PURE__ */ e.jsxs(
174
174
  "svg",
175
175
  {
@@ -197,10 +197,10 @@ const Pe = () => {
197
197
  },
198
198
  r.providerKey
199
199
  )) }),
200
- /* @__PURE__ */ e.jsx(Se, { onClose: () => c(null), provider: b })
200
+ /* @__PURE__ */ e.jsx(Ae, { onClose: () => c(null), provider: b })
201
201
  ] })
202
202
  ] });
203
- }, Ke = q(() => {
203
+ }, Ke = $(() => {
204
204
  const { t: s } = g(), o = {
205
205
  "ctrl + Z": "Undo",
206
206
  "ctrl + Y": "Redo",
@@ -212,9 +212,9 @@ const Pe = () => {
212
212
  del: "Delete block"
213
213
  };
214
214
  return /* @__PURE__ */ e.jsxs(M, { children: [
215
- /* @__PURE__ */ e.jsx(je, { children: /* @__PURE__ */ e.jsxs(ve, { children: [
216
- /* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsx(v, { size: "sm", className: "w-10", variant: "outline", children: /* @__PURE__ */ e.jsx(U, {}) }) }),
217
- /* @__PURE__ */ e.jsx(be, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
215
+ /* @__PURE__ */ e.jsx(ve, { children: /* @__PURE__ */ e.jsxs(ge, { children: [
216
+ /* @__PURE__ */ e.jsx(be, { children: /* @__PURE__ */ e.jsx(v, { size: "sm", className: "w-10", variant: "outline", children: /* @__PURE__ */ e.jsx(U, {}) }) }),
217
+ /* @__PURE__ */ e.jsx(Ne, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
218
218
  ] }) }),
219
219
  /* @__PURE__ */ e.jsxs(H, { className: "sm:max-w-[525px]", children: [
220
220
  /* @__PURE__ */ e.jsx(F, { children: /* @__PURE__ */ e.jsx(R, { children: s("Keyboard shortcuts") }) }),
@@ -230,10 +230,10 @@ const Pe = () => {
230
230
  ] }) })
231
231
  ] })
232
232
  ] });
233
- }), Ee = w(() => import("./AddBlocks-0eVRNr1d.js")), P = w(() => import("./ListTree-0ZrRreCs.js")), Be = w(() => import("./BrandingOptions-yYAznnw2.js")), ze = w(() => import("./index-hH5SIZ29.js").then((s) => s.cu));
233
+ }), Ee = w(() => import("./AddBlocks-RmEkZXdE.js")), P = w(() => import("./ListTree-H2WaKwOs.js")), Be = w(() => import("./BrandingOptions-TnzCIC7A.js")), ze = w(() => import("./ChaiBuilderEditor-y1NxvXJ7.js").then((s) => s.cn));
234
234
  let L = null;
235
- const As = () => {
236
- const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [l, a] = O(Ne), [h, d] = p(l), [n, k] = p(null), { t: u } = g(), b = {
235
+ const _s = () => {
236
+ const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [l, a] = O(ye), [p, d] = h(l), [n, k] = h(null), { t: u } = g(), b = {
237
237
  "add-blocks": Ee,
238
238
  [i]: P,
239
239
  "branding-options": Be,
@@ -244,8 +244,8 @@ const As = () => {
244
244
  });
245
245
  const c = (t) => {
246
246
  clearTimeout(L), l !== i && t === i ? L = setTimeout(() => a(i), 500) : d(t), a(t);
247
- }, C = T("dataBindingSupport", !1);
248
- function D() {
247
+ }, D = T("dataBindingSupport", !1);
248
+ function C() {
249
249
  const t = setTimeout(() => {
250
250
  n && (c(i), clearTimeout(n));
251
251
  }, 500);
@@ -255,7 +255,7 @@ const As = () => {
255
255
  l !== i ? /* @__PURE__ */ e.jsx(
256
256
  "div",
257
257
  {
258
- onMouseEnter: D,
258
+ onMouseEnter: C,
259
259
  onClick: () => c(i),
260
260
  className: "fixed inset-0 z-[50] bg-black/20"
261
261
  }
@@ -279,7 +279,7 @@ const As = () => {
279
279
  onClick: () => c(i),
280
280
  size: "sm",
281
281
  variant: l === i ? "default" : "outline",
282
- children: /* @__PURE__ */ e.jsx(_, { className: "w-4" })
282
+ children: /* @__PURE__ */ e.jsx(S, { className: "w-4" })
283
283
  }
284
284
  ),
285
285
  /* @__PURE__ */ e.jsx(
@@ -288,7 +288,7 @@ const As = () => {
288
288
  onClick: () => c("branding-options"),
289
289
  size: "sm",
290
290
  variant: l === "branding-options" ? "default" : "outline",
291
- children: /* @__PURE__ */ e.jsx(W, { className: "w-4 max-w-[40px] text-xs" })
291
+ children: /* @__PURE__ */ e.jsx(Z, { className: "w-4 max-w-[40px] text-xs" })
292
292
  }
293
293
  ),
294
294
  j.Children.toArray(
@@ -326,7 +326,7 @@ const As = () => {
326
326
  children: /* @__PURE__ */ e.jsx(
327
327
  "div",
328
328
  {
329
- className: Ae("relative z-[100] h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1"),
329
+ className: _e("relative z-[100] h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1"),
330
330
  onMouseEnter: () => {
331
331
  n && clearTimeout(n);
332
332
  },
@@ -345,28 +345,28 @@ const As = () => {
345
345
  /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
346
346
  /* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
347
347
  ] }),
348
- children: C ? /* @__PURE__ */ e.jsxs(V, { defaultValue: i, className: "flex h-full w-full flex-col py-1", children: [
348
+ children: D ? /* @__PURE__ */ e.jsxs(V, { defaultValue: i, className: "flex h-full w-full flex-col py-1", children: [
349
349
  /* @__PURE__ */ e.jsxs(I, { className: "mx-1 grid h-10 grid-cols-2", children: [
350
- /* @__PURE__ */ e.jsxs(A, { value: i, children: [
351
- /* @__PURE__ */ e.jsx(_, { className: "mr-2 h-3" }),
350
+ /* @__PURE__ */ e.jsxs(_, { value: i, children: [
351
+ /* @__PURE__ */ e.jsx(S, { className: "mr-2 h-3" }),
352
352
  " ",
353
353
  u("Outline")
354
354
  ] }),
355
- /* @__PURE__ */ e.jsxs(A, { value: "data-provider", children: [
356
- /* @__PURE__ */ e.jsx(ye, { className: "mr-2 w-3" }),
355
+ /* @__PURE__ */ e.jsxs(_, { value: "data-provider", children: [
356
+ /* @__PURE__ */ e.jsx(we, { className: "mr-2 w-3" }),
357
357
  u("Data")
358
358
  ] })
359
359
  ] }),
360
- /* @__PURE__ */ e.jsx(S, { value: i, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: j.createElement(P) }),
361
- /* @__PURE__ */ e.jsx(S, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(Pe, {}) })
360
+ /* @__PURE__ */ e.jsx(A, { value: i, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: j.createElement(P) }),
361
+ /* @__PURE__ */ e.jsx(A, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(Pe, {}) })
362
362
  ] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(V, { defaultValue: i, className: "flex h-full w-full flex-col py-1", children: [
363
- /* @__PURE__ */ e.jsx(I, { className: "mx-1 grid h-10 grid-cols-1", children: /* @__PURE__ */ e.jsxs(A, { value: i, children: [
364
- /* @__PURE__ */ e.jsx(_, { className: "mr-2 h-3" }),
363
+ /* @__PURE__ */ e.jsx(I, { className: "mx-1 grid h-10 grid-cols-1", children: /* @__PURE__ */ e.jsxs(_, { value: i, children: [
364
+ /* @__PURE__ */ e.jsx(S, { className: "mr-2 h-3" }),
365
365
  " ",
366
366
  u("Outline")
367
367
  ] }) }),
368
368
  /* @__PURE__ */ e.jsx(
369
- S,
369
+ A,
370
370
  {
371
371
  value: i,
372
372
  className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",
@@ -379,5 +379,5 @@ const As = () => {
379
379
  ] });
380
380
  };
381
381
  export {
382
- As as default
382
+ _s as default
383
383
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),q=require("@radix-ui/react-icons"),i=require("react"),S=require("jotai"),u=require("lodash-es"),s=require("./ChaiBuilderEditor-YqEKonJ_.cjs"),R=require("lucide-react"),_=require("@chaibuilder/runtime"),f=require("react-i18next"),w=require("./index-gi1LIOCw.cjs"),l=require("./STRINGS-gPz7CUOk.cjs"),D=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.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-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lodash");const K=({provider:t,onClose:a})=>{const{t:o}=f.useTranslation(),[n,h]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(c=>h(c))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:m=>m?"":a(),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(s.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(w.JsonView,{data:n,shouldExpandNode:w.allExpanded,style:{...w.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 C({children:t,name:a,onRemove:o}){const{t:n}=f.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:n("remove_provider_confirmation").replace("{name}",a)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:n("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:n("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:n("remove")})]})]})]})}const I=()=>{const{t}=f.useTranslation(),a=i.useMemo(()=>_.getChaiDataProviders(),[]),[o,n]=s.usePageDataProviders(),[,h]=S.useAtom(s.builderSaveStateAtom),[m,c]=i.useState(u.filter(a,r=>u.map(o,"providerKey").includes(r.providerKey))),[b,E]=i.useState(""),[g,d]=i.useState(null),N=u.filter(a.map(r=>u.map(m,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!u.isNull(r)),y=r=>{const p=u.find(a,{providerKey:r});c(j=>[...j,p]),n(j=>[...j,{providerKey:p.providerKey,args:{}}]),E(""),h("UNSAVED")},x=r=>{c(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),n(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),h("UNSAVED")},v=r=>d(r);return u.isEmpty(a)?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=>y(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")}),N.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:()=>v(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(C,{onRemove:()=>x(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(K,{onClose:()=>d(null),provider:g})]})]})},P=i.memo(()=>{const{t}=f.useTranslation(),a={"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,{children:e.jsxRuntimeExports.jsx(s.Button,{size:"sm",className:"w-10",variant:"outline",children:e.jsxRuntimeExports.jsx(q.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(a).map(n=>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(n)}),e.jsxRuntimeExports.jsx("div",{children:t(a[n])})]},n))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(n=>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(n)}),e.jsxRuntimeExports.jsx("div",{children:t(o[n])})]},n))})]})})]})]})}),L=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-XYCWUol8.cjs"))),T=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-GxCAsv2Y.cjs"))),O=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-qnaKl27s.cjs"))),A=i.lazy(()=>Promise.resolve().then(()=>require("./ChaiBuilderEditor-YqEKonJ_.cjs")).then(t=>t.ImagesPanel));let k=null;const B=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),a=s.useBuilderProp("sideBarComponents.bottom",[]),[o,n]=S.useAtom(s.activePanelAtom),[h,m]=i.useState(o),[c,b]=i.useState(null),{t:E}=f.useTranslation(),g={"add-blocks":L,[l.OUTLINE_KEY]:T,"branding-options":O,images:A};u.each(t,({name:x,panel:v})=>{g[x]=v});const d=x=>{clearTimeout(k),o!==l.OUTLINE_KEY&&x===l.OUTLINE_KEY?k=setTimeout(()=>n(l.OUTLINE_KEY),500):m(x),n(x)},N=s.useBuilderProp("dataBindingSupport",!1);function y(){const x=setTimeout(()=>{c&&(d(l.OUTLINE_KEY),clearTimeout(c))},500);b(x)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:y,onClick:()=>d(l.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:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{d("add-blocks")},size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(q.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d(l.OUTLINE_KEY),size:"sm",variant:o===l.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d("branding-options"),size:"sm",variant:o==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(q.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:x,icon:v})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d(x),size:"sm",className:"w-10",variant:o===x?"default":"outline",children:e.jsxRuntimeExports.jsx(v,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(P,{}),i.Children.toArray(a.map(x=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(x,{})})))]})]}),o!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{className:"absolute left-14 z-[50] h-full 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:D.cn("relative z-[100] h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1"),onMouseEnter:()=>{c&&clearTimeout(c)},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:N?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:l.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:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"mr-2 h-3"})," ",E("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(R.DatabaseIcon,{className:"mr-2 w-3"}),E("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:l.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(I,{})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsx(s.TabsList,{className:"mx-1 grid h-10 grid-cols-1",children:e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"mr-2 h-3"})," ",E("Outline")]})}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(T)})]})})})})]})};exports.default=B;
@@ -1,29 +1,32 @@
1
1
  import { j as c } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import z, { useMemo as o, Suspense as n } from "react";
3
3
  import { FontFamilyIcon as M, EyeOpenIcon as u } from "@radix-ui/react-icons";
4
- import { h as r, aj as d, ak as C, al as L, am as m, ay as p, az as F, an as i, z as w, B as g, q as B, S as v, aA as f } from "./index-hH5SIZ29.js";
5
- import { G as x } from "./index-YpnaudSM.js";
4
+ import { h as r, a6 as d, a7 as C, a8 as L, a9 as m, am as p, an as F, aa as i, G as w, V as B, B as g, E as f, ah as v, ao as x } from "./ChaiBuilderEditor-y1NxvXJ7.js";
6
5
  import { useTranslation as e } from "react-i18next";
7
6
  import "./_commonjsHelpers-UyOWmZb0.js";
7
+ import "clsx";
8
+ import "react-dom";
9
+ import "@radix-ui/react-scroll-area";
10
+ import "@floating-ui/react-dom";
11
+ import "jotai";
12
+ import "i18next";
13
+ import "flagged";
8
14
  import "lodash-es";
15
+ import "./STRINGS--j49GZJP.js";
9
16
  import "./Functions-7jnEwJyw.js";
10
- import "clsx";
11
17
  import "tailwind-merge";
12
18
  import "@chaibuilder/runtime";
13
- import "jotai";
14
- import "./STRINGS--j49GZJP.js";
15
19
  import "@react-hookz/web";
16
20
  import "./MODIFIERS-cBT31iqE.js";
17
- import "./Class-6Hz2KzYb.js";
18
21
  import "@radix-ui/react-toggle";
19
22
  import "class-variance-authority";
23
+ import "./Class-6Hz2KzYb.js";
20
24
  import "@radix-ui/react-switch";
21
25
  import "@radix-ui/react-slot";
22
26
  import "@radix-ui/react-accordion";
23
27
  import "@radix-ui/react-alert-dialog";
24
28
  import "@radix-ui/react-dialog";
25
29
  import "@radix-ui/react-label";
26
- import "@radix-ui/react-scroll-area";
27
30
  import "@radix-ui/react-tabs";
28
31
  import "@radix-ui/react-tooltip";
29
32
  import "@radix-ui/react-popover";
@@ -36,8 +39,10 @@ import "@radix-ui/react-toast";
36
39
  import "cmdk";
37
40
  import "@radix-ui/react-context-menu";
38
41
  import "react-icons-picker";
39
- import "react-dom";
40
42
  import "react-quill";
43
+ import "react-hotkeys-hook";
44
+ import "lodash";
45
+ import "lucide-react";
41
46
  const S = () => r("languages", ["en"]), A = () => S().length === 1 ? null : /* @__PURE__ */ c.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ c.jsxs(d, { children: [
42
47
  /* @__PURE__ */ c.jsx(C, { className: "w-[150px] border-0", children: /* @__PURE__ */ c.jsx(
43
48
  L,
@@ -58,10 +63,10 @@ const S = () => r("languages", ["en"]), A = () => S().length === 1 ? null : /* @
58
63
  ] }) })
59
64
  ] }) });
60
65
  function R(l) {
61
- return x({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z" } }] })(l);
66
+ return w({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z" } }] })(l);
62
67
  }
63
68
  const k = () => {
64
- const { savePage: l, saveState: t } = w(), { t: s } = e(), h = r("hideSaveButton", !1), a = o(() => {
69
+ const { savePage: l, saveState: t } = B(), { t: s } = e(), h = r("hideSaveButton", !1), a = o(() => {
65
70
  switch (t) {
66
71
  case "SAVING":
67
72
  return "animate-pulse bg-gray-300 text-gray-900";
@@ -91,7 +96,7 @@ const k = () => {
91
96
  );
92
97
  return /* @__PURE__ */ c.jsx("div", { className: "flex items-center", children: H });
93
98
  }, P = function() {
94
- const t = r("previewComponent"), [, s] = B(), { t: h } = e();
99
+ const t = r("previewComponent"), [, s] = f(), { t: h } = e();
95
100
  return t ? /* @__PURE__ */ c.jsxs(
96
101
  g,
97
102
  {
@@ -107,7 +112,7 @@ const k = () => {
107
112
  ]
108
113
  }
109
114
  ) : null;
110
- }, C1 = () => {
115
+ }, w1 = () => {
111
116
  const l = r("topBarComponents.left", []), t = r("topBarComponents.center", []), s = r("topBarComponents.right", []), h = r("editable", !0);
112
117
  return /* @__PURE__ */ c.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
113
118
  /* @__PURE__ */ c.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ c.jsx("div", { className: "flex items-center space-x-2 font-bold", children: z.Children.toArray(
@@ -119,7 +124,7 @@ const k = () => {
119
124
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center space-x-2", children: [
120
125
  /* @__PURE__ */ c.jsx(A, {}),
121
126
  /* @__PURE__ */ c.jsx(P, {}),
122
- /* @__PURE__ */ c.jsx(f, { orientation: "vertical" }),
127
+ /* @__PURE__ */ c.jsx(x, { orientation: "vertical" }),
123
128
  h ? /* @__PURE__ */ c.jsx(k, {}) : null,
124
129
  z.Children.toArray(
125
130
  s.map((a) => /* @__PURE__ */ c.jsx(n, { fallback: /* @__PURE__ */ c.jsx(v, { className: "h-10" }), children: /* @__PURE__ */ c.jsx(a, {}) }))
@@ -128,5 +133,5 @@ const k = () => {
128
133
  ] });
129
134
  };
130
135
  export {
131
- C1 as default
136
+ w1 as default
132
137
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),h=require("@radix-ui/react-icons"),t=require("./ChaiBuilderEditor-YqEKonJ_.cjs"),i=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("lodash-es");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lodash");require("lucide-react");const v=()=>t.useBuilderProp("languages",["en"]),g=()=>v().length===1?null:c.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:c.jsxRuntimeExports.jsxs(t.Select,{children:[c.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"w-[150px] border-0",children:c.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:c.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[c.jsxRuntimeExports.jsx(h.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),c.jsxRuntimeExports.jsx(t.SelectContent,{children:c.jsxRuntimeExports.jsxs(t.SelectGroup,{children:[c.jsxRuntimeExports.jsx(t.SelectLabel,{children:"Fruits"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"apple",children:"Apple"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"banana",children:"Banana"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"blueberry",children:"Blueberry"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"grapes",children:"Grapes"}),c.jsxRuntimeExports.jsx(t.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})});function H(l){return t.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"}}]})(l)}const V=()=>{const{savePage:l,saveState:a}=t.useSavePage(),{t:s}=i.useTranslation(),e=t.useBuilderProp("hideSaveButton",!1),n=r.useMemo(()=>{switch(a){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"}},[a]);if(e)return null;const o=c.jsxRuntimeExports.jsxs(t.Button,{disabled:a==="SAVING",onClick:z=>{z.preventDefault(),l()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${n}`,size:"sm",variant:"outline",children:[c.jsxRuntimeExports.jsx(H,{className:"text-lg"}),c.jsxRuntimeExports.jsx("span",{className:"text-sm",children:a==="SAVING"?"Saving...":s(a==="SAVED"?"Saved":"Unsaved")})]});return c.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},M=function(){const a=t.useBuilderProp("previewComponent"),[,s]=t.usePreviewMode(),{t:e}=i.useTranslation();return a?c.jsxRuntimeExports.jsxs(t.Button,{onClick:n=>{n.preventDefault(),s(!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:[c.jsxRuntimeExports.jsx(h.EyeOpenIcon,{className:"text-xs"}),c.jsxRuntimeExports.jsx("span",{className:"text-sm",children:e("Preview")})]}):null},u=()=>{const l=t.useBuilderProp("topBarComponents.left",[]),a=t.useBuilderProp("topBarComponents.center",[]),s=t.useBuilderProp("topBarComponents.right",[]),e=t.useBuilderProp("editable",!0);return c.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:r.Children.toArray(l.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))})}),c.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:r.Children.toArray(a.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))}),c.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsxRuntimeExports.jsx(g,{}),c.jsxRuntimeExports.jsx(M,{}),c.jsxRuntimeExports.jsx(t.Separator,{orientation:"vertical"}),e?c.jsxRuntimeExports.jsx(V,{}):null,r.Children.toArray(s.map(n=>c.jsxRuntimeExports.jsx(r.Suspense,{fallback:c.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-10"}),children:c.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=u;
@@ -3,28 +3,32 @@ import { useState as p, useEffect as D } from "react";
3
3
  import { isEmpty as d, startCase as E } from "lodash-es";
4
4
  import { MixerHorizontalIcon as L } from "@radix-ui/react-icons";
5
5
  import { createApi as B } from "unsplash-js";
6
- import { h as F, bg as K, aW as U, aX as V, aY as O, aj as P, ak as C, al as S, am as k, an as h, bi as Q, B as H } from "./index-hH5SIZ29.js";
6
+ import { h as F, b7 as K, aN as O, aO as U, aP as V, a6 as P, a7 as C, a8 as S, a9 as I, aa as h, b9 as Q, B as H } from "./ChaiBuilderEditor-y1NxvXJ7.js";
7
7
  import { useDebouncedState as R } from "@react-hookz/web";
8
- import { Loader as W } from "lucide-react";
8
+ import { Loader as $ } from "lucide-react";
9
9
  import "./_commonjsHelpers-UyOWmZb0.js";
10
- import "./Functions-7jnEwJyw.js";
11
10
  import "clsx";
12
- import "tailwind-merge";
13
- import "@chaibuilder/runtime";
11
+ import "react-dom";
12
+ import "@radix-ui/react-scroll-area";
13
+ import "@floating-ui/react-dom";
14
14
  import "jotai";
15
+ import "i18next";
16
+ import "react-i18next";
17
+ import "flagged";
15
18
  import "./STRINGS--j49GZJP.js";
19
+ import "./Functions-7jnEwJyw.js";
20
+ import "tailwind-merge";
21
+ import "@chaibuilder/runtime";
16
22
  import "./MODIFIERS-cBT31iqE.js";
17
- import "./Class-6Hz2KzYb.js";
18
- import "react-i18next";
19
23
  import "@radix-ui/react-toggle";
20
24
  import "class-variance-authority";
25
+ import "./Class-6Hz2KzYb.js";
21
26
  import "@radix-ui/react-switch";
22
27
  import "@radix-ui/react-slot";
23
28
  import "@radix-ui/react-accordion";
24
29
  import "@radix-ui/react-alert-dialog";
25
30
  import "@radix-ui/react-dialog";
26
31
  import "@radix-ui/react-label";
27
- import "@radix-ui/react-scroll-area";
28
32
  import "@radix-ui/react-tabs";
29
33
  import "@radix-ui/react-tooltip";
30
34
  import "@radix-ui/react-popover";
@@ -37,20 +41,21 @@ import "@radix-ui/react-toast";
37
41
  import "cmdk";
38
42
  import "@radix-ui/react-context-menu";
39
43
  import "react-icons-picker";
40
- import "react-dom";
41
44
  import "react-quill";
42
- const I = async (x, g) => new Promise((o, r) => {
45
+ import "react-hotkeys-hook";
46
+ import "lodash";
47
+ const k = async (x, g) => new Promise((o, r) => {
43
48
  B({ accessKey: g }).search.getPhotos(x).then((i) => {
44
49
  o(i);
45
50
  }).catch((i) => r(i));
46
- }), De = ({ isModalView: x, onSelect: g }) => {
51
+ }), Ke = ({ isModalView: x, onSelect: g }) => {
47
52
  const o = F("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l, A] = p(), [n, q] = p(), [z, y] = p(0), [u, T] = R("", 1e3), [f, c] = p(!1), _ = async (s) => {
48
53
  if (d(u))
49
54
  return;
50
55
  let t = i + 1;
51
56
  s && (s.preventDefault(), t = 1), c(!0), v(t);
52
57
  const m = { query: u, page: t };
53
- l && (m.orientation = l), n && (m.color = n), I(m, o).then((a) => {
58
+ l && (m.orientation = l), n && (m.color = n), k(m, o).then((a) => {
54
59
  var N, b, w;
55
60
  j(t === 1 ? ((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || [] : [...r, ...((b = a == null ? void 0 : a.response) == null ? void 0 : b.results) || []]), y((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), c(!1);
56
61
  }).catch(() => {
@@ -61,7 +66,7 @@ const I = async (x, g) => new Promise((o, r) => {
61
66
  if (!d(u) && o) {
62
67
  c(!0);
63
68
  const s = { query: u, page: 1 };
64
- l && (s.orientation = l), n && (s.color = n), v(1), I(s, o).then((t) => {
69
+ l && (s.orientation = l), n && (s.color = n), v(1), k(s, o).then((t) => {
65
70
  var m, a;
66
71
  j(((m = t == null ? void 0 : t.response) == null ? void 0 : m.results) || []), y((a = t == null ? void 0 : t.response) == null ? void 0 : a.total_pages), c(!1);
67
72
  }).catch(() => {
@@ -92,10 +97,10 @@ const I = async (x, g) => new Promise((o, r) => {
92
97
  onChange: (s) => T(s.target.value)
93
98
  }
94
99
  ),
95
- /* @__PURE__ */ e.jsxs(U, { children: [
96
- /* @__PURE__ */ e.jsx(V, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
100
+ /* @__PURE__ */ e.jsxs(O, { children: [
101
+ /* @__PURE__ */ e.jsx(U, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
97
102
  /* @__PURE__ */ e.jsx(
98
- O,
103
+ V,
99
104
  {
100
105
  side: x ? "bottom" : "right",
101
106
  className: "z-[9999] flex w-max items-center justify-center",
@@ -103,7 +108,7 @@ const I = async (x, g) => new Promise((o, r) => {
103
108
  /* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
104
109
  /* @__PURE__ */ e.jsxs(P, { defaultValue: l, onValueChange: (s) => A(s), children: [
105
110
  /* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
106
- /* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
111
+ /* @__PURE__ */ e.jsxs(I, { className: "z-[9999]", children: [
107
112
  /* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
108
113
  /* @__PURE__ */ e.jsx(h, { value: "landscape", children: "Landscape" }),
109
114
  /* @__PURE__ */ e.jsx(h, { value: "portrait", children: "Portrait" }),
@@ -113,7 +118,7 @@ const I = async (x, g) => new Promise((o, r) => {
113
118
  /* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
114
119
  /* @__PURE__ */ e.jsxs(P, { defaultValue: n, onValueChange: (s) => q(s), children: [
115
120
  /* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
116
- /* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
121
+ /* @__PURE__ */ e.jsxs(I, { className: "z-[9999]", children: [
117
122
  /* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
118
123
  [
119
124
  "black_and_white",
@@ -173,7 +178,7 @@ const I = async (x, g) => new Promise((o, r) => {
173
178
  ) }) }, s.id)
174
179
  )),
175
180
  f && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
176
- /* @__PURE__ */ e.jsx(W, { className: "animate-spin w-6 h-6" }),
181
+ /* @__PURE__ */ e.jsx($, { className: "animate-spin w-6 h-6" }),
177
182
  "  Loading..."
178
183
  ] }),
179
184
  !d(r) && i < z && !f && /* @__PURE__ */ e.jsx(
@@ -193,6 +198,6 @@ const I = async (x, g) => new Promise((o, r) => {
193
198
  ] });
194
199
  };
195
200
  export {
196
- De as default,
197
- I as fetchImage
201
+ Ke as default,
202
+ k as fetchImage
198
203
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),o=require("react"),l=require("lodash-es"),C=require("@radix-ui/react-icons"),k=require("unsplash-js"),t=require("./ChaiBuilderEditor-YqEKonJ_.cjs"),A=require("@react-hookz/web"),T=require("lucide-react");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lodash");const E=async(d,q)=>new Promise((a,n)=>{k.createApi({accessKey:q}).search.getPhotos(d).then(u=>{a(u)}).catch(u=>n(u))}),z=({isModalView:d,onSelect:q})=>{const a=t.useBuilderProp("unsplashAccessKey",""),[n,f]=o.useState([]),[u,g]=o.useState(0),[c,S]=o.useState(),[x,b]=o.useState(),[I,R]=o.useState(0),[j,w]=A.useDebouncedState("",1e3),[h,m]=o.useState(!1),P=async s=>{if(l.isEmpty(j))return;let i=u+1;s&&(s.preventDefault(),i=1),m(!0),g(i);const p={query:j,page:i};c&&(p.orientation=c),x&&(p.color=x),E(p,a).then(r=>{var y,v,N;f(i===1?((y=r==null?void 0:r.response)==null?void 0:y.results)||[]:[...n,...((v=r==null?void 0:r.response)==null?void 0:v.results)||[]]),R((N=r==null?void 0:r.response)==null?void 0:N.total_pages),m(!1)}).catch(()=>{m(!1)})};return o.useEffect(()=>{if(!l.isEmpty(j)&&a){m(!0);const s={query:j,page:1};c&&(s.orientation=c),x&&(s.color=x),g(1),E(s,a).then(i=>{var p,r;f(((p=i==null?void 0:i.response)==null?void 0:p.results)||[]),R((r=i==null?void 0:i.response)==null?void 0:r.total_pages),m(!1)}).catch(()=>{m(!1)})}},[c,x,j,a]),l.isEmpty(a)?e.jsxRuntimeExports.jsx("div",{className:"h-full flex flex-col items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsxRuntimeExports.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"underline px-1 hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center rounded-md border bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsx(t.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>w(s.target.value)}),e.jsxRuntimeExports.jsxs(t.Popover,{children:[e.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(C.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(t.PopoverContent,{side:d?"bottom":"right",className:"z-[9999] flex w-max items-center justify-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"py-1 text-sm font-medium",children:"Orientation"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:c,onValueChange:s=>S(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:x,onValueChange:s=>b(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:s,children:l.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(t.ScrollArea,{className:`h-full ${d&&!l.isEmpty(n)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[l.isEmpty(n)&&!h&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Data"}),e.jsxRuntimeExports.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),d?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:n.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>q(s.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id))}):n.map(s=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id)),h&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(T.Loader,{className:"animate-spin w-6 h-6"}),"  Loading..."]}),!l.isEmpty(n)&&u<I&&!h&&e.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>P(void 0),disabled:h,children:h?"":"Load More"})]})]})};exports.default=z;exports.fetchImage=E;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("react"),o=require("lodash-es"),m=require("@radix-ui/react-icons"),E=require("jotai"),p=require("./ChaiBuilderEditor-YqEKonJ_.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("react-i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lodash");require("lucide-react");const N=E.atom([]),I=({isModalView:t,onSelect:l})=>{const j=p.useBuilderProp("uploadMediaCallback"),a=p.useBuilderProp("fetchMediaCallback"),[i,x]=E.useAtom(N),[n,f]=s.useState(!1),[h,q]=s.useState(!1),[c,d]=s.useState(),[g,R]=s.useState("");s.useEffect(()=>{(async()=>{if(!a)return;q(!0);const r=await a();x(r||[]),q(!1)})()},[]);const v=r=>{var u,b;r&&((b=(u=r==null?void 0:r.target)==null?void 0:u.files)==null?void 0:b.length)>0&&d(r.target.files[0])},y=async()=>{if(j){f(!0);try{const{url:r}=await j(c);l(r),d(void 0);const u=await a();x(u)}catch(r){x([]),R((r==null?void 0:r.message)||"Something went wrong.")}f(!1)}};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[c?e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1",children:[e.jsxRuntimeExports.jsx("img",{src:URL.createObjectURL(c),alt:"",className:"h-auto max-h-96 w-full max-w-sm rounded-md object-contain"}),g&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:g}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:y,disabled:n,className:"flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",children:[n?e.jsxRuntimeExports.jsx(m.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(m.UploadIcon,{className:"animate-bounce"}),"  ",n?"Uploading...":"Upload"]}),!n&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",onClick:()=>d(void 0),children:[e.jsxRuntimeExports.jsx(m.Cross1Icon,{}),"  Cancel"]})]})]}):e.jsxRuntimeExports.jsxs("label",{htmlFor:t?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50",children:[e.jsxRuntimeExports.jsx("div",{className:"text-3xl",children:"+"}),e.jsxRuntimeExports.jsx("div",{children:"Click to choose file"})]}),e.jsxRuntimeExports.jsx("input",{type:"file",id:t?"upload-in-modal":"upload-in-panel",hidden:!0,onChange:v})]}),e.jsxRuntimeExports.jsxs(p.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${t?"px-2":""} pt-2`,children:[o.isEmpty(i)&&h&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:"Fetching..."})}),o.isEmpty(i)&&!h&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Images"})}),t?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:o.map(i,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>l(r.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:r.name,src:r.thumbUrl})})},r.id))}):o.map(i,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>l(r.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:r.name,src:r.url})})},r.id))]})]})};exports.default=I;