@chaibuilder/sdk 0.1.0 → 0.1.2

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 (49) hide show
  1. package/dist/AddBlocks-b5f37f2f.js +258 -0
  2. package/dist/AddBlocks-e23baf9a.cjs +3 -0
  3. package/dist/BrandingOptions-3d1bd24a.cjs +1 -0
  4. package/dist/{BrandingOptions-055cf22a.js → BrandingOptions-cfd1b740.js} +2 -2
  5. package/dist/{CanvasArea-a7901131.js → CanvasArea-a065a586.js} +3 -3
  6. package/dist/{CanvasArea-97dfbb52.cjs → CanvasArea-c4554d61.cjs} +10 -10
  7. package/dist/{ImagesPanel-160aa664.cjs → ImagesPanel-cc136c92.cjs} +1 -1
  8. package/dist/{ImagesPanel-815d5e6f.js → ImagesPanel-eccf9a56.js} +1 -1
  9. package/dist/Layers-f002ba1a.cjs +1 -0
  10. package/dist/{Layers-6f1c162e.js → Layers-f935e07b.js} +3 -3
  11. package/dist/MarkAsGlobalBlock-5f435dd5.cjs +1 -0
  12. package/dist/{MarkAsGlobalBlock-209ddfd5.js → MarkAsGlobalBlock-613bfdab.js} +2 -2
  13. package/dist/Settings-05b9b5fe.cjs +1 -0
  14. package/dist/{Settings-b1afcefe.js → Settings-a19fbb69.js} +4 -4
  15. package/dist/{SidePanels-f48777bb.js → SidePanels-67ebbcb4.js} +20 -18
  16. package/dist/SidePanels-af222189.cjs +1 -0
  17. package/dist/Topbar-e92351cc.cjs +1 -0
  18. package/dist/{Topbar-64729901.js → Topbar-fcb01371.js} +2 -2
  19. package/dist/{UnsplashImages-04fffeed.cjs → UnsplashImages-cca34e45.cjs} +1 -1
  20. package/dist/{UnsplashImages-315ce7a8.js → UnsplashImages-fda2f29a.js} +2 -2
  21. package/dist/{UploadImages-f317eef0.js → UploadImages-1839950f.js} +36 -32
  22. package/dist/UploadImages-d398bc93.cjs +1 -0
  23. package/dist/core.cjs +1 -1
  24. package/dist/core.js +2 -2
  25. package/dist/{html-to-json-fecbbe16.js → html-to-json-7510f587.js} +46 -46
  26. package/dist/html-to-json-7eba915f.cjs +1 -0
  27. package/dist/index-73cf645f.cjs +2 -0
  28. package/dist/{index-cdd49c4c.js → index-7e212fbc.js} +12 -6
  29. package/dist/lib.cjs +1 -1
  30. package/dist/lib.js +1 -1
  31. package/dist/link-1ee70bca.cjs +1 -0
  32. package/dist/{link-8594fd8f.js → link-e406254f.js} +27 -27
  33. package/dist/render.cjs +2 -2
  34. package/dist/render.js +1 -1
  35. package/dist/ui.cjs +1 -1
  36. package/dist/ui.js +2 -2
  37. package/package.json +2 -2
  38. package/dist/AddBlocks-04c49399.js +0 -258
  39. package/dist/AddBlocks-c27c81fa.cjs +0 -3
  40. package/dist/BrandingOptions-c25f6370.cjs +0 -1
  41. package/dist/Layers-3aa6aae7.cjs +0 -1
  42. package/dist/MarkAsGlobalBlock-536770e7.cjs +0 -1
  43. package/dist/Settings-2b1ff1a3.cjs +0 -1
  44. package/dist/SidePanels-f79dbace.cjs +0 -1
  45. package/dist/Topbar-bff765dc.cjs +0 -1
  46. package/dist/UploadImages-43c16a2d.cjs +0 -1
  47. package/dist/html-to-json-d8ac554d.cjs +0 -1
  48. package/dist/index-aea5c557.cjs +0 -2
  49. package/dist/link-43d13383.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),t=require("react"),a=require("lodash"),m=require("@radix-ui/react-icons"),E=require("jotai"),q=require("./scroll-area-088530b9.cjs");require("react-i18next");const b=require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-scroll-area");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");const I=E.atom([]),w=({isModalView:r,onSelect:u})=>{const R=b.useBuilderProp("uploadMediaCallback",()=>""),c=b.useBuilderProp("fetchMediaCallback",()=>[]),[n,o]=E.useAtom(I),[l,p]=t.useState(!1),[j,f]=t.useState(!1),[x,d]=t.useState(),[h,v]=t.useState("");t.useEffect(()=>{(async()=>{f(!0);const s=await c();o(s||[]),f(!1)})()},[c,o]);const y=s=>{var i,g;s&&((g=(i=s==null?void 0:s.target)==null?void 0:i.files)==null?void 0:g.length)>0&&d(s.target.files[0])},N=async()=>{p(!0);try{const s=await R(x),i=await c();o(i),u(s),d(void 0)}catch(s){o([]),v((s==null?void 0:s.message)||"Something went wrong.")}p(!1)};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[x?e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1",children:[e.jsxRuntimeExports.jsx("img",{src:URL.createObjectURL(x),alt:"",className:"h-auto w-full max-w-sm rounded-md max-h-96 object-contain"}),h&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:h}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:N,disabled:l,className:"flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",children:[l?e.jsxRuntimeExports.jsx(m.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(m.UploadIcon,{className:"animate-bounce"}),"  ",l?"Uploading...":"Upload"]}),!l&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",onClick:()=>d(void 0),children:[e.jsxRuntimeExports.jsx(m.Cross1Icon,{}),"  Cancel"]})]})]}):e.jsxRuntimeExports.jsxs("label",{htmlFor:r?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50",children:[e.jsxRuntimeExports.jsx("div",{className:"text-3xl",children:"+"}),e.jsxRuntimeExports.jsx("div",{children:"Click to choose file"})]}),e.jsxRuntimeExports.jsx("input",{type:"file",id:r?"upload-in-modal":"upload-in-panel",hidden:!0,onChange:y})]}),e.jsxRuntimeExports.jsxs(q.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${r?"px-2":""} pt-2`,children:[a.isEmpty(n)&&j&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:"Fetching..."})}),a.isEmpty(n)&&!j&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Images"})}),r?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(n,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>u(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))}):a.map(n,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>u(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=w;
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-aea5c557.cjs"),s=require("./useBuilderProp-5e57d0c8.cjs"),u=require("react-i18next");require("./jsx-runtime-5c3ac4f7.cjs");require("react");require("i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("jotai");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("chaibuilder-blocks");require("./CONTROLS-031e1de3.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");exports.ChaiBuilderStudio=e.ChaiBuilderStudio;exports.enableStyling=e.enableStyling;exports.setBlockProps=e.setBlockProps;exports.useActiveLanguage=e.useActiveLanguage;exports.useActiveModal=e.useActiveModal;exports.useActivePanel=e.useActivePanel;exports.useAddBlock=e.useAddBlock;exports.useAddBlockParent=e.useAddBlockParent;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAllBlocks=e.useAllBlocks;exports.useBlockContentByLanguage=e.useBlockContentByLanguage;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderReset=e.useBuilderReset;exports.useBuildingBlocks=e.useBuildingBlocks;exports.useCanvasHistory=e.useCanvasHistory;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDeveloperPreviewMode=e.useDeveloperPreviewMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useFeatureSupport=e.useFeatureSupport;exports.useGetPageData=e.useGetPageData;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useLanguages=e.useLanguages;exports.useMarkAsGlobalBlock=e.useMarkAsGlobalBlock;exports.useMoveBlocks=e.useMoveBlocks;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;exports.usePrimaryLanguage=e.usePrimaryLanguage;exports.useProject=e.useProject;exports.useReadOnlyMode=e.useReadOnlyMode;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useSavePage=e.useSavePage;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useSetAllBlocks=e.useSetAllBlocks;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useTranslations=e.useTranslations;exports.useTreeData=e.useTreeData;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.useBuilderProp=s.useBuilderProp;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>u.useTranslation});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-73cf645f.cjs"),s=require("./useBuilderProp-5e57d0c8.cjs"),u=require("react-i18next");require("./jsx-runtime-5c3ac4f7.cjs");require("react");require("i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("jotai");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("./CONTROLS-031e1de3.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");exports.ChaiBuilderStudio=e.ChaiBuilderStudio;exports.enableStyling=e.enableStyling;exports.setBlockProps=e.setBlockProps;exports.useActiveLanguage=e.useActiveLanguage;exports.useActiveModal=e.useActiveModal;exports.useActivePanel=e.useActivePanel;exports.useAddBlock=e.useAddBlock;exports.useAddBlockParent=e.useAddBlockParent;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAllBlocks=e.useAllBlocks;exports.useBlockContentByLanguage=e.useBlockContentByLanguage;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderReset=e.useBuilderReset;exports.useBuildingBlocks=e.useBuildingBlocks;exports.useCanvasHistory=e.useCanvasHistory;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDeveloperPreviewMode=e.useDeveloperPreviewMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useFeatureSupport=e.useFeatureSupport;exports.useGetPageData=e.useGetPageData;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.useLanguages=e.useLanguages;exports.useMarkAsGlobalBlock=e.useMarkAsGlobalBlock;exports.useMoveBlocks=e.useMoveBlocks;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;exports.usePrimaryLanguage=e.usePrimaryLanguage;exports.useProject=e.useProject;exports.useReadOnlyMode=e.useReadOnlyMode;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useSavePage=e.useSavePage;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useSetAllBlocks=e.useSetAllBlocks;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useTranslations=e.useTranslations;exports.useTreeData=e.useTreeData;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.useBuilderProp=s.useBuilderProp;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>u.useTranslation});
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import { X as M, W as h, V as L, D as R, _ as b, aa as f, O as x, ab as H, H as T, y as U, ae as w, w as O, Y as j, $ as F, c as G, e as W, k as Z, n as q, a0 as J, m as K, d as N, a1 as V, l as X, j as Y, a2 as _, N as $, x as z, ad as E, U as Q, a3 as ss, o as es, p as as, ac as os, a4 as ts, Z as us, q as ls, I as rs, u as is, A as ps, a6 as cs, K as ds, h as Bs, L as ms, f as ks, i as ns, g as gs, a7 as Ss, J as Cs, a5 as Ps, a8 as vs, R as ys, a9 as As, C as Ds } from "./index-cdd49c4c.js";
1
+ import { X as M, W as h, V as L, D as R, _ as b, aa as f, O as x, ab as H, H as T, y as U, ae as w, w as O, Y as j, $ as F, c as G, e as W, k as Z, n as q, a0 as J, m as K, d as N, a1 as V, l as X, j as Y, a2 as _, N as $, x as z, ad as E, U as Q, a3 as ss, o as es, p as as, ac as os, a4 as ts, Z as us, q as ls, I as rs, u as is, A as ps, a6 as cs, K as ds, h as Bs, L as ms, f as ks, i as ns, g as gs, a7 as Ss, J as Cs, a5 as Ps, a8 as vs, R as ys, a9 as As, C as Ds } from "./index-7e212fbc.js";
2
2
  import { u as Ms } from "./useBuilderProp-81a14920.js";
3
3
  import { useTranslation as Ls } from "react-i18next";
4
4
  import "./jsx-runtime-944c88e2.js";
@@ -17,7 +17,7 @@ import "flat-to-nested";
17
17
  import "./Class-e6b07b79.js";
18
18
  import "redux-undo";
19
19
  import "@react-hookz/web";
20
- import "chaibuilder-blocks";
20
+ import "@chaibuilder/blocks";
21
21
  import "./CONTROLS-442caee5.js";
22
22
  import "@radix-ui/react-slot";
23
23
  import "class-variance-authority";
@@ -1,42 +1,42 @@
1
- import { parse as k, stringify as g } from "himalaya";
1
+ import { parse as k, stringify as h } from "himalaya";
2
2
  import { g as x } from "./Class-e6b07b79.js";
3
- import { isEmpty as _, flatten as L, flatMapDeep as $, get as c, set as o, find as u, filter as w, includes as y, omit as S, forEach as C, capitalize as B } from "lodash";
3
+ import { isEmpty as y, flatten as L, flatMapDeep as $, get as c, set as o, find as u, filter as w, includes as g, omit as S, forEach as C, capitalize as B } from "lodash";
4
4
  import { c as I } from "./utils-ac68b2c8.js";
5
5
  import { S as p } from "./CONTROLS-442caee5.js";
6
6
  const A = {
7
- img: { alt: "_alt", width: "_width", height: "_height", src: "_image" },
7
+ img: { alt: "alt", width: "width", height: "height", src: "image" },
8
8
  video: {
9
- src: "_url",
10
- autoplay: "_controls.autoPlay",
11
- muted: "_controls.muted",
12
- loop: "_controls.loop",
13
- controls: "_controls.widgets"
9
+ src: "url",
10
+ autoplay: "controls.autoPlay",
11
+ muted: "controls.muted",
12
+ loop: "controls.loop",
13
+ controls: "controls.widgets"
14
14
  },
15
15
  a: {
16
- href: "_link.href",
17
- target: "_link.target",
16
+ href: "link.href",
17
+ target: "link.target",
18
18
  type: ""
19
19
  // @TODO: Detect here what to url, email, phone, elementId
20
20
  },
21
21
  input: {
22
- placeholder: "_placeholder",
23
- required: "_required",
24
- type: "_inputType",
25
- name: "_fieldName"
22
+ placeholder: "placeholder",
23
+ required: "required",
24
+ type: "inputType",
25
+ name: "fieldName"
26
26
  },
27
27
  textarea: {
28
- placeholder: "_placeholder",
29
- required: "_required",
30
- type: "_inputType",
31
- name: "_fieldName"
28
+ placeholder: "placeholder",
29
+ required: "required",
30
+ type: "inputType",
31
+ name: "fieldName"
32
32
  },
33
33
  select: {
34
- placeholder: "_placeholder",
35
- required: "_required",
36
- multiple: "_multiple",
37
- name: "_fieldName"
34
+ placeholder: "placeholder",
35
+ required: "required",
36
+ multiple: "multiple",
37
+ name: "fieldName"
38
38
  }
39
- }, H = (t, e) => t.children.length === 1 && y(["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link"], e._type), f = (t) => t.map((e) => e.type === "text" ? c(e, "content", "") : _(e.children) ? "" : f(e.children)).join(""), h = (t) => t === null ? !0 : t, m = (t) => {
39
+ }, H = (t, e) => t.children.length === 1 && g(["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link"], e._type), _ = (t) => t.map((e) => e.type === "text" ? c(e, "content", "") : y(e.children) ? "" : _(e.children)).join(""), m = (t) => t === null ? !0 : t, f = (t) => {
40
40
  const e = {}, r = A[t.tagName] || {}, a = t.attributes;
41
41
  return C(a, ({ key: i, value: l }) => {
42
42
  if (r[i]) {
@@ -44,11 +44,11 @@ const A = {
44
44
  const s = u(t.attributes, { key: "width" }), n = u(t.attributes, { key: "height" });
45
45
  s && n ? l = `https://via.placeholder.com/${s == null ? void 0 : s.value}x${n == null ? void 0 : n.value}` : l = "https://via.placeholder.com/150x150";
46
46
  }
47
- o(e, r[i], h(l));
47
+ o(e, r[i], m(l));
48
48
  } else
49
- y(["style", "class", "srcset"], i) || o(e, `_styles_attrs.${i}`, h(l));
49
+ g(["style", "class", "srcset"], i) || o(e, `styles_attrs.${i}`, m(l));
50
50
  }), delete e.class, e;
51
- }, q = (t, e = "_styles") => {
51
+ }, q = (t, e = "styles") => {
52
52
  if (!t.attributes)
53
53
  return { [e]: `${p},` };
54
54
  const r = u(t.attributes, { key: "class" });
@@ -62,13 +62,13 @@ const A = {
62
62
  case "img":
63
63
  return { _type: "Image" };
64
64
  case "input":
65
- return { _type: "Input", _showLabel: !1 };
65
+ return { _type: "Input", showLabel: !1 };
66
66
  case "hr":
67
67
  return { _type: "Divider" };
68
68
  case "br":
69
69
  return { _type: "LineBreak" };
70
70
  case "textarea":
71
- return { _type: "TextArea", _showLabel: !1 };
71
+ return { _type: "TextArea", showLabel: !1 };
72
72
  case "audio":
73
73
  return { _type: "Audio" };
74
74
  case "iframe":
@@ -80,7 +80,7 @@ const A = {
80
80
  case "svg":
81
81
  return { _type: "Icon" };
82
82
  case "select":
83
- return { _type: "Select", _options: [] };
83
+ return { _type: "Select", options: [] };
84
84
  case "option":
85
85
  return { _type: "Option" };
86
86
  case "ul":
@@ -88,18 +88,18 @@ const A = {
88
88
  case "dl":
89
89
  return {
90
90
  _type: "List",
91
- _tag: t.tagName,
91
+ tag: t.tagName,
92
92
  _listType: t.tagName === "ol" ? "list-decimal" : "list-none"
93
93
  };
94
94
  case "li":
95
95
  case "dt":
96
- return { _type: "ListItem", _tag: t.tagName };
96
+ return { _type: "ListItem", tag: t.tagName };
97
97
  case "span":
98
98
  case "figcaption":
99
99
  case "legend":
100
- return { _type: "Span", _tag: t.tagName };
100
+ return { _type: "Span", tag: t.tagName };
101
101
  case "p":
102
- return { _type: "Paragraph", _content: "" };
102
+ return { _type: "Paragraph", content: "" };
103
103
  case "a":
104
104
  return { _type: "Link" };
105
105
  case "form":
@@ -116,14 +116,14 @@ const A = {
116
116
  case "h4":
117
117
  case "h5":
118
118
  case "h6":
119
- return { _type: "Heading", _tag: t.tagName };
119
+ return { _type: "Heading", tag: t.tagName };
120
120
  case "table":
121
121
  return { _type: "Table" };
122
122
  case "tr":
123
123
  return { _type: "TableRow" };
124
124
  case "td":
125
125
  case "th":
126
- return { _type: "TableCell", _tag: t.tagName };
126
+ return { _type: "TableCell", tag: t.tagName };
127
127
  case "thead":
128
128
  return { _type: "TableHead" };
129
129
  case "tbody":
@@ -132,9 +132,9 @@ const A = {
132
132
  return { _type: "TableFooter" };
133
133
  default:
134
134
  return {
135
- _tag: t.tagName,
136
135
  _type: "Box",
137
- _name: t.tagName === "div" ? "Box" : B(t.tagName)
136
+ tag: t.tagName,
137
+ name: t.tagName === "div" ? "Box" : B(t.tagName)
138
138
  };
139
139
  }
140
140
  }, b = (t, e = null) => $(t, (r) => {
@@ -143,25 +143,25 @@ const A = {
143
143
  return [];
144
144
  let a = { _id: x() };
145
145
  if (e && (a._parent = e.block._id), r.type === "text")
146
- return _(c(r, "content", "")) ? [] : e && H(e.node, e.block) ? (o(e, "block._content", c(r, "content", "")), []) : { ...a, _type: "Text", _content: c(r, "content", "") };
146
+ return y(c(r, "content", "")) ? [] : e && H(e.node, e.block) ? (o(e, "block.content", c(r, "content", "")), []) : { ...a, _type: "Text", content: c(r, "content", "") };
147
147
  if (a = {
148
148
  ...a,
149
149
  ...E(r),
150
- ...m(r),
150
+ ...f(r),
151
151
  ...q(r)
152
152
  }, a._type === "Input") {
153
- const s = a._inputType || "text";
153
+ const s = a.inputType || "text";
154
154
  s === "checkbox" ? o(a, "_type", "Checkbox") : s === "radio" && o(a, "_type", "Radio");
155
155
  } else {
156
156
  if (r.tagName === "video")
157
- return a._content = g([r]), [a];
157
+ return a.content = h([r]), [a];
158
158
  if (r.tagName === "svg") {
159
159
  const s = u(r.attributes, { key: "height" }), n = u(r.attributes, { key: "width" }), d = c(s, "value") ? `[${c(s, "value")}px]` : "full", T = c(n, "value") ? `[${c(n, "value")}px]` : "full", v = c(u(r.attributes, { key: "class" }), "value");
160
- return a._styles = `${p}, ${I(`w-${T} h-${d}`, v)}`.trim(), r.attributes = w(r.attributes, (N) => !y(["style", "width", "height", "class"], N.key)), a._icon = g([r]), o(a, "_styles_attrs", S(c(a, "_styles_attrs") || {}, ["height", "width", "style", "class"])), [a];
160
+ return a.styles = `${p}, ${I(`w-${T} h-${d}`, v)}`.trim(), r.attributes = w(r.attributes, (N) => !g(["style", "width", "height", "class"], N.key)), a._icon = h([r]), o(a, "styles_attrs", S(c(a, "styles_attrs") || {}, ["height", "width", "style", "class"])), [a];
161
161
  } else if (r.tagName == "option" && e && ((l = e.block) == null ? void 0 : l._type) === "Select")
162
- return e.block._options.push({
163
- label: f(r.children),
164
- ...m(r)
162
+ return e.block.options.push({
163
+ label: _(r.children),
164
+ ...f(r)
165
165
  }), [];
166
166
  }
167
167
  const i = b(r.children, { block: a, node: r });
@@ -171,7 +171,7 @@ const A = {
171
171
  return (e && e.length > 0 ? e[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : t).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
172
172
  }, U = (t) => {
173
173
  const e = k(M(t));
174
- return _(t) ? [] : L(b(e));
174
+ return y(t) ? [] : L(b(e));
175
175
  };
176
176
  export {
177
177
  U as g
@@ -0,0 +1 @@
1
+ "use strict";const o=require("himalaya"),b=require("./Class-0801d193.cjs"),e=require("lodash"),T=require("./utils-3c452dd0.cjs"),u=require("./CONTROLS-031e1de3.cjs"),v={img:{alt:"alt",width:"width",height:"height",src:"image"},video:{src:"url",autoplay:"controls.autoPlay",muted:"controls.muted",loop:"controls.loop",controls:"controls.widgets"},a:{href:"link.href",target:"link.target",type:""},input:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},textarea:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},select:{placeholder:"placeholder",required:"required",multiple:"multiple",name:"fieldName"}},N=(t,r)=>t.children.length===1&&e.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link"],r._type),y=t=>t.map(r=>r.type==="text"?e.get(r,"content",""):e.isEmpty(r.children)?"":y(r.children)).join(""),p=t=>t===null?!0:t,g=t=>{const r={},s=v[t.tagName]||{},a=t.attributes;return e.forEach(a,({key:l,value:c})=>{if(s[l]){if(t.tagName==="img"&&l==="src"&&!c.startsWith("http")){const i=e.find(t.attributes,{key:"width"}),n=e.find(t.attributes,{key:"height"});i&&n?c=`https://via.placeholder.com/${i==null?void 0:i.value}x${n==null?void 0:n.value}`:c="https://via.placeholder.com/150x150"}e.set(r,s[l],p(c))}else e.includes(["style","class","srcset"],l)||e.set(r,`styles_attrs.${l}`,p(c))}),delete r.class,r},k=(t,r="styles")=>{if(!t.attributes)return{[r]:`${u.STYLES_KEY},`};const s=e.find(t.attributes,{key:"class"});if(s){const a=s.value;return{[r]:`${u.STYLES_KEY},${a}`}}return{[r]:`${u.STYLES_KEY},`}},L=t=>{switch(t.tagName){case"img":return{_type:"Image"};case"input":return{_type:"Input",showLabel:!1};case"hr":return{_type:"Divider"};case"br":return{_type:"LineBreak"};case"textarea":return{_type:"TextArea",showLabel:!1};case"audio":return{_type:"Audio"};case"iframe":return{_type:"Iframe"};case"canvas":return{_type:"Canvas"};case"video":return{_type:"CustomHTML"};case"svg":return{_type:"Icon"};case"select":return{_type:"Select",options:[]};case"option":return{_type:"Option"};case"ul":case"ol":case"dl":return{_type:"List",tag:t.tagName,_listType:t.tagName==="ol"?"list-decimal":"list-none"};case"li":case"dt":return{_type:"ListItem",tag:t.tagName};case"span":case"figcaption":case"legend":return{_type:"Span",tag:t.tagName};case"p":return{_type:"Paragraph",content:""};case"a":return{_type:"Link"};case"form":return{_type:"Form"};case"label":return{_type:"Label"};case"button":return{_type:"Button"};case"code":return{_type:"Code"};case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return{_type:"Heading",tag:t.tagName};case"table":return{_type:"Table"};case"tr":return{_type:"TableRow"};case"td":case"th":return{_type:"TableCell",tag:t.tagName};case"thead":return{_type:"TableHead"};case"tbody":return{_type:"TableBody"};case"tfoot":return{_type:"TableFooter"};default:return{_type:"Box",tag:t.tagName,name:t.tagName==="div"?"Box":e.capitalize(t.tagName)}}},h=(t,r=null)=>e.flatMapDeep(t,s=>{var c;if(s.type==="comment")return[];let a={_id:b.generateUUID()};if(r&&(a._parent=r.block._id),s.type==="text")return e.isEmpty(e.get(s,"content",""))?[]:r&&N(r.node,r.block)?(e.set(r,"block.content",e.get(s,"content","")),[]):{...a,_type:"Text",content:e.get(s,"content","")};if(a={...a,...L(s),...g(s),...k(s)},a._type==="Input"){const i=a.inputType||"text";i==="checkbox"?e.set(a,"_type","Checkbox"):i==="radio"&&e.set(a,"_type","Radio")}else{if(s.tagName==="video")return a.content=o.stringify([s]),[a];if(s.tagName==="svg"){const i=e.find(s.attributes,{key:"height"}),n=e.find(s.attributes,{key:"width"}),m=e.get(i,"value")?`[${e.get(i,"value")}px]`:"full",f=e.get(n,"value")?`[${e.get(n,"value")}px]`:"full",_=e.get(e.find(s.attributes,{key:"class"}),"value");return a.styles=`${u.STYLES_KEY}, ${T.cn(`w-${f} h-${m}`,_)}`.trim(),s.attributes=e.filter(s.attributes,d=>!e.includes(["style","width","height","class"],d.key)),a._icon=o.stringify([s]),e.set(a,"styles_attrs",e.omit(e.get(a,"styles_attrs")||{},["height","width","style","class"])),[a]}else if(s.tagName=="option"&&r&&((c=r.block)==null?void 0:c._type)==="Select")return r.block.options.push({label:y(s.children),...g(s)}),[]}const l=h(s.children,{block:a,node:s});return[a,...l]}),S=t=>{const r=t.match(/<body[^>]*>[\s\S]*?<\/body>/);return(r&&r.length>0?r[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):t).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},x=t=>{const r=o.parse(S(t));return e.isEmpty(t)?[]:e.flatten(h(r))};exports.getBlocksFromHTML=x;
@@ -0,0 +1,2 @@
1
+ "use strict";const N=require("./jsx-runtime-5c3ac4f7.cjs"),jr=require("i18next"),Cr=require("react-i18next"),Or=require("flagged"),x=require("react"),Lr=require("react-dnd"),a=require("lodash"),$t=require("@minoru/react-dnd-treeview"),te=require("./useBuilderProp-5e57d0c8.cjs"),p=require("jotai"),Nr=require("./utils-3c452dd0.cjs"),ie=require("react-hotkeys-hook"),vn=require("flat-to-nested"),K=require("./Class-0801d193.cjs"),Oe=require("redux-undo"),Tr=require("@react-hookz/web"),bn=require("@chaibuilder/blocks"),Q=require("./CONTROLS-031e1de3.cjs"),Dr="Dark mode",Mr="This page has no blocks. Add a block by clicking the + button",$r="This page is empty",Rr="Please select a block to edit settings or styles",qr="Please select a styling block",Ur="Drop your block here",Vr={dark_mode:Dr,tree_view_no_blocks:Mr,canvas_empty:$r,no_block_selected_for_styling:Rr,no_styling_block_selected:qr,drop_here_message:Ur};jr.use(Cr.initReactI18next).init({resources:{en:{translation:Vr}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const Fr="";const zr={};class kn extends x.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return console.error(t),{hasError:!0}}render(){return this.state.hasError?N.jsxRuntimeExports.jsx("h1",{children:"Something went wrong."}):this.props.children}}const Hr=e=>{const t=e.replace(Q.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}};let Kr=0;function ce(e,t){const n=`atom${++Kr}`,r={toString:()=>n};return typeof e=="function"?r.read=e:(r.init=e,r.read=s=>s(r),r.write=(s,o,i)=>o(r,typeof i=="function"?i(s(r)):i)),t&&(r.write=t),r}const Wr=Symbol();function Yr(e,t){const n=ce(e,(r,s,o)=>s(n,t(r(n),o)));return n}const Rt=(e,t,n)=>(t.has(n)?t:t.set(n,e())).get(n),Gr=new WeakMap,Jr=(e,t,n)=>{const r=Rt(()=>new WeakMap,Gr,t);return Rt(e,r,n)},Xr={},qt=e=>!!e.write,Qr=e=>typeof e=="function";function Zr(e,t){return Jr(()=>{const n=new WeakMap,r=(i,c)=>{let d=n.get(i);if(d)return d;const l=c&&n.get(c),m=[],g=[];return i.forEach((v,h)=>{const E=t?t(v):h;g[h]=E;const B=l&&l.atomList[l.keyList.indexOf(E)];if(B){m[h]=B;return}const w=P=>{const L=P(s),y=P(e),T=r(y,L==null?void 0:L.arr).keyList.indexOf(E);if(T<0||T>=y.length){const $=i[r(i).keyList.indexOf(E)];if($)return $;throw new Error("splitAtom: index out of bounds for read")}return y[T]},C=(P,L,y)=>{const b=P(s),T=P(e),O=r(T,b==null?void 0:b.arr).keyList.indexOf(E);if(O<0||O>=T.length)throw new Error("splitAtom: index out of bounds for write");const U=Qr(y)?y(T[O]):y;L(e,[...T.slice(0,O),U,...T.slice(O+1)])};m[h]=qt(e)?ce(w,C):ce(w)}),l&&l.keyList.length===g.length&&l.keyList.every((v,h)=>v===g[h])?d=l:d={arr:i,atomList:m,keyList:g},n.set(i,d),d},s=ce(i=>{const c=i(s),d=i(e);return r(d,c==null?void 0:c.arr)});s.init=void 0;const o=qt(e)?ce(i=>i(s).atomList,(i,c,d)=>{switch(d.type){case"remove":{const l=i(o).indexOf(d.atom);if(l>=0){const m=i(e);c(e,[...m.slice(0,l),...m.slice(l+1)])}break}case"insert":{const l=d.before?i(o).indexOf(d.before):i(o).length;if(l>=0){const m=i(e);c(e,[...m.slice(0,l),d.value,...m.slice(l)])}break}case"move":{const l=i(o).indexOf(d.atom),m=d.before?i(o).indexOf(d.before):i(o).length;if(l>=0&&m>=0){const g=i(e);l<m?c(e,[...g.slice(0,l),...g.slice(l+1,m),g[l],...g.slice(m)]):c(e,[...g.slice(0,m),g[l],...g.slice(m,l),...g.slice(l+1)])}break}}}):ce(i=>i(s).atomList);return o},e,t||Xr)}const es=e=>typeof(e==null?void 0:e.then)=="function";function ts(e){let t,n;const r={getItem:(s,o)=>{var i,c;const d=m=>{if(m=m||"",t!==m){try{n=JSON.parse(m)}catch{return o}t=m}return n},l=(c=(i=e())==null?void 0:i.getItem(s))!=null?c:null;return es(l)?l.then(d):d(l)},setItem:(s,o)=>{var i;return(i=e())==null?void 0:i.setItem(s,JSON.stringify(o))},removeItem:s=>{var o;return(o=e())==null?void 0:o.removeItem(s)}};return typeof window<"u"&&typeof window.addEventListener=="function"&&(r.subscribe=(s,o,i)=>{if(!(e()instanceof window.Storage))return()=>{};const c=d=>{if(d.storageArea===e()&&d.key===s){let l;try{l=JSON.parse(d.newValue||"")}catch{l=i}o(l)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}}),r}const ns=ts(()=>typeof window<"u"?window.localStorage:void 0);function ye(e,t,n=ns,r){const s=r==null?void 0:r.unstable_getOnInit,o=ce(s?n.getItem(e,t):t);return o.onMount=c=>{s||c(n.getItem(e,t));let d;return n.subscribe&&(d=n.subscribe(e,c,t)),d},ce(c=>c(o),(c,d,l)=>{const m=typeof l=="function"?l(c(o)):l;return m===Wr?(d(o,t),n.removeItem(e)):m instanceof Promise?m.then(g=>(d(o,g),n.setItem(e,g))):(d(o,m),n.setItem(e,m))})}const rs=new vn({children:"blockNodes"}),xn=(e,t=null)=>a.flatten(e.map(n=>{if(n=t!==null?{...n,parent:t}:n,n.children&&n.children.length){const r=[...n.children];return delete n.children,a.flatten([n,...xn(r,n._id)])}return n}));function An(e,t,n){const r=a.filter(e,o=>o._parent===t),s=[];for(let o=0;o<r.length;o++){const i=Sn(r[o]);if(Object.keys(i).length>0&&Object.keys(i).forEach(c=>{r[o][c]=`slot:${K.generateUUID()}`}),a.filter(e,{_parent:r[o]._id}).length>0){const c=K.generateUUID();s.push({...r[o],oldId:r[o]._id,_id:c,_parent:n}),s.push(a.flatten(An(e,r[o]._id,c)))}else s.push({...r[o],oldId:r[o]._id,_id:K.generateUUID(),_parent:n})}return a.flatten(s)}function ss(e){let t=rs.convert(e.map(n=>a.omit(n,["settings"])));return t=!t.type&&t.blockNodes?t.blockNodes:a.isEmpty(t)?[]:[t],t}const Sn=e=>{const t={};return Object.keys(e).forEach(n=>{a.isString(e[n])&&e[n].startsWith("slot")&&(t[n]=e[n].replace("slot:",""))}),t},os=(e,t,n=null)=>{let r=a.find(e,{_id:t});r={...r,oldId:r._id,_id:K.generateUUID()},n&&(r={...r,_parent:n});const s=[r];a.filter(e,{_parent:t}).length>0&&s.push(a.flatten(An(e,t,r._id)));const o=a.flatten(s);return a.map(o,i=>{const c=i,d=Sn(c);return Object.keys(d).length>0&&Object.keys(d).forEach(l=>{const m=a.find(o,{oldId:d[l].replace("slot:","")});c[l]=`slot:${m._id}`}),a.omit(c,["global","oldId"])})},is=Oe((e=[],t)=>{switch(t.type){case"add_new_blocks":case"add_duplicate_blocks":return[...e,...t.payload];case"create_snapshot":return[...e];case"set_blocks":case"set_page_blocks":return[...t.payload];case"update_props":case"update_props_realtime":const{payload:n}=t;return e.map(r=>(n.ids.includes(r._id)&&!a.isEmpty(t.payload.props)&&Object.keys(t.payload.props).forEach(s=>{a.set(r,s,t.payload.props[s])}),r));default:return e}},{debug:!1,ignoreInitialState:!1,limit:30,filter:Oe.excludeAction(["update_props_realtime","add_duplicate_blocks","set_page_blocks"])}),Xe=Yr({past:[],present:[],future:[]},is);Xe.debugLabel="pageBlocksAtom";const Z=p.atom(e=>{var t;return(t=e(Xe))==null?void 0:t.present});Z.debugLabel="presentBlocksAtom";const gt=Zr(Z);gt.debugLabel="pageBlocksAtomsAtom";const wn=p.atom(e=>ss(e(Z)));wn.debugLabel="pageBlocksTreeAtom";const as=p.atom("");as.debugLabel="builderActivePageAtom";const cs=p.atom(-1);cs.debugLabel="destinationDropIndexAtom";const Bn=p.atom(!1);Bn.debugLabel="addBlocksModalAtom";const ee=()=>{const[,e]=p.useAtom(Xe);return e},ls=()=>{const e=ee(),t=p.useAtomValue(wn),n=x.useCallback(r=>{const s=xn(r);e({type:"set_page_blocks",payload:s})},[e]);return[t,n]},_n=()=>{const e=ee();return[x.useCallback(n=>{e({type:"set_page_blocks",payload:n})},[e])]},lt=e=>["Box","Slot","Form","DataContext","Link","List","ListItem","Row","Column","Table","TableCell"].includes(e),us=e=>!["Slot"].includes(e),ds=e=>!["Slot"].includes(e);function ps(e,t){return e==="Slot"||t==="List"&&e!=="ListItem"||t==="Row"&&e!=="Column"?!1:lt(t)}const fs=(e,{dragSource:t,dropTarget:n})=>{const r=a.get(t,"data._type",""),s=a.get(n,"data._type","");return r==="Slot"||a.get(t,"id")&&a.get(t,"id")===a.get(n,"id")?!1:a.isEmpty(s)?!0:ps(r,s)},En=p.atom([]);En.debugLabel="buildingBlocksAtom";const ms=p.atom(e=>{const t=e(En);return a.filter(t,n=>a.has(n,"blockId"))}),gs=()=>{},ht=()=>{const e=bn.useChaiBlocks(),t=p.useAtomValue(ms),n=()=>{},r=x.useCallback(()=>gs(),[]);return[e,t,n,r]},yt=p.atom([]);yt.debugLabel="selectedBlockIdsAtom";const vt=p.atom(e=>{const t=e(Z),n=e(yt);return a.map(a.filter(t,({_id:r})=>a.includes(n,r)),r=>({...r}))});vt.debugLabel="selectedBlocksAtom";const bt=p.atom(e=>{const t=e(vt);return t.length===0?null:t.length===1?t[0]:{type:"Multiple",id:a.map(t,"id")}});bt.debugLabel="selectedBlockAtom";const hs=e=>a.get(e,"parent",null),ys=p.atom(e=>{const t=e(vt),n=a.map(t,hs);return a.filter(e(Z),r=>a.includes(n,r._id))});ys.debugLabel="selectedBlocksParentsAtom";const In=p.atom(()=>!1);In.debugLabel="selectedBlockFlexChildAtom";const Pn=p.atom(()=>!1);Pn.debugLabel="selectedBlockGridChildAtom";const kt=p.atom("");kt.debugLabel="styleStateAtom";const jn=ye("styleBreakpoint","xs");jn.debugLabel="styleBreakpointAtom";const vs=()=>({flexChild:p.useAtomValue(In),gridChild:p.useAtomValue(Pn)}),bs=()=>p.useAtomValue(bt),de=()=>{const[e,t]=p.useAtom(yt),n=x.useCallback(r=>{t(s=>a.includes(s,r)?a.without(s,r):[...s,r])},[t]);return[e,t,n]},ut=(e,t="")=>{switch(e.type){case"singular":return e.uiSchema;case"model":const{properties:n}=e,r={};return Object.keys(n).forEach(i=>{const c=n[i];if(a.includes(["slot","styles"],c.type))return;const d=a.get(c,"i18n",!1)?`${i}-${t}`:i;r[d]=ut(c,t)}),r;case"list":const{itemProperties:s}=e,o={items:{}};return Object.keys(s).forEach(i=>{const c=s[i];if(a.includes(["slot","styles"],c.type))return;const d=a.get(c,"i18n",!1)?`${i}-${t}`:i;o.items[d]=ut(c,t)}),o;default:return{}}},dt=(e,t="")=>{switch(e.type){case"singular":return e.schema;case"model":const{properties:n,title:r}=e,s={title:r,type:"object",properties:{}};return Object.keys(n).forEach(d=>{const l=n[d];if(a.includes(["slot","styles"],l.type))return;const m=a.get(l,"i18n",!1)?`${d}-${t}`:d;s.properties[m]=dt(l,t)}),s;case"list":const{itemProperties:o,title:i}=e,c={title:i,type:"array",items:{type:"object",properties:{}}};return Object.keys(o).forEach(d=>{const l=o[d];if(a.includes(["slot","styles"],l.type))return;const m=a.get(l,"i18n",!1)?`${d}-${t}`:d;c.items.properties[m]=dt(l,t),a.set(c.items,"title",a.get(l,"itemTitle",`${i} item`))}),c;default:return{}}},Cn=e=>{const t={};return Object.keys(e).forEach(n=>{t[n]=xs(e[n])}),t},ks=e=>{if(a.isEmpty(e.default))return[];const{itemProperties:t}=e;return a.map(e.default,n=>{const r={...n};return a.forIn(n,(s,o)=>{a.has(t,o)&&a.get(t[o],"i18n",!1)&&(r[o]=Q.I18N_KEY)}),r})},xs=e=>{switch(e.type){case"styles":return e.default;case"slot":return`${Q.SLOT_KEY}${K.generateUUID()}`;case"singular":const{i18n:t,schema:n}=e;return t?Q.I18N_KEY:a.get(n,"default","");case"model":return Cn(e.properties);case"list":return ks(e);default:return""}},On=()=>p.useAtomValue(Z);function Ut(e,t,n,r,s){if(t===null)return[...e,...r];if(n!==null){const d=a.findIndex(e,{_parent:t}),l=(d===-1?0:d)+n;return e.splice(l,0,...r),e}if(!s){const l=a.findIndex(e,{_id:t})+1;return e.splice(l,0,...r),e}let o=a.findIndex(e,{_id:t});const i=a.filter(e,{_parent:t});a.isEmpty(i)||(o=a.findIndex(e,{_id:a.last(i)._id}));const c=o+1;return e.splice(c,0,...r),e}const As=()=>{const e=ee(),t=On(),[,n]=ht(),[,r]=de(),s=x.useCallback((i,c,d)=>{if(a.has(i,"blocks")){const w=i.blocks;return o(w,c,d)}const l=K.generateUUID(),m=Cn(i.props),g=[];a.forIn(m,(w,C)=>{if(a.startsWith(w,Q.SLOT_KEY)){const P=w.replace(Q.SLOT_KEY,"");g.push({_id:P,_type:"Slot",_parent:l,_name:i.props[C].name,_styles:i.props[C].styles,_emptyStyles:i.props[C].emptyStyles})}});const v={_type:i.type,_id:l,...m};let h;c&&(h=a.find(t,{_id:c}),v._parent=c);const E=h?lt(h._type):!0;!E&&h&&(v._parent=h._parent);const B=[v,...g];return e({type:"set_blocks",payload:Ut(t,c||null,d||null,B,E)}),r([v._id]),v},[t,e,r]),o=x.useCallback((i,c,d)=>{var g;for(let v=0;v<i.length;v++){const{_id:h}=i[v];i[v]._id=K.generateUUID();const E=a.filter(i,{_parent:h});for(let B=0;B<E.length;B++)E[B]._parent=i[v]._id}let l;c&&(l=a.find(t,{_id:c}),i[0]._parent=c);const m=l?lt(l._type):!0;return!m&&l&&(i[0]._parent=l._parent),e({type:"set_blocks",payload:Ut(t,c||null,d||null,i,m)}),r([(g=a.first(i))==null?void 0:g._id]),a.first(i)},[t,e,r,n]);return{addCoreBlock:s,addPredefinedBlock:o}},Vt={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},Ft=["xs","sm","md","lg","xl","2xl"];function Ss(e,t){if(t===null)return"baseClasses";const n=t.mq;if(n==="xs"||t.dark||t.mod!=="")return"classes";let r="baseClasses",s=Ft.indexOf(n);for(;s>0;){const o=Ft[s-1];if(a.find(e,{mq:o,property:t.property})){r="classes";break}s--}return r}const zt=[];function ws(e="",t="",n=[]){e=e.trim().replace(/ +/g,"");let r=a.filter(a.map(e.split(" "),K.constructClassObject),l=>!a.isNull(l)),s=a.filter(a.map(t.split(" "),K.constructClassObject),l=>!a.isNull(l));s=a.filter(s,l=>!a.includes(zt,l.property));const o=[],i=[];a.each(n,l=>{const m=K.constructClassObject(l),g=a.find(r,a.pick(m,["dark","mq","mod","property"]));if(g&&(r=a.filter(r,v=>v.fullCls!==(g==null?void 0:g.fullCls))),o.push(m),m.mq==="xs"&&!m.dark&&m.mod===""&&(s=a.filter(s,v=>v.property!==m.property)),Ss(r,m)==="baseClasses"&&!a.includes(zt,m.property)){const v=a.find(s,a.pick(m,["property"]));g&&(s=a.filter(s,h=>h.fullCls!==(v==null?void 0:v.fullCls))),i.push({...m,fullCls:m.cls,mq:"xs"})}});const c=a.map(a.sortBy([...r,...o],l=>Vt[l.mq]),"fullCls").join(" ");return`${a.map(a.sortBy([...s,...i],l=>Vt[l.mq]),"fullCls").join(" ").trim()},${c.trim()}`.trim().replace(/ +/g,"")}const $e=p.atom([]);$e.debugLabel="selectedStylingBlocksAtom";const xt=()=>p.useAtom($e),Bs=e=>{const t=e.replace(Q.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}},_s=p.atom(null,(e,t,{blockIds:n,newClasses:r,dispatch:s})=>{const o=a.filter(e(gt),c=>n.includes(e(c)._id)),i=a.first(e($e));a.each(o,c=>{const d=e(c),l=a.get(d,i.prop,`${Q.STYLES_KEY},`),{baseClasses:m,classes:g}=Bs(l);s({type:"update_props_realtime",payload:{ids:[d._id],props:{[i.prop]:`${Q.STYLES_KEY}${ws(g,m,r)}`}}})})}),Es=()=>{const e=ee(),t=p.useSetAtom(_s);return x.useCallback((n,r,s)=>{t({blockIds:n,newClasses:r,dispatch:e}),s&&setTimeout(()=>e({type:"create_snapshot"}),500)},[e,t])},Is=p.atom(!1),At=()=>{const[e,t]=p.useAtom(Is);return[e,t]},Ps=p.atom(K.BRANDING_OPTIONS_DEFAULTS),St=()=>{const[e,t]=p.useAtom(Ps);return[a.isObject(e)?{...e,...K.BRANDING_OPTIONS_DEFAULTS}:K.BRANDING_OPTIONS_DEFAULTS,t]},js=p.atom(null),Ln=()=>({currentPage:p.useAtomValue(js)}),Nn=new vn({});function Cs(e){let t=Nn.convert(e);return t=!t.type&&t.children&&t.children.length?t.children:a.isEmpty(t)?[]:[t],t}const wt=(e,t)=>a.flatten(e.map(n=>{if(n=t?{...n,parent:t}:{...n},n.children){const r=[...n.children];return delete n.children,a.flatten([n,...wt(r,n._id)])}return n}));function Bt(e,t=!1){for(let n=0;n<e.length;n++){const r=e[n];r.global&&!t?e[n]={type:"GlobalBlock",_parent:a.get(r,"parent",null),blockId:r.blockId,_id:r._id}:r.children&&r.children.length&&Bt(r.children)}}function Tn(e){let t=[],n=a.filter(e,{type:"GlobalBlock"});return n.length>0&&(n=a.map(n,Dn),a.each(n,r=>{t=[...t,...Os(r)]})),t}function Os(e){let t=[];const n=a.get(a.first(e),"parent",null);a.set(a.first(e),"parent",null);const r=[Nn.convert(Mn(e))];Bt(r,!0);let s=wt(r,e[0]._id);return s=a.set(s,"0.parent",n),t=[...t,s,...Tn(s)],t}function Dn(e){const t=a.find(pt,{_id:e._id});if(!t)return[];const n=[t],r=a.filter(pt,{_parent:e._id});return r.length?a.flatten([...n,...a.flatten(a.map(r,Dn))]):a.flatten(n)}const Mn=e=>JSON.parse(JSON.stringify(e));let pt=[];function Ls(e){pt=e;const t=Cs(Mn(e));Bt(t);const n=wt(t,null),r=Tn(n),s={};return a.each(r,o=>a.set(s,a.first(o).blockId,o)),[n,s]}const _t=()=>{const[e]=St(),{currentPage:t}=Ln(),n=p.useAtomValue(Z);return x.useCallback(()=>{const r=a.map(n,i=>a.omit(i,["expanded","order","title","siblings","tempClasses"])),[s=[],o=[]]=Ls(r);return{currentPage:t,blocks:s,globalBlocks:o}},[e,t,n])};ye("blockStylingActiveTab",1);p.atom([]);const $n=p.atom(!1);$n.debugLabel="readOnlyModeAtom";const Rn=p.atom(!1);Rn.debugLabel="inlineEditingActiveAtom";const qn=p.atom(!1);qn.debugLabel="advanceStylingOpenAtom";const Un=p.atom("online");Un.debugLabel="networkModeAtom";ye("currentUiLibrary","");const Ns=p.atom(!1);Ns.debugLabel="codeEditorOpenAtom";const Vn=p.atom(!1);Vn.debugLabel="editLayerNameAtom";const Ts=p.atom("");Ts.debugLabel="activeLanguageAtom";const Ds=p.atom("");Ds.debugLabel="primaryLanguageAtom";const Fn=p.atom(null);Fn.debugLabel="canvasIframeAtom";const zn=p.atom("layers");zn.debugLabel="activePanelAtom";const Hn=p.atom(!1);Hn.debugLabel="addBlockOffCanvasAtom";const Kn=p.atom("");Kn.debugLabel="showPredefinedBlockCategoryAtom";const Qe=p.atom({undoCount:0,redoCount:0});Qe.debugLabel="historyStatesAtom";const Et=p.atom("SAVED");Et.debugLabel="pageSyncStateAtom";const Ms=()=>{const[e,t]=p.useAtom(Et),n=te.useBuilderProp("onSaveBlocks",async()=>{}),r=te.useBuilderProp("onSyncStatusChange",()=>{}),s=_t(),o=p.useSetAtom(Qe),{undoCount:i,redoCount:c}=Re();return{savePage:Tr.useThrottledCallback(async()=>{t("SAVING"),r("SAVING");const l=s();return await n({blocks:l.blocks,globalBlocks:l.globalBlocks}),setTimeout(()=>{o({undoCount:i,redoCount:c}),t("SAVED"),r("SAVED")},100),!0},[s,t,r,n],5e3),syncState:e,setSyncState:t}},Re=()=>{const e=p.useAtomValue(Xe),[{undoCount:t,redoCount:n}]=p.useAtom(Qe),r=ee(),[s]=At(),[,o]=de(),[,i]=xt(),[,c]=p.useAtom(Et),d=te.useBuilderProp("onSyncStatusChange",()=>{}),l=x.useCallback(()=>{r({type:"create_snapshot"})},[r]);return x.useEffect(()=>{t!==(e==null?void 0:e.past.length)||n!==(e==null?void 0:e.future.length)?(c("UNSAVED"),d("UNSAVED")):t===(e==null?void 0:e.past.length)&&n===(e==null?void 0:e.future.length)&&(c("SAVED"),d("SAVED"))},[e==null?void 0:e.past.length,e==null?void 0:e.future.length,t,n,d,c]),{undoCount:e==null?void 0:e.past.length,redoCount:e==null?void 0:e.future.length,undo:x.useCallback(()=>{s||(r(Oe.ActionCreators.undo()),setTimeout(()=>{i([]),o([])},200))},[r,s,c]),redo:x.useCallback(()=>{s||(r(Oe.ActionCreators.redo()),setTimeout(()=>{i([]),o([])},200))},[s,r]),clear:()=>{r(Oe.ActionCreators.clearHistory())},createSnapshot:l}},Wn=()=>p.useAtom(jn),Yn=ye("canvasWidth",360),Gn=p.atom(e=>{const t=e(Yn);return K.getBreakpointValue(t).toLowerCase()}),$s=()=>{const[e,t]=p.useAtom(Yn),n=p.useAtomValue(Gn),[r,s]=Wn();return x.useEffect(()=>{r!=="xs"&&s(n)},[n,r,s]),[e,n,t]},Rs=ye("canvasZoom",100),qs=()=>p.useAtom(Rs),Jn=p.atom([]),It=()=>{const[e,t]=p.useAtom(Jn),n=p.useSetAtom(Pt),r=x.useCallback(s=>{t(s),n([])},[t,n]);return[e,r]},Pt=p.atom([]),Xn=()=>{const[e,t]=p.useAtom(Pt),n=p.useSetAtom(Jn),r=x.useCallback(s=>{t(s),n([])},[t,n]);return[e,r]},Qn=ye("darkMode",!1),Us=()=>{const[e,t]=p.useAtom(Qn);return[e,t]},Vs=p.atom(!1),Fs=()=>{const[e,t]=p.useAtom(Vs);return[e,t]},jt=()=>{const e=ee(),t=p.useAtomValue(Z),[,n]=de();return x.useCallback((r,s=null)=>{const o=[];a.each(r,i=>{const d=os(t,i,s===i?null:s);o.push(a.get(d,"0._id","")),e({type:"add_duplicate_blocks",payload:d})}),n(o),e({type:"create_snapshot"})},[t,n,e])},zs=p.atom([]),Hs=()=>{const[e,t]=p.useAtom(zs),n=x.useCallback(r=>{t(s=>a.includes(s,r)?a.without(s,r):[...s,r])},[t]);return[e,t,n]},Ks=p.atom(""),Zn=()=>p.useAtom(Ks),Ws=()=>{const e=p.useAtomValue(Z),t=ee(),n=_t(),[,,r]=ht();return x.useCallback(async(s,o)=>{const i=K.generateUUID(16),c=a.map(e,d=>(d._id===s&&(d._globalBlockId=i,d._name=o),d));t({type:"set_page_blocks",payload:c}),r()},[e,t,n,r])},Ys=()=>({}),Gs=()=>{const e=p.useAtomValue(Z),t=ee();return x.useCallback((n,r)=>{const s=a.map(e,o=>(a.includes(n,a.get(o,"_id"))&&a.set(o,"_parent",r),o));t({type:"set_blocks",payload:s})},[e,t])},er=()=>{const e=p.useAtomValue(Pt),[t,n]=It(),r=jt(),s=Gs();return{canPaste:x.useMemo(()=>t.length>0||e.length>0,[e,t]),pasteBlocks:x.useCallback(i=>{a.isEmpty(e)?s(t,i):r(e,i),n(()=>[])},[t,e,r,s,n])}},Js=p.atom(""),Xs=()=>{const e=p.useAtomValue(Js),t=x.useCallback(()=>{},[]),n=x.useCallback(()=>{},[]),r=x.useCallback(()=>{},[]);return{currentProject:e,createProject:r,deleteProject:t,updateProject:n}},tr=(e,t)=>{const n=[],r=a.filter(e,s=>a.includes(t,s._id)||a.includes(t,s._parent)?(n.push(s._id),!1):!0);return a.isEmpty(n)?r:tr(r,n)},nr=()=>{const e=ee(),t=p.useAtomValue(Z),[n,r]=de();return x.useCallback(s=>{var c;const o=((c=a.find(t,{_id:s[0]}))==null?void 0:c._parent)||null,i=tr(t,s);e({type:"set_blocks",payload:i}),r(o?[o]:[])},[t,r,e,n])},Qs=p.atom(null,(e,t,{blockIds:n,fullClasses:r,dispatch:s})=>{const o=a.first(e($e)),i=a.filter(e(gt),c=>n.includes(e(c)._id));a.each(i,c=>{const d=e(c),l=r;let{classes:m,baseClasses:g}=Hr(a.get(d,o.prop,"styles:,"));a.each(l,v=>{const h=new RegExp(`(^| )${v.replace("[","\\[").replace("]","\\]")}($| )`,"g");m=m.replace(h," ").replace(/ +/g," ").trim();const E=a.first(v.split(":"));a.includes(["2xl","xl","lg","md","sm"],E)&&l.push(v.split(":").pop().trim())}),a.each(l,v=>{const h=new RegExp(`(^| )${v.replace("[","\\[").replace("]","\\]")}($| )`,"g");g=g.replace(h," ").replace(/ +/g," ").trim()}),s({type:"update_props_realtime",payload:{ids:[d._id],props:{[o.prop]:`${Q.STYLES_KEY}${g},${m}`}}})})}),Zs=()=>{const e=ee(),t=p.useSetAtom(Qs);return x.useCallback((n,r)=>{t({blockIds:n,fullClasses:r,dispatch:e}),setTimeout(()=>e({type:"create_snapshot"}))},[e,t])},rr=p.atom(e=>{const t=a.first(e($e)),n=e(bt);if(!t||t.blockId!==a.get(n,"_id",null))return[];const s=a.get(n,t.prop,`${Q.STYLES_KEY},`).replace(Q.STYLES_KEY,"").split(",").join(" ");return a.filter(a.map(s.trim().split(" "),K.constructClassObject),o=>!a.isNull(o))}),eo=()=>p.useAtomValue(rr),Ht={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},to=p.atom(e=>{const t=e(Gn),n=e(kt),r=e(Qn),s=no(t);let o=a.filter(e(rr),{mod:n});return a.startsWith(n,"_")||(o=a.filter(o,i=>s.includes(i.mq))),o=o.sort((i,c)=>Ht[i.mq]-Ht[c.mq]),r||(o=a.filter(o,{dark:!1})),o}),no=e=>{let t=[];switch(e){case"xs":t=["xs"];break;case"sm":t=["xs","sm"];break;case"md":t=["xs","sm","md"];break;case"lg":t=["xs","sm","md","lg"];break;case"xl":t=["xs","sm","md","lg","xl"];break;case"2xl":t=["xs","sm","md","lg","xl","2xl"];break;default:t=["xs"];break}return t},ro=()=>p.useAtomValue(to),so=()=>p.useAtom(kt),sr=p.atom(null,(e,t,{blockIds:n,props:r,dispatch:s})=>{s({type:"update_props_realtime",payload:{ids:n,props:r}})}),oo=()=>{const{createSnapshot:e}=Re(),t=ee(),n=p.useSetAtom(sr);return x.useCallback((r,s)=>{n({blockIds:r,props:s,dispatch:t}),e()},[e,t,n])},io=()=>{const e=ee(),t=p.useSetAtom(sr);return x.useCallback((n,r)=>{t({blockIds:n,props:r,dispatch:e})},[e,t])},or={name:"",props:{},modalProps:{},backdropClose:!0},ao=p.atom(or),co=()=>{const[e,t]=p.useAtom(ao),n=x.useCallback((s,o={},i={})=>{t({name:s,props:o,modalProps:i})},[t]),r=x.useCallback((...s)=>{a.get(e,"props.onClose",()=>{})(...s),t(or)},[t,e]);return{activeModal:e,openModal:n,closeModal:r}},lo=()=>p.useAtomValue($n),uo=p.atom(""),po=p.atom(null),fo=()=>p.useAtom(uo),mo=()=>p.useAtom(po),go=ye("selectedBreakpoints",["XS","MD","XL"]),ho=()=>{const[e,t]=p.useAtom(go);return[e,t]},ir=()=>{const e=p.useSetAtom(Qe),{clear:t}=Re(),[,n]=de(),[,r]=Zn(),[,s]=xt();return()=>{n([]),s([]),r(""),t(),e({undoCount:0,redoCount:0})}},yo=p.atom({en:{}}),vo=()=>{const[e,t]=p.useAtom(yo),n=x.useCallback((r,s,o)=>{a.set(e,`${r}.${s}`,o),t(e)},[e,t]);return[e,n]},bo=(e,t)=>{const[n]=p.useAtom(te.chaiBuilderPropsAtom);return a.get(n,e,t)},ko=p.atom([]),xo=()=>{const[e,t]=x.useState(!1),[n,r]=p.useAtom(ko),s=te.useBuilderProp("getUILibraryBlocks",()=>[]);return x.useEffect(()=>{(async()=>n.length>0||(t(!0),r(await s()),t(!1)))()},[]),{data:n,isLoading:e}},Ao=p.atom("en"),So=p.atom("en"),wo=p.atom(["en"]),ar=()=>p.useAtom(Ao),Bo=()=>p.useAtom(So),_o=()=>p.useAtom(wo),Eo=(e,t)=>{const[n]=ar(),r=`${e}${n?`-${n}`:""}`;return{content:a.get(t,r,a.get(t,e,"")),propKey:e}},Io=()=>{const[e,t]=At(),n=te.useBuilderProp("previewComponent");return N.jsxRuntimeExports.jsxs("div",{className:Nr.cn("fixed inset-0 z-[999] bg-background",e?"block":"hidden"),children:[N.jsxRuntimeExports.jsx(te.Button,{size:"sm",className:"absolute right-0 top-0 m-4",onClick:()=>t(!1),children:"Close Preview"}),N.jsxRuntimeExports.jsx("div",{children:n?N.jsxRuntimeExports.jsx(x.Suspense,{fallback:N.jsxRuntimeExports.jsx(te.Skeleton,{className:"h-96 w-full"}),children:x.createElement(n)}):null})]})},Po=()=>{const[e,t]=de(),[,n]=Xn(),r=nr(),s=jt(),[,o]=It(),{pasteBlocks:i}=er(),{undo:c,redo:d}=Re();ie.useHotkeys("esc",()=>t([]),{},[t]),ie.useHotkeys("ctrl+c,command+c",()=>n(e),{},[e,n]),ie.useHotkeys("ctrl+d,command+d",()=>s(e),{preventDefault:!0},[e,s]),ie.useHotkeys("ctrl+x,command+x",()=>o(e),{},[e,o]),ie.useHotkeys("ctrl+v,command+v",()=>e.length===1?i(e[0]):null,{},[e,i]),ie.useHotkeys("ctrl+z,command+z",()=>c(),{},[c]),ie.useHotkeys("ctrl+y,command+y",()=>d(),{},[d]),ie.useHotkeys("del, backspace",l=>{l.preventDefault(),r(e)},{},[e,r])},jo=(e,t)=>{const n=[];let r=a.find(e,{_id:t}),s=a.get(r,"_parent","");for(;a.isString(s)&&!a.isEmpty(s);)n.push(r==null?void 0:r._parent),r=a.find(e,{_id:s}),s=r==null?void 0:r._parent;return a.flatten(n)},cr=p.atom([]),Co=()=>{const[e]=de(),t=p.useAtomValue(Z),[,n]=p.useAtom(cr);x.useEffect(()=>{let r=[];const s=a.first(e);a.isString(s)&&(r=[s,...jo(t,s)]),n(r)},[e,t,n])},Oo=()=>p.useAtomValue(cr),Lo=x.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-af222189.cjs"))),No=x.lazy(()=>Promise.resolve().then(()=>require("./Topbar-e92351cc.cjs"))),To=x.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-c4554d61.cjs"))),Do=x.lazy(()=>Promise.resolve().then(()=>require("./Settings-05b9b5fe.cjs"))),Mo=()=>{const e=t=>{t.preventDefault()};return Po(),Co(),N.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-background text-foreground",children:N.jsxRuntimeExports.jsxs(te.TooltipProvider,{children:[N.jsxRuntimeExports.jsxs("div",{onContextMenu:e,className:"flex h-screen flex-col overflow-hidden bg-background text-foreground",children:[N.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:N.jsxRuntimeExports.jsx(x.Suspense,{children:N.jsxRuntimeExports.jsx(No,{})})}),N.jsxRuntimeExports.jsxs("main",{className:"flex h-full flex-row",children:[N.jsxRuntimeExports.jsx("div",{className:"flex h-full w-fit border-border",children:N.jsxRuntimeExports.jsx(x.Suspense,{children:N.jsxRuntimeExports.jsx(Lo,{})})}),N.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:N.jsxRuntimeExports.jsx(x.Suspense,{children:N.jsxRuntimeExports.jsx(To,{})})}),N.jsxRuntimeExports.jsx("div",{className:"flex h-full w-[280px] min-w-[280px] border-l border-border",children:N.jsxRuntimeExports.jsx(x.Suspense,{children:N.jsxRuntimeExports.jsx(Do,{})})})]})]}),N.jsxRuntimeExports.jsx(Io,{})]})})},$o=p.getDefaultStore();p.atom({});function Kt(e,t,n,r,s){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:s;return e===s?n:e}var Ve="undefined",Wt="object",lr="any",ur="*",me="__",Ge=typeof process<"u"?process:{};Ge.env&&Ge.env.NODE_ENV;var ne=typeof document<"u";Ge.versions!=null&&Ge.versions.node!=null;typeof Deno<"u"&&Deno.core;ne&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent!==void 0&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function dr(e,t){return t.charAt(0)[e]()+t.slice(1)}var Ro=dr.bind(null,"toUpperCase"),qo=dr.bind(null,"toLowerCase");function Uo(e){return pr(e)?Ro("null"):typeof e=="object"?Ko(e):Object.prototype.toString.call(e).slice(8,-1)}function Je(e,t){t===void 0&&(t=!0);var n=Uo(e);return t?qo(n):n}function qe(e,t){return typeof t===e}var se=qe.bind(null,"function"),ke=qe.bind(null,"string"),ve=qe.bind(null,"undefined"),Vo=qe.bind(null,"boolean");qe.bind(null,"symbol");function pr(e){return e===null}function Fo(e){return Je(e)==="number"&&!isNaN(e)}function zo(e){return Je(e)==="array"}function X(e){if(!Ho(e))return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ho(e){return e&&(typeof e=="object"||e!==null)}function Ko(e){return se(e.constructor)?e.constructor.name:null}function Wo(e){return e instanceof Error||ke(e.message)&&e.constructor&&Fo(e.constructor.stackTraceLimit)}function fr(e,t){if(typeof t!="object"||pr(t))return!1;if(t instanceof e)return!0;var n=Je(new e(""));if(Wo(t))for(;t;){if(Je(t)===n)return!0;t=Object.getPrototypeOf(t)}return!1}fr.bind(null,TypeError);fr.bind(null,SyntaxError);function Ze(e,t){var n=e instanceof Element||e instanceof HTMLDocument;return n&&t?Yo(e,t):n}function Yo(e,t){return t===void 0&&(t=""),e&&e.nodeName===t.toUpperCase()}function et(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}et(Ze,"form");et(Ze,"button");et(Ze,"input");et(Ze,"select");function Yt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Go(){if(ne){var e=navigator,t=e.languages;return e.userLanguage||(t&&t.length?t[0]:e.language)}}function Jo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function Xo(e){return function(t){for(var n,r=Object.create(null),s=/([^&=]+)=?([^&]*)/g;n=s.exec(t);){var o=Yt(n[1]),i=Yt(n[2]);o.substring(o.length-2)==="[]"?(r[o=o.substring(0,o.length-2)]||(r[o]=[])).push(i):r[o]=i===""||i}for(var c in r){var d=c.split("[");d.length>1&&(Qo(r,d.map(function(l){return l.replace(/[?[\]\\ ]/g,"")}),r[c]),delete r[c])}return r}(function(t){if(t){var n=t.match(/\?(.*)/);return n&&n[1]?n[1].split("#")[0]:""}return ne&&window.location.search.substring(1)}(e))}function Qo(e,t,n){for(var r=t.length-1,s=0;s<r;++s){var o=t[s];if(o==="__proto__"||o==="constructor")break;o in e||(e[o]={}),e=e[o]}e[t[r]]=n}function tt(){for(var e="",t=0,n=4294967295*Math.random()|0;t++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],s=15&n;e+=r=="-"||r=="4"?r:(r=="x"?s:3&s|8).toString(16),n=t%8==0?4294967295*Math.random()|0:n>>4}return e}var Le="global",we=me+"global"+me,Be=typeof self===Wt&&self.self===self&&self||typeof global===Wt&&global.global===global&&global||void 0;function ge(e){return Be[we][e]}function he(e,t){return Be[we][e]=t}function Ee(e){delete Be[we][e]}function Ie(e,t,n){var r;try{if(Ct(e)){var s=window[e];r=s[t].bind(s)}}catch{}return r||n}Be[we]||(Be[we]={});var Fe={};function Ct(e){if(typeof Fe[e]!==Ve)return Fe[e];try{var t=window[e];t.setItem(Ve,Ve),t.removeItem(Ve)}catch{return Fe[e]=!1}return Fe[e]=!0}function S(){return S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},S.apply(this,arguments)}var le="function",oe="undefined",Zo="@@redux/"+Math.random().toString(36),Gt=function(){return typeof Symbol===le&&Symbol.observable||"@@observable"}(),ze=" != "+le;function mr(e,t,n){var r;if(typeof t===le&&typeof n===oe&&(n=t,t=void 0),typeof n!==oe){if(typeof n!==le)throw new Error("enhancer"+ze);return n(mr)(e,t)}if(typeof e!==le)throw new Error("reducer"+ze);var s=e,o=t,i=[],c=i,d=!1;function l(){c===i&&(c=i.slice())}function m(){return o}function g(h){if(typeof h!==le)throw new Error("Listener"+ze);var E=!0;return l(),c.push(h),function(){if(E){E=!1,l();var B=c.indexOf(h);c.splice(B,1)}}}function v(h){if(!X(h))throw new Error("Act != obj");if(typeof h.type===oe)throw new Error("ActType "+oe);if(d)throw new Error("Dispatch in reducer");try{d=!0,o=s(o,h)}finally{d=!1}for(var E=i=c,B=0;B<E.length;B++)(0,E[B])();return h}return v({type:"@@redux/INIT"}),(r={dispatch:v,subscribe:g,getState:m,replaceReducer:function(h){if(typeof h!==le)throw new Error("next reducer"+ze);s=h,v({type:"@@redux/INIT"})}})[Gt]=function(){var h,E=g;return(h={subscribe:function(B){if(typeof B!="object")throw new TypeError("Observer != obj");function w(){B.next&&B.next(m())}return w(),{unsubscribe:E(w)}}})[Gt]=function(){return this},h},r}function ei(e,t){var n=t&&t.type;return"action "+(n&&n.toString()||"?")+"reducer "+e+" returns "+oe}function _e(){var e=[].slice.call(arguments);return e.length===0?function(t){return t}:e.length===1?e[0]:e.reduce(function(t,n){return function(){return t(n.apply(void 0,[].slice.call(arguments)))}})}function ti(){var e=arguments;return function(t){return function(n,r,s){var o,i=t(n,r,s),c=i.dispatch,d={getState:i.getState,dispatch:function(l){return c(l)}};return o=[].slice.call(e).map(function(l){return l(d)}),S({},i,{dispatch:c=_e.apply(void 0,o)(i.dispatch)})}}}var ue=me+"anon_id",fe=me+"user_id",xe=me+"user_traits",ae="userId",be="anonymousId",Ye=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],ft=["name","EVENTS","config","loaded"],A=Ye.reduce(function(e,t){return e[t]=t,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),Jt=/^utm_/,Xt=/^an_prop_/,Qt=/^an_trait_/;function ni(e){var t=e.storage.setItem;return function(n){return function(r){return function(s){if(s.type===A.bootstrap){var o=s.params,i=s.user,c=s.persistedUser,d=s.initialUser,l=c.userId===i.userId;c.anonymousId!==i.anonymousId&&t(ue,i.anonymousId),l||t(fe,i.userId),d.traits&&t(xe,S({},l&&c.traits?c.traits:{},d.traits));var m=Object.keys(s.params);if(m.length){var g=o.an_uid,v=o.an_event,h=m.reduce(function(E,B){if(B.match(Jt)||B.match(/^(d|g)clid/)){var w=B.replace(Jt,"");E.campaign[w==="campaign"?"name":w]=o[B]}return B.match(Xt)&&(E.props[B.replace(Xt,"")]=o[B]),B.match(Qt)&&(E.traits[B.replace(Qt,"")]=o[B]),E},{campaign:{},props:{},traits:{}});n.dispatch(S({type:A.params,raw:o},h,g?{userId:g}:{})),g&&setTimeout(function(){return e.identify(g,h.traits)},0),v&&setTimeout(function(){return e.track(v,h.props)},0),Object.keys(h.campaign).length&&n.dispatch({type:A.campaign,campaign:h.campaign})}}return r(s)}}}}function ri(e){return function(t,n){if(t===void 0&&(t={}),n===void 0&&(n={}),n.type===A.setItemEnd){if(n.key===ue)return S({},t,{anonymousId:n.value});if(n.key===fe)return S({},t,{userId:n.value})}switch(n.type){case A.identify:return Object.assign({},t,{userId:n.userId,traits:S({},t.traits,n.traits)});case A.reset:return[fe,ue,xe].forEach(function(r){e.removeItem(r)}),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}}function Zt(e){return{userId:e.getItem(fe),anonymousId:e.getItem(ue),traits:e.getItem(xe)}}var mt=function(e){return me+"TEMP"+me+e};function si(e){var t=e.storage,n=t.setItem,r=t.removeItem,s=t.getItem;return function(o){return function(i){return function(c){var d=c.userId,l=c.traits,m=c.options;if(c.type===A.reset&&([fe,xe,ue].forEach(function(h){r(h)}),[ae,be,"traits"].forEach(function(h){Ee(mt(h))})),c.type===A.identify){s(ue)||n(ue,tt());var g=s(fe),v=s(xe)||{};g&&g!==d&&o.dispatch({type:A.userIdChanged,old:{userId:g,traits:v},new:{userId:d,traits:l},options:m}),d&&n(fe,d),l&&n(xe,S({},v,l))}return i(c)}}}}var Ce={};function en(e,t){Ce[e]&&se(Ce[e])&&(Ce[e](t),delete Ce[e])}function gr(e,t,n){return new Promise(function(r,s){return t()?r(e):n<1?s(S({},e,{queue:!0})):new Promise(function(o){return setTimeout(o,10)}).then(function(o){return gr(e,t,n-10).then(r,s)})})}function hr(e,t,n){var r=t(),s=e.getState(),o=s.plugins,i=s.queue,c=s.user;if(!s.context.offline&&i&&i.actions&&i.actions.length){var d=i.actions.reduce(function(m,g,v){return o[g.plugin].loaded?(m.process.push(g),m.processIndex.push(v)):(m.requeue.push(g),m.requeueIndex.push(v)),m},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(d.processIndex&&d.processIndex.length){d.processIndex.forEach(function(m){var g=i.actions[m],v=g.plugin,h=g.payload.type,E=r[v][h];if(E&&se(E)){var B=function(C,P){return C===void 0&&(C={}),P===void 0&&(P={}),[ae,be].reduce(function(L,y){return C.hasOwnProperty(y)&&P[y]&&P[y]!==C[y]&&(L[y]=P[y]),L},C)}(g.payload,c);E({payload:B,config:o[v].config,instance:n});var w=h+":"+v;e.dispatch(S({},B,{type:w,_:{called:w,from:"queueDrain"}}))}});var l=i.actions.filter(function(m,g){return!~d.processIndex.indexOf(g)});i.actions=l}}}var ot=function(e){var t=e.data,n=e.action,r=e.instance,s=e.state,o=e.allPlugins,i=e.allMatches,c=e.store,d=e.EVENTS;try{var l=s.plugins,m=s.context,g=n.type,v=g.match(Ae),h=t.exact.map(function(w){return w.pluginName});v&&(h=i.during.map(function(w){return w.pluginName}));var E=function(w,C){return function(P,L,y){var b=L.config,T=L.name,$=T+"."+P.type;y&&($=y.event);var O=P.type.match(Ae)?function(U,q,G,V,J){return function(z,_){var W=V?V.name:U,Y=_&&Me(_)?_:G;if(V&&(!(Y=_&&Me(_)?_:[U]).includes(U)||Y.length!==1))throw new Error("Method "+q+" can only abort "+U+" plugin. "+JSON.stringify(Y)+" input valid");return S({},J,{abort:{reason:z,plugins:Y,caller:q,_:W}})}}(T,$,C,y,P):function(U,q){return function(){throw new Error(U.type+" action not cancellable. Remove abort in "+q)}}(P,$);return{payload:oi(P),instance:w,config:b||{},abort:O}}}(r,h),B=t.exact.reduce(function(w,C){var P=C.pluginName,L=C.methodName,y=!1;return L.match(/^initialize/)||L.match(/^reset/)||(y=!l[P].loaded),m.offline&&L.match(/^(page|track|identify)/)&&(y=!0),w[""+P]=y,w},{});return Promise.resolve(t.exact.reduce(function(w,C,P){try{var L=C.pluginName;return Promise.resolve(w).then(function(y){function b(){return Promise.resolve(y)}var T=function(){if(t.namespaced&&t.namespaced[L])return Promise.resolve(t.namespaced[L].reduce(function($,O,U){try{return Promise.resolve($).then(function(q){return O.method&&se(O.method)?(function(z,_){var W=cn(z);if(W&&W.name===_){var Y=cn(W.method);throw new Error([_+" plugin is calling method "+z,"Plugins cant call self","Use "+W.method+" "+(Y?"or "+Y.method:"")+" in "+_+" plugin insteadof "+z].join(`
2
+ `))}}(O.methodName,O.pluginName),Promise.resolve(O.method({payload:q,instance:r,abort:(G=q,V=L,J=O.pluginName,function(z,_){return S({},G,{abort:{reason:z,plugins:_||[V],caller:g,from:J||V}})}),config:rn(O.pluginName,l,o),plugins:l})).then(function(z){var _=X(z)?z:{};return Promise.resolve(S({},q,_))})):q;var G,V,J})}catch(q){return Promise.reject(q)}},Promise.resolve(n))).then(function($){y[L]=$});y[L]=n}();return T&&T.then?T.then(b):b()})}catch(y){return Promise.reject(y)}},Promise.resolve({}))).then(function(w){return Promise.resolve(t.exact.reduce(function(C,P,L){try{var y=t.exact.length===L+1,b=P.pluginName,T=o[b];return Promise.resolve(C).then(function($){var O=w[b]?w[b]:{};if(v&&(O=$),at(O,b))return it({data:O,method:g,instance:r,pluginName:b,store:c}),Promise.resolve($);if(at($,b))return y&&it({data:$,method:g,instance:r,store:c}),Promise.resolve($);if(B.hasOwnProperty(b)&&B[b]===!0)return c.dispatch({type:"queue",plugin:b,payload:O,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve($);var U=E(w[b],o[b]);return Promise.resolve(T[g]({abort:U.abort,payload:O,instance:r,config:rn(b,l,o),plugins:l})).then(function(q){var G=X(q)?q:{},V=S({},$,G),J=w[b];if(at(J,b))it({data:J,method:g,instance:r,pluginName:b,store:c});else{var z=g+":"+b;(z.match(/:/g)||[]).length<2&&!g.match(tn)&&!g.match(nn)&&r.dispatch(S({},v?V:O,{type:z,_:{called:z,from:"submethod"}}))}return Promise.resolve(V)})})}catch($){return Promise.reject($)}},Promise.resolve(n))).then(function(C){if(!(g.match(Ae)||g.match(/^registerPlugin/)||g.match(nn)||g.match(tn)||g.match(/^params/)||g.match(/^userIdChanged/))){if(d.plugins.includes(g),C._&&C._.originalAction===g)return C;var P=S({},C,{_:{originalAction:C.type,called:C.type,from:"engineEnd"}});yr(C,t.exact.length)&&!g.match(/End$/)&&(P=S({},P,{type:C.type+"Aborted"})),c.dispatch(P)}return C})})}catch(w){return Promise.reject(w)}},Ae=/Start$/,tn=/^bootstrap/,nn=/^ready/;function it(e){var t=e.pluginName,n=e.method+"Aborted"+(t?":"+t:"");e.store.dispatch(S({},e.data,{type:n,_:{called:n,from:"abort"}}))}function rn(e,t,n){var r=t[e]||n[e];return r&&r.config?r.config:{}}function sn(e,t){return t.reduce(function(n,r){return r[e]?n.concat({methodName:e,pluginName:r.name,method:r[e]}):n},[])}function on(e,t){var n=e.replace(Ae,""),r=t?":"+t:"";return[""+e+r,""+n+r,n+"End"+r]}function at(e,t){var n=e.abort;return!!n&&(n===!0||an(n,t)||n&&an(n.plugins,t))}function yr(e,t){var n=e.abort;if(!n)return!1;if(n===!0||ke(n))return!0;var r=n.plugins;return Me(n)&&n.length===t||Me(r)&&r.length===t}function Me(e){return Array.isArray(e)}function an(e,t){return!(!e||!Me(e))&&e.includes(t)}function cn(e){var t=e.match(/(.*):(.*)/);return!!t&&{method:t[1],name:t[2]}}function oi(e){return Object.keys(e).reduce(function(t,n){return n==="type"||(t[n]=X(e[n])?Object.assign({},e[n]):e[n]),t},{})}function ii(e,t,n){var r={};return function(s){return function(o){return function(i){try{var c,d=function(y){return c?y:o(g)},l=i.type,m=i.plugins,g=i;if(i.abort)return Promise.resolve(o(i));if(l===A.enablePlugin&&s.dispatch({type:A.initializeStart,plugins:m,disabled:[],fromEnable:!0,meta:i.meta}),l===A.disablePlugin&&setTimeout(function(){return en(i.meta.rid,{payload:i})},0),l===A.initializeEnd){var v=t(),h=Object.keys(v),E=h.filter(function(y){return m.includes(y)}).map(function(y){return v[y]}),B=[],w=[],C=i.disabled,P=E.map(function(y){var b=y.loaded,T=y.name,$=y.config;return gr(y,function(){return b({config:$})},1e4).then(function(O){return r[T]||(s.dispatch({type:A.pluginReadyType(T),name:T,events:Object.keys(y).filter(function(U){return!ft.includes(U)})}),r[T]=!0),B=B.concat(T),y}).catch(function(O){if(O instanceof Error)throw new Error(O);return w=w.concat(O.name),O})});Promise.all(P).then(function(y){var b={plugins:B,failed:w,disabled:C};setTimeout(function(){h.length===P.length+C.length&&s.dispatch(S({},{type:A.ready},b))},0)})}var L=function(){if(l!==A.bootstrap)return/^ready:([^:]*)$/.test(l)&&setTimeout(function(){return hr(s,t,e)},0),Promise.resolve(function(y,b,T,$,O){try{var U=se(b)?b():b,q=y.type,G=q.replace(Ae,"");if(y._&&y._.called)return Promise.resolve(y);var V=T.getState(),J=(W=U,(Y=V.plugins)===void 0&&(Y={}),(Pe=y.options)===void 0&&(Pe={}),Object.keys(W).filter(function(u){var f=Pe.plugins||{};return Vo(f[u])?f[u]:f.all!==!1&&(!Y[u]||Y[u].enabled!==!1)}).map(function(u){return W[u]}));q===A.initializeStart&&y.fromEnable&&(J=Object.keys(V.plugins).filter(function(u){var f=V.plugins[u];return y.plugins.includes(u)&&!f.initialized}).map(function(u){return U[u]}));var z=J.map(function(u){return u.name}),_=function(u,f,k){var I=on(u).map(function(j){return sn(j,f)});return f.reduce(function(j,D){var H=D.name,R=on(u,H).map(function(je){return sn(je,f)}),F=R[0],M=R[1],re=R[2];return F.length&&(j.beforeNS[H]=F),M.length&&(j.duringNS[H]=M),re.length&&(j.afterNS[H]=re),j},{before:I[0],beforeNS:{},during:I[1],duringNS:{},after:I[2],afterNS:{}})}(q,J);return Promise.resolve(ot({action:y,data:{exact:_.before,namespaced:_.beforeNS},state:V,allPlugins:U,allMatches:_,instance:T,store:$,EVENTS:O})).then(function(u){function f(){var j=function(){if(q.match(Ae))return Promise.resolve(ot({action:S({},k,{type:G+"End"}),data:{exact:_.after,namespaced:_.afterNS},state:V,allPlugins:U,allMatches:_,instance:T,store:$,EVENTS:O})).then(function(D){D.meta&&D.meta.hasCallback&&en(D.meta.rid,{payload:D})})}();return j&&j.then?j.then(function(){return u}):u}if(yr(u,z.length))return u;var k,I=function(){if(q!==G)return Promise.resolve(ot({action:S({},u,{type:G}),data:{exact:_.during,namespaced:_.duringNS},state:V,allPlugins:U,allMatches:_,instance:T,store:$,EVENTS:O})).then(function(j){k=j});k=u}();return I&&I.then?I.then(f):f()})}catch(u){return Promise.reject(u)}var W,Y,Pe}(i,t,e,s,n)).then(function(y){return c=1,o(y)})}();return Promise.resolve(L&&L.then?L.then(d):d(L))}catch(y){return Promise.reject(y)}}}}}function ai(e){return function(t){return function(n){return function(r){var s=r.type,o=r.key,i=r.value,c=r.options;if(s===A.setItem||s===A.removeItem){if(r.abort)return n(r);s===A.setItem?e.setItem(o,i,c):e.removeItem(o,c)}return n(r)}}}}var ci=function(){var e=this;this.before=[],this.after=[],this.addMiddleware=function(t,n){e[n]=e[n].concat(t)},this.removeMiddleware=function(t,n){var r=e[n].findIndex(function(s){return s===t});r!==-1&&(e[n]=[].concat(e[n].slice(0,r),e[n].slice(r+1)))},this.dynamicMiddlewares=function(t){return function(n){return function(r){return function(s){var o={getState:n.getState,dispatch:function(c){return n.dispatch(c)}},i=e[t].map(function(c){return c(o)});return _e.apply(void 0,i)(r)(s)}}}}};function li(e){return function(t,n){t===void 0&&(t={});var r={};if(n.type==="initialize:aborted")return t;if(/^registerPlugin:([^:]*)$/.test(n.type)){var s=ln(n.type,"registerPlugin"),o=e()[s];if(!o||!s)return t;var i=n.enabled,c=o.config;return r[s]={enabled:i,initialized:!!i&&!o.initialize,loaded:!!i&&!!o.loaded({config:c}),config:c},S({},t,r)}if(/^initialize:([^:]*)$/.test(n.type)){var d=ln(n.type,A.initialize),l=e()[d];return l&&d?(r[d]=S({},t[d],{initialized:!0,loaded:!!l.loaded({config:l.config})}),S({},t,r)):t}if(/^ready:([^:]*)$/.test(n.type))return r[n.name]=S({},t[n.name],{loaded:!0}),S({},t,r);switch(n.type){case A.disablePlugin:return S({},t,un(n.plugins,!1,t));case A.enablePlugin:return S({},t,un(n.plugins,!0,t));default:return t}}}function ln(e,t){return e.substring(t.length+1,e.length)}function un(e,t,n){return e.reduce(function(r,s){return r[s]=S({},n[s],{enabled:t}),r},n)}function vr(e){try{return JSON.parse(JSON.stringify(e))}catch{}return e}var ui={last:{},history:[]};function di(e,t){e===void 0&&(e=ui);var n=t.options,r=t.meta;if(t.type===A.track){var s=vr(S({event:t.event,properties:t.properties},Object.keys(n).length&&{options:n},{meta:r}));return S({},e,{last:s,history:e.history.concat(s)})}return e}var pi={actions:[]};function fi(e,t){e===void 0&&(e=pi);var n=t.payload;switch(t.type){case"queue":var r;return r=n&&n.type&&n.type===A.identify?[t].concat(e.actions):e.actions.concat(t),S({},e,{actions:r});case"dequeue":return[];default:return e}}var br=/#.*$/;function mi(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(t&&t[3]?t[3].split("?")[0].replace(br,""):"")}var kr,xr,Ar,Sr,gi=function(e){if(e===void 0&&(e={}),!ne)return e;var t=document,n=t.title,r=t.referrer,s=window,o=s.location,i=s.innerWidth,c=s.innerHeight,d=o.hash,l=o.search,m=function(v){var h=function(){if(ne){for(var E,B=document.getElementsByTagName("link"),w=0;E=B[w];w++)if(E.getAttribute("rel")==="canonical")return E.getAttribute("href")}}();return h?h.match(/\?/)?h:h+v:window.location.href.replace(br,"")}(l),g={title:n,url:m,path:mi(m),hash:d,search:l,width:i,height:c};return r&&r!==""&&(g.referrer=r),S({},g,e)},hi={last:{},history:[]};function yi(e,t){e===void 0&&(e=hi);var n=t.options;if(t.type===A.page){var r=vr(S({properties:t.properties,meta:t.meta},Object.keys(n).length&&{options:n}));return S({},e,{last:r,history:e.history.concat(r)})}return e}kr=function(){if(!ne)return!1;var e=navigator.appVersion;return~e.indexOf("Win")?"Windows":~e.indexOf("Mac")?"MacOS":~e.indexOf("X11")?"UNIX":~e.indexOf("Linux")?"Linux":"Unknown OS"}(),xr=ne?document.referrer:null,Ar=Go(),Sr=Jo();var dn={initialized:!1,sessionId:tt(),app:null,version:null,debug:!1,offline:!!ne&&!navigator.onLine,os:{name:kr},userAgent:ne?navigator.userAgent:"node",library:{name:"analytics",version:"0.12.5"},timezone:Sr,locale:Ar,campaign:{},referrer:xr};function vi(e,t){e===void 0&&(e=dn);var n=e.initialized,r=t.campaign;switch(t.type){case A.campaign:return S({},e,{campaign:r});case A.offline:return S({},e,{offline:!0});case A.online:return S({},e,{offline:!1});default:return n?e:S({},dn,e,{initialized:!0})}}var bi=["plugins","reducers","storage"];function ki(e,t,n){if(ne){var r=window[(n?"add":"remove")+"EventListener"];e.split(" ").forEach(function(s){r(s,t)})}}function xi(e){var t=ki.bind(null,"online offline",function(n){return Promise.resolve(!navigator.onLine).then(e)});return t(!0),function(n){return t(!1)}}function wr(){return he("analytics",[]),function(e){return function(t,n,r){var s=e(t,n,r),o=s.dispatch;return Object.assign(s,{dispatch:function(i){return Be[we].analytics.push(i.action||i),o(i)}})}}}function pn(e){return function(){return _e(_e.apply(null,arguments),wr())}}function ct(e){return e?zo(e)?e:[e]:[]}function fn(e,t,n){e===void 0&&(e={});var r,s,o=tt();return t&&(Ce[o]=(r=t,s=function(i){for(var c,d=i||Array.prototype.slice.call(arguments),l=0;l<d.length;l++)if(se(d[l])){c=d[l];break}return c}(n),function(i){s&&s(i),r(i)})),S({},e,{rid:o,ts:new Date().getTime()},t?{hasCallback:!0}:{})}function Ai(e){e===void 0&&(e={});var t=e.reducers||{},n=e.initialUser||{},r=(e.plugins||[]).reduce(function(u,f){if(se(f))return u.middlewares=u.middlewares.concat(f),u;if(f.NAMESPACE&&(f.name=f.NAMESPACE),!f.name)throw new Error("https://lytics.dev/errors/1");f.config||(f.config={});var k=f.EVENTS?Object.keys(f.EVENTS).map(function(D){return f.EVENTS[D]}):[];u.pluginEnabled[f.name]=!(f.enabled===!1||f.config.enabled===!1),delete f.enabled,f.methods&&(u.methods[f.name]=Object.keys(f.methods).reduce(function(D,H){var R;return D[H]=(R=f.methods[H],function(){for(var F=Array.prototype.slice.call(arguments),M=new Array(R.length),re=0;re<F.length;re++)M[re]=F[re];return M[M.length]=b,R.apply({instance:b},M)}),D},{}),delete f.methods);var I=Object.keys(f).concat(k),j=new Set(u.events.concat(I));if(u.events=Array.from(j),u.pluginsArray=u.pluginsArray.concat(f),u.plugins[f.name])throw new Error(f.name+"AlreadyLoaded");return u.plugins[f.name]=f,u.plugins[f.name].loaded||(u.plugins[f.name].loaded=function(){return!0}),u},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),s=e.storage?e.storage:{getItem:ge,setItem:he,removeItem:Ee},o=function(u){return function(f,k,I){return k.getState("user")[f]||(I&&X(I)&&I[f]?I[f]:Zt(u)[f]||ge(mt(f))||null)}}(s),i=r.plugins,c=r.events.filter(function(u){return!ft.includes(u)}).sort(),d=new Set(c.concat(Ye).filter(function(u){return!ft.includes(u)})),l=Array.from(d).sort(),m=function(){return i},g=new ci,v=g.addMiddleware,h=g.removeMiddleware,E=g.dynamicMiddlewares,B=function(){throw new Error("Abort disabled inListener")},w=Xo(),C=Zt(s),P=S({},C,n,w.an_uid?{userId:w.an_uid}:{},w.an_aid?{anonymousId:w.an_aid}:{});P.anonymousId||(P.anonymousId=tt());var L=S({enable:function(u,f){return new Promise(function(k){_.dispatch({type:A.enablePlugin,plugins:ct(u),_:{originalAction:A.enablePlugin}},k,[f])})},disable:function(u,f){return new Promise(function(k){_.dispatch({type:A.disablePlugin,plugins:ct(u),_:{originalAction:A.disablePlugin}},k,[f])})}},r.methods),y=!1,b={identify:function(u,f,k,I){try{var j=ke(u)?u:null,D=X(u)?u:f,H=k||{},R=b.user();he(mt(ae),j);var F=j||D.userId||o(ae,b,D);return Promise.resolve(new Promise(function(M){_.dispatch(S({type:A.identifyStart,userId:F,traits:D||{},options:H,anonymousId:R.anonymousId},R.id&&R.id!==j&&{previousId:R.id}),M,[f,k,I])}))}catch(M){return Promise.reject(M)}},track:function(u,f,k,I){try{var j=X(u)?u.event:u;if(!j||!ke(j))throw new Error("EventMissing");var D=X(u)?u:f||{},H=X(k)?k:{};return Promise.resolve(new Promise(function(R){_.dispatch({type:A.trackStart,event:j,properties:D,options:H,userId:o(ae,b,f),anonymousId:o(be,b,f)},R,[f,k,I])}))}catch(R){return Promise.reject(R)}},page:function(u,f,k){try{var I=X(u)?u:{},j=X(f)?f:{};return Promise.resolve(new Promise(function(D){_.dispatch({type:A.pageStart,properties:gi(I),options:j,userId:o(ae,b,I),anonymousId:o(be,b,I)},D,[u,f,k])}))}catch(D){return Promise.reject(D)}},user:function(u){if(u===ae||u==="id")return o(ae,b);if(u===be||u==="anonId")return o(be,b);var f=b.getState("user");return u?Kt(f,u):f},reset:function(u){return new Promise(function(f){_.dispatch({type:A.resetStart},f,u)})},ready:function(u){return y&&u({plugins:L,instance:b}),b.on(A.ready,function(f){u(f),y=!0})},on:function(u,f){if(!u||!se(f))return!1;if(u===A.bootstrap)throw new Error(".on disabled for "+u);var k=/Start$|Start:/;if(u==="*"){var I=function(R){return function(F){return function(M){return M.type.match(k)&&f({payload:M,instance:b,plugins:i}),F(M)}}},j=function(R){return function(F){return function(M){return M.type.match(k)||f({payload:M,instance:b,plugins:i}),F(M)}}};return v(I,He),v(j,Ke),function(){h(I,He),h(j,Ke)}}var D=u.match(k)?He:Ke,H=function(R){return function(F){return function(M){return M.type===u&&f({payload:M,instance:b,plugins:i,abort:B}),F(M)}}};return v(H,D),function(){return h(H,D)}},once:function(u,f){if(!u||!se(f))return!1;if(u===A.bootstrap)throw new Error(".once disabled for "+u);var k=b.on(u,function(I){f({payload:I.payload,instance:b,plugins:i,abort:B}),k()});return k},getState:function(u){var f=_.getState();return u?Kt(f,u):Object.assign({},f)},dispatch:function(u){var f=ke(u)?{type:u}:u;if(Ye.includes(f.type))throw new Error("reserved action "+f.type);var k=S({},f,{_:S({originalAction:f.type},u._||{})});_.dispatch(k)},enablePlugin:L.enable,disablePlugin:L.disable,plugins:L,storage:{getItem:s.getItem,setItem:function(u,f,k){_.dispatch({type:A.setItemStart,key:u,value:f,options:k})},removeItem:function(u,f){_.dispatch({type:A.removeItemStart,key:u,options:f})}},setAnonymousId:function(u,f){b.storage.setItem(ue,u,f)},events:{core:Ye,plugins:c}},T=r.middlewares.concat([function(u){return function(f){return function(k){return k.meta||(k.meta=fn()),f(k)}}},E(He),ii(b,m,{all:l,plugins:c}),ai(s),ni(b),si(b),E(Ke)]),$={context:vi,user:ri(s),page:yi,track:di,plugins:li(m),queue:fi},O=_e,U=_e;if(ne&&e.debug){var q=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;q&&(O=q({trace:!0,traceLimit:25})),U=function(){return arguments.length===0?wr():X(typeof arguments[0])?pn():pn().apply(null,arguments)}}var G,V=function(u){return Object.keys(u).reduce(function(f,k){return bi.includes(k)||(f[k]=u[k]),f},{})}(e),J=r.pluginsArray.reduce(function(u,f){var k=f.name,I=f.config,j=f.loaded,D=r.pluginEnabled[k];return u[k]={enabled:D,initialized:!!D&&!f.initialize,loaded:!!j({config:I}),config:I},u},{}),z={context:V,user:P,plugins:J},_=mr(function(u){for(var f=Object.keys(u),k={},I=0;I<f.length;I++){var j=f[I];typeof u[j]===le&&(k[j]=u[j])}var D,H=Object.keys(k);try{(function(R){Object.keys(R).forEach(function(F){var M=R[F];if(typeof M(void 0,{type:"@@redux/INIT"})===oe||typeof M(void 0,{type:Zo})===oe)throw new Error("reducer "+F+" "+oe)})})(k)}catch(R){D=R}return function(R,F){if(R===void 0&&(R={}),D)throw D;for(var M=!1,re={},je=0;je<H.length;je++){var Ue=H[je],Mt=R[Ue],st=(0,k[Ue])(Mt,F);if(typeof st===oe){var Pr=ei(Ue,F);throw new Error(Pr)}re[Ue]=st,M=M||st!==Mt}return M?re:R}}(S({},$,t)),z,U(O(ti.apply(void 0,T))));_.dispatch=(G=_.dispatch,function(u,f,k){var I=S({},u,{meta:fn(u.meta,f,ct(k))});return G.apply(null,[I])});var W=Object.keys(i);_.dispatch({type:A.bootstrap,plugins:W,config:V,params:w,user:P,initialUser:n,persistedUser:C});var Y=W.filter(function(u){return r.pluginEnabled[u]}),Pe=W.filter(function(u){return!r.pluginEnabled[u]});return _.dispatch({type:A.registerPlugins,plugins:W,enabled:r.pluginEnabled}),r.pluginsArray.map(function(u,f){var k=u.bootstrap,I=u.config,j=u.name;k&&se(k)&&k({instance:b,config:I,payload:u}),_.dispatch({type:A.registerPluginType(j),name:j,enabled:r.pluginEnabled[j],plugin:u}),r.pluginsArray.length===f+1&&_.dispatch({type:A.initializeStart,plugins:Y,disabled:Pe})}),xi(function(u){_.dispatch({type:u?A.offline:A.online})}),function(u,f,k){setInterval(function(){return hr(u,f,k)},3e3)}(_,m,b),b}var He="before",Ke="after",Ne="cookie",pe=Er(),Br=nt,Si=nt;function _r(e){return pe?nt(e,"",-1):Ee(e)}function Er(){if(pe!==void 0)return pe;var e="cookiecookie";try{nt(e,e),pe=document.cookie.indexOf(e)!==-1,_r(e)}catch{pe=!1}return pe}function nt(e,t,n,r,s,o){if(typeof window<"u"){var i=arguments.length>1;return pe===!1&&(i?he(e,t):ge(e)),i?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(s?"; domain="+s:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var Te="localStorage",wi=Ct.bind(null,"localStorage");Ie("localStorage","getItem",ge);Ie("localStorage","setItem",he);Ie("localStorage","removeItem",Ee);var De="sessionStorage",Bi=Ct.bind(null,"sessionStorage");Ie("sessionStorage","getItem",ge);Ie("sessionStorage","setItem",he);Ie("sessionStorage","removeItem",Ee);function Se(e){var t=e;try{if((t=JSON.parse(e))==="true")return!0;if(t==="false")return!1;if(X(t))return t;parseFloat(t)===t&&(t=parseFloat(t))}catch{}if(t!==null&&t!=="")return t}var _i=wi(),Ei=Bi(),Ii=Er();function Ir(e,t){if(e){var n=Ot(t),r=!Dt(n),s=Lt(n)?Se(localStorage.getItem(e)):void 0;if(r&&!ve(s))return s;var o=Nt(n)?Se(Br(e)):void 0;if(r&&o)return o;var i=Tt(n)?Se(sessionStorage.getItem(e)):void 0;if(r&&i)return i;var c=ge(e);return r?c:{localStorage:s,sessionStorage:i,cookie:o,global:c}}}function Pi(e,t,n){if(e&&!ve(t)){var r={},s=Ot(n),o=JSON.stringify(t),i=!Dt(s);return Lt(s)&&(r[Te]=We(Te,t,Se(localStorage.getItem(e))),localStorage.setItem(e,o),i)?r[Te]:Nt(s)&&(r[Ne]=We(Ne,t,Se(Br(e))),Si(e,o),i)?r[Ne]:Tt(s)&&(r[De]=We(De,t,Se(sessionStorage.getItem(e))),sessionStorage.setItem(e,o),i)?r[De]:(r[Le]=We(Le,t,ge(e)),he(e,t),i?r[Le]:r)}}function ji(e,t){if(e){var n=Ot(t),r=Ir(e,ur),s={};return!ve(r.localStorage)&&Lt(n)&&(localStorage.removeItem(e),s[Te]=r.localStorage),!ve(r.cookie)&&Nt(n)&&(_r(e),s[Ne]=r.cookie),!ve(r.sessionStorage)&&Tt(n)&&(sessionStorage.removeItem(e),s[De]=r.sessionStorage),!ve(r.global)&&rt(n,Le)&&(Ee(e),s[Le]=r.global),s}}function Ot(e){return e?ke(e)?e:e.storage:lr}function Lt(e){return _i&&rt(e,Te)}function Nt(e){return Ii&&rt(e,Ne)}function Tt(e){return Ei&&rt(e,De)}function Dt(e){return e===ur||e==="all"}function rt(e,t){return e===lr||e===t||Dt(e)}function We(e,t,n){return{location:e,current:t,previous:n}}var Ci={setItem:Pi,getItem:Ir,removeItem:ji};function Oi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function gn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mn(Object(n),!0).forEach(function(r){Oi(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mn(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Li(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t={storage:Ci};return Ai(gn(gn({},t),e))}const Ni="@chaibuilder/sdk",Ti="0.1.2",Di="module",Mi=["dist"],$i="dist/core.js",Ri=!1,qi={".":{import:"./dist/core.js",require:"./dist/core.cjs",types:"./dist/core.d.ts"},"./render":{import:"./dist/render.js",require:"./dist/render.cjs",types:"./dist/render.d.ts"},"./ui":{import:"./dist/ui.js",require:"./dist/ui.cjs",types:"./dist/ui.d.ts"},"./lib":{import:"./dist/lib.js",require:"./dist/lib.cjs",types:"./dist/lib.d.ts"},"./styles":{import:"./dist/style.css",require:"./dist/style.css"}},Ui={dev:"vite",build:"tsc && vite build",lint:"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",preview:"vite preview",test:"jest --colors","test:watch":"jest --watch --colors","test:coverage":"jest --coverage --colors",e2e:"playwright test","e2e:report":"playwright show-report","e2e:ui":"playwright test --ui",docs:"jsdoc -c jsdoc.conf.json"},Vi={"@analytics/google-analytics":"^1.0.7","@bobthered/tailwindcss-palette-generator":"3.1.1","@chaibuilder/blocks":"^0.1.0","@floating-ui/dom":"1.4.5","@floating-ui/react-dom":"2.0.1","@mhsdesign/jit-browser-tailwindcss":"0.3.0","@minoru/react-dnd-treeview":"3.4.4","@radix-ui/react-accordion":"^1.1.2","@radix-ui/react-alert-dialog":"^1.0.4","@radix-ui/react-context-menu":"^2.1.4","@radix-ui/react-dialog":"^1.0.4","@radix-ui/react-dropdown-menu":"^2.0.5","@radix-ui/react-hover-card":"^1.0.6","@radix-ui/react-icons":"^1.3.0","@radix-ui/react-label":"^2.0.2","@radix-ui/react-menubar":"^1.0.3","@radix-ui/react-navigation-menu":"^1.1.3","@radix-ui/react-popover":"^1.0.6","@radix-ui/react-scroll-area":"^1.0.4","@radix-ui/react-select":"^1.2.2","@radix-ui/react-separator":"^1.0.3","@radix-ui/react-slot":"^1.0.2","@radix-ui/react-switch":"^1.0.3","@radix-ui/react-tabs":"^1.0.4","@radix-ui/react-toast":"^1.1.4","@radix-ui/react-toggle":"^1.0.3","@radix-ui/react-tooltip":"^1.0.6","@react-hookz/web":"23.1.0","@rjsf/core":"5.11.2","@rjsf/utils":"5.11.2","@rjsf/validator-ajv8":"5.11.2","@tailwindcss/aspect-ratio":"0.4.2","@tailwindcss/forms":"^0.5.6","@tailwindcss/line-clamp":"^0.4.4","@tailwindcss/typography":"^0.5.10",analytics:"^0.8.9","class-variance-authority":"0.6.1",clsx:"1.2.1",cmdk:"0.2.0","date-fns":"^2.30.0",flagged:"2.0.9","flat-to-nested":"1.1.1","focus-trap-react":"^10.2.1","forgiving-xml-parser":"1.4.0","framer-motion":"^10.12.18","fuse.js":"6.6.2","gray-matter":"^4.0.3",himalaya:"^1.1.0","html-formatter":"0.1.9",i18next:"^23.2.8",jotai:"2.2.2",lodash:"4.17.21","lucide-react":"^0.244.0",nanoid:"^4.0.2","post-robot":"10.0.46",react:"^18.2.0","react-autosuggest":"10.1.0","react-colorful":"5.6.1","react-dnd":"16.0.1","react-dnd-html5-backend":"16.0.1","react-dom":"^18.2.0","react-hotkeys-hook":"4.4.1","react-i18next":"13.0.1","react-icons":"^4.10.1","react-icons-picker":"^1.0.9","react-quill":"^2.0.0","react-textarea-autosize":"^8.5.2","react-wrap-balancer":"^1.0.0","redux-undo":"1.1.0","tailwind-merge":"1.13.2","tailwindcss-animate":"1.0.6","tippy.js":"^6.3.7","unist-util-visit":"^4.1.2","unsplash-js":"^7.0.18"},Fi={"@commitlint/cli":"17.7.1","@commitlint/config-conventional":"17.7.0","@playwright/test":"^1.39.0","@types/jest":"^29.5.7","@types/lodash":"^4.14.200","@types/node":"^20.8.10","@types/react":"^18.2.15","@types/react-dom":"^18.2.7","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","@vitejs/plugin-react-swc":"^3.3.2",autoprefixer:"^10.4.16","better-docs":"^2.7.2",eslint:"^8.45.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.4.3",jest:"^29.7.0","jest-environment-jsdom":"^29.7.0",jsdoc:"^4.0.2",postcss:"^8.4.31",prettier:"^3.0.3","prettier-plugin-tailwindcss":"^0.5.6","prop-types":"^15.8.1",tailwindcss:"^3.3.5","ts-jest":"^29.1.1",typescript:"^5.0.2",vite:"^4.4.5","vite-plugin-dts":"^3.6.3"},zi={name:Ni,private:!1,version:Ti,type:Di,files:Mi,main:$i,sideEffects:Ri,exports:qi,scripts:Ui,dependencies:Vi,devDependencies:Fi},hn="https://api.chaibuilder.com",yn=()=>typeof window>"u"?!1:window.location.href.includes("localhost");function Hi(){return{name:"chaibuilder-analytics",config:{},initialize:()=>{if(typeof window>"u")return!1;window.chaibuilderAnalyticsLoaded=!0},page:e=>{if(typeof window>"u")return!1;if(yn())return;const{payload:t}=e;fetch(`${hn}/v1/log`,{method:"post",body:JSON.stringify(t)}).then(n=>n.json())},track:({payload:e})=>{if(typeof window>"u")return!1;yn()||fetch(`${hn}/v1/log`,{method:"post",body:JSON.stringify(e)})},loaded:()=>typeof window>"u"?!0:!!window.chaibuilderAnalyticsLoaded}}const Ki=Li({app:"chaibuilder",version:zi.version,plugins:[Hi()]});({}).NODE_ENV==="development"&&console.log("Chai Builder:",Fr);const Wi=e=>N.jsxRuntimeExports.jsx(N.jsxRuntimeExports.Fragment,{children:e.children}),Yi=e=>{const{dndOptions:t={backend:$t.MultiBackend}}=e,[n]=_n(),[,r]=St(),s=ir();return x.useEffect(()=>{$o.set(te.chaiBuilderPropsAtom,a.omit(e,["blocks","globalBlocks","brandingOptions"]))},[e]),x.useEffect(()=>{n(bn.syncBlocksWithDefaults(e.blocks||[])),s()},[e.blocks]),x.useEffect(()=>{r(e.brandingOptions)},[e.brandingOptions]),x.useEffect(()=>{Ki.page()},[]),N.jsxRuntimeExports.jsx(Lr.DndProvider,{...t,options:$t.getBackendOptions(),children:N.jsxRuntimeExports.jsx(Wi,{children:N.jsxRuntimeExports.jsx(Mo,{})})})},Gi=e=>N.jsxRuntimeExports.jsxs(kn,{children:[N.jsxRuntimeExports.jsx(Or.FlagsProvider,{features:zr,children:N.jsxRuntimeExports.jsx(Yi,{...e})}),N.jsxRuntimeExports.jsx(te.Toaster,{})]}),Ji=e=>({...e}),Xi=e=>({...e});exports.ChaiBuilderStudio=Gi;exports.ErrorBoundary=kn;exports.activePanelAtom=zn;exports.addBlockOffCanvasAtom=Hn;exports.addBlocksModalAtom=Bn;exports.advanceStylingOpenAtom=qn;exports.canDeleteBlock=ds;exports.canDropBlock=fs;exports.canDuplicateBlock=us;exports.canvasIframeAtom=Fn;exports.editLayerNameAtom=Vn;exports.enableStyling=Xi;exports.getBlockJSONFromSchemas=dt;exports.getBlockJSONFromUISchemas=ut;exports.inlineEditingActiveAtom=Rn;exports.networkModeAtom=Un;exports.setBlockProps=Ji;exports.showPredefinedBlockCategoryAtom=Kn;exports.useActiveLanguage=ar;exports.useActiveModal=co;exports.useActivePanel=fo;exports.useAddBlock=As;exports.useAddBlockParent=mo;exports.useAddClassesToBlocks=Es;exports.useAllBlocks=On;exports.useBlockContentByLanguage=Eo;exports.useBrandingOptions=St;exports.useBuilderReset=ir;exports.useBuildingBlocks=ht;exports.useCanvasHistory=Re;exports.useCanvasWidth=$s;exports.useCanvasZoom=qs;exports.useCopyBlockIds=Xn;exports.useCurrentPage=Ln;exports.useCutBlockIds=It;exports.useDarkMode=Us;exports.useDeveloperPreviewMode=Fs;exports.useDuplicateBlocks=jt;exports.useExpandedIds=Oo;exports.useFeatureSupport=bo;exports.useGetPageData=_t;exports.useHiddenBlockIds=Hs;exports.useHighlightBlockId=Zn;exports.useLanguages=_o;exports.useMarkAsGlobalBlock=Ws;exports.useMoveBlocks=Ys;exports.usePasteBlocks=er;exports.usePreviewMode=At;exports.usePrimaryLanguage=Bo;exports.useProject=Xs;exports.useReadOnlyMode=lo;exports.useRemoveBlocks=nr;exports.useRemoveClassesFromBlocks=Zs;exports.useSavePage=Ms;exports.useSelectedBlock=bs;exports.useSelectedBlockAllClasses=eo;exports.useSelectedBlockCurrentClasses=ro;exports.useSelectedBlockIds=de;exports.useSelectedBlocksDisplayChild=vs;exports.useSelectedBreakpoints=ho;exports.useSelectedStylingBlocks=xt;exports.useSetAllBlocks=_n;exports.useStylingBreakpoint=Wn;exports.useStylingState=so;exports.useTranslations=vo;exports.useTreeData=ls;exports.useUILibraryBlocks=xo;exports.useUpdateBlocksProps=oo;exports.useUpdateBlocksPropsRealtime=io;
@@ -14,7 +14,7 @@ import Un from "flat-to-nested";
14
14
  import { g as ve, c as at, B as Pt, a as to } from "./Class-e6b07b79.js";
15
15
  import no, { excludeAction as ro, ActionCreators as xt } from "redux-undo";
16
16
  import { useThrottledCallback as oo } from "@react-hookz/web";
17
- import { useChaiBlocks as so, syncBlocksWithDefaults as io } from "chaibuilder-blocks";
17
+ import { useChaiBlocks as so, syncBlocksWithDefaults as io } from "@chaibuilder/blocks";
18
18
  import { S as _e, I as qn, a as Et } from "./CONTROLS-442caee5.js";
19
19
  const ao = "Dark mode", co = "This page has no blocks. Add a block by clicking the + button", lo = "This page is empty", uo = "Please select a block to edit settings or styles", po = "Please select a styling block", fo = "Drop your block here", mo = {
20
20
  dark_mode: ao,
@@ -1123,7 +1123,7 @@ const Oa = () => {
1123
1123
  const o = le(e);
1124
1124
  Nt(o) && (r = [o, ...qs(t, o)]), n(r);
1125
1125
  }, [e, t, n]);
1126
- }, rc = () => V(yr), zs = dt(() => import("./SidePanels-f48777bb.js")), Vs = dt(() => import("./Topbar-64729901.js")), Ws = dt(() => import("./CanvasArea-a7901131.js")), Js = dt(() => import("./Settings-b1afcefe.js")), Gs = () => {
1126
+ }, rc = () => V(yr), zs = dt(() => import("./SidePanels-67ebbcb4.js")), Vs = dt(() => import("./Topbar-fcb01371.js")), Ws = dt(() => import("./CanvasArea-a065a586.js")), Js = dt(() => import("./Settings-a19fbb69.js")), Gs = () => {
1127
1127
  const e = (t) => {
1128
1128
  t.preventDefault();
1129
1129
  };
@@ -2376,7 +2376,7 @@ function zi() {
2376
2376
  };
2377
2377
  return Ci(Cn(Cn({}, t), e));
2378
2378
  }
2379
- const Vi = "@chaibuilder/sdk", Wi = "0.1.0", Ji = "module", Gi = [
2379
+ const Vi = "@chaibuilder/sdk", Wi = "0.1.2", Ji = "module", Gi = [
2380
2380
  "dist"
2381
2381
  ], Ki = "dist/core.js", Hi = !1, Xi = {
2382
2382
  ".": {
@@ -2418,6 +2418,7 @@ const Vi = "@chaibuilder/sdk", Wi = "0.1.0", Ji = "module", Gi = [
2418
2418
  }, Qi = {
2419
2419
  "@analytics/google-analytics": "^1.0.7",
2420
2420
  "@bobthered/tailwindcss-palette-generator": "3.1.1",
2421
+ "@chaibuilder/blocks": "^0.1.0",
2421
2422
  "@floating-ui/dom": "1.4.5",
2422
2423
  "@floating-ui/react-dom": "2.0.1",
2423
2424
  "@mhsdesign/jit-browser-tailwindcss": "0.3.0",
@@ -2451,7 +2452,6 @@ const Vi = "@chaibuilder/sdk", Wi = "0.1.0", Ji = "module", Gi = [
2451
2452
  "@tailwindcss/line-clamp": "^0.4.4",
2452
2453
  "@tailwindcss/typography": "^0.5.10",
2453
2454
  analytics: "^0.8.9",
2454
- "chaibuilder-blocks": "0.1.2",
2455
2455
  "class-variance-authority": "0.6.1",
2456
2456
  clsx: "1.2.1",
2457
2457
  cmdk: "0.2.0",
@@ -2531,7 +2531,7 @@ const Vi = "@chaibuilder/sdk", Wi = "0.1.0", Ji = "module", Gi = [
2531
2531
  scripts: Yi,
2532
2532
  dependencies: Qi,
2533
2533
  devDependencies: Zi
2534
- }, Ln = "https://api.chaibuilder.com", Nn = () => window.location.href.includes("localhost");
2534
+ }, Ln = "https://api.chaibuilder.com", Nn = () => typeof window > "u" ? !1 : window.location.href.includes("localhost");
2535
2535
  function ta() {
2536
2536
  return {
2537
2537
  /* All plugins require a name */
@@ -2539,18 +2539,24 @@ function ta() {
2539
2539
  /* Everything else below this is optional depending on your plugin requirements */
2540
2540
  config: {},
2541
2541
  initialize: () => {
2542
+ if (typeof window > "u")
2543
+ return !1;
2542
2544
  window.chaibuilderAnalyticsLoaded = !0;
2543
2545
  },
2544
2546
  page: (e) => {
2547
+ if (typeof window > "u")
2548
+ return !1;
2545
2549
  if (Nn())
2546
2550
  return;
2547
2551
  const { payload: t } = e;
2548
2552
  fetch(`${Ln}/v1/log`, { method: "post", body: JSON.stringify(t) }).then((n) => n.json());
2549
2553
  },
2550
2554
  track: ({ payload: e }) => {
2555
+ if (typeof window > "u")
2556
+ return !1;
2551
2557
  Nn() || fetch(`${Ln}/v1/log`, { method: "post", body: JSON.stringify(e) });
2552
2558
  },
2553
- loaded: () => !!window.chaibuilderAnalyticsLoaded
2559
+ loaded: () => typeof window > "u" ? !0 : !!window.chaibuilderAnalyticsLoaded
2554
2560
  };
2555
2561
  }
2556
2562
  const na = zi({
package/dist/lib.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./utils-3c452dd0.cjs"),r=require("./Class-0801d193.cjs"),T=require("./html-to-json-d8ac554d.cjs"),s=require("lodash");require("clsx");require("tailwind-merge");require("himalaya");require("./CONTROLS-031e1de3.cjs");const d={25:"1/4","33.33":"1/3",50:"1/2","66.67":"2/3",75:"3/4",20:"1/5",40:"2/5",60:"3/5",80:"4/5","16.67":"1/6","83.33":"5/6","8.33":"1/12","41.67":"5/12","58.33":"7/12","91.67":"11/12",100:"full"},k={0:"0",1:"px",2:"0.5",4:"1",6:"1.5",8:"2",10:"2.5",12:"3",14:"3.5",16:"4",20:"5",24:"6",28:"7",32:"8",36:"9",40:"10",44:"11",48:"12",56:"14",64:"16",80:"20",96:"24",112:"28",128:"32",144:"36",160:"40",176:"44",192:"48",208:"52",224:"56",240:"60",256:"64",288:"72",320:"80",384:"96"},b=16,V=4;function O(n){return n.indexOf("rem")!==-1&&(n=`${parseFloat(n.replace("rem",""))*b}px`),n}const w=n=>{const p=n.match(/\[.*\]/);if(p===null)return n;const l=r.constructClassObject(n);if(l===null)return n;const{property:m}=l;let e=s.first(p).replace(/\]/i,"").replace(/\[/i,"");const c=n.replace(/\[.*\]/i,"");e=O(e);let a=n;switch(m){case"top":case"right":case"left":case"bottom":case"inset":case"insetX":case"insetY":case"gap":case"gapX":case"gapY":case"padding":case"paddingX":case"paddingY":case"paddingTop":case"paddingRight":case"paddingBottom":case"paddingLeft":case"margin":case"marginX":case"marginY":case"marginTop":case"marginRight":case"marginBottom":case"marginLeft":case"flexBasis":case"width":case"height":case"maxHeight":case"textIndent":case"spaceX":case"spaceY":if(e.indexOf("px")!==-1){const t=s.map(s.keys(k),i=>`${i}px`);if(s.includes(t,e)){const i=s.parseInt(e.replace("px",""),10);i===1?a=`${c}px`:a=c+i/V}}if(e.indexOf("%")!==-1){const t=s.map(s.keys(d),i=>`${i}%`);if(s.includes(t,e)){const i=parseFloat(e.replace("%",""));a=c+s.get(d,i)}}e.indexOf("vw")!==-1&&parseFloat(e.replace("vw",""))===100&&(a=`${c}screen`),e.indexOf("vh")!==-1&&parseFloat(e.replace("vh",""))===100&&(a=`${c}screen`);break;case"minWidth":e.indexOf("%")!==-1&&parseFloat(e.replace("%",""))===100&&(a=`${c}full`),e==="0px"&&(a="min-w-0");break;case"maxWidth":e==="0px"&&(a="max-w-0");const x={"320px":"xs","384px":"sm","448px":"md","512px":"lg","576px":"xl","672px":"2xl","768px":"3xl","896px":"4xl","1024px":"5xl","1152px":"6xl","1280px":"7xl","100%":"full","65ch":"prose","640px":"screen-sm","1536px":"screen-2xl"};s.includes(s.keys(x),e)&&(a=`max-w-${x[e]}`);break;case"minHeight":e.indexOf("%")!==-1&&parseFloat(e.replace("%",""))===100&&(a=`${c}full`),e==="0px"&&(a="min-h-0"),e==="100vh"&&(a="min-h-screen");break;case"fontSize":const o={"12px":"xs","14px":"sm","16px":"base","18px":"lg","20px":"xl","24px":"2xl","30px":"3xl","36px":"4xl","48px":"5xl","60px":"6xl","72px":"7xl","96px":"8xl","128px":"9xl"};s.includes(s.keys(o),e)&&(a=c+o[e]);break;case"lineHeight":const u={"12px":"3","16px":"4","20px":"5","24px":"6","28px":"7","32px":"8","36px":"9","40px":"10",1:"none","1.25":"tight","1.375":"snug","1.5":"normal","1.625":"relaxed",2:"loose"};s.includes(s.keys(u),e)&&(a=c+u[e]);break;case"zIndex":a=["0","10","20","30","40","50"].indexOf(e)!==-1?`${c}${e}`:n;break;case"opacity":const g=["0","5","10","20","25","30","40","50","60","70","75","80","90","95","100"],f=parseFloat(e)*100;s.includes(g,f.toString())&&(a=`opacity-${f}`);break}return a};exports.cn=h.cn;exports.generateUUID=r.generateUUID;exports.getBreakpointValue=r.getBreakpointValue;exports.getBlocksFromHTML=T.getBlocksFromHTML;exports.convertArbitraryToTailwindClass=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./utils-3c452dd0.cjs"),r=require("./Class-0801d193.cjs"),T=require("./html-to-json-7eba915f.cjs"),s=require("lodash");require("clsx");require("tailwind-merge");require("himalaya");require("./CONTROLS-031e1de3.cjs");const d={25:"1/4","33.33":"1/3",50:"1/2","66.67":"2/3",75:"3/4",20:"1/5",40:"2/5",60:"3/5",80:"4/5","16.67":"1/6","83.33":"5/6","8.33":"1/12","41.67":"5/12","58.33":"7/12","91.67":"11/12",100:"full"},k={0:"0",1:"px",2:"0.5",4:"1",6:"1.5",8:"2",10:"2.5",12:"3",14:"3.5",16:"4",20:"5",24:"6",28:"7",32:"8",36:"9",40:"10",44:"11",48:"12",56:"14",64:"16",80:"20",96:"24",112:"28",128:"32",144:"36",160:"40",176:"44",192:"48",208:"52",224:"56",240:"60",256:"64",288:"72",320:"80",384:"96"},b=16,V=4;function O(n){return n.indexOf("rem")!==-1&&(n=`${parseFloat(n.replace("rem",""))*b}px`),n}const w=n=>{const p=n.match(/\[.*\]/);if(p===null)return n;const l=r.constructClassObject(n);if(l===null)return n;const{property:m}=l;let e=s.first(p).replace(/\]/i,"").replace(/\[/i,"");const c=n.replace(/\[.*\]/i,"");e=O(e);let a=n;switch(m){case"top":case"right":case"left":case"bottom":case"inset":case"insetX":case"insetY":case"gap":case"gapX":case"gapY":case"padding":case"paddingX":case"paddingY":case"paddingTop":case"paddingRight":case"paddingBottom":case"paddingLeft":case"margin":case"marginX":case"marginY":case"marginTop":case"marginRight":case"marginBottom":case"marginLeft":case"flexBasis":case"width":case"height":case"maxHeight":case"textIndent":case"spaceX":case"spaceY":if(e.indexOf("px")!==-1){const t=s.map(s.keys(k),i=>`${i}px`);if(s.includes(t,e)){const i=s.parseInt(e.replace("px",""),10);i===1?a=`${c}px`:a=c+i/V}}if(e.indexOf("%")!==-1){const t=s.map(s.keys(d),i=>`${i}%`);if(s.includes(t,e)){const i=parseFloat(e.replace("%",""));a=c+s.get(d,i)}}e.indexOf("vw")!==-1&&parseFloat(e.replace("vw",""))===100&&(a=`${c}screen`),e.indexOf("vh")!==-1&&parseFloat(e.replace("vh",""))===100&&(a=`${c}screen`);break;case"minWidth":e.indexOf("%")!==-1&&parseFloat(e.replace("%",""))===100&&(a=`${c}full`),e==="0px"&&(a="min-w-0");break;case"maxWidth":e==="0px"&&(a="max-w-0");const x={"320px":"xs","384px":"sm","448px":"md","512px":"lg","576px":"xl","672px":"2xl","768px":"3xl","896px":"4xl","1024px":"5xl","1152px":"6xl","1280px":"7xl","100%":"full","65ch":"prose","640px":"screen-sm","1536px":"screen-2xl"};s.includes(s.keys(x),e)&&(a=`max-w-${x[e]}`);break;case"minHeight":e.indexOf("%")!==-1&&parseFloat(e.replace("%",""))===100&&(a=`${c}full`),e==="0px"&&(a="min-h-0"),e==="100vh"&&(a="min-h-screen");break;case"fontSize":const o={"12px":"xs","14px":"sm","16px":"base","18px":"lg","20px":"xl","24px":"2xl","30px":"3xl","36px":"4xl","48px":"5xl","60px":"6xl","72px":"7xl","96px":"8xl","128px":"9xl"};s.includes(s.keys(o),e)&&(a=c+o[e]);break;case"lineHeight":const u={"12px":"3","16px":"4","20px":"5","24px":"6","28px":"7","32px":"8","36px":"9","40px":"10",1:"none","1.25":"tight","1.375":"snug","1.5":"normal","1.625":"relaxed",2:"loose"};s.includes(s.keys(u),e)&&(a=c+u[e]);break;case"zIndex":a=["0","10","20","30","40","50"].indexOf(e)!==-1?`${c}${e}`:n;break;case"opacity":const g=["0","5","10","20","25","30","40","50","60","70","75","80","90","95","100"],f=parseFloat(e)*100;s.includes(g,f.toString())&&(a=`opacity-${f}`);break}return a};exports.cn=h.cn;exports.generateUUID=r.generateUUID;exports.getBreakpointValue=r.getBreakpointValue;exports.getBlocksFromHTML=T.getBlocksFromHTML;exports.convertArbitraryToTailwindClass=w;
package/dist/lib.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { c as R } from "./utils-ac68b2c8.js";
2
2
  import { c as T } from "./Class-e6b07b79.js";
3
3
  import { g as z, a as C } from "./Class-e6b07b79.js";
4
- import { g as M } from "./html-to-json-fecbbe16.js";
4
+ import { g as M } from "./html-to-json-7510f587.js";
5
5
  import { first as V, includes as t, keys as i, map as u, parseInt as b, get as O } from "lodash";
6
6
  import "clsx";
7
7
  import "tailwind-merge";
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./jsx-runtime-5c3ac4f7.cjs"),d=require("react"),h=require("./utils-3c452dd0.cjs"),m=require("react-icons-picker"),f=require("react-dom"),g=require("lodash"),u=require("./dialog-170eaad9.cjs"),b=require("./ImagesPanel-cc136c92.cjs"),R=require("react-quill");require("react-i18next");const E=require("./useBuilderProp-5e57d0c8.cjs");function k(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const v=k(d),j=v.forwardRef(({className:t,type:s,...r},n)=>e.jsxRuntimeExports.jsx("input",{type:s,className:h.cn("flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...r}));j.displayName="Input";const y=t=>{const s=document.getElementById("icon-picker-field"),r=document.createElement("div");f.render(e.jsxRuntimeExports.jsx(m.IconPickerItem,{value:t}),r),s.appendChild(r),r.hidden=!0;const n=r.innerHTML;return setTimeout(()=>s.removeChild(r),1e3),n},w=({value:t,onChange:s,onBlur:r,id:n})=>{const a=i=>{s("<svg />");const l=y(i);s(l),r(n,l)};return e.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative h-12 w-12",children:[e.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:t==null?void 0:t.replace("<svg",'<svg class="h-5 w-5"')},className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer bg-white hover:hidden"}),e.jsxRuntimeExports.jsx(m,{value:t?"BiSolidGrid":null,onChange:a,pickButtonStyle:{height:"48px",width:"48px",border:"1px solid #BBBBBB",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px"},searchInputStyle:{backgroundColor:"transparent",width:"100%",border:"1px solid #BBBBBB",margin:"0px 10px",padding:"10px"}})]}),e.jsxRuntimeExports.jsx("textarea",{value:t,onChange:i=>s(i.target.value),className:"h-full w-full rounded-sm border-foreground/20 px-2 py-1 text-xs shadow-sm focus:border-gray-500/80 focus:outline-none focus:ring-0",placeholder:"Choose icon or enter svg"})]})},I=w,P=({children:t,onSelect:s})=>{const[r,n]=d.useState(!1),a=(...i)=>{s.call(void 0,...i),n(!1)};return e.jsxRuntimeExports.jsxs(u.Dialog,{open:r,onOpenChange:i=>n(i),children:[e.jsxRuntimeExports.jsx(u.DialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsx(u.DialogContent,{className:"flex h-3/4 max-w-5xl",children:e.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:e.jsxRuntimeExports.jsx(b.default,{isModalView:!0,onSelect:a})})})]})},p=P,N=({value:t,onChange:s,id:r,onBlur:n})=>e.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[t?e.jsxRuntimeExports.jsx("img",{src:t,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):e.jsxRuntimeExports.jsx(p,{onSelect:s,children:e.jsxRuntimeExports.jsx("div",{className:"h-20 w-20 cursor-pointer rounded-md border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px] hover:border-gray-400"})}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[e.jsxRuntimeExports.jsx(p,{onSelect:s,children:e.jsxRuntimeExports.jsx("small",{className:"cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700",children:t||!g.isEmpty(t)?"Replace Image":"Choose Image"})}),e.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"}),e.jsxRuntimeExports.jsx("input",{type:"url",className:"text-xs",placeholder:"Enter image URL",value:t,onBlur:({target:{value:a}})=>n(r,a),onChange:a=>s(a.target.value)})]})]}),B=N,C=({id:t,placeholder:s,value:r,onChange:n,onBlur:a})=>{const i={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},l=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:e.jsxRuntimeExports.jsx(R,{id:t,value:r,onBlur:c=>a(t,c),onChange:c=>n(c),modules:i,formats:l,placeholder:s,className:"mt-1 rounded-md"})},S=C,q=({schema:t,formData:s,onChange:r})=>{const[n,a]=d.useState([]),i=E.useBuilderProp("getPages",()=>[]),{type:l="page",href:c="",target:x="self"}=s;return d.useEffect(()=>{(async()=>{const o=await i();a(o)})()},[i]),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(t==null?void 0:t.title)??"Link"}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[e.jsxRuntimeExports.jsx("select",{name:"type",defaultValue:"page",value:l,onChange:o=>r({...s,type:o.target.value}),children:[{const:"page",title:"Open Page"},{const:"url",title:"Open URL"},{const:"email",title:"Compose Email"},{const:"telephone",title:"Call Phone"},{const:"scroll",title:"Scroll to element"}].map(o=>e.jsxRuntimeExports.jsx("option",{value:o.const,children:o.title},o.const))}),l==="page"?e.jsxRuntimeExports.jsxs("select",{name:"href",defaultValue:"",placeholder:"Choose Page",value:c,onChange:o=>r({...s,href:o.target.value}),children:[e.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),g.map(n,o=>e.jsxRuntimeExports.jsx("option",{value:o.slug,children:o.page_name},o.uuid))]}):e.jsxRuntimeExports.jsx("input",{name:"href",type:"text",value:c,onChange:o=>r({...s,href:o.target.value}),placeholder:l==="page"||l==="url"?"Enter URL":l==="scroll"?"#ElementID":"Enter detail"}),(l==="page"||l==="url")&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("input",{type:"checkbox",defaultChecked:x==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>r({...s,target:x==="_blank"?"_self":"_blank"})}),e.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})},_=q;exports.IconPickerField=I;exports.ImagePickerField=B;exports.Input=j;exports.LinkField=_;exports.RTEField=S;