@chaibuilder/sdk 1.1.14 → 1.1.15
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/BrandingOptions-TRVyCvVq.cjs +1 -0
- package/dist/{BrandingOptions-4qzTYdj5.js → BrandingOptions-zFJ28xmJ.js} +18 -19
- package/dist/{CanvasArea-U3egqewu.js → CanvasArea-IiD0f6Eq.js} +1 -1
- package/dist/{CanvasArea-4m1-c1yq.cjs → CanvasArea-Kbw-TjPH.cjs} +1 -1
- package/dist/{CurrentPage-zxrdTVsG.cjs → CurrentPage-lOQd17GA.cjs} +1 -1
- package/dist/{CurrentPage-spjJpQSM.js → CurrentPage-n2RQMBpJ.js} +1 -1
- package/dist/{Layers-QNAlCI4j.js → Layers-38kbAjTI.js} +1 -1
- package/dist/{Layers-YyBChBtg.cjs → Layers-D2WY0CpR.cjs} +1 -1
- package/dist/{PagesPanel-BeJrveus.cjs → PagesPanel-RWnIpNqP.cjs} +1 -1
- package/dist/{PagesPanel--LI-BoSj.js → PagesPanel-bNqfHuCk.js} +2 -2
- package/dist/{ProjectPanel-VNj0jXca.js → ProjectPanel-1Kgm2-R5.js} +2 -2
- package/dist/{ProjectPanel-MjcAymKT.cjs → ProjectPanel-cXKiyEXm.cjs} +1 -1
- package/dist/Settings-5AI0CInt.cjs +1 -0
- package/dist/{Settings-LZJwbkO6.js → Settings-ou3Owu0B.js} +40 -41
- package/dist/{SidePanels-_5oUp-eI.cjs → SidePanels-NV3UX8kK.cjs} +1 -1
- package/dist/{SidePanels-4lvmnnlw.js → SidePanels-muLqfBql.js} +2 -2
- package/dist/{add-page-modal-fZnKopNf.js → add-page-modal-AJorVipD.js} +6 -7
- package/dist/add-page-modal-zOdAgfvh.cjs +1 -0
- package/dist/controls-QnyBNkXG.cjs +36 -0
- package/dist/controls-kEuiMMDf.js +4600 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-fRoXPfhG.js → delete-page-modal-0VAs4Heb.js} +1 -1
- package/dist/{delete-page-modal-P_KKu12n.cjs → delete-page-modal-KRBGE4Fo.cjs} +1 -1
- package/dist/{index-CQz6j3ex.js → index-4fMl4eN2.js} +2 -2
- package/dist/{index-1Dr-VtaT.cjs → index-veRjBw4J.cjs} +1 -1
- package/dist/{page-viewer-_lc8vqU4.cjs → page-viewer-LvBMrQas.cjs} +1 -1
- package/dist/{page-viewer-39ZtxLzx.js → page-viewer-QuVbTBKO.js} +2 -2
- package/dist/{project-general-setting-CCVuGyHh.js → project-general-setting-6Nsq4-2Z.js} +7 -8
- package/dist/project-general-setting-pSrUGR7K.cjs +1 -0
- package/dist/{project-seo-setting-Wo7E46w7.js → project-seo-setting-EhqUcTKy.js} +7 -8
- package/dist/project-seo-setting-N0OnBCvh.cjs +1 -0
- package/dist/single-page-detail-JWCEEBaZ.cjs +1 -0
- package/dist/{single-page-detail-r1GJF00l.js → single-page-detail-SAqjZ5E1.js} +47 -48
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +1 -1
- package/package.json +2 -2
- package/dist/BrandingOptions-xBuqDpj0.cjs +0 -1
- package/dist/Settings-BrYkhn3H.cjs +0 -1
- package/dist/add-page-modal-rWhPuGd9.cjs +0 -1
- package/dist/controls-G0puEH71.js +0 -120
- package/dist/controls-aHZq-q4b.cjs +0 -1
- package/dist/project-general-setting-LEzDhwoq.cjs +0 -1
- package/dist/project-seo-setting-orwH-Ufg.cjs +0 -1
- package/dist/single-page-detail-jkDYF7lW.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-WUGKV8jN.cjs"),j=require("react"),B=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),g=require("./index-d55M5MRz.cjs"),r=require("./controls-QnyBNkXG.cjs"),m=require("./lodash-2us0VT8I.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");function R(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=R(j),N=({value:t,onChange:e,id:i,onBlur:a})=>{const d=m.debounce(e,200),c=n=>d(n.target.value);return l.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:l.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:l.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:n}})=>a(i,n),onChange:c})})})},y=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=g.useBuilderProp("onSaveBrandingOptions",async()=>{}),[e,i]=g.useBrandingOptions(),a=x.useRef(e);x.useEffect(()=>()=>{m.isEqual(e,a.current)||t(a.current)},[]);const d=({formData:o},s)=>{s&&(i(o),a.current=o)},{bodyFont:c,headingFont:n,primaryColor:f,bodyTextDarkColor:q,bodyTextLightColor:b,bodyBgDarkColor:h,secondaryColor:S,bodyBgLightColor:C,roundedCorners:O}=e,v={headingFont:r.Ty({title:"Heading font",default:n,options:y}),bodyFont:r.Ty({title:"Body font",default:c,options:y}),roundedCorners:r.my({title:"Rounded Corner",default:parseInt(O||5,10)}),primaryColor:r.Ey({title:"Primary",default:f}),secondaryColor:r.Ey({title:"Secondary",default:S}),bodyBgLightColor:r.Ey({title:"Body Background (Light)",default:C}),bodyBgDarkColor:r.Ey({title:"Body Background (Dark)",default:h}),bodyTextLightColor:r.Ey({title:"Body Text (Light)",default:q}),bodyTextDarkColor:r.Ey({title:"Body Text (Dark)",default:b})},u={type:"object",properties:{}},p={};return Object.keys(v).forEach(o=>{const s=v[o];return u.properties||(u.properties={}),u.properties[o]=s.schema,p[o]=s.uiSchema,!0}),l.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[l.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:l.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),l.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:l.jsxRuntimeExports.jsx(E,{widgets:{color:N},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:p,schema:u,formData:e,validator:B,onChange:d})})]})};exports.default=P;
|
|
@@ -3,7 +3,7 @@ import * as c from "react";
|
|
|
3
3
|
import O from "@rjsf/validator-ajv8";
|
|
4
4
|
import N from "@rjsf/core";
|
|
5
5
|
import { i as j, x as k } from "./index-0OqmBgqo.js";
|
|
6
|
-
import {
|
|
6
|
+
import { T as g, m as D, E as o } from "./controls-kEuiMMDf.js";
|
|
7
7
|
import { $ as P, X as R } from "./lodash-3gkdNK5u.js";
|
|
8
8
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
@@ -39,8 +39,7 @@ import "redux-undo";
|
|
|
39
39
|
import "@chaibuilder/runtime";
|
|
40
40
|
import "@react-hookz/web";
|
|
41
41
|
import "react-i18next";
|
|
42
|
-
|
|
43
|
-
const w = ({ value: s, onChange: e, id: u, onBlur: i }) => {
|
|
42
|
+
const T = ({ value: s, onChange: e, id: u, onBlur: i }) => {
|
|
44
43
|
const p = P(e, 200), d = (l) => p(l.target.value);
|
|
45
44
|
return /* @__PURE__ */ t.jsx("div", { className: "mt-1.5 flex items-center gap-x-3", children: /* @__PURE__ */ t.jsx("div", { className: "flex w-3/5 flex-col", children: /* @__PURE__ */ t.jsx(
|
|
46
45
|
"input",
|
|
@@ -108,14 +107,14 @@ const w = ({ value: s, onChange: e, id: u, onBlur: i }) => {
|
|
|
108
107
|
c.useEffect(() => () => {
|
|
109
108
|
R(e, i.current) || s(i.current);
|
|
110
109
|
}, []);
|
|
111
|
-
const p = ({ formData:
|
|
112
|
-
n && (u(
|
|
110
|
+
const p = ({ formData: a }, n) => {
|
|
111
|
+
n && (u(a), i.current = a);
|
|
113
112
|
}, {
|
|
114
113
|
bodyFont: d,
|
|
115
114
|
headingFont: l,
|
|
116
115
|
primaryColor: h,
|
|
117
|
-
bodyTextDarkColor:
|
|
118
|
-
bodyTextLightColor:
|
|
116
|
+
bodyTextDarkColor: y,
|
|
117
|
+
bodyTextLightColor: x,
|
|
119
118
|
bodyBgDarkColor: b,
|
|
120
119
|
secondaryColor: C,
|
|
121
120
|
bodyBgLightColor: S,
|
|
@@ -135,39 +134,39 @@ const w = ({ value: s, onChange: e, id: u, onBlur: i }) => {
|
|
|
135
134
|
title: "Rounded Corner",
|
|
136
135
|
default: parseInt(B || 5, 10)
|
|
137
136
|
}),
|
|
138
|
-
primaryColor:
|
|
139
|
-
secondaryColor:
|
|
140
|
-
bodyBgLightColor:
|
|
137
|
+
primaryColor: o({ title: "Primary", default: h }),
|
|
138
|
+
secondaryColor: o({ title: "Secondary", default: C }),
|
|
139
|
+
bodyBgLightColor: o({
|
|
141
140
|
title: "Body Background (Light)",
|
|
142
141
|
default: S
|
|
143
142
|
}),
|
|
144
|
-
bodyBgDarkColor:
|
|
143
|
+
bodyBgDarkColor: o({
|
|
145
144
|
title: "Body Background (Dark)",
|
|
146
145
|
default: b
|
|
147
146
|
}),
|
|
148
|
-
bodyTextLightColor:
|
|
147
|
+
bodyTextLightColor: o({
|
|
149
148
|
title: "Body Text (Light)",
|
|
150
|
-
default:
|
|
149
|
+
default: y
|
|
151
150
|
}),
|
|
152
|
-
bodyTextDarkColor:
|
|
151
|
+
bodyTextDarkColor: o({
|
|
153
152
|
title: "Body Text (Dark)",
|
|
154
|
-
default:
|
|
153
|
+
default: x
|
|
155
154
|
})
|
|
156
155
|
// TODO: exteend more options from user
|
|
157
156
|
}, r = {
|
|
158
157
|
type: "object",
|
|
159
158
|
properties: {}
|
|
160
159
|
}, v = {};
|
|
161
|
-
return Object.keys(m).forEach((
|
|
162
|
-
const n = m[
|
|
163
|
-
return r.properties || (r.properties = {}), r.properties[
|
|
160
|
+
return Object.keys(m).forEach((a) => {
|
|
161
|
+
const n = m[a];
|
|
162
|
+
return r.properties || (r.properties = {}), r.properties[a] = n.schema, v[a] = n.uiSchema, !0;
|
|
164
163
|
}), /* @__PURE__ */ t.jsxs("div", { className: "flex h-full select-none flex-col", children: [
|
|
165
164
|
/* @__PURE__ */ t.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ t.jsx("h1", { className: "px-1 font-semibold", children: "Branding Options" }) }),
|
|
166
165
|
/* @__PURE__ */ t.jsx("div", { className: "-mx-2", children: /* @__PURE__ */ t.jsx(
|
|
167
166
|
N,
|
|
168
167
|
{
|
|
169
168
|
widgets: {
|
|
170
|
-
color:
|
|
169
|
+
color: T
|
|
171
170
|
},
|
|
172
171
|
idSeparator: ".",
|
|
173
172
|
autoComplete: "off",
|
|
@@ -10,7 +10,7 @@ import { useTranslation as En } from "react-i18next";
|
|
|
10
10
|
import { useAtom as F } from "jotai";
|
|
11
11
|
import Pe from "react-dom";
|
|
12
12
|
import { g as Dn, S as Re, a as tt } from "./MODIFIERS-MLfpKQY1.js";
|
|
13
|
-
import { r as nt, u as Bn, B as On, E as An } from "./index-
|
|
13
|
+
import { r as nt, u as Bn, B as On, E as An } from "./index-4fMl4eN2.js";
|
|
14
14
|
import { Quill as Pn } from "react-quill";
|
|
15
15
|
import { u as Rn } from "./useAddBlockByDrop-5QW86HjG.js";
|
|
16
16
|
import { useFeature as rt } from "flagged";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var We=Object.defineProperty;var $e=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),h=require("./lodash-2us0VT8I.cjs"),L=require("@radix-ui/react-icons"),r=require("./index-d55M5MRz.cjs"),Ue=require("react-i18next"),H=require("jotai"),xe=require("react-dom"),Z=require("./MODIFIERS-WFzDQfiT.cjs"),Q=require("./index-
|
|
1
|
+
"use strict";var We=Object.defineProperty;var $e=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),h=require("./lodash-2us0VT8I.cjs"),L=require("@radix-ui/react-icons"),r=require("./index-d55M5MRz.cjs"),Ue=require("react-i18next"),H=require("jotai"),xe=require("react-dom"),Z=require("./MODIFIERS-WFzDQfiT.cjs"),Q=require("./index-veRjBw4J.cjs"),ze=require("react-quill"),Ye=require("./useAddBlockByDrop-Ckzuvu-s.cjs"),Se=require("flagged"),Ke=require("@floating-ui/dom"),ge=require("@floating-ui/react-dom"),Je=require("@react-hookz/web"),Xe=require("@bobthered/tailwindcss-palette-generator"),Ve=require("react-wrap-balancer"),Ze=require("tailwind-merge"),Ge=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("flat-to-nested");require("redux-undo");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");require("lucide-react");const Qe=()=>{const{undoCount:e,redoCount:t,undo:n,redo:a}=r.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{})}),s.jsxRuntimeExports.jsx(r.Button,{disabled:!t,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function et(){const[e,t]=r.useDarkMode(),{t:n}=Ue.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(r.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
|
|
2
2
|
relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[s.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),s.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
|
|
3
3
|
pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const me=({landscape:e=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),ye=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(L.MobileIcon,{}),width:400},{title:"Mobile landscape (SM)",content:"Styles set here are applied at 640px and up unless edited at higher breakpoint",breakpoint:"sm",icon:s.jsxRuntimeExports.jsx(L.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(me,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(me,{landscape:!0}),width:1024},{title:"Desktop (XL)",content:"Styles set here are applied at 1280px and up unless edited at higher breakpoint",breakpoint:"xl",icon:s.jsxRuntimeExports.jsx(L.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(L.DesktopIcon,{}),width:1920}],tt=({title:e,content:t,currentBreakpoint:n,breakpoint:a,width:c,icon:i,onClick:u})=>s.jsxRuntimeExports.jsxs(r.HoverCard,{children:[s.jsxRuntimeExports.jsx(r.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(r.Button,{onClick:()=>u(c),size:"sm",variant:a===n?"secondary":"ghost",children:i})}),s.jsxRuntimeExports.jsx(r.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:e}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),nt=()=>{const[,e,t]=r.useCanvasWidth(),[n,a]=r.useSelectedBreakpoints(),c=i=>{n.includes(i)?n.length>2&&a(n.filter(u=>u!==i)):a(u=>[...u,i])};return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[h.map(ye.filter(i=>h.includes(n,h.toUpper(i.breakpoint))),i=>m.createElement(tt,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(r.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(r.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(L.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(r.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(r.DropdownMenuLabel,{children:"Breakpoints"}),s.jsxRuntimeExports.jsx(r.DropdownMenuSeparator,{}),h.map(ye,i=>s.jsxRuntimeExports.jsx(r.DropdownMenuCheckboxItem,{disabled:i.breakpoint==="xs",onCheckedChange:()=>c(h.toUpper(i.breakpoint)),checked:h.includes(n,h.toUpper(i.breakpoint)),children:i.title},i.breakpoint))]})]})]})},st=()=>{const[e]=r.useSetAllBlocks(),{createSnapshot:t}=r.useCanvasHistory(),[,n]=r.useSelectedBlockIds(),[,a]=r.useSelectedStylingBlocks(),c=m.useCallback(()=>{e([]),n([]),a([]),t()},[e,t]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(r.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(L.EraserIcon,{})," Clear"]})}),s.jsxRuntimeExports.jsxs(r.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(r.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTitle,{children:"Clear whole canvas?"}),s.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),s.jsxRuntimeExports.jsxs(r.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogCancel,{children:"Cancel"}),s.jsxRuntimeExports.jsx(r.AlertDialogAction,{onClick:c,children:"Yes"})]})]})]})})},rt=()=>{const e=r.useFeatureSupport("darkMode",!1),[t]=r.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(et,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(nt,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[s.jsxRuntimeExports.jsx(L.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[h.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(Qe,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(st,{})]})]})},ot=`<!doctype html>
|
|
4
4
|
<html class="scroll-smooth h-full overflow-y-auto">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-d55M5MRz.cjs"),i=require("./lodash-2us0VT8I.cjs"),h=require("sonner"),l=require("react"),o=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-d55M5MRz.cjs"),i=require("./lodash-2us0VT8I.cjs"),h=require("sonner"),l=require("react"),o=require("./index-veRjBw4J.cjs"),j=require("lucide-react");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");const p=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:d}=s.useSavePage(),m=o.useChangePage(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const q=r=>{if(d!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});m(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:q,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
|
|
@@ -3,7 +3,7 @@ import { ag as x, aq as h, ar as f, as as j, at as y, au as P } from "./index-0O
|
|
|
3
3
|
import { q as v, b, g as w, a as m, j as n, u as C, d as N } from "./lodash-3gkdNK5u.js";
|
|
4
4
|
import { toast as S } from "sonner";
|
|
5
5
|
import { useEffect as p } from "react";
|
|
6
|
-
import { b as k, a as B, d as E, e as I } from "./index-
|
|
6
|
+
import { b as k, a as B, d as E, e as I } from "./index-4fMl4eN2.js";
|
|
7
7
|
import { BriefcaseIcon as L } from "lucide-react";
|
|
8
8
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
@@ -9,7 +9,7 @@ import { DatabaseIcon as Ge } from "lucide-react";
|
|
|
9
9
|
import { useMemo as $e, lazy as Ke, useCallback as Qe, useState as Ue, Suspense as Ye } from "react";
|
|
10
10
|
import { a as qe } from "./MODIFIERS-MLfpKQY1.js";
|
|
11
11
|
import { d as S } from "./utils-XsPKXMVo.js";
|
|
12
|
-
import { f as We } from "./index-
|
|
12
|
+
import { f as We } from "./index-4fMl4eN2.js";
|
|
13
13
|
import { useAtom as Ze } from "jotai";
|
|
14
14
|
import { u as Je } from "./useAddBlockByDrop-5QW86HjG.js";
|
|
15
15
|
import "@radix-ui/react-toggle";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("./lodash-2us0VT8I.cjs"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),N=require("react-i18next"),n=require("./index-d55M5MRz.cjs"),O=require("lucide-react"),R=require("react"),A=require("./MODIFIERS-WFzDQfiT.cjs"),q=require("./utils-37UXq2O5.cjs"),_=require("./index-1Dr-VtaT.cjs"),P=require("jotai"),H=require("./useAddBlockByDrop-Ckzuvu-s.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");const C=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(O.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function L(s=""){const r={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(c);if(u.nth(l,1))return`Visible >=${r[u.nth(l,1)]}`}return""}const F=s=>{let r="";return Object.keys(s).forEach(o=>{u.startsWith(s[o],A.STYLES_KEY)&&(r=s[o])}),r},V=s=>{var j;const[,r]=n.useHighlightBlockId(),[o]=n.useHiddenBlockIds(),{isSelected:i}=s,{id:c,data:l}=s.node,d=s.depth*10,m=a=>{a.stopPropagation(),s.onToggle(s.node.id)},E=y.useDragOver(c,s.isOpen,s.onToggle),p=R.useMemo(()=>{const a=F(s.node.data);return L(a)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>r(c),className:q.cn$1("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:a=>{a.stopPropagation(),!o.includes(c)&&s.onSelect(c)},onContextMenu:()=>s.onSelect(c),style:{paddingInlineStart:d},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:m,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(C,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((j=s.node.data)==null?void 0:j._name)||s.node.text}),p?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",p,")"]}):null]})]})})},$=s=>{var o;const{item:r}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(C,{type:(o=r==null?void 0:r.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:r.text})]})},z=s=>{const r=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:r}})},G=R.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-LXDkmFUr.cjs"))),K=()=>{const[s]=n.useSelectedBlockIds(),[,r]=n.useCutBlockIds();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},Q=()=>{const[s]=n.useSelectedBlockIds(),[,r]=n.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},U=()=>{const[s]=n.useSelectedBlockIds(),r=n.useRemoveBlocks(),o=n.useSelectedBlock();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},Y=({id:s=null,openMarkAsGlobalModal:r})=>{const[o]=n.useSelectedBlockIds(),i=n.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=n.usePasteBlocks(),d=n.useBuilderProp("globalBlocksSupport",!1),m=R.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(n.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(n.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:r,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(U,{})]})},W=({children:s,id:r=null})=>{const[o,i]=R.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(n.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(n.DialogContent,{children:e.jsxRuntimeExports.jsx(R.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(G,{closeModal:()=>i(!1),id:r})})})}),e.jsxRuntimeExports.jsxs(n.ContextMenu,{children:[e.jsxRuntimeExports.jsx(n.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(Y,{id:r,openMarkAsGlobalModal:()=>i(!0)})]})]})};function J(s){return u.map(s,r=>{const{data:o}=r;return{...o,_parent:r.parent===0?null:r.parent}})}const X=()=>{const s=n.useAllBlocks(),[r]=n.useSetAllBlocks(),[o,i,c]=n.useSelectedBlockIds(),[,l]=n.useSelectedStylingBlocks(),{t:d}=N.useTranslation(),{createSnapshot:m}=n.useCanvasHistory(),E=_.useExpandedIds(),p=H.useAddBlockByDrop(),[,j]=P.useAtom(n.addBlocksModalAtom),a=async(x,g)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:f}=g;if(h){m();const T=J(x);r(T);const M=f.getItem();i([M.id])}else await p({block:f.getItem(),dropTargetId:k,relativeIndex:b}),j(!1)},v=u.map(s,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(s,{_parent:x._id})),data:x})),S=()=>{i([]),l([])},[{isOver:I},w]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await p({block:x,dropTargetId:"",relativeIndex:0}),j(!1)))()}})),{isDragging:D}=B.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>S(),className:q.cn$1("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:u.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:w,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(n.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:v,rootId:0,render:(x,{depth:g,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(W,{id:x.id,children:e.jsxRuntimeExports.jsx(V,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:g,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx($,{monitorProps:x}),onDrop:a,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:n.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:g})=>e.jsxRuntimeExports.jsx(z,{node:x,depth:g})})})})})};exports.default=X;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("./lodash-2us0VT8I.cjs"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),N=require("react-i18next"),n=require("./index-d55M5MRz.cjs"),O=require("lucide-react"),R=require("react"),A=require("./MODIFIERS-WFzDQfiT.cjs"),q=require("./utils-37UXq2O5.cjs"),_=require("./index-veRjBw4J.cjs"),P=require("jotai"),H=require("./useAddBlockByDrop-Ckzuvu-s.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");const C=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(O.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function L(s=""){const r={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(c);if(u.nth(l,1))return`Visible >=${r[u.nth(l,1)]}`}return""}const F=s=>{let r="";return Object.keys(s).forEach(o=>{u.startsWith(s[o],A.STYLES_KEY)&&(r=s[o])}),r},V=s=>{var j;const[,r]=n.useHighlightBlockId(),[o]=n.useHiddenBlockIds(),{isSelected:i}=s,{id:c,data:l}=s.node,d=s.depth*10,m=a=>{a.stopPropagation(),s.onToggle(s.node.id)},E=y.useDragOver(c,s.isOpen,s.onToggle),p=R.useMemo(()=>{const a=F(s.node.data);return L(a)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>r(c),className:q.cn$1("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:a=>{a.stopPropagation(),!o.includes(c)&&s.onSelect(c)},onContextMenu:()=>s.onSelect(c),style:{paddingInlineStart:d},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:m,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(C,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((j=s.node.data)==null?void 0:j._name)||s.node.text}),p?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",p,")"]}):null]})]})})},$=s=>{var o;const{item:r}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(C,{type:(o=r==null?void 0:r.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:r.text})]})},z=s=>{const r=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:r}})},G=R.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-LXDkmFUr.cjs"))),K=()=>{const[s]=n.useSelectedBlockIds(),[,r]=n.useCutBlockIds();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},Q=()=>{const[s]=n.useSelectedBlockIds(),[,r]=n.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},U=()=>{const[s]=n.useSelectedBlockIds(),r=n.useRemoveBlocks(),o=n.useSelectedBlock();return e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},Y=({id:s=null,openMarkAsGlobalModal:r})=>{const[o]=n.useSelectedBlockIds(),i=n.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=n.usePasteBlocks(),d=n.useBuilderProp("globalBlocksSupport",!1),m=R.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(n.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(n.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:r,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsxs(n.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(U,{})]})},W=({children:s,id:r=null})=>{const[o,i]=R.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(n.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(n.DialogContent,{children:e.jsxRuntimeExports.jsx(R.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(G,{closeModal:()=>i(!1),id:r})})})}),e.jsxRuntimeExports.jsxs(n.ContextMenu,{children:[e.jsxRuntimeExports.jsx(n.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(Y,{id:r,openMarkAsGlobalModal:()=>i(!0)})]})]})};function J(s){return u.map(s,r=>{const{data:o}=r;return{...o,_parent:r.parent===0?null:r.parent}})}const X=()=>{const s=n.useAllBlocks(),[r]=n.useSetAllBlocks(),[o,i,c]=n.useSelectedBlockIds(),[,l]=n.useSelectedStylingBlocks(),{t:d}=N.useTranslation(),{createSnapshot:m}=n.useCanvasHistory(),E=_.useExpandedIds(),p=H.useAddBlockByDrop(),[,j]=P.useAtom(n.addBlocksModalAtom),a=async(x,g)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:f}=g;if(h){m();const T=J(x);r(T);const M=f.getItem();i([M.id])}else await p({block:f.getItem(),dropTargetId:k,relativeIndex:b}),j(!1)},v=u.map(s,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(s,{_parent:x._id})),data:x})),S=()=>{i([]),l([])},[{isOver:I},w]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await p({block:x,dropTargetId:"",relativeIndex:0}),j(!1)))()}})),{isDragging:D}=B.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>S(),className:q.cn$1("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:u.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:w,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(n.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:v,rootId:0,render:(x,{depth:g,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(W,{id:x.id,children:e.jsxRuntimeExports.jsx(V,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:g,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx($,{monitorProps:x}),onDrop:a,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:n.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:g})=>e.jsxRuntimeExports.jsx(z,{node:x,depth:g})})})})})};exports.default=X;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("react"),i=require("./lodash-2us0VT8I.cjs"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("react"),i=require("./lodash-2us0VT8I.cjs"),s=require("./index-veRjBw4J.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("i18next");require("react-i18next");require("./index-d55M5MRz.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");require("lucide-react");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-zOdAgfvh.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-LvBMrQas.cjs"))),d=()=>{const{data:t=[],isLoading:q}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(t,{type:"STATIC"}),o=>i.get(o,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(x,{isLoading:q,pages:n})})]})};exports.default=d;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-NV737rRe.js";
|
|
2
2
|
import i, { Suspense as s } from "react";
|
|
3
3
|
import { q as a, b as d, g as n } from "./lodash-3gkdNK5u.js";
|
|
4
|
-
import { a as l, b as c } from "./index-
|
|
4
|
+
import { a as l, b as c } from "./index-4fMl4eN2.js";
|
|
5
5
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
6
6
|
import "i18next";
|
|
7
7
|
import "react-i18next";
|
|
@@ -48,7 +48,7 @@ import "sonner";
|
|
|
48
48
|
import "./html-to-json-Y5M0N8PH.js";
|
|
49
49
|
import "himalaya";
|
|
50
50
|
import "lucide-react";
|
|
51
|
-
const x = i.lazy(() => import("./add-page-modal-
|
|
51
|
+
const x = i.lazy(() => import("./add-page-modal-AJorVipD.js")), g = i.lazy(() => import("./page-viewer-QuVbTBKO.js")), lt = () => {
|
|
52
52
|
const { data: o = [], isLoading: m } = l(), { data: r } = c(), p = a(d(o, { type: "STATIC" }), (e) => n(e, "uuid") === (r == null ? void 0 : r.homepage) ? 0 : 1);
|
|
53
53
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
54
54
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
|
|
@@ -2,7 +2,7 @@ import { j as t } from "./jsx-runtime-NV737rRe.js";
|
|
|
2
2
|
import a, { useRef as x, useEffect as m, Suspense as p } from "react";
|
|
3
3
|
import { X as b, a as j } from "./lodash-3gkdNK5u.js";
|
|
4
4
|
import { bh as h, bi as n, bj as l, bk as c } from "./index-0OqmBgqo.js";
|
|
5
|
-
import { c as f, b as g } from "./index-
|
|
5
|
+
import { c as f, b as g } from "./index-4fMl4eN2.js";
|
|
6
6
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
7
7
|
import "@radix-ui/react-toggle";
|
|
8
8
|
import "class-variance-authority";
|
|
@@ -48,7 +48,7 @@ import "sonner";
|
|
|
48
48
|
import "./html-to-json-Y5M0N8PH.js";
|
|
49
49
|
import "himalaya";
|
|
50
50
|
import "lucide-react";
|
|
51
|
-
const N = a.lazy(() => import("./project-general-setting-
|
|
51
|
+
const N = a.lazy(() => import("./project-general-setting-6Nsq4-2Z.js")), S = a.lazy(() => import("./project-seo-setting-EhqUcTKy.js")), d = /* @__PURE__ */ t.jsx("div", { className: "px-3", children: /* @__PURE__ */ t.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (e) => e && j(e.seoData) ? {
|
|
52
52
|
...e,
|
|
53
53
|
seoData: { title: "", description: "", image: "" }
|
|
54
54
|
} : e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),r=require("react"),x=require("./lodash-2us0VT8I.cjs"),s=require("./index-d55M5MRz.cjs"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),r=require("react"),x=require("./lodash-2us0VT8I.cjs"),s=require("./index-d55M5MRz.cjs"),a=require("./index-veRjBw4J.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");require("lucide-react");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-pSrUGR7K.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-N0OnBCvh.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function q(){const t=a.useUpdateProject(),{data:n}=a.useProject(),[i,o]=r.useState(l(n||{})),u=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(n,u.current)||t.mutate(u.current,{onSuccess:()=>o(u.current)})},[u]),r.useEffect(()=>{u.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:o})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(m,{_projectData:i,seany:o})})})]})]})})]})}exports.default=q;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var ae=Object.create;var U=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty;var ce=(s,n,r,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of pe(n))!xe.call(s,i)&&i!==r&&U(s,i,{get:()=>n[i],enumerable:!(l=ue(n,i))||l.enumerable});return s};var me=(s,n,r)=>(r=s!=null?ae(de(s)):{},ce(n||!s||!s.__esModule?U(r,"default",{value:s,enumerable:!0}):r,s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),W=require("@react-hookz/web"),t=require("./lodash-2us0VT8I.cjs"),te=require("react-i18next"),d=require("@radix-ui/react-icons"),o=require("./index-d55M5MRz.cjs"),ge=require("./controls-QnyBNkXG.cjs"),F=require("lucide-react"),Z=require("@chaibuilder/runtime"),O=require("./index-veRjBw4J.cjs"),he=require("@rjsf/core"),ye=require("@rjsf/validator-ajv8"),je=require("jotai"),be=require("react-autosuggest"),fe=require("fuse.js"),V=require("./utils-37UXq2O5.cjs"),ve=require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("i18next");require("clsx");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-aAZkA0f5.cjs");require("himalaya");require("tailwind-merge");function Re(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const l=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(n,r,l.get?l:{enumerable:!0,get:()=>s[r]})}}return n.default=s,Object.freeze(n)}const M=Re(m),Ee=m.lazy(()=>import("react-json-view"));function we(s){const n=[],r={};function l(i,a){t.forEach(a,(x,p)=>{const u=i?`${i}.${p}`:p,g=t.isArray(x)?"list":typeof x;n.push(u),r[u]=g==="string"?"text":g==="object"?"model":g,g==="object"&&!t.isArray(x)&&l(u,x)})}return l("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:n,pathsType:r}}const Y=({data:s,fullView:n})=>{if(!s)return null;const r=typeof s;return n?typeof s=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(O.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(Ee,{style:{maxHeight:"40vh",overflowY:"auto"},name:"Content",enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:s,collapsed:!0})})]}):e.jsxRuntimeExports.jsxs("div",{className:"text-gray-800/50 text-[12px] leading-4 w-full max-h-36 overflow-x-hidden overflow-y-auto",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),s]}):e.jsxRuntimeExports.jsx("div",{className:"text-[10px] text-gray-800/50 leading-3 whitespace-nowrap overflow-hidden w-full",children:t.truncate(r==="object"?JSON.stringify(s):s,{length:40})})},G=({type:s,value:n="",setValue:r,data:l,onChange:i,dataType:a,appliedBindings:x})=>{const{paths:p,pathsType:u}=we(l),g=s==="PROP"?Z.getBlockComponent(l==null?void 0:l._type):{},y=s==="PROP",[c,b]=m.useState(!1),j=m.useMemo(()=>s==="PROP"?p.filter(h=>!t.includes(x,h)&&t.get(g,`props.${t.head(t.split(h,"."))}.binding`)):p.filter(h=>a===t.get(u,h,"")),[s,p,x,a,g]);return m.useEffect(()=>{n&&i(n)},[n,s]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:t.startCase(t.toLower(s))}),e.jsxRuntimeExports.jsxs(o.Popover,{open:c,onOpenChange:b,children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(n)?"bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white w-44 justify-center":"min-w-[350px] justify-between items-center"}`,children:n?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"text-sm pr-8",children:[y&&e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 mr-2 rounded-full",children:t.startCase(a)}),n]}),e.jsxRuntimeExports.jsx("span",{className:"text-[9px] text-blue-400 underline cursor-pointer hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(s))]})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{className:"p-0 z-[999] min-w-[300px]",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(o.Command,{children:[e.jsxRuntimeExports.jsx(o.CommandInput,{placeholder:`Choose ${t.toLower(s)}...`}),e.jsxRuntimeExports.jsxs(o.CommandList,{children:[e.jsxRuntimeExports.jsx(o.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(o.CommandGroup,{children:t.map(j,h=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:h,className:`cursor-pointer ${y?"flex justify-between items-center":"flex flex-col items-start justify-start"}`,onSelect:v=>{r(t.find(j,C=>C===v)||null),b(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(F.Check,{className:`w-4 h-4 text-green-500 ${n===h?"":"opacity-0"}`}),h]}),y?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 rounded-full",children:t.startCase(t.get(u,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(Y,{data:t.get(l,h)})})]},h))})]})]})})]})]}),!y&&!t.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(Y,{data:t.get(l,n,""),fullView:!0})})]})},Ce=({appliedBindings:s=[],onAddBinding:n,editMode:r,item:l})=>{const[i,a]=m.useState(r?l.key:""),[x,p]=m.useState(r?l.value:""),u=o.useSelectedBlock(),[g]=O.useChaiExternalData(),y=m.useCallback((j,h)=>{if(t.isEmpty(j))return"";{const v=t.get(h==="PROP"?u:g,j,"");if(t.isArray(v))return"list";const C=typeof v;return C==="string"?"text":C==="object"?"model":C}},[u,g]),[c,b]=m.useState(r?y(l.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DialogHeader,{children:[e.jsxRuntimeExports.jsx(o.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx(o.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 relative",children:[e.jsxRuntimeExports.jsx(G,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:i,setValue:a,onChange:j=>{const h=y(j,"PROP");a(j),c!==h&&p(""),b(h)},data:u,dataType:c,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(G,{type:"PATH",isDisabled:t.isEmpty(i),placeholder:"Enter data path",value:x,setValue:p,onChange:j=>{const h=y(j,"PATH");p(c===h?j:"")},data:g,dataType:c,appliedBindings:s})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(i)&&t.isEmpty(x),onClick:()=>n({key:i,value:x}),children:"Save"})})]})},se=({disabled:s,children:n,onAddBinding:r,appliedBindings:l,editMode:i=!0,item:a={}})=>{const[x,p]=m.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{disabled:s,asChild:!0,onClick:()=>p(!0),children:n}),x&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(Ce,{item:a,editMode:i,appliedBindings:l,onAddBinding:u=>{r(u),p(!1)}})})]})},ke=({item:s,onAddBinding:n,onRemove:r,selectedBlock:l,dataProvider:i,appliedBindings:a})=>{const[x,p]=m.useState("string"),u=(g,y)=>{if(t.isEmpty(g))return"";{const c=t.get(y==="PROP"?l:i,g,"");if(t.isArray(c))return"list";const b=typeof c;return b==="string"?"text":b==="object"?"model":b}};return m.useEffect(()=>p(()=>u(s.key,"PROP")),[s.key]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col border border-gray-200 relative rounded-md p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-gray-500 font-normal text-sm",children:s.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:s.value}),e.jsxRuntimeExports.jsx(Y,{data:t.get(i,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(se,{editMode:!0,onAddBinding:n,appliedBindings:a,item:s,children:e.jsxRuntimeExports.jsx(F.EditIcon,{className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-blue-400 hover:text-white border-blue-400 p-1 text-blue-400 hover:scale-105 duration-200"})}),e.jsxRuntimeExports.jsx(F.TrashIcon,{onClick:()=>r(),className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-red-400 hover:text-white border-red-400 p-1 text-red-400 hover:scale-105 duration-200"})]}),!t.isEmpty(x)&&!t.isEmpty(s.key)&&e.jsxRuntimeExports.jsx("div",{className:"mt-px absolute right-0 top-1 text-purple-600 text-[10px] flex items-center font-medium h-4 px-2 rounded-full",children:t.startCase(x)})]})},Ne=({bindingData:s,onChange:n})=>{const r=o.useSelectedBlock(),[l]=O.useChaiExternalData(),i=Z.getChaiDataProviders(),[a,x]=m.useState(t.map(s,(c,b)=>({key:b,value:c})));m.useEffect(()=>{x(t.map(s,(c,b)=>({key:b,value:c})))},[r==null?void 0:r._id]);const p=m.useMemo(()=>{if(t.isEmpty(l))return!0;if(t.isEmpty(a))return!1;const c=t.last(a);return t.isEmpty(c==null?void 0:c.key)||t.isEmpty(c==null?void 0:c.value)},[l,a]),u=c=>{const b=t.filter(a,j=>j.key!==c.key);x([...b,c]),y([...b,c])},g=c=>{const b=t.filter(a,(j,h)=>c!==h);y([...b])},y=m.useCallback((c=[])=>{if(x(c),t.isEmpty(c)){n({});return}const b={};t.forEach(c,j=>{!t.isEmpty(j==null?void 0:j.key)&&!t.isEmpty(j==null?void 0:j.value)&&t.set(b,j.key,j.value)}),n(b)},[n]);return t.isEmpty(i)?e.jsxRuntimeExports.jsx("div",{className:"w-full flex items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(a,(c,b)=>e.jsxRuntimeExports.jsx(ke,{item:c,onAddBinding:u,onRemove:()=>g(b),selectedBlock:r,dataProvider:l,appliedBindings:t.map(a,"key")},c.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(se,{disabled:p,appliedBindings:t.map(a,"key"),onAddBinding:u,children:e.jsxRuntimeExports.jsx("span",{className:`w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${p?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(l)?e.jsxRuntimeExports.jsx("small",{className:"text-gray-500 text-[9.5px]",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),p&&e.jsxRuntimeExports.jsx(o.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(l)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},Se=()=>e.jsxRuntimeExports.jsx("div",{className:"text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100",children:"Data binding is set for this field"}),q=m.memo(({createHistorySnapshot:s,properties:n,formData:r,onChange:l})=>{const i={type:"object",properties:{}},a={};return Object.keys(n).forEach(x=>{const p=n[x];if(t.includes(["slot","styles"],p.type))return;const u=x;i.properties[u]=o.getBlockJSONFromSchemas(p),a[u]=o.getBlockJSONFromUISchemas(p)}),e.jsxRuntimeExports.jsx(he,{widgets:{binding:Se,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!0,validator:ye,uiSchema:a,onBlur:s,schema:i,formData:r,onChange:l})});function Te(){const s=o.useSelectedBlock(),{createSnapshot:n}=o.useCanvasHistory(),r=o.useUpdateBlocksPropsRealtime(),l=Z.getBlockComponent(s._type),i={...s},a=o.useBuilderProp("dataBindingSupport",!1),x=()=>n(),p=({formData:c},b)=>{if(b){const j=b.replace("root.","");r([s._id],{[j]:t.get(c,j)})}},u={_name:ge.Ry({title:"Name",default:t.get(s,"_name",s._type)})},g=t.keys(t.get(i,"_bindings",{})),y=m.useMemo(()=>{const c=t.cloneDeep(t.get(l,"props",{}));return a&&t.forEach(g,b=>delete c[b]),c},[l,g,a]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(q,{onChange:p,createHistorySnapshot:x,formData:i,properties:u}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),a?e.jsxRuntimeExports.jsxs(o.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(s,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"pt-4 px-4",children:e.jsxRuntimeExports.jsx(Ne,{bindingData:t.get(i,"_bindings",{}),onChange:c=>{p({formData:{...i,_bindings:c}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(o.AccordionContent,{className:"pt-4",children:[t.isEmpty(g)?"":e.jsxRuntimeExports.jsxs("div",{className:"text-xs mx-4 border rounded-sm p-1 mb-1 mt-0 border-orange-500 text-orange-500 bg-orange-100",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(g,t.capitalize).join(", ")})," ",g.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(q,{onChange:p,createHistorySnapshot:x,formData:i,properties:y})]})]})]}):e.jsxRuntimeExports.jsx(q,{onChange:p,createHistorySnapshot:x,formData:i,properties:y}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const K=new fe(V.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Ie(){var S;const[s]=o.useSelectedStylingBlocks(),n=o.useSelectedBlock(),r=o.useAddClassesToBlocks(),l=o.useRemoveClassesFromBlocks(),[i]=o.useSelectedBlockIds(),[a,x]=m.useState(""),p=(S=t.head(s))==null?void 0:S.prop,u=t.reject((t.get(n,p,"").replace(ve.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),g=()=>{const E=a.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(i,E,!0),x("")},[y,c]=m.useState([]),b=({value:E})=>{const B=E.trim().toLowerCase(),T=B.match(/.+:/g);let w=[];if(T&&T.length>0){const[I]=T,H=B.replace(I,"");w=K.search(H).map(f=>({...f,item:{...f.item,name:I+f.item.name}}))}else w=K.search(B);c(t.map(w,"item"))},j=()=>{c([])},h=E=>E.name,v=E=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:E.name}),C={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:a,onKeyDown:E=>{E.key==="Enter"&&a.trim()!==""&&g()},onChange:(E,{newValue:B})=>x(B),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"};return e.jsxRuntimeExports.jsxs("div",{className:`no-scrollbar flex ${y.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-5 overflow-y-auto bg-gray-100 px-px`,children:[e.jsxRuntimeExports.jsx(o.Label,{className:"mt-2",children:"Add Tailwind classes"}),e.jsxRuntimeExports.jsxs("div",{className:"relative -mt-4 flex items-center gap-x-3",children:[e.jsxRuntimeExports.jsx("div",{className:"relative flex w-full items-center gap-x-3",children:e.jsxRuntimeExports.jsx(be,{suggestions:y,onSuggestionsFetchRequested:b,onSuggestionsClearRequested:j,getSuggestionValue:h,renderSuggestion:v,inputProps:C,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"bg-gray-700 ",suggestionsContainerOpen:"absolute bg-gray-100 z-50 max-h-[230px] overflow-y-auto w-full border border-gray-600 rounded-md"}})}),e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:g,disabled:a.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(u)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-10 w-full items-center justify-center text-center text-sm text-gray-400",children:"No class added"}),M.Children.toArray(u.map(E=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",children:[E,e.jsxRuntimeExports.jsx(d.Cross2Icon,{onClick:()=>l(i,[E]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},E)))]})]})}const N=["px","%","em","rem","ch","vh","vw"],Be={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:N,property:"flexBasis"},{type:"range",label:"Order",property:"order"},{type:"dropdown",label:"Flex",property:"flexGrowShrink"},{type:"dropdown",label:"Grow",property:"flexGrow"},{type:"dropdown",label:"Shrink",property:"flexShrink"}]},Ae={heading:"Grid Child",items:[{type:"range",label:"Col Span",property:"gridColSpan"},{type:"range",label:"Col Start",property:"gridColStart"},{type:"range",label:"Col End",property:"gridColEnd"},{type:"range",label:"Row Span",property:"gridRowSpan"},{type:"range",label:"Row Start",property:"gridRowStart"},{type:"range",label:"Row End",property:"gridRowEnd"},{type:"range",label:"Order",property:"order"}]},He=[{heading:"Layout",items:[{type:"arbitrary",label:"Width",units:N.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:N.concat("auto"),property:"height"},{styleType:"multiple",label:"Margin",negative:!0,units:[...N,"auto"],options:[{key:"margin",label:"All"},{key:"marginX",label:"Left-Right"},{key:"marginY",label:"Top-Bottom"},{key:"marginTop",label:"Top"},{key:"marginRight",label:"Right"},{key:"marginBottom",label:"Bottom"},{key:"marginLeft",label:"Left"}]},{styleType:"multiple",label:"Padding",options:[{key:"padding",label:"All"},{key:"paddingX",label:"Left-Right"},{key:"paddingY",label:"Top-Bottom"},{key:"paddingTop",label:"Top"},{key:"paddingRight",label:"Right"},{key:"paddingBottom",label:"Bottom"},{key:"paddingLeft",label:"Left"}]},{styleType:"multiple",label:"Space Bt.",options:[{key:"spaceX",label:"Left-Right"},{key:"spaceY",label:"Top-Bottom"}]}]},{heading:"Size",items:[{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:N.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:N.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:N.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:N.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"Object options & aspect ratio",items:[{type:"dropdown",label:"Aspect",property:"aspectRatio"},{type:"dropdown",label:"Fit",property:"objectFit"},{type:"dropdown",label:"Position",property:"objectPosition"}]}]},{heading:"Display",items:[{type:"dropdown",label:"Display",property:"display",units:N},{styleType:"accordion",heading:"Flex options",items:[{type:"dropdown",label:"Direction",property:"flexDirection"},{type:"dropdown",label:"Wrap",property:"flexWrap"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"Grid options",items:[{type:"range",label:"Columns",property:"gridColumns"},{type:"range",label:"Rows",property:"gridRows"},{type:"dropdown",label:"Auto Flow",property:"gridAutoFlow"},{type:"dropdown",label:"Auto Cols",property:"gridAutoColumns"},{type:"dropdown",label:"Auto Rows",property:"gridAutoRows"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",units:["px","rem"],options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"Visibility & Opacity",items:[{type:"dropdown",label:"Visibility",property:"visibility",units:N},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Position",items:[{type:"icons",label:"Position",property:"position"},{styleType:"accordion",heading:"Position options",items:[{styleType:"multiple",label:"Direction",options:[{key:"top",label:"Top"},{key:"right",label:"Right"},{key:"bottom",label:"Bottom"},{key:"left",label:"Left"}]},{styleType:"multiple",label:"Inset",options:[{key:"inset",label:"All"},{key:"insetX",label:"Left Right"},{key:"insetY",label:"Top Bottom"}]},{type:"arbitrary",label:"Z-Index",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"Float & Clear",items:[{type:"icons",label:"Float",property:"float"},{type:"dropdown",label:"Clear",property:"clear"}]},{styleType:"accordion",heading:"Overflow & Overscroll",items:[{styleType:"multiple",type:"dropdown",label:"Overflow",options:[{key:"overflow",label:"All"},{key:"overflowX",label:"Left-Right"},{key:"overflowY",label:"Top-Bottom"}]},{styleType:"multiple",type:"dropdown",label:"Overscroll",options:[{key:"overscroll",label:"All"},{key:"overscrollX",label:"Left-Right"},{key:"overscrollY",label:"Top-Bottom"}]}]}]},{heading:"Typography",items:[{type:"dropdown",property:"fontFamily",label:"Font"},{type:"arbitrary",property:"fontSize",label:"Size",units:N},{type:"arbitrary",property:"lineHeight",label:"Height",units:N.concat("-")},{type:"range",property:"fontWeight",label:"Weight"},{type:"color",property:"textColor",label:"Color"},{styleType:"accordion",heading:"Alignments",items:[{type:"dropdown",property:"textAlign",label:"Align"},{type:"dropdown",property:"verticalAlign",label:"V. Align"}]},{styleType:"accordion",heading:"Spacing, decoration & more",items:[{type:"dropdown",property:"letterSpacing",label:"Spacing"},{type:"dropdown",property:"textDecoration",label:"Decoration"},{type:"range",property:"textDecorationThickness",label:"Thickness"},{type:"dropdown",property:"textTransform",label:"Transform"}]},{styleType:"accordion",heading:"White space & breaks",items:[{type:"dropdown",property:"whitespace",label:"Whitespace"},{type:"dropdown",property:"wordBreak",label:"Wordbreak"}]}]},{heading:"Background",items:[{type:"color",label:"Bg. Color",property:"backgroundColor"},{styleType:"accordion",heading:"Position, Size & more",items:[{type:"dropdown",label:"Attachment",property:"backgroundAttachment"},{type:"dropdown",label:"Clipping",property:"backgroundClip"},{type:"dropdown",label:"Origin",property:"backgroundOrigin"},{type:"dropdown",label:"Position",property:"backgroundPosition"},{type:"dropdown",label:"Repeat",property:"backgroundRepeat"},{type:"dropdown",label:"Size",property:"backgroundSize"}]},{type:"dropdown",label:"Gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"Gradient colors",items:[{type:"color",label:"From",property:"fromColor"},{type:"color",label:"Via",property:"viaColor"},{type:"color",label:"To",property:"toColor"}]}]},{heading:"Border & Outline",items:[{styleType:"multiple",type:"dropdown",label:"Width",options:[{key:"border",label:"All"},{key:"borderX",label:"Left Right"},{key:"borderY",label:"Top bottom"},{key:"borderTop",label:"Top"},{key:"borderRight",label:"Right"},{key:"borderBottom",label:"Bottom"},{key:"borderLeft",label:"Left"}]},{styleType:"multiple",type:"dropdown",label:"Corners",options:[{key:"borderRadius",label:"All"},{key:"borderRadiusTop",label:"Top"},{key:"borderRadiusRight",label:"Right"},{key:"borderRadiusBottom",label:"Bottom"},{key:"borderRadiusLeft",label:"Left"},{key:"borderRadiusTopLeft",label:"Top Left"},{key:"borderRadiusTopRight",label:"Top right"},{key:"borderRadiusBottomRight",label:"Bottom right"},{key:"borderRadiusBottomLeft",label:"Bottom left"}]},{type:"color",label:"Color",property:"borderColor"},{type:"dropdown",label:"Style",property:"borderStyle"},{styleType:"accordion",heading:"Divide options",items:[{styleType:"multiple",type:"range",label:"Width",options:[{key:"divideXWidth",label:"Left Right"},{key:"divideYWidth",label:"Top Bottom"}]},{type:"color",label:"Color",property:"divideColor"},{type:"dropdown",label:"Style",property:"divideStyle"}]},{styleType:"accordion",heading:"Outline styling",items:[{type:"range",label:"Width",property:"outlineWidth"},{type:"range",label:"Offset",property:"outlineOffset"},{type:"dropdown",label:"Style",property:"outlineStyle"}]},{styleType:"accordion",heading:"Ring options",items:[{type:"range",label:"Width",property:"ringWidth"},{type:"color",label:"Color",property:"ringColor"},{type:"range",label:"Offset",property:"ringOffsetWidth"},{type:"color",label:"Off. color",property:"ringOffsetColor"}]}]},{heading:"Effect & Animation",items:[{type:"range",label:"Shadow",property:"boxShadow"},{type:"color",label:"Color",property:"boxShadowColor"},{type:"dropdown",label:"Cursor",property:"cursor"},{styleType:"accordion",heading:"Blend & Cursor",items:[{type:"dropdown",label:"Mix Blend",property:"mixBlendMode"},{type:"dropdown",label:"Bg. Blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"Transform",items:[{type:"dropdown",label:"Origin",property:"transformOrigin"},{styleType:"multiple",label:"Scale",units:["-"],options:[{key:"scale",label:"All"},{key:"scaleX",label:"Left-Right"},{key:"scaleY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Skew",units:["deg"],options:[{key:"skewX",label:"Left-Right"},{key:"skewY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Translate",negative:!0,options:[{key:"translateX",label:"Left-Right"},{key:"translateY",label:"Top-Bottom"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"Rotate",property:"rotate"}]},{styleType:"accordion",heading:"Animation",items:[{type:"dropdown",label:"Animation",property:"animation"},{type:"dropdown",label:"Transition",property:"transition"},{type:"dropdown",label:"Easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"Duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"Delay",property:"delay"}]}]},{heading:"Classes",items:[{component:Ie}]}],re={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:d.EyeOpenIcon,invisible:d.EyeClosedIcon,hidden:d.EyeClosedIcon,gap:d.BorderAllIcon,gapX:d.WidthIcon,gapY:d.HeightIcon,spaceX:d.WidthIcon,spaceY:d.HeightIcon,overscroll:d.BorderAllIcon,overscrollX:d.WidthIcon,overscrollY:d.HeightIcon,overflow:d.BorderAllIcon,overflowX:d.WidthIcon,overflowY:d.HeightIcon,top:d.ArrowUpIcon,right:d.ArrowRightIcon,bottom:d.ArrowDownIcon,left:d.ArrowLeftIcon,inset:d.BorderAllIcon,insetX:d.WidthIcon,insetY:d.HeightIcon,border:d.BorderAllIcon,borderX:d.WidthIcon,borderY:d.HeightIcon,borderTop:d.ArrowUpIcon,borderRight:d.ArrowRightIcon,borderBottom:d.ArrowDownIcon,borderLeft:d.ArrowLeftIcon,borderRadius:d.BorderAllIcon,borderRadiusX:d.WidthIcon,borderRadiusY:d.HeightIcon,borderRadiusTop:d.ArrowUpIcon,borderRadiusRight:d.ArrowRightIcon,borderRadiusBottom:d.ArrowDownIcon,borderRadiusLeft:d.ArrowLeftIcon,borderRadiusTopLeft:d.ArrowTopLeftIcon,borderRadiusTopRight:d.ArrowTopRightIcon,borderRadiusBottomRight:d.ArrowBottomRightIcon,borderRadiusBottomLeft:d.ArrowBottomLeftIcon,divideXWidth:d.WidthIcon,divideYWidth:d.HeightIcon,scale:d.BorderAllIcon,scaleX:d.WidthIcon,scaleY:d.HeightIcon,skewX:d.WidthIcon,skewY:d.HeightIcon,translateX:d.WidthIcon,translateY:d.HeightIcon,padding:d.BorderAllIcon,paddingX:d.WidthIcon,paddingY:d.HeightIcon,paddingTop:d.ArrowUpIcon,paddingRight:d.ArrowRightIcon,paddingBottom:d.ArrowDownIcon,paddingLeft:d.ArrowLeftIcon,margin:d.BorderAllIcon,marginX:d.WidthIcon,marginY:d.HeightIcon,marginTop:d.ArrowUpIcon,marginRight:d.ArrowRightIcon,marginBottom:d.ArrowDownIcon,marginLeft:d.ArrowLeftIcon,textLeft:d.AlignLeftIcon,textCenter:d.AlignCenterHorizontallyIcon,textRight:d.AlignRightIcon,textJustify:d.StretchHorizontallyIcon,italic:d.FontItalicIcon,underline:d.UnderlineIcon,overline:d.OverlineIcon,uppercase:d.LetterCaseUppercaseIcon,block:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":d.Cross2Icon,fixed:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",fill:"currentColor"})]}),static:d.Cross1Icon},L=m.createContext({canReset:!1,canChange:!0}),Ve=({children:s,canReset:n=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx(L.Provider,{value:{canReset:n,canChange:r},children:s}),oe=({label:s,property:n,onChange:r})=>{const l=m.useMemo(()=>t.get(V.CLASSES_LIST,`${n}.classes`,[""]),[n]),i=P(n),a=m.useMemo(()=>t.get(i,"cls",""),[i]),{canChange:x}=m.useContext(L),p=/\[.*\]/g.test(a);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded ":"grow",children:p?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:a}),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(X,{rounded:s,onChange:u=>r(u,n),selected:a,options:l,disabled:!x})})};function X({selected:s,onChange:n,rounded:r=!1,options:l,disabled:i=!1}){const a=s.replace(/.*:/g,"").trim(),{undo:x,redo:p}=o.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!l.length||i,className:`${r?"rounded-md border border-border":"border-0"} w-full disable:bg-gray-500 h-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:u=>n(u.target.value),onKeyDown:u=>{u.ctrlKey&&(u.key==="z"&&x(),u.key==="y"&&p())},value:a,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),m.Children.toArray(l.map(u=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:u,children:u})))]})}const De=({property:s,onChange:n})=>{const{canReset:r,canChange:l}=m.useContext(L),i=P(s),a=m.useMemo(()=>t.get(i,"cls",""),[i]),x=m.useMemo(()=>t.get(V.CLASSES_LIST,`${s}.classes`,[""]),[s]),p=x.indexOf(a)>-1?x.indexOf(a):0,u=/\[.*\]/g.test(a);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:u?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:a}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!r||p-1<0),onClick:()=>n(t.nth(x,p-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.MinusIcon,{className:!l&&(!r||p-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(oe,{label:!1,property:s,onChange:n})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!r||p+1>=x.length),onClick:()=>n(t.nth(x,p+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{className:!l&&(!r||p+1>=x.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Le=({property:s,onChange:n})=>{const r=m.useMemo(()=>t.get(V.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:l}=m.useContext(L),i=P(s),a=m.useMemo(()=>t.get(i,"cls",""),[i]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(r,x=>e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!l,onClick:()=>n(x,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${a===x?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:m.createElement(t.get(re,x,d.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(x))})]}))})},Pe={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},$e=({property:s,onChange:n})=>{const r=P(s),l=m.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:i}=m.useContext(L),[a,x]=m.useState([]),[p,u]=m.useState({color:"",shade:""}),g=l.split("-"),y=t.get(g,"1",""),c=t.get(g,"2",""),b=m.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(x([]),u({color:h})):(x(["50","100","200","300","400","500","600","700","800","900"]),u(v=>({...v,color:h,shade:v.shade?v.shade:"500"})))},[x,u]);m.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(y))return x([]);x(["50","100","200","300","400","500","600","700","800","900"])},[y]);const j=m.useCallback(h=>{u({color:y,shade:h})},[y]);return m.useEffect(()=>{u({color:"",shade:""})},[r]),m.useEffect(()=>{const v=`${t.get(Pe,s,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;v.match(new RegExp(t.get(V.CLASSES_LIST,`${s}.regExp`,"")))&&n(v,s)},[p,n,s]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:e.jsxRuntimeExports.jsx(X,{disabled:!i,rounded:!0,selected:y,onChange:b,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(X,{rounded:!0,selected:c,disabled:!y||!i,onChange:j,options:a})})]})},J=(s,n)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&n.includes(r))return{value:"",unit:r};const l=n.length?new RegExp(n.join("|"),"g"):/XXXXXX/g;r=r.replace(l,"");const i=s.match(l),a=i&&i.length>1,x=!t.isEmpty(r)&&Number.isNaN(Number(r));return a||x?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:r,unit:i?i[0]:""}};const Me=s=>{const n=s.startsWith("-")?"-":"",r=s.split("-").pop();if(["auto","none"].includes(r))return{value:"",unit:r};if(r==="px")return{value:"1",unit:"px"};if(r==="screen")return{value:"100",unit:s.indexOf("w-")!==-1?"vw":"vh"};if(r==="full")return{value:"100",unit:"%"};if(t.includes(s,"skew-"))return{value:`${n}${r}`,unit:"deg"};if(t.includes(s,"rotate-"))return{value:`${n}${r}`,unit:"deg"};if(t.includes(s,"opacity-"))return{value:`${r/100}`,unit:"-"};if(t.includes(s,"duration-")||t.includes(s,"delay-"))return{value:`${r}`,unit:"ms"};if(t.includes(s,"translate-")&&!r.includes("/"))return{value:`${n}${`${r/4}`}`,unit:"rem"};if(t.includes(s,"scale-"))return{value:`${n}${`${r/100}`}`,unit:"-"};if(t.startsWith(s,"border")){const l=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(l)return{value:l[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(s,"max-w-")){if(s==="max-w-screen-sm")return{value:"640",unit:"px"};if(s==="max-w-screen-md")return{value:"768",unit:"px"};if(s==="max-w-screen-lg")return{value:"1024",unit:"px"};if(s==="max-w-screen-xl")return{value:"1280",unit:"px"};if(s==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(r==="xs")return{value:"320",unit:"px"};if(r==="sm")return{value:"384",unit:"px"};if(r==="md")return{value:"448",unit:"px"};if(r==="lg")return{value:"512",unit:"px"};if(r==="xl")return{value:"576",unit:"px"};if(r==="2xl")return{value:"672",unit:"px"};if(r==="3xl")return{value:"768",unit:"px"};if(r==="4xl")return{value:"896",unit:"px"};if(r==="5xl")return{value:"1024",unit:"px"};if(r==="6xl")return{value:"1152",unit:"px"};if(r==="7xl")return{value:"1280",unit:"px"};if(r==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(s,"text-")){if(r==="xs")return{value:"12",unit:"px"};if(r==="sm")return{value:"14",unit:"px"};if(r==="base")return{value:"16",unit:"px"};if(r==="lg")return{value:"18",unit:"px"};if(r==="xl")return{value:"20",unit:"px"};if(r==="2xl")return{value:"24",unit:"px"};if(r==="3xl")return{value:"30",unit:"px"};if(r==="4xl")return{value:"36",unit:"px"};if(r==="5xl")return{value:"48",unit:"px"};if(r==="6xl")return{value:"60",unit:"px"};if(r==="7xl")return{value:"72",unit:"px"};if(r==="8xl")return{value:"96",unit:"px"};if(r==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(s,"leading-")){if(r==="none")return{value:"1",unit:"-"};if(r==="tight")return{value:"1.25",unit:"-"};if(r==="snug")return{value:"1.375",unit:"-"};if(r==="normal")return{value:"1.5",unit:"-"};if(r==="relaxed")return{value:"1.625",unit:"-"};if(r==="loose")return{value:"2",unit:"-"}}if(t.startsWith(s,"tracking-")){if(r==="tighter")return{value:"-0.05",unit:"em"};if(r==="tight")return{value:"-0.025",unit:"em"};if(r==="normal")return{value:"0",unit:"em"};if(r==="wide")return{value:"0.025",unit:"em"};if(r==="wider")return{value:"0.05",unit:"em"};if(r==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(r))return{value:s,unit:"class"};if(r.includes("/")){const[l,i]=t.map(r.split("/"),a=>parseInt(a,10));return{value:n+(l/i*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${n+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}};const Oe=s=>{if(t.isEmpty(s))return{value:"",unit:""};const n=s.match(/\[.*\]/g);if(n===null)return qe(s);const r=t.get(n,"0","").replace(/\[|\]/g,""),l=s.startsWith("-")?"-":"",i=t.head(r.match(/\d+.\d+|\d+/g));return{value:`${l}${i}`,unit:r.replace(i,"")}},qe=s=>t.isEmpty(s)?{value:"",unit:""}:Me(s),ne=m.createContext({setDragData:()=>{}}),_e=({unit:s,currentValue:n,onDrag:r,onDragEnd:l,onDragStart:i,negative:a,cssProperty:x})=>{const{setDragData:p}=m.useContext(ne);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:u=>{const g={onDrag:r,onDragEnd:l,dragging:!0,dragStartY:u.pageY,dragStartValue:`${n}`,dragUnit:s,negative:a,cssProperty:x};i(g),p(g)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:e.jsxRuntimeExports.jsx(d.RowSpacingIcon,{})})},We=({onSelect:s,current:n,units:r})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:r.map(l=>e.jsxRuntimeExports.jsx(o.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:n===l?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),s(l)},children:l},l))}),Q=50,Fe=s=>{const[n,r]=m.useState(!1),[l,i]=m.useState(""),{currentClass:a,onChange:x,classPrefix:p,cssProperty:u,units:g,negative:y}=s,[c,b]=m.useState(u!=null&&u.toLowerCase().includes("width")?"%":g[0]),[j,h]=m.useState(!1),[v,C]=m.useState(""),[S,E]=m.useState(!1),[B,T]=m.useState(!1);m.useEffect(()=>{const{value:f,unit:R}=Oe(a);if(R===""){i(f),b(u!=null&&u.toLowerCase().includes("width")?"%":t.head(g));return}b(R),i(R==="class"||t.isEmpty(f)?"":f)},[a,u,g]);const w=W.useThrottledCallback(f=>x(f),[x],Q),I=W.useThrottledCallback(f=>x(f,!1),[x],Q),H=m.useCallback((f=!1)=>{const R=J(`${l}`,g);if(t.get(R,"error",!1)){h(!0);return}const k=t.get(R,"unit")!==""?t.get(R,"unit"):c;if(k==="auto"||k==="none"){w(`${p}${k}`);return}if(t.get(R,"value")==="")return;const D=`${t.get(R,"value","").startsWith("-")?"-":""}${p}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;f?I(D):w(D)},[w,I,l,c,p,g]),$=m.useCallback(f=>{const R=J(`${l}`,g);if(t.get(R,"error",!1)){h(!0);return}if(f==="auto"||f==="none"){w(`${p}${f}`);return}if(t.get(R,"value")==="")return;const k=t.get(R,"unit")!==""?t.get(R,"unit"):f,D=`${t.get(R,"value","").startsWith("-")?"-":""}${p}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;w(D)},[w,l,p,g]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:c==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:a}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${S?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(c)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:c==="class",onKeyPress:f=>{f.key==="Enter"&&H()},onKeyDown:f=>{if(f.keyCode!==38&&f.keyCode!==40)return;f.preventDefault(),T(!0);const R=t.parseInt(f.target.value);let k=t.isNaN(R)?0:R;f.keyCode===38&&(k+=1),f.keyCode===40&&(k-=1);const A=`${k}`,ie=`${A.startsWith("-")?"-":""}${p}[${A.replace("-","")}${c==="-"?"":c}]`;I(ie)},onKeyUp:f=>{B&&(f.preventDefault(),T(!1))},onBlur:()=>H(),onChange:f=>{h(!1),i(f.target.value)},onClick:f=>{var R;(R=f==null?void 0:f.target)==null||R.select(),r(!1)},value:S?v:l,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",j?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{open:n,delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!n),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${g.length===1?"px-2 font-semibold":""}`,children:c}),g.length>1?e.jsxRuntimeExports.jsx(d.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(o.TooltipPortal,{children:e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(We,{units:g,current:c,onSelect:f=>{r(!1),b(f),$(f)}})})})]})]}),["none","auto"].indexOf(c)!==-1||S?null:e.jsxRuntimeExports.jsx(_e,{onDragStart:()=>E(!0),onDragEnd:f=>{if(C(()=>""),E(!1),t.isEmpty(f))return;const R=`${f}`,A=`${R.startsWith("-")?"-":""}${p}[${R.replace("-","")}${c==="-"?"":c}]`;w(A)},onDrag:f=>{if(t.isEmpty(f))return;C(f);const R=`${f}`,A=`${R.startsWith("-")?"-":""}${p}[${R.replace("-","")}${c==="-"?"":c}]`;I(A)},currentValue:l,unit:c,negative:y,cssProperty:u})]})})})},P=s=>{const n=o.useSelectedBlockCurrentClasses();return t.findLast(n,{property:s})},Ye=(s,n)=>{const r={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return r[t.get(s,"mq","xs")]<=r[n]},Xe={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},ee={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Ze=s=>`${s.toUpperCase()} ${ee[s]?`(${ee[s]} & up)`:""}`,z=s=>{const{type:n="icons",label:r,property:l,onEmitChange:i=()=>{},units:a,negative:x=!1}=s,[p]=o.useDarkMode(),[u]=o.useStylingState(),[,g]=o.useCanvasWidth(),y=P(l),c=o.useAddClassesToBlocks(),b=o.useRemoveClassesFromBlocks(),[j]=o.useSelectedBlockIds(),h=m.useMemo(()=>t.get(y,"fullCls",""),[y]),v=m.useCallback((w,I=!0)=>{const H={dark:p,mq:g,mod:u,cls:w,property:l,fullCls:""};(p||u!=="")&&(H.mq="xs");const $=V.generateFullClsName(H);c(j,[$],I)},[j,p,g,u,l,c]),C=m.useCallback(()=>{b(j,[h])},[j,h,b]),S=m.useMemo(()=>Ye(y,g),[y,g]);m.useEffect(()=>{i(S,y)},[S,i,y]);const[,,E]=o.useCanvasWidth(),B=m.useCallback(w=>{E({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[w])},[E]),T=t.get(y,"dark",null)===p&&t.get(y,"mod",null)===u&&t.get(y,"mq",null)===g;return e.jsxRuntimeExports.jsx(Ve,{canChange:S,canReset:y&&T,children:e.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:e.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${y&&!T?"text-foreground":""}`,children:r})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[n==="arbitrary"?e.jsxRuntimeExports.jsx(Fe,{currentClass:t.get(y,"cls",""),classPrefix:t.get(Xe,l,""),units:a||[],onChange:v,negative:x,cssProperty:l}):null,n==="icons"&&e.jsxRuntimeExports.jsx(Le,{property:l,onChange:v}),n==="range"&&e.jsxRuntimeExports.jsx(De,{property:l,onChange:v}),n==="color"&&e.jsxRuntimeExports.jsx($e,{property:l,onChange:v}),n==="dropdown"&&e.jsxRuntimeExports.jsx(oe,{label:r,property:l,onChange:v})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${h?"visible":"invisible"}`,children:T?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>C(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(d.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):S&&y?e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("div",{className:"text-right",children:e.jsxRuntimeExports.jsxs("div",{children:["Current style is set at ",e.jsxRuntimeExports.jsxs("span",{className:"font-bold ",children:[Ze(t.get(y,"mq")),p&&!y.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>B(t.get(y,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(y,"mq").toUpperCase()]})]})})})]}):null})]})]})})},ze=["px","%","em","rem","ch","vh","vw"],le=({label:s,options:n,borderB:r=!1,borderT:l=!1,type:i="arbitrary",units:a=ze,negative:x=!1})=>{const[p,u]=m.useState(n[0].key),g=o.useSelectedBlockCurrentClasses(),y=m.useCallback(c=>t.map(g,"property").includes(c),[g]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${l?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:s}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:m.Children.toArray(n.map(({label:c,key:b})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>u(b),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${b===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[m.createElement("div",{className:y(b)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),m.createElement(t.get(re,b,d.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(c))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(z,{type:i,units:[...a],label:"",property:p,negative:x})})]})},Ue=({heading:s,items:n})=>{const r=o.useSelectedBlockCurrentClasses(),l=m.useMemo(()=>{const i=p=>t.flatten(p.map(u=>u.styleType==="multiple"?t.map(u.options,"key"):u.property)),a=t.flatten(n.map(p=>p.styleType==="accordion"?i(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),x=t.map(r,"property");return t.intersection(a,x).length>0},[r,n]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[s,l?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${l?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:n.map(i=>i.styleType==="multiple"?e.jsxRuntimeExports.jsx(le,{...i},i.label):e.jsxRuntimeExports.jsx(z,{...i},i.label))})]})},Ge=m.createContext({}),_=({section:s})=>{const n=o.useSelectedBlockCurrentClasses(),r=m.useCallback((a=[])=>{const x={};for(let u=0;u<n.length;u++)x[n[u].property]=n[u].cls;let p=!0;for(const u in a)if(!t.has(x,u)||x[u]!==a[u]){p=!1;break}return p},[n]),l=m.useMemo(()=>{if(n.length>0&&s.heading==="Classes")return!0;const a=u=>t.flatten(u.map(g=>g.styleType==="multiple"?t.flatten(t.map(g.options,"key")):g.property)),x=t.flatten(s.items.map(u=>u.styleType==="accordion"?a(u.items):u.styleType==="multiple"?t.flatten(t.map(u.options,"key")):u.property)),p=t.map(n,"property");return t.intersection(x,p).length>0},[n,s.heading,s.items]),i=m.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Ge.Provider,{value:i,children:e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${l?"bg-blue-500":"bg-gray-300"}`}),s.heading]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:m.Children.toArray(s.items.map(a=>t.has(a,"component")?m.createElement(a.component,{key:a.label}):t.has(a,"styleType")?a.styleType==="multiple"?e.jsxRuntimeExports.jsx(le,{...a},a.label):a.styleType==="accordion"&&r(a==null?void 0:a.conditions)?e.jsxRuntimeExports.jsx(Ue,{...a},a.label):null:e.jsxRuntimeExports.jsx(z,{...a},a.label)))})]})})},Ke=({item:s,index:n,canDelete:r,onChange:l,onRemove:i})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${r?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:a=>l(a,n),value:s.key,placeholder:"Key",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1.5",children:[e.jsxRuntimeExports.jsx("input",{name:"value",onChange:a=>t.isEmpty(s.key)?{}:l(a,n),value:s.value,placeholder:"Value",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsx(d.TrashIcon,{onClick:i,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),Je=({section:s})=>{var b;const{setSyncState:n}=o.useSavePage(),r=o.useSelectedBlock(),[l,i]=m.useState([]),[a]=o.useSelectedStylingBlocks(),x=o.useUpdateBlocksPropsRealtime(),p=`${t.get(a,"0.prop")}_attrs`;M.useEffect(()=>{const j=t.map(t.get(r,p),(h,v)=>({key:v,value:h}));t.isEmpty(j)?i([]):i(j)},[t.get(r,p)]);const u=()=>i([...l,{key:"",value:""}]),g=j=>{const h=t.filter(l,(v,C)=>j!==C);c(h)},y=(j,h)=>{const v=[...l];v[h][j.target.name]=j.target.value,c(v)},c=M.useCallback((j=[])=>{const h={};t.forEach(j,v=>{t.isEmpty(v.key)||t.set(h,v.key,v.value)}),x([t.get(r,"_id")],{[p]:h}),n("UNSAVED")},[r,n,x,p]);return e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,p))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsxs(o.Label,{className:"mt-2 flex w-full items-center justify-between",children:["Add Custom attributes",e.jsxRuntimeExports.jsxs("div",{className:`flex h-6 w-max items-center justify-center gap-x-0.5 rounded-full border p-1 px-2 text-xs ${!t.isEmpty(l)&&t.isEmpty((b=t.last(l))==null?void 0:b.key)?"cursor-not-allowed border-gray-400 text-gray-400":"cursor-pointer border-blue-400 text-blue-400 hover:bg-blue-400 hover:text-white"}`,onClick:()=>{var j;!t.isEmpty(l)&&t.isEmpty((j=t.last(l))==null?void 0:j.key)||u()},children:[e.jsxRuntimeExports.jsx(d.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(l)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),M.Children.toArray(t.map(l,(j,h)=>{const v=l.length>0&&h<l.length-1;return e.jsxRuntimeExports.jsx(Ke,{item:j,index:h,canDelete:v,onChange:y,onRemove:()=>g(h)})}))]})]})})]})};function Qe(){const[s,n]=o.useStylingState(),{flexChild:r,gridChild:l}=o.useSelectedBlocksDisplayChild(),[,i]=je.useAtom(o.advanceStylingOpenAtom),{t:a}=te.useTranslation(),[x]=o.useSelectedStylingBlocks();return t.isEmpty(x)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(d.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:a("no_styling_block_selected")}),e.jsxRuntimeExports.jsxs("p",{className:"text-xs ",children:["Hint: Styling allowed blocks are highlighted with"," ",e.jsxRuntimeExports.jsx("span",{className:"border border-orange-500 p-px",children:"orange"})," border"]})]})}):e.jsxRuntimeExports.jsxs("div",{onClick:()=>i(!1),className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-x-4 space-y-3 border-b h-12 border-border px-4 py-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-1.5",children:[e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(o.Select,{defaultValue:s,onValueChange:p=>n(p),children:[e.jsxRuntimeExports.jsx(o.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(o.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(o.SelectContent,{children:[e.jsxRuntimeExports.jsx(o.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsx(o.ScrollArea,{className:"no-scrollbar -mx-1 flex-1 max-h-full overflow-y-hidden overflow-x-hidden",children:e.jsxRuntimeExports.jsxs(o.Accordion,{defaultValue:["Layout"],type:"multiple",className:"w-full",children:[r&&e.jsxRuntimeExports.jsx(_,{section:Be}),l?e.jsxRuntimeExports.jsx(_,{section:Ae}):null,He.map(p=>e.jsxRuntimeExports.jsx(_,{section:p},p.heading)),e.jsxRuntimeExports.jsx(Je,{section:{heading:"Attributes"}})]})})]})}const et={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},tt=()=>{const s=o.useSelectedBlock(),{t:n}=te.useTranslation(),[r,l]=m.useState(""),[i,a]=m.useState({onDrag:u=>u,onDragEnd:u=>u,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),x=W.useThrottledCallback(u=>{const g=!t.get(i,"negative",!1),y=t.get(i,"cssProperty","");let c=parseFloat(i.dragStartValue);c=t.isNaN(c)?0:c;let b=et[i.dragUnit];(t.startsWith(y,"scale")||y==="opacity")&&(b=10);let h=(i.dragStartY-u.pageY)/b+c;g&&h<0&&(h=0),y==="opacity"&&h>1&&(h=1),i.onDrag(`${h}`),l(`${h}`)},[i],50),p=m.useCallback(()=>{setTimeout(()=>i.onDragEnd(`${r}`),100),a({onDrag:u=>u,onDragEnd:u=>u,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[i,r,a]);return t.isNull(s)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(d.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:n("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(O.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(ne.Provider,{value:{setDragData:a},children:[i.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:x,onMouseUp:()=>p(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10 "}):null,e.jsxRuntimeExports.jsxs(o.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(o.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"settings",children:"Settings"}),e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"styling",children:"Styling"})]}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"settings",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(o.ScrollArea,{className:"no-scrollbar -mx-1 pb-5 flex-1 max-h-full overflow-y-hidden overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Te,{})})}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"styling",className:"flex-1 h-full overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Qe,{})})]})]})})};exports.default=tt;
|