@chaibuilder/sdk 1.2.75 → 1.2.77
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.
- package/dist/{CodeEditor-HxRQW3jF.js → CodeEditor-J-XqPeSx.js} +4 -3
- package/dist/CodeEditor-qSebvlcW.cjs +1 -0
- package/dist/Topbar-tfoXdBnv.cjs +1 -0
- package/dist/{Topbar--rV07rOP.js → Topbar-uwCF26N5.js} +4 -3
- package/dist/UnsplashImages-wKvqSePy.cjs +1 -0
- package/dist/{UnsplashImages-tuqgUrm5.js → UnsplashImages-ycaFnevC.js} +4 -3
- package/dist/{UploadImages-5_8G8NXf.js → UploadImages-SBOaVL2H.js} +13 -12
- package/dist/UploadImages-_y_ACWKk.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +64 -63
- package/dist/index-AnW6pixe.cjs +223 -0
- package/dist/{index-Uhj6zHCH.js → index-wgzGsKsU.js} +55 -152
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +113 -115
- package/package.json +3 -2
- package/dist/CodeEditor-bLHnkh3p.cjs +0 -1
- package/dist/Topbar-BoiUPZ7V.cjs +0 -1
- package/dist/UnsplashImages-HCgUgi0z.cjs +0 -1
- package/dist/UploadImages-HeJuyKpH.cjs +0 -1
- package/dist/index-AAGeGuFf.cjs +0 -223
|
@@ -3,7 +3,7 @@ var gt = (r, n, o) => n in r ? mt(r, n, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var ze = (r, n, o) => (gt(r, typeof n != "symbol" ? n + "" : n, o), o);
|
|
4
4
|
import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import React__default, { createContext as createContext$1, useReducer, useEffect as useEffect$1, useDebugValue, useCallback as useCallback$1, useContext as useContext$1, useState as useState$1, Component, Children, Suspense, useMemo as useMemo$1, useRef as useRef$1, memo, createElement as createElement$1, useLayoutEffect as useLayoutEffect$1, forwardRef as forwardRef$1, cloneElement, Fragment,
|
|
6
|
+
import React__default, { createContext as createContext$1, useReducer, useEffect as useEffect$1, useDebugValue, useCallback as useCallback$1, useContext as useContext$1, useState as useState$1, Component, Children, Suspense, useMemo as useMemo$1, useRef as useRef$1, memo, createElement as createElement$1, useLayoutEffect as useLayoutEffect$1, forwardRef as forwardRef$1, cloneElement, Fragment, lazy } from "react";
|
|
7
7
|
import { S as Skeleton, C as ContextMenu, a as ContextMenuTrigger, b as ContextMenuContent, c as ContextMenuItem, T as Tooltip$1, d as TooltipTrigger, e as TooltipContent, B as Button$1, f as Card, g as CardHeader, h as CardDescription, i as CardContent, L as Label, j as Textarea, k as CardFooter, D as Dialog, l as DialogTrigger, m as DialogContent, n as DialogHeader, o as DialogTitle, p as DialogDescription, q as DialogFooter, P as Popover$1, r as PopoverTrigger, s as PopoverContent, t as Command, u as CommandInput, v as CommandList, w as CommandEmpty, x as CommandGroup, y as CommandItem, z as Tabs$1, A as TabsList$1, E as TabsTrigger, F as TabsContent, G as Switch, H as Accordion, I as AccordionItem, J as AccordionTrigger, K as AccordionContent, M as useToast, N as Input$2, O as TooltipPortal, Q as DropdownMenu, R as DropdownMenuTrigger, U as DropdownMenuContent, V as ScrollArea$1, W as DropdownMenuLabel, X as DropdownMenuSeparator, Y as DropdownMenuGroup, Z as DropdownMenuItem, _ as DropdownMenuShortcut, $ as AlertDialog, a0 as AlertDialogTrigger, a1 as AlertDialogContent, a2 as AlertDialogHeader, a3 as AlertDialogTitle, a4 as AlertDialogDescription, a5 as AlertDialogFooter, a6 as AlertDialogCancel, a7 as AlertDialogAction, a8 as DropdownMenuCheckboxItem, a9 as HoverCard, aa as HoverCardTrigger, ab as HoverCardContent, ac as Separator, ad as TooltipProvider, ae as Toaster } from "./context-menu-zu6r7B6f.js";
|
|
8
8
|
import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get as get$1, set, isEmpty, forIn, isObject as isObject$2, each, first, noop as noop$1, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, chunk, throttle, memoize as memoize$1, debounce as debounce$1, isEqual, flatMapDeep, forEach, capitalize, last, startCase, truncate, isArray as isArray$5, split, toLower, cloneDeep, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$2, uniq, toUpper, round } from "lodash-es";
|
|
9
9
|
import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
|
|
@@ -29,6 +29,7 @@ import { twMerge } from "tailwind-merge";
|
|
|
29
29
|
import { Provider } from "react-wrap-balancer";
|
|
30
30
|
import ReactDOM, { flushSync, createPortal } from "react-dom";
|
|
31
31
|
import PropTypes from "prop-types";
|
|
32
|
+
import { ErrorBoundary as ErrorBoundary$1 } from "react-error-boundary";
|
|
32
33
|
import { Resizable } from "re-resizable";
|
|
33
34
|
import validator from "@rjsf/validator-ajv8";
|
|
34
35
|
import Form from "@rjsf/core";
|
|
@@ -3566,29 +3567,13 @@ const useAllDataProviders = () => useMemo$1(() => getChaiDataProviders(), []), B
|
|
|
3566
3567
|
)
|
|
3567
3568
|
}
|
|
3568
3569
|
) });
|
|
3569
|
-
}, StaticCanvas$1 = StaticCanvas
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
/**
|
|
3575
|
-
* A static method that returns an object to update the state when an error is caught.
|
|
3576
|
-
* @returns {object} An object to update the state when an error is caught.
|
|
3577
|
-
*/
|
|
3578
|
-
static getDerivedStateFromError() {
|
|
3579
|
-
return { hasError: !0 };
|
|
3580
|
-
}
|
|
3581
|
-
render() {
|
|
3582
|
-
return this.state.hasError ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", id: "errorBoundary", children: [
|
|
3583
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
|
|
3584
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Please try again later." })
|
|
3585
|
-
] }) : this.props.children;
|
|
3586
|
-
}
|
|
3587
|
-
};
|
|
3588
|
-
const CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-HxRQW3jF.js")), CanvasArea = () => {
|
|
3589
|
-
const [r] = useCodeEditor();
|
|
3570
|
+
}, StaticCanvas$1 = StaticCanvas, FallbackError = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
3571
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
|
|
3572
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Please try again." })
|
|
3573
|
+
] }) }), CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-J-XqPeSx.js")), CanvasArea = () => {
|
|
3574
|
+
const [r] = useCodeEditor(), n = useBuilderProp("onError", noop$1);
|
|
3590
3575
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
|
|
3591
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$
|
|
3576
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
|
|
3592
3577
|
r ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Resizable, { enable: { top: !0, bottom: !1 }, className: "max-h-[400px] min-h-[200px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CodeEditor$1, {}) }) }) : null
|
|
3593
3578
|
] }) });
|
|
3594
3579
|
}, CanvasArea$1 = CanvasArea, ColorField = ({ value: r, onChange: n, id: o, onBlur: a }) => {
|
|
@@ -4406,9 +4391,9 @@ const Node = memo(({ node: r, style: n, dragHandle: o }) => {
|
|
|
4406
4391
|
const n = parse$1(getSanitizedHTML(r));
|
|
4407
4392
|
return isEmpty(r) ? [] : flatten(traverseNodes(n));
|
|
4408
4393
|
}, ImportHTML = () => {
|
|
4409
|
-
const { t: r } = useTranslation(), [n, o] = useState$1(""), { addPredefinedBlock: a } = useAddBlock(), [i] = useSelectedBlockIds(), [, l] = useAtom$1(activePanelAtom$1), c = () => {
|
|
4410
|
-
const
|
|
4411
|
-
a([...
|
|
4394
|
+
const { t: r } = useTranslation(), [n, o] = useState$1(""), { addPredefinedBlock: a } = useAddBlock(), [i] = useSelectedBlockIds(), [, l] = useAtom$1(activePanelAtom$1), [, c] = useAddBlocksModal(), u = () => {
|
|
4395
|
+
const d = getBlocksFromHTML(n);
|
|
4396
|
+
a([...d], first(i) || null), o(""), c(""), l(OUTLINE_KEY);
|
|
4412
4397
|
};
|
|
4413
4398
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { className: "border-border/0 p-0 shadow-none", children: [
|
|
4414
4399
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CardHeader, { className: "p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, { children: r("html_snippet_description") }) }),
|
|
@@ -4419,8 +4404,8 @@ const Node = memo(({ node: r, style: n, dragHandle: o }) => {
|
|
|
4419
4404
|
{
|
|
4420
4405
|
autoFocus: !0,
|
|
4421
4406
|
tabIndex: 1,
|
|
4422
|
-
ref: (
|
|
4423
|
-
onChange: (
|
|
4407
|
+
ref: (d) => d && d.focus(),
|
|
4408
|
+
onChange: (d) => o(d.target.value),
|
|
4424
4409
|
rows: 12,
|
|
4425
4410
|
value: n,
|
|
4426
4411
|
placeholder: r("enter_code_snippet"),
|
|
@@ -4428,7 +4413,7 @@ const Node = memo(({ node: r, style: n, dragHandle: o }) => {
|
|
|
4428
4413
|
}
|
|
4429
4414
|
)
|
|
4430
4415
|
] }) }),
|
|
4431
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(CardFooter, { className: "flex flex-col justify-end p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { disabled: n.trim() === "", onClick: () =>
|
|
4416
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CardFooter, { className: "flex flex-col justify-end p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { disabled: n.trim() === "", onClick: () => u(), size: "sm", className: "w-full", children: r("import_html") }) })
|
|
4432
4417
|
] });
|
|
4433
4418
|
}, ImportHTML$1 = ImportHTML, isBoolean = (r) => typeof r == "boolean" || r instanceof Boolean, isNumber = (r) => typeof r == "number" || r instanceof Number, isBigInt = (r) => typeof r == "bigint" || r instanceof BigInt, isDate = (r) => !!r && r instanceof Date, isString = (r) => typeof r == "string" || r instanceof String, isArray$4 = (r) => Array.isArray(r), isObject$1 = (r) => r instanceof Object && r !== null;
|
|
4434
4419
|
function useBool(r) {
|
|
@@ -4623,12 +4608,13 @@ function getPathAndTypes(r) {
|
|
|
4623
4608
|
return a("", omit(r, ["styles", "_type", "_id", "_name", "_bindings"])), { paths: n, pathsType: o };
|
|
4624
4609
|
}
|
|
4625
4610
|
const ViewData = ({ data: r, fullView: n }) => {
|
|
4611
|
+
const o = useBuilderProp("onError", noop$1);
|
|
4626
4612
|
if (!r)
|
|
4627
4613
|
return null;
|
|
4628
|
-
const
|
|
4614
|
+
const a = typeof r;
|
|
4629
4615
|
return n ? typeof r == "object" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4630
4616
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-3" }),
|
|
4631
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$
|
|
4617
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: o, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4632
4618
|
JsonView,
|
|
4633
4619
|
{
|
|
4634
4620
|
data: r,
|
|
@@ -4644,7 +4630,7 @@ const ViewData = ({ data: r, fullView: n }) => {
|
|
|
4644
4630
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50", children: [
|
|
4645
4631
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-gray-800/80", children: "Content: " }),
|
|
4646
4632
|
r
|
|
4647
|
-
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50", children: truncate(
|
|
4633
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50", children: truncate(a === "object" ? JSON.stringify(r) : r, { length: 40 }) });
|
|
4648
4634
|
}, DataProvidersSuggester = ({
|
|
4649
4635
|
type: r,
|
|
4650
4636
|
value: n = "",
|
|
@@ -4970,7 +4956,7 @@ const ViewData = ({ data: r, fullView: n }) => {
|
|
|
4970
4956
|
}
|
|
4971
4957
|
)
|
|
4972
4958
|
] });
|
|
4973
|
-
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-
|
|
4959
|
+
}, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-ycaFnevC.js")), UploadImages = React__default.lazy(() => import("./UploadImages-SBOaVL2H.js")), ImagesPanel = ({
|
|
4974
4960
|
isModalView: r = !1,
|
|
4975
4961
|
onSelect: n = () => {
|
|
4976
4962
|
}
|
|
@@ -5325,8 +5311,9 @@ function FaRecycle(r) {
|
|
|
5325
5311
|
function FaSpinner(r) {
|
|
5326
5312
|
return GenIcon({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z" }, child: [] }] })(r);
|
|
5327
5313
|
}
|
|
5314
|
+
const SECONDS = 10;
|
|
5328
5315
|
function Countdown() {
|
|
5329
|
-
const [r, n] = useState$1(
|
|
5316
|
+
const [r, n] = useState$1(SECONDS), [o, a] = useState$1(!1);
|
|
5330
5317
|
useEffect$1(() => {
|
|
5331
5318
|
if (o && r > 0) {
|
|
5332
5319
|
const d = setTimeout(() => {
|
|
@@ -5334,15 +5321,15 @@ function Countdown() {
|
|
|
5334
5321
|
}, 100);
|
|
5335
5322
|
return () => clearTimeout(d);
|
|
5336
5323
|
} else
|
|
5337
|
-
r <= 0 && (a(!1), n(
|
|
5324
|
+
r <= 0 && (a(!1), n(SECONDS));
|
|
5338
5325
|
}, [o, r]);
|
|
5339
5326
|
const i = () => {
|
|
5340
|
-
a(!0), n(
|
|
5327
|
+
a(!0), n(SECONDS);
|
|
5341
5328
|
};
|
|
5342
5329
|
useEffect$1(() => {
|
|
5343
|
-
r ===
|
|
5330
|
+
r === SECONDS && i();
|
|
5344
5331
|
}, [r]);
|
|
5345
|
-
const l = 18, c = 2 * Math.PI * l, u = c * (1 - (
|
|
5332
|
+
const l = 18, c = 2 * Math.PI * l, u = c * (1 - (SECONDS - r) / SECONDS);
|
|
5346
5333
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative h-4 w-4", children: [
|
|
5347
5334
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className: "h-full w-full", viewBox: "0 0 40 40", children: [
|
|
5348
5335
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -5377,14 +5364,14 @@ function Countdown() {
|
|
|
5377
5364
|
] });
|
|
5378
5365
|
}
|
|
5379
5366
|
const AskAIStyles = ({ blockId: r }) => {
|
|
5380
|
-
const { t: n } = useTranslation(), { askAi: o, loading: a, error: i } = useAskAi(), [l, c] = useState$1(""), u = useRef$1(null),
|
|
5367
|
+
const { t: n } = useTranslation(), { askAi: o, loading: a, error: i } = useAskAi(), [l, c] = useState$1(""), u = useRef$1(null), d = useRef$1(null), [m, p] = useState$1();
|
|
5381
5368
|
useEffect$1(() => {
|
|
5382
|
-
var
|
|
5383
|
-
(
|
|
5369
|
+
var h;
|
|
5370
|
+
(h = u.current) == null || h.focus();
|
|
5384
5371
|
}, []);
|
|
5385
|
-
const
|
|
5386
|
-
const { usage:
|
|
5387
|
-
!i &&
|
|
5372
|
+
const g = (h) => {
|
|
5373
|
+
const { usage: b } = h || {};
|
|
5374
|
+
!i && b && p(b), d.current = setTimeout(() => p(void 0), 1e4), i || c("");
|
|
5388
5375
|
};
|
|
5389
5376
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
5390
5377
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
|
|
@@ -5393,12 +5380,12 @@ const AskAIStyles = ({ blockId: r }) => {
|
|
|
5393
5380
|
{
|
|
5394
5381
|
ref: u,
|
|
5395
5382
|
value: l,
|
|
5396
|
-
onChange: (
|
|
5383
|
+
onChange: (h) => c(h.target.value),
|
|
5397
5384
|
placeholder: n("ask_ai_to_edit_styles"),
|
|
5398
5385
|
className: "w-full border border-gray-400 focus:border-0",
|
|
5399
5386
|
rows: 3,
|
|
5400
|
-
onKeyDown: (
|
|
5401
|
-
|
|
5387
|
+
onKeyDown: (h) => {
|
|
5388
|
+
h.key === "Enter" && (h.preventDefault(), d.current && clearTimeout(d.current), p(void 0), o("styles", r, l, g));
|
|
5402
5389
|
}
|
|
5403
5390
|
}
|
|
5404
5391
|
),
|
|
@@ -5408,7 +5395,7 @@ const AskAIStyles = ({ blockId: r }) => {
|
|
|
5408
5395
|
{
|
|
5409
5396
|
disabled: l.trim().length < 5 || a,
|
|
5410
5397
|
onClick: () => {
|
|
5411
|
-
|
|
5398
|
+
d.current && clearTimeout(d.current), p(void 0), o("styles", r, l, g);
|
|
5412
5399
|
},
|
|
5413
5400
|
variant: "default",
|
|
5414
5401
|
className: "w-fit",
|
|
@@ -5427,11 +5414,11 @@ const AskAIStyles = ({ blockId: r }) => {
|
|
|
5427
5414
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("stop") })
|
|
5428
5415
|
] }) : null
|
|
5429
5416
|
] }),
|
|
5430
|
-
|
|
5417
|
+
m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
|
|
5431
5418
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
5432
5419
|
n("Total tokens used"),
|
|
5433
5420
|
": ",
|
|
5434
|
-
|
|
5421
|
+
m.totalTokens
|
|
5435
5422
|
] }),
|
|
5436
5423
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Countdown, {})
|
|
5437
5424
|
] }) }) : null,
|
|
@@ -7483,14 +7470,14 @@ function QuickPrompts({ onClick: r }) {
|
|
|
7483
7470
|
) }) });
|
|
7484
7471
|
}
|
|
7485
7472
|
const AIUserPrompt = ({ blockId: r }) => {
|
|
7486
|
-
const { t: n } = useTranslation(), { askAi: o, loading: a, error: i } = useAskAi(), [l, c] = useState$1(""), [u, d] = useState$1(!0), [m, p] = useState$1(), g = useRef$1(null);
|
|
7473
|
+
const { t: n } = useTranslation(), { askAi: o, loading: a, error: i } = useAskAi(), [l, c] = useState$1(""), [u, d] = useState$1(!0), [m, p] = useState$1(), g = useRef$1(null), h = useRef$1(null);
|
|
7487
7474
|
useEffect$1(() => {
|
|
7488
|
-
var
|
|
7489
|
-
(
|
|
7475
|
+
var x;
|
|
7476
|
+
(x = g.current) == null || x.focus();
|
|
7490
7477
|
}, []);
|
|
7491
|
-
const
|
|
7492
|
-
const { usage:
|
|
7493
|
-
!i &&
|
|
7478
|
+
const b = (x) => {
|
|
7479
|
+
const { usage: v } = x || {};
|
|
7480
|
+
!i && v && p(v), h.current = setTimeout(() => p(void 0), 1e4), i || c("");
|
|
7494
7481
|
};
|
|
7495
7482
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
|
7496
7483
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -7510,12 +7497,12 @@ const AIUserPrompt = ({ blockId: r }) => {
|
|
|
7510
7497
|
{
|
|
7511
7498
|
ref: g,
|
|
7512
7499
|
value: l,
|
|
7513
|
-
onChange: (
|
|
7500
|
+
onChange: (x) => c(x.target.value),
|
|
7514
7501
|
placeholder: n("ask_ai_to_edit_content"),
|
|
7515
7502
|
className: "w-full border border-gray-400 focus:border-0",
|
|
7516
7503
|
rows: 3,
|
|
7517
|
-
onKeyDown: (
|
|
7518
|
-
|
|
7504
|
+
onKeyDown: (x) => {
|
|
7505
|
+
x.key === "Enter" && (x.preventDefault(), h.current && clearTimeout(h.current), p(void 0), o("content", r, l, b));
|
|
7519
7506
|
}
|
|
7520
7507
|
}
|
|
7521
7508
|
),
|
|
@@ -7525,7 +7512,7 @@ const AIUserPrompt = ({ blockId: r }) => {
|
|
|
7525
7512
|
{
|
|
7526
7513
|
disabled: l.trim().length < 5 || a,
|
|
7527
7514
|
onClick: () => {
|
|
7528
|
-
p(void 0), o("content", r, l,
|
|
7515
|
+
h.current && clearTimeout(h.current), p(void 0), o("content", r, l, b);
|
|
7529
7516
|
},
|
|
7530
7517
|
variant: "default",
|
|
7531
7518
|
className: "w-fit",
|
|
@@ -7556,8 +7543,8 @@ const AIUserPrompt = ({ blockId: r }) => {
|
|
|
7556
7543
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7557
7544
|
QuickPrompts,
|
|
7558
7545
|
{
|
|
7559
|
-
onClick: (
|
|
7560
|
-
p(void 0), o("content", r,
|
|
7546
|
+
onClick: (x) => {
|
|
7547
|
+
h.current && clearTimeout(h.current), p(void 0), o("content", r, x, b);
|
|
7561
7548
|
}
|
|
7562
7549
|
}
|
|
7563
7550
|
)
|
|
@@ -26087,90 +26074,6 @@ PrismExport.Tabs = PrismTabs;
|
|
|
26087
26074
|
PrismExport.Tab = Tabs.Tab;
|
|
26088
26075
|
PrismExport.TabsList = Tabs.List;
|
|
26089
26076
|
PrismExport.Panel = PrismPanel;
|
|
26090
|
-
const ErrorBoundaryContext = createContext$1(null), initialState = {
|
|
26091
|
-
didCatch: !1,
|
|
26092
|
-
error: null
|
|
26093
|
-
};
|
|
26094
|
-
let ErrorBoundary$1 = class extends Component {
|
|
26095
|
-
constructor(n) {
|
|
26096
|
-
super(n), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = initialState;
|
|
26097
|
-
}
|
|
26098
|
-
static getDerivedStateFromError(n) {
|
|
26099
|
-
return {
|
|
26100
|
-
didCatch: !0,
|
|
26101
|
-
error: n
|
|
26102
|
-
};
|
|
26103
|
-
}
|
|
26104
|
-
resetErrorBoundary() {
|
|
26105
|
-
const {
|
|
26106
|
-
error: n
|
|
26107
|
-
} = this.state;
|
|
26108
|
-
if (n !== null) {
|
|
26109
|
-
for (var o, a, i = arguments.length, l = new Array(i), c = 0; c < i; c++)
|
|
26110
|
-
l[c] = arguments[c];
|
|
26111
|
-
(o = (a = this.props).onReset) === null || o === void 0 || o.call(a, {
|
|
26112
|
-
args: l,
|
|
26113
|
-
reason: "imperative-api"
|
|
26114
|
-
}), this.setState(initialState);
|
|
26115
|
-
}
|
|
26116
|
-
}
|
|
26117
|
-
componentDidCatch(n, o) {
|
|
26118
|
-
var a, i;
|
|
26119
|
-
(a = (i = this.props).onError) === null || a === void 0 || a.call(i, n, o);
|
|
26120
|
-
}
|
|
26121
|
-
componentDidUpdate(n, o) {
|
|
26122
|
-
const {
|
|
26123
|
-
didCatch: a
|
|
26124
|
-
} = this.state, {
|
|
26125
|
-
resetKeys: i
|
|
26126
|
-
} = this.props;
|
|
26127
|
-
if (a && o.error !== null && hasArrayChanged(n.resetKeys, i)) {
|
|
26128
|
-
var l, c;
|
|
26129
|
-
(l = (c = this.props).onReset) === null || l === void 0 || l.call(c, {
|
|
26130
|
-
next: i,
|
|
26131
|
-
prev: n.resetKeys,
|
|
26132
|
-
reason: "keys"
|
|
26133
|
-
}), this.setState(initialState);
|
|
26134
|
-
}
|
|
26135
|
-
}
|
|
26136
|
-
render() {
|
|
26137
|
-
const {
|
|
26138
|
-
children: n,
|
|
26139
|
-
fallbackRender: o,
|
|
26140
|
-
FallbackComponent: a,
|
|
26141
|
-
fallback: i
|
|
26142
|
-
} = this.props, {
|
|
26143
|
-
didCatch: l,
|
|
26144
|
-
error: c
|
|
26145
|
-
} = this.state;
|
|
26146
|
-
let u = n;
|
|
26147
|
-
if (l) {
|
|
26148
|
-
const d = {
|
|
26149
|
-
error: c,
|
|
26150
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
26151
|
-
};
|
|
26152
|
-
if (isValidElement(i))
|
|
26153
|
-
u = i;
|
|
26154
|
-
else if (typeof o == "function")
|
|
26155
|
-
u = o(d);
|
|
26156
|
-
else if (a)
|
|
26157
|
-
u = createElement$1(a, d);
|
|
26158
|
-
else
|
|
26159
|
-
throw c;
|
|
26160
|
-
}
|
|
26161
|
-
return createElement$1(ErrorBoundaryContext.Provider, {
|
|
26162
|
-
value: {
|
|
26163
|
-
didCatch: l,
|
|
26164
|
-
error: c,
|
|
26165
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
26166
|
-
}
|
|
26167
|
-
}, u);
|
|
26168
|
-
}
|
|
26169
|
-
};
|
|
26170
|
-
function hasArrayChanged() {
|
|
26171
|
-
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
26172
|
-
return r.length !== n.length || r.some((o, a) => !Object.is(o, n[a]));
|
|
26173
|
-
}
|
|
26174
26077
|
var diffMatchPatch = { exports: {} };
|
|
26175
26078
|
(function(r) {
|
|
26176
26079
|
var n = function() {
|
|
@@ -33953,11 +33856,11 @@ const TabletIcon = ({ landscape: r = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
33953
33856
|
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogFooter, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDialogCancel, { children: r("Close") }) })
|
|
33954
33857
|
] }) });
|
|
33955
33858
|
}, SettingsPanel = () => {
|
|
33956
|
-
const r = useSelectedBlock(), { t: n } = useTranslation(), [o, a] = useState$1(!0);
|
|
33859
|
+
const r = useSelectedBlock(), { t: n } = useTranslation(), [o, a] = useState$1(!0), i = useBuilderProp("onError", noop$1);
|
|
33957
33860
|
return isNull(r) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 rounded-xl p-4", children: [
|
|
33958
33861
|
/* @__PURE__ */ jsxRuntimeExports.jsx(MixerHorizontalIcon, { className: "mx-auto text-3xl" }),
|
|
33959
33862
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h1", { children: n("please_select_a_block_to_edit") })
|
|
33960
|
-
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$
|
|
33863
|
+
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: i, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex w-full flex-col", children: [
|
|
33961
33864
|
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockSettings, {}),
|
|
33962
33865
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
33963
33866
|
/* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyling, {}),
|
|
@@ -33977,7 +33880,7 @@ const TabletIcon = ({ landscape: r = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
33977
33880
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
33978
33881
|
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
|
|
33979
33882
|
] }) });
|
|
33980
|
-
}, SettingsPanel$1 = SettingsPanel, TopBar = lazy(() => import("./Topbar
|
|
33883
|
+
}, SettingsPanel$1 = SettingsPanel, TopBar = lazy(() => import("./Topbar-uwCF26N5.js")), menuItems = [
|
|
33981
33884
|
{ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Layers, { size: 20 }), label: "sidebar.outline", component: Outline$1 },
|
|
33982
33885
|
{ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: 16 }), label: "sidebar.edit_block", component: SettingsPanel$1 },
|
|
33983
33886
|
{ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(LightningBoltIcon, { className: "size-5" }), label: "sidebar.ai_assistant", component: AskAI },
|
|
@@ -34095,14 +33998,14 @@ const TabletIcon = ({ landscape: r = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
|
|
|
34095
33998
|
window.onbeforeunload = null;
|
|
34096
33999
|
}), [i]), /* @__PURE__ */ jsxRuntimeExports.jsx(l, {});
|
|
34097
34000
|
}, ChaiBuilderEditor = (r) => {
|
|
34098
|
-
const n = r._flags || {};
|
|
34099
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$
|
|
34001
|
+
const n = r._flags || {}, o = r.onError || noop$1;
|
|
34002
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-screen w-screen", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: o, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(FlagsProvider, { features: { ...FEATURE_TOGGLES, ...n }, children: [
|
|
34100
34003
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DevTools, {}),
|
|
34101
34004
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SmallScreenMessage, {}),
|
|
34102
34005
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ChaiBuilderComponent, { ...r }),
|
|
34103
34006
|
/* @__PURE__ */ jsxRuntimeExports.jsx(PreviewScreen, {}),
|
|
34104
34007
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Toaster, {})
|
|
34105
|
-
] }) });
|
|
34008
|
+
] }) }) });
|
|
34106
34009
|
};
|
|
34107
34010
|
export {
|
|
34108
34011
|
useSelectedBlocksDisplayChild as $,
|
package/dist/web-blocks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@chaibuilder/runtime"),n=require("./jsx-runtime-JYMCiFoE.cjs"),B=require("react"),e=require("./iconBase-vJD0OXxU.cjs");require("i18next");const m=require("@radix-ui/react-icons"),f=require("lodash-es");require("clsx");require("tailwind-merge");function E(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const l in t)if(l!=="default"){const s=Object.getOwnPropertyDescriptor(t,l);Object.defineProperty(o,l,s.get?s:{enumerable:!0,get:()=>t[l]})}}return o.default=t,Object.freeze(o)}const b=E(B),I=({className:t="",inBuilder:o})=>o?n.jsxRuntimeExports.jsx("div",{className:e.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",t),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:n.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,y=I,C=t=>{const{blockProps:o,inBuilder:l,backgroundImage:s,children:r,tag:a="div",styles:i}=t;let u=r;r||(u=n.jsxRuntimeExports.jsx(y,{inBuilder:l}));let c={};return s&&(c={backgroundImage:`url(${s})`}),b.createElement(a,{...o,...i,style:c},u)},R={type:"Box",label:"web_blocks.box",category:"core",group:"basic",props:{styles:e.o({default:""}),tag:e.f({title:"web_blocks.tag",default:"div",options:[{value:"div",title:"web_blocks.div"},{value:"header",title:"web_blocks.header"},{value:"footer",title:"web_blocks.footer"},{value:"section",title:"web_blocks.section"},{value:"article",title:"web_blocks.article"},{value:"aside",title:"web_blocks.aside"},{value:"main",title:"web_blocks.main"},{value:"nav",title:"web_blocks.nav"},{value:"figure",title:"web_blocks.figure"},{value:"details",title:"web_blocks.details"},{value:"summary",title:"web_blocks.summary"},{value:"dialog",title:"web_blocks.dialog"},{value:"strike",title:"web_blocks.strike"},{value:"caption",title:"web_blocks.caption"},{value:"legend",title:"web_blocks.legend"},{value:"figcaption",title:"web_blocks.figcaption"},{value:"mark",title:"web_blocks.mark"}]}),backgroundImage:e.v({title:"web_blocks.background_image"})},canAcceptBlock:()=>!0},L=t=>{const{blockProps:o,iconSize:l,icon:s,content:r,iconPos:a,styles:i,children:u}=t,c=s,d=u||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:r}),c&&n.jsxRuntimeExports.jsx("div",{style:{width:l+"px"},className:a+" "+(a==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:c}})]});return b.createElement("button",{...o,...i,type:"button"},d)},S={type:"Button",label:"web_blocks.button",category:"core",icon:m.ButtonIcon,group:"basic",props:{content:e.g({title:"web_blocks.label",default:"Button"}),styles:e.o({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:e.T({title:"web_blocks.icon",default:""}),iconSize:e.y({title:"web_blocks.icon_size",default:24}),iconPos:e.f({title:"web_blocks.icon_position",default:"order-last",options:[{title:"web_blocks.start",value:"order-first"},{title:"web_blocks.end",value:"order-last"}]})}},M=t=>{const{blockProps:o,styles:l,htmlCode:s,inBuilder:r}=t;return r?n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?n.jsxRuntimeExports.jsx("div",{...o,...l,className:"absolute z-20 h-full w-full"}):null,b.createElement("div",{...l,dangerouslySetInnerHTML:{__html:s.replace(/<script.*?>.*?<\/script>/g,"")}})]}):b.createElement("div",{...o,...l,dangerouslySetInnerHTML:{__html:s}})},T={type:"CustomHTML",label:"web_blocks.custom_html",category:"core",icon:m.CodeIcon,group:"advanced",props:{styles:e.o({default:""}),htmlCode:e.u({title:"web_blocks.html_code",default:"<div><p>web_blocks.default_snippet</p></div>",placeholder:"web_blocks.placeholder"})},canAcceptBlock:()=>!1},P=b.memo(t=>{const{blockProps:o,styles:l}=t;return b.createElement("div",{...o,...l})}),$={type:"EmptyBox",label:"web_blocks.empty_box",category:"core",group:"basic",props:{styles:e.o({default:""})}},N=t=>{const{blockProps:o,styles:l,content:s,level:r="h1",children:a=null}=t;return a?b.createElement(r,{...l,...o},a):b.createElement(r,{...l,...o,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})},q={type:"Heading",label:"web_blocks.heading",category:"core",icon:m.HeadingIcon,group:"typography",props:{level:e.f({title:"web_blocks.level",default:"h2",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:e.o({default:"text-3xl"}),content:e.r({title:"web_blocks.content",default:"Heading goes here"})},canAcceptBlock:t=>t==="Span"||t==="Text"},D=t=>{const{blockProps:o,styles:l,content:s}=t;return f.isNull(t.children)?b.createElement("p",{...l,...o,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):b.createElement("p",{...l,...o},t.children)},H={type:"Paragraph",label:"web_blocks.paragraph",category:"core",icon:m.TextIcon,group:"typography",props:{styles:e.o({default:""}),content:e.r({title:"web_blocks.content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:t=>t==="Span"||t==="Link"||t==="Text"},z=t=>{const{blockProps:o,styles:l,content:s,children:r=null,tag:a}=t;return r?b.createElement("span",{...l,...o},r):b.createElement(a||"span",{...l,...o,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s}})},A={type:"Span",label:"web_blocks.span",category:"core",group:"typography",props:{styles:e.o({default:""}),content:e.r({title:"web_blocks.content",default:""})},canAcceptBlock:()=>!0},U=t=>{const{blockProps:o,content:l,styles:s}=t;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...o,...s,dangerouslySetInnerHTML:{__html:l}})})},F={type:"RichText",label:"web_blocks.richtext",category:"core",icon:m.CursorTextIcon,group:"typography",props:{styles:e.o({default:""}),content:e.b({title:"web_blocks.content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}},O=t=>{const{blockProps:o,link:l,children:s,styles:r,inBuilder:a,content:i}=t;return!s&&f.isEmpty(r==null?void 0:r.className)&&f.isEmpty(i)?n.jsxRuntimeExports.jsx(y,{inBuilder:a}):a?s?n.jsxRuntimeExports.jsx("span",{...o,...r,children:s}):b.createElement("span",{...o,...r,dangerouslySetInnerHTML:{__html:i}}):s?n.jsxRuntimeExports.jsx("a",{href:(l==null?void 0:l.href)||"#/",target:l==null?void 0:l.target,...o,...r,children:s}):b.createElement("a",{...o,...r,"data-ai-key":"content",href:(l==null?void 0:l.href)||"#",target:(l==null?void 0:l.target)||"_self",dangerouslySetInnerHTML:{__html:i}})},V={type:"Link",label:"web_blocks.link",category:"core",icon:m.Link1Icon,group:"basic",props:{styles:e.o({default:""}),content:e.g({title:"web_blocks.content",default:""}),link:e.q({title:"web_blocks.link",default:{type:"page",target:"_self",href:"#"}})},canAcceptBlock:t=>t!=="Link"},j=(t,...o)=>({...t,className:e.cn(t.className,...o)}),G=t=>{const{blockProps:o,children:l,styles:s,inBuilder:r,content:a,href:i}=t,{hrefType:u,autoplay:c,maxWidth:d,backdropColor:h,galleryName:g}=t,k=j(s,"cb-lightbox");if(!l&&f.isEmpty(s==null?void 0:s.className)&&f.isEmpty(a))return n.jsxRuntimeExports.jsx(y,{inBuilder:r});if(r)return l?n.jsxRuntimeExports.jsx("span",{...o,...k,children:l}):b.createElement("span",{...o,...k,dangerouslySetInnerHTML:{__html:a}});const x={};return x["data-vbtype"]=u,c&&(x["data-autoplay"]="true"),d&&(x["data-maxwidth"]=d+"px"),h&&(x["data-overlay"]=h),g&&(x["data-gall"]=g),l?n.jsxRuntimeExports.jsx("a",{...x,href:i||"#/",...o,...k,children:l}):b.createElement("a",{...o,...k,...x,href:i||"#",dangerouslySetInnerHTML:{__html:a}})},W={type:"LightBoxLink",label:"web_blocks.lightbox_link",category:"core",icon:m.ImageIcon,group:"basic",props:{styles:e.o({default:""}),content:e.g({title:"web_blocks.content",default:"Link text or drop blocks inside"}),href:e.g({title:"web_blocks.href",default:""}),hrefType:e.f({title:"web_blocks.type",default:"video",options:[{value:"video",title:"web_blocks.video"},{value:"iframe",title:"web_blocks.iframe"},{value:"inline",title:"web_blocks.inline"},{value:"ajax",title:"web_blocks.ajax"}]}),autoplay:e.c({title:"web_blocks.autoplay",default:!1}),maxWidth:e.y({title:"web_blocks.max_width",default:""}),backdropColor:e.g({title:"backdrop_color",default:""}),galleryName:e.g({title:"web_blocks.gallery_name",default:""})},canAcceptBlock:t=>t!=="Link"&&t!=="LightBoxLink"},X=t=>{const{blockProps:o,children:l,listType:s,styles:r,tag:a,inBuilder:i}=t,u=e.cn(f.get(r,"className",""),s);return!l&&f.isEmpty(r==null?void 0:r.className)?n.jsxRuntimeExports.jsx(y,{inBuilder:i}):b.createElement(a||(s==="list-decimal"?"ol":"ul"),{...o,...r,className:u},l)},Y={type:"List",label:"web_blocks.list",icon:m.RowsIcon,category:"core",group:"basic",props:{styles:e.o({default:""}),listType:e.f({title:"web_blocks.list_type",default:"list-none",options:[{value:"list-none",title:"web_blocks.none"},{value:"list-disc",title:"web_blocks.disc"},{value:"list-decimal",title:"web_blocks.number"}]})},canAcceptBlock:t=>t==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},Z=t=>{const{blockProps:o,content:l,styles:s,children:r,tag:a}=t;return r?b.createElement(a||"li",{...s,...o},r):b.createElement(a||"li",{...s,...o,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:l}})},J={type:"ListItem",label:"web_blocks.listitem",icon:m.ColumnsIcon,category:"core",group:"basic",props:{styles:e.o({default:""}),content:e.r({title:"web_blocks.content",default:"List item"})},canAcceptBlock:t=>t!=="ListItem",canBeNested:t=>t==="List"},K=t=>{const{blockProps:o,icon:l,styles:s,width:r,inBuilder:a,height:i}=t,u=j(s,e.cn(r?`w-[${r}px]`:"",i?`h-[${i}px]`:""));if(f.isEmpty(l))return n.jsxRuntimeExports.jsx(y,{inBuilder:a,className:"h-8 w-14"});const c=l.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return b.createElement("span",{...o,...u,dangerouslySetInnerHTML:{__html:c}})},Q={type:"Icon",label:"web_blocks.icon",category:"core",icon:m.SketchLogoIcon,group:"media",props:{styles:e.o({default:"text-black"}),icon:e.T({title:"web_blocks.icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'}),width:e.y({title:"web_blocks.width",default:""}),height:e.y({title:"web_blocks.height",default:""})}},ee=t=>{const{blockProps:o,image:l,styles:s,alt:r,height:a,width:i}=t;return f.isEmpty(l)?n.jsxRuntimeExports.jsx(y,{className:"h-36"}):b.createElement("img",{...o,...s,src:l,alt:r,loading:"lazy",height:a,width:i})},te={type:"Image",label:"web_blocks.image",category:"core",icon:m.ImageIcon,group:"media",props:{styles:e.o({default:""}),image:e.v({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:e.g({title:"web_blocks.alt",default:""}),width:e.g({title:"web_blocks.width",default:""}),height:e.g({title:"web_blocks.height",default:""})}},_=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,w=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,v=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,le=t=>{if(_.test(t)){const o=t.match(_);return o?`https://www.youtube.com/embed/${o[4]}`:t}if(w.test(t)){const o=t.match(w);return o?`https://player.vimeo.com/video/${o[3]}`:t}if(v.test(t)){const o=t.match(v);return o?`https://www.dailymotion.com/embed/video/${o[4]}`:t}return null},oe=b.memo(t=>{const{blockProps:o,inBuilder:l,styles:s,url:r,controls:a}=t,i=f.get(a,"autoPlay",!1),u=f.get(a,"controls",!1),c=i||f.get(a,"muted",!0),d=f.get(a,"loop",!1);if(f.isEmpty(r))return n.jsxRuntimeExports.jsx(y,{inBuilder:l,className:"h-36"});let h=le(r),g=null;if(h){if(!f.isEmpty(h)){const k=[];k.push(`autoplay=${i?1:0}`),k.push(`controls=${a?1:0}`),k.push(`mute=${c?1:0}&muted=${c?1:0}`),k.push(`loop=${d?1:0}`),h=`${h}?${k.join("&")}`}g=b.createElement("iframe",{...o,className:"absolute inset-0 w-full h-full",src:h,allow:l?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=b.createElement("video",{...o,className:"absolute inset-0 w-full h-full",src:r,controls:u,muted:c,autoPlay:l?!1:i,loop:d});return n.jsxRuntimeExports.jsx("div",{...f.pick(s,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[l?n.jsxRuntimeExports.jsx("div",{...o,...f.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})}),se={type:"Video",label:"web_blocks.video",category:"core",icon:m.VideoIcon,group:"media",props:{styles:e.o({default:""}),url:e.g({title:"web_blocks.video_url",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:e.h({title:"web_blocks.controls",properties:{autoPlay:e.c({title:"web_blocks.autoplay",default:!0}),controls:e.c({title:"web_blocks.controls",default:!1}),loop:e.c({title:"web_blocks.loop",default:!1}),muted:e.c({title:"web_blocks.muted",default:!0})}})}};function re(t){return e.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(t)}const ne=t=>{const{scripts:o,inBuilder:l,blockProps:s}=t;return l?n.jsxRuntimeExports.jsx("div",{...s}):n.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},ae={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:re,group:"advanced",props:{scripts:e.u({title:"Script",default:"",placeholder:"<script>console.log('Hello, world!');<\/script>"})},canAcceptBlock:()=>!1},ie=t=>{const{blockProps:o,styles:l}=t;return b.createElement("hr",{...l,...o})},ce={type:"Divider",label:"web_blocks.divider",category:"core",icon:m.DividerHorizontalIcon,group:"basic",props:{styles:e.o({default:"bg-gray-900 h-0.5 py-2 my-1"})}},ue=()=>null,de={type:"Dark Mode",label:"web_blocks.dark_mode",category:"core",icon:m.MoonIcon,group:"advanced",props:{},blocks:()=>[{_id:"ultqCh",_type:"Span",tag:"span",styles:"#styles:,",_name:"Dark Mode Switcher"},{_id:"vroabi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'dark'","x-show":"darkMode === 'light'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Dark Mode Btn"},{_id:"eweibk",_parent:"vroabi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"nltBrv",_parent:"eweibk",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'></path></svg>"},{_id:"gesydi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Light Mode Btn"},{_id:"sgbhDo",_parent:"gesydi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"AdDwBC",_parent:"sgbhDo",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'></circle><path d='M12 2v2'></path><path d='M12 20v2'></path><path d='m4.93 4.93 1.41 1.41'></path><path d='m17.66 17.66 1.41 1.41'></path><path d='M2 12h2'></path><path d='M20 12h2'></path><path d='m6.34 17.66-1.41 1.41'></path><path d='m19.07 4.93-1.41 1.41'></path></svg>"}]},pe=t=>t.inBuilder||t.forceWrapper?n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...t.blockProps,children:t.content}):`${t.content}`,be={type:"Text",label:"web_blocks.text",hidden:!0,category:"core",group:"typography",icon:m.SpaceBetweenVerticallyIcon,props:{content:e.r({title:"web_blocks.content",defaultValue:""})}},me=t=>{const{blockProps:o,backgroundImage:l,children:s,styles:r}=t;let a={};return l&&(a={backgroundImage:`url(${l})`}),b.createElement("div",{...o,...r,style:a},s)},ge={type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:e.o({default:"font-body antialiased"}),backgroundImage:e.v({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},fe=t=>{const{blockProps:o,styles:l}=t;return b.createElement("br",{...o,...l})},he={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:m.SpaceBetweenVerticallyIcon,props:{styles:e.o({default:""})}},ke=t=>{const{blockProps:o,errorMessage:l,name:s,_type:r,successMessage:a,action:i,styles:u,children:c}=t;let d=c;c||(d=n.jsxRuntimeExports.jsx(y,{}));const h={"x-data":"useForm","x-on:submit.prevent":"post"},g={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return n.jsxRuntimeExports.jsxs("form",{...h,"data-error":l,"data-success":a,method:"post",action:i,...o,...u,children:[n.jsxRuntimeExports.jsx("div",{...g}),n.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:s||r}),d]})},ye={type:"Form",label:"web_blocks.form",category:"core",icon:m.GroupIcon,group:"form",props:{styles:e.o({default:""}),action:e.g({title:"web_blocks.submit_url",default:"/api/form/submit"}),errorMessage:e.b({title:"web_blocks.error_message",default:"Something went wrong. Please try again"}),successMessage:e.b({title:"web_blocks.success_message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0},xe=t=>{const{blockProps:o,inBuilder:l,label:s,styles:r,inputStyles:a,icon:i,iconPos:u}=t,c=e.generateUUID(),d={"x-bind:disabled":"formLoading"};return n.jsxRuntimeExports.jsxs("button",{id:c,...d,...a,...r,...o||{},type:l?"button":"submit",children:[s,i&&n.jsxRuntimeExports.jsx("span",{className:u,dangerouslySetInnerHTML:{__html:i}})]})},_e={type:"FormButton",label:"web_blocks.submit_button",category:"core",icon:m.ButtonIcon,group:"form",props:{label:e.g({title:"web_blocks.label",default:"Submit"}),styles:e.o({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:e.T({title:"Icon",default:""}),iconPos:e.f({title:"web_blocks.icon_position",default:"order-last",options:[{title:"web_blocks.start",value:"order-first"},{title:"web_blocks.end",value:"order-last"}]})}},we=t=>{const{blockProps:o,label:l,placeholder:s,styles:r,inputStyles:a,showLabel:i,required:u,inputType:c="text",inBuilder:d,fieldName:h}=t,g=e.generateUUID();return!i||c==="submit"?(c==="submit"&&(o.value=l),n.jsxRuntimeExports.jsx("input",{id:g,name:h,readOnly:d,...o,...a,...r,type:c,placeholder:s,required:u})):n.jsxRuntimeExports.jsxs("div",{...r,...o,children:[i&&n.jsxRuntimeExports.jsx("label",{htmlFor:g,children:l}),n.jsxRuntimeExports.jsx("input",{name:h,readOnly:d,...a,id:g,type:c,placeholder:s,required:u})]})},ve={type:"Input",label:"web_blocks.input",category:"core",icon:m.InputIcon,group:"form",props:{styles:e.o({default:""}),fieldName:e.g({title:"Field Name",default:"input"}),inputType:e.f({title:"web_blocks.type",options:f.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],t=>({value:t,title:t})),default:"text"}),value:e.g({title:"web_blocks.value",default:""}),showLabel:e.c({title:"web_blocks.show_label",default:!0}),inputStyles:e.o({default:"w-full p-1"}),label:e.g({title:"web_blocks.label",default:"Label"}),placeholder:e.g({title:"web_blocks.placeholder",default:"Placeholder"}),required:e.c({title:"web_blocks.required",default:!1})}},je=t=>{const{blockProps:o,fieldName:l,label:s,styles:r,inputStyles:a,checked:i,required:u,showLabel:c=!0}=t,d=e.generateUUID();return c?n.jsxRuntimeExports.jsxs("div",{...r,...o,children:[n.jsxRuntimeExports.jsx("input",{...a,name:l,id:d,type:"radio",required:u,defaultChecked:i}),s&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s})]}):n.jsxRuntimeExports.jsx("input",{id:d,...o,...a,...r,type:"radio",required:u,checked:i,name:l})},Be={type:"Radio",label:"web_blocks.radio",category:"core",icon:m.RadiobuttonIcon,group:"form",props:{styles:e.o({default:"flex items-center w-max gap-x-2"}),fieldName:e.g({title:"web_blocks.field_name",default:"radio"}),label:e.g({title:"web_blocks.label",default:"Label"}),checked:e.c({title:"web_blocks.checked",default:!1}),required:e.c({title:"web_blocks.required",default:!1})}},Ee=t=>{const{blockProps:o,fieldName:l,label:s,placeholder:r,styles:a,inputStyles:i,required:u,showLabel:c,_multiple:d=!1}=t,h=e.generateUUID();return c?n.jsxRuntimeExports.jsxs("div",{...a,children:[c&&n.jsxRuntimeExports.jsx("label",{htmlFor:h,children:s}),n.jsxRuntimeExports.jsxs("select",{...i,id:h,required:u,multiple:d,name:l,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),f.map(t.options,g=>n.jsxRuntimeExports.jsx("option",{selected:f.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})]}):n.jsxRuntimeExports.jsxs("select",{id:h,...a,...o,required:u,multiple:d,name:l,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),f.map(t.options,g=>n.jsxRuntimeExports.jsx("option",{selected:f.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})},Ie={type:"Select",label:"web_blocks.select",category:"core",icon:m.DropdownMenuIcon,group:"form",props:{styles:e.o({default:""}),fieldName:e.g({title:"web_blocks.field_name",default:"select"}),showLabel:e.c({title:"web_blocks.show_label",default:!0}),inputStyles:e.o({default:"w-full p-1"}),label:e.g({title:"web_blocks.label",default:"Label"}),placeholder:e.g({title:"web_blocks.placeholder",default:"Placeholder"}),required:e.c({title:"web_blocks.required",default:!1}),_multiple:e.c({title:"web_blocks.multiple",default:!1}),options:e.S({title:"web_blocks.options",itemProperties:{label:e.g({title:"web_blocks.label",default:""}),value:e.g({title:"web_blocks.value",default:""})}})}},Ce=t=>{const{blockProps:o,fieldName:l,label:s,placeholder:r,styles:a,inputStyles:i,_rows:u,showLabel:c}=t,d=e.generateUUID();return c?n.jsxRuntimeExports.jsxs("div",{...a,...o,children:[c&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s}),n.jsxRuntimeExports.jsx("textarea",{name:l,...i,id:d,placeholder:r,rows:u})]}):n.jsxRuntimeExports.jsx("textarea",{id:d,name:l,...o,...i,...a,placeholder:r,rows:u})},Re={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:m.InputIcon,group:"form",props:{fieldName:e.g({title:"web_blocks.field_name",default:"textarea"}),showLabel:e.c({title:"web_blocks.show_label",default:!0}),styles:e.o({default:""}),inputStyles:e.o({default:"w-full p-1"}),label:e.g({title:"web_blocks.label",default:"Label"}),placeholder:e.g({title:"web_blocks.placeholder",default:"Placeholder"}),_rows:e.y({title:"web_blocks.rows",default:3})}},Le=t=>{const{blockProps:o,fieldName:l,label:s,styles:r,inputStyles:a,required:i,checked:u,showLabel:c=!0}=t,d=e.generateUUID();return c?n.jsxRuntimeExports.jsxs("div",{...r,...o,children:[n.jsxRuntimeExports.jsx("input",{...a,name:l,id:d,type:"checkbox",required:i,defaultChecked:u}),s&&s!=="Label"&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s})]}):n.jsxRuntimeExports.jsx("input",{id:d,...o,...a,...r,type:"checkbox",required:i,name:l})},Se={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:m.CheckboxIcon,group:"form",props:{fieldName:e.g({title:"Field Name",default:"checkbox"}),styles:e.o({default:"flex items-center gap-x-2"}),label:e.g({title:"web_blocks.label",default:"Label"}),checked:e.c({title:"web_blocks.checked",default:!1}),required:e.c({title:"web_blocks.required",default:!1})}},Me=()=>{p.registerChaiBlock(C,R),p.registerChaiBlock(P,$),p.registerChaiBlock(L,S),p.registerChaiBlock(N,q),p.registerChaiBlock(D,H),p.registerChaiBlock(z,A),p.registerChaiBlock(U,F),p.registerChaiBlock(O,V),p.registerChaiBlock(G,W),p.registerChaiBlock(X,Y),p.registerChaiBlock(Z,J),p.registerChaiBlock(K,Q),p.registerChaiBlock(ee,te),p.registerChaiBlock(oe,se),p.registerChaiBlock(M,T),p.registerChaiBlock(pe,be),p.registerChaiBlock(ke,ye),p.registerChaiBlock(xe,_e),p.registerChaiBlock(we,ve),p.registerChaiBlock(Le,Se),p.registerChaiBlock(je,Be),p.registerChaiBlock(Ee,Ie),p.registerChaiBlock(Ce,Re),p.registerChaiBlock(fe,he),p.registerChaiBlock(me,ge),p.registerChaiBlock(ne,ae),p.registerChaiBlock(ie,ce),p.registerChaiBlock(ue,de)};exports.loadWebBlocks=Me;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@chaibuilder/runtime"),n=require("./jsx-runtime-JYMCiFoE.cjs"),E=require("react"),e=require("./iconBase-vJD0OXxU.cjs");require("i18next");const m=require("@radix-ui/react-icons"),h=require("lodash-es");require("clsx");require("tailwind-merge");function B(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const l in t)if(l!=="default"){const s=Object.getOwnPropertyDescriptor(t,l);Object.defineProperty(o,l,s.get?s:{enumerable:!0,get:()=>t[l]})}}return o.default=t,Object.freeze(o)}const b=B(E),I=({className:t="",inBuilder:o})=>o?n.jsxRuntimeExports.jsx("div",{className:e.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",t),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:n.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,y=I,C=t=>{const{blockProps:o,inBuilder:l,backgroundImage:s,children:r,tag:a="div",styles:i}=t;let u=r;r||(u=n.jsxRuntimeExports.jsx(y,{inBuilder:l}));let c={};return s&&(c={backgroundImage:`url(${s})`}),b.createElement(a,{...o,...i,style:c},u)},R={type:"Box",label:"web_blocks.box",category:"core",group:"basic",props:{styles:e.o({default:""}),tag:e.f({title:"web_blocks.tag",default:"div",options:[{value:"div",title:"web_blocks.div"},{value:"header",title:"web_blocks.header"},{value:"footer",title:"web_blocks.footer"},{value:"section",title:"web_blocks.section"},{value:"article",title:"web_blocks.article"},{value:"aside",title:"web_blocks.aside"},{value:"main",title:"web_blocks.main"},{value:"nav",title:"web_blocks.nav"},{value:"figure",title:"web_blocks.figure"},{value:"details",title:"web_blocks.details"},{value:"summary",title:"web_blocks.summary"},{value:"dialog",title:"web_blocks.dialog"},{value:"strike",title:"web_blocks.strike"},{value:"caption",title:"web_blocks.caption"},{value:"legend",title:"web_blocks.legend"},{value:"figcaption",title:"web_blocks.figcaption"},{value:"mark",title:"web_blocks.mark"}]}),backgroundImage:e.v({title:"web_blocks.background_image"})},canAcceptBlock:()=>!0},L=t=>{const{blockProps:o,iconSize:l,icon:s,content:r,iconPos:a,styles:i,children:u}=t,c=s,d=u||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:r}),c&&n.jsxRuntimeExports.jsx("div",{style:{width:l+"px"},className:a+" "+(a==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:c}})]});return b.createElement("button",{...o,...i,type:"button"},d)},S={type:"Button",label:"web_blocks.button",category:"core",icon:m.ButtonIcon,group:"basic",props:{content:e.g({title:"web_blocks.label",default:"Button"}),styles:e.o({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:e.T({title:"web_blocks.icon",default:""}),iconSize:e.y({title:"web_blocks.icon_size",default:24}),iconPos:e.f({title:"web_blocks.icon_position",default:"order-last",options:[{title:"web_blocks.start",value:"order-first"},{title:"web_blocks.end",value:"order-last"}]})}},M=t=>{const{blockProps:o,styles:l,htmlCode:s,inBuilder:r}=t;return r?n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?n.jsxRuntimeExports.jsx("div",{...o,...l,className:"absolute z-20 h-full w-full"}):null,b.createElement("div",{...l,dangerouslySetInnerHTML:{__html:s.replace(/<script.*?>.*?<\/script>/g,"")}})]}):b.createElement("div",{...o,...l,dangerouslySetInnerHTML:{__html:s}})},N={type:"CustomHTML",label:"web_blocks.custom_html",category:"core",icon:m.CodeIcon,group:"advanced",props:{styles:e.o({default:""}),htmlCode:e.u({title:"web_blocks.html_code",default:"<div><p>Enter your HTML code here...</p></div>",placeholder:"web_blocks.placeholder"})}},T=b.memo(t=>{const{blockProps:o,styles:l}=t;return b.createElement("div",{...o,...l})}),P={type:"EmptyBox",label:"web_blocks.empty_box",category:"core",group:"basic",props:{styles:e.o({default:""})}},$=t=>{const{blockProps:o,styles:l,content:s,level:r="h1",children:a=null}=t;return a?b.createElement(r,{...l,...o},a):b.createElement(r,{...l,...o,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})},q={type:"Heading",label:"web_blocks.heading",category:"core",icon:m.HeadingIcon,group:"typography",props:{level:e.f({title:"web_blocks.level",default:"h2",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:e.o({default:"text-3xl"}),content:e.r({title:"web_blocks.content",default:"Heading goes here"})},canAcceptBlock:t=>t==="Span"||t==="Text"},H=t=>{const{blockProps:o,styles:l,content:s}=t;return h.isNull(t.children)?b.createElement("p",{...l,...o,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):b.createElement("p",{...l,...o},t.children)},D={type:"Paragraph",label:"web_blocks.paragraph",category:"core",icon:m.TextIcon,group:"typography",props:{styles:e.o({default:""}),content:e.r({title:"web_blocks.content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:t=>t==="Span"||t==="Link"||t==="Text"},z=t=>{const{blockProps:o,styles:l,content:s,children:r=null,tag:a}=t;return r?b.createElement("span",{...l,...o},r):b.createElement(a||"span",{...l,...o,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s}})},A={type:"Span",label:"web_blocks.span",category:"core",group:"typography",props:{styles:e.o({default:""}),content:e.r({title:"web_blocks.content",default:""})},canAcceptBlock:()=>!0},U=t=>{const{blockProps:o,content:l,styles:s}=t;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...o,...s,dangerouslySetInnerHTML:{__html:l}})})},F={type:"RichText",label:"web_blocks.richtext",category:"core",icon:m.CursorTextIcon,group:"typography",props:{styles:e.o({default:""}),content:e.b({title:"web_blocks.content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}},O=t=>{const{blockProps:o,link:l,children:s,styles:r,inBuilder:a,content:i}=t;return!s&&h.isEmpty(r==null?void 0:r.className)&&h.isEmpty(i)?n.jsxRuntimeExports.jsx(y,{inBuilder:a}):a?s?n.jsxRuntimeExports.jsx("span",{...o,...r,children:s}):b.createElement("span",{...o,...r,dangerouslySetInnerHTML:{__html:i}}):s?n.jsxRuntimeExports.jsx("a",{href:(l==null?void 0:l.href)||"#/",target:l==null?void 0:l.target,...o,...r,children:s}):b.createElement("a",{...o,...r,"data-ai-key":"content",href:(l==null?void 0:l.href)||"#",target:(l==null?void 0:l.target)||"_self",dangerouslySetInnerHTML:{__html:i}})},V={type:"Link",label:"web_blocks.link",category:"core",icon:m.Link1Icon,group:"basic",props:{styles:e.o({default:""}),content:e.g({title:"web_blocks.content",default:""}),link:e.q({title:"web_blocks.link",default:{type:"page",target:"_self",href:"#"}})},canAcceptBlock:t=>t!=="Link"},j=(t,...o)=>({...t,className:e.cn(t.className,...o)}),G=t=>{const{blockProps:o,children:l,styles:s,inBuilder:r,content:a,href:i}=t,{hrefType:u,autoplay:c,maxWidth:d,backdropColor:f,galleryName:g}=t,k=j(s,"cb-lightbox");if(!l&&h.isEmpty(s==null?void 0:s.className)&&h.isEmpty(a))return n.jsxRuntimeExports.jsx(y,{inBuilder:r});if(r)return l?n.jsxRuntimeExports.jsx("span",{...o,...k,children:l}):b.createElement("span",{...o,...k,dangerouslySetInnerHTML:{__html:a}});const x={};return x["data-vbtype"]=u,c&&(x["data-autoplay"]="true"),d&&(x["data-maxwidth"]=d+"px"),f&&(x["data-overlay"]=f),g&&(x["data-gall"]=g),l?n.jsxRuntimeExports.jsx("a",{...x,href:i||"#/",...o,...k,children:l}):b.createElement("a",{...o,...k,...x,href:i||"#",dangerouslySetInnerHTML:{__html:a}})},W={type:"LightBoxLink",label:"web_blocks.lightbox_link",category:"core",icon:m.ImageIcon,group:"basic",props:{styles:e.o({default:""}),content:e.g({title:"web_blocks.content",default:"Link text or drop blocks inside"}),href:e.g({title:"web_blocks.href",default:""}),hrefType:e.f({title:"web_blocks.type",default:"video",options:[{value:"video",title:"web_blocks.video"},{value:"iframe",title:"web_blocks.iframe"},{value:"inline",title:"web_blocks.inline"},{value:"ajax",title:"web_blocks.ajax"}]}),autoplay:e.c({title:"web_blocks.autoplay",default:!1}),maxWidth:e.y({title:"web_blocks.max_width",default:""}),backdropColor:e.g({title:"backdrop_color",default:""}),galleryName:e.g({title:"web_blocks.gallery_name",default:""})},canAcceptBlock:t=>t!=="Link"&&t!=="LightBoxLink"},X=t=>{const{blockProps:o,children:l,listType:s,styles:r,tag:a,inBuilder:i}=t,u=e.cn(h.get(r,"className",""),s);return!l&&h.isEmpty(r==null?void 0:r.className)?n.jsxRuntimeExports.jsx(y,{inBuilder:i}):b.createElement(a||(s==="list-decimal"?"ol":"ul"),{...o,...r,className:u},l)},Y={type:"List",label:"web_blocks.list",icon:m.RowsIcon,category:"core",group:"basic",props:{styles:e.o({default:""}),listType:e.f({title:"web_blocks.list_type",default:"list-none",options:[{value:"list-none",title:"web_blocks.none"},{value:"list-disc",title:"web_blocks.disc"},{value:"list-decimal",title:"web_blocks.number"}]})},canAcceptBlock:t=>t==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},Z=t=>{const{blockProps:o,content:l,styles:s,children:r,tag:a}=t;return r?b.createElement(a||"li",{...s,...o},r):b.createElement(a||"li",{...s,...o,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:l}})},J={type:"ListItem",label:"web_blocks.listitem",icon:m.ColumnsIcon,category:"core",group:"basic",props:{styles:e.o({default:""}),content:e.r({title:"web_blocks.content",default:"List item"})},canAcceptBlock:t=>t!=="ListItem",canBeNested:t=>t==="List"},K=t=>{const{blockProps:o,icon:l,styles:s,width:r,inBuilder:a,height:i}=t,u=j(s,e.cn(r?`w-[${r}px]`:"",i?`h-[${i}px]`:""));if(h.isEmpty(l))return n.jsxRuntimeExports.jsx(y,{inBuilder:a,className:"h-8 w-14"});const c=l.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return b.createElement("span",{...o,...u,dangerouslySetInnerHTML:{__html:c}})},Q={type:"Icon",label:"web_blocks.icon",category:"core",icon:m.SketchLogoIcon,group:"media",props:{styles:e.o({default:"text-black"}),icon:e.T({title:"web_blocks.icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'}),width:e.y({title:"web_blocks.width",default:""}),height:e.y({title:"web_blocks.height",default:""})}},ee=t=>{const{blockProps:o,image:l,styles:s,alt:r,height:a,width:i}=t;return h.isEmpty(l)?n.jsxRuntimeExports.jsx(y,{className:"h-36"}):b.createElement("img",{...o,...s,src:l,alt:r,loading:"lazy",height:a,width:i})},te={type:"Image",label:"web_blocks.image",category:"core",icon:m.ImageIcon,group:"media",props:{styles:e.o({default:""}),image:e.v({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:e.g({title:"web_blocks.alt",default:""}),width:e.g({title:"web_blocks.width",default:""}),height:e.g({title:"web_blocks.height",default:""})}},_=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,w=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,v=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,le=t=>{if(_.test(t)){const o=t.match(_);return o?`https://www.youtube.com/embed/${o[4]}`:t}if(w.test(t)){const o=t.match(w);return o?`https://player.vimeo.com/video/${o[3]}`:t}if(v.test(t)){const o=t.match(v);return o?`https://www.dailymotion.com/embed/video/${o[4]}`:t}return null},oe=b.memo(t=>{const{blockProps:o,inBuilder:l,styles:s,url:r,controls:a}=t,i=h.get(a,"autoPlay",!1),u=h.get(a,"controls",!1),c=i||h.get(a,"muted",!0),d=h.get(a,"loop",!1);if(h.isEmpty(r))return n.jsxRuntimeExports.jsx(y,{inBuilder:l,className:"h-36"});let f=le(r),g=null;if(f){if(!h.isEmpty(f)){const k=[];k.push(`autoplay=${i?1:0}`),k.push(`controls=${a?1:0}`),k.push(`mute=${c?1:0}&muted=${c?1:0}`),k.push(`loop=${d?1:0}`),f=`${f}?${k.join("&")}`}g=b.createElement("iframe",{...o,className:"absolute inset-0 w-full h-full",src:f,allow:l?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=b.createElement("video",{...o,className:"absolute inset-0 w-full h-full",src:r,controls:u,muted:c,autoPlay:l?!1:i,loop:d});return n.jsxRuntimeExports.jsx("div",{...h.pick(s,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[l?n.jsxRuntimeExports.jsx("div",{...o,...h.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})}),se={type:"Video",label:"web_blocks.video",category:"core",icon:m.VideoIcon,group:"media",props:{styles:e.o({default:""}),url:e.g({title:"web_blocks.video_url",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:e.h({title:"web_blocks.controls",properties:{autoPlay:e.c({title:"web_blocks.autoplay",default:!0}),controls:e.c({title:"web_blocks.controls",default:!1}),loop:e.c({title:"web_blocks.loop",default:!1}),muted:e.c({title:"web_blocks.muted",default:!0})}})}};function re(t){return e.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(t)}const ne=t=>{const{scripts:o,inBuilder:l,blockProps:s}=t;return l?n.jsxRuntimeExports.jsx("div",{...s,children:n.jsxRuntimeExports.jsx("div",{className:e.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:n.jsxRuntimeExports.jsx("p",{className:"text-left text-xs text-gray-400",children:"Scripts will be only executed in preview and live mode. Place your script at the bottom of the"})})})}):n.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},ae={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:re,group:"advanced",props:{scripts:e.u({title:"Script",default:"",placeholder:"<script>console.log('Hello, world!');<\/script>"})}},ie=t=>{const{blockProps:o,styles:l}=t;return b.createElement("hr",{...l,...o})},ce={type:"Divider",label:"web_blocks.divider",category:"core",icon:m.DividerHorizontalIcon,group:"basic",props:{styles:e.o({default:"bg-gray-900 h-0.5 py-2 my-1"})}},ue=()=>null,de={type:"Dark Mode",label:"web_blocks.dark_mode",category:"core",icon:m.MoonIcon,group:"advanced",props:{},blocks:()=>[{_id:"ultqCh",_type:"Span",tag:"span",styles:"#styles:,",_name:"Dark Mode Switcher"},{_id:"vroabi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'dark'","x-show":"darkMode === 'light'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Dark Mode Btn"},{_id:"eweibk",_parent:"vroabi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"nltBrv",_parent:"eweibk",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'></path></svg>"},{_id:"gesydi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Light Mode Btn"},{_id:"sgbhDo",_parent:"gesydi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"AdDwBC",_parent:"sgbhDo",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'></circle><path d='M12 2v2'></path><path d='M12 20v2'></path><path d='m4.93 4.93 1.41 1.41'></path><path d='m17.66 17.66 1.41 1.41'></path><path d='M2 12h2'></path><path d='M20 12h2'></path><path d='m6.34 17.66-1.41 1.41'></path><path d='m19.07 4.93-1.41 1.41'></path></svg>"}]},pe=t=>t.inBuilder||t.forceWrapper?n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...t.blockProps,children:t.content}):`${t.content}`,be={type:"Text",label:"web_blocks.text",hidden:!0,category:"core",group:"typography",icon:m.SpaceBetweenVerticallyIcon,props:{content:e.r({title:"web_blocks.content",defaultValue:""})}},me=t=>{const{blockProps:o,backgroundImage:l,children:s,styles:r}=t;let a={};return l&&(a={backgroundImage:`url(${l})`}),b.createElement("div",{...o,...r,style:a},s)},ge={type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:e.o({default:"font-body antialiased"}),backgroundImage:e.v({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},he=t=>{const{blockProps:o,styles:l}=t;return b.createElement("br",{...o,...l})},fe={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:m.SpaceBetweenVerticallyIcon,props:{styles:e.o({default:""})}},ke=t=>{const{blockProps:o,errorMessage:l,name:s,_type:r,successMessage:a,action:i,styles:u,children:c}=t;let d=c;c||(d=n.jsxRuntimeExports.jsx(y,{}));const f={"x-data":"useForm","x-on:submit.prevent":"post"},g={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return n.jsxRuntimeExports.jsxs("form",{...f,"data-error":l,"data-success":a,method:"post",action:i,...o,...u,children:[n.jsxRuntimeExports.jsx("div",{...g}),n.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:s||r}),d]})},ye={type:"Form",label:"web_blocks.form",category:"core",icon:m.GroupIcon,group:"form",props:{styles:e.o({default:""}),action:e.g({title:"web_blocks.submit_url",default:"/api/form/submit"}),errorMessage:e.b({title:"web_blocks.error_message",default:"Something went wrong. Please try again"}),successMessage:e.b({title:"web_blocks.success_message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0},xe=t=>{const{blockProps:o,inBuilder:l,label:s,styles:r,inputStyles:a,icon:i,iconPos:u}=t,c=e.generateUUID(),d={"x-bind:disabled":"formLoading"};return n.jsxRuntimeExports.jsxs("button",{id:c,...d,...a,...r,...o||{},type:l?"button":"submit",children:[s,i&&n.jsxRuntimeExports.jsx("span",{className:u,dangerouslySetInnerHTML:{__html:i}})]})},_e={type:"FormButton",label:"web_blocks.submit_button",category:"core",icon:m.ButtonIcon,group:"form",props:{label:e.g({title:"web_blocks.label",default:"Submit"}),styles:e.o({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:e.T({title:"Icon",default:""}),iconPos:e.f({title:"web_blocks.icon_position",default:"order-last",options:[{title:"web_blocks.start",value:"order-first"},{title:"web_blocks.end",value:"order-last"}]})}},we=t=>{const{blockProps:o,label:l,placeholder:s,styles:r,inputStyles:a,showLabel:i,required:u,inputType:c="text",inBuilder:d,fieldName:f}=t,g=e.generateUUID();return!i||c==="submit"?(c==="submit"&&(o.value=l),n.jsxRuntimeExports.jsx("input",{id:g,name:f,readOnly:d,...o,...a,...r,type:c,placeholder:s,required:u})):n.jsxRuntimeExports.jsxs("div",{...r,...o,children:[i&&n.jsxRuntimeExports.jsx("label",{htmlFor:g,children:l}),n.jsxRuntimeExports.jsx("input",{name:f,readOnly:d,...a,id:g,type:c,placeholder:s,required:u})]})},ve={type:"Input",label:"web_blocks.input",category:"core",icon:m.InputIcon,group:"form",props:{styles:e.o({default:""}),fieldName:e.g({title:"Field Name",default:"input"}),inputType:e.f({title:"web_blocks.type",options:h.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],t=>({value:t,title:t})),default:"text"}),value:e.g({title:"web_blocks.value",default:""}),showLabel:e.c({title:"web_blocks.show_label",default:!0}),inputStyles:e.o({default:"w-full p-1"}),label:e.g({title:"web_blocks.label",default:"Label"}),placeholder:e.g({title:"web_blocks.placeholder",default:"Placeholder"}),required:e.c({title:"web_blocks.required",default:!1})}},je=t=>{const{blockProps:o,fieldName:l,label:s,styles:r,inputStyles:a,checked:i,required:u,showLabel:c=!0}=t,d=e.generateUUID();return c?n.jsxRuntimeExports.jsxs("div",{...r,...o,children:[n.jsxRuntimeExports.jsx("input",{...a,name:l,id:d,type:"radio",required:u,defaultChecked:i}),s&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s})]}):n.jsxRuntimeExports.jsx("input",{id:d,...o,...a,...r,type:"radio",required:u,checked:i,name:l})},Ee={type:"Radio",label:"web_blocks.radio",category:"core",icon:m.RadiobuttonIcon,group:"form",props:{styles:e.o({default:"flex items-center w-max gap-x-2"}),fieldName:e.g({title:"web_blocks.field_name",default:"radio"}),label:e.g({title:"web_blocks.label",default:"Label"}),checked:e.c({title:"web_blocks.checked",default:!1}),required:e.c({title:"web_blocks.required",default:!1})}},Be=t=>{const{blockProps:o,fieldName:l,label:s,placeholder:r,styles:a,inputStyles:i,required:u,showLabel:c,_multiple:d=!1}=t,f=e.generateUUID();return c?n.jsxRuntimeExports.jsxs("div",{...a,children:[c&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:s}),n.jsxRuntimeExports.jsxs("select",{...i,id:f,required:u,multiple:d,name:l,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),h.map(t.options,g=>n.jsxRuntimeExports.jsx("option",{selected:h.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})]}):n.jsxRuntimeExports.jsxs("select",{id:f,...a,...o,required:u,multiple:d,name:l,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),h.map(t.options,g=>n.jsxRuntimeExports.jsx("option",{selected:h.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})},Ie={type:"Select",label:"web_blocks.select",category:"core",icon:m.DropdownMenuIcon,group:"form",props:{styles:e.o({default:""}),fieldName:e.g({title:"web_blocks.field_name",default:"select"}),showLabel:e.c({title:"web_blocks.show_label",default:!0}),inputStyles:e.o({default:"w-full p-1"}),label:e.g({title:"web_blocks.label",default:"Label"}),placeholder:e.g({title:"web_blocks.placeholder",default:"Placeholder"}),required:e.c({title:"web_blocks.required",default:!1}),_multiple:e.c({title:"web_blocks.multiple",default:!1}),options:e.S({title:"web_blocks.options",itemProperties:{label:e.g({title:"web_blocks.label",default:""}),value:e.g({title:"web_blocks.value",default:""})}})}},Ce=t=>{const{blockProps:o,fieldName:l,label:s,placeholder:r,styles:a,inputStyles:i,_rows:u,showLabel:c}=t,d=e.generateUUID();return c?n.jsxRuntimeExports.jsxs("div",{...a,...o,children:[c&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s}),n.jsxRuntimeExports.jsx("textarea",{name:l,...i,id:d,placeholder:r,rows:u})]}):n.jsxRuntimeExports.jsx("textarea",{id:d,name:l,...o,...i,...a,placeholder:r,rows:u})},Re={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:m.InputIcon,group:"form",props:{fieldName:e.g({title:"web_blocks.field_name",default:"textarea"}),showLabel:e.c({title:"web_blocks.show_label",default:!0}),styles:e.o({default:""}),inputStyles:e.o({default:"w-full p-1"}),label:e.g({title:"web_blocks.label",default:"Label"}),placeholder:e.g({title:"web_blocks.placeholder",default:"Placeholder"}),_rows:e.y({title:"web_blocks.rows",default:3})}},Le=t=>{const{blockProps:o,fieldName:l,label:s,styles:r,inputStyles:a,required:i,checked:u,showLabel:c=!0}=t,d=e.generateUUID();return c?n.jsxRuntimeExports.jsxs("div",{...r,...o,children:[n.jsxRuntimeExports.jsx("input",{...a,name:l,id:d,type:"checkbox",required:i,defaultChecked:u}),s&&s!=="Label"&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s})]}):n.jsxRuntimeExports.jsx("input",{id:d,...o,...a,...r,type:"checkbox",required:i,name:l})},Se={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:m.CheckboxIcon,group:"form",props:{fieldName:e.g({title:"Field Name",default:"checkbox"}),styles:e.o({default:"flex items-center gap-x-2"}),label:e.g({title:"web_blocks.label",default:"Label"}),checked:e.c({title:"web_blocks.checked",default:!1}),required:e.c({title:"web_blocks.required",default:!1})}},Me=()=>{p.registerChaiBlock(C,R),p.registerChaiBlock(T,P),p.registerChaiBlock(L,S),p.registerChaiBlock($,q),p.registerChaiBlock(H,D),p.registerChaiBlock(z,A),p.registerChaiBlock(U,F),p.registerChaiBlock(O,V),p.registerChaiBlock(G,W),p.registerChaiBlock(X,Y),p.registerChaiBlock(Z,J),p.registerChaiBlock(K,Q),p.registerChaiBlock(ee,te),p.registerChaiBlock(oe,se),p.registerChaiBlock(M,N),p.registerChaiBlock(pe,be),p.registerChaiBlock(ke,ye),p.registerChaiBlock(xe,_e),p.registerChaiBlock(we,ve),p.registerChaiBlock(Le,Se),p.registerChaiBlock(je,Ee),p.registerChaiBlock(Be,Ie),p.registerChaiBlock(Ce,Re),p.registerChaiBlock(he,fe),p.registerChaiBlock(me,ge),p.registerChaiBlock(ne,ae),p.registerChaiBlock(ie,ce),p.registerChaiBlock(ue,de)};exports.loadWebBlocks=Me;
|