@chaibuilder/sdk 1.2.38 → 1.2.39

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 (76) hide show
  1. package/dist/AddBlocks-2_dpKDpp.js +144 -0
  2. package/dist/AddBlocks-p4Hrxjdf.cjs +1 -0
  3. package/dist/{CanvasArea-WJYJtUFt.js → CanvasArea-iN0LxF74.js} +183 -184
  4. package/dist/{CanvasArea-MuuWWyW0.cjs → CanvasArea-sbec3R-f.cjs} +5 -5
  5. package/dist/{ChaiBuilderEditor-vzyVasJe.js → ChaiBuilderEditor-JnZFji5_.js} +8191 -8073
  6. package/dist/{ChaiBuilderEditor-PLQ8Sq34.cjs → ChaiBuilderEditor-qxbkVVLu.cjs} +49 -49
  7. package/dist/{CurrentPage-j6xVMVFH.js → CurrentPage-Lr3ztuMx.js} +9 -10
  8. package/dist/CurrentPage-m7_GkZ8a.cjs +1 -0
  9. package/dist/ListTree-piETqoz9.cjs +1 -0
  10. package/dist/{ListTree-1oWz6vwo.js → ListTree-uJFhqUk9.js} +1 -2
  11. package/dist/{PagesPanel-PKnqTla9.js → PagesPanel-R8FWg5Xg.js} +4 -5
  12. package/dist/PagesPanel-lShO3SmJ.cjs +1 -0
  13. package/dist/{ProjectPanel-hx21JHK8.js → ProjectPanel-2dX4bM5q.js} +5 -6
  14. package/dist/ProjectPanel-_4546hym.cjs +1 -0
  15. package/dist/{Settings-3omes6Yj.js → Settings-J785mqWv.js} +4 -5
  16. package/dist/Settings-e2AZkjqY.cjs +1 -0
  17. package/dist/SidePanels-Vfw9Ir6p.cjs +1 -0
  18. package/dist/{SidePanels-vNc0pvVt.js → SidePanels-cN9er64h.js} +165 -146
  19. package/dist/{BrandingOptions-z7hXgff2.js → ThemeConfiguration-m_jkR2zi.js} +42 -41
  20. package/dist/ThemeConfiguration-nler1cz3.cjs +1 -0
  21. package/dist/Topbar-DmIPkF8D.cjs +1 -0
  22. package/dist/{Topbar-c3HIPa_q.js → Topbar-gaBycI3a.js} +3 -4
  23. package/dist/UILibrariesPanel-Igx0R4zc.js +138 -0
  24. package/dist/UILibrariesPanel-N144UO0E.cjs +1 -0
  25. package/dist/{UnsplashImages-IQo081nF.js → UnsplashImages-6HmGnetM.js} +3 -4
  26. package/dist/UnsplashImages-mC2ewX9D.cjs +1 -0
  27. package/dist/UploadImages-fo9ufcCE.cjs +1 -0
  28. package/dist/{UploadImages-BAy3wsRT.js → UploadImages-qRW8zhKj.js} +3 -4
  29. package/dist/{add-page-modal-WWRdRyDM.js → add-page-modal-0OuVNgx3.js} +16 -17
  30. package/dist/add-page-modal-mP9aTfG9.cjs +1 -0
  31. package/dist/{confirm-alert-LvvLsCWh.cjs → confirm-alert-3cDnni4v.cjs} +1 -1
  32. package/dist/{confirm-alert-h4RiwjkJ.js → confirm-alert-Mv-Iofef.js} +3 -4
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.d.ts +3 -0
  35. package/dist/core.js +44 -45
  36. package/dist/{delete-page-modal-XymJxo7r.js → delete-page-modal-BVz9nreM.js} +4 -5
  37. package/dist/delete-page-modal-PTwcrTET.cjs +1 -0
  38. package/dist/email.cjs +1 -1
  39. package/dist/email.d.ts +3 -0
  40. package/dist/email.js +3 -4
  41. package/dist/{form-P0nEC3WH.js → form-e8l4xtI9.js} +1 -1
  42. package/dist/{form-I4uC5vkq.cjs → form-o7e6NNTk.cjs} +1 -1
  43. package/dist/{index-mVQVs_cP.cjs → index--XTVdy1h.cjs} +1 -1
  44. package/dist/{index-SP6aKHPH.js → index-CdnwVCXv.js} +2 -2
  45. package/dist/{page-viewer-OSlqdbEV.js → page-viewer-OopsJHBE.js} +5 -6
  46. package/dist/page-viewer-cjvx3lg7.cjs +1 -0
  47. package/dist/{project-general-setting-JR9L7fMQ.cjs → project-general-setting-3sdmeYrS.cjs} +1 -1
  48. package/dist/{project-general-setting-LXfl5i5Z.js → project-general-setting-n8KKf8qD.js} +5 -6
  49. package/dist/{project-seo-setting-cVDCPjBD.cjs → project-seo-setting-E554FQ3V.cjs} +1 -1
  50. package/dist/{project-seo-setting-lyzUUxe2.js → project-seo-setting-pu3qUSE0.js} +4 -5
  51. package/dist/single-page-detail-KdxEu4WS.cjs +1 -0
  52. package/dist/{single-page-detail-GeG-SXWn.js → single-page-detail-hcTkta3X.js} +6 -7
  53. package/dist/studio.cjs +1 -1
  54. package/dist/studio.d.ts +3 -0
  55. package/dist/studio.js +3 -4
  56. package/dist/ui.cjs +1 -1
  57. package/dist/ui.js +138 -139
  58. package/dist/{useCanvasSettings-_EzUaA9P.js → useCanvasSettings-6lwRwexD.js} +1 -1
  59. package/dist/{useCanvasSettings-bP_V0UR2.cjs → useCanvasSettings-oERGzYXb.cjs} +1 -1
  60. package/package.json +2 -2
  61. package/dist/AddBlocks-G9pjsIyq.cjs +0 -1
  62. package/dist/AddBlocks-dljjAE5r.js +0 -210
  63. package/dist/BrandingOptions-N7iDaMgM.cjs +0 -1
  64. package/dist/CurrentPage-LaeYQ-Ke.cjs +0 -1
  65. package/dist/ListTree-_7e5p_e3.cjs +0 -1
  66. package/dist/PagesPanel-BsELxMie.cjs +0 -1
  67. package/dist/ProjectPanel-1aAFwguw.cjs +0 -1
  68. package/dist/Settings-tYjuuUgX.cjs +0 -1
  69. package/dist/SidePanels-7WG6SXw0.cjs +0 -1
  70. package/dist/Topbar-1zU6Ljsn.cjs +0 -1
  71. package/dist/UnsplashImages-zCQkmow-.cjs +0 -1
  72. package/dist/UploadImages-6K3GdM-b.cjs +0 -1
  73. package/dist/add-page-modal-8FJnOckX.cjs +0 -1
  74. package/dist/delete-page-modal-IRX0oKZJ.cjs +0 -1
  75. package/dist/page-viewer-fonOyiuT.cjs +0 -1
  76. package/dist/single-page-detail-LL8m0Va7.cjs +0 -1
@@ -1,210 +0,0 @@
1
- import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import y, { createElement as O, useState as g, useCallback as q, useMemo as U, useEffect as V, Suspense as R } from "react";
3
- import { has as F, isFunction as W, first as x, omit as J, noop as K, isEmpty as b, filter as k, values as v, groupBy as w, mergeWith as Y, isArray as L, keys as Q, get as X, map as A, uniq as Z, includes as $, find as ee, reject as I } from "lodash-es";
4
- import { useAtom as N } from "jotai";
5
- import { useTranslation as H } from "react-i18next";
6
- import { m as _, L as S, z as se, ag as P, ac as te, ad as re, ae as oe, h as T, O as z, a6 as le, a7 as ae, a8 as ie, a9 as ce, aa as E, bg as ne, bh as de, bi as me, bj as pe, aq as ue, bk as he, bl as xe, B as fe, bm as ge, bn as je, bo as be, ai as ke, aj as ve, ak as C, ba as ye, b3 as Be, b4 as Ne, b5 as Ce, b6 as we, ah as Ae } from "./ChaiBuilderEditor-vzyVasJe.js";
7
- import { BoxIcon as Te } from "@radix-ui/react-icons";
8
- import { syncBlocksWithDefaults as G, useChaiBlocks as M } from "@chaibuilder/runtime";
9
- import { useFeature as _e } from "flagged";
10
- import { O as B } from "./STRINGS--j49GZJP.js";
11
- import { Loader as Se } from "lucide-react";
12
- import { g as Pe } from "./html-to-json-Z6R2o_fA.js";
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 "./Functions-7jnEwJyw.js";
20
- import "tailwind-merge";
21
- import "@react-hookz/web";
22
- import "./MODIFIERS-cBT31iqE.js";
23
- import "@radix-ui/react-toggle";
24
- import "class-variance-authority";
25
- import "./Class-6Hz2KzYb.js";
26
- import "@radix-ui/react-switch";
27
- import "@radix-ui/react-slot";
28
- import "@radix-ui/react-accordion";
29
- import "@radix-ui/react-alert-dialog";
30
- import "@radix-ui/react-dialog";
31
- import "@radix-ui/react-label";
32
- import "@radix-ui/react-tabs";
33
- import "@radix-ui/react-tooltip";
34
- import "@radix-ui/react-popover";
35
- import "@radix-ui/react-menubar";
36
- import "@radix-ui/react-hover-card";
37
- import "@radix-ui/react-select";
38
- import "@radix-ui/react-dropdown-menu";
39
- import "@radix-ui/react-separator";
40
- import "@radix-ui/react-toast";
41
- import "cmdk";
42
- import "@radix-ui/react-context-menu";
43
- import "react-icons-picker";
44
- import "react-quill";
45
- import "react-hotkeys-hook";
46
- import "lodash";
47
- import "himalaya";
48
- const Le = ({ block: s }) => {
49
- const { type: r, icon: i, label: l } = s, { addCoreBlock: d, addPredefinedBlock: c } = _(), [n, t] = S(), [, p] = se(), [, m] = N(P), o = () => {
50
- if (F(s, "blocks")) {
51
- const u = W(s.blocks) ? s.blocks() : s.blocks;
52
- c(G(u), x(n));
53
- } else
54
- d(s, x(n));
55
- m(B);
56
- }, a = _e("dnd");
57
- return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(te, { children: [
58
- /* @__PURE__ */ e.jsx(re, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
59
- "button",
60
- {
61
- onClick: o,
62
- type: "button",
63
- onDragStart: (u) => {
64
- u.dataTransfer.setData("text/plain", JSON.stringify(J(s, ["component", "icon"]))), setTimeout(() => {
65
- t([]), p(null), m(B);
66
- }, 200);
67
- },
68
- draggable: a ? "true" : "false",
69
- className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (a ? "cursor-grab" : "cursor-pointer"),
70
- children: [
71
- O(i || Te, { className: "w-4 h-4 mx-auto" }),
72
- /* @__PURE__ */ e.jsx("p", { className: "text-xs", children: l || r })
73
- ]
74
- }
75
- ) }),
76
- /* @__PURE__ */ e.jsx(oe, { children: /* @__PURE__ */ e.jsx("p", { children: l || r }) })
77
- ] }) });
78
- }, Ie = ({ block: s, closePopover: r }) => {
79
- const [i, l] = g(!1), d = T("getExternalPredefinedBlock", K()), { addCoreBlock: c, addPredefinedBlock: n } = _(), [t] = S(), p = q(
80
- async (m) => {
81
- if (m.stopPropagation(), F(s, "component")) {
82
- c(s, x(t)), r();
83
- return;
84
- }
85
- l(!0);
86
- const o = await d(s);
87
- b(o) || n(G(o), x(t)), r();
88
- },
89
- [s]
90
- );
91
- return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
92
- "div",
93
- {
94
- onClick: i ? () => {
95
- } : p,
96
- className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
97
- children: [
98
- i && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
99
- /* @__PURE__ */ e.jsx(Se, { className: "animate-spin", size: 15, color: "white" }),
100
- " ",
101
- /* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
102
- ] }),
103
- s.preview ? /* @__PURE__ */ e.jsx(
104
- "img",
105
- {
106
- src: s.preview,
107
- className: "min-h-[50px] w-full rounded-md border border-gray-300",
108
- alt: s.label
109
- }
110
- ) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: s.label }) })
111
- ]
112
- }
113
- ) });
114
- }, Ee = () => {
115
- const { data: s } = z(), r = M(), i = k(v(r), { category: "custom" }), l = w(i, "group"), d = w(s, "group"), c = U(() => Y(l, d, (o, a) => {
116
- if (L(o) && L(a))
117
- return [...o, ...a];
118
- }), [l, d]), [n, t] = g(x(Q(c)) || ""), [, p] = N(P), m = X(c, n, []);
119
- return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden py-2", children: [
120
- /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex w-full items-center p-3", children: /* @__PURE__ */ e.jsxs(le, { value: n, onValueChange: (o) => t(o), children: [
121
- /* @__PURE__ */ e.jsx(ae, { className: "w-full", children: /* @__PURE__ */ e.jsx(ie, { placeholder: "Select a provider" }) }),
122
- /* @__PURE__ */ e.jsxs(ce, { children: [
123
- /* @__PURE__ */ e.jsx(E, { value: "", children: "Choose" }),
124
- y.Children.toArray(
125
- A(c, (o, a) => /* @__PURE__ */ e.jsx(E, { value: a, children: a }, a))
126
- )
127
- ] })
128
- ] }) }),
129
- /* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children: y.Children.toArray(
130
- m.map((o) => /* @__PURE__ */ e.jsx(Ie, { block: o, closePopover: () => p(B) }))
131
- ) })
132
- ] });
133
- }, Fe = () => {
134
- const { t: s } = H(), [r, i] = g(""), { addPredefinedBlock: l } = _(), [d] = S(), [, c] = N(P), n = () => {
135
- const t = Pe(r);
136
- l([...t], x(d) || null), i(""), c(B);
137
- };
138
- return /* @__PURE__ */ e.jsxs(ne, { className: "border-border/0 p-0 shadow-none", children: [
139
- /* @__PURE__ */ e.jsx(de, { className: "p-3", children: /* @__PURE__ */ e.jsx(me, { children: s("html_snippet_description") }) }),
140
- /* @__PURE__ */ e.jsx(pe, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
141
- /* @__PURE__ */ e.jsx(ue, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
142
- /* @__PURE__ */ e.jsx(
143
- he,
144
- {
145
- autoFocus: !0,
146
- tabIndex: 1,
147
- ref: (t) => t && t.focus(),
148
- onChange: (t) => i(t.target.value),
149
- rows: 12,
150
- value: r,
151
- placeholder: s("enter_code_snippet"),
152
- className: "resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"
153
- }
154
- )
155
- ] }) }),
156
- /* @__PURE__ */ e.jsxs(xe, { className: "flex flex-col justify-end p-3", children: [
157
- /* @__PURE__ */ e.jsx(fe, { disabled: r.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: s("import_html") }),
158
- /* @__PURE__ */ e.jsx(ge, { variant: "default", className: "mt-2 border-none p-1 text-gray-400", children: /* @__PURE__ */ e.jsx(je, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
159
- ] })
160
- ] });
161
- }, _s = () => {
162
- const { t: s } = H(), [r, i] = g("core"), [l, d] = g("basic"), c = M(), [, n] = N(be), t = T("importHTMLSupport", !0), p = T("filterChaiBlock", () => !0), { data: m, isLoading: o } = z(), a = k(c, p), u = w(a, "category"), f = Z(A(u.core, "group"));
163
- V(() => {
164
- !$(f, l) && !b(f) && !b(l) && d(x(f));
165
- }, [f, l]);
166
- const j = !o && !b(m) || ee(v(a), { category: "custom" }) !== void 0;
167
- return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-72 flex-col overflow-hidden", children: [
168
- /* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
169
- /* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: s("add_block") }),
170
- /* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(r === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
171
- ] }),
172
- /* @__PURE__ */ e.jsx(
173
- ke,
174
- {
175
- onValueChange: (h) => {
176
- n(""), i(h);
177
- },
178
- value: r,
179
- className: "h-max",
180
- children: /* @__PURE__ */ e.jsxs(
181
- ve,
182
- {
183
- className: "grid w-full " + (j && t ? "grid-cols-3" : j && !t || !j && t ? "grid-cols-2" : "grid-cols-1"),
184
- children: [
185
- /* @__PURE__ */ e.jsx(C, { value: "core", children: s("Blocks") }),
186
- j ? /* @__PURE__ */ e.jsx(C, { value: "ui-blocks", children: s("ui_library") }) : null,
187
- t ? /* @__PURE__ */ e.jsx(C, { value: "html", children: s("import") }) : null
188
- ]
189
- }
190
- )
191
- }
192
- ),
193
- r === "core" && /* @__PURE__ */ e.jsx(ye, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx("div", { className: "mt-2 w-full", children: y.Children.toArray(
194
- A(
195
- f,
196
- (h) => I(k(v(u.core), { group: h }), { hidden: !0 }).length ? /* @__PURE__ */ e.jsx(Be, { type: "single", value: h, collapsible: !0, className: "w-full", children: /* @__PURE__ */ e.jsxs(Ne, { value: h, children: [
197
- /* @__PURE__ */ e.jsx(Ce, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize", children: h }),
198
- /* @__PURE__ */ e.jsx(we, { className: "p-3", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: y.Children.toArray(
199
- I(k(v(u.core), { group: h }), { hidden: !0 }).map((D) => /* @__PURE__ */ e.jsx(Le, { block: D }))
200
- ) }) })
201
- ] }) }) : null
202
- )
203
- ) }) }),
204
- r === "ui-blocks" && /* @__PURE__ */ e.jsx(R, { fallback: /* @__PURE__ */ e.jsx(Ae, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Ee, {}) }),
205
- r === "html" && t ? /* @__PURE__ */ e.jsx(Fe, {}) : null
206
- ] });
207
- };
208
- export {
209
- _s as default
210
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),R=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./ChaiBuilderEditor-PLQ8Sq34.cjs"),r=require("./controls-jWJDao88.cjs"),f=require("lodash-es");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("@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-icons");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");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const q=N(B),k=({value:t,onChange:e,id:i,onBlur:l})=>{const n=f.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},x=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",f.noop),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=q.useRef(e);q.useEffect(()=>()=>{f.isEqual(e,n.current)||t(n.current)},[]);const v=({formData:o},c)=>{c&&(i(o),n.current=o)},{bodyFont:u,headingFont:m,primaryColor:b,bodyTextDarkColor:y,bodyTextLightColor:h,bodyBgDarkColor:S,secondaryColor:C,bodyBgLightColor:O,roundedCorners:j}=e;let s={headingFont:r.y({title:"Heading font",default:m,options:x}),bodyFont:r.y({title:"Body font",default:u,options:x}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(j||5,10)}),primaryColor:r.f({title:"Primary",default:b}),secondaryColor:r.f({title:"Secondary",default:C})};l||(s={...s,bodyBgLightColor:r.f({title:"Body Background (Light Mode)",default:O}),bodyTextLightColor:r.f({title:"Body Text (Light Mode)",default:y}),bodyBgDarkColor:r.f({title:"Body Background (Dark mode)",default:S}),bodyTextDarkColor:r.f({title:"Body Text (Dark mode)",default:h})});const d={type:"object",properties:{}},g={};return Object.keys(s).forEach(o=>{const c=s[o];return d.properties||(d.properties={}),d.properties[o]=c.schema,g[o]=c.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-60 select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:k},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:g,schema:d,formData:e,validator:R,onChange:v})})]})};exports.default=P;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./ChaiBuilderEditor-PLQ8Sq34.cjs"),i=require("lodash-es"),j=require("sonner"),l=require("react"),o=require("./index-mVQVs_cP.cjs"),p=require("lucide-react"),f=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("./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-icons");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("./core.cjs");require("./html-to-json-VPWiWWGH.cjs");require("himalaya");const E=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{saveState:d}=s.useSavePage(),m=o.useChangePage(),{t:q}=f.useTranslation(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const g=r=>{if(d!=="SAVED")j.toast.error(q("You have unsaved changes. Please save before changing the page."));else{const h=i.find(c,{uuid:r});m(h)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 py-1 pr-0 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(p.BriefcaseIcon,{className:"mr-2 h-4 w-4"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=E;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsxRuntime=require("./jsx-runtime-Z_BpKhVy.cjs"),React=require("react"),jotai=require("jotai"),web=require("@react-hookz/web"),reactArborist=require("react-arborist"),ui=require("./ChaiBuilderEditor-PLQ8Sq34.cjs"),Functions=require("./Functions-N3yhPYKY.cjs"),reactIcons=require("@radix-ui/react-icons"),lucideReact=require("lucide-react"),lodashEs=require("lodash-es");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("@chaibuilder/runtime");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 TypeIcon=t=>{switch(t.type){case"Image":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ImageIcon,{});case"Heading":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.HeadingIcon,{});case"Text":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{});case"Link":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Link1Icon,{});case"Video":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.VideoIcon,{});case"RichText":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CursorTextIcon,{});case"Button":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{});case"CustomHTML":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CodeIcon,{});case"Divider":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DividerHorizontalIcon,{});case"Icon":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SketchLogoIcon,{});case"List":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowsIcon,{});case"Paragraph":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{});case"Row":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowsIcon,{});case"ListItem":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ColumnsIcon,{});case"LineBreak":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SpaceBetweenVerticallyIcon,{});case"Form":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.GroupIcon,{});case"Checkbox":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CheckboxIcon,{});case"FormButton":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{});case"Input":case"TextArea":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InputIcon,{});case"Radio":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RadiobuttonIcon,{});case"Select":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DropdownMenuIcon,{});case"Table":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TableIcon,{});case"TableHead":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderTopIcon,{});case"TableBody":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderAllIcon,{});case"TableRow":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ViewHorizontalIcon,{});case"TableCell":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DragHandleHorizontalIcon,{});case"DataProvider":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.DatabaseIcon,{size:16});case"Box":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxIcon,{});default:return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxModelIcon,{})}},placeholderStyle={display:"flex",alignItems:"center",zIndex:1},DefaultCursor=React.memo(function({top:r,left:n}){const o={position:"absolute",pointerEvents:"none",top:r+"px",left:n+"px",right:0};return jsxRuntime.jsxRuntimeExports.jsx("div",{style:{...placeholderStyle,...o},children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-0.5 flex-1 rounded-[1px] bg-green-500"})})}),Overlay=React.memo(function({children:r,isDragging:n}){return n?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pointer-events-none fixed left-0 top-0 z-[100] h-full w-full",children:r}):null}),DefaultDragPreview=React.memo(({id:t,isDragging:r,mouse:n})=>{const[o]=ui.useBlocksStore(),i=React.useMemo(()=>o.find(x=>x._id===t),[o,t]),a=React.useMemo(()=>({transform:`translate(${(n==null?void 0:n.x)-10}px, ${(n==null?void 0:n.y)-10}px)`}),[n]);return n?jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx(Overlay,{isDragging:r,children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pointer-events-none absolute z-50 rounded border border-gray-200 bg-gray-100/80 font-semibold text-blue-600 shadow-md dark:border-gray-700 dark:bg-gray-800",style:a,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex !cursor-grab items-center p-0.5","aria-label":`Type: ${i==null?void 0:i._type}`,children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:i==null?void 0:i._type})}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:(i==null?void 0:i._name)||(i==null?void 0:i._type)})]})})})}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"hidden"})}),RemoveBlocks=()=>{const[t]=ui.useSelectedBlockIds(),r=ui.useRemoveBlocks(),n=ui.useSelectedBlock();return jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenuItem,{disabled:!ui.canDeleteBlock(n==null?void 0:n._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>r(t),children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TrashIcon,{})," Remove"]})},BlockContextMenuContent=()=>{const[t]=ui.useSelectedBlockIds(),r=ui.useDuplicateBlocks(),n=ui.useSelectedBlock(),o=React.useCallback(()=>{r(t)},[t,r]);return jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenuContent,{className:"text-xs",children:[jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenuItem,{disabled:!ui.canDuplicateBlock(n==null?void 0:n._type),className:"flex items-center gap-x-4 text-xs",onClick:o,children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CopyIcon,{})," Duplicate"]}),jsxRuntime.jsxRuntimeExports.jsx(RemoveBlocks,{})]})},BlockContextMenu=({children:t})=>jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:jsxRuntime.jsxRuntimeExports.jsxs(ui.ContextMenu,{children:[jsxRuntime.jsxRuntimeExports.jsx(ui.ContextMenuTrigger,{children:t}),jsxRuntime.jsxRuntimeExports.jsx(BlockContextMenuContent,{})]})}),defaultShortcuts=[{key:"ArrowDown",command:"selectNext"},{key:"ArrowUp",command:"selectPrev"},{key:"ArrowLeft",command:"selectParent",when:"isLeaf || isClosed"},{key:"ArrowLeft",command:"close",when:"isOpen"},{key:"ArrowRight",command:"open",when:"isClosed"},{key:"ArrowRight",command:"selectNext",when:"isOpen"},{key:"Home",command:"selectFirst"},{key:"End",command:"selectLast"}];function selectFirst(t){t.firstNode&&t.select(t.firstNode.id)}function selectLast(t){t.lastNode&&t.select(t.lastNode.id)}function selectNext(t){const r=t.selectedNodes[0].next||t.firstNode;t.select(r.id)}function selectPrev(t){const r=t.selectedNodes[0].prev||t.lastNode;t.select(r.id)}const selectParent=(t,r)=>{var o;const n=((o=t.selectedIds[0])==null?void 0:o.parent)||null;n&&r&&t.select(n.id)},open=(t,r)=>{const n=t.selectedNodes[0];n.isInternal&&r&&n.open()},close=(t,r)=>{const n=t.selectedNodes[0];n.isInternal&&r&&n.close()},Node=React.memo(({node:t,style:r,dragHandle:n})=>{const o=ui.useBuilderProp("outlineMenuItems",[]),[,i]=ui.useHighlightBlockId(),a=t.children.length>0,{id:x,data:c,isSelected:m,willReceiveDrop:l,isDragging:d,isEditing:j,handleClick:p}=t,R=web.useDebouncedCallback(u=>i(u),[],300),f=u=>{u.stopPropagation(),t.toggle()},h=u=>{u.stopPropagation(),t.isOpen||t.toggle(),p(u)};return React.useEffect(()=>{const u=setTimeout(()=>{l&&!t.isOpen&&t.toggle()},500);return()=>clearTimeout(u)},[l,t]),jsxRuntime.jsxRuntimeExports.jsx(BlockContextMenu,{id:x,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{onClick:h,onMouseEnter:()=>R(x),style:r,"data-node-id":x,ref:n,className:Functions.cn("group flex !h-fit w-full items-center justify-between space-x-px py-px outline-none",m?"bg-blue-500 text-white":"text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800",l&&ui.canAcceptChildBlock(c._type,"Icon")?"bg-green-200":"",d&&"opacity-20"),children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${t.isOpen?"rotate-90":""}`,children:a&&jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:f,type:"button",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TriangleRightIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:c==null?void 0:c._type})}),j?jsxRuntime.jsxRuntimeExports.jsx(Input,{node:t}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",onDoubleClick:u=>{u.stopPropagation(),t.edit(),t.deselect()},children:(c==null?void 0:c._name)||(c==null?void 0:c._type.split("/").pop())})]})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"invisible flex items-center space-x-1 pr-2 group-hover:visible",children:o.map(u=>jsxRuntime.jsxRuntimeExports.jsxs(ui.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(ui.TooltipTrigger,{className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",asChild:!0,children:React.createElement(u.item,{blockId:x})}),jsxRuntime.jsxRuntimeExports.jsx(ui.TooltipContent,{className:"z-[9999]",children:u.tooltip})]}))})]})})}),Input=({node:t})=>{var r,n;return jsxRuntime.jsxRuntimeExports.jsx("input",{autoFocus:!0,className:"ml-2 w-full rounded-sm border border-black/30 bg-transparent px-1 text-[11px] outline-none",type:"text",defaultValue:((r=t.data)==null?void 0:r._name)||((n=t.data)==null?void 0:n._type),onFocus:o=>o.currentTarget.select(),onBlur:o=>t.submit(o.currentTarget.value),onKeyDown:o=>{o.key==="Enter"&&t.submit(o.currentTarget.value)}})},useCanMove=()=>{const[t]=ui.useBlocksStore();return(r,n)=>{var a;const o=(a=lodashEs.find(t,{_id:n}))==null?void 0:a._type,i=lodashEs.first(r.map(x=>{var c;return(c=lodashEs.find(t,{_id:x}))==null?void 0:c._type}));return ui.canAcceptChildBlock(o,i)}},ListTree=()=>{const[treeData]=jotai.useAtom(ui.treeDSBlocks),[ids,setIds]=ui.useSelectedBlockIds(),updateBlockProps=ui.useUpdateBlocksProps(),[,setStyleBlocks]=ui.useSelectedStylingBlocks(),{moveBlocks}=ui.useBlocksStoreUndoableActions(),canMove=useCanMove(),treeRef=React.useRef(null),[,setTreeRef]=jotai.useAtom(ui.treeRefAtom),clearSelection=()=>{setIds([]),setStyleBlocks([])};React.useEffect(()=>{setTreeRef(treeRef.current)},[treeRef.current]);const onRename=({id:t,name:r,node:n})=>{updateBlockProps([t],{_name:r},n.data._name)},onMove=({dragIds:t,parentId:r,index:n})=>{canMove(t,r)&&moveBlocks(t,r,n)},onSelect=t=>{if(t.length===0)return;const r=t[0]?t[0].id:"";setStyleBlocks([]),setIds([r])},onContextMenu=t=>{var o;t.preventDefault();const r=t.target,n=r.getAttribute("data-node-id")||((o=r.closest("[data-node-id]"))==null?void 0:o.getAttribute("data-node-id"));n&&(setStyleBlocks([]),setIds([n]))},debouncedDisableDrop=web.useDebouncedCallback(({parentNode:t,dragNodes:r})=>{var n;return!ui.canAcceptChildBlock(t==null?void 0:t.data._type,(n=r[0])==null?void 0:n.data._type)},[],300),handleKeyDown=e=>{if(!treeRef.current)return;const tree=treeRef.current,selectedNode=tree.selectedNodes[0];if(!selectedNode)return;setIds[selectedNode.id],setStyleBlocks([]);const isLeaf=!selectedNode.isInternal,isClosed=!selectedNode.isOpen,isOpen=selectedNode.isOpen,shortcut=defaultShortcuts.find(s=>s.key===e.key&&(!s.when||eval(s.when)));if(shortcut)switch(e.preventDefault(),shortcut.command){case"selectNext":selectNext(tree);break;case"selectPrev":selectPrev(tree);break;case"selectParent":selectParent(tree,isLeaf||isClosed);break;case"close":close(tree,isOpen);break;case"open":open(tree,isClosed);break;case"selectFirst":selectFirst(tree);break;case"selectLast":selectLast(tree);break;default:break}};return jsxRuntime.jsxRuntimeExports.jsx("div",{className:Functions.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1"),onClick:()=>clearSelection(),children:jsxRuntime.jsxRuntimeExports.jsx("div",{id:"outline-view",className:"no-scrollbar h-full overflow-y-auto p-1 px-2 text-xs",onKeyDown:t=>{treeRef.current.isEditing||handleKeyDown(t)},children:jsxRuntime.jsxRuntimeExports.jsx(reactArborist.Tree,{ref:treeRef,height:800,className:"no-scrollbar !h-full max-w-full !overflow-y-auto !overflow-x-hidden",selection:ids[0]||"",onRename,openByDefault:!1,onMove,rowHeight:20,data:treeData,renderCursor:DefaultCursor,onSelect,childrenAccessor:t=>t.children,width:"100%",renderDragPreview:DefaultDragPreview,indent:10,onContextMenu,disableDrop:debouncedDisableDrop,idAccessor:"_id",children:Node})})})};exports.default=ListTree;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),i=require("lodash-es"),s=require("./index-mVQVs_cP.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./core.cjs");require("./ChaiBuilderEditor-PLQ8Sq34.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("@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-icons");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");require("sonner");require("./html-to-json-VPWiWWGH.cjs");require("himalaya");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-8FJnOckX.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-fonOyiuT.cjs"))),d=()=>{const{data:t=[],isLoading:q}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(t,{type:"STATIC"}),o=>i.get(o,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(x,{isLoading:q,pages:n})})]})};exports.default=d;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),x=require("lodash-es"),s=require("./ChaiBuilderEditor-PLQ8Sq34.cjs"),a=require("./index-mVQVs_cP.cjs");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("@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-icons");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");require("./core.cjs");require("sonner");require("./html-to-json-VPWiWWGH.cjs");require("himalaya");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-JR9L7fMQ.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-cVDCPjBD.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function q(){const t=a.useUpdateProject(),{data:n}=a.useProject(),[i,o]=r.useState(l(n||{})),u=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(n,u.current)||t.mutate(u.current,{onSuccess:()=>o(u.current)})},[u]),r.useEffect(()=>{u.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:o})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(m,{_projectData:i,seany:o})})})]})]})})]})}exports.default=q;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),g=require("react"),z=require("@react-hookz/web"),t=require("lodash-es"),B=require("react-i18next"),d=require("@radix-ui/react-icons"),o=require("./ChaiBuilderEditor-PLQ8Sq34.cjs"),le=require("./controls-jWJDao88.cjs"),M=require("lucide-react"),$=require("@chaibuilder/runtime"),F=require("./index-gi1LIOCw.cjs"),ae=require("@rjsf/core"),pe=require("@rjsf/validator-ajv8"),ue=require("./useCanvasSettings-bP_V0UR2.cjs"),de=require("react-autosuggest"),xe=require("fuse.js"),A=require("./Class-Zc8hpE7f.cjs"),ce=require("./STRINGS-gPz7CUOk.cjs");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("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");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");function me(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(i,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}return i.default=r,Object.freeze(i)}const O=me(g);function ge(r){const i=[],s={};function a(n,u){t.forEach(u,(l,x)=>{const p=n?`${n}.${x}`:x,c=t.isArray(l)?"list":typeof l;i.push(p),s[p]=c==="string"?"text":c==="object"?"model":c,c==="object"&&!t.isArray(l)&&a(p,l)})}return a("",t.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:i,pathsType:s}}const X=({data:r,fullView:i})=>{if(!r)return null;const s=typeof r;return i?typeof r=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(o.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(F.JsonView,{data:r,shouldExpandNode:F.allExpanded,style:{...F.defaultStyles,container:"max-h-[40vh] 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"}})})]}):e.jsxRuntimeExports.jsxs("div",{className:"max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),r]}):e.jsxRuntimeExports.jsx("div",{className:"w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50",children:t.truncate(s==="object"?JSON.stringify(r):r,{length:40})})},G=({type:r,value:i="",setValue:s,data:a,onChange:n,dataType:u,appliedBindings:l})=>{const{paths:x,pathsType:p}=ge(a),c=r==="PROP"?$.getBlockComponent(a==null?void 0:a._type):{},j=r==="PROP",[m,h]=g.useState(!1),b=g.useMemo(()=>r==="PROP"?x.filter(y=>!t.includes(l,y)&&t.get(c,`props.${t.first(t.split(y,"."))}.binding`)):x.filter(y=>u===t.get(p,y,"")),[r,x,l,u,c]);return g.useEffect(()=>{i&&n(i)},[i,r]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:t.startCase(t.toLower(r))}),e.jsxRuntimeExports.jsxs(o.Popover,{open:m,onOpenChange:h,children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(i)?"w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white":"min-w-[350px] items-center justify-between"}`,children:i?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[j&&e.jsxRuntimeExports.jsx("span",{className:"mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(u)}),i]}),e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(r))]})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{className:"z-[999] min-w-[300px] p-0",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(o.Command,{children:[e.jsxRuntimeExports.jsx(o.CommandInput,{placeholder:`Choose ${t.toLower(r)}...`}),e.jsxRuntimeExports.jsxs(o.CommandList,{children:[e.jsxRuntimeExports.jsx(o.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(o.CommandGroup,{children:t.map(b,y=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:y,className:`cursor-pointer ${j?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:v=>{s(t.find(b,E=>E===v)||null),h(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(M.Check,{className:`h-4 w-4 text-green-500 ${i===y?"":"opacity-0"}`}),y]}),j?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(t.get(p,y,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(X,{data:t.get(a,y)})})]},y))})]})]})})]})]}),!j&&!t.isEmpty(i)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(X,{data:t.get(a,i,""),fullView:!0})})]})},he=({appliedBindings:r=[],onAddBinding:i,editMode:s,item:a})=>{const[n,u]=g.useState(s?a.key:""),[l,x]=g.useState(s?a.value:""),p=o.useSelectedBlock(),[c]=o.useChaiExternalData(),j=g.useCallback((b,y)=>{if(t.isEmpty(b))return"";{const v=t.get(y==="PROP"?p:c,b,"");if(t.isArray(v))return"list";const E=typeof v;return E==="string"?"text":E==="object"?"model":E}},[p,c]),[m,h]=g.useState(s?j(a.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DialogHeader,{children:[e.jsxRuntimeExports.jsx(o.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx(o.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col gap-1",children:[e.jsxRuntimeExports.jsx(G,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:n,setValue:u,onChange:b=>{const y=j(b,"PROP");u(b),m!==y&&x(""),h(y)},data:p,dataType:m,appliedBindings:r}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(G,{type:"PATH",isDisabled:t.isEmpty(n),placeholder:"Enter data path",value:l,setValue:x,onChange:b=>{const y=j(b,"PATH");x(m===y?b:"")},data:c,dataType:m,appliedBindings:r})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(n)&&t.isEmpty(l),onClick:()=>i({key:n,value:l}),children:"Save"})})]})},te=({disabled:r,children:i,onAddBinding:s,appliedBindings:a,editMode:n=!0,item:u={}})=>{const[l,x]=g.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{disabled:r,asChild:!0,onClick:()=>x(!0),children:i}),l&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(he,{item:u,editMode:n,appliedBindings:a,onAddBinding:p=>{s(p),x(!1)}})})]})},ye=({item:r,onAddBinding:i,onRemove:s,selectedBlock:a,dataProvider:n,appliedBindings:u})=>{const[l,x]=g.useState("string"),p=(c,j)=>{if(t.isEmpty(c))return"";{const m=t.get(j==="PROP"?a:n,c,"");if(t.isArray(m))return"list";const h=typeof m;return h==="string"?"text":h==="object"?"model":h}};return g.useEffect(()=>x(()=>p(r.key,"PROP")),[r.key]),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col rounded-md border border-gray-200 p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm font-normal text-gray-500",children:r.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:r.value}),e.jsxRuntimeExports.jsx(X,{data:t.get(n,r.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(te,{editMode:!0,onAddBinding:i,appliedBindings:u,item:r,children:e.jsxRuntimeExports.jsx(M.EditIcon,{className:"mt-1 h-6 w-6 cursor-pointer rounded border border-blue-400 p-1 text-blue-400 duration-200 hover:scale-105 hover:bg-blue-400 hover:text-white"})}),e.jsxRuntimeExports.jsx(M.TrashIcon,{onClick:()=>s(),className:"mt-1 h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 duration-200 hover:scale-105 hover:bg-red-400 hover:text-white"})]}),!t.isEmpty(l)&&!t.isEmpty(r.key)&&e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-1 mt-px flex h-4 items-center rounded-full px-2 text-[10px] font-medium text-purple-600",children:t.startCase(l)})]})},je=({bindingData:r,onChange:i})=>{const s=o.useSelectedBlock(),[a]=o.useChaiExternalData(),n=$.getChaiDataProviders(),[u,l]=g.useState(t.map(r,(m,h)=>({key:h,value:m})));g.useEffect(()=>{l(t.map(r,(m,h)=>({key:h,value:m})))},[s==null?void 0:s._id,r]);const x=g.useMemo(()=>{if(t.isEmpty(a))return!0;if(t.isEmpty(u))return!1;const m=t.last(u);return t.isEmpty(m==null?void 0:m.key)||t.isEmpty(m==null?void 0:m.value)},[a,u]),p=m=>{const h=t.filter(u,b=>b.key!==m.key);l([...h,m]),j([...h,m])},c=m=>{const h=t.filter(u,(b,y)=>m!==y);j([...h])},j=g.useCallback((m=[])=>{if(l(m),t.isEmpty(m)){i({});return}const h={};t.forEach(m,b=>{!t.isEmpty(b==null?void 0:b.key)&&!t.isEmpty(b==null?void 0:b.value)&&t.set(h,b.key,b.value)}),i(h)},[i]);return t.isEmpty(n)?e.jsxRuntimeExports.jsx("div",{className:"flex w-full items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 text-xs text-gray-500",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(u,(m,h)=>e.jsxRuntimeExports.jsx(ye,{item:m,onAddBinding:p,onRemove:()=>c(h),selectedBlock:s,dataProvider:a,appliedBindings:t.map(u,"key")},m.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{disabled:t.isEmpty(a),className:"w-full",children:e.jsxRuntimeExports.jsx(te,{disabled:x,appliedBindings:t.map(u,"key"),onAddBinding:p,children:e.jsxRuntimeExports.jsx("span",{className:`w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${x?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(a)?e.jsxRuntimeExports.jsx("small",{className:"text-[9.5px] text-gray-500",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),x&&e.jsxRuntimeExports.jsx(o.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(a)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},be=()=>e.jsxRuntimeExports.jsx("div",{className:"text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100",children:"Data binding is set for this field"}),W=g.memo(({id:r,properties:i,formData:s,onChange:a})=>{const[n,u]=g.useState(s),l={type:"object",properties:{}},x={};Object.keys(i).forEach(c=>{const j=i[c];if(t.includes(["slot","styles"],j.type))return;const m=c;l.properties[m]=o.getBlockJSONFromSchemas(j),x[m]=o.getBlockJSONFromUISchemas(j)}),g.useEffect(()=>{u(s)},[r]);const p=z.useThrottledCallback(async({formData:c},j)=>{a({formData:c},j)},[a],1e3);return e.jsxRuntimeExports.jsx(ae,{widgets:{binding:be,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:pe,uiSchema:x,schema:l,formData:n,onChange:({formData:c},j)=>{j&&(u(c),p({formData:c},j))}})}),fe=()=>{const[r,i]=ue.useCanvasSettings(),s=o.useSelectedBlockCanvasSetting(),a=(l,x)=>{i(p=>({...p,[l]:x}))};if(t.isEmpty(s))return null;const{block:n,settings:u}=s;return e.jsxRuntimeExports.jsxs("div",{className:"text-xs hover:no-underline",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 px-4 py-2",children:[s.block._type," settings"]}),e.jsxRuntimeExports.jsx("div",{className:"bg-white pb-2",children:e.jsxRuntimeExports.jsx(W,{id:n==null?void 0:n._id,onChange:({formData:l})=>a(n._id,l),formData:t.get(r,n._id,{}),properties:u})})]})};function ve(){const r=o.useSelectedBlock(),i=o.useUpdateBlocksPropsRealtime(),s=o.useUpdateBlocksProps(),a=$.getBlockComponent(r._type),n={...r},[u,l]=g.useState(n),x=o.useBuilderProp("dataBindingSupport",!1),p=({formData:y},v,E)=>{if(v&&(u==null?void 0:u._id)===r._id){const T=v.replace("root.","");s([r._id],{[T]:t.get(y,T)},E)}},c=g.useCallback(t.debounce(({formData:y},v,E)=>{p({formData:y},v,E),l(y)},1500),[r==null?void 0:r._id]),j=({formData:y},v)=>{if(v){const E=v.replace("root.","");i([r._id],{[E]:t.get(y,E)}),c({formData:y},v,{[E]:t.get(u,E)})}},m={_name:le.l({title:"Name",default:t.get(r,"_name",r._type)})},h=t.keys(t.get(n,"_bindings",{})),b=g.useMemo(()=>{const y=t.cloneDeep(t.get(a,"props",{}));return x&&t.each(h,v=>delete y[v]),y},[a,h,x]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(W,{id:r==null?void 0:r._id,onChange:j,formData:n,properties:m}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),e.jsxRuntimeExports.jsx(fe,{}),x?e.jsxRuntimeExports.jsxs(o.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"px-4 pt-4",children:e.jsxRuntimeExports.jsx(je,{bindingData:t.get(r,"_bindings",{}),onChange:y=>{p({formData:{_bindings:y}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(o.AccordionContent,{className:"pt-4",children:[t.isEmpty(h)?null:e.jsxRuntimeExports.jsxs("div",{className:"mx-4 mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(h,t.capitalize).join(", ")})," ",h.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(W,{id:r==null?void 0:r._id,onChange:j,formData:n,properties:b})]})]})]}):e.jsxRuntimeExports.jsx(W,{id:r==null?void 0:r._id,onChange:j,formData:n,properties:b}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const K=new xe(A.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Re(){var V;const[r]=o.useSelectedStylingBlocks(),i=o.useSelectedBlock(),s=o.useAddClassesToBlocks(),a=o.useRemoveClassesFromBlocks(),[n]=o.useSelectedBlockIds(),[u,l]=g.useState(""),{toast:x}=o.useToast(),p=(V=t.first(r))==null?void 0:V.prop,c=t.reject((t.get(i,p,"").replace(ce.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),j=()=>{const w=u.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");s(n,w,!0),l("")},[m,h]=g.useState([]),b=({value:w})=>{const k=w.trim().toLowerCase(),N=k.match(/.+:/g);let _=[];if(N&&N.length>0){const[D]=N,f=k.replace(D,"");_=K.search(f).map(C=>({...C,item:{...C.item,name:D+C.item.name}}))}else _=K.search(k);h(t.map(_,"item"))},y=()=>{h([])},v=w=>w.name,E=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),T={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:u,onKeyDown:w=>{w.key==="Enter"&&u.trim()!==""&&j()},onChange:(w,{newValue:k})=>l(k),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"},I=()=>{if(navigator.clipboard===void 0){x({title:"Clipboard not supported",description:"Please use Chrome, Firefox or Safari",variant:"destructive"});return}navigator.clipboard.writeText(c.join(" ")),x({title:"Copied",description:"Classes copied to clipboard"})};return e.jsxRuntimeExports.jsxs("div",{className:`no-scrollbar flex ${m.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-5 overflow-y-auto bg-gray-100 px-px`,children:[e.jsxRuntimeExports.jsxs(o.Label,{className:"mt-2 flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("span",{children:"Add Tailwind classes"}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(d.CopyIcon,{onClick:I,className:"cursor-pointer"})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:"Copy classes to clipboard"})})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"relative -mt-4 flex items-center gap-x-3",children:[e.jsxRuntimeExports.jsx("div",{className:"relative flex w-full items-center gap-x-3",children:e.jsxRuntimeExports.jsx(de,{suggestions:m,onSuggestionsFetchRequested:b,onSuggestionsClearRequested:y,getSuggestionValue:v,renderSuggestion:E,inputProps:T,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"bg-gray-700 ",suggestionsContainerOpen:"absolute bg-gray-100 z-50 max-h-[230px] overflow-y-auto w-full border border-gray-600 rounded-md"}})}),e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:j,disabled:u.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(c)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-10 w-full items-center justify-center text-center text-sm text-gray-400",children:"No class added"}),O.Children.toArray(c.map(w=>e.jsxRuntimeExports.jsxs("div",{className:"group relative truncate max-w-[260px] flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",children:[w,e.jsxRuntimeExports.jsx(d.Cross2Icon,{onClick:()=>a(n,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer "})]},w)))]})]})}const S=["px","%","em","rem","ch","vh","vw"],Ee={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:S,property:"flexBasis"},{type:"range",label:"flex.order",property:"order"},{type:"dropdown",label:"flex.flex",property:"flexGrowShrink"},{type:"dropdown",label:"flex.grow",property:"flexGrow"},{type:"dropdown",label:"flex.shrink",property:"flexShrink"}]},we={heading:"grid.heading",items:[{type:"range",label:"grid.col_span",property:"gridColSpan"},{type:"range",label:"grid.col_start",property:"gridColStart"},{type:"range",label:"grid.col_end",property:"gridColEnd"},{type:"range",label:"grid.row_span",property:"gridRowSpan"},{type:"range",label:"grid.row_start",property:"gridRowStart"},{type:"range",label:"grid.row_end",property:"gridRowEnd"},{type:"range",label:"grid.order",property:"order"}]},Ce=[{heading:"layout.heading",items:[{type:"arbitrary",label:"layout.width",units:S.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:S.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...S,"auto"],options:[{key:"margin",label:"layout.margin_all"},{key:"marginX",label:"layout.margin_lr"},{key:"marginY",label:"layout.margin_tb"},{key:"marginTop",label:"layout.margin_top"},{key:"marginRight",label:"layout.margin_right"},{key:"marginBottom",label:"layout.margin_bottom"},{key:"marginLeft",label:"layout.margin_left"}]},{styleType:"multiple",label:"layout.padding",options:[{key:"padding",label:"layout.padding_all"},{key:"paddingX",label:"layout.padding_lr"},{key:"paddingY",label:"layout.padding_tb"},{key:"paddingTop",label:"layout.padding_top"},{key:"paddingRight",label:"layout.padding_right"},{key:"paddingBottom",label:"layout.padding_bottom"},{key:"paddingLeft",label:"layout.padding_left"}]},{styleType:"multiple",label:"layout.space_bt",options:[{key:"spaceX",label:"layout.space_lr"},{key:"spaceY",label:"layout.space_tb"}]}]},{heading:"size.heading",items:[{styleType:"accordion",heading:"size.min_width_height",items:[{type:"arbitrary",label:"size.min_width",units:S.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"size.min_height",units:S.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"size.max_width_height",items:[{type:"arbitrary",label:"size.max_width",units:S.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"size.max_height",units:S.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"size.object_options_aspect_ratio",items:[{type:"dropdown",label:"size.aspect",property:"aspectRatio"},{type:"dropdown",label:"size.fit",property:"objectFit"},{type:"dropdown",label:"size.position",property:"objectPosition"}]}]},{heading:"display.heading",items:[{type:"dropdown",label:"display.display",property:"display",units:S},{styleType:"accordion",heading:"display.flex_options",items:[{type:"dropdown",label:"display.flex_direction",property:"flexDirection"},{type:"dropdown",label:"display.flex_wrap",property:"flexWrap"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"display.grid_options",items:[{type:"range",label:"display.grid_columns",property:"gridColumns"},{type:"range",label:"display.grid_rows",property:"gridRows"},{type:"dropdown",label:"display.grid_auto_flow",property:"gridAutoFlow"},{type:"dropdown",label:"display.grid_auto_cols",property:"gridAutoColumns"},{type:"dropdown",label:"display.grid_auto_rows",property:"gridAutoRows"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",units:["px","rem"],options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"display.visibility_opacity",items:[{type:"dropdown",label:"display.visibility",property:"visibility",units:S},{type:"arbitrary",label:"display.opacity",property:"opacity",units:["-"]}]}]},{heading:"position.heading",items:[{type:"icons",label:"position.position",property:"position"},{styleType:"accordion",heading:"position.options",items:[{styleType:"multiple",label:"position.direction",options:[{key:"top",label:"position.top"},{key:"right",label:"position.right"},{key:"bottom",label:"position.bottom"},{key:"left",label:"position.left"}]},{styleType:"multiple",label:"position.inset",options:[{key:"inset",label:"position.all"},{key:"insetX",label:"position.lr"},{key:"insetY",label:"position.tb"}]},{type:"arbitrary",label:"position.z_index",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"position.float_clear",items:[{type:"icons",label:"position.float",property:"float"},{type:"dropdown",label:"position.clear",property:"clear"}]},{styleType:"accordion",heading:"position.overflow_overscroll",items:[{styleType:"multiple",type:"dropdown",label:"position.overflow",options:[{key:"overflow",label:"position.all"},{key:"overflowX",label:"position.lr"},{key:"overflowY",label:"position.tb"}]},{styleType:"multiple",type:"dropdown",label:"position.overscroll",options:[{key:"overscroll",label:"position.all"},{key:"overscrollX",label:"position.lr"},{key:"overscrollY",label:"position.tb"}]}]}]},{heading:"typography.heading",items:[{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:S},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:S.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"},{styleType:"accordion",heading:"typography.alignments",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"verticalAlign",label:"typography.valign"}]},{styleType:"accordion",heading:"typography.spacing_decoration_more",items:[{type:"dropdown",property:"letterSpacing",label:"typography.spacing"},{type:"dropdown",property:"textDecoration",label:"typography.decoration"},{type:"range",property:"textDecorationThickness",label:"typography.thickness"},{type:"dropdown",property:"textTransform",label:"typography.transform"}]},{styleType:"accordion",heading:"typography.whitespace_breaks",items:[{type:"dropdown",property:"whitespace",label:"typography.whitespace"},{type:"dropdown",property:"wordbreak",label:"typography.wordbreak"}]}]},{heading:"background.heading",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{styleType:"accordion",heading:"background.position_size_more",items:[{type:"dropdown",label:"background.attachment",property:"backgroundAttachment"},{type:"dropdown",label:"background.clipping",property:"backgroundClip"},{type:"dropdown",label:"background.origin",property:"backgroundOrigin"},{type:"dropdown",label:"background.position",property:"backgroundPosition"},{type:"dropdown",label:"background.repeat",property:"backgroundRepeat"},{type:"dropdown",label:"background.size",property:"backgroundSize"}]},{type:"dropdown",label:"background.gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"background.gradient_colors",items:[{type:"color",label:"background.from_color",property:"fromColor"},{type:"color",label:"background.via_color",property:"viaColor"},{type:"color",label:"background.to_color",property:"toColor"}]}]},{heading:"border.heading",items:[{styleType:"multiple",type:"dropdown",label:"border.width",options:[{key:"border",label:"border.all"},{key:"borderX",label:"border.lr"},{key:"borderY",label:"border.tb"},{key:"borderTop",label:"border.top"},{key:"borderRight",label:"border.right"},{key:"borderBottom",label:"border.bottom"},{key:"borderLeft",label:"border.left"}]},{styleType:"multiple",type:"dropdown",label:"border.corners",options:[{key:"borderRadius",label:"border.all"},{key:"borderRadiusTop",label:"border.top"},{key:"borderRadiusRight",label:"border.right"},{key:"borderRadiusBottom",label:"border.bottom"},{key:"borderRadiusLeft",label:"border.left"},{key:"borderRadiusTopLeft",label:"border.top_left"},{key:"borderRadiusTopRight",label:"border.top_right"},{key:"borderRadiusBottomRight",label:"border.bottom_right"},{key:"borderRadiusBottomLeft",label:"border.bottom_left"}]},{type:"color",label:"border.color",property:"borderColor"},{type:"dropdown",label:"border.style",property:"borderStyle"},{styleType:"accordion",heading:"border.divide_options",items:[{styleType:"multiple",type:"range",label:"border.width",options:[{key:"divideXWidth",label:"border.lr"},{key:"divideYWidth",label:"border.tb"}]},{type:"color",label:"border.divide_color",property:"divideColor"},{type:"dropdown",label:"border.divide_style",property:"divideStyle"}]},{styleType:"accordion",heading:"border.outline_styling",items:[{type:"range",label:"border.outline_width",property:"outlineWidth"},{type:"range",label:"border.outline_offset",property:"outlineOffset"},{type:"dropdown",label:"border.outline_style",property:"outlineStyle"}]},{styleType:"accordion",heading:"border.ring_options",items:[{type:"range",label:"border.ring_width",property:"ringWidth"},{type:"color",label:"border.ring_color",property:"ringColor"},{type:"range",label:"border.ring_offset_width",property:"ringOffsetWidth"},{type:"color",label:"border.ring_offset_color",property:"ringOffsetColor"}]}]},{heading:"effect.heading",items:[{type:"range",label:"effect.shadow",property:"boxShadow"},{type:"color",label:"effect.color",property:"boxShadowColor"},{type:"dropdown",label:"effect.cursor",property:"cursor"},{styleType:"accordion",heading:"effect.blend_cursor",items:[{type:"dropdown",label:"effect.mix_blend",property:"mixBlendMode"},{type:"dropdown",label:"effect.bg_blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"effect.transform",items:[{type:"dropdown",label:"effect.origin",property:"transformOrigin"},{styleType:"multiple",label:"effect.scale",units:["-"],options:[{key:"scale",label:"effect.all"},{key:"scaleX",label:"effect.lr"},{key:"scaleY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.skew",units:["deg"],options:[{key:"skewX",label:"effect.lr"},{key:"skewY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.translate",negative:!0,options:[{key:"translateX",label:"effect.lr"},{key:"translateY",label:"effect.tb"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"effect.rotate",property:"rotate"}]},{styleType:"accordion",heading:"effect.animation",items:[{type:"dropdown",label:"effect.animation",property:"animation"},{type:"dropdown",label:"effect.transition",property:"transition"},{type:"dropdown",label:"effect.easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"effect.duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"effect.delay",property:"delay"}]}]},{heading:"classes.heading",items:[{component:Re}]}],se={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:d.EyeOpenIcon,invisible:d.EyeClosedIcon,hidden:d.EyeClosedIcon,gap:d.BorderAllIcon,gapX:d.WidthIcon,gapY:d.HeightIcon,spaceX:d.WidthIcon,spaceY:d.HeightIcon,overscroll:d.BorderAllIcon,overscrollX:d.WidthIcon,overscrollY:d.HeightIcon,overflow:d.BorderAllIcon,overflowX:d.WidthIcon,overflowY:d.HeightIcon,top:d.ArrowUpIcon,right:d.ArrowRightIcon,bottom:d.ArrowDownIcon,left:d.ArrowLeftIcon,inset:d.BorderAllIcon,insetX:d.WidthIcon,insetY:d.HeightIcon,border:d.BorderAllIcon,borderX:d.WidthIcon,borderY:d.HeightIcon,borderTop:d.ArrowUpIcon,borderRight:d.ArrowRightIcon,borderBottom:d.ArrowDownIcon,borderLeft:d.ArrowLeftIcon,borderRadius:d.BorderAllIcon,borderRadiusX:d.WidthIcon,borderRadiusY:d.HeightIcon,borderRadiusTop:d.ArrowUpIcon,borderRadiusRight:d.ArrowRightIcon,borderRadiusBottom:d.ArrowDownIcon,borderRadiusLeft:d.ArrowLeftIcon,borderRadiusTopLeft:d.ArrowTopLeftIcon,borderRadiusTopRight:d.ArrowTopRightIcon,borderRadiusBottomRight:d.ArrowBottomRightIcon,borderRadiusBottomLeft:d.ArrowBottomLeftIcon,divideXWidth:d.WidthIcon,divideYWidth:d.HeightIcon,scale:d.BorderAllIcon,scaleX:d.WidthIcon,scaleY:d.HeightIcon,skewX:d.WidthIcon,skewY:d.HeightIcon,translateX:d.WidthIcon,translateY:d.HeightIcon,padding:d.BorderAllIcon,paddingX:d.WidthIcon,paddingY:d.HeightIcon,paddingTop:d.ArrowUpIcon,paddingRight:d.ArrowRightIcon,paddingBottom:d.ArrowDownIcon,paddingLeft:d.ArrowLeftIcon,margin:d.BorderAllIcon,marginX:d.WidthIcon,marginY:d.HeightIcon,marginTop:d.ArrowUpIcon,marginRight:d.ArrowRightIcon,marginBottom:d.ArrowDownIcon,marginLeft:d.ArrowLeftIcon,textLeft:d.AlignLeftIcon,textCenter:d.AlignCenterHorizontallyIcon,textRight:d.AlignRightIcon,textJustify:d.StretchHorizontallyIcon,italic:d.FontItalicIcon,underline:d.UnderlineIcon,overline:d.OverlineIcon,uppercase:d.LetterCaseUppercaseIcon,block:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":d.Cross2Icon,fixed:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",fill:"currentColor"})]}),static:d.Cross1Icon},L=g.createContext({canReset:!1,canChange:!0}),ke=({children:r,canReset:i=!1,canChange:s=!0})=>e.jsxRuntimeExports.jsx(L.Provider,{value:{canReset:i,canChange:s},children:r}),re=({label:r,property:i,onChange:s})=>{const a=g.useMemo(()=>t.get(A.CLASSES_LIST,`${i}.classes`,[""]),[i]),n=q(i),u=g.useMemo(()=>t.get(n,"cls",""),[n]),{canChange:l}=g.useContext(L),x=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:r?"w-full rounded":"grow",children:x?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:u}),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(Z,{rounded:r,onChange:p=>s(p,i),selected:u,options:a,disabled:!l})})};function Z({selected:r,onChange:i,rounded:s=!1,options:a,disabled:n=!1}){const u=r.replace(/.*:/g,"").trim(),{undo:l,redo:x}=o.useUndoManager();return e.jsxRuntimeExports.jsxs("select",{disabled:!a.length||n,className:`${s?"rounded-md border border-border":"border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:p=>i(p.target.value),onKeyDown:p=>{p.ctrlKey&&(p.key==="z"&&l(),p.key==="y"&&x())},value:u,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),g.Children.toArray(a.map(p=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:p,children:p})))]})}const Ne=({property:r,onChange:i})=>{const{canReset:s,canChange:a}=g.useContext(L),n=q(r),u=g.useMemo(()=>t.get(n,"cls",""),[n]),l=g.useMemo(()=>t.get(A.CLASSES_LIST,`${r}.classes`,[""]),[r]),x=l.indexOf(u)>-1?l.indexOf(u):0,p=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:p?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:u}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!a&&(!s||x-1<0),onClick:()=>i(t.nth(l,x-1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.MinusIcon,{className:!a&&(!s||x-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(re,{label:!1,property:r,onChange:i})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!a&&(!s||x+1>=l.length),onClick:()=>i(t.nth(l,x+1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{className:!a&&(!s||x+1>=l.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Se=({property:r,onChange:i})=>{const s=g.useMemo(()=>t.get(A.CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:a}=g.useContext(L),n=q(r),u=g.useMemo(()=>t.get(n,"cls",""),[n]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(s,l=>e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!a,onClick:()=>i(l,r),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${u===l?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:g.createElement(t.get(se,l,d.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(l))})]}))})},Te={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Ie=({property:r,onChange:i})=>{const s=q(r),a=g.useMemo(()=>t.get(s,"cls",""),[s]),{canChange:n}=g.useContext(L),[u,l]=g.useState([]),[x,p]=g.useState({color:"",shade:""}),c=a.split("-"),j=t.get(c,"1",""),m=t.get(c,"2",""),h=g.useCallback(y=>{["current","inherit","transparent","black","white"].includes(y)?(l([]),p({color:y})):(l(["50","100","200","300","400","500","600","700","800","900"]),p(v=>({...v,color:y,shade:v.shade?v.shade:"500"})))},[l,p]);g.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(j))return l([]);l(["50","100","200","300","400","500","600","700","800","900"])},[j]);const b=g.useCallback(y=>{p({color:j,shade:y})},[j]);return g.useEffect(()=>{p({color:"",shade:""})},[s]),g.useEffect(()=>{const v=`${t.get(Te,r,"")}-${x.color}${x.shade?`-${x.shade}`:""}`;v.match(new RegExp(t.get(A.CLASSES_LIST,`${r}.regExp`,"")))&&i(v,r)},[x,i,r]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:e.jsxRuntimeExports.jsx(Z,{disabled:!n,rounded:!0,selected:j,onChange:h,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(Z,{rounded:!0,selected:m,disabled:!j||!n,onChange:b,options:u})})]})},J=(r,i)=>{r=r.toLowerCase();let s=r.trim().replace(/ |\+/g,"");if((s==="auto"||s==="none")&&i.includes(s))return{value:"",unit:s};const a=i.length?new RegExp(i.join("|"),"g"):/XXXXXX/g;s=s.replace(a,"");const n=r.match(a),u=n&&n.length>1,l=!t.isEmpty(s)&&Number.isNaN(Number(s));return u||l?{error:"Invalid value"}:n&&(n[0]==="auto"||n[0]==="none")?{value:n[0],unit:""}:{value:s,unit:n?n[0]:""}};const _e=r=>{const i=r.startsWith("-")?"-":"",s=r.split("-").pop();if(["auto","none"].includes(s))return{value:"",unit:s};if(s==="px")return{value:"1",unit:"px"};if(s==="screen")return{value:"100",unit:r.indexOf("w-")!==-1?"vw":"vh"};if(s==="full")return{value:"100",unit:"%"};if(t.includes(r,"skew-"))return{value:`${i}${s}`,unit:"deg"};if(t.includes(r,"rotate-"))return{value:`${i}${s}`,unit:"deg"};if(t.includes(r,"opacity-"))return{value:`${s/100}`,unit:"-"};if(t.includes(r,"duration-")||t.includes(r,"delay-"))return{value:`${s}`,unit:"ms"};if(t.includes(r,"translate-")&&!s.includes("/"))return{value:`${i}${`${s/4}`}`,unit:"rem"};if(t.includes(r,"scale-"))return{value:`${i}${`${s/100}`}`,unit:"-"};if(t.startsWith(r,"border")){const a=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(a)return{value:a[0].split("-").pop(),unit:"px"};if(r.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(r,"max-w-")){if(r==="max-w-screen-sm")return{value:"640",unit:"px"};if(r==="max-w-screen-md")return{value:"768",unit:"px"};if(r==="max-w-screen-lg")return{value:"1024",unit:"px"};if(r==="max-w-screen-xl")return{value:"1280",unit:"px"};if(r==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(s==="xs")return{value:"320",unit:"px"};if(s==="sm")return{value:"384",unit:"px"};if(s==="md")return{value:"448",unit:"px"};if(s==="lg")return{value:"512",unit:"px"};if(s==="xl")return{value:"576",unit:"px"};if(s==="2xl")return{value:"672",unit:"px"};if(s==="3xl")return{value:"768",unit:"px"};if(s==="4xl")return{value:"896",unit:"px"};if(s==="5xl")return{value:"1024",unit:"px"};if(s==="6xl")return{value:"1152",unit:"px"};if(s==="7xl")return{value:"1280",unit:"px"};if(s==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(r,"text-")){if(s==="xs")return{value:"12",unit:"px"};if(s==="sm")return{value:"14",unit:"px"};if(s==="base")return{value:"16",unit:"px"};if(s==="lg")return{value:"18",unit:"px"};if(s==="xl")return{value:"20",unit:"px"};if(s==="2xl")return{value:"24",unit:"px"};if(s==="3xl")return{value:"30",unit:"px"};if(s==="4xl")return{value:"36",unit:"px"};if(s==="5xl")return{value:"48",unit:"px"};if(s==="6xl")return{value:"60",unit:"px"};if(s==="7xl")return{value:"72",unit:"px"};if(s==="8xl")return{value:"96",unit:"px"};if(s==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(r,"leading-")){if(s==="none")return{value:"1",unit:"-"};if(s==="tight")return{value:"1.25",unit:"-"};if(s==="snug")return{value:"1.375",unit:"-"};if(s==="normal")return{value:"1.5",unit:"-"};if(s==="relaxed")return{value:"1.625",unit:"-"};if(s==="loose")return{value:"2",unit:"-"}}if(t.startsWith(r,"tracking-")){if(s==="tighter")return{value:"-0.05",unit:"em"};if(s==="tight")return{value:"-0.025",unit:"em"};if(s==="normal")return{value:"0",unit:"em"};if(s==="wide")return{value:"0.025",unit:"em"};if(s==="wider")return{value:"0.05",unit:"em"};if(s==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(s))return{value:r,unit:"class"};if(s.includes("/")){const[a,n]=t.map(s.split("/"),u=>parseInt(u,10));return{value:i+(a/n*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(s))?{value:`${i+parseFloat(s)*4}`,unit:"px"}:{value:s,unit:"class"}};const Be=r=>{if(t.isEmpty(r))return{value:"",unit:""};const i=r.match(/\[.*\]/g);if(i===null)return He(r);const s=t.get(i,"0","").replace(/\[|\]/g,""),a=r.startsWith("-")?"-":"",n=t.first(s.match(/\d+.\d+|\d+/g));return{value:`${a}${n}`,unit:s.replace(n,"")}},He=r=>t.isEmpty(r)?{value:"",unit:""}:_e(r),oe=g.createContext({setDragData:()=>{}}),Ve=({unit:r,currentValue:i,onDrag:s,onDragEnd:a,onDragStart:n,negative:u,cssProperty:l})=>{const{setDragData:x}=g.useContext(oe);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:p=>{const c={onDrag:s,onDragEnd:a,dragging:!0,dragStartY:p.pageY,dragStartValue:`${i}`,dragUnit:r,negative:u,cssProperty:l};n(c),x(c)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:e.jsxRuntimeExports.jsx(d.RowSpacingIcon,{})})},De=({onSelect:r,current:i,units:s})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:s.map(a=>e.jsxRuntimeExports.jsx(o.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:i===a?"primary":void 0,size:"sm",onClick:n=>{n.stopPropagation(),r(a)},children:a},a))}),Q=50,Ae=r=>{const[i,s]=g.useState(!1),[a,n]=g.useState(""),{currentClass:u,onChange:l,classPrefix:x,cssProperty:p,units:c,negative:j}=r,[m,h]=g.useState(p!=null&&p.toLowerCase().includes("width")?"%":c[0]),[b,y]=g.useState(!1),[v,E]=g.useState(""),[T,I]=g.useState(!1),[V,w]=g.useState(!1);g.useEffect(()=>{const{value:f,unit:R}=Be(u);if(R===""){n(f),h(p!=null&&p.toLowerCase().includes("width")?"%":t.first(c));return}h(R),n(R==="class"||t.isEmpty(f)?"":f)},[u,p,c]);const k=z.useThrottledCallback(f=>l(f),[l],Q),N=z.useThrottledCallback(f=>l(f,!1),[l],Q),_=g.useCallback((f=!1)=>{const R=J(`${a}`,c);if(t.get(R,"error",!1)){y(!0);return}const C=t.get(R,"unit")!==""?t.get(R,"unit"):m;if(C==="auto"||C==="none"){k(`${x}${C}`);return}if(t.get(R,"value")==="")return;const P=`${t.get(R,"value","").startsWith("-")?"-":""}${x}[${t.get(R,"value","").replace("-","")}${C==="-"?"":C}]`;f?N(P):k(P)},[k,N,a,m,x,c]),D=g.useCallback(f=>{const R=J(`${a}`,c);if(t.get(R,"error",!1)){y(!0);return}if(f==="auto"||f==="none"){k(`${x}${f}`);return}if(t.get(R,"value")==="")return;const C=t.get(R,"unit")!==""?t.get(R,"unit"):f,P=`${t.get(R,"value","").startsWith("-")?"-":""}${x}[${t.get(R,"value","").replace("-","")}${C==="-"?"":C}]`;k(P)},[k,a,x,c]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:m==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:u}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${T?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(m)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:m==="class",onKeyPress:f=>{f.key==="Enter"&&_()},onKeyDown:f=>{if(f.keyCode!==38&&f.keyCode!==40)return;f.preventDefault(),w(!0);const R=t.parseInt(f.target.value);let C=t.isNaN(R)?0:R;f.keyCode===38&&(C+=1),f.keyCode===40&&(C-=1);const H=`${C}`,ie=`${H.startsWith("-")?"-":""}${x}[${H.replace("-","")}${m==="-"?"":m}]`;N(ie)},onKeyUp:f=>{V&&(f.preventDefault(),w(!1))},onBlur:()=>_(),onChange:f=>{y(!1),n(f.target.value)},onClick:f=>{var R;(R=f==null?void 0:f.target)==null||R.select(),s(!1)},value:T?v:a,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",b?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{open:i,delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>s(!i),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${c.length===1?"px-2 font-semibold":""}`,children:m}),c.length>1?e.jsxRuntimeExports.jsx(d.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(o.TooltipPortal,{children:e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(De,{units:c,current:m,onSelect:f=>{s(!1),h(f),D(f)}})})})]})]}),["none","auto"].indexOf(m)!==-1||T?null:e.jsxRuntimeExports.jsx(Ve,{onDragStart:()=>I(!0),onDragEnd:f=>{if(E(()=>""),I(!1),t.isEmpty(f))return;const R=`${f}`,H=`${R.startsWith("-")?"-":""}${x}[${R.replace("-","")}${m==="-"?"":m}]`;k(H)},onDrag:f=>{if(t.isEmpty(f))return;E(f);const R=`${f}`,H=`${R.startsWith("-")?"-":""}${x}[${R.replace("-","")}${m==="-"?"":m}]`;N(H)},currentValue:a,unit:m,negative:j,cssProperty:p})]})})})},q=r=>{const i=o.useSelectedBlockCurrentClasses();return t.findLast(i,{property:r})},Pe=(r,i)=>{const s={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return s[t.get(r,"mq","xs")]<=s[i]},Me={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},ee={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},$e=r=>`${r.toUpperCase()} ${ee[r]?`(${ee[r]} & up)`:""}`,U=r=>{const{t:i}=B.useTranslation(),{type:s="icons",label:a,property:n,onEmitChange:u=()=>{},units:l,negative:x=!1}=r,[p]=o.useDarkMode(),[c]=o.useStylingState(),[,j]=o.useCanvasWidth(),m=q(n),h=o.useAddClassesToBlocks(),b=o.useRemoveClassesFromBlocks(),[y]=o.useSelectedBlockIds(),v=g.useMemo(()=>t.get(m,"fullCls",""),[m]),E=g.useCallback((N,_=!0)=>{const D={dark:p,mq:j,mod:c,cls:N,property:n,fullCls:""};(p||c!=="")&&(D.mq="xs");const f=A.generateFullClsName(D);h(y,[f],_)},[y,p,j,c,n,h]),T=g.useCallback(()=>{b(y,[v])},[y,v,b]),I=g.useMemo(()=>Pe(m,j),[m,j]);g.useEffect(()=>{u(I,m)},[I,u,m]);const[,,V]=o.useCanvasWidth(),w=g.useCallback(N=>{V({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[N])},[V]),k=t.get(m,"dark",null)===p&&t.get(m,"mod",null)===c&&t.get(m,"mq",null)===j;return e.jsxRuntimeExports.jsx(ke,{canChange:I,canReset:m&&k,children:e.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:e.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${m&&!k?"text-foreground":""}`,children:i(a)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[s==="arbitrary"?e.jsxRuntimeExports.jsx(Ae,{currentClass:t.get(m,"cls",""),classPrefix:t.get(Me,n,""),units:l||[],onChange:E,negative:x,cssProperty:n}):null,s==="icons"&&e.jsxRuntimeExports.jsx(Se,{property:n,onChange:E}),s==="range"&&e.jsxRuntimeExports.jsx(Ne,{property:n,onChange:E}),s==="color"&&e.jsxRuntimeExports.jsx(Ie,{property:n,onChange:E}),s==="dropdown"&&e.jsxRuntimeExports.jsx(re,{label:a,property:n,onChange:E})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${v?"visible":"invisible"}`,children:k?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>T(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(d.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):I&&m?e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("div",{className:"text-right",children:e.jsxRuntimeExports.jsxs("div",{children:["Current style is set at  ",e.jsxRuntimeExports.jsxs("span",{className:"font-bold",children:[$e(t.get(m,"mq")),p&&!m.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>w(t.get(m,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(m,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Le=["px","%","em","rem","ch","vh","vw"],ne=({label:r,options:i,borderB:s=!1,borderT:a=!1,type:n="arbitrary",units:u=Le,negative:l=!1})=>{const{t:x}=B.useTranslation(),[p,c]=g.useState(i[0].key),j=o.useSelectedBlockCurrentClasses(),m=g.useCallback(h=>t.map(j,"property").includes(h),[j]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${s?"border-b":""} ${a?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[r&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:x(r)}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:g.Children.toArray(i.map(({label:h,key:b})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>c(b),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${b===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[g.createElement("div",{className:m(b)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),g.createElement(t.get(se,b,d.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(h))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(U,{type:n,units:[...u],label:"",property:p,negative:l})})]})},qe=({heading:r,items:i})=>{const{t:s}=B.useTranslation(),a=o.useSelectedBlockCurrentClasses(),n=g.useMemo(()=>{const u=p=>t.flatten(p.map(c=>c.styleType==="multiple"?t.map(c.options,"key"):c.property)),l=t.flatten(i.map(p=>p.styleType==="accordion"?u(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),x=t.map(a,"property");return t.intersection(l,x).length>0},[a,i]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[s(r),n?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${n?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:i.map(u=>u.styleType==="multiple"?e.jsxRuntimeExports.jsx(ne,{...u},u.label):e.jsxRuntimeExports.jsx(U,{...u},u.label))})]})},Oe=g.createContext({}),Y=({section:r})=>{const{t:i}=B.useTranslation(),s=o.useSelectedBlockCurrentClasses(),a=g.useCallback((l=[])=>{const x={};for(let c=0;c<s.length;c++)x[s[c].property]=s[c].cls;let p=!0;for(const c in l)if(!t.has(x,c)||x[c]!==l[c]){p=!1;break}return p},[s]),n=g.useMemo(()=>{if(s.length>0&&r.heading==="classes.heading")return!0;const l=c=>t.flatten(c.map(j=>j.styleType==="multiple"?t.flatten(t.map(j.options,"key")):j.property)),x=t.flatten(r.items.map(c=>c.styleType==="accordion"?l(c.items):c.styleType==="multiple"?t.flatten(t.map(c.options,"key")):c.property)),p=t.map(s,"property");return t.intersection(x,p).length>0},[s,r.heading,r.items]),u=g.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Oe.Provider,{value:u,children:e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${n?"bg-blue-500":"bg-gray-300"}`}),i(r.heading)]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:g.Children.toArray(r.items.map(l=>t.has(l,"component")?g.createElement(l.component,{key:l.label}):t.has(l,"styleType")?l.styleType==="multiple"?e.jsxRuntimeExports.jsx(ne,{...l},l.label):l.styleType==="accordion"&&a(l==null?void 0:l.conditions)?e.jsxRuntimeExports.jsx(qe,{...l},l.label):null:e.jsxRuntimeExports.jsx(U,{...l},l.label)))})]})})},We=()=>{const r=o.useSelectedBlock(),[i]=o.useSelectedStylingBlocks(),{t:s}=B.useTranslation(),a=$.useGlobalStylingPresets(),n=o.useAddClassesToBlocks(),u=$.getBlockComponent(r._type),l=t.get(t.first(i),"prop"),x=t.get(u.props,`${l}.presets`,{});if(t.isEmpty(a)&&(!t.has(u,"props")||t.isEmpty(x)))return null;const p=c=>{const j=c.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");n([r._id],j,!0)};return e.jsxRuntimeExports.jsx("div",{className:"h-10",children:e.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"px-4",children:e.jsxRuntimeExports.jsxs(o.Button,{variant:"default",className:"w-full",size:"sm",children:[s("Apply Presets"),e.jsxRuntimeExports.jsx(d.CaretDownIcon,{})]})})}),e.jsxRuntimeExports.jsx(o.DropdownMenuContent,{className:"max-h-80 w-56",children:e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar h-full",children:[t.isEmpty(x)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DropdownMenuLabel,{children:[u.type," ",s("presets")]}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(x).map(c=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>p(x[c]),children:[t.capitalize(t.startCase(s(c))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:s("apply")})]}))})]}),t.isEmpty(a)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:s("Global presets")}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(a).map(c=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>p(a[c]),children:[t.capitalize(t.startCase(s(c))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:s("apply")})]}))})]})]})})]})})};function ze(){const[r,i]=o.useStylingState(),{flexChild:s,gridChild:a}=o.useSelectedBlocksDisplayChild(),{t:n}=B.useTranslation(),u=o.useSelectedBlockCustomStylingStates(),[l]=o.useSelectedStylingBlocks();return t.isEmpty(l)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(d.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:n("no_styling_block_selected")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx(We,{}),e.jsxRuntimeExports.jsx("div",{className:"flex h-12 flex-col space-x-4 px-4 py-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-1.5",children:[e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(o.Select,{defaultValue:r,onValueChange:x=>i(x),children:[e.jsxRuntimeExports.jsx(o.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(o.SelectValue,{placeholder:n("State")})}),e.jsxRuntimeExports.jsxs(o.SelectContent,{children:[t.map(u,(x,p)=>e.jsxRuntimeExports.jsx(o.SelectItem,{value:p,children:n(x)},p)),e.jsxRuntimeExports.jsx("hr",{}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"",children:n("Normal")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"hover",children:n("Hover")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"active",children:n("Active")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"focus",children:n("Focus")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"before",children:n("Before")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"after",children:n("After")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"only",children:n("Only")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first",children:n("First")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"last",children:n("Last")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first-letter",children:n("First Letter")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first-line",children:n("First Line")}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"disabled",children:n("Disabled")})]})]})]})}),r!==""?e.jsxRuntimeExports.jsxs("div",{className:"m-1 flex items-center space-x-1 rounded border border-orange-500 bg-orange-200 p-px px-2 text-xs text-orange-900",children:[e.jsxRuntimeExports.jsx(M.BrushIcon,{className:"w-3"}),e.jsxRuntimeExports.jsx("span",{children:n(`Styles will be applied for (:${r}) state`)})]}):null,e.jsxRuntimeExports.jsx(o.ScrollArea,{className:"no-scrollbar -mx-1 max-h-full flex-1 overflow-x-hidden overflow-y-hidden border-t border-border",children:e.jsxRuntimeExports.jsxs(o.Accordion,{defaultValue:["Layout"],type:"multiple",className:"w-full",children:[s&&e.jsxRuntimeExports.jsx(Y,{section:Ee}),a?e.jsxRuntimeExports.jsx(Y,{section:we}):null,Ce.map(x=>e.jsxRuntimeExports.jsx(Y,{section:x},x.heading))]})})]})}const Fe=({onAdd:r})=>{const{t:i}=B.useTranslation(),[s,a]=g.useState({key:"",value:""}),n=()=>{t.isEmpty(s.key)||(r({...s,key:t.kebabCase(s.key)}),a({key:"",value:""}))};return e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 border-gray-200 px-1",children:[e.jsxRuntimeExports.jsx(o.Input,{name:"key",onChange:u=>a({...s,key:u.target.value}),value:s.key,placeholder:i("Name"),autoComplete:"off",autoCapitalize:"off",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),t.isEmpty(s.key)||n())}}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-1.5",children:e.jsxRuntimeExports.jsx(o.Input,{name:"value",onChange:u=>a({...s,value:u.target.value}),value:s.value,placeholder:i("Value"),autoComplete:"off",autoCapitalize:"off",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),t.isEmpty(s.key)||n())}})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsxs(o.Button,{disabled:t.isEmpty(s.key),onClick:n,size:"sm",className:"flex items-center",children:[e.jsxRuntimeExports.jsxs("span",{children:[i("Add")," "]}),e.jsxRuntimeExports.jsx(d.PlusIcon,{})]}),t.isEmpty(s.key)?null:e.jsxRuntimeExports.jsx(o.Button,{variant:"ghost",onClick:()=>a({key:"",value:""}),children:i("Cancel")})]})]})},Ye=()=>{const r=o.useSelectedBlock(),[i,s]=g.useState([]),[a]=o.useSelectedStylingBlocks(),n=o.useUpdateBlocksPropsRealtime(),u=o.useUpdateBlocksProps(),{t:l}=B.useTranslation(),{toast:x}=o.useToast(),p=`${t.get(a,"0.prop")}_attrs`;O.useEffect(()=>{const h=t.map(t.get(r,p),(b,y)=>({key:y,value:b}));t.isEmpty(h)?s([]):s(h)},[t.get(r,p)]);const c=h=>{const b=t.filter(i,(y,v)=>h!==v);m(b)},j=h=>{const b=t.find(i,{key:h.key});if(b&&(b.value.startsWith("dnd-")||b.value.startsWith("#dnd-"))){x({title:l("Cannot add predefined attribute"),variant:"destructive",description:l(`"(${h.key})" cannot be added as it is a predefined attribute for this block`)});return}const y=[...i,h];m(y)},m=O.useCallback((h=[])=>{const b={};t.forEach(h,y=>{t.isEmpty(y.key)||t.set(b,y.key,y.value)}),u([t.get(r,"_id")],{[p]:b})},[r,n,p]);return e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto",children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("ul",{className:"overflow-hidden rounded-md bg-gray-100 p-2 text-xs text-gray-700",children:[t.isEmpty(i)?e.jsxRuntimeExports.jsx("li",{className:"flex h-16 items-center justify-center",children:e.jsxRuntimeExports.jsx("p",{children:l("No custom attributes added yet")})}):e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("span",{className:"font-bold",children:l("Attributes")})}),O.Children.toArray(t.map(i,h=>e.jsxRuntimeExports.jsxs("li",{className:"group flex max-w-full items-center justify-between",children:[e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:1e3,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{className:"w-[90%] cursor-default truncate px-1 hover:bg-gray-200",children:[h.key," ",e.jsxRuntimeExports.jsx("span",{className:"font-bold text-orange-500",children:"="})," ",h.value]})}),e.jsxRuntimeExports.jsxs(o.TooltipContent,{className:"max-w-[200px]",children:[e.jsxRuntimeExports.jsxs("div",{children:[l("Name"),": ",h.key]}),e.jsxRuntimeExports.jsxs("div",{children:[l("Value"),": ",h.value]})]})]}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{disabled:t.startsWith(h.value,"dnd-"),className:"invisible group-hover:visible",onClick:()=>c(i.indexOf(h)),children:e.jsxRuntimeExports.jsx(M.DeleteIcon,{className:"w-4 text-gray-500"})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"max-w-[200px]",children:t.startsWith(h.value,"dnd-")?l("Predefined attribute. Cannot be deleted"):l("Remove attribute")})]})]})))]})}),e.jsxRuntimeExports.jsx("div",{className:"py-2"}),e.jsxRuntimeExports.jsx(Fe,{onAdd:h=>j(h)})]})})})},Xe={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},Ze=()=>{const r=o.useSelectedBlock(),{t:i}=B.useTranslation(),[s,a]=g.useState(""),[n,u]=g.useState({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),l=z.useThrottledCallback(p=>{const c=!t.get(n,"negative",!1),j=t.get(n,"cssProperty","");let m=parseFloat(n.dragStartValue);m=t.isNaN(m)?0:m;let h=Xe[n.dragUnit];(t.startsWith(j,"scale")||j==="opacity")&&(h=10);let y=(n.dragStartY-p.pageY)/h+m;c&&y<0&&(y=0),j==="opacity"&&y>1&&(y=1),n.onDrag(`${y}`),a(`${y}`)},[n],50),x=g.useCallback(()=>{setTimeout(()=>n.onDragEnd(`${s}`),100),u({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[n,s,u]);return t.isNull(r)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(d.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:i("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(o.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(oe.Provider,{value:{setDragData:u},children:[n.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:l,onMouseUp:()=>x(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,e.jsxRuntimeExports.jsxs(o.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1 text-xs",children:[e.jsxRuntimeExports.jsxs(o.TabsList,{className:"mx-1 grid grid-cols-3",children:[e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"settings",children:i("settings")}),e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"styling",children:i("styling")}),e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"attrs",children:i("Attributes")})]}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"settings",className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(o.ScrollArea,{className:"no-scrollbar max-h-full flex-1 overflow-x-hidden overflow-y-hidden pb-5",children:e.jsxRuntimeExports.jsx(ve,{})})}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"styling",className:"h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(ze,{})}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"attrs",className:"h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Ye,{})})]})]})})};exports.default=Ze;
@@ -1 +0,0 @@
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-PLQ8Sq34.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("div",{className:"flex w-10 items-center justify-center",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-G9pjsIyq.cjs"))),T=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-_7e5p_e3.cjs"))),O=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-N7iDaMgM.cjs"))),A=i.lazy(()=>Promise.resolve().then(()=>require("./ChaiBuilderEditor-PLQ8Sq34.cjs")).then(t=>t.ImagesPanel));let k=null;const U=()=>{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=U;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),a=require("@radix-ui/react-icons"),r=require("./ChaiBuilderEditor-PLQ8Sq34.cjs"),l=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 p=()=>r.useBuilderProp("languages",["en"]),m=()=>p().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"})]})})]})}),j=()=>{const{savePage:u,saveState:s}=r.useSavePage(),{t:i}=l.useTranslation(),x=r.useBuilderProp("hideSaveButton",!1),t=n.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(r.FaCircleCheck,{className:"text-lg"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:s==="SAVING"?"Saving...":i(s==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},d=function(){const s=r.useBuilderProp("previewComponent"),[,i]=r.usePreviewMode(),{t:x}=l.useTranslation();return s?e.jsxRuntimeExports.jsxs(r.Button,{onClick:t=>{t.preventDefault(),i(!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",[]),i=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:n.Children.toArray(u.map(t=>e.jsxRuntimeExports.jsx(n.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:n.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(n.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(m,{}),e.jsxRuntimeExports.jsx(d,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),x?e.jsxRuntimeExports.jsx(j,{}):null,n.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=h;
@@ -1 +0,0 @@
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-PLQ8Sq34.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;