@billgangcom/theme-lib 1.42.0 → 1.43.0
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/builder.cjs.js +1 -1
- package/dist/builder.es.js +1 -1
- package/dist/ui/Link/index.d.ts +10 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +324 -308
- package/package.json +1 -1
package/dist/builder.cjs.js
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
`,n+=` --input-size: ${s.general.size}px;
|
|
45
45
|
`,n+=` --input-field-color: ${s.field.color};
|
|
46
46
|
`,n+=` --input-field-opacity: ${s.field.opacity/100};
|
|
47
|
-
`}return n+="}",n},ds=t=>{const o=document.getElementById("dynamic-styles");if(o)o.innerHTML=t;else{const n=document.createElement("style");n.id="dynamic-styles",n.innerHTML=t,document.head.appendChild(n)}};let Ae=new Set;const ps=t=>{const o=new Map;return Object.entries(t).forEach(([n,s])=>{typeof s=="object"&&Object.entries(s).forEach(([i,r])=>{var a;if(r&&r.font){const l=r.font.replace(/\s+/g,"+");o.has(l)||o.set(l,new Set),(a=o.get(l))==null||a.add(r.weight)}})}),o},ms=t=>{const o=new Map;return Object.entries(t).forEach(([n,s])=>{typeof s=="object"&&Object.keys(s).forEach(i=>{var r;if(i==="font"&&s[i]){const a=s[i].replace(/\s+/g,"+");o.has(a)||o.set(a,new Set),(r=o.get(a))==null||r.add("400")}})}),o},xs=t=>{Ae.forEach(o=>{if(!t.has(o)){const n=document.querySelector(`link[data-font="${o}"]`);n&&n.remove(),Ae.delete(o)}})},hs=t=>{const o=new Set;t.forEach((n,s)=>{const i=Array.from(n).join(";"),r=`${s}:wght@${i}`;if(o.add(r),!Ae.has(r)){const a=document.createElement("link");a.rel="stylesheet",a.href=`https://fonts.googleapis.com/css2?family=${r}&display=swap`,a.setAttribute("data-font",r),document.head.appendChild(a),Ae.add(r)}}),xs(o)},gs=t=>{if(t.fonts){const o=ps(t.fonts),n=ms(t.buttons),s=new Map(o);n.forEach((i,r)=>{if(s.has(r)){const a=s.get(r);i.forEach(l=>a==null?void 0:a.add(l))}else s.set(r,new Set(i))}),hs(s)}},js="_tooltip_1ch07_1",Ss="_fadeIn_1ch07_1",fs={tooltip:js,fadeIn:Ss},Se=t=>{const{text:o}=t,{setShowTooltip:n}=e.useTooltipStore();return j.useEffect(()=>(n(!0),()=>{n(!1)}),[]),e.jsxRuntimeExports.jsx("div",{className:fs.tooltip,children:o})},_s=()=>{const{undo:t,redo:o,past:n,future:s}=e.useHistoryStore(),[i,r]=j.useState(!1),[a,l]=j.useState(!1),[p,h]=j.useState(!1),[u,b]=j.useState(!1),[S,x]=j.useState(null);return j.useEffect(()=>{r(n.length===0)},[n]),j.useEffect(()=>{l(s.length===0)},[s]),e.jsxRuntimeExports.jsxs("div",{className:fe.buttons,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(fe.button,{[fe.disabled]:i}),onMouseEnter:()=>{const c=setTimeout(()=>{b(!0),h(!1)},200);x(c)},onMouseLeave:()=>{S&&clearTimeout(S),b(!1),h(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{i||t()},fill:i?"#757575":"#252525"}),u&&e.jsxRuntimeExports.jsx(Se,{text:i?"Nothing to undo":"Click to undo changes"})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(fe.button,{[fe.disabled]:a}),onMouseEnter:()=>{const c=setTimeout(()=>{h(!0),b(!1)},200);x(c)},onMouseLeave:()=>{S&&clearTimeout(S),h(!1),b(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||o()},fill:a?"#757575":"#252525"}),p&&e.jsxRuntimeExports.jsx(Se,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},bs="_devices_ls6k9_1",ws="_device_ls6k9_1",Cs="_active_ls6k9_27",Oe={devices:bs,device:ws,active:Cs},vs=()=>e.jsxRuntimeExports.jsx("div",{className:Oe.devices,children:_t.map(t=>e.jsxRuntimeExports.jsx(ks,{device:t}))}),ks=t=>{const{device:o}=t,{currentDevice:n,setCurrentDevice:s}=e.useDeviceStore(),[i,r]=j.useState(!1),[a,l]=j.useState(null);return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Oe.device,{[Oe.active]:n.value===o.value}),onClick:()=>s(o),onMouseEnter:()=>{const p=setTimeout(()=>{r(!0)},200);l(p)},onMouseLeave:()=>{a&&clearTimeout(a),r(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:o.icon,fill:n.value===o.value?"#252525":"#757575",width:20,height:20}),i&&e.jsxRuntimeExports.jsx(Se,{text:`Switch to ${o.value} view`})]},o.value)},Es="_header_2d8xd_1",Rs="_left_2d8xd_13",ys="_right_2d8xd_14",ve={header:Es,left:Rs,right:ys},Ls="_preview_1x3m8_2",Ts="_active_1x3m8_19",$e={preview:Ls,active:Ts},Bs=()=>{const{onPreview:t}=e.usePreviewStore(),[o,n]=j.useState(!1),[s,i]=j.useState(null);return e.jsxRuntimeExports.jsxs("a",{href:"/",className:e.clx($e.preview,{[$e.active]:t}),target:"_blank",onMouseEnter:()=>{const r=setTimeout(()=>{n(!0)},200);i(r)},onMouseLeave:()=>{s&&clearTimeout(s),n(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUpRight",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:$e.text,children:"Preview"}),o&&e.jsxRuntimeExports.jsx(Se,{text:"Open draft theme in new tab"})]})},Ns="_settings_u4cv4_1",As={settings:Ns},Ps="_pages_167qp_1",Is="_text_167qp_21",Ms="_modal_167qp_27",$s="_open_167qp_46",Fs="_page_167qp_1",Hs="_hoverable_167qp_61",Ds="_separator_167qp_65",Os="_button_167qp_70",Us="_items_167qp_85",K={pages:Ps,default:"_default_167qp_5",text:Is,modal:Ms,open:$s,page:Fs,hoverable:Hs,separator:Ds,button:Os,items:Us},qs=()=>{const{currentPage:t,setCurrentPage:o,setIsOpenModal:n,pages:s,setIsEdit:i,setEditedPage:r,deletePage:a,setIsOpenSelectModal:l}=e.usePagesStore(),{deletePage:p}=e.useLayersStore(),[h,u]=j.useState(null),{setTitle:b,setDescription:S,setOnConfirm:x}=e.useConfirmationModalStore(),[c,R]=j.useState(!1);return j.useEffect(()=>{const w=()=>{R(!1)};return document.body.addEventListener("click",w),()=>{document.body.removeEventListener("click",w)}},[]),j.useEffect(()=>{c?l(!0):setTimeout(()=>{l(!1)},300)},[c]),e.jsxRuntimeExports.jsxs("div",{className:K.pages,children:[e.jsxRuntimeExports.jsxs("div",{className:K.default,onClick:w=>{w.stopPropagation(),R(!c)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:s&&s[t]&&s[t].icon||"File",fill:"#252525",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:K.text,children:s&&s[t]&&Ne.includes(s[t].name)?`${ee(s[t].name)} page`:s&&s[t]&&s[t].name}),e.jsxRuntimeExports.jsx("div",{style:{transform:c?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretDown",width:20,height:20})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(K.modal,{[K.open]:c}),onClick:w=>w.stopPropagation(),children:[s&&e.jsxRuntimeExports.jsx("div",{className:K.items,children:Object.keys(s).map(w=>{const d=s[w];return e.jsxRuntimeExports.jsxs("div",{className:e.clx(K.page,{[K.hoverable]:h===w}),onMouseEnter:()=>u(w),onMouseLeave:()=>u(null),onClick:()=>{u(null),i(!1),o(w),R(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:d.icon,fill:"#252525"}),e.jsxRuntimeExports.jsx("span",{className:K.text,children:Ne.includes(d.name)?`${ee(d.name)} page`:d.name}),h===w&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Gear",fill:"#757575",onClick:k=>{k.stopPropagation(),i(!0),r(w),n(!0)}}),!Ne.includes(d.name)&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",onClick:k=>{k.stopPropagation(),b("Delete Page"),S(`Are you sure you want to delete ${d.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),x(()=>{k.stopPropagation(),s[t].name===d.name&&o("/"),a(w),p(d.name),e.deletePage(d.path)})}})]}),s[t]&&s[t].name===d.name&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"#FF3F19"})]},w)})}),e.jsxRuntimeExports.jsx("div",{className:K.separator}),e.jsxRuntimeExports.jsxs(e.Button,{className:K.button,onClick:w=>{w.stopPropagation(),n(!0)},size:"l",children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#ff3f19"}),e.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},zs="_zoom_1q1ud_1",Vs={zoom:zs},Gs=()=>{const[t,o]=j.useState(),n=()=>{o(Number(Math.round(window.devicePixelRatio*50).toFixed(0)))};return j.useEffect(()=>(n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}),[]),e.jsxRuntimeExports.jsxs("div",{className:Vs.zoom,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"MagnifyingGlassMinus",width:20,height:20}),e.jsxRuntimeExports.jsxs("span",{children:[t," %"]})]})},Ws=()=>e.jsxRuntimeExports.jsxs("div",{className:As.settings,children:[e.jsxRuntimeExports.jsx(qs,{}),e.jsxRuntimeExports.jsx(Gs,{})]}),Zs="_theme_1e5wq_1",Xs="_text_1e5wq_13",Qe={theme:Zs,text:Xs},Ys=()=>e.jsxRuntimeExports.jsx("div",{className:Qe.theme,children:e.jsxRuntimeExports.jsx("div",{className:Qe.text,children:"Live Theme"})}),Ks=({setIsLoading:t,isLoading:o})=>{const{themeSettings:n}=e.useThemeSettingsStore(),{settings:s}=e.useSettingsStore(),[i,r]=j.useState(null),[a,l]=j.useState(!1),{setNotification:p}=e.useNotificationStore(),{header:h,footer:u}=e.useLayersStore(),{pageContext:b}=e.usePagesStore(),{pages:S}=e.usePagesStore(),{blocks:x}=e.useLayersStore();function c(f,g){try{return g.map(_=>{if(!_.value||!_.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(_.value.blockSettings).filter(E=>E&&E.type===f).map(E=>{if(E.value===void 0)throw new Error("item.value is undefined.");return E.value}).flat()}).flat().filter(_=>_).map(_=>f==="ListingIds"?_.listingId:_)}catch(m){return console.error("Error in getValues function:",m),[]}}function R(f,g){return w(f,g)?b.reviews.length*3:0}function w(f,g){return g.map(_=>{if(!_.value||!_.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(_.value.blockSettings).filter(E=>E&&E.type===f).map(E=>{if(E.value===void 0)throw new Error("item.value is undefined.");return E.value}).flat()}).flat().filter(_=>_).length>0}function d(f){if(S){const g=Object.keys(S).find(m=>S[m].path===f);if(g)return S[g]}return null}const k=async()=>{if(a)i&&clearTimeout(i);else{t(!0);const g=Object.keys(x).map(_=>{const C=d(_);return x[_]&&x[_].data&&(C!=null&&C.path)?{name:C?C.name:_,path:C.path,layout:{...x[_]},neededProductIds:[...c("ProductId",Object.values(x[_].data))],neededCategoryIds:[...c("CategoryId",Object.values(x[_].data))],neededAnnouncementIds:[...c("AnnouncementId",Object.values(x[_].data))],neededListingIds:[...c("ListingIds",Object.values(x[_].data))],neededFaqIds:[...c("FaqsIds",Object.values(x[_].data))],neededReviewCount:R("ReviewCount",Object.values(x[_].data)),seo:{pageTitle:C&&C.seo&&C.seo.title?C.seo.title:"",pageDescription:C&&C.seo&&C.seo.description?C.seo.description:""}}:null}).filter(_=>_),{status:m}=await e.updateSettings("post","save",{themeSettings:n,settings:{settings:s,header:h,footer:u},updatedPages:g});p({message:m===200?"Settings saved":"Error",status:m===200?"success":"error"}),t(!1)}l(!0);const f=setTimeout(()=>{l(!1)},2e3);r(f)};return e.jsxRuntimeExports.jsx(e.Button,{onClick:k,disabled:o,children:"Save"})},Qs=()=>{const{isOpenSelectModal:t}=e.usePagesStore(),[o,n]=j.useState(!1),{showTooltip:s}=e.useTooltipStore();return e.jsxRuntimeExports.jsxs("div",{className:ve.header,style:{zIndex:t?5e4:s?501:50},children:[e.jsxRuntimeExports.jsxs("div",{className:ve.left,children:[e.jsxRuntimeExports.jsx(vs,{}),e.jsxRuntimeExports.jsx(Bs,{})]}),e.jsxRuntimeExports.jsx("div",{className:ve.center,children:e.jsxRuntimeExports.jsx(Ws,{})}),e.jsxRuntimeExports.jsxs("div",{className:ve.right,children:[e.jsxRuntimeExports.jsx(Ys,{}),e.jsxRuntimeExports.jsx(_s,{}),e.jsxRuntimeExports.jsx(Ks,{setIsLoading:n,isLoading:o}),o&&e.jsxRuntimeExports.jsx(e.Loader,{})]})]})},Js="_exit_1lmsz_1",eo="_text_1lmsz_11",to="_exitLink_1lmsz_16",Fe={exit:Js,text:eo,exitLink:to},so=()=>e.jsxRuntimeExports.jsx("div",{className:Fe.exit,children:e.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:Fe.exitLink,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"SignOut",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Fe.text,children:"Exit"})]})}),oo="_navbar_1podc_1",no="_main_1podc_6",ro="_block_1podc_13",io="_active_1podc_29",ke={navbar:oo,main:no,block:ro,active:io},ao=()=>{const{activeBlock:t}=e.useNavbarStore(),{setActiveBlock:o}=e.useBlocksStore(),{setCurrentBlock:n}=e.useLayersStore(),{setActiveBlock:s}=e.useThemeSettingsStore(),i=e.useNavigate();function r(a){switch(o(null),n(null),s(null),a.name){case"Layers":i("/admin/builder");break;case"Add":i("/admin/builder/add");break;case"Theme":i("/admin/builder/theme");break;case"Settings":i("/admin/builder/settings");break}}return e.jsxRuntimeExports.jsxs("div",{className:ke.navbar,children:[e.jsxRuntimeExports.jsx(so,{}),e.jsxRuntimeExports.jsx("div",{className:ke.main,children:e.navbarBlocks.map(a=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(ke.block,{[ke.active]:t.icon===a.icon}),onClick:()=>r(a),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:a.icon,fill:t.icon===a.icon?"#252525":"#757575"}),e.jsxRuntimeExports.jsx("span",{children:a.name})]},a.icon))})]})},lo="_preview_186z3_1",co="_main_186z3_15",uo="_content_186z3_26",po="_loading_186z3_33",mo="_loader_186z3_43",xo="_spin_186z3_1",Ee={preview:lo,main:co,content:uo,loading:po,loader:mo,spin:xo},ho="_header_lk0ru_2",go="_circles_lk0ru_17",jo="_circle_lk0ru_17",So="_red_lk0ru_33",fo="_green_lk0ru_37",_o="_yellow_lk0ru_41",bo="_input_lk0ru_45",wo="_main_lk0ru_56",Co="_text_lk0ru_64",oe={header:ho,circles:go,circle:jo,red:So,green:fo,yellow:_o,input:bo,main:wo,text:Co},vo=["red","yellow","green"],ko=()=>{const{currentDevice:t}=e.useDeviceStore(),o=(i,r)=>i.length>r?i.slice(0,r)+"...":i,{notification:n,setNotification:s}=e.useNotificationStore();return e.jsxRuntimeExports.jsxs("div",{className:oe.header,children:[e.jsxRuntimeExports.jsx("div",{className:oe.circles,children:vo.map(i=>e.jsxRuntimeExports.jsx("div",{className:e.clx(oe.circle,{[oe.red]:i==="red",[oe.yellow]:i==="yellow",[oe.green]:i==="green"})},i))}),e.jsxRuntimeExports.jsx("div",{className:oe.input,children:e.jsxRuntimeExports.jsxs("div",{className:oe.main,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),e.jsxRuntimeExports.jsx("span",{className:oe.text,children:t.value==="mobile"?o(window.location.origin,40):t.value==="desktop"?o(window.location.origin,200):o(window.location.origin,100)})]})}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),s({status:"success",message:"Domain copied to clipboard"})},children:e.jsxRuntimeExports.jsx(e.Icon,{name:n?"Check":"Copy",width:20,height:20,fill:"#252525"})})]})},Eo="_content_cjgr7_1",Ro="_main_cjgr7_9",yo="_block_cjgr7_13",Lo="_active_cjgr7_20",To="_name_cjgr7_24",Bo="_empty_cjgr7_38",No="_icon_cjgr7_49",Ao="_title_cjgr7_62",Po="_text_cjgr7_68",Io="_sections_cjgr7_74",Mo="_section_cjgr7_74",$o="_addSection_cjgr7_99",Fo="_addSectionTop_cjgr7_107",ie={content:Eo,main:Ro,block:yo,active:Lo,name:To,empty:Bo,icon:No,title:Ao,text:Po,sections:Io,section:Mo,addSection:$o,addSectionTop:Fo},Ho="_sidebar_xhqpt_1",Do="_content_xhqpt_14",Oo="_button_xhqpt_24",Uo="_moveButton_xhqpt_40",qo="_border_xhqpt_44",zo="_deleteButton_xhqpt_49",te={sidebar:Ho,content:Do,button:Oo,moveButton:Uo,border:qo,deleteButton:zo},Vo=()=>{var k;const{activeBlock:t}=e.usePreviewStore(),{blocks:o,removeBlock:n,moveBlock:s,duplicateBlock:i}=e.useLayersStore(),{currentPage:r,pages:a}=e.usePagesStore(),{setTitle:l,setDescription:p,setOnConfirm:h}=e.useConfirmationModalStore(),u=(k=a==null?void 0:a[r])==null?void 0:k.path,b=u?o[u]:null,S=(b==null?void 0:b.order)||[],x=S.indexOf(t),c=()=>{x>0&&u&&s(u,x,x-1)},R=()=>{x<S.length-1&&u&&s(u,x,x+1)},w=()=>{u&&i(u,t)},d=()=>{u&&n(u,t)};return e.jsxRuntimeExports.jsx("div",{className:te.sidebar,children:e.jsxRuntimeExports.jsxs("div",{className:te.content,children:[e.jsxRuntimeExports.jsx("button",{onClick:c,className:e.clx(te.button,te.moveButton),disabled:x===0,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUp"})}),e.jsxRuntimeExports.jsx("button",{onClick:R,className:e.clx(te.button,te.moveButton),disabled:x===S.length-1,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowDown"})}),e.jsxRuntimeExports.jsx("button",{onClick:w,className:e.clx(te.button,te.moveButton),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})}),e.jsxRuntimeExports.jsx("button",{className:e.clx(te.button,te.deleteButton),onClick:f=>{f.stopPropagation(),l("Remove Block"),p(`Are you sure you want to delete ${(b==null?void 0:b.data[t].name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),h(d)},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]})})},Go=j.memo(()=>{const{setActiveBlock:t,activeBlock:o}=e.usePreviewStore(),{blocks:n,sourceBlocks:s}=e.useBlocksStore(),{blocks:i,setCurrentBlock:r,currentBlock:a,setPositionBlock:l}=e.useLayersStore(),{settings:p}=e.useSettingsStore(),{currentPage:h,pages:u,setIsOpenSelectModal:b,pageContext:S}=e.usePagesStore(),{activeBlock:x,setActiveBlock:c}=e.useThemeSettingsStore(),{setError:R}=e.useErrorStore(),w=j.useRef(o),d=e.useNavigate();j.useEffect(()=>{w.current=o},[o]),j.useEffect(()=>{const g=()=>{w.current&&(t(null),r(null))};return document.body.addEventListener("click",g),()=>{document.body.removeEventListener("click",g)}},[]);const k=g=>{if(!g||!g.name)return R({message:"Block or block.name is undefined.",failedSettings:!1,failedThemeSettings:!1,failedPageIds:u&&u[h].id?[u[h].id]:[]}),d("/error"),e.jsxRuntimeExports.jsx(je,{error:"Block or block.name is undefined."});if(!n||!n[g.name])return R({message:'Block "${block.name}" does not exist in blocks.',failedSettings:!1,failedThemeSettings:!1,failedPageIds:u&&u[h].id?[u[h].id]:[]}),d("/error"),e.jsxRuntimeExports.jsx(je,{error:`Block "${g.name}" does not exist in blocks.`});const m=new n[g.name];return g.value&&Object.assign(m,g.value),m.renderBlock(p,S)};function f(g){if(!s||!s[g])return"unknown name";const m=new s[g];return!m.blockSettings||!m.blockSettings.displayName?"unknown name":m.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{onClick:g=>{g.stopPropagation(),b(!1)},className:ie.content,children:[e.jsxRuntimeExports.jsx(ze,{}),e.jsxRuntimeExports.jsx("div",{className:ie.main,children:u&&u[h]&&i[u[h].path]&&i[u[h].path].data&&i[u[h].path].order.map(g=>e.jsxRuntimeExports.jsxs("div",{onClick:m=>{m.stopPropagation(),x&&c(null),o?(t(null),setTimeout(()=>{t(g)},100)):t(g),a?(r(null),setTimeout(()=>{r(g)},100)):r(g)},onMouseEnter:m=>{m.stopPropagation(),t(g)},onMouseLeave:m=>{m.stopPropagation(),t(null)},className:e.clx(ie.block,{[ie.active]:o===g}),children:[o===g&&e.jsxRuntimeExports.jsx("div",{className:ie.name,children:f(i[u[h].path].data[g].name)}),o===g&&f(i[u[h].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx(Vo,{}),o===g&&f(i[u[h].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx("div",{className:ie.addSection,onClick:m=>{m.stopPropagation(),l(g,!0)},children:e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{r(null),t(null),d("/admin/builder/add")},children:"Add Section"})}),o===g&&f(i[u[h].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx("div",{className:e.clx(ie.addSection,ie.addSectionTop),onClick:m=>{m.stopPropagation(),l(g,!1)},children:e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{r(null),t(null),d("/admin/builder/add")},children:"Add Section"})}),n&&e.jsxRuntimeExports.jsx(Ue,{render:k,block:i[u[h].path].data[g]})]},g))}),e.jsxRuntimeExports.jsx(qe,{})]})}),Wo="_results_xxju1_1",Zo="_name_xxju1_6",Xo="_product_xxju1_13",Re={results:Wo,name:Zo,product:Xo},it=()=>{const{blocks:t,sourceBlocks:o,setActiveBlock:n}=e.useBlocksStore(),{hideModal:s,hoverBlockId:i,isModalVisible:r,showPreview:a,hidePreview:l,clearHideTimeout:p,startHideTimeout:h}=e.useSubmodalStore(),[u,b]=j.useState(""),[S,x]=j.useState([]),c=j.useMemo(()=>Object.keys(t||{}).reduce((m,_)=>(k(_)&&m.push(_),m),[]),[t]),R=j.useMemo(()=>new e.Fuse(c,{keys:["name"],threshold:.4}),[c]);j.useEffect(()=>{if(u.trim()==="")x(c);else{const m=R.search(u);x(m.map(_=>_.item))}},[u,R]);function w(m){b(""),n(m),s("keyBlock")}function d(m){if(!o||!o[m])return"unknown name";const _=new o[m];return!_.blockSettings||!_.blockSettings.displayName?"unknown name":_.blockSettings.displayName}function k(m){return o?new o[m]().blockSettings.isAddable:!1}const f=m=>{i||s("keyBlock"),a(m,"keyBlock"),p()},g=()=>{r?h("keyBlock"):l("keyBlock")};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:b,value:u,style:{marginBottom:10}}),e.jsxRuntimeExports.jsx("div",{className:Re.results,children:S.length>0?S.map(m=>e.jsxRuntimeExports.jsxs("div",{className:Re.product,onClick:()=>w(m),onMouseEnter:()=>f(m),onMouseLeave:g,children:[be[m]?e.jsxRuntimeExports.jsx("img",{src:be[m]}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards"}),e.jsxRuntimeExports.jsx("span",{className:Re.name,children:d(m)}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:20,height:20})]},m)):e.jsxRuntimeExports.jsx("div",{className:Re.noResults,children:"No sections found"})})]})},Yo="_wrapper_lvjgh_1",Ko={wrapper:Yo},Je=({children:t})=>{const{hoverBlockId:o,keyBlock:n,startHideTimeout:s,clearHideTimeout:i,setMouseOverModal:r}=e.useSubmodalStore();return!o&&!n?null:e.jsxRuntimeExports.jsx("div",{className:Ko.wrapper,onMouseEnter:()=>{i(),r(!0)},onMouseLeave:()=>{r(!1),s()},children:t})},Qo="_applyButton_qzy8h_2",Jo="_content_qzy8h_7",en="_label_qzy8h_14",tn="_colorValue_qzy8h_27",sn="_modal_qzy8h_34",on="_colorMap_qzy8h_53",nn="_indicator_qzy8h_62",rn="_hueSlider_qzy8h_71",an="_slider_qzy8h_102",ln="_buttons_qzy8h_107",cn="_name_qzy8h_114",un="_secondary_qzy8h_119",dn="_input_qzy8h_127",pn="_alphaSlider_qzy8h_263",mn="_alphaBackground_qzy8h_271",xn="_alphaGradient_qzy8h_282",hn="_chargeTypes_qzy8h_311",gn="_charge_qzy8h_311",jn="_chargeActive_qzy8h_340",Sn="_gradient_qzy8h_348",fn="_color_qzy8h_27",_n="_colorActive_qzy8h_363",$={applyButton:Qo,content:Jo,label:en,colorValue:tn,modal:sn,colorMap:on,indicator:nn,hueSlider:rn,slider:an,buttons:ln,name:cn,secondary:un,input:dn,alphaSlider:pn,alphaBackground:mn,alphaGradient:xn,chargeTypes:hn,charge:gn,chargeActive:jn,gradient:Sn,color:fn,colorActive:_n},bn=()=>{const{modalPosition:t,color:o,initialColor:n,setShowModal:s,hue:i,saturation:r,brightness:a,alpha:l,dragging:p,setDragging:h,setHue:u,setSaturation:b,setBrightness:S,setAlpha:x,colorChange:c,setColor:R,update:w,isGradient:d,setIsGradient:k,gradientDirection:f,setGradientDirection:g,hue2:m,saturation2:_,brightness2:C,alpha2:E,setHue2:z,setSaturation2:y,setBrightness2:P,setAlpha2:I,activeColorIndex:v,setActiveColorIndex:V,isGradientActive:W}=e.useColorPickerStore(),M=(N,T,U)=>{T/=100,U/=100;const B=Z=>(Z+N/60)%6,D=Z=>U*(1-T*Math.max(0,Math.min(B(Z),4-B(Z),1))),A=Math.round(255*D(5)),O=Math.round(255*D(3)),q=Math.round(255*D(1));return{r:A,g:O,b:q}},F=N=>N.toString(16).padStart(2,"0"),L=(N,T,U,B)=>{const{r:D,g:A,b:O}=M(N,T,U),q=Math.round(B/100*255);return`#${F(D)}${F(A)}${F(O)}${F(q)}`},H=(N,T,U,B)=>{if(d)if(v===1){u(N),b(T),S(U),x(B);const D=L(N,T,U,B),A=L(m,_,C,E),q=`linear-gradient(${f==="vertical"?"0deg":"90deg"}, ${D} 0%, ${A} 100%)`;c(q),R(q)}else{z(N),y(T),P(U),I(B);const D=L(N,T,U,B),A=L(i,r,a,l),q=`linear-gradient(${f==="vertical"?"0deg":"90deg"}, ${A} 0%, ${D} 100%)`;c(q),R(q)}else{const D=L(N,T,U,B);c(D),R(D)}},re=(N,T,U)=>{const{width:B,height:D}=U.getBoundingClientRect(),A=Math.max(0,Math.min(N/B*100,100)),O=Math.max(0,Math.min(100-T/D*100,100));d?v===1?(b(A),S(O),H(i,A,O,l)):(y(A),P(O),H(m,A,O,E)):(b(A),S(O),H(i,A,O,l))},ut=N=>{const{offsetX:T,offsetY:U}=N.nativeEvent;h(!0),re(T,U,N.currentTarget)},dt=N=>{if(p){const T=document.querySelector(`.${$.colorMap}`),{left:U,top:B}=T.getBoundingClientRect(),D=N.clientX-U,A=N.clientY-B;re(D,A,T)}},pt=()=>{h(!1)};j.useEffect(()=>{function N(B){const D=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,A=B.match(D);if(A){const O=A[1],q=A[2],Z=A[3];return{angle:O,col1:q,col2:Z}}return null}function T(B){const D=parseInt(B.slice(1,3),16),A=parseInt(B.slice(3,5),16),O=parseInt(B.slice(5,7),16),q=parseInt(B.slice(7,9),16)/255*100,{h:Z,s:pe,b:Pe}=U(D,A,O);return{h:Z,s:pe,b:Pe,a:q}}function U(B,D,A){B/=255,D/=255,A/=255;const O=Math.max(B,D,A),q=Math.min(B,D,A);let Z=0;const pe=O-q,Pe=(O===0?0:pe/O)*100,ft=O*100;if(O===q)Z=0;else switch(O){case B:Z=((D-A)/pe+(D<A?6:0))*60;break;case D:Z=((A-B)/pe+2)*60;break;case A:Z=((B-D)/pe+4)*60;break}return{h:Z,s:Pe,b:ft}}if(n&&n.startsWith("linear-gradient")){const B=N(n);if(B){const{angle:D,col1:A,col2:O}=B,q=T(A),Z=T(O);k(!0),g(D==="0deg"?"vertical":"horizontal"),u(q.h),b(q.s),S(q.b),x(q.a),z(Z.h),y(Z.s),P(Z.b),I(Z.a),V(1)}}else if(n){const D=function(O){let q=O;return q.length===7&&(q=q+"ff"),q}(n),A=T(D);k(!1),u(A.h),b(A.s),S(A.b),x(A.a)}},[n,k,g,u,b,S,x,z,y,P,I,V]),j.useEffect(()=>{let N,T,U,B;d?v===1?(N=i,T=r,U=a,B=l):(N=m,T=_,U=C,B=E):(N=i,T=r,U=a,B=l),H(N,T,U,B)},[d,f,v,i,r,a,l,m,_,C,E]),j.useEffect(()=>{const N=U=>dt(U),T=()=>pt();return p?(document.addEventListener("mousemove",N),document.addEventListener("mouseup",T)):(document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",T)),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",T)}},[p,d,f]);function mt(){if(!d)w(o);else{const N=L(i,r,a,l),T=L(m,_,C,E),B=`linear-gradient(${f==="vertical"?"0deg":"90deg"}, ${N} 0%, ${T} 100%)`;w(B)}s(!1)}function xt(){s(!1),c(n)}const we=d?v===1?i:m:i,Ge=d?v===1?r:_:r,We=d?v===1?a:C:a,ht=d?v===1?l:E:l,{r:Ze,g:Xe,b:Ye}=M(we,Ge,We),gt=`linear-gradient(to right, rgba(${Ze}, ${Xe}, ${Ye}, 0), rgba(${Ze}, ${Xe}, ${Ye}, 1))`,jt=L(i,r,a,l),St=L(m,_,C,E);return e.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:N=>N.stopPropagation(),style:{top:`${t.top}px`,left:`${t.left}px`},children:[W&&e.jsxRuntimeExports.jsxs("div",{className:$.chargeTypes,children:[e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:!d}),onClick:()=>k(!1),children:"Color"}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:d}),onClick:()=>k(!0),children:"Gradient"})]}),d&&W&&e.jsxRuntimeExports.jsxs("div",{className:$.gradient,children:[e.jsxRuntimeExports.jsx("div",{className:e.clx($.color,{[$.colorActive]:v===1}),onClick:()=>V(1),style:{background:jt}}),e.jsxRuntimeExports.jsxs("div",{className:$.chargeTypes,children:[e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:f==="vertical"}),onClick:()=>g("vertical"),children:"Vertical"}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:f==="horizontal"}),onClick:()=>g("horizontal"),children:"Horizontal"})]}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.color,{[$.colorActive]:v===2}),onClick:()=>V(2),style:{background:St}})]}),e.jsxRuntimeExports.jsx("div",{className:$.colorMap,onMouseDown:ut,style:{background:`
|
|
47
|
+
`}return n+="}",n},ds=t=>{const o=document.getElementById("dynamic-styles");if(o)o.innerHTML=t;else{const n=document.createElement("style");n.id="dynamic-styles",n.innerHTML=t,document.head.appendChild(n)}};let Ae=new Set;const ps=t=>{const o=new Map;return Object.entries(t).forEach(([n,s])=>{typeof s=="object"&&Object.entries(s).forEach(([i,r])=>{var a;if(r&&r.font){const l=r.font.replace(/\s+/g,"+");o.has(l)||o.set(l,new Set),(a=o.get(l))==null||a.add(r.weight)}})}),o},ms=t=>{const o=new Map;return Object.entries(t).forEach(([n,s])=>{typeof s=="object"&&Object.keys(s).forEach(i=>{var r;if(i==="font"&&s[i]){const a=s[i].replace(/\s+/g,"+");o.has(a)||o.set(a,new Set),(r=o.get(a))==null||r.add("400")}})}),o},xs=t=>{Ae.forEach(o=>{if(!t.has(o)){const n=document.querySelector(`link[data-font="${o}"]`);n&&n.remove(),Ae.delete(o)}})},hs=t=>{const o=new Set;t.forEach((n,s)=>{const i=Array.from(n).join(";"),r=`${s}:wght@${i}`;if(o.add(r),!Ae.has(r)){const a=document.createElement("link");a.rel="stylesheet",a.href=`https://fonts.googleapis.com/css2?family=${r}&display=swap`,a.setAttribute("data-font",r),document.head.appendChild(a),Ae.add(r)}}),xs(o)},gs=t=>{if(t.fonts){const o=ps(t.fonts),n=ms(t.buttons),s=new Map(o);n.forEach((i,r)=>{if(s.has(r)){const a=s.get(r);i.forEach(l=>a==null?void 0:a.add(l))}else s.set(r,new Set(i))}),hs(s)}},js="_tooltip_1ch07_1",Ss="_fadeIn_1ch07_1",fs={tooltip:js,fadeIn:Ss},Se=t=>{const{text:o}=t,{setShowTooltip:n}=e.useTooltipStore();return j.useEffect(()=>(n(!0),()=>{n(!1)}),[]),e.jsxRuntimeExports.jsx("div",{className:fs.tooltip,children:o})},_s=()=>{const{undo:t,redo:o,past:n,future:s}=e.useHistoryStore(),[i,r]=j.useState(!1),[a,l]=j.useState(!1),[p,h]=j.useState(!1),[u,b]=j.useState(!1),[S,x]=j.useState(null);return j.useEffect(()=>{r(n.length===0)},[n]),j.useEffect(()=>{l(s.length===0)},[s]),e.jsxRuntimeExports.jsxs("div",{className:fe.buttons,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(fe.button,{[fe.disabled]:i}),onMouseEnter:()=>{const c=setTimeout(()=>{b(!0),h(!1)},200);x(c)},onMouseLeave:()=>{S&&clearTimeout(S),b(!1),h(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{i||t()},fill:i?"#757575":"#252525"}),u&&e.jsxRuntimeExports.jsx(Se,{text:i?"Nothing to undo":"Click to undo changes"})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(fe.button,{[fe.disabled]:a}),onMouseEnter:()=>{const c=setTimeout(()=>{h(!0),b(!1)},200);x(c)},onMouseLeave:()=>{S&&clearTimeout(S),h(!1),b(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||o()},fill:a?"#757575":"#252525"}),p&&e.jsxRuntimeExports.jsx(Se,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},bs="_devices_ls6k9_1",ws="_device_ls6k9_1",Cs="_active_ls6k9_27",Oe={devices:bs,device:ws,active:Cs},vs=()=>e.jsxRuntimeExports.jsx("div",{className:Oe.devices,children:_t.map(t=>e.jsxRuntimeExports.jsx(ks,{device:t}))}),ks=t=>{const{device:o}=t,{currentDevice:n,setCurrentDevice:s}=e.useDeviceStore(),[i,r]=j.useState(!1),[a,l]=j.useState(null);return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Oe.device,{[Oe.active]:n.value===o.value}),onClick:()=>s(o),onMouseEnter:()=>{const p=setTimeout(()=>{r(!0)},200);l(p)},onMouseLeave:()=>{a&&clearTimeout(a),r(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:o.icon,fill:n.value===o.value?"#252525":"#757575",width:20,height:20}),i&&e.jsxRuntimeExports.jsx(Se,{text:`Switch to ${o.value} view`})]},o.value)},Es="_header_2d8xd_1",Rs="_left_2d8xd_13",ys="_right_2d8xd_14",ve={header:Es,left:Rs,right:ys},Ls="_preview_1x3m8_2",Ts="_active_1x3m8_19",$e={preview:Ls,active:Ts},Bs=()=>{const{onPreview:t}=e.usePreviewStore(),[o,n]=j.useState(!1),[s,i]=j.useState(null);return e.jsxRuntimeExports.jsxs("a",{href:"/",className:e.clx($e.preview,{[$e.active]:t}),target:"_blank",onMouseEnter:()=>{const r=setTimeout(()=>{n(!0)},200);i(r)},onMouseLeave:()=>{s&&clearTimeout(s),n(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUpRight",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:$e.text,children:"Preview"}),o&&e.jsxRuntimeExports.jsx(Se,{text:"Open draft theme in new tab"})]})},Ns="_settings_u4cv4_1",As={settings:Ns},Ps="_pages_167qp_1",Is="_text_167qp_21",Ms="_modal_167qp_27",$s="_open_167qp_46",Fs="_page_167qp_1",Hs="_hoverable_167qp_61",Ds="_separator_167qp_65",Os="_button_167qp_70",Us="_items_167qp_85",K={pages:Ps,default:"_default_167qp_5",text:Is,modal:Ms,open:$s,page:Fs,hoverable:Hs,separator:Ds,button:Os,items:Us},qs=()=>{const{currentPage:t,setCurrentPage:o,setIsOpenModal:n,pages:s,setIsEdit:i,setEditedPage:r,deletePage:a,setIsOpenSelectModal:l}=e.usePagesStore(),{deletePage:p}=e.useLayersStore(),[h,u]=j.useState(null),{setTitle:b,setDescription:S,setOnConfirm:x}=e.useConfirmationModalStore(),[c,R]=j.useState(!1);return j.useEffect(()=>{const w=()=>{R(!1)};return document.body.addEventListener("click",w),()=>{document.body.removeEventListener("click",w)}},[]),j.useEffect(()=>{c?l(!0):setTimeout(()=>{l(!1)},300)},[c]),e.jsxRuntimeExports.jsxs("div",{className:K.pages,children:[e.jsxRuntimeExports.jsxs("div",{className:K.default,onClick:w=>{w.stopPropagation(),R(!c)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:s&&s[t]&&s[t].icon||"File",fill:"#252525",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:K.text,children:s&&s[t]&&Ne.includes(s[t].name)?`${ee(s[t].name)} page`:s&&s[t]&&s[t].name}),e.jsxRuntimeExports.jsx("div",{style:{transform:c?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretDown",width:20,height:20})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(K.modal,{[K.open]:c}),onClick:w=>w.stopPropagation(),children:[s&&e.jsxRuntimeExports.jsx("div",{className:K.items,children:Object.keys(s).map(w=>{const d=s[w];return e.jsxRuntimeExports.jsxs("div",{className:e.clx(K.page,{[K.hoverable]:h===w}),onMouseEnter:()=>u(w),onMouseLeave:()=>u(null),onClick:()=>{u(null),i(!1),o(w),R(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:d.icon,fill:"#252525"}),e.jsxRuntimeExports.jsx("span",{className:K.text,children:Ne.includes(d.name)?`${ee(d.name)} page`:d.name}),h===w&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Gear",fill:"#757575",onClick:k=>{k.stopPropagation(),i(!0),r(w),n(!0)}}),!Ne.includes(d.name)&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",onClick:k=>{k.stopPropagation(),b("Delete Page"),S(`Are you sure you want to delete ${d.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),x(()=>{k.stopPropagation(),s[t].name===d.name&&o("/"),a(w),p(d.name),e.deletePage(d.path)})}})]}),s[t]&&s[t].name===d.name&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"#FF3F19"})]},w)})}),e.jsxRuntimeExports.jsx("div",{className:K.separator}),e.jsxRuntimeExports.jsxs(e.Button,{className:K.button,onClick:w=>{w.stopPropagation(),n(!0)},size:"l",children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#ff3f19"}),e.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},zs="_zoom_1q1ud_1",Vs={zoom:zs},Gs=()=>{const[t,o]=j.useState(),n=()=>{o(Number(Math.round(window.devicePixelRatio*50).toFixed(0)))};return j.useEffect(()=>(n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}),[]),e.jsxRuntimeExports.jsxs("div",{className:Vs.zoom,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"MagnifyingGlassMinus",width:20,height:20}),e.jsxRuntimeExports.jsxs("span",{children:[t," %"]})]})},Ws=()=>e.jsxRuntimeExports.jsxs("div",{className:As.settings,children:[e.jsxRuntimeExports.jsx(qs,{}),e.jsxRuntimeExports.jsx(Gs,{})]}),Zs="_theme_1e5wq_1",Xs="_text_1e5wq_13",Qe={theme:Zs,text:Xs},Ys=()=>e.jsxRuntimeExports.jsx("div",{className:Qe.theme,children:e.jsxRuntimeExports.jsx("div",{className:Qe.text,children:"Live Theme"})}),Ks=({setIsLoading:t,isLoading:o})=>{const{themeSettings:n}=e.useThemeSettingsStore(),{settings:s}=e.useSettingsStore(),[i,r]=j.useState(null),[a,l]=j.useState(!1),{setNotification:p}=e.useNotificationStore(),{header:h,footer:u}=e.useLayersStore(),{pageContext:b}=e.usePagesStore(),{pages:S}=e.usePagesStore(),{blocks:x}=e.useLayersStore();function c(f,g){try{return g.map(_=>{if(!_.value||!_.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(_.value.blockSettings).filter(E=>E&&E.type===f).map(E=>{if(E.value===void 0)throw new Error("item.value is undefined.");return E.value}).flat()}).flat().filter(_=>_).map(_=>f==="ListingIds"?_.listingId:_)}catch(m){return console.error("Error in getValues function:",m),[]}}function R(f,g){return w(f,g)?b.reviews.length*3:0}function w(f,g){return g.map(_=>{if(!_.value||!_.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(_.value.blockSettings).filter(E=>E&&E.type===f).map(E=>{if(E.value===void 0)throw new Error("item.value is undefined.");return E.value}).flat()}).flat().filter(_=>_).length>0}function d(f){if(S){const g=Object.keys(S).find(m=>S[m].path===f);if(g)return S[g]}return null}const k=async()=>{if(a)i&&clearTimeout(i);else{t(!0);const g=Object.keys(x).map(_=>{const C=d(_);return x[_]&&x[_].data&&(C!=null&&C.path)?{name:C?C.name:_,path:C.path,layout:{...x[_]},neededProductIds:[...c("ProductId",Object.values(x[_].data))],neededCategoryIds:[...c("CategoryId",Object.values(x[_].data))],neededAnnouncementIds:[...c("AnnouncementId",Object.values(x[_].data))],neededListingIds:[...c("ListingIds",Object.values(x[_].data))],neededFaqIds:[...c("FaqsIds",Object.values(x[_].data))],neededReviewCount:R("ReviewCount",Object.values(x[_].data)),seo:{pageTitle:C&&C.seo&&C.seo.title?C.seo.title:"",pageDescription:C&&C.seo&&C.seo.description?C.seo.description:""}}:null}).filter(_=>_),{status:m}=await e.updateSettings("post","save",{themeSettings:n,settings:{settings:s,header:h,footer:u},updatedPages:g});p({message:m===200?"Settings saved":"Error",status:m===200?"success":"error"}),t(!1)}l(!0);const f=setTimeout(()=>{l(!1)},2e3);r(f)};return e.jsxRuntimeExports.jsx(e.Button,{onClick:k,disabled:o,children:"Save"})},Qs=()=>{const{isOpenSelectModal:t}=e.usePagesStore(),[o,n]=j.useState(!1),{showTooltip:s}=e.useTooltipStore();return e.jsxRuntimeExports.jsxs("div",{className:ve.header,style:{zIndex:t?5e4:s?501:50},children:[e.jsxRuntimeExports.jsxs("div",{className:ve.left,children:[e.jsxRuntimeExports.jsx(vs,{}),e.jsxRuntimeExports.jsx(Bs,{})]}),e.jsxRuntimeExports.jsx("div",{className:ve.center,children:e.jsxRuntimeExports.jsx(Ws,{})}),e.jsxRuntimeExports.jsxs("div",{className:ve.right,children:[e.jsxRuntimeExports.jsx(Ys,{}),e.jsxRuntimeExports.jsx(_s,{}),e.jsxRuntimeExports.jsx(Ks,{setIsLoading:n,isLoading:o}),o&&e.jsxRuntimeExports.jsx(e.Loader,{})]})]})},Js="_exit_1lmsz_1",eo="_text_1lmsz_11",to="_exitLink_1lmsz_16",Fe={exit:Js,text:eo,exitLink:to},so=()=>e.jsxRuntimeExports.jsx("div",{className:Fe.exit,children:e.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:Fe.exitLink,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"SignOut",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Fe.text,children:"Exit"})]})}),oo="_navbar_1podc_1",no="_main_1podc_6",ro="_block_1podc_13",io="_active_1podc_29",ke={navbar:oo,main:no,block:ro,active:io},ao=()=>{const{activeBlock:t}=e.useNavbarStore(),{setActiveBlock:o}=e.useBlocksStore(),{setCurrentBlock:n}=e.useLayersStore(),{setActiveBlock:s}=e.useThemeSettingsStore(),i=e.useNavigate();function r(a){switch(o(null),n(null),s(null),a.name){case"Layers":i("/admin/builder");break;case"Add":i("/admin/builder/add");break;case"Theme":i("/admin/builder/theme");break;case"Settings":i("/admin/builder/settings");break}}return e.jsxRuntimeExports.jsxs("div",{className:ke.navbar,children:[e.jsxRuntimeExports.jsx(so,{}),e.jsxRuntimeExports.jsx("div",{className:ke.main,children:e.navbarBlocks.map(a=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(ke.block,{[ke.active]:t.icon===a.icon}),onClick:()=>r(a),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:a.icon,fill:t.icon===a.icon?"#252525":"#757575"}),e.jsxRuntimeExports.jsx("span",{children:a.name})]},a.icon))})]})},lo="_preview_186z3_1",co="_main_186z3_15",uo="_content_186z3_26",po="_loading_186z3_33",mo="_loader_186z3_43",xo="_spin_186z3_1",Ee={preview:lo,main:co,content:uo,loading:po,loader:mo,spin:xo},ho="_header_lk0ru_2",go="_circles_lk0ru_17",jo="_circle_lk0ru_17",So="_red_lk0ru_33",fo="_green_lk0ru_37",_o="_yellow_lk0ru_41",bo="_input_lk0ru_45",wo="_main_lk0ru_56",Co="_text_lk0ru_64",oe={header:ho,circles:go,circle:jo,red:So,green:fo,yellow:_o,input:bo,main:wo,text:Co},vo=["red","yellow","green"],ko=()=>{const{currentDevice:t}=e.useDeviceStore(),o=(i,r)=>i.length>r?i.slice(0,r)+"...":i,{notification:n,setNotification:s}=e.useNotificationStore();return e.jsxRuntimeExports.jsxs("div",{className:oe.header,children:[e.jsxRuntimeExports.jsx("div",{className:oe.circles,children:vo.map(i=>e.jsxRuntimeExports.jsx("div",{className:e.clx(oe.circle,{[oe.red]:i==="red",[oe.yellow]:i==="yellow",[oe.green]:i==="green"})},i))}),e.jsxRuntimeExports.jsx("div",{className:oe.input,children:e.jsxRuntimeExports.jsxs("div",{className:oe.main,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),e.jsxRuntimeExports.jsx("span",{className:oe.text,children:t.value==="mobile"?o(window.location.origin,40):t.value==="desktop"?o(window.location.origin,200):o(window.location.origin,100)})]})}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),s({status:"success",message:"Domain copied to clipboard"})},children:e.jsxRuntimeExports.jsx(e.Icon,{name:n&&n.message==="Domain copied to clipboard"?"Check":"Copy",width:20,height:20,fill:"#252525"})})]})},Eo="_content_cjgr7_1",Ro="_main_cjgr7_9",yo="_block_cjgr7_13",Lo="_active_cjgr7_20",To="_name_cjgr7_24",Bo="_empty_cjgr7_38",No="_icon_cjgr7_49",Ao="_title_cjgr7_62",Po="_text_cjgr7_68",Io="_sections_cjgr7_74",Mo="_section_cjgr7_74",$o="_addSection_cjgr7_99",Fo="_addSectionTop_cjgr7_107",ie={content:Eo,main:Ro,block:yo,active:Lo,name:To,empty:Bo,icon:No,title:Ao,text:Po,sections:Io,section:Mo,addSection:$o,addSectionTop:Fo},Ho="_sidebar_xhqpt_1",Do="_content_xhqpt_14",Oo="_button_xhqpt_24",Uo="_moveButton_xhqpt_40",qo="_border_xhqpt_44",zo="_deleteButton_xhqpt_49",te={sidebar:Ho,content:Do,button:Oo,moveButton:Uo,border:qo,deleteButton:zo},Vo=()=>{var k;const{activeBlock:t}=e.usePreviewStore(),{blocks:o,removeBlock:n,moveBlock:s,duplicateBlock:i}=e.useLayersStore(),{currentPage:r,pages:a}=e.usePagesStore(),{setTitle:l,setDescription:p,setOnConfirm:h}=e.useConfirmationModalStore(),u=(k=a==null?void 0:a[r])==null?void 0:k.path,b=u?o[u]:null,S=(b==null?void 0:b.order)||[],x=S.indexOf(t),c=()=>{x>0&&u&&s(u,x,x-1)},R=()=>{x<S.length-1&&u&&s(u,x,x+1)},w=()=>{u&&i(u,t)},d=()=>{u&&n(u,t)};return e.jsxRuntimeExports.jsx("div",{className:te.sidebar,children:e.jsxRuntimeExports.jsxs("div",{className:te.content,children:[e.jsxRuntimeExports.jsx("button",{onClick:c,className:e.clx(te.button,te.moveButton),disabled:x===0,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUp"})}),e.jsxRuntimeExports.jsx("button",{onClick:R,className:e.clx(te.button,te.moveButton),disabled:x===S.length-1,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowDown"})}),e.jsxRuntimeExports.jsx("button",{onClick:w,className:e.clx(te.button,te.moveButton),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})}),e.jsxRuntimeExports.jsx("button",{className:e.clx(te.button,te.deleteButton),onClick:f=>{f.stopPropagation(),l("Remove Block"),p(`Are you sure you want to delete ${(b==null?void 0:b.data[t].name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),h(d)},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]})})},Go=j.memo(()=>{const{setActiveBlock:t,activeBlock:o}=e.usePreviewStore(),{blocks:n,sourceBlocks:s}=e.useBlocksStore(),{blocks:i,setCurrentBlock:r,currentBlock:a,setPositionBlock:l}=e.useLayersStore(),{settings:p}=e.useSettingsStore(),{currentPage:h,pages:u,setIsOpenSelectModal:b,pageContext:S}=e.usePagesStore(),{activeBlock:x,setActiveBlock:c}=e.useThemeSettingsStore(),{setError:R}=e.useErrorStore(),w=j.useRef(o),d=e.useNavigate();j.useEffect(()=>{w.current=o},[o]),j.useEffect(()=>{const g=()=>{w.current&&(t(null),r(null))};return document.body.addEventListener("click",g),()=>{document.body.removeEventListener("click",g)}},[]);const k=g=>{if(!g||!g.name)return R({message:"Block or block.name is undefined.",failedSettings:!1,failedThemeSettings:!1,failedPageIds:u&&u[h].id?[u[h].id]:[]}),d("/error"),e.jsxRuntimeExports.jsx(je,{error:"Block or block.name is undefined."});if(!n||!n[g.name])return R({message:'Block "${block.name}" does not exist in blocks.',failedSettings:!1,failedThemeSettings:!1,failedPageIds:u&&u[h].id?[u[h].id]:[]}),d("/error"),e.jsxRuntimeExports.jsx(je,{error:`Block "${g.name}" does not exist in blocks.`});const m=new n[g.name];return g.value&&Object.assign(m,g.value),m.renderBlock(p,S)};function f(g){if(!s||!s[g])return"unknown name";const m=new s[g];return!m.blockSettings||!m.blockSettings.displayName?"unknown name":m.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{onClick:g=>{g.stopPropagation(),b(!1)},className:ie.content,children:[e.jsxRuntimeExports.jsx(ze,{}),e.jsxRuntimeExports.jsx("div",{className:ie.main,children:u&&u[h]&&i[u[h].path]&&i[u[h].path].data&&i[u[h].path].order.map(g=>e.jsxRuntimeExports.jsxs("div",{onClick:m=>{m.stopPropagation(),x&&c(null),o?(t(null),setTimeout(()=>{t(g)},100)):t(g),a?(r(null),setTimeout(()=>{r(g)},100)):r(g)},onMouseEnter:m=>{m.stopPropagation(),t(g)},onMouseLeave:m=>{m.stopPropagation(),t(null)},className:e.clx(ie.block,{[ie.active]:o===g}),children:[o===g&&e.jsxRuntimeExports.jsx("div",{className:ie.name,children:f(i[u[h].path].data[g].name)}),o===g&&f(i[u[h].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx(Vo,{}),o===g&&f(i[u[h].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx("div",{className:ie.addSection,onClick:m=>{m.stopPropagation(),l(g,!0)},children:e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{r(null),t(null),d("/admin/builder/add")},children:"Add Section"})}),o===g&&f(i[u[h].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx("div",{className:e.clx(ie.addSection,ie.addSectionTop),onClick:m=>{m.stopPropagation(),l(g,!1)},children:e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{r(null),t(null),d("/admin/builder/add")},children:"Add Section"})}),n&&e.jsxRuntimeExports.jsx(Ue,{render:k,block:i[u[h].path].data[g]})]},g))}),e.jsxRuntimeExports.jsx(qe,{})]})}),Wo="_results_xxju1_1",Zo="_name_xxju1_6",Xo="_product_xxju1_13",Re={results:Wo,name:Zo,product:Xo},it=()=>{const{blocks:t,sourceBlocks:o,setActiveBlock:n}=e.useBlocksStore(),{hideModal:s,hoverBlockId:i,isModalVisible:r,showPreview:a,hidePreview:l,clearHideTimeout:p,startHideTimeout:h}=e.useSubmodalStore(),[u,b]=j.useState(""),[S,x]=j.useState([]),c=j.useMemo(()=>Object.keys(t||{}).reduce((m,_)=>(k(_)&&m.push(_),m),[]),[t]),R=j.useMemo(()=>new e.Fuse(c,{keys:["name"],threshold:.4}),[c]);j.useEffect(()=>{if(u.trim()==="")x(c);else{const m=R.search(u);x(m.map(_=>_.item))}},[u,R]);function w(m){b(""),n(m),s("keyBlock")}function d(m){if(!o||!o[m])return"unknown name";const _=new o[m];return!_.blockSettings||!_.blockSettings.displayName?"unknown name":_.blockSettings.displayName}function k(m){return o?new o[m]().blockSettings.isAddable:!1}const f=m=>{i||s("keyBlock"),a(m,"keyBlock"),p()},g=()=>{r?h("keyBlock"):l("keyBlock")};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:b,value:u,style:{marginBottom:10}}),e.jsxRuntimeExports.jsx("div",{className:Re.results,children:S.length>0?S.map(m=>e.jsxRuntimeExports.jsxs("div",{className:Re.product,onClick:()=>w(m),onMouseEnter:()=>f(m),onMouseLeave:g,children:[be[m]?e.jsxRuntimeExports.jsx("img",{src:be[m]}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards"}),e.jsxRuntimeExports.jsx("span",{className:Re.name,children:d(m)}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:20,height:20})]},m)):e.jsxRuntimeExports.jsx("div",{className:Re.noResults,children:"No sections found"})})]})},Yo="_wrapper_lvjgh_1",Ko={wrapper:Yo},Je=({children:t})=>{const{hoverBlockId:o,keyBlock:n,startHideTimeout:s,clearHideTimeout:i,setMouseOverModal:r}=e.useSubmodalStore();return!o&&!n?null:e.jsxRuntimeExports.jsx("div",{className:Ko.wrapper,onMouseEnter:()=>{i(),r(!0)},onMouseLeave:()=>{r(!1),s()},children:t})},Qo="_applyButton_qzy8h_2",Jo="_content_qzy8h_7",en="_label_qzy8h_14",tn="_colorValue_qzy8h_27",sn="_modal_qzy8h_34",on="_colorMap_qzy8h_53",nn="_indicator_qzy8h_62",rn="_hueSlider_qzy8h_71",an="_slider_qzy8h_102",ln="_buttons_qzy8h_107",cn="_name_qzy8h_114",un="_secondary_qzy8h_119",dn="_input_qzy8h_127",pn="_alphaSlider_qzy8h_263",mn="_alphaBackground_qzy8h_271",xn="_alphaGradient_qzy8h_282",hn="_chargeTypes_qzy8h_311",gn="_charge_qzy8h_311",jn="_chargeActive_qzy8h_340",Sn="_gradient_qzy8h_348",fn="_color_qzy8h_27",_n="_colorActive_qzy8h_363",$={applyButton:Qo,content:Jo,label:en,colorValue:tn,modal:sn,colorMap:on,indicator:nn,hueSlider:rn,slider:an,buttons:ln,name:cn,secondary:un,input:dn,alphaSlider:pn,alphaBackground:mn,alphaGradient:xn,chargeTypes:hn,charge:gn,chargeActive:jn,gradient:Sn,color:fn,colorActive:_n},bn=()=>{const{modalPosition:t,color:o,initialColor:n,setShowModal:s,hue:i,saturation:r,brightness:a,alpha:l,dragging:p,setDragging:h,setHue:u,setSaturation:b,setBrightness:S,setAlpha:x,colorChange:c,setColor:R,update:w,isGradient:d,setIsGradient:k,gradientDirection:f,setGradientDirection:g,hue2:m,saturation2:_,brightness2:C,alpha2:E,setHue2:z,setSaturation2:y,setBrightness2:P,setAlpha2:I,activeColorIndex:v,setActiveColorIndex:V,isGradientActive:W}=e.useColorPickerStore(),M=(N,T,U)=>{T/=100,U/=100;const B=Z=>(Z+N/60)%6,D=Z=>U*(1-T*Math.max(0,Math.min(B(Z),4-B(Z),1))),A=Math.round(255*D(5)),O=Math.round(255*D(3)),q=Math.round(255*D(1));return{r:A,g:O,b:q}},F=N=>N.toString(16).padStart(2,"0"),L=(N,T,U,B)=>{const{r:D,g:A,b:O}=M(N,T,U),q=Math.round(B/100*255);return`#${F(D)}${F(A)}${F(O)}${F(q)}`},H=(N,T,U,B)=>{if(d)if(v===1){u(N),b(T),S(U),x(B);const D=L(N,T,U,B),A=L(m,_,C,E),q=`linear-gradient(${f==="vertical"?"0deg":"90deg"}, ${D} 0%, ${A} 100%)`;c(q),R(q)}else{z(N),y(T),P(U),I(B);const D=L(N,T,U,B),A=L(i,r,a,l),q=`linear-gradient(${f==="vertical"?"0deg":"90deg"}, ${A} 0%, ${D} 100%)`;c(q),R(q)}else{const D=L(N,T,U,B);c(D),R(D)}},re=(N,T,U)=>{const{width:B,height:D}=U.getBoundingClientRect(),A=Math.max(0,Math.min(N/B*100,100)),O=Math.max(0,Math.min(100-T/D*100,100));d?v===1?(b(A),S(O),H(i,A,O,l)):(y(A),P(O),H(m,A,O,E)):(b(A),S(O),H(i,A,O,l))},ut=N=>{const{offsetX:T,offsetY:U}=N.nativeEvent;h(!0),re(T,U,N.currentTarget)},dt=N=>{if(p){const T=document.querySelector(`.${$.colorMap}`),{left:U,top:B}=T.getBoundingClientRect(),D=N.clientX-U,A=N.clientY-B;re(D,A,T)}},pt=()=>{h(!1)};j.useEffect(()=>{function N(B){const D=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,A=B.match(D);if(A){const O=A[1],q=A[2],Z=A[3];return{angle:O,col1:q,col2:Z}}return null}function T(B){const D=parseInt(B.slice(1,3),16),A=parseInt(B.slice(3,5),16),O=parseInt(B.slice(5,7),16),q=parseInt(B.slice(7,9),16)/255*100,{h:Z,s:pe,b:Pe}=U(D,A,O);return{h:Z,s:pe,b:Pe,a:q}}function U(B,D,A){B/=255,D/=255,A/=255;const O=Math.max(B,D,A),q=Math.min(B,D,A);let Z=0;const pe=O-q,Pe=(O===0?0:pe/O)*100,ft=O*100;if(O===q)Z=0;else switch(O){case B:Z=((D-A)/pe+(D<A?6:0))*60;break;case D:Z=((A-B)/pe+2)*60;break;case A:Z=((B-D)/pe+4)*60;break}return{h:Z,s:Pe,b:ft}}if(n&&n.startsWith("linear-gradient")){const B=N(n);if(B){const{angle:D,col1:A,col2:O}=B,q=T(A),Z=T(O);k(!0),g(D==="0deg"?"vertical":"horizontal"),u(q.h),b(q.s),S(q.b),x(q.a),z(Z.h),y(Z.s),P(Z.b),I(Z.a),V(1)}}else if(n){const D=function(O){let q=O;return q.length===7&&(q=q+"ff"),q}(n),A=T(D);k(!1),u(A.h),b(A.s),S(A.b),x(A.a)}},[n,k,g,u,b,S,x,z,y,P,I,V]),j.useEffect(()=>{let N,T,U,B;d?v===1?(N=i,T=r,U=a,B=l):(N=m,T=_,U=C,B=E):(N=i,T=r,U=a,B=l),H(N,T,U,B)},[d,f,v,i,r,a,l,m,_,C,E]),j.useEffect(()=>{const N=U=>dt(U),T=()=>pt();return p?(document.addEventListener("mousemove",N),document.addEventListener("mouseup",T)):(document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",T)),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",T)}},[p,d,f]);function mt(){if(!d)w(o);else{const N=L(i,r,a,l),T=L(m,_,C,E),B=`linear-gradient(${f==="vertical"?"0deg":"90deg"}, ${N} 0%, ${T} 100%)`;w(B)}s(!1)}function xt(){s(!1),c(n)}const we=d?v===1?i:m:i,Ge=d?v===1?r:_:r,We=d?v===1?a:C:a,ht=d?v===1?l:E:l,{r:Ze,g:Xe,b:Ye}=M(we,Ge,We),gt=`linear-gradient(to right, rgba(${Ze}, ${Xe}, ${Ye}, 0), rgba(${Ze}, ${Xe}, ${Ye}, 1))`,jt=L(i,r,a,l),St=L(m,_,C,E);return e.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:N=>N.stopPropagation(),style:{top:`${t.top}px`,left:`${t.left}px`},children:[W&&e.jsxRuntimeExports.jsxs("div",{className:$.chargeTypes,children:[e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:!d}),onClick:()=>k(!1),children:"Color"}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:d}),onClick:()=>k(!0),children:"Gradient"})]}),d&&W&&e.jsxRuntimeExports.jsxs("div",{className:$.gradient,children:[e.jsxRuntimeExports.jsx("div",{className:e.clx($.color,{[$.colorActive]:v===1}),onClick:()=>V(1),style:{background:jt}}),e.jsxRuntimeExports.jsxs("div",{className:$.chargeTypes,children:[e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:f==="vertical"}),onClick:()=>g("vertical"),children:"Vertical"}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:f==="horizontal"}),onClick:()=>g("horizontal"),children:"Horizontal"})]}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.color,{[$.colorActive]:v===2}),onClick:()=>V(2),style:{background:St}})]}),e.jsxRuntimeExports.jsx("div",{className:$.colorMap,onMouseDown:ut,style:{background:`
|
|
48
48
|
linear-gradient(to top, black, transparent),
|
|
49
49
|
linear-gradient(to right, hsl(${we}, 100%, 100%), hsl(${we}, 100%, 50%))
|
|
50
50
|
`},children:e.jsxRuntimeExports.jsx("div",{className:$.indicator,style:{position:"absolute",left:`${Ge}%`,top:`${100-We}%`,transform:"translate(-50%, -50%)"}})}),e.jsxRuntimeExports.jsx("div",{className:$.hueSlider,children:e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:we,onChange:N=>{const T=Number(N.target.value);d?v===1?H(T,r,a,l):H(T,_,C,E):(u(T),H(T,r,a,l))},className:$.slider})}),e.jsxRuntimeExports.jsxs("div",{className:$.alphaSlider,children:[e.jsxRuntimeExports.jsx("div",{className:$.alphaBackground}),e.jsxRuntimeExports.jsx("div",{className:$.alphaGradient,style:{background:gt}}),e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"100",value:ht,onChange:N=>{const T=Number(N.target.value);d?v===1?H(i,r,a,T):H(m,_,C,T):(x(T),H(i,r,a,T))},className:$.slider})]}),e.jsxRuntimeExports.jsxs("div",{className:$.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:xt,className:e.clx($.applyButton,$.cancelButton),type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:mt,className:$.applyButton,children:"Apply"})]})]})},wn=()=>{const{onPreview:t}=e.usePreviewStore(),{keyBlock:o,hoverBlockId:n,isModalVisible:s}=e.useSubmodalStore(),{settings:i}=e.useSettingsStore(),{sourceBlocks:r}=e.useBlocksStore(),{pageContext:a}=e.usePagesStore(),{showModal:l}=e.useColorPickerStore(),{currentDevice:p}=e.useDeviceStore(),{isLoadingThemeSettings:h}=e.useThemeSettingsStore(),{isLoadingLayers:u}=e.useLayersStore(),b=x=>x?!r||!r[x]?e.jsxRuntimeExports.jsx(je,{error:`Block "${x}" does not exist in blocks.`}):new r[x]().renderPreview(i,a):e.jsxRuntimeExports.jsx(je,{error:"Block or block.name is undefined."});function S(){return p.value==="desktop"?"100%":p.value==="tablet"?"768px":"425px"}return e.jsxRuntimeExports.jsxs("div",{className:Ee.preview,style:{zIndex:l?5e3:500},children:[s&&e.jsxRuntimeExports.jsx(Je,{variable:"hoverBlockId",children:e.jsxRuntimeExports.jsx(it,{})}),!n&&o&&e.jsxRuntimeExports.jsxs(Je,{variable:"keyBlock",children:[!h&&!u&&e.jsxRuntimeExports.jsx(Ue,{render:b,block:o}),h&&e.jsxRuntimeExports.jsx(e.Loader,{})]}),l&&e.jsxRuntimeExports.jsx(bn,{}),t&&e.jsxRuntimeExports.jsxs("div",{className:Ee.main,style:{width:S()},children:[e.jsxRuntimeExports.jsx(ko,{}),e.jsxRuntimeExports.jsx("div",{className:Ee.content,children:!h&&!u?e.jsxRuntimeExports.jsx(Go,{}):e.jsxRuntimeExports.jsx("div",{className:Ee.loading,children:e.jsxRuntimeExports.jsx(e.Loader,{})})})]})]})},Cn="_sidebar_1xtkj_1",vn="_title_1xtkj_11",kn="_active_1xtkj_19",et={sidebar:Cn,title:vn,active:kn},En="_layers_2rwb8_1",Rn="_wrapper_2rwb8_9",yn="_draggingWrapper_2rwb8_17",Ln="_block_2rwb8_21",Tn="_dragging_2rwb8_17",Bn="_active_2rwb8_56",Nn="_add_2rwb8_60",An="_addTop_2rwb8_76",Pn="_visible_2rwb8_92",In="_button_2rwb8_96",Mn="_empty_2rwb8_111",$n="_title_2rwb8_123",Fn="_icon_2rwb8_130",Hn="_blockIcon_2rwb8_134",Dn="_text_2rwb8_144",On="_highlight_2rwb8_150",Un="_nameBlock_2rwb8_155",qn="_loader_2rwb8_159",X={layers:En,wrapper:Rn,draggingWrapper:yn,block:Ln,dragging:Tn,active:Bn,add:Nn,addTop:An,visible:Pn,button:In,empty:Mn,title:$n,icon:Fn,blockIcon:Hn,text:Dn,highlight:On,nameBlock:Un,loader:qn},zn="_block_586dq_1",tt={block:zn},Vn=()=>{const{setCurrentBlock:t}=e.useLayersStore(),{activeBlock:o}=e.usePreviewStore();function n(s){t(s)}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(tt.block,{[tt.active]:o==="header"}),onClick:()=>n("header"),children:[e.jsxRuntimeExports.jsx("img",{src:be.Header,width:20,height:20}),e.jsxRuntimeExports.jsx("span",{children:"Header"})]})},Gn="_block_586dq_1",st={block:Gn},Wn=()=>{const{activeBlock:t}=e.usePreviewStore(),{setCurrentBlock:o}=e.useLayersStore();function n(s){o(s)}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(st.block,{[st.active]:t==="footer"}),onClick:()=>n("footer"),children:[e.jsxRuntimeExports.jsx("img",{src:be.Footer,width:20,height:20}),e.jsxRuntimeExports.jsx("span",{children:"Footer"})]})},Zn=({id:t,name:o,onClick:n,isDragging:s,icon:i})=>{const{activeBlock:r}=e.usePreviewStore(),{showPreview:a,hidePreview:l,showModal:p,hideModal:h,clearHideTimeout:u,startHideTimeout:b,hoverBlockId:S,isModalVisible:x}=e.useSubmodalStore(),{setPositionBlock:c}=e.useLayersStore(),[R,w]=j.useState(!1),[d,k]=j.useState(!1),[f,g]=j.useState(!1),[m,_]=j.useState(!1),[C,E]=j.useState(null),{attributes:z,listeners:y,setNodeRef:P,transform:I,transition:v}=e.useSortable({id:t}),V={transform:e.CSS.Transform.toString(I),transition:v},W=()=>{x&&h(),a(t),u()},M=(L,H=!0)=>{L.stopPropagation(),l(),p(t),u(),c(t,H)},F=()=>{x?b():l()};return j.useEffect(()=>{g(!1),w(!1),k(!1),_(!1)},[s]),j.useEffect(()=>{x||(k(!1),w(!1))},[x]),e.jsxRuntimeExports.jsxs("div",{ref:P,style:V,className:e.clx(X.wrapper,{[X.draggingWrapper]:s&&r===t}),onClick:()=>n(t),onMouseEnter:W,onMouseLeave:F,...z,...y,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(X.block,{[X.dragging]:s&&r===t,[X.active]:!s&&r===t}),children:[i?e.jsxRuntimeExports.jsx("img",{src:i,width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:X.nameBlock,children:o}),S===t&&!s&&e.jsxRuntimeExports.jsx("div",{className:e.clx(X.addTop,{[X.visible]:d}),onMouseEnter:()=>{k(!0)},onMouseLeave:()=>{k(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:X.button,onClick:L=>M(L,!1),onMouseEnter:()=>{const L=setTimeout(()=>{s||_(!0)},200);E(L)},onMouseLeave:()=>{C&&clearTimeout(C),_(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),m&&e.jsxRuntimeExports.jsx(Se,{text:"Click to add a section"})]})}),S===t&&!s&&e.jsxRuntimeExports.jsx("div",{className:e.clx(X.add,{[X.visible]:R}),onMouseEnter:()=>{w(!0)},onMouseLeave:()=>{w(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:X.button,onClick:L=>M(L),onMouseEnter:()=>{const L=setTimeout(()=>{s||g(!0)},200);E(L)},onMouseLeave:()=>{C&&clearTimeout(C),g(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),f&&e.jsxRuntimeExports.jsx(Se,{text:"Click to add a section"})]})})]}),S===t&&!s&&e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})})]})},Xn=()=>{const{blocks:t,setCurrentBlock:o,moveBlock:n,isLoadingLayers:s}=e.useLayersStore(),{currentPage:i,pages:r}=e.usePagesStore(),{setMouseOverModal:a,setHoverBlockId:l}=e.useSubmodalStore(),{sourceBlocks:p}=e.useBlocksStore();function h(w){o(w),a(!1),l(null)}function u(w){if(!p||!p[w])return"unknown name";const d=new p[w];return!d.blockSettings||!d.blockSettings.displayName?"unknown name":d.blockSettings.displayName}const b=e.useSensors(e.useSensor(e.PointerSensor,{activationConstraint:{distance:5}})),[S,x]=j.useState(!1),c=()=>{x(!0)},R=w=>{x(!1);const{active:d,over:k}=w;if(k&&d.id!==k.id&&r&&r[i]){const f=r[i].path,g=t[f].order,m=g.indexOf(d.id),_=g.indexOf(k.id);m!==-1&&_!==-1&&n(f,m,_)}};return e.jsxRuntimeExports.jsx("div",{className:X.layers,children:s?e.jsxRuntimeExports.jsx("div",{className:X.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Vn,{}),e.jsxRuntimeExports.jsx(e.DndContext,{sensors:b,onDragEnd:R,onDragStart:c,children:r&&r[i]&&t[r[i].path]&&e.jsxRuntimeExports.jsx(e.SortableContext,{items:t[r[i].path].order,strategy:e.verticalListSortingStrategy,children:t[r[i].path].order.map((w,d)=>e.jsxRuntimeExports.jsx(Zn,{id:w,name:u(t[r[i].path].data[w].name),index:d,onClick:h,isDragging:S,icon:be[t[r[i].path].data[w].name]},w))})}),e.jsxRuntimeExports.jsx(Wn,{})]})})},Yn=({isHeader:t})=>{const{header:o,footer:n}=e.useLayersStore(),{pageContext:s}=e.usePagesStore();return t?o==null?void 0:o.renderSettings(s):n==null?void 0:n.renderSettings(s)},Kn="_loader_eyvkk_1",Qn={loader:Kn},Jn=()=>{const{isLoadingSettings:t}=e.useSettingsStore();return t?e.jsxRuntimeExports.jsx("div",{className:Qn.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsx(er,{})},er=()=>{const{settings:t}=e.useSettingsStore(),o=e.useNavigate(),{setError:n}=e.useErrorStore();try{return t==null?void 0:t.renderSettings()}catch(s){return console.error("Error rendering settings:",s),n({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),o("/error"),null}},tr="_theme_a1one_1",sr="_block_a1one_8",or="_name_a1one_23",nr="_loader_a1one_27",ye={theme:tr,block:sr,name:or,loader:nr},rr=()=>{const t=e.useNavigate(),{isLoadingThemeSettings:o}=e.useThemeSettingsStore();function n(s){switch(s==null?void 0:s.name){case"Colors":t("/admin/builder/theme/colors");break;case"Fonts":t("/admin/builder/theme/fonts");break;case"Borders":t("/admin/builder/theme/borders");break;case"Buttons":t("/admin/builder/theme/buttons");break;case"Inputs":t("/admin/builder/theme/inputs");break}}return e.jsxRuntimeExports.jsx("div",{className:ye.theme,children:o?e.jsxRuntimeExports.jsx("div",{className:ye.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):ge.map(s=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>n(s),className:e.clx(ye.block),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:s.icon}),e.jsxRuntimeExports.jsx("span",{className:ye.name,children:s.name}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight"})]},s.icon))})},ir="_back_7e826_1",ar="_render_7e826_9",lr="_open_7e826_24",cr="_close_7e826_51",ur="_clicked_7e826_55",dr="_title_7e826_59",pr="_button_7e826_67",mr="_loading_7e826_72",xr="_settings_7e826_76",hr="_deleteButton_7e826_82",gr="_backIcon_7e826_95",Q={back:ir,render:ar,open:lr,close:cr,clicked:ur,title:dr,button:pr,loading:mr,settings:xr,deleteButton:hr,backIcon:gr},jr=({block:t})=>{const{pageContext:o}=e.usePagesStore(),n=e.useNavigate(),{setError:s}=e.useErrorStore();try{return t.renderSettings(o)}catch(i){return console.error("Error rendering settings:",i),s({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),n("/error"),null}},Sr="_wrapper_15ju8_1",fr="_header_15ju8_8",_r="_title_15ju8_15",br="_colorWrapper_15ju8_21",wr="_name_15ju8_35",Cr="_color_15ju8_21",vr="_value_15ju8_47",kr="_length_15ju8_51",Y={wrapper:Sr,header:fr,title:_r,colorWrapper:br,name:wr,color:Cr,value:vr,length:kr},ot=t=>{const{colors:o,isAddable:n}=t,{themeSettings:s}=e.useThemeSettingsStore(),[i,r]=j.useState(!1);j.useEffect(()=>{o.length<=3&&r(!0)},[]);function a(l){const p=l.replace("--",""),[h,u]=p.split("-"),b=`${u.charAt(0).toUpperCase()+u.slice(1)} ${h.charAt(0).toUpperCase()+h.slice(1)}`,[S,x]=p.split("-");return{name:b,field:S,variable:x}}return e.jsxRuntimeExports.jsxs("div",{className:Y.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:Y.header,children:[e.jsxRuntimeExports.jsx("div",{className:Y.title,children:"Section Colors"}),!i&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(Y.value,Y.length),onClick:()=>r(!0),children:["+",o.length]})]}),i&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:Y.colors,children:o.map(l=>{const p=a(l),{variable:h,name:u,field:b}=p;return e.jsxRuntimeExports.jsx(Er,{color:s.colors[b][h],name:u,isAddable:n})})}),o.length>3&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(Y.value,Y.length),onClick:()=>r(!1),children:["Hide ",o.length," colors"]})]})]})},Er=t=>{const{name:o,color:n,isAddable:s}=t,{setActiveLabel:i,setModalPosition:r,setInitialColor:a,setShowModal:l,setUpdate:p,setColor:h,setColorChange:u,colorChange:b}=e.useColorPickerStore(),{updateColor:S}=e.useThemeSettingsStore(),x=(w,d)=>k=>{S(w,d,k)};j.useEffect(()=>{const w=()=>{l(!1),i(null),a(n),p(()=>{}),h(n),u(()=>{})};return document.body.addEventListener("click",w),()=>{document.body.removeEventListener("click",w)}},[]);const c=w=>{const d=o.split("/")[0],k=o.split("/")[1];w.stopPropagation(),s||l(!0),u(b),p(W=>x(d,k)(W)),a(n),h(n);const f=w.currentTarget.getBoundingClientRect(),g=400,m=288,_=10,C=20,E=window.innerHeight-f.bottom,z=f.top,y=window.innerWidth-f.right,P=f.left;let I,v;I=f.bottom+_+window.scrollY,v=f.left,(E<g||E<C)&&(z>=g?I=f.top-g-_+window.scrollY:I=window.scrollY+(window.innerHeight-g)/2),y<m&&(P>=m?v=f.right-m:v=(window.innerWidth-m)/2),v<f.right&&v+m>f.left&&I<f.bottom&&I+g>f.top&&(y>=m?v=f.right+_+100:E>=g?I=f.bottom+_+window.scrollY:(I=window.scrollY+(window.innerHeight-g)/2,v=(window.innerWidth-m)/2)),r({top:I,left:v})};function R(w){return w.length>15?w.slice(0,15)+"...":w}return e.jsxRuntimeExports.jsxs("div",{className:Y.colorWrapper,onClick:c,children:[e.jsxRuntimeExports.jsx("div",{className:Y.color,style:{background:n}}),e.jsxRuntimeExports.jsx("div",{className:Y.name,children:o}),e.jsxRuntimeExports.jsx("div",{className:Y.value,children:R(n)})]})},Rr=t=>{var M,F;const{isAdd:o}=t,[n,s]=j.useState(!1),{setActiveBlock:i}=e.useNavbarStore(),{sourceBlocks:r,activeBlock:a,setActiveBlock:l,currentInstance:p,setCurrentInstance:h}=e.useBlocksStore(),{setTitle:u,setDescription:b,setOnConfirm:S}=e.useConfirmationModalStore(),x=e.useNavigate(),{blocks:c,addBlock:R,editBlock:w,currentBlock:d,setCurrentBlock:k,removeBlock:f,setPositionBlock:g,setHeader:m,setFooter:_,header:C,footer:E,isLoadingLayers:z}=e.useLayersStore(),{currentPage:y,pages:P}=e.usePagesStore();function I(L=!1){if(!o&&P&&p&&!L){const H={blockSettings:{}};Object.keys(p.blockSettings).filter(re=>!["displayName","isAddable"].includes(re)).map(re=>{H.blockSettings[re]=p.blockSettings[re]}),w(P[y].path,d,{name:c[P[y].path].data[d].name,value:H})}l(null),k(null),setTimeout(()=>{s(!1)},150),h(null)}function v(){I(),i({name:"Layers",icon:"TreeStructure"}),h(null)}function V(){var L;if(o)return!a||!r[a]?null:new r[a];{if(!P||!P[y]||!d)return null;const H=c[P[y].path].data[d];return!H||!r[H.name]?null:new r[H.name]((L=H.value)==null?void 0:L.blockSettings)}}j.useEffect(()=>{if(a||d&&!["header","footer"].includes(d)){const L=V();h(L)}else h(null)},[a,d]),j.useEffect(()=>{d==="header"&&m(C)},[d,C]),j.useEffect(()=>{d==="footer"&&_(E)},[d,E]);function W(L){if(!r)return"unknown name";if(!r[L])return d==="header"?C==null?void 0:C.blockSettings.displayName:d==="footer"?E==null?void 0:E.blockSettings.displayName:"unknown name";const H=new r[L];return!H.blockSettings||!H.blockSettings.displayName?"unknown name":H.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Q.render,{[Q.open]:d||a,[Q.close]:!d&&!a,[Q.clicked]:n}),onClick:L=>L.stopPropagation(),style:{opacity:z?0:1},children:[e.jsxRuntimeExports.jsxs("div",{className:Q.back,children:[e.jsxRuntimeExports.jsx("div",{className:Q.backIcon,onClick:()=>I(),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("h3",{className:Q.title,children:a&&W(a)||P&&P[y]&&c[P[y].path]&&d&&W((M=c[P[y].path].data[d])==null?void 0:M.name)||d&&ee(d)||"Loading"}),!o&&d&&P&&!["header","footer"].includes(d)&&c[P[y].path].data[d]&&W((F=c[P[y].path].data[d])==null?void 0:F.name)!=="unknown name"&&e.jsxRuntimeExports.jsx("button",{onClick:L=>{var H;L.stopPropagation(),u("Remove Block"),b(`Are you sure you want to delete ${W((H=c[P[y].path].data[d])==null?void 0:H.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),S(()=>{s(!0),f(P[y].path,d),I(!0)})},className:Q.deleteButton,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]}),e.jsxRuntimeExports.jsxs("div",{className:Q.settings,children:[p&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(jr,{block:p}),e.jsxRuntimeExports.jsx(ot,{colors:p.blockColors,isAddable:o})]}),d&&["header","footer"].includes(d)&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Yn,{isHeader:d==="header"}),e.jsxRuntimeExports.jsx(ot,{colors:d==="header"?C.blockColors:E.blockColors,isAddable:!1})]}),!a&&!d&&e.jsxRuntimeExports.jsx("div",{className:Q.loading,children:"Loading"})]}),o&&e.jsxRuntimeExports.jsx("div",{className:Q.addButton,children:e.jsxRuntimeExports.jsx(e.Button,{style:{width:"100%"},onClick:()=>{if(s(!0),!["header","footer"].includes(d)&&P){const L={blockSettings:{},blockColors:p.blockColors};Object.keys(p.blockSettings).filter(H=>!["displayName","isAddable"].includes(H)).map(H=>{L.blockSettings[H]=p.blockSettings[H]}),R(P[y].path,{name:a,value:L}),g(null,!1)}else d==="header"?m(C):_(E);x("/admin/builder"),v()},children:"Add Section"})})]})},yr="_settings_12jh6_1",Lr="_open_12jh6_16",Tr="_close_12jh6_20",Br="_header_12jh6_24",Nr="_title_12jh6_31",Ar="_addButton_12jh6_38",Pr="_backIcon_12jh6_47",Ir="_loader_12jh6_57",ae={settings:yr,open:Lr,close:Tr,header:Br,title:Nr,addButton:Ar,backIcon:Pr,loader:Ir},Mr="_wrapper_joj7w_1",$r="_category_joj7w_5",Fr="_categoryTitle_joj7w_11",Hr="_color_joj7w_17",Dr="_content_joj7w_26",Or="_preview_joj7w_35",he={wrapper:Mr,category:$r,categoryTitle:Fr,color:Hr,content:Dr,preview:Or},de=t=>{const{initialColor:o,onChange:n,title:s,labelStyle:i="primary",isGradientActive:r=!0}=t,[a,l]=j.useState(o);j.useEffect(()=>{l(o)},[o]);const{setActiveLabel:p,setModalPosition:h,setInitialColor:u,setShowModal:b,setUpdate:S,setColor:x,setColorChange:c,setIsGradientActive:R,colorChange:w}=e.useColorPickerStore();j.useEffect(()=>{const k=()=>{b(!1),p(null),u(o),S(()=>{}),x(o),c(()=>{})};return document.body.addEventListener("click",k),()=>{document.body.removeEventListener("click",k)}},[o,p,x,c,u,b,S]);const d=k=>{k.stopPropagation(),b(!0),c(l),S(n),u(o),x(a),R(r);const f=k.currentTarget.getBoundingClientRect(),g=400,m=288,_=10,C=20,E=window.innerHeight-f.bottom,z=f.top,y=window.innerWidth-f.right,P=f.left;let I,v;I=f.bottom+_+window.scrollY,v=f.left,(E<g||E<C)&&(z>=g?I=f.top-g-_+window.scrollY:I=window.scrollY+(window.innerHeight-g)/2),y<m&&(P>=m?v=f.right-m:v=(window.innerWidth-m)/2),v<f.right&&v+m>f.left&&I<f.bottom&&I+g>f.top&&(y>=m?v=f.right+_+100:E>=g?I=f.bottom+_+window.scrollY:(I=window.scrollY+(window.innerHeight-g)/2,v=(window.innerWidth-m)/2)),h({top:I,left:v})};return e.jsxRuntimeExports.jsxs("div",{className:$.content,children:[e.jsxRuntimeExports.jsx("span",{className:e.clx($.name,{[$.secondary]:i==="secondary"}),children:s}),e.jsxRuntimeExports.jsxs("label",{htmlFor:"color",className:$.label,children:[e.jsxRuntimeExports.jsx("div",{className:$.colorValue,style:{background:a},onClick:d}),e.jsxRuntimeExports.jsx("input",{type:"text",value:a,onChange:k=>{const f=k.target.value;n(f),x(f),l(f),w(f)},className:$.input})]})]})},Ur=()=>{const{themeSettings:t,updateColor:o}=e.useThemeSettingsStore();async function n(i,r,a){o(i,r,a)}const s=j.useMemo(()=>{const i={};return Object.entries(t.colors).forEach(([r,a])=>{Object.entries(a).forEach(([l,p])=>{i[p]||(i[p]=[]),i[p].push(`${r}-${l}`)})}),Object.keys(i).filter(r=>i[r].length>1)},[t.colors]);return e.jsxRuntimeExports.jsx("div",{className:he.wrapper,children:Object.entries(t.colors).map(([i,r])=>e.jsxRuntimeExports.jsxs("div",{className:he.category,children:[e.jsxRuntimeExports.jsx("h2",{className:he.categoryTitle,children:ee(i)}),Object.entries(r).map(([a,l])=>e.jsxRuntimeExports.jsxs("div",{className:he.color,children:[e.jsxRuntimeExports.jsxs("div",{className:he.content,children:[e.jsxRuntimeExports.jsx("div",{className:he.preview,style:{background:l}}),e.jsxRuntimeExports.jsx(de,{title:ee(a),initialColor:l,onChange:p=>n(i,a,p)})]}),s.includes(l)&&e.jsxRuntimeExports.jsx(Ve,{type:"warning",message:"To avoid contrast problems, please use a different color",style:{marginBottom:12}})]},a))]},i))})},qr="_wrapper_dv4am_2",zr="_category_dv4am_6",Vr="_categoryTitle_dv4am_12",Gr="_color_dv4am_18",Wr="_name_dv4am_24",Zr="_content_dv4am_29",Xr="_label_dv4am_36",Yr="_input_dv4am_48",Kr="_title_dv4am_74",Qr="_field_dv4am_82",Jr="_alignments_dv4am_92",ei="_lineField_dv4am_98",ti="_style_dv4am_106",si="_header_dv4am_113",se={wrapper:qr,category:zr,categoryTitle:Vr,color:Gr,name:Wr,content:Zr,label:Xr,input:Yr,title:Kr,field:Qr,alignments:Jr,lineField:ei,style:ti,header:si},oi="_blocks_emecf_1",ni="_block_emecf_1",ri="_active_emecf_21",He={blocks:oi,block:ni,active:ri},nt=t=>{const{items:o,selectedItem:n,onSelect:s,getIconName:i}=t;return e.jsxRuntimeExports.jsx("div",{className:He.blocks,children:o.map(r=>e.jsxRuntimeExports.jsx("div",{className:e.clx(He.block,{[He.active]:n===r}),onClick:()=>s(r),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i(r),fill:n===r?"#252525":"#757575"})},String(r)))})},ii=["left","center","right"],ai=["solid","dashed"],Le=t=>{const{title:o,children:n,rightAddon:s}=t;return e.jsxRuntimeExports.jsxs("div",{className:se.field,children:[e.jsxRuntimeExports.jsxs("div",{className:se.header,children:[e.jsxRuntimeExports.jsx("h4",{children:o}),s]}),n]})},li=()=>{const{themeSettings:t,updateInput:o}=e.useThemeSettingsStore(),n=j.useMemo(()=>t.inputs,[t]),s=(r,a,l)=>{o(r,a,l)},i=r=>a=>{o(r,a,"color")};return e.jsxRuntimeExports.jsxs("div",{className:se.wrapper,children:[e.jsxRuntimeExports.jsxs(Le,{title:"General",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(n.general.height),onChange:r=>s("general",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>s("general",r,"size"),value:String(n.general.size),options:e.sizeOptions}),e.jsxRuntimeExports.jsx(de,{initialColor:ee(n.general.color),onChange:i("general"),title:"Font Color",labelStyle:"secondary"})]}),e.jsxRuntimeExports.jsx(Le,{title:"Field Fill",rightAddon:e.jsxRuntimeExports.jsx("div",{className:se.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>s("field",r,"active"),current:n.field.active})}),children:e.jsxRuntimeExports.jsx(de,{initialColor:ee(n.field.color),onChange:i("field"),title:"Color",labelStyle:"secondary"})}),e.jsxRuntimeExports.jsxs(Le,{title:"Border",rightAddon:e.jsxRuntimeExports.jsx("div",{className:se.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>s("border",r,"active"),current:n.border.active})}),children:[e.jsxRuntimeExports.jsxs("div",{className:se.lineField,children:[e.jsxRuntimeExports.jsxs("div",{className:se.style,children:[e.jsxRuntimeExports.jsx("span",{className:se.title,children:"Style"}),e.jsxRuntimeExports.jsx(nt,{items:ai,selectedItem:n.border.style,onSelect:r=>s("border",r,"style"),getIconName:r=>r==="solid"?"Minus":"Selection"})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Radius (px)",value:String(n.border.radius),onChange:r=>s("border",r,"radius"),type:"number",min:0})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Thickness (px)",value:String(n.border.thickness),onChange:r=>s("border",r,"thickness"),type:"number",min:0}),e.jsxRuntimeExports.jsx(de,{initialColor:ee(n.border.color),onChange:i("border"),title:"Color",labelStyle:"secondary"})]}),e.jsxRuntimeExports.jsxs(Le,{title:"Label",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Line Height (px)",value:String(n.label.height),onChange:r=>s("label",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>s("label",r,"size"),value:String(n.label.size),options:e.sizeOptions}),e.jsxRuntimeExports.jsx(de,{initialColor:ee(n.label.color),onChange:i("label"),title:"Color",labelStyle:"secondary"}),e.jsxRuntimeExports.jsxs("div",{className:se.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:se.title,children:"Alignment Type"}),e.jsxRuntimeExports.jsx(nt,{items:ii,selectedItem:n.label.alignment,onSelect:r=>s("label",r,"alignment"),getIconName:r=>r==="center"?"AlignCenterHorizontal":r==="left"?"AlignLeft":"AlignRight"})]})]})]})},ci="_wrapper_mkmxa_1",ui="_category_mkmxa_5",di="_categoryTitle_mkmxa_11",pi="_font_mkmxa_17",mi="_content_mkmxa_32",xi="_icon_mkmxa_39",hi="_paragraph_mkmxa_50",gi="_deleteIcon_mkmxa_54",ji="_iconButton_mkmxa_61",ne={wrapper:ci,category:ui,categoryTitle:di,font:pi,content:mi,icon:xi,paragraph:hi,deleteIcon:gi,iconButton:ji},Si=t=>{const{font:o,size:n,id:s,category:i}=t,{setActiveFont:r}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsxs("div",{className:ne.font,onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(ne.icon,{[ne.paragraph]:i==="paragraph"}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i==="paragraph"?"TextB":"TextH"})}),e.jsxRuntimeExports.jsxs("div",{className:ne.content,children:[e.jsxRuntimeExports.jsx("h2",{className:ne.categoryTitle,children:ee(s)}),e.jsxRuntimeExports.jsx("span",{className:ne.value,children:`${o}, ${n}px`})]})]})},fi=()=>{const{themeSettings:t,setActiveFont:o,activeBlock:n}=e.useThemeSettingsStore();j.useEffect(()=>(s(),()=>{s()}),[]);function s(){o(null)}if(n!=null&&n.name)return e.jsxRuntimeExports.jsx("div",{className:ne.wrapper,children:Object.entries(t.fonts.desktop).map(([i,r])=>e.jsxRuntimeExports.jsxs("div",{className:ne.category,children:[e.jsxRuntimeExports.jsx("h2",{className:ne.categoryTitle,children:ee(i)}),Object.entries(r).map(([a,l])=>e.jsxRuntimeExports.jsx(Si,{id:a,category:i,...l},a))]},i))})},_i="_wrapper_ikvjo_1",bi="_open_ikvjo_16",wi="_close_ikvjo_20",Ci="_header_ikvjo_24",vi="_title_ikvjo_32",ki="_options_ikvjo_38",Ei="_clicked_ikvjo_45",Ri="_backIcon_ikvjo_49",yi="_charge_ikvjo_59",Li="_chargeActive_ikvjo_78",le={wrapper:_i,open:bi,close:wi,header:Ci,title:vi,options:ki,clicked:Ei,backIcon:Ri,charge:yi,chargeActive:Li},Ti=()=>{const{activeBlock:t,setActiveFont:o,activeFont:n,themeSettings:s,updateFont:i}=e.useThemeSettingsStore(),{fonts:r}=e.useFontsStore(),[a,l]=j.useState(null);function p(){o(null)}function h(b,S){a&&n&&i(a,n,S,b)}const u=j.useMemo(()=>n?s.fonts.desktop.heading[n]?(l("heading"),s.fonts.desktop.heading[n]):s.fonts.desktop.paragraph[n]?(l("paragraph"),s.fonts.desktop.paragraph[n]):(l(null),null):null,[n,s]);return e.jsxRuntimeExports.jsxs("div",{className:e.clx(le.wrapper,{[le.open]:(t==null?void 0:t.name)==="Fonts"&&n,[le.close]:(t==null?void 0:t.name)!=="Fonts"||!n}),children:[e.jsxRuntimeExports.jsxs("div",{className:le.header,children:[e.jsxRuntimeExports.jsx("div",{className:le.backIcon,onClick:p,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:le.title,children:"Font Style"})]}),n&&u&&e.jsxRuntimeExports.jsxs("div",{className:le.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:u.font,onChange:b=>h(b,"font"),options:[...r.filter(b=>b!==u.font)]}),e.jsxRuntimeExports.jsx(e.Select,{label:"Size",value:String(u.size),onChange:b=>h(b,"size"),options:e.sizeOptions}),e.jsxRuntimeExports.jsx(e.Select,{label:"Weight",value:String(u.weight),onChange:b=>h(b,"weight"),options:e.weightOptions})]})]})},Bi="_wrapper_yet01_1",Ni="_open_yet01_16",Ai="_close_yet01_20",Pi="_header_yet01_24",Ii="_title_yet01_32",Mi="_options_yet01_38",$i="_clicked_yet01_45",Fi="_backIcon_yet01_49",ce={wrapper:Bi,open:Ni,close:Ai,header:Pi,title:Ii,options:Mi,clicked:$i,backIcon:Fi},at=()=>{const{activeBlock:t,themeSettings:o,updateBorder:n,setActiveBlock:s}=e.useThemeSettingsStore();function i(p,h){n(h,p)}const r=e.useNavigate();function a(){s(null),r("/admin/builder/theme")}const l=j.useMemo(()=>o.borders,[o]);return e.jsxRuntimeExports.jsxs("div",{className:e.clx(ce.wrapper,{[ce.open]:(t==null?void 0:t.name)==="Borders",[ce.close]:(t==null?void 0:t.name)!=="Borders"}),children:[e.jsxRuntimeExports.jsxs("div",{className:ce.header,children:[e.jsxRuntimeExports.jsx("div",{className:ce.backIcon,onClick:a,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:ce.title,children:"Borders Style"})]}),e.jsxRuntimeExports.jsxs("div",{className:ce.options,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Border Radius (px)",value:String(l.radius),onChange:p=>i(Number(p),"radius"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Input,{label:"Border Thickness (px)",value:String(l.thickness),onChange:p=>i(Number(p),"thickness"),type:"number",min:0})]})]})},Hi="_wrapper_pg54d_1",Di="_open_pg54d_17",Oi="_close_pg54d_21",Ui="_header_pg54d_25",qi="_title_pg54d_33",zi="_options_pg54d_39",Vi="_clicked_pg54d_46",Gi="_label_pg54d_50",Wi="_alignments_pg54d_57",Zi="_blocks_pg54d_63",Xi="_alignment_pg54d_57",Yi="_active_pg54d_82",Ki="_chargeTypes_pg54d_89",Qi="_charge_pg54d_89",Ji="_chargeActive_pg54d_117",ea="_shadowsHeader_pg54d_125",ta="_sliderContainer_pg54d_131",sa="_shadowInputs_pg54d_139",oa="_shadowInputsRow_pg54d_159",na="_shadowInputsOpen_pg54d_167",ra="_toggleIcon_pg54d_173",ia="_toggleIconActive_pg54d_177",aa="_backIcon_pg54d_181",G={wrapper:Hi,open:Di,close:Oi,header:Ui,title:qi,options:zi,clicked:Vi,label:Gi,alignments:Wi,blocks:Zi,alignment:Xi,active:Yi,chargeTypes:Ki,charge:Qi,chargeActive:Ji,shadowsHeader:ea,sliderContainer:ta,shadowInputs:sa,shadowInputsRow:oa,shadowInputsOpen:na,toggleIcon:ra,toggleIconActive:ia,backIcon:aa},la=["left","center","right"],lt=()=>{const{activeBlock:t,themeSettings:o,updateButton:n,setActiveBlock:s}=e.useThemeSettingsStore(),{fonts:i}=e.useFontsStore(),[r,a]=j.useState("primary");function l(c,R){n(r,R,c)}const[p,h]=j.useState(!1),u=o.buttons[r],b=e.useNavigate();function S(){s(null),b("/admin/builder/theme")}function x(c,R){l({...u.boxShadow,[c]:R},"boxShadow")}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(G.wrapper,{[G.open]:(t==null?void 0:t.name)==="Buttons",[G.close]:(t==null?void 0:t.name)!=="Buttons"}),children:[e.jsxRuntimeExports.jsxs("div",{className:G.header,children:[e.jsxRuntimeExports.jsx("div",{className:G.backIcon,onClick:S,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:G.title,children:"Buttons Style"})]}),e.jsxRuntimeExports.jsx("div",{className:G.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(c=>e.jsxRuntimeExports.jsx("div",{className:e.clx(G.charge,{[G.chargeActive]:r===c}),onClick:()=>a(c),children:c.charAt(0).toUpperCase()+c.slice(1)},c))}),u&&e.jsxRuntimeExports.jsxs("div",{className:G.options,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(u.height),onChange:c=>l(Number(c),"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",value:String(u.size),onChange:c=>l(Number(c),"size"),options:e.sizeOptions}),e.jsxRuntimeExports.jsx(e.Input,{label:"Border Radius (px)",value:String(u.radius),onChange:c=>l(Number(c),"radius"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:u.font,onChange:c=>l(c,"font"),options:[...i.filter(c=>c!==u.font)]}),e.jsxRuntimeExports.jsx(de,{initialColor:u.background,onChange:c=>l(c,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),e.jsxRuntimeExports.jsxs("div",{className:G.sliderContainer,children:[e.jsxRuntimeExports.jsx("h4",{className:G.label,children:"Shadow"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:()=>h(!p),style:{padding:5},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretUp",style:{rotate:p?"0deg":"-180deg",transition:"0.3s rotate ease"}})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(G.shadowInputs,{[G.shadowInputsOpen]:p}),children:[e.jsxRuntimeExports.jsxs("div",{className:G.shadowInputsRow,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Left (px)",value:String(u.boxShadow.left),onChange:c=>x("left",Number(c)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Top (px)",value:String(u.boxShadow.top),onChange:c=>x("top",Number(c)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Blur (px)",value:String(u.boxShadow.blur),onChange:c=>x("blur",Number(c)),type:"number"}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,whiteSpace:"nowrap"},children:e.jsxRuntimeExports.jsx(e.Input,{label:"Spread (px)",value:String(u.boxShadow.spread),onChange:c=>x("spread",Number(c)),type:"number"})})]}),e.jsxRuntimeExports.jsx(de,{initialColor:u.boxShadow.color,onChange:c=>x("color",c),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs("div",{className:G.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:G.label,children:"Alignment Type"}),e.jsxRuntimeExports.jsx("div",{className:G.blocks,children:la.map(c=>e.jsxRuntimeExports.jsx("div",{className:e.clx(G.alignment,{[G.active]:u.alignment===c}),onClick:()=>{l(c,"alignment")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:c==="center"?"AlignCenterHorizontal":c==="left"?"AlignLeft":"AlignRight",fill:u.alignment===c?"#252525":"#757575"})},c))})]}),e.jsxRuntimeExports.jsx(e.Switch,{label:"Enable Hover",onChange:c=>l(c,"hover"),current:u.hover})]})]})},ca=()=>{const{activeBlock:t,themeSettings:o}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(t==null?void 0:t.name)==="Fonts"&&o.fonts&&e.jsxRuntimeExports.jsx(Ti,{}),(t==null?void 0:t.name)==="Borders"&&o.borders&&e.jsxRuntimeExports.jsx(at,{}),(t==null?void 0:t.name)==="Buttons"&&o.buttons&&e.jsxRuntimeExports.jsx(lt,{})]})},ua=()=>{const{activeBlock:t,setActiveBlock:o,themeSettings:n,isLoadingThemeSettings:s}=e.useThemeSettingsStore(),{activeBlock:i}=e.useNavbarStore(),r=e.useNavigate();function a(){o(null),r("/admin/builder/theme")}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(ae.settings,{[ae.open]:t,[ae.close]:!t||i.name!=="Theme"}),children:[e.jsxRuntimeExports.jsxs("div",{className:ae.header,children:[e.jsxRuntimeExports.jsx("div",{className:ae.backIcon,onClick:a,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:ae.title,children:t==null?void 0:t.name})]}),s?e.jsxRuntimeExports.jsx("div",{className:ae.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(fi,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(Ur,{}),(t==null?void 0:t.name)==="Inputs"&&n.inputs&&e.jsxRuntimeExports.jsx(li,{}),(t==null?void 0:t.name)==="Borders"&&n.borders&&e.jsxRuntimeExports.jsx(at,{}),(t==null?void 0:t.name)==="Buttons"&&n.buttons&&e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsx(ca,{})]})]})},da=()=>{const{activeBlock:t}=e.useNavbarStore(),{activeBlock:o}=e.useBlocksStore(),{showTooltip:n}=e.useTooltipStore();function s(){switch(t.name){case"Layers":return"Layers";case"Add":return"Add Sections";case"Theme":return"Theme Settings";case"Settings":return"Settings"}}return e.jsxRuntimeExports.jsxs("div",{className:et.sidebar,style:{zIndex:n?50:"auto"},children:[e.jsxRuntimeExports.jsx("h3",{className:et.title,children:s()}),t.name==="Layers"&&e.jsxRuntimeExports.jsx(Xn,{}),t.name==="Add"&&e.jsxRuntimeExports.jsx(it,{}),e.jsxRuntimeExports.jsx(Rr,{isAdd:!!o}),e.jsxRuntimeExports.jsx(ua,{}),t.name==="Theme"&&e.jsxRuntimeExports.jsx(rr,{}),t.name==="Settings"&&e.jsxRuntimeExports.jsx(Jn,{})]})},pa="_wrapper_pz7dv_1",ma="_header_pz7dv_12",xa="_content_pz7dv_23",ha="_buttons_pz7dv_31",ga="_label_pz7dv_38",ja="_description_pz7dv_39",Sa="_preview_pz7dv_47",fa="_block_pz7dv_53",_a="_slug_pz7dv_62",ba="_title_pz7dv_68",wa="_closeIcon_pz7dv_74",J={wrapper:pa,header:ma,content:xa,buttons:ha,label:ga,description:ja,preview:Sa,block:fa,slug:_a,title:ba,closeIcon:wa},Ca="_wrapper_ba9vp_2",va="_label_ba9vp_10",ka="_options_ba9vp_18",Ea="_radioLabel_ba9vp_24",Ra="_radio_ba9vp_24",ya="_custom_ba9vp_39",La="_option_ba9vp_18",ue={wrapper:Ca,label:va,options:ka,radioLabel:Ea,radio:Ra,custom:ya,option:La},Ta=t=>{const{defaultValue:o,options:n,onChange:s,label:i}=t,[r,a]=j.useState(o),l=p=>{const h=p.target.value;a(h),s(h)};return e.jsxRuntimeExports.jsxs("div",{className:ue.wrapper,children:[e.jsxRuntimeExports.jsx("span",{className:ue.label,children:i}),e.jsxRuntimeExports.jsx("div",{className:ue.options,children:n.map(p=>e.jsxRuntimeExports.jsxs("label",{className:ue.radioLabel,children:[e.jsxRuntimeExports.jsx("input",{type:"radio",value:p.value,checked:r===p.value,onChange:l,className:ue.radio}),e.jsxRuntimeExports.jsx("span",{className:ue.custom}),e.jsxRuntimeExports.jsx("span",{className:ue.option,children:p.label})]},p.value))})]})},Ba=()=>{var z,y,P,I,v,V,W;const{setIsOpenModal:t,pages:o,createPage:n,updatePage:s,isEdit:i,setIsEdit:r,editedPage:a,setEditedPage:l,pageContext:p}=e.usePagesStore(),{setIsOpen:h}=e.useModalStore(),{createPage:u,updatePage:b}=e.useLayersStore(),[S,x]=j.useState(a?o&&((z=o[a])==null?void 0:z.path):""),[c,R]=j.useState(a?o&&((y=o[a])==null?void 0:y.name):""),[w,d]=j.useState(a?o&&((P=o[a])==null?void 0:P.seo)&&((v=(I=o[a])==null?void 0:I.seo)==null?void 0:v.description)||"":`${p.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`),[k,f]=j.useState(a?o&&((V=o[a])==null?void 0:V.visibility):"public");function g(){x(""),R(""),d(""),f("public"),r(!1),l(null)}function m(){h(!1),setTimeout(()=>{g(),t(!1),h(!0)},300)}function _(M){return M[0]==="/"?M:"/"+M}function C(){n({path:_(S),name:c||S||"",icon:"File",seo:{title:c||"",description:w||""},visibility:k||"public"}),u(S),m()}function E(){o&&(b(o[a].name||"",c||S||""),s(a,{path:_(S),name:c||S,icon:o[a].icon||"File",seo:{title:c||"",description:w||""},visibility:k||"public"})),m()}return e.jsxRuntimeExports.jsxs("div",{className:J.wrapper,onClick:M=>M.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:J.header,children:[e.jsxRuntimeExports.jsx("h2",{children:i?"Edit Page":"Create New Page"}),e.jsxRuntimeExports.jsx("div",{className:J.closeIcon,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:m})})]}),e.jsxRuntimeExports.jsxs("div",{className:J.content,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Page Slug",onChange:M=>x(M),value:S,placeholder:"path-to-page",disabled:!!(a&&o&&((W=o[a])!=null&&W.name)&&Ne.includes(o[a].name)),required:!0,regex:"^.+$"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Page Title",onChange:M=>R(M),value:c.charAt(0).toUpperCase()+c.slice(1),placeholder:"Contact us"}),e.jsxRuntimeExports.jsx(e.Textarea,{label:"Description",onChange:M=>d(M),value:w,placeholder:`${p.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`,maxLength:150}),e.jsxRuntimeExports.jsx(Ta,{label:"Visibility",defaultValue:k,options:[{value:"public",label:"Public"},{value:"private",label:"Private"}],onChange:M=>f(M)}),e.jsxRuntimeExports.jsxs("div",{className:J.preview,children:[e.jsxRuntimeExports.jsx("span",{className:J.label,children:"Preview"}),e.jsxRuntimeExports.jsxs("div",{className:J.block,children:[e.jsxRuntimeExports.jsx("span",{className:J.slug,children:S||"yoursite.url"}),e.jsxRuntimeExports.jsx("span",{className:J.title,children:c||"My Blank Page"}),e.jsxRuntimeExports.jsx("span",{className:J.description,children:w||"It is My Description"})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:J.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:m,type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:i?E:C,disabled:S.length===0,children:i?"Update":"Create"})]})]})},Na="_layout_3kge3_1",Aa="_main_3kge3_10",Pa="_content_3kge3_18",Ia="_notification_3kge3_26",Te={layout:Na,main:Aa,content:Pa,notification:Ia},Ma="_modal_1h74q_1",$a="_title_1h74q_14",Fa="_buttons_1h74q_20",Be={modal:Ma,title:$a,buttons:Fa},ct=()=>{const{title:t,description:o,onConfirm:n,setTitle:s,setDescription:i,setOnConfirm:r}=e.useConfirmationModalStore(),{setIsOpen:a}=e.useModalStore();function l(){a(!1),setTimeout(()=>{s(null),i(null),r(null),a(!0)},300)}return t&&o&&n&&e.jsxRuntimeExports.jsxs("div",{className:Be.modal,children:[e.jsxRuntimeExports.jsx("div",{className:Be.title,children:t}),e.jsxRuntimeExports.jsx("div",{className:Be.description,children:o}),e.jsxRuntimeExports.jsxs("div",{className:Be.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:l,children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:n,type:"Secondary",children:"Confirm"})]})]})},Ha=()=>{const{isOpenModal:t,setIsOpenModal:o}=e.usePagesStore(),{openModal:n,setOpenModal:s}=e.useChooseImageStore(),{notification:i,setNotification:r}=e.useNotificationStore(),{title:a,description:l,setTitle:p,setDescription:h,setOnConfirm:u}=e.useConfirmationModalStore(),[b,S]=j.useState(null);return j.useEffect(()=>{if(i){b&&clearTimeout(b);const x=setTimeout(()=>{r(null)},3e3);S(x)}},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:Te.layout,children:[e.jsxRuntimeExports.jsx(ao,{}),e.jsxRuntimeExports.jsxs("main",{className:Te.main,children:[e.jsxRuntimeExports.jsx(Qs,{}),e.jsxRuntimeExports.jsxs("div",{className:Te.content,children:[e.jsxRuntimeExports.jsx(da,{}),e.jsxRuntimeExports.jsx(wn,{})]})]})]}),a&&l&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{p(null),h(null),u(null)},children:e.jsxRuntimeExports.jsx(ct,{})}),t&&e.jsxRuntimeExports.jsx(e.Modal,{close:o,children:e.jsxRuntimeExports.jsx(Ba,{})}),n&&e.jsxRuntimeExports.jsx(e.Modal,{close:s,children:e.jsxRuntimeExports.jsx(e.ChooseImageModal,{})}),i&&e.jsxRuntimeExports.jsx("div",{className:Te.notification,children:e.jsxRuntimeExports.jsx(Ve,{message:i.message,type:i.status})})]})},Da=t=>{const{blocks:o,settings:n,header:s,footer:i}=t,{setBlocks:r,setSourceBlocks:a}=e.useBlocksStore(),{fonts:l,setFonts:p}=e.useFontsStore(),{setSettings:h}=e.useSettingsStore(),{setPageContext:u}=e.usePagesStore(),{setThemeSettings:b,setIsLoadingThemeSettings:S}=e.useThemeSettingsStore(),{setIsLoadingSettings:x}=e.useSettingsStore(),{setHeader:c,setFooter:R,setBlocks:w,blocks:d,createPage:k,setIsLoadingLayers:f}=e.useLayersStore(),{setPages:g}=e.usePagesStore();function m(_){return _[0]==="/"?_.slice(1):_}return j.useEffect(()=>{S(!0),f(!0),x(!0);const _={};Object.keys(o).forEach(E=>{_[E]=o[E]}),a(_),r(_),c(s),R(i),(async()=>{const{data:E}=await qt();let z={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null};const y=await Ht();Object.keys(y).map(M=>{const F=M;z[F]=y[F].value.data}),u(z);const{themeSettings:P,layers:I,settings:v}=E;if(v){const M=n;if(v.settings&&(Object.keys(v.settings).map(F=>{M[F]=v.settings[F]}),h(M)),v.header){const F=s;Object.keys(v.header).map(L=>{F[L]=v.header[L]}),c(F)}if(v.footer){const F=i;Object.keys(v.footer).map(L=>{F[L]=v.footer[L]}),R(F)}}else h(n);P&&b(P),w(I);const V=await Ut(),W={};if(V.data.length>0&&V.data.forEach(M=>{const F=m(M.path);d[F]||k(F),M.path==="/"?W["/"]={...M,icon:Ie.home.icon,name:"home"}:Ie[F]?W[F]={...M,icon:Ie[F].icon,name:F}:W[F]={...M,icon:"File",name:F}}),g(W),l.length===0){const M=await Dt();p([...M.map(F=>F.family)])}S(!1),f(!1),x(!1)})()},[]),e.jsxRuntimeExports.jsx(Ha,{})},Oa=t=>{const{blocks:o,settings:n,header:s,footer:i}=t,[r,a]=j.useState(!0),l=e.useNavigate();return j.useEffect(()=>{a(!0),zt()?a(!1):l("/")},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:r?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsx(Da,{blocks:o,settings:n,header:s,footer:i})})},Ua="_wrapper_1yd2j_1",qa="_error_1yd2j_11",za="_title_1yd2j_21",Va="_buttons_1yd2j_29",_e={wrapper:Ua,error:qa,title:za,buttons:Va},De=()=>{const t=e.useNavigate(),{error:o,setError:n}=e.useErrorStore(),{pages:s}=e.usePagesStore(),{setIsOpen:i}=e.useModalStore(),{title:r,description:a,setOnConfirm:l,setTitle:p,setDescription:h}=e.useConfirmationModalStore();j.useEffect(()=>{o&&t("/error")},[o]);async function u(){await e.resetSettings({resetSettings:(o==null?void 0:o.failedSettings)??!1,resetThemeSettings:(o==null?void 0:o.failedThemeSettings)??!1,resetPageIds:(o==null?void 0:o.failedPageIds)??[]}),n(null),window.location.reload()}async function b(){const S=[];s&&Object.keys(s).map(x=>s[x].id).filter(x=>x!==void 0).map(x=>S.push(x)),await e.resetSettings({resetSettings:!0,resetThemeSettings:!0,resetPageIds:S}),n(null)}return e.jsxRuntimeExports.jsxs("div",{className:_e.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:_e.error,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:_e.title,children:"Oops! Something went wrong"}),e.jsxRuntimeExports.jsx("span",{className:_e.message,children:(o==null?void 0:o.message)||""})]}),e.jsxRuntimeExports.jsxs("div",{className:_e.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:u,children:"Reset Settings"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:S=>{S.stopPropagation(),p("Reset All Settings"),h("Are you sure you want to reset all settings? This is irreversible."),l(async()=>{await b()})},children:"Reset All Settings"})]})]}),r&&a&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{i(!1),setTimeout(()=>{p(null),h(null),l(null),i(!0)},300)},children:e.jsxRuntimeExports.jsx(ct,{})})]})},Ga=t=>{const{children:o}=t,{pathname:n}=e.useLocation(),{setActiveBlock:s}=e.useNavbarStore(),{setActiveBlock:i}=e.useThemeSettingsStore();return j.useEffect(()=>{switch(n){case"/admin/builder":s(e.navbarBlocks[0]);break;case"/admin/builder/add":s(e.navbarBlocks[1]);break;case"/admin/builder/theme":s(e.navbarBlocks[2]);break;case"/admin/builder/settings":s(e.navbarBlocks[3]);break;case"/admin/builder/theme/colors":s(e.navbarBlocks[2]),i(ge[0]);break;case"/admin/builder/theme/fonts":s(e.navbarBlocks[2]),i(ge[1]);break;case"/admin/builder/theme/borders":s(e.navbarBlocks[2]),i(ge[2]);break;case"/admin/builder/theme/buttons":s(e.navbarBlocks[2]),i(ge[3]);break;case"/admin/builder/theme/inputs":s(e.navbarBlocks[2]),i(ge[4]);break}},[n]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o})},Wa=t=>{const{blocks:o,settings:n,header:s,footer:i}=t,[r,a]=j.useState(null),{setBlocks:l,setSourceBlocks:p}=e.useBlocksStore(),{setSettings:h}=e.useSettingsStore(),{setHeader:u,setFooter:b}=e.useLayersStore(),{themeSettings:S}=e.useThemeSettingsStore(),{settings:x}=e.useSettingsStore();j.useEffect(()=>{if(!r){const d={};Object.keys(o).map(f=>{d[f]=o[f]}),p(d),l(d),u(s),b(i),h(n);const k=e.createBrowserRouter([{path:"/admin/builder/*",element:e.jsxRuntimeExports.jsx(Ga,{children:e.jsxRuntimeExports.jsx(Oa,{blocks:o,settings:n,header:s,footer:i})}),errorElement:e.jsxRuntimeExports.jsx(De,{})},{path:"/checkout",element:e.jsxRuntimeExports.jsx(e.checkout_app_default,{})},{path:"/top-up",element:e.jsxRuntimeExports.jsx(e.top_up_balance_default,{})},{path:"/charges/:id",element:e.jsxRuntimeExports.jsx(e.charge_default,{})},{path:"/orders/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(e.order_default,{})},{path:"/subscriptions/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(e.subscription_default,{})},{path:"/customer-dash",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100%",overflowY:"scroll"},children:[e.jsxRuntimeExports.jsx(ze,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsxRuntimeExports.jsx(e.customerDashboard_default,{})}),e.jsxRuntimeExports.jsx(qe,{})]})},{path:"/error",element:e.jsxRuntimeExports.jsx(De,{})},{path:"*",element:e.jsxRuntimeExports.jsx(ls,{}),errorElement:e.jsxRuntimeExports.jsx(De,{})}]);a(k)}},[r]),j.useEffect(()=>{const d=us(S,x);gs(S),ds(d)},[S,x]);const c=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,R=localStorage.getItem("shopPassword"),w=localStorage.getItem("shopId")||"";return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:r&&e.jsxRuntimeExports.jsx(e.BillgangProvider,{shopDomain:c,shopId:w,shopPassword:R||void 0,routes:{Checkout:"/checkout",TopUp:"/top-up",Charge:"/charges",Order:"/orders",Subscription:"/subscriptions"},children:e.jsxRuntimeExports.jsx(e.RouterProvider,{router:r})})})};exports.App=Wa;exports.ColorVariables=rt;exports.hotReload=Ot;exports.iconNames=bt;
|
package/dist/builder.es.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface LinkProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
path: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
target?: '_blank' | '_self';
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const Link: ({ children, path, className, target, id }: LinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './HeaderButtons';
|
|
|
13
13
|
export * from './ShareLink';
|
|
14
14
|
export * from './Accordion';
|
|
15
15
|
export * from './Button';
|
|
16
|
+
export * from './Link';
|
|
16
17
|
export * from '../builder/ui';
|
|
17
18
|
export { Input as InputSettings } from '../builder/ui/Input';
|
|
18
19
|
export { Input as InputUI } from './Input';
|