@billgangcom/theme-lib 1.69.3 → 1.69.4
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Page } from '@builder/constants';
|
|
2
2
|
import { PageContext, TypeVariable } from '../../../../abstractions';
|
|
3
3
|
export declare function getValues(name: TypeVariable, blocks: Record<string, any>[]): any[];
|
|
4
|
-
export declare function getCount(name: TypeVariable, blocks: Record<string, any>[], pageContext: PageContext): number
|
|
4
|
+
export declare function getCount(name: TypeVariable, blocks: Record<string, any>[], pageContext: PageContext): number;
|
|
5
5
|
export declare function getBoolean(name: TypeVariable, blocks: Record<string, any>[]): boolean;
|
|
6
6
|
export declare function getPage(path: string, pages: Record<string, Page>): Page | null;
|
package/dist/builder.cjs.js
CHANGED
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
`,s+=` --border-sm: var(--scale-1);
|
|
105
105
|
`,s+=` --border-md: var(--scale-2);
|
|
106
106
|
`,s+=` --border-lg: var(--scale-4);
|
|
107
|
-
`,s+="}",s},xu=e=>{const n=document.getElementById("dynamic-styles");if(n)n.innerHTML=e;else{const s=document.createElement("style");s.id="dynamic-styles",s.innerHTML=e,document.head.appendChild(s)}},zs=new Set,hu=e=>{const n=new Map;return Object.entries(e).forEach(([s,r])=>{typeof r=="object"&&Object.entries(r).forEach(([o,i])=>{var a,l;if(i&&i.font){const c=i.font.replace(/\s+/g,"+");n.has(c)||n.set(c,new Set),(a=n.get(c))==null||a.add(i.weight),(l=n.get(c))==null||l.add(i.boldWeight)}})}),n},fu=e=>{const n=new Map;return Object.entries(e).forEach(([s,r])=>{typeof r=="object"&&Object.keys(r).forEach(o=>{var i;if(o==="font"&&r[o]){const a=r[o].replace(/\s+/g,"+");n.has(a)||n.set(a,new Set),(i=n.get(a))==null||i.add("400")}})}),n},gu=e=>{zs.forEach(n=>{if(!e.has(n)){const s=document.querySelector(`link[data-font="${n}"]`);s&&s.remove(),zs.delete(n)}})},ju=e=>{const n=new Set;e.forEach((s,r)=>{const o=Array.from(s).join(";"),i=`${r}:wght@${o}`;if(n.add(i),!zs.has(i)){const a=document.createElement("link");a.rel="stylesheet",a.href=`https://fonts.googleapis.com/css2?family=${i}&display=swap`,a.setAttribute("data-font",i),document.head.appendChild(a),zs.add(i)}}),gu(n)},yu=e=>{if(e.fonts){const n=hu(e.fonts.desktop),s=fu(e.buttons),r=new Map(n);s.forEach((o,i)=>{if(r.has(i)){const a=r.get(i);o.forEach(l=>a==null?void 0:a.add(l))}else r.set(i,new Set(o))}),ju(r)}};function Cu(){try{const{editBlock:e,currentBlock:n,blocks:s,setHeader:r,setFooter:o,setAnnouncement:i}=t.useLayersStore.getState(),{currentPage:a,pages:l}=t.usePagesStore.getState(),{currentInstance:c,settingsInstance:d}=t.useBlocksStore.getState(),{setSettings:u}=t.useSettingsStore.getState();if(n||u(d),c&&n){if(n==="header")r(c);else if(n==="footer")o(c);else if(n==="announcement")i(c);else if(n==="header"||n==="footer"||n==="announcement")throw new Error(`Missing ${n} data.`)}if(c&&l&&n&&!["header","footer","announcement"].includes(n)){const p={blockSettings:{}};if(!c.blockSettings)throw new Error("currentInstance.blockSettings is undefined.");if(Object.keys(c.blockSettings).filter(m=>!["displayName","isAddable"].includes(m)).forEach(m=>{p.blockSettings[m]=c.blockSettings[m]}),!l[a])throw new Error(`Page "${a}" does not exist.`);if(!s[l[a].path].data||!s[l[a].path].data[n])throw new Error(`Layer or block for page "${l[a].path}" and block "${n}" does not exist.`);e(l[a].path,n,{name:s[l[a].path].data[n].name,value:p})}}catch(e){console.error("Error in hotReload function:",e)}}async function _u(e,n,s,r){const o=t.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,i=`${t.SL_API_URL}/v1/public/${o}/tickets`,{notifications:a,setNotifications:l}=t.useNotificationStore.getState();try{const c=await t.request({method:"post",url:i,body:{title:e,firstMessage:n,email:r,recaptcha:s},withToken:!1});return l([...a,{id:t.v4(),message:"Ticket created successfully. We will contact you by mail",status:"success"}]),c}catch(c){l([...a,{id:t.v4(),message:`Error: ${c}. Please try again later.`,status:"error"}])}}const Eu="_tooltip_4hruj_1",vu={tooltip:Eu},Tn=e=>{const{text:n}=e,{setShowTooltip:s}=t.useTooltipStore();return y.useEffect(()=>(s(!0),()=>{s(!1)}),[]),t.jsxRuntimeExports.jsx("div",{className:vu.tooltip,children:n})},Ru=()=>{const{undo:e,redo:n,past:s,future:r}=t.useHistoryStore(),[o,i]=y.useState(!1),[a,l]=y.useState(!1),[c,d]=y.useState(!1),[u,p]=y.useState(!1),[m,x]=y.useState(null),{notifications:g,setNotifications:h}=t.useNotificationStore();return y.useEffect(()=>{i(s.length===0)},[s]),y.useEffect(()=>{l(r.length===0)},[r]),t.jsxRuntimeExports.jsxs("div",{className:$n.buttons,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx($n.button,{[$n.disabled]:o}),onMouseEnter:()=>{const v=setTimeout(()=>{p(!0),d(!1)},200);x(v)},onMouseLeave:()=>{m&&clearTimeout(m),p(!1),d(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{o||(e(),h([...g,{id:t.v4(),message:"Changes undone",status:"success"}]))},fill:o?"#757575":"#252525"}),u&&t.jsxRuntimeExports.jsx(Tn,{text:o?"Nothing to undo":"Click to undo changes"})]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx($n.button,{[$n.disabled]:a}),onMouseEnter:()=>{const v=setTimeout(()=>{d(!0),p(!1)},200);x(v)},onMouseLeave:()=>{m&&clearTimeout(m),d(!1),p(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||(n(),h([...g,{id:t.v4(),message:"Changes redone",status:"success"}]))},fill:a?"#757575":"#252525"}),c&&t.jsxRuntimeExports.jsx(Tn,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},wu="_devices_ls6k9_1",bu="_device_ls6k9_1",Su="_active_ls6k9_27",Fr={devices:wu,device:bu,active:Su},ku=()=>t.jsxRuntimeExports.jsx("div",{className:Fr.devices,children:ic.map(e=>t.jsxRuntimeExports.jsx(Nu,{device:e}))}),Nu=e=>{const{device:n}=e,{currentDevice:s,setCurrentDevice:r}=t.useDeviceStore(),[o,i]=y.useState(!1),[a,l]=y.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:t.clx(Fr.device,{[Fr.active]:s.value===n.value}),onClick:()=>r(n),onMouseEnter:()=>{const c=setTimeout(()=>{i(!0)},200);l(c)},onMouseLeave:()=>{a&&clearTimeout(a),i(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:n.icon,fill:s.value===n.value?"#252525":"#757575",width:20,height:20}),o&&t.jsxRuntimeExports.jsx(Tn,{text:`Switch to ${n.value} view`})]},n.value)},Iu="_preview_1x3m8_2",Tu="_active_1x3m8_19",cr={preview:Iu,active:Tu},Lu=()=>{const{onPreview:e}=t.usePreviewStore(),[n,s]=y.useState(!1),[r,o]=y.useState(null);return t.jsxRuntimeExports.jsxs("a",{href:"/",className:t.clx(cr.preview,{[cr.active]:e}),target:"_blank",onMouseEnter:()=>{const i=setTimeout(()=>{s(!0)},200);o(i)},onMouseLeave:()=>{r&&clearTimeout(r),s(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUpRight",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:cr.text,children:"Preview"}),n&&t.jsxRuntimeExports.jsx(Tn,{text:"Open draft theme in new tab"})]})},Pu="_settings_u4cv4_1",Mu={settings:Pu},Au="_pages_167qp_1",Bu="_text_167qp_21",$u="_modal_167qp_27",Du="_open_167qp_46",Ou="_page_167qp_1",Hu="_hoverable_167qp_61",Vu="_separator_167qp_65",Fu="_button_167qp_70",Zu="_items_167qp_85",yt={pages:Au,default:"_default_167qp_5",text:Bu,modal:$u,open:Du,page:Ou,hoverable:Hu,separator:Vu,button:Fu,items:Zu},Nt=e=>e?e.replace(/_/g," ").split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" and "):"";function Sn(e,n){if(!n||!n[e])return"unknown name";const s=new n[e];return!s.blockSettings||!s.blockSettings.displayName?"unknown name":s.blockSettings.displayName}const aa=(e,n,s,r,o,i,a)=>{const l=e.currentTarget.getBoundingClientRect(),c=window.innerHeight-l.bottom,d=l.top,u=window.innerWidth-l.right,p=l.left;let m,x;return m=l.bottom+r+window.scrollY,x=l.left,(c<n||c<o)&&(d>=n+a?m=l.top-n-r+window.scrollY:m=window.scrollY+a),m-window.scrollY<a&&(m=window.scrollY+a),(u<s||u<i)&&(p>=s?x=l.right-s:x=(window.innerWidth-s)/2),x<l.right+i&&(x=l.right+i),x<l.right&&x+s>l.left&&m<l.bottom&&m+n>l.top&&(u>=s+i?x=l.right+r+i:c>=n?m=l.bottom+r+window.scrollY:(m=window.scrollY+a,x=(window.innerWidth-s)/2)),{top:m,left:x}},la=async e=>{const n=localStorage.getItem("shopId")||void 0,s=localStorage.getItem("draftId"),r=`${t.API_URL}/v2/builder/shops/${n}/drafts/${s}/pages/${encodeURIComponent(e)}`;return await t.request({url:r,withToken:!0,method:"delete"})},zu=()=>{const{currentPage:e,setCurrentPage:n,setIsOpenModal:s,pages:r,setIsEdit:o,setEditedPage:i,deletePage:a,setIsOpenSelectModal:l}=t.usePagesStore(),{deletePage:c,setCurrentBlock:d}=t.useLayersStore(),[u,p]=y.useState(null),{setTitle:m,setDescription:x,setOnConfirm:g}=t.useConfirmationModalStore(),[h,v]=y.useState(!1),j=y.useRef(null);return t.useOnClickOutside(j,()=>{h&&v(!1)}),y.useEffect(()=>{h?l(!0):setTimeout(()=>{l(!1)},300)},[h]),t.jsxRuntimeExports.jsxs("div",{className:yt.pages,ref:j,children:[t.jsxRuntimeExports.jsxs("div",{className:yt.default,onClick:w=>{w.stopPropagation(),v(_=>!_)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:r&&r[e]&&r[e].icon||"File",fill:"#252525",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:yt.text,children:r&&r[e]&&t.defaultPagePaths.includes(r[e].path)?`${Nt(r[e].name)} page`:r&&r[e]&&r[e].name}),t.jsxRuntimeExports.jsx("div",{style:{transform:h?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease",display:"flex"},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:20,height:20})})]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(yt.modal,{[yt.open]:h}),onClick:w=>w.stopPropagation(),children:[r&&t.jsxRuntimeExports.jsx("div",{className:yt.items,children:Object.keys(r).map(w=>{const _=r[w];return t.jsxRuntimeExports.jsxs("div",{className:t.clx(yt.page,{[yt.hoverable]:u===w}),onMouseEnter:()=>p(w),onMouseLeave:()=>p(null),onClick:()=>{p(null),o(!1),d(null),n(w),v(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:_.icon,fill:"#252525"}),t.jsxRuntimeExports.jsx("span",{className:yt.text,children:t.defaultPagePaths.includes(_.path)?`${Nt(_.name)} page`:_.name}),u===w&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Gear",fill:"#757575",onClick:b=>{b.stopPropagation(),o(!0),i(w),s(!0)}}),!t.defaultPagePaths.includes(_.path)&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",fill:"#C12A2A",onClick:b=>{b.stopPropagation(),m("Delete Page"),x(`Are you sure you want to delete ${_.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),g(()=>{b.stopPropagation(),r[e].path===_.path&&n(Object.keys(r)[0]),a(w),c(_.name),la(_.path)})}})]}),r[e]&&r[e].name===_.name&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Check",fill:"#FF3F19"})]},w)})}),t.jsxRuntimeExports.jsx("div",{className:yt.separator}),t.jsxRuntimeExports.jsxs(t.Button,{className:yt.button,onClick:w=>{w.stopPropagation(),s(!0)},size:"l",children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#ff3f19"}),t.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},Uu="_zoom_fu0hj_1",Ao={zoom:Uu},Wu=()=>{const{zoomLevel:e,setZoomLevel:n}=t.usePreviewStore();return t.jsxRuntimeExports.jsxs("label",{htmlFor:"zoom",className:Ao.zoom,children:[t.jsxRuntimeExports.jsx("label",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},htmlFor:"zoom",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlassMinus",width:20,height:20})}),t.jsxRuntimeExports.jsx("input",{id:"zoom",type:"number",min:25,max:250,value:(e*100).toFixed(0),onChange:s=>{const r=Number(s.target.value);n(r/100)},className:Ao.input}),t.jsxRuntimeExports.jsx("span",{children:"%"})]})},qu=()=>t.jsxRuntimeExports.jsxs("div",{className:Mu.settings,children:[t.jsxRuntimeExports.jsx(zu,{}),t.jsxRuntimeExports.jsx(Wu,{})]}),Gu="_theme_1e5wq_1",Yu="_text_1e5wq_13",Bo={theme:Gu,text:Yu},Xu=()=>t.jsxRuntimeExports.jsx("div",{className:Bo.theme,children:t.jsxRuntimeExports.jsx("div",{className:Bo.text,children:"Live Theme"})}),Ku=async(e,n,s)=>{const r=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${t.API_URL}/v2/builder/shops/${r}/drafts/${o}/${n}`;return await t.request({url:i,withToken:!0,method:e,body:s})};function Dn(e,n){try{return n.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(i=>i&&i.type===e).map(i=>{if(i.value===void 0)throw new Error("item.value is undefined.");return i.value}).flat()}).flat().filter(r=>r).map(r=>e==="ListingIds"?r.listingId:r)}catch(s){return console.error("Error in getValues function:",s),[]}}function Ju(e,n,s){return Qu(e,n)?s.reviews.length*3:0}function Qu(e,n){return n.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(i=>i&&i.type===e).map(i=>{if(i.value===void 0)throw new Error("item.value is undefined.");return i.value}).flat()}).flat().filter(r=>r).length>0}function e1(e,n){if(n){const s=Object.keys(n).find(r=>n[r].path===e);if(s)return n[s]}return null}const t1=({setIsLoading:e,isLoading:n})=>{const{themeSettings:s}=t.useThemeSettingsStore(),{settings:r}=t.useSettingsStore(),[o,i]=y.useState(null),[a,l]=y.useState(!1),{setNotifications:c,notifications:d}=t.useNotificationStore(),{header:u,footer:p,announcement:m,blocks:x}=t.useLayersStore(),{pageContext:g}=t.usePagesStore(),{pages:h}=t.usePagesStore(),v=async()=>{if(a)o&&clearTimeout(o);else{e(!0);const w=Object.keys(x).map(E=>{const R=e1(E,h);return x[E]&&x[E].data&&(R!=null&&R.path)?{id:R?R.id:E,name:R?R.name:E,path:R.path,layout:{...x[E]},neededProductIds:[...Dn("ProductId",Object.values(x[E].data))],neededCategoryIds:[...Dn("CategoryId",Object.values(x[E].data))],neededAnnouncementIds:[...Dn("AnnouncementId",Object.values(x[E].data))],neededListingIds:[...Dn("ListingIds",Object.values(x[E].data))],neededFaqIds:[...Dn("FaqsIds",Object.values(x[E].data))],neededReviewCount:Ju("ReviewCount",Object.values(x[E].data),g),seo:{pageTitle:R&&R.seo&&R.seo.pageTitle?R.seo.pageTitle:"",pageDescription:R&&R.seo&&R.seo.pageDescription?R.seo.pageDescription:""},isPrivate:!!(R&&R.visibility==="private")}:null}).filter(E=>E),_={settings:{maxStoreWidth:r==null?void 0:r.blockSettings.maxStoreWidth},header:u,footer:p,announcement:m},{status:b}=await Ku("post","save",{themeSettings:s,settings:_,updatedPages:w});c([...d,{id:t.v4(),message:b===200?"Settings saved":"Error",status:b===200?"success":"error"}]),e(!1)}l(!0);const j=setTimeout(()=>{l(!1)},2e3);i(j)};return t.jsxRuntimeExports.jsx(t.Button,{onClick:v,disabled:n,children:t.jsxRuntimeExports.jsx("span",{style:{userSelect:"none"},children:"Save"})})},n1=()=>{const{isOpenSelectModal:e}=t.usePagesStore(),[n,s]=y.useState(!1),{showTooltip:r}=t.useTooltipStore();return t.jsxRuntimeExports.jsxs("div",{className:ps.header,style:{zIndex:e?5e4:r?501:50},children:[t.jsxRuntimeExports.jsxs("div",{className:ps.left,children:[t.jsxRuntimeExports.jsx(ku,{}),t.jsxRuntimeExports.jsx(Lu,{})]}),t.jsxRuntimeExports.jsx("div",{className:ps.center,children:t.jsxRuntimeExports.jsx(qu,{})}),t.jsxRuntimeExports.jsxs("div",{className:ps.right,children:[t.jsxRuntimeExports.jsx(Xu,{}),t.jsxRuntimeExports.jsx(Ru,{}),t.jsxRuntimeExports.jsx(t1,{setIsLoading:s,isLoading:n}),n&&t.jsxRuntimeExports.jsx(rn,{})]})]})},s1="_exit_ovvox_1",r1="_text_ovvox_11",o1="_exitLink_ovvox_16",ur={exit:s1,text:r1,exitLink:o1},i1=()=>t.jsxRuntimeExports.jsx("div",{className:ur.exit,children:t.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:ur.exitLink,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"SignOut",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:ur.text,children:"Exit"})]})}),a1="_navbar_1podc_1",l1="_main_1podc_6",c1="_block_1podc_13",u1="_active_1podc_29",ms={navbar:a1,main:l1,block:c1,active:u1},d1=()=>{const{activeBlock:e}=t.useNavbarStore(),{setActiveBlock:n}=t.useBlocksStore(),{setCurrentBlock:s}=t.useLayersStore(),{setActiveBlock:r}=t.useThemeSettingsStore(),{setActiveBlock:o}=t.usePreviewStore(),i=t.useNavigate();function a(l){switch(n(null),s(null),r(null),o({id:null,neededScroll:!1}),l.name){case"Layers":i("/admin/builder");break;case"Add":i("/admin/builder/add");break;case"Theme":i("/admin/builder/theme");break;case"Settings":i("/admin/builder/settings");break}}return t.jsxRuntimeExports.jsxs("div",{className:ms.navbar,children:[t.jsxRuntimeExports.jsx(i1,{}),t.jsxRuntimeExports.jsx("div",{className:ms.main,children:t.navbarBlocks.map(l=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(ms.block,{[ms.active]:e.icon===l.icon}),onClick:()=>a(l),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:l.icon,fill:e.icon===l.icon?"#252525":"#757575"}),t.jsxRuntimeExports.jsx("span",{children:l.name})]},l.icon))})]})},p1="_preview_gb2ye_1",m1="_main_gb2ye_15",x1="_content_gb2ye_25",h1="_loading_gb2ye_34",f1="_previewLoading_gb2ye_65",On={preview:p1,main:m1,content:x1,loading:h1,previewLoading:f1},g1="_header_11zku_2",j1="_circles_11zku_16",y1="_circle_11zku_16",C1="_red_11zku_32",_1="_green_11zku_36",E1="_yellow_11zku_40",v1="_input_11zku_44",R1="_main_11zku_55",w1="_text_11zku_63",b1="_copy_11zku_75",It={header:g1,circles:j1,circle:y1,red:C1,green:_1,yellow:E1,input:v1,main:R1,text:w1,copy:b1},S1=["red","yellow","green"],k1=()=>{const{currentDevice:e}=t.useDeviceStore(),n=(o,i)=>o.length>i?o.slice(0,i)+"...":o,{notifications:s,setNotifications:r}=t.useNotificationStore();return t.jsxRuntimeExports.jsxs("div",{className:It.header,children:[t.jsxRuntimeExports.jsx("div",{className:It.circles,children:S1.map(o=>t.jsxRuntimeExports.jsx("div",{className:t.clx(It.circle,{[It.red]:o==="red",[It.yellow]:o==="yellow",[It.green]:o==="green"})},o))}),t.jsxRuntimeExports.jsx("div",{className:It.input,children:t.jsxRuntimeExports.jsxs("div",{className:It.main,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),t.jsxRuntimeExports.jsx("span",{className:It.text,children:e.value==="mobile"?n(window.location.origin,35):e.value==="desktop"?n(window.location.origin,200):n(window.location.origin,100)})]})}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),r([...s,{id:t.v4(),status:"success",message:"Domain copied to clipboard"}])},className:It.copy,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy",width:20,height:20,fill:"#252525"})})]})},N1="_content_o1u9i_1",I1="_main_o1u9i_11",T1="_block_o1u9i_15",L1="_active_o1u9i_21",P1="_name_o1u9i_31",M1="_addSection_o1u9i_108",A1="_addSectionTop_o1u9i_116",Gt={content:N1,main:I1,block:T1,active:L1,name:P1,addSection:M1,addSectionTop:A1},B1="_sidebar_xhqpt_1",$1="_content_xhqpt_14",D1="_button_xhqpt_24",O1="_moveButton_xhqpt_40",H1="_deleteButton_xhqpt_49",Tt={sidebar:B1,content:$1,button:D1,moveButton:O1,deleteButton:H1},V1=()=>{var E;const{activeBlock:e,setActiveBlock:n}=t.usePreviewStore(),{blocks:s,removeBlock:r,moveBlock:o,duplicateBlock:i,setCurrentBlock:a}=t.useLayersStore(),{currentPage:l,pages:c}=t.usePagesStore(),{setTitle:d,setDescription:u,setOnConfirm:p}=t.useConfirmationModalStore(),{setActiveBlock:m}=t.useBlocksStore(),x=(E=c==null?void 0:c[l])==null?void 0:E.path,g=x?s[x]:null,h=(g==null?void 0:g.order)||[],v=h.indexOf(e.id),j=R=>{R.stopPropagation(),v>0&&x&&(o(x,v,v-1),n({id:e.id,neededScroll:!0}),setTimeout(()=>{n({id:e.id,neededScroll:!1})},100))},w=R=>{R.stopPropagation(),v<h.length-1&&x&&(o(x,v,v+1),n({id:e.id,neededScroll:!0}),setTimeout(()=>{n({id:e.id,neededScroll:!1})},100))},_=R=>{R.stopPropagation(),x&&i(x,e.id)},b=()=>{x&&(r(x,e.id),a(null),m(null),n({id:null,neededScroll:!1}))};return t.jsxRuntimeExports.jsx("div",{className:Tt.sidebar,children:t.jsxRuntimeExports.jsxs("div",{className:Tt.content,children:[t.jsxRuntimeExports.jsx("button",{onClick:j,className:t.clx(Tt.button,Tt.moveButton),disabled:v===0,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUp"})}),t.jsxRuntimeExports.jsx("button",{onClick:w,className:t.clx(Tt.button,Tt.moveButton),disabled:v===h.length-1,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowDown"})}),t.jsxRuntimeExports.jsx("button",{onClick:_,className:t.clx(Tt.button,Tt.moveButton),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})}),t.jsxRuntimeExports.jsx("button",{className:t.clx(Tt.button,Tt.deleteButton),onClick:R=>{R.stopPropagation(),d("Remove Block"),u(`Are you sure you want to delete ${(g==null?void 0:g.data[e.id].name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),p(b)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]})})},F1=y.memo(({scrollableRef:e})=>{const{setActiveBlock:n,activeBlock:s,zoomLevel:r}=t.usePreviewStore(),{blocks:o,sourceBlocks:i}=t.useBlocksStore(),{blocks:a,setCurrentBlock:l,currentBlock:c,setPositionBlock:d,announcement:u}=t.useLayersStore(),{settings:p}=t.useSettingsStore(),{currentPage:m,pages:x,pageContext:g}=t.usePagesStore(),{activeBlock:h,setActiveBlock:v}=t.useThemeSettingsStore(),{setError:j}=t.useErrorStore(),{setActiveBlock:w}=t.useBlocksStore(),_=y.useRef(s.id),b=y.useRef({});y.useEffect(()=>{if(s.id&&s.neededScroll&&b.current[s.id]){const S=b.current[s.id];if(S&&e.current){const k=S.offsetTop;e.current.scrollTo({top:k-30,behavior:"smooth"})}}},[s,e]);const E=t.useNavigate();y.useEffect(()=>{_.current=s.id},[s.id]);const R=S=>{if(!S||!S.name)return j({message:"Block or block.name is undefined.",failedSettings:!1,failedThemeSettings:!1,failedPageIds:x&&x[m].id?[x[m].id]:[]}),t.jsxRuntimeExports.jsx(In,{error:"Block or block.name is undefined."});if(!o||!o[S.name])return j({message:'Block "${block.name}" does not exist in blocks.',failedSettings:!1,failedThemeSettings:!1,failedPageIds:x&&x[m].id?[x[m].id]:[]}),t.jsxRuntimeExports.jsx(In,{error:`Block "${S.name}" does not exist in blocks.`});const k=new o[S.name];return S.value&&Object.assign(k,S.value),k.renderBlock(p==null?void 0:p.blockSettings,g)};return t.jsxRuntimeExports.jsxs("div",{onClick:S=>{S.stopPropagation()},className:Gt.content,style:{width:"100%",height:"100%",zoom:`${r}`},ref:e,children:[u&&t.jsxRuntimeExports.jsx(oa,{}),t.jsxRuntimeExports.jsx(Zs,{}),t.jsxRuntimeExports.jsx("div",{className:Gt.main,children:x&&x[m]&&a[x[m].path]&&a[x[m].path].data&&a[x[m].path].order.map(S=>t.jsxRuntimeExports.jsxs("div",{ref:k=>b.current[S]=k,onClick:k=>{k.stopPropagation(),w(null),h&&v(null),n({id:S,neededScroll:!0}),setTimeout(()=>{n({id:S,neededScroll:!1})},100),l(null),c?setTimeout(()=>{l(s.id)},100):l(s.id)},onMouseEnter:k=>{k.stopPropagation(),s.neededScroll||n({id:S,neededScroll:!1})},onMouseLeave:k=>{k.stopPropagation(),s.neededScroll||n({id:null,neededScroll:!1})},className:t.clx(Gt.block),children:[(s.id===S||c===S)&&t.jsxRuntimeExports.jsx("div",{className:Gt.active}),(s.id===S||c===S)&&t.jsxRuntimeExports.jsx("div",{className:Gt.name,children:Sn(a[x[m].path].data[S].name,i)}),(s.id===S||c===S)&&Sn(a[x[m].path].data[S].name,i)!=="unknown name"&&t.jsxRuntimeExports.jsx(V1,{}),(s.id===S||c===S)&&Sn(a[x[m].path].data[S].name,i)!=="unknown name"&&t.jsxRuntimeExports.jsx("div",{className:Gt.addSection,children:t.jsxRuntimeExports.jsx(t.Button,{onClick:k=>{k.stopPropagation(),d(S,!0),l(null),n({id:null,neededScroll:!1}),w(null),E("/admin/builder/add")},children:"Add Section"})}),(s.id===S||c===S)&&Sn(a[x[m].path].data[S].name,i)!=="unknown name"&&t.jsxRuntimeExports.jsx("div",{className:t.clx(Gt.addSection,Gt.addSectionTop),children:t.jsxRuntimeExports.jsx(t.Button,{onClick:k=>{k.stopPropagation(),d(S,!1),l(null),n({id:null,neededScroll:!1}),w(null),E("/admin/builder/add")},children:"Add Section"})}),o&&t.jsxRuntimeExports.jsx(lo,{render:R,block:a[x[m].path].data[S]})]},S))}),t.jsxRuntimeExports.jsx(Fs,{})]})}),Z1="_results_1pahy_1",$o={results:Z1};function z1(e,n){return n?new n[e]().blockSettings.isAddable:!1}function U1(e,n){return e?Object.keys(e||{}).reduce((s,r)=>(z1(r,n)&&s.push(r),s),[]):[]}const W1="_product_yggw5_1",q1="_name_yggw5_15",Do={product:W1,name:q1},G1=e=>{const{blockId:n,setSearchValue:s}=e,{sourceBlocks:r,setActiveBlock:o}=t.useBlocksStore(),{hideModal:i,hoverBlockId:a,isModalVisible:l,showPreview:c,hidePreview:d,clearHideTimeout:u,startHideTimeout:p,setHoverBlockTopPosition:m}=t.useSubmodalStore();function x(v){s(""),o(v),i("keyBlock")}function g(v,j){const w=window.innerHeight,_=400,b=10;let E=j.clientY-120;E+_>w&&(E=w-_-b),E<b&&(E=b),a||i("keyBlock"),c(v,"keyBlock"),u(),m(E)}function h(){l?p("keyBlock"):d("keyBlock"),m(null)}return t.jsxRuntimeExports.jsxs("div",{className:Do.product,onClick:()=>x(n),onMouseEnter:v=>g(n,v),onMouseLeave:h,children:[Qn[n]?t.jsxRuntimeExports.jsx("img",{src:Qn[n]}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Cards"}),t.jsxRuntimeExports.jsx("span",{className:Do.name,children:Sn(n,r)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretRight",width:20,height:20})]},n)},ca=()=>{const{blocks:e,sourceBlocks:n}=t.useBlocksStore(),[s,r]=y.useState(""),[o,i]=y.useState([]),a=y.useMemo(()=>U1(e,n),[e]),l=y.useMemo(()=>new t.Fuse(a,{keys:["name"],threshold:.4}),[a]);return y.useEffect(()=>{if(s.trim()==="")i(a);else{const c=l.search(s);i(c.map(d=>d.item))}},[s,l]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:r,value:s,style:{marginBottom:10}}),t.jsxRuntimeExports.jsx("div",{className:$o.results,children:o.length>0?o.map(c=>t.jsxRuntimeExports.jsx(G1,{blockId:c,setSearchValue:r})):t.jsxRuntimeExports.jsx("div",{className:$o.noResults,children:"No sections found"})})]})},Y1="_wrapper_1k1cr_1",X1="_submodal_1k1cr_14",Zr={wrapper:Y1,submodal:X1},K1=({children:e,positionTop:n,positionLeft:s})=>{const{keyBlock:r,startHideTimeout:o,clearHideTimeout:i,setMouseOverModal:a}=t.useSubmodalStore();return r?t.jsxRuntimeExports.jsx("div",{className:Zr.wrapper,style:n?{top:n,left:s||void 0}:{},onMouseEnter:()=>{i(),a(!0)},onMouseLeave:()=>{a(!1),o()},children:e}):null},J1=({children:e})=>{const{hoverBlockId:n,startHideTimeout:s,clearHideTimeout:r,setMouseOverModal:o}=t.useSubmodalStore();return n?t.jsxRuntimeExports.jsx("div",{className:t.clx(Zr.wrapper,Zr.submodal),onMouseEnter:()=>{r(),o(!0)},onMouseLeave:()=>{o(!1),s()},children:e}):null},Q1="_applyButton_1a9kh_2",ed="_content_1a9kh_7",td="_title_1a9kh_14",nd="_label_1a9kh_21",sd="_colorValue_1a9kh_40",rd="_colorMap_1a9kh_48",od="_indicator_1a9kh_57",id="_hueSlider_1a9kh_66",ad="_slider_1a9kh_97",ld="_buttons_1a9kh_102",cd="_name_1a9kh_109",ud="_secondary_1a9kh_114",dd="_input_1a9kh_122",pd="_modal_1a9kh_160",md="_alphaSlider_1a9kh_249",xd="_alphaBackground_1a9kh_257",hd="_alphaGradient_1a9kh_268",fd="_chargeTypes_1a9kh_297",gd="_charge_1a9kh_297",jd="_chargeActive_1a9kh_326",yd="_gradient_1a9kh_334",Cd="_color_1a9kh_40",_d="_colorActive_1a9kh_355",Ed="_gradientWrapper_1a9kh_362",vd="_subtitle_1a9kh_368",Rd="_colorTypes_1a9kh_375",wd="_colorType_1a9kh_375",bd="_colorTypeActive_1a9kh_399",Sd="_colorsWrapper_1a9kh_404",kd="_colors_1a9kh_404",me={applyButton:Q1,content:ed,title:td,label:nd,colorValue:sd,colorMap:rd,indicator:od,hueSlider:id,slider:ad,buttons:ld,name:cd,secondary:ud,input:dd,modal:pd,alphaSlider:md,alphaBackground:xd,alphaGradient:hd,chargeTypes:fd,charge:gd,chargeActive:jd,gradient:yd,color:Cd,colorActive:_d,gradientWrapper:Ed,subtitle:vd,colorTypes:Rd,colorType:wd,colorTypeActive:bd,colorsWrapper:Sd,colors:kd},Nd=()=>{const{modalPosition:e,color:n,initialColor:s,setShowModal:r,hue:o,saturation:i,brightness:a,alpha:l,dragging:c,setDragging:d,setHue:u,setSaturation:p,setBrightness:m,setAlpha:x,colorChange:g,setColor:h,update:v,isGradient:j,setIsGradient:w,gradientDirection:_,setGradientDirection:b,hue2:E,saturation2:R,brightness2:S,alpha2:k,setHue2:M,setSaturation2:A,setBrightness2:L,setAlpha2:I,activeColorIndex:T,setActiveColorIndex:V,isGradientActive:Z}=t.useColorPickerStore(),U=(K,Y,ue)=>{Y/=100,ue/=100;const G=ye=>(ye+K/60)%6,ne=ye=>ue*(1-Y*Math.max(0,Math.min(G(ye),4-G(ye),1))),le=Math.round(255*ne(5)),de=Math.round(255*ne(3)),je=Math.round(255*ne(1));return{r:le,g:de,b:je}},z=K=>K.toString(16).padStart(2,"0"),W=(K,Y,ue,G)=>{const{r:ne,g:le,b:de}=U(K,Y,ue),je=Math.round(G/100*255);return`#${z(ne)}${z(le)}${z(de)}${z(je)}`},ee=(K,Y,ue,G)=>{if(j)if(T===1){u(K),p(Y),m(ue),x(G);const ne=W(K,Y,ue,G),le=W(E,R,S,k),je=`linear-gradient(${_==="vertical"?"0deg":"90deg"}, ${ne} 0%, ${le} 100%)`;g(je),h(je)}else{M(K),A(Y),L(ue),I(G);const ne=W(K,Y,ue,G),le=W(o,i,a,l),je=`linear-gradient(${_==="vertical"?"0deg":"90deg"}, ${le} 0%, ${ne} 100%)`;g(je),h(je)}else{const ne=W(K,Y,ue,G);g(ne),h(ne)}},f=(K,Y,ue)=>{const{width:G,height:ne}=ue.getBoundingClientRect(),le=Math.max(0,Math.min(K/G*100,100)),de=Math.max(0,Math.min(100-Y/ne*100,100));j?T===1?(p(le),m(de),ee(o,le,de,l)):(A(le),L(de),ee(E,le,de,k)):(p(le),m(de),ee(o,le,de,l))},P=K=>{const{offsetX:Y,offsetY:ue}=K.nativeEvent;d(!0),f(Y,ue,K.currentTarget)},q=K=>{if(c){const Y=document.querySelector(`.${me.colorMap}`),{left:ue,top:G}=Y.getBoundingClientRect(),ne=K.clientX-ue,le=K.clientY-G;f(ne,le,Y)}},C=()=>{d(!1)};y.useEffect(()=>{function K(G){const ne=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,le=G.match(ne);if(le){const de=le[1],je=le[2],ye=le[3];return{angle:de,col1:je,col2:ye}}return null}function Y(G){const ne=parseInt(G.slice(1,3),16),le=parseInt(G.slice(3,5),16),de=parseInt(G.slice(5,7),16),je=parseInt(G.slice(7,9),16)/255*100,{h:ye,s:$e,b:N}=ue(ne,le,de);return{h:ye,s:$e,b:N,a:je}}function ue(G,ne,le){G/=255,ne/=255,le/=255;const de=Math.max(G,ne,le),je=Math.min(G,ne,le);let ye=0;const $e=de-je,N=(de===0?0:$e/de)*100,D=de*100;if(de===je)ye=0;else switch(de){case G:ye=((ne-le)/$e+(ne<le?6:0))*60;break;case ne:ye=((le-G)/$e+2)*60;break;case le:ye=((G-ne)/$e+4)*60;break}return{h:ye,s:N,b:D}}if(s&&s.startsWith("linear-gradient")){const G=K(s);if(G){const{angle:ne,col1:le,col2:de}=G,je=Y(le),ye=Y(de);w(!0),b(ne==="0deg"?"vertical":"horizontal"),u(je.h),p(je.s),m(je.b),x(je.a),M(ye.h),A(ye.s),L(ye.b),I(ye.a),V(1)}}else if(s){const ne=function(de){let je=de;return je.length===7&&(je=je+"ff"),je}(s),le=Y(ne);w(!1),u(le.h),p(le.s),m(le.b),x(le.a)}},[s,w,b,u,p,m,x,M,A,L,I,V]),y.useEffect(()=>{let K,Y,ue,G;j?T===1?(K=o,Y=i,ue=a,G=l):(K=E,Y=R,ue=S,G=k):(K=o,Y=i,ue=a,G=l),ee(K,Y,ue,G)},[j,_,T,o,i,a,l,E,R,S,k]),y.useEffect(()=>{const K=ue=>q(ue),Y=()=>C();return c?(document.addEventListener("mousemove",K),document.addEventListener("mouseup",Y)):(document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",Y)),()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",Y)}},[c,j,_]);function O(){if(!j)v(n);else{const K=W(o,i,a,l),Y=W(E,R,S,k),G=`linear-gradient(${_==="vertical"?"0deg":"90deg"}, ${K} 0%, ${Y} 100%)`;v(G)}r(!1)}function X(){r(!1),g(s)}const H=j?T===1?o:E:o,J=j?T===1?i:R:i,re=j?T===1?a:S:a,pe=j?T===1?l:k:l,{r:ae,g:ke,b:F}=U(H,J,re),Fe=`linear-gradient(to right, rgba(${ae}, ${ke}, ${F}, 0), rgba(${ae}, ${ke}, ${F}, 1))`,Q=W(o,i,a,l),se=W(E,R,S,k);return t.jsxRuntimeExports.jsxs("div",{className:me.modal,onClick:K=>K.stopPropagation(),style:{top:`${e.top}px`,left:`${e.left}px`},children:[t.jsxRuntimeExports.jsx("h2",{className:me.title,children:"Color"}),Z&&t.jsxRuntimeExports.jsxs("div",{className:me.colorTypes,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(me.colorType,{[me.colorTypeActive]:!j}),onClick:()=>w(!1),children:[t.jsxRuntimeExports.jsx("div",{style:{background:"#757575",width:"16px",height:"16px",borderRadius:"50%"}}),"Solid"]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(me.colorType,{[me.colorTypeActive]:j}),onClick:()=>w(!0),children:[t.jsxRuntimeExports.jsx("div",{style:{background:"linear-gradient(to bottom, #757575 0%, #DBDBDB 100%)",width:"16px",height:"16px",borderRadius:"50%"}}),"Linear"]})]}),j&&Z&&t.jsxRuntimeExports.jsxs("div",{className:me.colorsWrapper,children:[t.jsxRuntimeExports.jsx("div",{className:me.colors,style:{background:`linear-gradient(90deg, ${Q} 0%, ${se} 100%)`}}),t.jsxRuntimeExports.jsx("div",{className:t.clx(me.color,{[me.colorActive]:T===1}),onClick:()=>V(1),style:{background:Q}}),t.jsxRuntimeExports.jsx("div",{className:t.clx(me.color,{[me.colorActive]:T===2}),onClick:()=>V(2),style:{background:se}})]}),t.jsxRuntimeExports.jsx("div",{className:me.colorMap,onMouseDown:P,style:{background:`
|
|
107
|
+
`,s+="}",s},xu=e=>{const n=document.getElementById("dynamic-styles");if(n)n.innerHTML=e;else{const s=document.createElement("style");s.id="dynamic-styles",s.innerHTML=e,document.head.appendChild(s)}},zs=new Set,hu=e=>{const n=new Map;return Object.entries(e).forEach(([s,r])=>{typeof r=="object"&&Object.entries(r).forEach(([o,i])=>{var a,l;if(i&&i.font){const c=i.font.replace(/\s+/g,"+");n.has(c)||n.set(c,new Set),(a=n.get(c))==null||a.add(i.weight),(l=n.get(c))==null||l.add(i.boldWeight)}})}),n},fu=e=>{const n=new Map;return Object.entries(e).forEach(([s,r])=>{typeof r=="object"&&Object.keys(r).forEach(o=>{var i;if(o==="font"&&r[o]){const a=r[o].replace(/\s+/g,"+");n.has(a)||n.set(a,new Set),(i=n.get(a))==null||i.add("400")}})}),n},gu=e=>{zs.forEach(n=>{if(!e.has(n)){const s=document.querySelector(`link[data-font="${n}"]`);s&&s.remove(),zs.delete(n)}})},ju=e=>{const n=new Set;e.forEach((s,r)=>{const o=Array.from(s).join(";"),i=`${r}:wght@${o}`;if(n.add(i),!zs.has(i)){const a=document.createElement("link");a.rel="stylesheet",a.href=`https://fonts.googleapis.com/css2?family=${i}&display=swap`,a.setAttribute("data-font",i),document.head.appendChild(a),zs.add(i)}}),gu(n)},yu=e=>{if(e.fonts){const n=hu(e.fonts.desktop),s=fu(e.buttons),r=new Map(n);s.forEach((o,i)=>{if(r.has(i)){const a=r.get(i);o.forEach(l=>a==null?void 0:a.add(l))}else r.set(i,new Set(o))}),ju(r)}};function Cu(){try{const{editBlock:e,currentBlock:n,blocks:s,setHeader:r,setFooter:o,setAnnouncement:i}=t.useLayersStore.getState(),{currentPage:a,pages:l}=t.usePagesStore.getState(),{currentInstance:c,settingsInstance:d}=t.useBlocksStore.getState(),{setSettings:u}=t.useSettingsStore.getState();if(n||u(d),c&&n){if(n==="header")r(c);else if(n==="footer")o(c);else if(n==="announcement")i(c);else if(n==="header"||n==="footer"||n==="announcement")throw new Error(`Missing ${n} data.`)}if(c&&l&&n&&!["header","footer","announcement"].includes(n)){const p={blockSettings:{}};if(!c.blockSettings)throw new Error("currentInstance.blockSettings is undefined.");if(Object.keys(c.blockSettings).filter(m=>!["displayName","isAddable"].includes(m)).forEach(m=>{p.blockSettings[m]=c.blockSettings[m]}),!l[a])throw new Error(`Page "${a}" does not exist.`);if(!s[l[a].path].data||!s[l[a].path].data[n])throw new Error(`Layer or block for page "${l[a].path}" and block "${n}" does not exist.`);e(l[a].path,n,{name:s[l[a].path].data[n].name,value:p})}}catch(e){console.error("Error in hotReload function:",e)}}async function _u(e,n,s,r){const o=t.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,i=`${t.SL_API_URL}/v1/public/${o}/tickets`,{notifications:a,setNotifications:l}=t.useNotificationStore.getState();try{const c=await t.request({method:"post",url:i,body:{title:e,firstMessage:n,email:r,recaptcha:s},withToken:!1});return l([...a,{id:t.v4(),message:"Ticket created successfully. We will contact you by mail",status:"success"}]),c}catch(c){l([...a,{id:t.v4(),message:`Error: ${c}. Please try again later.`,status:"error"}])}}const Eu="_tooltip_4hruj_1",vu={tooltip:Eu},Tn=e=>{const{text:n}=e,{setShowTooltip:s}=t.useTooltipStore();return y.useEffect(()=>(s(!0),()=>{s(!1)}),[]),t.jsxRuntimeExports.jsx("div",{className:vu.tooltip,children:n})},Ru=()=>{const{undo:e,redo:n,past:s,future:r}=t.useHistoryStore(),[o,i]=y.useState(!1),[a,l]=y.useState(!1),[c,d]=y.useState(!1),[u,p]=y.useState(!1),[m,x]=y.useState(null),{notifications:g,setNotifications:h}=t.useNotificationStore();return y.useEffect(()=>{i(s.length===0)},[s]),y.useEffect(()=>{l(r.length===0)},[r]),t.jsxRuntimeExports.jsxs("div",{className:$n.buttons,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx($n.button,{[$n.disabled]:o}),onMouseEnter:()=>{const v=setTimeout(()=>{p(!0),d(!1)},200);x(v)},onMouseLeave:()=>{m&&clearTimeout(m),p(!1),d(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{o||(e(),h([...g,{id:t.v4(),message:"Changes undone",status:"success"}]))},fill:o?"#757575":"#252525"}),u&&t.jsxRuntimeExports.jsx(Tn,{text:o?"Nothing to undo":"Click to undo changes"})]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx($n.button,{[$n.disabled]:a}),onMouseEnter:()=>{const v=setTimeout(()=>{d(!0),p(!1)},200);x(v)},onMouseLeave:()=>{m&&clearTimeout(m),d(!1),p(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||(n(),h([...g,{id:t.v4(),message:"Changes redone",status:"success"}]))},fill:a?"#757575":"#252525"}),c&&t.jsxRuntimeExports.jsx(Tn,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},wu="_devices_ls6k9_1",bu="_device_ls6k9_1",Su="_active_ls6k9_27",Fr={devices:wu,device:bu,active:Su},ku=()=>t.jsxRuntimeExports.jsx("div",{className:Fr.devices,children:ic.map(e=>t.jsxRuntimeExports.jsx(Nu,{device:e}))}),Nu=e=>{const{device:n}=e,{currentDevice:s,setCurrentDevice:r}=t.useDeviceStore(),[o,i]=y.useState(!1),[a,l]=y.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:t.clx(Fr.device,{[Fr.active]:s.value===n.value}),onClick:()=>r(n),onMouseEnter:()=>{const c=setTimeout(()=>{i(!0)},200);l(c)},onMouseLeave:()=>{a&&clearTimeout(a),i(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:n.icon,fill:s.value===n.value?"#252525":"#757575",width:20,height:20}),o&&t.jsxRuntimeExports.jsx(Tn,{text:`Switch to ${n.value} view`})]},n.value)},Iu="_preview_1x3m8_2",Tu="_active_1x3m8_19",cr={preview:Iu,active:Tu},Lu=()=>{const{onPreview:e}=t.usePreviewStore(),[n,s]=y.useState(!1),[r,o]=y.useState(null);return t.jsxRuntimeExports.jsxs("a",{href:"/",className:t.clx(cr.preview,{[cr.active]:e}),target:"_blank",onMouseEnter:()=>{const i=setTimeout(()=>{s(!0)},200);o(i)},onMouseLeave:()=>{r&&clearTimeout(r),s(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUpRight",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:cr.text,children:"Preview"}),n&&t.jsxRuntimeExports.jsx(Tn,{text:"Open draft theme in new tab"})]})},Pu="_settings_u4cv4_1",Mu={settings:Pu},Au="_pages_167qp_1",Bu="_text_167qp_21",$u="_modal_167qp_27",Du="_open_167qp_46",Ou="_page_167qp_1",Hu="_hoverable_167qp_61",Vu="_separator_167qp_65",Fu="_button_167qp_70",Zu="_items_167qp_85",yt={pages:Au,default:"_default_167qp_5",text:Bu,modal:$u,open:Du,page:Ou,hoverable:Hu,separator:Vu,button:Fu,items:Zu},Nt=e=>e?e.replace(/_/g," ").split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" and "):"";function Sn(e,n){if(!n||!n[e])return"unknown name";const s=new n[e];return!s.blockSettings||!s.blockSettings.displayName?"unknown name":s.blockSettings.displayName}const aa=(e,n,s,r,o,i,a)=>{const l=e.currentTarget.getBoundingClientRect(),c=window.innerHeight-l.bottom,d=l.top,u=window.innerWidth-l.right,p=l.left;let m,x;return m=l.bottom+r+window.scrollY,x=l.left,(c<n||c<o)&&(d>=n+a?m=l.top-n-r+window.scrollY:m=window.scrollY+a),m-window.scrollY<a&&(m=window.scrollY+a),(u<s||u<i)&&(p>=s?x=l.right-s:x=(window.innerWidth-s)/2),x<l.right+i&&(x=l.right+i),x<l.right&&x+s>l.left&&m<l.bottom&&m+n>l.top&&(u>=s+i?x=l.right+r+i:c>=n?m=l.bottom+r+window.scrollY:(m=window.scrollY+a,x=(window.innerWidth-s)/2)),{top:m,left:x}},la=async e=>{const n=localStorage.getItem("shopId")||void 0,s=localStorage.getItem("draftId"),r=`${t.API_URL}/v2/builder/shops/${n}/drafts/${s}/pages/${encodeURIComponent(e)}`;return await t.request({url:r,withToken:!0,method:"delete"})},zu=()=>{const{currentPage:e,setCurrentPage:n,setIsOpenModal:s,pages:r,setIsEdit:o,setEditedPage:i,deletePage:a,setIsOpenSelectModal:l}=t.usePagesStore(),{deletePage:c,setCurrentBlock:d}=t.useLayersStore(),[u,p]=y.useState(null),{setTitle:m,setDescription:x,setOnConfirm:g}=t.useConfirmationModalStore(),[h,v]=y.useState(!1),j=y.useRef(null);return t.useOnClickOutside(j,()=>{h&&v(!1)}),y.useEffect(()=>{h?l(!0):setTimeout(()=>{l(!1)},300)},[h]),t.jsxRuntimeExports.jsxs("div",{className:yt.pages,ref:j,children:[t.jsxRuntimeExports.jsxs("div",{className:yt.default,onClick:w=>{w.stopPropagation(),v(_=>!_)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:r&&r[e]&&r[e].icon||"File",fill:"#252525",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:yt.text,children:r&&r[e]&&t.defaultPagePaths.includes(r[e].path)?`${Nt(r[e].name)} page`:r&&r[e]&&r[e].name}),t.jsxRuntimeExports.jsx("div",{style:{transform:h?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease",display:"flex"},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:20,height:20})})]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(yt.modal,{[yt.open]:h}),onClick:w=>w.stopPropagation(),children:[r&&t.jsxRuntimeExports.jsx("div",{className:yt.items,children:Object.keys(r).map(w=>{const _=r[w];return t.jsxRuntimeExports.jsxs("div",{className:t.clx(yt.page,{[yt.hoverable]:u===w}),onMouseEnter:()=>p(w),onMouseLeave:()=>p(null),onClick:()=>{p(null),o(!1),d(null),n(w),v(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:_.icon,fill:"#252525"}),t.jsxRuntimeExports.jsx("span",{className:yt.text,children:t.defaultPagePaths.includes(_.path)?`${Nt(_.name)} page`:_.name}),u===w&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Gear",fill:"#757575",onClick:b=>{b.stopPropagation(),o(!0),i(w),s(!0)}}),!t.defaultPagePaths.includes(_.path)&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",fill:"#C12A2A",onClick:b=>{b.stopPropagation(),m("Delete Page"),x(`Are you sure you want to delete ${_.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),g(()=>{b.stopPropagation(),r[e].path===_.path&&n(Object.keys(r)[0]),a(w),c(_.name),la(_.path)})}})]}),r[e]&&r[e].name===_.name&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Check",fill:"#FF3F19"})]},w)})}),t.jsxRuntimeExports.jsx("div",{className:yt.separator}),t.jsxRuntimeExports.jsxs(t.Button,{className:yt.button,onClick:w=>{w.stopPropagation(),s(!0)},size:"l",children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#ff3f19"}),t.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},Uu="_zoom_fu0hj_1",Ao={zoom:Uu},Wu=()=>{const{zoomLevel:e,setZoomLevel:n}=t.usePreviewStore();return t.jsxRuntimeExports.jsxs("label",{htmlFor:"zoom",className:Ao.zoom,children:[t.jsxRuntimeExports.jsx("label",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},htmlFor:"zoom",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlassMinus",width:20,height:20})}),t.jsxRuntimeExports.jsx("input",{id:"zoom",type:"number",min:25,max:250,value:(e*100).toFixed(0),onChange:s=>{const r=Number(s.target.value);n(r/100)},className:Ao.input}),t.jsxRuntimeExports.jsx("span",{children:"%"})]})},qu=()=>t.jsxRuntimeExports.jsxs("div",{className:Mu.settings,children:[t.jsxRuntimeExports.jsx(zu,{}),t.jsxRuntimeExports.jsx(Wu,{})]}),Gu="_theme_1e5wq_1",Yu="_text_1e5wq_13",Bo={theme:Gu,text:Yu},Xu=()=>t.jsxRuntimeExports.jsx("div",{className:Bo.theme,children:t.jsxRuntimeExports.jsx("div",{className:Bo.text,children:"Live Theme"})}),Ku=async(e,n,s)=>{const r=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${t.API_URL}/v2/builder/shops/${r}/drafts/${o}/${n}`;return await t.request({url:i,withToken:!0,method:e,body:s})};function Dn(e,n){try{return n.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(i=>i&&i.type===e).map(i=>{if(i.value===void 0)throw new Error("item.value is undefined.");return i.value}).flat()}).flat().filter(r=>r).map(r=>e==="ListingIds"?r.listingId:r)}catch(s){return console.error("Error in getValues function:",s),[]}}function Ju(e,n,s){return Qu(e,n)?(s.reviews||[]).length*3:0}function Qu(e,n){return n.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(i=>i&&i.type===e).map(i=>{if(i.value===void 0)throw new Error("item.value is undefined.");return i.value}).flat()}).flat().filter(r=>r).length>0}function e1(e,n){if(n){const s=Object.keys(n).find(r=>n[r].path===e);if(s)return n[s]}return null}const t1=({setIsLoading:e,isLoading:n})=>{const{themeSettings:s}=t.useThemeSettingsStore(),{settings:r}=t.useSettingsStore(),[o,i]=y.useState(null),[a,l]=y.useState(!1),{setNotifications:c,notifications:d}=t.useNotificationStore(),{header:u,footer:p,announcement:m,blocks:x}=t.useLayersStore(),{pageContext:g}=t.usePagesStore(),{pages:h}=t.usePagesStore(),v=async()=>{if(a)o&&clearTimeout(o);else{e(!0);const w=Object.keys(x).map(E=>{const R=e1(E,h);return x[E]&&x[E].data&&(R!=null&&R.path)?{id:R?R.id:E,name:R?R.name:E,path:R.path,layout:{...x[E]},neededProductIds:[...Dn("ProductId",Object.values(x[E].data))],neededCategoryIds:[...Dn("CategoryId",Object.values(x[E].data))],neededAnnouncementIds:[...Dn("AnnouncementId",Object.values(x[E].data))],neededListingIds:[...Dn("ListingIds",Object.values(x[E].data))],neededFaqIds:[...Dn("FaqsIds",Object.values(x[E].data))],neededReviewCount:Ju("ReviewCount",Object.values(x[E].data),g),seo:{pageTitle:R&&R.seo&&R.seo.pageTitle?R.seo.pageTitle:"",pageDescription:R&&R.seo&&R.seo.pageDescription?R.seo.pageDescription:""},isPrivate:!!(R&&R.visibility==="private")}:null}).filter(E=>E),_={settings:{maxStoreWidth:r==null?void 0:r.blockSettings.maxStoreWidth},header:u,footer:p,announcement:m},{status:b}=await Ku("post","save",{themeSettings:s,settings:_,updatedPages:w});c([...d,{id:t.v4(),message:b===200?"Settings saved":"Error",status:b===200?"success":"error"}]),e(!1)}l(!0);const j=setTimeout(()=>{l(!1)},2e3);i(j)};return t.jsxRuntimeExports.jsx(t.Button,{onClick:v,disabled:n,children:t.jsxRuntimeExports.jsx("span",{style:{userSelect:"none"},children:"Save"})})},n1=()=>{const{isOpenSelectModal:e}=t.usePagesStore(),[n,s]=y.useState(!1),{showTooltip:r}=t.useTooltipStore();return t.jsxRuntimeExports.jsxs("div",{className:ps.header,style:{zIndex:e?5e4:r?501:50},children:[t.jsxRuntimeExports.jsxs("div",{className:ps.left,children:[t.jsxRuntimeExports.jsx(ku,{}),t.jsxRuntimeExports.jsx(Lu,{})]}),t.jsxRuntimeExports.jsx("div",{className:ps.center,children:t.jsxRuntimeExports.jsx(qu,{})}),t.jsxRuntimeExports.jsxs("div",{className:ps.right,children:[t.jsxRuntimeExports.jsx(Xu,{}),t.jsxRuntimeExports.jsx(Ru,{}),t.jsxRuntimeExports.jsx(t1,{setIsLoading:s,isLoading:n}),n&&t.jsxRuntimeExports.jsx(rn,{})]})]})},s1="_exit_ovvox_1",r1="_text_ovvox_11",o1="_exitLink_ovvox_16",ur={exit:s1,text:r1,exitLink:o1},i1=()=>t.jsxRuntimeExports.jsx("div",{className:ur.exit,children:t.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:ur.exitLink,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"SignOut",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:ur.text,children:"Exit"})]})}),a1="_navbar_1podc_1",l1="_main_1podc_6",c1="_block_1podc_13",u1="_active_1podc_29",ms={navbar:a1,main:l1,block:c1,active:u1},d1=()=>{const{activeBlock:e}=t.useNavbarStore(),{setActiveBlock:n}=t.useBlocksStore(),{setCurrentBlock:s}=t.useLayersStore(),{setActiveBlock:r}=t.useThemeSettingsStore(),{setActiveBlock:o}=t.usePreviewStore(),i=t.useNavigate();function a(l){switch(n(null),s(null),r(null),o({id:null,neededScroll:!1}),l.name){case"Layers":i("/admin/builder");break;case"Add":i("/admin/builder/add");break;case"Theme":i("/admin/builder/theme");break;case"Settings":i("/admin/builder/settings");break}}return t.jsxRuntimeExports.jsxs("div",{className:ms.navbar,children:[t.jsxRuntimeExports.jsx(i1,{}),t.jsxRuntimeExports.jsx("div",{className:ms.main,children:t.navbarBlocks.map(l=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(ms.block,{[ms.active]:e.icon===l.icon}),onClick:()=>a(l),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:l.icon,fill:e.icon===l.icon?"#252525":"#757575"}),t.jsxRuntimeExports.jsx("span",{children:l.name})]},l.icon))})]})},p1="_preview_gb2ye_1",m1="_main_gb2ye_15",x1="_content_gb2ye_25",h1="_loading_gb2ye_34",f1="_previewLoading_gb2ye_65",On={preview:p1,main:m1,content:x1,loading:h1,previewLoading:f1},g1="_header_11zku_2",j1="_circles_11zku_16",y1="_circle_11zku_16",C1="_red_11zku_32",_1="_green_11zku_36",E1="_yellow_11zku_40",v1="_input_11zku_44",R1="_main_11zku_55",w1="_text_11zku_63",b1="_copy_11zku_75",It={header:g1,circles:j1,circle:y1,red:C1,green:_1,yellow:E1,input:v1,main:R1,text:w1,copy:b1},S1=["red","yellow","green"],k1=()=>{const{currentDevice:e}=t.useDeviceStore(),n=(o,i)=>o.length>i?o.slice(0,i)+"...":o,{notifications:s,setNotifications:r}=t.useNotificationStore();return t.jsxRuntimeExports.jsxs("div",{className:It.header,children:[t.jsxRuntimeExports.jsx("div",{className:It.circles,children:S1.map(o=>t.jsxRuntimeExports.jsx("div",{className:t.clx(It.circle,{[It.red]:o==="red",[It.yellow]:o==="yellow",[It.green]:o==="green"})},o))}),t.jsxRuntimeExports.jsx("div",{className:It.input,children:t.jsxRuntimeExports.jsxs("div",{className:It.main,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),t.jsxRuntimeExports.jsx("span",{className:It.text,children:e.value==="mobile"?n(window.location.origin,35):e.value==="desktop"?n(window.location.origin,200):n(window.location.origin,100)})]})}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),r([...s,{id:t.v4(),status:"success",message:"Domain copied to clipboard"}])},className:It.copy,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy",width:20,height:20,fill:"#252525"})})]})},N1="_content_o1u9i_1",I1="_main_o1u9i_11",T1="_block_o1u9i_15",L1="_active_o1u9i_21",P1="_name_o1u9i_31",M1="_addSection_o1u9i_108",A1="_addSectionTop_o1u9i_116",Gt={content:N1,main:I1,block:T1,active:L1,name:P1,addSection:M1,addSectionTop:A1},B1="_sidebar_xhqpt_1",$1="_content_xhqpt_14",D1="_button_xhqpt_24",O1="_moveButton_xhqpt_40",H1="_deleteButton_xhqpt_49",Tt={sidebar:B1,content:$1,button:D1,moveButton:O1,deleteButton:H1},V1=()=>{var E;const{activeBlock:e,setActiveBlock:n}=t.usePreviewStore(),{blocks:s,removeBlock:r,moveBlock:o,duplicateBlock:i,setCurrentBlock:a}=t.useLayersStore(),{currentPage:l,pages:c}=t.usePagesStore(),{setTitle:d,setDescription:u,setOnConfirm:p}=t.useConfirmationModalStore(),{setActiveBlock:m}=t.useBlocksStore(),x=(E=c==null?void 0:c[l])==null?void 0:E.path,g=x?s[x]:null,h=(g==null?void 0:g.order)||[],v=h.indexOf(e.id),j=R=>{R.stopPropagation(),v>0&&x&&(o(x,v,v-1),n({id:e.id,neededScroll:!0}),setTimeout(()=>{n({id:e.id,neededScroll:!1})},100))},w=R=>{R.stopPropagation(),v<h.length-1&&x&&(o(x,v,v+1),n({id:e.id,neededScroll:!0}),setTimeout(()=>{n({id:e.id,neededScroll:!1})},100))},_=R=>{R.stopPropagation(),x&&i(x,e.id)},b=()=>{x&&(r(x,e.id),a(null),m(null),n({id:null,neededScroll:!1}))};return t.jsxRuntimeExports.jsx("div",{className:Tt.sidebar,children:t.jsxRuntimeExports.jsxs("div",{className:Tt.content,children:[t.jsxRuntimeExports.jsx("button",{onClick:j,className:t.clx(Tt.button,Tt.moveButton),disabled:v===0,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUp"})}),t.jsxRuntimeExports.jsx("button",{onClick:w,className:t.clx(Tt.button,Tt.moveButton),disabled:v===h.length-1,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowDown"})}),t.jsxRuntimeExports.jsx("button",{onClick:_,className:t.clx(Tt.button,Tt.moveButton),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})}),t.jsxRuntimeExports.jsx("button",{className:t.clx(Tt.button,Tt.deleteButton),onClick:R=>{R.stopPropagation(),d("Remove Block"),u(`Are you sure you want to delete ${(g==null?void 0:g.data[e.id].name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),p(b)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]})})},F1=y.memo(({scrollableRef:e})=>{const{setActiveBlock:n,activeBlock:s,zoomLevel:r}=t.usePreviewStore(),{blocks:o,sourceBlocks:i}=t.useBlocksStore(),{blocks:a,setCurrentBlock:l,currentBlock:c,setPositionBlock:d,announcement:u}=t.useLayersStore(),{settings:p}=t.useSettingsStore(),{currentPage:m,pages:x,pageContext:g}=t.usePagesStore(),{activeBlock:h,setActiveBlock:v}=t.useThemeSettingsStore(),{setError:j}=t.useErrorStore(),{setActiveBlock:w}=t.useBlocksStore(),_=y.useRef(s.id),b=y.useRef({});y.useEffect(()=>{if(s.id&&s.neededScroll&&b.current[s.id]){const S=b.current[s.id];if(S&&e.current){const k=S.offsetTop;e.current.scrollTo({top:k-30,behavior:"smooth"})}}},[s,e]);const E=t.useNavigate();y.useEffect(()=>{_.current=s.id},[s.id]);const R=S=>{if(!S||!S.name)return j({message:"Block or block.name is undefined.",failedSettings:!1,failedThemeSettings:!1,failedPageIds:x&&x[m].id?[x[m].id]:[]}),t.jsxRuntimeExports.jsx(In,{error:"Block or block.name is undefined."});if(!o||!o[S.name])return j({message:'Block "${block.name}" does not exist in blocks.',failedSettings:!1,failedThemeSettings:!1,failedPageIds:x&&x[m].id?[x[m].id]:[]}),t.jsxRuntimeExports.jsx(In,{error:`Block "${S.name}" does not exist in blocks.`});const k=new o[S.name];return S.value&&Object.assign(k,S.value),k.renderBlock(p==null?void 0:p.blockSettings,g)};return t.jsxRuntimeExports.jsxs("div",{onClick:S=>{S.stopPropagation()},className:Gt.content,style:{width:"100%",height:"100%",zoom:`${r}`},ref:e,children:[u&&t.jsxRuntimeExports.jsx(oa,{}),t.jsxRuntimeExports.jsx(Zs,{}),t.jsxRuntimeExports.jsx("div",{className:Gt.main,children:x&&x[m]&&a[x[m].path]&&a[x[m].path].data&&a[x[m].path].order.map(S=>t.jsxRuntimeExports.jsxs("div",{ref:k=>b.current[S]=k,onClick:k=>{k.stopPropagation(),w(null),h&&v(null),n({id:S,neededScroll:!0}),setTimeout(()=>{n({id:S,neededScroll:!1})},100),l(null),c?setTimeout(()=>{l(s.id)},100):l(s.id)},onMouseEnter:k=>{k.stopPropagation(),s.neededScroll||n({id:S,neededScroll:!1})},onMouseLeave:k=>{k.stopPropagation(),s.neededScroll||n({id:null,neededScroll:!1})},className:t.clx(Gt.block),children:[(s.id===S||c===S)&&t.jsxRuntimeExports.jsx("div",{className:Gt.active}),(s.id===S||c===S)&&t.jsxRuntimeExports.jsx("div",{className:Gt.name,children:Sn(a[x[m].path].data[S].name,i)}),(s.id===S||c===S)&&Sn(a[x[m].path].data[S].name,i)!=="unknown name"&&t.jsxRuntimeExports.jsx(V1,{}),(s.id===S||c===S)&&Sn(a[x[m].path].data[S].name,i)!=="unknown name"&&t.jsxRuntimeExports.jsx("div",{className:Gt.addSection,children:t.jsxRuntimeExports.jsx(t.Button,{onClick:k=>{k.stopPropagation(),d(S,!0),l(null),n({id:null,neededScroll:!1}),w(null),E("/admin/builder/add")},children:"Add Section"})}),(s.id===S||c===S)&&Sn(a[x[m].path].data[S].name,i)!=="unknown name"&&t.jsxRuntimeExports.jsx("div",{className:t.clx(Gt.addSection,Gt.addSectionTop),children:t.jsxRuntimeExports.jsx(t.Button,{onClick:k=>{k.stopPropagation(),d(S,!1),l(null),n({id:null,neededScroll:!1}),w(null),E("/admin/builder/add")},children:"Add Section"})}),o&&t.jsxRuntimeExports.jsx(lo,{render:R,block:a[x[m].path].data[S]})]},S))}),t.jsxRuntimeExports.jsx(Fs,{})]})}),Z1="_results_1pahy_1",$o={results:Z1};function z1(e,n){return n?new n[e]().blockSettings.isAddable:!1}function U1(e,n){return e?Object.keys(e||{}).reduce((s,r)=>(z1(r,n)&&s.push(r),s),[]):[]}const W1="_product_yggw5_1",q1="_name_yggw5_15",Do={product:W1,name:q1},G1=e=>{const{blockId:n,setSearchValue:s}=e,{sourceBlocks:r,setActiveBlock:o}=t.useBlocksStore(),{hideModal:i,hoverBlockId:a,isModalVisible:l,showPreview:c,hidePreview:d,clearHideTimeout:u,startHideTimeout:p,setHoverBlockTopPosition:m}=t.useSubmodalStore();function x(v){s(""),o(v),i("keyBlock")}function g(v,j){const w=window.innerHeight,_=400,b=10;let E=j.clientY-120;E+_>w&&(E=w-_-b),E<b&&(E=b),a||i("keyBlock"),c(v,"keyBlock"),u(),m(E)}function h(){l?p("keyBlock"):d("keyBlock"),m(null)}return t.jsxRuntimeExports.jsxs("div",{className:Do.product,onClick:()=>x(n),onMouseEnter:v=>g(n,v),onMouseLeave:h,children:[Qn[n]?t.jsxRuntimeExports.jsx("img",{src:Qn[n]}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Cards"}),t.jsxRuntimeExports.jsx("span",{className:Do.name,children:Sn(n,r)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretRight",width:20,height:20})]},n)},ca=()=>{const{blocks:e,sourceBlocks:n}=t.useBlocksStore(),[s,r]=y.useState(""),[o,i]=y.useState([]),a=y.useMemo(()=>U1(e,n),[e]),l=y.useMemo(()=>new t.Fuse(a,{keys:["name"],threshold:.4}),[a]);return y.useEffect(()=>{if(s.trim()==="")i(a);else{const c=l.search(s);i(c.map(d=>d.item))}},[s,l]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:r,value:s,style:{marginBottom:10}}),t.jsxRuntimeExports.jsx("div",{className:$o.results,children:o.length>0?o.map(c=>t.jsxRuntimeExports.jsx(G1,{blockId:c,setSearchValue:r})):t.jsxRuntimeExports.jsx("div",{className:$o.noResults,children:"No sections found"})})]})},Y1="_wrapper_1k1cr_1",X1="_submodal_1k1cr_14",Zr={wrapper:Y1,submodal:X1},K1=({children:e,positionTop:n,positionLeft:s})=>{const{keyBlock:r,startHideTimeout:o,clearHideTimeout:i,setMouseOverModal:a}=t.useSubmodalStore();return r?t.jsxRuntimeExports.jsx("div",{className:Zr.wrapper,style:n?{top:n,left:s||void 0}:{},onMouseEnter:()=>{i(),a(!0)},onMouseLeave:()=>{a(!1),o()},children:e}):null},J1=({children:e})=>{const{hoverBlockId:n,startHideTimeout:s,clearHideTimeout:r,setMouseOverModal:o}=t.useSubmodalStore();return n?t.jsxRuntimeExports.jsx("div",{className:t.clx(Zr.wrapper,Zr.submodal),onMouseEnter:()=>{r(),o(!0)},onMouseLeave:()=>{o(!1),s()},children:e}):null},Q1="_applyButton_1a9kh_2",ed="_content_1a9kh_7",td="_title_1a9kh_14",nd="_label_1a9kh_21",sd="_colorValue_1a9kh_40",rd="_colorMap_1a9kh_48",od="_indicator_1a9kh_57",id="_hueSlider_1a9kh_66",ad="_slider_1a9kh_97",ld="_buttons_1a9kh_102",cd="_name_1a9kh_109",ud="_secondary_1a9kh_114",dd="_input_1a9kh_122",pd="_modal_1a9kh_160",md="_alphaSlider_1a9kh_249",xd="_alphaBackground_1a9kh_257",hd="_alphaGradient_1a9kh_268",fd="_chargeTypes_1a9kh_297",gd="_charge_1a9kh_297",jd="_chargeActive_1a9kh_326",yd="_gradient_1a9kh_334",Cd="_color_1a9kh_40",_d="_colorActive_1a9kh_355",Ed="_gradientWrapper_1a9kh_362",vd="_subtitle_1a9kh_368",Rd="_colorTypes_1a9kh_375",wd="_colorType_1a9kh_375",bd="_colorTypeActive_1a9kh_399",Sd="_colorsWrapper_1a9kh_404",kd="_colors_1a9kh_404",me={applyButton:Q1,content:ed,title:td,label:nd,colorValue:sd,colorMap:rd,indicator:od,hueSlider:id,slider:ad,buttons:ld,name:cd,secondary:ud,input:dd,modal:pd,alphaSlider:md,alphaBackground:xd,alphaGradient:hd,chargeTypes:fd,charge:gd,chargeActive:jd,gradient:yd,color:Cd,colorActive:_d,gradientWrapper:Ed,subtitle:vd,colorTypes:Rd,colorType:wd,colorTypeActive:bd,colorsWrapper:Sd,colors:kd},Nd=()=>{const{modalPosition:e,color:n,initialColor:s,setShowModal:r,hue:o,saturation:i,brightness:a,alpha:l,dragging:c,setDragging:d,setHue:u,setSaturation:p,setBrightness:m,setAlpha:x,colorChange:g,setColor:h,update:v,isGradient:j,setIsGradient:w,gradientDirection:_,setGradientDirection:b,hue2:E,saturation2:R,brightness2:S,alpha2:k,setHue2:M,setSaturation2:A,setBrightness2:L,setAlpha2:I,activeColorIndex:T,setActiveColorIndex:V,isGradientActive:Z}=t.useColorPickerStore(),U=(K,Y,ue)=>{Y/=100,ue/=100;const G=ye=>(ye+K/60)%6,ne=ye=>ue*(1-Y*Math.max(0,Math.min(G(ye),4-G(ye),1))),le=Math.round(255*ne(5)),de=Math.round(255*ne(3)),je=Math.round(255*ne(1));return{r:le,g:de,b:je}},z=K=>K.toString(16).padStart(2,"0"),W=(K,Y,ue,G)=>{const{r:ne,g:le,b:de}=U(K,Y,ue),je=Math.round(G/100*255);return`#${z(ne)}${z(le)}${z(de)}${z(je)}`},ee=(K,Y,ue,G)=>{if(j)if(T===1){u(K),p(Y),m(ue),x(G);const ne=W(K,Y,ue,G),le=W(E,R,S,k),je=`linear-gradient(${_==="vertical"?"0deg":"90deg"}, ${ne} 0%, ${le} 100%)`;g(je),h(je)}else{M(K),A(Y),L(ue),I(G);const ne=W(K,Y,ue,G),le=W(o,i,a,l),je=`linear-gradient(${_==="vertical"?"0deg":"90deg"}, ${le} 0%, ${ne} 100%)`;g(je),h(je)}else{const ne=W(K,Y,ue,G);g(ne),h(ne)}},f=(K,Y,ue)=>{const{width:G,height:ne}=ue.getBoundingClientRect(),le=Math.max(0,Math.min(K/G*100,100)),de=Math.max(0,Math.min(100-Y/ne*100,100));j?T===1?(p(le),m(de),ee(o,le,de,l)):(A(le),L(de),ee(E,le,de,k)):(p(le),m(de),ee(o,le,de,l))},P=K=>{const{offsetX:Y,offsetY:ue}=K.nativeEvent;d(!0),f(Y,ue,K.currentTarget)},q=K=>{if(c){const Y=document.querySelector(`.${me.colorMap}`),{left:ue,top:G}=Y.getBoundingClientRect(),ne=K.clientX-ue,le=K.clientY-G;f(ne,le,Y)}},C=()=>{d(!1)};y.useEffect(()=>{function K(G){const ne=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,le=G.match(ne);if(le){const de=le[1],je=le[2],ye=le[3];return{angle:de,col1:je,col2:ye}}return null}function Y(G){const ne=parseInt(G.slice(1,3),16),le=parseInt(G.slice(3,5),16),de=parseInt(G.slice(5,7),16),je=parseInt(G.slice(7,9),16)/255*100,{h:ye,s:$e,b:N}=ue(ne,le,de);return{h:ye,s:$e,b:N,a:je}}function ue(G,ne,le){G/=255,ne/=255,le/=255;const de=Math.max(G,ne,le),je=Math.min(G,ne,le);let ye=0;const $e=de-je,N=(de===0?0:$e/de)*100,D=de*100;if(de===je)ye=0;else switch(de){case G:ye=((ne-le)/$e+(ne<le?6:0))*60;break;case ne:ye=((le-G)/$e+2)*60;break;case le:ye=((G-ne)/$e+4)*60;break}return{h:ye,s:N,b:D}}if(s&&s.startsWith("linear-gradient")){const G=K(s);if(G){const{angle:ne,col1:le,col2:de}=G,je=Y(le),ye=Y(de);w(!0),b(ne==="0deg"?"vertical":"horizontal"),u(je.h),p(je.s),m(je.b),x(je.a),M(ye.h),A(ye.s),L(ye.b),I(ye.a),V(1)}}else if(s){const ne=function(de){let je=de;return je.length===7&&(je=je+"ff"),je}(s),le=Y(ne);w(!1),u(le.h),p(le.s),m(le.b),x(le.a)}},[s,w,b,u,p,m,x,M,A,L,I,V]),y.useEffect(()=>{let K,Y,ue,G;j?T===1?(K=o,Y=i,ue=a,G=l):(K=E,Y=R,ue=S,G=k):(K=o,Y=i,ue=a,G=l),ee(K,Y,ue,G)},[j,_,T,o,i,a,l,E,R,S,k]),y.useEffect(()=>{const K=ue=>q(ue),Y=()=>C();return c?(document.addEventListener("mousemove",K),document.addEventListener("mouseup",Y)):(document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",Y)),()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",Y)}},[c,j,_]);function O(){if(!j)v(n);else{const K=W(o,i,a,l),Y=W(E,R,S,k),G=`linear-gradient(${_==="vertical"?"0deg":"90deg"}, ${K} 0%, ${Y} 100%)`;v(G)}r(!1)}function X(){r(!1),g(s)}const H=j?T===1?o:E:o,J=j?T===1?i:R:i,re=j?T===1?a:S:a,pe=j?T===1?l:k:l,{r:ae,g:ke,b:F}=U(H,J,re),Fe=`linear-gradient(to right, rgba(${ae}, ${ke}, ${F}, 0), rgba(${ae}, ${ke}, ${F}, 1))`,Q=W(o,i,a,l),se=W(E,R,S,k);return t.jsxRuntimeExports.jsxs("div",{className:me.modal,onClick:K=>K.stopPropagation(),style:{top:`${e.top}px`,left:`${e.left}px`},children:[t.jsxRuntimeExports.jsx("h2",{className:me.title,children:"Color"}),Z&&t.jsxRuntimeExports.jsxs("div",{className:me.colorTypes,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(me.colorType,{[me.colorTypeActive]:!j}),onClick:()=>w(!1),children:[t.jsxRuntimeExports.jsx("div",{style:{background:"#757575",width:"16px",height:"16px",borderRadius:"50%"}}),"Solid"]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(me.colorType,{[me.colorTypeActive]:j}),onClick:()=>w(!0),children:[t.jsxRuntimeExports.jsx("div",{style:{background:"linear-gradient(to bottom, #757575 0%, #DBDBDB 100%)",width:"16px",height:"16px",borderRadius:"50%"}}),"Linear"]})]}),j&&Z&&t.jsxRuntimeExports.jsxs("div",{className:me.colorsWrapper,children:[t.jsxRuntimeExports.jsx("div",{className:me.colors,style:{background:`linear-gradient(90deg, ${Q} 0%, ${se} 100%)`}}),t.jsxRuntimeExports.jsx("div",{className:t.clx(me.color,{[me.colorActive]:T===1}),onClick:()=>V(1),style:{background:Q}}),t.jsxRuntimeExports.jsx("div",{className:t.clx(me.color,{[me.colorActive]:T===2}),onClick:()=>V(2),style:{background:se}})]}),t.jsxRuntimeExports.jsx("div",{className:me.colorMap,onMouseDown:P,style:{background:`
|
|
108
108
|
linear-gradient(to top, black, transparent),
|
|
109
109
|
linear-gradient(to right, hsl(${H}, 100%, 100%), hsl(${H}, 100%, 50%))
|
|
110
110
|
`},children:t.jsxRuntimeExports.jsx("div",{className:me.indicator,style:{position:"absolute",left:`${J}%`,top:`${100-re}%`,transform:"translate(-50%, -50%)"}})}),t.jsxRuntimeExports.jsx("div",{className:me.hueSlider,style:{bottom:j?"175px":"100px"},children:t.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:H,onChange:K=>{const Y=Number(K.target.value);j?T===1?ee(Y,i,a,l):ee(Y,R,S,k):(u(Y),ee(Y,i,a,l))},className:me.slider})}),t.jsxRuntimeExports.jsxs("div",{className:me.alphaSlider,style:{bottom:j?"150px":"75px"},children:[t.jsxRuntimeExports.jsx("div",{className:me.alphaBackground}),t.jsxRuntimeExports.jsx("div",{className:me.alphaGradient,style:{background:Fe}}),t.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"100",value:pe,onChange:K=>{const Y=Number(K.target.value);j?T===1?ee(o,i,a,Y):ee(E,R,S,Y):(x(Y),ee(o,i,a,Y))},className:me.slider})]}),j&&Z&&t.jsxRuntimeExports.jsxs("div",{className:me.gradientWrapper,children:[t.jsxRuntimeExports.jsx("h3",{className:me.subtitle,children:"Rotation"}),t.jsxRuntimeExports.jsx("div",{className:me.gradient,children:t.jsxRuntimeExports.jsxs("div",{className:me.chargeTypes,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(me.charge,{[me.chargeActive]:_==="horizontal"}),onClick:()=>b("horizontal"),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowsHorizontal",width:20,height:20}),"Horizontal"]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(me.charge,{[me.chargeActive]:_==="vertical"}),onClick:()=>b("vertical"),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowsVertical",width:20,height:20}),"Vertical"]})]})})]}),t.jsxRuntimeExports.jsxs("div",{className:me.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:X,className:t.clx(me.applyButton,me.cancelButton),type:"Secondary",children:"Cancel"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:O,className:me.applyButton,children:"Apply"})]})]})},Id=()=>{const{onPreview:e,zoomLevel:n}=t.usePreviewStore(),{keyBlock:s,hoverBlockId:r,isModalVisible:o,hoverBlockTopPosition:i}=t.useSubmodalStore(),{settings:a}=t.useSettingsStore(),{sourceBlocks:l}=t.useBlocksStore(),{pageContext:c}=t.usePagesStore(),{showModal:d}=t.useColorPickerStore(),{currentDevice:u}=t.useDeviceStore(),{isLoadingThemeSettings:p}=t.useThemeSettingsStore(),{isLoadingLayers:m}=t.useLayersStore(),x=_=>_?!l||!l[_]?t.jsxRuntimeExports.jsx(In,{error:`Block "${_}" does not exist in blocks.`}):new l[_]().renderPreview(a,c):t.jsxRuntimeExports.jsx(In,{error:"Block or block.name is undefined."});function g(){if(u.value==="desktop")return n>=1?"100%":`${(n*100).toFixed(2)}%`;{const _=u.value==="tablet"?768:425;return n>=1?`${_}px`:`${(_*n).toFixed(2)}px`}}function h(){switch(u.value){case"desktop":return"100%";case"tablet":return 768;case"mobile":return 425;default:return"100%"}}const{isOpenSelectModal:v}=t.usePagesStore(),j=y.useRef(null),w=_=>{j.current&&(j.current.scrollTop+=_.deltaY)};return t.jsxRuntimeExports.jsxs("div",{className:On.preview,style:{zIndex:d&&!v?5e3:500},onWheel:_=>{_.stopPropagation(),w(_)},children:[o&&t.jsxRuntimeExports.jsx(J1,{children:t.jsxRuntimeExports.jsx(ca,{})}),t.jsxRuntimeExports.jsxs(K1,{positionTop:i,positionLeft:!r&&s?void 0:250,children:[!p&&!m&&t.jsxRuntimeExports.jsx(lo,{render:x,block:s},s),(p||!s||m)&&t.jsxRuntimeExports.jsx("div",{className:On.previewLoading,children:t.jsxRuntimeExports.jsx(rn,{})})]}),d&&t.jsxRuntimeExports.jsx(Nd,{}),e&&t.jsxRuntimeExports.jsxs("div",{className:On.main,style:{width:h()},children:[t.jsxRuntimeExports.jsx(k1,{}),t.jsxRuntimeExports.jsx("div",{style:{borderLeft:g()==="100%"?"none":"var(--default-border)",borderRight:g()==="100%"?"none":"var(--default-border)",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 160px)",overflowY:"scroll",overflowX:"hidden"},onScroll:_=>{_.stopPropagation()},onWheel:_=>{_.stopPropagation()},children:!p&&!m?t.jsxRuntimeExports.jsx("div",{className:On.content,style:{width:g()},children:t.jsxRuntimeExports.jsx(F1,{scrollableRef:j})}):t.jsxRuntimeExports.jsx("div",{className:On.loading,children:t.jsxRuntimeExports.jsx(rn,{})})})]})]})},Td="_sidebar_1xtkj_1",Ld="_title_1xtkj_11",Oo={sidebar:Td,title:Ld},Pd="_layers_1jhzw_1",Md="_wrapper_1jhzw_9",Ad="_draggingWrapper_1jhzw_17",Bd="_block_1jhzw_21",$d="_dragging_1jhzw_17",Dd="_active_1jhzw_56",Od="_add_1jhzw_63",Hd="_addTop_1jhzw_79",Vd="_visible_1jhzw_95",Fd="_button_1jhzw_99",Zd="_nameBlock_1jhzw_158",zd="_loader_1jhzw_162",Ud="_actions_1jhzw_171",Wd="_deleteButton_1jhzw_179",Ze={layers:Pd,wrapper:Md,draggingWrapper:Ad,block:Bd,dragging:$d,active:Dd,add:Od,addTop:Hd,visible:Vd,button:Fd,nameBlock:Zd,loader:zd,actions:Ud,deleteButton:Wd},qd="_block_sj4cc_1",Gd="_title_sj4cc_17",Yd="_actions_sj4cc_21",ln={block:qd,title:Gd,actions:Yd},dr={header:"Header",footer:"Footer",announcement:"Announcement"},pr=({id:e})=>{const{setCurrentBlock:n}=t.useLayersStore(),{activeBlock:s}=t.usePreviewStore(),[r,o]=y.useState(!1);function i(a){n(a)}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(ln.block,{[ln.active]:s.id===e,[ln.header]:e==="header",[ln.footer]:e==="footer",[ln.announcement]:e==="announcement"}),onClick:()=>i(e),onMouseOver:()=>o(!0),onMouseLeave:()=>o(!1),children:[Qn[dr[e]]?t.jsxRuntimeExports.jsx("img",{src:Qn[dr[e]],width:20,height:20}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Cards",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:ln.title,children:dr[e]}),t.jsxRuntimeExports.jsx("div",{className:ln.actions,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"PushPin",hoverable:!0,width:20,height:20,fill:"#757575"})})]})},Xd=({id:e,name:n,onClick:s,isDragging:r,icon:o})=>{const{activeBlock:i,setActiveBlock:a}=t.usePreviewStore(),{showPreview:l,hidePreview:c,showModal:d,hideModal:u,clearHideTimeout:p,startHideTimeout:m,hoverBlockId:x,isModalVisible:g}=t.useSubmodalStore(),{setPositionBlock:h}=t.useLayersStore(),[v,j]=y.useState(!1),[w,_]=y.useState(!1),[b,E]=y.useState(!1),[R,S]=y.useState(!1),[k,M]=y.useState(null),A=y.useRef(null),{attributes:L,listeners:I,setNodeRef:T,transform:V,transition:Z}=t.useSortable({id:e}),U={transform:t.CSS.Transform.toString(V),transition:Z},{setTitle:z,setDescription:W,setOnConfirm:ee}=t.useConfirmationModalStore(),{pages:f,currentPage:P}=t.usePagesStore(),{removeBlock:q}=t.useLayersStore(),C=H=>{H.stopPropagation(),A.current&&clearTimeout(A.current),a({id:e,neededScroll:!0}),g&&u(),l(e),p()},O=(H,J=!0)=>{H.stopPropagation(),c(),d(e),p(),h(e,J)},X=H=>{H.stopPropagation(),a({id:null,neededScroll:!1}),g?m():c()};return y.useEffect(()=>{E(!1),j(!1),_(!1),S(!1)},[r]),y.useEffect(()=>{g||(_(!1),j(!1))},[g]),t.jsxRuntimeExports.jsxs("div",{ref:T,style:U,className:t.clx(Ze.wrapper,{[Ze.draggingWrapper]:r&&i.id===e}),onClick:H=>{H.stopPropagation(),s(e)},onMouseEnter:C,onMouseLeave:X,...L,...I,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(Ze.block,{[Ze.dragging]:r&&i.id===e,[Ze.active]:!r&&i.id===e}),children:[o?t.jsxRuntimeExports.jsx("img",{src:o,width:20,height:20}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Cards",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:Ze.nameBlock,children:n}),x===e&&!r&&t.jsxRuntimeExports.jsx("div",{className:t.clx(Ze.addTop,{[Ze.visible]:w}),onMouseEnter:()=>{_(!0)},onMouseLeave:()=>{_(!1)},children:t.jsxRuntimeExports.jsxs("button",{className:Ze.button,onClick:H=>O(H,!1),onMouseEnter:()=>{const H=setTimeout(()=>{r||S(!0)},200);M(H)},onMouseLeave:()=>{k&&clearTimeout(k),S(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#fff"}),R&&t.jsxRuntimeExports.jsx(Tn,{text:"Click to add a section"})]})}),x===e&&!r&&t.jsxRuntimeExports.jsx("div",{className:t.clx(Ze.add,{[Ze.visible]:v}),onMouseEnter:()=>{j(!0)},onMouseLeave:()=>{j(!1)},children:t.jsxRuntimeExports.jsxs("button",{className:Ze.button,onClick:H=>O(H),onMouseEnter:()=>{const H=setTimeout(()=>{r||E(!0)},200);M(H)},onMouseLeave:()=>{k&&clearTimeout(k),E(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#fff"}),b&&t.jsxRuntimeExports.jsx(Tn,{text:"Click to add a section"})]})})]}),x===e&&!r&&t.jsxRuntimeExports.jsxs("div",{className:Ze.actions,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20}),t.jsxRuntimeExports.jsx("div",{className:Ze.deleteButton,onClick:H=>{H.stopPropagation(),z("Remove Block"),W(`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.`),ee(()=>{f&&q(f[P].path,e)})},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",fill:"#C12A2A",hoverable:!0,width:20,height:20})})]})]})},Kd=()=>{const{blocks:e,setCurrentBlock:n,currentBlock:s,moveBlock:r,isLoadingLayers:o,announcement:i}=t.useLayersStore(),{currentPage:a,pages:l}=t.usePagesStore(),{setMouseOverModal:c,setHoverBlockId:d}=t.useSubmodalStore(),{sourceBlocks:u}=t.useBlocksStore();function p(j){n(j),c(!1),d(null)}const m=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}})),[x,g]=y.useState(!1),h=()=>{g(!0)},v=j=>{g(!1);const{active:w,over:_}=j;if(_&&w.id!==_.id&&l&&l[a]){const b=l[a].path,E=e[b].order,R=E.indexOf(w.id),S=E.indexOf(_.id);R!==-1&&S!==-1&&r(b,R,S)}};return t.jsxRuntimeExports.jsx("div",{className:Ze.layers,children:o?t.jsxRuntimeExports.jsx("div",{className:Ze.loader,children:t.jsxRuntimeExports.jsx(rn,{})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[i&&t.jsxRuntimeExports.jsx(pr,{id:"announcement"}),t.jsxRuntimeExports.jsx(pr,{id:"header"}),!s&&t.jsxRuntimeExports.jsx(t.DndContext,{sensors:m,onDragEnd:v,onDragStart:h,children:l&&l[a]&&e[l[a].path]&&t.jsxRuntimeExports.jsx(t.SortableContext,{items:e[l[a].path].order,strategy:t.verticalListSortingStrategy,children:e[l[a].path].order.map((j,w)=>t.jsxRuntimeExports.jsx(Xd,{id:j,name:Sn(e[l[a].path].data[j].name,u),index:w,onClick:p,isDragging:x,icon:Qn[e[l[a].path].data[j].name]},j))})}),t.jsxRuntimeExports.jsx(pr,{id:"footer"})]})})},Jd="_loader_eyvkk_1",Qd={loader:Jd},ep=()=>{const{isLoadingSettings:e}=t.useSettingsStore();return e?t.jsxRuntimeExports.jsx("div",{className:Qd.loader,children:t.jsxRuntimeExports.jsx(rn,{})}):t.jsxRuntimeExports.jsx(tp,{})},tp=()=>{const{settings:e}=t.useSettingsStore(),{settings:n,setSettingsInstance:s}=t.useBlocksStore();if(!e)return null;const{setError:r}=t.useErrorStore(),o=new n(e.blockSettings);y.useEffect(()=>{s(o)},[e]);try{return o.renderSettings()}catch(i){throw console.error("Error rendering settings:",i),r({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),i}},np="_theme_a1one_1",sp="_block_a1one_8",rp="_name_a1one_23",op="_loader_a1one_27",xs={theme:np,block:sp,name:rp,loader:op},ip=()=>{const e=t.useNavigate(),{isLoadingThemeSettings:n,setActiveBlock:s}=t.useThemeSettingsStore();function r(o){switch(o==null?void 0:o.name){case"Colors":e("/admin/builder/theme/colors"),s(kt[0]);break;case"Fonts":e("/admin/builder/theme/fonts"),s(kt[1]);break;case"Borders":e("/admin/builder/theme/borders"),s(kt[2]);break;case"Buttons":e("/admin/builder/theme/buttons"),s(kt[3]);break;case"Inputs":e("/admin/builder/theme/inputs"),s(kt[4]);break}}return t.jsxRuntimeExports.jsx("div",{className:xs.theme,children:n?t.jsxRuntimeExports.jsx("div",{className:xs.loader,children:t.jsxRuntimeExports.jsx(rn,{})}):kt.map(o=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>r(o),className:t.clx(xs.block),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:o.icon}),t.jsxRuntimeExports.jsx("span",{className:xs.name,children:o.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretRight"})]},o.icon))})},ap="_render_7e826_9",lp="_open_7e826_24",cp="_close_7e826_51",up="_clicked_7e826_55",dp="_loading_7e826_72",pp="_settings_7e826_76",Cn={render:ap,open:lp,close:cp,clicked:up,loading:dp,settings:pp},mp=({block:e})=>{const{pageContext:n}=t.usePagesStore(),{setError:s}=t.useErrorStore();try{return e.renderSettings(n)}catch(r){throw console.error("Error rendering settings:",r),s({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),r}},xp="_wrapper_15ju8_1",hp="_header_15ju8_8",fp="_title_15ju8_15",gp="_colorWrapper_15ju8_21",jp="_name_15ju8_35",yp="_color_15ju8_21",Cp="_value_15ju8_47",_p="_length_15ju8_51",ht={wrapper:xp,header:hp,title:fp,colorWrapper:gp,name:jp,color:yp,value:Cp,length:_p},Ep=e=>{const{colors:n}=e,{themeSettings:s}=t.useThemeSettingsStore(),[r,o]=y.useState(!0);y.useEffect(()=>{n.length<=3&&o(!0)},[]);function i(a){const l=a.replace("--",""),[c,d]=l.split("-"),u=`${d.charAt(0).toUpperCase()+d.slice(1)} ${c.charAt(0).toUpperCase()+c.slice(1)}`,[p,m]=l.split("-");return{name:u,field:p,variable:m}}return t.jsxRuntimeExports.jsxs("div",{className:ht.wrapper,children:[t.jsxRuntimeExports.jsxs("div",{className:ht.header,children:[t.jsxRuntimeExports.jsx("div",{className:ht.title,children:"Section Colors"}),!r&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(ht.value,ht.length),onClick:()=>o(!0),children:["+",n.length]})]}),r&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:ht.colors,children:n.map(a=>{const l=i(a),{variable:c,name:d,field:u}=l;return t.jsxRuntimeExports.jsx(vp,{color:s.colors[u][c],name:d})})}),n.length>3&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(ht.value,ht.length),onClick:()=>o(!1),children:["Hide ",n.length," colors"]})]})]})},vp=e=>{const{name:n,color:s}=e,{setActiveLabel:r,setModalPosition:o,setInitialColor:i,setShowModal:a,setUpdate:l,setColor:c,setColorChange:d,colorChange:u,setIsGradientActive:p}=t.useColorPickerStore(),{updateColor:m}=t.useThemeSettingsStore(),x=(v,j)=>w=>{m(v,j,w)};y.useEffect(()=>{const v=()=>{a(!1),r(null),i(s),l(()=>{}),c(s),d(()=>{})};return document.body.addEventListener("click",v),()=>{document.body.removeEventListener("click",v)}},[]);const g=v=>{const j=n.split("/")[0],w=j.split(" ")[0].toLowerCase(),_=j.split(" ")[1].toLowerCase();v.stopPropagation(),a(!0),d(u),l(R=>x(_,w)(R)),i(s),c(s),p(_==="surface");const{top:b,left:E}=aa(v,550,288,10,20,230,80);o({top:_==="surface"?b:b+125,left:E-200})};function h(v){return v.length>15?v.slice(0,15)+"...":v}return t.jsxRuntimeExports.jsxs("div",{className:ht.colorWrapper,onClick:g,children:[t.jsxRuntimeExports.jsx("div",{className:ht.color,style:{background:s}}),t.jsxRuntimeExports.jsx("div",{className:ht.name,children:n}),t.jsxRuntimeExports.jsx("div",{className:ht.value,children:h(s)})]})},Rp="_back_1sznl_1",wp="_title_1sznl_9",bp="_deleteButton_1sznl_17",Sp="_backIcon_1sznl_30",hs={back:Rp,title:wp,deleteButton:bp,backIcon:Sp},kp=({onClick:e,setIsClicked:n,getDisplayName:s})=>{var m,x;const{activeBlock:r}=t.useBlocksStore(),{setTitle:o,setDescription:i,setOnConfirm:a}=t.useConfirmationModalStore(),{blocks:l,currentBlock:c,removeBlock:d}=t.useLayersStore(),{currentPage:u,pages:p}=t.usePagesStore();return t.jsxRuntimeExports.jsxs("div",{className:hs.back,children:[t.jsxRuntimeExports.jsx("div",{className:hs.backIcon,onClick:()=>e(),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx("h3",{className:hs.title,children:r&&s(r)||p&&p[u]&&l[p[u].path]&&c&&s((m=l[p[u].path].data[c])==null?void 0:m.name)||c&&Nt(c)||"Loading"}),c&&p&&!["header","footer","announcement"].includes(c)&&l[p[u].path].data[c]&&s((x=l[p[u].path].data[c])==null?void 0:x.name)!=="unknown name"&&t.jsxRuntimeExports.jsx("button",{onClick:g=>{var h;g.stopPropagation(),o("Remove Block"),i(`Are you sure you want to delete ${s((h=l[p[u].path].data[c])==null?void 0:h.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),a(()=>{n(!0),d(p[u].path,c),e(!0)})},className:hs.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A"})})]})},Np=()=>{const e=t.useNavigate(),[n,s]=y.useState(!1),{header:r,footer:o,announcement:i,sourceBlocks:a,activeBlock:l,setActiveBlock:c,currentInstance:d,setCurrentInstance:u}=t.useBlocksStore(),{setActiveBlock:p}=t.usePreviewStore(),{blocks:m,addBlock:x,editBlock:g,currentBlock:h,setCurrentBlock:v,header:j,footer:w,announcement:_,isLoadingLayers:b}=t.useLayersStore(),{currentPage:E,pages:R}=t.usePagesStore(),{past:S,future:k}=t.useHistoryStore();function M(I=!1){if(R&&d&&h&&!["header","footer","announcement"].includes(h)&&!I){const T={blockSettings:{}};Object.keys(d.blockSettings).filter(V=>!["displayName","isAddable"].includes(V)).map(V=>{T.blockSettings[V]=d.blockSettings[V]}),g(R[E].path,h,{name:m[R[E].path].data[h].name,value:T})}c(null),v(null),p({id:null,neededScroll:!1}),setTimeout(()=>{s(!1)},150),u(null)}function A(I){var U;if(!R||!E||!I)return null;if(I==="header"){const z=new r;return Object.keys(z.blockSettings).forEach(W=>{z.blockSettings[W]=j==null?void 0:j.blockSettings[W]}),Object.keys(z.blockColors).forEach(W=>{z.blockColors[W]=j==null?void 0:j.blockColors[W]}),z}if(I==="footer"){const z=new o;return Object.keys(z.blockSettings).forEach(W=>{z.blockSettings[W]=w==null?void 0:w.blockSettings[W]}),Object.keys(z.blockColors).forEach(W=>{z.blockColors[W]=w==null?void 0:w.blockColors[W]}),z}if(I==="announcement"){const z=new i;return Object.keys(z.blockSettings).forEach(W=>{z.blockSettings[W]=_==null?void 0:_.blockSettings[W]}),Object.keys(z.blockColors).forEach(W=>{z.blockColors[W]=_==null?void 0:_.blockColors[W]}),z}const T=m[R[E].path];if(!T||!T.data[I])return null;const V=T.data[I];return!V||!a[V.name]?null:new a[V.name]((U=V.value)==null?void 0:U.blockSettings)}y.useEffect(()=>{if(h){const I=A(h);u(I)}else u(null)},[h,S,k,l]),y.useEffect(()=>{if(l&&R&&!h){const I={blockSettings:{},blockColors:{}},T=new a[l];u(T),Object.keys(T.blockSettings).filter(Z=>!["displayName","isAddable"].includes(Z)).map(Z=>{I.blockSettings[Z]=T.blockSettings[Z]}),Object.keys(T.blockColors).filter(Z=>!["displayName","isAddable"].includes(Z)).map(Z=>{I.blockColors[Z]=T.blockColors[Z]});const V=x(R[E].path,{name:l,value:I});p({id:V,neededScroll:!0}),v(V),e("/admin/builder")}},[l,S,k]);function L(I){if(!a)return"unknown name";if(!a[I])return h==="header"?j==null?void 0:j.blockSettings.displayName:h==="footer"?w==null?void 0:w.blockSettings.displayName:h==="announcement"?_==null?void 0:_.blockSettings.displayName:"unknown name";const T=new a[I];return!T.blockSettings||!T.blockSettings.displayName?"unknown name":T.blockSettings.displayName}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(Cn.render,{[Cn.open]:h,[Cn.close]:!h,[Cn.clicked]:n}),onClick:I=>I.stopPropagation(),style:{opacity:b?0:1},children:[t.jsxRuntimeExports.jsx(kp,{onClick:M,setIsClicked:s,getDisplayName:L}),t.jsxRuntimeExports.jsxs("div",{className:Cn.settings,children:[d&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(mp,{block:d}),t.jsxRuntimeExports.jsx(Ep,{colors:d.blockColors})]}),!l&&!h&&t.jsxRuntimeExports.jsx("div",{className:Cn.loading,children:"Loading"})]})]})},Ip="_header_9rrfr_1",Tp="_title_9rrfr_9",Lp="_backIcon_9rrfr_15",mr={header:Ip,title:Tp,backIcon:Lp},ss=({onClick:e,title:n})=>t.jsxRuntimeExports.jsxs("div",{className:mr.header,children:[t.jsxRuntimeExports.jsx("div",{className:mr.backIcon,onClick:e,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx("span",{className:mr.title,children:n})]}),Pp="_options_ymds7_1",Mp={options:Pp},Ap="_wrapper_kzokw_1",Bp="_open_kzokw_16",$p="_close_kzokw_20",xr={wrapper:Ap,open:Bp,close:$p},rs=e=>{const{isOpen:n,isClose:s,children:r}=e;return t.jsxRuntimeExports.jsx("div",{className:t.clx(xr.wrapper,{[xr.open]:n,[xr.close]:s}),children:r})},Dp=()=>{var d,u;const{activeBlock:e,themeSettings:n,updateBorder:s,setActiveBlock:r}=t.useThemeSettingsStore();function o(p,m){s(m,p)}const i=t.useNavigate();function a(){r(null),i("/admin/builder/theme")}const l=y.useMemo(()=>n.borders,[n]),c=(e==null?void 0:e.name)==="Borders";return t.jsxRuntimeExports.jsxs(rs,{isOpen:c,isClose:!c,children:[t.jsxRuntimeExports.jsx(ss,{onClick:a,title:"Borders Style"}),t.jsxRuntimeExports.jsxs("div",{className:Mp.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Border Radius (px)",options:Object.keys(or),value:((d=Object.entries(or).find(([p,m])=>m===l.radius))==null?void 0:d[0])||"None",onChange:p=>o(or[p],"radius")}),t.jsxRuntimeExports.jsx(t.Select,{label:"Border Thickness (px)",options:Object.keys(ir),value:((u=Object.entries(ir).find(([p,m])=>m===l.thickness))==null?void 0:u[0])||"None",onChange:p=>o(ir[p],"thickness")})]})]})},Op="_options_jo38w_1",Hp="_alignments_jo38w_9",Vp="_blocks_jo38w_15",Fp="_alignment_jo38w_9",Zp="_active_jo38w_34",zp="_chargeTypes_jo38w_41",Up="_charge_jo38w_41",Wp="_chargeActive_jo38w_69",qp="_sliderContainer_jo38w_83",Gp="_shadowInputs_jo38w_91",Yp="_label_jo38w_102",Xp="_shadowInputsRow_jo38w_111",Kp="_shadowInputsOpen_jo38w_119",Je={options:Op,alignments:Hp,blocks:Vp,alignment:Fp,active:Zp,chargeTypes:zp,charge:Up,chargeActive:Wp,sliderContainer:qp,shadowInputs:Gp,label:Yp,shadowInputsRow:Xp,shadowInputsOpen:Kp},Bt=e=>{const{initialColor:n,onChange:s,title:r,labelStyle:o="primary",isGradientActive:i=!0}=e,[a,l]=y.useState(n);y.useEffect(()=>{l(n)},[n]);const{setActiveLabel:c,setModalPosition:d,setInitialColor:u,setShowModal:p,setUpdate:m,setColor:x,setColorChange:g,setIsGradientActive:h,colorChange:v}=t.useColorPickerStore();y.useEffect(()=>{const w=()=>{p(!1),c(null),u(n),m(()=>{}),x(n),g(()=>{})};return document.body.addEventListener("click",w),()=>{document.body.removeEventListener("click",w)}},[]);const j=w=>{w.stopPropagation(),p(!0),g(l),m(s),u(n),x(a),h(i);const{top:_,left:b}=aa(w,600,288,10,20,230,80);d({top:_,left:b})};return t.jsxRuntimeExports.jsxs("div",{className:me.content,children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(me.name,{[me.secondary]:o==="secondary"}),children:r}),t.jsxRuntimeExports.jsxs("label",{className:me.label,onClick:w=>w.stopPropagation(),children:[t.jsxRuntimeExports.jsx("div",{className:me.colorValue,style:{background:a},onClick:j}),t.jsxRuntimeExports.jsx("input",{type:"text",value:a,onChange:w=>{const _=w.target.value;s(_),x(_),l(_),v(_)},className:me.input})]})]})},Jp=["left","center","right"],Qp=()=>{const{activeBlock:e,themeSettings:n,updateButton:s,setActiveBlock:r}=t.useThemeSettingsStore(),{fonts:o}=t.useFontsStore(),[i,a]=y.useState("primary");function l(h,v){s(i,v,h)}const[c,d]=y.useState(!1),u=n.buttons[i],p=t.useNavigate();function m(){r(null),p("/admin/builder/theme")}const x=(e==null?void 0:e.name)==="Buttons";function g(h,v){l({...u.boxShadow,[h]:v},"boxShadow")}return t.jsxRuntimeExports.jsxs(rs,{isOpen:x,isClose:!x,children:[t.jsxRuntimeExports.jsx(ss,{onClick:m,title:"Buttons Style"}),t.jsxRuntimeExports.jsx("div",{className:Je.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(h=>t.jsxRuntimeExports.jsx("div",{className:t.clx(Je.charge,{[Je.chargeActive]:i===h}),onClick:()=>a(h),children:h.charAt(0).toUpperCase()+h.slice(1)},h))}),u&&t.jsxRuntimeExports.jsxs("div",{className:Je.options,children:[t.jsxRuntimeExports.jsx(t.Input,{label:"Height (px)",value:String(u.height),onChange:h=>l(Number(h),"height"),type:"number",min:0}),t.jsxRuntimeExports.jsx(t.Select,{label:"Font Size (px)",value:String(u.size),onChange:h=>l(Number(h),"size"),options:Vs}),t.jsxRuntimeExports.jsx(t.Input,{label:"Border Radius (px)",value:String(u.radius),onChange:h=>l(Number(h),"radius"),type:"number",min:0}),t.jsxRuntimeExports.jsx(t.Select,{label:"Font",value:u.font,onChange:h=>l(h,"font"),options:[...o.filter(h=>h.name!==u.font).map(h=>h.name)]}),t.jsxRuntimeExports.jsx(Bt,{initialColor:u.color,onChange:h=>l(h,"color"),title:"Text Color",labelStyle:"secondary",isGradientActive:!1}),t.jsxRuntimeExports.jsx(Bt,{initialColor:u.background,onChange:h=>l(h,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),t.jsxRuntimeExports.jsxs("div",{className:Je.sliderContainer,children:[t.jsxRuntimeExports.jsx("h4",{className:Je.label,children:"Shadow"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>d(!c),style:{padding:5,display:"flex"},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",style:{rotate:c?"0deg":"-180deg",transition:"0.3s rotate ease"}})})]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(Je.shadowInputs,{[Je.shadowInputsOpen]:c}),children:[t.jsxRuntimeExports.jsxs("div",{className:Je.shadowInputsRow,children:[t.jsxRuntimeExports.jsx(t.Input,{label:"Left (px)",value:String(u.boxShadow.left),onChange:h=>g("left",Number(h)),type:"number"}),t.jsxRuntimeExports.jsx(t.Input,{label:"Top (px)",value:String(u.boxShadow.top),onChange:h=>g("top",Number(h)),type:"number"}),t.jsxRuntimeExports.jsx(t.Input,{label:"Blur (px)",value:String(u.boxShadow.blur),onChange:h=>g("blur",Number(h)),type:"number"}),t.jsxRuntimeExports.jsx("div",{style:{flex:1,whiteSpace:"nowrap"},children:t.jsxRuntimeExports.jsx(t.Input,{label:"Spread (px)",value:String(u.boxShadow.spread),onChange:h=>g("spread",Number(h)),type:"number"})})]}),t.jsxRuntimeExports.jsx(Bt,{initialColor:u.boxShadow.color,onChange:h=>g("color",h),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),t.jsxRuntimeExports.jsxs("div",{className:Je.alignments,children:[t.jsxRuntimeExports.jsx("h4",{className:Je.label,children:"Alignment Type"}),t.jsxRuntimeExports.jsx("div",{className:Je.blocks,children:Jp.map(h=>t.jsxRuntimeExports.jsx("div",{className:t.clx(Je.alignment,{[Je.active]:u.alignment===h}),onClick:()=>{l(h,"alignment")},children:t.jsxRuntimeExports.jsx(t.Icon,{name:h==="center"?"AlignCenterHorizontal":h==="left"?"AlignLeft":"AlignRight",fill:u.alignment===h?"#252525":"#757575"})},h))})]}),t.jsxRuntimeExports.jsx(t.Switch,{label:"Enable Hover",onChange:h=>l(h,"hover"),current:u.hover}),u.hover&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Bt,{initialColor:u.colorHover,onChange:h=>l(h,"colorHover"),title:"Hover Text Color",labelStyle:"secondary",isGradientActive:!1}),t.jsxRuntimeExports.jsx(Bt,{initialColor:u.backgroundHover,onChange:h=>l(h,"backgroundHover"),title:"Hover Background Color",labelStyle:"secondary",isGradientActive:!0})]})]})]})},em="_category_hxy9u_1",tm="_categoryTitle_hxy9u_19",hr={category:em,categoryTitle:tm},nm=()=>{const{themeSettings:e,setActiveColorCategory:n}=t.useThemeSettingsStore();function s(r){n(r)}return t.jsxRuntimeExports.jsx("div",{className:hr.wrapper,children:Object.keys(e.colors).map(r=>r==="icon"?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}):t.jsxRuntimeExports.jsxs("div",{className:hr.category,onClick:()=>s(r),children:[t.jsxRuntimeExports.jsxs("h2",{className:hr.categoryTitle,children:[r==="text"?"Text & Icon":Nt(r)," Colors"]}),t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretRight",width:24,height:24})]},r))})},sm="_options_ikvjo_38",rm={options:sm},om=()=>{const{activeBlock:e,setActiveFont:n,activeFont:s,themeSettings:r,updateFont:o}=t.useThemeSettingsStore(),{fonts:i}=t.useFontsStore(),[a,l]=y.useState(null);function c(){n(null)}function d(h,v){a&&s&&o("desktop",a,s,v,h)}const[u,p]=y.useState([]),m=y.useMemo(()=>s?r.fonts.desktop.heading[s]?(l("heading"),r.fonts.desktop.heading[s]):r.fonts.desktop.body[s]?(l("body"),r.fonts.desktop.body[s]):(l(null),null):null,[s,r]);y.useEffect(()=>{if(m){const h=i.find(v=>v.name===m.font);h&&(p(h.weights),h.weights.includes(m.boldWeight)||d("400","boldWeight"),h.weights.includes(m.weight)||d("400","weight"))}},[m,s]);const x=!!((e==null?void 0:e.name)==="Fonts"&&s),g=(e==null?void 0:e.name)!=="Fonts"||!s;return t.jsxRuntimeExports.jsxs(rs,{isOpen:x,isClose:g,children:[t.jsxRuntimeExports.jsx(ss,{onClick:c,title:"Font Style"}),s&&m&&t.jsxRuntimeExports.jsxs("div",{className:rm.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Font",value:m.font,onChange:h=>d(h,"font"),options:[...i.filter(h=>h.name!==m.font).map(h=>h.name)]}),t.jsxRuntimeExports.jsx(t.Select,{label:"Size",value:String(m.size),onChange:h=>d(h,"size"),options:Vs}),t.jsxRuntimeExports.jsx(t.Select,{label:"Default Weight",value:String(m.weight),onChange:h=>d(h,"weight"),options:u}),t.jsxRuntimeExports.jsx(t.Select,{label:"Bold Weight",value:String(m.boldWeight),onChange:h=>d(h,"boldWeight"),options:u}),t.jsxRuntimeExports.jsx(t.Select,{label:"Case",value:String(m.case).charAt(0).toUpperCase()+String(m.case).slice(1),onChange:h=>d(h.toLowerCase(),"case"),options:["Normal","Uppercase","Lowercase","Capitalize"].filter(h=>h.toLowerCase()!==String(m.case))})]})]})},im="_wrapper_mkmxa_1",am="_category_mkmxa_5",lm="_categoryTitle_mkmxa_11",cm="_font_mkmxa_17",um="_content_mkmxa_32",dm="_icon_mkmxa_39",pm="_paragraph_mkmxa_50",Wt={wrapper:im,category:am,categoryTitle:lm,font:cm,content:um,icon:dm,paragraph:pm},mm={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",h7:"h7",lg:"large",md:"medium",sm:"small"},xm=e=>{const{font:n,size:s,id:r,category:o}=e,{setActiveFont:i}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsxs("div",{className:Wt.font,onClick:()=>i(r),children:[t.jsxRuntimeExports.jsx("div",{className:t.clx(Wt.icon,{[Wt.paragraph]:o==="paragraph"}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:o==="paragraph"?"TextB":"TextH"})}),t.jsxRuntimeExports.jsxs("div",{className:Wt.content,children:[t.jsxRuntimeExports.jsx("h2",{className:Wt.categoryTitle,children:Nt(mm[r])}),t.jsxRuntimeExports.jsx("span",{className:Wt.value,children:`${n}, ${s}px`})]})]})},hm=()=>{const{themeSettings:e,setActiveFont:n,activeBlock:s}=t.useThemeSettingsStore();y.useEffect(()=>(r(),()=>{r()}),[]);function r(){n(null)}if(s!=null&&s.name)return t.jsxRuntimeExports.jsx("div",{className:Wt.wrapper,children:Object.entries(e.fonts.desktop).sort(([o],[i])=>o==="heading"?-1:i==="heading"?1:0).map(([o,i])=>t.jsxRuntimeExports.jsxs("div",{className:Wt.category,children:[t.jsxRuntimeExports.jsx("h2",{className:Wt.categoryTitle,children:Nt(o)}),Object.entries(i).map(([a,l])=>t.jsxRuntimeExports.jsx(xm,{id:a,category:o,...l},a))]},o))})},fm="_wrapper_16ym0_2",gm="_categoryTitle_16ym0_12",jm="_title_16ym0_74",ym="_field_16ym0_82",Cm="_alignments_16ym0_92",_m="_lineField_16ym0_98",Em="_style_16ym0_106",vm="_header_16ym0_113",St={wrapper:fm,categoryTitle:gm,title:jm,field:ym,alignments:Cm,lineField:_m,style:Em,header:vm},Rm="_blocks_emecf_1",wm="_block_emecf_1",bm="_active_emecf_21",fr={blocks:Rm,block:wm,active:bm},Ho=e=>{const{items:n,selectedItem:s,onSelect:r,getIconName:o}=e;return t.jsxRuntimeExports.jsx("div",{className:fr.blocks,children:n.map(i=>t.jsxRuntimeExports.jsx("div",{className:t.clx(fr.block,{[fr.active]:s===i}),onClick:()=>r(i),children:t.jsxRuntimeExports.jsx(t.Icon,{name:o(i),fill:s===i?"#252525":"#757575"})},String(i)))})},Sm=["left","center","right"],km=["solid","dashed"],fs=e=>{const{title:n,children:s,rightAddon:r}=e;return t.jsxRuntimeExports.jsxs("div",{className:St.field,children:[t.jsxRuntimeExports.jsxs("div",{className:St.header,children:[t.jsxRuntimeExports.jsx("h4",{className:St.categoryTitle,children:n}),r]}),s]})},Nm=()=>{const{themeSettings:e,updateInput:n}=t.useThemeSettingsStore(),s=y.useMemo(()=>e.inputs,[e]),r=(i,a,l)=>{n(i,a,l)},o=i=>a=>{n(i,a,"color")};return t.jsxRuntimeExports.jsxs("div",{className:St.wrapper,children:[t.jsxRuntimeExports.jsxs(fs,{title:"General",children:[t.jsxRuntimeExports.jsx(t.Input,{label:"Height (px)",value:String(s.general.height),onChange:i=>r("general",i,"height"),type:"number",min:0}),t.jsxRuntimeExports.jsx(t.Select,{label:"Font Size (px)",onChange:i=>r("general",i,"size"),value:String(s.general.size),options:Vs}),t.jsxRuntimeExports.jsx(Bt,{initialColor:Nt(s.general.color),onChange:o("general"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})]}),t.jsxRuntimeExports.jsx(fs,{title:"Field Fill",rightAddon:t.jsxRuntimeExports.jsx("div",{className:St.switch,children:t.jsxRuntimeExports.jsx(t.Switch,{onChange:i=>r("field",i,"active"),current:s.field.active})}),children:t.jsxRuntimeExports.jsx(Bt,{initialColor:s.field.color,onChange:o("field"),title:"Color",labelStyle:"secondary"})}),t.jsxRuntimeExports.jsxs(fs,{title:"Border",rightAddon:t.jsxRuntimeExports.jsx("div",{className:St.switch,children:t.jsxRuntimeExports.jsx(t.Switch,{onChange:i=>r("border",i,"active"),current:s.border.active})}),children:[t.jsxRuntimeExports.jsxs("div",{className:St.lineField,children:[t.jsxRuntimeExports.jsxs("div",{className:St.style,children:[t.jsxRuntimeExports.jsx("span",{className:St.title,children:"Style"}),t.jsxRuntimeExports.jsx(Ho,{items:km,selectedItem:s.border.style,onSelect:i=>r("border",i,"style"),getIconName:i=>i==="solid"?"Minus":"Selection"})]}),t.jsxRuntimeExports.jsx(t.Input,{label:"Radius (px)",value:String(s.border.radius),onChange:i=>r("border",i,"radius"),type:"number",min:0})]}),t.jsxRuntimeExports.jsx(t.Input,{label:"Thickness (px)",value:String(s.border.thickness),onChange:i=>r("border",i,"thickness"),type:"number",min:0}),t.jsxRuntimeExports.jsx(Bt,{initialColor:Nt(s.border.color),onChange:o("border"),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),t.jsxRuntimeExports.jsxs(fs,{title:"Label",children:[t.jsxRuntimeExports.jsx(t.Input,{label:"Line Height (px)",value:String(s.label.height),onChange:i=>r("label",i,"height"),type:"number",min:0}),t.jsxRuntimeExports.jsx(t.Select,{label:"Font Size (px)",onChange:i=>r("label",i,"size"),value:String(s.label.size),options:Vs}),t.jsxRuntimeExports.jsx(Bt,{initialColor:Nt(s.label.color),onChange:o("label"),title:"Color",labelStyle:"secondary",isGradientActive:!1}),t.jsxRuntimeExports.jsxs("div",{className:St.alignments,children:[t.jsxRuntimeExports.jsx("h4",{className:St.title,children:"Alignment Type"}),t.jsxRuntimeExports.jsx(Ho,{items:Sm,selectedItem:s.label.alignment,onSelect:i=>r("label",i,"alignment"),getIconName:i=>i==="center"?"AlignCenterHorizontal":i==="left"?"AlignLeft":"AlignRight"})]})]})]})},Im="_wrapper_1yw63_2",Tm="_color_1yw63_24",Lm="_content_1yw63_33",Pm="_preview_1yw63_42",Mm="_container_1yw63_52",Am="_buttonWrapper_1yw63_62",Bm="_button_1yw63_62",$m="_buttonBorder_1yw63_80",Dm="_buttonBackground_1yw63_83",Om="_text_1yw63_87",Hm="_textText_1yw63_93",Vm="_icon_1yw63_97",Fm="_iconIcon_1yw63_100",Zm="_annotation_1yw63_104",zm="_annotationText_1yw63_111",Um="_label_1yw63_116",Wm="_circle_1yw63_127",qm="_line_1yw63_140",Gm="_circle1_1yw63_154",Ym="_circle2_1yw63_159",Xm="_annotationIcon_1yw63_164",Km="_annotationBorder_1yw63_192",Jm="_line1_1yw63_203",Qm="_line2_1yw63_210",e2="_circle3_1yw63_227",t2="_circle4_1yw63_232",n2="_annotationSurface_1yw63_237",te={wrapper:Im,color:Tm,content:Lm,preview:Pm,container:Mm,buttonWrapper:Am,button:Bm,buttonBorder:$m,buttonBackground:Dm,text:Om,textText:Hm,icon:Vm,iconIcon:Fm,annotation:Zm,annotationText:zm,label:Um,circle:Wm,line:qm,circle1:Gm,circle2:Ym,annotationIcon:Xm,annotationBorder:Km,line1:Jm,line2:Qm,circle3:e2,circle4:t2,annotationSurface:n2},s2=()=>{const{activeColorCategory:e}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx("div",{className:te.container,children:t.jsxRuntimeExports.jsxs("div",{className:te.buttonWrapper,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(te.button,{[te.buttonBorder]:e==="border",[te.buttonBackground]:e==="surface"}),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Smiley",className:t.clx(te.icon,{[te.iconIcon]:e==="text"}),width:22,height:22,fill:"#757575"}),t.jsxRuntimeExports.jsx("span",{className:t.clx(te.text,{[te.textText]:e==="text"}),children:"Button Example"})]}),e==="text"&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(te.annotation,te.annotationText),children:[t.jsxRuntimeExports.jsx("div",{className:te.label,children:"Text Color"}),t.jsxRuntimeExports.jsx("div",{className:te.line}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.circle,te.circle1)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.circle,te.circle2)})]}),e==="text"&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(te.annotation,te.annotationIcon),children:[t.jsxRuntimeExports.jsx("div",{className:te.label,children:"Icon Color"}),t.jsxRuntimeExports.jsx("div",{className:te.line}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.circle,te.circle1)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.circle,te.circle2)})]}),e==="border"&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(te.annotation,te.annotationBorder),children:[t.jsxRuntimeExports.jsx("div",{className:te.label,children:"Border Color"}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.line,te.line1)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.line,te.line2)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.circle,te.circle1)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.circle,te.circle2)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.circle,te.circle3)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.circle,te.circle4)})]}),e==="surface"&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(te.annotation,te.annotationSurface),children:[t.jsxRuntimeExports.jsx("div",{className:te.label,children:"Surface Color"}),t.jsxRuntimeExports.jsx("div",{className:te.line}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.circle,te.circle1)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(te.circle,te.circle2)})]})]})})},r2={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"]},o2=()=>{const{activeBlock:e,setActiveColorCategory:n,activeColorCategory:s,themeSettings:r,updateColor:o}=t.useThemeSettingsStore();function i(){n(null)}function a(u,p,m){o(u,p,m)}const l=!!((e==null?void 0:e.name)==="Colors"&&s),c=(e==null?void 0:e.name)!=="Colors"||!s,d=s?r2[s]:[];return t.jsxRuntimeExports.jsxs(rs,{isOpen:l,isClose:c,children:[t.jsxRuntimeExports.jsx(ss,{onClick:i,title:s==="text"?"Text & Icon Colors":`${Nt(s)} Colors`}),s&&t.jsxRuntimeExports.jsxs("div",{className:te.wrapper,children:[t.jsxRuntimeExports.jsx(s2,{}),d.map(u=>{const p=r.colors[s][u];return p?t.jsxRuntimeExports.jsx("div",{className:te.color,children:t.jsxRuntimeExports.jsxs("div",{className:te.content,children:[t.jsxRuntimeExports.jsx("div",{className:te.preview,style:{background:p}}),t.jsxRuntimeExports.jsx(Bt,{title:Nt(u),initialColor:p,onChange:m=>a(s,u,m),isGradientActive:s==="surface"})]})},u):null})]})]})},i2="_loader_1p5lr_1",a2={loader:i2},l2=()=>{const{activeBlock:e,themeSettings:n,isLoadingThemeSettings:s}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:s?t.jsxRuntimeExports.jsx("div",{className:a2.loader,children:t.jsxRuntimeExports.jsx(rn,{})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[(e==null?void 0:e.name)==="Fonts"&&n.fonts&&t.jsxRuntimeExports.jsx(hm,{}),(e==null?void 0:e.name)==="Fonts"&&n.fonts&&t.jsxRuntimeExports.jsx(om,{}),(e==null?void 0:e.name)==="Colors"&&n.colors&&t.jsxRuntimeExports.jsx(nm,{}),(e==null?void 0:e.name)==="Colors"&&n.colors&&t.jsxRuntimeExports.jsx(o2,{}),(e==null?void 0:e.name)==="Inputs"&&n.inputs&&t.jsxRuntimeExports.jsx(Nm,{}),(e==null?void 0:e.name)==="Borders"&&n.borders&&t.jsxRuntimeExports.jsx(Dp,{}),(e==null?void 0:e.name)==="Buttons"&&n.buttons&&t.jsxRuntimeExports.jsx(Qp,{})]})})},c2=()=>{const{activeBlock:e,setActiveBlock:n}=t.useThemeSettingsStore(),{activeBlock:s}=t.useNavbarStore(),r=t.useNavigate();function o(){n(null),r("/admin/builder/theme")}const i=!!e,a=!e||s.name!=="Theme";return t.jsxRuntimeExports.jsxs(rs,{isOpen:i,isClose:a,children:[t.jsxRuntimeExports.jsx(ss,{onClick:o,title:(e==null?void 0:e.name)||""}),t.jsxRuntimeExports.jsx(l2,{})]})},u2=()=>{const{activeBlock:e}=t.useNavbarStore(),{showTooltip:n}=t.useTooltipStore();function s(){switch(e.name){case"Layers":return"Layers";case"Add":return"Add Sections";case"Theme":return"Theme Settings";case"Settings":return"Settings"}}return t.jsxRuntimeExports.jsxs("div",{className:Oo.sidebar,style:{zIndex:n?50:"auto"},children:[t.jsxRuntimeExports.jsx("h3",{className:Oo.title,children:s()}),e.name==="Layers"&&t.jsxRuntimeExports.jsx(Kd,{}),e.name==="Add"&&t.jsxRuntimeExports.jsx(ca,{}),t.jsxRuntimeExports.jsx(Np,{}),t.jsxRuntimeExports.jsx(c2,{}),e.name==="Theme"&&t.jsxRuntimeExports.jsx(ip,{}),e.name==="Settings"&&t.jsxRuntimeExports.jsx(ep,{})]})},d2="_wrapper_no6if_1",p2="_header_no6if_12",m2="_content_no6if_23",x2="_buttons_no6if_44",h2="_label_no6if_51",f2="_description_no6if_52",g2="_preview_no6if_60",j2="_block_no6if_66",y2="_slug_no6if_75",C2="_title_no6if_81",_2="_closeIcon_no6if_87",Ct={wrapper:d2,header:p2,content:m2,buttons:x2,label:h2,description:f2,preview:g2,block:j2,slug:y2,title:C2,closeIcon:_2},E2="_wrapper_ba9vp_2",v2="_label_ba9vp_10",R2="_options_ba9vp_18",w2="_radioLabel_ba9vp_24",b2="_radio_ba9vp_24",S2="_custom_ba9vp_39",k2="_option_ba9vp_18",cn={wrapper:E2,label:v2,options:R2,radioLabel:w2,radio:b2,custom:S2,option:k2},N2=e=>{const{defaultValue:n,options:s,onChange:r,label:o}=e,[i,a]=y.useState(n),l=c=>{const d=c.target.value;a(d),r(d)};return t.jsxRuntimeExports.jsxs("div",{className:cn.wrapper,children:[t.jsxRuntimeExports.jsx("span",{className:cn.label,children:o}),t.jsxRuntimeExports.jsx("div",{className:cn.options,children:s.map(c=>t.jsxRuntimeExports.jsxs("label",{className:cn.radioLabel,children:[t.jsxRuntimeExports.jsx("input",{type:"radio",value:c.value,checked:i===c.value,onChange:l,className:cn.radio}),t.jsxRuntimeExports.jsx("span",{className:cn.custom}),t.jsxRuntimeExports.jsx("span",{className:cn.option,children:c.label})]},c.value))})]})},I2=()=>{var M,A,L,I,T,V,Z;const{setIsOpenModal:e,pages:n,createPage:s,updatePage:r,isEdit:o,setIsEdit:i,editedPage:a,setEditedPage:l,pageContext:c}=t.usePagesStore(),{setIsOpen:d}=t.useModalStore(),{createPage:u,updatePage:p}=t.useLayersStore(),[m,x]=y.useState(a?n&&((M=n[a])==null?void 0:M.path):""),[g,h]=y.useState(a?n&&((A=n[a])==null?void 0:A.name):""),[v,j]=y.useState(a?n&&((L=n[a])==null?void 0:L.seo)&&((T=(I=n[a])==null?void 0:I.seo)==null?void 0:T.pageDescription)||"":`${c.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`),[w,_]=y.useState(a&&n&&(V=n[a])!=null&&V.isPrivate?"private":"public");function b(){x(""),h(""),j(""),_("public"),i(!1),l(null)}function E(){d(!1),setTimeout(()=>{b(),e(!1),d(!0)},300)}y.useEffect(()=>()=>{E()},[]);function R(U){return U[0]==="/"?U:"/"+U}function S(){s({path:R(m),name:g||m||"",icon:"File",seo:{pageTitle:g||"",pageDescription:v||""},visibility:w||"public"}),u(R(m)),E()}function k(){n&&(t.defaultPagePaths.includes(n[a].path)||la(n[a].path),p(n[a].path||"",m||""),r(a,{path:R(m),name:g||m,icon:n[a].icon||"File",seo:{pageTitle:g||"",pageDescription:v||""},visibility:w||"public"})),E()}return t.jsxRuntimeExports.jsxs("div",{className:Ct.wrapper,onClick:U=>U.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:Ct.header,children:[t.jsxRuntimeExports.jsx("h2",{children:o?"Edit Page":"Create New Page"}),t.jsxRuntimeExports.jsx("div",{className:Ct.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:E})})]}),t.jsxRuntimeExports.jsxs("div",{className:Ct.content,children:[t.jsxRuntimeExports.jsx(t.Input,{label:"Page Slug",onChange:U=>x(U),value:m,placeholder:"path-to-page",disabled:!!(a&&n&&((Z=n[a])!=null&&Z.name)&&t.defaultPagePaths.includes(n[a].path)),required:!0,regex:"^.+$"}),t.jsxRuntimeExports.jsx(t.Input,{label:"Page Title",onChange:U=>{h(U)},value:g.charAt(0).toUpperCase()+g.slice(1),placeholder:"Contact us"}),t.jsxRuntimeExports.jsx(t.Textarea,{label:"Description",onChange:U=>j(U),value:v,placeholder:`${c.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`,maxLength:150}),t.jsxRuntimeExports.jsx(N2,{label:"Visibility",defaultValue:w,options:[{value:"public",label:"Public"},{value:"private",label:"Private"}],onChange:U=>_(U)}),t.jsxRuntimeExports.jsxs("div",{className:Ct.preview,children:[t.jsxRuntimeExports.jsx("span",{className:Ct.label,children:"Preview"}),t.jsxRuntimeExports.jsxs("div",{className:Ct.block,children:[t.jsxRuntimeExports.jsx("span",{className:Ct.slug,children:m||"yoursite.url"}),t.jsxRuntimeExports.jsx("span",{className:Ct.title,children:g||"My Blank Page"}),t.jsxRuntimeExports.jsx("span",{className:Ct.description,children:v||"It is My Description"})]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:Ct.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:E,type:"Secondary",children:"Cancel"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:o?k:S,disabled:m.length===0,children:o?"Update":"Create"})]})]})},T2="_layout_1pjho_1",L2="_main_1pjho_10",P2="_content_1pjho_18",M2="_notifications_1pjho_26",gs={layout:T2,main:L2,content:P2,notifications:M2},A2="_notification_2jmah_1",B2="_text_2jmah_22",$2="_timer_2jmah_27",D2="_warning_2jmah_32",O2="_error_2jmah_37",H2="_success_2jmah_42",_n={notification:A2,text:B2,timer:$2,warning:D2,error:O2,success:H2},Vo={warning:"#C1972A",error:"#FF3F19",success:"#338B13"},ua=e=>{const{type:n,message:s,style:r,padding:o,timer:i,id:a}=e,[l,c]=y.useState(i),{setNotifications:d}=t.useNotificationStore();function u(){const m=t.useNotificationStore.getState().notifications.filter(x=>x.id!==a);d([...m])}return y.useEffect(()=>{const p=setTimeout(()=>{u()},i*1e3);return()=>clearTimeout(p)},[i]),y.useEffect(()=>{const p=setInterval(()=>c(m=>m-1),1e3);return()=>clearInterval(p)},[l]),t.jsxRuntimeExports.jsx("div",{style:{padding:o,position:"relative"},children:t.jsxRuntimeExports.jsxs("div",{className:t.clx(_n.notification,{[_n.warning]:n==="warning",[_n.error]:n==="error",[_n.success]:n==="success"}),style:r,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",fill:Vo[n],width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:_n.text,children:s}),i&&t.jsxRuntimeExports.jsx("div",{className:_n.timer,children:l}),t.jsxRuntimeExports.jsx("div",{style:{display:"flex"},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:Vo[n],width:20,height:20,hoverable:!0,onClick:()=>u()})})]})})},V2="_modal_1h74q_1",F2="_title_1h74q_14",Z2="_buttons_1h74q_20",js={modal:V2,title:F2,buttons:Z2},da=()=>{const{title:e,description:n,onConfirm:s,setTitle:r,setDescription:o,setOnConfirm:i}=t.useConfirmationModalStore(),{setIsOpen:a}=t.useModalStore();function l(){a(!1),setTimeout(()=>{r(null),o(null),i(null),a(!0)},300)}return e&&n&&s&&t.jsxRuntimeExports.jsxs("div",{className:js.modal,onClick:c=>c.stopPropagation(),children:[t.jsxRuntimeExports.jsx("div",{className:js.title,children:e}),t.jsxRuntimeExports.jsx("div",{className:js.description,children:n}),t.jsxRuntimeExports.jsxs("div",{className:js.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:l,children:"Cancel"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>{s(),l()},type:"Secondary",children:"Confirm"})]})]})},z2="_modal_270ti_1",U2="_padding_270ti_17",W2="_content_270ti_21",q2="_close_270ti_42",ys={modal:z2,padding:U2,content:W2,close:q2},Bs=e=>{const{close:n,children:s,withAnimation:r=!0,hasPadding:o=!0}=e,{isOpen:i,setIsOpen:a}=t.useModalStore();return y.useEffect(()=>{const l=()=>{a(!1),r?setTimeout(()=>{n(!1),a(!0)},300):(n(!1),a(!0))};return document.body.addEventListener("click",l),()=>{document.body.removeEventListener("click",l)}},[]),t.jsxRuntimeExports.jsx("div",{className:t.clx(ys.modal,{[ys.padding]:o}),children:r?t.jsxRuntimeExports.jsx("div",{className:t.clx(ys.content,{[ys.close]:!i}),children:s}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:s})})},G2=()=>{const{isOpenModal:e,setIsOpenModal:n}=t.usePagesStore(),{openModal:s,setOpenModal:r}=t.useChooseImageStore(),{notifications:o}=t.useNotificationStore(),{title:i,description:a,setTitle:l,setDescription:c,setOnConfirm:d}=t.useConfirmationModalStore();return t.jsxRuntimeExports.jsxs("div",{id:"builder",children:[t.jsxRuntimeExports.jsxs("div",{className:gs.layout,children:[t.jsxRuntimeExports.jsx(d1,{}),t.jsxRuntimeExports.jsxs("main",{className:gs.main,children:[t.jsxRuntimeExports.jsx(n1,{}),t.jsxRuntimeExports.jsxs("div",{className:gs.content,children:[t.jsxRuntimeExports.jsx(u2,{}),t.jsxRuntimeExports.jsx(Id,{})]})]})]}),i&&a&&t.jsxRuntimeExports.jsx(Bs,{close:()=>{l(null),c(null),d(null)},children:t.jsxRuntimeExports.jsx(da,{})}),e&&t.jsxRuntimeExports.jsx(Bs,{close:n,children:t.jsxRuntimeExports.jsx(I2,{})}),s&&t.jsxRuntimeExports.jsx(Bs,{close:r,children:t.jsxRuntimeExports.jsx(t.ChooseImageModal,{})}),o.length>0&&t.jsxRuntimeExports.jsx("div",{className:gs.notifications,children:o.map(u=>t.jsxRuntimeExports.jsx(ua,{type:u.status,message:u.message,timer:10,id:u.id},u.id))})]})};async function En(e,n){const s=localStorage.getItem("shopId")||void 0,r=`${t.API_URL}/${e}/builder/shops/${s}/${n}`;return(await t.request({url:r,withToken:!0,method:"get"})).data}async function Y2(){try{const[e,n,s,r,o,i,a,l]=await Promise.allSettled([En("v1","general"),En("v1","faqs"),En("v1","listings"),En("v1","products"),En("v1","reviews"),En("v1","categories"),{data:null},{data:null}]);return{general:e,faqs:n,listings:s,products:r,reviews:o,categories:i,fullPosts:a,posts:l}}catch(e){throw console.error("Error fetching page data:",e),e}}async function X2(){try{const{data:e}=await t.axios.get(`${t.GOOGLE_FONTS_API}?key=AIzaSyAEsTbjAPUz_TeuFCq4z4LPK9w_vst0Pfw`);return e.items}catch(e){throw console.error("Error fetching page data:",e),e}}async function K2(){var r;const e=localStorage.getItem("shopId"),n=localStorage.getItem("draftId"),s=`${t.API_URL}/v2/builder/shops/${e}/drafts/${n}/pages`;try{return(await t.request({url:s,withToken:!0,method:"get"})).data}catch(o){return{data:[],status:(r=o.response)==null?void 0:r.status}}}async function J2(){const e=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId")||void 0,s=`${t.API_URL}/v2/builder/shops/${e}/drafts/${n}/all`;return(await t.request({url:s,withToken:!0,method:"get"})).data}const Q2=e=>{const{blocks:n,settings:s,header:r,footer:o,announcement:i}=e,{setBlocks:a,setSourceBlocks:l,setHeader:c,setFooter:d,setAnnouncement:u,setSettings:p}=t.useBlocksStore(),{fonts:m,setFonts:x}=t.useFontsStore(),{setSettings:g}=t.useSettingsStore(),{setPageContext:h}=t.usePagesStore(),{setThemeSettings:v,setIsLoadingThemeSettings:j}=t.useThemeSettingsStore(),{setIsLoadingSettings:w}=t.useSettingsStore(),{notifications:_,setNotifications:b}=t.useNotificationStore(),{setBlocks:E,blocks:R,createPage:S,setIsLoadingLayers:k,setHeader:M,setAnnouncement:A,setFooter:L}=t.useLayersStore(),{setPages:I,setCurrentPage:T}=t.usePagesStore();return y.useEffect(()=>{j(!0),k(!0),w(!0);const V={};Object.keys(n).forEach(U=>{V[U]=n[U]}),l(V),a(V),c(r),d(o),u(i),p(s),(async()=>{const U={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null,fullPosts:null,posts:null},z=await Y2();Object.keys(z).map(O=>{const X=O;U[X]=z[X].value.data}),h(U);const{data:W}=await J2(),{themeSettings:ee,layers:f,settings:P}=W||{};if(P){if(P.settings){const O=new s;O.blockSettings={displayName:"Settings",isAddable:!1,...P.settings},g(O)}P.header&&M(P.header),P.footer&&L(P.footer),P.announcement&&A(P.announcement)}else{const O=new s;g(O)}ee&&v(ee);const q=await K2(),C={};if(q.status>=400&&b([..._,{id:t.v4(),message:"Error fetching pages",status:"error"}]),q.data.length>0?(q.data.forEach(O=>{R[O.path]||S(O.path),C[O.id||O.path]={...O,icon:t.pages[O.path]?t.pages[O.path].icon:"File",name:O.name?O.name:t.pages[O.path].name}}),I(C),T(Object.keys(C)[0])):(I(t.pages),T(Object.keys(t.pages)[0])),m.length===0){const O=await X2();x([...O.map(X=>{const H=X.variants.map(J=>{if(!J.includes("italic"))return J==="regular"?"400":J}).filter(J=>J!==void 0);return{name:X.family,weights:H}})])}E(f),j(!1),k(!1),w(!1)})()},[]),t.jsxRuntimeExports.jsx(G2,{})};function ex(){const e=new URL(window.location.href);window.history.replaceState(null,"",e.pathname+e.hash)}function tx(){const e=new URLSearchParams(document.location.search),n=e.get("shopId")||localStorage.getItem("shopId"),s=e.get("sellerAccessToken")||localStorage.getItem("sellerAccessToken"),r=e.get("draftId")||localStorage.getItem("draftId");return ex(),s&&localStorage.setItem("sellerAccessToken",s),n&&localStorage.setItem("shopId",n),r&&localStorage.setItem("draftId",r),!!(s&&n&&r)}const nx=e=>{const{blocks:n,settings:s,header:r,footer:o,announcement:i}=e,[a,l]=y.useState(!0),c=t.useNavigate();return y.useEffect(()=>{l(!0),tx()?l(!1):c("/")},[]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:a?t.jsxRuntimeExports.jsx(rn,{}):t.jsxRuntimeExports.jsx(Q2,{blocks:n,settings:s,header:r,footer:o,announcement:i})})},sx="_wrapper_1yd2j_1",rx="_error_1yd2j_11",ox="_title_1yd2j_21",ix="_buttons_1yd2j_29",Hn={wrapper:sx,error:rx,title:ox,buttons:ix},Fo=async e=>{const n=localStorage.getItem("shopId")||void 0,s=localStorage.getItem("draftId"),r=`${t.API_URL}/v2/builder/shops/${n}/drafts/${s}/reset`;return await t.request({url:r,withToken:!0,method:"post",body:e})},ax=()=>{const{error:e,setError:n}=t.useErrorStore(),{pages:s}=t.usePagesStore(),{setIsOpen:r}=t.useModalStore(),{title:o,description:i,setOnConfirm:a,setTitle:l,setDescription:c}=t.useConfirmationModalStore(),{setBlocks:d}=t.useLayersStore();async function u(){await Fo({resetSettings:(e==null?void 0:e.failedSettings)??!1,resetThemeSettings:(e==null?void 0:e.failedThemeSettings)??!1,resetPageIds:(e==null?void 0:e.failedPageIds)??[]}),n(null),d({}),window.location.reload()}async function p(){const m=[];s&&Object.keys(s).map(x=>s[x].id).filter(x=>x!==void 0).map(x=>m.push(x)),await Fo({resetSettings:!0,resetThemeSettings:!0,resetPageIds:m}),n(null)}return t.jsxRuntimeExports.jsxs("div",{className:Hn.wrapper,children:[t.jsxRuntimeExports.jsxs("div",{className:Hn.error,children:[t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx("div",{className:Hn.title,children:"Oops! Something went wrong"}),t.jsxRuntimeExports.jsx("span",{className:Hn.message,children:(e==null?void 0:e.message)||""})]}),t.jsxRuntimeExports.jsxs("div",{className:Hn.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:u,children:"Reset Settings"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:m=>{m.stopPropagation(),l("Reset All Settings"),c("Are you sure you want to reset all settings? This is irreversible."),a(async()=>{await p()})},children:"Reset All Settings"})]})]}),o&&i&&t.jsxRuntimeExports.jsx(Bs,{close:()=>{r(!1),setTimeout(()=>{l(null),c(null),a(null),r(!0)},300)},children:t.jsxRuntimeExports.jsx(da,{})})]})},lx=e=>{const{children:n}=e,{pathname:s}=t.useLocation(),{setActiveBlock:r}=t.useNavbarStore(),{setActiveBlock:o}=t.useThemeSettingsStore(),{setActiveBlock:i}=t.usePreviewStore();return y.useEffect(()=>{switch(i({id:null,neededScroll:!1}),s){case"/admin/builder":r(t.navbarBlocks[0]);break;case"/admin/builder/add":r(t.navbarBlocks[1]);break;case"/admin/builder/theme":r(t.navbarBlocks[2]);break;case"/admin/builder/settings":r(t.navbarBlocks[3]);break;case"/admin/builder/theme/colors":r(t.navbarBlocks[2]),o(kt[0]);break;case"/admin/builder/theme/fonts":r(t.navbarBlocks[2]),o(kt[1]);break;case"/admin/builder/theme/borders":r(t.navbarBlocks[2]),o(kt[2]);break;case"/admin/builder/theme/buttons":r(t.navbarBlocks[2]),o(kt[3]);break;case"/admin/builder/theme/inputs":r(t.navbarBlocks[2]),o(kt[4]);break}},[s]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:n})},cx="_lock_1mxa7_1",ux="_wrapper_1mxa7_12",dx="_content_1mxa7_22",px="_info_1mxa7_31",mx="_buttons_1mxa7_38",xx="_button_1mxa7_38",hx="_input_1mxa7_50",fx="_error_1mxa7_57",_t={lock:cx,wrapper:ux,content:dx,info:px,buttons:mx,button:xx,input:hx,error:fx},gx=()=>{const[e,n]=y.useState(!1),[s,r]=y.useState(!1),[o,i]=y.useState(""),{general:a,setGeneral:l}=t.useGeneralStore(),c=t.useLocation(),d=t.useNavigate();y.useEffect(()=>{if(a&&(!a.info.passwordProtected||a.isPasswordValid)){const p=c.state.from==="/validation"?"/":c.state.from;d(p)}},[a]),y.useEffect(()=>{(async()=>{var g;n(!0);const m=localStorage.getItem("shopPassword")||"",x=await Vr(m);if(x.isPasswordValid){const h=((g=c.state)==null?void 0:g.from)||"/";d(h)}l(x),n(!1)})()},[]);async function u(){var m;if(n(!0),!(await Vr(o)).isPasswordValid)r(!0);else{localStorage.setItem("shopPassword",o);const x=((m=c.state)==null?void 0:m.from)||"/";d(x)}n(!1)}return t.jsxRuntimeExports.jsxs("div",{className:_t.wrapper,children:[!e&&t.jsxRuntimeExports.jsxs("div",{className:_t.content,children:[t.jsxRuntimeExports.jsx("div",{className:_t.lock,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Lock",fill:"var(--text-secondary)",width:64,height:64})}),t.jsxRuntimeExports.jsxs("div",{className:_t.info,children:[t.jsxRuntimeExports.jsx("h2",{id:"h2",className:_t.title,children:"The store is password protected"}),t.jsxRuntimeExports.jsx("p",{id:"p",className:_t.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"})]}),t.jsxRuntimeExports.jsxs("div",{className:_t.input,children:[t.jsxRuntimeExports.jsx(t.Input$1,{type:"password",onChange:p=>{r(!1),i(p)},value:o,placeholder:"Password",required:!0}),t.jsxRuntimeExports.jsx("span",{className:_t.error,children:s&&"Incorrect password"})]}),t.jsxRuntimeExports.jsxs("div",{className:_t.buttons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",className:_t.button,children:"Contact Support"}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",className:_t.button,disabled:s,onClick:u,children:"Submit"})]})]}),e&&t.jsxRuntimeExports.jsx(t.Loader,{})]})},jx="_notifications_1nx3n_1",yx="_wrapper_1nx3n_12",Zo={notifications:jx,wrapper:yx},Cx=({children:e})=>{const n=t.useLocation(),{token:s,setToken:r}=t.useStorefrontStore(),{dashInfo:o,setDashInfo:i}=t.useCustomerDashboardStore(),a=t.useNavigate(),[l,c]=sa(),{notifications:d}=t.useNotificationStore(),[u,p]=y.useState(!0),{setCustomerEmail:m}=t.useCartStore(),{setThemeSettings:x,themeSettings:g}=t.useThemeSettingsStore(),{settings:h,setSettings:v}=t.useSettingsStore(),{setHeader:j,setFooter:w,setAnnouncement:_,header:b,footer:E,announcement:R}=t.useLayersStore(),{general:S,setGeneral:k}=t.useGeneralStore(),{pageContext:M,setPageContext:A}=t.usePagesStore();return y.useEffect(()=>{const L=localStorage.getItem("token");if(L&&(!s||!o))try{const I=t.jwtDecode(L);i(I),r(L),m(I.email)}catch(I){console.error("Failed to decode token:",I),localStorage.removeItem("token"),r(""),i(null)}},[s,o]),y.useEffect(()=>{const L=l.get("r");L&&(localStorage.setItem("referralCode",L),l.delete("r"),c(l),a({pathname:n.pathname,search:l.toString()},{replace:!0}))},[l,n]),y.useEffect(()=>{p(!0);const L=async()=>{if(!S){const T=await Vr();T.isPasswordValid||a("/validation",{state:{from:n.pathname}}),k(T)}},I=async()=>{const{settings:T,theme:V}=(await Vc()).data,Z=n.pathname.startsWith("/validation")?null:await t.getDynamicPage(encodeURIComponent("/products"));if(Z){const{data:U}=Z;A({...M,listings:U.listings})}else A({...M});if(T&&h){const U=h;if(T.settings?(Object.keys(T.settings).map(z=>{U.blockSettings[z]=T.settings[z]}),v(U)):v(h),T.header&&b){const z=b;Object.keys(T.header).map(W=>{z[W]=T.header[W]}),j(z)}if(T.footer&&E){const z=E;Object.keys(T.footer).map(W=>{z[W]=T.footer[W]}),w(z)}if(T.announcement&&R){const z=R;Object.keys(T.announcement).map(W=>{z[W]=T.announcement[W]}),_(z)}}else v(h);x(g),x(V||g),p(!1)};n.pathname.startsWith("/validation")||L(),I()},[]),n.pathname.startsWith("/admin/builder")?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:e}):t.jsxRuntimeExports.jsx("div",{className:Zo.wrapper,children:u?t.jsxRuntimeExports.jsx("div",{style:{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsxRuntimeExports.jsx(t.Loader,{})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[e,d.length>0&&t.jsxRuntimeExports.jsx("div",{className:Zo.notifications,children:d.map(L=>t.jsxRuntimeExports.jsx(ua,{type:L.status,message:L.message,timer:10,id:L.id},L.id))})]})})},_x=()=>(y.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),t.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsxRuntimeExports.jsx(t.Loader,{})})),Ex="_wrapper_rccv2_1",vx="_content_rccv2_11",Rx="_title_rccv2_21",gr={wrapper:Ex,content:vx,title:Rx},Ft=()=>{const e=t.useNavigate();return t.jsxRuntimeExports.jsx("div",{className:gr.wrapper,children:t.jsxRuntimeExports.jsxs("div",{className:gr.content,children:[t.jsxRuntimeExports.jsx("h1",{className:gr.title,children:"Something went wrong"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>{e("/")},children:"Go to Home"})]})})},wx=({children:e,shopDomain:n,shopId:s,shopPassword:r})=>{const{setShopDomain:o,setShopId:i,setShopPassword:a,setShopTerms:l,setShopPrivacyPolicy:c,setShopRefundPolicy:d}=t.useStorefrontStore();return y.useLayoutEffect(()=>{const u=async()=>{const{data:x}=await t.fetchTerms();l(x)},p=async()=>{const{data:x}=await t.fetchPrivacyPolicy();c(x)},m=async()=>{const{data:x}=await t.fetchRefundPolicy();d(x)};o(n),i(s),r&&a(r),u(),p(),m()},[n,s,r]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:e})},bx="_statItem_16xmw_1",Sx="_content_16xmw_44",kx="_withChildren_16xmw_48",Nx="_info_16xmw_53",Ix="_iconWrapper_16xmw_65",Tx="_text_16xmw_75",Lx="_title_16xmw_81",Px="_value_16xmw_85",Mx="_emptyImage_16xmw_91",Ax="_image_16xmw_11",Bx="_imageTitle_16xmw_108",$x="_imageDescription_16xmw_114",Dx="_emptyImageText_16xmw_118",Ox="_description_16xmw_133",Pe={statItem:bx,content:Sx,withChildren:kx,info:Nx,iconWrapper:Ix,text:Tx,title:Lx,value:Px,emptyImage:Mx,image:Ax,imageTitle:Bx,imageDescription:$x,emptyImageText:Dx,description:Ox},pt=({iconName:e,title:n,value:s,image:r,imageName:o,children:i,className:a,logo:l,imageDescription:c})=>t.jsxRuntimeExports.jsxs("div",{className:`${Pe.statItem} ${a}`,children:[r&&r!=="empty"&&t.jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[t.jsxRuntimeExports.jsx("div",{style:{background:"#000000"},children:t.jsxRuntimeExports.jsx("img",{src:r,alt:o,className:t.clx(Pe.image,Pe.emptyImage)})}),t.jsxRuntimeExports.jsxs("div",{className:Pe.emptyImageText,children:[t.jsxRuntimeExports.jsx("div",{className:t.clx(Pe.title,Pe.imageTitle),children:o}),t.jsxRuntimeExports.jsx("div",{id:"sm",className:t.clx(Pe.description,Pe.imageDescription),children:c})]})]}),r==="empty"&&t.jsxRuntimeExports.jsxs("div",{className:Pe.emptyImage,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:64,height:64,fill:"var(--text-secondary)"}),t.jsxRuntimeExports.jsxs("div",{className:Pe.emptyImageText,children:[t.jsxRuntimeExports.jsx("div",{className:Pe.title,children:o||"No Product"}),c&&o&&t.jsxRuntimeExports.jsx("div",{id:"sm",className:Pe.description,children:c}),!c&&!o&&t.jsxRuntimeExports.jsx("div",{id:"sm",className:Pe.description,children:"Find the desired product in the all products tab"})]})]}),t.jsxRuntimeExports.jsxs("div",{className:`${Pe.content} ${i?Pe.withChildren:""}`,children:[t.jsxRuntimeExports.jsxs("div",{className:Pe.info,children:[l?t.jsxRuntimeExports.jsx("div",{className:Pe.iconWrapper,children:t.jsxRuntimeExports.jsx("img",{src:l,width:28,height:28})}):t.jsxRuntimeExports.jsx(t.Icon,{name:e||"File",className:Pe.iconWrapper,width:28,height:28,fill:"var(--text-action)"}),t.jsxRuntimeExports.jsxs("div",{className:Pe.text,children:[t.jsxRuntimeExports.jsx("div",{className:Pe.title,children:n}),t.jsxRuntimeExports.jsx("div",{className:Pe.value,children:s})]})]}),i]})]}),st=(e,n="auto")=>e==="not found"?"empty":`https://imagedelivery.net/${e}/w=${n}`,Le=e=>{const n=new Intl.NumberFormat("en-US",{style:"currency",currency:e.currency||"USD"});let s=e.amount;return e.quantity&&(s=s*e.quantity),n.format(s)},Hx=(e,n)=>{if(e===0)throw new Error("Old value cannot be zero, as it would result in division by zero.");return(n-e)/Math.abs(e)*100},Vx=e=>{if(Math.abs(e-365)<=15){const i=Math.round(e/365);return i===1?"year":`${i} years`}else if(Math.abs(e-30)<=5){const i=Math.round(e/30);return i===1?"month":`${i} months`}else return`${e} days`},Fx=e=>new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),es=e=>{const n=new Date(e),s={day:"2-digit",month:"2-digit",year:"numeric"},r={hour:"2-digit",minute:"2-digit"},o=n.toLocaleString("en-US",s),i=n.toLocaleString("en-US",r);return[o,i]},Zx="_card_v59ks_2",zx="_email_v59ks_16",Ux="_balance_v59ks_22",Wx="_sidebar_v59ks_29",qx="_navList_v59ks_43",Gx="_navItem_v59ks_54",Yx="_activeNavItem_v59ks_67",Xx="_inactiveNavItem_v59ks_72",Kx="_logoutNavItem_v59ks_80",Jx="_iconWrapper_v59ks_85",ft={card:Zx,email:zx,balance:Ux,sidebar:Wx,navList:qx,navItem:Gx,activeNavItem:Yx,inactiveNavItem:Xx,logoutNavItem:Kx,iconWrapper:Jx},Qx=({email:e,balance:n})=>t.jsxRuntimeExports.jsxs("div",{className:ft.card,children:[t.jsxRuntimeExports.jsx("div",{className:ft.email,children:e}),t.jsxRuntimeExports.jsxs("div",{className:ft.balance,children:["Balance: ",n]})]}),eh=[[t.Routes.Home,"House"],[t.Routes.Orders,"CurrencyCircleDollar"],[t.Routes.Rewards,"Medal"],[t.Routes.Balance,"Wallet"],[t.Routes.Subscriptions,"CalendarCheck"],[t.Routes.Tickets,"Question"]],zo=({children:e,className:n="",onClick:s})=>t.jsxRuntimeExports.jsx("button",{type:"button",className:t.clx(ft.navItem,n),onClick:s,children:e}),th=()=>{const{route:e,setRoute:n}=t.useCustomerDashboardStore();return t.jsxRuntimeExports.jsxs("div",{className:ft.navList,children:[eh.map(([s,r])=>{const o=s===e;return t.jsxRuntimeExports.jsxs(zo,{onClick:()=>n(s),className:t.clx(o?ft.activeNavItem:ft.inactiveNavItem),children:[t.jsxRuntimeExports.jsx("div",{className:ft.iconWrapper,children:t.jsxRuntimeExports.jsx(t.Icon,{name:r})}),t.jsxRuntimeExports.jsx("div",{children:s})]},s)}),t.jsxRuntimeExports.jsxs(zo,{className:ft.logoutNavItem,onClick:()=>{iu()},children:[t.jsxRuntimeExports.jsx("div",{className:ft.iconWrapper,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"SignOut"})}),t.jsxRuntimeExports.jsx("div",{children:"Sign Out"})]})]})};var ge=(e=>(e.New="NEW",e.Pending="PENDING",e.Completed="COMPLETED",e.Cancelled="CANCELLED",e.Expired="EXPIRED",e.FullDeliveryFailure="FULL_DELIVERY_FAILURE",e.PartiallyDelivered="PARTIALLY_DELIVERED",e.Refunded="REFUNDED",e.Failed="FAILED",e))(ge||{}),we=(e=>(e.Text="TEXT",e.Serial="SERIALS",e.Ebook="EBOOK",e.Link="LINK",e.Download="DOWNLOAD",e.Discord="DISCORD",e.Custom="CUSTOM",e))(we||{}),zt=(e=>(e.RIAL="RIAL",e.AWAITING_PAYMENT="AWAITING_PAYMENT",e.ACTIVE="ACTIVE",e.PAST_DUE="PAST_DUE",e.CANCELLED="CANCELLED",e.EXPIRED="EXPIRED",e.CHANGED_GATEWAY="CHANGED_GATEWAY",e.REPLACED="REPLACED",e))(zt||{});const Pn=async e=>(await ia(e)).data,co=async()=>{var s;const n=(await Gc()).data;if(n.isEnabled){const r=(s=n==null?void 0:n.topUpSettings)==null?void 0:s.gateways;r&&Pn(r)}return n},pa=async()=>{const n=(await qc()).data;return{amount:n.realBalance+n.manualBalance,currency:n.currency}};var qn=(e=>(e.ADDED="ADDED",e.REMOVED="REMOVED",e))(qn||{}),Ce=(e=>(e.NotPaid="NOT_PAID",e.Pending="PENDING",e.Paid="PAID",e.Expired="EXPIRED",e.Cancelled="CANCELLED",e))(Ce||{});/*! *****************************************************************************
|
package/dist/builder.es.js
CHANGED