@chaibuilder/sdk 1.0.20 → 1.0.22

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 (101) hide show
  1. package/README.md +30 -103
  2. package/dist/{AddBlocks-U6bHEqmk.js → AddBlocks--G1jvF_h.js} +8 -5
  3. package/dist/AddBlocks-kQZRgF1n.cjs +3 -0
  4. package/dist/BrandingOptions-3zuS6-D8.cjs +1 -0
  5. package/dist/{BrandingOptions-qDgIOayU.js → BrandingOptions-dwNB6XlX.js} +14 -21
  6. package/dist/{CanvasArea-yXpQHB6x.cjs → CanvasArea-SzwU-7i5.cjs} +4 -4
  7. package/dist/{CanvasArea-_poBbOON.js → CanvasArea-YM7NWbx0.js} +78 -76
  8. package/dist/CurrentPage-Fw-gGZIK.cjs +1 -0
  9. package/dist/{CurrentPage-SrovfgGL.js → CurrentPage-iC1tGuWi.js} +16 -14
  10. package/dist/Layers-bvtrSZ0e.cjs +1 -0
  11. package/dist/{Layers-OKJ5nkTF.js → Layers-tvGxr-fn.js} +18 -16
  12. package/dist/MODIFIERS-MLfpKQY1.js +73 -0
  13. package/dist/MODIFIERS-WFzDQfiT.cjs +1 -0
  14. package/dist/{MarkAsGlobalBlock-Ynq-S6mW.js → MarkAsGlobalBlock-hUoxbVet.js} +10 -9
  15. package/dist/MarkAsGlobalBlock-wqHaABl_.cjs +1 -0
  16. package/dist/PagesPanel-IHkdL59C.cjs +1 -0
  17. package/dist/{PagesPanel-5macGkBU.js → PagesPanel-w32nyAEE.js} +21 -19
  18. package/dist/{ProjectPanel-HS_TJ2k0.js → ProjectPanel-1yH8uzoo.js} +17 -15
  19. package/dist/ProjectPanel-Rt_C00rp.cjs +1 -0
  20. package/dist/{Settings-23ZBoDkz.js → Settings-MbtN9j5p.js} +19 -16
  21. package/dist/Settings-zqxhKtAP.cjs +1 -0
  22. package/dist/SidePanels-PcCVJHFu.cjs +1 -0
  23. package/dist/{SidePanels-HzpyQU1x.js → SidePanels-WDSKmDRO.js} +28 -26
  24. package/dist/{Topbar-tfg74vbT.js → Topbar-QBbGJftd.js} +26 -25
  25. package/dist/Topbar-p07CgA1J.cjs +1 -0
  26. package/dist/{UnsplashImages-tvUZGbHK.js → UnsplashImages-NOdXhrYp.js} +8 -7
  27. package/dist/UnsplashImages-RobUmAqJ.cjs +1 -0
  28. package/dist/{UploadImages-pKoVEsI7.js → UploadImages-_yFxI_3x.js} +8 -7
  29. package/dist/UploadImages-oRvUykXU.cjs +1 -0
  30. package/dist/{add-page-modal-217go3Eh.js → add-page-modal-1C4AYlR3.js} +21 -18
  31. package/dist/add-page-modal-c20toln3.cjs +1 -0
  32. package/dist/{confirm-alert-AG96Fmck.js → confirm-alert-LM4La_do.js} +9 -8
  33. package/dist/confirm-alert-exrulqxB.cjs +1 -0
  34. package/dist/controls-G0puEH71.js +120 -0
  35. package/dist/controls-aHZq-q4b.cjs +1 -0
  36. package/dist/core.cjs +1 -1
  37. package/dist/core.js +73 -71
  38. package/dist/{delete-page-modal-YYt_TVmB.js → delete-page-modal-ZkdZdhkf.js} +22 -20
  39. package/dist/delete-page-modal-sMfhH69k.cjs +1 -0
  40. package/dist/{form-Ik57WNLs.cjs → form-0TlI-dUt.cjs} +1 -1
  41. package/dist/{form-gIapXg-W.js → form-rvWlnmcr.js} +2 -2
  42. package/dist/functions-JFP-oMsY.js +1109 -0
  43. package/dist/functions-KMQYiBHf.cjs +2 -0
  44. package/dist/{index-tTN-yd28.cjs → index-8dYzEcE3.cjs} +44 -44
  45. package/dist/{index-4DQm5fFW.js → index-UPQtDmUs.js} +5439 -5429
  46. package/dist/index-lH7BBNlu.cjs +1 -0
  47. package/dist/{index-PrUoEet_.js → index-pgz9p5Yh.js} +191 -190
  48. package/dist/{jsx-runtime-qAwJ85SY.js → jsx-runtime-NV737rRe.js} +1 -1
  49. package/dist/{jsx-runtime-WKRPbKtm.cjs → jsx-runtime-WUGKV8jN.cjs} +6 -6
  50. package/dist/lib.cjs +1 -2
  51. package/dist/lib.d.ts +3 -9
  52. package/dist/lib.js +113 -1264
  53. package/dist/page-viewer-1EuLsHyz.cjs +1 -0
  54. package/dist/{page-viewer-LQSQxs98.js → page-viewer-3860AKDT.js} +39 -37
  55. package/dist/project-general-setting-Bg7qIWUd.cjs +1 -0
  56. package/dist/{project-general-setting-04N25MvJ.js → project-general-setting-mg_zEkzX.js} +22 -19
  57. package/dist/{project-seo-setting-zxnjvt3c.js → project-seo-setting-6Q0gFmHY.js} +17 -24
  58. package/dist/project-seo-setting-8B9pZPZN.cjs +1 -0
  59. package/dist/render.cjs +1 -1
  60. package/dist/render.js +40 -44
  61. package/dist/single-page-detail-52Xz-XJ7.cjs +1 -0
  62. package/dist/{single-page-detail-lJHZSKqK.js → single-page-detail-Asn7bb7f.js} +47 -44
  63. package/dist/studio.cjs +1 -1
  64. package/dist/studio.js +21 -19
  65. package/dist/tailwind-config-OxLD7oFU.cjs +1 -0
  66. package/dist/tailwind-config-d1VL1lzE.js +62 -0
  67. package/dist/tailwind.cjs +1 -0
  68. package/dist/tailwind.d.ts +80 -0
  69. package/dist/tailwind.js +24 -0
  70. package/dist/ui.cjs +1 -1
  71. package/dist/ui.d.ts +4 -4
  72. package/dist/ui.js +144 -143
  73. package/dist/utils-It2K33fU.cjs +1 -0
  74. package/dist/{Class-nQk08vqd.js → utils-PPBbw5bk.js} +115 -183
  75. package/package.json +9 -9
  76. package/dist/AddBlocks-LvIqNyBE.cjs +0 -3
  77. package/dist/BrandingOptions-viABH78W.cjs +0 -1
  78. package/dist/Class-RZuPYbUS.cjs +0 -1
  79. package/dist/CurrentPage-XWSb_RZ8.cjs +0 -1
  80. package/dist/Layers-oluQMEyo.cjs +0 -1
  81. package/dist/MarkAsGlobalBlock-PG9EQfno.cjs +0 -1
  82. package/dist/PagesPanel-wYA8ksbF.cjs +0 -1
  83. package/dist/ProjectPanel-4hGK3CSo.cjs +0 -1
  84. package/dist/Settings-KS4sVa5a.cjs +0 -1
  85. package/dist/SidePanels-IfwzrWxw.cjs +0 -1
  86. package/dist/Topbar-zZtHp9g8.cjs +0 -1
  87. package/dist/UnsplashImages-nA7MSE46.cjs +0 -1
  88. package/dist/UploadImages-Ne7knL-U.cjs +0 -1
  89. package/dist/add-page-modal-az5Y2__Z.cjs +0 -1
  90. package/dist/blocks.cjs +0 -1
  91. package/dist/blocks.d.ts +0 -4
  92. package/dist/blocks.js +0 -20
  93. package/dist/confirm-alert-tADWj_Cs.cjs +0 -1
  94. package/dist/delete-page-modal-iits21u4.cjs +0 -1
  95. package/dist/index-SSmZipiF.js +0 -1191
  96. package/dist/index-UXNvQkHk.cjs +0 -1
  97. package/dist/index-plLNWLKk.cjs +0 -9
  98. package/dist/page-viewer-2SE5kCoO.cjs +0 -1
  99. package/dist/project-general-setting-XunBDyuZ.cjs +0 -1
  100. package/dist/project-seo-setting-_nu22LPz.cjs +0 -1
  101. package/dist/single-page-detail-TjWZvxFa.cjs +0 -1
@@ -1,16 +1,16 @@
1
1
  var at = Object.defineProperty;
2
2
  var lt = (n, t, r) => t in n ? at(n, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[t] = r;
3
3
  var q = (n, t, r) => (lt(n, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { j as e } from "./jsx-runtime-qAwJ85SY.js";
4
+ import { j as e } from "./jsx-runtime-NV737rRe.js";
5
5
  import z, { createElement as ct, useCallback as V, useState as F, useEffect as _, Component as _e, Children as dt, Suspense as Me, useRef as je, useMemo as ut, lazy as pt } from "react";
6
6
  import { map as Q, includes as we, toUpper as oe, round as ft, isEmpty as U, first as ee, get as A, isString as he, memoize as ht, each as mt, find as yt, filter as Ne, isNull as gt } from "lodash";
7
- import { ResetIcon as ke, MobileIcon as Ce, LaptopIcon as vt, DesktopIcon as xt, DotsVerticalIcon as bt, EraserIcon as jt, ZoomInIcon as wt, DragHandleDots2Icon as kt, ArrowUpIcon as Ct, CopyIcon as Tt, TrashIcon as Et } from "@radix-ui/react-icons";
8
- import { p as me, B as te, W as Le, aM as St, aN as Ot, aO as Dt, aP as It, aQ as At, R as ye, ai as Bt, aR as Pt, aS as Rt, aT as _t, aU as Mt, aV as Nt, aW as Lt, w as Wt, j as H, aj as Y, D as $t, E as Ft, F as Ut, G as qt, H as zt, I as Ht, J as Yt, K as Kt, at as Vt, L as Xt, U as We, aL as G, m as $e, n as Jt, k as Zt, o as Gt, h as Fe, l as Ue, ag as Qt, aX as en, aY as tn, aZ as nn, a_ as rn, x as sn, _ as ge, ae as qe, a$ as on, a6 as an, b0 as ln, i as cn, S as ze, aA as dn } from "./index-PrUoEet_.js";
7
+ import { ResetIcon as ke, MobileIcon as Ce, LaptopIcon as vt, DesktopIcon as xt, DotsVerticalIcon as bt, EraserIcon as jt, ZoomInIcon as wt, DragHandleDots2Icon as kt, ArrowUpIcon as Ct, CopyIcon as Tt, TrashIcon as St } from "@radix-ui/react-icons";
8
+ import { p as me, B as te, W as Le, aM as Et, aN as Ot, aO as Dt, aP as It, aQ as At, R as ye, ai as Bt, aR as Pt, aS as Rt, aT as _t, aU as Mt, aV as Nt, aW as Lt, w as Wt, j as H, aj as Y, D as $t, E as Ft, F as Ut, G as qt, H as zt, I as Ht, J as Yt, K as Kt, at as Vt, L as Xt, U as We, aL as G, m as $e, n as Jt, k as Zt, o as Gt, h as Fe, l as Ue, ag as Qt, aX as en, aY as tn, aZ as nn, a_ as rn, x as sn, _ as ge, ae as qe, a$ as on, a6 as an, b0 as ln, i as cn, S as ze, aA as dn } from "./index-pgz9p5Yh.js";
9
9
  import { useTranslation as He } from "react-i18next";
10
10
  import { useAtom as J } from "jotai";
11
11
  import Te from "react-dom";
12
- import { g as un, S as Ee, a as Ye } from "./Class-nQk08vqd.js";
13
- import { r as Ke, u as pn, B as fn, E as hn } from "./index-4DQm5fFW.js";
12
+ import { g as un, S as Se, a as Ye } from "./MODIFIERS-MLfpKQY1.js";
13
+ import { r as Ke, u as pn, B as fn, E as hn } from "./index-UPQtDmUs.js";
14
14
  import { flip as mn } from "@floating-ui/dom";
15
15
  import { useFloating as yn, shift as gn } from "@floating-ui/react-dom";
16
16
  import { useDrag as vn } from "react-dnd";
@@ -21,6 +21,8 @@ import { twMerge as wn } from "tailwind-merge";
21
21
  import { getBlockComponent as kn } from "@chaibuilder/runtime";
22
22
  import "@radix-ui/react-toggle";
23
23
  import "class-variance-authority";
24
+ import "./utils-PPBbw5bk.js";
25
+ import "clsx";
24
26
  import "@radix-ui/react-switch";
25
27
  import "@radix-ui/react-slot";
26
28
  import "@radix-ui/react-accordion";
@@ -43,19 +45,19 @@ import "react-icons-picker";
43
45
  import "react-quill";
44
46
  import "flat-to-nested";
45
47
  import "redux-undo";
46
- import "clsx";
47
48
  import "i18next";
48
- import "./index-SSmZipiF.js";
49
+ import "react-textarea-autosize";
50
+ import "flagged";
51
+ import "@minoru/react-dnd-treeview";
49
52
  import "./lib.js";
50
53
  import "himalaya";
54
+ import "./functions-JFP-oMsY.js";
51
55
  import "@mhsdesign/jit-browser-tailwindcss";
52
56
  import "@tailwindcss/forms";
53
57
  import "@tailwindcss/typography";
54
58
  import "@tailwindcss/aspect-ratio";
55
59
  import "@tailwindcss/line-clamp";
56
- import "react-textarea-autosize";
57
- import "flagged";
58
- import "@minoru/react-dnd-treeview";
60
+ import "./tailwind-config-d1VL1lzE.js";
59
61
  import "react-hotkeys-hook";
60
62
  import "sonner";
61
63
  import "lucide-react";
@@ -69,7 +71,7 @@ const Cn = () => {
69
71
  function Tn() {
70
72
  const [n, t] = Le(), { t: r } = He();
71
73
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
72
- /* @__PURE__ */ e.jsx(St, { htmlFor: "dark-mode-switch", children: r("dark_mode") }),
74
+ /* @__PURE__ */ e.jsx(Et, { htmlFor: "dark-mode-switch", children: r("dark_mode") }),
73
75
  /* @__PURE__ */ e.jsxs(
74
76
  Ot,
75
77
  {
@@ -95,7 +97,7 @@ function Tn() {
95
97
  )
96
98
  ] });
97
99
  }
98
- const Se = ({ landscape: n = !1 }) => /* @__PURE__ */ e.jsxs(
100
+ const Ee = ({ landscape: n = !1 }) => /* @__PURE__ */ e.jsxs(
99
101
  "svg",
100
102
  {
101
103
  className: n ? "rotate-90" : "",
@@ -137,14 +139,14 @@ const Se = ({ landscape: n = !1 }) => /* @__PURE__ */ e.jsxs(
137
139
  title: "Tablet (MD)",
138
140
  content: "Styles set here are applied at 768px and up",
139
141
  breakpoint: "md",
140
- icon: /* @__PURE__ */ e.jsx(Se, {}),
142
+ icon: /* @__PURE__ */ e.jsx(Ee, {}),
141
143
  width: 800
142
144
  },
143
145
  {
144
146
  title: "Tablet Landscape (LG)",
145
147
  content: "Styles set here are applied at 1024px and up unless edited at higher breakpoint",
146
148
  breakpoint: "lg",
147
- icon: /* @__PURE__ */ e.jsx(Se, { landscape: !0 }),
149
+ icon: /* @__PURE__ */ e.jsx(Ee, { landscape: !0 }),
148
150
  width: 1024
149
151
  },
150
152
  {
@@ -161,7 +163,7 @@ const Se = ({ landscape: n = !1 }) => /* @__PURE__ */ e.jsxs(
161
163
  icon: /* @__PURE__ */ e.jsx(xt, {}),
162
164
  width: 1920
163
165
  }
164
- ], En = ({
166
+ ], Sn = ({
165
167
  title: n,
166
168
  content: t,
167
169
  currentBreakpoint: r,
@@ -183,14 +185,14 @@ const Se = ({ landscape: n = !1 }) => /* @__PURE__ */ e.jsxs(
183
185
  /* @__PURE__ */ e.jsx("h4", { className: "text-sm font-semibold", children: n }),
184
186
  /* @__PURE__ */ e.jsx("p", { className: "text-xs", children: t })
185
187
  ] }) }) })
186
- ] }), Sn = () => {
188
+ ] }), En = () => {
187
189
  const [, n, t] = ye(), [r, a] = Bt(), c = (o) => {
188
190
  r.includes(o) ? r.length > 2 && a(r.filter((i) => i !== o)) : a((i) => [...i, o]);
189
191
  };
190
192
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center rounded-md", children: [
191
193
  Q(
192
194
  Oe.filter((o) => we(r, oe(o.breakpoint))),
193
- (o) => /* @__PURE__ */ ct(En, { ...o, onClick: t, key: o.breakpoint, currentBreakpoint: n })
195
+ (o) => /* @__PURE__ */ ct(Sn, { ...o, onClick: t, key: o.breakpoint, currentBreakpoint: n })
194
196
  ),
195
197
  /* @__PURE__ */ e.jsxs(Pt, { children: [
196
198
  /* @__PURE__ */ e.jsx(Rt, { asChild: !0, children: /* @__PURE__ */ e.jsx("span", { className: "cursor-pointer px-2.5 hover:opacity-80", children: /* @__PURE__ */ e.jsx(bt, { className: "scale-90 transform" }) }) }),
@@ -238,7 +240,7 @@ const Se = ({ landscape: n = !1 }) => /* @__PURE__ */ e.jsxs(
238
240
  /* @__PURE__ */ e.jsx(Tn, {}),
239
241
  /* @__PURE__ */ e.jsx(G, { orientation: "vertical" })
240
242
  ] }) : null,
241
- /* @__PURE__ */ e.jsx(Sn, {}),
243
+ /* @__PURE__ */ e.jsx(En, {}),
242
244
  /* @__PURE__ */ e.jsx(G, { orientation: "vertical" }),
243
245
  /* @__PURE__ */ e.jsxs("div", { className: "flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium", children: [
244
246
  /* @__PURE__ */ e.jsx(wt, { className: "h-3.5 w-3.5 flex-shrink-0" }),
@@ -477,11 +479,11 @@ function Rn() {
477
479
  this.message = s, this.data = l && typeof l == "object" ? l : {}, this.stack = "";
478
480
  }
479
481
  w.prototype = Error.prototype;
480
- function S(s) {
482
+ function E(s) {
481
483
  if (process.env.NODE_ENV !== "production")
482
484
  var l = {}, j = 0;
483
- function v(C, y, x, T, O, E, R) {
484
- if (T = T || m, E = E || x, R !== r) {
485
+ function v(C, y, x, T, O, S, R) {
486
+ if (T = T || m, S = S || x, R !== r) {
485
487
  if (g) {
486
488
  var B = new Error(
487
489
  "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
@@ -491,11 +493,11 @@ function Rn() {
491
493
  var K = T + ":" + x;
492
494
  !l[K] && // Avoid spamming the console because they are often not actionable except for lib authors
493
495
  j < 3 && (o(
494
- "You are manually calling a React.PropTypes validation function for the `" + E + "` prop on `" + T + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
496
+ "You are manually calling a React.PropTypes validation function for the `" + S + "` prop on `" + T + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
495
497
  ), l[K] = !0, j++);
496
498
  }
497
499
  }
498
- return y[x] == null ? C ? y[x] === null ? new w("The " + O + " `" + E + "` is marked as required " + ("in `" + T + "`, but its value is `null`.")) : new w("The " + O + " `" + E + "` is marked as required in " + ("`" + T + "`, but its value is `undefined`.")) : null : s(y, x, T, O, E);
500
+ return y[x] == null ? C ? y[x] === null ? new w("The " + O + " `" + S + "` is marked as required " + ("in `" + T + "`, but its value is `null`.")) : new w("The " + O + " `" + S + "` is marked as required in " + ("`" + T + "`, but its value is `undefined`.")) : null : s(y, x, T, O, S);
499
501
  }
500
502
  var h = v.bind(null, !1);
501
503
  return h.isRequired = v.bind(null, !0), h;
@@ -504,18 +506,18 @@ function Rn() {
504
506
  function l(j, v, h, C, y, x) {
505
507
  var T = j[v], O = $(T);
506
508
  if (O !== s) {
507
- var E = X(T);
509
+ var S = X(T);
508
510
  return new w(
509
- "Invalid " + C + " `" + y + "` of type " + ("`" + E + "` supplied to `" + h + "`, expected ") + ("`" + s + "`."),
511
+ "Invalid " + C + " `" + y + "` of type " + ("`" + S + "` supplied to `" + h + "`, expected ") + ("`" + s + "`."),
510
512
  { expectedType: s }
511
513
  );
512
514
  }
513
515
  return null;
514
516
  }
515
- return S(l);
517
+ return E(l);
516
518
  }
517
519
  function W() {
518
- return S(i);
520
+ return E(i);
519
521
  }
520
522
  function M(s) {
521
523
  function l(j, v, h, C, y) {
@@ -527,13 +529,13 @@ function Rn() {
527
529
  return new w("Invalid " + C + " `" + y + "` of type " + ("`" + T + "` supplied to `" + h + "`, expected an array."));
528
530
  }
529
531
  for (var O = 0; O < x.length; O++) {
530
- var E = s(x, O, h, C, y + "[" + O + "]", r);
531
- if (E instanceof Error)
532
- return E;
532
+ var S = s(x, O, h, C, y + "[" + O + "]", r);
533
+ if (S instanceof Error)
534
+ return S;
533
535
  }
534
536
  return null;
535
537
  }
536
- return S(l);
538
+ return E(l);
537
539
  }
538
540
  function re() {
539
541
  function s(l, j, v, h, C) {
@@ -544,7 +546,7 @@ function Rn() {
544
546
  }
545
547
  return null;
546
548
  }
547
- return S(s);
549
+ return E(s);
548
550
  }
549
551
  function se() {
550
552
  function s(l, j, v, h, C) {
@@ -555,7 +557,7 @@ function Rn() {
555
557
  }
556
558
  return null;
557
559
  }
558
- return S(s);
560
+ return E(s);
559
561
  }
560
562
  function I(s) {
561
563
  function l(j, v, h, C, y) {
@@ -565,7 +567,7 @@ function Rn() {
565
567
  }
566
568
  return null;
567
569
  }
568
- return S(l);
570
+ return E(l);
569
571
  }
570
572
  function N(s) {
571
573
  if (!Array.isArray(s))
@@ -582,7 +584,7 @@ function Rn() {
582
584
  });
583
585
  return new w("Invalid " + C + " `" + y + "` of value `" + String(x) + "` " + ("supplied to `" + h + "`, expected one of " + O + "."));
584
586
  }
585
- return S(l);
587
+ return E(l);
586
588
  }
587
589
  function L(s) {
588
590
  function l(j, v, h, C, y) {
@@ -593,13 +595,13 @@ function Rn() {
593
595
  return new w("Invalid " + C + " `" + y + "` of type " + ("`" + T + "` supplied to `" + h + "`, expected an object."));
594
596
  for (var O in x)
595
597
  if (a(x, O)) {
596
- var E = s(x, O, h, C, y + "." + O, r);
597
- if (E instanceof Error)
598
- return E;
598
+ var S = s(x, O, h, C, y + "." + O, r);
599
+ if (S instanceof Error)
600
+ return S;
599
601
  }
600
602
  return null;
601
603
  }
602
- return S(l);
604
+ return E(l);
603
605
  }
604
606
  function et(s) {
605
607
  if (!Array.isArray(s))
@@ -612,8 +614,8 @@ function Rn() {
612
614
  ), i;
613
615
  }
614
616
  function v(h, C, y, x, T) {
615
- for (var O = [], E = 0; E < s.length; E++) {
616
- var R = s[E], B = R(h, C, y, x, T, r);
617
+ for (var O = [], S = 0; S < s.length; S++) {
618
+ var R = s[S], B = R(h, C, y, x, T, r);
617
619
  if (B == null)
618
620
  return null;
619
621
  B.data && a(B.data, "expectedType") && O.push(B.data.expectedType);
@@ -621,13 +623,13 @@ function Rn() {
621
623
  var K = O.length > 0 ? ", expected one of type [" + O.join(", ") + "]" : "";
622
624
  return new w("Invalid " + x + " `" + T + "` supplied to " + ("`" + y + "`" + K + "."));
623
625
  }
624
- return S(v);
626
+ return E(v);
625
627
  }
626
628
  function tt() {
627
629
  function s(l, j, v, h, C) {
628
630
  return Z(l[j]) ? null : new w("Invalid " + h + " `" + C + "` supplied to " + ("`" + v + "`, expected a ReactNode."));
629
631
  }
630
- return S(s);
632
+ return E(s);
631
633
  }
632
634
  function be(s, l, j, v, h) {
633
635
  return new w(
@@ -640,16 +642,16 @@ function Rn() {
640
642
  if (T !== "object")
641
643
  return new w("Invalid " + C + " `" + y + "` of type `" + T + "` " + ("supplied to `" + h + "`, expected `object`."));
642
644
  for (var O in s) {
643
- var E = s[O];
644
- if (typeof E != "function")
645
- return be(h, C, y, O, X(E));
646
- var R = E(x, O, h, C, y + "." + O, r);
645
+ var S = s[O];
646
+ if (typeof S != "function")
647
+ return be(h, C, y, O, X(S));
648
+ var R = S(x, O, h, C, y + "." + O, r);
647
649
  if (R)
648
650
  return R;
649
651
  }
650
652
  return null;
651
653
  }
652
- return S(l);
654
+ return E(l);
653
655
  }
654
656
  function rt(s) {
655
657
  function l(j, v, h, C, y) {
@@ -657,22 +659,22 @@ function Rn() {
657
659
  if (T !== "object")
658
660
  return new w("Invalid " + C + " `" + y + "` of type `" + T + "` " + ("supplied to `" + h + "`, expected `object`."));
659
661
  var O = t({}, j[v], s);
660
- for (var E in O) {
661
- var R = s[E];
662
- if (a(s, E) && typeof R != "function")
663
- return be(h, C, y, E, X(R));
662
+ for (var S in O) {
663
+ var R = s[S];
664
+ if (a(s, S) && typeof R != "function")
665
+ return be(h, C, y, S, X(R));
664
666
  if (!R)
665
667
  return new w(
666
- "Invalid " + C + " `" + y + "` key `" + E + "` supplied to `" + h + "`.\nBad object: " + JSON.stringify(j[v], null, " ") + `
668
+ "Invalid " + C + " `" + y + "` key `" + S + "` supplied to `" + h + "`.\nBad object: " + JSON.stringify(j[v], null, " ") + `
667
669
  Valid keys: ` + JSON.stringify(Object.keys(s), null, " ")
668
670
  );
669
- var B = R(x, E, h, C, y + "." + E, r);
671
+ var B = R(x, S, h, C, y + "." + S, r);
670
672
  if (B)
671
673
  return B;
672
674
  }
673
675
  return null;
674
676
  }
675
- return S(l);
677
+ return E(l);
676
678
  }
677
679
  function Z(s) {
678
680
  switch (typeof s) {
@@ -795,7 +797,7 @@ function _n() {
795
797
  return o.PropTypes = o, o;
796
798
  }, ue;
797
799
  }
798
- var as = ne.exports;
800
+ var cs = ne.exports;
799
801
  if (process.env.NODE_ENV !== "production") {
800
802
  var Mn = Ke, Nn = !0;
801
803
  ne.exports = Rn()(Mn.isElement, Nn);
@@ -806,7 +808,7 @@ const P = /* @__PURE__ */ un(Ln);
806
808
  let Xe, Je;
807
809
  typeof document < "u" && (Xe = document);
808
810
  typeof window < "u" && (Je = window);
809
- const Ze = z.createContext({ document: Xe, window: Je }), xe = () => z.useContext(Ze), { Provider: Wn, Consumer: ls } = Ze;
811
+ const Ze = z.createContext({ document: Xe, window: Je }), xe = () => z.useContext(Ze), { Provider: Wn, Consumer: ds } = Ze;
810
812
  class Ge extends _e {
811
813
  componentDidMount() {
812
814
  this.props.contentDidMount();
@@ -914,11 +916,11 @@ const $n = z.forwardRef((n, t) => /* @__PURE__ */ e.jsx(pe, { ...n, forwardedRef
914
916
  }, 100);
915
917
  }, [t, r, c, a]), /* @__PURE__ */ e.jsx("div", { id: "canvas", className: "relative h-screen max-w-full outline-2", children: n });
916
918
  }, Qe = (n, t) => n.querySelector(`[data-block-id="${t}"]`), Un = () => {
917
- const { window: n } = xe(), [t, r] = H(), [, a] = Y(), { undo: c, redo: o } = me(), i = $e(), [, p] = Jt(), [, g] = Zt(), { pasteBlocks: b } = Gt(), [, u] = Fe(), d = Ue(), { savePage: m } = Qt(), [k] = J(en), [, D] = J(tn), w = (S) => {
918
- S.key === "Enter" && (S.preventDefault(), t.length === 1 && D(ee(t)));
919
+ const { window: n } = xe(), [t, r] = H(), [, a] = Y(), { undo: c, redo: o } = me(), i = $e(), [, p] = Jt(), [, g] = Zt(), { pasteBlocks: b } = Gt(), [, u] = Fe(), d = Ue(), { savePage: m } = Qt(), [k] = J(en), [, D] = J(tn), w = (E) => {
920
+ E.key === "Enter" && (E.preventDefault(), t.length === 1 && D(ee(t)));
919
921
  };
920
922
  return _(() => {
921
- const S = (f) => {
923
+ const E = (f) => {
922
924
  if (f.key === "Escape") {
923
925
  r([]), a([]);
924
926
  return;
@@ -932,8 +934,8 @@ const $n = z.forwardRef((n, t) => /* @__PURE__ */ e.jsx(pe, { ...n, forwardedRef
932
934
  f.key === "s" && (f.stopPropagation(), f.preventDefault(), m()), f.key === "z" && c(), f.key === "y" && o(), f.key === "d" && i(t), f.key === "x" && p(t), f.key === "c" && g(t), f.key === "v" && t.length > 0 && b(t[0]);
933
935
  }
934
936
  };
935
- return n.removeEventListener("keydown", S), n.addEventListener("keydown", S), () => {
936
- n.removeEventListener("keydown", S);
937
+ return n.removeEventListener("keydown", E), n.addEventListener("keydown", E), () => {
938
+ n.removeEventListener("keydown", E);
937
939
  };
938
940
  }, [
939
941
  t,
@@ -1004,7 +1006,7 @@ const $n = z.forwardRef((n, t) => /* @__PURE__ */ e.jsx(pe, { ...n, forwardedRef
1004
1006
  }
1005
1007
  ),
1006
1008
  nn(A(t, "_type", "")) ? /* @__PURE__ */ e.jsx(Tt, { className: "hover:scale-105 ", onClick: () => a([t == null ? void 0 : t._id]) }) : null,
1007
- rn(A(t, "_type", "")) ? /* @__PURE__ */ e.jsx(Et, { className: "hover:scale-105 ", onClick: () => r([t == null ? void 0 : t._id]) }) : null
1009
+ rn(A(t, "_type", "")) ? /* @__PURE__ */ e.jsx(St, { className: "hover:scale-105 ", onClick: () => r([t == null ? void 0 : t._id]) }) : null
1008
1010
  ] })
1009
1011
  ]
1010
1012
  }
@@ -1025,7 +1027,7 @@ const $n = z.forwardRef((n, t) => /* @__PURE__ */ e.jsx(pe, { ...n, forwardedRef
1025
1027
  names: ["primary", "secondary"]
1026
1028
  });
1027
1029
  w.primary.DEFAULT = k, w.secondary.DEFAULT = D;
1028
- const S = A(t, "roundedCorners", "0");
1030
+ const E = A(t, "roundedCorners", "0");
1029
1031
  !p || !p.tailwind || (p.tailwind.config = {
1030
1032
  darkMode: "class",
1031
1033
  theme: {
@@ -1035,7 +1037,7 @@ const $n = z.forwardRef((n, t) => /* @__PURE__ */ e.jsx(pe, { ...n, forwardedRef
1035
1037
  },
1036
1038
  extend: {
1037
1039
  borderRadius: {
1038
- global: `${S || "0"}px`
1040
+ global: `${E || "0"}px`
1039
1041
  },
1040
1042
  colors: w
1041
1043
  }
@@ -1067,8 +1069,8 @@ const $n = z.forwardRef((n, t) => /* @__PURE__ */ e.jsx(pe, { ...n, forwardedRef
1067
1069
  }, [o, u]), _(() => {
1068
1070
  if (n === "section")
1069
1071
  return;
1070
- const k = A(t, "bodyTextLightColor", "#64748b"), D = A(t, "bodyTextDarkColor", "#94a3b8"), w = A(t, "bodyBgLightColor", "#FFFFFF"), S = A(t, "bodyBgDarkColor", "#0f172a");
1071
- i.body.className = `font-body antialiased text-[${k}] bg-[${w}] dark:text-[${D}] dark:bg-[${S}]`;
1072
+ const k = A(t, "bodyTextLightColor", "#64748b"), D = A(t, "bodyTextDarkColor", "#94a3b8"), w = A(t, "bodyBgLightColor", "#FFFFFF"), E = A(t, "bodyBgDarkColor", "#0f172a");
1073
+ i.body.className = `font-body antialiased text-[${k}] bg-[${w}] dark:text-[${D}] dark:bg-[${E}]`;
1072
1074
  }, [t, i, n]), n === "page" ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1073
1075
  d && /* @__PURE__ */ e.jsx(
1074
1076
  "link",
@@ -1104,7 +1106,7 @@ const $n = z.forwardRef((n, t) => /* @__PURE__ */ e.jsx(pe, { ...n, forwardedRef
1104
1106
  }, Kn = (n) => {
1105
1107
  const t = {};
1106
1108
  return Object.keys(n).forEach((r) => {
1107
- he(n[r]) && n[r].startsWith(Ee) && (t[r] = n[r].replace(Ee, "").split(","));
1109
+ he(n[r]) && n[r].startsWith(Se) && (t[r] = n[r].replace(Se, "").split(","));
1108
1110
  }), t;
1109
1111
  }, Vn = ht((n) => {
1110
1112
  const t = n.replace(Ye, "").split(",");
@@ -1177,8 +1179,8 @@ function fe({ blocks: n }) {
1177
1179
  });
1178
1180
  const D = Ne(t, { _parent: u._id });
1179
1181
  k.children = D.length ? /* @__PURE__ */ e.jsx(fe, { blocks: D }) : null;
1180
- const w = kn(u._type), S = A(w, "component", null);
1181
- return gt(S) ? /* @__PURE__ */ e.jsx("noscript", { children: `<!-- ${u == null ? void 0 : u._type} not registered -->` }) : /* @__PURE__ */ e.jsx(Me, { children: z.createElement(S, {
1182
+ const w = kn(u._type), E = A(w, "component", null);
1183
+ return gt(E) ? /* @__PURE__ */ e.jsx("noscript", { children: `<!-- ${u == null ? void 0 : u._type} not registered -->` }) : /* @__PURE__ */ e.jsx(Me, { children: z.createElement(E, {
1182
1184
  blockProps: {
1183
1185
  onClick: p,
1184
1186
  "data-block-id": u._id,
@@ -1197,7 +1199,7 @@ const Gn = () => {
1197
1199
  const n = qe();
1198
1200
  return /* @__PURE__ */ e.jsx(jn, { children: U(n) ? /* @__PURE__ */ e.jsx(Yn, {}) : /* @__PURE__ */ e.jsx(fn, { children: /* @__PURE__ */ e.jsx(fe, { blocks: Ne(n, (t) => U(t._parent)) }) }) });
1199
1201
  }, Qn = (n, t) => n.querySelector(`[data-style-id="${t}"]`), er = () => {
1200
- const [n] = J(on), [t] = Fe(), [r] = ye(), [, a] = H(), c = an(), [, o] = ge(), i = je(null), p = je(null), [g, b] = F({ width: 0, height: 0 }), u = An(g), [d, m] = F(0), [k, D] = F([]), [, w] = F([]), [, S] = J(ln), [f, W] = Y(), M = cn("loadingCanvas", !1);
1202
+ const [n] = J(on), [t] = Fe(), [r] = ye(), [, a] = H(), c = an(), [, o] = ge(), i = je(null), p = je(null), [g, b] = F({ width: 0, height: 0 }), u = An(g), [d, m] = F(0), [k, D] = F([]), [, w] = F([]), [, E] = J(ln), [f, W] = Y(), M = cn("loadingCanvas", !1);
1201
1203
  _(() => {
1202
1204
  const { clientWidth: I, clientHeight: N } = p.current;
1203
1205
  b({ width: I, height: N }), d === 0 && m(I);
@@ -1242,11 +1244,11 @@ const Gn = () => {
1242
1244
  children: /* @__PURE__ */ e.jsxs(
1243
1245
  $n,
1244
1246
  {
1245
- contentDidMount: () => S(i.current),
1247
+ contentDidMount: () => E(i.current),
1246
1248
  ref: i,
1247
1249
  id: "canvas-iframe",
1248
1250
  style: { width: `${r}px`, ...u },
1249
- className: "relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",
1251
+ className: "relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",
1250
1252
  initialContent: se,
1251
1253
  children: [
1252
1254
  /* @__PURE__ */ e.jsx(Un, {}),
@@ -1267,11 +1269,11 @@ const Gn = () => {
1267
1269
  )
1268
1270
  }
1269
1271
  );
1270
- }, tr = pt(() => import("./AddBlocks-U6bHEqmk.js")), cs = () => {
1272
+ }, tr = pt(() => import("./AddBlocks--G1jvF_h.js")), us = () => {
1271
1273
  const [n, t] = J(dn);
1272
1274
  return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-full flex-col", children: [
1273
1275
  /* @__PURE__ */ e.jsx(Dn, {}),
1274
- /* @__PURE__ */ e.jsxs("div", { className: "relative flex-1 overflow-hidden bg-slate-800/80 px-2 bg-[linear-gradient(to_right,#EEE_0.5px,transparent_0.5px),linear-gradient(to_bottom,#EEE_0.5px,transparent_0.5px)] bg-[size:12px_12px]", children: [
1276
+ /* @__PURE__ */ e.jsxs("div", { className: "relative flex-1 overflow-hidden bg-slate-800/90 px-2 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px]", children: [
1275
1277
  /* @__PURE__ */ e.jsx(Me, { fallback: /* @__PURE__ */ e.jsx(ze, { className: "h-full" }), children: /* @__PURE__ */ e.jsx(hn, { children: /* @__PURE__ */ e.jsx(er, {}) }) }),
1276
1278
  n ? /* @__PURE__ */ e.jsx(
1277
1279
  "div",
@@ -1292,5 +1294,5 @@ const Gn = () => {
1292
1294
  ] });
1293
1295
  };
1294
1296
  export {
1295
- cs as default
1297
+ us as default
1296
1298
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-lH7BBNlu.cjs"),i=require("lodash"),h=require("sonner"),l=require("react"),o=require("./index-8dYzEcE3.cjs"),j=require("lucide-react");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");const p=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:q}=s.useSavePage(),d=o.useChangePage(),[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 m=r=>{if(q!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});d(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 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(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),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:m,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=p;
@@ -1,15 +1,16 @@
1
- import { j as e } from "./jsx-runtime-qAwJ85SY.js";
2
- import { ag as x, au as h, av as f, aw as j, ax as y, ay as v } from "./index-PrUoEet_.js";
1
+ import { j as e } from "./jsx-runtime-NV737rRe.js";
2
+ import { ag as x, au as h, av as f, aw as j, ax as y, ay as v } from "./index-pgz9p5Yh.js";
3
3
  import { sortBy as P, filter as b, get as w, isEmpty as s, find as n, capitalize as C, map as N } from "lodash";
4
4
  import { toast as S } from "sonner";
5
5
  import { useEffect as p } from "react";
6
- import { b as k, a as B, d as E, e as I } from "./index-4DQm5fFW.js";
6
+ import { b as k, a as B, d as E, e as I } from "./index-UPQtDmUs.js";
7
7
  import { BriefcaseIcon as L } from "lucide-react";
8
- import "./Class-nQk08vqd.js";
9
- import "clsx";
10
- import "tailwind-merge";
8
+ import "./MODIFIERS-MLfpKQY1.js";
11
9
  import "@radix-ui/react-toggle";
12
10
  import "class-variance-authority";
11
+ import "./utils-PPBbw5bk.js";
12
+ import "clsx";
13
+ import "tailwind-merge";
13
14
  import "@radix-ui/react-switch";
14
15
  import "@radix-ui/react-slot";
15
16
  import "@radix-ui/react-accordion";
@@ -39,22 +40,23 @@ import "@chaibuilder/runtime";
39
40
  import "@react-hookz/web";
40
41
  import "react-i18next";
41
42
  import "i18next";
42
- import "./index-SSmZipiF.js";
43
+ import "@floating-ui/react-dom";
44
+ import "react-textarea-autosize";
45
+ import "flagged";
46
+ import "react-dnd";
47
+ import "@minoru/react-dnd-treeview";
43
48
  import "./lib.js";
44
49
  import "himalaya";
50
+ import "./functions-JFP-oMsY.js";
45
51
  import "@mhsdesign/jit-browser-tailwindcss";
46
52
  import "@bobthered/tailwindcss-palette-generator";
47
53
  import "@tailwindcss/forms";
48
54
  import "@tailwindcss/typography";
49
55
  import "@tailwindcss/aspect-ratio";
50
56
  import "@tailwindcss/line-clamp";
51
- import "@floating-ui/react-dom";
52
- import "react-textarea-autosize";
53
- import "flagged";
54
- import "react-dnd";
55
- import "@minoru/react-dnd-treeview";
57
+ import "./tailwind-config-d1VL1lzE.js";
56
58
  import "react-hotkeys-hook";
57
- const ze = () => {
59
+ const De = () => {
58
60
  const { data: t } = k(), { data: i, isLoading: l } = B(), { syncState: c } = x(), d = E(), [o, a] = I(), m = P(b(i, { type: "STATIC" }), (r) => w(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
59
61
  p(() => {
60
62
  !s(i) && t.homepage && !n(i, { uuid: o }) && a(t.homepage);
@@ -108,5 +110,5 @@ const ze = () => {
108
110
  );
109
111
  };
110
112
  export {
111
- ze as default
113
+ De as default
112
114
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("lodash"),s=require("@radix-ui/react-icons"),f=require("react-dnd"),B=require("@minoru/react-dnd-treeview"),N=require("react-i18next"),r=require("./index-lH7BBNlu.cjs"),O=require("lucide-react");require("./lib.cjs");const p=require("react"),A=require("./MODIFIERS-WFzDQfiT.cjs"),q=require("./utils-It2K33fU.cjs"),_=require("./index-8dYzEcE3.cjs"),P=require("jotai");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-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");const C=t=>{switch(t.type){case"Image":return e.jsxRuntimeExports.jsx(s.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(s.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(s.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(s.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(s.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(s.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(s.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(s.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(s.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(s.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(s.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(s.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(s.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(s.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(s.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(s.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(s.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(s.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(s.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(s.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(O.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}};function H(t=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(t))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(t))return"Visible on mobile";if(t.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=t.match(c);if(u.nth(l,1))return`Visible >=${n[u.nth(l,1)]}`}return""}const L=t=>{let n="";return Object.keys(t).forEach(o=>{u.startsWith(t[o],A.STYLES_KEY)&&(n=t[o])}),n},F=t=>{var g;const[,n]=r.useHighlightBlockId(),[o]=r.useHiddenBlockIds(),{isSelected:x}=t,{id:c,data:l}=t.node,a=t.depth*10,m=d=>{d.stopPropagation(),t.onToggle(t.node.id)},E=B.useDragOver(c,t.isOpen,t.onToggle),j=p.useMemo(()=>{const d=L(t.node.data);return H(d)},[t.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:q.cn("group flex w-full items-center justify-between space-x-px py-px ",x?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:d=>{d.stopPropagation(),!o.includes(c)&&t.onSelect(c)},onContextMenu:()=>t.onSelect(c),style:{paddingInlineStart:a},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.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:t.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:m,type:"button",children:e.jsxRuntimeExports.jsx(s.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(C,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((g=t.node.data)==null?void 0:g._name)||t.node.text}),j?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(x?"text-gray-200":"text-gray-500"),children:["(",j,")"]}):null]})]})})},V=t=>{var o;const{item:n}=t.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(C,{type:(o=n==null?void 0:n.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},z=t=>{const n=t.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},G=p.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-wqHaABl_.cjs"))),$=()=>{const[t]=r.useSelectedBlockIds(),[,n]=r.useCutBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ScissorsIcon,{})," Cut"]})},K=()=>{const[t]=r.useSelectedBlockIds(),[,n]=r.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ClipboardIcon,{})," Copy"]})},Q=()=>{const[t]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),o=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},U=({id:t=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),x=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),a=r.useBuilderProp("globalBlocksSupport",!1),m=p.useCallback(()=>{x(o)},[o,x]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[a&&e.jsxRuntimeExports.jsx(r.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(s.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx($,{}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(t),disabled:!l,children:[e.jsxRuntimeExports.jsx(s.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Q,{})]})},Y=({children:t,id:n=null})=>{const[o,x]=p.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(r.Dialog,{open:o,onOpenChange:x,children:o&&e.jsxRuntimeExports.jsx(r.DialogContent,{children:e.jsxRuntimeExports.jsx(p.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(G,{closeModal:()=>x(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx(U,{id:n,openMarkAsGlobalModal:()=>x(!0)})]})]})},W=()=>{const{addCoreBlock:t}=r.useAddBlock(),n=r.useBuilderProp("getExternalPredefinedBlock");return p.useCallback(async o=>{const{block:x,dropTargetId:c,relativeIndex:l}=o;if(u.has(x,"format")){const a=await n(x);return t({blocks:a},c===0?null:c,l)}return t(x,c===0?null:c,l)},[t])};function J(t){return u.map(t,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const X=()=>{const t=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,x,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:a}=N.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=_.useExpandedIds(),j=W(),[,g]=P.useAtom(r.addBlocksModalAtom),d=async(i,R)=>{const{dragSource:h,destinationIndex:b,relativeIndex:k,dropTargetId:T,monitor:D}=R,M=J(i);n(M),h?m():(await j({block:D.getItem(),dropTargetId:T,destinationIndex:b,relativeIndex:k}),g(!1))},y=u.map(t,i=>({id:i._id,text:i._type,parent:i._parent||0,droppable:!u.isUndefined(u.find(t,{_parent:i._id})),data:i})),v=()=>{x([]),l([])},[{isOver:I},S]=f.useDrop(()=>({accept:["CHAI_BLOCK"],collect:i=>({canDrop:i.canDrop(),isOver:i.isOver()}),drop:i=>{(async()=>(await j({block:i,dropTargetId:"",destinationIndex:0,relativeIndex:0}),g(!1)))()}})),{isDragging:w}=f.useDragLayer(i=>({isDragging:i.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>v(),className:q.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",w?"bg-green-50/80":"bg-background"),children:u.isEmpty(t)?e.jsxRuntimeExports.jsxs("div",{ref:S,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(s.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(s.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:a(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(B.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:y,rootId:0,render:(i,{depth:R,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(Y,{id:i.id,children:e.jsxRuntimeExports.jsx(F,{onSelect:k=>{l([]),x([k])},isSelected:u.includes(o,i.id),node:i,depth:R,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:i=>e.jsxRuntimeExports.jsx(V,{monitorProps:i}),onDrop:d,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(i,{depth:R})=>e.jsxRuntimeExports.jsx(z,{node:i,depth:R})})})})})};exports.default=X;