@billgangcom/theme-lib 1.67.0 → 1.67.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.
- package/dist/builder.cjs.js +1 -1
- package/dist/builder.es.js +1 -2
- package/package.json +1 -1
package/dist/builder.cjs.js
CHANGED
|
@@ -88,4 +88,4 @@
|
|
|
88
88
|
`,s+="}",s},fs=t=>{const n=document.getElementById("dynamic-styles");if(n)n.innerHTML=t;else{const s=document.createElement("style");s.id="dynamic-styles",s.innerHTML=t,document.head.appendChild(s)}};let Ue=new Set;const _s=t=>{const n=new Map;return Object.entries(t).forEach(([s,o])=>{typeof o=="object"&&Object.entries(o).forEach(([a,r])=>{var i,l;if(r&&r.font){const d=r.font.replace(/\s+/g,"+");n.has(d)||n.set(d,new Set),(i=n.get(d))==null||i.add(r.weight),(l=n.get(d))==null||l.add(r.boldWeight)}})}),n},vs=t=>{const n=new Map;return Object.entries(t).forEach(([s,o])=>{typeof o=="object"&&Object.keys(o).forEach(a=>{var r;if(a==="font"&&o[a]){const i=o[a].replace(/\s+/g,"+");n.has(i)||n.set(i,new Set),(r=n.get(i))==null||r.add("400")}})}),n},ws=t=>{Ue.forEach(n=>{if(!t.has(n)){const s=document.querySelector(`link[data-font="${n}"]`);s&&s.remove(),Ue.delete(n)}})},bs=t=>{const n=new Set;t.forEach((s,o)=>{const a=Array.from(s).join(";"),r=`${o}:wght@${a}`;if(n.add(r),!Ue.has(r)){const i=document.createElement("link");i.rel="stylesheet",i.href=`https://fonts.googleapis.com/css2?family=${r}&display=swap`,i.setAttribute("data-font",r),document.head.appendChild(i),Ue.add(r)}}),ws(n)},Cs=t=>{if(t.fonts){const n=_s(t.fonts.desktop),s=vs(t.buttons),o=new Map(n);s.forEach((a,r)=>{if(o.has(r)){const i=o.get(r);a.forEach(l=>i==null?void 0:i.add(l))}else o.set(r,new Set(a))}),bs(o)}};function ks(){try{const{editBlock:t,currentBlock:n,blocks:s,header:o,setHeader:a,footer:r,setFooter:i,announcement:l,setAnnouncement:d}=e.useLayersStore.getState(),{currentPage:j,pages:p}=e.usePagesStore.getState(),{currentInstance:x}=e.useBlocksStore.getState(),{settings:c,setSettings:m}=e.useSettingsStore.getState();if(m(c),n&&x&&p){if(n==="header"&&o)a(o);else if(n==="footer"&&r)i(r);else if(n==="announcement"&&l)d(l);else if(n==="header"||n==="footer"||n==="announcement")throw new Error(`Missing ${n} data.`);const v={blockSettings:{}};if(!x.blockSettings)throw new Error("currentInstance.blockSettings is undefined.");if(Object.keys(x.blockSettings).filter(u=>!["displayName","isAddable"].includes(u)).forEach(u=>{v.blockSettings[u]=x.blockSettings[u]}),!p[j])throw new Error(`Page "${j}" does not exist.`);if(!s[p[j].path].data||!s[p[j].path].data[n])throw new Error(`Layer or block for page "${p[j].path}" and block "${n}" does not exist.`);t(p[j].path,n,{name:s[p[j].path].data[n].name,value:v})}}catch(t){console.error("Error in hotReload function:",t)}}async function Es(t,n,s,o){const a=e.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${e.SL_API_URL}/v1/public/${a}/tickets`,{setNotification:i}=e.useNotificationStore.getState();try{const l=await e.request({method:"post",url:r,body:{title:t,firstMessage:n,email:o,recaptcha:s},withToken:!1});return i({message:"Ticket created successfully. We will contact you by mail",status:"success"}),l}catch(l){i({message:`Error: ${l}. Please try again later.`,status:"error"})}}const Rs="_tooltip_4hruj_1",ys="_fadeIn_4hruj_1",Ts={tooltip:Rs,fadeIn:ys},we=t=>{const{text:n}=t,{setShowTooltip:s}=e.useTooltipStore();return g.useEffect(()=>(s(!0),()=>{s(!1)}),[]),e.jsxRuntimeExports.jsx("div",{className:Ts.tooltip,children:n})},Ls=()=>{const{undo:t,redo:n,past:s,future:o}=e.useHistoryStore(),[a,r]=g.useState(!1),[i,l]=g.useState(!1),[d,j]=g.useState(!1),[p,x]=g.useState(!1),[c,m]=g.useState(null),{setNotification:v}=e.useNotificationStore();return g.useEffect(()=>{r(s.length===0)},[s]),g.useEffect(()=>{l(o.length===0)},[o]),e.jsxRuntimeExports.jsxs("div",{className:be.buttons,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(be.button,{[be.disabled]:a}),onMouseEnter:()=>{const u=setTimeout(()=>{x(!0),j(!1)},200);m(u)},onMouseLeave:()=>{c&&clearTimeout(c),x(!1),j(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{a||(t(),v({message:"Changes undone",status:"success"}))},fill:a?"#757575":"#252525"}),p&&e.jsxRuntimeExports.jsx(we,{text:a?"Nothing to undo":"Click to undo changes"})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(be.button,{[be.disabled]:i}),onMouseEnter:()=>{const u=setTimeout(()=>{j(!0),x(!1)},200);m(u)},onMouseLeave:()=>{c&&clearTimeout(c),j(!1),x(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{i||(n(),v({message:"Changes redone",status:"success"}))},fill:i?"#757575":"#252525"}),d&&e.jsxRuntimeExports.jsx(we,{text:i?"Nothing to redo":"Click to redo changes"})]})]})},Bs="_devices_ls6k9_1",Ns="_device_ls6k9_1",Ps="_active_ls6k9_27",rt={devices:Bs,device:Ns,active:Ps},As=()=>e.jsxRuntimeExports.jsx("div",{className:rt.devices,children:Bt.map(t=>e.jsxRuntimeExports.jsx(Is,{device:t}))}),Is=t=>{const{device:n}=t,{currentDevice:s,setCurrentDevice:o}=e.useDeviceStore(),[a,r]=g.useState(!1),[i,l]=g.useState(null);return e.jsxRuntimeExports.jsxs("div",{className:e.clx(rt.device,{[rt.active]:s.value===n.value}),onClick:()=>o(n),onMouseEnter:()=>{const d=setTimeout(()=>{r(!0)},200);l(d)},onMouseLeave:()=>{i&&clearTimeout(i),r(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:n.icon,fill:s.value===n.value?"#252525":"#757575",width:20,height:20}),a&&e.jsxRuntimeExports.jsx(we,{text:`Switch to ${n.value} view`})]},n.value)},$s="_preview_1x3m8_2",Ms="_active_1x3m8_19",Ze={preview:$s,active:Ms},Fs=()=>{const{onPreview:t}=e.usePreviewStore(),[n,s]=g.useState(!1),[o,a]=g.useState(null);return e.jsxRuntimeExports.jsxs("a",{href:"/",className:e.clx(Ze.preview,{[Ze.active]:t}),target:"_blank",onMouseEnter:()=>{const r=setTimeout(()=>{s(!0)},200);a(r)},onMouseLeave:()=>{o&&clearTimeout(o),s(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUpRight",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Ze.text,children:"Preview"}),n&&e.jsxRuntimeExports.jsx(we,{text:"Open draft theme in new tab"})]})},Hs="_settings_u4cv4_1",Ds={settings:Hs},Os="_pages_167qp_1",Us="_text_167qp_21",Vs="_modal_167qp_27",zs="_open_167qp_46",qs="_page_167qp_1",Gs="_hoverable_167qp_61",Ws="_separator_167qp_65",Zs="_button_167qp_70",Xs="_items_167qp_85",ee={pages:Os,default:"_default_167qp_5",text:Us,modal:Vs,open:zs,page:qs,hoverable:Gs,separator:Ws,button:Zs,items:Xs},re=t=>t?t.replace(/_/g," ").split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" and "):"";function _e(t,n){if(!n||!n[t])return"unknown name";const s=new n[t];return!s.blockSettings||!s.blockSettings.displayName?"unknown name":s.blockSettings.displayName}const Ct=(t,n,s,o,a,r,i)=>{const l=t.currentTarget.getBoundingClientRect(),d=window.innerHeight-l.bottom,j=l.top,p=window.innerWidth-l.right,x=l.left;let c,m;return c=l.bottom+o+window.scrollY,m=l.left,(d<n||d<a)&&(j>=n+i?c=l.top-n-o+window.scrollY:c=window.scrollY+i),c-window.scrollY<i&&(c=window.scrollY+i),(p<s||p<r)&&(x>=s?m=l.right-s:m=(window.innerWidth-s)/2),m<l.right+r&&(m=l.right+r),m<l.right&&m+s>l.left&&c<l.bottom&&c+n>l.top&&(p>=s+r?m=l.right+o+r:d>=n?c=l.bottom+o+window.scrollY:(c=window.scrollY+i,m=(window.innerWidth-s)/2)),{top:c,left:m}},kt=async t=>{const n=localStorage.getItem("shopId")||void 0,s=localStorage.getItem("draftId"),o=`${e.API_URL}/v2/builder/shops/${n}/drafts/${s}/pages/${encodeURIComponent(t)}`;return await e.request({url:o,withToken:!0,method:"delete"})},Ys=()=>{const{currentPage:t,setCurrentPage:n,setIsOpenModal:s,pages:o,setIsEdit:a,setEditedPage:r,deletePage:i,setIsOpenSelectModal:l}=e.usePagesStore(),{deletePage:d,setCurrentBlock:j}=e.useLayersStore(),[p,x]=g.useState(null),{setTitle:c,setDescription:m,setOnConfirm:v}=e.useConfirmationModalStore(),[u,S]=g.useState(!1),_=g.useRef(null);return e.useOnClickOutside(_,()=>{u&&S(!1)}),g.useEffect(()=>{u?l(!0):setTimeout(()=>{l(!1)},300)},[u]),e.jsxRuntimeExports.jsxs("div",{className:ee.pages,ref:_,children:[e.jsxRuntimeExports.jsxs("div",{className:ee.default,onClick:f=>{f.stopPropagation(),S(h=>!h)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:o&&o[t]&&o[t].icon||"File",fill:"#252525",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:ee.text,children:o&&o[t]&&e.defaultPagePaths.includes(o[t].path)?`${re(o[t].name)} page`:o&&o[t]&&o[t].name}),e.jsxRuntimeExports.jsx("div",{style:{transform:u?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease",display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretDown",width:20,height:20})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(ee.modal,{[ee.open]:u}),onClick:f=>f.stopPropagation(),children:[o&&e.jsxRuntimeExports.jsx("div",{className:ee.items,children:Object.keys(o).map(f=>{const h=o[f];return e.jsxRuntimeExports.jsxs("div",{className:e.clx(ee.page,{[ee.hoverable]:p===f}),onMouseEnter:()=>x(f),onMouseLeave:()=>x(null),onClick:()=>{x(null),a(!1),j(null),n(f),S(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:h.icon,fill:"#252525"}),e.jsxRuntimeExports.jsx("span",{className:ee.text,children:e.defaultPagePaths.includes(h.path)?`${re(h.name)} page`:h.name}),p===f&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Gear",fill:"#757575",onClick:C=>{C.stopPropagation(),a(!0),r(f),s(!0)}}),!e.defaultPagePaths.includes(h.path)&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",onClick:C=>{C.stopPropagation(),c("Delete Page"),m(`Are you sure you want to delete ${h.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),v(()=>{C.stopPropagation(),o[t].path===h.path&&n(Object.keys(o)[0]),i(f),d(h.name),kt(h.path)})}})]}),o[t]&&o[t].name===h.name&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"#FF3F19"})]},f)})}),e.jsxRuntimeExports.jsx("div",{className:ee.separator}),e.jsxRuntimeExports.jsxs(e.Button,{className:ee.button,onClick:f=>{f.stopPropagation(),s(!0)},size:"l",children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#ff3f19"}),e.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},Ks="_zoom_fu0hj_1",ht={zoom:Ks},Js=()=>{const{zoomLevel:t,setZoomLevel:n}=e.usePreviewStore();return e.jsxRuntimeExports.jsxs("label",{htmlFor:"zoom",className:ht.zoom,children:[e.jsxRuntimeExports.jsx("label",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},htmlFor:"zoom",children:e.jsxRuntimeExports.jsx(e.Icon,{name:"MagnifyingGlassMinus",width:20,height:20})}),e.jsxRuntimeExports.jsx("input",{id:"zoom",type:"number",min:25,max:250,value:(t*100).toFixed(0),onChange:s=>{const o=Number(s.target.value);n(o/100)},className:ht.input}),e.jsxRuntimeExports.jsx("span",{children:"%"})]})},Qs=()=>e.jsxRuntimeExports.jsxs("div",{className:Ds.settings,children:[e.jsxRuntimeExports.jsx(Ys,{}),e.jsxRuntimeExports.jsx(Js,{})]}),eo="_theme_1e5wq_1",to="_text_1e5wq_13",gt={theme:eo,text:to},so=()=>e.jsxRuntimeExports.jsx("div",{className:gt.theme,children:e.jsxRuntimeExports.jsx("div",{className:gt.text,children:"Live Theme"})}),oo=async(t,n,s)=>{const o=localStorage.getItem("shopId")||void 0,a=localStorage.getItem("draftId"),r=`${e.API_URL}/v2/builder/shops/${o}/drafts/${a}/${n}`;return await e.request({url:r,withToken:!0,method:t,body:s})};function Ce(t,n){try{return n.map(o=>{if(!o.value||!o.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(o.value.blockSettings).filter(r=>r&&r.type===t).map(r=>{if(r.value===void 0)throw new Error("item.value is undefined.");return r.value}).flat()}).flat().filter(o=>o).map(o=>t==="ListingIds"?o.listingId:o)}catch(s){return console.error("Error in getValues function:",s),[]}}function no(t,n,s){return ro(t,n)?s.reviews.length*3:0}function ro(t,n){return n.map(o=>{if(!o.value||!o.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(o.value.blockSettings).filter(r=>r&&r.type===t).map(r=>{if(r.value===void 0)throw new Error("item.value is undefined.");return r.value}).flat()}).flat().filter(o=>o).length>0}function io(t,n){if(n){const s=Object.keys(n).find(o=>n[o].path===t);if(s)return n[s]}return null}const ao=({setIsLoading:t,isLoading:n})=>{const{themeSettings:s}=e.useThemeSettingsStore(),{settings:o}=e.useSettingsStore(),[a,r]=g.useState(null),[i,l]=g.useState(!1),{setNotification:d}=e.useNotificationStore(),{header:j,footer:p,announcement:x,blocks:c}=e.useLayersStore(),{pageContext:m}=e.usePagesStore(),{pages:v}=e.usePagesStore(),u=async()=>{if(i)a&&clearTimeout(a);else{t(!0);const _=Object.keys(c).map(h=>{const C=io(h,v);return c[h]&&c[h].data&&(C!=null&&C.path)?{id:C?C.id:h,name:C?C.name:h,path:C.path,layout:{...c[h]},neededProductIds:[...Ce("ProductId",Object.values(c[h].data))],neededCategoryIds:[...Ce("CategoryId",Object.values(c[h].data))],neededAnnouncementIds:[...Ce("AnnouncementId",Object.values(c[h].data))],neededListingIds:[...Ce("ListingIds",Object.values(c[h].data))],neededFaqIds:[...Ce("FaqsIds",Object.values(c[h].data))],neededReviewCount:no("ReviewCount",Object.values(c[h].data),m),seo:{pageTitle:C&&C.seo&&C.seo.pageTitle?C.seo.pageTitle:"",pageDescription:C&&C.seo&&C.seo.pageDescription?C.seo.pageDescription:""},isPrivate:!!(C&&C.visibility==="private")}:null}).filter(h=>h),{status:f}=await oo("post","save",{themeSettings:s,settings:{settings:o,header:j,footer:p,announcement:x},updatedPages:_});d({message:f===200?"Settings saved":"Error",status:f===200?"success":"error"}),t(!1)}l(!0);const S=setTimeout(()=>{l(!1)},2e3);r(S)};return e.jsxRuntimeExports.jsx(e.Button,{onClick:u,disabled:n,children:"Save"})},lo=()=>{const{isOpenSelectModal:t}=e.usePagesStore(),[n,s]=g.useState(!1),{showTooltip:o}=e.useTooltipStore();return e.jsxRuntimeExports.jsxs("div",{className:Be.header,style:{zIndex:t?5e4:o?501:50},children:[e.jsxRuntimeExports.jsxs("div",{className:Be.left,children:[e.jsxRuntimeExports.jsx(As,{}),e.jsxRuntimeExports.jsx(Fs,{})]}),e.jsxRuntimeExports.jsx("div",{className:Be.center,children:e.jsxRuntimeExports.jsx(Qs,{})}),e.jsxRuntimeExports.jsxs("div",{className:Be.right,children:[e.jsxRuntimeExports.jsx(so,{}),e.jsxRuntimeExports.jsx(Ls,{}),e.jsxRuntimeExports.jsx(ao,{setIsLoading:s,isLoading:n}),n&&e.jsxRuntimeExports.jsx(e.Loader,{})]})]})},co="_exit_ovvox_1",uo="_text_ovvox_11",po="_exitLink_ovvox_16",Xe={exit:co,text:uo,exitLink:po},mo=()=>e.jsxRuntimeExports.jsx("div",{className:Xe.exit,children:e.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:Xe.exitLink,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"SignOut",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Xe.text,children:"Exit"})]})}),xo="_navbar_1podc_1",ho="_main_1podc_6",go="_block_1podc_13",jo="_active_1podc_29",Pe={navbar:xo,main:ho,block:go,active:jo},So=()=>{const{activeBlock:t}=e.useNavbarStore(),{setActiveBlock:n}=e.useBlocksStore(),{setCurrentBlock:s}=e.useLayersStore(),{setActiveBlock:o}=e.useThemeSettingsStore(),{setActiveBlock:a}=e.usePreviewStore(),r=e.useNavigate();function i(l){switch(n(null),s(null),o(null),a({id:null,neededScroll:!1}),l.name){case"Layers":r("/admin/builder");break;case"Add":r("/admin/builder/add");break;case"Theme":r("/admin/builder/theme");break;case"Settings":r("/admin/builder/settings");break}}return e.jsxRuntimeExports.jsxs("div",{className:Pe.navbar,children:[e.jsxRuntimeExports.jsx(mo,{}),e.jsxRuntimeExports.jsx("div",{className:Pe.main,children:e.navbarBlocks.map(l=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(Pe.block,{[Pe.active]:t.icon===l.icon}),onClick:()=>i(l),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:l.icon,fill:t.icon===l.icon?"#252525":"#757575"}),e.jsxRuntimeExports.jsx("span",{children:l.name})]},l.icon))})]})},fo="_preview_gb2ye_1",_o="_main_gb2ye_15",vo="_content_gb2ye_25",wo="_loading_gb2ye_34",bo="_loader_gb2ye_48",Co="_spin_gb2ye_1",ko="_previewLoading_gb2ye_65",ke={preview:fo,main:_o,content:vo,loading:wo,loader:bo,spin:Co,previewLoading:ko},Eo="_header_11zku_2",Ro="_circles_11zku_16",yo="_circle_11zku_16",To="_red_11zku_32",Lo="_green_11zku_36",Bo="_yellow_11zku_40",No="_input_11zku_44",Po="_main_11zku_55",Ao="_text_11zku_63",Io="_copy_11zku_75",ae={header:Eo,circles:Ro,circle:yo,red:To,green:Lo,yellow:Bo,input:No,main:Po,text:Ao,copy:Io},$o=["red","yellow","green"],Mo=()=>{const{currentDevice:t}=e.useDeviceStore(),n=(o,a)=>o.length>a?o.slice(0,a)+"...":o,{setNotification:s}=e.useNotificationStore();return e.jsxRuntimeExports.jsxs("div",{className:ae.header,children:[e.jsxRuntimeExports.jsx("div",{className:ae.circles,children:$o.map(o=>e.jsxRuntimeExports.jsx("div",{className:e.clx(ae.circle,{[ae.red]:o==="red",[ae.yellow]:o==="yellow",[ae.green]:o==="green"})},o))}),e.jsxRuntimeExports.jsx("div",{className:ae.input,children:e.jsxRuntimeExports.jsxs("div",{className:ae.main,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),e.jsxRuntimeExports.jsx("span",{className:ae.text,children:t.value==="mobile"?n(window.location.origin,35):t.value==="desktop"?n(window.location.origin,200):n(window.location.origin,100)})]})}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),s({status:"success",message:"Domain copied to clipboard"})},className:ae.copy,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy",width:20,height:20,fill:"#252525"})})]})},Fo="_content_l6a1a_1",Ho="_main_l6a1a_10",Do="_block_l6a1a_14",Oo="_active_l6a1a_20",Uo="_name_l6a1a_30",Vo="_empty_l6a1a_46",zo="_icon_l6a1a_57",qo="_title_l6a1a_70",Go="_text_l6a1a_76",Wo="_sections_l6a1a_82",Zo="_section_l6a1a_82",Xo="_addSection_l6a1a_107",Yo="_addSectionTop_l6a1a_115",pe={content:Fo,main:Ho,block:Do,active:Oo,name:Uo,empty:Vo,icon:zo,title:qo,text:Go,sections:Wo,section:Zo,addSection:Xo,addSectionTop:Yo},Ko="_sidebar_xhqpt_1",Jo="_content_xhqpt_14",Qo="_button_xhqpt_24",en="_moveButton_xhqpt_40",tn="_border_xhqpt_44",sn="_deleteButton_xhqpt_49",le={sidebar:Ko,content:Jo,button:Qo,moveButton:en,border:tn,deleteButton:sn},on=()=>{var w;const{activeBlock:t,setActiveBlock:n}=e.usePreviewStore(),{blocks:s,removeBlock:o,moveBlock:a,duplicateBlock:r,setCurrentBlock:i}=e.useLayersStore(),{currentPage:l,pages:d}=e.usePagesStore(),{setTitle:j,setDescription:p,setOnConfirm:x}=e.useConfirmationModalStore(),{setActiveBlock:c}=e.useBlocksStore(),m=(w=d==null?void 0:d[l])==null?void 0:w.path,v=m?s[m]:null,u=(v==null?void 0:v.order)||[],S=u.indexOf(t.id),_=E=>{E.stopPropagation(),S>0&&m&&(a(m,S,S-1),n({id:t.id,neededScroll:!0}),setTimeout(()=>{n({id:t.id,neededScroll:!1})},100))},f=E=>{E.stopPropagation(),S<u.length-1&&m&&(a(m,S,S+1),n({id:t.id,neededScroll:!0}),setTimeout(()=>{n({id:t.id,neededScroll:!1})},100))},h=E=>{E.stopPropagation(),m&&r(m,t.id)},C=()=>{m&&(o(m,t.id),i(null),c(null),n({id:null,neededScroll:!1}))};return e.jsxRuntimeExports.jsx("div",{className:le.sidebar,children:e.jsxRuntimeExports.jsxs("div",{className:le.content,children:[e.jsxRuntimeExports.jsx("button",{onClick:_,className:e.clx(le.button,le.moveButton),disabled:S===0,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUp"})}),e.jsxRuntimeExports.jsx("button",{onClick:f,className:e.clx(le.button,le.moveButton),disabled:S===u.length-1,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowDown"})}),e.jsxRuntimeExports.jsx("button",{onClick:h,className:e.clx(le.button,le.moveButton),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})}),e.jsxRuntimeExports.jsx("button",{className:e.clx(le.button,le.deleteButton),onClick:E=>{E.stopPropagation(),j("Remove Block"),p(`Are you sure you want to delete ${(v==null?void 0:v.data[t.id].name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),x(C)},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]})})},nn=g.memo(({scrollableRef:t})=>{const{setActiveBlock:n,activeBlock:s,zoomLevel:o}=e.usePreviewStore(),{blocks:a,sourceBlocks:r}=e.useBlocksStore(),{blocks:i,setCurrentBlock:l,currentBlock:d,setPositionBlock:j,announcement:p}=e.useLayersStore(),{settings:x}=e.useSettingsStore(),{currentPage:c,pages:m,pageContext:v}=e.usePagesStore(),{activeBlock:u,setActiveBlock:S}=e.useThemeSettingsStore(),{setError:_}=e.useErrorStore(),{setActiveBlock:f}=e.useBlocksStore(),h=g.useRef(s.id),C=g.useRef({});g.useEffect(()=>{if(s.id&&s.neededScroll&&C.current[s.id]){const b=C.current[s.id];if(b&&t.current){const R=b.offsetTop;t.current.scrollTo({top:R-30,behavior:"smooth"})}}},[s,t]);const w=e.useNavigate();g.useEffect(()=>{h.current=s.id},[s.id]);const E=b=>{if(!b||!b.name)return _({message:"Block or block.name is undefined.",failedSettings:!1,failedThemeSettings:!1,failedPageIds:m&&m[c].id?[m[c].id]:[]}),e.jsxRuntimeExports.jsx(ve,{error:"Block or block.name is undefined."});if(!a||!a[b.name])return _({message:'Block "${block.name}" does not exist in blocks.',failedSettings:!1,failedThemeSettings:!1,failedPageIds:m&&m[c].id?[m[c].id]:[]}),e.jsxRuntimeExports.jsx(ve,{error:`Block "${b.name}" does not exist in blocks.`});const R=new a[b.name];return b.value&&Object.assign(R,b.value),R.renderBlock(x,v)};return e.jsxRuntimeExports.jsxs("div",{onClick:b=>{b.stopPropagation()},className:pe.content,style:{width:"100%",height:"100%",zoom:`${o}`},ref:t,children:[p&&e.jsxRuntimeExports.jsx(bt,{}),e.jsxRuntimeExports.jsx(Oe,{}),e.jsxRuntimeExports.jsx("div",{className:pe.main,children:m&&m[c]&&i[m[c].path]&&i[m[c].path].data&&i[m[c].path].order.map(b=>e.jsxRuntimeExports.jsxs("div",{ref:R=>C.current[b]=R,onClick:R=>{R.stopPropagation(),f(null),u&&S(null),n({id:b,neededScroll:!0}),setTimeout(()=>{n({id:b,neededScroll:!1})},100),l(null),d?setTimeout(()=>{l(s.id)},100):l(s.id)},onMouseEnter:R=>{R.stopPropagation(),s.neededScroll||n({id:b,neededScroll:!1})},onMouseLeave:R=>{R.stopPropagation(),s.neededScroll||n({id:null,neededScroll:!1})},className:e.clx(pe.block),children:[(s.id===b||d===b)&&e.jsxRuntimeExports.jsx("div",{className:pe.active}),(s.id===b||d===b)&&e.jsxRuntimeExports.jsx("div",{className:pe.name,children:_e(i[m[c].path].data[b].name,r)}),(s.id===b||d===b)&&_e(i[m[c].path].data[b].name,r)!=="unknown name"&&e.jsxRuntimeExports.jsx(on,{}),(s.id===b||d===b)&&_e(i[m[c].path].data[b].name,r)!=="unknown name"&&e.jsxRuntimeExports.jsx("div",{className:pe.addSection,children:e.jsxRuntimeExports.jsx(e.Button,{onClick:R=>{R.stopPropagation(),j(b,!0),l(null),n({id:null,neededScroll:!1}),f(null),w("/admin/builder/add")},children:"Add Section"})}),(s.id===b||d===b)&&_e(i[m[c].path].data[b].name,r)!=="unknown name"&&e.jsxRuntimeExports.jsx("div",{className:e.clx(pe.addSection,pe.addSectionTop),children:e.jsxRuntimeExports.jsx(e.Button,{onClick:R=>{R.stopPropagation(),j(b,!1),l(null),n({id:null,neededScroll:!1}),f(null),w("/admin/builder/add")},children:"Add Section"})}),a&&e.jsxRuntimeExports.jsx(at,{render:E,block:i[m[c].path].data[b]})]},b))}),e.jsxRuntimeExports.jsx(De,{})]})}),rn="_results_1pahy_1",jt={results:rn};function an(t,n){return n?new n[t]().blockSettings.isAddable:!1}function ln(t,n){return t?Object.keys(t||{}).reduce((s,o)=>(an(o,n)&&s.push(o),s),[]):[]}const cn="_product_yggw5_1",un="_name_yggw5_15",St={product:cn,name:un},dn=t=>{const{blockId:n,setSearchValue:s}=t,{sourceBlocks:o,setActiveBlock:a}=e.useBlocksStore(),{hideModal:r,hoverBlockId:i,isModalVisible:l,showPreview:d,hidePreview:j,clearHideTimeout:p,startHideTimeout:x,setHoverBlockTopPosition:c}=e.useSubmodalStore();function m(S){s(""),a(S),r("keyBlock")}function v(S,_){const f=window.innerHeight,h=400,C=10;let w=_.clientY-120;w+h>f&&(w=f-h-C),w<C&&(w=C),i||r("keyBlock"),d(S,"keyBlock"),p(),c(w)}function u(){l?x("keyBlock"):j("keyBlock"),c(null)}return e.jsxRuntimeExports.jsxs("div",{className:St.product,onClick:()=>m(n),onMouseEnter:S=>v(n,S),onMouseLeave:u,children:[Re[n]?e.jsxRuntimeExports.jsx("img",{src:Re[n]}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards"}),e.jsxRuntimeExports.jsx("span",{className:St.name,children:_e(n,o)}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:20,height:20})]},n)},Et=()=>{const{blocks:t,sourceBlocks:n}=e.useBlocksStore(),[s,o]=g.useState(""),[a,r]=g.useState([]),i=g.useMemo(()=>ln(t,n),[t]),l=g.useMemo(()=>new e.Fuse(i,{keys:["name"],threshold:.4}),[i]);return g.useEffect(()=>{if(s.trim()==="")r(i);else{const d=l.search(s);r(d.map(j=>j.item))}},[s,l]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:o,value:s,style:{marginBottom:10}}),e.jsxRuntimeExports.jsx("div",{className:jt.results,children:a.length>0?a.map(d=>e.jsxRuntimeExports.jsx(dn,{blockId:d,setSearchValue:o})):e.jsxRuntimeExports.jsx("div",{className:jt.noResults,children:"No sections found"})})]})},pn="_wrapper_1k1cr_1",mn="_submodal_1k1cr_14",it={wrapper:pn,submodal:mn},xn=({children:t,positionTop:n,positionLeft:s})=>{const{keyBlock:o,startHideTimeout:a,clearHideTimeout:r,setMouseOverModal:i}=e.useSubmodalStore();return o?e.jsxRuntimeExports.jsx("div",{className:it.wrapper,style:n?{top:n,left:s||void 0}:{},onMouseEnter:()=>{r(),i(!0)},onMouseLeave:()=>{i(!1),a()},children:t}):null},hn=({children:t})=>{const{hoverBlockId:n,startHideTimeout:s,clearHideTimeout:o,setMouseOverModal:a}=e.useSubmodalStore();return n?e.jsxRuntimeExports.jsx("div",{className:e.clx(it.wrapper,it.submodal),onMouseEnter:()=>{o(),a(!0)},onMouseLeave:()=>{a(!1),s()},children:t}):null},gn="_applyButton_1a9kh_2",jn="_content_1a9kh_7",Sn="_title_1a9kh_14",fn="_label_1a9kh_21",_n="_colorValue_1a9kh_40",vn="_colorMap_1a9kh_48",wn="_indicator_1a9kh_57",bn="_hueSlider_1a9kh_66",Cn="_slider_1a9kh_97",kn="_buttons_1a9kh_102",En="_name_1a9kh_109",Rn="_secondary_1a9kh_114",yn="_input_1a9kh_122",Tn="_modal_1a9kh_160",Ln="_alphaSlider_1a9kh_249",Bn="_alphaBackground_1a9kh_257",Nn="_alphaGradient_1a9kh_268",Pn="_chargeTypes_1a9kh_297",An="_charge_1a9kh_297",In="_chargeActive_1a9kh_326",$n="_gradient_1a9kh_334",Mn="_color_1a9kh_40",Fn="_colorActive_1a9kh_355",Hn="_gradientWrapper_1a9kh_362",Dn="_subtitle_1a9kh_368",On="_colorTypes_1a9kh_375",Un="_colorType_1a9kh_375",Vn="_colorTypeActive_1a9kh_399",zn="_colorsWrapper_1a9kh_404",qn="_colors_1a9kh_404",T={applyButton:gn,content:jn,title:Sn,label:fn,colorValue:_n,colorMap:vn,indicator:wn,hueSlider:bn,slider:Cn,buttons:kn,name:En,secondary:Rn,input:yn,modal:Tn,alphaSlider:Ln,alphaBackground:Bn,alphaGradient:Nn,chargeTypes:Pn,charge:An,chargeActive:In,gradient:$n,color:Mn,colorActive:Fn,gradientWrapper:Hn,subtitle:Dn,colorTypes:On,colorType:Un,colorTypeActive:Vn,colorsWrapper:zn,colors:qn},Gn=()=>{const{modalPosition:t,color:n,initialColor:s,setShowModal:o,hue:a,saturation:r,brightness:i,alpha:l,dragging:d,setDragging:j,setHue:p,setSaturation:x,setBrightness:c,setAlpha:m,colorChange:v,setColor:u,update:S,isGradient:_,setIsGradient:f,gradientDirection:h,setGradientDirection:C,hue2:w,saturation2:E,brightness2:b,alpha2:R,setHue2:M,setSaturation2:U,setBrightness2:q,setAlpha2:F,activeColorIndex:P,setActiveColorIndex:V,isGradientActive:G}=e.useColorPickerStore(),A=(B,y,D)=>{y/=100,D/=100;const L=Z=>(Z+B/60)%6,I=Z=>D*(1-y*Math.max(0,Math.min(L(Z),4-L(Z),1))),N=Math.round(255*I(5)),H=Math.round(255*I(3)),O=Math.round(255*I(1));return{r:N,g:H,b:O}},ie=B=>B.toString(16).padStart(2,"0"),Y=(B,y,D,L)=>{const{r:I,g:N,b:H}=A(B,y,D),O=Math.round(L/100*255);return`#${ie(I)}${ie(N)}${ie(H)}${ie(O)}`},$=(B,y,D,L)=>{if(_)if(P===1){p(B),x(y),c(D),m(L);const I=Y(B,y,D,L),N=Y(w,E,b,R),O=`linear-gradient(${h==="vertical"?"0deg":"90deg"}, ${I} 0%, ${N} 100%)`;v(O),u(O)}else{M(B),U(y),q(D),F(L);const I=Y(B,y,D,L),N=Y(a,r,i,l),O=`linear-gradient(${h==="vertical"?"0deg":"90deg"}, ${N} 0%, ${I} 100%)`;v(O),u(O)}else{const I=Y(B,y,D,L);v(I),u(I)}},z=(B,y,D)=>{const{width:L,height:I}=D.getBoundingClientRect(),N=Math.max(0,Math.min(B/L*100,100)),H=Math.max(0,Math.min(100-y/I*100,100));_?P===1?(x(N),c(H),$(a,N,H,l)):(U(N),q(H),$(w,N,H,R)):(x(N),c(H),$(a,N,H,l))},K=B=>{const{offsetX:y,offsetY:D}=B.nativeEvent;j(!0),z(y,D,B.currentTarget)},ce=B=>{if(d){const y=document.querySelector(`.${T.colorMap}`),{left:D,top:L}=y.getBoundingClientRect(),I=B.clientX-D,N=B.clientY-L;z(I,N,y)}},Le=()=>{j(!1)};g.useEffect(()=>{function B(L){const I=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,N=L.match(I);if(N){const H=N[1],O=N[2],Z=N[3];return{angle:H,col1:O,col2:Z}}return null}function y(L){const I=parseInt(L.slice(1,3),16),N=parseInt(L.slice(3,5),16),H=parseInt(L.slice(5,7),16),O=parseInt(L.slice(7,9),16)/255*100,{h:Z,s:je,b:ze}=D(I,N,H);return{h:Z,s:je,b:ze,a:O}}function D(L,I,N){L/=255,I/=255,N/=255;const H=Math.max(L,I,N),O=Math.min(L,I,N);let Z=0;const je=H-O,ze=(H===0?0:je/H)*100,Lt=H*100;if(H===O)Z=0;else switch(H){case L:Z=((I-N)/je+(I<N?6:0))*60;break;case I:Z=((N-L)/je+2)*60;break;case N:Z=((L-I)/je+4)*60;break}return{h:Z,s:ze,b:Lt}}if(s&&s.startsWith("linear-gradient")){const L=B(s);if(L){const{angle:I,col1:N,col2:H}=L,O=y(N),Z=y(H);f(!0),C(I==="0deg"?"vertical":"horizontal"),p(O.h),x(O.s),c(O.b),m(O.a),M(Z.h),U(Z.s),q(Z.b),F(Z.a),V(1)}}else if(s){const I=function(H){let O=H;return O.length===7&&(O=O+"ff"),O}(s),N=y(I);f(!1),p(N.h),x(N.s),c(N.b),m(N.a)}},[s,f,C,p,x,c,m,M,U,q,F,V]),g.useEffect(()=>{let B,y,D,L;_?P===1?(B=a,y=r,D=i,L=l):(B=w,y=E,D=b,L=R):(B=a,y=r,D=i,L=l),$(B,y,D,L)},[_,h,P,a,r,i,l,w,E,b,R]),g.useEffect(()=>{const B=D=>ce(D),y=()=>Le();return d?(document.addEventListener("mousemove",B),document.addEventListener("mouseup",y)):(document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",y)),()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",y)}},[d,_,h]);function Ve(){if(!_)S(n);else{const B=Y(a,r,i,l),y=Y(w,E,b,R),L=`linear-gradient(${h==="vertical"?"0deg":"90deg"}, ${B} 0%, ${y} 100%)`;S(L)}o(!1)}function W(){o(!1),v(s)}const ge=_?P===1?a:w:a,lt=_?P===1?r:E:r,ct=_?P===1?i:b:i,yt=_?P===1?l:R:l,{r:ut,g:dt,b:pt}=A(ge,lt,ct),Tt=`linear-gradient(to right, rgba(${ut}, ${dt}, ${pt}, 0), rgba(${ut}, ${dt}, ${pt}, 1))`,mt=Y(a,r,i,l),xt=Y(w,E,b,R);return e.jsxRuntimeExports.jsxs("div",{className:T.modal,onClick:B=>B.stopPropagation(),style:{top:`${t.top}px`,left:`${t.left}px`},children:[e.jsxRuntimeExports.jsx("h2",{className:T.title,children:"Color"}),G&&e.jsxRuntimeExports.jsxs("div",{className:T.colorTypes,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(T.colorType,{[T.colorTypeActive]:!_}),onClick:()=>f(!1),children:[e.jsxRuntimeExports.jsx("div",{style:{background:"#757575",width:"16px",height:"16px",borderRadius:"50%"}}),"Solid"]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(T.colorType,{[T.colorTypeActive]:_}),onClick:()=>f(!0),children:[e.jsxRuntimeExports.jsx("div",{style:{background:"linear-gradient(to bottom, #757575 0%, #DBDBDB 100%)",width:"16px",height:"16px",borderRadius:"50%"}}),"Linear"]})]}),_&&G&&e.jsxRuntimeExports.jsxs("div",{className:T.colorsWrapper,children:[e.jsxRuntimeExports.jsx("div",{className:T.colors,style:{background:`linear-gradient(90deg, ${mt} 0%, ${xt} 100%)`}}),e.jsxRuntimeExports.jsx("div",{className:e.clx(T.color,{[T.colorActive]:P===1}),onClick:()=>V(1),style:{background:mt}}),e.jsxRuntimeExports.jsx("div",{className:e.clx(T.color,{[T.colorActive]:P===2}),onClick:()=>V(2),style:{background:xt}})]}),e.jsxRuntimeExports.jsx("div",{className:T.colorMap,onMouseDown:K,style:{background:`
|
|
89
89
|
linear-gradient(to top, black, transparent),
|
|
90
90
|
linear-gradient(to right, hsl(${ge}, 100%, 100%), hsl(${ge}, 100%, 50%))
|
|
91
|
-
`},children:e.jsxRuntimeExports.jsx("div",{className:T.indicator,style:{position:"absolute",left:`${lt}%`,top:`${100-ct}%`,transform:"translate(-50%, -50%)"}})}),e.jsxRuntimeExports.jsx("div",{className:T.hueSlider,style:{bottom:_?"175px":"100px"},children:e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:ge,onChange:B=>{const y=Number(B.target.value);_?P===1?$(y,r,i,l):$(y,E,b,R):(p(y),$(y,r,i,l))},className:T.slider})}),e.jsxRuntimeExports.jsxs("div",{className:T.alphaSlider,style:{bottom:_?"150px":"75px"},children:[e.jsxRuntimeExports.jsx("div",{className:T.alphaBackground}),e.jsxRuntimeExports.jsx("div",{className:T.alphaGradient,style:{background:Tt}}),e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"100",value:yt,onChange:B=>{const y=Number(B.target.value);_?P===1?$(a,r,i,y):$(w,E,b,y):(m(y),$(a,r,i,y))},className:T.slider})]}),_&&G&&e.jsxRuntimeExports.jsxs("div",{className:T.gradientWrapper,children:[e.jsxRuntimeExports.jsx("h3",{className:T.subtitle,children:"Rotation"}),e.jsxRuntimeExports.jsx("div",{className:T.gradient,children:e.jsxRuntimeExports.jsxs("div",{className:T.chargeTypes,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(T.charge,{[T.chargeActive]:h==="horizontal"}),onClick:()=>C("horizontal"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsHorizontal",width:20,height:20}),"Horizontal"]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(T.charge,{[T.chargeActive]:h==="vertical"}),onClick:()=>C("vertical"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsVertical",width:20,height:20}),"Vertical"]})]})})]}),e.jsxRuntimeExports.jsxs("div",{className:T.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:W,className:e.clx(T.applyButton,T.cancelButton),type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:Ve,className:T.applyButton,children:"Apply"})]})]})},Wn=()=>{const{onPreview:t,zoomLevel:n}=e.usePreviewStore(),{keyBlock:s,hoverBlockId:o,isModalVisible:a,hoverBlockTopPosition:r}=e.useSubmodalStore(),{settings:i}=e.useSettingsStore(),{sourceBlocks:l}=e.useBlocksStore(),{pageContext:d}=e.usePagesStore(),{showModal:j}=e.useColorPickerStore(),{currentDevice:p}=e.useDeviceStore(),{isLoadingThemeSettings:x}=e.useThemeSettingsStore(),{isLoadingLayers:c}=e.useLayersStore(),m=h=>h?!l||!l[h]?e.jsxRuntimeExports.jsx(ve,{error:`Block "${h}" does not exist in blocks.`}):new l[h]().renderPreview(i,d):e.jsxRuntimeExports.jsx(ve,{error:"Block or block.name is undefined."});function v(){if(p.value==="desktop")return n>=1?"100%":`${(n*100).toFixed(2)}%`;{const h=p.value==="tablet"?768:425;return n>=1?`${h}px`:`${(h*n).toFixed(2)}px`}}function u(){switch(p.value){case"desktop":return"100%";case"tablet":return 768;case"mobile":return 425;default:return"100%"}}const{isOpenSelectModal:S}=e.usePagesStore(),_=g.useRef(null),f=h=>{_.current&&(_.current.scrollTop+=h.deltaY)};return e.jsxRuntimeExports.jsxs("div",{className:ke.preview,style:{zIndex:j&&!S?5e3:500},onWheel:h=>{h.stopPropagation(),f(h)},children:[a&&e.jsxRuntimeExports.jsx(hn,{children:e.jsxRuntimeExports.jsx(Et,{})}),e.jsxRuntimeExports.jsxs(xn,{positionTop:r,positionLeft:!o&&s?void 0:250,children:[!x&&!c&&e.jsxRuntimeExports.jsx(at,{render:m,block:s},s),(x||!s||c)&&e.jsxRuntimeExports.jsx("div",{className:ke.previewLoading,children:e.jsxRuntimeExports.jsx(e.Loader,{})})]}),j&&e.jsxRuntimeExports.jsx(Gn,{}),t&&e.jsxRuntimeExports.jsxs("div",{className:ke.main,style:{width:u()},children:[e.jsxRuntimeExports.jsx(Mo,{}),e.jsxRuntimeExports.jsx("div",{style:{borderLeft:v()==="100%"?"none":"var(--default-border)",borderRight:v()==="100%"?"none":"var(--default-border)",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 160px)",overflowY:"scroll",overflowX:"hidden"},onScroll:h=>{h.stopPropagation()},onWheel:h=>{h.stopPropagation()},children:!x&&!c?e.jsxRuntimeExports.jsx("div",{className:ke.content,style:{width:v()},children:e.jsxRuntimeExports.jsx(nn,{scrollableRef:_})}):e.jsxRuntimeExports.jsx("div",{className:ke.loading,children:e.jsxRuntimeExports.jsx(e.Loader,{})})})]})]})},Zn="_sidebar_1xtkj_1",Xn="_title_1xtkj_11",Yn="_active_1xtkj_19",ft={sidebar:Zn,title:Xn,active:Yn},Kn="_layers_1jhzw_1",Jn="_wrapper_1jhzw_9",Qn="_draggingWrapper_1jhzw_17",er="_block_1jhzw_21",tr="_dragging_1jhzw_17",sr="_active_1jhzw_56",or="_add_1jhzw_63",nr="_addTop_1jhzw_79",rr="_visible_1jhzw_95",ir="_button_1jhzw_99",ar="_empty_1jhzw_114",lr="_title_1jhzw_126",cr="_icon_1jhzw_133",ur="_blockIcon_1jhzw_137",dr="_text_1jhzw_147",pr="_highlight_1jhzw_153",mr="_nameBlock_1jhzw_158",xr="_loader_1jhzw_162",hr="_actions_1jhzw_171",gr="_deleteButton_1jhzw_179",X={layers:Kn,wrapper:Jn,draggingWrapper:Qn,block:er,dragging:tr,active:sr,add:or,addTop:nr,visible:rr,button:ir,empty:ar,title:lr,icon:cr,blockIcon:ur,text:dr,highlight:pr,nameBlock:mr,loader:xr,actions:hr,deleteButton:gr},jr="_block_sj4cc_1",Sr="_title_sj4cc_17",fr="_actions_sj4cc_21",_r="_deleteButton_sj4cc_28",me={block:jr,title:Sr,actions:fr,deleteButton:_r},Ye={header:"Header",footer:"Footer",announcement:"Announcement"},Ke=({id:t})=>{const{setCurrentBlock:n}=e.useLayersStore(),{activeBlock:s}=e.usePreviewStore(),[o,a]=g.useState(!1);function r(i){n(i)}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(me.block,{[me.active]:s.id===t,[me.header]:t==="header",[me.footer]:t==="footer",[me.announcement]:t==="announcement"}),onClick:()=>r(t),onMouseOver:()=>a(!0),onMouseLeave:()=>a(!1),children:[Re[Ye[t]]?e.jsxRuntimeExports.jsx("img",{src:Re[Ye[t]],width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:me.title,children:Ye[t]}),e.jsxRuntimeExports.jsx("div",{className:me.actions,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"PushPin",hoverable:!0,width:20,height:20,fill:"#757575"})})]})},vr=({id:t,name:n,onClick:s,isDragging:o,icon:a})=>{const{activeBlock:r,setActiveBlock:i}=e.usePreviewStore(),{showPreview:l,hidePreview:d,showModal:j,hideModal:p,clearHideTimeout:x,startHideTimeout:c,hoverBlockId:m,isModalVisible:v}=e.useSubmodalStore(),{setPositionBlock:u}=e.useLayersStore(),[S,_]=g.useState(!1),[f,h]=g.useState(!1),[C,w]=g.useState(!1),[E,b]=g.useState(!1),[R,M]=g.useState(null),{attributes:U,listeners:q,setNodeRef:F,transform:P,transition:V}=e.useSortable({id:t}),G={transform:e.CSS.Transform.toString(P),transition:V},{setTitle:A,setDescription:ie,setOnConfirm:Y}=e.useConfirmationModalStore(),{pages:$,currentPage:z}=e.usePagesStore(),{removeBlock:K}=e.useLayersStore(),ce=W=>{W.stopPropagation(),i({id:t,neededScroll:!0}),v&&p(),l(t),x()},Le=(W,ge=!0)=>{W.stopPropagation(),d(),j(t),x(),u(t,ge)},Ve=W=>{W.stopPropagation(),i({id:null,neededScroll:!1}),v?c():d()};return g.useEffect(()=>{w(!1),_(!1),h(!1),b(!1)},[o]),g.useEffect(()=>{v||(h(!1),_(!1))},[v]),e.jsxRuntimeExports.jsxs("div",{ref:F,style:G,className:e.clx(X.wrapper,{[X.draggingWrapper]:o&&r.id===t}),onClick:W=>{W.stopPropagation(),s(t)},onMouseEnter:ce,onMouseLeave:Ve,...U,...q,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(X.block,{[X.dragging]:o&&r.id===t,[X.active]:!o&&r.id===t}),children:[a?e.jsxRuntimeExports.jsx("img",{src:a,width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:X.nameBlock,children:n}),m===t&&!o&&e.jsxRuntimeExports.jsx("div",{className:e.clx(X.addTop,{[X.visible]:f}),onMouseEnter:()=>{h(!0)},onMouseLeave:()=>{h(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:X.button,onClick:W=>Le(W,!1),onMouseEnter:()=>{const W=setTimeout(()=>{o||b(!0)},200);M(W)},onMouseLeave:()=>{R&&clearTimeout(R),b(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),E&&e.jsxRuntimeExports.jsx(we,{text:"Click to add a section"})]})}),m===t&&!o&&e.jsxRuntimeExports.jsx("div",{className:e.clx(X.add,{[X.visible]:S}),onMouseEnter:()=>{_(!0)},onMouseLeave:()=>{_(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:X.button,onClick:W=>Le(W),onMouseEnter:()=>{const W=setTimeout(()=>{o||w(!0)},200);M(W)},onMouseLeave:()=>{R&&clearTimeout(R),w(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),C&&e.jsxRuntimeExports.jsx(we,{text:"Click to add a section"})]})})]}),m===t&&!o&&e.jsxRuntimeExports.jsxs("div",{className:X.actions,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20}),e.jsxRuntimeExports.jsx("div",{className:X.deleteButton,onClick:W=>{W.stopPropagation(),A("Remove Block"),ie(`Are you sure you want to delete ${n||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),Y(()=>{$&&K($[z].path,t)})},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",hoverable:!0,width:20,height:20})})]})]})},wr=()=>{const{blocks:t,setCurrentBlock:n,moveBlock:s,isLoadingLayers:o,announcement:a}=e.useLayersStore(),{currentPage:r,pages:i}=e.usePagesStore(),{setMouseOverModal:l,setHoverBlockId:d}=e.useSubmodalStore(),{sourceBlocks:j}=e.useBlocksStore();function p(S){n(S),l(!1),d(null)}const x=e.useSensors(e.useSensor(e.PointerSensor,{activationConstraint:{distance:5}})),[c,m]=g.useState(!1),v=()=>{m(!0)},u=S=>{m(!1);const{active:_,over:f}=S;if(f&&_.id!==f.id&&i&&i[r]){const h=i[r].path,C=t[h].order,w=C.indexOf(_.id),E=C.indexOf(f.id);w!==-1&&E!==-1&&s(h,w,E)}};return e.jsxRuntimeExports.jsx("div",{className:X.layers,children:o?e.jsxRuntimeExports.jsx("div",{className:X.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[a&&e.jsxRuntimeExports.jsx(Ke,{id:"announcement"}),e.jsxRuntimeExports.jsx(Ke,{id:"header"}),e.jsxRuntimeExports.jsx(e.DndContext,{sensors:x,onDragEnd:u,onDragStart:v,children:i&&i[r]&&t[i[r].path]&&e.jsxRuntimeExports.jsx(e.SortableContext,{items:t[i[r].path].order,strategy:e.verticalListSortingStrategy,children:t[i[r].path].order.map((S,_)=>e.jsxRuntimeExports.jsx(vr,{id:S,name:_e(t[i[r].path].data[S].name,j),index:_,onClick:p,isDragging:c,icon:Re[t[i[r].path].data[S].name]},S))})}),e.jsxRuntimeExports.jsx(Ke,{id:"footer"})]})})},br=({isHeader:t})=>{const{header:n,footer:s}=e.useLayersStore(),{pageContext:o}=e.usePagesStore(),{footer:a,header:r}=e.useBlocksStore();if(!a||!r||!s||!n)return null;if(t){const i=new r;return Object.keys(n).map(l=>{i[l]=n[l]}),i.renderSettings(o)}else{const i=new a;return Object.keys(s).map(l=>{i[l]=s[l]}),i.renderSettings(o)}},Cr=()=>{const{announcement:t}=e.useLayersStore(),{pageContext:n}=e.usePagesStore(),{announcement:s}=e.useBlocksStore();if(!s||!t)return null;const o=new s;return Object.keys(t).map(a=>{o[a]=t[a]}),o.renderSettings(n)},kr="_loader_eyvkk_1",Er={loader:kr},Rr=()=>{const{isLoadingSettings:t}=e.useSettingsStore();return t?e.jsxRuntimeExports.jsx("div",{className:Er.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsx(yr,{})},yr=()=>{const{settings:t}=e.useSettingsStore(),{setError:n}=e.useErrorStore();try{return t==null?void 0:t.renderSettings()}catch(s){throw console.error("Error rendering settings:",s),n({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),s}},Tr="_theme_a1one_1",Lr="_block_a1one_8",Br="_name_a1one_23",Nr="_loader_a1one_27",Ae={theme:Tr,block:Lr,name:Br,loader:Nr},Pr=()=>{const t=e.useNavigate(),{isLoadingThemeSettings:n,setActiveBlock:s}=e.useThemeSettingsStore();function o(a){switch(a==null?void 0:a.name){case"Colors":t("/admin/builder/theme/colors"),s(ne[0]);break;case"Fonts":t("/admin/builder/theme/fonts"),s(ne[1]);break;case"Borders":t("/admin/builder/theme/borders"),s(ne[2]);break;case"Buttons":t("/admin/builder/theme/buttons"),s(ne[3]);break;case"Inputs":t("/admin/builder/theme/inputs"),s(ne[4]);break}}return e.jsxRuntimeExports.jsx("div",{className:Ae.theme,children:n?e.jsxRuntimeExports.jsx("div",{className:Ae.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):ne.map(a=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>o(a),className:e.clx(Ae.block),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:a.icon}),e.jsxRuntimeExports.jsx("span",{className:Ae.name,children:a.name}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight"})]},a.icon))})},Ar="_back_7e826_1",Ir="_render_7e826_9",$r="_open_7e826_24",Mr="_close_7e826_51",Fr="_clicked_7e826_55",Hr="_title_7e826_59",Dr="_button_7e826_67",Or="_loading_7e826_72",Ur="_settings_7e826_76",Vr="_deleteButton_7e826_82",zr="_backIcon_7e826_95",fe={back:Ar,render:Ir,open:$r,close:Mr,clicked:Fr,title:Hr,button:Dr,loading:Or,settings:Ur,deleteButton:Vr,backIcon:zr},qr=({block:t})=>{const{pageContext:n}=e.usePagesStore(),{setError:s}=e.useErrorStore();try{return t.renderSettings(n)}catch(o){throw console.error("Error rendering settings:",o),s({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),o}},Gr="_wrapper_15ju8_1",Wr="_header_15ju8_8",Zr="_title_15ju8_15",Xr="_colorWrapper_15ju8_21",Yr="_name_15ju8_35",Kr="_color_15ju8_21",Jr="_value_15ju8_47",Qr="_length_15ju8_51",Q={wrapper:Gr,header:Wr,title:Zr,colorWrapper:Xr,name:Yr,color:Kr,value:Jr,length:Qr},Je=t=>{const{colors:n}=t,{themeSettings:s}=e.useThemeSettingsStore(),[o,a]=g.useState(!0);g.useEffect(()=>{n.length<=3&&a(!0)},[]);function r(i){const l=i.replace("--",""),[d,j]=l.split("-"),p=`${j.charAt(0).toUpperCase()+j.slice(1)} ${d.charAt(0).toUpperCase()+d.slice(1)}`,[x,c]=l.split("-");return{name:p,field:x,variable:c}}return e.jsxRuntimeExports.jsxs("div",{className:Q.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:Q.header,children:[e.jsxRuntimeExports.jsx("div",{className:Q.title,children:"Section Colors"}),!o&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(Q.value,Q.length),onClick:()=>a(!0),children:["+",n.length]})]}),o&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:Q.colors,children:n.map(i=>{const l=r(i),{variable:d,name:j,field:p}=l;return e.jsxRuntimeExports.jsx(ei,{color:s.colors[p][d],name:j})})}),n.length>3&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(Q.value,Q.length),onClick:()=>a(!1),children:["Hide ",n.length," colors"]})]})]})},ei=t=>{const{name:n,color:s}=t,{setActiveLabel:o,setModalPosition:a,setInitialColor:r,setShowModal:i,setUpdate:l,setColor:d,setColorChange:j,colorChange:p,setIsGradientActive:x}=e.useColorPickerStore(),{updateColor:c}=e.useThemeSettingsStore(),m=(S,_)=>f=>{c(S,_,f)};g.useEffect(()=>{const S=()=>{i(!1),o(null),r(s),l(()=>{}),d(s),j(()=>{})};return document.body.addEventListener("click",S),()=>{document.body.removeEventListener("click",S)}},[]);const v=S=>{const _=n.split("/")[0],f=_.split(" ")[0].toLowerCase(),h=_.split(" ")[1].toLowerCase();S.stopPropagation(),i(!0),j(p),l(E=>m(h,f)(E)),r(s),d(s),x(h==="surface");const{top:C,left:w}=Ct(S,550,288,10,20,230,80);a({top:h==="surface"?C:C+125,left:w-200})};function u(S){return S.length>15?S.slice(0,15)+"...":S}return e.jsxRuntimeExports.jsxs("div",{className:Q.colorWrapper,onClick:v,children:[e.jsxRuntimeExports.jsx("div",{className:Q.color,style:{background:s}}),e.jsxRuntimeExports.jsx("div",{className:Q.name,children:n}),e.jsxRuntimeExports.jsx("div",{className:Q.value,children:u(s)})]})},ti="_back_1sznl_1",si="_title_1sznl_9",oi="_deleteButton_1sznl_17",ni="_backIcon_1sznl_30",Ie={back:ti,title:si,deleteButton:oi,backIcon:ni},ri=({onClick:t,setIsClicked:n,getDisplayName:s})=>{var c,m;const{activeBlock:o}=e.useBlocksStore(),{setTitle:a,setDescription:r,setOnConfirm:i}=e.useConfirmationModalStore(),{blocks:l,currentBlock:d,removeBlock:j}=e.useLayersStore(),{currentPage:p,pages:x}=e.usePagesStore();return e.jsxRuntimeExports.jsxs("div",{className:Ie.back,children:[e.jsxRuntimeExports.jsx("div",{className:Ie.backIcon,onClick:()=>t(),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("h3",{className:Ie.title,children:o&&s(o)||x&&x[p]&&l[x[p].path]&&d&&s((c=l[x[p].path].data[d])==null?void 0:c.name)||d&&re(d)||"Loading"}),d&&x&&!["header","footer","announcement"].includes(d)&&l[x[p].path].data[d]&&s((m=l[x[p].path].data[d])==null?void 0:m.name)!=="unknown name"&&e.jsxRuntimeExports.jsx("button",{onClick:v=>{var u;v.stopPropagation(),a("Remove Block"),r(`Are you sure you want to delete ${s((u=l[x[p].path].data[d])==null?void 0:u.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),i(()=>{n(!0),j(x[p].path,d),t(!0)})},className:Ie.deleteButton,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A"})})]})},ii=()=>{const t=e.useNavigate(),[n,s]=g.useState(!1),{sourceBlocks:o,activeBlock:a,setActiveBlock:r,currentInstance:i,setCurrentInstance:l}=e.useBlocksStore(),{setActiveBlock:d}=e.usePreviewStore(),{blocks:j,addBlock:p,editBlock:x,currentBlock:c,setCurrentBlock:m,setHeader:v,setFooter:u,setAnnouncement:S,header:_,footer:f,announcement:h,isLoadingLayers:C}=e.useLayersStore(),{currentPage:w,pages:E}=e.usePagesStore(),{past:b,future:R}=e.useHistoryStore();function M(F=!1){if(E&&i&&!F){const P={blockSettings:{}};Object.keys(i.blockSettings).filter(V=>!["displayName","isAddable"].includes(V)).map(V=>{P.blockSettings[V]=i.blockSettings[V]}),x(E[w].path,c,{name:j[E[w].path].data[c].name,value:P})}r(null),m(null),d({id:null,neededScroll:!1}),setTimeout(()=>{s(!1)},150),l(null)}function U(){var V;if(!E||!E[w]||!c)return null;const F=j[E[w].path].data[c];return!F||!o[F.name]?null:new o[F.name]((V=F.value)==null?void 0:V.blockSettings)}g.useEffect(()=>{if(a||c&&!["header","footer","announcement"].includes(c)){const F=U();l(F)}else l(null)},[a,c,b,R]),g.useEffect(()=>{if(a&&E&&!c){const F={blockSettings:{},blockColors:{}},P=new o[a];l(P),Object.keys(P.blockSettings).filter(G=>!["displayName","isAddable"].includes(G)).map(G=>{F.blockSettings[G]=P.blockSettings[G]}),Object.keys(P.blockColors).filter(G=>!["displayName","isAddable"].includes(G)).map(G=>{F.blockColors[G]=P.blockColors[G]});const V=p(E[w].path,{name:a,value:F});d({id:V,neededScroll:!0}),m(V),t("/admin/builder")}},[a,b,R]),g.useEffect(()=>{c==="header"&&v(_)},[c,_]),g.useEffect(()=>{c==="footer"&&u(f)},[c,f]),g.useEffect(()=>{c==="announcement"&&S(h)},[c,h]);function q(F){if(!o)return"unknown name";if(!o[F])return c==="header"?_==null?void 0:_.blockSettings.displayName:c==="footer"?f==null?void 0:f.blockSettings.displayName:c==="announcement"?h==null?void 0:h.blockSettings.displayName:"unknown name";const P=new o[F];return!P.blockSettings||!P.blockSettings.displayName?"unknown name":P.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(fe.render,{[fe.open]:c,[fe.close]:!c,[fe.clicked]:n}),onClick:F=>F.stopPropagation(),style:{opacity:C?0:1},children:[e.jsxRuntimeExports.jsx(ri,{onClick:M,setIsClicked:s,getDisplayName:q}),e.jsxRuntimeExports.jsxs("div",{className:fe.settings,children:[i&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(qr,{block:i}),e.jsxRuntimeExports.jsx(Je,{colors:i.blockColors})]}),c&&["header","footer"].includes(c)&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(br,{isHeader:c==="header"}),e.jsxRuntimeExports.jsx(Je,{colors:c==="header"?_.blockColors:f.blockColors})]}),c==="announcement"&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Cr,{}),e.jsxRuntimeExports.jsx(Je,{colors:h.blockColors})]}),!a&&!c&&e.jsxRuntimeExports.jsx("div",{className:fe.loading,children:"Loading"})]})]})},ai="_header_9rrfr_1",li="_title_9rrfr_9",ci="_backIcon_9rrfr_15",Qe={header:ai,title:li,backIcon:ci},ye=({onClick:t,title:n})=>e.jsxRuntimeExports.jsxs("div",{className:Qe.header,children:[e.jsxRuntimeExports.jsx("div",{className:Qe.backIcon,onClick:t,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:Qe.title,children:n})]}),ui="_options_ymds7_1",di={options:ui},pi="_wrapper_kzokw_1",mi="_open_kzokw_16",xi="_close_kzokw_20",et={wrapper:pi,open:mi,close:xi},Te=t=>{const{isOpen:n,isClose:s,children:o}=t;return e.jsxRuntimeExports.jsx("div",{className:e.clx(et.wrapper,{[et.open]:n,[et.close]:s}),children:o})},hi=()=>{var j,p;const{activeBlock:t,themeSettings:n,updateBorder:s,setActiveBlock:o}=e.useThemeSettingsStore();function a(x,c){s(c,x)}const r=e.useNavigate();function i(){o(null),r("/admin/builder/theme")}const l=g.useMemo(()=>n.borders,[n]),d=(t==null?void 0:t.name)==="Borders";return e.jsxRuntimeExports.jsxs(Te,{isOpen:d,isClose:!d,children:[e.jsxRuntimeExports.jsx(ye,{onClick:i,title:"Borders Style"}),e.jsxRuntimeExports.jsxs("div",{className:di.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Border Radius (px)",options:Object.keys(qe),value:((j=Object.entries(qe).find(([x,c])=>c===l.radius))==null?void 0:j[0])||"None",onChange:x=>a(qe[x],"radius")}),e.jsxRuntimeExports.jsx(e.Select,{label:"Border Thickness (px)",options:Object.keys(Ge),value:((p=Object.entries(Ge).find(([x,c])=>c===l.thickness))==null?void 0:p[0])||"None",onChange:x=>a(Ge[x],"thickness")})]})]})},gi="_options_jo38w_1",ji="_alignments_jo38w_9",Si="_blocks_jo38w_15",fi="_alignment_jo38w_9",_i="_active_jo38w_34",vi="_chargeTypes_jo38w_41",wi="_charge_jo38w_41",bi="_chargeActive_jo38w_69",Ci="_shadowsHeader_jo38w_77",ki="_sliderContainer_jo38w_83",Ei="_shadowInputs_jo38w_91",Ri="_label_jo38w_102",yi="_shadowInputsRow_jo38w_111",Ti="_shadowInputsOpen_jo38w_119",J={options:gi,alignments:ji,blocks:Si,alignment:fi,active:_i,chargeTypes:vi,charge:wi,chargeActive:bi,shadowsHeader:Ci,sliderContainer:ki,shadowInputs:Ei,label:Ri,shadowInputsRow:yi,shadowInputsOpen:Ti},he=t=>{const{initialColor:n,onChange:s,title:o,labelStyle:a="primary",isGradientActive:r=!0}=t,[i,l]=g.useState(n);g.useEffect(()=>{l(n)},[n]);const{setActiveLabel:d,setModalPosition:j,setInitialColor:p,setShowModal:x,setUpdate:c,setColor:m,setColorChange:v,setIsGradientActive:u,colorChange:S}=e.useColorPickerStore();g.useEffect(()=>{const f=()=>{x(!1),d(null),p(n),c(()=>{}),m(n),v(()=>{})};return document.body.addEventListener("click",f),()=>{document.body.removeEventListener("click",f)}},[]);const _=f=>{f.stopPropagation(),x(!0),v(l),c(s),p(n),m(i),u(r);const{top:h,left:C}=Ct(f,600,288,10,20,230,80);j({top:h,left:C})};return e.jsxRuntimeExports.jsxs("div",{className:T.content,children:[e.jsxRuntimeExports.jsx("span",{className:e.clx(T.name,{[T.secondary]:a==="secondary"}),children:o}),e.jsxRuntimeExports.jsxs("label",{className:T.label,onClick:f=>f.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:T.colorValue,style:{background:i},onClick:_}),e.jsxRuntimeExports.jsx("input",{type:"text",value:i,onChange:f=>{const h=f.target.value;s(h),m(h),l(h),S(h)},className:T.input})]})]})},Li=["left","center","right"],Bi=()=>{const{activeBlock:t,themeSettings:n,updateButton:s,setActiveBlock:o}=e.useThemeSettingsStore(),{fonts:a}=e.useFontsStore(),[r,i]=g.useState("primary");function l(u,S){s(r,S,u)}const[d,j]=g.useState(!1),p=n.buttons[r],x=e.useNavigate();function c(){o(null),x("/admin/builder/theme")}const m=(t==null?void 0:t.name)==="Buttons";function v(u,S){l({...p.boxShadow,[u]:S},"boxShadow")}return e.jsxRuntimeExports.jsxs(Te,{isOpen:m,isClose:!m,children:[e.jsxRuntimeExports.jsx(ye,{onClick:c,title:"Buttons Style"}),e.jsxRuntimeExports.jsx("div",{className:J.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(u=>e.jsxRuntimeExports.jsx("div",{className:e.clx(J.charge,{[J.chargeActive]:r===u}),onClick:()=>i(u),children:u.charAt(0).toUpperCase()+u.slice(1)},u))}),p&&e.jsxRuntimeExports.jsxs("div",{className:J.options,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(p.height),onChange:u=>l(Number(u),"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",value:String(p.size),onChange:u=>l(Number(u),"size"),options:He}),e.jsxRuntimeExports.jsx(e.Input,{label:"Border Radius (px)",value:String(p.radius),onChange:u=>l(Number(u),"radius"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:p.font,onChange:u=>l(u,"font"),options:[...a.filter(u=>u.name!==p.font).map(u=>u.name)]}),e.jsxRuntimeExports.jsx(he,{initialColor:p.background,onChange:u=>l(u,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),e.jsxRuntimeExports.jsxs("div",{className:J.sliderContainer,children:[e.jsxRuntimeExports.jsx("h4",{className:J.label,children:"Shadow"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:()=>j(!d),style:{padding:5,display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretUp",style:{rotate:d?"0deg":"-180deg",transition:"0.3s rotate ease"}})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(J.shadowInputs,{[J.shadowInputsOpen]:d}),children:[e.jsxRuntimeExports.jsxs("div",{className:J.shadowInputsRow,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Left (px)",value:String(p.boxShadow.left),onChange:u=>v("left",Number(u)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Top (px)",value:String(p.boxShadow.top),onChange:u=>v("top",Number(u)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Blur (px)",value:String(p.boxShadow.blur),onChange:u=>v("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(p.boxShadow.spread),onChange:u=>v("spread",Number(u)),type:"number"})})]}),e.jsxRuntimeExports.jsx(he,{initialColor:p.boxShadow.color,onChange:u=>v("color",u),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs("div",{className:J.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:J.label,children:"Alignment Type"}),e.jsxRuntimeExports.jsx("div",{className:J.blocks,children:Li.map(u=>e.jsxRuntimeExports.jsx("div",{className:e.clx(J.alignment,{[J.active]:p.alignment===u}),onClick:()=>{l(u,"alignment")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:u==="center"?"AlignCenterHorizontal":u==="left"?"AlignLeft":"AlignRight",fill:p.alignment===u?"#252525":"#757575"})},u))})]}),e.jsxRuntimeExports.jsx(e.Switch,{label:"Enable Hover",onChange:u=>l(u,"hover"),current:p.hover})]})]})},Ni="_category_hxy9u_1",Pi="_categoryTitle_hxy9u_19",tt={category:Ni,categoryTitle:Pi},Ai=()=>{const{themeSettings:t,setActiveColorCategory:n}=e.useThemeSettingsStore();function s(o){n(o)}return e.jsxRuntimeExports.jsx("div",{className:tt.wrapper,children:Object.keys(t.colors).map(o=>o==="icon"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",{className:tt.category,onClick:()=>s(o),children:[e.jsxRuntimeExports.jsxs("h2",{className:tt.categoryTitle,children:[o==="text"?"Text & Icon":re(o)," Colors"]}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:24,height:24})]},o))})},Ii="_wrapper_ikvjo_1",$i="_open_ikvjo_16",Mi="_close_ikvjo_20",Fi="_header_ikvjo_24",Hi="_title_ikvjo_32",Di="_options_ikvjo_38",Oi="_clicked_ikvjo_45",Ui="_backIcon_ikvjo_49",Vi="_charge_ikvjo_59",zi="_chargeActive_ikvjo_78",qi={wrapper:Ii,open:$i,close:Mi,header:Fi,title:Hi,options:Di,clicked:Oi,backIcon:Ui,charge:Vi,chargeActive:zi},Gi=()=>{const{activeBlock:t,setActiveFont:n,activeFont:s,themeSettings:o,updateFont:a}=e.useThemeSettingsStore(),{fonts:r}=e.useFontsStore(),[i,l]=g.useState(null);function d(){n(null)}function j(u,S){i&&s&&a("desktop",i,s,S,u)}const[p,x]=g.useState([]),c=g.useMemo(()=>s?o.fonts.desktop.heading[s]?(l("heading"),o.fonts.desktop.heading[s]):o.fonts.desktop.body[s]?(l("body"),o.fonts.desktop.body[s]):(l(null),null):null,[s,o]);g.useEffect(()=>{if(c){const u=r.find(S=>S.name===c.font);u&&(x(u.weights),u.weights.includes(c.boldWeight)||j("400","boldWeight"),u.weights.includes(c.weight)||j("400","weight"))}},[c,s]);const m=!!((t==null?void 0:t.name)==="Fonts"&&s),v=(t==null?void 0:t.name)!=="Fonts"||!s;return e.jsxRuntimeExports.jsxs(Te,{isOpen:m,isClose:v,children:[e.jsxRuntimeExports.jsx(ye,{onClick:d,title:"Font Style"}),s&&c&&e.jsxRuntimeExports.jsxs("div",{className:qi.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:c.font,onChange:u=>j(u,"font"),options:[...r.filter(u=>u.name!==c.font).map(u=>u.name)]}),e.jsxRuntimeExports.jsx(e.Select,{label:"Size",value:String(c.size),onChange:u=>j(u,"size"),options:He}),e.jsxRuntimeExports.jsx(e.Select,{label:"Default Weight",value:String(c.weight),onChange:u=>j(u,"weight"),options:p}),e.jsxRuntimeExports.jsx(e.Select,{label:"Bold Weight",value:String(c.boldWeight),onChange:u=>j(u,"boldWeight"),options:p})]})]})},Wi="_wrapper_mkmxa_1",Zi="_category_mkmxa_5",Xi="_categoryTitle_mkmxa_11",Yi="_font_mkmxa_17",Ki="_content_mkmxa_32",Ji="_icon_mkmxa_39",Qi="_paragraph_mkmxa_50",ea="_deleteIcon_mkmxa_54",ta="_iconButton_mkmxa_61",de={wrapper:Wi,category:Zi,categoryTitle:Xi,font:Yi,content:Ki,icon:Ji,paragraph:Qi,deleteIcon:ea,iconButton:ta},sa={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",h7:"h7",lg:"large",md:"medium",sm:"small"},oa=t=>{const{font:n,size:s,id:o,category:a}=t,{setActiveFont:r}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsxs("div",{className:de.font,onClick:()=>r(o),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(de.icon,{[de.paragraph]:a==="paragraph"}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:a==="paragraph"?"TextB":"TextH"})}),e.jsxRuntimeExports.jsxs("div",{className:de.content,children:[e.jsxRuntimeExports.jsx("h2",{className:de.categoryTitle,children:re(sa[o])}),e.jsxRuntimeExports.jsx("span",{className:de.value,children:`${n}, ${s}px`})]})]})},na=()=>{const{themeSettings:t,setActiveFont:n,activeBlock:s}=e.useThemeSettingsStore();g.useEffect(()=>(o(),()=>{o()}),[]);function o(){n(null)}if(s!=null&&s.name)return e.jsxRuntimeExports.jsx("div",{className:de.wrapper,children:Object.entries(t.fonts.desktop).sort(([a],[r])=>a==="heading"?-1:r==="heading"?1:0).map(([a,r])=>e.jsxRuntimeExports.jsxs("div",{className:de.category,children:[e.jsxRuntimeExports.jsx("h2",{className:de.categoryTitle,children:re(a)}),Object.entries(r).map(([i,l])=>e.jsxRuntimeExports.jsx(oa,{id:i,category:a,...l},i))]},a))})},ra="_wrapper_16ym0_2",ia="_category_16ym0_6",aa="_categoryTitle_16ym0_12",la="_color_16ym0_18",ca="_name_16ym0_24",ua="_content_16ym0_29",da="_label_16ym0_36",pa="_input_16ym0_48",ma="_title_16ym0_74",xa="_field_16ym0_82",ha="_alignments_16ym0_92",ga="_lineField_16ym0_98",ja="_style_16ym0_106",Sa="_header_16ym0_113",oe={wrapper:ra,category:ia,categoryTitle:aa,color:la,name:ca,content:ua,label:da,input:pa,title:ma,field:xa,alignments:ha,lineField:ga,style:ja,header:Sa},fa="_blocks_emecf_1",_a="_block_emecf_1",va="_active_emecf_21",st={blocks:fa,block:_a,active:va},_t=t=>{const{items:n,selectedItem:s,onSelect:o,getIconName:a}=t;return e.jsxRuntimeExports.jsx("div",{className:st.blocks,children:n.map(r=>e.jsxRuntimeExports.jsx("div",{className:e.clx(st.block,{[st.active]:s===r}),onClick:()=>o(r),children:e.jsxRuntimeExports.jsx(e.Icon,{name:a(r),fill:s===r?"#252525":"#757575"})},String(r)))})},wa=["left","center","right"],ba=["solid","dashed"],$e=t=>{const{title:n,children:s,rightAddon:o}=t;return e.jsxRuntimeExports.jsxs("div",{className:oe.field,children:[e.jsxRuntimeExports.jsxs("div",{className:oe.header,children:[e.jsxRuntimeExports.jsx("h4",{className:oe.categoryTitle,children:n}),o]}),s]})},Ca=()=>{const{themeSettings:t,updateInput:n}=e.useThemeSettingsStore(),s=g.useMemo(()=>t.inputs,[t]),o=(r,i,l)=>{n(r,i,l)},a=r=>i=>{n(r,i,"color")};return e.jsxRuntimeExports.jsxs("div",{className:oe.wrapper,children:[e.jsxRuntimeExports.jsxs($e,{title:"General",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(s.general.height),onChange:r=>o("general",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>o("general",r,"size"),value:String(s.general.size),options:He}),e.jsxRuntimeExports.jsx(he,{initialColor:re(s.general.color),onChange:a("general"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsx($e,{title:"Field Fill",rightAddon:e.jsxRuntimeExports.jsx("div",{className:oe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>o("field",r,"active"),current:s.field.active})}),children:e.jsxRuntimeExports.jsx(he,{initialColor:s.field.color,onChange:a("field"),title:"Color",labelStyle:"secondary"})}),e.jsxRuntimeExports.jsxs($e,{title:"Border",rightAddon:e.jsxRuntimeExports.jsx("div",{className:oe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>o("border",r,"active"),current:s.border.active})}),children:[e.jsxRuntimeExports.jsxs("div",{className:oe.lineField,children:[e.jsxRuntimeExports.jsxs("div",{className:oe.style,children:[e.jsxRuntimeExports.jsx("span",{className:oe.title,children:"Style"}),e.jsxRuntimeExports.jsx(_t,{items:ba,selectedItem:s.border.style,onSelect:r=>o("border",r,"style"),getIconName:r=>r==="solid"?"Minus":"Selection"})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Radius (px)",value:String(s.border.radius),onChange:r=>o("border",r,"radius"),type:"number",min:0})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Thickness (px)",value:String(s.border.thickness),onChange:r=>o("border",r,"thickness"),type:"number",min:0}),e.jsxRuntimeExports.jsx(he,{initialColor:re(s.border.color),onChange:a("border"),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs($e,{title:"Label",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Line Height (px)",value:String(s.label.height),onChange:r=>o("label",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>o("label",r,"size"),value:String(s.label.size),options:He}),e.jsxRuntimeExports.jsx(he,{initialColor:re(s.label.color),onChange:a("label"),title:"Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsxs("div",{className:oe.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:oe.title,children:"Alignment Type"}),e.jsxRuntimeExports.jsx(_t,{items:wa,selectedItem:s.label.alignment,onSelect:r=>o("label",r,"alignment"),getIconName:r=>r==="center"?"AlignCenterHorizontal":r==="left"?"AlignLeft":"AlignRight"})]})]})]})},ka="_wrapper_1yw63_2",Ea="_category_1yw63_7",Ra="_categoryTitle_1yw63_13",ya="_color_1yw63_24",Ta="_content_1yw63_33",La="_preview_1yw63_42",Ba="_container_1yw63_52",Na="_buttonWrapper_1yw63_62",Pa="_button_1yw63_62",Aa="_buttonBorder_1yw63_80",Ia="_buttonBackground_1yw63_83",$a="_text_1yw63_87",Ma="_textText_1yw63_93",Fa="_icon_1yw63_97",Ha="_iconIcon_1yw63_100",Da="_annotation_1yw63_104",Oa="_annotationText_1yw63_111",Ua="_label_1yw63_116",Va="_circle_1yw63_127",za="_line_1yw63_140",qa="_circle1_1yw63_154",Ga="_circle2_1yw63_159",Wa="_annotationIcon_1yw63_164",Za="_annotationBorder_1yw63_192",Xa="_line1_1yw63_203",Ya="_line2_1yw63_210",Ka="_circle3_1yw63_227",Ja="_circle4_1yw63_232",Qa="_annotationSurface_1yw63_237",k={wrapper:ka,category:Ea,categoryTitle:Ra,color:ya,content:Ta,preview:La,container:Ba,buttonWrapper:Na,button:Pa,buttonBorder:Aa,buttonBackground:Ia,text:$a,textText:Ma,icon:Fa,iconIcon:Ha,annotation:Da,annotationText:Oa,label:Ua,circle:Va,line:za,circle1:qa,circle2:Ga,annotationIcon:Wa,annotationBorder:Za,line1:Xa,line2:Ya,circle3:Ka,circle4:Ja,annotationSurface:Qa},el=()=>{const{activeColorCategory:t}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx("div",{className:k.container,children:e.jsxRuntimeExports.jsxs("div",{className:k.buttonWrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(k.button,{[k.buttonBorder]:t==="border",[k.buttonBackground]:t==="surface"}),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Smiley",className:e.clx(k.icon,{[k.iconIcon]:t==="text"}),width:22,height:22,fill:"#757575"}),e.jsxRuntimeExports.jsx("span",{className:e.clx(k.text,{[k.textText]:t==="text"}),children:"Button Example"})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(k.annotation,k.annotationText),children:[e.jsxRuntimeExports.jsx("div",{className:k.label,children:"Text Color"}),e.jsxRuntimeExports.jsx("div",{className:k.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle2)})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(k.annotation,k.annotationIcon),children:[e.jsxRuntimeExports.jsx("div",{className:k.label,children:"Icon Color"}),e.jsxRuntimeExports.jsx("div",{className:k.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle2)})]}),t==="border"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(k.annotation,k.annotationBorder),children:[e.jsxRuntimeExports.jsx("div",{className:k.label,children:"Border Color"}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.line,k.line1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.line,k.line2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle3)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle4)})]}),t==="surface"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(k.annotation,k.annotationSurface),children:[e.jsxRuntimeExports.jsx("div",{className:k.label,children:"Surface Color"}),e.jsxRuntimeExports.jsx("div",{className:k.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle2)})]})]})})},tl={text:["primary","secondary","tertiary","inverted","action","action-hover","disabled","warning","error","success","information","link"],border:["primary","secondary","action","actionHover","disabled","warning","error","success","information","focus"],surface:["primary","secondary","action1","action1Hover","action2","action2Hover","disabled","warning","error","success","information","modal"]},sl=()=>{const{activeBlock:t,setActiveColorCategory:n,activeColorCategory:s,themeSettings:o,updateColor:a}=e.useThemeSettingsStore();if(!s)return null;function r(){n(null)}function i(p,x,c){a(p,x,c)}const l=!!((t==null?void 0:t.name)==="Colors"&&s),d=(t==null?void 0:t.name)!=="Colors"||!s,j=tl[s]||[];return e.jsxRuntimeExports.jsxs(Te,{isOpen:l,isClose:d,children:[e.jsxRuntimeExports.jsx(ye,{onClick:r,title:s==="text"?"Text & Icon Colors":`${re(s)} Colors`}),s&&e.jsxRuntimeExports.jsxs("div",{className:k.wrapper,children:[e.jsxRuntimeExports.jsx(el,{}),j.map(p=>{const x=o.colors[s][p];return x?e.jsxRuntimeExports.jsx("div",{className:k.color,children:e.jsxRuntimeExports.jsxs("div",{className:k.content,children:[e.jsxRuntimeExports.jsx("div",{className:k.preview,style:{background:x}}),e.jsxRuntimeExports.jsx(he,{title:re(p),initialColor:x,onChange:c=>i(s,p,c),isGradientActive:s==="surface"})]})},p):null})]})]})},ol="_loader_1p5lr_1",nl={loader:ol},rl=()=>{const{activeBlock:t,themeSettings:n,isLoadingThemeSettings:s}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s?e.jsxRuntimeExports.jsx("div",{className:nl.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(na,{}),(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(Gi,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(Ai,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(sl,{}),(t==null?void 0:t.name)==="Inputs"&&n.inputs&&e.jsxRuntimeExports.jsx(Ca,{}),(t==null?void 0:t.name)==="Borders"&&n.borders&&e.jsxRuntimeExports.jsx(hi,{}),(t==null?void 0:t.name)==="Buttons"&&n.buttons&&e.jsxRuntimeExports.jsx(Bi,{})]})})},il=()=>{const{activeBlock:t,setActiveBlock:n}=e.useThemeSettingsStore(),{activeBlock:s}=e.useNavbarStore(),o=e.useNavigate();function a(){n(null),o("/admin/builder/theme")}const r=!!t,i=!t||s.name!=="Theme";return e.jsxRuntimeExports.jsxs(Te,{isOpen:r,isClose:i,children:[e.jsxRuntimeExports.jsx(ye,{onClick:a,title:(t==null?void 0:t.name)||""}),e.jsxRuntimeExports.jsx(rl,{})]})},al=()=>{const{activeBlock:t}=e.useNavbarStore(),{showTooltip:n}=e.useTooltipStore();function s(){switch(t.name){case"Layers":return"Layers";case"Add":return"Add Sections";case"Theme":return"Theme Settings";case"Settings":return"Settings"}}return e.jsxRuntimeExports.jsxs("div",{className:ft.sidebar,style:{zIndex:n?50:"auto"},children:[e.jsxRuntimeExports.jsx("h3",{className:ft.title,children:s()}),t.name==="Layers"&&e.jsxRuntimeExports.jsx(wr,{}),t.name==="Add"&&e.jsxRuntimeExports.jsx(Et,{}),e.jsxRuntimeExports.jsx(ii,{}),e.jsxRuntimeExports.jsx(il,{}),t.name==="Theme"&&e.jsxRuntimeExports.jsx(Pr,{}),t.name==="Settings"&&e.jsxRuntimeExports.jsx(Rr,{})]})},ll="_wrapper_no6if_1",cl="_header_no6if_12",ul="_content_no6if_23",dl="_buttons_no6if_44",pl="_label_no6if_51",ml="_description_no6if_52",xl="_preview_no6if_60",hl="_block_no6if_66",gl="_slug_no6if_75",jl="_title_no6if_81",Sl="_closeIcon_no6if_87",te={wrapper:ll,header:cl,content:ul,buttons:dl,label:pl,description:ml,preview:xl,block:hl,slug:gl,title:jl,closeIcon:Sl},fl="_wrapper_ba9vp_2",_l="_label_ba9vp_10",vl="_options_ba9vp_18",wl="_radioLabel_ba9vp_24",bl="_radio_ba9vp_24",Cl="_custom_ba9vp_39",kl="_option_ba9vp_18",xe={wrapper:fl,label:_l,options:vl,radioLabel:wl,radio:bl,custom:Cl,option:kl},El=t=>{const{defaultValue:n,options:s,onChange:o,label:a}=t,[r,i]=g.useState(n),l=d=>{const j=d.target.value;i(j),o(j)};return e.jsxRuntimeExports.jsxs("div",{className:xe.wrapper,children:[e.jsxRuntimeExports.jsx("span",{className:xe.label,children:a}),e.jsxRuntimeExports.jsx("div",{className:xe.options,children:s.map(d=>e.jsxRuntimeExports.jsxs("label",{className:xe.radioLabel,children:[e.jsxRuntimeExports.jsx("input",{type:"radio",value:d.value,checked:r===d.value,onChange:l,className:xe.radio}),e.jsxRuntimeExports.jsx("span",{className:xe.custom}),e.jsxRuntimeExports.jsx("span",{className:xe.option,children:d.label})]},d.value))})]})},Rl=()=>{var M,U,q,F,P,V,G;const{setIsOpenModal:t,pages:n,createPage:s,updatePage:o,isEdit:a,setIsEdit:r,editedPage:i,setEditedPage:l,pageContext:d}=e.usePagesStore(),{setIsOpen:j}=e.useModalStore(),{createPage:p,updatePage:x}=e.useLayersStore(),[c,m]=g.useState(i?n&&((M=n[i])==null?void 0:M.path):""),[v,u]=g.useState(i?n&&((U=n[i])==null?void 0:U.name):""),[S,_]=g.useState(i?n&&((q=n[i])==null?void 0:q.seo)&&((P=(F=n[i])==null?void 0:F.seo)==null?void 0:P.pageDescription)||"":`${d.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`),[f,h]=g.useState(i&&n&&(V=n[i])!=null&&V.isPrivate?"private":"public");function C(){m(""),u(""),_(""),h("public"),r(!1),l(null)}function w(){j(!1),setTimeout(()=>{C(),t(!1),j(!0)},300)}g.useEffect(()=>()=>{w()},[]);function E(A){return A[0]==="/"?A:"/"+A}function b(){s({path:E(c),name:v||c||"",icon:"File",seo:{pageTitle:v||"",pageDescription:S||""},visibility:f||"public"}),p(E(c)),w()}function R(){n&&(e.defaultPagePaths.includes(n[i].path)||kt(n[i].path),x(n[i].path||"",c||""),o(i,{path:E(c),name:v||c,icon:n[i].icon||"File",seo:{pageTitle:v||"",pageDescription:S||""},visibility:f||"public"})),w()}return e.jsxRuntimeExports.jsxs("div",{className:te.wrapper,onClick:A=>A.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:te.header,children:[e.jsxRuntimeExports.jsx("h2",{children:a?"Edit Page":"Create New Page"}),e.jsxRuntimeExports.jsx("div",{className:te.closeIcon,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:w})})]}),e.jsxRuntimeExports.jsxs("div",{className:te.content,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Page Slug",onChange:A=>m(A),value:c,placeholder:"path-to-page",disabled:!!(i&&n&&((G=n[i])!=null&&G.name)&&e.defaultPagePaths.includes(n[i].path)),required:!0,regex:"^.+$"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Page Title",onChange:A=>{u(A)},value:v.charAt(0).toUpperCase()+v.slice(1),placeholder:"Contact us"}),e.jsxRuntimeExports.jsx(e.Textarea,{label:"Description",onChange:A=>_(A),value:S,placeholder:`${d.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`,maxLength:150}),e.jsxRuntimeExports.jsx(El,{label:"Visibility",defaultValue:f,options:[{value:"public",label:"Public"},{value:"private",label:"Private"}],onChange:A=>h(A)}),e.jsxRuntimeExports.jsxs("div",{className:te.preview,children:[e.jsxRuntimeExports.jsx("span",{className:te.label,children:"Preview"}),e.jsxRuntimeExports.jsxs("div",{className:te.block,children:[e.jsxRuntimeExports.jsx("span",{className:te.slug,children:c||"yoursite.url"}),e.jsxRuntimeExports.jsx("span",{className:te.title,children:v||"My Blank Page"}),e.jsxRuntimeExports.jsx("span",{className:te.description,children:S||"It is My Description"})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:te.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:w,type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:a?R:b,disabled:c.length===0,children:a?"Update":"Create"})]})]})},yl="_layout_3kge3_1",Tl="_main_3kge3_10",Ll="_content_3kge3_18",Bl="_notification_3kge3_26",Me={layout:yl,main:Tl,content:Ll,notification:Bl},Nl="_modal_1h74q_1",Pl="_title_1h74q_14",Al="_buttons_1h74q_20",Fe={modal:Nl,title:Pl,buttons:Al},Rt=()=>{const{title:t,description:n,onConfirm:s,setTitle:o,setDescription:a,setOnConfirm:r}=e.useConfirmationModalStore(),{setIsOpen:i}=e.useModalStore();function l(){i(!1),setTimeout(()=>{o(null),a(null),r(null),i(!0)},300)}return t&&n&&s&&e.jsxRuntimeExports.jsxs("div",{className:Fe.modal,onClick:d=>d.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:Fe.title,children:t}),e.jsxRuntimeExports.jsx("div",{className:Fe.description,children:n}),e.jsxRuntimeExports.jsxs("div",{className:Fe.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:l,children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{s(),l()},type:"Secondary",children:"Confirm"})]})]})},Il=()=>{const{isOpenModal:t,setIsOpenModal:n}=e.usePagesStore(),{openModal:s,setOpenModal:o}=e.useChooseImageStore(),{notification:a,setNotification:r}=e.useNotificationStore(),{title:i,description:l,setTitle:d,setDescription:j,setOnConfirm:p}=e.useConfirmationModalStore(),[x,c]=g.useState(null);return g.useEffect(()=>{if(a){x&&clearTimeout(x);const m=setTimeout(()=>{r(null)},3e3);c(m)}},[a]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:Me.layout,children:[e.jsxRuntimeExports.jsx(So,{}),e.jsxRuntimeExports.jsxs("main",{className:Me.main,children:[e.jsxRuntimeExports.jsx(lo,{}),e.jsxRuntimeExports.jsxs("div",{className:Me.content,children:[e.jsxRuntimeExports.jsx(al,{}),e.jsxRuntimeExports.jsx(Wn,{})]})]})]}),i&&l&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{d(null),j(null),p(null)},children:e.jsxRuntimeExports.jsx(Rt,{})}),t&&e.jsxRuntimeExports.jsx(e.Modal,{close:n,children:e.jsxRuntimeExports.jsx(Rl,{})}),s&&e.jsxRuntimeExports.jsx(e.Modal,{close:o,children:e.jsxRuntimeExports.jsx(e.ChooseImageModal,{})}),a&&e.jsxRuntimeExports.jsx("div",{className:Me.notification,children:e.jsxRuntimeExports.jsx(e.Tip,{message:a.message,type:a.status})})]})},$l=t=>{const{blocks:n,settings:s,header:o,footer:a,announcement:r}=t,{setBlocks:i,setSourceBlocks:l,setHeader:d,setFooter:j,setAnnouncement:p}=e.useBlocksStore(),{fonts:x,setFonts:c}=e.useFontsStore(),{setSettings:m}=e.useSettingsStore(),{setPageContext:v}=e.usePagesStore(),{setThemeSettings:u,setIsLoadingThemeSettings:S}=e.useThemeSettingsStore(),{setIsLoadingSettings:_}=e.useSettingsStore(),{setNotification:f}=e.useNotificationStore(),{setBlocks:h,blocks:C,createPage:w,setIsLoadingLayers:E}=e.useLayersStore(),{setPages:b,setCurrentPage:R}=e.usePagesStore();return g.useEffect(()=>{S(!0),E(!0),_(!0);const M={};Object.keys(n).forEach(q=>{M[q]=n[q]}),l(M),i(M),d(o),j(a),p(r),(async()=>{let q={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null,fullPosts:null,posts:null};const F=await Jt();Object.keys(F).map($=>{const z=$;q[z]=F[z].value.data}),v(q);const{data:P}=await ts(),{themeSettings:V,layers:G,settings:A}=P||{};if(A){const $=s;if(A.settings&&(Object.keys(A.settings).map(z=>{$[z]=A.settings[z]}),m($)),A.header){const z=o;Object.keys(A.header).map(K=>{z[K]=A.header[K]}),d(z)}if(A.footer){const z=a;Object.keys(A.footer).map(K=>{z[K]=A.footer[K]}),j(z)}if(A.announcement){const z=r;Object.keys(A.announcement).map(K=>{z[K]=A.announcement[K]}),p(z)}}else m(s);V&&u(V);const ie=await es(),Y={};if(ie.status>=400&&f({message:"Error fetching pages",status:"error"}),ie.data.length>0?(ie.data.forEach($=>{C[$.path]||w($.path),Y[$.id||$.path]={...$,icon:e.pages[$.path]?e.pages[$.path].icon:"File",name:$.name?$.name:e.pages[$.path].name}}),b(Y),R(Object.keys(Y)[0])):(b(e.pages),R(Object.keys(e.pages)[0])),x.length===0){const $=await Qt();c([...$.map(z=>{const K=z.variants.map(ce=>{if(!ce.includes("italic"))return ce==="regular"?"400":ce}).filter(ce=>ce!==void 0);return{name:z.family,weights:K}})])}h(G),S(!1),E(!1),_(!1)})()},[]),e.jsxRuntimeExports.jsx(Il,{})};function Ml(){const t=new URL(window.location.href);window.history.replaceState(null,"",t.pathname+t.hash)}function Fl(){const t=new URLSearchParams(document.location.search),n=t.get("shopId")||localStorage.getItem("shopId"),s=t.get("sellerAccessToken")||localStorage.getItem("sellerAccessToken"),o=t.get("draftId")||localStorage.getItem("draftId");return Ml(),s&&localStorage.setItem("sellerAccessToken",s),n&&localStorage.setItem("shopId",n),o&&localStorage.setItem("draftId",o),!!(s&&n&&o)}const Hl=t=>{const{blocks:n,settings:s,header:o,footer:a,announcement:r}=t,[i,l]=g.useState(!0),d=e.useNavigate();return g.useEffect(()=>{l(!0),Fl()?l(!1):d("/")},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:i?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsx($l,{blocks:n,settings:s,header:o,footer:a,announcement:r})})},Dl="_wrapper_1yd2j_1",Ol="_error_1yd2j_11",Ul="_title_1yd2j_21",Vl="_buttons_1yd2j_29",Ee={wrapper:Dl,error:Ol,title:Ul,buttons:Vl},vt=async t=>{const n=localStorage.getItem("shopId")||void 0,s=localStorage.getItem("draftId"),o=`${e.API_URL}/v2/builder/shops/${n}/drafts/${s}/reset`;return await e.request({url:o,withToken:!0,method:"post",body:t})},zl=()=>{const{error:t,setError:n}=e.useErrorStore(),{pages:s}=e.usePagesStore(),{setIsOpen:o}=e.useModalStore(),{title:a,description:r,setOnConfirm:i,setTitle:l,setDescription:d}=e.useConfirmationModalStore(),{setBlocks:j}=e.useLayersStore();async function p(){await vt({resetSettings:(t==null?void 0:t.failedSettings)??!1,resetThemeSettings:(t==null?void 0:t.failedThemeSettings)??!1,resetPageIds:(t==null?void 0:t.failedPageIds)??[]}),n(null),j({}),window.location.reload()}async function x(){const c=[];s&&Object.keys(s).map(m=>s[m].id).filter(m=>m!==void 0).map(m=>c.push(m)),await vt({resetSettings:!0,resetThemeSettings:!0,resetPageIds:c}),n(null)}return e.jsxRuntimeExports.jsxs("div",{className:Ee.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:Ee.error,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:Ee.title,children:"Oops! Something went wrong"}),e.jsxRuntimeExports.jsx("span",{className:Ee.message,children:(t==null?void 0:t.message)||""})]}),e.jsxRuntimeExports.jsxs("div",{className:Ee.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:p,children:"Reset Settings"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:c=>{c.stopPropagation(),l("Reset All Settings"),d("Are you sure you want to reset all settings? This is irreversible."),i(async()=>{await x()})},children:"Reset All Settings"})]})]}),a&&r&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{o(!1),setTimeout(()=>{l(null),d(null),i(null),o(!0)},300)},children:e.jsxRuntimeExports.jsx(Rt,{})})]})},ql=t=>{const{children:n}=t,{pathname:s}=e.useLocation(),{setActiveBlock:o}=e.useNavbarStore(),{setActiveBlock:a}=e.useThemeSettingsStore(),{setActiveBlock:r}=e.usePreviewStore();return g.useEffect(()=>{switch(r({id:null,neededScroll:!1}),s){case"/admin/builder":o(e.navbarBlocks[0]);break;case"/admin/builder/add":o(e.navbarBlocks[1]);break;case"/admin/builder/theme":o(e.navbarBlocks[2]);break;case"/admin/builder/settings":o(e.navbarBlocks[3]);break;case"/admin/builder/theme/colors":o(e.navbarBlocks[2]),a(ne[0]);break;case"/admin/builder/theme/fonts":o(e.navbarBlocks[2]),a(ne[1]);break;case"/admin/builder/theme/borders":o(e.navbarBlocks[2]),a(ne[2]);break;case"/admin/builder/theme/buttons":o(e.navbarBlocks[2]),a(ne[3]);break;case"/admin/builder/theme/inputs":o(e.navbarBlocks[2]),a(ne[4]);break}},[s]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n})},Gl="_lock_1mxa7_1",Wl="_wrapper_1mxa7_12",Zl="_content_1mxa7_22",Xl="_info_1mxa7_31",Yl="_buttons_1mxa7_38",Kl="_button_1mxa7_38",Jl="_input_1mxa7_50",Ql="_error_1mxa7_57",se={lock:Gl,wrapper:Wl,content:Zl,info:Xl,buttons:Yl,button:Kl,input:Jl,error:Ql},ec=()=>{const[t,n]=g.useState(!1),[s,o]=g.useState(!1),[a,r]=g.useState(""),{general:i,setGeneral:l}=e.useGeneralStore(),d=e.useLocation(),j=e.useNavigate();g.useEffect(()=>{if(i&&(!i.info.passwordProtected||i.isPasswordValid)){const x=d.state.from==="/validation"?"/":d.state.from;j(x)}},[i]),g.useEffect(()=>{(async()=>{var v;n(!0);const c=localStorage.getItem("shopPassword")||"",m=await nt(c);if(m.isPasswordValid){const u=((v=d.state)==null?void 0:v.from)||"/";j(u)}l(m),n(!1)})()},[]);async function p(){var c;if(n(!0),!(await nt(a)).isPasswordValid)o(!0);else{localStorage.setItem("shopPassword",a);const m=((c=d.state)==null?void 0:c.from)||"/";j(m)}n(!1)}return e.jsxRuntimeExports.jsxs("div",{className:se.wrapper,children:[!t&&e.jsxRuntimeExports.jsxs("div",{className:se.content,children:[e.jsxRuntimeExports.jsx("div",{className:se.lock,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"var(--text-secondary)",width:64,height:64})}),e.jsxRuntimeExports.jsxs("div",{className:se.info,children:[e.jsxRuntimeExports.jsx("h2",{id:"h2",className:se.title,children:"The store is password protected"}),e.jsxRuntimeExports.jsx("p",{id:"p",className:se.description,children:"If you do not have a password, we recommend you to contact the technical support of the store or write to the mail"})]}),e.jsxRuntimeExports.jsxs("div",{className:se.input,children:[e.jsxRuntimeExports.jsx(e.Input$1,{type:"password",onChange:x=>{o(!1),r(x)},value:a,placeholder:"Password",required:!0}),e.jsxRuntimeExports.jsx("span",{className:se.error,children:s&&"Incorrect password"})]}),e.jsxRuntimeExports.jsxs("div",{className:se.buttons,children:[e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",className:se.button,children:"Contact Support"}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",className:se.button,disabled:s,onClick:p,children:"Submit"})]})]}),t&&e.jsxRuntimeExports.jsx(e.Loader,{})]})},tc=({children:t})=>{const n=e.useLocation();if(n.pathname.startsWith("/admin/builder"))return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t});const[s,o]=g.useState(!0),{setThemeSettings:a,themeSettings:r}=e.useThemeSettingsStore(),{settings:i,setSettings:l}=e.useSettingsStore(),{setHeader:d,setFooter:j,setAnnouncement:p,header:x,footer:c,announcement:m}=e.useLayersStore(),{general:v,setGeneral:u}=e.useGeneralStore(),{pageContext:S,setPageContext:_}=e.usePagesStore(),f=e.useNavigate();return g.useEffect(()=>{o(!0);const h=async()=>{if(!v){const w=await nt();w.isPasswordValid||f("/validation",{state:{from:n.pathname}}),u(w)}},C=async()=>{const{settings:w,theme:E}=(await ss()).data,b=n.pathname.startsWith("/validation")?null:await e.getDynamicPage(encodeURIComponent("/products"));if(b){const{data:R}=b;_({...S,listings:R.listings})}else _({...S});if(w&&i){const R=i;if(w.settings?(Object.keys(w.settings).map(M=>{R[M]=w.settings[M]}),l(R)):l(i),w.header&&x){const M=x;Object.keys(w.header).map(U=>{M[U]=w.header[U]}),d(M)}if(w.footer&&c){const M=c;Object.keys(w.footer).map(U=>{M[U]=w.footer[U]}),j(M)}if(w.announcement&&m){const M=m;Object.keys(w.announcement).map(U=>{M[U]=w.announcement[U]}),p(M)}}else l(i);a(r),a(E||r),o(!1)};n.pathname.startsWith("/validation")||h(),C()},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s?e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})}):t})},sc=()=>(g.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})})),oc="_wrapper_rccv2_1",nc="_content_rccv2_11",rc="_title_rccv2_21",ot={wrapper:oc,content:nc,title:rc},ue=()=>{const t=e.useNavigate();return e.jsxRuntimeExports.jsx("div",{className:ot.wrapper,children:e.jsxRuntimeExports.jsxs("div",{className:ot.content,children:[e.jsxRuntimeExports.jsx("h1",{className:ot.title,children:"Something went wrong"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:()=>{t("/")},children:"Go to Home"})]})})},ic=t=>{const{blocks:n,settings:s,header:o,footer:a,announcement:r}=t,[i,l]=g.useState(null),{setBlocks:d,setSourceBlocks:j,setHeader:p,setFooter:x,setAnnouncement:c}=e.useBlocksStore(),{setSettings:m}=e.useSettingsStore(),{setHeader:v,setFooter:u,setAnnouncement:S}=e.useLayersStore(),{themeSettings:_}=e.useThemeSettingsStore(),{settings:f}=e.useSettingsStore(),h=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,C=localStorage.getItem("shopPassword"),w=localStorage.getItem("shopId")||"";return g.useEffect(()=>{if(!i){const E={};Object.keys(n).map(q=>{E[q]=n[q]}),j(E),d(E),p(o),x(a),c(r),m(s);const b=new o,R=new a,M=new r;v(b),u(R),S(M);const U=e.createBrowserRouter([{element:e.jsxRuntimeExports.jsx(e.hI,{shopDomain:h,shopId:w,shopPassword:C||void 0,routes:{Checkout:"/checkout",TopUp:"/top-up",Charge:"/charges",Order:"/orders",Subscription:"/subscriptions"},children:e.jsxRuntimeExports.jsx(tc,{children:e.jsxRuntimeExports.jsx(e.Outlet,{})})}),errorElement:e.jsxRuntimeExports.jsx(sc,{}),children:[{path:"/admin/builder/*",element:e.jsxRuntimeExports.jsx(ql,{children:e.jsxRuntimeExports.jsx(Hl,{blocks:n,settings:s,header:o,footer:a,announcement:r})}),errorElement:e.jsxRuntimeExports.jsx(zl,{}),loader:()=>(document.title="Builder",!0)},{path:"/checkout",element:e.jsxRuntimeExports.jsx(e.gI,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:e.jsxRuntimeExports.jsx(e.CI,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:e.jsxRuntimeExports.jsx(e._I,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(e.yI,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(e.xI,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Subscriptions",!0)},{path:"/customer-dash",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden"},children:[e.jsxRuntimeExports.jsx(Oe,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsxRuntimeExports.jsx(e.vI,{})}),e.jsxRuntimeExports.jsx(De,{})]}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Customer Dashboard",!0)},{path:"/validation",element:e.jsxRuntimeExports.jsx(ec,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden"},children:[e.jsxRuntimeExports.jsx(Oe,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsxRuntimeExports.jsx(e.q2,{children:e.jsxRuntimeExports.jsx(e.bI,{})})}),e.jsxRuntimeExports.jsx(De,{})]}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:e.jsxRuntimeExports.jsx(js,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{})}]}]);l(U)}},[i]),g.useEffect(()=>{const E=Ss(_,f);Cs(_),fs(E)},[_,f]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:i&&e.jsxRuntimeExports.jsx(e.RouterProvider,{router:i})})};exports.ReCaptchaProvider=e.q2;exports.aspectRatioOptions=e.aspectRatioOptions;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useReCaptcha=e.bi;exports.App=ic;exports.ColorVariables=wt;exports.createTicket=Es;exports.hotReload=ks;exports.iconNames=Nt;
|
|
91
|
+
`},children:e.jsxRuntimeExports.jsx("div",{className:T.indicator,style:{position:"absolute",left:`${lt}%`,top:`${100-ct}%`,transform:"translate(-50%, -50%)"}})}),e.jsxRuntimeExports.jsx("div",{className:T.hueSlider,style:{bottom:_?"175px":"100px"},children:e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:ge,onChange:B=>{const y=Number(B.target.value);_?P===1?$(y,r,i,l):$(y,E,b,R):(p(y),$(y,r,i,l))},className:T.slider})}),e.jsxRuntimeExports.jsxs("div",{className:T.alphaSlider,style:{bottom:_?"150px":"75px"},children:[e.jsxRuntimeExports.jsx("div",{className:T.alphaBackground}),e.jsxRuntimeExports.jsx("div",{className:T.alphaGradient,style:{background:Tt}}),e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"100",value:yt,onChange:B=>{const y=Number(B.target.value);_?P===1?$(a,r,i,y):$(w,E,b,y):(m(y),$(a,r,i,y))},className:T.slider})]}),_&&G&&e.jsxRuntimeExports.jsxs("div",{className:T.gradientWrapper,children:[e.jsxRuntimeExports.jsx("h3",{className:T.subtitle,children:"Rotation"}),e.jsxRuntimeExports.jsx("div",{className:T.gradient,children:e.jsxRuntimeExports.jsxs("div",{className:T.chargeTypes,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(T.charge,{[T.chargeActive]:h==="horizontal"}),onClick:()=>C("horizontal"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsHorizontal",width:20,height:20}),"Horizontal"]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(T.charge,{[T.chargeActive]:h==="vertical"}),onClick:()=>C("vertical"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsVertical",width:20,height:20}),"Vertical"]})]})})]}),e.jsxRuntimeExports.jsxs("div",{className:T.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:W,className:e.clx(T.applyButton,T.cancelButton),type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:Ve,className:T.applyButton,children:"Apply"})]})]})},Wn=()=>{const{onPreview:t,zoomLevel:n}=e.usePreviewStore(),{keyBlock:s,hoverBlockId:o,isModalVisible:a,hoverBlockTopPosition:r}=e.useSubmodalStore(),{settings:i}=e.useSettingsStore(),{sourceBlocks:l}=e.useBlocksStore(),{pageContext:d}=e.usePagesStore(),{showModal:j}=e.useColorPickerStore(),{currentDevice:p}=e.useDeviceStore(),{isLoadingThemeSettings:x}=e.useThemeSettingsStore(),{isLoadingLayers:c}=e.useLayersStore(),m=h=>h?!l||!l[h]?e.jsxRuntimeExports.jsx(ve,{error:`Block "${h}" does not exist in blocks.`}):new l[h]().renderPreview(i,d):e.jsxRuntimeExports.jsx(ve,{error:"Block or block.name is undefined."});function v(){if(p.value==="desktop")return n>=1?"100%":`${(n*100).toFixed(2)}%`;{const h=p.value==="tablet"?768:425;return n>=1?`${h}px`:`${(h*n).toFixed(2)}px`}}function u(){switch(p.value){case"desktop":return"100%";case"tablet":return 768;case"mobile":return 425;default:return"100%"}}const{isOpenSelectModal:S}=e.usePagesStore(),_=g.useRef(null),f=h=>{_.current&&(_.current.scrollTop+=h.deltaY)};return e.jsxRuntimeExports.jsxs("div",{className:ke.preview,style:{zIndex:j&&!S?5e3:500},onWheel:h=>{h.stopPropagation(),f(h)},children:[a&&e.jsxRuntimeExports.jsx(hn,{children:e.jsxRuntimeExports.jsx(Et,{})}),e.jsxRuntimeExports.jsxs(xn,{positionTop:r,positionLeft:!o&&s?void 0:250,children:[!x&&!c&&e.jsxRuntimeExports.jsx(at,{render:m,block:s},s),(x||!s||c)&&e.jsxRuntimeExports.jsx("div",{className:ke.previewLoading,children:e.jsxRuntimeExports.jsx(e.Loader,{})})]}),j&&e.jsxRuntimeExports.jsx(Gn,{}),t&&e.jsxRuntimeExports.jsxs("div",{className:ke.main,style:{width:u()},children:[e.jsxRuntimeExports.jsx(Mo,{}),e.jsxRuntimeExports.jsx("div",{style:{borderLeft:v()==="100%"?"none":"var(--default-border)",borderRight:v()==="100%"?"none":"var(--default-border)",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 160px)",overflowY:"scroll",overflowX:"hidden"},onScroll:h=>{h.stopPropagation()},onWheel:h=>{h.stopPropagation()},children:!x&&!c?e.jsxRuntimeExports.jsx("div",{className:ke.content,style:{width:v()},children:e.jsxRuntimeExports.jsx(nn,{scrollableRef:_})}):e.jsxRuntimeExports.jsx("div",{className:ke.loading,children:e.jsxRuntimeExports.jsx(e.Loader,{})})})]})]})},Zn="_sidebar_1xtkj_1",Xn="_title_1xtkj_11",Yn="_active_1xtkj_19",ft={sidebar:Zn,title:Xn,active:Yn},Kn="_layers_1jhzw_1",Jn="_wrapper_1jhzw_9",Qn="_draggingWrapper_1jhzw_17",er="_block_1jhzw_21",tr="_dragging_1jhzw_17",sr="_active_1jhzw_56",or="_add_1jhzw_63",nr="_addTop_1jhzw_79",rr="_visible_1jhzw_95",ir="_button_1jhzw_99",ar="_empty_1jhzw_114",lr="_title_1jhzw_126",cr="_icon_1jhzw_133",ur="_blockIcon_1jhzw_137",dr="_text_1jhzw_147",pr="_highlight_1jhzw_153",mr="_nameBlock_1jhzw_158",xr="_loader_1jhzw_162",hr="_actions_1jhzw_171",gr="_deleteButton_1jhzw_179",X={layers:Kn,wrapper:Jn,draggingWrapper:Qn,block:er,dragging:tr,active:sr,add:or,addTop:nr,visible:rr,button:ir,empty:ar,title:lr,icon:cr,blockIcon:ur,text:dr,highlight:pr,nameBlock:mr,loader:xr,actions:hr,deleteButton:gr},jr="_block_sj4cc_1",Sr="_title_sj4cc_17",fr="_actions_sj4cc_21",_r="_deleteButton_sj4cc_28",me={block:jr,title:Sr,actions:fr,deleteButton:_r},Ye={header:"Header",footer:"Footer",announcement:"Announcement"},Ke=({id:t})=>{const{setCurrentBlock:n}=e.useLayersStore(),{activeBlock:s}=e.usePreviewStore(),[o,a]=g.useState(!1);function r(i){n(i)}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(me.block,{[me.active]:s.id===t,[me.header]:t==="header",[me.footer]:t==="footer",[me.announcement]:t==="announcement"}),onClick:()=>r(t),onMouseOver:()=>a(!0),onMouseLeave:()=>a(!1),children:[Re[Ye[t]]?e.jsxRuntimeExports.jsx("img",{src:Re[Ye[t]],width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:me.title,children:Ye[t]}),e.jsxRuntimeExports.jsx("div",{className:me.actions,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"PushPin",hoverable:!0,width:20,height:20,fill:"#757575"})})]})},vr=({id:t,name:n,onClick:s,isDragging:o,icon:a})=>{const{activeBlock:r,setActiveBlock:i}=e.usePreviewStore(),{showPreview:l,hidePreview:d,showModal:j,hideModal:p,clearHideTimeout:x,startHideTimeout:c,hoverBlockId:m,isModalVisible:v}=e.useSubmodalStore(),{setPositionBlock:u}=e.useLayersStore(),[S,_]=g.useState(!1),[f,h]=g.useState(!1),[C,w]=g.useState(!1),[E,b]=g.useState(!1),[R,M]=g.useState(null),{attributes:U,listeners:q,setNodeRef:F,transform:P,transition:V}=e.useSortable({id:t}),G={transform:e.CSS.Transform.toString(P),transition:V},{setTitle:A,setDescription:ie,setOnConfirm:Y}=e.useConfirmationModalStore(),{pages:$,currentPage:z}=e.usePagesStore(),{removeBlock:K}=e.useLayersStore(),ce=W=>{W.stopPropagation(),i({id:t,neededScroll:!0}),v&&p(),l(t),x()},Le=(W,ge=!0)=>{W.stopPropagation(),d(),j(t),x(),u(t,ge)},Ve=W=>{W.stopPropagation(),i({id:null,neededScroll:!1}),v?c():d()};return g.useEffect(()=>{w(!1),_(!1),h(!1),b(!1)},[o]),g.useEffect(()=>{v||(h(!1),_(!1))},[v]),e.jsxRuntimeExports.jsxs("div",{ref:F,style:G,className:e.clx(X.wrapper,{[X.draggingWrapper]:o&&r.id===t}),onClick:W=>{W.stopPropagation(),s(t)},onMouseEnter:ce,onMouseLeave:Ve,...U,...q,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(X.block,{[X.dragging]:o&&r.id===t,[X.active]:!o&&r.id===t}),children:[a?e.jsxRuntimeExports.jsx("img",{src:a,width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:X.nameBlock,children:n}),m===t&&!o&&e.jsxRuntimeExports.jsx("div",{className:e.clx(X.addTop,{[X.visible]:f}),onMouseEnter:()=>{h(!0)},onMouseLeave:()=>{h(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:X.button,onClick:W=>Le(W,!1),onMouseEnter:()=>{const W=setTimeout(()=>{o||b(!0)},200);M(W)},onMouseLeave:()=>{R&&clearTimeout(R),b(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),E&&e.jsxRuntimeExports.jsx(we,{text:"Click to add a section"})]})}),m===t&&!o&&e.jsxRuntimeExports.jsx("div",{className:e.clx(X.add,{[X.visible]:S}),onMouseEnter:()=>{_(!0)},onMouseLeave:()=>{_(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:X.button,onClick:W=>Le(W),onMouseEnter:()=>{const W=setTimeout(()=>{o||w(!0)},200);M(W)},onMouseLeave:()=>{R&&clearTimeout(R),w(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),C&&e.jsxRuntimeExports.jsx(we,{text:"Click to add a section"})]})})]}),m===t&&!o&&e.jsxRuntimeExports.jsxs("div",{className:X.actions,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20}),e.jsxRuntimeExports.jsx("div",{className:X.deleteButton,onClick:W=>{W.stopPropagation(),A("Remove Block"),ie(`Are you sure you want to delete ${n||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),Y(()=>{$&&K($[z].path,t)})},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",hoverable:!0,width:20,height:20})})]})]})},wr=()=>{const{blocks:t,setCurrentBlock:n,moveBlock:s,isLoadingLayers:o,announcement:a}=e.useLayersStore(),{currentPage:r,pages:i}=e.usePagesStore(),{setMouseOverModal:l,setHoverBlockId:d}=e.useSubmodalStore(),{sourceBlocks:j}=e.useBlocksStore();function p(S){n(S),l(!1),d(null)}const x=e.useSensors(e.useSensor(e.PointerSensor,{activationConstraint:{distance:5}})),[c,m]=g.useState(!1),v=()=>{m(!0)},u=S=>{m(!1);const{active:_,over:f}=S;if(f&&_.id!==f.id&&i&&i[r]){const h=i[r].path,C=t[h].order,w=C.indexOf(_.id),E=C.indexOf(f.id);w!==-1&&E!==-1&&s(h,w,E)}};return e.jsxRuntimeExports.jsx("div",{className:X.layers,children:o?e.jsxRuntimeExports.jsx("div",{className:X.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[a&&e.jsxRuntimeExports.jsx(Ke,{id:"announcement"}),e.jsxRuntimeExports.jsx(Ke,{id:"header"}),e.jsxRuntimeExports.jsx(e.DndContext,{sensors:x,onDragEnd:u,onDragStart:v,children:i&&i[r]&&t[i[r].path]&&e.jsxRuntimeExports.jsx(e.SortableContext,{items:t[i[r].path].order,strategy:e.verticalListSortingStrategy,children:t[i[r].path].order.map((S,_)=>e.jsxRuntimeExports.jsx(vr,{id:S,name:_e(t[i[r].path].data[S].name,j),index:_,onClick:p,isDragging:c,icon:Re[t[i[r].path].data[S].name]},S))})}),e.jsxRuntimeExports.jsx(Ke,{id:"footer"})]})})},br=({isHeader:t})=>{const{header:n,footer:s}=e.useLayersStore(),{pageContext:o}=e.usePagesStore(),{footer:a,header:r}=e.useBlocksStore();if(!a||!r||!s||!n)return null;if(t){const i=new r;return Object.keys(n).map(l=>{i[l]=n[l]}),i.renderSettings(o)}else{const i=new a;return Object.keys(s).map(l=>{i[l]=s[l]}),i.renderSettings(o)}},Cr=()=>{const{announcement:t}=e.useLayersStore(),{pageContext:n}=e.usePagesStore(),{announcement:s}=e.useBlocksStore();if(!s||!t)return null;const o=new s;return Object.keys(t).map(a=>{o[a]=t[a]}),o.renderSettings(n)},kr="_loader_eyvkk_1",Er={loader:kr},Rr=()=>{const{isLoadingSettings:t}=e.useSettingsStore();return t?e.jsxRuntimeExports.jsx("div",{className:Er.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsx(yr,{})},yr=()=>{const{settings:t}=e.useSettingsStore(),{setError:n}=e.useErrorStore();try{return t==null?void 0:t.renderSettings()}catch(s){throw console.error("Error rendering settings:",s),n({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),s}},Tr="_theme_a1one_1",Lr="_block_a1one_8",Br="_name_a1one_23",Nr="_loader_a1one_27",Ae={theme:Tr,block:Lr,name:Br,loader:Nr},Pr=()=>{const t=e.useNavigate(),{isLoadingThemeSettings:n,setActiveBlock:s}=e.useThemeSettingsStore();function o(a){switch(a==null?void 0:a.name){case"Colors":t("/admin/builder/theme/colors"),s(ne[0]);break;case"Fonts":t("/admin/builder/theme/fonts"),s(ne[1]);break;case"Borders":t("/admin/builder/theme/borders"),s(ne[2]);break;case"Buttons":t("/admin/builder/theme/buttons"),s(ne[3]);break;case"Inputs":t("/admin/builder/theme/inputs"),s(ne[4]);break}}return e.jsxRuntimeExports.jsx("div",{className:Ae.theme,children:n?e.jsxRuntimeExports.jsx("div",{className:Ae.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):ne.map(a=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>o(a),className:e.clx(Ae.block),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:a.icon}),e.jsxRuntimeExports.jsx("span",{className:Ae.name,children:a.name}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight"})]},a.icon))})},Ar="_back_7e826_1",Ir="_render_7e826_9",$r="_open_7e826_24",Mr="_close_7e826_51",Fr="_clicked_7e826_55",Hr="_title_7e826_59",Dr="_button_7e826_67",Or="_loading_7e826_72",Ur="_settings_7e826_76",Vr="_deleteButton_7e826_82",zr="_backIcon_7e826_95",fe={back:Ar,render:Ir,open:$r,close:Mr,clicked:Fr,title:Hr,button:Dr,loading:Or,settings:Ur,deleteButton:Vr,backIcon:zr},qr=({block:t})=>{const{pageContext:n}=e.usePagesStore(),{setError:s}=e.useErrorStore();try{return t.renderSettings(n)}catch(o){throw console.error("Error rendering settings:",o),s({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),o}},Gr="_wrapper_15ju8_1",Wr="_header_15ju8_8",Zr="_title_15ju8_15",Xr="_colorWrapper_15ju8_21",Yr="_name_15ju8_35",Kr="_color_15ju8_21",Jr="_value_15ju8_47",Qr="_length_15ju8_51",Q={wrapper:Gr,header:Wr,title:Zr,colorWrapper:Xr,name:Yr,color:Kr,value:Jr,length:Qr},Je=t=>{const{colors:n}=t,{themeSettings:s}=e.useThemeSettingsStore(),[o,a]=g.useState(!0);g.useEffect(()=>{n.length<=3&&a(!0)},[]);function r(i){const l=i.replace("--",""),[d,j]=l.split("-"),p=`${j.charAt(0).toUpperCase()+j.slice(1)} ${d.charAt(0).toUpperCase()+d.slice(1)}`,[x,c]=l.split("-");return{name:p,field:x,variable:c}}return e.jsxRuntimeExports.jsxs("div",{className:Q.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:Q.header,children:[e.jsxRuntimeExports.jsx("div",{className:Q.title,children:"Section Colors"}),!o&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(Q.value,Q.length),onClick:()=>a(!0),children:["+",n.length]})]}),o&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:Q.colors,children:n.map(i=>{const l=r(i),{variable:d,name:j,field:p}=l;return e.jsxRuntimeExports.jsx(ei,{color:s.colors[p][d],name:j})})}),n.length>3&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(Q.value,Q.length),onClick:()=>a(!1),children:["Hide ",n.length," colors"]})]})]})},ei=t=>{const{name:n,color:s}=t,{setActiveLabel:o,setModalPosition:a,setInitialColor:r,setShowModal:i,setUpdate:l,setColor:d,setColorChange:j,colorChange:p,setIsGradientActive:x}=e.useColorPickerStore(),{updateColor:c}=e.useThemeSettingsStore(),m=(S,_)=>f=>{c(S,_,f)};g.useEffect(()=>{const S=()=>{i(!1),o(null),r(s),l(()=>{}),d(s),j(()=>{})};return document.body.addEventListener("click",S),()=>{document.body.removeEventListener("click",S)}},[]);const v=S=>{const _=n.split("/")[0],f=_.split(" ")[0].toLowerCase(),h=_.split(" ")[1].toLowerCase();S.stopPropagation(),i(!0),j(p),l(E=>m(h,f)(E)),r(s),d(s),x(h==="surface");const{top:C,left:w}=Ct(S,550,288,10,20,230,80);a({top:h==="surface"?C:C+125,left:w-200})};function u(S){return S.length>15?S.slice(0,15)+"...":S}return e.jsxRuntimeExports.jsxs("div",{className:Q.colorWrapper,onClick:v,children:[e.jsxRuntimeExports.jsx("div",{className:Q.color,style:{background:s}}),e.jsxRuntimeExports.jsx("div",{className:Q.name,children:n}),e.jsxRuntimeExports.jsx("div",{className:Q.value,children:u(s)})]})},ti="_back_1sznl_1",si="_title_1sznl_9",oi="_deleteButton_1sznl_17",ni="_backIcon_1sznl_30",Ie={back:ti,title:si,deleteButton:oi,backIcon:ni},ri=({onClick:t,setIsClicked:n,getDisplayName:s})=>{var c,m;const{activeBlock:o}=e.useBlocksStore(),{setTitle:a,setDescription:r,setOnConfirm:i}=e.useConfirmationModalStore(),{blocks:l,currentBlock:d,removeBlock:j}=e.useLayersStore(),{currentPage:p,pages:x}=e.usePagesStore();return e.jsxRuntimeExports.jsxs("div",{className:Ie.back,children:[e.jsxRuntimeExports.jsx("div",{className:Ie.backIcon,onClick:()=>t(),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("h3",{className:Ie.title,children:o&&s(o)||x&&x[p]&&l[x[p].path]&&d&&s((c=l[x[p].path].data[d])==null?void 0:c.name)||d&&re(d)||"Loading"}),d&&x&&!["header","footer","announcement"].includes(d)&&l[x[p].path].data[d]&&s((m=l[x[p].path].data[d])==null?void 0:m.name)!=="unknown name"&&e.jsxRuntimeExports.jsx("button",{onClick:v=>{var u;v.stopPropagation(),a("Remove Block"),r(`Are you sure you want to delete ${s((u=l[x[p].path].data[d])==null?void 0:u.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),i(()=>{n(!0),j(x[p].path,d),t(!0)})},className:Ie.deleteButton,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A"})})]})},ii=()=>{const t=e.useNavigate(),[n,s]=g.useState(!1),{sourceBlocks:o,activeBlock:a,setActiveBlock:r,currentInstance:i,setCurrentInstance:l}=e.useBlocksStore(),{setActiveBlock:d}=e.usePreviewStore(),{blocks:j,addBlock:p,editBlock:x,currentBlock:c,setCurrentBlock:m,setHeader:v,setFooter:u,setAnnouncement:S,header:_,footer:f,announcement:h,isLoadingLayers:C}=e.useLayersStore(),{currentPage:w,pages:E}=e.usePagesStore(),{past:b,future:R}=e.useHistoryStore();function M(F=!1){if(E&&i&&!F){const P={blockSettings:{}};Object.keys(i.blockSettings).filter(V=>!["displayName","isAddable"].includes(V)).map(V=>{P.blockSettings[V]=i.blockSettings[V]}),x(E[w].path,c,{name:j[E[w].path].data[c].name,value:P})}r(null),m(null),d({id:null,neededScroll:!1}),setTimeout(()=>{s(!1)},150),l(null)}function U(){var V;if(!E||!E[w]||!c)return null;const F=j[E[w].path].data[c];return!F||!o[F.name]?null:new o[F.name]((V=F.value)==null?void 0:V.blockSettings)}g.useEffect(()=>{if(a||c&&!["header","footer","announcement"].includes(c)){const F=U();l(F)}else l(null)},[a,c,b,R]),g.useEffect(()=>{if(a&&E&&!c){const F={blockSettings:{},blockColors:{}},P=new o[a];l(P),Object.keys(P.blockSettings).filter(G=>!["displayName","isAddable"].includes(G)).map(G=>{F.blockSettings[G]=P.blockSettings[G]}),Object.keys(P.blockColors).filter(G=>!["displayName","isAddable"].includes(G)).map(G=>{F.blockColors[G]=P.blockColors[G]});const V=p(E[w].path,{name:a,value:F});d({id:V,neededScroll:!0}),m(V),t("/admin/builder")}},[a,b,R]),g.useEffect(()=>{c==="header"&&v(_)},[c,_]),g.useEffect(()=>{c==="footer"&&u(f)},[c,f]),g.useEffect(()=>{c==="announcement"&&S(h)},[c,h]);function q(F){if(!o)return"unknown name";if(!o[F])return c==="header"?_==null?void 0:_.blockSettings.displayName:c==="footer"?f==null?void 0:f.blockSettings.displayName:c==="announcement"?h==null?void 0:h.blockSettings.displayName:"unknown name";const P=new o[F];return!P.blockSettings||!P.blockSettings.displayName?"unknown name":P.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(fe.render,{[fe.open]:c,[fe.close]:!c,[fe.clicked]:n}),onClick:F=>F.stopPropagation(),style:{opacity:C?0:1},children:[e.jsxRuntimeExports.jsx(ri,{onClick:M,setIsClicked:s,getDisplayName:q}),e.jsxRuntimeExports.jsxs("div",{className:fe.settings,children:[i&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(qr,{block:i}),e.jsxRuntimeExports.jsx(Je,{colors:i.blockColors})]}),c&&["header","footer"].includes(c)&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(br,{isHeader:c==="header"}),e.jsxRuntimeExports.jsx(Je,{colors:c==="header"?_.blockColors:f.blockColors})]}),c==="announcement"&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Cr,{}),e.jsxRuntimeExports.jsx(Je,{colors:h.blockColors})]}),!a&&!c&&e.jsxRuntimeExports.jsx("div",{className:fe.loading,children:"Loading"})]})]})},ai="_header_9rrfr_1",li="_title_9rrfr_9",ci="_backIcon_9rrfr_15",Qe={header:ai,title:li,backIcon:ci},ye=({onClick:t,title:n})=>e.jsxRuntimeExports.jsxs("div",{className:Qe.header,children:[e.jsxRuntimeExports.jsx("div",{className:Qe.backIcon,onClick:t,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:Qe.title,children:n})]}),ui="_options_ymds7_1",di={options:ui},pi="_wrapper_kzokw_1",mi="_open_kzokw_16",xi="_close_kzokw_20",et={wrapper:pi,open:mi,close:xi},Te=t=>{const{isOpen:n,isClose:s,children:o}=t;return e.jsxRuntimeExports.jsx("div",{className:e.clx(et.wrapper,{[et.open]:n,[et.close]:s}),children:o})},hi=()=>{var j,p;const{activeBlock:t,themeSettings:n,updateBorder:s,setActiveBlock:o}=e.useThemeSettingsStore();function a(x,c){s(c,x)}const r=e.useNavigate();function i(){o(null),r("/admin/builder/theme")}const l=g.useMemo(()=>n.borders,[n]),d=(t==null?void 0:t.name)==="Borders";return e.jsxRuntimeExports.jsxs(Te,{isOpen:d,isClose:!d,children:[e.jsxRuntimeExports.jsx(ye,{onClick:i,title:"Borders Style"}),e.jsxRuntimeExports.jsxs("div",{className:di.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Border Radius (px)",options:Object.keys(qe),value:((j=Object.entries(qe).find(([x,c])=>c===l.radius))==null?void 0:j[0])||"None",onChange:x=>a(qe[x],"radius")}),e.jsxRuntimeExports.jsx(e.Select,{label:"Border Thickness (px)",options:Object.keys(Ge),value:((p=Object.entries(Ge).find(([x,c])=>c===l.thickness))==null?void 0:p[0])||"None",onChange:x=>a(Ge[x],"thickness")})]})]})},gi="_options_jo38w_1",ji="_alignments_jo38w_9",Si="_blocks_jo38w_15",fi="_alignment_jo38w_9",_i="_active_jo38w_34",vi="_chargeTypes_jo38w_41",wi="_charge_jo38w_41",bi="_chargeActive_jo38w_69",Ci="_shadowsHeader_jo38w_77",ki="_sliderContainer_jo38w_83",Ei="_shadowInputs_jo38w_91",Ri="_label_jo38w_102",yi="_shadowInputsRow_jo38w_111",Ti="_shadowInputsOpen_jo38w_119",J={options:gi,alignments:ji,blocks:Si,alignment:fi,active:_i,chargeTypes:vi,charge:wi,chargeActive:bi,shadowsHeader:Ci,sliderContainer:ki,shadowInputs:Ei,label:Ri,shadowInputsRow:yi,shadowInputsOpen:Ti},he=t=>{const{initialColor:n,onChange:s,title:o,labelStyle:a="primary",isGradientActive:r=!0}=t,[i,l]=g.useState(n);g.useEffect(()=>{l(n)},[n]);const{setActiveLabel:d,setModalPosition:j,setInitialColor:p,setShowModal:x,setUpdate:c,setColor:m,setColorChange:v,setIsGradientActive:u,colorChange:S}=e.useColorPickerStore();g.useEffect(()=>{const f=()=>{x(!1),d(null),p(n),c(()=>{}),m(n),v(()=>{})};return document.body.addEventListener("click",f),()=>{document.body.removeEventListener("click",f)}},[]);const _=f=>{f.stopPropagation(),x(!0),v(l),c(s),p(n),m(i),u(r);const{top:h,left:C}=Ct(f,600,288,10,20,230,80);j({top:h,left:C})};return e.jsxRuntimeExports.jsxs("div",{className:T.content,children:[e.jsxRuntimeExports.jsx("span",{className:e.clx(T.name,{[T.secondary]:a==="secondary"}),children:o}),e.jsxRuntimeExports.jsxs("label",{className:T.label,onClick:f=>f.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:T.colorValue,style:{background:i},onClick:_}),e.jsxRuntimeExports.jsx("input",{type:"text",value:i,onChange:f=>{const h=f.target.value;s(h),m(h),l(h),S(h)},className:T.input})]})]})},Li=["left","center","right"],Bi=()=>{const{activeBlock:t,themeSettings:n,updateButton:s,setActiveBlock:o}=e.useThemeSettingsStore(),{fonts:a}=e.useFontsStore(),[r,i]=g.useState("primary");function l(u,S){s(r,S,u)}const[d,j]=g.useState(!1),p=n.buttons[r],x=e.useNavigate();function c(){o(null),x("/admin/builder/theme")}const m=(t==null?void 0:t.name)==="Buttons";function v(u,S){l({...p.boxShadow,[u]:S},"boxShadow")}return e.jsxRuntimeExports.jsxs(Te,{isOpen:m,isClose:!m,children:[e.jsxRuntimeExports.jsx(ye,{onClick:c,title:"Buttons Style"}),e.jsxRuntimeExports.jsx("div",{className:J.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(u=>e.jsxRuntimeExports.jsx("div",{className:e.clx(J.charge,{[J.chargeActive]:r===u}),onClick:()=>i(u),children:u.charAt(0).toUpperCase()+u.slice(1)},u))}),p&&e.jsxRuntimeExports.jsxs("div",{className:J.options,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(p.height),onChange:u=>l(Number(u),"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",value:String(p.size),onChange:u=>l(Number(u),"size"),options:He}),e.jsxRuntimeExports.jsx(e.Input,{label:"Border Radius (px)",value:String(p.radius),onChange:u=>l(Number(u),"radius"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:p.font,onChange:u=>l(u,"font"),options:[...a.filter(u=>u.name!==p.font).map(u=>u.name)]}),e.jsxRuntimeExports.jsx(he,{initialColor:p.background,onChange:u=>l(u,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),e.jsxRuntimeExports.jsxs("div",{className:J.sliderContainer,children:[e.jsxRuntimeExports.jsx("h4",{className:J.label,children:"Shadow"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:()=>j(!d),style:{padding:5,display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretUp",style:{rotate:d?"0deg":"-180deg",transition:"0.3s rotate ease"}})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(J.shadowInputs,{[J.shadowInputsOpen]:d}),children:[e.jsxRuntimeExports.jsxs("div",{className:J.shadowInputsRow,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Left (px)",value:String(p.boxShadow.left),onChange:u=>v("left",Number(u)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Top (px)",value:String(p.boxShadow.top),onChange:u=>v("top",Number(u)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Blur (px)",value:String(p.boxShadow.blur),onChange:u=>v("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(p.boxShadow.spread),onChange:u=>v("spread",Number(u)),type:"number"})})]}),e.jsxRuntimeExports.jsx(he,{initialColor:p.boxShadow.color,onChange:u=>v("color",u),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs("div",{className:J.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:J.label,children:"Alignment Type"}),e.jsxRuntimeExports.jsx("div",{className:J.blocks,children:Li.map(u=>e.jsxRuntimeExports.jsx("div",{className:e.clx(J.alignment,{[J.active]:p.alignment===u}),onClick:()=>{l(u,"alignment")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:u==="center"?"AlignCenterHorizontal":u==="left"?"AlignLeft":"AlignRight",fill:p.alignment===u?"#252525":"#757575"})},u))})]}),e.jsxRuntimeExports.jsx(e.Switch,{label:"Enable Hover",onChange:u=>l(u,"hover"),current:p.hover})]})]})},Ni="_category_hxy9u_1",Pi="_categoryTitle_hxy9u_19",tt={category:Ni,categoryTitle:Pi},Ai=()=>{const{themeSettings:t,setActiveColorCategory:n}=e.useThemeSettingsStore();function s(o){n(o)}return e.jsxRuntimeExports.jsx("div",{className:tt.wrapper,children:Object.keys(t.colors).map(o=>o==="icon"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",{className:tt.category,onClick:()=>s(o),children:[e.jsxRuntimeExports.jsxs("h2",{className:tt.categoryTitle,children:[o==="text"?"Text & Icon":re(o)," Colors"]}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:24,height:24})]},o))})},Ii="_wrapper_ikvjo_1",$i="_open_ikvjo_16",Mi="_close_ikvjo_20",Fi="_header_ikvjo_24",Hi="_title_ikvjo_32",Di="_options_ikvjo_38",Oi="_clicked_ikvjo_45",Ui="_backIcon_ikvjo_49",Vi="_charge_ikvjo_59",zi="_chargeActive_ikvjo_78",qi={wrapper:Ii,open:$i,close:Mi,header:Fi,title:Hi,options:Di,clicked:Oi,backIcon:Ui,charge:Vi,chargeActive:zi},Gi=()=>{const{activeBlock:t,setActiveFont:n,activeFont:s,themeSettings:o,updateFont:a}=e.useThemeSettingsStore(),{fonts:r}=e.useFontsStore(),[i,l]=g.useState(null);function d(){n(null)}function j(u,S){i&&s&&a("desktop",i,s,S,u)}const[p,x]=g.useState([]),c=g.useMemo(()=>s?o.fonts.desktop.heading[s]?(l("heading"),o.fonts.desktop.heading[s]):o.fonts.desktop.body[s]?(l("body"),o.fonts.desktop.body[s]):(l(null),null):null,[s,o]);g.useEffect(()=>{if(c){const u=r.find(S=>S.name===c.font);u&&(x(u.weights),u.weights.includes(c.boldWeight)||j("400","boldWeight"),u.weights.includes(c.weight)||j("400","weight"))}},[c,s]);const m=!!((t==null?void 0:t.name)==="Fonts"&&s),v=(t==null?void 0:t.name)!=="Fonts"||!s;return e.jsxRuntimeExports.jsxs(Te,{isOpen:m,isClose:v,children:[e.jsxRuntimeExports.jsx(ye,{onClick:d,title:"Font Style"}),s&&c&&e.jsxRuntimeExports.jsxs("div",{className:qi.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:c.font,onChange:u=>j(u,"font"),options:[...r.filter(u=>u.name!==c.font).map(u=>u.name)]}),e.jsxRuntimeExports.jsx(e.Select,{label:"Size",value:String(c.size),onChange:u=>j(u,"size"),options:He}),e.jsxRuntimeExports.jsx(e.Select,{label:"Default Weight",value:String(c.weight),onChange:u=>j(u,"weight"),options:p}),e.jsxRuntimeExports.jsx(e.Select,{label:"Bold Weight",value:String(c.boldWeight),onChange:u=>j(u,"boldWeight"),options:p})]})]})},Wi="_wrapper_mkmxa_1",Zi="_category_mkmxa_5",Xi="_categoryTitle_mkmxa_11",Yi="_font_mkmxa_17",Ki="_content_mkmxa_32",Ji="_icon_mkmxa_39",Qi="_paragraph_mkmxa_50",ea="_deleteIcon_mkmxa_54",ta="_iconButton_mkmxa_61",de={wrapper:Wi,category:Zi,categoryTitle:Xi,font:Yi,content:Ki,icon:Ji,paragraph:Qi,deleteIcon:ea,iconButton:ta},sa={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",h7:"h7",lg:"large",md:"medium",sm:"small"},oa=t=>{const{font:n,size:s,id:o,category:a}=t,{setActiveFont:r}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsxs("div",{className:de.font,onClick:()=>r(o),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(de.icon,{[de.paragraph]:a==="paragraph"}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:a==="paragraph"?"TextB":"TextH"})}),e.jsxRuntimeExports.jsxs("div",{className:de.content,children:[e.jsxRuntimeExports.jsx("h2",{className:de.categoryTitle,children:re(sa[o])}),e.jsxRuntimeExports.jsx("span",{className:de.value,children:`${n}, ${s}px`})]})]})},na=()=>{const{themeSettings:t,setActiveFont:n,activeBlock:s}=e.useThemeSettingsStore();g.useEffect(()=>(o(),()=>{o()}),[]);function o(){n(null)}if(s!=null&&s.name)return e.jsxRuntimeExports.jsx("div",{className:de.wrapper,children:Object.entries(t.fonts.desktop).sort(([a],[r])=>a==="heading"?-1:r==="heading"?1:0).map(([a,r])=>e.jsxRuntimeExports.jsxs("div",{className:de.category,children:[e.jsxRuntimeExports.jsx("h2",{className:de.categoryTitle,children:re(a)}),Object.entries(r).map(([i,l])=>e.jsxRuntimeExports.jsx(oa,{id:i,category:a,...l},i))]},a))})},ra="_wrapper_16ym0_2",ia="_category_16ym0_6",aa="_categoryTitle_16ym0_12",la="_color_16ym0_18",ca="_name_16ym0_24",ua="_content_16ym0_29",da="_label_16ym0_36",pa="_input_16ym0_48",ma="_title_16ym0_74",xa="_field_16ym0_82",ha="_alignments_16ym0_92",ga="_lineField_16ym0_98",ja="_style_16ym0_106",Sa="_header_16ym0_113",oe={wrapper:ra,category:ia,categoryTitle:aa,color:la,name:ca,content:ua,label:da,input:pa,title:ma,field:xa,alignments:ha,lineField:ga,style:ja,header:Sa},fa="_blocks_emecf_1",_a="_block_emecf_1",va="_active_emecf_21",st={blocks:fa,block:_a,active:va},_t=t=>{const{items:n,selectedItem:s,onSelect:o,getIconName:a}=t;return e.jsxRuntimeExports.jsx("div",{className:st.blocks,children:n.map(r=>e.jsxRuntimeExports.jsx("div",{className:e.clx(st.block,{[st.active]:s===r}),onClick:()=>o(r),children:e.jsxRuntimeExports.jsx(e.Icon,{name:a(r),fill:s===r?"#252525":"#757575"})},String(r)))})},wa=["left","center","right"],ba=["solid","dashed"],$e=t=>{const{title:n,children:s,rightAddon:o}=t;return e.jsxRuntimeExports.jsxs("div",{className:oe.field,children:[e.jsxRuntimeExports.jsxs("div",{className:oe.header,children:[e.jsxRuntimeExports.jsx("h4",{className:oe.categoryTitle,children:n}),o]}),s]})},Ca=()=>{const{themeSettings:t,updateInput:n}=e.useThemeSettingsStore(),s=g.useMemo(()=>t.inputs,[t]),o=(r,i,l)=>{n(r,i,l)},a=r=>i=>{n(r,i,"color")};return e.jsxRuntimeExports.jsxs("div",{className:oe.wrapper,children:[e.jsxRuntimeExports.jsxs($e,{title:"General",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(s.general.height),onChange:r=>o("general",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>o("general",r,"size"),value:String(s.general.size),options:He}),e.jsxRuntimeExports.jsx(he,{initialColor:re(s.general.color),onChange:a("general"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsx($e,{title:"Field Fill",rightAddon:e.jsxRuntimeExports.jsx("div",{className:oe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>o("field",r,"active"),current:s.field.active})}),children:e.jsxRuntimeExports.jsx(he,{initialColor:s.field.color,onChange:a("field"),title:"Color",labelStyle:"secondary"})}),e.jsxRuntimeExports.jsxs($e,{title:"Border",rightAddon:e.jsxRuntimeExports.jsx("div",{className:oe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>o("border",r,"active"),current:s.border.active})}),children:[e.jsxRuntimeExports.jsxs("div",{className:oe.lineField,children:[e.jsxRuntimeExports.jsxs("div",{className:oe.style,children:[e.jsxRuntimeExports.jsx("span",{className:oe.title,children:"Style"}),e.jsxRuntimeExports.jsx(_t,{items:ba,selectedItem:s.border.style,onSelect:r=>o("border",r,"style"),getIconName:r=>r==="solid"?"Minus":"Selection"})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Radius (px)",value:String(s.border.radius),onChange:r=>o("border",r,"radius"),type:"number",min:0})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Thickness (px)",value:String(s.border.thickness),onChange:r=>o("border",r,"thickness"),type:"number",min:0}),e.jsxRuntimeExports.jsx(he,{initialColor:re(s.border.color),onChange:a("border"),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs($e,{title:"Label",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Line Height (px)",value:String(s.label.height),onChange:r=>o("label",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>o("label",r,"size"),value:String(s.label.size),options:He}),e.jsxRuntimeExports.jsx(he,{initialColor:re(s.label.color),onChange:a("label"),title:"Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsxs("div",{className:oe.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:oe.title,children:"Alignment Type"}),e.jsxRuntimeExports.jsx(_t,{items:wa,selectedItem:s.label.alignment,onSelect:r=>o("label",r,"alignment"),getIconName:r=>r==="center"?"AlignCenterHorizontal":r==="left"?"AlignLeft":"AlignRight"})]})]})]})},ka="_wrapper_1yw63_2",Ea="_category_1yw63_7",Ra="_categoryTitle_1yw63_13",ya="_color_1yw63_24",Ta="_content_1yw63_33",La="_preview_1yw63_42",Ba="_container_1yw63_52",Na="_buttonWrapper_1yw63_62",Pa="_button_1yw63_62",Aa="_buttonBorder_1yw63_80",Ia="_buttonBackground_1yw63_83",$a="_text_1yw63_87",Ma="_textText_1yw63_93",Fa="_icon_1yw63_97",Ha="_iconIcon_1yw63_100",Da="_annotation_1yw63_104",Oa="_annotationText_1yw63_111",Ua="_label_1yw63_116",Va="_circle_1yw63_127",za="_line_1yw63_140",qa="_circle1_1yw63_154",Ga="_circle2_1yw63_159",Wa="_annotationIcon_1yw63_164",Za="_annotationBorder_1yw63_192",Xa="_line1_1yw63_203",Ya="_line2_1yw63_210",Ka="_circle3_1yw63_227",Ja="_circle4_1yw63_232",Qa="_annotationSurface_1yw63_237",k={wrapper:ka,category:Ea,categoryTitle:Ra,color:ya,content:Ta,preview:La,container:Ba,buttonWrapper:Na,button:Pa,buttonBorder:Aa,buttonBackground:Ia,text:$a,textText:Ma,icon:Fa,iconIcon:Ha,annotation:Da,annotationText:Oa,label:Ua,circle:Va,line:za,circle1:qa,circle2:Ga,annotationIcon:Wa,annotationBorder:Za,line1:Xa,line2:Ya,circle3:Ka,circle4:Ja,annotationSurface:Qa},el=()=>{const{activeColorCategory:t}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx("div",{className:k.container,children:e.jsxRuntimeExports.jsxs("div",{className:k.buttonWrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(k.button,{[k.buttonBorder]:t==="border",[k.buttonBackground]:t==="surface"}),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Smiley",className:e.clx(k.icon,{[k.iconIcon]:t==="text"}),width:22,height:22,fill:"#757575"}),e.jsxRuntimeExports.jsx("span",{className:e.clx(k.text,{[k.textText]:t==="text"}),children:"Button Example"})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(k.annotation,k.annotationText),children:[e.jsxRuntimeExports.jsx("div",{className:k.label,children:"Text Color"}),e.jsxRuntimeExports.jsx("div",{className:k.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle2)})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(k.annotation,k.annotationIcon),children:[e.jsxRuntimeExports.jsx("div",{className:k.label,children:"Icon Color"}),e.jsxRuntimeExports.jsx("div",{className:k.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle2)})]}),t==="border"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(k.annotation,k.annotationBorder),children:[e.jsxRuntimeExports.jsx("div",{className:k.label,children:"Border Color"}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.line,k.line1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.line,k.line2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle3)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle4)})]}),t==="surface"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(k.annotation,k.annotationSurface),children:[e.jsxRuntimeExports.jsx("div",{className:k.label,children:"Surface Color"}),e.jsxRuntimeExports.jsx("div",{className:k.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(k.circle,k.circle2)})]})]})})},tl={text:["primary","secondary","tertiary","inverted","action","action-hover","disabled","warning","error","success","information","link"],border:["primary","secondary","action","actionHover","disabled","warning","error","success","information","focus"],surface:["primary","secondary","action1","action1Hover","action2","action2Hover","disabled","warning","error","success","information","modal"]},sl=()=>{const{activeBlock:t,setActiveColorCategory:n,activeColorCategory:s,themeSettings:o,updateColor:a}=e.useThemeSettingsStore();function r(){n(null)}function i(p,x,c){a(p,x,c)}const l=!!((t==null?void 0:t.name)==="Colors"&&s),d=(t==null?void 0:t.name)!=="Colors"||!s,j=s?tl[s]:[];return e.jsxRuntimeExports.jsxs(Te,{isOpen:l,isClose:d,children:[e.jsxRuntimeExports.jsx(ye,{onClick:r,title:s==="text"?"Text & Icon Colors":`${re(s)} Colors`}),s&&e.jsxRuntimeExports.jsxs("div",{className:k.wrapper,children:[e.jsxRuntimeExports.jsx(el,{}),j.map(p=>{const x=o.colors[s][p];return x?e.jsxRuntimeExports.jsx("div",{className:k.color,children:e.jsxRuntimeExports.jsxs("div",{className:k.content,children:[e.jsxRuntimeExports.jsx("div",{className:k.preview,style:{background:x}}),e.jsxRuntimeExports.jsx(he,{title:re(p),initialColor:x,onChange:c=>i(s,p,c),isGradientActive:s==="surface"})]})},p):null})]})]})},ol="_loader_1p5lr_1",nl={loader:ol},rl=()=>{const{activeBlock:t,themeSettings:n,isLoadingThemeSettings:s}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s?e.jsxRuntimeExports.jsx("div",{className:nl.loader,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(na,{}),(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(Gi,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(Ai,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(sl,{}),(t==null?void 0:t.name)==="Inputs"&&n.inputs&&e.jsxRuntimeExports.jsx(Ca,{}),(t==null?void 0:t.name)==="Borders"&&n.borders&&e.jsxRuntimeExports.jsx(hi,{}),(t==null?void 0:t.name)==="Buttons"&&n.buttons&&e.jsxRuntimeExports.jsx(Bi,{})]})})},il=()=>{const{activeBlock:t,setActiveBlock:n}=e.useThemeSettingsStore(),{activeBlock:s}=e.useNavbarStore(),o=e.useNavigate();function a(){n(null),o("/admin/builder/theme")}const r=!!t,i=!t||s.name!=="Theme";return e.jsxRuntimeExports.jsxs(Te,{isOpen:r,isClose:i,children:[e.jsxRuntimeExports.jsx(ye,{onClick:a,title:(t==null?void 0:t.name)||""}),e.jsxRuntimeExports.jsx(rl,{})]})},al=()=>{const{activeBlock:t}=e.useNavbarStore(),{showTooltip:n}=e.useTooltipStore();function s(){switch(t.name){case"Layers":return"Layers";case"Add":return"Add Sections";case"Theme":return"Theme Settings";case"Settings":return"Settings"}}return e.jsxRuntimeExports.jsxs("div",{className:ft.sidebar,style:{zIndex:n?50:"auto"},children:[e.jsxRuntimeExports.jsx("h3",{className:ft.title,children:s()}),t.name==="Layers"&&e.jsxRuntimeExports.jsx(wr,{}),t.name==="Add"&&e.jsxRuntimeExports.jsx(Et,{}),e.jsxRuntimeExports.jsx(ii,{}),e.jsxRuntimeExports.jsx(il,{}),t.name==="Theme"&&e.jsxRuntimeExports.jsx(Pr,{}),t.name==="Settings"&&e.jsxRuntimeExports.jsx(Rr,{})]})},ll="_wrapper_no6if_1",cl="_header_no6if_12",ul="_content_no6if_23",dl="_buttons_no6if_44",pl="_label_no6if_51",ml="_description_no6if_52",xl="_preview_no6if_60",hl="_block_no6if_66",gl="_slug_no6if_75",jl="_title_no6if_81",Sl="_closeIcon_no6if_87",te={wrapper:ll,header:cl,content:ul,buttons:dl,label:pl,description:ml,preview:xl,block:hl,slug:gl,title:jl,closeIcon:Sl},fl="_wrapper_ba9vp_2",_l="_label_ba9vp_10",vl="_options_ba9vp_18",wl="_radioLabel_ba9vp_24",bl="_radio_ba9vp_24",Cl="_custom_ba9vp_39",kl="_option_ba9vp_18",xe={wrapper:fl,label:_l,options:vl,radioLabel:wl,radio:bl,custom:Cl,option:kl},El=t=>{const{defaultValue:n,options:s,onChange:o,label:a}=t,[r,i]=g.useState(n),l=d=>{const j=d.target.value;i(j),o(j)};return e.jsxRuntimeExports.jsxs("div",{className:xe.wrapper,children:[e.jsxRuntimeExports.jsx("span",{className:xe.label,children:a}),e.jsxRuntimeExports.jsx("div",{className:xe.options,children:s.map(d=>e.jsxRuntimeExports.jsxs("label",{className:xe.radioLabel,children:[e.jsxRuntimeExports.jsx("input",{type:"radio",value:d.value,checked:r===d.value,onChange:l,className:xe.radio}),e.jsxRuntimeExports.jsx("span",{className:xe.custom}),e.jsxRuntimeExports.jsx("span",{className:xe.option,children:d.label})]},d.value))})]})},Rl=()=>{var M,U,q,F,P,V,G;const{setIsOpenModal:t,pages:n,createPage:s,updatePage:o,isEdit:a,setIsEdit:r,editedPage:i,setEditedPage:l,pageContext:d}=e.usePagesStore(),{setIsOpen:j}=e.useModalStore(),{createPage:p,updatePage:x}=e.useLayersStore(),[c,m]=g.useState(i?n&&((M=n[i])==null?void 0:M.path):""),[v,u]=g.useState(i?n&&((U=n[i])==null?void 0:U.name):""),[S,_]=g.useState(i?n&&((q=n[i])==null?void 0:q.seo)&&((P=(F=n[i])==null?void 0:F.seo)==null?void 0:P.pageDescription)||"":`${d.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`),[f,h]=g.useState(i&&n&&(V=n[i])!=null&&V.isPrivate?"private":"public");function C(){m(""),u(""),_(""),h("public"),r(!1),l(null)}function w(){j(!1),setTimeout(()=>{C(),t(!1),j(!0)},300)}g.useEffect(()=>()=>{w()},[]);function E(A){return A[0]==="/"?A:"/"+A}function b(){s({path:E(c),name:v||c||"",icon:"File",seo:{pageTitle:v||"",pageDescription:S||""},visibility:f||"public"}),p(E(c)),w()}function R(){n&&(e.defaultPagePaths.includes(n[i].path)||kt(n[i].path),x(n[i].path||"",c||""),o(i,{path:E(c),name:v||c,icon:n[i].icon||"File",seo:{pageTitle:v||"",pageDescription:S||""},visibility:f||"public"})),w()}return e.jsxRuntimeExports.jsxs("div",{className:te.wrapper,onClick:A=>A.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:te.header,children:[e.jsxRuntimeExports.jsx("h2",{children:a?"Edit Page":"Create New Page"}),e.jsxRuntimeExports.jsx("div",{className:te.closeIcon,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:w})})]}),e.jsxRuntimeExports.jsxs("div",{className:te.content,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Page Slug",onChange:A=>m(A),value:c,placeholder:"path-to-page",disabled:!!(i&&n&&((G=n[i])!=null&&G.name)&&e.defaultPagePaths.includes(n[i].path)),required:!0,regex:"^.+$"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Page Title",onChange:A=>{u(A)},value:v.charAt(0).toUpperCase()+v.slice(1),placeholder:"Contact us"}),e.jsxRuntimeExports.jsx(e.Textarea,{label:"Description",onChange:A=>_(A),value:S,placeholder:`${d.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`,maxLength:150}),e.jsxRuntimeExports.jsx(El,{label:"Visibility",defaultValue:f,options:[{value:"public",label:"Public"},{value:"private",label:"Private"}],onChange:A=>h(A)}),e.jsxRuntimeExports.jsxs("div",{className:te.preview,children:[e.jsxRuntimeExports.jsx("span",{className:te.label,children:"Preview"}),e.jsxRuntimeExports.jsxs("div",{className:te.block,children:[e.jsxRuntimeExports.jsx("span",{className:te.slug,children:c||"yoursite.url"}),e.jsxRuntimeExports.jsx("span",{className:te.title,children:v||"My Blank Page"}),e.jsxRuntimeExports.jsx("span",{className:te.description,children:S||"It is My Description"})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:te.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:w,type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:a?R:b,disabled:c.length===0,children:a?"Update":"Create"})]})]})},yl="_layout_3kge3_1",Tl="_main_3kge3_10",Ll="_content_3kge3_18",Bl="_notification_3kge3_26",Me={layout:yl,main:Tl,content:Ll,notification:Bl},Nl="_modal_1h74q_1",Pl="_title_1h74q_14",Al="_buttons_1h74q_20",Fe={modal:Nl,title:Pl,buttons:Al},Rt=()=>{const{title:t,description:n,onConfirm:s,setTitle:o,setDescription:a,setOnConfirm:r}=e.useConfirmationModalStore(),{setIsOpen:i}=e.useModalStore();function l(){i(!1),setTimeout(()=>{o(null),a(null),r(null),i(!0)},300)}return t&&n&&s&&e.jsxRuntimeExports.jsxs("div",{className:Fe.modal,onClick:d=>d.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:Fe.title,children:t}),e.jsxRuntimeExports.jsx("div",{className:Fe.description,children:n}),e.jsxRuntimeExports.jsxs("div",{className:Fe.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:l,children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{s(),l()},type:"Secondary",children:"Confirm"})]})]})},Il=()=>{const{isOpenModal:t,setIsOpenModal:n}=e.usePagesStore(),{openModal:s,setOpenModal:o}=e.useChooseImageStore(),{notification:a,setNotification:r}=e.useNotificationStore(),{title:i,description:l,setTitle:d,setDescription:j,setOnConfirm:p}=e.useConfirmationModalStore(),[x,c]=g.useState(null);return g.useEffect(()=>{if(a){x&&clearTimeout(x);const m=setTimeout(()=>{r(null)},3e3);c(m)}},[a]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:Me.layout,children:[e.jsxRuntimeExports.jsx(So,{}),e.jsxRuntimeExports.jsxs("main",{className:Me.main,children:[e.jsxRuntimeExports.jsx(lo,{}),e.jsxRuntimeExports.jsxs("div",{className:Me.content,children:[e.jsxRuntimeExports.jsx(al,{}),e.jsxRuntimeExports.jsx(Wn,{})]})]})]}),i&&l&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{d(null),j(null),p(null)},children:e.jsxRuntimeExports.jsx(Rt,{})}),t&&e.jsxRuntimeExports.jsx(e.Modal,{close:n,children:e.jsxRuntimeExports.jsx(Rl,{})}),s&&e.jsxRuntimeExports.jsx(e.Modal,{close:o,children:e.jsxRuntimeExports.jsx(e.ChooseImageModal,{})}),a&&e.jsxRuntimeExports.jsx("div",{className:Me.notification,children:e.jsxRuntimeExports.jsx(e.Tip,{message:a.message,type:a.status})})]})},$l=t=>{const{blocks:n,settings:s,header:o,footer:a,announcement:r}=t,{setBlocks:i,setSourceBlocks:l,setHeader:d,setFooter:j,setAnnouncement:p}=e.useBlocksStore(),{fonts:x,setFonts:c}=e.useFontsStore(),{setSettings:m}=e.useSettingsStore(),{setPageContext:v}=e.usePagesStore(),{setThemeSettings:u,setIsLoadingThemeSettings:S}=e.useThemeSettingsStore(),{setIsLoadingSettings:_}=e.useSettingsStore(),{setNotification:f}=e.useNotificationStore(),{setBlocks:h,blocks:C,createPage:w,setIsLoadingLayers:E}=e.useLayersStore(),{setPages:b,setCurrentPage:R}=e.usePagesStore();return g.useEffect(()=>{S(!0),E(!0),_(!0);const M={};Object.keys(n).forEach(q=>{M[q]=n[q]}),l(M),i(M),d(o),j(a),p(r),(async()=>{let q={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null,fullPosts:null,posts:null};const F=await Jt();Object.keys(F).map($=>{const z=$;q[z]=F[z].value.data}),v(q);const{data:P}=await ts(),{themeSettings:V,layers:G,settings:A}=P||{};if(A){const $=s;if(A.settings&&(Object.keys(A.settings).map(z=>{$[z]=A.settings[z]}),m($)),A.header){const z=o;Object.keys(A.header).map(K=>{z[K]=A.header[K]}),d(z)}if(A.footer){const z=a;Object.keys(A.footer).map(K=>{z[K]=A.footer[K]}),j(z)}if(A.announcement){const z=r;Object.keys(A.announcement).map(K=>{z[K]=A.announcement[K]}),p(z)}}else m(s);V&&u(V);const ie=await es(),Y={};if(ie.status>=400&&f({message:"Error fetching pages",status:"error"}),ie.data.length>0?(ie.data.forEach($=>{C[$.path]||w($.path),Y[$.id||$.path]={...$,icon:e.pages[$.path]?e.pages[$.path].icon:"File",name:$.name?$.name:e.pages[$.path].name}}),b(Y),R(Object.keys(Y)[0])):(b(e.pages),R(Object.keys(e.pages)[0])),x.length===0){const $=await Qt();c([...$.map(z=>{const K=z.variants.map(ce=>{if(!ce.includes("italic"))return ce==="regular"?"400":ce}).filter(ce=>ce!==void 0);return{name:z.family,weights:K}})])}h(G),S(!1),E(!1),_(!1)})()},[]),e.jsxRuntimeExports.jsx(Il,{})};function Ml(){const t=new URL(window.location.href);window.history.replaceState(null,"",t.pathname+t.hash)}function Fl(){const t=new URLSearchParams(document.location.search),n=t.get("shopId")||localStorage.getItem("shopId"),s=t.get("sellerAccessToken")||localStorage.getItem("sellerAccessToken"),o=t.get("draftId")||localStorage.getItem("draftId");return Ml(),s&&localStorage.setItem("sellerAccessToken",s),n&&localStorage.setItem("shopId",n),o&&localStorage.setItem("draftId",o),!!(s&&n&&o)}const Hl=t=>{const{blocks:n,settings:s,header:o,footer:a,announcement:r}=t,[i,l]=g.useState(!0),d=e.useNavigate();return g.useEffect(()=>{l(!0),Fl()?l(!1):d("/")},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:i?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsx($l,{blocks:n,settings:s,header:o,footer:a,announcement:r})})},Dl="_wrapper_1yd2j_1",Ol="_error_1yd2j_11",Ul="_title_1yd2j_21",Vl="_buttons_1yd2j_29",Ee={wrapper:Dl,error:Ol,title:Ul,buttons:Vl},vt=async t=>{const n=localStorage.getItem("shopId")||void 0,s=localStorage.getItem("draftId"),o=`${e.API_URL}/v2/builder/shops/${n}/drafts/${s}/reset`;return await e.request({url:o,withToken:!0,method:"post",body:t})},zl=()=>{const{error:t,setError:n}=e.useErrorStore(),{pages:s}=e.usePagesStore(),{setIsOpen:o}=e.useModalStore(),{title:a,description:r,setOnConfirm:i,setTitle:l,setDescription:d}=e.useConfirmationModalStore(),{setBlocks:j}=e.useLayersStore();async function p(){await vt({resetSettings:(t==null?void 0:t.failedSettings)??!1,resetThemeSettings:(t==null?void 0:t.failedThemeSettings)??!1,resetPageIds:(t==null?void 0:t.failedPageIds)??[]}),n(null),j({}),window.location.reload()}async function x(){const c=[];s&&Object.keys(s).map(m=>s[m].id).filter(m=>m!==void 0).map(m=>c.push(m)),await vt({resetSettings:!0,resetThemeSettings:!0,resetPageIds:c}),n(null)}return e.jsxRuntimeExports.jsxs("div",{className:Ee.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:Ee.error,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:Ee.title,children:"Oops! Something went wrong"}),e.jsxRuntimeExports.jsx("span",{className:Ee.message,children:(t==null?void 0:t.message)||""})]}),e.jsxRuntimeExports.jsxs("div",{className:Ee.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:p,children:"Reset Settings"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:c=>{c.stopPropagation(),l("Reset All Settings"),d("Are you sure you want to reset all settings? This is irreversible."),i(async()=>{await x()})},children:"Reset All Settings"})]})]}),a&&r&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{o(!1),setTimeout(()=>{l(null),d(null),i(null),o(!0)},300)},children:e.jsxRuntimeExports.jsx(Rt,{})})]})},ql=t=>{const{children:n}=t,{pathname:s}=e.useLocation(),{setActiveBlock:o}=e.useNavbarStore(),{setActiveBlock:a}=e.useThemeSettingsStore(),{setActiveBlock:r}=e.usePreviewStore();return g.useEffect(()=>{switch(r({id:null,neededScroll:!1}),s){case"/admin/builder":o(e.navbarBlocks[0]);break;case"/admin/builder/add":o(e.navbarBlocks[1]);break;case"/admin/builder/theme":o(e.navbarBlocks[2]);break;case"/admin/builder/settings":o(e.navbarBlocks[3]);break;case"/admin/builder/theme/colors":o(e.navbarBlocks[2]),a(ne[0]);break;case"/admin/builder/theme/fonts":o(e.navbarBlocks[2]),a(ne[1]);break;case"/admin/builder/theme/borders":o(e.navbarBlocks[2]),a(ne[2]);break;case"/admin/builder/theme/buttons":o(e.navbarBlocks[2]),a(ne[3]);break;case"/admin/builder/theme/inputs":o(e.navbarBlocks[2]),a(ne[4]);break}},[s]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n})},Gl="_lock_1mxa7_1",Wl="_wrapper_1mxa7_12",Zl="_content_1mxa7_22",Xl="_info_1mxa7_31",Yl="_buttons_1mxa7_38",Kl="_button_1mxa7_38",Jl="_input_1mxa7_50",Ql="_error_1mxa7_57",se={lock:Gl,wrapper:Wl,content:Zl,info:Xl,buttons:Yl,button:Kl,input:Jl,error:Ql},ec=()=>{const[t,n]=g.useState(!1),[s,o]=g.useState(!1),[a,r]=g.useState(""),{general:i,setGeneral:l}=e.useGeneralStore(),d=e.useLocation(),j=e.useNavigate();g.useEffect(()=>{if(i&&(!i.info.passwordProtected||i.isPasswordValid)){const x=d.state.from==="/validation"?"/":d.state.from;j(x)}},[i]),g.useEffect(()=>{(async()=>{var v;n(!0);const c=localStorage.getItem("shopPassword")||"",m=await nt(c);if(m.isPasswordValid){const u=((v=d.state)==null?void 0:v.from)||"/";j(u)}l(m),n(!1)})()},[]);async function p(){var c;if(n(!0),!(await nt(a)).isPasswordValid)o(!0);else{localStorage.setItem("shopPassword",a);const m=((c=d.state)==null?void 0:c.from)||"/";j(m)}n(!1)}return e.jsxRuntimeExports.jsxs("div",{className:se.wrapper,children:[!t&&e.jsxRuntimeExports.jsxs("div",{className:se.content,children:[e.jsxRuntimeExports.jsx("div",{className:se.lock,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"var(--text-secondary)",width:64,height:64})}),e.jsxRuntimeExports.jsxs("div",{className:se.info,children:[e.jsxRuntimeExports.jsx("h2",{id:"h2",className:se.title,children:"The store is password protected"}),e.jsxRuntimeExports.jsx("p",{id:"p",className:se.description,children:"If you do not have a password, we recommend you to contact the technical support of the store or write to the mail"})]}),e.jsxRuntimeExports.jsxs("div",{className:se.input,children:[e.jsxRuntimeExports.jsx(e.Input$1,{type:"password",onChange:x=>{o(!1),r(x)},value:a,placeholder:"Password",required:!0}),e.jsxRuntimeExports.jsx("span",{className:se.error,children:s&&"Incorrect password"})]}),e.jsxRuntimeExports.jsxs("div",{className:se.buttons,children:[e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",className:se.button,children:"Contact Support"}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",className:se.button,disabled:s,onClick:p,children:"Submit"})]})]}),t&&e.jsxRuntimeExports.jsx(e.Loader,{})]})},tc=({children:t})=>{const n=e.useLocation();if(n.pathname.startsWith("/admin/builder"))return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t});const[s,o]=g.useState(!0),{setThemeSettings:a,themeSettings:r}=e.useThemeSettingsStore(),{settings:i,setSettings:l}=e.useSettingsStore(),{setHeader:d,setFooter:j,setAnnouncement:p,header:x,footer:c,announcement:m}=e.useLayersStore(),{general:v,setGeneral:u}=e.useGeneralStore(),{pageContext:S,setPageContext:_}=e.usePagesStore(),f=e.useNavigate();return g.useEffect(()=>{o(!0);const h=async()=>{if(!v){const w=await nt();w.isPasswordValid||f("/validation",{state:{from:n.pathname}}),u(w)}},C=async()=>{const{settings:w,theme:E}=(await ss()).data,b=n.pathname.startsWith("/validation")?null:await e.getDynamicPage(encodeURIComponent("/products"));if(b){const{data:R}=b;_({...S,listings:R.listings})}else _({...S});if(w&&i){const R=i;if(w.settings?(Object.keys(w.settings).map(M=>{R[M]=w.settings[M]}),l(R)):l(i),w.header&&x){const M=x;Object.keys(w.header).map(U=>{M[U]=w.header[U]}),d(M)}if(w.footer&&c){const M=c;Object.keys(w.footer).map(U=>{M[U]=w.footer[U]}),j(M)}if(w.announcement&&m){const M=m;Object.keys(w.announcement).map(U=>{M[U]=w.announcement[U]}),p(M)}}else l(i);a(r),a(E||r),o(!1)};n.pathname.startsWith("/validation")||h(),C()},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s?e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})}):t})},sc=()=>(g.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})})),oc="_wrapper_rccv2_1",nc="_content_rccv2_11",rc="_title_rccv2_21",ot={wrapper:oc,content:nc,title:rc},ue=()=>{const t=e.useNavigate();return e.jsxRuntimeExports.jsx("div",{className:ot.wrapper,children:e.jsxRuntimeExports.jsxs("div",{className:ot.content,children:[e.jsxRuntimeExports.jsx("h1",{className:ot.title,children:"Something went wrong"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:()=>{t("/")},children:"Go to Home"})]})})},ic=t=>{const{blocks:n,settings:s,header:o,footer:a,announcement:r}=t,[i,l]=g.useState(null),{setBlocks:d,setSourceBlocks:j,setHeader:p,setFooter:x,setAnnouncement:c}=e.useBlocksStore(),{setSettings:m}=e.useSettingsStore(),{setHeader:v,setFooter:u,setAnnouncement:S}=e.useLayersStore(),{themeSettings:_}=e.useThemeSettingsStore(),{settings:f}=e.useSettingsStore(),h=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,C=localStorage.getItem("shopPassword"),w=localStorage.getItem("shopId")||"";return g.useEffect(()=>{if(!i){const E={};Object.keys(n).map(q=>{E[q]=n[q]}),j(E),d(E),p(o),x(a),c(r),m(s);const b=new o,R=new a,M=new r;v(b),u(R),S(M);const U=e.createBrowserRouter([{element:e.jsxRuntimeExports.jsx(e.hI,{shopDomain:h,shopId:w,shopPassword:C||void 0,routes:{Checkout:"/checkout",TopUp:"/top-up",Charge:"/charges",Order:"/orders",Subscription:"/subscriptions"},children:e.jsxRuntimeExports.jsx(tc,{children:e.jsxRuntimeExports.jsx(e.Outlet,{})})}),errorElement:e.jsxRuntimeExports.jsx(sc,{}),children:[{path:"/admin/builder/*",element:e.jsxRuntimeExports.jsx(ql,{children:e.jsxRuntimeExports.jsx(Hl,{blocks:n,settings:s,header:o,footer:a,announcement:r})}),errorElement:e.jsxRuntimeExports.jsx(zl,{}),loader:()=>(document.title="Builder",!0)},{path:"/checkout",element:e.jsxRuntimeExports.jsx(e.gI,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:e.jsxRuntimeExports.jsx(e.CI,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:e.jsxRuntimeExports.jsx(e._I,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(e.yI,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(e.xI,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Subscriptions",!0)},{path:"/customer-dash",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden"},children:[e.jsxRuntimeExports.jsx(Oe,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsxRuntimeExports.jsx(e.vI,{})}),e.jsxRuntimeExports.jsx(De,{})]}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Customer Dashboard",!0)},{path:"/validation",element:e.jsxRuntimeExports.jsx(ec,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden"},children:[e.jsxRuntimeExports.jsx(Oe,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsxRuntimeExports.jsx(e.q2,{children:e.jsxRuntimeExports.jsx(e.bI,{})})}),e.jsxRuntimeExports.jsx(De,{})]}),errorElement:e.jsxRuntimeExports.jsx(ue,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:e.jsxRuntimeExports.jsx(js,{}),errorElement:e.jsxRuntimeExports.jsx(ue,{})}]}]);l(U)}},[i]),g.useEffect(()=>{const E=Ss(_,f);Cs(_),fs(E)},[_,f]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:i&&e.jsxRuntimeExports.jsx(e.RouterProvider,{router:i})})};exports.ReCaptchaProvider=e.q2;exports.aspectRatioOptions=e.aspectRatioOptions;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useReCaptcha=e.bi;exports.App=ic;exports.ColorVariables=wt;exports.createTicket=Es;exports.hotReload=ks;exports.iconNames=Nt;
|
package/dist/builder.es.js
CHANGED
|
@@ -5291,14 +5291,13 @@ const ba = "_product_yggw5_1", Sa = "_name_yggw5_15", Kt = {
|
|
|
5291
5291
|
]
|
|
5292
5292
|
}, mc = () => {
|
|
5293
5293
|
const { activeBlock: t, setActiveColorCategory: s, activeColorCategory: o, themeSettings: n, updateColor: i } = X();
|
|
5294
|
-
if (!o) return null;
|
|
5295
5294
|
function a() {
|
|
5296
5295
|
s(null);
|
|
5297
5296
|
}
|
|
5298
5297
|
function r(h, m, c) {
|
|
5299
5298
|
i(h, m, c);
|
|
5300
5299
|
}
|
|
5301
|
-
const l = !!((t == null ? void 0 : t.name) === "Colors" && o), u = (t == null ? void 0 : t.name) !== "Colors" || !o, x = pc[o]
|
|
5300
|
+
const l = !!((t == null ? void 0 : t.name) === "Colors" && o), u = (t == null ? void 0 : t.name) !== "Colors" || !o, x = o ? pc[o] : [];
|
|
5302
5301
|
return /* @__PURE__ */ e.jsxs(
|
|
5303
5302
|
Ye,
|
|
5304
5303
|
{
|