@billgangcom/theme-lib 1.35.0 → 1.35.1

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.
@@ -43,7 +43,7 @@
43
43
  `,s+=` --input-size: ${o.general.size}px;
44
44
  `,s+=` --input-field-color: ${o.field.color};
45
45
  `,s+=` --input-field-opacity: ${o.field.opacity/100};
46
- `}return s+="}",s},us=t=>{const s=document.getElementById("dynamic-styles");if(s)s.innerHTML=t;else{const o=document.createElement("style");o.id="dynamic-styles",o.innerHTML=t,document.head.appendChild(o)}};let Ne=new Set;const ds=t=>{const s=new Map;return Object.entries(t).forEach(([o,n])=>{typeof n=="object"&&Object.entries(n).forEach(([i,r])=>{var a;if(r&&r.font){const c=r.font.replace(/\s+/g,"+");s.has(c)||s.set(c,new Set),(a=s.get(c))==null||a.add(r.weight)}})}),s},ps=t=>{const s=new Map;return Object.entries(t).forEach(([o,n])=>{typeof n=="object"&&Object.keys(n).forEach(i=>{var r;if(i==="font"&&n[i]){const a=n[i].replace(/\s+/g,"+");s.has(a)||s.set(a,new Set),(r=s.get(a))==null||r.add("400")}})}),s},ms=t=>{Ne.forEach(s=>{if(!t.has(s)){const o=document.querySelector(`link[data-font="${s}"]`);o&&o.remove(),Ne.delete(s)}})},xs=t=>{const s=new Set;t.forEach((o,n)=>{const i=Array.from(o).join(";"),r=`${n}:wght@${i}`;if(s.add(r),!Ne.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),Ne.add(r)}}),ms(s)},hs=t=>{if(t.fonts){const s=ds(t.fonts),o=ps(t.buttons),n=new Map(s);o.forEach((i,r)=>{if(n.has(r)){const a=n.get(r);i.forEach(c=>a==null?void 0:a.add(c))}else n.set(r,new Set(i))}),xs(n)}},gs="_tooltip_1ch07_1",js="_fadeIn_1ch07_1",Ss={tooltip:gs,fadeIn:js},He=t=>{const{text:s}=t,{setShowTooltip:o}=e.useTooltipStore();return f.useEffect(()=>(o(!0),()=>{o(!1)}),[]),e.jsxRuntimeExports.jsx("div",{className:Ss.tooltip,children:s})},fs=()=>{const{undo:t,redo:s,past:o,future:n}=e.useHistoryStore(),[i,r]=f.useState(!1),[a,c]=f.useState(!1),[p,j]=f.useState(!1),[l,x]=f.useState(!1);return f.useEffect(()=>{r(o.length===0)},[o]),f.useEffect(()=>{c(n.length===0)},[n]),e.jsxRuntimeExports.jsxs("div",{className:je.buttons,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(je.button,{[je.disabled]:i}),onMouseEnter:()=>{setTimeout(()=>{x(!0),j(!1)},200)},onMouseLeave:()=>{x(!1),j(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{i||t()},fill:i?"#757575":"#252525"}),l&&e.jsxRuntimeExports.jsx(He,{text:i?"Nothing to undo":"Click to undo changes"})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(je.button,{[je.disabled]:a}),onMouseEnter:()=>{setTimeout(()=>{j(!0),x(!1)},200)},onMouseLeave:()=>{j(!1),x(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||s()},fill:a?"#757575":"#252525"}),p&&e.jsxRuntimeExports.jsx(He,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},bs="_devices_u83zb_1",_s="_device_u83zb_1",ws="_active_u83zb_26",Pe={devices:bs,device:_s,active:ws},Cs=()=>{const{currentDevice:t,setCurrentDevice:s}=e.useDeviceStore();return e.jsxRuntimeExports.jsx("div",{className:Pe.devices,children:bt.map(o=>e.jsxRuntimeExports.jsx("div",{className:e.clx(Pe.device,{[Pe.active]:t.value===o.value}),onClick:()=>s(o),children:e.jsxRuntimeExports.jsx(e.Icon,{name:o.icon,fill:t.value===o.value?"#252525":"#757575",width:20,height:20})},o.value))})},vs="_header_2d8xd_1",ks="_left_2d8xd_13",Es="_right_2d8xd_14",Ce={header:vs,left:ks,right:Es},Rs="_preview_5ii2g_2",ys="_active_5ii2g_18",Ie={preview:Rs,active:ys},Bs=()=>{const{onPreview:t}=e.usePreviewStore();return e.jsxRuntimeExports.jsxs("a",{href:"/",className:e.clx(Ie.preview,{[Ie.active]:t}),target:"_blank",children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUpRight",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Ie.text,children:"Preview"})]})},Ns="_settings_u4cv4_1",Ls={settings:Ns},Ts="_pages_167qp_1",As="_text_167qp_21",Ps="_modal_167qp_27",Is="_open_167qp_46",$s="_page_167qp_1",Ms="_hoverable_167qp_61",Fs="_separator_167qp_65",Hs="_button_167qp_70",Ds="_items_167qp_85",Y={pages:Ts,default:"_default_167qp_5",text:As,modal:Ps,open:Is,page:$s,hoverable:Ms,separator:Fs,button:Hs,items:Ds},Os=()=>{const{currentPage:t,setCurrentPage:s,setIsOpenModal:o,pages:n,setIsEdit:i,setEditedPage:r,deletePage:a,setIsOpenSelectModal:c}=e.usePagesStore(),{deletePage:p}=e.useLayersStore(),[j,l]=f.useState(null),{setTitle:x,setDescription:S,setOnConfirm:_}=e.useConfirmationModalStore(),[u,y]=f.useState(!1);return f.useEffect(()=>{const b=()=>{y(!1)};return document.body.addEventListener("click",b),()=>{document.body.removeEventListener("click",b)}},[]),f.useEffect(()=>{u?c(!0):setTimeout(()=>{c(!1)},300)},[u]),e.jsxRuntimeExports.jsxs("div",{className:Y.pages,children:[e.jsxRuntimeExports.jsxs("div",{className:Y.default,onClick:b=>{b.stopPropagation(),y(!u)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:n&&n[t]&&n[t].icon||"File",fill:"#252525",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Y.text,children:n&&n[t]&&Be.includes(n[t].name)?`${J(n[t].name)} page`:n&&n[t]&&n[t].name}),e.jsxRuntimeExports.jsx("div",{style:{transform:u?"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(Y.modal,{[Y.open]:u}),onClick:b=>b.stopPropagation(),children:[n&&e.jsxRuntimeExports.jsx("div",{className:Y.items,children:Object.keys(n).map(b=>{const d=n[b];return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Y.page,{[Y.hoverable]:j===b}),onMouseEnter:()=>l(b),onMouseLeave:()=>l(null),onClick:()=>{l(null),i(!1),s(b),y(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:d.icon,fill:"#252525"}),e.jsxRuntimeExports.jsx("span",{className:Y.text,children:Be.includes(d.name)?`${J(d.name)} page`:d.name}),j===b&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Gear",fill:"#757575",onClick:w=>{w.stopPropagation(),i(!0),r(b),o(!0)}}),!Be.includes(d.name)&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",onClick:w=>{w.stopPropagation(),x("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.`),_(()=>{w.stopPropagation(),n[t].name===d.name&&s("/"),a(b),p(d.name),e.deletePage(d.path)})}})]}),n[t]&&n[t].name===d.name&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"#FF3F19"})]},b)})}),e.jsxRuntimeExports.jsx("div",{className:Y.separator}),e.jsxRuntimeExports.jsxs(e.Button,{className:Y.button,onClick:b=>{b.stopPropagation(),o(!0)},size:"l",children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#ff3f19"}),e.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},Us="_zoom_1q1ud_1",qs={zoom:Us},zs=()=>{const[t,s]=f.useState(),o=()=>{s(Number(Math.round(window.devicePixelRatio*50).toFixed(0)))};return f.useEffect(()=>(o(),window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}),[]),e.jsxRuntimeExports.jsxs("div",{className:qs.zoom,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"MagnifyingGlassMinus",width:20,height:20}),e.jsxRuntimeExports.jsxs("span",{children:[t," %"]})]})},Gs=()=>e.jsxRuntimeExports.jsxs("div",{className:Ls.settings,children:[e.jsxRuntimeExports.jsx(Os,{}),e.jsxRuntimeExports.jsx(zs,{})]}),Vs="_theme_1e5wq_1",Ws="_text_1e5wq_13",Ke={theme:Vs,text:Ws},Zs=()=>e.jsxRuntimeExports.jsx("div",{className:Ke.theme,children:e.jsxRuntimeExports.jsx("div",{className:Ke.text,children:"Live Theme"})}),Xs=({setIsLoading:t})=>{const{themeSettings:s}=e.useThemeSettingsStore(),{settings:o}=e.useSettingsStore(),[n,i]=f.useState(null),[r,a]=f.useState(!1),{setNotification:c}=e.useNotificationStore(),{header:p,footer:j}=e.useLayersStore(),{pageContext:l}=e.usePagesStore(),{pages:x}=e.usePagesStore(),{blocks:S}=e.useLayersStore();function _(w,m){try{return m.map(h=>{if(!h.value||!h.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(h.value.blockSettings).filter(k=>k&&k.type===w).map(k=>{if(k.value===void 0)throw new Error("item.value is undefined.");return k.value}).flat()}).flat().filter(h=>h).map(h=>w==="ListingIds"?h.listingId:h)}catch(g){return console.error("Error in getValues function:",g),[]}}function u(w,m){return y(w,m)?l.reviews.length*3:0}function y(w,m){return m.map(h=>{if(!h.value||!h.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(h.value.blockSettings).filter(k=>k&&k.type===w).map(k=>{if(k.value===void 0)throw new Error("item.value is undefined.");return k.value}).flat()}).flat().filter(h=>h).length>0}function b(w){if(x){const m=Object.keys(x).find(g=>x[g].name===w);if(m)return x[m]}return null}const d=async()=>{if(r)n&&clearTimeout(n);else{t(!0);const m=Object.keys(S).map(h=>{const B=b(h);return S[h]&&S[h].data?{name:B?B.name:h,path:(B==null?void 0:B.path)||h,layout:{...S[h]},neededProductIds:[..._("ProductId",Object.values(S[h].data))],neededCategoryIds:[..._("CategoryId",Object.values(S[h].data))],neededAnnouncementIds:[..._("AnnouncementId",Object.values(S[h].data))],neededListingIds:[..._("ListingIds",Object.values(S[h].data))],neededFaqIds:[..._("FaqsIds",Object.values(S[h].data))],neededReviewCount:u("ReviewCount",Object.values(S[h].data)),seo:{pageTitle:B&&B.seo&&B.seo.title?B.seo.title:"",pageDescription:B&&B.seo&&B.seo.description?B.seo.description:""}}:null}),{status:g}=await e.updateSettings("post","save",{themeSettings:s,settings:{settings:o,header:p,footer:j},updatedPages:m});c({message:g===200?"Settings saved":"Error",status:g===200?"success":"error"}),t(!1)}a(!0);const w=setTimeout(()=>{a(!1)},2e3);i(w)};return e.jsxRuntimeExports.jsx(e.Button,{onClick:d,children:"Save"})},Ys=()=>{const{isOpenSelectModal:t}=e.usePagesStore(),[s,o]=f.useState(!1),{showTooltip:n}=e.useTooltipStore();return e.jsxRuntimeExports.jsxs("div",{className:Ce.header,style:{zIndex:t?5e4:n?501:50},children:[e.jsxRuntimeExports.jsxs("div",{className:Ce.left,children:[e.jsxRuntimeExports.jsx(Cs,{}),e.jsxRuntimeExports.jsx(Bs,{})]}),e.jsxRuntimeExports.jsx("div",{className:Ce.center,children:e.jsxRuntimeExports.jsx(Gs,{})}),e.jsxRuntimeExports.jsxs("div",{className:Ce.right,children:[e.jsxRuntimeExports.jsx(Zs,{}),e.jsxRuntimeExports.jsx(fs,{}),s?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsx(Xs,{setIsLoading:o})]})]})},Ks="_exit_1wk4t_1",Qs="_text_1wk4t_11",Qe={exit:Ks,text:Qs},Js=()=>e.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:Qe.exit,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"SignOut",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Qe.text,children:"Exit"})]}),eo="_navbar_1podc_1",to="_main_1podc_6",so="_block_1podc_13",oo="_active_1podc_29",ve={navbar:eo,main:to,block:so,active:oo},no=()=>{const{activeBlock:t}=e.useNavbarStore(),{setActiveBlock:s}=e.useBlocksStore(),{setCurrentBlock:o}=e.useLayersStore(),{setActiveBlock:n}=e.useThemeSettingsStore(),i=e.useNavigate();function r(a){switch(s(null),o(null),n(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:ve.navbar,children:[e.jsxRuntimeExports.jsx(Js,{}),e.jsxRuntimeExports.jsx("div",{className:ve.main,children:e.navbarBlocks.map(a=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(ve.block,{[ve.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))})]})},ro="_preview_186z3_1",io="_main_186z3_15",ao="_content_186z3_26",lo="_loading_186z3_33",co="_loader_186z3_43",uo="_spin_186z3_1",ke={preview:ro,main:io,content:ao,loading:lo,loader:co,spin:uo},po="_header_245z3_2",mo="_circles_245z3_17",xo="_circle_245z3_17",ho="_red_245z3_33",go="_green_245z3_37",jo="_yellow_245z3_41",So="_input_245z3_45",fo="_main_245z3_56",bo="_text_245z3_64",te={header:po,circles:mo,circle:xo,red:ho,green:go,yellow:jo,input:So,main:fo,text:bo},_o=["red","yellow","green"],wo=()=>{const{currentDevice:t}=e.useDeviceStore(),s=(o,n)=>o.length>n?o.slice(0,n)+"...":o;return e.jsxRuntimeExports.jsxs("div",{className:te.header,children:[e.jsxRuntimeExports.jsx("div",{className:te.circles,children:_o.map(o=>e.jsxRuntimeExports.jsx("div",{className:e.clx(te.circle,{[te.red]:o==="red",[te.yellow]:o==="yellow",[te.green]:o==="green"})},o))}),e.jsxRuntimeExports.jsx("div",{className:te.input,children:e.jsxRuntimeExports.jsxs("div",{className:te.main,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),e.jsxRuntimeExports.jsx("span",{className:te.text,children:t.value==="mobile"?s(window.location.origin,40):t.value==="desktop"?s(window.location.origin,200):s(window.location.origin,100)})]})}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",style:{padding:"8px"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy",width:20,height:20,onClick:()=>{navigator.clipboard.writeText(window.location.origin)},fill:"#252525"})})]})},Co="_content_cjgr7_1",vo="_main_cjgr7_9",ko="_block_cjgr7_13",Eo="_active_cjgr7_20",Ro="_name_cjgr7_24",yo="_empty_cjgr7_38",Bo="_icon_cjgr7_49",No="_title_cjgr7_62",Lo="_text_cjgr7_68",To="_sections_cjgr7_74",Ao="_section_cjgr7_74",Po="_addSection_cjgr7_99",Io="_addSectionTop_cjgr7_107",oe={content:Co,main:vo,block:ko,active:Eo,name:Ro,empty:yo,icon:Bo,title:No,text:Lo,sections:To,section:Ao,addSection:Po,addSectionTop:Io},$o="_sidebar_xhqpt_1",Mo="_content_xhqpt_14",Fo="_button_xhqpt_24",Ho="_moveButton_xhqpt_40",Do="_border_xhqpt_44",Oo="_deleteButton_xhqpt_49",Z={sidebar:$o,content:Mo,button:Fo,moveButton:Ho,border:Do,deleteButton:Oo},Uo=()=>{var w;const{activeBlock:t}=e.usePreviewStore(),{blocks:s,removeBlock:o,moveBlock:n,duplicateBlock:i}=e.useLayersStore(),{currentPage:r,pages:a}=e.usePagesStore(),{setTitle:c,setDescription:p,setOnConfirm:j}=e.useConfirmationModalStore(),l=(w=a==null?void 0:a[r])==null?void 0:w.path,x=l?s[l]:null,S=(x==null?void 0:x.order)||[],_=S.indexOf(t),u=()=>{_>0&&l&&n(l,_,_-1)},y=()=>{_<S.length-1&&l&&n(l,_,_+1)},b=()=>{l&&i(l,t)},d=()=>{l&&o(l,t)};return e.jsxRuntimeExports.jsx("div",{className:Z.sidebar,children:e.jsxRuntimeExports.jsxs("div",{className:Z.content,children:[e.jsxRuntimeExports.jsx("button",{onClick:u,className:e.clx(Z.button,Z.moveButton),disabled:_===0,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUp"})}),e.jsxRuntimeExports.jsx("div",{className:Z.border}),e.jsxRuntimeExports.jsx("button",{onClick:y,className:e.clx(Z.button,Z.moveButton),disabled:_===S.length-1,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowDown"})}),e.jsxRuntimeExports.jsx("div",{className:Z.border}),e.jsxRuntimeExports.jsx("button",{onClick:b,className:e.clx(Z.button,Z.moveButton),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})}),e.jsxRuntimeExports.jsx("div",{className:Z.border}),e.jsxRuntimeExports.jsx("button",{className:e.clx(Z.button,Z.deleteButton),onClick:m=>{m.stopPropagation(),c("Remove Block"),p(`Are you sure you want to delete ${(x==null?void 0:x.data[t].name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),j(d)},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]})})},qo=f.memo(()=>{const{setActiveBlock:t,activeBlock:s}=e.usePreviewStore(),{blocks:o,sourceBlocks:n}=e.useBlocksStore(),{blocks:i,setCurrentBlock:r,currentBlock:a,setPositionBlock:c}=e.useLayersStore(),{settings:p}=e.useSettingsStore(),{currentPage:j,pages:l,setIsOpenSelectModal:x,pageContext:S}=e.usePagesStore(),{activeBlock:_,setActiveBlock:u}=e.useThemeSettingsStore(),{setError:y}=e.useErrorStore(),b=f.useRef(s),d=e.useNavigate();f.useEffect(()=>{b.current=s},[s]),f.useEffect(()=>{const g=()=>{b.current&&(t(null),r(null))};return document.body.addEventListener("click",g),()=>{document.body.removeEventListener("click",g)}},[]);const w=g=>{if(!g||!g.name)return y({message:"Block or block.name is undefined.",failedSettings:!1,failedThemeSettings:!1,failedPageIds:l&&l[j].id?[l[j].id]:[]}),d("/error"),e.jsxRuntimeExports.jsx(he,{error:"Block or block.name is undefined."});if(!o||!o[g.name])return y({message:'Block "${block.name}" does not exist in blocks.',failedSettings:!1,failedThemeSettings:!1,failedPageIds:l&&l[j].id?[l[j].id]:[]}),d("/error"),e.jsxRuntimeExports.jsx(he,{error:`Block "${g.name}" does not exist in blocks.`});const h=new o[g.name];return g.value&&Object.assign(h,g.value),h.renderBlock(p,S)};function m(g){if(!n||!n[g])return"unknown name";const h=new n[g];return!h.blockSettings||!h.blockSettings.displayName?"unknown name":h.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{onClick:g=>{g.stopPropagation(),x(!1)},className:oe.content,children:[e.jsxRuntimeExports.jsx(Ue,{}),e.jsxRuntimeExports.jsx("div",{className:oe.main,children:l&&l[j]&&i[l[j].path]&&i[l[j].path].data&&i[l[j].path].order.map(g=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>{s!==g&&(_&&u(null),s?(t(null),setTimeout(()=>{t(g)},100)):t(g),a?(r(null),setTimeout(()=>{r(g)},100)):r(g))},className:e.clx(oe.block,{[oe.active]:s===g}),children:[s===g&&e.jsxRuntimeExports.jsx("div",{className:oe.name,children:m(i[l[j].path].data[g].name)}),s===g&&m(i[l[j].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx(Uo,{}),s===g&&m(i[l[j].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx("div",{className:oe.addSection,onClick:h=>{h.stopPropagation(),c(g,!0)},children:e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{r(null),t(null),d("/admin/builder/add")},children:"Add Section"})}),s===g&&m(i[l[j].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx("div",{className:e.clx(oe.addSection,oe.addSectionTop),onClick:h=>{h.stopPropagation(),c(g,!1)},children:e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{r(null),t(null),d("/admin/builder/add")},children:"Add Section"})}),o&&e.jsxRuntimeExports.jsx(De,{render:w,block:i[l[j].path].data[g]})]},g))}),e.jsxRuntimeExports.jsx(Oe,{})]})}),zo="_name_ghnzi_1",Go="_product_ghnzi_8",Se={name:zo,product:Go},it=()=>{const{blocks:t,sourceBlocks:s,setActiveBlock:o}=e.useBlocksStore(),{hideModal:n,hoverBlockId:i,isModalVisible:r,showPreview:a,hidePreview:c,clearHideTimeout:p,startHideTimeout:j}=e.useSubmodalStore(),{setPositionBlock:l}=e.useLayersStore(),[x,S]=f.useState(""),[_,u]=f.useState([]),[y,b]=f.useState(null),d=f.useMemo(()=>Object.keys(t||{}).reduce((C,N)=>(h(N)&&C.push(N),C),[]),[t]),w=f.useMemo(()=>new e.Fuse(d,{keys:["name"],threshold:.4}),[d]);f.useEffect(()=>{if(x.trim()==="")u(d);else{const C=w.search(x);u(C.map(N=>N.item))}},[x,w]);function m(C){S(""),o(C),i&&l(i,!0),n("keyBlock")}function g(C){if(!s||!s[C])return"unknown name";const N=new s[C];return!N.blockSettings||!N.blockSettings.displayName?"unknown name":N.blockSettings.displayName}function h(C){return s?new s[C]().blockSettings.isAddable:!1}const B=C=>{const N=setTimeout(()=>{i||n("keyBlock"),a(C,"keyBlock"),p()},100);b(N)},k=()=>{y&&clearTimeout(y),r?j("keyBlock"):c("keyBlock")};return e.jsxRuntimeExports.jsxs("div",{className:Se.add,children:[e.jsxRuntimeExports.jsx(e.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:S,value:x,style:{marginBottom:10}}),e.jsxRuntimeExports.jsx("div",{className:Se.results,children:_.length>0?_.map(C=>e.jsxRuntimeExports.jsxs("div",{className:Se.product,onClick:()=>m(C),onMouseEnter:()=>B(C),onMouseLeave:k,children:[be[C]?e.jsxRuntimeExports.jsx("img",{src:be[C]}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards"}),e.jsxRuntimeExports.jsx("span",{className:Se.name,children:g(C)}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:20,height:20})]},C)):e.jsxRuntimeExports.jsx("div",{className:Se.noResults,children:"No sections found"})})]})},Vo="_wrapper_kjs8n_1",Wo={wrapper:Vo},Je=({children:t})=>{const{hoverBlockId:s,keyBlock:o,startHideTimeout:n,clearHideTimeout:i,setMouseOverModal:r}=e.useSubmodalStore();return!s&&!o?null:e.jsxRuntimeExports.jsx("div",{className:Wo.wrapper,onMouseEnter:()=>{i(),r(!0)},onMouseLeave:()=>{r(!1),n()},children:t})},Zo="_applyButton_qzy8h_2",Xo="_content_qzy8h_7",Yo="_label_qzy8h_14",Ko="_colorValue_qzy8h_27",Qo="_modal_qzy8h_34",Jo="_colorMap_qzy8h_53",en="_indicator_qzy8h_62",tn="_hueSlider_qzy8h_71",sn="_slider_qzy8h_102",on="_buttons_qzy8h_107",nn="_name_qzy8h_114",rn="_secondary_qzy8h_119",an="_input_qzy8h_127",ln="_alphaSlider_qzy8h_263",cn="_alphaBackground_qzy8h_271",un="_alphaGradient_qzy8h_282",dn="_chargeTypes_qzy8h_311",pn="_charge_qzy8h_311",mn="_chargeActive_qzy8h_340",xn="_gradient_qzy8h_348",hn="_color_qzy8h_27",gn="_colorActive_qzy8h_363",$={applyButton:Zo,content:Xo,label:Yo,colorValue:Ko,modal:Qo,colorMap:Jo,indicator:en,hueSlider:tn,slider:sn,buttons:on,name:nn,secondary:rn,input:an,alphaSlider:ln,alphaBackground:cn,alphaGradient:un,chargeTypes:dn,charge:pn,chargeActive:mn,gradient:xn,color:hn,colorActive:gn},jn=()=>{const{modalPosition:t,color:s,initialColor:o,setShowModal:n,hue:i,saturation:r,brightness:a,alpha:c,dragging:p,setDragging:j,setHue:l,setSaturation:x,setBrightness:S,setAlpha:_,colorChange:u,setColor:y,update:b,isGradient:d,setIsGradient:w,gradientDirection:m,setGradientDirection:g,hue2:h,saturation2:B,brightness2:k,alpha2:C,setHue2:N,setSaturation2:E,setBrightness2:U,setAlpha2:A,activeColorIndex:v,setActiveColorIndex:R,isGradientActive:W}=e.useColorPickerStore(),ge=(P,L,D)=>{L/=100,D/=100;const T=G=>(G+P/60)%6,M=G=>D*(1-L*Math.max(0,Math.min(T(G),4-T(G),1))),I=Math.round(255*M(5)),H=Math.round(255*M(3)),O=Math.round(255*M(1));return{r:I,g:H,b:O}},q=P=>P.toString(16).padStart(2,"0"),F=(P,L,D,T)=>{const{r:M,g:I,b:H}=ge(P,L,D),O=Math.round(T/100*255);return`#${q(M)}${q(I)}${q(H)}${q(O)}`},V=(P,L,D,T)=>{if(d)if(v===1){l(P),x(L),S(D),_(T);const M=F(P,L,D,T),I=F(h,B,k,C),O=`linear-gradient(${m==="vertical"?"0deg":"90deg"}, ${M} 0%, ${I} 100%)`;u(O),y(O)}else{N(P),E(L),U(D),A(T);const M=F(P,L,D,T),I=F(i,r,a,c),O=`linear-gradient(${m==="vertical"?"0deg":"90deg"}, ${I} 0%, ${M} 100%)`;u(O),y(O)}else{const M=F(P,L,D,T);u(M),y(M)}},ze=(P,L,D)=>{const{width:T,height:M}=D.getBoundingClientRect(),I=Math.max(0,Math.min(P/T*100,100)),H=Math.max(0,Math.min(100-L/M*100,100));d?v===1?(x(I),S(H),V(i,I,H,c)):(E(I),U(H),V(h,I,H,C)):(x(I),S(H),V(i,I,H,c))},ut=P=>{const{offsetX:L,offsetY:D}=P.nativeEvent;j(!0),ze(L,D,P.currentTarget)},dt=P=>{if(p){const L=document.querySelector(`.${$.colorMap}`),{left:D,top:T}=L.getBoundingClientRect(),M=P.clientX-D,I=P.clientY-T;ze(M,I,L)}},pt=()=>{j(!1)};f.useEffect(()=>{function P(T){const M=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,I=T.match(M);if(I){const H=I[1],O=I[2],G=I[3];return{angle:H,col1:O,col2:G}}return null}function L(T){const M=parseInt(T.slice(1,3),16),I=parseInt(T.slice(3,5),16),H=parseInt(T.slice(5,7),16),O=parseInt(T.slice(7,9),16)/255*100,{h:G,s:le,b:Le}=D(M,I,H);return{h:G,s:le,b:Le,a:O}}function D(T,M,I){T/=255,M/=255,I/=255;const H=Math.max(T,M,I),O=Math.min(T,M,I);let G=0;const le=H-O,Le=(H===0?0:le/H)*100,ft=H*100;if(H===O)G=0;else switch(H){case T:G=((M-I)/le+(M<I?6:0))*60;break;case M:G=((I-T)/le+2)*60;break;case I:G=((T-M)/le+4)*60;break}return{h:G,s:Le,b:ft}}if(o&&o.startsWith("linear-gradient")){const T=P(o);if(T){const{angle:M,col1:I,col2:H}=T,O=L(I),G=L(H);w(!0),g(M==="0deg"?"vertical":"horizontal"),l(O.h),x(O.s),S(O.b),_(O.a),N(G.h),E(G.s),U(G.b),A(G.a),R(1)}}else if(o){const M=function(H){let O=H;return O.length===7&&(O=O+"ff"),O}(o),I=L(M);w(!1),l(I.h),x(I.s),S(I.b),_(I.a)}},[o,w,g,l,x,S,_,N,E,U,A,R]),f.useEffect(()=>{let P,L,D,T;d?v===1?(P=i,L=r,D=a,T=c):(P=h,L=B,D=k,T=C):(P=i,L=r,D=a,T=c),V(P,L,D,T)},[d,m,v,i,r,a,c,h,B,k,C]),f.useEffect(()=>{const P=D=>dt(D),L=()=>pt();return p?(document.addEventListener("mousemove",P),document.addEventListener("mouseup",L)):(document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",L)),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",L)}},[p,d,m]);function mt(){if(!d)b(s);else{const P=F(i,r,a,c),L=F(h,B,k,C),T=`linear-gradient(${m==="vertical"?"0deg":"90deg"}, ${P} 0%, ${L} 100%)`;b(T)}n(!1)}function xt(){n(!1),u(o)}const _e=d?v===1?i:h:i,Ge=d?v===1?r:B:r,Ve=d?v===1?a:k:a,ht=d?v===1?c:C:c,{r:We,g:Ze,b:Xe}=ge(_e,Ge,Ve),gt=`linear-gradient(to right, rgba(${We}, ${Ze}, ${Xe}, 0), rgba(${We}, ${Ze}, ${Xe}, 1))`,jt=F(i,r,a,c),St=F(h,B,k,C);return e.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:P=>P.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:()=>w(!1),children:"Color"}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:d}),onClick:()=>w(!0),children:"Gradient"})]}),d&&W&&e.jsxRuntimeExports.jsxs("div",{className:$.gradient,children:[e.jsxRuntimeExports.jsx("div",{className:e.clx($.color,{[$.colorActive]:v===1}),onClick:()=>R(1),style:{background:jt}}),e.jsxRuntimeExports.jsxs("div",{className:$.chargeTypes,children:[e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:m==="vertical"}),onClick:()=>g("vertical"),children:"Vertical"}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:m==="horizontal"}),onClick:()=>g("horizontal"),children:"Horizontal"})]}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.color,{[$.colorActive]:v===2}),onClick:()=>R(2),style:{background:St}})]}),e.jsxRuntimeExports.jsx("div",{className:$.colorMap,onMouseDown:ut,style:{background:`
46
+ `}return s+="}",s},us=t=>{const s=document.getElementById("dynamic-styles");if(s)s.innerHTML=t;else{const o=document.createElement("style");o.id="dynamic-styles",o.innerHTML=t,document.head.appendChild(o)}};let Ne=new Set;const ds=t=>{const s=new Map;return Object.entries(t).forEach(([o,n])=>{typeof n=="object"&&Object.entries(n).forEach(([i,r])=>{var a;if(r&&r.font){const c=r.font.replace(/\s+/g,"+");s.has(c)||s.set(c,new Set),(a=s.get(c))==null||a.add(r.weight)}})}),s},ps=t=>{const s=new Map;return Object.entries(t).forEach(([o,n])=>{typeof n=="object"&&Object.keys(n).forEach(i=>{var r;if(i==="font"&&n[i]){const a=n[i].replace(/\s+/g,"+");s.has(a)||s.set(a,new Set),(r=s.get(a))==null||r.add("400")}})}),s},ms=t=>{Ne.forEach(s=>{if(!t.has(s)){const o=document.querySelector(`link[data-font="${s}"]`);o&&o.remove(),Ne.delete(s)}})},xs=t=>{const s=new Set;t.forEach((o,n)=>{const i=Array.from(o).join(";"),r=`${n}:wght@${i}`;if(s.add(r),!Ne.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),Ne.add(r)}}),ms(s)},hs=t=>{if(t.fonts){const s=ds(t.fonts),o=ps(t.buttons),n=new Map(s);o.forEach((i,r)=>{if(n.has(r)){const a=n.get(r);i.forEach(c=>a==null?void 0:a.add(c))}else n.set(r,new Set(i))}),xs(n)}},gs="_tooltip_1ch07_1",js="_fadeIn_1ch07_1",Ss={tooltip:gs,fadeIn:js},He=t=>{const{text:s}=t,{setShowTooltip:o}=e.useTooltipStore();return f.useEffect(()=>(o(!0),()=>{o(!1)}),[]),e.jsxRuntimeExports.jsx("div",{className:Ss.tooltip,children:s})},fs=()=>{const{undo:t,redo:s,past:o,future:n}=e.useHistoryStore(),[i,r]=f.useState(!1),[a,c]=f.useState(!1),[p,j]=f.useState(!1),[l,x]=f.useState(!1);return f.useEffect(()=>{r(o.length===0)},[o]),f.useEffect(()=>{c(n.length===0)},[n]),e.jsxRuntimeExports.jsxs("div",{className:je.buttons,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(je.button,{[je.disabled]:i}),onMouseEnter:()=>{setTimeout(()=>{x(!0),j(!1)},200)},onMouseLeave:()=>{x(!1),j(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{i||t()},fill:i?"#757575":"#252525"}),l&&e.jsxRuntimeExports.jsx(He,{text:i?"Nothing to undo":"Click to undo changes"})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(je.button,{[je.disabled]:a}),onMouseEnter:()=>{setTimeout(()=>{j(!0),x(!1)},200)},onMouseLeave:()=>{j(!1),x(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||s()},fill:a?"#757575":"#252525"}),p&&e.jsxRuntimeExports.jsx(He,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},bs="_devices_u83zb_1",_s="_device_u83zb_1",ws="_active_u83zb_26",Pe={devices:bs,device:_s,active:ws},Cs=()=>{const{currentDevice:t,setCurrentDevice:s}=e.useDeviceStore();return e.jsxRuntimeExports.jsx("div",{className:Pe.devices,children:bt.map(o=>e.jsxRuntimeExports.jsx("div",{className:e.clx(Pe.device,{[Pe.active]:t.value===o.value}),onClick:()=>s(o),children:e.jsxRuntimeExports.jsx(e.Icon,{name:o.icon,fill:t.value===o.value?"#252525":"#757575",width:20,height:20})},o.value))})},vs="_header_2d8xd_1",ks="_left_2d8xd_13",Es="_right_2d8xd_14",Ce={header:vs,left:ks,right:Es},Rs="_preview_5ii2g_2",ys="_active_5ii2g_18",Ie={preview:Rs,active:ys},Bs=()=>{const{onPreview:t}=e.usePreviewStore();return e.jsxRuntimeExports.jsxs("a",{href:"/",className:e.clx(Ie.preview,{[Ie.active]:t}),target:"_blank",children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUpRight",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Ie.text,children:"Preview"})]})},Ns="_settings_u4cv4_1",Ls={settings:Ns},Ts="_pages_167qp_1",As="_text_167qp_21",Ps="_modal_167qp_27",Is="_open_167qp_46",$s="_page_167qp_1",Ms="_hoverable_167qp_61",Fs="_separator_167qp_65",Hs="_button_167qp_70",Ds="_items_167qp_85",Y={pages:Ts,default:"_default_167qp_5",text:As,modal:Ps,open:Is,page:$s,hoverable:Ms,separator:Fs,button:Hs,items:Ds},Os=()=>{const{currentPage:t,setCurrentPage:s,setIsOpenModal:o,pages:n,setIsEdit:i,setEditedPage:r,deletePage:a,setIsOpenSelectModal:c}=e.usePagesStore(),{deletePage:p}=e.useLayersStore(),[j,l]=f.useState(null),{setTitle:x,setDescription:S,setOnConfirm:_}=e.useConfirmationModalStore(),[u,y]=f.useState(!1);return f.useEffect(()=>{const b=()=>{y(!1)};return document.body.addEventListener("click",b),()=>{document.body.removeEventListener("click",b)}},[]),f.useEffect(()=>{u?c(!0):setTimeout(()=>{c(!1)},300)},[u]),e.jsxRuntimeExports.jsxs("div",{className:Y.pages,children:[e.jsxRuntimeExports.jsxs("div",{className:Y.default,onClick:b=>{b.stopPropagation(),y(!u)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:n&&n[t]&&n[t].icon||"File",fill:"#252525",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Y.text,children:n&&n[t]&&Be.includes(n[t].name)?`${J(n[t].name)} page`:n&&n[t]&&n[t].name}),e.jsxRuntimeExports.jsx("div",{style:{transform:u?"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(Y.modal,{[Y.open]:u}),onClick:b=>b.stopPropagation(),children:[n&&e.jsxRuntimeExports.jsx("div",{className:Y.items,children:Object.keys(n).map(b=>{const d=n[b];return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Y.page,{[Y.hoverable]:j===b}),onMouseEnter:()=>l(b),onMouseLeave:()=>l(null),onClick:()=>{l(null),i(!1),s(b),y(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:d.icon,fill:"#252525"}),e.jsxRuntimeExports.jsx("span",{className:Y.text,children:Be.includes(d.name)?`${J(d.name)} page`:d.name}),j===b&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Gear",fill:"#757575",onClick:w=>{w.stopPropagation(),i(!0),r(b),o(!0)}}),!Be.includes(d.name)&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",onClick:w=>{w.stopPropagation(),x("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.`),_(()=>{w.stopPropagation(),n[t].name===d.name&&s("/"),a(b),p(d.name),e.deletePage(d.path)})}})]}),n[t]&&n[t].name===d.name&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"#FF3F19"})]},b)})}),e.jsxRuntimeExports.jsx("div",{className:Y.separator}),e.jsxRuntimeExports.jsxs(e.Button,{className:Y.button,onClick:b=>{b.stopPropagation(),o(!0)},size:"l",children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#ff3f19"}),e.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},Us="_zoom_1q1ud_1",qs={zoom:Us},zs=()=>{const[t,s]=f.useState(),o=()=>{s(Number(Math.round(window.devicePixelRatio*50).toFixed(0)))};return f.useEffect(()=>(o(),window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}),[]),e.jsxRuntimeExports.jsxs("div",{className:qs.zoom,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"MagnifyingGlassMinus",width:20,height:20}),e.jsxRuntimeExports.jsxs("span",{children:[t," %"]})]})},Gs=()=>e.jsxRuntimeExports.jsxs("div",{className:Ls.settings,children:[e.jsxRuntimeExports.jsx(Os,{}),e.jsxRuntimeExports.jsx(zs,{})]}),Vs="_theme_1e5wq_1",Ws="_text_1e5wq_13",Ke={theme:Vs,text:Ws},Zs=()=>e.jsxRuntimeExports.jsx("div",{className:Ke.theme,children:e.jsxRuntimeExports.jsx("div",{className:Ke.text,children:"Live Theme"})}),Xs=({setIsLoading:t})=>{const{themeSettings:s}=e.useThemeSettingsStore(),{settings:o}=e.useSettingsStore(),[n,i]=f.useState(null),[r,a]=f.useState(!1),{setNotification:c}=e.useNotificationStore(),{header:p,footer:j}=e.useLayersStore(),{pageContext:l}=e.usePagesStore(),{pages:x}=e.usePagesStore(),{blocks:S}=e.useLayersStore();function _(w,m){try{return m.map(h=>{if(!h.value||!h.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(h.value.blockSettings).filter(k=>k&&k.type===w).map(k=>{if(k.value===void 0)throw new Error("item.value is undefined.");return k.value}).flat()}).flat().filter(h=>h).map(h=>w==="ListingIds"?h.listingId:h)}catch(g){return console.error("Error in getValues function:",g),[]}}function u(w,m){return y(w,m)?l.reviews.length*3:0}function y(w,m){return m.map(h=>{if(!h.value||!h.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(h.value.blockSettings).filter(k=>k&&k.type===w).map(k=>{if(k.value===void 0)throw new Error("item.value is undefined.");return k.value}).flat()}).flat().filter(h=>h).length>0}function b(w){if(x){const m=Object.keys(x).find(g=>x[g].path===w);if(m)return x[m]}return null}const d=async()=>{if(r)n&&clearTimeout(n);else{t(!0);const m=Object.keys(S).map(h=>{const B=b(h);return S[h]&&S[h].data&&(B!=null&&B.path)?{name:B?B.name:h,path:B.path,layout:{...S[h]},neededProductIds:[..._("ProductId",Object.values(S[h].data))],neededCategoryIds:[..._("CategoryId",Object.values(S[h].data))],neededAnnouncementIds:[..._("AnnouncementId",Object.values(S[h].data))],neededListingIds:[..._("ListingIds",Object.values(S[h].data))],neededFaqIds:[..._("FaqsIds",Object.values(S[h].data))],neededReviewCount:u("ReviewCount",Object.values(S[h].data)),seo:{pageTitle:B&&B.seo&&B.seo.title?B.seo.title:"",pageDescription:B&&B.seo&&B.seo.description?B.seo.description:""}}:null}).filter(h=>h),{status:g}=await e.updateSettings("post","save",{themeSettings:s,settings:{settings:o,header:p,footer:j},updatedPages:m});c({message:g===200?"Settings saved":"Error",status:g===200?"success":"error"}),t(!1)}a(!0);const w=setTimeout(()=>{a(!1)},2e3);i(w)};return e.jsxRuntimeExports.jsx(e.Button,{onClick:d,children:"Save"})},Ys=()=>{const{isOpenSelectModal:t}=e.usePagesStore(),[s,o]=f.useState(!1),{showTooltip:n}=e.useTooltipStore();return e.jsxRuntimeExports.jsxs("div",{className:Ce.header,style:{zIndex:t?5e4:n?501:50},children:[e.jsxRuntimeExports.jsxs("div",{className:Ce.left,children:[e.jsxRuntimeExports.jsx(Cs,{}),e.jsxRuntimeExports.jsx(Bs,{})]}),e.jsxRuntimeExports.jsx("div",{className:Ce.center,children:e.jsxRuntimeExports.jsx(Gs,{})}),e.jsxRuntimeExports.jsxs("div",{className:Ce.right,children:[e.jsxRuntimeExports.jsx(Zs,{}),e.jsxRuntimeExports.jsx(fs,{}),s?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsx(Xs,{setIsLoading:o})]})]})},Ks="_exit_1wk4t_1",Qs="_text_1wk4t_11",Qe={exit:Ks,text:Qs},Js=()=>e.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:Qe.exit,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"SignOut",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Qe.text,children:"Exit"})]}),eo="_navbar_1podc_1",to="_main_1podc_6",so="_block_1podc_13",oo="_active_1podc_29",ve={navbar:eo,main:to,block:so,active:oo},no=()=>{const{activeBlock:t}=e.useNavbarStore(),{setActiveBlock:s}=e.useBlocksStore(),{setCurrentBlock:o}=e.useLayersStore(),{setActiveBlock:n}=e.useThemeSettingsStore(),i=e.useNavigate();function r(a){switch(s(null),o(null),n(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:ve.navbar,children:[e.jsxRuntimeExports.jsx(Js,{}),e.jsxRuntimeExports.jsx("div",{className:ve.main,children:e.navbarBlocks.map(a=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(ve.block,{[ve.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))})]})},ro="_preview_186z3_1",io="_main_186z3_15",ao="_content_186z3_26",lo="_loading_186z3_33",co="_loader_186z3_43",uo="_spin_186z3_1",ke={preview:ro,main:io,content:ao,loading:lo,loader:co,spin:uo},po="_header_245z3_2",mo="_circles_245z3_17",xo="_circle_245z3_17",ho="_red_245z3_33",go="_green_245z3_37",jo="_yellow_245z3_41",So="_input_245z3_45",fo="_main_245z3_56",bo="_text_245z3_64",te={header:po,circles:mo,circle:xo,red:ho,green:go,yellow:jo,input:So,main:fo,text:bo},_o=["red","yellow","green"],wo=()=>{const{currentDevice:t}=e.useDeviceStore(),s=(o,n)=>o.length>n?o.slice(0,n)+"...":o;return e.jsxRuntimeExports.jsxs("div",{className:te.header,children:[e.jsxRuntimeExports.jsx("div",{className:te.circles,children:_o.map(o=>e.jsxRuntimeExports.jsx("div",{className:e.clx(te.circle,{[te.red]:o==="red",[te.yellow]:o==="yellow",[te.green]:o==="green"})},o))}),e.jsxRuntimeExports.jsx("div",{className:te.input,children:e.jsxRuntimeExports.jsxs("div",{className:te.main,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),e.jsxRuntimeExports.jsx("span",{className:te.text,children:t.value==="mobile"?s(window.location.origin,40):t.value==="desktop"?s(window.location.origin,200):s(window.location.origin,100)})]})}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",style:{padding:"8px"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy",width:20,height:20,onClick:()=>{navigator.clipboard.writeText(window.location.origin)},fill:"#252525"})})]})},Co="_content_cjgr7_1",vo="_main_cjgr7_9",ko="_block_cjgr7_13",Eo="_active_cjgr7_20",Ro="_name_cjgr7_24",yo="_empty_cjgr7_38",Bo="_icon_cjgr7_49",No="_title_cjgr7_62",Lo="_text_cjgr7_68",To="_sections_cjgr7_74",Ao="_section_cjgr7_74",Po="_addSection_cjgr7_99",Io="_addSectionTop_cjgr7_107",oe={content:Co,main:vo,block:ko,active:Eo,name:Ro,empty:yo,icon:Bo,title:No,text:Lo,sections:To,section:Ao,addSection:Po,addSectionTop:Io},$o="_sidebar_xhqpt_1",Mo="_content_xhqpt_14",Fo="_button_xhqpt_24",Ho="_moveButton_xhqpt_40",Do="_border_xhqpt_44",Oo="_deleteButton_xhqpt_49",Z={sidebar:$o,content:Mo,button:Fo,moveButton:Ho,border:Do,deleteButton:Oo},Uo=()=>{var w;const{activeBlock:t}=e.usePreviewStore(),{blocks:s,removeBlock:o,moveBlock:n,duplicateBlock:i}=e.useLayersStore(),{currentPage:r,pages:a}=e.usePagesStore(),{setTitle:c,setDescription:p,setOnConfirm:j}=e.useConfirmationModalStore(),l=(w=a==null?void 0:a[r])==null?void 0:w.path,x=l?s[l]:null,S=(x==null?void 0:x.order)||[],_=S.indexOf(t),u=()=>{_>0&&l&&n(l,_,_-1)},y=()=>{_<S.length-1&&l&&n(l,_,_+1)},b=()=>{l&&i(l,t)},d=()=>{l&&o(l,t)};return e.jsxRuntimeExports.jsx("div",{className:Z.sidebar,children:e.jsxRuntimeExports.jsxs("div",{className:Z.content,children:[e.jsxRuntimeExports.jsx("button",{onClick:u,className:e.clx(Z.button,Z.moveButton),disabled:_===0,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUp"})}),e.jsxRuntimeExports.jsx("div",{className:Z.border}),e.jsxRuntimeExports.jsx("button",{onClick:y,className:e.clx(Z.button,Z.moveButton),disabled:_===S.length-1,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowDown"})}),e.jsxRuntimeExports.jsx("div",{className:Z.border}),e.jsxRuntimeExports.jsx("button",{onClick:b,className:e.clx(Z.button,Z.moveButton),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})}),e.jsxRuntimeExports.jsx("div",{className:Z.border}),e.jsxRuntimeExports.jsx("button",{className:e.clx(Z.button,Z.deleteButton),onClick:m=>{m.stopPropagation(),c("Remove Block"),p(`Are you sure you want to delete ${(x==null?void 0:x.data[t].name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),j(d)},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]})})},qo=f.memo(()=>{const{setActiveBlock:t,activeBlock:s}=e.usePreviewStore(),{blocks:o,sourceBlocks:n}=e.useBlocksStore(),{blocks:i,setCurrentBlock:r,currentBlock:a,setPositionBlock:c}=e.useLayersStore(),{settings:p}=e.useSettingsStore(),{currentPage:j,pages:l,setIsOpenSelectModal:x,pageContext:S}=e.usePagesStore(),{activeBlock:_,setActiveBlock:u}=e.useThemeSettingsStore(),{setError:y}=e.useErrorStore(),b=f.useRef(s),d=e.useNavigate();f.useEffect(()=>{b.current=s},[s]),f.useEffect(()=>{const g=()=>{b.current&&(t(null),r(null))};return document.body.addEventListener("click",g),()=>{document.body.removeEventListener("click",g)}},[]);const w=g=>{if(!g||!g.name)return y({message:"Block or block.name is undefined.",failedSettings:!1,failedThemeSettings:!1,failedPageIds:l&&l[j].id?[l[j].id]:[]}),d("/error"),e.jsxRuntimeExports.jsx(he,{error:"Block or block.name is undefined."});if(!o||!o[g.name])return y({message:'Block "${block.name}" does not exist in blocks.',failedSettings:!1,failedThemeSettings:!1,failedPageIds:l&&l[j].id?[l[j].id]:[]}),d("/error"),e.jsxRuntimeExports.jsx(he,{error:`Block "${g.name}" does not exist in blocks.`});const h=new o[g.name];return g.value&&Object.assign(h,g.value),h.renderBlock(p,S)};function m(g){if(!n||!n[g])return"unknown name";const h=new n[g];return!h.blockSettings||!h.blockSettings.displayName?"unknown name":h.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{onClick:g=>{g.stopPropagation(),x(!1)},className:oe.content,children:[e.jsxRuntimeExports.jsx(Ue,{}),e.jsxRuntimeExports.jsx("div",{className:oe.main,children:l&&l[j]&&i[l[j].path]&&i[l[j].path].data&&i[l[j].path].order.map(g=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>{s!==g&&(_&&u(null),s?(t(null),setTimeout(()=>{t(g)},100)):t(g),a?(r(null),setTimeout(()=>{r(g)},100)):r(g))},className:e.clx(oe.block,{[oe.active]:s===g}),children:[s===g&&e.jsxRuntimeExports.jsx("div",{className:oe.name,children:m(i[l[j].path].data[g].name)}),s===g&&m(i[l[j].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx(Uo,{}),s===g&&m(i[l[j].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx("div",{className:oe.addSection,onClick:h=>{h.stopPropagation(),c(g,!0)},children:e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{r(null),t(null),d("/admin/builder/add")},children:"Add Section"})}),s===g&&m(i[l[j].path].data[g].name)!=="unknown name"&&e.jsxRuntimeExports.jsx("div",{className:e.clx(oe.addSection,oe.addSectionTop),onClick:h=>{h.stopPropagation(),c(g,!1)},children:e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{r(null),t(null),d("/admin/builder/add")},children:"Add Section"})}),o&&e.jsxRuntimeExports.jsx(De,{render:w,block:i[l[j].path].data[g]})]},g))}),e.jsxRuntimeExports.jsx(Oe,{})]})}),zo="_name_ghnzi_1",Go="_product_ghnzi_8",Se={name:zo,product:Go},it=()=>{const{blocks:t,sourceBlocks:s,setActiveBlock:o}=e.useBlocksStore(),{hideModal:n,hoverBlockId:i,isModalVisible:r,showPreview:a,hidePreview:c,clearHideTimeout:p,startHideTimeout:j}=e.useSubmodalStore(),{setPositionBlock:l}=e.useLayersStore(),[x,S]=f.useState(""),[_,u]=f.useState([]),[y,b]=f.useState(null),d=f.useMemo(()=>Object.keys(t||{}).reduce((C,N)=>(h(N)&&C.push(N),C),[]),[t]),w=f.useMemo(()=>new e.Fuse(d,{keys:["name"],threshold:.4}),[d]);f.useEffect(()=>{if(x.trim()==="")u(d);else{const C=w.search(x);u(C.map(N=>N.item))}},[x,w]);function m(C){S(""),o(C),i&&l(i,!0),n("keyBlock")}function g(C){if(!s||!s[C])return"unknown name";const N=new s[C];return!N.blockSettings||!N.blockSettings.displayName?"unknown name":N.blockSettings.displayName}function h(C){return s?new s[C]().blockSettings.isAddable:!1}const B=C=>{const N=setTimeout(()=>{i||n("keyBlock"),a(C,"keyBlock"),p()},100);b(N)},k=()=>{y&&clearTimeout(y),r?j("keyBlock"):c("keyBlock")};return e.jsxRuntimeExports.jsxs("div",{className:Se.add,children:[e.jsxRuntimeExports.jsx(e.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:S,value:x,style:{marginBottom:10}}),e.jsxRuntimeExports.jsx("div",{className:Se.results,children:_.length>0?_.map(C=>e.jsxRuntimeExports.jsxs("div",{className:Se.product,onClick:()=>m(C),onMouseEnter:()=>B(C),onMouseLeave:k,children:[be[C]?e.jsxRuntimeExports.jsx("img",{src:be[C]}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards"}),e.jsxRuntimeExports.jsx("span",{className:Se.name,children:g(C)}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:20,height:20})]},C)):e.jsxRuntimeExports.jsx("div",{className:Se.noResults,children:"No sections found"})})]})},Vo="_wrapper_kjs8n_1",Wo={wrapper:Vo},Je=({children:t})=>{const{hoverBlockId:s,keyBlock:o,startHideTimeout:n,clearHideTimeout:i,setMouseOverModal:r}=e.useSubmodalStore();return!s&&!o?null:e.jsxRuntimeExports.jsx("div",{className:Wo.wrapper,onMouseEnter:()=>{i(),r(!0)},onMouseLeave:()=>{r(!1),n()},children:t})},Zo="_applyButton_qzy8h_2",Xo="_content_qzy8h_7",Yo="_label_qzy8h_14",Ko="_colorValue_qzy8h_27",Qo="_modal_qzy8h_34",Jo="_colorMap_qzy8h_53",en="_indicator_qzy8h_62",tn="_hueSlider_qzy8h_71",sn="_slider_qzy8h_102",on="_buttons_qzy8h_107",nn="_name_qzy8h_114",rn="_secondary_qzy8h_119",an="_input_qzy8h_127",ln="_alphaSlider_qzy8h_263",cn="_alphaBackground_qzy8h_271",un="_alphaGradient_qzy8h_282",dn="_chargeTypes_qzy8h_311",pn="_charge_qzy8h_311",mn="_chargeActive_qzy8h_340",xn="_gradient_qzy8h_348",hn="_color_qzy8h_27",gn="_colorActive_qzy8h_363",$={applyButton:Zo,content:Xo,label:Yo,colorValue:Ko,modal:Qo,colorMap:Jo,indicator:en,hueSlider:tn,slider:sn,buttons:on,name:nn,secondary:rn,input:an,alphaSlider:ln,alphaBackground:cn,alphaGradient:un,chargeTypes:dn,charge:pn,chargeActive:mn,gradient:xn,color:hn,colorActive:gn},jn=()=>{const{modalPosition:t,color:s,initialColor:o,setShowModal:n,hue:i,saturation:r,brightness:a,alpha:c,dragging:p,setDragging:j,setHue:l,setSaturation:x,setBrightness:S,setAlpha:_,colorChange:u,setColor:y,update:b,isGradient:d,setIsGradient:w,gradientDirection:m,setGradientDirection:g,hue2:h,saturation2:B,brightness2:k,alpha2:C,setHue2:N,setSaturation2:E,setBrightness2:U,setAlpha2:A,activeColorIndex:v,setActiveColorIndex:R,isGradientActive:W}=e.useColorPickerStore(),ge=(P,L,D)=>{L/=100,D/=100;const T=G=>(G+P/60)%6,M=G=>D*(1-L*Math.max(0,Math.min(T(G),4-T(G),1))),I=Math.round(255*M(5)),H=Math.round(255*M(3)),O=Math.round(255*M(1));return{r:I,g:H,b:O}},q=P=>P.toString(16).padStart(2,"0"),F=(P,L,D,T)=>{const{r:M,g:I,b:H}=ge(P,L,D),O=Math.round(T/100*255);return`#${q(M)}${q(I)}${q(H)}${q(O)}`},V=(P,L,D,T)=>{if(d)if(v===1){l(P),x(L),S(D),_(T);const M=F(P,L,D,T),I=F(h,B,k,C),O=`linear-gradient(${m==="vertical"?"0deg":"90deg"}, ${M} 0%, ${I} 100%)`;u(O),y(O)}else{N(P),E(L),U(D),A(T);const M=F(P,L,D,T),I=F(i,r,a,c),O=`linear-gradient(${m==="vertical"?"0deg":"90deg"}, ${I} 0%, ${M} 100%)`;u(O),y(O)}else{const M=F(P,L,D,T);u(M),y(M)}},ze=(P,L,D)=>{const{width:T,height:M}=D.getBoundingClientRect(),I=Math.max(0,Math.min(P/T*100,100)),H=Math.max(0,Math.min(100-L/M*100,100));d?v===1?(x(I),S(H),V(i,I,H,c)):(E(I),U(H),V(h,I,H,C)):(x(I),S(H),V(i,I,H,c))},ut=P=>{const{offsetX:L,offsetY:D}=P.nativeEvent;j(!0),ze(L,D,P.currentTarget)},dt=P=>{if(p){const L=document.querySelector(`.${$.colorMap}`),{left:D,top:T}=L.getBoundingClientRect(),M=P.clientX-D,I=P.clientY-T;ze(M,I,L)}},pt=()=>{j(!1)};f.useEffect(()=>{function P(T){const M=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,I=T.match(M);if(I){const H=I[1],O=I[2],G=I[3];return{angle:H,col1:O,col2:G}}return null}function L(T){const M=parseInt(T.slice(1,3),16),I=parseInt(T.slice(3,5),16),H=parseInt(T.slice(5,7),16),O=parseInt(T.slice(7,9),16)/255*100,{h:G,s:le,b:Le}=D(M,I,H);return{h:G,s:le,b:Le,a:O}}function D(T,M,I){T/=255,M/=255,I/=255;const H=Math.max(T,M,I),O=Math.min(T,M,I);let G=0;const le=H-O,Le=(H===0?0:le/H)*100,ft=H*100;if(H===O)G=0;else switch(H){case T:G=((M-I)/le+(M<I?6:0))*60;break;case M:G=((I-T)/le+2)*60;break;case I:G=((T-M)/le+4)*60;break}return{h:G,s:Le,b:ft}}if(o&&o.startsWith("linear-gradient")){const T=P(o);if(T){const{angle:M,col1:I,col2:H}=T,O=L(I),G=L(H);w(!0),g(M==="0deg"?"vertical":"horizontal"),l(O.h),x(O.s),S(O.b),_(O.a),N(G.h),E(G.s),U(G.b),A(G.a),R(1)}}else if(o){const M=function(H){let O=H;return O.length===7&&(O=O+"ff"),O}(o),I=L(M);w(!1),l(I.h),x(I.s),S(I.b),_(I.a)}},[o,w,g,l,x,S,_,N,E,U,A,R]),f.useEffect(()=>{let P,L,D,T;d?v===1?(P=i,L=r,D=a,T=c):(P=h,L=B,D=k,T=C):(P=i,L=r,D=a,T=c),V(P,L,D,T)},[d,m,v,i,r,a,c,h,B,k,C]),f.useEffect(()=>{const P=D=>dt(D),L=()=>pt();return p?(document.addEventListener("mousemove",P),document.addEventListener("mouseup",L)):(document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",L)),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",L)}},[p,d,m]);function mt(){if(!d)b(s);else{const P=F(i,r,a,c),L=F(h,B,k,C),T=`linear-gradient(${m==="vertical"?"0deg":"90deg"}, ${P} 0%, ${L} 100%)`;b(T)}n(!1)}function xt(){n(!1),u(o)}const _e=d?v===1?i:h:i,Ge=d?v===1?r:B:r,Ve=d?v===1?a:k:a,ht=d?v===1?c:C:c,{r:We,g:Ze,b:Xe}=ge(_e,Ge,Ve),gt=`linear-gradient(to right, rgba(${We}, ${Ze}, ${Xe}, 0), rgba(${We}, ${Ze}, ${Xe}, 1))`,jt=F(i,r,a,c),St=F(h,B,k,C);return e.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:P=>P.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:()=>w(!1),children:"Color"}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:d}),onClick:()=>w(!0),children:"Gradient"})]}),d&&W&&e.jsxRuntimeExports.jsxs("div",{className:$.gradient,children:[e.jsxRuntimeExports.jsx("div",{className:e.clx($.color,{[$.colorActive]:v===1}),onClick:()=>R(1),style:{background:jt}}),e.jsxRuntimeExports.jsxs("div",{className:$.chargeTypes,children:[e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:m==="vertical"}),onClick:()=>g("vertical"),children:"Vertical"}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.charge,{[$.chargeActive]:m==="horizontal"}),onClick:()=>g("horizontal"),children:"Horizontal"})]}),e.jsxRuntimeExports.jsx("div",{className:e.clx($.color,{[$.colorActive]:v===2}),onClick:()=>R(2),style:{background:St}})]}),e.jsxRuntimeExports.jsx("div",{className:$.colorMap,onMouseDown:ut,style:{background:`
47
47
  linear-gradient(to top, black, transparent),
48
48
  linear-gradient(to right, hsl(${_e}, 100%, 100%), hsl(${_e}, 100%, 50%))
49
49
  `},children:e.jsxRuntimeExports.jsx("div",{className:$.indicator,style:{position:"absolute",left:`${Ge}%`,top:`${100-Ve}%`,transform:"translate(-50%, -50%)"}})}),e.jsxRuntimeExports.jsx("div",{className:$.hueSlider,children:e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:_e,onChange:P=>{const L=Number(P.target.value);d?v===1?V(L,r,a,c):V(L,B,k,C):(l(L),V(L,r,a,c))},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:P=>{const L=Number(P.target.value);d?v===1?V(i,r,a,L):V(h,B,k,L):(_(L),V(i,r,a,L))},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"})]})]})},Sn=()=>{const{onPreview:t}=e.usePreviewStore(),{keyBlock:s,hoverBlockId:o,isModalVisible:n}=e.useSubmodalStore(),{settings:i}=e.useSettingsStore(),{sourceBlocks:r}=e.useBlocksStore(),{pageContext:a}=e.usePagesStore(),{showModal:c}=e.useColorPickerStore(),[p,j]=f.useState(!0),{currentDevice:l}=e.useDeviceStore();f.useEffect(()=>{t&&a.general&&setTimeout(()=>{j(!1)},100)},[t,a]);const x=_=>_?(console.log(_),!r||!r[_]?e.jsxRuntimeExports.jsx(he,{error:`Block "${_}" does not exist in blocks.`}):new r[_]().renderBlock(i,a)):e.jsxRuntimeExports.jsx(he,{error:"Block or block.name is undefined."});function S(){return l.value==="desktop"?"100%":l.value==="tablet"?"768px":"425px"}return e.jsxRuntimeExports.jsxs("div",{className:ke.preview,style:{zIndex:c?5e3:500},children:[n&&e.jsxRuntimeExports.jsx(Je,{variable:"hoverBlockId",children:e.jsxRuntimeExports.jsx(it,{})}),!o&&s&&e.jsxRuntimeExports.jsxs(Je,{variable:"keyBlock",children:[!p&&e.jsxRuntimeExports.jsx(De,{render:x,block:s}),p&&e.jsxRuntimeExports.jsx(e.Loader,{})]}),c&&e.jsxRuntimeExports.jsx(jn,{}),t&&e.jsxRuntimeExports.jsxs("div",{className:ke.main,style:{width:S()},children:[e.jsxRuntimeExports.jsx(wo,{}),e.jsxRuntimeExports.jsx("div",{className:ke.content,children:p?e.jsxRuntimeExports.jsx("div",{className:ke.loading,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsx(qo,{})})]})]})},fn="_sidebar_1htbz_1",bn="_title_1htbz_11",_n="_active_1htbz_19",et={sidebar:fn,title:bn,active:_n},wn="_layers_1js10_1",Cn="_block_1js10_9",vn="_dragging_1js10_25",kn="_active_1js10_33",En="_add_1js10_37",Rn="_button_1js10_51",yn="_empty_1js10_66",Bn="_title_1js10_78",Nn="_icon_1js10_85",Ln="_blockIcon_1js10_89",Tn="_text_1js10_99",An="_highlight_1js10_105",xe={layers:wn,block:Cn,dragging:vn,active:kn,add:En,button:Rn,empty:yn,title:Bn,icon:Nn,blockIcon:Ln,text:Tn,highlight:An},Pn="_block_586dq_1",tt={block:Pn},In=()=>{const{setCurrentBlock:t}=e.useLayersStore(),{activeBlock:s}=e.usePreviewStore();function o(n){t(n)}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(tt.block,{[tt.active]:s==="header"}),onClick:()=>o("header"),children:[e.jsxRuntimeExports.jsx("img",{src:be.Header,width:20,height:20}),e.jsxRuntimeExports.jsx("span",{children:"Header"})]})},$n="_block_586dq_1",st={block:$n},Mn=()=>{const{activeBlock:t}=e.usePreviewStore(),{setCurrentBlock:s}=e.useLayersStore();function o(n){s(n)}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(st.block,{[st.active]:t==="footer"}),onClick:()=>o("footer"),children:[e.jsxRuntimeExports.jsx("img",{src:be.Footer,width:20,height:20}),e.jsxRuntimeExports.jsx("span",{children:"Footer"})]})},Fn=({id:t,name:s,onClick:o,isDragging:n,icon:i})=>{const{activeBlock:r}=e.usePreviewStore(),{showPreview:a,hidePreview:c,showModal:p,hideModal:j,clearHideTimeout:l,startHideTimeout:x,hoverBlockId:S,isModalVisible:_}=e.useSubmodalStore(),{setPositionBlock:u}=e.useLayersStore(),[y,b]=f.useState(!1),[d,w]=f.useState(!1),{attributes:m,listeners:g,setNodeRef:h,transform:B,transition:k}=e.useSortable({id:t}),C={transform:e.CSS.Transform.toString(B),transition:k},N=()=>{_&&j(),a(t),n||b(!0),l()},E=A=>{A.stopPropagation(),c(),p(t),l(),u(t,!0)},U=()=>{_?x():(b(!1),c())};return f.useEffect(()=>{w(!1),b(!1)},[n]),f.useEffect(()=>{_||b(!1)},[_]),e.jsxRuntimeExports.jsxs("div",{ref:h,style:C,className:e.clx(xe.block,{[xe.dragging]:n&&r===t,[xe.active]:!n&&r===t}),onClick:()=>o(t),onMouseEnter:N,onMouseLeave:U,...m,...g,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",{children:s}),(y||S===t)&&!n&&e.jsxRuntimeExports.jsx("div",{className:xe.add,children:e.jsxRuntimeExports.jsxs("button",{className:xe.button,onClick:A=>E(A),onMouseEnter:()=>{setTimeout(()=>{n||w(!0)},200)},onMouseLeave:()=>{w(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),d&&e.jsxRuntimeExports.jsx(He,{text:"Click to Add Section"})]})})]})},Hn=()=>{const{blocks:t,setCurrentBlock:s,moveBlock:o}=e.useLayersStore(),{currentPage:n,pages:i}=e.usePagesStore(),{setMouseOverModal:r,setHoverBlockId:a}=e.useSubmodalStore(),{sourceBlocks:c}=e.useBlocksStore();function p(y){s(y),r(!1),a(null)}function j(y){if(!c||!c[y])return"unknown name";const b=new c[y];return!b.blockSettings||!b.blockSettings.displayName?"unknown name":b.blockSettings.displayName}const l=e.useSensors(e.useSensor(e.PointerSensor,{activationConstraint:{distance:5}})),[x,S]=f.useState(!1),_=()=>{S(!0)},u=y=>{S(!1);const{active:b,over:d}=y;if(d&&b.id!==d.id&&i&&i[n]){const w=i[n].path,m=t[w].order,g=m.indexOf(b.id),h=m.indexOf(d.id);g!==-1&&h!==-1&&o(w,g,h)}};return e.jsxRuntimeExports.jsxs("div",{className:xe.layers,children:[e.jsxRuntimeExports.jsx(In,{}),e.jsxRuntimeExports.jsx(e.DndContext,{sensors:l,onDragEnd:u,onDragStart:_,children:i&&i[n]&&t[i[n].path]&&e.jsxRuntimeExports.jsx(e.SortableContext,{items:t[i[n].path].order,strategy:e.verticalListSortingStrategy,children:t[i[n].path].order.map((y,b)=>e.jsxRuntimeExports.jsx(Fn,{id:y,name:j(t[i[n].path].data[y].name),index:b,onClick:p,isDragging:x,icon:be[t[i[n].path].data[y].name]},y))})}),e.jsxRuntimeExports.jsx(Mn,{})]})},Dn=({isHeader:t})=>{const{header:s,footer:o}=e.useLayersStore(),{pageContext:n}=e.usePagesStore();return t?s==null?void 0:s.renderSettings(n):o==null?void 0:o.renderSettings(n)},On=()=>{const{settings:t}=e.useSettingsStore(),s=e.useNavigate(),{setError:o}=e.useErrorStore();try{return t==null?void 0:t.renderSettings()}catch(n){return console.error("Error rendering settings:",n),o({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),s("/error"),null}},Un="_theme_1wwlz_1",qn="_block_1wwlz_7",zn="_name_1wwlz_22",$e={theme:Un,block:qn,name:zn},Gn=()=>{const t=e.useNavigate();function s(o){switch(o==null?void 0:o.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:$e.theme,children:me.map(o=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>s(o),className:e.clx($e.block),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:o.icon}),e.jsxRuntimeExports.jsx("span",{className:$e.name,children:o.name}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight"})]},o.icon))})},Vn="_back_fx3bu_1",Wn="_render_fx3bu_9",Zn="_open_fx3bu_24",Xn="_close_fx3bu_51",Yn="_clicked_fx3bu_55",Kn="_title_fx3bu_59",Qn="_button_fx3bu_67",Jn="_loading_fx3bu_72",er="_settings_fx3bu_76",tr="_deleteButton_fx3bu_82",sr="_backIcon_fx3bu_95",K={back:Vn,render:Wn,open:Zn,close:Xn,clicked:Yn,title:Kn,button:Qn,loading:Jn,settings:er,deleteButton:tr,backIcon:sr},or=({block:t})=>{const{pageContext:s}=e.usePagesStore(),o=e.useNavigate(),{setError:n}=e.useErrorStore();try{return t.renderSettings(s)}catch(i){return console.error("Error rendering settings:",i),n({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),o("/error"),null}},nr="_wrapper_1u3c5_1",rr="_header_1u3c5_8",ir="_title_1u3c5_15",ar="_colorWrapper_1u3c5_21",lr="_name_1u3c5_32",cr="_color_1u3c5_21",ur="_value_1u3c5_44",dr="_length_1u3c5_48",X={wrapper:nr,header:rr,title:ir,colorWrapper:ar,name:lr,color:cr,value:ur,length:dr},ot=t=>{const{colors:s,isAddable:o}=t,{themeSettings:n}=e.useThemeSettingsStore(),[i,r]=f.useState(!1);f.useEffect(()=>{s.length<=3&&r(!0)},[]);function a(c){const p=c.replace("--",""),j=p.replace("-","/"),[l,x]=p.split("-");return{name:j,field:l,variable:x}}return e.jsxRuntimeExports.jsxs("div",{className:X.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:X.header,children:[e.jsxRuntimeExports.jsx("div",{className:X.title,children:"Section colors"}),!i&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(X.value,X.length),onClick:()=>r(!0),children:["+",s.length]})]}),i&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:X.colors,children:s.map(c=>{const p=a(c),{variable:j,name:l,field:x}=p;return e.jsxRuntimeExports.jsx(pr,{color:n.colors[x][j],name:l,isAddable:o})})}),s.length>3&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(X.value,X.length),onClick:()=>r(!1),children:["Hide ",s.length," colors"]})]})]})},pr=t=>{const{name:s,color:o,isAddable:n}=t,{setActiveLabel:i,setModalPosition:r,setInitialColor:a,setShowModal:c,setUpdate:p,setColor:j,setColorChange:l,colorChange:x}=e.useColorPickerStore(),{updateColor:S}=e.useThemeSettingsStore(),_=(b,d)=>w=>{S(b,d,w)};f.useEffect(()=>{const b=()=>{c(!1),i(null),a(o),p(()=>{}),j(o),l(()=>{})};return document.body.addEventListener("click",b),()=>{document.body.removeEventListener("click",b)}},[]);const u=b=>{const d=s.split("/")[0],w=s.split("/")[1];b.stopPropagation(),n||c(!0),l(x),p(W=>_(d,w)(W)),a(o),j(o);const m=b.currentTarget.getBoundingClientRect(),g=400,h=288,B=10,k=20,C=window.innerHeight-m.bottom,N=m.top,E=window.innerWidth-m.right,U=m.left;let A,v;A=m.bottom+B+window.scrollY,v=m.left,(C<g||C<k)&&(N>=g?A=m.top-g-B+window.scrollY:A=window.scrollY+(window.innerHeight-g)/2),E<h&&(U>=h?v=m.right-h:v=(window.innerWidth-h)/2),v<m.right&&v+h>m.left&&A<m.bottom&&A+g>m.top&&(E>=h?v=m.right+B+100:C>=g?A=m.bottom+B+window.scrollY:(A=window.scrollY+(window.innerHeight-g)/2,v=(window.innerWidth-h)/2)),r({top:A,left:v})};function y(b){return b.length>15?b.slice(0,15)+"...":b}return e.jsxRuntimeExports.jsxs("div",{className:X.colorWrapper,onClick:u,children:[e.jsxRuntimeExports.jsx("div",{className:X.color,style:{background:o}}),e.jsxRuntimeExports.jsx("div",{className:X.name,children:s}),e.jsxRuntimeExports.jsx("div",{className:X.value,children:y(o)})]})},mr=t=>{var W,ge;const{isAdd:s}=t,[o,n]=f.useState(!1),{setActiveBlock:i}=e.useNavbarStore(),{sourceBlocks:r,activeBlock:a,setActiveBlock:c,currentInstance:p,setCurrentInstance:j}=e.useBlocksStore(),{setTitle:l,setDescription:x,setOnConfirm:S}=e.useConfirmationModalStore(),_=e.useNavigate(),{blocks:u,addBlock:y,editBlock:b,currentBlock:d,setCurrentBlock:w,removeBlock:m,setPositionBlock:g,setHeader:h,setFooter:B,header:k,footer:C}=e.useLayersStore(),{currentPage:N,pages:E}=e.usePagesStore();function U(q=!1){if(!s&&E&&p&&!q){const F={blockSettings:{}};Object.keys(p.blockSettings).filter(V=>!["displayName","isAddable"].includes(V)).map(V=>{F.blockSettings[V]=p.blockSettings[V]}),b(E[N].path,d,{name:u[E[N].path].data[d].name,value:F})}c(null),w(null),setTimeout(()=>{n(!1)},150),j(null)}function A(){U(),i({name:"Layers",icon:"TreeStructure"}),j(null)}function v(){var q;if(s)return!a||!r[a]?null:new r[a];{if(!E||!E[N]||!d)return null;const F=u[E[N].path].data[d];return!F||!r[F.name]?null:new r[F.name]((q=F.value)==null?void 0:q.blockSettings)}}f.useEffect(()=>{if(a||d&&!["header","footer"].includes(d)){const q=v();j(q)}else j(null)},[a,d]),f.useEffect(()=>{d==="header"&&h(k)},[d,k]),f.useEffect(()=>{d==="footer"&&B(C)},[d,C]);function R(q){if(!r)return"unknown name";if(!r[q])return d==="header"?k==null?void 0:k.blockSettings.displayName:d==="footer"?C==null?void 0:C.blockSettings.displayName:"unknown name";const F=new r[q];return!F.blockSettings||!F.blockSettings.displayName?"unknown name":F.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(K.render,{[K.open]:d||a,[K.close]:!d&&!a,[K.clicked]:o}),onClick:q=>q.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:K.back,children:[e.jsxRuntimeExports.jsx("div",{className:K.backIcon,onClick:()=>U(),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("h3",{className:K.title,children:a&&R(a)||E&&E[N]&&u[E[N].path]&&d&&R((W=u[E[N].path].data[d])==null?void 0:W.name)||d&&J(d)||"Loading"}),!s&&d&&E&&!["header","footer"].includes(d)&&u[E[N].path].data[d]&&R((ge=u[E[N].path].data[d])==null?void 0:ge.name)!=="unknown name"&&e.jsxRuntimeExports.jsx("button",{onClick:q=>{var F;q.stopPropagation(),l("Remove Block"),x(`Are you sure you want to delete ${R((F=u[E[N].path].data[d])==null?void 0:F.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),S(()=>{n(!0),m(E[N].path,d),U(!0)})},className:K.deleteButton,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]}),e.jsxRuntimeExports.jsxs("div",{className:K.settings,children:[p&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(or,{block:p}),e.jsxRuntimeExports.jsx(ot,{colors:p.blockColors,isAddable:s})]}),d&&["header","footer"].includes(d)&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Dn,{isHeader:d==="header"}),e.jsxRuntimeExports.jsx(ot,{colors:d==="header"?k.blockColors:C.blockColors,isAddable:!1})]}),!a&&!d&&e.jsxRuntimeExports.jsx("div",{className:K.loading,children:"Loading"})]}),s&&e.jsxRuntimeExports.jsx("div",{className:K.addButton,children:e.jsxRuntimeExports.jsx(e.Button,{style:{width:"100%"},onClick:()=>{if(n(!0),!["header","footer"].includes(d)&&E){const q={blockSettings:{},blockColors:p.blockColors};Object.keys(p.blockSettings).filter(F=>!["displayName","isAddable"].includes(F)).map(F=>{q.blockSettings[F]=p.blockSettings[F]}),y(E[N].path,{name:a,value:q}),g(null,!1)}else d==="header"?h(k):B(C);_("/admin/builder"),A()},children:"Add Section"})})]})},xr="_settings_ydsyo_1",hr="_open_ydsyo_16",gr="_close_ydsyo_20",jr="_header_ydsyo_24",Sr="_title_ydsyo_31",fr="_addButton_ydsyo_38",br="_backIcon_ydsyo_47",de={settings:xr,open:hr,close:gr,header:jr,title:Sr,addButton:fr,backIcon:br},_r="_wrapper_joj7w_1",wr="_category_joj7w_5",Cr="_categoryTitle_joj7w_11",vr="_color_joj7w_17",kr="_content_joj7w_26",Er="_preview_joj7w_35",pe={wrapper:_r,category:wr,categoryTitle:Cr,color:vr,content:kr,preview:Er},ae=t=>{const{initialColor:s,onChange:o,title:n,labelStyle:i="primary",isGradientActive:r=!0}=t,[a,c]=f.useState(s);f.useEffect(()=>{c(s)},[s]);const{setActiveLabel:p,setModalPosition:j,setInitialColor:l,setShowModal:x,setUpdate:S,setColor:_,setColorChange:u,setIsGradientActive:y,colorChange:b}=e.useColorPickerStore();f.useEffect(()=>{const w=()=>{x(!1),p(null),l(s),S(()=>{}),_(s),u(()=>{})};return document.body.addEventListener("click",w),()=>{document.body.removeEventListener("click",w)}},[s,p,_,u,l,x,S]);const d=w=>{w.stopPropagation(),x(!0),u(c),S(o),l(s),_(a),y(r);const m=w.currentTarget.getBoundingClientRect(),g=400,h=288,B=10,k=20,C=window.innerHeight-m.bottom,N=m.top,E=window.innerWidth-m.right,U=m.left;let A,v;A=m.bottom+B+window.scrollY,v=m.left,(C<g||C<k)&&(N>=g?A=m.top-g-B+window.scrollY:A=window.scrollY+(window.innerHeight-g)/2),E<h&&(U>=h?v=m.right-h:v=(window.innerWidth-h)/2),v<m.right&&v+h>m.left&&A<m.bottom&&A+g>m.top&&(E>=h?v=m.right+B+100:C>=g?A=m.bottom+B+window.scrollY:(A=window.scrollY+(window.innerHeight-g)/2,v=(window.innerWidth-h)/2)),j({top:A,left:v})};return e.jsxRuntimeExports.jsxs("div",{className:$.content,children:[e.jsxRuntimeExports.jsx("span",{className:e.clx($.name,{[$.secondary]:i==="secondary"}),children:n}),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:w=>{const m=w.target.value;o(m),_(m),c(m),b(m)},className:$.input})]})]})},Rr=()=>{const{themeSettings:t,updateColor:s}=e.useThemeSettingsStore();async function o(i,r,a){s(i,r,a)}const n=f.useMemo(()=>{const i={};return Object.entries(t.colors).forEach(([r,a])=>{Object.entries(a).forEach(([c,p])=>{i[p]||(i[p]=[]),i[p].push(`${r}-${c}`)})}),Object.keys(i).filter(r=>i[r].length>1)},[t.colors]);return e.jsxRuntimeExports.jsx("div",{className:pe.wrapper,children:Object.entries(t.colors).map(([i,r])=>e.jsxRuntimeExports.jsxs("div",{className:pe.category,children:[e.jsxRuntimeExports.jsx("h2",{className:pe.categoryTitle,children:J(i)}),Object.entries(r).map(([a,c])=>e.jsxRuntimeExports.jsxs("div",{className:pe.color,children:[e.jsxRuntimeExports.jsxs("div",{className:pe.content,children:[e.jsxRuntimeExports.jsx("div",{className:pe.preview,style:{background:c}}),e.jsxRuntimeExports.jsx(ae,{title:J(a),initialColor:c,onChange:p=>o(i,a,p)})]}),n.includes(c)&&e.jsxRuntimeExports.jsx(qe,{type:"warning",message:"To avoid contrast problems, please use a different color",style:{marginBottom:12}})]},a))]},i))})},yr="_wrapper_dv4am_2",Br="_category_dv4am_6",Nr="_categoryTitle_dv4am_12",Lr="_color_dv4am_18",Tr="_name_dv4am_24",Ar="_content_dv4am_29",Pr="_label_dv4am_36",Ir="_input_dv4am_48",$r="_title_dv4am_74",Mr="_field_dv4am_82",Fr="_alignments_dv4am_92",Hr="_lineField_dv4am_98",Dr="_style_dv4am_106",Or="_header_dv4am_113",ee={wrapper:yr,category:Br,categoryTitle:Nr,color:Lr,name:Tr,content:Ar,label:Pr,input:Ir,title:$r,field:Mr,alignments:Fr,lineField:Hr,style:Dr,header:Or},Ur="_blocks_emecf_1",qr="_block_emecf_1",zr="_active_emecf_21",Me={blocks:Ur,block:qr,active:zr},nt=t=>{const{items:s,selectedItem:o,onSelect:n,getIconName:i}=t;return e.jsxRuntimeExports.jsx("div",{className:Me.blocks,children:s.map(r=>e.jsxRuntimeExports.jsx("div",{className:e.clx(Me.block,{[Me.active]:o===r}),onClick:()=>n(r),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i(r),fill:o===r?"#252525":"#757575"})},String(r)))})},Gr=["left","center","right"],Vr=["solid","dashed"],Ee=t=>{const{title:s,children:o,rightAddon:n}=t;return e.jsxRuntimeExports.jsxs("div",{className:ee.field,children:[e.jsxRuntimeExports.jsxs("div",{className:ee.header,children:[e.jsxRuntimeExports.jsx("h4",{children:s}),n]}),o]})},Wr=()=>{const{themeSettings:t,updateInput:s}=e.useThemeSettingsStore(),o=f.useMemo(()=>t.inputs,[t]),n=(r,a,c)=>{s(r,a,c)},i=r=>a=>{s(r,a,"color")};return e.jsxRuntimeExports.jsxs("div",{className:ee.wrapper,children:[e.jsxRuntimeExports.jsxs(Ee,{title:"General",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(o.general.height),onChange:r=>n("general",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Input,{label:"Style name",value:o.general.name,onChange:r=>n("general",r,"name")}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>n("general",r,"size"),value:String(o.general.size),options:e.sizeOptions}),e.jsxRuntimeExports.jsx(ae,{initialColor:J(o.general.color),onChange:i("general"),title:"Font Color",labelStyle:"secondary"})]}),e.jsxRuntimeExports.jsxs(Ee,{title:"Field Fill",rightAddon:e.jsxRuntimeExports.jsx("div",{className:ee.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>n("field",r,"active"),current:o.field.active})}),children:[e.jsxRuntimeExports.jsx(ae,{initialColor:J(o.field.color),onChange:i("field"),title:"Color",labelStyle:"secondary"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Opacity (%)",value:String(o.field.opacity),onChange:r=>n("field",r,"opacity"),type:"number",min:0})]}),e.jsxRuntimeExports.jsxs(Ee,{title:"Border",rightAddon:e.jsxRuntimeExports.jsx("div",{className:ee.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>n("border",r,"active"),current:o.border.active})}),children:[e.jsxRuntimeExports.jsxs("div",{className:ee.lineField,children:[e.jsxRuntimeExports.jsxs("div",{className:ee.style,children:[e.jsxRuntimeExports.jsx("span",{className:ee.title,children:"Style"}),e.jsxRuntimeExports.jsx(nt,{items:Vr,selectedItem:o.border.style,onSelect:r=>n("border",r,"style"),getIconName:r=>r==="solid"?"Minus":"Selection"})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Radius (px)",value:String(o.border.radius),onChange:r=>n("border",r,"radius"),type:"number",min:0})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Thickness (px)",value:String(o.border.thickness),onChange:r=>n("border",r,"thickness"),type:"number",min:0}),e.jsxRuntimeExports.jsx(ae,{initialColor:J(o.border.color),onChange:i("border"),title:"Color",labelStyle:"secondary"})]}),e.jsxRuntimeExports.jsxs(Ee,{title:"Label",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Line Height (px)",value:String(o.label.height),onChange:r=>n("label",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>n("label",r,"size"),value:String(o.label.size),options:e.sizeOptions}),e.jsxRuntimeExports.jsx(ae,{initialColor:J(o.label.color),onChange:i("label"),title:"Color",labelStyle:"secondary"}),e.jsxRuntimeExports.jsxs("div",{className:ee.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:ee.title,children:"Alignment Type"}),e.jsxRuntimeExports.jsx(nt,{items:Gr,selectedItem:o.label.alignment,onSelect:r=>n("label",r,"alignment"),getIconName:r=>r==="center"?"AlignCenterHorizontal":r==="left"?"AlignLeft":"AlignRight"})]})]})]})},Zr="_wrapper_mkmxa_1",Xr="_category_mkmxa_5",Yr="_categoryTitle_mkmxa_11",Kr="_font_mkmxa_17",Qr="_content_mkmxa_32",Jr="_icon_mkmxa_39",ei="_paragraph_mkmxa_50",ti="_deleteIcon_mkmxa_54",si="_iconButton_mkmxa_61",se={wrapper:Zr,category:Xr,categoryTitle:Yr,font:Kr,content:Qr,icon:Jr,paragraph:ei,deleteIcon:ti,iconButton:si},oi=t=>{const{font:s,size:o,id:n,category:i}=t,{setActiveFont:r}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsxs("div",{className:se.font,onClick:()=>r(n),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(se.icon,{[se.paragraph]:i==="paragraph"}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i==="paragraph"?"TextB":"TextH"})}),e.jsxRuntimeExports.jsxs("div",{className:se.content,children:[e.jsxRuntimeExports.jsx("h2",{className:se.categoryTitle,children:J(n)}),e.jsxRuntimeExports.jsx("span",{className:se.value,children:`${s}, ${o}px`})]})]})},ni=()=>{const{themeSettings:t,setActiveFont:s,activeBlock:o}=e.useThemeSettingsStore();f.useEffect(()=>(n(),()=>{n()}),[]);function n(){s(null)}if(o!=null&&o.name)return e.jsxRuntimeExports.jsx("div",{className:se.wrapper,children:Object.entries(t.fonts).map(([i,r])=>e.jsxRuntimeExports.jsxs("div",{className:se.category,children:[e.jsxRuntimeExports.jsx("h2",{className:se.categoryTitle,children:J(i)}),Object.entries(r).map(([a,c])=>e.jsxRuntimeExports.jsx(oi,{id:a,category:i,...c},a))]},i))})},ri="_wrapper_r293u_1",ii="_open_r293u_16",ai="_close_r293u_20",li="_header_r293u_24",ci="_title_r293u_32",ui="_options_r293u_38",di="_clicked_r293u_45",pi="_backIcon_r293u_49",ne={wrapper:ri,open:ii,close:ai,header:li,title:ci,options:ui,clicked:di,backIcon:pi},mi=()=>{const{activeBlock:t,setActiveFont:s,activeFont:o,themeSettings:n,updateFont:i}=e.useThemeSettingsStore(),{fonts:r}=e.useFontsStore(),[a,c]=f.useState(null);function p(){s(null)}function j(x,S){a&&o&&i(a,o,S,x)}const l=f.useMemo(()=>o?n.fonts.heading[o]?(c("heading"),n.fonts.heading[o]):n.fonts.paragraph[o]?(c("paragraph"),n.fonts.paragraph[o]):(c(null),null):null,[o,n]);return e.jsxRuntimeExports.jsxs("div",{className:e.clx(ne.wrapper,{[ne.open]:(t==null?void 0:t.name)==="Fonts"&&o,[ne.close]:(t==null?void 0:t.name)!=="Fonts"||!o}),children:[e.jsxRuntimeExports.jsxs("div",{className:ne.header,children:[e.jsxRuntimeExports.jsx("div",{className:ne.backIcon,onClick:p,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:ne.title,children:"Font Style"})]}),o&&l&&e.jsxRuntimeExports.jsxs("div",{className:ne.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:l.font,onChange:x=>j(x,"font"),options:[...r.filter(x=>x!==l.font)]}),e.jsxRuntimeExports.jsx(e.Select,{label:"Size",value:String(l.size),onChange:x=>j(x,"size"),options:e.sizeOptions}),e.jsxRuntimeExports.jsx(e.Select,{label:"Weight",value:String(l.weight),onChange:x=>j(x,"weight"),options:e.weightOptions})]})]})},xi="_wrapper_r293u_1",hi="_open_r293u_16",gi="_close_r293u_20",ji="_header_r293u_24",Si="_title_r293u_32",fi="_options_r293u_38",bi="_clicked_r293u_45",_i="_backIcon_r293u_49",re={wrapper:xi,open:hi,close:gi,header:ji,title:Si,options:fi,clicked:bi,backIcon:_i},at=()=>{const{activeBlock:t,themeSettings:s,updateBorder:o,setActiveBlock:n}=e.useThemeSettingsStore();function i(p,j){o(j,p)}const r=e.useNavigate();function a(){n(null),r("/admin/builder/theme")}const c=f.useMemo(()=>s.borders,[s]);return e.jsxRuntimeExports.jsxs("div",{className:e.clx(re.wrapper,{[re.open]:(t==null?void 0:t.name)==="Borders",[re.close]:(t==null?void 0:t.name)!=="Borders"}),children:[e.jsxRuntimeExports.jsxs("div",{className:re.header,children:[e.jsxRuntimeExports.jsx("div",{className:re.backIcon,onClick:a,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:re.title,children:"Borders Style"})]}),e.jsxRuntimeExports.jsxs("div",{className:re.options,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Border Radius (px)",value:String(c.radius),onChange:p=>i(Number(p),"radius"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Input,{label:"Border Thickness (px)",value:String(c.thickness),onChange:p=>i(Number(p),"thickness"),type:"number",min:0})]})]})},wi="_wrapper_38nwu_1",Ci="_open_38nwu_17",vi="_close_38nwu_21",ki="_header_38nwu_25",Ei="_title_38nwu_33",Ri="_options_38nwu_39",yi="_clicked_38nwu_46",Bi="_label_38nwu_50",Ni="_alignments_38nwu_57",Li="_blocks_38nwu_63",Ti="_alignment_38nwu_57",Ai="_active_38nwu_82",Pi="_chargeTypes_38nwu_89",Ii="_charge_38nwu_89",$i="_chargeActive_38nwu_117",Mi="_shadowsHeader_38nwu_125",Fi="_sliderContainer_38nwu_131",Hi="_shadowInputs_38nwu_139",Di="_shadowInputsRow_38nwu_159",Oi="_shadowInputsOpen_38nwu_167",Ui="_toggleIcon_38nwu_173",qi="_toggleIconActive_38nwu_177",zi="_backIcon_38nwu_181",z={wrapper:wi,open:Ci,close:vi,header:ki,title:Ei,options:Ri,clicked:yi,label:Bi,alignments:Ni,blocks:Li,alignment:Ti,active:Ai,chargeTypes:Pi,charge:Ii,chargeActive:$i,shadowsHeader:Mi,sliderContainer:Fi,shadowInputs:Hi,shadowInputsRow:Di,shadowInputsOpen:Oi,toggleIcon:Ui,toggleIconActive:qi,backIcon:zi},Gi=["left","center","right"],lt=()=>{const{activeBlock:t,themeSettings:s,updateButton:o,setActiveBlock:n}=e.useThemeSettingsStore(),{fonts:i}=e.useFontsStore(),[r,a]=f.useState("primary");function c(u,y){o(r,y,u)}const[p,j]=f.useState(!1),l=s.buttons[r],x=e.useNavigate();function S(){n(null),x("/admin/builder/theme")}function _(u,y){c({...l.boxShadow,[u]:y},"boxShadow")}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(z.wrapper,{[z.open]:(t==null?void 0:t.name)==="Buttons",[z.close]:(t==null?void 0:t.name)!=="Buttons"}),children:[e.jsxRuntimeExports.jsxs("div",{className:z.header,children:[e.jsxRuntimeExports.jsx("div",{className:z.backIcon,onClick:S,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:z.title,children:"Buttons Style"})]}),e.jsxRuntimeExports.jsx("div",{className:z.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(u=>e.jsxRuntimeExports.jsx("div",{className:e.clx(z.charge,{[z.chargeActive]:r===u}),onClick:()=>a(u),children:u.charAt(0).toUpperCase()+u.slice(1)},u))}),l&&e.jsxRuntimeExports.jsxs("div",{className:z.options,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(l.height),onChange:u=>c(Number(u),"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",value:String(l.size),onChange:u=>c(Number(u),"size"),options:e.sizeOptions}),e.jsxRuntimeExports.jsx(e.Input,{label:"Border Radius (px)",value:String(l.radius),onChange:u=>c(Number(u),"radius"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:l.font,onChange:u=>c(u,"font"),options:[...i.filter(u=>u!==l.font)]}),e.jsxRuntimeExports.jsx(ae,{initialColor:l.background,onChange:u=>c(u,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),e.jsxRuntimeExports.jsxs("div",{className:z.sliderContainer,children:[e.jsxRuntimeExports.jsx("h4",{className:z.label,children:"Shadow"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:()=>j(!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(z.shadowInputs,{[z.shadowInputsOpen]:p}),children:[e.jsxRuntimeExports.jsxs("div",{className:z.shadowInputsRow,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Left (px)",value:String(l.boxShadow.left),onChange:u=>_("left",Number(u)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Top (px)",value:String(l.boxShadow.top),onChange:u=>_("top",Number(u)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Blur (px)",value:String(l.boxShadow.blur),onChange:u=>_("blur",Number(u)),type:"number"}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,whiteSpace:"nowrap"},children:e.jsxRuntimeExports.jsx(e.Input,{label:"Spread (px)",value:String(l.boxShadow.spread),onChange:u=>_("spread",Number(u)),type:"number"})})]}),e.jsxRuntimeExports.jsx(ae,{initialColor:l.boxShadow.color,onChange:u=>_("color",u),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs("div",{className:z.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:z.label,children:"Alignment Type"}),e.jsxRuntimeExports.jsx("div",{className:z.blocks,children:Gi.map(u=>e.jsxRuntimeExports.jsx("div",{className:e.clx(z.alignment,{[z.active]:l.alignment===u}),onClick:()=>{c(u,"alignment")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:u==="center"?"AlignCenterHorizontal":u==="left"?"AlignLeft":"AlignRight",fill:l.alignment===u?"#252525":"#757575"})},u))})]}),e.jsxRuntimeExports.jsx(e.Switch,{label:"Enable Hover",onChange:u=>c(u,"hover"),current:l.hover})]})]})},Vi=()=>{const{activeBlock:t,themeSettings:s}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(t==null?void 0:t.name)==="Fonts"&&s.fonts&&e.jsxRuntimeExports.jsx(mi,{}),(t==null?void 0:t.name)==="Borders"&&s.borders&&e.jsxRuntimeExports.jsx(at,{}),(t==null?void 0:t.name)==="Buttons"&&s.buttons&&e.jsxRuntimeExports.jsx(lt,{})]})},Wi=()=>{const{activeBlock:t,setActiveBlock:s,themeSettings:o}=e.useThemeSettingsStore(),{activeBlock:n}=e.useNavbarStore(),i=e.useNavigate();function r(){s(null),i("/admin/builder/theme")}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(de.settings,{[de.open]:t,[de.close]:!t||n.name!=="Theme"}),children:[e.jsxRuntimeExports.jsxs("div",{className:de.header,children:[e.jsxRuntimeExports.jsx("div",{className:de.backIcon,onClick:r,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:de.title,children:t==null?void 0:t.name})]}),(t==null?void 0:t.name)==="Fonts"&&o.fonts&&e.jsxRuntimeExports.jsx(ni,{}),(t==null?void 0:t.name)==="Colors"&&o.colors&&e.jsxRuntimeExports.jsx(Rr,{}),(t==null?void 0:t.name)==="Inputs"&&o.inputs&&e.jsxRuntimeExports.jsx(Wr,{}),(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,{}),e.jsxRuntimeExports.jsx(Vi,{})]})},Zi=()=>{const{activeBlock:t}=e.useNavbarStore(),{activeBlock:s}=e.useBlocksStore();function o(){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,children:[e.jsxRuntimeExports.jsx("h3",{className:et.title,children:o()}),t.name==="Layers"&&e.jsxRuntimeExports.jsx(Hn,{}),t.name==="Add"&&e.jsxRuntimeExports.jsx(it,{}),e.jsxRuntimeExports.jsx(mr,{isAdd:!!s}),e.jsxRuntimeExports.jsx(Wi,{}),t.name==="Theme"&&e.jsxRuntimeExports.jsx(Gn,{}),t.name==="Settings"&&e.jsxRuntimeExports.jsx(On,{})]})},Xi="_wrapper_gibny_1",Yi="_header_gibny_12",Ki="_content_gibny_23",Qi="_buttons_gibny_31",Ji="_cancel_gibny_38",ea="_label_gibny_43",ta="_description_gibny_44",sa="_preview_gibny_52",oa="_block_gibny_58",na="_slug_gibny_67",ra="_title_gibny_73",Q={wrapper:Xi,header:Yi,content:Ki,buttons:Qi,cancel:Ji,label:ea,description:ta,preview:sa,block:oa,slug:na,title:ra},ia="_wrapper_ba9vp_2",aa="_label_ba9vp_10",la="_options_ba9vp_18",ca="_radioLabel_ba9vp_24",ua="_radio_ba9vp_24",da="_custom_ba9vp_39",pa="_option_ba9vp_18",ie={wrapper:ia,label:aa,options:la,radioLabel:ca,radio:ua,custom:da,option:pa},ma=t=>{const{defaultValue:s,options:o,onChange:n,label:i}=t,[r,a]=f.useState(s),c=p=>{const j=p.target.value;a(j),n(j)};return e.jsxRuntimeExports.jsxs("div",{className:ie.wrapper,children:[e.jsxRuntimeExports.jsx("span",{className:ie.label,children:i}),e.jsxRuntimeExports.jsx("div",{className:ie.options,children:o.map(p=>e.jsxRuntimeExports.jsxs("label",{className:ie.radioLabel,children:[e.jsxRuntimeExports.jsx("input",{type:"radio",value:p.value,checked:r===p.value,onChange:c,className:ie.radio}),e.jsxRuntimeExports.jsx("span",{className:ie.custom}),e.jsxRuntimeExports.jsx("span",{className:ie.option,children:p.label})]},p.value))})]})},xa=()=>{var k,C,N,E,U,A,v;const{setIsOpenModal:t,pages:s,createPage:o,updatePage:n,isEdit:i,setIsEdit:r,editedPage:a,setEditedPage:c}=e.usePagesStore(),{createPage:p,updatePage:j}=e.useLayersStore(),[l,x]=f.useState(a?s&&((k=s[a])==null?void 0:k.path):""),[S,_]=f.useState(a?s&&((C=s[a])==null?void 0:C.name):""),[u,y]=f.useState(a&&s&&((N=s[a])==null?void 0:N.seo)&&((U=(E=s[a])==null?void 0:E.seo)==null?void 0:U.description)||""),[b,d]=f.useState(a?s&&((A=s[a])==null?void 0:A.visibility):"public");function w(){x(""),_(""),y(""),d("public"),r(!1),c(null)}function m(){w(),t(!1)}function g(R){return R[0]==="/"?R:"/"+R}function h(){o({path:g(l),name:S||l||"",icon:"File",seo:{title:S||"",description:u||""},visibility:b||"public"}),p(l),m()}function B(){s&&(j(s[a].name||"",S||l||""),n(a,{path:g(l),name:S||l,icon:s[a].icon||"File",seo:{title:S||"",description:u||""},visibility:b||"public"})),m()}return e.jsxRuntimeExports.jsxs("div",{className:Q.wrapper,onClick:R=>R.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Q.header,children:[e.jsxRuntimeExports.jsxs("h2",{children:[i?"Edit":"Create"," Blank Page"]}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:m})]}),e.jsxRuntimeExports.jsxs("div",{className:Q.content,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Page Slug",onChange:R=>x(R),value:l,placeholder:"path-to-page",disabled:!!(a&&s&&((v=s[a])!=null&&v.name)&&Be.includes(s[a].name)),required:!0,regex:"^.+$"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Page Title",onChange:R=>_(R),value:S,placeholder:"Contact us"}),e.jsxRuntimeExports.jsx(e.Textarea,{label:"Description",onChange:R=>y(R),value:u,placeholder:"Contact us at any time of the day or night. You are always welcome",maxLength:150}),e.jsxRuntimeExports.jsx(ma,{label:"Visibility",defaultValue:b,options:[{value:"public",label:"Public"},{value:"private",label:"Private"}],onChange:R=>d(R)}),e.jsxRuntimeExports.jsxs("div",{className:Q.preview,children:[e.jsxRuntimeExports.jsx("span",{className:Q.label,children:"Preview"}),e.jsxRuntimeExports.jsxs("div",{className:Q.block,children:[e.jsxRuntimeExports.jsx("span",{className:Q.slug,children:l||"yoursite.url"}),e.jsxRuntimeExports.jsx("span",{className:Q.title,children:S||"My Blank Page"}),e.jsxRuntimeExports.jsx("span",{className:Q.description,children:u||"It is My Description"})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:Q.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{className:Q.cancel,onClick:m,children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:i?B:h,disabled:l.length===0,children:i?"Update":"Create"})]})]})},ha="_layout_3kge3_1",ga="_main_3kge3_10",ja="_content_3kge3_18",Sa="_notification_3kge3_26",Re={layout:ha,main:ga,content:ja,notification:Sa},fa="_modal_1h74q_1",ba="_title_1h74q_14",_a="_buttons_1h74q_20",ye={modal:fa,title:ba,buttons:_a},ct=()=>{const{title:t,description:s,onConfirm:o,setTitle:n,setDescription:i,setOnConfirm:r}=e.useConfirmationModalStore();function a(){n(null),i(null),r(null)}return t&&s&&o&&e.jsxRuntimeExports.jsxs("div",{className:ye.modal,children:[e.jsxRuntimeExports.jsx("div",{className:ye.title,children:t}),e.jsxRuntimeExports.jsx("div",{className:ye.description,children:s}),e.jsxRuntimeExports.jsxs("div",{className:ye.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:a,children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:o,type:"Secondary",children:"Confirm"})]})]})},wa=()=>{const{isOpenModal:t,setIsOpenModal:s}=e.usePagesStore(),{openModal:o,setOpenModal:n}=e.useChooseImageStore(),{notification:i,setNotification:r}=e.useNotificationStore(),{title:a,description:c,setTitle:p,setDescription:j,setOnConfirm:l}=e.useConfirmationModalStore(),[x,S]=f.useState(null);return f.useEffect(()=>{if(i){x&&clearTimeout(x);const _=setTimeout(()=>{r(null)},3e3);S(_)}},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:Re.layout,children:[e.jsxRuntimeExports.jsx(no,{}),e.jsxRuntimeExports.jsxs("main",{className:Re.main,children:[e.jsxRuntimeExports.jsx(Ys,{}),e.jsxRuntimeExports.jsxs("div",{className:Re.content,children:[e.jsxRuntimeExports.jsx(Zi,{}),e.jsxRuntimeExports.jsx(Sn,{})]})]})]}),a&&c&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{p(null),j(null),l(null)},children:e.jsxRuntimeExports.jsx(ct,{})}),t&&e.jsxRuntimeExports.jsx(e.Modal,{close:s,children:e.jsxRuntimeExports.jsx(xa,{})}),o&&e.jsxRuntimeExports.jsx(e.Modal,{close:n,children:e.jsxRuntimeExports.jsx(e.ChooseImageModal,{})}),i&&e.jsxRuntimeExports.jsx("div",{className:Re.notification,children:e.jsxRuntimeExports.jsx(qe,{message:i.message,type:i.status})})]})},Ca=t=>{const{blocks:s,settings:o,header:n,footer:i}=t,{setBlocks:r,setSourceBlocks:a}=e.useBlocksStore(),{fonts:c,setFonts:p}=e.useFontsStore(),{setSettings:j}=e.useSettingsStore(),{setPageContext:l}=e.usePagesStore(),{setThemeSettings:x}=e.useThemeSettingsStore(),{setHeader:S,setFooter:_,setBlocks:u,blocks:y,createPage:b}=e.useLayersStore(),{setPages:d}=e.usePagesStore();function w(m){return m[0]==="/"?m.slice(1):m}return f.useEffect(()=>{const m={};Object.keys(s).map(h=>{m[h]=s[h]}),a(m),r(m),S(n),_(i),(async()=>{const{data:h}=await Ut();let B={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null};const k=await Ft();Object.keys(k).map(v=>{const R=v;B[R]=k[R].value.data}),l(B);const{themeSettings:C,layers:N,settings:E}=h;if(E){const v=o;if(E.settings&&(Object.keys(E.settings).map(R=>{v[R]=E.settings[R]}),j(v)),E.header){const R=n;Object.keys(E.header).map(W=>{R[W]=E.header[W]}),S(R)}if(E.footer){const R=i;Object.keys(E.footer).map(W=>{R[W]=E.footer[W]}),_(R)}}else j(o);C&&x(C),u(N);const U=await Ot(),A={};if(U.data.length>0&&U.data.forEach(v=>{const R=w(v.path);y[R]||b(R),v.path==="/"?A["/"]={...v,icon:Te.home.icon,name:"home"}:Te[R]?A[R]={...v,icon:Te[R].icon,name:R}:A[R]={...v,icon:"File",name:R}}),d(A),c.length===0){const v=await Ht();p([...v.map(R=>R.family)])}})()},[]),e.jsxRuntimeExports.jsx(wa,{})},va=t=>{const{blocks:s,settings:o,header:n,footer:i}=t,[r,a]=f.useState(!0),c=e.useNavigate();return f.useEffect(()=>{a(!0),qt()?a(!1):c("/")},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:r?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsx(Ca,{blocks:s,settings:o,header:n,footer:i})})},ka="_wrapper_1yd2j_1",Ea="_error_1yd2j_11",Ra="_title_1yd2j_21",ya="_buttons_1yd2j_29",fe={wrapper:ka,error:Ea,title:Ra,buttons:ya},Fe=()=>{const t=e.useNavigate(),{error:s,setError:o}=e.useErrorStore(),{pages:n}=e.usePagesStore(),{title:i,description:r,setOnConfirm:a,setTitle:c,setDescription:p}=e.useConfirmationModalStore();f.useEffect(()=>{s&&t("/error")},[s]);async function j(){await e.resetSettings({resetSettings:(s==null?void 0:s.failedSettings)??!1,resetThemeSettings:(s==null?void 0:s.failedThemeSettings)??!1,resetPageIds:(s==null?void 0:s.failedPageIds)??[]}),o(null),window.location.reload()}async function l(){const x=[];n&&Object.keys(n).map(S=>n[S].id).filter(S=>S!==void 0).map(S=>x.push(S)),await e.resetSettings({resetSettings:!0,resetThemeSettings:!0,resetPageIds:x}),o(null)}return e.jsxRuntimeExports.jsxs("div",{className:fe.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:fe.error,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:fe.title,children:"Oops! Something went wrong"}),e.jsxRuntimeExports.jsx("span",{className:fe.message,children:(s==null?void 0:s.message)||""})]}),e.jsxRuntimeExports.jsxs("div",{className:fe.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:j,children:"Reset Settings"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:x=>{x.stopPropagation(),c("Reset All Settings"),p("Are you sure you want to reset all settings? This is irreversible."),a(async()=>{await l()})},children:"Reset All Settings"})]})]}),i&&r&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{c(null),p(null),a(null)},children:e.jsxRuntimeExports.jsx(ct,{})})]})},Ba=t=>{const{children:s}=t,{pathname:o}=e.useLocation(),{setActiveBlock:n}=e.useNavbarStore(),{setActiveBlock:i}=e.useThemeSettingsStore();return f.useEffect(()=>{switch(o){case"/admin/builder":n(e.navbarBlocks[0]);break;case"/admin/builder/add":n(e.navbarBlocks[1]);break;case"/admin/builder/theme":n(e.navbarBlocks[2]);break;case"/admin/builder/settings":n(e.navbarBlocks[3]);break;case"/admin/builder/theme/colors":n(e.navbarBlocks[2]),i(me[0]);break;case"/admin/builder/theme/fonts":n(e.navbarBlocks[2]),i(me[1]);break;case"/admin/builder/theme/borders":n(e.navbarBlocks[2]),i(me[2]);break;case"/admin/builder/theme/buttons":n(e.navbarBlocks[2]),i(me[3]);break;case"/admin/builder/theme/inputs":n(e.navbarBlocks[2]),i(me[4]);break}},[o]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s})},Na=t=>{const{blocks:s,settings:o,header:n,footer:i}=t,[r,a]=f.useState(null),{setBlocks:c,setSourceBlocks:p}=e.useBlocksStore(),{setSettings:j}=e.useSettingsStore(),{setHeader:l,setFooter:x}=e.useLayersStore(),{themeSettings:S}=e.useThemeSettingsStore();f.useEffect(()=>{if(!r){const b={};Object.keys(s).map(w=>{b[w]=s[w]}),p(b),c(b),l(n),x(i),j(o);const d=e.createBrowserRouter([{path:"/admin/builder/*",element:e.jsxRuntimeExports.jsx(Ba,{children:e.jsxRuntimeExports.jsx(va,{blocks:s,settings:o,header:n,footer:i})}),errorElement:e.jsxRuntimeExports.jsx(Fe,{})},{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(Ue,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsxRuntimeExports.jsx(e.customerDashboard_default,{})}),e.jsxRuntimeExports.jsx(Oe,{})]})},{path:"/error",element:e.jsxRuntimeExports.jsx(Fe,{})},{path:"*",element:e.jsxRuntimeExports.jsx(as,{}),errorElement:e.jsxRuntimeExports.jsx(Fe,{})}]);a(d)}},[r]),f.useEffect(()=>{const b=cs(S);hs(S),us(b)},[S]);const _=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,u=localStorage.getItem("shopPassword"),y=localStorage.getItem("shopId")||"";return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:r&&e.jsxRuntimeExports.jsx(e.BillgangProvider,{shopDomain:_,shopId:y,shopPassword:u||void 0,routes:{Checkout:"/checkout",TopUp:"/top-up",Charge:"/charges",Order:"/orders",Subscription:"/subscriptions"},children:e.jsxRuntimeExports.jsx(e.RouterProvider,{router:r})})})};exports.App=Na;exports.ColorVariables=rt;exports.hotReload=Dt;exports.iconNames=_t;
@@ -896,7 +896,7 @@ const _o = (t) => {
896
896
  }
897
897
  function S(x) {
898
898
  if (g) {
899
- const p = Object.keys(g).find((f) => g[f].name === x);
899
+ const p = Object.keys(g).find((f) => g[f].path === x);
900
900
  if (p) return g[p];
901
901
  }
902
902
  return null;
@@ -908,9 +908,9 @@ const _o = (t) => {
908
908
  t(!0);
909
909
  const p = Object.keys(_).map((m) => {
910
910
  const A = S(m);
911
- return _[m] && _[m].data ? {
911
+ return _[m] && _[m].data && (A != null && A.path) ? {
912
912
  name: A ? A.name : m,
913
- path: (A == null ? void 0 : A.path) || m,
913
+ path: A.path,
914
914
  layout: {
915
915
  ..._[m]
916
916
  },
@@ -927,7 +927,7 @@ const _o = (t) => {
927
927
  pageDescription: A && A.seo && A.seo.description ? A.seo.description : ""
928
928
  }
929
929
  } : null;
930
- }), { status: f } = await on("post", "save", {
930
+ }).filter((m) => m), { status: f } = await on("post", "save", {
931
931
  themeSettings: n,
932
932
  settings: {
933
933
  settings: o,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@billgangcom/theme-lib",
3
- "version": "1.35.0",
3
+ "version": "1.35.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"