@billgangcom/theme-lib 1.99.0 → 1.99.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder.cjs.js +1 -1
- package/dist/builder.es.js +1 -1
- package/package.json +1 -1
package/dist/builder.cjs.js
CHANGED
|
@@ -101,4 +101,4 @@
|
|
|
101
101
|
`,o+="}",o},vn=t=>{const n=document.getElementById("dynamic-styles");if(n)n.innerHTML=t;else{const o=document.createElement("style");o.id="dynamic-styles",o.innerHTML=t,document.head.appendChild(o)}},Et=new Set,Rn=t=>{const n=new Map;return Object.entries(t).forEach(([o,s])=>{typeof s=="object"&&Object.entries(s).forEach(([i,r])=>{var a,c;if(r&&r.font){const u=r.font.replace(/\s+/g,"+");n.has(u)||n.set(u,new Set),(a=n.get(u))==null||a.add(r.weight),(c=n.get(u))==null||c.add(r.boldWeight)}})}),n},En=t=>{const n=new Map;return Object.entries(t).forEach(([o,s])=>{typeof s=="object"&&Object.keys(s).forEach(i=>{var r;if(i==="font"&&s[i]){const a=s[i].replace(/\s+/g,"+");n.has(a)||n.set(a,new Set),(r=n.get(a))==null||r.add("400")}})}),n},yn=t=>{Et.forEach(n=>{if(!t.has(n)){const o=document.querySelector(`link[data-font="${n}"]`);o&&o.remove(),Et.delete(n)}})},bn=t=>{const n=new Set;t.forEach((o,s)=>{const i=Array.from(o).join(";"),r=`${s}:wght@${i}`;if(n.add(r),!Et.has(r)){const a=document.createElement("link");a.rel="stylesheet",a.href=`https://fonts.googleapis.com/css2?family=${r}&display=swap`,a.setAttribute("data-font",r),document.head.appendChild(a),Et.add(r)}}),yn(n)},wn=t=>{if(t.fonts){const n=Rn(t.fonts.desktop),o=En(t.buttons),s=new Map(n);o.forEach((i,r)=>{if(s.has(r)){const a=s.get(r);i.forEach(c=>a==null?void 0:a.add(c))}else s.set(r,new Set(i))}),bn(s)}};function kn(){if(window.location.pathname.includes("/admin/builder"))try{const{editBlock:t,currentBlock:n,blocks:o,setHeader:s,setFooter:i,setAnnouncement:r}=e.useLayersStore.getState(),{currentPage:a,pages:c}=e.usePagesStore.getState(),{currentInstance:u,settingsInstance:h}=e.useBlocksStore.getState(),{setSettings:d}=e.useSettingsStore.getState();if(n||d(h.blockSettings),u&&n){if(n==="header")s(u);else if(n==="footer")i(u);else if(n==="announcement")r(u);else if(n==="header"||n==="footer"||n==="announcement")throw new Error(`Missing ${n} data.`)}if(u&&c&&n&&!["header","footer","announcement"].includes(n)){const g={blockSettings:{}};if(!u.blockSettings)throw new Error("currentInstance.blockSettings is undefined.");if(Object.keys(u.blockSettings).filter(p=>!["displayName","isAddable"].includes(p)).forEach(p=>{g.blockSettings[p]=u.blockSettings[p]}),!c[a])throw new Error(`Page "${a}" does not exist.`);if(!o[c[a].path].data||!o[c[a].path].data[n])throw new Error(`Layer or block for page "${c[a].path}" and block "${n}" does not exist.`);t(c[a].path,n,{name:o[c[a].path].data[n].name,value:g})}}catch(t){console.error("Error in hotReload function:",t)}}const Nn=()=>{const t=e.useApiStore.getState().apiUrls,n=e.useNavigate(),{notifications:o,setNotifications:s}=e.useNotificationStore(),{isAntistock:i}=e.useGeneralStore();return async(r,a,c,u,h)=>{const d=e.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,g=`${t.slApi}/v1/public/${d}/tickets`;try{const p=await e.request({method:"post",url:g,body:{title:r,firstMessage:a,email:u,recaptcha:c,tsId:e.getTsId(),orderId:h},withToken:!1});return s([...o,{id:e.v4(),message:i?"Support ticket successfully created. You can expect to hear from us soon.":"Ticket created successfully. We will contact you by mail",status:"success"}]),n(`/ticket/${p.data.id}/${p.data.accessToken}`),p}catch(p){s([...o,{id:e.v4(),message:`Error: ${p}. Please try again later.`,status:"error"}])}}},Tn=()=>{const{pages:t}=e.usePagesStore(),[n,o]=m.useState(t);return m.useEffect(()=>{o(t)},[t]),n},Ln="_tooltip_4hruj_1",Pn={tooltip:Ln},Je=t=>{const{text:n}=t,{setShowTooltip:o}=e.useTooltipStore();return m.useEffect(()=>(o(!0),()=>{o(!1)}),[]),e.jsxRuntimeExports.jsx("div",{className:Pn.tooltip,children:n})},An=()=>{const{undo:t,redo:n,past:o,future:s}=e.useHistoryStore(),[i,r]=m.useState(!1),[a,c]=m.useState(!1),[u,h]=m.useState(!1),[d,g]=m.useState(!1),[p,I]=m.useState(null),{notifications:j,setNotifications:l}=e.useNotificationStore();return m.useEffect(()=>{r(o.length===0)},[o]),m.useEffect(()=>{c(s.length===0)},[s]),e.jsxRuntimeExports.jsxs("div",{className:Qe.buttons,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(Qe.button,{[Qe.disabled]:i}),onMouseEnter:()=>{const C=setTimeout(()=>{g(!0),h(!1)},200);I(C)},onMouseLeave:()=>{p&&clearTimeout(p),g(!1),h(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{i||(t(),l([...j,{id:e.v4(),message:"Changes undone",status:"success"}]))},fill:i?"#757575":"#252525"}),d&&e.jsxRuntimeExports.jsx(Je,{text:i?"Nothing to undo":"Click to undo changes"})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(Qe.button,{[Qe.disabled]:a}),onMouseEnter:()=>{const C=setTimeout(()=>{h(!0),g(!1)},200);I(C)},onMouseLeave:()=>{p&&clearTimeout(p),h(!1),g(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||(n(),l([...j,{id:e.v4(),message:"Changes redone",status:"success"}]))},fill:a?"#757575":"#252525"}),u&&e.jsxRuntimeExports.jsx(Je,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},Bn="_devices_ls6k9_1",Mn="_device_ls6k9_1",$n="_active_ls6k9_27",Gt={devices:Bn,device:Mn,active:$n},Fn=()=>e.jsxRuntimeExports.jsx("div",{className:Gt.devices,children:No.map(t=>e.jsxRuntimeExports.jsx(Dn,{device:t}))}),Dn=t=>{const{device:n}=t,{currentDevice:o,setCurrentDevice:s}=e.useDeviceStore(),[i,r]=m.useState(!1),[a,c]=m.useState(null);return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Gt.device,{[Gt.active]:o.value===n.value}),onClick:()=>s(n),onMouseEnter:()=>{const u=setTimeout(()=>{r(!0)},200);c(u)},onMouseLeave:()=>{a&&clearTimeout(a),r(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:n.icon,fill:o.value===n.value?"#252525":"#757575",width:20,height:20}),i&&e.jsxRuntimeExports.jsx(Je,{text:`Switch to ${n.value} view`})]},n.value)},Hn="_preview_1x3m8_2",On="_active_1x3m8_19",Nt={preview:Hn,active:On},Un=()=>{const{onPreview:t}=e.usePreviewStore(),[n,o]=m.useState(!1),[s,i]=m.useState(null);return e.jsxRuntimeExports.jsxs("a",{href:"/",className:e.clx(Nt.preview,{[Nt.active]:t}),target:"_blank",onMouseEnter:()=>{const r=setTimeout(()=>{o(!0)},200);i(r)},onMouseLeave:()=>{s&&clearTimeout(s),o(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUpRight",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Nt.text,children:"Preview"}),n&&e.jsxRuntimeExports.jsx(Je,{text:"Open draft theme in new tab"})]})},Wn="_settings_u4cv4_1",Gn={settings:Wn},qn="_pages_167qp_1",Vn="_text_167qp_21",zn="_modal_167qp_27",Zn="_open_167qp_46",Xn="_page_167qp_1",Yn="_hoverable_167qp_61",Kn="_separator_167qp_65",Jn="_button_167qp_70",Qn="_items_167qp_85",ge={pages:qn,default:"_default_167qp_5",text:Vn,modal:zn,open:Zn,page:Xn,hoverable:Yn,separator:Kn,button:Jn,items:Qn},go=async t=>{const n=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${n}/drafts/${o}/pages/${encodeURIComponent(t)}`;return await e.request({url:i,withToken:!0,method:"delete"})},es=()=>{const{currentPage:t,setCurrentPage:n,setIsOpenModal:o,pages:s,setIsEdit:i,setEditedPage:r,deletePage:a,setIsOpenSelectModal:c}=e.usePagesStore(),{deletePage:u,setCurrentBlock:h}=e.useLayersStore(),[d,g]=m.useState(null),{setTitle:p,setDescription:I,setOnConfirm:j}=e.useConfirmationModalStore(),[l,C]=m.useState(!1),x=m.useRef(null);e.useOnClickOutside(x,()=>{l&&C(!1)}),m.useEffect(()=>{l?c(!0):setTimeout(()=>{c(!1)},300)},[l]);const _=f=>f?f.replace(/_/g," ").split(" ").map(v=>v.charAt(0).toUpperCase()+v.slice(1)).join(" "):"";return e.jsxRuntimeExports.jsxs("div",{className:ge.pages,ref:x,children:[e.jsxRuntimeExports.jsxs("div",{className:ge.default,onClick:f=>{f.stopPropagation(),C(v=>!v)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:s&&s[t]&&s[t].icon||"File",fill:"#252525",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:ge.text,children:s&&s[t]&&e.defaultPagePaths.includes(s[t].path)?`${_(s[t].name)} page`:s&&s[t]&&s[t].name}),e.jsxRuntimeExports.jsx("div",{style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease",display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretDown",width:20,height:20})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(ge.modal,{[ge.open]:l}),onClick:f=>f.stopPropagation(),children:[s&&e.jsxRuntimeExports.jsx("div",{className:ge.items,children:Object.keys(s).map(f=>{const v=s[f];return e.jsxRuntimeExports.jsxs("div",{className:e.clx(ge.page,{[ge.hoverable]:d===f}),onMouseEnter:()=>g(f),onMouseLeave:()=>g(null),onClick:()=>{g(null),i(!1),h(null),n(f),C(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:v.icon,fill:"#252525"}),e.jsxRuntimeExports.jsx("span",{className:ge.text,children:e.defaultPagePaths.includes(v.path)?`${_(v.name)} page`:v.name}),d===f&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Gear",fill:"#757575",onClick:S=>{S.stopPropagation(),i(!0),r(f),o(!0)}}),!e.defaultPagePaths.includes(v.path)&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",onClick:S=>{S.stopPropagation(),p("Delete Page"),I(`Are you sure you want to delete ${v.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),j(()=>{S.stopPropagation(),s[t].path===v.path&&n(Object.keys(s)[0]),a(f),u(v.name),go(v.path)})}})]}),s[t]&&s[t].name===v.name&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"#FF3F19"})]},f)})}),e.jsxRuntimeExports.jsx("div",{className:ge.separator}),e.jsxRuntimeExports.jsxs(e.Button,{className:ge.button,onClick:f=>{f.stopPropagation(),o(!0)},size:"l",children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#ff3f19"}),e.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},ts="_zoom_fu0hj_1",no={zoom:ts},os=()=>{const{zoomLevel:t,setZoomLevel:n}=e.usePreviewStore();return e.jsxRuntimeExports.jsxs("label",{htmlFor:"zoom",className:no.zoom,children:[e.jsxRuntimeExports.jsx("label",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},htmlFor:"zoom",children:e.jsxRuntimeExports.jsx(e.Icon,{name:"MagnifyingGlassMinus",width:20,height:20})}),e.jsxRuntimeExports.jsx("input",{id:"zoom",type:"number",min:25,max:250,value:(t*100).toFixed(0),onChange:o=>{const s=Number(o.target.value);n(s/100)},className:no.input}),e.jsxRuntimeExports.jsx("span",{children:"%"})]})},ns=()=>e.jsxRuntimeExports.jsxs("div",{className:Gn.settings,children:[e.jsxRuntimeExports.jsx(es,{}),e.jsxRuntimeExports.jsx(os,{})]}),ss="_theme_1e5wq_1",rs="_text_1e5wq_13",so={theme:ss,text:rs},is=()=>e.jsxRuntimeExports.jsx("div",{className:so.theme,children:e.jsxRuntimeExports.jsx("div",{className:so.text,children:"Live Theme"})}),as=async(t,n,o)=>{const s=localStorage.getItem("shopId")||void 0,i=localStorage.getItem("draftId"),a=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${s}/drafts/${i}/${n}`;return await e.request({url:a,withToken:!0,method:t,body:o})};function et(t,n){try{return n.map(s=>{if(!s.value||!s.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(s.value.blockSettings).filter(r=>r&&r.type===t).map(r=>{if(r.value===void 0)throw new Error("item.value is undefined.");return r.value}).flat()}).flat().filter(s=>s).map(s=>t==="ListingIds"?s.listingId:s)}catch(o){return console.error("Error in getValues function:",o),[]}}function cs(t,n,o){return ls(t,n)?(o.reviews||[]).length*3:0}function ls(t,n){return n.map(s=>{if(!s.value||!s.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(s.value.blockSettings).filter(r=>r&&r.type===t).map(r=>{if(r.value===void 0)throw new Error("item.value is undefined.");return r.value}).flat()}).flat().filter(s=>s).length>0}function us(t,n){if(n){const o=Object.keys(n).find(s=>n[s].path===t);if(o)return n[o]}return null}const ds=({setIsLoading:t,isLoading:n})=>{const{themeSettings:o}=e.useThemeSettingsStore(),{settings:s}=e.useSettingsStore(),[i,r]=m.useState(null),[a,c]=m.useState(!1),{setNotifications:u,notifications:h}=e.useNotificationStore(),{header:d,footer:g,announcement:p,blocks:I}=e.useLayersStore(),{pageContext:j}=e.usePagesStore(),{pages:l}=e.usePagesStore(),C=async()=>{if(a)i&&clearTimeout(i);else{t(!0);const _=Object.keys(I).map(S=>{const R=us(S,l);return I[S]&&I[S].data&&(R!=null&&R.path)?{id:R?R.id:S,name:R?R.name:S,path:R.path,layout:{...I[S]},neededProductIds:[...et("ProductId",Object.values(I[S].data))],neededCategoryIds:[...et("CategoryId",Object.values(I[S].data))],neededAnnouncementIds:[...et("AnnouncementId",Object.values(I[S].data))],neededListingIds:[...et("ListingIds",Object.values(I[S].data))],neededFaqIds:[...et("FaqsIds",Object.values(I[S].data))],neededReviewCount:cs("ReviewCount",Object.values(I[S].data),j),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(S=>S),f={settings:{...s},header:d,footer:g,announcement:p},{status:v}=await as("post","save",{themeSettings:o,settings:f,updatedPages:_});u([...h,{id:e.v4(),message:v===200?"Settings saved":"Error",status:v===200?"success":"error"}]),t(!1)}c(!0);const x=setTimeout(()=>{c(!1)},2e3);r(x)};return e.jsxRuntimeExports.jsx(e.Button,{onClick:C,disabled:n,children:e.jsxRuntimeExports.jsx("span",{style:{userSelect:"none"},children:"Save"})})},ps=()=>{const{isOpenSelectModal:t}=e.usePagesStore(),[n,o]=m.useState(!1),{showTooltip:s}=e.useTooltipStore();return e.jsxRuntimeExports.jsxs("div",{className:dt.header,style:{zIndex:t?5e4:s?501:50},children:[e.jsxRuntimeExports.jsxs("div",{className:dt.left,children:[e.jsxRuntimeExports.jsx(Fn,{}),e.jsxRuntimeExports.jsx(Un,{})]}),e.jsxRuntimeExports.jsx("div",{className:dt.center,children:e.jsxRuntimeExports.jsx(ns,{})}),e.jsxRuntimeExports.jsxs("div",{className:dt.right,children:[e.jsxRuntimeExports.jsx(is,{}),e.jsxRuntimeExports.jsx(An,{}),e.jsxRuntimeExports.jsx(ds,{setIsLoading:o,isLoading:n}),n&&e.jsxRuntimeExports.jsx($e,{})]})]})},ms="_exit_ovvox_1",xs="_text_ovvox_11",hs="_exitLink_ovvox_16",Tt={exit:ms,text:xs,exitLink:hs},gs=()=>e.jsxRuntimeExports.jsx("div",{className:Tt.exit,children:e.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:Tt.exitLink,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"SignOut",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Tt.text,children:"Exit"})]})}),js="_navbar_1podc_1",Is="_main_1podc_6",fs="_block_1podc_13",Ss="_active_1podc_29",mt={navbar:js,main:Is,block:fs,active:Ss},Cs=()=>{const{activeBlock:t}=e.useNavbarStore(),{setActiveBlock:n}=e.useBlocksStore(),{setCurrentBlock:o}=e.useLayersStore(),{setActiveBlock:s}=e.useThemeSettingsStore(),{setActiveBlock:i}=e.usePreviewStore(),r=e.useNavigate();function a(c){switch(n(null),o(null),s(null),i({id:null,neededScroll:!1}),c.name){case"Layers":r("/admin/builder");break;case"Add":r("/admin/builder/add");break;case"Theme":r("/admin/builder/theme");break;case"Settings":r("/admin/builder/settings");break}}return e.jsxRuntimeExports.jsxs("div",{className:mt.navbar,children:[e.jsxRuntimeExports.jsx(gs,{}),e.jsxRuntimeExports.jsx("div",{className:mt.main,children:e.navbarBlocks.map(c=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(mt.block,{[mt.active]:t.icon===c.icon}),onClick:()=>a(c),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:c.icon,fill:t.icon===c.icon?"#252525":"#757575"}),e.jsxRuntimeExports.jsx("span",{children:c.name})]},c.icon))})]})},_s="_preview_gb2ye_1",vs="_main_gb2ye_15",Rs="_content_gb2ye_25",Es="_loading_gb2ye_34",ys="_previewLoading_gb2ye_65",tt={preview:_s,main:vs,content:Rs,loading:Es,previewLoading:ys},bs="_header_11zku_2",ws="_circles_11zku_16",ks="_circle_11zku_16",Ns="_red_11zku_32",Ts="_green_11zku_36",Ls="_yellow_11zku_40",Ps="_input_11zku_44",As="_main_11zku_55",Bs="_text_11zku_63",Ms="_copy_11zku_75",Re={header:bs,circles:ws,circle:ks,red:Ns,green:Ts,yellow:Ls,input:Ps,main:As,text:Bs,copy:Ms},$s=["red","yellow","green"],Fs=()=>{const{currentDevice:t}=e.useDeviceStore(),n=(i,r)=>i.length>r?i.slice(0,r)+"...":i,{notifications:o,setNotifications:s}=e.useNotificationStore();return e.jsxRuntimeExports.jsxs("div",{className:Re.header,children:[e.jsxRuntimeExports.jsx("div",{className:Re.circles,children:$s.map(i=>e.jsxRuntimeExports.jsx("div",{className:e.clx(Re.circle,{[Re.red]:i==="red",[Re.yellow]:i==="yellow",[Re.green]:i==="green"})},i))}),e.jsxRuntimeExports.jsx("div",{className:Re.input,children:e.jsxRuntimeExports.jsxs("div",{className:Re.main,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),e.jsxRuntimeExports.jsx("span",{className:Re.text,children:t.value==="mobile"?n(window.location.origin,35):t.value==="desktop"?n(window.location.origin,200):n(window.location.origin,100)})]})}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),s([...o,{id:e.v4(),status:"success",message:"Domain copied to clipboard"}])},className:Re.copy,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy",width:20,height:20,fill:"#252525"})})]})},we=t=>t?t.replace(/_/g," ").split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" and "):"",jo=(t,n,o,s,i,r,a)=>{const c=t.currentTarget.getBoundingClientRect(),u=window.innerHeight-c.bottom,h=c.top,d=window.innerWidth-c.right,g=c.left;let p,I;return p=c.bottom+s+window.scrollY,I=c.left,(u<n||u<i)&&(h>=n+a?p=c.top-n-s+window.scrollY:p=window.scrollY+a),p-window.scrollY<a&&(p=window.scrollY+a),(d<o||d<r)&&(g>=o?I=c.right-o:I=(window.innerWidth-o)/2),I<c.right+r&&(I=c.right+r),I<c.right&&I+o>c.left&&p<c.bottom&&p+n>c.top&&(d>=o+r?I=c.right+s+r:u>=n?p=c.bottom+s+window.scrollY:(p=window.scrollY+a,I=(window.innerWidth-o)/2)),{top:p,left:I}},Ds="_results_1pahy_1",ro={results:Ds};function Hs(t,n){return n?new n[t]().blockSettings.isAddable:!1}function io(t,n){return t?Object.keys(t||{}).reduce((o,s)=>(Hs(s,n)&&o.push({name:s,displayName:e.getDisplayName(s,n)}),o),[]):[]}const Os="_product_yggw5_1",Us="_name_yggw5_15",ao={product:Os,name:Us},Ws=t=>{const{blockId:n,setSearchValue:o}=t,{sourceBlocks:s,setActiveBlock:i}=e.useBlocksStore(),{hideModal:r,hoverBlockId:a,isModalVisible:c,showPreview:u,hidePreview:h,clearHideTimeout:d,startHideTimeout:g,setHoverBlockTopPosition:p}=e.useSubmodalStore();function I(C){o(""),i(C),r("keyBlock")}function j(C,x){const _=window.innerHeight,f=400,v=10;let S=x.clientY-120;S+f>_&&(S=_-f-v),S<v&&(S=v),a||r("keyBlock"),u(C,"keyBlock"),d(),p(S)}function l(){c?g("keyBlock"):h("keyBlock"),p(null)}return e.jsxRuntimeExports.jsxs("div",{className:ao.product,onClick:()=>I(n),onMouseEnter:C=>j(n,C),onMouseLeave:l,children:[it[n]?e.jsxRuntimeExports.jsx("img",{src:it[n]}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards"}),e.jsxRuntimeExports.jsx("span",{className:ao.name,children:e.getDisplayName(n,s)}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:20,height:20})]},n)},Io=()=>{const{blocks:t,sourceBlocks:n}=e.useBlocksStore(),[o,s]=m.useState(""),[i,r]=m.useState([]),a=m.useMemo(()=>io(t,n),[t,n]),c=m.useMemo(()=>new e.Fuse(a,{keys:["displayName"],threshold:.4}),[a]);return m.useEffect(()=>{if(o.trim()==="")r(io(t,n));else{const u=c.search(o);r(u.map(h=>h.item))}},[o,c]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:s,value:o,style:{marginBottom:10}}),e.jsxRuntimeExports.jsx("div",{className:ro.results,children:i.length>0?i.map(u=>e.jsxRuntimeExports.jsx(Ws,{blockId:u.name,setSearchValue:s})):e.jsxRuntimeExports.jsx("div",{className:ro.noResults,children:"No sections found"})})]})},Gs="_wrapper_1k1cr_1",qs="_submodal_1k1cr_14",qt={wrapper:Gs,submodal:qs},Vs=({children:t,positionTop:n,positionLeft:o})=>{const{keyBlock:s,startHideTimeout:i,clearHideTimeout:r,setMouseOverModal:a}=e.useSubmodalStore();return s?e.jsxRuntimeExports.jsx("div",{className:qt.wrapper,style:n?{top:n,left:o||void 0}:{},onMouseEnter:()=>{r(),a(!0)},onMouseLeave:()=>{a(!1),i()},children:t}):null},zs=({children:t})=>{const{hoverBlockId:n,startHideTimeout:o,clearHideTimeout:s,setMouseOverModal:i}=e.useSubmodalStore();return n?e.jsxRuntimeExports.jsx("div",{className:e.clx(qt.wrapper,qt.submodal),onMouseEnter:()=>{s(),i(!0)},onMouseLeave:()=>{i(!1),o()},children:t}):null},Zs="_applyButton_1a9kh_2",Xs="_content_1a9kh_7",Ys="_title_1a9kh_14",Ks="_label_1a9kh_21",Js="_colorValue_1a9kh_40",Qs="_colorMap_1a9kh_48",er="_indicator_1a9kh_57",tr="_hueSlider_1a9kh_66",or="_slider_1a9kh_97",nr="_buttons_1a9kh_102",sr="_name_1a9kh_109",rr="_secondary_1a9kh_114",ir="_input_1a9kh_122",ar="_modal_1a9kh_160",cr="_alphaSlider_1a9kh_249",lr="_alphaBackground_1a9kh_257",ur="_alphaGradient_1a9kh_268",dr="_chargeTypes_1a9kh_297",pr="_charge_1a9kh_297",mr="_chargeActive_1a9kh_326",xr="_gradient_1a9kh_334",hr="_color_1a9kh_40",gr="_colorActive_1a9kh_355",jr="_gradientWrapper_1a9kh_362",Ir="_subtitle_1a9kh_368",fr="_colorTypes_1a9kh_375",Sr="_colorType_1a9kh_375",Cr="_colorTypeActive_1a9kh_399",_r="_colorsWrapper_1a9kh_404",vr="_colors_1a9kh_404",P={applyButton:Zs,content:Xs,title:Ys,label:Ks,colorValue:Js,colorMap:Qs,indicator:er,hueSlider:tr,slider:or,buttons:nr,name:sr,secondary:rr,input:ir,modal:ar,alphaSlider:cr,alphaBackground:lr,alphaGradient:ur,chargeTypes:dr,charge:pr,chargeActive:mr,gradient:xr,color:hr,colorActive:gr,gradientWrapper:jr,subtitle:Ir,colorTypes:fr,colorType:Sr,colorTypeActive:Cr,colorsWrapper:_r,colors:vr};function Lt(t){return(t.includes("linear-gradient")||t.includes("radial-gradient"))&&/^linear-gradient\(\d+deg,\s*#[A-Fa-f0-9]{8}\s+\d+%,\s*#[A-Fa-f0-9]{8}\s+\d+%\)$/.test(t)?!0:/^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(t)}const he=t=>{const{initialColor:n,onChange:o,title:s,labelStyle:i="primary",isGradientActive:r=!0,isBlockSettings:a}=t,[c,u]=m.useState(n);m.useEffect(()=>{u(n)},[n]);const{setActiveLabel:h,setModalPosition:d,setInitialColor:g,setShowModal:p,setUpdate:I,setColor:j,setColorChange:l,setIsGradientActive:C,colorChange:x}=e.useColorPickerStore();m.useEffect(()=>{const S=()=>{p(!1),h(null),g(n),I(()=>{}),j(n),l(()=>{})};return document.body.addEventListener("click",S),()=>{document.body.removeEventListener("click",S)}},[n]);const _=S=>{S.stopPropagation(),p(!0),l(u),I(o),g(n),j(c),C(r);const{top:R,left:w}=jo(S,600,288,10,20,230,80);d({top:R,left:w})},f=S=>{const R=S.target.value;u(R),Lt(R)&&(o(R),j(R),l(x))},v=()=>{Lt(c)||u(n)};return e.jsxRuntimeExports.jsxs("div",{className:P.content,children:[e.jsxRuntimeExports.jsx("span",{className:e.clx(P.name,{[P.secondary]:i==="secondary"}),children:s}),e.jsxRuntimeExports.jsxs("label",{className:P.label,onClick:S=>S.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:P.colorValue,style:{background:Lt(c)?c:n},onClick:a?void 0:_}),e.jsxRuntimeExports.jsx("input",{type:"text",value:c.includes("linear-gradient")?c:c.toUpperCase(),onChange:f,onBlur:v,className:P.input,style:{textTransform:c.includes("linear-gradient")?"none":"uppercase"}})]})]})},Rr=()=>{const{modalPosition:t,color:n,initialColor:o,setShowModal:s,hue:i,saturation:r,brightness:a,alpha:c,dragging:u,setDragging:h,setHue:d,setSaturation:g,setBrightness:p,setAlpha:I,colorChange:j,setColor:l,update:C,isGradient:x,setIsGradient:_,gradientDirection:f,setGradientDirection:v,hue2:S,saturation2:R,brightness2:w,alpha2:D,setHue2:te,setSaturation2:Z,setBrightness2:M,setAlpha2:b,activeColorIndex:E,setActiveColorIndex:F,isGradientActive:Y,isBlockSettings:U}=e.useColorPickerStore(),N=(L,k,V)=>{k/=100,V/=100;const B=oe=>(oe+L/60)%6,H=oe=>V*(1-k*Math.max(0,Math.min(B(oe),4-B(oe),1))),$=Math.round(255*H(5)),G=Math.round(255*H(3)),O=Math.round(255*H(1));return{r:$,g:G,b:O}},A=L=>L.toString(16).padStart(2,"0"),W=(L,k,V,B)=>{const{r:H,g:$,b:G}=N(L,k,V),O=Math.round(B/100*255);return`#${A(H)}${A($)}${A(G)}${A(O)}`},T=(L,k,V,B)=>{if(x)if(E===1){d(L),g(k),p(V),I(B);const H=W(L,k,V,B),$=W(S,R,w,D),O=`linear-gradient(${f==="vertical"?"0deg":"90deg"}, ${H} 0%, ${$} 100%)`;j(O),l(O)}else{te(L),Z(k),M(V),b(B);const H=W(L,k,V,B),$=W(i,r,a,c),O=`linear-gradient(${f==="vertical"?"0deg":"90deg"}, ${$} 0%, ${H} 100%)`;j(O),l(O)}else{const H=W(L,k,V,B);j(H),l(H)}},q=(L,k,V)=>{const{width:B,height:H}=V.getBoundingClientRect(),$=Math.max(0,Math.min(L/B*100,100)),G=Math.max(0,Math.min(100-k/H*100,100));x?E===1?(g($),p(G),T(i,$,G,c)):(Z($),M(G),T(S,$,G,D)):(g($),p(G),T(i,$,G,c))},ke=L=>{const{offsetX:k,offsetY:V}=L.nativeEvent;h(!0),q(k,V,L.currentTarget)},ve=L=>{if(u){const k=document.querySelector(`.${P.colorMap}`),{left:V,top:B}=k.getBoundingClientRect(),H=L.clientX-V,$=L.clientY-B;q(H,$,k)}},z=()=>{h(!1)};m.useEffect(()=>{function L(B){const H=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,$=B.match(H);if($){const G=$[1],O=$[2],oe=$[3];return{angle:G,col1:O,col2:oe}}return null}function k(B){const H=parseInt(B.slice(1,3),16),$=parseInt(B.slice(3,5),16),G=parseInt(B.slice(5,7),16),O=parseInt(B.slice(7,9),16)/255*100,{h:oe,s:Ge,b:yt}=V(H,$,G);return{h:oe,s:Ge,b:yt,a:O}}function V(B,H,$){B/=255,H/=255,$/=255;const G=Math.max(B,H,$),O=Math.min(B,H,$);let oe=0;const Ge=G-O,yt=(G===0?0:Ge/G)*100,ko=G*100;if(G===O)oe=0;else switch(G){case B:oe=((H-$)/Ge+(H<$?6:0))*60;break;case H:oe=(($-B)/Ge+2)*60;break;case $:oe=((B-H)/Ge+4)*60;break}return{h:oe,s:yt,b:ko}}if(o&&o.startsWith("linear-gradient")){const B=L(o);if(B){const{angle:H,col1:$,col2:G}=B,O=k($),oe=k(G);_(!0),v(H==="0deg"?"vertical":"horizontal"),d(O.h),g(O.s),p(O.b),I(O.a),te(oe.h),Z(oe.s),M(oe.b),b(oe.a),F(1)}}else if(o){const H=function(G){let O=G;return O.length===7?O+"ff":O.length===9?O:O.length===4?O[0]+O[1].repeat(2)+O[2].repeat(2)+O[3].repeat(2)+"ff":"#000000ff"}(o),$=k(H);_(!1),d($.h),g($.s),p($.b),I($.a)}},[o,_,v,d,g,p,I,te,Z,M,b,F]),m.useEffect(()=>{let L,k,V,B;x?E===1?(L=i,k=r,V=a,B=c):(L=S,k=R,V=w,B=D):(L=i,k=r,V=a,B=c),T(L,k,V,B)},[x,f,E,i,r,a,c,S,R,w,D]),m.useEffect(()=>{const L=V=>ve(V),k=()=>z();return u?(document.addEventListener("mousemove",L),document.addEventListener("mouseup",k)):(document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",k)),()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",k)}},[u,x,f]);function ue(){if(!x)C(n);else{const L=W(i,r,a,c),k=W(S,R,w,D),B=`linear-gradient(${f==="vertical"?"0deg":"90deg"}, ${L} 0%, ${k} 100%)`;C(B)}s(!1)}function X(){s(!1),j(o)}const de=x?E===1?i:S:i,Xt=x?E===1?r:R:r,Yt=x?E===1?a:w:a,bo=x?E===1?c:D:c,{r:Kt,g:Jt,b:Qt}=N(de,Xt,Yt),wo=`linear-gradient(to right, rgba(${Kt}, ${Jt}, ${Qt}, 0), rgba(${Kt}, ${Jt}, ${Qt}, 1))`,eo=W(i,r,a,c),to=W(S,R,w,D);return e.jsxRuntimeExports.jsxs("div",{className:P.modal,onClick:L=>L.stopPropagation(),style:{top:`${t.top}px`,left:`${t.left}px`},children:[e.jsxRuntimeExports.jsx("h2",{className:P.title,children:"Color"}),Y&&e.jsxRuntimeExports.jsxs("div",{className:P.colorTypes,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.colorType,{[P.colorTypeActive]:!x}),onClick:()=>_(!1),children:[e.jsxRuntimeExports.jsx("div",{style:{background:"#757575",width:"16px",height:"16px",borderRadius:"50%"}}),"Solid"]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.colorType,{[P.colorTypeActive]:x}),onClick:()=>_(!0),children:[e.jsxRuntimeExports.jsx("div",{style:{background:"linear-gradient(to bottom, #757575 0%, #DBDBDB 100%)",width:"16px",height:"16px",borderRadius:"50%"}}),"Linear"]})]}),x&&Y&&e.jsxRuntimeExports.jsxs("div",{className:P.colorsWrapper,children:[e.jsxRuntimeExports.jsx("div",{className:P.colors,style:{background:`linear-gradient(90deg, ${eo} 0%, ${to} 100%)`}}),e.jsxRuntimeExports.jsx("div",{className:e.clx(P.color,{[P.colorActive]:E===1}),onClick:()=>F(1),style:{background:eo}}),e.jsxRuntimeExports.jsx("div",{className:e.clx(P.color,{[P.colorActive]:E===2}),onClick:()=>F(2),style:{background:to}})]}),e.jsxRuntimeExports.jsx("div",{className:P.colorMap,onMouseDown:ke,style:{background:`
|
|
102
102
|
linear-gradient(to top, black, transparent),
|
|
103
103
|
linear-gradient(to right, hsl(${de}, 100%, 100%), hsl(${de}, 100%, 50%))
|
|
104
|
-
`},children:e.jsxRuntimeExports.jsx("div",{className:P.indicator,style:{position:"absolute",left:`${Xt}%`,top:`${100-Yt}%`,transform:"translate(-50%, -50%)"}})}),e.jsxRuntimeExports.jsx("div",{className:P.hueSlider,style:{bottom:U?x?"225px":"150px":x?"175px":"100px"},children:e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:de,onChange:L=>{const k=Number(L.target.value);x?E===1?T(k,r,a,c):T(k,R,w,D):(d(k),T(k,r,a,c))},className:P.slider})}),e.jsxRuntimeExports.jsxs("div",{className:P.alphaSlider,style:{bottom:U?x?"200px":"125px":x?"150px":"75px"},children:[e.jsxRuntimeExports.jsx("div",{className:P.alphaBackground}),e.jsxRuntimeExports.jsx("div",{className:P.alphaGradient,style:{background:wo}}),e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"100",value:bo,onChange:L=>{const k=Number(L.target.value);x?E===1?T(i,r,a,k):T(S,R,w,k):(I(k),T(i,r,a,k))},className:P.slider})]}),x&&Y&&e.jsxRuntimeExports.jsxs("div",{className:P.gradientWrapper,children:[e.jsxRuntimeExports.jsx("h3",{className:P.subtitle,children:"Rotation"}),e.jsxRuntimeExports.jsx("div",{className:P.gradient,children:e.jsxRuntimeExports.jsxs("div",{className:P.chargeTypes,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.charge,{[P.chargeActive]:f==="horizontal"}),onClick:()=>v("horizontal"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsHorizontal",width:20,height:20}),"Horizontal"]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.charge,{[P.chargeActive]:f==="vertical"}),onClick:()=>v("vertical"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsVertical",width:20,height:20}),"Vertical"]})]})})]}),U&&e.jsxRuntimeExports.jsx(he,{initialColor:n,onChange:L=>l(L),title:"",isBlockSettings:U}),e.jsxRuntimeExports.jsxs("div",{className:P.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:X,className:e.clx(P.applyButton,P.cancelButton),type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:ue,className:P.applyButton,children:"Apply"})]})]})},Er=()=>{const{onPreview:t,zoomLevel:n}=e.usePreviewStore(),{keyBlock:o,hoverBlockId:s,isModalVisible:i,hoverBlockTopPosition:r}=e.useSubmodalStore(),{settings:a}=e.useSettingsStore(),{sourceBlocks:c}=e.useBlocksStore(),{pageContext:u}=e.usePagesStore(),{showModal:h}=e.useColorPickerStore(),{currentDevice:d}=e.useDeviceStore(),{isLoadingThemeSettings:g}=e.useThemeSettingsStore(),{isLoadingLayers:p}=e.useLayersStore(),I=f=>f?!c||!c[f]?e.jsxRuntimeExports.jsx(e.ErrorableBlock,{error:`Block "${f}" does not exist in blocks.`}):new c[f]().renderPreview(a,u):e.jsxRuntimeExports.jsx(e.ErrorableBlock,{error:"Block or block.name is undefined."});function j(){if(d.value==="desktop")return n>=1?"100%":`${(n*100).toFixed(2)}%`;{const f=d.value==="tablet"?768:425;return n>=1?`${f}px`:`${(f*n).toFixed(2)}px`}}function l(){switch(d.value){case"desktop":return"100%";case"tablet":return 768;case"mobile":return 425;default:return"100%"}}const{isOpenSelectModal:C}=e.usePagesStore(),x=m.useRef(null),_=f=>{x.current&&(x.current.scrollTop+=f.deltaY)};return e.jsxRuntimeExports.jsxs("div",{className:tt.preview,style:{zIndex:h&&!C?5e3:500},onWheel:f=>{f.stopPropagation(),_(f)},children:[i&&e.jsxRuntimeExports.jsx(zs,{children:e.jsxRuntimeExports.jsx(Io,{})}),e.jsxRuntimeExports.jsxs(Vs,{positionTop:r,positionLeft:!s&&o?void 0:250,children:[!g&&!p&&e.jsxRuntimeExports.jsx(e.RenderBlock,{render:I,block:o},o),(g||!o||p)&&e.jsxRuntimeExports.jsx("div",{className:tt.previewLoading,children:e.jsxRuntimeExports.jsx($e,{})})]}),h&&e.jsxRuntimeExports.jsx(Rr,{}),t&&e.jsxRuntimeExports.jsxs("div",{className:tt.main,style:{width:l()},children:[e.jsxRuntimeExports.jsx(Fs,{}),e.jsxRuntimeExports.jsx("div",{style:{borderLeft:j()==="100%"?"none":"var(--default-border)",borderRight:j()==="100%"?"none":"var(--default-border)",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 160px)",overflowY:"scroll",overflowX:"hidden"},onScroll:f=>{f.stopPropagation()},onWheel:f=>{f.stopPropagation()},children:!g&&!p?e.jsxRuntimeExports.jsx("div",{className:tt.content,style:{width:j()},children:e.jsxRuntimeExports.jsx(e.PreviewContent,{scrollableRef:x})}):e.jsxRuntimeExports.jsx("div",{className:tt.loading,children:e.jsxRuntimeExports.jsx($e,{})})})]})]})},yr="_sidebar_1xtkj_1",br="_title_1xtkj_11",co={sidebar:yr,title:br},wr="_layers_1jhzw_1",kr="_wrapper_1jhzw_9",Nr="_draggingWrapper_1jhzw_17",Tr="_block_1jhzw_21",Lr="_dragging_1jhzw_17",Pr="_active_1jhzw_56",Ar="_add_1jhzw_63",Br="_addTop_1jhzw_79",Mr="_visible_1jhzw_95",$r="_button_1jhzw_99",Fr="_nameBlock_1jhzw_158",Dr="_loader_1jhzw_162",Hr="_actions_1jhzw_171",Or="_deleteButton_1jhzw_179",re={layers:wr,wrapper:kr,draggingWrapper:Nr,block:Tr,dragging:Lr,active:Pr,add:Ar,addTop:Br,visible:Mr,button:$r,nameBlock:Fr,loader:Dr,actions:Hr,deleteButton:Or},Ur="_block_sj4cc_1",Wr="_title_sj4cc_17",Gr="_actions_sj4cc_21",Fe={block:Ur,title:Wr,actions:Gr},Pt={header:"Header",footer:"Footer",announcement:"Announcement"},At=({id:t})=>{const{setCurrentBlock:n}=e.useLayersStore(),{activeBlock:o}=e.usePreviewStore(),[s,i]=m.useState(!1);function r(a){n(a)}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Fe.block,{[Fe.active]:o.id===t,[Fe.header]:t==="header",[Fe.footer]:t==="footer",[Fe.announcement]:t==="announcement"}),onClick:()=>r(t),onMouseOver:()=>i(!0),onMouseLeave:()=>i(!1),children:[it[Pt[t]]?e.jsxRuntimeExports.jsx("img",{src:it[Pt[t]],width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Fe.title,children:Pt[t]}),e.jsxRuntimeExports.jsx("div",{className:Fe.actions,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"PushPin",hoverable:!0,width:20,height:20,fill:"#757575"})})]})},qr=({id:t,name:n,onClick:o,isDragging:s,icon:i})=>{const{activeBlock:r,setActiveBlock:a}=e.usePreviewStore(),{showPreview:c,hidePreview:u,showModal:h,hideModal:d,clearHideTimeout:g,startHideTimeout:p,hoverBlockId:I,isModalVisible:j}=e.useSubmodalStore(),{setPositionBlock:l}=e.useLayersStore(),[C,x]=m.useState(!1),[_,f]=m.useState(!1),[v,S]=m.useState(!1),[R,w]=m.useState(!1),[D,te]=m.useState(null),Z=m.useRef(null),{attributes:M,listeners:b,setNodeRef:E,transform:F,transition:Y}=e.useSortable({id:t}),U={transform:e.CSS.Transform.toString(F),transition:Y},{setTitle:N,setDescription:A,setOnConfirm:W}=e.useConfirmationModalStore(),{pages:T,currentPage:q}=e.usePagesStore(),{removeBlock:ke}=e.useLayersStore(),ve=X=>{X.stopPropagation(),Z.current&&clearTimeout(Z.current),a({id:t,neededScroll:!0}),j&&d(),c(t),g()},z=(X,de=!0)=>{X.stopPropagation(),u(),h(t),g(),l(t,de)},ue=X=>{X.stopPropagation(),a({id:null,neededScroll:!1}),j?p():u()};return m.useEffect(()=>{S(!1),x(!1),f(!1),w(!1)},[s]),m.useEffect(()=>{j||(f(!1),x(!1))},[j]),e.jsxRuntimeExports.jsxs("div",{ref:E,style:U,className:e.clx(re.wrapper,{[re.draggingWrapper]:s&&r.id===t}),onClick:X=>{X.stopPropagation(),o(t)},onMouseEnter:ve,onMouseLeave:ue,...M,...b,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(re.block,{[re.dragging]:s&&r.id===t,[re.active]:!s&&r.id===t}),children:[i?e.jsxRuntimeExports.jsx("img",{src:i,width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:re.nameBlock,children:n}),I===t&&!s&&e.jsxRuntimeExports.jsx("div",{className:e.clx(re.addTop,{[re.visible]:_}),onMouseEnter:()=>{f(!0)},onMouseLeave:()=>{f(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:re.button,onClick:X=>z(X,!1),onMouseEnter:()=>{const X=setTimeout(()=>{s||w(!0)},200);te(X)},onMouseLeave:()=>{D&&clearTimeout(D),w(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),R&&e.jsxRuntimeExports.jsx(Je,{text:"Click to add a section"})]})}),I===t&&!s&&e.jsxRuntimeExports.jsx("div",{className:e.clx(re.add,{[re.visible]:C}),onMouseEnter:()=>{x(!0)},onMouseLeave:()=>{x(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:re.button,onClick:X=>z(X),onMouseEnter:()=>{const X=setTimeout(()=>{s||S(!0)},200);te(X)},onMouseLeave:()=>{D&&clearTimeout(D),S(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),v&&e.jsxRuntimeExports.jsx(Je,{text:"Click to add a section"})]})})]}),I===t&&!s&&e.jsxRuntimeExports.jsxs("div",{className:re.actions,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20}),e.jsxRuntimeExports.jsx("div",{className:re.deleteButton,onClick:X=>{X.stopPropagation(),N("Remove Block"),A(`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.`),W(()=>{T&&ke(T[q].path,t)})},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",hoverable:!0,width:20,height:20})})]})]})},Vr=()=>{const{blocks:t,setCurrentBlock:n,currentBlock:o,moveBlock:s,isLoadingLayers:i,announcement:r}=e.useLayersStore(),{currentPage:a,pages:c}=e.usePagesStore(),{setMouseOverModal:u,setHoverBlockId:h}=e.useSubmodalStore(),{sourceBlocks:d}=e.useBlocksStore();function g(x){n(x),u(!1),h(null)}const p=e.useSensors(e.useSensor(e.PointerSensor,{activationConstraint:{distance:5}})),[I,j]=m.useState(!1),l=()=>{j(!0)},C=x=>{j(!1);const{active:_,over:f}=x;if(f&&_.id!==f.id&&c&&c[a]){const v=c[a].path,S=t[v].order,R=S.indexOf(_.id),w=S.indexOf(f.id);R!==-1&&w!==-1&&s(v,R,w)}};return e.jsxRuntimeExports.jsx("div",{className:re.layers,children:i?e.jsxRuntimeExports.jsx("div",{className:re.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[r&&e.jsxRuntimeExports.jsx(At,{id:"announcement"}),e.jsxRuntimeExports.jsx(At,{id:"header"}),!o&&e.jsxRuntimeExports.jsx(e.DndContext,{sensors:p,onDragEnd:C,onDragStart:l,children:c&&c[a]&&t[c[a].path]&&e.jsxRuntimeExports.jsx(e.SortableContext,{items:t[c[a].path].order,strategy:e.verticalListSortingStrategy,children:t[c[a].path].order.map((x,_)=>e.jsxRuntimeExports.jsx(qr,{id:x,name:e.getDisplayName(t[c[a].path].data[x].name,d),index:_,onClick:g,isDragging:I,icon:it[t[c[a].path].data[x].name]},x))})}),e.jsxRuntimeExports.jsx(At,{id:"footer"})]})})},zr="_loader_eyvkk_1",Zr={loader:zr},Xr=()=>{const{isLoadingSettings:t}=e.useSettingsStore();return t?e.jsxRuntimeExports.jsx("div",{className:Zr.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsx(Yr,{})},Yr=()=>{const{settings:t}=e.useSettingsStore(),{settings:n,setSettingsInstance:o}=e.useBlocksStore();if(!t)return null;const{setError:s}=e.useErrorStore(),i=new n(t);m.useEffect(()=>{o(i)},[t]);try{return i.renderSettings()}catch(r){throw console.error("Error rendering settings:",r),s({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),r}},Kr="_theme_a1one_1",Jr="_block_a1one_8",Qr="_name_a1one_23",ei="_loader_a1one_27",xt={theme:Kr,block:Jr,name:Qr,loader:ei},ti=()=>{const t=e.useNavigate(),{isLoadingThemeSettings:n,setActiveBlock:o}=e.useThemeSettingsStore();function s(i){switch(i==null?void 0:i.name){case"Colors":t("/admin/builder/theme/colors"),o(Se[0]);break;case"Fonts":t("/admin/builder/theme/fonts"),o(Se[1]);break;case"Borders":t("/admin/builder/theme/borders"),o(Se[2]);break;case"Buttons":t("/admin/builder/theme/buttons"),o(Se[3]);break;case"Inputs":t("/admin/builder/theme/inputs"),o(Se[4]);break}}return e.jsxRuntimeExports.jsx("div",{className:xt.theme,children:n?e.jsxRuntimeExports.jsx("div",{className:xt.loader,children:e.jsxRuntimeExports.jsx($e,{})}):Se.map(i=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>s(i),className:e.clx(xt.block),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:i.icon}),e.jsxRuntimeExports.jsx("span",{className:xt.name,children:i.name}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight"})]},i.icon))})},oi="_render_7e826_9",ni="_open_7e826_24",si="_close_7e826_51",ri="_clicked_7e826_55",ii="_loading_7e826_72",ai="_settings_7e826_76",qe={render:oi,open:ni,close:si,clicked:ri,loading:ii,settings:ai},ci=({block:t})=>{const{pageContext:n}=e.usePagesStore(),{setError:o}=e.useErrorStore();try{return t.renderSettings(n)}catch(s){throw console.error("Error rendering settings:",s),o({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),s}},li="_wrapper_15ju8_1",ui="_header_15ju8_8",di="_title_15ju8_15",pi="_colorWrapper_15ju8_21",mi="_name_15ju8_35",xi="_color_15ju8_21",hi="_value_15ju8_47",gi="_length_15ju8_51",xe={wrapper:li,header:ui,title:di,colorWrapper:pi,name:mi,color:xi,value:hi,length:gi},ji=t=>{const{colors:n}=t,{themeSettings:o}=e.useThemeSettingsStore(),[s,i]=m.useState(!0);m.useEffect(()=>{n.length<=3&&i(!0)},[]);function r(a){const c=a.replace("--",""),[u,h]=c.split("-"),d=`${h.charAt(0).toUpperCase()+h.slice(1)} ${u.charAt(0).toUpperCase()+u.slice(1)}`,[g,p]=c.split("-");return{name:d,field:g,variable:p}}return e.jsxRuntimeExports.jsxs("div",{className:xe.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:xe.header,children:[e.jsxRuntimeExports.jsx("div",{className:xe.title,children:"Section Colors"}),!s&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(xe.value,xe.length),onClick:()=>i(!0),children:["+",n.length]})]}),s&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:xe.colors,children:n.map(a=>{const c=r(a),{variable:u,name:h,field:d}=c;return e.jsxRuntimeExports.jsx(Ii,{color:o.colors[d][u],name:h})})}),n.length>3&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(xe.value,xe.length),onClick:()=>i(!1),children:["Hide ",n.length," colors"]})]})]})},Ii=t=>{const{name:n,color:o}=t,{setActiveLabel:s,setModalPosition:i,setInitialColor:r,setShowModal:a,setUpdate:c,setColor:u,setColorChange:h,colorChange:d,setIsGradientActive:g,setIsBlockSettings:p}=e.useColorPickerStore(),{updateColor:I}=e.useThemeSettingsStore(),j=(x,_)=>f=>{I(x,_,f)};m.useEffect(()=>{const x=()=>{a(!1),s(null),r(o),c(()=>{}),u(o),h(()=>{})};return document.body.addEventListener("click",x),()=>{document.body.removeEventListener("click",x)}},[]);const l=x=>{const _=n.split("/")[0],f=_.split(" ")[0].toLowerCase(),v=_.split(" ")[1].toLowerCase();x.stopPropagation(),a(!0),h(d),c(w=>j(v,f)(w)),r(o),u(o),p(!0),g(v==="surface");const{top:S,left:R}=jo(x,550,288,10,20,230,80);i({top:v==="surface"?S:S+125,left:R-200})};function C(x){return x.length>15?x.slice(0,15)+"...":x}return e.jsxRuntimeExports.jsxs("div",{className:xe.colorWrapper,onClick:l,children:[e.jsxRuntimeExports.jsx("div",{className:xe.color,style:{background:o}}),e.jsxRuntimeExports.jsx("div",{className:xe.name,children:n}),e.jsxRuntimeExports.jsx("div",{className:xe.value,children:C(o)})]})},fi="_back_1sznl_1",Si="_title_1sznl_9",Ci="_deleteButton_1sznl_17",_i="_backIcon_1sznl_30",ht={back:fi,title:Si,deleteButton:Ci,backIcon:_i},vi=({onClick:t,setIsClicked:n,getDisplayName:o})=>{var p,I;const{activeBlock:s}=e.useBlocksStore(),{setTitle:i,setDescription:r,setOnConfirm:a}=e.useConfirmationModalStore(),{blocks:c,currentBlock:u,removeBlock:h}=e.useLayersStore(),{currentPage:d,pages:g}=e.usePagesStore();return e.jsxRuntimeExports.jsxs("div",{className:ht.back,children:[e.jsxRuntimeExports.jsx("div",{className:ht.backIcon,onClick:()=>t(),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("h3",{className:ht.title,children:s&&o(s)||g&&g[d]&&c[g[d].path]&&u&&o((p=c[g[d].path].data[u])==null?void 0:p.name)||u&&we(u)||"Loading"}),u&&g&&!["header","footer","announcement"].includes(u)&&c[g[d].path].data[u]&&o((I=c[g[d].path].data[u])==null?void 0:I.name)!=="unknown name"&&e.jsxRuntimeExports.jsx("button",{onClick:j=>{var l;j.stopPropagation(),i("Remove Block"),r(`Are you sure you want to delete ${o((l=c[g[d].path].data[u])==null?void 0:l.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),a(()=>{n(!0),h(g[d].path,u),t(!0)})},className:ht.deleteButton,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A"})})]})},Ri=()=>{const t=e.useNavigate(),[n,o]=m.useState(!1),{header:s,footer:i,announcement:r,sourceBlocks:a,activeBlock:c,setActiveBlock:u,currentInstance:h,setCurrentInstance:d}=e.useBlocksStore(),{setActiveBlock:g}=e.usePreviewStore(),{blocks:p,addBlock:I,editBlock:j,currentBlock:l,setCurrentBlock:C,header:x,footer:_,announcement:f,isLoadingLayers:v}=e.useLayersStore(),{currentPage:S,pages:R}=e.usePagesStore(),{past:w,future:D}=e.useHistoryStore();function te(b=!1){if(R&&h&&l&&!["header","footer","announcement"].includes(l)&&!b){const E={blockSettings:{}};Object.keys(h.blockSettings).filter(F=>!["displayName","isAddable"].includes(F)).map(F=>{E.blockSettings[F]=h.blockSettings[F]}),j(R[S].path,l,{name:p[R[S].path].data[l].name,value:E})}u(null),C(null),g({id:null,neededScroll:!1}),setTimeout(()=>{o(!1)},150),d(null)}function Z(b){var U;if(!R||!S||!b)return null;if(b==="header"){const N=new s;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=x==null?void 0:x.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=x==null?void 0:x.blockColors[A]}),N}if(b==="footer"){const N=new i;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=_==null?void 0:_.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=_==null?void 0:_.blockColors[A]}),N}if(b==="announcement"){const N=new r;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=f==null?void 0:f.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=f==null?void 0:f.blockColors[A]}),N}const E=p[R[S].path];if(!E||!E.data[b])return null;const F=E.data[b];return!F||!a[F.name]?null:new a[F.name]((U=F.value)==null?void 0:U.blockSettings)}m.useEffect(()=>{if(l){const b=Z(l);d(b)}else d(null)},[l,w,D,c]),m.useEffect(()=>{if(c&&R&&!l){const b={blockSettings:{},blockColors:{}},E=new a[c];d(E),Object.keys(E.blockSettings).filter(Y=>!["displayName","isAddable"].includes(Y)).map(Y=>{b.blockSettings[Y]=E.blockSettings[Y]}),Object.keys(E.blockColors).filter(Y=>!["displayName","isAddable"].includes(Y)).map(Y=>{b.blockColors[Y]=E.blockColors[Y]});const F=I(R[S].path,{name:c,value:b});g({id:F,neededScroll:!0}),C(F),t("/admin/builder")}},[c,w,D]);function M(b){if(!a)return"unknown name";if(!a[b])return l==="header"?x==null?void 0:x.blockSettings.displayName:l==="footer"?_==null?void 0:_.blockSettings.displayName:l==="announcement"?f==null?void 0:f.blockSettings.displayName:"unknown name";const E=new a[b];return!E.blockSettings||!E.blockSettings.displayName?"unknown name":E.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(qe.render,{[qe.open]:l,[qe.close]:!l,[qe.clicked]:n}),onClick:b=>b.stopPropagation(),style:{opacity:v?0:1},children:[e.jsxRuntimeExports.jsx(vi,{onClick:te,setIsClicked:o,getDisplayName:M}),e.jsxRuntimeExports.jsxs("div",{className:qe.settings,children:[h&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(ci,{block:h}),e.jsxRuntimeExports.jsx(ji,{colors:h.blockColors})]}),!c&&!l&&e.jsxRuntimeExports.jsx("div",{className:qe.loading,children:"Loading"})]})]})},Ei="_header_9rrfr_1",yi="_title_9rrfr_9",bi="_backIcon_9rrfr_15",Bt={header:Ei,title:yi,backIcon:bi},at=({onClick:t,title:n})=>e.jsxRuntimeExports.jsxs("div",{className:Bt.header,children:[e.jsxRuntimeExports.jsx("div",{className:Bt.backIcon,onClick:t,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:Bt.title,children:n})]}),wi="_options_ymds7_1",ki={options:wi},Ni="_wrapper_kzokw_1",Ti="_open_kzokw_16",Li="_close_kzokw_20",Mt={wrapper:Ni,open:Ti,close:Li},ct=t=>{const{isOpen:n,isClose:o,children:s}=t;return e.jsxRuntimeExports.jsx("div",{className:e.clx(Mt.wrapper,{[Mt.open]:n,[Mt.close]:o}),children:s})},Pi=()=>{var h,d;const{activeBlock:t,themeSettings:n,updateBorder:o,setActiveBlock:s}=e.useThemeSettingsStore();function i(g,p){o(p,g)}const r=e.useNavigate();function a(){s(null),r("/admin/builder/theme")}const c=m.useMemo(()=>n.borders,[n]),u=(t==null?void 0:t.name)==="Borders";return e.jsxRuntimeExports.jsxs(ct,{isOpen:u,isClose:!u,children:[e.jsxRuntimeExports.jsx(at,{onClick:a,title:"Borders Style"}),e.jsxRuntimeExports.jsxs("div",{className:ki.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Border Radius (px)",options:Object.keys(bt),value:((h=Object.entries(bt).find(([g,p])=>p===c.radius))==null?void 0:h[0])||"None",onChange:g=>i(bt[g],"radius")}),e.jsxRuntimeExports.jsx(e.Select,{label:"Border Thickness (px)",options:Object.keys(wt),value:((d=Object.entries(wt).find(([g,p])=>p===c.thickness))==null?void 0:d[0])||"None",onChange:g=>i(wt[g],"thickness")})]})]})},Ai="_options_jo38w_1",Bi="_alignments_jo38w_9",Mi="_blocks_jo38w_15",$i="_alignment_jo38w_9",Fi="_active_jo38w_34",Di="_chargeTypes_jo38w_41",Hi="_charge_jo38w_41",Oi="_chargeActive_jo38w_69",Ui="_sliderContainer_jo38w_83",Wi="_shadowInputs_jo38w_91",Gi="_label_jo38w_102",qi="_shadowInputsRow_jo38w_111",Vi="_shadowInputsOpen_jo38w_119",ie={options:Ai,alignments:Bi,blocks:Mi,alignment:$i,active:Fi,chargeTypes:Di,charge:Hi,chargeActive:Oi,sliderContainer:Ui,shadowInputs:Wi,label:Gi,shadowInputsRow:qi,shadowInputsOpen:Vi},zi=["left","center","right"],Zi=()=>{const{activeBlock:t,themeSettings:n,updateButton:o,setActiveBlock:s}=e.useThemeSettingsStore(),{fonts:i}=e.useFontsStore(),[r,a]=m.useState("primary");function c(l,C){o(r,C,l)}const[u,h]=m.useState(!1),d=n.buttons[r],g=e.useNavigate();function p(){s(null),g("/admin/builder/theme")}const I=(t==null?void 0:t.name)==="Buttons";function j(l,C){c({...d.boxShadow,[l]:C},"boxShadow")}return e.jsxRuntimeExports.jsxs(ct,{isOpen:I,isClose:!I,children:[e.jsxRuntimeExports.jsx(at,{onClick:p,title:"Buttons Style"}),e.jsxRuntimeExports.jsx("div",{className:ie.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(l=>e.jsxRuntimeExports.jsx("div",{className:e.clx(ie.charge,{[ie.chargeActive]:r===l}),onClick:()=>a(l),children:l.charAt(0).toUpperCase()+l.slice(1)},l))}),d&&e.jsxRuntimeExports.jsxs("div",{className:ie.options,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(d.height),onChange:l=>c(Number(l),"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",value:String(d.size),onChange:l=>c(Number(l),"size"),options:Rt}),e.jsxRuntimeExports.jsx(e.Input,{label:"Border Radius (px)",value:String(d.radius),onChange:l=>c(Number(l),"radius"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:d.font,onChange:l=>c(l,"font"),options:[...i.filter(l=>l.name!==d.font).map(l=>l.name)]}),e.jsxRuntimeExports.jsx(he,{initialColor:d.color,onChange:l=>c(l,"color"),title:"Text Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsx(he,{initialColor:d.background,onChange:l=>c(l,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),e.jsxRuntimeExports.jsxs("div",{className:ie.sliderContainer,children:[e.jsxRuntimeExports.jsx("h4",{className:ie.label,children:"Shadow"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:()=>h(!u),style:{padding:5,display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretUp",style:{rotate:u?"0deg":"-180deg",transition:"0.3s rotate ease"}})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(ie.shadowInputs,{[ie.shadowInputsOpen]:u}),children:[e.jsxRuntimeExports.jsxs("div",{className:ie.shadowInputsRow,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Left (px)",value:String(d.boxShadow.left),onChange:l=>j("left",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Top (px)",value:String(d.boxShadow.top),onChange:l=>j("top",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Blur (px)",value:String(d.boxShadow.blur),onChange:l=>j("blur",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,whiteSpace:"nowrap"},children:e.jsxRuntimeExports.jsx(e.Input,{label:"Spread (px)",value:String(d.boxShadow.spread),onChange:l=>j("spread",Number(l)),type:"number"})})]}),e.jsxRuntimeExports.jsx(he,{initialColor:d.boxShadow.color,onChange:l=>j("color",l),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs("div",{className:ie.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:ie.label,children:"Alignment Type"}),e.jsxRuntimeExports.jsx("div",{className:ie.blocks,children:zi.map(l=>e.jsxRuntimeExports.jsx("div",{className:e.clx(ie.alignment,{[ie.active]:d.alignment===l}),onClick:()=>{c(l,"alignment")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:l==="center"?"AlignCenterHorizontal":l==="left"?"AlignLeft":"AlignRight",fill:d.alignment===l?"#252525":"#757575"})},l))})]}),e.jsxRuntimeExports.jsx(e.Switch,{label:"Enable Hover",onChange:l=>c(l,"hover"),current:d.hover}),d.hover&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(he,{initialColor:d.colorHover,onChange:l=>c(l,"colorHover"),title:"Hover Text Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsx(he,{initialColor:d.backgroundHover,onChange:l=>c(l,"backgroundHover"),title:"Hover Background Color",labelStyle:"secondary",isGradientActive:!0})]})]})]})},Xi="_category_hxy9u_1",Yi="_categoryTitle_hxy9u_19",$t={category:Xi,categoryTitle:Yi},Ki=()=>{const{themeSettings:t,setActiveColorCategory:n}=e.useThemeSettingsStore();function o(s){n(s)}return e.jsxRuntimeExports.jsx("div",{className:$t.wrapper,children:Object.keys(t.colors).map(s=>s==="icon"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",{className:$t.category,onClick:()=>o(s),children:[e.jsxRuntimeExports.jsxs("h2",{className:$t.categoryTitle,children:[s==="text"?"Text & Icon":we(s)," Colors"]}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:24,height:24})]},s))})},Ji="_options_ikvjo_38",Qi={options:Ji},ea=()=>{const{activeBlock:t,setActiveFont:n,activeFont:o,themeSettings:s,updateFont:i}=e.useThemeSettingsStore(),{fonts:r}=e.useFontsStore(),[a,c]=m.useState(null);function u(){n(null)}function h(l,C){a&&o&&i("desktop",a,o,C,l)}const[d,g]=m.useState([]),p=m.useMemo(()=>o?s.fonts.desktop.heading[o]?(c("heading"),s.fonts.desktop.heading[o]):s.fonts.desktop.body[o]?(c("body"),s.fonts.desktop.body[o]):(c(null),null):null,[o,s]);m.useEffect(()=>{if(p){const l=r.find(C=>C.name===p.font);l&&(g(l.weights),l.weights.includes(p.boldWeight)||h("400","boldWeight"),l.weights.includes(p.weight)||h("400","weight"))}},[p,o]);const I=!!((t==null?void 0:t.name)==="Fonts"&&o),j=(t==null?void 0:t.name)!=="Fonts"||!o;return e.jsxRuntimeExports.jsxs(ct,{isOpen:I,isClose:j,children:[e.jsxRuntimeExports.jsx(at,{onClick:u,title:"Font Style"}),o&&p&&e.jsxRuntimeExports.jsxs("div",{className:Qi.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:p.font,onChange:l=>h(l,"font"),options:[...r.filter(l=>l.name!==p.font).map(l=>l.name)]}),e.jsxRuntimeExports.jsx(e.Select,{label:"Size",value:String(p.size),onChange:l=>h(l,"size"),options:Rt}),e.jsxRuntimeExports.jsx(e.Select,{label:"Default Weight",value:String(p.weight),onChange:l=>h(l,"weight"),options:d}),e.jsxRuntimeExports.jsx(e.Select,{label:"Bold Weight",value:String(p.boldWeight),onChange:l=>h(l,"boldWeight"),options:d}),e.jsxRuntimeExports.jsx(e.Select,{label:"Case",value:String(p.case).charAt(0).toUpperCase()+String(p.case).slice(1),onChange:l=>h(l.toLowerCase(),"case"),options:["Normal","Uppercase","Lowercase","Capitalize"].filter(l=>l.toLowerCase()!==String(p.case))})]})]})},ta="_wrapper_mkmxa_1",oa="_category_mkmxa_5",na="_categoryTitle_mkmxa_11",sa="_font_mkmxa_17",ra="_content_mkmxa_32",ia="_icon_mkmxa_39",aa="_paragraph_mkmxa_50",Le={wrapper:ta,category:oa,categoryTitle:na,font:sa,content:ra,icon:ia,paragraph:aa},ca={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",h7:"h7",lg:"large",md:"medium",sm:"small"},la=t=>{const{font:n,size:o,id:s,category:i}=t,{setActiveFont:r}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsxs("div",{className:Le.font,onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(Le.icon,{[Le.paragraph]:i==="paragraph"}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i==="paragraph"?"TextB":"TextH"})}),e.jsxRuntimeExports.jsxs("div",{className:Le.content,children:[e.jsxRuntimeExports.jsx("h2",{className:Le.categoryTitle,children:we(ca[s])}),e.jsxRuntimeExports.jsx("span",{className:Le.value,children:`${n}, ${o}px`})]})]})},ua=()=>{const{themeSettings:t,setActiveFont:n,activeBlock:o}=e.useThemeSettingsStore();m.useEffect(()=>(s(),()=>{s()}),[]);function s(){n(null)}if(o!=null&&o.name)return e.jsxRuntimeExports.jsx("div",{className:Le.wrapper,children:Object.entries(t.fonts.desktop).sort(([i],[r])=>i==="heading"?-1:r==="heading"?1:0).map(([i,r])=>e.jsxRuntimeExports.jsxs("div",{className:Le.category,children:[e.jsxRuntimeExports.jsx("h2",{className:Le.categoryTitle,children:we(i)}),Object.entries(r).map(([a,c])=>e.jsxRuntimeExports.jsx(la,{id:a,category:i,...c},a))]},i))})},da="_wrapper_16ym0_2",pa="_categoryTitle_16ym0_12",ma="_title_16ym0_74",xa="_field_16ym0_82",ha="_alignments_16ym0_92",ga="_lineField_16ym0_98",ja="_style_16ym0_106",Ia="_header_16ym0_113",fe={wrapper:da,categoryTitle:pa,title:ma,field:xa,alignments:ha,lineField:ga,style:ja,header:Ia},fa="_blocks_emecf_1",Sa="_block_emecf_1",Ca="_active_emecf_21",Ft={blocks:fa,block:Sa,active:Ca},lo=t=>{const{items:n,selectedItem:o,onSelect:s,getIconName:i}=t;return e.jsxRuntimeExports.jsx("div",{className:Ft.blocks,children:n.map(r=>e.jsxRuntimeExports.jsx("div",{className:e.clx(Ft.block,{[Ft.active]:o===r}),onClick:()=>s(r),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i(r),fill:o===r?"#252525":"#757575"})},String(r)))})},_a=["left","center","right"],va=["solid","dashed"],ot=t=>{const{title:n,children:o,rightAddon:s}=t;return e.jsxRuntimeExports.jsxs("div",{className:fe.field,children:[e.jsxRuntimeExports.jsxs("div",{className:fe.header,children:[e.jsxRuntimeExports.jsx("h4",{className:fe.categoryTitle,children:n}),s]}),o]})},Ra=()=>{const{themeSettings:t,updateInput:n}=e.useThemeSettingsStore(),o=m.useMemo(()=>t.inputs,[t]),s=(r,a,c)=>{n(r,a,c)},i=r=>a=>{n(r,a,"color")};return e.jsxRuntimeExports.jsxs("div",{className:fe.wrapper,children:[e.jsxRuntimeExports.jsxs(ot,{title:"General",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(o.general.height),onChange:r=>s("general",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>s("general",r,"size"),value:String(o.general.size),options:Rt}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.general.color),onChange:i("general"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsx(ot,{title:"Field Fill",rightAddon:e.jsxRuntimeExports.jsx("div",{className:fe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>s("field",r,"active"),current:o.field.active})}),children:e.jsxRuntimeExports.jsx(he,{initialColor:o.field.color,onChange:i("field"),title:"Color",labelStyle:"secondary"})}),e.jsxRuntimeExports.jsx(ot,{title:"Placeholder",children:e.jsxRuntimeExports.jsx(he,{initialColor:we(o.placeholder.color),onChange:i("placeholder"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})}),e.jsxRuntimeExports.jsxs(ot,{title:"Border",rightAddon:e.jsxRuntimeExports.jsx("div",{className:fe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>s("border",r,"active"),current:o.border.active})}),children:[e.jsxRuntimeExports.jsxs("div",{className:fe.lineField,children:[e.jsxRuntimeExports.jsxs("div",{className:fe.style,children:[e.jsxRuntimeExports.jsx("span",{className:fe.title,children:"Style"}),e.jsxRuntimeExports.jsx(lo,{items:va,selectedItem:o.border.style,onSelect:r=>s("border",r,"style"),getIconName:r=>r==="solid"?"Minus":"Selection"})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Radius (px)",value:String(o.border.radius),onChange:r=>s("border",r,"radius"),type:"number",min:0})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Thickness (px)",value:String(o.border.thickness),onChange:r=>s("border",r,"thickness"),type:"number",min:0}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.border.color),onChange:i("border"),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs(ot,{title:"Label",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Line Height (px)",value:String(o.label.height),onChange:r=>s("label",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>s("label",r,"size"),value:String(o.label.size),options:Rt}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.label.color),onChange:i("label"),title:"Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsxs("div",{className:fe.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:fe.title,children:"Alignment Type"}),e.jsxRuntimeExports.jsx(lo,{items:_a,selectedItem:o.label.alignment,onSelect:r=>s("label",r,"alignment"),getIconName:r=>r==="center"?"AlignCenterHorizontal":r==="left"?"AlignLeft":"AlignRight"})]})]})]})},Ea="_wrapper_1yw63_2",ya="_color_1yw63_24",ba="_content_1yw63_33",wa="_preview_1yw63_42",ka="_container_1yw63_52",Na="_buttonWrapper_1yw63_62",Ta="_button_1yw63_62",La="_buttonBorder_1yw63_80",Pa="_buttonBackground_1yw63_83",Aa="_text_1yw63_87",Ba="_textText_1yw63_93",Ma="_icon_1yw63_97",$a="_iconIcon_1yw63_100",Fa="_annotation_1yw63_104",Da="_annotationText_1yw63_111",Ha="_label_1yw63_116",Oa="_circle_1yw63_127",Ua="_line_1yw63_140",Wa="_circle1_1yw63_154",Ga="_circle2_1yw63_159",qa="_annotationIcon_1yw63_164",Va="_annotationBorder_1yw63_192",za="_line1_1yw63_203",Za="_line2_1yw63_210",Xa="_circle3_1yw63_227",Ya="_circle4_1yw63_232",Ka="_annotationSurface_1yw63_237",y={wrapper:Ea,color:ya,content:ba,preview:wa,container:ka,buttonWrapper:Na,button:Ta,buttonBorder:La,buttonBackground:Pa,text:Aa,textText:Ba,icon:Ma,iconIcon:$a,annotation:Fa,annotationText:Da,label:Ha,circle:Oa,line:Ua,circle1:Wa,circle2:Ga,annotationIcon:qa,annotationBorder:Va,line1:za,line2:Za,circle3:Xa,circle4:Ya,annotationSurface:Ka},Ja=()=>{const{activeColorCategory:t}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx("div",{className:y.container,children:e.jsxRuntimeExports.jsxs("div",{className:y.buttonWrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.button,{[y.buttonBorder]:t==="border",[y.buttonBackground]:t==="surface"}),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Smiley",className:e.clx(y.icon,{[y.iconIcon]:t==="text"}),width:22,height:22,fill:"#757575"}),e.jsxRuntimeExports.jsx("span",{className:e.clx(y.text,{[y.textText]:t==="text"}),children:"Button Example"})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationText),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Text Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationIcon),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Icon Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]}),t==="border"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationBorder),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Border Color"}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.line,y.line1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.line,y.line2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle3)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle4)})]}),t==="surface"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationSurface),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Surface Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]})]})})},Qa={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"]},ec=()=>{const{activeBlock:t,setActiveColorCategory:n,activeColorCategory:o,themeSettings:s,updateColor:i}=e.useThemeSettingsStore();function r(){n(null)}function a(d,g,p){i(d,g,p)}const c=!!((t==null?void 0:t.name)==="Colors"&&o),u=(t==null?void 0:t.name)!=="Colors"||!o,h=o?Qa[o]:[];return e.jsxRuntimeExports.jsxs(ct,{isOpen:c,isClose:u,children:[e.jsxRuntimeExports.jsx(at,{onClick:r,title:o==="text"?"Text & Icon Colors":`${we(o)} Colors`}),o&&e.jsxRuntimeExports.jsxs("div",{className:y.wrapper,children:[e.jsxRuntimeExports.jsx(Ja,{}),h.map(d=>{const g=s.colors[o][d];return typeof g!="string"?null:e.jsxRuntimeExports.jsx("div",{className:y.color,children:e.jsxRuntimeExports.jsxs("div",{className:y.content,children:[e.jsxRuntimeExports.jsx("div",{className:y.preview,style:{background:g}}),e.jsxRuntimeExports.jsx(he,{title:we(d),initialColor:g,onChange:p=>a(o,d,p),isGradientActive:o==="surface"})]})},d)})]})]})},tc="_loader_1p5lr_1",oc={loader:tc},nc=()=>{const{activeBlock:t,themeSettings:n,isLoadingThemeSettings:o}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o?e.jsxRuntimeExports.jsx("div",{className:oc.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(ua,{}),(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(ea,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(Ki,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(ec,{}),(t==null?void 0:t.name)==="Inputs"&&n.inputs&&e.jsxRuntimeExports.jsx(Ra,{}),(t==null?void 0:t.name)==="Borders"&&n.borders&&e.jsxRuntimeExports.jsx(Pi,{}),(t==null?void 0:t.name)==="Buttons"&&n.buttons&&e.jsxRuntimeExports.jsx(Zi,{})]})})},sc=()=>{const{activeBlock:t,setActiveBlock:n}=e.useThemeSettingsStore(),{activeBlock:o}=e.useNavbarStore(),s=e.useNavigate();function i(){n(null),s("/admin/builder/theme")}const r=!!t,a=!t||o.name!=="Theme";return e.jsxRuntimeExports.jsxs(ct,{isOpen:r,isClose:a,children:[e.jsxRuntimeExports.jsx(at,{onClick:i,title:(t==null?void 0:t.name)||""}),e.jsxRuntimeExports.jsx(nc,{})]})},rc=()=>{const{activeBlock:t}=e.useNavbarStore(),{showTooltip:n}=e.useTooltipStore();function o(){switch(t.name){case"Layers":return"Layers";case"Add":return"Add Sections";case"Theme":return"Theme Settings";case"Settings":return"Settings"}}return e.jsxRuntimeExports.jsxs("div",{className:co.sidebar,style:{zIndex:n?50:"auto"},children:[e.jsxRuntimeExports.jsx("h3",{className:co.title,children:o()}),t.name==="Layers"&&e.jsxRuntimeExports.jsx(Vr,{}),t.name==="Add"&&e.jsxRuntimeExports.jsx(Io,{}),e.jsxRuntimeExports.jsx(Ri,{}),e.jsxRuntimeExports.jsx(sc,{}),t.name==="Theme"&&e.jsxRuntimeExports.jsx(ti,{}),t.name==="Settings"&&e.jsxRuntimeExports.jsx(Xr,{})]})},ic="_wrapper_no6if_1",ac="_header_no6if_12",cc="_content_no6if_23",lc="_buttons_no6if_44",uc="_label_no6if_51",dc="_description_no6if_52",pc="_preview_no6if_60",mc="_block_no6if_66",xc="_slug_no6if_75",hc="_title_no6if_81",gc="_closeIcon_no6if_87",je={wrapper:ic,header:ac,content:cc,buttons:lc,label:uc,description:dc,preview:pc,block:mc,slug:xc,title:hc,closeIcon:gc},jc=()=>{var te,Z,M,b,E,F,Y;const{setIsOpenModal:t,pages:n,createPage:o,updatePage:s,isEdit:i,setIsEdit:r,editedPage:a,setEditedPage:c,pageContext:u}=e.usePagesStore(),{setIsOpen:h}=e.useModalStore(),{createPage:d,updatePage:g}=e.useLayersStore(),[p,I]=m.useState(a?n&&((te=n[a])==null?void 0:te.path):""),[j,l]=m.useState(a?n&&((Z=n[a])==null?void 0:Z.name):""),[C,x]=m.useState(a?n&&((M=n[a])==null?void 0:M.seo)&&((E=(b=n[a])==null?void 0:b.seo)==null?void 0:E.pageDescription)||"":`${u.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`),[_,f]=m.useState(a&&n&&(F=n[a])!=null&&F.isPrivate?"private":"public");function v(){I(""),l(""),x(""),f("public"),r(!1),c(null)}function S(){h(!1),setTimeout(()=>{v(),t(!1),h(!0)},300)}m.useEffect(()=>()=>{S()},[]);function R(U){return U[0]==="/"?U:"/"+U}function w(){o({path:R(p),name:j||p||"",icon:"File",seo:{pageTitle:j||"",pageDescription:C||""},visibility:_||"public"}),d(R(p)),S()}function D(){n&&(e.defaultPagePaths.includes(n[a].path)||go(n[a].path),g(n[a].path||"",p||""),s(a,{path:R(p),name:j||p,icon:n[a].icon||"File",seo:{pageTitle:j||"",pageDescription:C||""},visibility:_||"public"})),S()}return e.jsxRuntimeExports.jsxs("div",{className:je.wrapper,onClick:U=>U.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:je.header,children:[e.jsxRuntimeExports.jsx("h2",{children:i?"Edit Page":"Create New Page"}),e.jsxRuntimeExports.jsx("div",{className:je.closeIcon,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:S})})]}),e.jsxRuntimeExports.jsxs("div",{className:je.content,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Page Slug",onChange:U=>I(U),value:p,placeholder:"path-to-page",disabled:!!(a&&n&&((Y=n[a])!=null&&Y.name)&&e.defaultPagePaths.includes(n[a].path)),required:!0,regex:"^.+$"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Page Title",onChange:U=>{l(U)},value:j.charAt(0).toUpperCase()+j.slice(1),placeholder:"Contact us"}),e.jsxRuntimeExports.jsx(e.Textarea,{label:"Description",onChange:U=>x(U),value:C,placeholder:`${u.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`,maxLength:150}),e.jsxRuntimeExports.jsxs("div",{className:je.preview,children:[e.jsxRuntimeExports.jsx("span",{className:je.label,children:"Preview"}),e.jsxRuntimeExports.jsxs("div",{className:je.block,children:[e.jsxRuntimeExports.jsx("span",{className:je.slug,children:p||"yoursite.url"}),e.jsxRuntimeExports.jsx("span",{className:je.title,children:j||"My Blank Page"}),e.jsxRuntimeExports.jsx("span",{className:je.description,children:C||"It is My Description"})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:je.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:S,type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:i?D:w,disabled:p.length===0,children:i?"Update":"Create"})]})]})},Ic="_layout_1pjho_1",fc="_main_1pjho_10",Sc="_content_1pjho_18",Cc="_notifications_1pjho_26",gt={layout:Ic,main:fc,content:Sc,notifications:Cc},_c="_notification_2jmah_1",vc="_text_2jmah_22",Rc="_timer_2jmah_27",Ec="_warning_2jmah_32",yc="_error_2jmah_37",bc="_success_2jmah_42",Ve={notification:_c,text:vc,timer:Rc,warning:Ec,error:yc,success:bc},uo={warning:"#C1972A",error:"#FF3F19",success:"#338B13"},fo=t=>{const{type:n,message:o,style:s,padding:i,timer:r,id:a,element:c}=t,[u,h]=m.useState(r),{setNotifications:d}=e.useNotificationStore();function g(){const I=e.useNotificationStore.getState().notifications.filter(j=>j.id!==a);d([...I])}return m.useEffect(()=>{const p=setTimeout(()=>{g()},r*1e3);return()=>clearTimeout(p)},[r]),m.useEffect(()=>{const p=setInterval(()=>h(I=>I-1),1e3);return()=>clearInterval(p)},[u]),c?c({type:n,message:o,style:s,padding:i,timer:r,id:a}):e.jsxRuntimeExports.jsx("div",{style:{padding:i,position:"relative"},children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(Ve.notification,{[Ve.warning]:n==="warning",[Ve.error]:n==="error",[Ve.success]:n==="success"}),style:s,children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Info",fill:uo[n],width:20,height:20})}),e.jsxRuntimeExports.jsx("div",{className:Ve.text,children:o}),r&&e.jsxRuntimeExports.jsx("div",{className:Ve.timer,children:u}),e.jsxRuntimeExports.jsx("div",{style:{display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:uo[n],width:20,height:20,hoverable:!0,onClick:()=>g()})})]})})},wc="_modal_1h74q_1",kc="_title_1h74q_14",Nc="_buttons_1h74q_20",jt={modal:wc,title:kc,buttons:Nc},So=()=>{const{title:t,description:n,onConfirm:o,setTitle:s,setDescription:i,setOnConfirm:r}=e.useConfirmationModalStore(),{setIsOpen:a}=e.useModalStore();function c(){a(!1),setTimeout(()=>{s(null),i(null),r(null),a(!0)},300)}return t&&n&&o&&e.jsxRuntimeExports.jsxs("div",{className:jt.modal,onClick:u=>u.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:jt.title,children:t}),e.jsxRuntimeExports.jsx("div",{className:jt.description,children:n}),e.jsxRuntimeExports.jsxs("div",{className:jt.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:c,children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{o(),c()},type:"Secondary",children:"Confirm"})]})]})},Tc="_modal_270ti_1",Lc="_padding_270ti_17",Pc="_content_270ti_21",Ac="_close_270ti_42",It={modal:Tc,padding:Lc,content:Pc,close:Ac},vt=t=>{const{close:n,children:o,withAnimation:s=!0,hasPadding:i=!0}=t,{isOpen:r,setIsOpen:a}=e.useModalStore();return m.useEffect(()=>{const c=()=>{a(!1),s?setTimeout(()=>{n(!1),a(!0)},300):(n(!1),a(!0))};return document.body.addEventListener("click",c),()=>{document.body.removeEventListener("click",c)}},[]),e.jsxRuntimeExports.jsx("div",{className:e.clx(It.modal,{[It.padding]:i}),children:s?e.jsxRuntimeExports.jsx("div",{className:e.clx(It.content,{[It.close]:!r}),children:o}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o})})},Bc=()=>{const{isOpenModal:t,setIsOpenModal:n}=e.usePagesStore(),{openModal:o,setOpenModal:s}=e.useChooseImageStore(),{notifications:i}=e.useNotificationStore(),{title:r,description:a,setTitle:c,setDescription:u,setOnConfirm:h}=e.useConfirmationModalStore();return e.jsxRuntimeExports.jsxs("div",{id:"builder",children:[e.jsxRuntimeExports.jsxs("div",{className:gt.layout,children:[e.jsxRuntimeExports.jsx(Cs,{}),e.jsxRuntimeExports.jsxs("main",{className:gt.main,children:[e.jsxRuntimeExports.jsx(ps,{}),e.jsxRuntimeExports.jsxs("div",{className:gt.content,children:[e.jsxRuntimeExports.jsx(rc,{}),e.jsxRuntimeExports.jsx(Er,{})]})]})]}),r&&a&&e.jsxRuntimeExports.jsx(vt,{close:()=>{c(null),u(null),h(null)},children:e.jsxRuntimeExports.jsx(So,{})}),t&&e.jsxRuntimeExports.jsx(vt,{close:n,children:e.jsxRuntimeExports.jsx(jc,{})}),o&&e.jsxRuntimeExports.jsx(vt,{close:s,children:e.jsxRuntimeExports.jsx(e.ChooseImageModal,{})}),i.length>0&&e.jsxRuntimeExports.jsx("div",{className:gt.notifications,children:i.map(d=>e.jsxRuntimeExports.jsx(fo,{type:d.status,message:d.message,timer:d.timer||10,id:d.id,element:d.component},d.id))})]})};async function ze(t,n){const o=localStorage.getItem("shopId")||void 0,i=`${e.useApiStore.getState().apiUrls.api}/${t}/builder/shops/${o}/${n}`;return(await e.request({url:i,withToken:!0,method:"get"})).data}async function Mc(){try{const[t,n,o,s,i,r,a,c]=await Promise.allSettled([ze("v1","general"),ze("v1","faqs"),ze("v1","listings"),ze("v1","products"),ze("v1","reviews"),ze("v1","categories"),{data:null},{data:null}]);return{general:t,faqs:n,listings:o,products:s,reviews:i,categories:r,fullPosts:a,posts:c}}catch(t){throw console.error("Error fetching page data:",t),t}}async function $c(){const t=e.useApiStore.getState().apiUrls;try{const{data:n}=await e.axios.get(`${t.googleFonts}?key=AIzaSyAEsTbjAPUz_TeuFCq4z4LPK9w_vst0Pfw`);return n.items}catch(n){throw console.error("Error fetching page data:",n),n}}async function Fc(){var i;const t=localStorage.getItem("shopId"),n=localStorage.getItem("draftId"),s=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/pages`;try{return(await e.request({url:s,withToken:!0,method:"get"})).data}catch(r){return{data:[],status:(i=r.response)==null?void 0:i.status}}}async function Dc(){const t=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId")||void 0,s=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/all`;return(await e.request({url:s,withToken:!0,method:"get"})).data}const Hc=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r}=t,{setBlocks:a,setSourceBlocks:c,setHeader:u,setFooter:h,setAnnouncement:d,setSettings:g}=e.useBlocksStore(),{fonts:p,setFonts:I}=e.useFontsStore(),{setSettings:j}=e.useSettingsStore(),{setPageContext:l}=e.usePagesStore(),{setThemeSettings:C,setIsLoadingThemeSettings:x}=e.useThemeSettingsStore(),{setIsLoadingSettings:_}=e.useSettingsStore(),{notifications:f,setNotifications:v}=e.useNotificationStore(),{setBlocks:S,blocks:R,createPage:w,setIsLoadingLayers:D,setHeader:te,setAnnouncement:Z,setFooter:M}=e.useLayersStore(),{setPages:b,setCurrentPage:E}=e.usePagesStore();return m.useEffect(()=>{x(!0),D(!0),_(!0);const F={};Object.keys(n).forEach(U=>{F[U]=n[U]}),c(F),a(F),u(s),h(i),d(r),g(o),(async()=>{const U={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null,fullPosts:null,posts:null},N=await Mc();Object.keys(N).map(z=>{const ue=z;U[ue]=N[ue].value.data}),l(U);const{data:A}=await Dc(),{themeSettings:W,layers:T,settings:q}=A||{};if(q){if(q.settings){const z=new o;z.blockSettings={displayName:"Settings",isAddable:!1,...q.settings},j(z.blockSettings)}q.header&&te(q.header),q.footer&&M(q.footer),q.announcement&&Z(q.announcement)}else{const z=new o;j(z.blockSettings)}W&&C(W);const ke=await Fc(),ve={};if(ke.status>=400&&v([...f,{id:e.v4(),message:"Error fetching pages",status:"error"}]),ke.data.length>0?(ke.data.forEach(z=>{var ue,X;R[z.path]||w(z.path),ve[z.id||z.path]={...z,icon:e.pages[z.path]?e.pages[z.path].icon:"File",name:z.name||((ue=z.seo)==null?void 0:ue.pageTitle)||((X=e.pages[z.path])==null?void 0:X.name)||z.path}}),b(ve),E(Object.keys(ve)[0])):(b(e.pages),E(Object.keys(e.pages)[0])),p.length===0){const z=await $c();I([...z.map(ue=>{const X=ue.variants.map(de=>{if(!de.includes("italic"))return de==="regular"?"400":de}).filter(de=>de!==void 0);return{name:ue.family,weights:X}})])}S(T),x(!1),D(!1),_(!1)})()},[]),e.jsxRuntimeExports.jsx(Bc,{})};function Oc(){const t=new URL(window.location.href);window.history.replaceState(null,"",t.pathname+t.hash)}function Uc(){const t=new URLSearchParams(document.location.search),n=t.get("shopId")||localStorage.getItem("shopId"),o=t.get("sellerAccessToken")||localStorage.getItem("sellerAccessToken"),s=t.get("draftId")||localStorage.getItem("draftId");return Oc(),o&&localStorage.setItem("sellerAccessToken",o),n&&localStorage.setItem("shopId",n),s&&localStorage.setItem("draftId",s),!!(o&&n&&s)}const Wc="data:image/svg+xml,%3csvg%20width='204'%20height='241'%20viewBox='0%200%20204%20241'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M204%200V118.282L154.174%20134.707V69.0074L49.7111%20102.77V43.5716L204%200Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M154.174%20134.694V191.155L0%20241V117.471L49.7114%20102.757V169.597L154.174%20134.694Z'%20fill='%23FF3F19'/%3e%3c/svg%3e",Gc=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r}=t,[a,c]=m.useState(!0),u=e.useNavigate(),h=e.useLocation();return m.useEffect(()=>{const d=h.pathname;if(d.startsWith("/admin/builder")){d==="/admin/builder/add"?document.title="Add Section | Builder":d==="/admin/builder/theme"?document.title="Theme Settings | Builder":d==="/admin/builder/settings"?document.title="Settings | Builder":document.title="Builder | Billgang";let g=document.querySelector("link[rel~='icon']");g||(g=document.createElement("link"),g.rel="icon",document.head.appendChild(g)),g&&(g.href=Wc)}},[h]),m.useEffect(()=>{c(!0),Uc()?c(!1):u("/")},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:a?e.jsxRuntimeExports.jsx($e,{}):e.jsxRuntimeExports.jsx(Hc,{blocks:n,settings:o,header:s,footer:i,announcement:r})})},qc="_wrapper_1yd2j_1",Vc="_error_1yd2j_11",zc="_title_1yd2j_21",Zc="_buttons_1yd2j_29",nt={wrapper:qc,error:Vc,title:zc,buttons:Zc},po=async t=>{const n=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${n}/drafts/${o}/reset`;return await e.request({url:i,withToken:!0,method:"post",body:t})},Xc=()=>{const{error:t,setError:n}=e.useErrorStore(),{pages:o}=e.usePagesStore(),{setIsOpen:s}=e.useModalStore(),{title:i,description:r,setOnConfirm:a,setTitle:c,setDescription:u}=e.useConfirmationModalStore(),{setBlocks:h}=e.useLayersStore();async function d(){await po({resetSettings:(t==null?void 0:t.failedSettings)??!1,resetThemeSettings:(t==null?void 0:t.failedThemeSettings)??!1,resetPageIds:(t==null?void 0:t.failedPageIds)??[]}),n(null),h({}),window.location.reload()}async function g(){const p=[];o&&Object.keys(o).map(I=>o[I].id).filter(I=>I!==void 0).map(I=>p.push(I)),await po({resetSettings:!0,resetThemeSettings:!0,resetPageIds:p}),n(null)}return e.jsxRuntimeExports.jsxs("div",{className:nt.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:nt.error,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:nt.title,children:"Oops! Something went wrong"}),e.jsxRuntimeExports.jsx("span",{className:nt.message,children:(t==null?void 0:t.message)||""})]}),e.jsxRuntimeExports.jsxs("div",{className:nt.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:d,children:"Reset Settings"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:p=>{p.stopPropagation(),c("Reset All Settings"),u("Are you sure you want to reset all settings? This is irreversible."),a(async()=>{await g()})},children:"Reset All Settings"})]})]}),i&&r&&e.jsxRuntimeExports.jsx(vt,{close:()=>{s(!1),setTimeout(()=>{c(null),u(null),a(null),s(!0)},300)},children:e.jsxRuntimeExports.jsx(So,{})})]})},Yc=t=>{const{children:n}=t,{pathname:o}=e.useLocation(),{setActiveBlock:s}=e.useNavbarStore(),{setActiveBlock:i}=e.useThemeSettingsStore(),{setActiveBlock:r}=e.usePreviewStore();return m.useEffect(()=>{switch(r({id:null,neededScroll:!1}),o){case"/admin/builder":s(e.navbarBlocks[0]);break;case"/admin/builder/add":s(e.navbarBlocks[1]);break;case"/admin/builder/theme":s(e.navbarBlocks[2]);break;case"/admin/builder/settings":s(e.navbarBlocks[3]);break;case"/admin/builder/theme/colors":s(e.navbarBlocks[2]),i(Se[0]);break;case"/admin/builder/theme/fonts":s(e.navbarBlocks[2]),i(Se[1]);break;case"/admin/builder/theme/borders":s(e.navbarBlocks[2]),i(Se[2]);break;case"/admin/builder/theme/buttons":s(e.navbarBlocks[2]),i(Se[3]);break;case"/admin/builder/theme/inputs":s(e.navbarBlocks[2]),i(Se[4]);break}},[o]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n})},Kc="_lock_1mxa7_1",Jc="_wrapper_1mxa7_12",Qc="_content_1mxa7_22",el="_info_1mxa7_31",tl="_buttons_1mxa7_38",ol="_button_1mxa7_38",nl="_input_1mxa7_50",sl="_error_1mxa7_57",Ee={lock:Kc,wrapper:Jc,content:Qc,info:el,buttons:tl,button:ol,input:nl,error:sl},rl=()=>{const[t,n]=m.useState(!1),[o,s]=m.useState(!1),[i,r]=m.useState(""),{general:a,setGeneral:c}=e.useGeneralStore(),{setShopPassword:u}=e.useStorefrontStore(),h=e.useLocation(),d=e.useNavigate();m.useEffect(()=>{if(a&&(!a.info.passwordProtected||a.isPasswordValid)){const p=h.state.from==="/validation"?"/":h.state.from;d(p)}},[a]),m.useEffect(()=>{a||(async()=>{var l;n(!0);const I=localStorage.getItem("shopPassword")||"",j=await Wt(I);if(j.isPasswordValid){const C=((l=h.state)==null?void 0:l.from)||"/";d(C)}j.info.passwordProtected||(localStorage.removeItem("shopPassword"),u("")),c(j),n(!1)})()},[a]);async function g(){var I;n(!0);const p=await Wt(i);if(!p.isPasswordValid)s(!0);else{localStorage.setItem("shopPassword",i),u(i);const j=((I=h.state)==null?void 0:I.from)||"/";d(j),p.info.passwordProtected||(localStorage.removeItem("shopPassword"),u("")),c(p)}n(!1)}return e.jsxRuntimeExports.jsxs("div",{className:Ee.wrapper,children:[!t&&e.jsxRuntimeExports.jsxs("div",{className:Ee.content,children:[e.jsxRuntimeExports.jsx("div",{className:Ee.lock,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"var(--text-secondary)",width:64,height:64})}),e.jsxRuntimeExports.jsxs("div",{className:Ee.info,children:[e.jsxRuntimeExports.jsx("h2",{id:"h2",className:Ee.title,children:"The store is password protected"}),e.jsxRuntimeExports.jsx("p",{id:"p",className:Ee.description,children:"If you do not have a password, we recommend you to contact the technical support of the store or write to the mail"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ee.input,children:[e.jsxRuntimeExports.jsx(e.Input$1,{type:"password",onChange:p=>{s(!1),r(p)},value:i,placeholder:"Password",required:!0}),e.jsxRuntimeExports.jsx("span",{className:Ee.error,children:o&&"Incorrect password"})]}),e.jsxRuntimeExports.jsx("div",{className:Ee.buttons,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",className:Ee.button,disabled:o,onClick:g,children:"Submit"})})]}),t&&e.jsxRuntimeExports.jsx(e.Loader,{})]})},il="_notifications_2ywhg_1",al={notifications:il},cl=()=>(m.useEffect(()=>{document.title="On Maintenance"},[]),e.jsxRuntimeExports.jsx("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:"1",justifyContent:"center",alignItems:"center",gap:"24px"},children:[e.jsxRuntimeExports.jsx("h2",{style:{color:"var(--text-primary)",fontSize:"var(--font-heading-h2-size)"},children:"Temporarily Unavailable"}),e.jsxRuntimeExports.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"var(--font-heading-h3-size)",width:"85%",textAlign:"center"},children:"We're making some quick updates to improve your shopping experience. During this time, browsing and checkout are temporarily unavailable."})]})})),ll="_notification_o93uc_1",ul="_accent_o93uc_15",dl="_body_o93uc_23",pl="_label_o93uc_30",ml="_content_o93uc_36",xl="_timer_o93uc_41",hl="_warning_o93uc_48",gl="_error_o93uc_53",jl="_success_o93uc_58",De={notification:ll,accent:ul,body:dl,label:pl,content:ml,timer:xl,warning:hl,error:gl,success:jl},Il={warning:"Warning",error:"Error",success:"Success"},fl=({type:t,message:n,style:o,padding:s=0,timer:i=0})=>{const[r,a]=m.useState(i);return m.useEffect(()=>{if(!i)return;const c=setInterval(()=>a(u=>u-1),1e3);return()=>clearInterval(c)},[]),e.jsxRuntimeExports.jsx("div",{style:{padding:s,position:"relative"},children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(De.notification,De[t]),style:o,children:[e.jsxRuntimeExports.jsx("div",{className:De.accent}),e.jsxRuntimeExports.jsx("div",{className:De.body,children:e.jsxRuntimeExports.jsxs("div",{className:De.content,children:[e.jsxRuntimeExports.jsxs("span",{className:De.label,children:[Il[t],":"]})," ",n]})}),i>0&&e.jsxRuntimeExports.jsx("span",{className:De.timer,children:r})]})})},Sl=({children:t})=>{const n=e.useLocation(),{token:o,setToken:s}=e.useStorefrontStore(),{dashInfo:i,setDashInfo:r}=e.useCustomerDashboardStore(),{shopPassword:a}=e.useStorefrontStore(),c=e.useNavigate(),[u,h]=e.useSearchParams(),{notifications:d}=e.useNotificationStore(),[g,p]=m.useState(!0),{setCustomerEmail:I}=e.useCartStore(),{setThemeSettings:j,themeSettings:l}=e.useThemeSettingsStore(),{settings:C,setSettings:x}=e.useSettingsStore(),{setHeader:_,setFooter:f,setAnnouncement:v}=e.useLayersStore(),{general:S,setGeneral:R,isAntistock:w}=e.useGeneralStore(),{pageContext:D,setPageContext:te}=e.usePagesStore();e.useTrackingAnalytics((S==null?void 0:S.info.id)||localStorage.getItem("shopId")||"");const Z=async()=>{const M=await e.getDynamicPage(encodeURIComponent("/products"),S==null?void 0:S.info.passwordProtected);if(M){const{data:b}=M;te({...D,listings:b.listings})}};return m.useEffect(()=>{const M=localStorage.getItem("token");if(M&&(!o||!i))try{const b=e.jwtDecode(M);r(b),s(M),I(b.email)}catch(b){console.error("Failed to decode token:",b),localStorage.removeItem("token"),s(""),r(null)}},[o,i]),m.useEffect(()=>{const M=u.get("r");M&&(localStorage.setItem("referralCode",M),u.delete("r"),h(u),c({pathname:n.pathname,search:u.toString()},{replace:!0}))},[u,n]),m.useEffect(()=>{!n.pathname.startsWith("/products")&&!n.pathname.startsWith("/admin/builder")&&S&&(S.info.passwordProtected&&a||S.isPasswordValid)&&Z()},[S,a]),m.useLayoutEffect(()=>{const M=async()=>{if(p(!0),!S){const E=await Wt(a);if(!E.isPasswordValid&&!n.pathname.includes("/admin/builder")){c("/validation",{state:{from:n.pathname}});return}if(!E.info.passwordProtected){localStorage.removeItem("shopPassword");const{setShopPassword:F}=e.useStorefrontStore.getState();F("")}R(E)}p(!1)},b=async()=>{p(!0);const{settings:E,theme:F}=(await dn()).data;E?(E.settings&&x(E.settings),E.header&&_(JSON.parse(JSON.stringify(E.header))),E.footer&&f(JSON.parse(JSON.stringify(E.footer))),E.announcement&&v(JSON.parse(JSON.stringify(E.announcement)))):x(C),j(F||l),p(!1)};n.pathname.startsWith("/validation")||M(),b()},[]),w&&(S!=null&&S.info.onHold)?e.jsxRuntimeExports.jsx(cl,{}):n.pathname.startsWith("/admin/builder")?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:g?e.jsxRuntimeExports.jsx("div",{style:{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[t,d.length>0&&e.jsxRuntimeExports.jsx("div",{className:al.notifications,children:d.map(M=>e.jsxRuntimeExports.jsx(fo,{type:M.status,message:M.message,timer:M.timer||10,id:M.id,element:w?fl:M.component},M.id))})]})})},Cl=()=>(m.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})})),_l="_wrapper_rccv2_1",vl="_content_rccv2_11",Rl="_title_rccv2_21",Dt={wrapper:_l,content:vl,title:Rl},Ne=()=>{const t=e.useNavigate();return e.jsxRuntimeExports.jsx("div",{className:Dt.wrapper,children:e.jsxRuntimeExports.jsxs("div",{className:Dt.content,children:[e.jsxRuntimeExports.jsx("h1",{className:Dt.title,children:"Something went wrong"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:()=>{t("/")},children:"Go to Home"})]})})},El=({children:t,shopDomain:n,shopId:o,shopPassword:s,shopLogo:i})=>{const{setShopDomain:r,setShopId:a,setShopPassword:c,setShopTerms:u,setShopPrivacyPolicy:h,setShopRefundPolicy:d,setShopLogo:g}=e.useStorefrontStore();return m.useLayoutEffect(()=>{const p=async()=>{const{data:l}=await mn();u(l)},I=async()=>{const{data:l}=await hn();h(l)},j=async()=>{const{data:l}=await xn();d(l)};r(n),a(o),s&&c(s),i&&g(i),p(),I(),j()},[n,o,s]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t})},yl="_checkoutItemsContainer_1kn61_2",bl="_innerContainer_1kn61_16",wl="_headerSection_1kn61_22",kl="_header_1kn61_22",Nl="_productsContainer_1kn61_47",Tl="_couponContainer_1kn61_54",Ll="_checkoutFooter_1kn61_58",He={checkoutItemsContainer:yl,innerContainer:bl,headerSection:wl,header:kl,productsContainer:Nl,couponContainer:Tl,checkoutFooter:Ll},Pl="_checkoutFooter_sum4s_1",Al="_antistock_sum4s_12",Bl="_footerBranding_sum4s_22",Ml="_poweredText_sum4s_27",$l="_antistockLink_sum4s_31",Fl="_footerNav_sum4s_39",Ze={checkoutFooter:Pl,antistock:Al,footerBranding:Bl,poweredText:Ml,antistockLink:$l,footerNav:Fl},Dl="data:image/svg+xml,%3csvg%20width='100'%20height='26'%20viewBox='0%200%20100%2026'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20.3996%203.39999V12.8228L16.2964%2014.1313V8.89738L7.69363%2011.587V6.87107L20.3996%203.39999Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M16.2964%2014.1313L16.2962%2018.6292L3.59961%2022.6V12.7592L7.69363%2011.587L7.69344%2016.9118L16.2964%2014.1313Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M95.6308%2022C93.4931%2022%2091.8804%2020.882%2091.4678%2019.1776L93.118%2019.0676C93.4181%2019.984%2094.0931%2020.5338%2095.6308%2020.5338C97.4311%2020.5338%2098.4249%2019.8373%2098.4249%2018.4078V16.8316C97.9374%2017.858%2096.8122%2018.5178%2095.5183%2018.5178C92.9868%2018.5178%2091.1865%2016.575%2091.1865%2013.8076C91.1865%2011.0401%2092.9492%209.09737%2095.4433%209.09737C96.831%209.09737%2098.0499%209.77549%2098.5%2010.8568V9.3173H100V18.3711C100%2020.6438%2098.3687%2022%2095.6308%2022ZM95.5933%2017.0515C97.2998%2017.0515%2098.4062%2015.8053%2098.4249%2013.8076C98.4624%2011.8099%2097.3186%2010.5636%2095.5933%2010.5636C93.8494%2010.5636%2092.8367%2011.8099%2092.8367%2013.8076C92.8367%2015.8053%2093.8869%2017.0515%2095.5933%2017.0515Z'%20fill='%23252525'/%3e%3cpath%20d='M81.1836%2019.0309V9.3173H82.6275L82.665%2011.0584C83.1901%209.72051%2084.3527%209.09737%2085.7217%209.09737C87.9907%209.09737%2089.0783%2010.7285%2089.0783%2012.7812V19.0309H87.5031V13.2211C87.5031%2011.425%2086.8843%2010.4536%2085.3841%2010.4536C83.8464%2010.4536%2082.7588%2011.425%2082.7588%2013.2211V19.0309H81.1836Z'%20fill='%23252525'/%3e%3cpath%20d='M73.3176%2019.2509C71.2549%2019.2509%2069.9609%2018.2795%2069.9609%2016.6117C69.9609%2014.9622%2070.9173%2014.0458%2073.0926%2013.6426L76.618%2013.0011C76.618%2011.37%2075.8304%2010.5636%2074.2552%2010.5636C72.8676%2010.5636%2072.0987%2011.1867%2071.7987%2012.3047L70.1297%2012.1764C70.5048%2010.3436%2072.0049%209.09737%2074.2552%209.09737C76.8056%209.09737%2078.1932%2010.6002%2078.1932%2013.0561V17.0699C78.1932%2017.5097%2078.3433%2017.6747%2078.7183%2017.6747H79.1121V19.0309C78.9996%2019.0493%2078.7558%2019.0676%2078.512%2019.0676C77.3119%2019.0676%2076.7681%2018.6094%2076.6368%2017.5281C76.1492%2018.5361%2074.7803%2019.2509%2073.3176%2019.2509ZM73.4676%2017.8946C75.4554%2017.8946%2076.618%2016.6483%2076.618%2015.0355V14.3391L73.3926%2014.9255C72.0425%2015.1638%2071.6111%2015.6586%2071.6111%2016.4651C71.6111%2017.3814%2072.305%2017.8946%2073.4676%2017.8946Z'%20fill='%23252525'/%3e%3cpath%20d='M63.2168%2022C61.079%2022%2059.4663%2020.882%2059.0537%2019.1776L60.704%2019.0676C61.004%2019.984%2061.6791%2020.5338%2063.2168%2020.5338C65.017%2020.5338%2066.0109%2019.8373%2066.0109%2018.4078V16.8316C65.5233%2017.858%2064.3982%2018.5178%2063.1043%2018.5178C60.5727%2018.5178%2058.7725%2016.575%2058.7725%2013.8076C58.7725%2011.0401%2060.5352%209.09737%2063.0293%209.09737C64.4169%209.09737%2065.6358%209.77549%2066.0859%2010.8568V9.3173H67.5861V18.3711C67.5861%2020.6438%2065.9546%2022%2063.2168%2022ZM63.1793%2017.0515C64.8857%2017.0515%2065.9921%2015.8053%2066.0109%2013.8076C66.0484%2011.8099%2064.9045%2010.5636%2063.1793%2010.5636C61.4353%2010.5636%2060.4227%2011.8099%2060.4227%2013.8076C60.4227%2015.8053%2061.4728%2017.0515%2063.1793%2017.0515Z'%20fill='%23252525'/%3e%3cpath%20d='M56.2141%2019.0309C55.0515%2019.0309%2054.2451%2018.4811%2054.2451%2017.1982L54.2639%206.01834H55.8391V17.0699C55.8391%2017.4731%2056.0453%2017.6747%2056.4579%2017.6747H57.3205V19.0309H56.2141Z'%20fill='%23252525'/%3e%3cpath%20d='M51.0686%2019.0309C49.906%2019.0309%2049.0996%2018.4811%2049.0996%2017.1982L49.1184%206.01834H50.6936V17.0699C50.6936%2017.4731%2050.8998%2017.6747%2051.3124%2017.6747H52.175V19.0309H51.0686Z'%20fill='%23252525'/%3e%3cpath%20d='M44.5209%2019.0309V9.3173H46.0961V19.0309H44.5209ZM44.4834%207.79611V6H46.1336V7.79611H44.4834Z'%20fill='%23252525'/%3e%3cpath%20d='M32%2019.0309V6.01834H36.5756C39.726%206.01834%2041.3012%207.09967%2041.3012%209.51891C41.3012%2010.9851%2040.4198%2012.0481%2038.9384%2012.3047C40.7574%2012.5613%2041.8638%2013.7709%2041.8638%2015.4571C41.8638%2017.8213%2040.2323%2019.0309%2037.3257%2019.0309H32ZM37.3257%2017.4914C39.1447%2017.4914%2040.176%2016.74%2040.176%2015.3654C40.176%2013.9908%2039.1447%2013.1844%2037.3257%2013.1844H33.6127V17.4914H37.3257ZM36.5756%2011.6449C38.5258%2011.6449%2039.6135%2010.8935%2039.6135%209.59222C39.6135%208.21765%2038.6008%207.55786%2036.5756%207.55786H33.6127V11.6449H36.5756Z'%20fill='%23252525'/%3e%3c/svg%3e",_e=({className:t})=>{const{shopTerms:n,shopPrivacyPolicy:o,shopRefundPolicy:s,shopLogo:i}=e.useStorefrontStore(),{isAntistock:r}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("footer",{className:`${Ze.checkoutFooter} ${t} ${r?Ze.antistock:""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:Ze.footerBranding,children:[e.jsxRuntimeExports.jsx("p",{className:Ze.poweredText,id:"md",style:r?{color:"var(--text-action)"}:void 0,children:"Powered by"}),r?e.jsxRuntimeExports.jsxs("a",{className:Ze.antistockLink,href:"https://antistock.io",target:"_blank",rel:"noopener noreferrer",children:[e.jsxRuntimeExports.jsx(e.SvgMiniLogoAntistock,{width:14,height:18}),"Antistock"]}):i||e.jsxRuntimeExports.jsx("img",{src:Dl,alt:"Billgang"})]}),e.jsxRuntimeExports.jsx("nav",{children:e.jsxRuntimeExports.jsxs("ul",{className:Ze.footerNav,children:[(n==null?void 0:n.showTermsOfServiceOnProduct)&&!r&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:n.termsOfService,target:"_blank",rel:"noopener noreferrer",children:"Terms"})}),(o==null?void 0:o.showPrivacyPolicyOnProduct)&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:o.privacyPolicy,target:"_blank",rel:"noopener noreferrer",children:"Privacy"})}),(s==null?void 0:s.showRefundPolicyOnProduct)&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:s.refundPolicy,target:"_blank",rel:"noopener noreferrer",children:"Refund"})})]})})]})},Hl="_checkoutHeader_1stm3_1",Ol="_leftContainer_1stm3_20",Ul="_backArrow_1stm3_26",Wl="_logoContainer_1stm3_38",Gl="_logo_1stm3_38",ql="_antistockLink_1stm3_48",Xe={checkoutHeader:Hl,leftContainer:Ol,backArrow:Ul,logoContainer:Wl,logo:Gl,antistockLink:ql},Vl="_activeBadge_1yb5i_1",zl="_activeBadgeText_1yb5i_12",mo={activeBadge:Vl,activeBadgeText:zl},Zl=({className:t})=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(mo.activeBadge,t),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",width:20,height:20}),e.jsxRuntimeExports.jsx("p",{className:mo.activeBadgeText,children:"Active"})]}),Xl="_timerContainer_rh66p_2",Yl="_timerText_rh66p_12",Kl="_timerContainerAntistock_rh66p_16",Ht={timerContainer:Xl,timerText:Yl,timerContainerAntistock:Kl},Jl=({expiresAt:t})=>{const[n,o]=m.useState(i()),{isAntistock:s}=e.useGeneralStore();function i(){const r=new Date,a=new Date(t).getTime()-r.getTime();if(a<=0)return{hours:"00",minutes:"00",seconds:"00"};const c=Math.floor(a/(1e3*60*60)),u=Math.floor(a%(1e3*60*60)/(1e3*60)),h=Math.floor(a%(1e3*60)/1e3);return{hours:String(c).padStart(2,"0"),minutes:String(u).padStart(2,"0"),seconds:String(h).padStart(2,"0")}}return m.useEffect(()=>{const r=setInterval(()=>{o(i())},1e3);return()=>clearInterval(r)},[t]),n.hours==="00"&&n.minutes==="00"&&n.seconds==="00"?null:s?e.jsxRuntimeExports.jsxs("div",{className:Ht.timerContainerAntistock,children:[e.jsxRuntimeExports.jsxs("span",{children:[n.hours,":",n.minutes,":",n.seconds]}),e.jsxRuntimeExports.jsx("span",{children:"remaining"})]}):e.jsxRuntimeExports.jsxs("div",{className:Ht.timerContainer,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Clock"}),e.jsxRuntimeExports.jsxs("p",{className:Ht.timerText,id:"md",children:[n.hours,":",n.minutes,":",n.seconds]})]})},Ql="_progressBar_mcabf_4",eu="_progressBarLabel_mcabf_12",tu="_progressBarTrack_mcabf_17",ou="_progressBarFill_mcabf_28",ft={progressBar:Ql,progressBarLabel:eu,progressBarTrack:tu,progressBarFill:ou},Co=({color:t,percent:n,disablePercentLabel:o})=>e.jsxRuntimeExports.jsxs("div",{className:ft.progressBar,children:[!o&&e.jsxRuntimeExports.jsxs("p",{className:ft.progressBarLabel,children:[n,"%"]}),e.jsxRuntimeExports.jsx("div",{className:ft.progressBarTrack,children:e.jsxRuntimeExports.jsx("div",{style:{width:`${n}%`,background:t||void 0},className:ft.progressBarFill})})]}),nu="_rating_1bpps_4",su="_disabled_1bpps_9",ru="_ratingStar_1bpps_14",iu="_inactive_1bpps_22",St={rating:nu,disabled:su,ratingStar:ru,inactive:iu},au=({setRating:t,rating:n,disabled:o})=>{const[s,i]=m.useState(0),r=c=>{o||i(+c.currentTarget.id)},a=c=>{o||t(c)};return e.jsxRuntimeExports.jsx("div",{className:e.clx(St.rating,{[St.disabled]:o}),onMouseLeave:()=>i(0),children:[1,2,3,4,5].map(c=>e.jsxRuntimeExports.jsx("div",{id:c.toString(),className:e.clx(St.ratingStar,{[St.inactive]:!(n>=c||s>=c)}),onMouseEnter:r,onClick:()=>a(c),children:n>=c||s>=c?e.jsxRuntimeExports.jsx(e.FilledStar,{}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Star",fill:"var(--text-secondary)",width:22,height:21})},c))})},cu="_inputRange_iv6ow_4",lu="_inputRangeLabel_iv6ow_14",uu="_progressBar_iv6ow_22",du="_progressBarFill_iv6ow_29",pu="_stepsContainer_iv6ow_40",mu="_step_iv6ow_40",xu="_stepDot_iv6ow_57",hu="_current_iv6ow_61",gu="_active_iv6ow_69",ju="_inactive_iv6ow_72",Iu="_tooltip_iv6ow_77",pe={inputRange:cu,inputRangeLabel:lu,progressBar:uu,progressBarFill:du,stepsContainer:pu,step:mu,stepDot:xu,current:hu,default:"_default_iv6ow_65",active:gu,inactive:ju,tooltip:Iu},fu=({totalSteps:t,step:n,onStepChange:o,label:s})=>{const[i,r]=m.useState(n),a=i===1?0:(i-1)/(t-1)*100,c=u=>{r(u),o(u)};return e.jsxRuntimeExports.jsxs("div",{className:pe.inputRange,children:[s&&e.jsxRuntimeExports.jsx("div",{className:pe.inputRangeLabel,children:s}),e.jsxRuntimeExports.jsxs("div",{className:pe.progressBar,children:[e.jsxRuntimeExports.jsx("div",{className:pe.progressBarFill,style:{width:`${Math.ceil(a)}%`}}),e.jsxRuntimeExports.jsx("div",{className:pe.stepsContainer,children:[...Array(t)].map((u,h)=>{const d=h+1,g=d<=i,p=d===i;return e.jsxRuntimeExports.jsxs("div",{className:pe.step,onClick:()=>c(d),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(pe.stepDot,p?pe.current:pe.default,g?pe.active:pe.inactive)}),p&&e.jsxRuntimeExports.jsxs("div",{className:pe.tooltip,style:{transform:`translateX(calc(50% - ${a<99?"40px":"70px"}))`},children:[e.jsxRuntimeExports.jsx("span",{children:i}),e.jsxRuntimeExports.jsx("span",{children:i===1?"month":"months"})]})]},d)})})]})]})},lt=({className:t,expiresAt:n})=>{const{shopGeneral:o}=e.useStorefrontStore(),s=e.useNavigate(),{isAntistock:i}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("header",{className:`${Xe.checkoutHeader} ${t}`,children:[e.jsxRuntimeExports.jsxs("div",{className:Xe.leftContainer,children:[e.jsxRuntimeExports.jsx("div",{className:Xe.backArrow,onClick:()=>{window.history.length>2?s(-1):s("/")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUp"})}),(o==null?void 0:o.info.logo)&&e.jsxRuntimeExports.jsx("div",{className:Xe.logoContainer,children:i?e.jsxRuntimeExports.jsx("a",{className:Xe.antistockLink,href:"https://antistock.io",target:"_blank",rel:"noopener noreferrer",children:"Antistock"}):e.jsxRuntimeExports.jsx("img",{className:Xe.logo,src:e.convertCfImageIdToUrl(o.info.logo.cfId)})})]}),n&&e.jsxRuntimeExports.jsx(Jl,{expiresAt:n})]})},Su="_checkoutPrices_vp75r_1",Cu="_priceRow_vp75r_12",_u="_label_vp75r_22",vu="_totalRow_vp75r_26",Ru="_totalLabel_vp75r_37",Eu="_totalValue_vp75r_42",ye={checkoutPrices:Su,priceRow:Cu,label:_u,totalRow:vu,totalLabel:Ru,totalValue:Eu},ut=({formatter:t,coupon:n,discount:o,totalWithDiscount:s,total:i,className:r,isShowSubtotal:a=!0,feeOrDiscount:c})=>{const u=Math.max(0,o),{priceAdjusment:h}=e.useCartStore(),{isAntistock:d}=e.useGeneralStore(),p=(()=>{const I=s!==void 0?s:i-u;return!h||c===null||c===void 0?Math.max(I,0):h.isDiscount?Math.max(I-c,0):Math.max(I+c,0)})();return e.jsxRuntimeExports.jsxs("div",{className:`${ye.checkoutPrices} ${r||""}`,style:{border:d?"1px solid var(--border-secondary)":void 0},children:[a&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsx("p",{className:ye.label,id:"md",children:"Subtotal"}),e.jsxRuntimeExports.jsx("p",{id:"md",children:t.format(i)})]}),(n||u>0)&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsxs("p",{className:ye.label,id:"md",children:["Discount ",n&&!(n!=null&&n.isFixed)&&`(${n==null?void 0:n.discount}%)`]}),e.jsxRuntimeExports.jsx("p",{id:"md",children:n&&!(n!=null&&n.isFixed)&&(n==null?void 0:n.discount)===100?`-${t.format(i)}`:`-${t.format(u)}`})]}),c!=null&&c!==0&&h&&(h.fixedAmount!==0||h.percentage!==0)&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsxs("p",{className:ye.label,id:"md-bold",children:[h.isDiscount?"Discount: ":"Fee: ",h.percentage!==0&&h.fixedAmount===0&&`(${h.percentage}%)`,h.fixedAmount!==0&&h.percentage===0&&`(${t.format(h.fixedAmount)})`,h.percentage!==0&&h.fixedAmount!==0&&`(${h.percentage}% + ${t.format(h.fixedAmount)})`]}),e.jsxRuntimeExports.jsx("p",{id:"md-bold",children:t.format(c)})]}),e.jsxRuntimeExports.jsxs("div",{className:ye.totalRow,children:[e.jsxRuntimeExports.jsx("p",{className:ye.totalLabel,id:"md-bold",children:"Total Due"}),e.jsxRuntimeExports.jsx("p",{className:ye.totalValue,id:"md-bold",children:t.format(p)})]})]})},yu="_checkoutProduct_hr575_1",bu="_isOrder_hr575_1",wu="_productDetails_hr575_10",ku="_productImage_hr575_16",Nu="_isOrderImage_hr575_26",Tu="_productImageAntistock_hr575_30",Lu="_image_hr575_35",Pu="_productInfo_hr575_40",Au="_productHeader_hr575_47",Bu="_quantityBadge_hr575_53",Mu="_productPrice_hr575_71",$u="_deliveryCategories_hr575_80",Fu="_customerNote_hr575_88",Du="_noteHeader_hr575_95",Hu="_logoContainer_hr575_101",Ou="_shopName_hr575_113",Uu="_noteContent_hr575_117",Wu="_productName_hr575_123",ne={checkoutProduct:yu,isOrder:bu,productDetails:wu,productImage:ku,isOrderImage:Nu,productImageAntistock:Tu,image:Lu,productInfo:Pu,productHeader:Au,quantityBadge:Bu,productPrice:Mu,deliveryCategories:$u,customerNote:Fu,noteHeader:Du,logoContainer:Hu,shopName:Ou,noteContent:Uu,productName:Wu},Zt=({isOrder:t,product:n})=>{var a;const{shopGeneral:o}=e.useStorefrontStore(),s=n.subscriptionSettings,{cart:i}=e.useCart(),{isAntistock:r}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("div",{className:`${ne.checkoutProduct} ${t?ne.isOrder:""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:ne.productDetails,children:[e.jsxRuntimeExports.jsx("div",{className:`${ne.productImage} ${t?ne.isOrderImage:""} ${r?ne.productImageAntistock:""}`,children:n!=null&&n.image?e.jsxRuntimeExports.jsx("img",{className:ne.image,src:e.convertCfImageIdToUrl(n.image.cfId)}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image",fill:"var(--text-secondary)"})}),e.jsxRuntimeExports.jsx("div",{className:ne.productInfo,children:e.jsxRuntimeExports.jsxs("div",{className:ne.productHeader,children:[e.jsxRuntimeExports.jsx("h2",{className:ne.productName,id:"h5",children:n.name}),e.jsxRuntimeExports.jsxs("span",{className:ne.quantityBadge,id:"md",children:[n.price.quantity,"x"]})]})}),n.chargeType==="RECURRING"&&e.jsxRuntimeExports.jsx("p",{className:ne.productPrice,id:"md",children:s&&`${e.formatPrice(s.price)} / ${e.normalizeInterval(s.recurringIntervalDays||0)}${s.entryFee?" + "+e.formatPrice(s.entryFee):""}`}),n.chargeType==="ONE_TIME"&&e.jsxRuntimeExports.jsx("p",{className:ne.productPrice,id:"md",children:n.variantsGateways&&i.gateway&&n.variantsGateways.some(c=>c.name===i.gateway&&c.overrodePrice)?e.formatPrice(((a=n.variantsGateways.find(c=>c.name===i.gateway))==null?void 0:a.overrodePrice)||n.price):e.formatPrice(n.price)})]}),n.deliveryCategories&&e.jsxRuntimeExports.jsx("div",{className:ne.deliveryCategories,children:n.deliveryCategories.map(c=>e.jsxRuntimeExports.jsx(e.DeliveryItem,{deliveryConfiguration:c},c.id))}),n.customerNote&&e.jsxRuntimeExports.jsxs("div",{className:ne.customerNote,style:r?{border:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsxs("div",{className:ne.noteHeader,children:[(o==null?void 0:o.info.logo)&&e.jsxRuntimeExports.jsx("div",{className:ne.logoContainer,children:e.jsxRuntimeExports.jsx("img",{src:e.convertCfImageIdToUrl(o==null?void 0:o.info.logo.cfId)})}),e.jsxRuntimeExports.jsx("p",{className:ne.shopName,id:"md",children:o==null?void 0:o.info.name})]}),e.jsxRuntimeExports.jsx("p",{className:ne.noteContent,id:"md",children:n.customerNote})]})]})},Gu="_coupon_dkjzv_1",qu="_couponApplied_dkjzv_7",Vu="_discount_dkjzv_17",zu="_removeButton_dkjzv_23",Zu="_removeButtonText_dkjzv_27",Xu="_couponInput_dkjzv_31",Yu="_couponInputContainer_dkjzv_37",Pe={coupon:Gu,couponApplied:qu,discount:Vu,removeButton:zu,removeButtonText:Zu,couponInput:Xu,couponInputContainer:Yu},Ku=({applyCoupon:t,couponData:n,discount:o,removeCoupon:s,gateway:i})=>{const[r,a]=m.useState(null),[c,u]=m.useState(!1),{isAntistock:h}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("div",{className:Pe.coupon,children:[c&&e.jsxRuntimeExports.jsx(e.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Pe.skeleton,style:{borderRadius:"var(--border-radius)"},children:e.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!c&&(n?e.jsxRuntimeExports.jsxs("div",{className:Pe.couponApplied,style:h?{border:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"var(--text-success)"}),e.jsxRuntimeExports.jsxs("p",{id:"md",style:{color:h?"var(--text-primary)":void 0},children:[r," is applied"," ",e.jsxRuntimeExports.jsxs("span",{className:Pe.discount,children:["-",o," ",!n.isFixed&&`(${n.discount}%)`]})]}),e.jsxRuntimeExports.jsx("button",{className:Pe.removeButton,onClick:s,children:e.jsxRuntimeExports.jsx("span",{className:Pe.removeButtonText,children:"Remove"})})]}):e.jsxRuntimeExports.jsxs("div",{className:Pe.couponInput,children:[e.jsxRuntimeExports.jsxs("div",{className:Pe.couponInputContainer,children:[e.jsxRuntimeExports.jsx(e.Input$1,{placeholder:"Enter a discount code",value:r||"",onChange:d=>{a(d===""?null:d)}}),e.jsxRuntimeExports.jsx(e.Button$1,{onClick:async()=>{u(!0),r&&await t(r),u(!1)},disabled:!i||!r,type:"Primary",children:"Apply"})]}),!h&&!i&&e.jsxRuntimeExports.jsx(e.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},Ju=({cart:t,products:n,applyCoupon:o,applyCouponPending:s,coupon:i,totalAndDiscount:r,removeCoupon:a})=>{var l;const{priceAdjusment:c}=e.useCartStore(),[u,h]=m.useState(!1),d=m.useMemo(()=>t.parts.map(C=>{const x=n.find(f=>f.id===C.productId),_=x==null?void 0:x.variants.find(f=>f.id===C.productVariantId);return C.chargeType==="RECURRING"&&h(!0),{id:(x==null?void 0:x.id)||0,image:x==null?void 0:x.images[0],name:(()=>{const f=(x==null?void 0:x.name)||"",v=(_==null?void 0:_.name)||"";return!f&&!v?"":!v||f===v?f:f?`${f} (${v})`:v})(),description:"",price:{quantity:C.quantity,amount:(_==null?void 0:_.price.amount)||0,currency:_==null?void 0:_.price.currency},subscriptionSettings:_==null?void 0:_.subscriptionSettings,chargeType:C.chargeType,variantsGateways:_==null?void 0:_.gateways}}),[t,n]),g=((l=d[0])==null?void 0:l.price.currency)||"USD",p=new Intl.NumberFormat("en-US",{style:"currency",currency:g}),I=m.useMemo(()=>i&&!i.isFixed&&i.discount===100?r.total:r.totalWithDiscount?r.total-r.totalWithDiscount:0,[r,i]),j=c?(c==null?void 0:c.fixedAmount)+Math.round((r.totalWithDiscount!==void 0?r.totalWithDiscount:r.total-I)*((c==null?void 0:c.percentage)/100)):null;return e.jsxRuntimeExports.jsx("div",{className:He.checkoutItemsContainer,children:e.jsxRuntimeExports.jsxs("div",{className:He.innerContainer,children:[e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsxs("div",{className:He.headerSection,children:[e.jsxRuntimeExports.jsx("header",{className:He.header,children:e.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),e.jsxRuntimeExports.jsx("div",{className:He.productsContainer,children:d.map(C=>e.jsxRuntimeExports.jsx(Zt,{product:C},C.id))}),e.jsxRuntimeExports.jsx("div",{className:He.couponContainer,children:e.jsxRuntimeExports.jsx(Ku,{applyCoupon:o,applyCouponPending:s,couponData:i,discount:p.format(I),removeCoupon:a,gateway:t.gateway})}),e.jsxRuntimeExports.jsx(ut,{formatter:p,coupon:i,total:r.total,discount:I,totalWithDiscount:r.totalWithDiscount,feeOrDiscount:u?null:j})]}),e.jsxRuntimeExports.jsx("div",{className:He.checkoutFooter,children:e.jsxRuntimeExports.jsx(_e,{})})]})})},Qu="_checkoutOperational_b62bq_1",ed="_innerContainer_b62bq_17",td="_innerContainerAntistock_b62bq_27",od="_paymentMethodsSectionAntistock_b62bq_39",nd="_continueButtonAntistock_b62bq_49",sd="_checkoutFooterAntistock_b62bq_59",rd="_antistock_b62bq_70",id="_paymentMethodsSection_b62bq_39",ad="_socialConnectSection_b62bq_81",cd="_socialConnectLabel_b62bq_84",ld="_socialConnectContent_b62bq_88",ud="_continueButton_b62bq_49",dd="_button_b62bq_96",pd="_checkoutFooter_b62bq_59",ae={checkoutOperational:Qu,innerContainer:ed,innerContainerAntistock:td,paymentMethodsSectionAntistock:od,continueButtonAntistock:nd,checkoutFooterAntistock:sd,antistock:rd,paymentMethodsSection:id,socialConnectSection:ad,socialConnectLabel:cd,socialConnectContent:ld,continueButton:ud,button:dd,checkoutFooter:pd},md="_customFields_uhcib_2",xd="_checkboxWrapper_uhcib_9",hd="_textareaWrapper_uhcib_16",gd="_inputWrapper_uhcib_17",jd="_requiredStar_uhcib_27",Ke={customFields:md,checkboxWrapper:xd,textareaWrapper:hd,inputWrapper:gd,requiredStar:jd},Id=({customFields:t,setCustomFields:n})=>{if(t.length===0)return null;const o=t.map(s=>e.jsxRuntimeExports.jsx(fd,{customField:s,setCustomFields:n},s.name));return e.jsxRuntimeExports.jsx("div",{className:Ke.customFields,children:o})},fd=({customField:t,setCustomFields:n})=>{const o=s=>{n(i=>i.map(r=>r.name===t.name?{...r,value:s}:r))};return e.jsxRuntimeExports.jsx(Sd,{value:t.value??"",placeholder:t.placeholder,required:t.required,defaultValue:t.defaultValue,type:t.type,onValueChange:o,label:t.name,regex:t.regex})},Sd=({label:t,type:n,defaultValue:o,value:s,placeholder:i,regex:r,required:a,onValueChange:c})=>{if(m.useEffect(()=>{s===""&&o!==void 0&&c(String(o))},[]),n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return e.jsxRuntimeExports.jsxs("label",{className:Ke.checkboxWrapper,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:s==="true",onChange:h=>c(h?"true":"false")}),e.jsxRuntimeExports.jsxs("p",{className:Ke.checkboxLabel,children:[t,a&&e.jsxRuntimeExports.jsx("span",{className:Ke.requiredStar,children:"*"})]})]});if(n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return e.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(o??""),required:a});const u=h=>{(n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:r?new RegExp(r):/.*/).test(h)&&c(h)};return n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?e.jsxRuntimeExports.jsx("div",{className:Ke.textareaWrapper,children:e.jsxRuntimeExports.jsx(e.Textarea$1,{label:t,value:s,placeholder:i,onChange:u,required:a})}):e.jsxRuntimeExports.jsx("div",{className:Ke.inputWrapper,children:e.jsxRuntimeExports.jsx(e.Input$1,{type:n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":i,label:t,value:s,required:a,onChange:u})})},Cd="_connectedContainer_1rxr8_1",_d="_userInfo_1rxr8_10",vd="_avatar_1rxr8_16",Rd="_avatarImage_1rxr8_26",Ct={connectedContainer:Cd,userInfo:_d,avatar:vd,avatarImage:Rd},Ed=({customerEmail:t})=>{const{discordInfo:n,setDiscordInfo:o}=e.useDiscordStore(),{notifications:s,setNotifications:i}=e.useNotificationStore(),[r,a]=m.useState(!1),[c,u]=m.useState(0),[h,d]=m.useState(null),g=20,p=l=>{var C,x,_,f;return(x=(C=l==null?void 0:l.response)==null?void 0:C.data)!=null&&x.error?l.response.data.error:(f=(_=l==null?void 0:l.response)==null?void 0:_.data)!=null&&f.message?l.response.data.message:l!=null&&l.message?l.message:"Failed to connect to Discord. Please try again later."},I=(l,C)=>{i([...s,{id:e.v4(),message:l,status:C}])};m.useEffect(()=>{if(h&&r){const l=setInterval(()=>{h.closed&&(clearInterval(l),a(!1),d(null))},1e3);return()=>clearInterval(l)}},[h,r]);const j=()=>{t.trim()!==""&&(a(!0),u(0),In({customerEmail:t,tsId:e.getTsId()}).then(({data:l})=>{const C=window.open(l.redirectUrl);d(C),(!C||C.closed||typeof C.closed>"u")&&setTimeout(()=>{const f=document.createElement("a");f.href=l.redirectUrl,f.target="_blank",f.click()});let x;const _=()=>{if(u(f=>f+1),c>=g||C&&C.closed){c>=g&&I("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(x);return}fn({id:l.id,customerEmail:t}).then(({data:f})=>{o({authorized:!0,id:l.id,avatar:f.avatar,username:f.username}),C&&C.close(),a(!1),d(null),I("Discord successfully connected!","success"),clearTimeout(x)}).catch(f=>{var v;if(console.log("Waiting for authorization...",f,{newWindow:C}),C&&C.closed){a(!1),clearTimeout(x);return}if((v=f==null?void 0:f.response)!=null&&v.status&&f.response.status!==404&&f.response.status>=400){I(p(f),"error"),a(!1),clearTimeout(x);return}clearTimeout(x),x=setTimeout(_,1500)})};_()}).catch(l=>{console.log("Could not initiate Discord authorization",l),I(p(l),"error"),a(!1)}))};return n!=null&&n.authorized?e.jsxRuntimeExports.jsxs("div",{className:Ct.connectedContainer,children:[e.jsxRuntimeExports.jsxs("div",{className:Ct.userInfo,children:[e.jsxRuntimeExports.jsx("div",{className:Ct.avatar,children:n.avatar?e.jsxRuntimeExports.jsx("img",{className:Ct.avatarImage,src:`https://cdn.discordapp.com/avatars/${n.id}/${n.avatar}.png?size=256`}):e.jsxRuntimeExports.jsx(e.Icon,{name:"UserCircle"})}),e.jsxRuntimeExports.jsx("p",{children:n.username}),e.jsxRuntimeExports.jsx(Zl,{})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Reconnect"})]}):e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:r,children:r?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"DiscordLogo"}),e.jsxRuntimeExports.jsx(e.StableText,{children:"Connect Your Discord"})]})})},yd="_paymentMethodsContainer_1pfqr_2",bd="_antistock_1pfqr_15",xo={paymentMethodsContainer:yd,antistock:bd},wd="_bottomSheet_1x8kc_1",kd="_content_1x8kc_8",Nd="_description_1x8kc_11",Td="_title_1x8kc_15",Ld="_buttonGroup_1x8kc_19",Pd="_buttonWrapper_1x8kc_29",Ad="_fullWidthButton_1x8kc_32",Bd="_modal_1x8kc_36",Md="_header_1x8kc_43",Te={bottomSheet:wd,content:kd,description:Nd,title:Td,buttonGroup:Ld,buttonWrapper:Pd,fullWidthButton:Ad,modal:Bd,header:Md},$d=({setIsOpen:t,balance:n})=>{const o=e.useNavigate(),{setIsOpen:s}=e.useModalStore(),i=()=>{o("/top-up?redirectRoute=checkout")};function r(){s(!1),setTimeout(()=>{t(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Te.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Te.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Te.title,children:"Insufficient Customer Balance"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Te.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Te.content,children:e.jsxRuntimeExports.jsxs("p",{className:Te.description,children:["You currently have ",n&&e.formatPrice(n)," in your balance. After topping up the required amount, you can continue to checkout."]})}),e.jsxRuntimeExports.jsxs("div",{className:Te.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Te.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:r,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Te.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:i,children:"Add Balance"})})]})]})]})},_o=({align:t,gateway:n,gatewayDisplayName:o,selected:s,onSelect:i,total:r,onSignInClick:a,reversed:c,isAntistock:u=!1})=>{const{token:h}=e.useStorefrontStore(),{balance:d}=e.useCustomerDashboardStore(),[g,p]=m.useState(!1),{setIsOpen:I}=e.useModalStore(),j=l=>{l.stopPropagation(),i==null||i(n),d&&d.amount<r&&(p(!0),I(!0))};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(e.styles$3.paymentMethod,{[e.styles$3.selected]:s,[e.styles$3.alignColumn]:t==="column",[e.styles$3.reversed]:c&&!u,[e.styles$3.antistock]:u}),onClick:j,children:u?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("p",{className:e.styles$3.paymentText,id:"md",children:[o," ",e.jsxRuntimeExports.jsxs("span",{className:e.styles$3.balanceText,id:"md",children:["(",h?d&&e.formatPrice(d):e.jsxRuntimeExports.jsx("a",{className:e.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),e.jsxRuntimeExports.jsx("div",{className:e.styles$3.iconContainer,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("p",{className:e.styles$3.paymentText,id:"md",children:[o," ",e.jsxRuntimeExports.jsxs("span",{className:e.styles$3.balanceText,id:"md",children:["(",h?d&&e.formatPrice(d):e.jsxRuntimeExports.jsx("a",{className:e.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),e.jsxRuntimeExports.jsx("div",{className:e.styles$3.iconContainer,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]})}),g&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>p(!1),children:e.jsxRuntimeExports.jsx($d,{setIsOpen:p,balance:d})})]})},vo=({possibleGateways:t,setGateway:n,totalAndDiscount:o,onSignInClick:s,setPaymentMethod:i,isAntistock:r=!1})=>{const[a,c]=m.useState(),[u,h]=m.useState(),{setPriceAdjustment:d}=e.useCartStore(),[g,p]=m.useState(null),I=(j,l)=>{var C;u!==l&&(n(l),d(((C=g==null?void 0:g.find(x=>x.name===l))==null?void 0:C.priceAdjustment)||null)),i(j),c(j),h(l)};return m.useEffect(()=>{if(g&&g.length>0){const j=g[0];if(j.name==="Balance")h(j.name),n(j.name),d(j.priceAdjustment||null);else if(j.paymentMethods&&j.paymentMethods.length>0){const l=j.paymentMethods[0];c(l),h(j.name),n(j.name),i(l),d(j.priceAdjustment||null)}}},[g]),m.useEffect(()=>{const j=async()=>{const{data:l}=await e.fetchGatewaysDetail([...t.availableGateways,...t.requiresSignInGateways]);p(l)};t.availableGateways.length&&j()},[]),m.useLayoutEffect(()=>{d(null)},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:g&&e.jsxRuntimeExports.jsx("div",{className:e.clx(xo.paymentMethodsContainer,{[xo.antistock]:r}),children:g==null?void 0:g.map(j=>j.name==="Balance"?e.jsxRuntimeExports.jsx(_o,{gateway:j.name,gatewayDisplayName:j.displayName,onSelect:l=>{h(l),u!==l&&n(l)},selected:j.name===u,total:o.total,onSignInClick:s,reversed:!0,isAntistock:r},j.name):j.paymentMethods.map(l=>e.jsxRuntimeExports.jsx(e.CheckoutPaymentMethod,{paymentMethod:l,gateway:j.name,gatewayDisplayName:j.displayName,gatewayLogoCfId:j.logoCfImageId,poweredByLogoCfId:j.poweredByImageCfImageId,onSelect:C=>I(C,j.name),selected:a===l&&u===j.name,isAntistock:r},`${j.name}-${l}`)))})})},Fd="_modal_14r0b_1",Dd={modal:Fd},Hd=({setIsOpen:t})=>{const{token:n}=e.useStorefrontStore(),{setIsOpen:o}=e.useModalStore();m.useEffect(()=>{n&&s()},[n]);const s=()=>{o(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsx("div",{className:Dd.modal,onClick:i=>i.stopPropagation(),children:e.jsxRuntimeExports.jsx(e.Auth,{inModal:!0})})},Od=({getPossibleGateways:t,setGateway:n,getDiscordSettings:o,cart:s,products:i,submitCart:r,reset:a,setCustomFieldsToCart:c,totalAndDiscount:u,setDiscordSocialConnectId:h,setPaymentMethod:d,isAntistock:g})=>{const p=m.useMemo(()=>o(),[]),[I,j]=m.useState([]),{balance:l,setBalance:C}=e.useCustomerDashboardStore(),{token:x}=e.useStorefrontStore(),{executeRecaptcha:_}=e.useReCaptcha(),{discordInfo:f}=e.useDiscordStore(),{customerEmail:v,setCustomerEmail:S}=e.useCartStore(),R=f!=null&&f.authorized?f.id:void 0,w=e.useNavigate(),D=m.useMemo(()=>t(),[s.parts]),[te,Z]=m.useState(!1),{setIsOpen:M}=e.useModalStore(),{notifications:b,setNotifications:E}=e.useNotificationStore();m.useEffect(()=>{const A=e.getCommonCustomFields(s.parts,i).map(W=>W.type===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...W,value:String(W.defaultValue)}:W);j([...A])},[]),m.useEffect(()=>{const N=e.getCommonCustomFields(s.parts,i);j(A=>{const W=new Map(A.map(T=>[T.name,T]));return N.map(T=>{const q=W.get(T.name);return q&&q.value?{...T,value:q.value}:T.type===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...T,value:String(T.defaultValue)}:T})})},[s.parts,i]),m.useEffect(()=>{x&&(async()=>{const A=await e.getBalance();C(A)})()},[x]);function F(N){return N&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(N)}const Y=()=>{const N=[];return I.forEach(A=>{var W;A.required&&!((W=A.value)!=null&&W.toString().trim())&&N.push({message:`Field "${A.name}" is required.`,status:"error",id:e.v4()})}),N.length>0?(E([...b,...N]),!1):!0},U=async N=>{if(N.stopPropagation(),s.gateway==="Balance"&&!x){M(!0),Z(!0);return}if(!Y())return;const A=Object.fromEntries(I.map(T=>[T.name,T.value||""]));c({...A}),R&&p.isEnabled&&h(R);const W=await _();if(W){const T=await r(W),q=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(q).length>10){const ke=Date.now()-864e5;Object.keys(q).forEach(ve=>{q[ve].createdAt<=ke&&delete q[ve]})}"order"in T?q[T.order.id]={createdAt:Date.now(),fullAccessToken:T.order.fullAccessToken}:q[T.id]={createdAt:Date.now(),fullAccessToken:T.fullAccessToken},localStorage.setItem("orders",JSON.stringify(q)),w(`/orders/${"order"in T?T.order.id:T.id}/${"order"in T?T.order.fullAccessToken:T.fullAccessToken}`),setTimeout(()=>a(),0)}};return e.jsxRuntimeExports.jsxs("div",{className:ae.checkoutOperational,style:g?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsxs("div",{className:`${ae.innerContainer} ${g?ae.innerContainerAntistock:""}`,children:[g?e.jsxRuntimeExports.jsx("h4",{style:{fontSize:"var(--input-label-size)",color:"var(--text-secondary)",paddingBottom:"12px",fontWeight:"400"},children:"Select Payment Method"}):null,s.parts.length>0&&e.jsxRuntimeExports.jsx(vo,{possibleGateways:D,setGateway:n,setPaymentMethod:d,balance:l,totalAndDiscount:u,onSignInClick:()=>{Z(!0),M(!0)},isAntistock:g}),e.jsxRuntimeExports.jsx("div",{className:e.clx(ae.paymentMethodsSection,{[ae.antistock]:g,[ae.paymentMethodsSectionAntistock]:g}),children:e.jsxRuntimeExports.jsx(e.Input$1,{placeholder:"your@email.com",value:v||"",onChange:N=>S(N),disabled:!!x,label:"Email Address"})}),e.jsxRuntimeExports.jsx(Id,{customFields:I,setCustomFields:j}),p.isEnabled&&e.jsxRuntimeExports.jsxs("div",{className:ae.socialConnectSection,children:[e.jsxRuntimeExports.jsx("p",{className:ae.socialConnectLabel,id:"md",children:"Social Connect"}),e.jsxRuntimeExports.jsx("div",{className:ae.socialConnectContent,children:e.jsxRuntimeExports.jsx(Ed,{customerEmail:v||""})})]}),e.jsxRuntimeExports.jsxs("div",{className:`${ae.continueButton} ${g?ae.continueButtonAntistock:""}`,children:[e.jsxRuntimeExports.jsx(e.Button$1,{onClick:U,disabled:!s.gateway||!F(v||"")||p.isRequired&&!(f!=null&&f.authorized),className:ae.button,children:"Continue to Checkout"}),e.jsxRuntimeExports.jsx(e.TermsOfService,{}),e.jsxRuntimeExports.jsx(e.SecuredBySsl,{isAntistock:g})]}),e.jsxRuntimeExports.jsx(_e,{className:`${ae.checkoutFooter} ${g?ae.checkoutFooterAntistock:""}`})]}),te&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>Z(!1),children:e.jsxRuntimeExports.jsx(Hd,{setIsOpen:Z})})]})},Ud="_mt1_1l62z_1",Wd="_notifyBlock_1l62z_13",Gd="_notifyHeader_1l62z_19",qd="_notifyContent_1l62z_25",Vd="_buttonBlock_1l62z_30",zd="_imageBlock_1l62z_34",Zd="_imageContainer_1l62z_42",Xd="_sectionBlock_1l62z_54",Yd="_sectionTitle_1l62z_61",Kd="_sectionSubtitle_1l62z_64",Jd="_inputContainer_1l62z_69",Ce={mt1:Ud,notifyBlock:Wd,notifyHeader:Gd,notifyContent:qd,buttonBlock:Vd,imageBlock:zd,imageContainer:Zd,sectionBlock:Xd,sectionTitle:Yd,sectionSubtitle:Kd,inputContainer:Jd},Qd=({props:t})=>{const n=e.useCopy();return e.jsxRuntimeExports.jsx("div",{className:Ce.mt1,children:e.jsxRuntimeExports.jsxs("div",{className:Ce.inputContainer,children:[e.jsxRuntimeExports.jsx(e.Input$1,{value:t.text,disabled:!0,onChange:()=>{}}),t.shownCopyButton&&e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:()=>n(t.text),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})})},ep=({props:t})=>e.jsxRuntimeExports.jsx(e.Button$1,{className:Ce.buttonBlock,onClick:()=>window.open(t.url,"_blank","noopener"),children:t.text}),tp=({props:t})=>e.jsxRuntimeExports.jsx("div",{className:Ce.imageBlock,children:e.jsxRuntimeExports.jsx("div",{className:Ce.imageContainer,children:e.jsxRuntimeExports.jsx("img",{src:t.src,alt:""})})}),op=({props:t})=>e.jsxRuntimeExports.jsxs("div",{className:Ce.notifyBlock,children:[e.jsxRuntimeExports.jsxs("div",{className:Ce.notifyHeader,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),e.jsxRuntimeExports.jsx("p",{children:t.heading})]}),e.jsxRuntimeExports.jsx("p",{className:Ce.notifyContent,children:t.content})]}),np=({props:t})=>{var n;return e.jsxRuntimeExports.jsxs("div",{className:Ce.sectionBlock,children:[e.jsxRuntimeExports.jsx("p",{className:Ce.sectionTitle,children:t.title}),e.jsxRuntimeExports.jsx("span",{className:Ce.sectionSubtitle,children:t.subTitle}),(n=t.children)==null?void 0:n.map((o,s)=>e.jsxRuntimeExports.jsx(Vt,{block:o},s))]})},Vt=({block:t})=>{switch(t.type){case"Section":return e.jsxRuntimeExports.jsx(np,{...t});case"ReadOnlyTextInput":return e.jsxRuntimeExports.jsx(Qd,{...t});case"Notify":return e.jsxRuntimeExports.jsx(op,{...t});case"Button":return e.jsxRuntimeExports.jsx(ep,{...t});case"Image":return e.jsxRuntimeExports.jsx(tp,{...t});default:return null}},sp="_bottomSheet_1x4sq_1",rp="_content_1x4sq_8",ip="_agreementList_1x4sq_11",ap="_agreementItem_1x4sq_16",cp="_warning_1x4sq_23",lp="_buttonGroup_1x4sq_31",up="_buttonWrapper_1x4sq_41",dp="_fullWidthButton_1x4sq_44",pp="_modal_1x4sq_48",mp="_header_1x4sq_55",me={bottomSheet:sp,content:rp,agreementList:ip,agreementItem:ap,warning:cp,buttonGroup:lp,buttonWrapper:up,fullWidthButton:dp,modal:pp,header:mp},xp=({setIsOpen:t,price:n})=>{const[o,s]=m.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:i}=e.useModalStore(),r=()=>{i(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:me.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:me.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:me.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:me.content,children:[e.jsxRuntimeExports.jsxs("div",{className:me.agreementList,children:[e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToSendAsFF,onChange:a=>s({...o,agreeToSendAsFF:a})}),e.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToSend,onChange:a=>s({...o,agreeToSend:a})}),e.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",e.formatPrice(n)," ",n.currency]})]}),e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToNotAddNote,onChange:a=>s({...o,agreeToNotAddNote:a})}),e.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),e.jsxRuntimeExports.jsx("div",{className:me.warning,children:e.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",e.formatPrice(n)," ",n.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),e.jsxRuntimeExports.jsxs("div",{className:me.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:me.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",children:e.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),e.jsxRuntimeExports.jsx("div",{className:me.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!(o.agreeToSendAsFF&&o.agreeToNotAddNote&&o.agreeToSend),onClick:r,children:"Continue to Payment"})})]})]})]})},hp="_chargeItemsContainer_vynct_5",gp="_chargeItemsInner_vynct_18",jp="_productsContainer_vynct_25",Ip="_antistockLayout_vynct_40",fp="_mainContentAntistock_vynct_53",Sp="_desktopTrackPayment_vynct_64",Cp="_desktopFooter_vynct_73",_p="_footerContainerAntistock_vynct_94",vp="_chargeHeader_vynct_107",Rp="_chargeTitle_vynct_115",Ep="_chargeDescription_vynct_121",yp="_copyButton_vynct_127",bp="_productsList_vynct_139",wp="_footerContainer_vynct_94",ce={chargeItemsContainer:hp,chargeItemsInner:gp,productsContainer:jp,antistockLayout:Ip,mainContentAntistock:fp,desktopTrackPayment:Sp,desktopFooter:Cp,footerContainerAntistock:_p,chargeHeader:vp,chargeTitle:Rp,chargeDescription:Ep,copyButton:yp,productsList:bp,footerContainer:wp},kp=({charge:t})=>{var a;const n=e.useCopy(),{isAntistock:o}=e.useGeneralStore(),s=(t==null?void 0:t.price.currency)||"USD",i=new Intl.NumberFormat("en-US",{style:"currency",currency:s}),r=m.useMemo(()=>{var c;return((c=t==null?void 0:t.order)==null?void 0:c.partOrders.map(u=>{var h,d,g,p;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:(()=>{var l,C;const I=((l=u.productWithVariant)==null?void 0:l.name)||"",j=((C=u.productWithVariant)==null?void 0:C.variantName)||"";return!I&&!j?"":!j||I===j?I:I?`${I} (${j})`:j})(),description:"",price:{quantity:u.quantity,amount:((h=u.productWithVariant)==null?void 0:h.price.amount)||0,currency:(d=u.productWithVariant)==null?void 0:d.price.currency},subscriptionSettings:(g=t.order)!=null&&g.subscriptionOrderId?(p=u.productWithVariant)==null?void 0:p.subscriptionSettings:null}}))||[]},[t]);return e.jsxRuntimeExports.jsx("div",{className:ce.chargeItemsContainer,children:e.jsxRuntimeExports.jsxs("div",{className:ce.chargeItemsInner,children:[e.jsxRuntimeExports.jsx(lt,{expiresAt:t==null?void 0:t.expiresAt}),e.jsxRuntimeExports.jsxs("div",{className:`${ce.productsContainer} ${o?ce.antistockLayout:""}`,children:[(t==null?void 0:t.name)&&e.jsxRuntimeExports.jsxs("header",{className:ce.chargeHeader,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{className:ce.chargeTitle,id:"h5",children:t.name}),t.description&&e.jsxRuntimeExports.jsx("p",{className:ce.chargeDescription,id:"md",children:t.description})]}),((a=t.order)==null?void 0:a.id)&&!o&&e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Secondary",className:ce.copyButton,onClick:()=>{var c;return n(((c=t.order)==null?void 0:c.id)||"")},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"}),"Copy Order ID"]})]}),e.jsxRuntimeExports.jsxs("div",{className:o?ce.mainContentAntistock:"",style:o?void 0:{flex:1},children:[!!r.length&&e.jsxRuntimeExports.jsx("div",{className:ce.productsList,children:r.map(c=>e.jsxRuntimeExports.jsx(Zt,{product:c},c.id))}),e.jsxRuntimeExports.jsx(ut,{formatter:i,coupon:null,total:(t==null?void 0:t.price.amount)||0,discount:0,totalWithDiscount:(t==null?void 0:t.price.amount)||0,isShowSubtotal:!1}),o&&t&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:ce.desktopTrackPayment,children:e.jsxRuntimeExports.jsx(e.TrackPayment,{timeline:t.timeline})}),e.jsxRuntimeExports.jsx(_e,{className:ce.desktopFooter})]})]}),!o&&e.jsxRuntimeExports.jsx(_e,{className:`${ce.footerContainer} ${o?ce.footerContainerAntistock:""}`})]})]})})},Np="_checkoutOrderMainData_hqf60_1",Tp="_orderDetailRow_hqf60_6",Lp="_chargeIdRow_hqf60_16",Pp="_detailLabel_hqf60_25",Ap="_detailValue_hqf60_29",Bp="_chargeIdContainer_hqf60_33",Mp="_chargeId_hqf60_16",$p="_copyIcon_hqf60_51",ee={checkoutOrderMainData:Np,orderDetailRow:Tp,chargeIdRow:Lp,detailLabel:Pp,detailValue:Ap,chargeIdContainer:Bp,chargeId:Mp,copyIcon:$p},Ro=({lastUpdate:t,invoiceId:n,email:o,paymentType:s,orderId:i})=>{const r=e.useCopy(),[a,c]=m.useState(null),u=a==null?void 0:a.find(d=>d.name===s);m.useEffect(()=>{a||(async()=>{if(!s)return;const g=[s],p=await e.getGatewaysDetail(g);c(p)})()},[s,a]);const h=d=>{const g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],p=d.getDate().toString().padStart(2,"0"),I=g[d.getMonth()],j=d.getFullYear(),l=d.getHours(),C=d.getMinutes().toString().padStart(2,"0"),x=d.getSeconds().toString().padStart(2,"0"),_=l>=12?"PM":"AM",f=(l%12||12).toString().padStart(2,"0");return`${I} ${p}, ${j} at ${f}:${C}:${x} ${_}`};return e.jsxRuntimeExports.jsxs("div",{className:ee.checkoutOrderMainData,children:[e.jsxRuntimeExports.jsxs("div",{className:ee.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:ee.detailLabel,id:"md",children:"Last Updated"}),e.jsxRuntimeExports.jsx("p",{className:ee.detailValue,id:"md",children:h(new Date(t))})]}),s&&e.jsxRuntimeExports.jsxs("div",{className:ee.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:ee.detailLabel,id:"md",children:"Payment Type"}),e.jsxRuntimeExports.jsx("p",{className:ee.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),e.jsxRuntimeExports.jsxs("div",{className:ee.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:ee.detailLabel,id:"md",children:"Email"}),e.jsxRuntimeExports.jsx("p",{className:ee.detailValue,id:"md",children:o})]}),n&&e.jsxRuntimeExports.jsxs("div",{className:ee.chargeIdRow,children:[e.jsxRuntimeExports.jsx("p",{className:ee.detailLabel,id:"md",children:"Charge ID"}),e.jsxRuntimeExports.jsxs("div",{className:ee.chargeIdContainer,children:[e.jsxRuntimeExports.jsx("p",{className:ee.chargeId,id:"md",children:n}),e.jsxRuntimeExports.jsx("div",{className:ee.copyIcon,onClick:()=>r(n),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})]}),i&&e.jsxRuntimeExports.jsxs("div",{className:ee.chargeIdRow,children:[e.jsxRuntimeExports.jsx("p",{className:ee.detailLabel,id:"md",children:"Order ID"}),e.jsxRuntimeExports.jsxs("div",{className:ee.chargeIdContainer,children:[e.jsxRuntimeExports.jsx("p",{className:ee.chargeId,id:"md",children:i}),e.jsxRuntimeExports.jsx("div",{className:ee.copyIcon,onClick:()=>r(i),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})]})]})},Fp="_bottomSheet_1yai1_1",Dp="_formContainer_1yai1_8",Hp="_error_1yai1_14",Op="_buttonGroup_1yai1_18",Up="_buttonWrapper_1yai1_28",Wp="_fullWidthButton_1yai1_31",Gp="_modal_1yai1_41",qp="_header_1yai1_48",Ae={bottomSheet:Fp,formContainer:Dp,error:Hp,buttonGroup:Op,buttonWrapper:Up,fullWidthButton:Wp,modal:Gp,header:qp},Vp=({chargeId:t,setIsOpen:n})=>{const[o,s]=m.useState(""),[i,r]=m.useState(""),{setIsOpen:a}=e.useModalStore(),c=d=>{try{return new URL(d),!0}catch{return!1}},u=async d=>{if(d.preventDefault(),!o){r("The link field cannot be empty.");return}if(!c(o)){r("Please enter a valid URL");return}await pn({url:o},t)&&(alert("CashApp successfully verified"),n(!1))},h=()=>{a(!1),setTimeout(()=>{n(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:Ae.modal,onClick:d=>d.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Ae.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:h,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsx("form",{onSubmit:u,children:e.jsxRuntimeExports.jsxs("div",{className:Ae.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Ae.formContainer,children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.Input$1,{value:o,onChange:d=>{s(d),r("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),i&&e.jsxRuntimeExports.jsx("p",{className:Ae.error,children:i})]})}),e.jsxRuntimeExports.jsxs("div",{className:Ae.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ae.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:h,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Ae.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},zp="_container_1opbn_1",Zp="_productDetails_1opbn_8",Xp="_imageContainer_1opbn_14",Yp="_image_1opbn_14",Kp="_textContainer_1opbn_32",Jp="_header_1opbn_40",Qp="_title_1opbn_46",em="_price_1opbn_53",tm="_badgeContainer_1opbn_57",om="_description_1opbn_61",be={container:zp,productDetails:Zp,imageContainer:Xp,image:Yp,textContainer:Kp,header:Jp,title:Qp,price:em,badgeContainer:tm,description:om},nm=({subscription:t})=>e.jsxRuntimeExports.jsxs("div",{className:be.container,children:[e.jsxRuntimeExports.jsxs("div",{className:be.productDetails,children:[e.jsxRuntimeExports.jsx("div",{className:be.imageContainer,children:t!=null&&t.image?e.jsxRuntimeExports.jsx("img",{className:be.image,src:e.convertCfImageIdToUrl(t.image.cfId),alt:t==null?void 0:t.name}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image"})}),e.jsxRuntimeExports.jsxs("div",{className:be.textContainer,children:[e.jsxRuntimeExports.jsx("div",{className:be.header,children:e.jsxRuntimeExports.jsx("h2",{className:be.title,children:t.name})}),e.jsxRuntimeExports.jsxs("p",{className:be.price,children:[e.formatPrice(t.price)," / ",t.recurringInterval]})]}),e.jsxRuntimeExports.jsx("div",{className:be.badgeContainer,children:e.jsxRuntimeExports.jsx(e.SubscriptionStatusBadge,{status:t.status})})]}),t.description&&e.jsxRuntimeExports.jsx(e.Markdown,{className:be.description,children:t.description})]}),sm="_card_69liy_1",rm="_price_69liy_10",im="_interval_69liy_17",am="_name_69liy_22",cm="_description_69liy_28",lm="_currentPlan_69liy_32",um="_selectButton_69liy_45",dm="_progressSection_69liy_50",pm="_progressLabel_69liy_54",mm="_bottomSheet_69liy_60",xm="_title_69liy_69",hm="_typeSelector_69liy_80",gm="_typeOption_69liy_90",jm="_active_69liy_100",Im="_saveTag_69liy_108",fm="_planSelector_69liy_117",Sm="_modal_69liy_127",Cm="_inactive_69liy_148",_m="_notMounted_69liy_151",vm="_closeButton_69liy_157",K={card:sm,price:rm,interval:im,name:am,description:cm,currentPlan:lm,selectButton:um,progressSection:dm,progressLabel:pm,bottomSheet:mm,title:xm,typeSelector:hm,typeOption:gm,active:jm,saveTag:Im,planSelector:fm,modal:Sm,inactive:Cm,notMounted:_m,closeButton:vm},Rm=({variant:t,onSelect:n,isCurrent:o})=>{const s=t.subscriptionSettings.recurringIntervalDays===30?"month":t.subscriptionSettings.recurringIntervalDays===365?"year":"period",i=t.subscriptionSettings.price.amount.toFixed(2),r=t.subscriptionSettings.recurringIntervalDays,a=10;return e.jsxRuntimeExports.jsxs("div",{className:K.card,onClick:n,children:[e.jsxRuntimeExports.jsxs("h2",{className:K.price,children:["$",i," ",e.jsxRuntimeExports.jsxs("span",{className:K.interval,children:["/ ",s]})]}),e.jsxRuntimeExports.jsx("h3",{className:K.name,children:t.name}),t.description&&e.jsxRuntimeExports.jsx("p",{className:K.description,children:t.description}),o?e.jsxRuntimeExports.jsxs("div",{className:K.currentPlan,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check"}),"Your current Plan"]}):e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",className:K.selectButton,children:"Select"}),o&&e.jsxRuntimeExports.jsxs("div",{className:K.progressSection,children:[e.jsxRuntimeExports.jsx(Co,{percent:a/r*100,disablePercentLabel:!0}),e.jsxRuntimeExports.jsxs("p",{className:K.progressLabel,children:["Used: ",a," of ",r," days"]})]})]})},Em=({isOpen:t,setIsOpen:n,subscription:o})=>{const[s,i]=m.useState(null),[r,a]=m.useState(null),[c,u]=m.useState(null),{id:h,accessToken:d}=e.useParams(),[g,p]=m.useState(!1),[I,j]=m.useState(!1),{setIsOpen:l}=e.useModalStore();m.useEffect(()=>{t&&p(!0)},[t]);const C=()=>{n(!1)},[x,_]=m.useState(null);m.useEffect(()=>{h&&d&&(async()=>{if(h&&d){const{data:R}=await e.getSubscriptionUpgradePlans({id:h,accessToken:d});_(R)}})()},[h,d]),m.useEffect(()=>{var S;if(x!=null&&x.data.types[0]){const R=(S=x.data.types.flatMap(w=>w.productVariants).find(w=>w.data.id===(o==null?void 0:o.variantId)))==null?void 0:S.data;R&&(u(R),a(R))}},[x,o]),m.useEffect(()=>{x!=null&&x.data.types[0]&&i(x==null?void 0:x.data.types[0])},[x==null?void 0:x.data.types]);const f=S=>{i(S),a(null)},v=S=>{a(S),l(!0),j(!0)};return e.jsxRuntimeExports.jsxs("div",{className:e.clx(K.modal,{[K.active]:t,[K.inactive]:!t&&g,[K.notMounted]:!g}),onClick:S=>S.stopPropagation(),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:C,hoverable:!0,className:K.closeButton,fill:"var(--text-primary)"}),e.jsxRuntimeExports.jsxs("div",{className:K.bottomSheet,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:K.title,children:"Change Plan"}),e.jsxRuntimeExports.jsx("p",{className:K.description,children:x==null?void 0:x.data.description}),e.jsxRuntimeExports.jsx("div",{className:K.typeSelector,children:x==null?void 0:x.data.types.map(S=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(K.typeOption,{[K.active]:(s==null?void 0:s.id)===S.id}),onClick:()=>f(S),children:[S.name,S.name==="Yearly"&&e.jsxRuntimeExports.jsx("span",{className:K.saveTag,children:"Save %"})]},S.id))}),s&&e.jsxRuntimeExports.jsx("div",{className:K.planSelector,children:s.productVariants.map(S=>e.jsxRuntimeExports.jsx(Rm,{variant:S.data,isSelected:(r==null?void 0:r.id)===S.data.id,isCurrent:(c==null?void 0:c.id)===S.data.id,onSelect:()=>v(S.data)},S.data.id))})]}),I&&r&&o&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{j(!1)},children:e.jsxRuntimeExports.jsx(hx,{setIsOpen:j,selectedVariant:r,subscription:o})})]})},ym="_container_nb625_1",bm="_title_nb625_11",wm="_subtitle_nb625_16",km="_info_nb625_20",_t={container:ym,title:bm,subtitle:wm,info:km},Nm=()=>{const{subscription:t}=e.useSubscriptionStore(),[n,o]=e.extractDateAndTime((t==null?void 0:t.activeTo)||""),[s,i]=m.useState(!1),{setIsOpen:r}=e.useModalStore();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:_t.container,children:[e.jsxRuntimeExports.jsxs("div",{className:_t.info,children:[e.jsxRuntimeExports.jsx("p",{className:_t.title,children:"Expiration Date"}),e.jsxRuntimeExports.jsxs("p",{className:_t.subtitle,children:[n," at ",o]})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:a=>{a.stopPropagation(),r(!0),i(!0)},children:"Extend"})]}),s&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Px,{setIsOpen:i})})]})},Tm="_couponContainer_1sspa_1",Lm="_iconWrapper_1sspa_10",Pm="_details_1sspa_21",Am="_title_1sspa_25",Bm="_progress_1sspa_29",Mm="_foreverText_1sspa_34",Ye={couponContainer:Tm,iconWrapper:Lm,details:Pm,title:Am,progress:Bm,foreverText:Mm},$m=({coupon:t,currency:n})=>{const o=t.isFixed?e.formatPrice({amount:t.discount,currency:n}):`${t.discount}%`,s=t.initialCouponDurationForSubscriptions?e.percentageDifference(t.initialCouponDurationForSubscriptions,t.currentCouponDurationForSubscriptions||1):100;return e.jsxRuntimeExports.jsxs("div",{className:Ye.couponContainer,children:[e.jsxRuntimeExports.jsx("div",{className:Ye.iconWrapper,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CheckCircle"})}),e.jsxRuntimeExports.jsxs("div",{className:Ye.details,children:[e.jsxRuntimeExports.jsxs("p",{className:Ye.title,children:[t.name,", ",o," discount"]}),e.jsxRuntimeExports.jsx("div",{className:Ye.progress,children:e.jsxRuntimeExports.jsx(Co,{color:"#C2C2C2",percent:s,disablePercentLabel:!0})}),e.jsxRuntimeExports.jsx("p",{className:Ye.foreverText,children:"Forever discount code"})]})]})},Fm="_paymentMethodContainer_1g0da_4",Dm="_paymentMethodTitle_1g0da_15",Hm="_activeMethod_1g0da_20",Om="_noMethod_1g0da_28",Um="_activeMethodPaymentMethod_1g0da_37",Wm="_paymentMethodLogo_1g0da_47",Gm="_paymentMethodNumber_1g0da_57",qm="_method_1g0da_61",Me={paymentMethodContainer:Fm,paymentMethodTitle:Dm,activeMethod:Hm,noMethod:Om,activeMethodPaymentMethod:Um,paymentMethodLogo:Wm,paymentMethodNumber:Gm,method:qm},Vm="_paymentMethods_1gev0_1",zm="_modal_1gev0_14",Zm="_header_1gev0_28",Xm="_content_1gev0_37",Oe={paymentMethods:Vm,modal:zm,header:Zm,content:Xm},Ym=t=>{const{setIsLoading:n,setIsOpen:o}=t,{subscription:s,setSubscription:i}=e.useSubscriptionStore();if(!s)return null;const{id:r}=e.useParams(),a=e.useNavigate(),{notifications:c,setNotifications:u}=e.useNotificationStore(),{setPaymentMethod:h,setGateway:d,cart:g}=e.useCart(),{setIsOpen:p}=e.useModalStore();async function I(){if(j(),n(!0),r&&s){const{data:l}=await e.changeSubscriptionGateway(r,g.gateway);l.isReconnectPaymentNeeded?a(`/charges/${l.chargeId}`):(u([...c,{status:"success",id:e.v4(),message:"Your action has been successfully completed"}]),i({...s,gatewayName:g.gateway}))}else u([...c,{status:"error",id:e.v4(),message:"Your action has been failed. Try again!"}]);n(!1)}function j(){p(!1),setTimeout(()=>{o(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Oe.modal,onClick:l=>{l.stopPropagation()},children:[e.jsxRuntimeExports.jsxs("div",{className:Oe.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Oe.title,children:"Choose Payment Method"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:j,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Oe.content,children:[(s==null?void 0:s.availableGateways)&&e.jsxRuntimeExports.jsx(vo,{possibleGateways:{availableGateways:s.availableGateways,requiresSignInGateways:s.availableGateways},setGateway:d,setPaymentMethod:h,totalAndDiscount:{total:(s==null?void 0:s.price.amount)||0,totalWithDiscount:s==null?void 0:s.price.amount},onSignInClick:()=>a("/customer-dash")}),e.jsxRuntimeExports.jsxs("div",{className:Oe.paymentMethods,children:[e.jsxRuntimeExports.jsx("div",{className:Oe.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Oe.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!g.gateway,onClick:()=>I(),children:"Continue"})})]})]})]})},Km="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20131.39%2086.9'%3e%3cdefs%3e%3cstyle%3e.a{opacity:0;}.b{fill:%23fff;}.c{fill:%23ff5f00;}.d{fill:%23eb001b;}.e{fill:%23f79e1b;}%3c/style%3e%3c/defs%3e%3ctitle%3eAsset%201%3c/title%3e%3cg%20class='a'%3e%3crect%20class='b'%20width='131.39'%20height='86.9'/%3e%3c/g%3e%3crect%20class='c'%20x='48.37'%20y='15.14'%20width='34.66'%20height='56.61'/%3e%3cpath%20class='d'%20d='M51.94,43.45a35.94,35.94,0,0,1,13.75-28.3,36,36,0,1,0,0,56.61A35.94,35.94,0,0,1,51.94,43.45Z'/%3e%3cpath%20class='e'%20d='M120.5,65.76V64.6H121v-.24h-1.19v.24h.47v1.16Zm2.31,0v-1.4h-.36l-.42,1-.42-1h-.36v1.4h.26V64.7l.39.91h.27l.39-.91v1.06Z'/%3e%3cpath%20class='e'%20d='M123.94,43.45a36,36,0,0,1-58.25,28.3,36,36,0,0,0,0-56.61,36,36,0,0,1,58.25,28.3Z'/%3e%3c/svg%3e",Jm=()=>{var j,l,C;const{subscription:t}=e.useSubscriptionStore(),{cart:n,setPaymentMethod:o}=e.useCart(),s=e.useNavigate(),[i,r]=m.useState(null),[a,c]=m.useState(!1),[u,h]=m.useState(!1),{setIsOpen:d}=e.useModalStore();if(!t)return null;const[g,p]=m.useState(t.gatewayName||n.gateway),I=n.paymentMethod;return m.useEffect(()=>{(async()=>{const _=await e.getGatewaysDetail(t.availableGateways);r(_)})()},[]),m.useEffect(()=>{n.gateway!==g&&p(n.gateway)},[n.gateway]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:Me.paymentMethodContainer,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("p",{className:Me.paymentMethodTitle,children:"Active Payment Method"}),t.gatewayInfo&&Object.keys(t.gatewayInfo).length>0&&e.jsxRuntimeExports.jsx(Qm,{gatewayInfo:t.gatewayInfo}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&g==="Balance"&&e.jsxRuntimeExports.jsx(_o,{gateway:g,gatewayDisplayName:g,total:(t==null?void 0:t.price.amount)||0,onSignInClick:()=>s("/customer-dash")}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&!g&&e.jsxRuntimeExports.jsx("span",{className:Me.noMethod,children:"Payment method is not set"}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&g&&e.jsxRuntimeExports.jsx("div",{className:Me.activeMethod,children:i&&e.jsxRuntimeExports.jsx(e.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(j=i.find(x=>x.name===g))==null?void 0:j.logoCfImageId,gatewayDisplayName:(l=i.find(x=>x.name===g))==null?void 0:l.displayName,gateway:g,poweredByLogoCfId:(C=i.find(x=>x.name===g))==null?void 0:C.poweredByImageCfImageId,className:Me.activeMethodPaymentMethod,selected:I===g,onSelect:x=>{o(x)}},g)})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:x=>{x.stopPropagation(),d(!0),h(!0)},children:n.gateway?"Change":"Manage"})]}),u&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>h(!1),children:e.jsxRuntimeExports.jsx(Ym,{setIsLoading:c,setIsOpen:h})})]})},Qm=({gatewayInfo:t})=>{var n,o,s,i,r;return e.jsxRuntimeExports.jsxs("div",{className:Me.method,children:[e.jsxRuntimeExports.jsxs("div",{className:Me.paymentMethodLogo,children:[((n=t.card)==null?void 0:n.brand.toLowerCase())==="visa"&&e.jsxRuntimeExports.jsx(e.Visa,{}),((o=t.card)==null?void 0:o.brand.toLowerCase())==="mastercard"&&e.jsxRuntimeExports.jsx("img",{src:Km,alt:"",width:22}),((s=t.card)==null?void 0:s.brand.toLowerCase())!=="visa"&&((i=t.card)==null?void 0:i.brand.toLowerCase())!=="mastercard"&&e.jsxRuntimeExports.jsx(e.Icon,{name:"CreditCard",width:22})]}),e.jsxRuntimeExports.jsxs("p",{className:Me.paymentMethodNumber,children:["•••• •••• •••• ",(r=t.card)==null?void 0:r.last4]})]})},ex="_subscriptionProductContainer_83ibx_4",tx="_subscriptionProductImage_83ibx_15",ox="_subscriptionProductInfo_83ibx_32",nx="_name_83ibx_37",sx="_price_83ibx_40",st={subscriptionProductContainer:ex,subscriptionProductImage:tx,subscriptionProductInfo:ox,name:nx,price:sx},rx=({subscription:t,id:n,accessToken:o})=>{const[s,i]=m.useState(!1),{setIsOpen:r}=e.useModalStore();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:st.subscriptionProductContainer,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:st.subscriptionProductImage,children:t!=null&&t.image?e.jsxRuntimeExports.jsx("img",{src:e.convertCfImageIdToUrl(t.image.cfId)}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image"})}),e.jsxRuntimeExports.jsxs("div",{className:st.subscriptionProductInfo,children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:e.jsxRuntimeExports.jsx("h2",{className:st.name,children:t.name})}),e.jsxRuntimeExports.jsxs("p",{className:st.price,children:[e.formatPrice(t.price)," / ",t.recurringInterval]})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:a=>{a.preventDefault(),i(!0),r(!0)},children:"Cancel"})]}),s&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Vx,{accessToken:o,id:n,isOpen:s,setIsOpen:i})})]})},ix="_content_5ctxw_1",ax="_selectedPlan_5ctxw_37",cx="_planName_5ctxw_44",lx="_description_5ctxw_48",ux="_price_5ctxw_51",dx="_buttonGroup_5ctxw_79",px="_buttonWrapper_5ctxw_84",mx="_modal_5ctxw_88",xx="_header_5ctxw_95",Ie={content:ix,selectedPlan:ax,planName:cx,description:lx,price:ux,buttonGroup:dx,buttonWrapper:px,modal:mx,header:xx},hx=({setIsOpen:t,selectedVariant:n,subscription:o})=>{if(!n)return null;const{setIsOpen:s}=e.useModalStore(),i=()=>{r()},r=()=>{s(!1),setTimeout(()=>{t(!1)},300)},a=(n.subscriptionSettings.compareAtPrice||n.subscriptionSettings.price).amount,c=n.subscriptionSettings.compareAtPrice?n.subscriptionSettings.compareAtPrice.amount-n.subscriptionSettings.price.amount:n.subscriptionSettings.price.amount,u=a-c,h=new Intl.NumberFormat("en-US",{style:"currency",currency:o.price.currency});return e.jsxRuntimeExports.jsxs("div",{className:Ie.modal,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:()=>r(),fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ie.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.content,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.selectedPlan,children:[e.jsxRuntimeExports.jsx("h2",{className:Ie.planName,children:n.name}),e.jsxRuntimeExports.jsx("p",{className:Ie.description,children:n.description}),e.jsxRuntimeExports.jsxs("p",{className:Ie.price,children:["$",n.subscriptionSettings.price.amount.toFixed(2)," /"," ",n.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),e.jsxRuntimeExports.jsx(ut,{formatter:h,coupon:null,total:u,discount:c})]}),e.jsxRuntimeExports.jsxs("div",{className:Ie.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ie.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:()=>r(),children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:Ie.buttonWrapper,children:e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Primary",onClick:i,children:["Upgrade for $",u.toFixed(2)]})})]})]})]})},gx="_reviewMessage_1t8u4_1",jx="_leaveReviewContainer_1t8u4_11",Ix="_leaveReviewTitle_1t8u4_20",Ot={reviewMessage:gx,leaveReviewContainer:jx,leaveReviewTitle:Ix},fx=({review:t,orderId:n,className:o})=>{const[s,i]=m.useState((t==null?void 0:t.rating)||0),[r,a]=m.useState(!1),{setIsOpen:c}=e.useModalStore(),{notifications:u,setNotifications:h}=e.useNotificationStore(),d=async g=>{t&&"accessToken"in t&&(await gn({comment:g,rating:s,tsId:e.getTsId()},n,t.accessToken),h([...u,{status:"success",id:e.v4(),message:"Review left successfully"}]),a(!1))};return m.useEffect(()=>{t&&s&&"accessToken"in t&&!t.rating&&(c(!0),a(!0))},[s]),t?t.rating&&"accessToken"in t?e.jsxRuntimeExports.jsxs("div",{className:Ot.reviewMessage,children:["You left a ",t.rating," star rating"]}):e.jsxRuntimeExports.jsxs("div",{className:e.clx(Ot.leaveReviewContainer,o),children:[e.jsxRuntimeExports.jsx("p",{className:Ot.leaveReviewTitle,children:"Leave a review"}),e.jsxRuntimeExports.jsx(au,{rating:s,setRating:i,disabled:!!t.rating||!("accessToken"in t)}),r&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>a(!1),children:e.jsxRuntimeExports.jsx(bx,{setIsOpen:a,onSubmit:d})})]}):null},Sx="_bottomSheet_1bcyj_1",Cx="_content_1bcyj_7",_x="_title_1bcyj_18",vx="_buttonGroup_1bcyj_22",Rx="_buttonWrapper_1bcyj_33",Ex="_modal_1bcyj_37",yx="_header_1bcyj_44",Be={bottomSheet:Sx,content:Cx,title:_x,buttonGroup:vx,buttonWrapper:Rx,modal:Ex,header:yx},bx=({setIsOpen:t,onSubmit:n})=>{const[o,s]=m.useState(""),{setIsOpen:i}=e.useModalStore(),r=()=>{i(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:Be.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Be.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Be.title,children:"Review Description"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Be.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Be.content,children:e.jsxRuntimeExports.jsx(e.Textarea$1,{placeholder:"Great product and fast checkout...",value:o,onChange:a=>s(a),label:"Describe your review in detail below"})}),e.jsxRuntimeExports.jsxs("div",{className:Be.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Be.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:r,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Be.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!o,onClick:()=>{r(),n(o)},children:"Submit"})})]})]})]})},wx="_container_1idhv_1",kx="_buttonGroup_1idhv_8",Nx="_buttonWrapper_1idhv_15",Tx="_header_1idhv_19",Lx="_content_1idhv_28",Ue={container:wx,buttonGroup:kx,buttonWrapper:Nx,header:Tx,content:Lx},Px=({setIsOpen:t})=>{const{subscription:n}=e.useSubscriptionStore(),{getTotalAndDiscount:o,cart:s,coupon:i}=e.useCart(),[r,a]=m.useState(1),c=e.useNavigate(),{setIsOpen:u}=e.useModalStore(),{setNotifications:h,notifications:d}=e.useNotificationStore(),[g,p]=m.useState(!1),I=m.useMemo(()=>o(),[i,s]),j=m.useMemo(()=>I.totalWithDiscount?I.total-I.totalWithDiscount:0,[I]);if(g)return e.jsxRuntimeExports.jsx(e.ProcessingPaymentModal,{});const l=(n==null?void 0:n.price.currency)||"USD",C=new Intl.NumberFormat("en-US",{style:"currency",currency:l});async function x(){var f;p(!0);try{const{data:v}=await e.extendSubscription((n==null?void 0:n.id)||"",{});h([{id:e.v4(),message:"Order created successfully",status:"success"}]),c(`/orders/${(f=v.data)==null?void 0:f.id}/${v.data.fullAccessToken}`)}catch(v){const S=v;h([...d,{id:e.v4(),message:`Order creation failed: ${S.message}`,status:"error"}]),_()}finally{p(!1)}}function _(){u(!1),setTimeout(()=>{t(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Ue.container,onClick:f=>f.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Ue.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ue.title,children:"Extend Subscription"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:_,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ue.content,children:[e.jsxRuntimeExports.jsx(fu,{step:r,totalSteps:12,onStepChange:a,label:"How long would you like to extend your subscription for?"}),e.jsxRuntimeExports.jsx(ut,{formatter:C,coupon:i,total:I.total,discount:j,totalWithDiscount:I.totalWithDiscount}),e.jsxRuntimeExports.jsxs("div",{className:Ue.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ue.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:_,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Ue.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:x,children:"Extend"})})]})]})]})},Ax="_bottomSheet_uw5jb_1",Bx="_content_uw5jb_7",Mx="_radioGroup_uw5jb_11",$x="_confirmation_uw5jb_26",Fx="_iconWrapper_uw5jb_33",Dx="_title_uw5jb_42",Hx="_message_uw5jb_48",Ox="_buttonGroup_uw5jb_54",Ux="_buttonWrapper_uw5jb_64",Wx="_modal_uw5jb_68",Gx="_header_uw5jb_77",se={bottomSheet:Ax,content:Bx,radioGroup:Mx,confirmation:$x,iconWrapper:Fx,title:Dx,message:Hx,buttonGroup:Ox,buttonWrapper:Ux,modal:Wx,header:Gx},qx={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},Vx=({isOpen:t,setIsOpen:n,id:o,accessToken:s})=>{const[i,r]=m.useState(0),[a,c]=m.useState(!1),[u,h]=m.useState(""),[d,g]=m.useState(""),{setIsOpen:p}=e.useModalStore(),I=async()=>{if(!u)return;c(!0);const l=await e.cancelSubscription(o,s,{reason:u==="Other reason"?d:u});c(!1),l&&r(2)};m.useEffect(()=>{t||(r(0),h(""),g(""))},[t]);const j=()=>{p(!1),setTimeout(()=>{n(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:se.modal,onClick:l=>l.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:se.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:qx[i]||""}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:j,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:se.content,children:[i===0&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),e.jsxRuntimeExports.jsxs("div",{className:se.radioGroup,children:[e.jsxRuntimeExports.jsx(e.Radio,{defaultValue:u,onChange:l=>h(l),options:[{value:"Found another company",label:"Found another company"},{value:"Expensive",label:"Expensive"},{value:"Technical problems",label:"Technical problems"},{value:"Support problems",label:"Support problems"},{value:"Other reason",label:"Other reason"}],flexDirection:"column"}),u==="Other reason"&&e.jsxRuntimeExports.jsx(e.Textarea$1,{value:d,onChange:l=>g(l),placeholder:"Describe the reason..."})]}),e.jsxRuntimeExports.jsxs("div",{className:se.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:()=>u&&r(1),disabled:!u,children:"Continue"})})]})]}),i===1&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),e.jsxRuntimeExports.jsxs("div",{className:se.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:I,disabled:a,children:"Cancel it anyway"})})]})]}),i===2&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:`${se.confirmation}`,children:[e.jsxRuntimeExports.jsx("div",{className:se.iconWrapper,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"var(--text-success)"})}),e.jsxRuntimeExports.jsx("p",{className:se.title,children:"Subscription Cancelled"}),e.jsxRuntimeExports.jsx("p",{className:se.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),e.jsxRuntimeExports.jsx("div",{className:se.buttonGroup,children:e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Close"})})})]})]})]})},zx="_checkoutContainer_cm7ux_1",Zx="_loaderContainer_cm7ux_20",Ut={checkoutContainer:zx,loaderContainer:Zx},Eo=()=>{const{isAntistock:t}=e.useGeneralStore(),{cart:n,products:o,pending:s,getTotalAndDiscount:i,getPossibleGateways:r,submitCart:a,setGateway:c,applyCoupon:u,setDiscordSocialConnectId:h,setCustomFields:d,applyCouponPending:g,coupon:p,removeCoupon:I,getDiscordSettings:j,setPaymentMethod:l,reset:C}=e.useCart(),x=m.useMemo(()=>i(),[p,n]),_=e.useNavigate();return m.useEffect(()=>{if(n.parts.length===0){if(t){_("/");return}try{_(-1)}catch{_("/")}}},[n.parts]),s?e.jsxRuntimeExports.jsx("div",{className:Ut.checkoutContainer,children:e.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})})}):e.jsxRuntimeExports.jsxs("div",{className:Ut.checkoutContainer,children:[e.jsxRuntimeExports.jsx(Ju,{cart:n,products:o,applyCoupon:u,applyCouponPending:g,coupon:p,removeCoupon:I,totalAndDiscount:x}),e.jsxRuntimeExports.jsx(Od,{cart:n,getPossibleGateways:r,setGateway:c,getDiscordSettings:j,products:o,submitCart:a,totalAndDiscount:x,setCustomFieldsToCart:d,setDiscordSocialConnectId:h,setPaymentMethod:l,reset:C,isAntistock:t})]})},Xx="_chargePageContainer_qeuie_1",Yx="_chargeItems_qeuie_14",Kx="_mainContent_qeuie_25",Jx="_contentWrapper_qeuie_44",Qx="_antistockContent_qeuie_53",eh="_statusBlock_qeuie_58",th="_statusBlockAntistock_qeuie_63",oh="_notPaidSection_qeuie_68",nh="_antistockPayNow_qeuie_82",sh="_antistockFooter_qeuie_86",rh="_antistockTrackPayment_qeuie_96",ih="_footer_qeuie_106",ah="_loaderContainer_qeuie_128",le={chargePageContainer:Xx,chargeItems:Yx,mainContent:Kx,contentWrapper:Jx,antistockContent:Qx,statusBlock:eh,statusBlockAntistock:th,notPaidSection:oh,antistockPayNow:nh,antistockFooter:sh,antistockTrackPayment:rh,footer:ih,loaderContainer:ah},ch=()=>{const{id:t}=e.useParams(),[n,o]=e.useSearchParams(),[s,i]=m.useState(!1),[r,a]=m.useState(),[c,u]=m.useState(!0),h=e.useNavigate(),d=m.useRef(),g=m.useRef(!1),{setIsOpen:p}=e.useModalStore(),{isAntistock:I}=e.useGeneralStore();return m.useEffect(()=>{const j=async(C,x=!1)=>{x||i(!0);const{data:_}=await jn(C);i(!1),a(_)},l=setInterval(()=>{t&&j(t,!0)},5e3);return t&&j(t),()=>{clearInterval(l)}},[]),m.useEffect(()=>{const j=setTimeout(()=>{var C;console.log("charge timeout",r);const l=n.get("redirectRoute");if((r==null?void 0:r.status)===e.ChargeStatus.Paid&&r.redirectUrl&&!d.current){const _=JSON.parse(localStorage.getItem("orders")||"{}")[((C=r==null?void 0:r.order)==null?void 0:C.id)||""];_?window.open(_.fullAccessToken?`${r.redirectUrl}/${_.fullAccessToken}`:`${r.redirectUrl}`,"_self"):window.open(r.redirectUrl,"_self")}(r==null?void 0:r.status)===e.ChargeStatus.Paid&&d.current&&(console.log("redirectRouteRef.current",d.current),h(d.current,{replace:!0})),l&&d&&(d.current=l,n.delete("redirectRoute"),o(n))},1e3);return()=>clearTimeout(j)},[r]),m.useEffect(()=>{((r==null?void 0:r.gateway)==="PayPalFF"||(r==null?void 0:r.gateway)==="Сashapp")&&p(!0)},[r]),m.useEffect(()=>{var j;if(r!=null&&r.displayPaymentInfo&&r.displayPaymentInfo.length===1&&r.status===e.ChargeStatus.NotPaid&&!g.current){const l=r.displayPaymentInfo[0];l.type==="Button"&&((j=l.props)!=null&&j.url)&&(window.open(l.props.url,"_blank"),g.current=!0)}},[r==null?void 0:r.displayPaymentInfo,r==null?void 0:r.status]),s?e.jsxRuntimeExports.jsx("div",{className:le.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs("div",{className:le.chargePageContainer,children:[e.jsxRuntimeExports.jsx("div",{className:le.chargeItems,children:e.jsxRuntimeExports.jsx(kp,{charge:r})}),e.jsxRuntimeExports.jsx("div",{className:le.mainContent,style:I?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(le.contentWrapper,{[le.antistockContent]:I}),children:[r&&(r==null?void 0:r.status)!==e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx(e.ChargeStatusBlock,{charge:r}),r&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(le.statusBlock,{[le.statusBlockAntistock]:I}),children:[e.jsxRuntimeExports.jsx(Ro,{lastUpdate:r.expiresAt,email:r.customerForCharge.email,invoiceId:r.id,paymentType:r.gateway}),I&&(r==null?void 0:r.status)===e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx("div",{className:le.antistockPayNow,children:r==null?void 0:r.displayPaymentInfo.map((j,l)=>e.jsxRuntimeExports.jsx(Vt,{block:j},l))}),I&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:le.antistockTrackPayment,children:e.jsxRuntimeExports.jsx(e.TrackPayment,{timeline:r.timeline})}),e.jsxRuntimeExports.jsx(_e,{className:le.antistockFooter})]})]}),!I&&(r==null?void 0:r.status)===e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx("div",{className:le.notPaidSection,children:r==null?void 0:r.displayPaymentInfo.map((j,l)=>e.jsxRuntimeExports.jsx(Vt,{block:j},l))}),!I&&e.jsxRuntimeExports.jsx(_e,{className:le.footer})]})}),(r==null?void 0:r.gateway)==="PayPalFF"&&c&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>u(!1),children:e.jsxRuntimeExports.jsx(xp,{price:r.price,setIsOpen:u})}),(r==null?void 0:r.gateway)==="Сashapp"&&c&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Vp,{setIsOpen:u,chargeId:r.id})})]})};var yo=(t=>(t.NEW="NEW",t.ANSWERED="ANSWERED",t.NOT_ANSWERED="NOT_ANSWERED",t.CLOSED="CLOSED",t))(yo||{});const lh="_wrapper_3txfs_1",uh="_ticketContainer_3txfs_23",dh="_title_3txfs_28",ph="_subtext_3txfs_35",mh="_container_3txfs_41",xh="_content_3txfs_52",hh="_messages_3txfs_63",gh="_input_3txfs_81",jh="_textarea_3txfs_94",Ih="_textareaAntistock_3txfs_123",fh="_message_3txfs_63",Sh="_messageDate_3txfs_153",Ch="_messageAntistock_3txfs_159",_h="_myMessage_3txfs_163",vh="_otherMessage_3txfs_170",Rh="_button_3txfs_177",Eh="_disabled_3txfs_177",yh="_loadingMessage_3txfs_203",J={wrapper:lh,ticketContainer:uh,title:dh,subtext:ph,container:mh,content:xh,messages:hh,input:gh,textarea:jh,textareaAntistock:Ih,message:fh,messageDate:Sh,messageAntistock:Ch,myMessage:_h,otherMessage:vh,button:Rh,disabled:Eh,loadingMessage:yh},bh=()=>{const t=window.location.pathname.split("/"),n=t[t.length-1],o=t[t.length-2],[s,i]=m.useState(!0),[r,a]=m.useState(null),[c,u]=m.useState(""),[h,d]=m.useState(null),{executeRecaptcha:g}=e.useReCaptcha(),{isAntistock:p}=e.useGeneralStore(),I=(r==null?void 0:r.status)===yo.CLOSED,j=async()=>{if(o&&n){const{data:x}=await e.fetchTicket(o,n);a(x),i(!1)}};m.useEffect(()=>{j();const x=setInterval(()=>{j()},5e3);return()=>clearInterval(x)},[]);const l=async()=>{const x=await g();if(!o||!n||!x||!c.trim())return;const _={content:c,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};a(f=>f?{...f,messages:[...f.messages,_]}:null),d(_.id),u("");try{await e.sendTicketMessage(o,n,c,x,e.getTsId()),await j()}finally{setTimeout(()=>{d(null)},1e4)}},C=x=>{const _=new Date,f=new Date(x),v=Math.floor((_.getTime()-f.getTime())/1e3);if(v<60)return"just now";if(v<3600){const S=Math.floor(v/60);return`${S} minute${S>1?"s":""} ago`}else if(v<10800){const S=Math.floor(v/3600);return`${S} hour${S>1?"s":""} ago`}else return f.getFullYear()===_.getFullYear()?f.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):f.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return e.jsxRuntimeExports.jsx("div",{className:J.wrapper,children:s&&!r?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs("div",{className:J.container,children:[p?e.jsxRuntimeExports.jsxs("div",{className:J.ticketContainer,children:[e.jsxRuntimeExports.jsx("div",{className:J.title,style:{fontSize:"var(--font-heading-h3-size)"},children:r==null?void 0:r.title}),e.jsxRuntimeExports.jsx("div",{className:J.subtext,style:{fontSize:"var(--font-body-md-size)"},children:"We’re going to respond to your ticket shortly. You’ll receive updates in your email inbox. Feel free to close this page."})]}):e.jsxRuntimeExports.jsx("div",{className:J.title,children:`#${o} (${r==null?void 0:r.title})`}),e.jsxRuntimeExports.jsxs("div",{className:J.content,style:{position:p?"relative":void 0,border:p?"1px solid var(--border-secondary)":void 0},children:[e.jsxRuntimeExports.jsx("div",{className:J.messages,children:r==null?void 0:r.messages.sort((x,_)=>new Date(x.createdAt).getTime()-new Date(_.createdAt).getTime()).map(x=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(J.message,{[J.messageAntistock]:p,[J.myMessage]:!x.isSellerReply,[J.otherMessage]:x.isSellerReply,[J.loadingMessage]:h===x.id}),children:[e.jsxRuntimeExports.jsx("div",{className:J.messageContent,children:e.splitTextIntoSpans(x.content,!1)}),h!==x.id&&e.jsxRuntimeExports.jsx("div",{className:J.messageDate,children:C(x.createdAt)}),h===x.id&&e.jsxRuntimeExports.jsx("div",{className:J.messageDate,children:e.jsxRuntimeExports.jsx(e.Loader,{})})]},x.id))}),e.jsxRuntimeExports.jsxs("div",{className:J.input,children:[e.jsxRuntimeExports.jsx("textarea",{disabled:I,className:e.clx(J.textarea,{[J.textareaAntistock]:p}),value:c,placeholder:I?"The ticket has been closed. Need further assistance? Please submit a new request.":p?"Type a message...":"What worries you?",onChange:x=>u(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),l())}}),e.jsxRuntimeExports.jsx("div",{onClick:l,className:e.clx(J.button,{[J.disabled]:I}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"PaperPlaneRight"})})]})]})]})})},wh="_subscriptionContainer_1j6ol_1",kh="_leftSection_1j6ol_15",Nh="_content_1j6ol_26",Th="_mainContent_1j6ol_33",Lh="_detailsSection_1j6ol_37",Ph="_buttonGroup_1j6ol_50",Ah="_detailsContent_1j6ol_57",We={subscriptionContainer:wh,leftSection:kh,content:Nh,mainContent:Th,detailsSection:Lh,buttonGroup:Ph,detailsContent:Ah},Bh=()=>{const{id:t,accessToken:n}=e.useParams(),{subscription:o,setSubscription:s}=e.useSubscriptionStore(),{setIsOpen:i}=e.useModalStore(),[r,a]=m.useState(!1),[c,u]=m.useState(!1);m.useLayoutEffect(()=>{s(null)},[t,n]);const{balanceSettings:h,setBalanceSettings:d}=e.useCustomerDashboardStore();return m.useEffect(()=>{t&&n&&(async()=>{if(!t||!n)return;u(!0);const{data:p}=await e.fetchSubscription(t,n);s({...p}),u(!1)})()},[t,n]),m.useEffect(()=>{h||(async()=>{const p=await e.getBalanceSettings();d(p)})()},[h]),c?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:We.subscriptionContainer,children:[e.jsxRuntimeExports.jsx("div",{className:We.leftSection,children:e.jsxRuntimeExports.jsxs("div",{className:We.content,children:[e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsxs("div",{className:We.mainContent,children:[o&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),e.jsxRuntimeExports.jsx(nm,{subscription:{price:o.price,name:o.productName,description:o.productDescription,status:o.status,image:o.productImage,recurringInterval:o.recurringInterval}}),e.jsxRuntimeExports.jsx("div",{className:We.buttonGroup,children:o.pricingPlanExists&&e.jsxRuntimeExports.jsx(e.Button$1,{onClick:g=>{g.stopPropagation(),i(!0),a(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),e.jsxRuntimeExports.jsx(_e,{})]})]})}),e.jsxRuntimeExports.jsx("div",{className:We.detailsSection,children:e.jsxRuntimeExports.jsxs("div",{className:We.detailsContent,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(o==null?void 0:o.coupon)&&e.jsxRuntimeExports.jsx($m,{coupon:o.coupon,currency:o.price.currency||"USD"}),o&&e.jsxRuntimeExports.jsx(rx,{id:t||"",accessToken:n||"",subscription:{price:o.price,name:o.productName,description:o.productDescription,status:o.status,image:o.productImage,recurringInterval:o.recurringInterval}}),o&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Jm,{}),o.activeTo&&e.jsxRuntimeExports.jsx(Nm,{})]}),e.jsxRuntimeExports.jsx(_e,{className:"flex md:hidden"})]})})]}),e.jsxRuntimeExports.jsx(Em,{isOpen:r,setIsOpen:a,subscription:o})]})},Mh="_topUpContainer_1pag6_1",$h="_formWrapper_1pag6_15",Fh="_header_1pag6_29",Dh="_footer_1pag6_82",Hh="_wrapper_1pag6_105",rt={topUpContainer:Mh,formWrapper:$h,header:Fh,footer:Dh,wrapper:Hh},Oh=()=>{const{gatewaysDetail:t,setGatewaysDetail:n,balanceSettings:o,setBalanceSettings:s}=e.useCustomerDashboardStore();return m.useEffect(()=>{!t&&o&&(async()=>{const r=await e.getGatewaysDetail(o!=null&&o.isEnabled?(o==null?void 0:o.topUpSettings.gateways)||[]:[]);n(r)})()},[t,o]),m.useEffect(()=>{o||(async()=>{const r=await e.getBalanceSettings();s(r)})()},[o]),e.jsxRuntimeExports.jsxs("div",{className:rt.wrapper,children:[e.jsxRuntimeExports.jsx(lt,{className:rt.header}),e.jsxRuntimeExports.jsx("div",{className:rt.topUpContainer,children:o?e.jsxRuntimeExports.jsx("div",{className:rt.formWrapper,children:e.jsxRuntimeExports.jsx(e.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):e.jsxRuntimeExports.jsx(e.Loader,{})}),e.jsxRuntimeExports.jsx("div",{className:rt.footer,children:e.jsxRuntimeExports.jsx(_e,{})})]})},Uh="_orderPage_gc87l_1",Wh="_leftSection_gc87l_15",Gh="_content_gc87l_35",qh="_main_gc87l_42",Vh="_mainAntistock_gc87l_56",zh="_orderMainDataAntistock_gc87l_69",Zh="_timelineBlockAntistock_gc87l_81",Xh="_footerAntistock_gc87l_92",Yh="_statusBlock_gc87l_104",Kh="_timelineBlock_gc87l_81",Jh="_footer_gc87l_92",Qh="_rightSection_gc87l_121",e2="_header_gc87l_142",t2="_productList_gc87l_150",o2="_mobileFooter_gc87l_157",n2="_loaderContainer_gc87l_166",s2="_orderMainData_gc87l_69",r2="_prices_gc87l_181",i2="_headerTitle_gc87l_185",a2="_headerDescription_gc87l_189",Q={orderPage:Uh,leftSection:Wh,content:Gh,main:qh,mainAntistock:Vh,orderMainDataAntistock:zh,timelineBlockAntistock:Zh,footerAntistock:Xh,statusBlock:Yh,timelineBlock:Kh,footer:Jh,rightSection:Qh,header:e2,productList:t2,mobileFooter:o2,loaderContainer:n2,orderMainData:s2,prices:r2,headerTitle:i2,headerDescription:a2},c2=()=>{var I,j,l,C,x;const{id:t,accessToken:n}=e.useParams(),o=e.useNavigate(),[s,i]=m.useState(),[r,a]=m.useState(!1),c=e.useCopy(),{isAntistock:u}=e.useGeneralStore(),h=((I=s==null?void 0:s.rawPrice)==null?void 0:I.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),g=m.useMemo(()=>(s==null?void 0:s.partOrders.map(_=>{var f,v;return{id:(_==null?void 0:_.id)||0,image:_.productWithVariant.image,name:(()=>{var w,D;const S=((w=_.productWithVariant)==null?void 0:w.name)||"",R=((D=_.productWithVariant)==null?void 0:D.variantName)||"";return!S&&!R?"":!R||S===R?S:S?`${S} (${R})`:R})(),description:"",price:{quantity:_.quantity,amount:((f=_.productWithVariant)==null?void 0:f.price.amount)||0,currency:(v=_.productWithVariant)==null?void 0:v.price.currency},deliveryCategories:"deliveryCategories"in _?_.deliveryCategories:void 0,customerNote:_.customerNote,chargeType:_.chargeType||"ONE_TIME"}}))||[],[s]),p=async(_,f,v=!1)=>{var R,w;v||a(!0);const{data:S}=await(f?e.fetchAuthorizedOrder(`${_}/${f}`):e.fetchOrder(_));a(!1),S.status!==e.OrderStatus.Completed&&((R=S.charge)==null?void 0:R.status)===e.ChargeStatus.NotPaid&&o(`/charges/${(w=S.charge)==null?void 0:w.id}`,{replace:!0}),i(S)};return m.useLayoutEffect(()=>{if(t&&!n){const _=JSON.parse(localStorage.getItem("orders")||"{}");_[t]&&o(`/orders/${t}/${_[t].fullAccessToken}`)}},[t]),m.useEffect(()=>{t&&p(t,n,!0);const _=setInterval(()=>{t&&p(t,n,!0)},5e3);return()=>{clearInterval(_)}},[t,n]),r?e.jsxRuntimeExports.jsx("div",{className:Q.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs("div",{className:Q.orderPage,children:[e.jsxRuntimeExports.jsx("div",{className:Q.leftSection,children:e.jsxRuntimeExports.jsxs("div",{className:Q.content,children:[e.jsxRuntimeExports.jsx(lt,{}),s&&e.jsxRuntimeExports.jsxs("div",{className:`${Q.main} ${u?Q.mainAntistock:""}`,children:[e.jsxRuntimeExports.jsx(e.OrderStatusBlock,{className:Q.statusBlock,orderStatus:s.status}),e.jsxRuntimeExports.jsxs("div",{className:`${Q.orderMainData} ${u?Q.orderMainDataAntistock:""}`,children:[e.jsxRuntimeExports.jsx(Ro,{lastUpdate:s.createdAt,paymentType:(j=s.charge)==null?void 0:j.gateway,email:s.customer.email,orderId:s.id}),"accessToken"in s.review&&!u&&e.jsxRuntimeExports.jsx(fx,{orderId:s.id,review:s.review})]}),s.charge&&s.charge.timeline&&e.jsxRuntimeExports.jsx(e.TrackPayment,{className:`${Q.timelineBlock} ${u?Q.timelineBlockAntistock:""}`,timeline:s.charge.timeline}),e.jsxRuntimeExports.jsx(_e,{className:`${Q.footer} ${u?Q.footerAntistock:""}`})]})]})}),e.jsxRuntimeExports.jsx("div",{className:Q.rightSection,style:u?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:e.jsxRuntimeExports.jsxs("div",{className:Q.content,children:[((l=s==null?void 0:s.charge)==null?void 0:l.name)&&e.jsxRuntimeExports.jsxs("header",{className:Q.header,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{className:Q.headerTitle,children:s.charge.name}),s.charge.description&&e.jsxRuntimeExports.jsx("p",{className:Q.headerDescription,children:s.charge.description})]}),u?null:e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Secondary",onClick:()=>c((s==null?void 0:s.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"}),e.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:Q.productList,children:g.map(_=>e.jsxRuntimeExports.jsx(Zt,{product:_,isOrder:!0},_.id))}),u?null:e.jsxRuntimeExports.jsx(ut,{formatter:d,coupon:null,total:((C=s==null?void 0:s.charge)==null?void 0:C.price.amount)||0,discount:0,totalWithDiscount:((x=s==null?void 0:s.charge)==null?void 0:x.price.amount)||0,className:Q.prices,isShowSubtotal:!1}),e.jsxRuntimeExports.jsx(_e,{className:Q.mobileFooter})]})]})})]})},l2=()=>{const{isAntistock:t,general:n}=e.useGeneralStore();return{isAntistock:t,general:n}},u2=t=>{const{notifications:n,setNotifications:o}=e.useNotificationStore.getState();o(n.filter(s=>s.id!==t))},d2=t=>{const{notifications:n,setNotifications:o}=e.useNotificationStore.getState(),s=e.v4();return o([...n,{id:s,...t}]),s},p2=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r,routes:a=[],shopLogo:c,apiURLs:u,isAntistock:h=!1}=t,[d,g]=m.useState(null),{general:p,setIsAntistock:I}=e.useGeneralStore(),{setApiUrls:j}=e.useApiStore(),{setBlocks:l,setSourceBlocks:C,setHeader:x,setFooter:_,setAnnouncement:f,setSettings:v}=e.useBlocksStore(),{themeSettings:S}=e.useThemeSettingsStore(),{settings:R,setSettings:w}=e.useSettingsStore(),D=e.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"":window.location.hostname,te=localStorage.getItem("shopPassword"),Z=localStorage.getItem("shopId")||"",M=localStorage.getItem("draftId")||"";return m.useEffect(()=>{I(h)},[h,I]),m.useEffect(()=>{Z||localStorage.setItem("shopId",(p==null?void 0:p.info.id)||"15124f8d-2c8c-4dda-a04c-31c16816f9b6")},[p]),m.useEffect(()=>{M||localStorage.setItem("draftId","ca18cf24-6659-4015-b1ab-9ebe9fa64e74")},[M]),m.useEffect(()=>{!D&&!h&&localStorage.setItem("fakeDomain","drafts-ca18cf24-6659-4015-b1ab-9ebe9fa64e74.bgng.io"),!D&&h&&localStorage.setItem("fakeDomain","eva8.astck.io")},[D]),m.useEffect(()=>{if(S&&R){const b=_n(S,R);wn(S),vn(b)}},[S,JSON.stringify(R),window.location.hostname]),m.useEffect(()=>{const E=new o().blockSettings;w(E)},[]),m.useLayoutEffect(()=>{const b={};Object.keys(n).map(F=>{b[F]=n[F]}),C(b),l(b),x(s),_(i),f(r),v(o),u&&j(u);const E=e.createBrowserRouter([{element:e.jsxRuntimeExports.jsx(El,{shopDomain:D,shopId:Z,shopPassword:te||void 0,shopLogo:c,children:e.jsxRuntimeExports.jsx(e.ReCaptchaProvider,{children:e.jsxRuntimeExports.jsx(Sl,{children:e.jsxRuntimeExports.jsx(e.Outlet,{})})})}),errorElement:e.jsxRuntimeExports.jsx(Cl,{}),children:[{path:"/admin/builder/*",element:e.jsxRuntimeExports.jsx(Yc,{children:e.jsxRuntimeExports.jsx(Gc,{blocks:n,settings:o,header:s,footer:i,announcement:r})}),errorElement:e.jsxRuntimeExports.jsx(Xc,{})},...a,{path:"/checkout",element:e.jsxRuntimeExports.jsx(Eo,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:e.jsxRuntimeExports.jsx(Oh,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:e.jsxRuntimeExports.jsx(ch,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(c2,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(Bh,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Subscriptions",!0)},{path:h?"/account":"/customer-dash",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100dvh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[e.jsxRuntimeExports.jsx(e.RenderAnnouncement,{}),e.jsxRuntimeExports.jsx(e.RenderHeader,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:"1 1 auto"},children:e.jsxRuntimeExports.jsx(e.CustomerDashboard,{})}),e.jsxRuntimeExports.jsx(e.RenderFooter,{})]}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title=h?"Account":"Customer Dashboard",!0)},{path:"/validation",element:e.jsxRuntimeExports.jsx(rl,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100dvh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[e.jsxRuntimeExports.jsx(e.RenderHeader,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsxRuntimeExports.jsx(e.ReCaptchaProvider,{children:e.jsxRuntimeExports.jsx(bh,{})})}),e.jsxRuntimeExports.jsx(e.RenderFooter,{})]}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:e.jsxRuntimeExports.jsx(Cn,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{})}]}]);g(E)},[p]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:d&&e.jsxRuntimeExports.jsx(e.RouterProvider,{router:d})})};exports.ReCaptchaProvider=e.ReCaptchaProvider;exports.aspectRatioOptions=e.aspectRatioOptions;exports.formatPrice=e.formatPrice;exports.parseDraftJsText=e.parseDraftJsText;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useAdaptiveStyles=e.useAdaptiveStyles;exports.useCart=e.useCart;exports.useReCaptcha=e.useReCaptcha;exports.App=p2;exports.Checkout=Eo;exports.ColorVariables=ho;exports.hotReload=kn;exports.iconNames=To;exports.removeNotification=u2;exports.showNotification=d2;exports.useBuilderPages=Tn;exports.useCreateTicket=Nn;exports.useGeneralInfo=l2;
|
|
104
|
+
`},children:e.jsxRuntimeExports.jsx("div",{className:P.indicator,style:{position:"absolute",left:`${Xt}%`,top:`${100-Yt}%`,transform:"translate(-50%, -50%)"}})}),e.jsxRuntimeExports.jsx("div",{className:P.hueSlider,style:{bottom:U?x?"225px":"150px":x?"175px":"100px"},children:e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:de,onChange:L=>{const k=Number(L.target.value);x?E===1?T(k,r,a,c):T(k,R,w,D):(d(k),T(k,r,a,c))},className:P.slider})}),e.jsxRuntimeExports.jsxs("div",{className:P.alphaSlider,style:{bottom:U?x?"200px":"125px":x?"150px":"75px"},children:[e.jsxRuntimeExports.jsx("div",{className:P.alphaBackground}),e.jsxRuntimeExports.jsx("div",{className:P.alphaGradient,style:{background:wo}}),e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"100",value:bo,onChange:L=>{const k=Number(L.target.value);x?E===1?T(i,r,a,k):T(S,R,w,k):(I(k),T(i,r,a,k))},className:P.slider})]}),x&&Y&&e.jsxRuntimeExports.jsxs("div",{className:P.gradientWrapper,children:[e.jsxRuntimeExports.jsx("h3",{className:P.subtitle,children:"Rotation"}),e.jsxRuntimeExports.jsx("div",{className:P.gradient,children:e.jsxRuntimeExports.jsxs("div",{className:P.chargeTypes,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.charge,{[P.chargeActive]:f==="horizontal"}),onClick:()=>v("horizontal"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsHorizontal",width:20,height:20}),"Horizontal"]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.charge,{[P.chargeActive]:f==="vertical"}),onClick:()=>v("vertical"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsVertical",width:20,height:20}),"Vertical"]})]})})]}),U&&e.jsxRuntimeExports.jsx(he,{initialColor:n,onChange:L=>l(L),title:"",isBlockSettings:U}),e.jsxRuntimeExports.jsxs("div",{className:P.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:X,className:e.clx(P.applyButton,P.cancelButton),type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:ue,className:P.applyButton,children:"Apply"})]})]})},Er=()=>{const{onPreview:t,zoomLevel:n}=e.usePreviewStore(),{keyBlock:o,hoverBlockId:s,isModalVisible:i,hoverBlockTopPosition:r}=e.useSubmodalStore(),{settings:a}=e.useSettingsStore(),{sourceBlocks:c}=e.useBlocksStore(),{pageContext:u}=e.usePagesStore(),{showModal:h}=e.useColorPickerStore(),{currentDevice:d}=e.useDeviceStore(),{isLoadingThemeSettings:g}=e.useThemeSettingsStore(),{isLoadingLayers:p}=e.useLayersStore(),I=f=>f?!c||!c[f]?e.jsxRuntimeExports.jsx(e.ErrorableBlock,{error:`Block "${f}" does not exist in blocks.`}):new c[f]().renderPreview(a,u):e.jsxRuntimeExports.jsx(e.ErrorableBlock,{error:"Block or block.name is undefined."});function j(){if(d.value==="desktop")return n>=1?"100%":`${(n*100).toFixed(2)}%`;{const f=d.value==="tablet"?768:425;return n>=1?`${f}px`:`${(f*n).toFixed(2)}px`}}function l(){switch(d.value){case"desktop":return"100%";case"tablet":return 768;case"mobile":return 425;default:return"100%"}}const{isOpenSelectModal:C}=e.usePagesStore(),x=m.useRef(null),_=f=>{x.current&&(x.current.scrollTop+=f.deltaY)};return e.jsxRuntimeExports.jsxs("div",{className:tt.preview,style:{zIndex:h&&!C?5e3:500},onWheel:f=>{f.stopPropagation(),_(f)},children:[i&&e.jsxRuntimeExports.jsx(zs,{children:e.jsxRuntimeExports.jsx(Io,{})}),e.jsxRuntimeExports.jsxs(Vs,{positionTop:r,positionLeft:!s&&o?void 0:250,children:[!g&&!p&&e.jsxRuntimeExports.jsx(e.RenderBlock,{render:I,block:o},o),(g||!o||p)&&e.jsxRuntimeExports.jsx("div",{className:tt.previewLoading,children:e.jsxRuntimeExports.jsx($e,{})})]}),h&&e.jsxRuntimeExports.jsx(Rr,{}),t&&e.jsxRuntimeExports.jsxs("div",{className:tt.main,style:{width:l()},children:[e.jsxRuntimeExports.jsx(Fs,{}),e.jsxRuntimeExports.jsx("div",{style:{borderLeft:j()==="100%"?"none":"var(--default-border)",borderRight:j()==="100%"?"none":"var(--default-border)",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 160px)",overflowY:"scroll",overflowX:"hidden"},onScroll:f=>{f.stopPropagation()},onWheel:f=>{f.stopPropagation()},children:!g&&!p?e.jsxRuntimeExports.jsx("div",{className:tt.content,style:{width:j()},children:e.jsxRuntimeExports.jsx(e.PreviewContent,{scrollableRef:x})}):e.jsxRuntimeExports.jsx("div",{className:tt.loading,children:e.jsxRuntimeExports.jsx($e,{})})})]})]})},yr="_sidebar_1xtkj_1",br="_title_1xtkj_11",co={sidebar:yr,title:br},wr="_layers_1jhzw_1",kr="_wrapper_1jhzw_9",Nr="_draggingWrapper_1jhzw_17",Tr="_block_1jhzw_21",Lr="_dragging_1jhzw_17",Pr="_active_1jhzw_56",Ar="_add_1jhzw_63",Br="_addTop_1jhzw_79",Mr="_visible_1jhzw_95",$r="_button_1jhzw_99",Fr="_nameBlock_1jhzw_158",Dr="_loader_1jhzw_162",Hr="_actions_1jhzw_171",Or="_deleteButton_1jhzw_179",re={layers:wr,wrapper:kr,draggingWrapper:Nr,block:Tr,dragging:Lr,active:Pr,add:Ar,addTop:Br,visible:Mr,button:$r,nameBlock:Fr,loader:Dr,actions:Hr,deleteButton:Or},Ur="_block_sj4cc_1",Wr="_title_sj4cc_17",Gr="_actions_sj4cc_21",Fe={block:Ur,title:Wr,actions:Gr},Pt={header:"Header",footer:"Footer",announcement:"Announcement"},At=({id:t})=>{const{setCurrentBlock:n}=e.useLayersStore(),{activeBlock:o}=e.usePreviewStore(),[s,i]=m.useState(!1);function r(a){n(a)}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Fe.block,{[Fe.active]:o.id===t,[Fe.header]:t==="header",[Fe.footer]:t==="footer",[Fe.announcement]:t==="announcement"}),onClick:()=>r(t),onMouseOver:()=>i(!0),onMouseLeave:()=>i(!1),children:[it[Pt[t]]?e.jsxRuntimeExports.jsx("img",{src:it[Pt[t]],width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Fe.title,children:Pt[t]}),e.jsxRuntimeExports.jsx("div",{className:Fe.actions,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"PushPin",hoverable:!0,width:20,height:20,fill:"#757575"})})]})},qr=({id:t,name:n,onClick:o,isDragging:s,icon:i})=>{const{activeBlock:r,setActiveBlock:a}=e.usePreviewStore(),{showPreview:c,hidePreview:u,showModal:h,hideModal:d,clearHideTimeout:g,startHideTimeout:p,hoverBlockId:I,isModalVisible:j}=e.useSubmodalStore(),{setPositionBlock:l}=e.useLayersStore(),[C,x]=m.useState(!1),[_,f]=m.useState(!1),[v,S]=m.useState(!1),[R,w]=m.useState(!1),[D,te]=m.useState(null),Z=m.useRef(null),{attributes:M,listeners:b,setNodeRef:E,transform:F,transition:Y}=e.useSortable({id:t}),U={transform:e.CSS.Transform.toString(F),transition:Y},{setTitle:N,setDescription:A,setOnConfirm:W}=e.useConfirmationModalStore(),{pages:T,currentPage:q}=e.usePagesStore(),{removeBlock:ke}=e.useLayersStore(),ve=X=>{X.stopPropagation(),Z.current&&clearTimeout(Z.current),a({id:t,neededScroll:!0}),j&&d(),c(t),g()},z=(X,de=!0)=>{X.stopPropagation(),u(),h(t),g(),l(t,de)},ue=X=>{X.stopPropagation(),a({id:null,neededScroll:!1}),j?p():u()};return m.useEffect(()=>{S(!1),x(!1),f(!1),w(!1)},[s]),m.useEffect(()=>{j||(f(!1),x(!1))},[j]),e.jsxRuntimeExports.jsxs("div",{ref:E,style:U,className:e.clx(re.wrapper,{[re.draggingWrapper]:s&&r.id===t}),onClick:X=>{X.stopPropagation(),o(t)},onMouseEnter:ve,onMouseLeave:ue,...M,...b,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(re.block,{[re.dragging]:s&&r.id===t,[re.active]:!s&&r.id===t}),children:[i?e.jsxRuntimeExports.jsx("img",{src:i,width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:re.nameBlock,children:n}),I===t&&!s&&e.jsxRuntimeExports.jsx("div",{className:e.clx(re.addTop,{[re.visible]:_}),onMouseEnter:()=>{f(!0)},onMouseLeave:()=>{f(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:re.button,onClick:X=>z(X,!1),onMouseEnter:()=>{const X=setTimeout(()=>{s||w(!0)},200);te(X)},onMouseLeave:()=>{D&&clearTimeout(D),w(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),R&&e.jsxRuntimeExports.jsx(Je,{text:"Click to add a section"})]})}),I===t&&!s&&e.jsxRuntimeExports.jsx("div",{className:e.clx(re.add,{[re.visible]:C}),onMouseEnter:()=>{x(!0)},onMouseLeave:()=>{x(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:re.button,onClick:X=>z(X),onMouseEnter:()=>{const X=setTimeout(()=>{s||S(!0)},200);te(X)},onMouseLeave:()=>{D&&clearTimeout(D),S(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),v&&e.jsxRuntimeExports.jsx(Je,{text:"Click to add a section"})]})})]}),I===t&&!s&&e.jsxRuntimeExports.jsxs("div",{className:re.actions,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20}),e.jsxRuntimeExports.jsx("div",{className:re.deleteButton,onClick:X=>{X.stopPropagation(),N("Remove Block"),A(`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.`),W(()=>{T&&ke(T[q].path,t)})},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",hoverable:!0,width:20,height:20})})]})]})},Vr=()=>{const{blocks:t,setCurrentBlock:n,currentBlock:o,moveBlock:s,isLoadingLayers:i,announcement:r}=e.useLayersStore(),{currentPage:a,pages:c}=e.usePagesStore(),{setMouseOverModal:u,setHoverBlockId:h}=e.useSubmodalStore(),{sourceBlocks:d}=e.useBlocksStore();function g(x){n(x),u(!1),h(null)}const p=e.useSensors(e.useSensor(e.PointerSensor,{activationConstraint:{distance:5}})),[I,j]=m.useState(!1),l=()=>{j(!0)},C=x=>{j(!1);const{active:_,over:f}=x;if(f&&_.id!==f.id&&c&&c[a]){const v=c[a].path,S=t[v].order,R=S.indexOf(_.id),w=S.indexOf(f.id);R!==-1&&w!==-1&&s(v,R,w)}};return e.jsxRuntimeExports.jsx("div",{className:re.layers,children:i?e.jsxRuntimeExports.jsx("div",{className:re.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[r&&e.jsxRuntimeExports.jsx(At,{id:"announcement"}),e.jsxRuntimeExports.jsx(At,{id:"header"}),!o&&e.jsxRuntimeExports.jsx(e.DndContext,{sensors:p,onDragEnd:C,onDragStart:l,children:c&&c[a]&&t[c[a].path]&&e.jsxRuntimeExports.jsx(e.SortableContext,{items:t[c[a].path].order,strategy:e.verticalListSortingStrategy,children:t[c[a].path].order.map((x,_)=>e.jsxRuntimeExports.jsx(qr,{id:x,name:e.getDisplayName(t[c[a].path].data[x].name,d),index:_,onClick:g,isDragging:I,icon:it[t[c[a].path].data[x].name]},x))})}),e.jsxRuntimeExports.jsx(At,{id:"footer"})]})})},zr="_loader_eyvkk_1",Zr={loader:zr},Xr=()=>{const{isLoadingSettings:t}=e.useSettingsStore();return t?e.jsxRuntimeExports.jsx("div",{className:Zr.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsx(Yr,{})},Yr=()=>{const{settings:t}=e.useSettingsStore(),{settings:n,setSettingsInstance:o}=e.useBlocksStore();if(!t)return null;const{setError:s}=e.useErrorStore(),i=new n(t);m.useEffect(()=>{o(i)},[t]);try{return i.renderSettings()}catch(r){throw console.error("Error rendering settings:",r),s({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),r}},Kr="_theme_a1one_1",Jr="_block_a1one_8",Qr="_name_a1one_23",ei="_loader_a1one_27",xt={theme:Kr,block:Jr,name:Qr,loader:ei},ti=()=>{const t=e.useNavigate(),{isLoadingThemeSettings:n,setActiveBlock:o}=e.useThemeSettingsStore();function s(i){switch(i==null?void 0:i.name){case"Colors":t("/admin/builder/theme/colors"),o(Se[0]);break;case"Fonts":t("/admin/builder/theme/fonts"),o(Se[1]);break;case"Borders":t("/admin/builder/theme/borders"),o(Se[2]);break;case"Buttons":t("/admin/builder/theme/buttons"),o(Se[3]);break;case"Inputs":t("/admin/builder/theme/inputs"),o(Se[4]);break}}return e.jsxRuntimeExports.jsx("div",{className:xt.theme,children:n?e.jsxRuntimeExports.jsx("div",{className:xt.loader,children:e.jsxRuntimeExports.jsx($e,{})}):Se.map(i=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>s(i),className:e.clx(xt.block),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:i.icon}),e.jsxRuntimeExports.jsx("span",{className:xt.name,children:i.name}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight"})]},i.icon))})},oi="_render_7e826_9",ni="_open_7e826_24",si="_close_7e826_51",ri="_clicked_7e826_55",ii="_loading_7e826_72",ai="_settings_7e826_76",qe={render:oi,open:ni,close:si,clicked:ri,loading:ii,settings:ai},ci=({block:t})=>{const{pageContext:n}=e.usePagesStore(),{setError:o}=e.useErrorStore();try{return t.renderSettings(n)}catch(s){throw console.error("Error rendering settings:",s),o({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),s}},li="_wrapper_15ju8_1",ui="_header_15ju8_8",di="_title_15ju8_15",pi="_colorWrapper_15ju8_21",mi="_name_15ju8_35",xi="_color_15ju8_21",hi="_value_15ju8_47",gi="_length_15ju8_51",xe={wrapper:li,header:ui,title:di,colorWrapper:pi,name:mi,color:xi,value:hi,length:gi},ji=t=>{const{colors:n}=t,{themeSettings:o}=e.useThemeSettingsStore(),[s,i]=m.useState(!0);m.useEffect(()=>{n.length<=3&&i(!0)},[]);function r(a){const c=a.replace("--",""),[u,h]=c.split("-"),d=`${h.charAt(0).toUpperCase()+h.slice(1)} ${u.charAt(0).toUpperCase()+u.slice(1)}`,[g,p]=c.split("-");return{name:d,field:g,variable:p}}return e.jsxRuntimeExports.jsxs("div",{className:xe.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:xe.header,children:[e.jsxRuntimeExports.jsx("div",{className:xe.title,children:"Section Colors"}),!s&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(xe.value,xe.length),onClick:()=>i(!0),children:["+",n.length]})]}),s&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:xe.colors,children:n.map(a=>{const c=r(a),{variable:u,name:h,field:d}=c;return e.jsxRuntimeExports.jsx(Ii,{color:o.colors[d][u],name:h})})}),n.length>3&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(xe.value,xe.length),onClick:()=>i(!1),children:["Hide ",n.length," colors"]})]})]})},Ii=t=>{const{name:n,color:o}=t,{setActiveLabel:s,setModalPosition:i,setInitialColor:r,setShowModal:a,setUpdate:c,setColor:u,setColorChange:h,colorChange:d,setIsGradientActive:g,setIsBlockSettings:p}=e.useColorPickerStore(),{updateColor:I}=e.useThemeSettingsStore(),j=(x,_)=>f=>{I(x,_,f)};m.useEffect(()=>{const x=()=>{a(!1),s(null),r(o),c(()=>{}),u(o),h(()=>{})};return document.body.addEventListener("click",x),()=>{document.body.removeEventListener("click",x)}},[]);const l=x=>{const _=n.split("/")[0],f=_.split(" ")[0].toLowerCase(),v=_.split(" ")[1].toLowerCase();x.stopPropagation(),a(!0),h(d),c(w=>j(v,f)(w)),r(o),u(o),p(!0),g(v==="surface");const{top:S,left:R}=jo(x,550,288,10,20,230,80);i({top:v==="surface"?S:S+125,left:R-200})};function C(x){return x.length>15?x.slice(0,15)+"...":x}return e.jsxRuntimeExports.jsxs("div",{className:xe.colorWrapper,onClick:l,children:[e.jsxRuntimeExports.jsx("div",{className:xe.color,style:{background:o}}),e.jsxRuntimeExports.jsx("div",{className:xe.name,children:n}),e.jsxRuntimeExports.jsx("div",{className:xe.value,children:C(o)})]})},fi="_back_1sznl_1",Si="_title_1sznl_9",Ci="_deleteButton_1sznl_17",_i="_backIcon_1sznl_30",ht={back:fi,title:Si,deleteButton:Ci,backIcon:_i},vi=({onClick:t,setIsClicked:n,getDisplayName:o})=>{var p,I;const{activeBlock:s}=e.useBlocksStore(),{setTitle:i,setDescription:r,setOnConfirm:a}=e.useConfirmationModalStore(),{blocks:c,currentBlock:u,removeBlock:h}=e.useLayersStore(),{currentPage:d,pages:g}=e.usePagesStore();return e.jsxRuntimeExports.jsxs("div",{className:ht.back,children:[e.jsxRuntimeExports.jsx("div",{className:ht.backIcon,onClick:()=>t(),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("h3",{className:ht.title,children:s&&o(s)||g&&g[d]&&c[g[d].path]&&u&&o((p=c[g[d].path].data[u])==null?void 0:p.name)||u&&we(u)||"Loading"}),u&&g&&!["header","footer","announcement"].includes(u)&&c[g[d].path].data[u]&&o((I=c[g[d].path].data[u])==null?void 0:I.name)!=="unknown name"&&e.jsxRuntimeExports.jsx("button",{onClick:j=>{var l;j.stopPropagation(),i("Remove Block"),r(`Are you sure you want to delete ${o((l=c[g[d].path].data[u])==null?void 0:l.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),a(()=>{n(!0),h(g[d].path,u),t(!0)})},className:ht.deleteButton,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A"})})]})},Ri=()=>{const t=e.useNavigate(),[n,o]=m.useState(!1),{header:s,footer:i,announcement:r,sourceBlocks:a,activeBlock:c,setActiveBlock:u,currentInstance:h,setCurrentInstance:d}=e.useBlocksStore(),{setActiveBlock:g}=e.usePreviewStore(),{blocks:p,addBlock:I,editBlock:j,currentBlock:l,setCurrentBlock:C,header:x,footer:_,announcement:f,isLoadingLayers:v}=e.useLayersStore(),{currentPage:S,pages:R}=e.usePagesStore(),{past:w,future:D}=e.useHistoryStore();function te(b=!1){if(R&&h&&l&&!["header","footer","announcement"].includes(l)&&!b){const E={blockSettings:{}};Object.keys(h.blockSettings).filter(F=>!["displayName","isAddable"].includes(F)).map(F=>{E.blockSettings[F]=h.blockSettings[F]}),j(R[S].path,l,{name:p[R[S].path].data[l].name,value:E})}u(null),C(null),g({id:null,neededScroll:!1}),setTimeout(()=>{o(!1)},150),d(null)}function Z(b){var U;if(!R||!S||!b)return null;if(b==="header"){const N=new s;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=x==null?void 0:x.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=x==null?void 0:x.blockColors[A]}),N}if(b==="footer"){const N=new i;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=_==null?void 0:_.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=_==null?void 0:_.blockColors[A]}),N}if(b==="announcement"){const N=new r;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=f==null?void 0:f.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=f==null?void 0:f.blockColors[A]}),N}const E=p[R[S].path];if(!E||!E.data[b])return null;const F=E.data[b];return!F||!a[F.name]?null:new a[F.name]((U=F.value)==null?void 0:U.blockSettings)}m.useEffect(()=>{if(l){const b=Z(l);d(b)}else d(null)},[l,w,D,c]),m.useEffect(()=>{if(c&&R&&!l){const b={blockSettings:{},blockColors:{}},E=new a[c];d(E),Object.keys(E.blockSettings).filter(Y=>!["displayName","isAddable"].includes(Y)).map(Y=>{b.blockSettings[Y]=E.blockSettings[Y]}),Object.keys(E.blockColors).filter(Y=>!["displayName","isAddable"].includes(Y)).map(Y=>{b.blockColors[Y]=E.blockColors[Y]});const F=I(R[S].path,{name:c,value:b});g({id:F,neededScroll:!0}),C(F),t("/admin/builder")}},[c,w,D]);function M(b){if(!a)return"unknown name";if(!a[b])return l==="header"?x==null?void 0:x.blockSettings.displayName:l==="footer"?_==null?void 0:_.blockSettings.displayName:l==="announcement"?f==null?void 0:f.blockSettings.displayName:"unknown name";const E=new a[b];return!E.blockSettings||!E.blockSettings.displayName?"unknown name":E.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(qe.render,{[qe.open]:l,[qe.close]:!l,[qe.clicked]:n}),onClick:b=>b.stopPropagation(),style:{opacity:v?0:1},children:[e.jsxRuntimeExports.jsx(vi,{onClick:te,setIsClicked:o,getDisplayName:M}),e.jsxRuntimeExports.jsxs("div",{className:qe.settings,children:[h&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(ci,{block:h}),e.jsxRuntimeExports.jsx(ji,{colors:h.blockColors})]}),!c&&!l&&e.jsxRuntimeExports.jsx("div",{className:qe.loading,children:"Loading"})]})]})},Ei="_header_9rrfr_1",yi="_title_9rrfr_9",bi="_backIcon_9rrfr_15",Bt={header:Ei,title:yi,backIcon:bi},at=({onClick:t,title:n})=>e.jsxRuntimeExports.jsxs("div",{className:Bt.header,children:[e.jsxRuntimeExports.jsx("div",{className:Bt.backIcon,onClick:t,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:Bt.title,children:n})]}),wi="_options_ymds7_1",ki={options:wi},Ni="_wrapper_kzokw_1",Ti="_open_kzokw_16",Li="_close_kzokw_20",Mt={wrapper:Ni,open:Ti,close:Li},ct=t=>{const{isOpen:n,isClose:o,children:s}=t;return e.jsxRuntimeExports.jsx("div",{className:e.clx(Mt.wrapper,{[Mt.open]:n,[Mt.close]:o}),children:s})},Pi=()=>{var h,d;const{activeBlock:t,themeSettings:n,updateBorder:o,setActiveBlock:s}=e.useThemeSettingsStore();function i(g,p){o(p,g)}const r=e.useNavigate();function a(){s(null),r("/admin/builder/theme")}const c=m.useMemo(()=>n.borders,[n]),u=(t==null?void 0:t.name)==="Borders";return e.jsxRuntimeExports.jsxs(ct,{isOpen:u,isClose:!u,children:[e.jsxRuntimeExports.jsx(at,{onClick:a,title:"Borders Style"}),e.jsxRuntimeExports.jsxs("div",{className:ki.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Border Radius (px)",options:Object.keys(bt),value:((h=Object.entries(bt).find(([g,p])=>p===c.radius))==null?void 0:h[0])||"None",onChange:g=>i(bt[g],"radius")}),e.jsxRuntimeExports.jsx(e.Select,{label:"Border Thickness (px)",options:Object.keys(wt),value:((d=Object.entries(wt).find(([g,p])=>p===c.thickness))==null?void 0:d[0])||"None",onChange:g=>i(wt[g],"thickness")})]})]})},Ai="_options_jo38w_1",Bi="_alignments_jo38w_9",Mi="_blocks_jo38w_15",$i="_alignment_jo38w_9",Fi="_active_jo38w_34",Di="_chargeTypes_jo38w_41",Hi="_charge_jo38w_41",Oi="_chargeActive_jo38w_69",Ui="_sliderContainer_jo38w_83",Wi="_shadowInputs_jo38w_91",Gi="_label_jo38w_102",qi="_shadowInputsRow_jo38w_111",Vi="_shadowInputsOpen_jo38w_119",ie={options:Ai,alignments:Bi,blocks:Mi,alignment:$i,active:Fi,chargeTypes:Di,charge:Hi,chargeActive:Oi,sliderContainer:Ui,shadowInputs:Wi,label:Gi,shadowInputsRow:qi,shadowInputsOpen:Vi},zi=["left","center","right"],Zi=()=>{const{activeBlock:t,themeSettings:n,updateButton:o,setActiveBlock:s}=e.useThemeSettingsStore(),{fonts:i}=e.useFontsStore(),[r,a]=m.useState("primary");function c(l,C){o(r,C,l)}const[u,h]=m.useState(!1),d=n.buttons[r],g=e.useNavigate();function p(){s(null),g("/admin/builder/theme")}const I=(t==null?void 0:t.name)==="Buttons";function j(l,C){c({...d.boxShadow,[l]:C},"boxShadow")}return e.jsxRuntimeExports.jsxs(ct,{isOpen:I,isClose:!I,children:[e.jsxRuntimeExports.jsx(at,{onClick:p,title:"Buttons Style"}),e.jsxRuntimeExports.jsx("div",{className:ie.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(l=>e.jsxRuntimeExports.jsx("div",{className:e.clx(ie.charge,{[ie.chargeActive]:r===l}),onClick:()=>a(l),children:l.charAt(0).toUpperCase()+l.slice(1)},l))}),d&&e.jsxRuntimeExports.jsxs("div",{className:ie.options,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(d.height),onChange:l=>c(Number(l),"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",value:String(d.size),onChange:l=>c(Number(l),"size"),options:Rt}),e.jsxRuntimeExports.jsx(e.Input,{label:"Border Radius (px)",value:String(d.radius),onChange:l=>c(Number(l),"radius"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:d.font,onChange:l=>c(l,"font"),options:[...i.filter(l=>l.name!==d.font).map(l=>l.name)]}),e.jsxRuntimeExports.jsx(he,{initialColor:d.color,onChange:l=>c(l,"color"),title:"Text Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsx(he,{initialColor:d.background,onChange:l=>c(l,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),e.jsxRuntimeExports.jsxs("div",{className:ie.sliderContainer,children:[e.jsxRuntimeExports.jsx("h4",{className:ie.label,children:"Shadow"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:()=>h(!u),style:{padding:5,display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretUp",style:{rotate:u?"0deg":"-180deg",transition:"0.3s rotate ease"}})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(ie.shadowInputs,{[ie.shadowInputsOpen]:u}),children:[e.jsxRuntimeExports.jsxs("div",{className:ie.shadowInputsRow,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Left (px)",value:String(d.boxShadow.left),onChange:l=>j("left",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Top (px)",value:String(d.boxShadow.top),onChange:l=>j("top",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Blur (px)",value:String(d.boxShadow.blur),onChange:l=>j("blur",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,whiteSpace:"nowrap"},children:e.jsxRuntimeExports.jsx(e.Input,{label:"Spread (px)",value:String(d.boxShadow.spread),onChange:l=>j("spread",Number(l)),type:"number"})})]}),e.jsxRuntimeExports.jsx(he,{initialColor:d.boxShadow.color,onChange:l=>j("color",l),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs("div",{className:ie.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:ie.label,children:"Alignment Type"}),e.jsxRuntimeExports.jsx("div",{className:ie.blocks,children:zi.map(l=>e.jsxRuntimeExports.jsx("div",{className:e.clx(ie.alignment,{[ie.active]:d.alignment===l}),onClick:()=>{c(l,"alignment")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:l==="center"?"AlignCenterHorizontal":l==="left"?"AlignLeft":"AlignRight",fill:d.alignment===l?"#252525":"#757575"})},l))})]}),e.jsxRuntimeExports.jsx(e.Switch,{label:"Enable Hover",onChange:l=>c(l,"hover"),current:d.hover}),d.hover&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(he,{initialColor:d.colorHover,onChange:l=>c(l,"colorHover"),title:"Hover Text Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsx(he,{initialColor:d.backgroundHover,onChange:l=>c(l,"backgroundHover"),title:"Hover Background Color",labelStyle:"secondary",isGradientActive:!0})]})]})]})},Xi="_category_hxy9u_1",Yi="_categoryTitle_hxy9u_19",$t={category:Xi,categoryTitle:Yi},Ki=()=>{const{themeSettings:t,setActiveColorCategory:n}=e.useThemeSettingsStore();function o(s){n(s)}return e.jsxRuntimeExports.jsx("div",{className:$t.wrapper,children:Object.keys(t.colors).map(s=>s==="icon"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",{className:$t.category,onClick:()=>o(s),children:[e.jsxRuntimeExports.jsxs("h2",{className:$t.categoryTitle,children:[s==="text"?"Text & Icon":we(s)," Colors"]}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:24,height:24})]},s))})},Ji="_options_ikvjo_38",Qi={options:Ji},ea=()=>{const{activeBlock:t,setActiveFont:n,activeFont:o,themeSettings:s,updateFont:i}=e.useThemeSettingsStore(),{fonts:r}=e.useFontsStore(),[a,c]=m.useState(null);function u(){n(null)}function h(l,C){a&&o&&i("desktop",a,o,C,l)}const[d,g]=m.useState([]),p=m.useMemo(()=>o?s.fonts.desktop.heading[o]?(c("heading"),s.fonts.desktop.heading[o]):s.fonts.desktop.body[o]?(c("body"),s.fonts.desktop.body[o]):(c(null),null):null,[o,s]);m.useEffect(()=>{if(p){const l=r.find(C=>C.name===p.font);l&&(g(l.weights),l.weights.includes(p.boldWeight)||h("400","boldWeight"),l.weights.includes(p.weight)||h("400","weight"))}},[p,o]);const I=!!((t==null?void 0:t.name)==="Fonts"&&o),j=(t==null?void 0:t.name)!=="Fonts"||!o;return e.jsxRuntimeExports.jsxs(ct,{isOpen:I,isClose:j,children:[e.jsxRuntimeExports.jsx(at,{onClick:u,title:"Font Style"}),o&&p&&e.jsxRuntimeExports.jsxs("div",{className:Qi.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:p.font,onChange:l=>h(l,"font"),options:[...r.filter(l=>l.name!==p.font).map(l=>l.name)]}),e.jsxRuntimeExports.jsx(e.Select,{label:"Size",value:String(p.size),onChange:l=>h(l,"size"),options:Rt}),e.jsxRuntimeExports.jsx(e.Select,{label:"Default Weight",value:String(p.weight),onChange:l=>h(l,"weight"),options:d}),e.jsxRuntimeExports.jsx(e.Select,{label:"Bold Weight",value:String(p.boldWeight),onChange:l=>h(l,"boldWeight"),options:d}),e.jsxRuntimeExports.jsx(e.Select,{label:"Case",value:String(p.case).charAt(0).toUpperCase()+String(p.case).slice(1),onChange:l=>h(l.toLowerCase(),"case"),options:["Normal","Uppercase","Lowercase","Capitalize"].filter(l=>l.toLowerCase()!==String(p.case))})]})]})},ta="_wrapper_mkmxa_1",oa="_category_mkmxa_5",na="_categoryTitle_mkmxa_11",sa="_font_mkmxa_17",ra="_content_mkmxa_32",ia="_icon_mkmxa_39",aa="_paragraph_mkmxa_50",Le={wrapper:ta,category:oa,categoryTitle:na,font:sa,content:ra,icon:ia,paragraph:aa},ca={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",h7:"h7",lg:"large",md:"medium",sm:"small"},la=t=>{const{font:n,size:o,id:s,category:i}=t,{setActiveFont:r}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsxs("div",{className:Le.font,onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(Le.icon,{[Le.paragraph]:i==="paragraph"}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i==="paragraph"?"TextB":"TextH"})}),e.jsxRuntimeExports.jsxs("div",{className:Le.content,children:[e.jsxRuntimeExports.jsx("h2",{className:Le.categoryTitle,children:we(ca[s])}),e.jsxRuntimeExports.jsx("span",{className:Le.value,children:`${n}, ${o}px`})]})]})},ua=()=>{const{themeSettings:t,setActiveFont:n,activeBlock:o}=e.useThemeSettingsStore();m.useEffect(()=>(s(),()=>{s()}),[]);function s(){n(null)}if(o!=null&&o.name)return e.jsxRuntimeExports.jsx("div",{className:Le.wrapper,children:Object.entries(t.fonts.desktop).sort(([i],[r])=>i==="heading"?-1:r==="heading"?1:0).map(([i,r])=>e.jsxRuntimeExports.jsxs("div",{className:Le.category,children:[e.jsxRuntimeExports.jsx("h2",{className:Le.categoryTitle,children:we(i)}),Object.entries(r).map(([a,c])=>e.jsxRuntimeExports.jsx(la,{id:a,category:i,...c},a))]},i))})},da="_wrapper_16ym0_2",pa="_categoryTitle_16ym0_12",ma="_title_16ym0_74",xa="_field_16ym0_82",ha="_alignments_16ym0_92",ga="_lineField_16ym0_98",ja="_style_16ym0_106",Ia="_header_16ym0_113",fe={wrapper:da,categoryTitle:pa,title:ma,field:xa,alignments:ha,lineField:ga,style:ja,header:Ia},fa="_blocks_emecf_1",Sa="_block_emecf_1",Ca="_active_emecf_21",Ft={blocks:fa,block:Sa,active:Ca},lo=t=>{const{items:n,selectedItem:o,onSelect:s,getIconName:i}=t;return e.jsxRuntimeExports.jsx("div",{className:Ft.blocks,children:n.map(r=>e.jsxRuntimeExports.jsx("div",{className:e.clx(Ft.block,{[Ft.active]:o===r}),onClick:()=>s(r),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i(r),fill:o===r?"#252525":"#757575"})},String(r)))})},_a=["left","center","right"],va=["solid","dashed"],ot=t=>{const{title:n,children:o,rightAddon:s}=t;return e.jsxRuntimeExports.jsxs("div",{className:fe.field,children:[e.jsxRuntimeExports.jsxs("div",{className:fe.header,children:[e.jsxRuntimeExports.jsx("h4",{className:fe.categoryTitle,children:n}),s]}),o]})},Ra=()=>{const{themeSettings:t,updateInput:n}=e.useThemeSettingsStore(),o=m.useMemo(()=>t.inputs,[t]),s=(r,a,c)=>{n(r,a,c)},i=r=>a=>{n(r,a,"color")};return e.jsxRuntimeExports.jsxs("div",{className:fe.wrapper,children:[e.jsxRuntimeExports.jsxs(ot,{title:"General",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(o.general.height),onChange:r=>s("general",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>s("general",r,"size"),value:String(o.general.size),options:Rt}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.general.color),onChange:i("general"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsx(ot,{title:"Field Fill",rightAddon:e.jsxRuntimeExports.jsx("div",{className:fe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>s("field",r,"active"),current:o.field.active})}),children:e.jsxRuntimeExports.jsx(he,{initialColor:o.field.color,onChange:i("field"),title:"Color",labelStyle:"secondary"})}),e.jsxRuntimeExports.jsx(ot,{title:"Placeholder",children:e.jsxRuntimeExports.jsx(he,{initialColor:we(o.placeholder.color),onChange:i("placeholder"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})}),e.jsxRuntimeExports.jsxs(ot,{title:"Border",rightAddon:e.jsxRuntimeExports.jsx("div",{className:fe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>s("border",r,"active"),current:o.border.active})}),children:[e.jsxRuntimeExports.jsxs("div",{className:fe.lineField,children:[e.jsxRuntimeExports.jsxs("div",{className:fe.style,children:[e.jsxRuntimeExports.jsx("span",{className:fe.title,children:"Style"}),e.jsxRuntimeExports.jsx(lo,{items:va,selectedItem:o.border.style,onSelect:r=>s("border",r,"style"),getIconName:r=>r==="solid"?"Minus":"Selection"})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Radius (px)",value:String(o.border.radius),onChange:r=>s("border",r,"radius"),type:"number",min:0})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Thickness (px)",value:String(o.border.thickness),onChange:r=>s("border",r,"thickness"),type:"number",min:0}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.border.color),onChange:i("border"),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs(ot,{title:"Label",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Line Height (px)",value:String(o.label.height),onChange:r=>s("label",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>s("label",r,"size"),value:String(o.label.size),options:Rt}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.label.color),onChange:i("label"),title:"Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsxs("div",{className:fe.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:fe.title,children:"Alignment Type"}),e.jsxRuntimeExports.jsx(lo,{items:_a,selectedItem:o.label.alignment,onSelect:r=>s("label",r,"alignment"),getIconName:r=>r==="center"?"AlignCenterHorizontal":r==="left"?"AlignLeft":"AlignRight"})]})]})]})},Ea="_wrapper_1yw63_2",ya="_color_1yw63_24",ba="_content_1yw63_33",wa="_preview_1yw63_42",ka="_container_1yw63_52",Na="_buttonWrapper_1yw63_62",Ta="_button_1yw63_62",La="_buttonBorder_1yw63_80",Pa="_buttonBackground_1yw63_83",Aa="_text_1yw63_87",Ba="_textText_1yw63_93",Ma="_icon_1yw63_97",$a="_iconIcon_1yw63_100",Fa="_annotation_1yw63_104",Da="_annotationText_1yw63_111",Ha="_label_1yw63_116",Oa="_circle_1yw63_127",Ua="_line_1yw63_140",Wa="_circle1_1yw63_154",Ga="_circle2_1yw63_159",qa="_annotationIcon_1yw63_164",Va="_annotationBorder_1yw63_192",za="_line1_1yw63_203",Za="_line2_1yw63_210",Xa="_circle3_1yw63_227",Ya="_circle4_1yw63_232",Ka="_annotationSurface_1yw63_237",y={wrapper:Ea,color:ya,content:ba,preview:wa,container:ka,buttonWrapper:Na,button:Ta,buttonBorder:La,buttonBackground:Pa,text:Aa,textText:Ba,icon:Ma,iconIcon:$a,annotation:Fa,annotationText:Da,label:Ha,circle:Oa,line:Ua,circle1:Wa,circle2:Ga,annotationIcon:qa,annotationBorder:Va,line1:za,line2:Za,circle3:Xa,circle4:Ya,annotationSurface:Ka},Ja=()=>{const{activeColorCategory:t}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx("div",{className:y.container,children:e.jsxRuntimeExports.jsxs("div",{className:y.buttonWrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.button,{[y.buttonBorder]:t==="border",[y.buttonBackground]:t==="surface"}),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Smiley",className:e.clx(y.icon,{[y.iconIcon]:t==="text"}),width:22,height:22,fill:"#757575"}),e.jsxRuntimeExports.jsx("span",{className:e.clx(y.text,{[y.textText]:t==="text"}),children:"Button Example"})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationText),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Text Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationIcon),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Icon Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]}),t==="border"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationBorder),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Border Color"}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.line,y.line1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.line,y.line2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle3)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle4)})]}),t==="surface"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationSurface),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Surface Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]})]})})},Qa={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"]},ec=()=>{const{activeBlock:t,setActiveColorCategory:n,activeColorCategory:o,themeSettings:s,updateColor:i}=e.useThemeSettingsStore();function r(){n(null)}function a(d,g,p){i(d,g,p)}const c=!!((t==null?void 0:t.name)==="Colors"&&o),u=(t==null?void 0:t.name)!=="Colors"||!o,h=o?Qa[o]:[];return e.jsxRuntimeExports.jsxs(ct,{isOpen:c,isClose:u,children:[e.jsxRuntimeExports.jsx(at,{onClick:r,title:o==="text"?"Text & Icon Colors":`${we(o)} Colors`}),o&&e.jsxRuntimeExports.jsxs("div",{className:y.wrapper,children:[e.jsxRuntimeExports.jsx(Ja,{}),h.map(d=>{const g=s.colors[o][d];return typeof g!="string"?null:e.jsxRuntimeExports.jsx("div",{className:y.color,children:e.jsxRuntimeExports.jsxs("div",{className:y.content,children:[e.jsxRuntimeExports.jsx("div",{className:y.preview,style:{background:g}}),e.jsxRuntimeExports.jsx(he,{title:we(d),initialColor:g,onChange:p=>a(o,d,p),isGradientActive:o==="surface"})]})},d)})]})]})},tc="_loader_1p5lr_1",oc={loader:tc},nc=()=>{const{activeBlock:t,themeSettings:n,isLoadingThemeSettings:o}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o?e.jsxRuntimeExports.jsx("div",{className:oc.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(ua,{}),(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(ea,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(Ki,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(ec,{}),(t==null?void 0:t.name)==="Inputs"&&n.inputs&&e.jsxRuntimeExports.jsx(Ra,{}),(t==null?void 0:t.name)==="Borders"&&n.borders&&e.jsxRuntimeExports.jsx(Pi,{}),(t==null?void 0:t.name)==="Buttons"&&n.buttons&&e.jsxRuntimeExports.jsx(Zi,{})]})})},sc=()=>{const{activeBlock:t,setActiveBlock:n}=e.useThemeSettingsStore(),{activeBlock:o}=e.useNavbarStore(),s=e.useNavigate();function i(){n(null),s("/admin/builder/theme")}const r=!!t,a=!t||o.name!=="Theme";return e.jsxRuntimeExports.jsxs(ct,{isOpen:r,isClose:a,children:[e.jsxRuntimeExports.jsx(at,{onClick:i,title:(t==null?void 0:t.name)||""}),e.jsxRuntimeExports.jsx(nc,{})]})},rc=()=>{const{activeBlock:t}=e.useNavbarStore(),{showTooltip:n}=e.useTooltipStore();function o(){switch(t.name){case"Layers":return"Layers";case"Add":return"Add Sections";case"Theme":return"Theme Settings";case"Settings":return"Settings"}}return e.jsxRuntimeExports.jsxs("div",{className:co.sidebar,style:{zIndex:n?50:"auto"},children:[e.jsxRuntimeExports.jsx("h3",{className:co.title,children:o()}),t.name==="Layers"&&e.jsxRuntimeExports.jsx(Vr,{}),t.name==="Add"&&e.jsxRuntimeExports.jsx(Io,{}),e.jsxRuntimeExports.jsx(Ri,{}),e.jsxRuntimeExports.jsx(sc,{}),t.name==="Theme"&&e.jsxRuntimeExports.jsx(ti,{}),t.name==="Settings"&&e.jsxRuntimeExports.jsx(Xr,{})]})},ic="_wrapper_no6if_1",ac="_header_no6if_12",cc="_content_no6if_23",lc="_buttons_no6if_44",uc="_label_no6if_51",dc="_description_no6if_52",pc="_preview_no6if_60",mc="_block_no6if_66",xc="_slug_no6if_75",hc="_title_no6if_81",gc="_closeIcon_no6if_87",je={wrapper:ic,header:ac,content:cc,buttons:lc,label:uc,description:dc,preview:pc,block:mc,slug:xc,title:hc,closeIcon:gc},jc=()=>{var te,Z,M,b,E,F,Y;const{setIsOpenModal:t,pages:n,createPage:o,updatePage:s,isEdit:i,setIsEdit:r,editedPage:a,setEditedPage:c,pageContext:u}=e.usePagesStore(),{setIsOpen:h}=e.useModalStore(),{createPage:d,updatePage:g}=e.useLayersStore(),[p,I]=m.useState(a?n&&((te=n[a])==null?void 0:te.path):""),[j,l]=m.useState(a?n&&((Z=n[a])==null?void 0:Z.name):""),[C,x]=m.useState(a?n&&((M=n[a])==null?void 0:M.seo)&&((E=(b=n[a])==null?void 0:b.seo)==null?void 0:E.pageDescription)||"":`${u.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`),[_,f]=m.useState(a&&n&&(F=n[a])!=null&&F.isPrivate?"private":"public");function v(){I(""),l(""),x(""),f("public"),r(!1),c(null)}function S(){h(!1),setTimeout(()=>{v(),t(!1),h(!0)},300)}m.useEffect(()=>()=>{S()},[]);function R(U){return U[0]==="/"?U:"/"+U}function w(){o({path:R(p),name:j||p||"",icon:"File",seo:{pageTitle:j||"",pageDescription:C||""},visibility:_||"public"}),d(R(p)),S()}function D(){n&&(e.defaultPagePaths.includes(n[a].path)||go(n[a].path),g(n[a].path||"",p||""),s(a,{path:R(p),name:j||p,icon:n[a].icon||"File",seo:{pageTitle:j||"",pageDescription:C||""},visibility:_||"public"})),S()}return e.jsxRuntimeExports.jsxs("div",{className:je.wrapper,onClick:U=>U.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:je.header,children:[e.jsxRuntimeExports.jsx("h2",{children:i?"Edit Page":"Create New Page"}),e.jsxRuntimeExports.jsx("div",{className:je.closeIcon,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:S})})]}),e.jsxRuntimeExports.jsxs("div",{className:je.content,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Page Slug",onChange:U=>I(U),value:p,placeholder:"path-to-page",disabled:!!(a&&n&&((Y=n[a])!=null&&Y.name)&&e.defaultPagePaths.includes(n[a].path)),required:!0,regex:"^.+$"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Page Title",onChange:U=>{l(U)},value:j.charAt(0).toUpperCase()+j.slice(1),placeholder:"Contact us"}),e.jsxRuntimeExports.jsx(e.Textarea,{label:"Description",onChange:U=>x(U),value:C,placeholder:`${u.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`,maxLength:150}),e.jsxRuntimeExports.jsxs("div",{className:je.preview,children:[e.jsxRuntimeExports.jsx("span",{className:je.label,children:"Preview"}),e.jsxRuntimeExports.jsxs("div",{className:je.block,children:[e.jsxRuntimeExports.jsx("span",{className:je.slug,children:p||"yoursite.url"}),e.jsxRuntimeExports.jsx("span",{className:je.title,children:j||"My Blank Page"}),e.jsxRuntimeExports.jsx("span",{className:je.description,children:C||"It is My Description"})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:je.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:S,type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:i?D:w,disabled:p.length===0,children:i?"Update":"Create"})]})]})},Ic="_layout_1pjho_1",fc="_main_1pjho_10",Sc="_content_1pjho_18",Cc="_notifications_1pjho_26",gt={layout:Ic,main:fc,content:Sc,notifications:Cc},_c="_notification_2jmah_1",vc="_text_2jmah_22",Rc="_timer_2jmah_27",Ec="_warning_2jmah_32",yc="_error_2jmah_37",bc="_success_2jmah_42",Ve={notification:_c,text:vc,timer:Rc,warning:Ec,error:yc,success:bc},uo={warning:"#C1972A",error:"#FF3F19",success:"#338B13"},fo=t=>{const{type:n,message:o,style:s,padding:i,timer:r,id:a,element:c}=t,[u,h]=m.useState(r),{setNotifications:d}=e.useNotificationStore();function g(){const I=e.useNotificationStore.getState().notifications.filter(j=>j.id!==a);d([...I])}return m.useEffect(()=>{const p=setTimeout(()=>{g()},r*1e3);return()=>clearTimeout(p)},[r]),m.useEffect(()=>{const p=setInterval(()=>h(I=>I-1),1e3);return()=>clearInterval(p)},[u]),c?c({type:n,message:o,style:s,padding:i,timer:r,id:a}):e.jsxRuntimeExports.jsx("div",{style:{padding:i,position:"relative"},children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(Ve.notification,{[Ve.warning]:n==="warning",[Ve.error]:n==="error",[Ve.success]:n==="success"}),style:s,children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Info",fill:uo[n],width:20,height:20})}),e.jsxRuntimeExports.jsx("div",{className:Ve.text,children:o}),r&&e.jsxRuntimeExports.jsx("div",{className:Ve.timer,children:u}),e.jsxRuntimeExports.jsx("div",{style:{display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:uo[n],width:20,height:20,hoverable:!0,onClick:()=>g()})})]})})},wc="_modal_1h74q_1",kc="_title_1h74q_14",Nc="_buttons_1h74q_20",jt={modal:wc,title:kc,buttons:Nc},So=()=>{const{title:t,description:n,onConfirm:o,setTitle:s,setDescription:i,setOnConfirm:r}=e.useConfirmationModalStore(),{setIsOpen:a}=e.useModalStore();function c(){a(!1),setTimeout(()=>{s(null),i(null),r(null),a(!0)},300)}return t&&n&&o&&e.jsxRuntimeExports.jsxs("div",{className:jt.modal,onClick:u=>u.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:jt.title,children:t}),e.jsxRuntimeExports.jsx("div",{className:jt.description,children:n}),e.jsxRuntimeExports.jsxs("div",{className:jt.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:c,children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{o(),c()},type:"Secondary",children:"Confirm"})]})]})},Tc="_modal_270ti_1",Lc="_padding_270ti_17",Pc="_content_270ti_21",Ac="_close_270ti_42",It={modal:Tc,padding:Lc,content:Pc,close:Ac},vt=t=>{const{close:n,children:o,withAnimation:s=!0,hasPadding:i=!0}=t,{isOpen:r,setIsOpen:a}=e.useModalStore();return m.useEffect(()=>{const c=()=>{a(!1),s?setTimeout(()=>{n(!1),a(!0)},300):(n(!1),a(!0))};return document.body.addEventListener("click",c),()=>{document.body.removeEventListener("click",c)}},[]),e.jsxRuntimeExports.jsx("div",{className:e.clx(It.modal,{[It.padding]:i}),children:s?e.jsxRuntimeExports.jsx("div",{className:e.clx(It.content,{[It.close]:!r}),children:o}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o})})},Bc=()=>{const{isOpenModal:t,setIsOpenModal:n}=e.usePagesStore(),{openModal:o,setOpenModal:s}=e.useChooseImageStore(),{notifications:i}=e.useNotificationStore(),{title:r,description:a,setTitle:c,setDescription:u,setOnConfirm:h}=e.useConfirmationModalStore();return e.jsxRuntimeExports.jsxs("div",{id:"builder",children:[e.jsxRuntimeExports.jsxs("div",{className:gt.layout,children:[e.jsxRuntimeExports.jsx(Cs,{}),e.jsxRuntimeExports.jsxs("main",{className:gt.main,children:[e.jsxRuntimeExports.jsx(ps,{}),e.jsxRuntimeExports.jsxs("div",{className:gt.content,children:[e.jsxRuntimeExports.jsx(rc,{}),e.jsxRuntimeExports.jsx(Er,{})]})]})]}),r&&a&&e.jsxRuntimeExports.jsx(vt,{close:()=>{c(null),u(null),h(null)},children:e.jsxRuntimeExports.jsx(So,{})}),t&&e.jsxRuntimeExports.jsx(vt,{close:n,children:e.jsxRuntimeExports.jsx(jc,{})}),o&&e.jsxRuntimeExports.jsx(vt,{close:s,children:e.jsxRuntimeExports.jsx(e.ChooseImageModal,{})}),i.length>0&&e.jsxRuntimeExports.jsx("div",{className:gt.notifications,children:i.map(d=>e.jsxRuntimeExports.jsx(fo,{type:d.status,message:d.message,timer:d.timer||10,id:d.id,element:d.component},d.id))})]})};async function ze(t,n){const o=localStorage.getItem("shopId")||void 0,i=`${e.useApiStore.getState().apiUrls.api}/${t}/builder/shops/${o}/${n}`;return(await e.request({url:i,withToken:!0,method:"get"})).data}async function Mc(){try{const[t,n,o,s,i,r,a,c]=await Promise.allSettled([ze("v1","general"),ze("v1","faqs"),ze("v1","listings"),ze("v1","products"),ze("v1","reviews"),ze("v1","categories"),{data:null},{data:null}]);return{general:t,faqs:n,listings:o,products:s,reviews:i,categories:r,fullPosts:a,posts:c}}catch(t){throw console.error("Error fetching page data:",t),t}}async function $c(){const t=e.useApiStore.getState().apiUrls;try{const{data:n}=await e.axios.get(`${t.googleFonts}?key=AIzaSyAEsTbjAPUz_TeuFCq4z4LPK9w_vst0Pfw`);return n.items}catch(n){throw console.error("Error fetching page data:",n),n}}async function Fc(){var i;const t=localStorage.getItem("shopId"),n=localStorage.getItem("draftId"),s=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/pages`;try{return(await e.request({url:s,withToken:!0,method:"get"})).data}catch(r){return{data:[],status:(i=r.response)==null?void 0:i.status}}}async function Dc(){const t=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId")||void 0,s=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/all`;return(await e.request({url:s,withToken:!0,method:"get"})).data}const Hc=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r}=t,{setBlocks:a,setSourceBlocks:c,setHeader:u,setFooter:h,setAnnouncement:d,setSettings:g}=e.useBlocksStore(),{fonts:p,setFonts:I}=e.useFontsStore(),{setSettings:j}=e.useSettingsStore(),{setPageContext:l}=e.usePagesStore(),{setThemeSettings:C,setIsLoadingThemeSettings:x}=e.useThemeSettingsStore(),{setIsLoadingSettings:_}=e.useSettingsStore(),{notifications:f,setNotifications:v}=e.useNotificationStore(),{setBlocks:S,blocks:R,createPage:w,setIsLoadingLayers:D,setHeader:te,setAnnouncement:Z,setFooter:M}=e.useLayersStore(),{setPages:b,setCurrentPage:E}=e.usePagesStore();return m.useEffect(()=>{x(!0),D(!0),_(!0);const F={};Object.keys(n).forEach(U=>{F[U]=n[U]}),c(F),a(F),u(s),h(i),d(r),g(o),(async()=>{const U={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null,fullPosts:null,posts:null},N=await Mc();Object.keys(N).map(z=>{const ue=z;U[ue]=N[ue].value.data}),l(U);const{data:A}=await Dc(),{themeSettings:W,layers:T,settings:q}=A||{};if(q){if(q.settings){const z=new o;z.blockSettings={displayName:"Settings",isAddable:!1,...q.settings},j(z.blockSettings)}q.header&&te(q.header),q.footer&&M(q.footer),q.announcement&&Z(q.announcement)}else{const z=new o;j(z.blockSettings)}W&&C(W);const ke=await Fc(),ve={};if(ke.status>=400&&v([...f,{id:e.v4(),message:"Error fetching pages",status:"error"}]),ke.data.length>0?(ke.data.forEach(z=>{var ue,X;R[z.path]||w(z.path),ve[z.id||z.path]={...z,icon:e.pages[z.path]?e.pages[z.path].icon:"File",name:z.name||((ue=z.seo)==null?void 0:ue.pageTitle)||((X=e.pages[z.path])==null?void 0:X.name)||z.path}}),b(ve),E(Object.keys(ve)[0])):(b(e.pages),E(Object.keys(e.pages)[0])),p.length===0){const z=await $c();I([...z.map(ue=>{const X=ue.variants.map(de=>{if(!de.includes("italic"))return de==="regular"?"400":de}).filter(de=>de!==void 0);return{name:ue.family,weights:X}})])}S(T),x(!1),D(!1),_(!1)})()},[]),e.jsxRuntimeExports.jsx(Bc,{})};function Oc(){const t=new URL(window.location.href);window.history.replaceState(null,"",t.pathname+t.hash)}function Uc(){const t=new URLSearchParams(document.location.search),n=t.get("shopId")||localStorage.getItem("shopId"),o=t.get("sellerAccessToken")||localStorage.getItem("sellerAccessToken"),s=t.get("draftId")||localStorage.getItem("draftId");return Oc(),o&&localStorage.setItem("sellerAccessToken",o),n&&localStorage.setItem("shopId",n),s&&localStorage.setItem("draftId",s),!!(o&&n&&s)}const Wc="data:image/svg+xml,%3csvg%20width='204'%20height='241'%20viewBox='0%200%20204%20241'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M204%200V118.282L154.174%20134.707V69.0074L49.7111%20102.77V43.5716L204%200Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M154.174%20134.694V191.155L0%20241V117.471L49.7114%20102.757V169.597L154.174%20134.694Z'%20fill='%23FF3F19'/%3e%3c/svg%3e",Gc=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r}=t,[a,c]=m.useState(!0),u=e.useNavigate(),h=e.useLocation();return m.useEffect(()=>{const d=h.pathname;if(d.startsWith("/admin/builder")){d==="/admin/builder/add"?document.title="Add Section | Builder":d==="/admin/builder/theme"?document.title="Theme Settings | Builder":d==="/admin/builder/settings"?document.title="Settings | Builder":document.title="Builder | Billgang";let g=document.querySelector("link[rel~='icon']");g||(g=document.createElement("link"),g.rel="icon",document.head.appendChild(g)),g&&(g.href=Wc)}},[h]),m.useEffect(()=>{c(!0),Uc()?c(!1):u("/")},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:a?e.jsxRuntimeExports.jsx($e,{}):e.jsxRuntimeExports.jsx(Hc,{blocks:n,settings:o,header:s,footer:i,announcement:r})})},qc="_wrapper_1yd2j_1",Vc="_error_1yd2j_11",zc="_title_1yd2j_21",Zc="_buttons_1yd2j_29",nt={wrapper:qc,error:Vc,title:zc,buttons:Zc},po=async t=>{const n=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${n}/drafts/${o}/reset`;return await e.request({url:i,withToken:!0,method:"post",body:t})},Xc=()=>{const{error:t,setError:n}=e.useErrorStore(),{pages:o}=e.usePagesStore(),{setIsOpen:s}=e.useModalStore(),{title:i,description:r,setOnConfirm:a,setTitle:c,setDescription:u}=e.useConfirmationModalStore(),{setBlocks:h}=e.useLayersStore();async function d(){await po({resetSettings:(t==null?void 0:t.failedSettings)??!1,resetThemeSettings:(t==null?void 0:t.failedThemeSettings)??!1,resetPageIds:(t==null?void 0:t.failedPageIds)??[]}),n(null),h({}),window.location.reload()}async function g(){const p=[];o&&Object.keys(o).map(I=>o[I].id).filter(I=>I!==void 0).map(I=>p.push(I)),await po({resetSettings:!0,resetThemeSettings:!0,resetPageIds:p}),n(null)}return e.jsxRuntimeExports.jsxs("div",{className:nt.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:nt.error,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:nt.title,children:"Oops! Something went wrong"}),e.jsxRuntimeExports.jsx("span",{className:nt.message,children:(t==null?void 0:t.message)||""})]}),e.jsxRuntimeExports.jsxs("div",{className:nt.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:d,children:"Reset Settings"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:p=>{p.stopPropagation(),c("Reset All Settings"),u("Are you sure you want to reset all settings? This is irreversible."),a(async()=>{await g()})},children:"Reset All Settings"})]})]}),i&&r&&e.jsxRuntimeExports.jsx(vt,{close:()=>{s(!1),setTimeout(()=>{c(null),u(null),a(null),s(!0)},300)},children:e.jsxRuntimeExports.jsx(So,{})})]})},Yc=t=>{const{children:n}=t,{pathname:o}=e.useLocation(),{setActiveBlock:s}=e.useNavbarStore(),{setActiveBlock:i}=e.useThemeSettingsStore(),{setActiveBlock:r}=e.usePreviewStore();return m.useEffect(()=>{switch(r({id:null,neededScroll:!1}),o){case"/admin/builder":s(e.navbarBlocks[0]);break;case"/admin/builder/add":s(e.navbarBlocks[1]);break;case"/admin/builder/theme":s(e.navbarBlocks[2]);break;case"/admin/builder/settings":s(e.navbarBlocks[3]);break;case"/admin/builder/theme/colors":s(e.navbarBlocks[2]),i(Se[0]);break;case"/admin/builder/theme/fonts":s(e.navbarBlocks[2]),i(Se[1]);break;case"/admin/builder/theme/borders":s(e.navbarBlocks[2]),i(Se[2]);break;case"/admin/builder/theme/buttons":s(e.navbarBlocks[2]),i(Se[3]);break;case"/admin/builder/theme/inputs":s(e.navbarBlocks[2]),i(Se[4]);break}},[o]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n})},Kc="_lock_1mxa7_1",Jc="_wrapper_1mxa7_12",Qc="_content_1mxa7_22",el="_info_1mxa7_31",tl="_buttons_1mxa7_38",ol="_button_1mxa7_38",nl="_input_1mxa7_50",sl="_error_1mxa7_57",Ee={lock:Kc,wrapper:Jc,content:Qc,info:el,buttons:tl,button:ol,input:nl,error:sl},rl=()=>{const[t,n]=m.useState(!1),[o,s]=m.useState(!1),[i,r]=m.useState(""),{general:a,setGeneral:c}=e.useGeneralStore(),{setShopPassword:u}=e.useStorefrontStore(),h=e.useLocation(),d=e.useNavigate();m.useEffect(()=>{if(a&&(!a.info.passwordProtected||a.isPasswordValid)){const p=h.state.from==="/validation"?"/":h.state.from;d(p)}},[a]),m.useEffect(()=>{a||(async()=>{var l;n(!0);const I=localStorage.getItem("shopPassword")||"",j=await Wt(I);if(j.isPasswordValid){const C=((l=h.state)==null?void 0:l.from)||"/";d(C)}j.info.passwordProtected||(localStorage.removeItem("shopPassword"),u("")),c(j),n(!1)})()},[a]);async function g(){var I;n(!0);const p=await Wt(i);if(!p.isPasswordValid)s(!0);else{localStorage.setItem("shopPassword",i),u(i);const j=((I=h.state)==null?void 0:I.from)||"/";d(j),p.info.passwordProtected||(localStorage.removeItem("shopPassword"),u("")),c(p)}n(!1)}return e.jsxRuntimeExports.jsxs("div",{className:Ee.wrapper,children:[!t&&e.jsxRuntimeExports.jsxs("div",{className:Ee.content,children:[e.jsxRuntimeExports.jsx("div",{className:Ee.lock,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"var(--text-secondary)",width:64,height:64})}),e.jsxRuntimeExports.jsxs("div",{className:Ee.info,children:[e.jsxRuntimeExports.jsx("h2",{id:"h2",className:Ee.title,children:"The store is password protected"}),e.jsxRuntimeExports.jsx("p",{id:"p",className:Ee.description,children:"If you do not have a password, we recommend you to contact the technical support of the store or write to the mail"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ee.input,children:[e.jsxRuntimeExports.jsx(e.Input$1,{type:"password",onChange:p=>{s(!1),r(p)},value:i,placeholder:"Password",required:!0}),e.jsxRuntimeExports.jsx("span",{className:Ee.error,children:o&&"Incorrect password"})]}),e.jsxRuntimeExports.jsx("div",{className:Ee.buttons,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",className:Ee.button,disabled:o,onClick:g,children:"Submit"})})]}),t&&e.jsxRuntimeExports.jsx(e.Loader,{})]})},il="_notifications_2ywhg_1",al={notifications:il},cl=()=>(m.useEffect(()=>{document.title="Temporarily Unavailable"},[]),e.jsxRuntimeExports.jsx("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:"1",justifyContent:"center",alignItems:"center",gap:"24px"},children:[e.jsxRuntimeExports.jsx("h2",{style:{color:"var(--text-primary)",fontSize:"var(--font-heading-h2-size)"},children:"Temporarily Unavailable"}),e.jsxRuntimeExports.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"var(--font-heading-h3-size)",width:"85%",textAlign:"center"},children:"We're making some quick updates to improve your shopping experience. During this time, browsing and checkout are temporarily unavailable."})]})})),ll="_notification_o93uc_1",ul="_accent_o93uc_15",dl="_body_o93uc_23",pl="_label_o93uc_30",ml="_content_o93uc_36",xl="_timer_o93uc_41",hl="_warning_o93uc_48",gl="_error_o93uc_53",jl="_success_o93uc_58",De={notification:ll,accent:ul,body:dl,label:pl,content:ml,timer:xl,warning:hl,error:gl,success:jl},Il={warning:"Warning",error:"Error",success:"Success"},fl=({type:t,message:n,style:o,padding:s=0,timer:i=0})=>{const[r,a]=m.useState(i);return m.useEffect(()=>{if(!i)return;const c=setInterval(()=>a(u=>u-1),1e3);return()=>clearInterval(c)},[]),e.jsxRuntimeExports.jsx("div",{style:{padding:s,position:"relative"},children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(De.notification,De[t]),style:o,children:[e.jsxRuntimeExports.jsx("div",{className:De.accent}),e.jsxRuntimeExports.jsx("div",{className:De.body,children:e.jsxRuntimeExports.jsxs("div",{className:De.content,children:[e.jsxRuntimeExports.jsxs("span",{className:De.label,children:[Il[t],":"]})," ",n]})}),i>0&&e.jsxRuntimeExports.jsx("span",{className:De.timer,children:r})]})})},Sl=({children:t})=>{const n=e.useLocation(),{token:o,setToken:s}=e.useStorefrontStore(),{dashInfo:i,setDashInfo:r}=e.useCustomerDashboardStore(),{shopPassword:a}=e.useStorefrontStore(),c=e.useNavigate(),[u,h]=e.useSearchParams(),{notifications:d}=e.useNotificationStore(),[g,p]=m.useState(!0),{setCustomerEmail:I}=e.useCartStore(),{setThemeSettings:j,themeSettings:l}=e.useThemeSettingsStore(),{settings:C,setSettings:x}=e.useSettingsStore(),{setHeader:_,setFooter:f,setAnnouncement:v}=e.useLayersStore(),{general:S,setGeneral:R,isAntistock:w}=e.useGeneralStore(),{pageContext:D,setPageContext:te}=e.usePagesStore();e.useTrackingAnalytics((S==null?void 0:S.info.id)||localStorage.getItem("shopId")||"");const Z=async()=>{const M=await e.getDynamicPage(encodeURIComponent("/products"),S==null?void 0:S.info.passwordProtected);if(M){const{data:b}=M;te({...D,listings:b.listings})}};return m.useEffect(()=>{const M=localStorage.getItem("token");if(M&&(!o||!i))try{const b=e.jwtDecode(M);r(b),s(M),I(b.email)}catch(b){console.error("Failed to decode token:",b),localStorage.removeItem("token"),s(""),r(null)}},[o,i]),m.useEffect(()=>{const M=u.get("r");M&&(localStorage.setItem("referralCode",M),u.delete("r"),h(u),c({pathname:n.pathname,search:u.toString()},{replace:!0}))},[u,n]),m.useEffect(()=>{!n.pathname.startsWith("/products")&&!n.pathname.startsWith("/admin/builder")&&S&&(S.info.passwordProtected&&a||S.isPasswordValid)&&Z()},[S,a]),m.useLayoutEffect(()=>{const M=async()=>{if(p(!0),!S){const E=await Wt(a);if(!E.isPasswordValid&&!n.pathname.includes("/admin/builder")){c("/validation",{state:{from:n.pathname}});return}if(!E.info.passwordProtected){localStorage.removeItem("shopPassword");const{setShopPassword:F}=e.useStorefrontStore.getState();F("")}R(E)}p(!1)},b=async()=>{p(!0);const{settings:E,theme:F}=(await dn()).data;E?(E.settings&&x(E.settings),E.header&&_(JSON.parse(JSON.stringify(E.header))),E.footer&&f(JSON.parse(JSON.stringify(E.footer))),E.announcement&&v(JSON.parse(JSON.stringify(E.announcement)))):x(C),j(F||l),p(!1)};n.pathname.startsWith("/validation")||M(),b()},[]),w&&(S!=null&&S.info.onHold)?e.jsxRuntimeExports.jsx(cl,{}):n.pathname.startsWith("/admin/builder")?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:g?e.jsxRuntimeExports.jsx("div",{style:{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[t,d.length>0&&e.jsxRuntimeExports.jsx("div",{className:al.notifications,children:d.map(M=>e.jsxRuntimeExports.jsx(fo,{type:M.status,message:M.message,timer:M.timer||10,id:M.id,element:w?fl:M.component},M.id))})]})})},Cl=()=>(m.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})})),_l="_wrapper_rccv2_1",vl="_content_rccv2_11",Rl="_title_rccv2_21",Dt={wrapper:_l,content:vl,title:Rl},Ne=()=>{const t=e.useNavigate();return e.jsxRuntimeExports.jsx("div",{className:Dt.wrapper,children:e.jsxRuntimeExports.jsxs("div",{className:Dt.content,children:[e.jsxRuntimeExports.jsx("h1",{className:Dt.title,children:"Something went wrong"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:()=>{t("/")},children:"Go to Home"})]})})},El=({children:t,shopDomain:n,shopId:o,shopPassword:s,shopLogo:i})=>{const{setShopDomain:r,setShopId:a,setShopPassword:c,setShopTerms:u,setShopPrivacyPolicy:h,setShopRefundPolicy:d,setShopLogo:g}=e.useStorefrontStore();return m.useLayoutEffect(()=>{const p=async()=>{const{data:l}=await mn();u(l)},I=async()=>{const{data:l}=await hn();h(l)},j=async()=>{const{data:l}=await xn();d(l)};r(n),a(o),s&&c(s),i&&g(i),p(),I(),j()},[n,o,s]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t})},yl="_checkoutItemsContainer_1kn61_2",bl="_innerContainer_1kn61_16",wl="_headerSection_1kn61_22",kl="_header_1kn61_22",Nl="_productsContainer_1kn61_47",Tl="_couponContainer_1kn61_54",Ll="_checkoutFooter_1kn61_58",He={checkoutItemsContainer:yl,innerContainer:bl,headerSection:wl,header:kl,productsContainer:Nl,couponContainer:Tl,checkoutFooter:Ll},Pl="_checkoutFooter_sum4s_1",Al="_antistock_sum4s_12",Bl="_footerBranding_sum4s_22",Ml="_poweredText_sum4s_27",$l="_antistockLink_sum4s_31",Fl="_footerNav_sum4s_39",Ze={checkoutFooter:Pl,antistock:Al,footerBranding:Bl,poweredText:Ml,antistockLink:$l,footerNav:Fl},Dl="data:image/svg+xml,%3csvg%20width='100'%20height='26'%20viewBox='0%200%20100%2026'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20.3996%203.39999V12.8228L16.2964%2014.1313V8.89738L7.69363%2011.587V6.87107L20.3996%203.39999Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M16.2964%2014.1313L16.2962%2018.6292L3.59961%2022.6V12.7592L7.69363%2011.587L7.69344%2016.9118L16.2964%2014.1313Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M95.6308%2022C93.4931%2022%2091.8804%2020.882%2091.4678%2019.1776L93.118%2019.0676C93.4181%2019.984%2094.0931%2020.5338%2095.6308%2020.5338C97.4311%2020.5338%2098.4249%2019.8373%2098.4249%2018.4078V16.8316C97.9374%2017.858%2096.8122%2018.5178%2095.5183%2018.5178C92.9868%2018.5178%2091.1865%2016.575%2091.1865%2013.8076C91.1865%2011.0401%2092.9492%209.09737%2095.4433%209.09737C96.831%209.09737%2098.0499%209.77549%2098.5%2010.8568V9.3173H100V18.3711C100%2020.6438%2098.3687%2022%2095.6308%2022ZM95.5933%2017.0515C97.2998%2017.0515%2098.4062%2015.8053%2098.4249%2013.8076C98.4624%2011.8099%2097.3186%2010.5636%2095.5933%2010.5636C93.8494%2010.5636%2092.8367%2011.8099%2092.8367%2013.8076C92.8367%2015.8053%2093.8869%2017.0515%2095.5933%2017.0515Z'%20fill='%23252525'/%3e%3cpath%20d='M81.1836%2019.0309V9.3173H82.6275L82.665%2011.0584C83.1901%209.72051%2084.3527%209.09737%2085.7217%209.09737C87.9907%209.09737%2089.0783%2010.7285%2089.0783%2012.7812V19.0309H87.5031V13.2211C87.5031%2011.425%2086.8843%2010.4536%2085.3841%2010.4536C83.8464%2010.4536%2082.7588%2011.425%2082.7588%2013.2211V19.0309H81.1836Z'%20fill='%23252525'/%3e%3cpath%20d='M73.3176%2019.2509C71.2549%2019.2509%2069.9609%2018.2795%2069.9609%2016.6117C69.9609%2014.9622%2070.9173%2014.0458%2073.0926%2013.6426L76.618%2013.0011C76.618%2011.37%2075.8304%2010.5636%2074.2552%2010.5636C72.8676%2010.5636%2072.0987%2011.1867%2071.7987%2012.3047L70.1297%2012.1764C70.5048%2010.3436%2072.0049%209.09737%2074.2552%209.09737C76.8056%209.09737%2078.1932%2010.6002%2078.1932%2013.0561V17.0699C78.1932%2017.5097%2078.3433%2017.6747%2078.7183%2017.6747H79.1121V19.0309C78.9996%2019.0493%2078.7558%2019.0676%2078.512%2019.0676C77.3119%2019.0676%2076.7681%2018.6094%2076.6368%2017.5281C76.1492%2018.5361%2074.7803%2019.2509%2073.3176%2019.2509ZM73.4676%2017.8946C75.4554%2017.8946%2076.618%2016.6483%2076.618%2015.0355V14.3391L73.3926%2014.9255C72.0425%2015.1638%2071.6111%2015.6586%2071.6111%2016.4651C71.6111%2017.3814%2072.305%2017.8946%2073.4676%2017.8946Z'%20fill='%23252525'/%3e%3cpath%20d='M63.2168%2022C61.079%2022%2059.4663%2020.882%2059.0537%2019.1776L60.704%2019.0676C61.004%2019.984%2061.6791%2020.5338%2063.2168%2020.5338C65.017%2020.5338%2066.0109%2019.8373%2066.0109%2018.4078V16.8316C65.5233%2017.858%2064.3982%2018.5178%2063.1043%2018.5178C60.5727%2018.5178%2058.7725%2016.575%2058.7725%2013.8076C58.7725%2011.0401%2060.5352%209.09737%2063.0293%209.09737C64.4169%209.09737%2065.6358%209.77549%2066.0859%2010.8568V9.3173H67.5861V18.3711C67.5861%2020.6438%2065.9546%2022%2063.2168%2022ZM63.1793%2017.0515C64.8857%2017.0515%2065.9921%2015.8053%2066.0109%2013.8076C66.0484%2011.8099%2064.9045%2010.5636%2063.1793%2010.5636C61.4353%2010.5636%2060.4227%2011.8099%2060.4227%2013.8076C60.4227%2015.8053%2061.4728%2017.0515%2063.1793%2017.0515Z'%20fill='%23252525'/%3e%3cpath%20d='M56.2141%2019.0309C55.0515%2019.0309%2054.2451%2018.4811%2054.2451%2017.1982L54.2639%206.01834H55.8391V17.0699C55.8391%2017.4731%2056.0453%2017.6747%2056.4579%2017.6747H57.3205V19.0309H56.2141Z'%20fill='%23252525'/%3e%3cpath%20d='M51.0686%2019.0309C49.906%2019.0309%2049.0996%2018.4811%2049.0996%2017.1982L49.1184%206.01834H50.6936V17.0699C50.6936%2017.4731%2050.8998%2017.6747%2051.3124%2017.6747H52.175V19.0309H51.0686Z'%20fill='%23252525'/%3e%3cpath%20d='M44.5209%2019.0309V9.3173H46.0961V19.0309H44.5209ZM44.4834%207.79611V6H46.1336V7.79611H44.4834Z'%20fill='%23252525'/%3e%3cpath%20d='M32%2019.0309V6.01834H36.5756C39.726%206.01834%2041.3012%207.09967%2041.3012%209.51891C41.3012%2010.9851%2040.4198%2012.0481%2038.9384%2012.3047C40.7574%2012.5613%2041.8638%2013.7709%2041.8638%2015.4571C41.8638%2017.8213%2040.2323%2019.0309%2037.3257%2019.0309H32ZM37.3257%2017.4914C39.1447%2017.4914%2040.176%2016.74%2040.176%2015.3654C40.176%2013.9908%2039.1447%2013.1844%2037.3257%2013.1844H33.6127V17.4914H37.3257ZM36.5756%2011.6449C38.5258%2011.6449%2039.6135%2010.8935%2039.6135%209.59222C39.6135%208.21765%2038.6008%207.55786%2036.5756%207.55786H33.6127V11.6449H36.5756Z'%20fill='%23252525'/%3e%3c/svg%3e",_e=({className:t})=>{const{shopTerms:n,shopPrivacyPolicy:o,shopRefundPolicy:s,shopLogo:i}=e.useStorefrontStore(),{isAntistock:r}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("footer",{className:`${Ze.checkoutFooter} ${t} ${r?Ze.antistock:""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:Ze.footerBranding,children:[e.jsxRuntimeExports.jsx("p",{className:Ze.poweredText,id:"md",style:r?{color:"var(--text-action)"}:void 0,children:"Powered by"}),r?e.jsxRuntimeExports.jsxs("a",{className:Ze.antistockLink,href:"https://antistock.io",target:"_blank",rel:"noopener noreferrer",children:[e.jsxRuntimeExports.jsx(e.SvgMiniLogoAntistock,{width:14,height:18}),"Antistock"]}):i||e.jsxRuntimeExports.jsx("img",{src:Dl,alt:"Billgang"})]}),e.jsxRuntimeExports.jsx("nav",{children:e.jsxRuntimeExports.jsxs("ul",{className:Ze.footerNav,children:[(n==null?void 0:n.showTermsOfServiceOnProduct)&&!r&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:n.termsOfService,target:"_blank",rel:"noopener noreferrer",children:"Terms"})}),(o==null?void 0:o.showPrivacyPolicyOnProduct)&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:o.privacyPolicy,target:"_blank",rel:"noopener noreferrer",children:"Privacy"})}),(s==null?void 0:s.showRefundPolicyOnProduct)&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:s.refundPolicy,target:"_blank",rel:"noopener noreferrer",children:"Refund"})})]})})]})},Hl="_checkoutHeader_1stm3_1",Ol="_leftContainer_1stm3_20",Ul="_backArrow_1stm3_26",Wl="_logoContainer_1stm3_38",Gl="_logo_1stm3_38",ql="_antistockLink_1stm3_48",Xe={checkoutHeader:Hl,leftContainer:Ol,backArrow:Ul,logoContainer:Wl,logo:Gl,antistockLink:ql},Vl="_activeBadge_1yb5i_1",zl="_activeBadgeText_1yb5i_12",mo={activeBadge:Vl,activeBadgeText:zl},Zl=({className:t})=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(mo.activeBadge,t),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",width:20,height:20}),e.jsxRuntimeExports.jsx("p",{className:mo.activeBadgeText,children:"Active"})]}),Xl="_timerContainer_rh66p_2",Yl="_timerText_rh66p_12",Kl="_timerContainerAntistock_rh66p_16",Ht={timerContainer:Xl,timerText:Yl,timerContainerAntistock:Kl},Jl=({expiresAt:t})=>{const[n,o]=m.useState(i()),{isAntistock:s}=e.useGeneralStore();function i(){const r=new Date,a=new Date(t).getTime()-r.getTime();if(a<=0)return{hours:"00",minutes:"00",seconds:"00"};const c=Math.floor(a/(1e3*60*60)),u=Math.floor(a%(1e3*60*60)/(1e3*60)),h=Math.floor(a%(1e3*60)/1e3);return{hours:String(c).padStart(2,"0"),minutes:String(u).padStart(2,"0"),seconds:String(h).padStart(2,"0")}}return m.useEffect(()=>{const r=setInterval(()=>{o(i())},1e3);return()=>clearInterval(r)},[t]),n.hours==="00"&&n.minutes==="00"&&n.seconds==="00"?null:s?e.jsxRuntimeExports.jsxs("div",{className:Ht.timerContainerAntistock,children:[e.jsxRuntimeExports.jsxs("span",{children:[n.hours,":",n.minutes,":",n.seconds]}),e.jsxRuntimeExports.jsx("span",{children:"remaining"})]}):e.jsxRuntimeExports.jsxs("div",{className:Ht.timerContainer,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Clock"}),e.jsxRuntimeExports.jsxs("p",{className:Ht.timerText,id:"md",children:[n.hours,":",n.minutes,":",n.seconds]})]})},Ql="_progressBar_mcabf_4",eu="_progressBarLabel_mcabf_12",tu="_progressBarTrack_mcabf_17",ou="_progressBarFill_mcabf_28",ft={progressBar:Ql,progressBarLabel:eu,progressBarTrack:tu,progressBarFill:ou},Co=({color:t,percent:n,disablePercentLabel:o})=>e.jsxRuntimeExports.jsxs("div",{className:ft.progressBar,children:[!o&&e.jsxRuntimeExports.jsxs("p",{className:ft.progressBarLabel,children:[n,"%"]}),e.jsxRuntimeExports.jsx("div",{className:ft.progressBarTrack,children:e.jsxRuntimeExports.jsx("div",{style:{width:`${n}%`,background:t||void 0},className:ft.progressBarFill})})]}),nu="_rating_1bpps_4",su="_disabled_1bpps_9",ru="_ratingStar_1bpps_14",iu="_inactive_1bpps_22",St={rating:nu,disabled:su,ratingStar:ru,inactive:iu},au=({setRating:t,rating:n,disabled:o})=>{const[s,i]=m.useState(0),r=c=>{o||i(+c.currentTarget.id)},a=c=>{o||t(c)};return e.jsxRuntimeExports.jsx("div",{className:e.clx(St.rating,{[St.disabled]:o}),onMouseLeave:()=>i(0),children:[1,2,3,4,5].map(c=>e.jsxRuntimeExports.jsx("div",{id:c.toString(),className:e.clx(St.ratingStar,{[St.inactive]:!(n>=c||s>=c)}),onMouseEnter:r,onClick:()=>a(c),children:n>=c||s>=c?e.jsxRuntimeExports.jsx(e.FilledStar,{}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Star",fill:"var(--text-secondary)",width:22,height:21})},c))})},cu="_inputRange_iv6ow_4",lu="_inputRangeLabel_iv6ow_14",uu="_progressBar_iv6ow_22",du="_progressBarFill_iv6ow_29",pu="_stepsContainer_iv6ow_40",mu="_step_iv6ow_40",xu="_stepDot_iv6ow_57",hu="_current_iv6ow_61",gu="_active_iv6ow_69",ju="_inactive_iv6ow_72",Iu="_tooltip_iv6ow_77",pe={inputRange:cu,inputRangeLabel:lu,progressBar:uu,progressBarFill:du,stepsContainer:pu,step:mu,stepDot:xu,current:hu,default:"_default_iv6ow_65",active:gu,inactive:ju,tooltip:Iu},fu=({totalSteps:t,step:n,onStepChange:o,label:s})=>{const[i,r]=m.useState(n),a=i===1?0:(i-1)/(t-1)*100,c=u=>{r(u),o(u)};return e.jsxRuntimeExports.jsxs("div",{className:pe.inputRange,children:[s&&e.jsxRuntimeExports.jsx("div",{className:pe.inputRangeLabel,children:s}),e.jsxRuntimeExports.jsxs("div",{className:pe.progressBar,children:[e.jsxRuntimeExports.jsx("div",{className:pe.progressBarFill,style:{width:`${Math.ceil(a)}%`}}),e.jsxRuntimeExports.jsx("div",{className:pe.stepsContainer,children:[...Array(t)].map((u,h)=>{const d=h+1,g=d<=i,p=d===i;return e.jsxRuntimeExports.jsxs("div",{className:pe.step,onClick:()=>c(d),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(pe.stepDot,p?pe.current:pe.default,g?pe.active:pe.inactive)}),p&&e.jsxRuntimeExports.jsxs("div",{className:pe.tooltip,style:{transform:`translateX(calc(50% - ${a<99?"40px":"70px"}))`},children:[e.jsxRuntimeExports.jsx("span",{children:i}),e.jsxRuntimeExports.jsx("span",{children:i===1?"month":"months"})]})]},d)})})]})]})},lt=({className:t,expiresAt:n})=>{const{shopGeneral:o}=e.useStorefrontStore(),s=e.useNavigate(),{isAntistock:i}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("header",{className:`${Xe.checkoutHeader} ${t}`,children:[e.jsxRuntimeExports.jsxs("div",{className:Xe.leftContainer,children:[e.jsxRuntimeExports.jsx("div",{className:Xe.backArrow,onClick:()=>{window.history.length>2?s(-1):s("/")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUp"})}),(o==null?void 0:o.info.logo)&&e.jsxRuntimeExports.jsx("div",{className:Xe.logoContainer,children:i?e.jsxRuntimeExports.jsx("a",{className:Xe.antistockLink,href:"https://antistock.io",target:"_blank",rel:"noopener noreferrer",children:"Antistock"}):e.jsxRuntimeExports.jsx("img",{className:Xe.logo,src:e.convertCfImageIdToUrl(o.info.logo.cfId)})})]}),n&&e.jsxRuntimeExports.jsx(Jl,{expiresAt:n})]})},Su="_checkoutPrices_vp75r_1",Cu="_priceRow_vp75r_12",_u="_label_vp75r_22",vu="_totalRow_vp75r_26",Ru="_totalLabel_vp75r_37",Eu="_totalValue_vp75r_42",ye={checkoutPrices:Su,priceRow:Cu,label:_u,totalRow:vu,totalLabel:Ru,totalValue:Eu},ut=({formatter:t,coupon:n,discount:o,totalWithDiscount:s,total:i,className:r,isShowSubtotal:a=!0,feeOrDiscount:c})=>{const u=Math.max(0,o),{priceAdjusment:h}=e.useCartStore(),{isAntistock:d}=e.useGeneralStore(),p=(()=>{const I=s!==void 0?s:i-u;return!h||c===null||c===void 0?Math.max(I,0):h.isDiscount?Math.max(I-c,0):Math.max(I+c,0)})();return e.jsxRuntimeExports.jsxs("div",{className:`${ye.checkoutPrices} ${r||""}`,style:{border:d?"1px solid var(--border-secondary)":void 0},children:[a&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsx("p",{className:ye.label,id:"md",children:"Subtotal"}),e.jsxRuntimeExports.jsx("p",{id:"md",children:t.format(i)})]}),(n||u>0)&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsxs("p",{className:ye.label,id:"md",children:["Discount ",n&&!(n!=null&&n.isFixed)&&`(${n==null?void 0:n.discount}%)`]}),e.jsxRuntimeExports.jsx("p",{id:"md",children:n&&!(n!=null&&n.isFixed)&&(n==null?void 0:n.discount)===100?`-${t.format(i)}`:`-${t.format(u)}`})]}),c!=null&&c!==0&&h&&(h.fixedAmount!==0||h.percentage!==0)&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsxs("p",{className:ye.label,id:"md-bold",children:[h.isDiscount?"Discount: ":"Fee: ",h.percentage!==0&&h.fixedAmount===0&&`(${h.percentage}%)`,h.fixedAmount!==0&&h.percentage===0&&`(${t.format(h.fixedAmount)})`,h.percentage!==0&&h.fixedAmount!==0&&`(${h.percentage}% + ${t.format(h.fixedAmount)})`]}),e.jsxRuntimeExports.jsx("p",{id:"md-bold",children:t.format(c)})]}),e.jsxRuntimeExports.jsxs("div",{className:ye.totalRow,children:[e.jsxRuntimeExports.jsx("p",{className:ye.totalLabel,id:"md-bold",children:"Total Due"}),e.jsxRuntimeExports.jsx("p",{className:ye.totalValue,id:"md-bold",children:t.format(p)})]})]})},yu="_checkoutProduct_hr575_1",bu="_isOrder_hr575_1",wu="_productDetails_hr575_10",ku="_productImage_hr575_16",Nu="_isOrderImage_hr575_26",Tu="_productImageAntistock_hr575_30",Lu="_image_hr575_35",Pu="_productInfo_hr575_40",Au="_productHeader_hr575_47",Bu="_quantityBadge_hr575_53",Mu="_productPrice_hr575_71",$u="_deliveryCategories_hr575_80",Fu="_customerNote_hr575_88",Du="_noteHeader_hr575_95",Hu="_logoContainer_hr575_101",Ou="_shopName_hr575_113",Uu="_noteContent_hr575_117",Wu="_productName_hr575_123",ne={checkoutProduct:yu,isOrder:bu,productDetails:wu,productImage:ku,isOrderImage:Nu,productImageAntistock:Tu,image:Lu,productInfo:Pu,productHeader:Au,quantityBadge:Bu,productPrice:Mu,deliveryCategories:$u,customerNote:Fu,noteHeader:Du,logoContainer:Hu,shopName:Ou,noteContent:Uu,productName:Wu},Zt=({isOrder:t,product:n})=>{var a;const{shopGeneral:o}=e.useStorefrontStore(),s=n.subscriptionSettings,{cart:i}=e.useCart(),{isAntistock:r}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("div",{className:`${ne.checkoutProduct} ${t?ne.isOrder:""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:ne.productDetails,children:[e.jsxRuntimeExports.jsx("div",{className:`${ne.productImage} ${t?ne.isOrderImage:""} ${r?ne.productImageAntistock:""}`,children:n!=null&&n.image?e.jsxRuntimeExports.jsx("img",{className:ne.image,src:e.convertCfImageIdToUrl(n.image.cfId)}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image",fill:"var(--text-secondary)"})}),e.jsxRuntimeExports.jsx("div",{className:ne.productInfo,children:e.jsxRuntimeExports.jsxs("div",{className:ne.productHeader,children:[e.jsxRuntimeExports.jsx("h2",{className:ne.productName,id:"h5",children:n.name}),e.jsxRuntimeExports.jsxs("span",{className:ne.quantityBadge,id:"md",children:[n.price.quantity,"x"]})]})}),n.chargeType==="RECURRING"&&e.jsxRuntimeExports.jsx("p",{className:ne.productPrice,id:"md",children:s&&`${e.formatPrice(s.price)} / ${e.normalizeInterval(s.recurringIntervalDays||0)}${s.entryFee?" + "+e.formatPrice(s.entryFee):""}`}),n.chargeType==="ONE_TIME"&&e.jsxRuntimeExports.jsx("p",{className:ne.productPrice,id:"md",children:n.variantsGateways&&i.gateway&&n.variantsGateways.some(c=>c.name===i.gateway&&c.overrodePrice)?e.formatPrice(((a=n.variantsGateways.find(c=>c.name===i.gateway))==null?void 0:a.overrodePrice)||n.price):e.formatPrice(n.price)})]}),n.deliveryCategories&&e.jsxRuntimeExports.jsx("div",{className:ne.deliveryCategories,children:n.deliveryCategories.map(c=>e.jsxRuntimeExports.jsx(e.DeliveryItem,{deliveryConfiguration:c},c.id))}),n.customerNote&&e.jsxRuntimeExports.jsxs("div",{className:ne.customerNote,style:r?{border:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsxs("div",{className:ne.noteHeader,children:[(o==null?void 0:o.info.logo)&&e.jsxRuntimeExports.jsx("div",{className:ne.logoContainer,children:e.jsxRuntimeExports.jsx("img",{src:e.convertCfImageIdToUrl(o==null?void 0:o.info.logo.cfId)})}),e.jsxRuntimeExports.jsx("p",{className:ne.shopName,id:"md",children:o==null?void 0:o.info.name})]}),e.jsxRuntimeExports.jsx("p",{className:ne.noteContent,id:"md",children:n.customerNote})]})]})},Gu="_coupon_dkjzv_1",qu="_couponApplied_dkjzv_7",Vu="_discount_dkjzv_17",zu="_removeButton_dkjzv_23",Zu="_removeButtonText_dkjzv_27",Xu="_couponInput_dkjzv_31",Yu="_couponInputContainer_dkjzv_37",Pe={coupon:Gu,couponApplied:qu,discount:Vu,removeButton:zu,removeButtonText:Zu,couponInput:Xu,couponInputContainer:Yu},Ku=({applyCoupon:t,couponData:n,discount:o,removeCoupon:s,gateway:i})=>{const[r,a]=m.useState(null),[c,u]=m.useState(!1),{isAntistock:h}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("div",{className:Pe.coupon,children:[c&&e.jsxRuntimeExports.jsx(e.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Pe.skeleton,style:{borderRadius:"var(--border-radius)"},children:e.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!c&&(n?e.jsxRuntimeExports.jsxs("div",{className:Pe.couponApplied,style:h?{border:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"var(--text-success)"}),e.jsxRuntimeExports.jsxs("p",{id:"md",style:{color:h?"var(--text-primary)":void 0},children:[r," is applied"," ",e.jsxRuntimeExports.jsxs("span",{className:Pe.discount,children:["-",o," ",!n.isFixed&&`(${n.discount}%)`]})]}),e.jsxRuntimeExports.jsx("button",{className:Pe.removeButton,onClick:s,children:e.jsxRuntimeExports.jsx("span",{className:Pe.removeButtonText,children:"Remove"})})]}):e.jsxRuntimeExports.jsxs("div",{className:Pe.couponInput,children:[e.jsxRuntimeExports.jsxs("div",{className:Pe.couponInputContainer,children:[e.jsxRuntimeExports.jsx(e.Input$1,{placeholder:"Enter a discount code",value:r||"",onChange:d=>{a(d===""?null:d)}}),e.jsxRuntimeExports.jsx(e.Button$1,{onClick:async()=>{u(!0),r&&await t(r),u(!1)},disabled:!i||!r,type:"Primary",children:"Apply"})]}),!h&&!i&&e.jsxRuntimeExports.jsx(e.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},Ju=({cart:t,products:n,applyCoupon:o,applyCouponPending:s,coupon:i,totalAndDiscount:r,removeCoupon:a})=>{var l;const{priceAdjusment:c}=e.useCartStore(),[u,h]=m.useState(!1),d=m.useMemo(()=>t.parts.map(C=>{const x=n.find(f=>f.id===C.productId),_=x==null?void 0:x.variants.find(f=>f.id===C.productVariantId);return C.chargeType==="RECURRING"&&h(!0),{id:(x==null?void 0:x.id)||0,image:x==null?void 0:x.images[0],name:(()=>{const f=(x==null?void 0:x.name)||"",v=(_==null?void 0:_.name)||"";return!f&&!v?"":!v||f===v?f:f?`${f} (${v})`:v})(),description:"",price:{quantity:C.quantity,amount:(_==null?void 0:_.price.amount)||0,currency:_==null?void 0:_.price.currency},subscriptionSettings:_==null?void 0:_.subscriptionSettings,chargeType:C.chargeType,variantsGateways:_==null?void 0:_.gateways}}),[t,n]),g=((l=d[0])==null?void 0:l.price.currency)||"USD",p=new Intl.NumberFormat("en-US",{style:"currency",currency:g}),I=m.useMemo(()=>i&&!i.isFixed&&i.discount===100?r.total:r.totalWithDiscount?r.total-r.totalWithDiscount:0,[r,i]),j=c?(c==null?void 0:c.fixedAmount)+Math.round((r.totalWithDiscount!==void 0?r.totalWithDiscount:r.total-I)*((c==null?void 0:c.percentage)/100)):null;return e.jsxRuntimeExports.jsx("div",{className:He.checkoutItemsContainer,children:e.jsxRuntimeExports.jsxs("div",{className:He.innerContainer,children:[e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsxs("div",{className:He.headerSection,children:[e.jsxRuntimeExports.jsx("header",{className:He.header,children:e.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),e.jsxRuntimeExports.jsx("div",{className:He.productsContainer,children:d.map(C=>e.jsxRuntimeExports.jsx(Zt,{product:C},C.id))}),e.jsxRuntimeExports.jsx("div",{className:He.couponContainer,children:e.jsxRuntimeExports.jsx(Ku,{applyCoupon:o,applyCouponPending:s,couponData:i,discount:p.format(I),removeCoupon:a,gateway:t.gateway})}),e.jsxRuntimeExports.jsx(ut,{formatter:p,coupon:i,total:r.total,discount:I,totalWithDiscount:r.totalWithDiscount,feeOrDiscount:u?null:j})]}),e.jsxRuntimeExports.jsx("div",{className:He.checkoutFooter,children:e.jsxRuntimeExports.jsx(_e,{})})]})})},Qu="_checkoutOperational_b62bq_1",ed="_innerContainer_b62bq_17",td="_innerContainerAntistock_b62bq_27",od="_paymentMethodsSectionAntistock_b62bq_39",nd="_continueButtonAntistock_b62bq_49",sd="_checkoutFooterAntistock_b62bq_59",rd="_antistock_b62bq_70",id="_paymentMethodsSection_b62bq_39",ad="_socialConnectSection_b62bq_81",cd="_socialConnectLabel_b62bq_84",ld="_socialConnectContent_b62bq_88",ud="_continueButton_b62bq_49",dd="_button_b62bq_96",pd="_checkoutFooter_b62bq_59",ae={checkoutOperational:Qu,innerContainer:ed,innerContainerAntistock:td,paymentMethodsSectionAntistock:od,continueButtonAntistock:nd,checkoutFooterAntistock:sd,antistock:rd,paymentMethodsSection:id,socialConnectSection:ad,socialConnectLabel:cd,socialConnectContent:ld,continueButton:ud,button:dd,checkoutFooter:pd},md="_customFields_uhcib_2",xd="_checkboxWrapper_uhcib_9",hd="_textareaWrapper_uhcib_16",gd="_inputWrapper_uhcib_17",jd="_requiredStar_uhcib_27",Ke={customFields:md,checkboxWrapper:xd,textareaWrapper:hd,inputWrapper:gd,requiredStar:jd},Id=({customFields:t,setCustomFields:n})=>{if(t.length===0)return null;const o=t.map(s=>e.jsxRuntimeExports.jsx(fd,{customField:s,setCustomFields:n},s.name));return e.jsxRuntimeExports.jsx("div",{className:Ke.customFields,children:o})},fd=({customField:t,setCustomFields:n})=>{const o=s=>{n(i=>i.map(r=>r.name===t.name?{...r,value:s}:r))};return e.jsxRuntimeExports.jsx(Sd,{value:t.value??"",placeholder:t.placeholder,required:t.required,defaultValue:t.defaultValue,type:t.type,onValueChange:o,label:t.name,regex:t.regex})},Sd=({label:t,type:n,defaultValue:o,value:s,placeholder:i,regex:r,required:a,onValueChange:c})=>{if(m.useEffect(()=>{s===""&&o!==void 0&&c(String(o))},[]),n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return e.jsxRuntimeExports.jsxs("label",{className:Ke.checkboxWrapper,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:s==="true",onChange:h=>c(h?"true":"false")}),e.jsxRuntimeExports.jsxs("p",{className:Ke.checkboxLabel,children:[t,a&&e.jsxRuntimeExports.jsx("span",{className:Ke.requiredStar,children:"*"})]})]});if(n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return e.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(o??""),required:a});const u=h=>{(n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:r?new RegExp(r):/.*/).test(h)&&c(h)};return n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?e.jsxRuntimeExports.jsx("div",{className:Ke.textareaWrapper,children:e.jsxRuntimeExports.jsx(e.Textarea$1,{label:t,value:s,placeholder:i,onChange:u,required:a})}):e.jsxRuntimeExports.jsx("div",{className:Ke.inputWrapper,children:e.jsxRuntimeExports.jsx(e.Input$1,{type:n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":i,label:t,value:s,required:a,onChange:u})})},Cd="_connectedContainer_1rxr8_1",_d="_userInfo_1rxr8_10",vd="_avatar_1rxr8_16",Rd="_avatarImage_1rxr8_26",Ct={connectedContainer:Cd,userInfo:_d,avatar:vd,avatarImage:Rd},Ed=({customerEmail:t})=>{const{discordInfo:n,setDiscordInfo:o}=e.useDiscordStore(),{notifications:s,setNotifications:i}=e.useNotificationStore(),[r,a]=m.useState(!1),[c,u]=m.useState(0),[h,d]=m.useState(null),g=20,p=l=>{var C,x,_,f;return(x=(C=l==null?void 0:l.response)==null?void 0:C.data)!=null&&x.error?l.response.data.error:(f=(_=l==null?void 0:l.response)==null?void 0:_.data)!=null&&f.message?l.response.data.message:l!=null&&l.message?l.message:"Failed to connect to Discord. Please try again later."},I=(l,C)=>{i([...s,{id:e.v4(),message:l,status:C}])};m.useEffect(()=>{if(h&&r){const l=setInterval(()=>{h.closed&&(clearInterval(l),a(!1),d(null))},1e3);return()=>clearInterval(l)}},[h,r]);const j=()=>{t.trim()!==""&&(a(!0),u(0),In({customerEmail:t,tsId:e.getTsId()}).then(({data:l})=>{const C=window.open(l.redirectUrl);d(C),(!C||C.closed||typeof C.closed>"u")&&setTimeout(()=>{const f=document.createElement("a");f.href=l.redirectUrl,f.target="_blank",f.click()});let x;const _=()=>{if(u(f=>f+1),c>=g||C&&C.closed){c>=g&&I("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(x);return}fn({id:l.id,customerEmail:t}).then(({data:f})=>{o({authorized:!0,id:l.id,avatar:f.avatar,username:f.username}),C&&C.close(),a(!1),d(null),I("Discord successfully connected!","success"),clearTimeout(x)}).catch(f=>{var v;if(console.log("Waiting for authorization...",f,{newWindow:C}),C&&C.closed){a(!1),clearTimeout(x);return}if((v=f==null?void 0:f.response)!=null&&v.status&&f.response.status!==404&&f.response.status>=400){I(p(f),"error"),a(!1),clearTimeout(x);return}clearTimeout(x),x=setTimeout(_,1500)})};_()}).catch(l=>{console.log("Could not initiate Discord authorization",l),I(p(l),"error"),a(!1)}))};return n!=null&&n.authorized?e.jsxRuntimeExports.jsxs("div",{className:Ct.connectedContainer,children:[e.jsxRuntimeExports.jsxs("div",{className:Ct.userInfo,children:[e.jsxRuntimeExports.jsx("div",{className:Ct.avatar,children:n.avatar?e.jsxRuntimeExports.jsx("img",{className:Ct.avatarImage,src:`https://cdn.discordapp.com/avatars/${n.id}/${n.avatar}.png?size=256`}):e.jsxRuntimeExports.jsx(e.Icon,{name:"UserCircle"})}),e.jsxRuntimeExports.jsx("p",{children:n.username}),e.jsxRuntimeExports.jsx(Zl,{})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Reconnect"})]}):e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:r,children:r?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"DiscordLogo"}),e.jsxRuntimeExports.jsx(e.StableText,{children:"Connect Your Discord"})]})})},yd="_paymentMethodsContainer_1pfqr_2",bd="_antistock_1pfqr_15",xo={paymentMethodsContainer:yd,antistock:bd},wd="_bottomSheet_1x8kc_1",kd="_content_1x8kc_8",Nd="_description_1x8kc_11",Td="_title_1x8kc_15",Ld="_buttonGroup_1x8kc_19",Pd="_buttonWrapper_1x8kc_29",Ad="_fullWidthButton_1x8kc_32",Bd="_modal_1x8kc_36",Md="_header_1x8kc_43",Te={bottomSheet:wd,content:kd,description:Nd,title:Td,buttonGroup:Ld,buttonWrapper:Pd,fullWidthButton:Ad,modal:Bd,header:Md},$d=({setIsOpen:t,balance:n})=>{const o=e.useNavigate(),{setIsOpen:s}=e.useModalStore(),i=()=>{o("/top-up?redirectRoute=checkout")};function r(){s(!1),setTimeout(()=>{t(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Te.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Te.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Te.title,children:"Insufficient Customer Balance"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Te.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Te.content,children:e.jsxRuntimeExports.jsxs("p",{className:Te.description,children:["You currently have ",n&&e.formatPrice(n)," in your balance. After topping up the required amount, you can continue to checkout."]})}),e.jsxRuntimeExports.jsxs("div",{className:Te.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Te.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:r,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Te.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:i,children:"Add Balance"})})]})]})]})},_o=({align:t,gateway:n,gatewayDisplayName:o,selected:s,onSelect:i,total:r,onSignInClick:a,reversed:c,isAntistock:u=!1})=>{const{token:h}=e.useStorefrontStore(),{balance:d}=e.useCustomerDashboardStore(),[g,p]=m.useState(!1),{setIsOpen:I}=e.useModalStore(),j=l=>{l.stopPropagation(),i==null||i(n),d&&d.amount<r&&(p(!0),I(!0))};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(e.styles$3.paymentMethod,{[e.styles$3.selected]:s,[e.styles$3.alignColumn]:t==="column",[e.styles$3.reversed]:c&&!u,[e.styles$3.antistock]:u}),onClick:j,children:u?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("p",{className:e.styles$3.paymentText,id:"md",children:[o," ",e.jsxRuntimeExports.jsxs("span",{className:e.styles$3.balanceText,id:"md",children:["(",h?d&&e.formatPrice(d):e.jsxRuntimeExports.jsx("a",{className:e.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),e.jsxRuntimeExports.jsx("div",{className:e.styles$3.iconContainer,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("p",{className:e.styles$3.paymentText,id:"md",children:[o," ",e.jsxRuntimeExports.jsxs("span",{className:e.styles$3.balanceText,id:"md",children:["(",h?d&&e.formatPrice(d):e.jsxRuntimeExports.jsx("a",{className:e.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),e.jsxRuntimeExports.jsx("div",{className:e.styles$3.iconContainer,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]})}),g&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>p(!1),children:e.jsxRuntimeExports.jsx($d,{setIsOpen:p,balance:d})})]})},vo=({possibleGateways:t,setGateway:n,totalAndDiscount:o,onSignInClick:s,setPaymentMethod:i,isAntistock:r=!1})=>{const[a,c]=m.useState(),[u,h]=m.useState(),{setPriceAdjustment:d}=e.useCartStore(),[g,p]=m.useState(null),I=(j,l)=>{var C;u!==l&&(n(l),d(((C=g==null?void 0:g.find(x=>x.name===l))==null?void 0:C.priceAdjustment)||null)),i(j),c(j),h(l)};return m.useEffect(()=>{if(g&&g.length>0){const j=g[0];if(j.name==="Balance")h(j.name),n(j.name),d(j.priceAdjustment||null);else if(j.paymentMethods&&j.paymentMethods.length>0){const l=j.paymentMethods[0];c(l),h(j.name),n(j.name),i(l),d(j.priceAdjustment||null)}}},[g]),m.useEffect(()=>{const j=async()=>{const{data:l}=await e.fetchGatewaysDetail([...t.availableGateways,...t.requiresSignInGateways]);p(l)};t.availableGateways.length&&j()},[]),m.useLayoutEffect(()=>{d(null)},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:g&&e.jsxRuntimeExports.jsx("div",{className:e.clx(xo.paymentMethodsContainer,{[xo.antistock]:r}),children:g==null?void 0:g.map(j=>j.name==="Balance"?e.jsxRuntimeExports.jsx(_o,{gateway:j.name,gatewayDisplayName:j.displayName,onSelect:l=>{h(l),u!==l&&n(l)},selected:j.name===u,total:o.total,onSignInClick:s,reversed:!0,isAntistock:r},j.name):j.paymentMethods.map(l=>e.jsxRuntimeExports.jsx(e.CheckoutPaymentMethod,{paymentMethod:l,gateway:j.name,gatewayDisplayName:j.displayName,gatewayLogoCfId:j.logoCfImageId,poweredByLogoCfId:j.poweredByImageCfImageId,onSelect:C=>I(C,j.name),selected:a===l&&u===j.name,isAntistock:r},`${j.name}-${l}`)))})})},Fd="_modal_14r0b_1",Dd={modal:Fd},Hd=({setIsOpen:t})=>{const{token:n}=e.useStorefrontStore(),{setIsOpen:o}=e.useModalStore();m.useEffect(()=>{n&&s()},[n]);const s=()=>{o(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsx("div",{className:Dd.modal,onClick:i=>i.stopPropagation(),children:e.jsxRuntimeExports.jsx(e.Auth,{inModal:!0})})},Od=({getPossibleGateways:t,setGateway:n,getDiscordSettings:o,cart:s,products:i,submitCart:r,reset:a,setCustomFieldsToCart:c,totalAndDiscount:u,setDiscordSocialConnectId:h,setPaymentMethod:d,isAntistock:g})=>{const p=m.useMemo(()=>o(),[]),[I,j]=m.useState([]),{balance:l,setBalance:C}=e.useCustomerDashboardStore(),{token:x}=e.useStorefrontStore(),{executeRecaptcha:_}=e.useReCaptcha(),{discordInfo:f}=e.useDiscordStore(),{customerEmail:v,setCustomerEmail:S}=e.useCartStore(),R=f!=null&&f.authorized?f.id:void 0,w=e.useNavigate(),D=m.useMemo(()=>t(),[s.parts]),[te,Z]=m.useState(!1),{setIsOpen:M}=e.useModalStore(),{notifications:b,setNotifications:E}=e.useNotificationStore();m.useEffect(()=>{const A=e.getCommonCustomFields(s.parts,i).map(W=>W.type===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...W,value:String(W.defaultValue)}:W);j([...A])},[]),m.useEffect(()=>{const N=e.getCommonCustomFields(s.parts,i);j(A=>{const W=new Map(A.map(T=>[T.name,T]));return N.map(T=>{const q=W.get(T.name);return q&&q.value?{...T,value:q.value}:T.type===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...T,value:String(T.defaultValue)}:T})})},[s.parts,i]),m.useEffect(()=>{x&&(async()=>{const A=await e.getBalance();C(A)})()},[x]);function F(N){return N&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(N)}const Y=()=>{const N=[];return I.forEach(A=>{var W;A.required&&!((W=A.value)!=null&&W.toString().trim())&&N.push({message:`Field "${A.name}" is required.`,status:"error",id:e.v4()})}),N.length>0?(E([...b,...N]),!1):!0},U=async N=>{if(N.stopPropagation(),s.gateway==="Balance"&&!x){M(!0),Z(!0);return}if(!Y())return;const A=Object.fromEntries(I.map(T=>[T.name,T.value||""]));c({...A}),R&&p.isEnabled&&h(R);const W=await _();if(W){const T=await r(W),q=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(q).length>10){const ke=Date.now()-864e5;Object.keys(q).forEach(ve=>{q[ve].createdAt<=ke&&delete q[ve]})}"order"in T?q[T.order.id]={createdAt:Date.now(),fullAccessToken:T.order.fullAccessToken}:q[T.id]={createdAt:Date.now(),fullAccessToken:T.fullAccessToken},localStorage.setItem("orders",JSON.stringify(q)),w(`/orders/${"order"in T?T.order.id:T.id}/${"order"in T?T.order.fullAccessToken:T.fullAccessToken}`),setTimeout(()=>a(),0)}};return e.jsxRuntimeExports.jsxs("div",{className:ae.checkoutOperational,style:g?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsxs("div",{className:`${ae.innerContainer} ${g?ae.innerContainerAntistock:""}`,children:[g?e.jsxRuntimeExports.jsx("h4",{style:{fontSize:"var(--input-label-size)",color:"var(--text-secondary)",paddingBottom:"12px",fontWeight:"400"},children:"Select Payment Method"}):null,s.parts.length>0&&e.jsxRuntimeExports.jsx(vo,{possibleGateways:D,setGateway:n,setPaymentMethod:d,balance:l,totalAndDiscount:u,onSignInClick:()=>{Z(!0),M(!0)},isAntistock:g}),e.jsxRuntimeExports.jsx("div",{className:e.clx(ae.paymentMethodsSection,{[ae.antistock]:g,[ae.paymentMethodsSectionAntistock]:g}),children:e.jsxRuntimeExports.jsx(e.Input$1,{placeholder:"your@email.com",value:v||"",onChange:N=>S(N),disabled:!!x,label:"Email Address"})}),e.jsxRuntimeExports.jsx(Id,{customFields:I,setCustomFields:j}),p.isEnabled&&e.jsxRuntimeExports.jsxs("div",{className:ae.socialConnectSection,children:[e.jsxRuntimeExports.jsx("p",{className:ae.socialConnectLabel,id:"md",children:"Social Connect"}),e.jsxRuntimeExports.jsx("div",{className:ae.socialConnectContent,children:e.jsxRuntimeExports.jsx(Ed,{customerEmail:v||""})})]}),e.jsxRuntimeExports.jsxs("div",{className:`${ae.continueButton} ${g?ae.continueButtonAntistock:""}`,children:[e.jsxRuntimeExports.jsx(e.Button$1,{onClick:U,disabled:!s.gateway||!F(v||"")||p.isRequired&&!(f!=null&&f.authorized),className:ae.button,children:"Continue to Checkout"}),e.jsxRuntimeExports.jsx(e.TermsOfService,{}),e.jsxRuntimeExports.jsx(e.SecuredBySsl,{isAntistock:g})]}),e.jsxRuntimeExports.jsx(_e,{className:`${ae.checkoutFooter} ${g?ae.checkoutFooterAntistock:""}`})]}),te&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>Z(!1),children:e.jsxRuntimeExports.jsx(Hd,{setIsOpen:Z})})]})},Ud="_mt1_1l62z_1",Wd="_notifyBlock_1l62z_13",Gd="_notifyHeader_1l62z_19",qd="_notifyContent_1l62z_25",Vd="_buttonBlock_1l62z_30",zd="_imageBlock_1l62z_34",Zd="_imageContainer_1l62z_42",Xd="_sectionBlock_1l62z_54",Yd="_sectionTitle_1l62z_61",Kd="_sectionSubtitle_1l62z_64",Jd="_inputContainer_1l62z_69",Ce={mt1:Ud,notifyBlock:Wd,notifyHeader:Gd,notifyContent:qd,buttonBlock:Vd,imageBlock:zd,imageContainer:Zd,sectionBlock:Xd,sectionTitle:Yd,sectionSubtitle:Kd,inputContainer:Jd},Qd=({props:t})=>{const n=e.useCopy();return e.jsxRuntimeExports.jsx("div",{className:Ce.mt1,children:e.jsxRuntimeExports.jsxs("div",{className:Ce.inputContainer,children:[e.jsxRuntimeExports.jsx(e.Input$1,{value:t.text,disabled:!0,onChange:()=>{}}),t.shownCopyButton&&e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:()=>n(t.text),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})})},ep=({props:t})=>e.jsxRuntimeExports.jsx(e.Button$1,{className:Ce.buttonBlock,onClick:()=>window.open(t.url,"_blank","noopener"),children:t.text}),tp=({props:t})=>e.jsxRuntimeExports.jsx("div",{className:Ce.imageBlock,children:e.jsxRuntimeExports.jsx("div",{className:Ce.imageContainer,children:e.jsxRuntimeExports.jsx("img",{src:t.src,alt:""})})}),op=({props:t})=>e.jsxRuntimeExports.jsxs("div",{className:Ce.notifyBlock,children:[e.jsxRuntimeExports.jsxs("div",{className:Ce.notifyHeader,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),e.jsxRuntimeExports.jsx("p",{children:t.heading})]}),e.jsxRuntimeExports.jsx("p",{className:Ce.notifyContent,children:t.content})]}),np=({props:t})=>{var n;return e.jsxRuntimeExports.jsxs("div",{className:Ce.sectionBlock,children:[e.jsxRuntimeExports.jsx("p",{className:Ce.sectionTitle,children:t.title}),e.jsxRuntimeExports.jsx("span",{className:Ce.sectionSubtitle,children:t.subTitle}),(n=t.children)==null?void 0:n.map((o,s)=>e.jsxRuntimeExports.jsx(Vt,{block:o},s))]})},Vt=({block:t})=>{switch(t.type){case"Section":return e.jsxRuntimeExports.jsx(np,{...t});case"ReadOnlyTextInput":return e.jsxRuntimeExports.jsx(Qd,{...t});case"Notify":return e.jsxRuntimeExports.jsx(op,{...t});case"Button":return e.jsxRuntimeExports.jsx(ep,{...t});case"Image":return e.jsxRuntimeExports.jsx(tp,{...t});default:return null}},sp="_bottomSheet_1x4sq_1",rp="_content_1x4sq_8",ip="_agreementList_1x4sq_11",ap="_agreementItem_1x4sq_16",cp="_warning_1x4sq_23",lp="_buttonGroup_1x4sq_31",up="_buttonWrapper_1x4sq_41",dp="_fullWidthButton_1x4sq_44",pp="_modal_1x4sq_48",mp="_header_1x4sq_55",me={bottomSheet:sp,content:rp,agreementList:ip,agreementItem:ap,warning:cp,buttonGroup:lp,buttonWrapper:up,fullWidthButton:dp,modal:pp,header:mp},xp=({setIsOpen:t,price:n})=>{const[o,s]=m.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:i}=e.useModalStore(),r=()=>{i(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:me.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:me.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:me.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:me.content,children:[e.jsxRuntimeExports.jsxs("div",{className:me.agreementList,children:[e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToSendAsFF,onChange:a=>s({...o,agreeToSendAsFF:a})}),e.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToSend,onChange:a=>s({...o,agreeToSend:a})}),e.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",e.formatPrice(n)," ",n.currency]})]}),e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToNotAddNote,onChange:a=>s({...o,agreeToNotAddNote:a})}),e.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),e.jsxRuntimeExports.jsx("div",{className:me.warning,children:e.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",e.formatPrice(n)," ",n.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),e.jsxRuntimeExports.jsxs("div",{className:me.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:me.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",children:e.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),e.jsxRuntimeExports.jsx("div",{className:me.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!(o.agreeToSendAsFF&&o.agreeToNotAddNote&&o.agreeToSend),onClick:r,children:"Continue to Payment"})})]})]})]})},hp="_chargeItemsContainer_vynct_5",gp="_chargeItemsInner_vynct_18",jp="_productsContainer_vynct_25",Ip="_antistockLayout_vynct_40",fp="_mainContentAntistock_vynct_53",Sp="_desktopTrackPayment_vynct_64",Cp="_desktopFooter_vynct_73",_p="_footerContainerAntistock_vynct_94",vp="_chargeHeader_vynct_107",Rp="_chargeTitle_vynct_115",Ep="_chargeDescription_vynct_121",yp="_copyButton_vynct_127",bp="_productsList_vynct_139",wp="_footerContainer_vynct_94",ce={chargeItemsContainer:hp,chargeItemsInner:gp,productsContainer:jp,antistockLayout:Ip,mainContentAntistock:fp,desktopTrackPayment:Sp,desktopFooter:Cp,footerContainerAntistock:_p,chargeHeader:vp,chargeTitle:Rp,chargeDescription:Ep,copyButton:yp,productsList:bp,footerContainer:wp},kp=({charge:t})=>{var a;const n=e.useCopy(),{isAntistock:o}=e.useGeneralStore(),s=(t==null?void 0:t.price.currency)||"USD",i=new Intl.NumberFormat("en-US",{style:"currency",currency:s}),r=m.useMemo(()=>{var c;return((c=t==null?void 0:t.order)==null?void 0:c.partOrders.map(u=>{var h,d,g,p;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:(()=>{var l,C;const I=((l=u.productWithVariant)==null?void 0:l.name)||"",j=((C=u.productWithVariant)==null?void 0:C.variantName)||"";return!I&&!j?"":!j||I===j?I:I?`${I} (${j})`:j})(),description:"",price:{quantity:u.quantity,amount:((h=u.productWithVariant)==null?void 0:h.price.amount)||0,currency:(d=u.productWithVariant)==null?void 0:d.price.currency},subscriptionSettings:(g=t.order)!=null&&g.subscriptionOrderId?(p=u.productWithVariant)==null?void 0:p.subscriptionSettings:null}}))||[]},[t]);return e.jsxRuntimeExports.jsx("div",{className:ce.chargeItemsContainer,children:e.jsxRuntimeExports.jsxs("div",{className:ce.chargeItemsInner,children:[e.jsxRuntimeExports.jsx(lt,{expiresAt:t==null?void 0:t.expiresAt}),e.jsxRuntimeExports.jsxs("div",{className:`${ce.productsContainer} ${o?ce.antistockLayout:""}`,children:[(t==null?void 0:t.name)&&e.jsxRuntimeExports.jsxs("header",{className:ce.chargeHeader,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{className:ce.chargeTitle,id:"h5",children:t.name}),t.description&&e.jsxRuntimeExports.jsx("p",{className:ce.chargeDescription,id:"md",children:t.description})]}),((a=t.order)==null?void 0:a.id)&&!o&&e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Secondary",className:ce.copyButton,onClick:()=>{var c;return n(((c=t.order)==null?void 0:c.id)||"")},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"}),"Copy Order ID"]})]}),e.jsxRuntimeExports.jsxs("div",{className:o?ce.mainContentAntistock:"",style:o?void 0:{flex:1},children:[!!r.length&&e.jsxRuntimeExports.jsx("div",{className:ce.productsList,children:r.map(c=>e.jsxRuntimeExports.jsx(Zt,{product:c},c.id))}),e.jsxRuntimeExports.jsx(ut,{formatter:i,coupon:null,total:(t==null?void 0:t.price.amount)||0,discount:0,totalWithDiscount:(t==null?void 0:t.price.amount)||0,isShowSubtotal:!1}),o&&t&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:ce.desktopTrackPayment,children:e.jsxRuntimeExports.jsx(e.TrackPayment,{timeline:t.timeline})}),e.jsxRuntimeExports.jsx(_e,{className:ce.desktopFooter})]})]}),!o&&e.jsxRuntimeExports.jsx(_e,{className:`${ce.footerContainer} ${o?ce.footerContainerAntistock:""}`})]})]})})},Np="_checkoutOrderMainData_hqf60_1",Tp="_orderDetailRow_hqf60_6",Lp="_chargeIdRow_hqf60_16",Pp="_detailLabel_hqf60_25",Ap="_detailValue_hqf60_29",Bp="_chargeIdContainer_hqf60_33",Mp="_chargeId_hqf60_16",$p="_copyIcon_hqf60_51",ee={checkoutOrderMainData:Np,orderDetailRow:Tp,chargeIdRow:Lp,detailLabel:Pp,detailValue:Ap,chargeIdContainer:Bp,chargeId:Mp,copyIcon:$p},Ro=({lastUpdate:t,invoiceId:n,email:o,paymentType:s,orderId:i})=>{const r=e.useCopy(),[a,c]=m.useState(null),u=a==null?void 0:a.find(d=>d.name===s);m.useEffect(()=>{a||(async()=>{if(!s)return;const g=[s],p=await e.getGatewaysDetail(g);c(p)})()},[s,a]);const h=d=>{const g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],p=d.getDate().toString().padStart(2,"0"),I=g[d.getMonth()],j=d.getFullYear(),l=d.getHours(),C=d.getMinutes().toString().padStart(2,"0"),x=d.getSeconds().toString().padStart(2,"0"),_=l>=12?"PM":"AM",f=(l%12||12).toString().padStart(2,"0");return`${I} ${p}, ${j} at ${f}:${C}:${x} ${_}`};return e.jsxRuntimeExports.jsxs("div",{className:ee.checkoutOrderMainData,children:[e.jsxRuntimeExports.jsxs("div",{className:ee.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:ee.detailLabel,id:"md",children:"Last Updated"}),e.jsxRuntimeExports.jsx("p",{className:ee.detailValue,id:"md",children:h(new Date(t))})]}),s&&e.jsxRuntimeExports.jsxs("div",{className:ee.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:ee.detailLabel,id:"md",children:"Payment Type"}),e.jsxRuntimeExports.jsx("p",{className:ee.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),e.jsxRuntimeExports.jsxs("div",{className:ee.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:ee.detailLabel,id:"md",children:"Email"}),e.jsxRuntimeExports.jsx("p",{className:ee.detailValue,id:"md",children:o})]}),n&&e.jsxRuntimeExports.jsxs("div",{className:ee.chargeIdRow,children:[e.jsxRuntimeExports.jsx("p",{className:ee.detailLabel,id:"md",children:"Charge ID"}),e.jsxRuntimeExports.jsxs("div",{className:ee.chargeIdContainer,children:[e.jsxRuntimeExports.jsx("p",{className:ee.chargeId,id:"md",children:n}),e.jsxRuntimeExports.jsx("div",{className:ee.copyIcon,onClick:()=>r(n),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})]}),i&&e.jsxRuntimeExports.jsxs("div",{className:ee.chargeIdRow,children:[e.jsxRuntimeExports.jsx("p",{className:ee.detailLabel,id:"md",children:"Order ID"}),e.jsxRuntimeExports.jsxs("div",{className:ee.chargeIdContainer,children:[e.jsxRuntimeExports.jsx("p",{className:ee.chargeId,id:"md",children:i}),e.jsxRuntimeExports.jsx("div",{className:ee.copyIcon,onClick:()=>r(i),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})]})]})},Fp="_bottomSheet_1yai1_1",Dp="_formContainer_1yai1_8",Hp="_error_1yai1_14",Op="_buttonGroup_1yai1_18",Up="_buttonWrapper_1yai1_28",Wp="_fullWidthButton_1yai1_31",Gp="_modal_1yai1_41",qp="_header_1yai1_48",Ae={bottomSheet:Fp,formContainer:Dp,error:Hp,buttonGroup:Op,buttonWrapper:Up,fullWidthButton:Wp,modal:Gp,header:qp},Vp=({chargeId:t,setIsOpen:n})=>{const[o,s]=m.useState(""),[i,r]=m.useState(""),{setIsOpen:a}=e.useModalStore(),c=d=>{try{return new URL(d),!0}catch{return!1}},u=async d=>{if(d.preventDefault(),!o){r("The link field cannot be empty.");return}if(!c(o)){r("Please enter a valid URL");return}await pn({url:o},t)&&(alert("CashApp successfully verified"),n(!1))},h=()=>{a(!1),setTimeout(()=>{n(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:Ae.modal,onClick:d=>d.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Ae.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:h,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsx("form",{onSubmit:u,children:e.jsxRuntimeExports.jsxs("div",{className:Ae.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Ae.formContainer,children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.Input$1,{value:o,onChange:d=>{s(d),r("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),i&&e.jsxRuntimeExports.jsx("p",{className:Ae.error,children:i})]})}),e.jsxRuntimeExports.jsxs("div",{className:Ae.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ae.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:h,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Ae.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},zp="_container_1opbn_1",Zp="_productDetails_1opbn_8",Xp="_imageContainer_1opbn_14",Yp="_image_1opbn_14",Kp="_textContainer_1opbn_32",Jp="_header_1opbn_40",Qp="_title_1opbn_46",em="_price_1opbn_53",tm="_badgeContainer_1opbn_57",om="_description_1opbn_61",be={container:zp,productDetails:Zp,imageContainer:Xp,image:Yp,textContainer:Kp,header:Jp,title:Qp,price:em,badgeContainer:tm,description:om},nm=({subscription:t})=>e.jsxRuntimeExports.jsxs("div",{className:be.container,children:[e.jsxRuntimeExports.jsxs("div",{className:be.productDetails,children:[e.jsxRuntimeExports.jsx("div",{className:be.imageContainer,children:t!=null&&t.image?e.jsxRuntimeExports.jsx("img",{className:be.image,src:e.convertCfImageIdToUrl(t.image.cfId),alt:t==null?void 0:t.name}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image"})}),e.jsxRuntimeExports.jsxs("div",{className:be.textContainer,children:[e.jsxRuntimeExports.jsx("div",{className:be.header,children:e.jsxRuntimeExports.jsx("h2",{className:be.title,children:t.name})}),e.jsxRuntimeExports.jsxs("p",{className:be.price,children:[e.formatPrice(t.price)," / ",t.recurringInterval]})]}),e.jsxRuntimeExports.jsx("div",{className:be.badgeContainer,children:e.jsxRuntimeExports.jsx(e.SubscriptionStatusBadge,{status:t.status})})]}),t.description&&e.jsxRuntimeExports.jsx(e.Markdown,{className:be.description,children:t.description})]}),sm="_card_69liy_1",rm="_price_69liy_10",im="_interval_69liy_17",am="_name_69liy_22",cm="_description_69liy_28",lm="_currentPlan_69liy_32",um="_selectButton_69liy_45",dm="_progressSection_69liy_50",pm="_progressLabel_69liy_54",mm="_bottomSheet_69liy_60",xm="_title_69liy_69",hm="_typeSelector_69liy_80",gm="_typeOption_69liy_90",jm="_active_69liy_100",Im="_saveTag_69liy_108",fm="_planSelector_69liy_117",Sm="_modal_69liy_127",Cm="_inactive_69liy_148",_m="_notMounted_69liy_151",vm="_closeButton_69liy_157",K={card:sm,price:rm,interval:im,name:am,description:cm,currentPlan:lm,selectButton:um,progressSection:dm,progressLabel:pm,bottomSheet:mm,title:xm,typeSelector:hm,typeOption:gm,active:jm,saveTag:Im,planSelector:fm,modal:Sm,inactive:Cm,notMounted:_m,closeButton:vm},Rm=({variant:t,onSelect:n,isCurrent:o})=>{const s=t.subscriptionSettings.recurringIntervalDays===30?"month":t.subscriptionSettings.recurringIntervalDays===365?"year":"period",i=t.subscriptionSettings.price.amount.toFixed(2),r=t.subscriptionSettings.recurringIntervalDays,a=10;return e.jsxRuntimeExports.jsxs("div",{className:K.card,onClick:n,children:[e.jsxRuntimeExports.jsxs("h2",{className:K.price,children:["$",i," ",e.jsxRuntimeExports.jsxs("span",{className:K.interval,children:["/ ",s]})]}),e.jsxRuntimeExports.jsx("h3",{className:K.name,children:t.name}),t.description&&e.jsxRuntimeExports.jsx("p",{className:K.description,children:t.description}),o?e.jsxRuntimeExports.jsxs("div",{className:K.currentPlan,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check"}),"Your current Plan"]}):e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",className:K.selectButton,children:"Select"}),o&&e.jsxRuntimeExports.jsxs("div",{className:K.progressSection,children:[e.jsxRuntimeExports.jsx(Co,{percent:a/r*100,disablePercentLabel:!0}),e.jsxRuntimeExports.jsxs("p",{className:K.progressLabel,children:["Used: ",a," of ",r," days"]})]})]})},Em=({isOpen:t,setIsOpen:n,subscription:o})=>{const[s,i]=m.useState(null),[r,a]=m.useState(null),[c,u]=m.useState(null),{id:h,accessToken:d}=e.useParams(),[g,p]=m.useState(!1),[I,j]=m.useState(!1),{setIsOpen:l}=e.useModalStore();m.useEffect(()=>{t&&p(!0)},[t]);const C=()=>{n(!1)},[x,_]=m.useState(null);m.useEffect(()=>{h&&d&&(async()=>{if(h&&d){const{data:R}=await e.getSubscriptionUpgradePlans({id:h,accessToken:d});_(R)}})()},[h,d]),m.useEffect(()=>{var S;if(x!=null&&x.data.types[0]){const R=(S=x.data.types.flatMap(w=>w.productVariants).find(w=>w.data.id===(o==null?void 0:o.variantId)))==null?void 0:S.data;R&&(u(R),a(R))}},[x,o]),m.useEffect(()=>{x!=null&&x.data.types[0]&&i(x==null?void 0:x.data.types[0])},[x==null?void 0:x.data.types]);const f=S=>{i(S),a(null)},v=S=>{a(S),l(!0),j(!0)};return e.jsxRuntimeExports.jsxs("div",{className:e.clx(K.modal,{[K.active]:t,[K.inactive]:!t&&g,[K.notMounted]:!g}),onClick:S=>S.stopPropagation(),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:C,hoverable:!0,className:K.closeButton,fill:"var(--text-primary)"}),e.jsxRuntimeExports.jsxs("div",{className:K.bottomSheet,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:K.title,children:"Change Plan"}),e.jsxRuntimeExports.jsx("p",{className:K.description,children:x==null?void 0:x.data.description}),e.jsxRuntimeExports.jsx("div",{className:K.typeSelector,children:x==null?void 0:x.data.types.map(S=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(K.typeOption,{[K.active]:(s==null?void 0:s.id)===S.id}),onClick:()=>f(S),children:[S.name,S.name==="Yearly"&&e.jsxRuntimeExports.jsx("span",{className:K.saveTag,children:"Save %"})]},S.id))}),s&&e.jsxRuntimeExports.jsx("div",{className:K.planSelector,children:s.productVariants.map(S=>e.jsxRuntimeExports.jsx(Rm,{variant:S.data,isSelected:(r==null?void 0:r.id)===S.data.id,isCurrent:(c==null?void 0:c.id)===S.data.id,onSelect:()=>v(S.data)},S.data.id))})]}),I&&r&&o&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{j(!1)},children:e.jsxRuntimeExports.jsx(hx,{setIsOpen:j,selectedVariant:r,subscription:o})})]})},ym="_container_nb625_1",bm="_title_nb625_11",wm="_subtitle_nb625_16",km="_info_nb625_20",_t={container:ym,title:bm,subtitle:wm,info:km},Nm=()=>{const{subscription:t}=e.useSubscriptionStore(),[n,o]=e.extractDateAndTime((t==null?void 0:t.activeTo)||""),[s,i]=m.useState(!1),{setIsOpen:r}=e.useModalStore();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:_t.container,children:[e.jsxRuntimeExports.jsxs("div",{className:_t.info,children:[e.jsxRuntimeExports.jsx("p",{className:_t.title,children:"Expiration Date"}),e.jsxRuntimeExports.jsxs("p",{className:_t.subtitle,children:[n," at ",o]})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:a=>{a.stopPropagation(),r(!0),i(!0)},children:"Extend"})]}),s&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Px,{setIsOpen:i})})]})},Tm="_couponContainer_1sspa_1",Lm="_iconWrapper_1sspa_10",Pm="_details_1sspa_21",Am="_title_1sspa_25",Bm="_progress_1sspa_29",Mm="_foreverText_1sspa_34",Ye={couponContainer:Tm,iconWrapper:Lm,details:Pm,title:Am,progress:Bm,foreverText:Mm},$m=({coupon:t,currency:n})=>{const o=t.isFixed?e.formatPrice({amount:t.discount,currency:n}):`${t.discount}%`,s=t.initialCouponDurationForSubscriptions?e.percentageDifference(t.initialCouponDurationForSubscriptions,t.currentCouponDurationForSubscriptions||1):100;return e.jsxRuntimeExports.jsxs("div",{className:Ye.couponContainer,children:[e.jsxRuntimeExports.jsx("div",{className:Ye.iconWrapper,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CheckCircle"})}),e.jsxRuntimeExports.jsxs("div",{className:Ye.details,children:[e.jsxRuntimeExports.jsxs("p",{className:Ye.title,children:[t.name,", ",o," discount"]}),e.jsxRuntimeExports.jsx("div",{className:Ye.progress,children:e.jsxRuntimeExports.jsx(Co,{color:"#C2C2C2",percent:s,disablePercentLabel:!0})}),e.jsxRuntimeExports.jsx("p",{className:Ye.foreverText,children:"Forever discount code"})]})]})},Fm="_paymentMethodContainer_1g0da_4",Dm="_paymentMethodTitle_1g0da_15",Hm="_activeMethod_1g0da_20",Om="_noMethod_1g0da_28",Um="_activeMethodPaymentMethod_1g0da_37",Wm="_paymentMethodLogo_1g0da_47",Gm="_paymentMethodNumber_1g0da_57",qm="_method_1g0da_61",Me={paymentMethodContainer:Fm,paymentMethodTitle:Dm,activeMethod:Hm,noMethod:Om,activeMethodPaymentMethod:Um,paymentMethodLogo:Wm,paymentMethodNumber:Gm,method:qm},Vm="_paymentMethods_1gev0_1",zm="_modal_1gev0_14",Zm="_header_1gev0_28",Xm="_content_1gev0_37",Oe={paymentMethods:Vm,modal:zm,header:Zm,content:Xm},Ym=t=>{const{setIsLoading:n,setIsOpen:o}=t,{subscription:s,setSubscription:i}=e.useSubscriptionStore();if(!s)return null;const{id:r}=e.useParams(),a=e.useNavigate(),{notifications:c,setNotifications:u}=e.useNotificationStore(),{setPaymentMethod:h,setGateway:d,cart:g}=e.useCart(),{setIsOpen:p}=e.useModalStore();async function I(){if(j(),n(!0),r&&s){const{data:l}=await e.changeSubscriptionGateway(r,g.gateway);l.isReconnectPaymentNeeded?a(`/charges/${l.chargeId}`):(u([...c,{status:"success",id:e.v4(),message:"Your action has been successfully completed"}]),i({...s,gatewayName:g.gateway}))}else u([...c,{status:"error",id:e.v4(),message:"Your action has been failed. Try again!"}]);n(!1)}function j(){p(!1),setTimeout(()=>{o(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Oe.modal,onClick:l=>{l.stopPropagation()},children:[e.jsxRuntimeExports.jsxs("div",{className:Oe.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Oe.title,children:"Choose Payment Method"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:j,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Oe.content,children:[(s==null?void 0:s.availableGateways)&&e.jsxRuntimeExports.jsx(vo,{possibleGateways:{availableGateways:s.availableGateways,requiresSignInGateways:s.availableGateways},setGateway:d,setPaymentMethod:h,totalAndDiscount:{total:(s==null?void 0:s.price.amount)||0,totalWithDiscount:s==null?void 0:s.price.amount},onSignInClick:()=>a("/customer-dash")}),e.jsxRuntimeExports.jsxs("div",{className:Oe.paymentMethods,children:[e.jsxRuntimeExports.jsx("div",{className:Oe.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Oe.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!g.gateway,onClick:()=>I(),children:"Continue"})})]})]})]})},Km="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20131.39%2086.9'%3e%3cdefs%3e%3cstyle%3e.a{opacity:0;}.b{fill:%23fff;}.c{fill:%23ff5f00;}.d{fill:%23eb001b;}.e{fill:%23f79e1b;}%3c/style%3e%3c/defs%3e%3ctitle%3eAsset%201%3c/title%3e%3cg%20class='a'%3e%3crect%20class='b'%20width='131.39'%20height='86.9'/%3e%3c/g%3e%3crect%20class='c'%20x='48.37'%20y='15.14'%20width='34.66'%20height='56.61'/%3e%3cpath%20class='d'%20d='M51.94,43.45a35.94,35.94,0,0,1,13.75-28.3,36,36,0,1,0,0,56.61A35.94,35.94,0,0,1,51.94,43.45Z'/%3e%3cpath%20class='e'%20d='M120.5,65.76V64.6H121v-.24h-1.19v.24h.47v1.16Zm2.31,0v-1.4h-.36l-.42,1-.42-1h-.36v1.4h.26V64.7l.39.91h.27l.39-.91v1.06Z'/%3e%3cpath%20class='e'%20d='M123.94,43.45a36,36,0,0,1-58.25,28.3,36,36,0,0,0,0-56.61,36,36,0,0,1,58.25,28.3Z'/%3e%3c/svg%3e",Jm=()=>{var j,l,C;const{subscription:t}=e.useSubscriptionStore(),{cart:n,setPaymentMethod:o}=e.useCart(),s=e.useNavigate(),[i,r]=m.useState(null),[a,c]=m.useState(!1),[u,h]=m.useState(!1),{setIsOpen:d}=e.useModalStore();if(!t)return null;const[g,p]=m.useState(t.gatewayName||n.gateway),I=n.paymentMethod;return m.useEffect(()=>{(async()=>{const _=await e.getGatewaysDetail(t.availableGateways);r(_)})()},[]),m.useEffect(()=>{n.gateway!==g&&p(n.gateway)},[n.gateway]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:Me.paymentMethodContainer,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("p",{className:Me.paymentMethodTitle,children:"Active Payment Method"}),t.gatewayInfo&&Object.keys(t.gatewayInfo).length>0&&e.jsxRuntimeExports.jsx(Qm,{gatewayInfo:t.gatewayInfo}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&g==="Balance"&&e.jsxRuntimeExports.jsx(_o,{gateway:g,gatewayDisplayName:g,total:(t==null?void 0:t.price.amount)||0,onSignInClick:()=>s("/customer-dash")}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&!g&&e.jsxRuntimeExports.jsx("span",{className:Me.noMethod,children:"Payment method is not set"}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&g&&e.jsxRuntimeExports.jsx("div",{className:Me.activeMethod,children:i&&e.jsxRuntimeExports.jsx(e.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(j=i.find(x=>x.name===g))==null?void 0:j.logoCfImageId,gatewayDisplayName:(l=i.find(x=>x.name===g))==null?void 0:l.displayName,gateway:g,poweredByLogoCfId:(C=i.find(x=>x.name===g))==null?void 0:C.poweredByImageCfImageId,className:Me.activeMethodPaymentMethod,selected:I===g,onSelect:x=>{o(x)}},g)})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:x=>{x.stopPropagation(),d(!0),h(!0)},children:n.gateway?"Change":"Manage"})]}),u&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>h(!1),children:e.jsxRuntimeExports.jsx(Ym,{setIsLoading:c,setIsOpen:h})})]})},Qm=({gatewayInfo:t})=>{var n,o,s,i,r;return e.jsxRuntimeExports.jsxs("div",{className:Me.method,children:[e.jsxRuntimeExports.jsxs("div",{className:Me.paymentMethodLogo,children:[((n=t.card)==null?void 0:n.brand.toLowerCase())==="visa"&&e.jsxRuntimeExports.jsx(e.Visa,{}),((o=t.card)==null?void 0:o.brand.toLowerCase())==="mastercard"&&e.jsxRuntimeExports.jsx("img",{src:Km,alt:"",width:22}),((s=t.card)==null?void 0:s.brand.toLowerCase())!=="visa"&&((i=t.card)==null?void 0:i.brand.toLowerCase())!=="mastercard"&&e.jsxRuntimeExports.jsx(e.Icon,{name:"CreditCard",width:22})]}),e.jsxRuntimeExports.jsxs("p",{className:Me.paymentMethodNumber,children:["•••• •••• •••• ",(r=t.card)==null?void 0:r.last4]})]})},ex="_subscriptionProductContainer_83ibx_4",tx="_subscriptionProductImage_83ibx_15",ox="_subscriptionProductInfo_83ibx_32",nx="_name_83ibx_37",sx="_price_83ibx_40",st={subscriptionProductContainer:ex,subscriptionProductImage:tx,subscriptionProductInfo:ox,name:nx,price:sx},rx=({subscription:t,id:n,accessToken:o})=>{const[s,i]=m.useState(!1),{setIsOpen:r}=e.useModalStore();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:st.subscriptionProductContainer,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:st.subscriptionProductImage,children:t!=null&&t.image?e.jsxRuntimeExports.jsx("img",{src:e.convertCfImageIdToUrl(t.image.cfId)}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image"})}),e.jsxRuntimeExports.jsxs("div",{className:st.subscriptionProductInfo,children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:e.jsxRuntimeExports.jsx("h2",{className:st.name,children:t.name})}),e.jsxRuntimeExports.jsxs("p",{className:st.price,children:[e.formatPrice(t.price)," / ",t.recurringInterval]})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:a=>{a.preventDefault(),i(!0),r(!0)},children:"Cancel"})]}),s&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Vx,{accessToken:o,id:n,isOpen:s,setIsOpen:i})})]})},ix="_content_5ctxw_1",ax="_selectedPlan_5ctxw_37",cx="_planName_5ctxw_44",lx="_description_5ctxw_48",ux="_price_5ctxw_51",dx="_buttonGroup_5ctxw_79",px="_buttonWrapper_5ctxw_84",mx="_modal_5ctxw_88",xx="_header_5ctxw_95",Ie={content:ix,selectedPlan:ax,planName:cx,description:lx,price:ux,buttonGroup:dx,buttonWrapper:px,modal:mx,header:xx},hx=({setIsOpen:t,selectedVariant:n,subscription:o})=>{if(!n)return null;const{setIsOpen:s}=e.useModalStore(),i=()=>{r()},r=()=>{s(!1),setTimeout(()=>{t(!1)},300)},a=(n.subscriptionSettings.compareAtPrice||n.subscriptionSettings.price).amount,c=n.subscriptionSettings.compareAtPrice?n.subscriptionSettings.compareAtPrice.amount-n.subscriptionSettings.price.amount:n.subscriptionSettings.price.amount,u=a-c,h=new Intl.NumberFormat("en-US",{style:"currency",currency:o.price.currency});return e.jsxRuntimeExports.jsxs("div",{className:Ie.modal,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:()=>r(),fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ie.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.content,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.selectedPlan,children:[e.jsxRuntimeExports.jsx("h2",{className:Ie.planName,children:n.name}),e.jsxRuntimeExports.jsx("p",{className:Ie.description,children:n.description}),e.jsxRuntimeExports.jsxs("p",{className:Ie.price,children:["$",n.subscriptionSettings.price.amount.toFixed(2)," /"," ",n.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),e.jsxRuntimeExports.jsx(ut,{formatter:h,coupon:null,total:u,discount:c})]}),e.jsxRuntimeExports.jsxs("div",{className:Ie.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ie.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:()=>r(),children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:Ie.buttonWrapper,children:e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Primary",onClick:i,children:["Upgrade for $",u.toFixed(2)]})})]})]})]})},gx="_reviewMessage_1t8u4_1",jx="_leaveReviewContainer_1t8u4_11",Ix="_leaveReviewTitle_1t8u4_20",Ot={reviewMessage:gx,leaveReviewContainer:jx,leaveReviewTitle:Ix},fx=({review:t,orderId:n,className:o})=>{const[s,i]=m.useState((t==null?void 0:t.rating)||0),[r,a]=m.useState(!1),{setIsOpen:c}=e.useModalStore(),{notifications:u,setNotifications:h}=e.useNotificationStore(),d=async g=>{t&&"accessToken"in t&&(await gn({comment:g,rating:s,tsId:e.getTsId()},n,t.accessToken),h([...u,{status:"success",id:e.v4(),message:"Review left successfully"}]),a(!1))};return m.useEffect(()=>{t&&s&&"accessToken"in t&&!t.rating&&(c(!0),a(!0))},[s]),t?t.rating&&"accessToken"in t?e.jsxRuntimeExports.jsxs("div",{className:Ot.reviewMessage,children:["You left a ",t.rating," star rating"]}):e.jsxRuntimeExports.jsxs("div",{className:e.clx(Ot.leaveReviewContainer,o),children:[e.jsxRuntimeExports.jsx("p",{className:Ot.leaveReviewTitle,children:"Leave a review"}),e.jsxRuntimeExports.jsx(au,{rating:s,setRating:i,disabled:!!t.rating||!("accessToken"in t)}),r&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>a(!1),children:e.jsxRuntimeExports.jsx(bx,{setIsOpen:a,onSubmit:d})})]}):null},Sx="_bottomSheet_1bcyj_1",Cx="_content_1bcyj_7",_x="_title_1bcyj_18",vx="_buttonGroup_1bcyj_22",Rx="_buttonWrapper_1bcyj_33",Ex="_modal_1bcyj_37",yx="_header_1bcyj_44",Be={bottomSheet:Sx,content:Cx,title:_x,buttonGroup:vx,buttonWrapper:Rx,modal:Ex,header:yx},bx=({setIsOpen:t,onSubmit:n})=>{const[o,s]=m.useState(""),{setIsOpen:i}=e.useModalStore(),r=()=>{i(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:Be.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Be.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Be.title,children:"Review Description"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Be.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Be.content,children:e.jsxRuntimeExports.jsx(e.Textarea$1,{placeholder:"Great product and fast checkout...",value:o,onChange:a=>s(a),label:"Describe your review in detail below"})}),e.jsxRuntimeExports.jsxs("div",{className:Be.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Be.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:r,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Be.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!o,onClick:()=>{r(),n(o)},children:"Submit"})})]})]})]})},wx="_container_1idhv_1",kx="_buttonGroup_1idhv_8",Nx="_buttonWrapper_1idhv_15",Tx="_header_1idhv_19",Lx="_content_1idhv_28",Ue={container:wx,buttonGroup:kx,buttonWrapper:Nx,header:Tx,content:Lx},Px=({setIsOpen:t})=>{const{subscription:n}=e.useSubscriptionStore(),{getTotalAndDiscount:o,cart:s,coupon:i}=e.useCart(),[r,a]=m.useState(1),c=e.useNavigate(),{setIsOpen:u}=e.useModalStore(),{setNotifications:h,notifications:d}=e.useNotificationStore(),[g,p]=m.useState(!1),I=m.useMemo(()=>o(),[i,s]),j=m.useMemo(()=>I.totalWithDiscount?I.total-I.totalWithDiscount:0,[I]);if(g)return e.jsxRuntimeExports.jsx(e.ProcessingPaymentModal,{});const l=(n==null?void 0:n.price.currency)||"USD",C=new Intl.NumberFormat("en-US",{style:"currency",currency:l});async function x(){var f;p(!0);try{const{data:v}=await e.extendSubscription((n==null?void 0:n.id)||"",{});h([{id:e.v4(),message:"Order created successfully",status:"success"}]),c(`/orders/${(f=v.data)==null?void 0:f.id}/${v.data.fullAccessToken}`)}catch(v){const S=v;h([...d,{id:e.v4(),message:`Order creation failed: ${S.message}`,status:"error"}]),_()}finally{p(!1)}}function _(){u(!1),setTimeout(()=>{t(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Ue.container,onClick:f=>f.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Ue.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ue.title,children:"Extend Subscription"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:_,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ue.content,children:[e.jsxRuntimeExports.jsx(fu,{step:r,totalSteps:12,onStepChange:a,label:"How long would you like to extend your subscription for?"}),e.jsxRuntimeExports.jsx(ut,{formatter:C,coupon:i,total:I.total,discount:j,totalWithDiscount:I.totalWithDiscount}),e.jsxRuntimeExports.jsxs("div",{className:Ue.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ue.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:_,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Ue.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:x,children:"Extend"})})]})]})]})},Ax="_bottomSheet_uw5jb_1",Bx="_content_uw5jb_7",Mx="_radioGroup_uw5jb_11",$x="_confirmation_uw5jb_26",Fx="_iconWrapper_uw5jb_33",Dx="_title_uw5jb_42",Hx="_message_uw5jb_48",Ox="_buttonGroup_uw5jb_54",Ux="_buttonWrapper_uw5jb_64",Wx="_modal_uw5jb_68",Gx="_header_uw5jb_77",se={bottomSheet:Ax,content:Bx,radioGroup:Mx,confirmation:$x,iconWrapper:Fx,title:Dx,message:Hx,buttonGroup:Ox,buttonWrapper:Ux,modal:Wx,header:Gx},qx={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},Vx=({isOpen:t,setIsOpen:n,id:o,accessToken:s})=>{const[i,r]=m.useState(0),[a,c]=m.useState(!1),[u,h]=m.useState(""),[d,g]=m.useState(""),{setIsOpen:p}=e.useModalStore(),I=async()=>{if(!u)return;c(!0);const l=await e.cancelSubscription(o,s,{reason:u==="Other reason"?d:u});c(!1),l&&r(2)};m.useEffect(()=>{t||(r(0),h(""),g(""))},[t]);const j=()=>{p(!1),setTimeout(()=>{n(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:se.modal,onClick:l=>l.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:se.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:qx[i]||""}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:j,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:se.content,children:[i===0&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),e.jsxRuntimeExports.jsxs("div",{className:se.radioGroup,children:[e.jsxRuntimeExports.jsx(e.Radio,{defaultValue:u,onChange:l=>h(l),options:[{value:"Found another company",label:"Found another company"},{value:"Expensive",label:"Expensive"},{value:"Technical problems",label:"Technical problems"},{value:"Support problems",label:"Support problems"},{value:"Other reason",label:"Other reason"}],flexDirection:"column"}),u==="Other reason"&&e.jsxRuntimeExports.jsx(e.Textarea$1,{value:d,onChange:l=>g(l),placeholder:"Describe the reason..."})]}),e.jsxRuntimeExports.jsxs("div",{className:se.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:()=>u&&r(1),disabled:!u,children:"Continue"})})]})]}),i===1&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),e.jsxRuntimeExports.jsxs("div",{className:se.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:I,disabled:a,children:"Cancel it anyway"})})]})]}),i===2&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:`${se.confirmation}`,children:[e.jsxRuntimeExports.jsx("div",{className:se.iconWrapper,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"var(--text-success)"})}),e.jsxRuntimeExports.jsx("p",{className:se.title,children:"Subscription Cancelled"}),e.jsxRuntimeExports.jsx("p",{className:se.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),e.jsxRuntimeExports.jsx("div",{className:se.buttonGroup,children:e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Close"})})})]})]})]})},zx="_checkoutContainer_cm7ux_1",Zx="_loaderContainer_cm7ux_20",Ut={checkoutContainer:zx,loaderContainer:Zx},Eo=()=>{const{isAntistock:t}=e.useGeneralStore(),{cart:n,products:o,pending:s,getTotalAndDiscount:i,getPossibleGateways:r,submitCart:a,setGateway:c,applyCoupon:u,setDiscordSocialConnectId:h,setCustomFields:d,applyCouponPending:g,coupon:p,removeCoupon:I,getDiscordSettings:j,setPaymentMethod:l,reset:C}=e.useCart(),x=m.useMemo(()=>i(),[p,n]),_=e.useNavigate();return m.useEffect(()=>{if(n.parts.length===0){if(t){_("/");return}try{_(-1)}catch{_("/")}}},[n.parts]),s?e.jsxRuntimeExports.jsx("div",{className:Ut.checkoutContainer,children:e.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})})}):e.jsxRuntimeExports.jsxs("div",{className:Ut.checkoutContainer,children:[e.jsxRuntimeExports.jsx(Ju,{cart:n,products:o,applyCoupon:u,applyCouponPending:g,coupon:p,removeCoupon:I,totalAndDiscount:x}),e.jsxRuntimeExports.jsx(Od,{cart:n,getPossibleGateways:r,setGateway:c,getDiscordSettings:j,products:o,submitCart:a,totalAndDiscount:x,setCustomFieldsToCart:d,setDiscordSocialConnectId:h,setPaymentMethod:l,reset:C,isAntistock:t})]})},Xx="_chargePageContainer_qeuie_1",Yx="_chargeItems_qeuie_14",Kx="_mainContent_qeuie_25",Jx="_contentWrapper_qeuie_44",Qx="_antistockContent_qeuie_53",eh="_statusBlock_qeuie_58",th="_statusBlockAntistock_qeuie_63",oh="_notPaidSection_qeuie_68",nh="_antistockPayNow_qeuie_82",sh="_antistockFooter_qeuie_86",rh="_antistockTrackPayment_qeuie_96",ih="_footer_qeuie_106",ah="_loaderContainer_qeuie_128",le={chargePageContainer:Xx,chargeItems:Yx,mainContent:Kx,contentWrapper:Jx,antistockContent:Qx,statusBlock:eh,statusBlockAntistock:th,notPaidSection:oh,antistockPayNow:nh,antistockFooter:sh,antistockTrackPayment:rh,footer:ih,loaderContainer:ah},ch=()=>{const{id:t}=e.useParams(),[n,o]=e.useSearchParams(),[s,i]=m.useState(!1),[r,a]=m.useState(),[c,u]=m.useState(!0),h=e.useNavigate(),d=m.useRef(),g=m.useRef(!1),{setIsOpen:p}=e.useModalStore(),{isAntistock:I}=e.useGeneralStore();return m.useEffect(()=>{const j=async(C,x=!1)=>{x||i(!0);const{data:_}=await jn(C);i(!1),a(_)},l=setInterval(()=>{t&&j(t,!0)},5e3);return t&&j(t),()=>{clearInterval(l)}},[]),m.useEffect(()=>{const j=setTimeout(()=>{var C;console.log("charge timeout",r);const l=n.get("redirectRoute");if((r==null?void 0:r.status)===e.ChargeStatus.Paid&&r.redirectUrl&&!d.current){const _=JSON.parse(localStorage.getItem("orders")||"{}")[((C=r==null?void 0:r.order)==null?void 0:C.id)||""];_?window.open(_.fullAccessToken?`${r.redirectUrl}/${_.fullAccessToken}`:`${r.redirectUrl}`,"_self"):window.open(r.redirectUrl,"_self")}(r==null?void 0:r.status)===e.ChargeStatus.Paid&&d.current&&(console.log("redirectRouteRef.current",d.current),h(d.current,{replace:!0})),l&&d&&(d.current=l,n.delete("redirectRoute"),o(n))},1e3);return()=>clearTimeout(j)},[r]),m.useEffect(()=>{((r==null?void 0:r.gateway)==="PayPalFF"||(r==null?void 0:r.gateway)==="Сashapp")&&p(!0)},[r]),m.useEffect(()=>{var j;if(r!=null&&r.displayPaymentInfo&&r.displayPaymentInfo.length===1&&r.status===e.ChargeStatus.NotPaid&&!g.current){const l=r.displayPaymentInfo[0];l.type==="Button"&&((j=l.props)!=null&&j.url)&&(window.open(l.props.url,"_blank"),g.current=!0)}},[r==null?void 0:r.displayPaymentInfo,r==null?void 0:r.status]),s?e.jsxRuntimeExports.jsx("div",{className:le.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs("div",{className:le.chargePageContainer,children:[e.jsxRuntimeExports.jsx("div",{className:le.chargeItems,children:e.jsxRuntimeExports.jsx(kp,{charge:r})}),e.jsxRuntimeExports.jsx("div",{className:le.mainContent,style:I?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(le.contentWrapper,{[le.antistockContent]:I}),children:[r&&(r==null?void 0:r.status)!==e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx(e.ChargeStatusBlock,{charge:r}),r&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(le.statusBlock,{[le.statusBlockAntistock]:I}),children:[e.jsxRuntimeExports.jsx(Ro,{lastUpdate:r.expiresAt,email:r.customerForCharge.email,invoiceId:r.id,paymentType:r.gateway}),I&&(r==null?void 0:r.status)===e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx("div",{className:le.antistockPayNow,children:r==null?void 0:r.displayPaymentInfo.map((j,l)=>e.jsxRuntimeExports.jsx(Vt,{block:j},l))}),I&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:le.antistockTrackPayment,children:e.jsxRuntimeExports.jsx(e.TrackPayment,{timeline:r.timeline})}),e.jsxRuntimeExports.jsx(_e,{className:le.antistockFooter})]})]}),!I&&(r==null?void 0:r.status)===e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx("div",{className:le.notPaidSection,children:r==null?void 0:r.displayPaymentInfo.map((j,l)=>e.jsxRuntimeExports.jsx(Vt,{block:j},l))}),!I&&e.jsxRuntimeExports.jsx(_e,{className:le.footer})]})}),(r==null?void 0:r.gateway)==="PayPalFF"&&c&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>u(!1),children:e.jsxRuntimeExports.jsx(xp,{price:r.price,setIsOpen:u})}),(r==null?void 0:r.gateway)==="Сashapp"&&c&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Vp,{setIsOpen:u,chargeId:r.id})})]})};var yo=(t=>(t.NEW="NEW",t.ANSWERED="ANSWERED",t.NOT_ANSWERED="NOT_ANSWERED",t.CLOSED="CLOSED",t))(yo||{});const lh="_wrapper_3txfs_1",uh="_ticketContainer_3txfs_23",dh="_title_3txfs_28",ph="_subtext_3txfs_35",mh="_container_3txfs_41",xh="_content_3txfs_52",hh="_messages_3txfs_63",gh="_input_3txfs_81",jh="_textarea_3txfs_94",Ih="_textareaAntistock_3txfs_123",fh="_message_3txfs_63",Sh="_messageDate_3txfs_153",Ch="_messageAntistock_3txfs_159",_h="_myMessage_3txfs_163",vh="_otherMessage_3txfs_170",Rh="_button_3txfs_177",Eh="_disabled_3txfs_177",yh="_loadingMessage_3txfs_203",J={wrapper:lh,ticketContainer:uh,title:dh,subtext:ph,container:mh,content:xh,messages:hh,input:gh,textarea:jh,textareaAntistock:Ih,message:fh,messageDate:Sh,messageAntistock:Ch,myMessage:_h,otherMessage:vh,button:Rh,disabled:Eh,loadingMessage:yh},bh=()=>{const t=window.location.pathname.split("/"),n=t[t.length-1],o=t[t.length-2],[s,i]=m.useState(!0),[r,a]=m.useState(null),[c,u]=m.useState(""),[h,d]=m.useState(null),{executeRecaptcha:g}=e.useReCaptcha(),{isAntistock:p}=e.useGeneralStore(),I=(r==null?void 0:r.status)===yo.CLOSED,j=async()=>{if(o&&n){const{data:x}=await e.fetchTicket(o,n);a(x),i(!1)}};m.useEffect(()=>{j();const x=setInterval(()=>{j()},5e3);return()=>clearInterval(x)},[]);const l=async()=>{const x=await g();if(!o||!n||!x||!c.trim())return;const _={content:c,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};a(f=>f?{...f,messages:[...f.messages,_]}:null),d(_.id),u("");try{await e.sendTicketMessage(o,n,c,x,e.getTsId()),await j()}finally{setTimeout(()=>{d(null)},1e4)}},C=x=>{const _=new Date,f=new Date(x),v=Math.floor((_.getTime()-f.getTime())/1e3);if(v<60)return"just now";if(v<3600){const S=Math.floor(v/60);return`${S} minute${S>1?"s":""} ago`}else if(v<10800){const S=Math.floor(v/3600);return`${S} hour${S>1?"s":""} ago`}else return f.getFullYear()===_.getFullYear()?f.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):f.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return e.jsxRuntimeExports.jsx("div",{className:J.wrapper,children:s&&!r?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs("div",{className:J.container,children:[p?e.jsxRuntimeExports.jsxs("div",{className:J.ticketContainer,children:[e.jsxRuntimeExports.jsx("div",{className:J.title,style:{fontSize:"var(--font-heading-h3-size)"},children:r==null?void 0:r.title}),e.jsxRuntimeExports.jsx("div",{className:J.subtext,style:{fontSize:"var(--font-body-md-size)"},children:"We’re going to respond to your ticket shortly. You’ll receive updates in your email inbox. Feel free to close this page."})]}):e.jsxRuntimeExports.jsx("div",{className:J.title,children:`#${o} (${r==null?void 0:r.title})`}),e.jsxRuntimeExports.jsxs("div",{className:J.content,style:{position:p?"relative":void 0,border:p?"1px solid var(--border-secondary)":void 0},children:[e.jsxRuntimeExports.jsx("div",{className:J.messages,children:r==null?void 0:r.messages.sort((x,_)=>new Date(x.createdAt).getTime()-new Date(_.createdAt).getTime()).map(x=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(J.message,{[J.messageAntistock]:p,[J.myMessage]:!x.isSellerReply,[J.otherMessage]:x.isSellerReply,[J.loadingMessage]:h===x.id}),children:[e.jsxRuntimeExports.jsx("div",{className:J.messageContent,children:e.splitTextIntoSpans(x.content,!1)}),h!==x.id&&e.jsxRuntimeExports.jsx("div",{className:J.messageDate,children:C(x.createdAt)}),h===x.id&&e.jsxRuntimeExports.jsx("div",{className:J.messageDate,children:e.jsxRuntimeExports.jsx(e.Loader,{})})]},x.id))}),e.jsxRuntimeExports.jsxs("div",{className:J.input,children:[e.jsxRuntimeExports.jsx("textarea",{disabled:I,className:e.clx(J.textarea,{[J.textareaAntistock]:p}),value:c,placeholder:I?"The ticket has been closed. Need further assistance? Please submit a new request.":p?"Type a message...":"What worries you?",onChange:x=>u(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),l())}}),e.jsxRuntimeExports.jsx("div",{onClick:l,className:e.clx(J.button,{[J.disabled]:I}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"PaperPlaneRight"})})]})]})]})})},wh="_subscriptionContainer_1j6ol_1",kh="_leftSection_1j6ol_15",Nh="_content_1j6ol_26",Th="_mainContent_1j6ol_33",Lh="_detailsSection_1j6ol_37",Ph="_buttonGroup_1j6ol_50",Ah="_detailsContent_1j6ol_57",We={subscriptionContainer:wh,leftSection:kh,content:Nh,mainContent:Th,detailsSection:Lh,buttonGroup:Ph,detailsContent:Ah},Bh=()=>{const{id:t,accessToken:n}=e.useParams(),{subscription:o,setSubscription:s}=e.useSubscriptionStore(),{setIsOpen:i}=e.useModalStore(),[r,a]=m.useState(!1),[c,u]=m.useState(!1);m.useLayoutEffect(()=>{s(null)},[t,n]);const{balanceSettings:h,setBalanceSettings:d}=e.useCustomerDashboardStore();return m.useEffect(()=>{t&&n&&(async()=>{if(!t||!n)return;u(!0);const{data:p}=await e.fetchSubscription(t,n);s({...p}),u(!1)})()},[t,n]),m.useEffect(()=>{h||(async()=>{const p=await e.getBalanceSettings();d(p)})()},[h]),c?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:We.subscriptionContainer,children:[e.jsxRuntimeExports.jsx("div",{className:We.leftSection,children:e.jsxRuntimeExports.jsxs("div",{className:We.content,children:[e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsxs("div",{className:We.mainContent,children:[o&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),e.jsxRuntimeExports.jsx(nm,{subscription:{price:o.price,name:o.productName,description:o.productDescription,status:o.status,image:o.productImage,recurringInterval:o.recurringInterval}}),e.jsxRuntimeExports.jsx("div",{className:We.buttonGroup,children:o.pricingPlanExists&&e.jsxRuntimeExports.jsx(e.Button$1,{onClick:g=>{g.stopPropagation(),i(!0),a(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),e.jsxRuntimeExports.jsx(_e,{})]})]})}),e.jsxRuntimeExports.jsx("div",{className:We.detailsSection,children:e.jsxRuntimeExports.jsxs("div",{className:We.detailsContent,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(o==null?void 0:o.coupon)&&e.jsxRuntimeExports.jsx($m,{coupon:o.coupon,currency:o.price.currency||"USD"}),o&&e.jsxRuntimeExports.jsx(rx,{id:t||"",accessToken:n||"",subscription:{price:o.price,name:o.productName,description:o.productDescription,status:o.status,image:o.productImage,recurringInterval:o.recurringInterval}}),o&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Jm,{}),o.activeTo&&e.jsxRuntimeExports.jsx(Nm,{})]}),e.jsxRuntimeExports.jsx(_e,{className:"flex md:hidden"})]})})]}),e.jsxRuntimeExports.jsx(Em,{isOpen:r,setIsOpen:a,subscription:o})]})},Mh="_topUpContainer_1pag6_1",$h="_formWrapper_1pag6_15",Fh="_header_1pag6_29",Dh="_footer_1pag6_82",Hh="_wrapper_1pag6_105",rt={topUpContainer:Mh,formWrapper:$h,header:Fh,footer:Dh,wrapper:Hh},Oh=()=>{const{gatewaysDetail:t,setGatewaysDetail:n,balanceSettings:o,setBalanceSettings:s}=e.useCustomerDashboardStore();return m.useEffect(()=>{!t&&o&&(async()=>{const r=await e.getGatewaysDetail(o!=null&&o.isEnabled?(o==null?void 0:o.topUpSettings.gateways)||[]:[]);n(r)})()},[t,o]),m.useEffect(()=>{o||(async()=>{const r=await e.getBalanceSettings();s(r)})()},[o]),e.jsxRuntimeExports.jsxs("div",{className:rt.wrapper,children:[e.jsxRuntimeExports.jsx(lt,{className:rt.header}),e.jsxRuntimeExports.jsx("div",{className:rt.topUpContainer,children:o?e.jsxRuntimeExports.jsx("div",{className:rt.formWrapper,children:e.jsxRuntimeExports.jsx(e.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):e.jsxRuntimeExports.jsx(e.Loader,{})}),e.jsxRuntimeExports.jsx("div",{className:rt.footer,children:e.jsxRuntimeExports.jsx(_e,{})})]})},Uh="_orderPage_gc87l_1",Wh="_leftSection_gc87l_15",Gh="_content_gc87l_35",qh="_main_gc87l_42",Vh="_mainAntistock_gc87l_56",zh="_orderMainDataAntistock_gc87l_69",Zh="_timelineBlockAntistock_gc87l_81",Xh="_footerAntistock_gc87l_92",Yh="_statusBlock_gc87l_104",Kh="_timelineBlock_gc87l_81",Jh="_footer_gc87l_92",Qh="_rightSection_gc87l_121",e2="_header_gc87l_142",t2="_productList_gc87l_150",o2="_mobileFooter_gc87l_157",n2="_loaderContainer_gc87l_166",s2="_orderMainData_gc87l_69",r2="_prices_gc87l_181",i2="_headerTitle_gc87l_185",a2="_headerDescription_gc87l_189",Q={orderPage:Uh,leftSection:Wh,content:Gh,main:qh,mainAntistock:Vh,orderMainDataAntistock:zh,timelineBlockAntistock:Zh,footerAntistock:Xh,statusBlock:Yh,timelineBlock:Kh,footer:Jh,rightSection:Qh,header:e2,productList:t2,mobileFooter:o2,loaderContainer:n2,orderMainData:s2,prices:r2,headerTitle:i2,headerDescription:a2},c2=()=>{var I,j,l,C,x;const{id:t,accessToken:n}=e.useParams(),o=e.useNavigate(),[s,i]=m.useState(),[r,a]=m.useState(!1),c=e.useCopy(),{isAntistock:u}=e.useGeneralStore(),h=((I=s==null?void 0:s.rawPrice)==null?void 0:I.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),g=m.useMemo(()=>(s==null?void 0:s.partOrders.map(_=>{var f,v;return{id:(_==null?void 0:_.id)||0,image:_.productWithVariant.image,name:(()=>{var w,D;const S=((w=_.productWithVariant)==null?void 0:w.name)||"",R=((D=_.productWithVariant)==null?void 0:D.variantName)||"";return!S&&!R?"":!R||S===R?S:S?`${S} (${R})`:R})(),description:"",price:{quantity:_.quantity,amount:((f=_.productWithVariant)==null?void 0:f.price.amount)||0,currency:(v=_.productWithVariant)==null?void 0:v.price.currency},deliveryCategories:"deliveryCategories"in _?_.deliveryCategories:void 0,customerNote:_.customerNote,chargeType:_.chargeType||"ONE_TIME"}}))||[],[s]),p=async(_,f,v=!1)=>{var R,w;v||a(!0);const{data:S}=await(f?e.fetchAuthorizedOrder(`${_}/${f}`):e.fetchOrder(_));a(!1),S.status!==e.OrderStatus.Completed&&((R=S.charge)==null?void 0:R.status)===e.ChargeStatus.NotPaid&&o(`/charges/${(w=S.charge)==null?void 0:w.id}`,{replace:!0}),i(S)};return m.useLayoutEffect(()=>{if(t&&!n){const _=JSON.parse(localStorage.getItem("orders")||"{}");_[t]&&o(`/orders/${t}/${_[t].fullAccessToken}`)}},[t]),m.useEffect(()=>{t&&p(t,n,!0);const _=setInterval(()=>{t&&p(t,n,!0)},5e3);return()=>{clearInterval(_)}},[t,n]),r?e.jsxRuntimeExports.jsx("div",{className:Q.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs("div",{className:Q.orderPage,children:[e.jsxRuntimeExports.jsx("div",{className:Q.leftSection,children:e.jsxRuntimeExports.jsxs("div",{className:Q.content,children:[e.jsxRuntimeExports.jsx(lt,{}),s&&e.jsxRuntimeExports.jsxs("div",{className:`${Q.main} ${u?Q.mainAntistock:""}`,children:[e.jsxRuntimeExports.jsx(e.OrderStatusBlock,{className:Q.statusBlock,orderStatus:s.status}),e.jsxRuntimeExports.jsxs("div",{className:`${Q.orderMainData} ${u?Q.orderMainDataAntistock:""}`,children:[e.jsxRuntimeExports.jsx(Ro,{lastUpdate:s.createdAt,paymentType:(j=s.charge)==null?void 0:j.gateway,email:s.customer.email,orderId:s.id}),"accessToken"in s.review&&!u&&e.jsxRuntimeExports.jsx(fx,{orderId:s.id,review:s.review})]}),s.charge&&s.charge.timeline&&e.jsxRuntimeExports.jsx(e.TrackPayment,{className:`${Q.timelineBlock} ${u?Q.timelineBlockAntistock:""}`,timeline:s.charge.timeline}),e.jsxRuntimeExports.jsx(_e,{className:`${Q.footer} ${u?Q.footerAntistock:""}`})]})]})}),e.jsxRuntimeExports.jsx("div",{className:Q.rightSection,style:u?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:e.jsxRuntimeExports.jsxs("div",{className:Q.content,children:[((l=s==null?void 0:s.charge)==null?void 0:l.name)&&e.jsxRuntimeExports.jsxs("header",{className:Q.header,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{className:Q.headerTitle,children:s.charge.name}),s.charge.description&&e.jsxRuntimeExports.jsx("p",{className:Q.headerDescription,children:s.charge.description})]}),u?null:e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Secondary",onClick:()=>c((s==null?void 0:s.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"}),e.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:Q.productList,children:g.map(_=>e.jsxRuntimeExports.jsx(Zt,{product:_,isOrder:!0},_.id))}),u?null:e.jsxRuntimeExports.jsx(ut,{formatter:d,coupon:null,total:((C=s==null?void 0:s.charge)==null?void 0:C.price.amount)||0,discount:0,totalWithDiscount:((x=s==null?void 0:s.charge)==null?void 0:x.price.amount)||0,className:Q.prices,isShowSubtotal:!1}),e.jsxRuntimeExports.jsx(_e,{className:Q.mobileFooter})]})]})})]})},l2=()=>{const{isAntistock:t,general:n}=e.useGeneralStore();return{isAntistock:t,general:n}},u2=t=>{const{notifications:n,setNotifications:o}=e.useNotificationStore.getState();o(n.filter(s=>s.id!==t))},d2=t=>{const{notifications:n,setNotifications:o}=e.useNotificationStore.getState(),s=e.v4();return o([...n,{id:s,...t}]),s},p2=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r,routes:a=[],shopLogo:c,apiURLs:u,isAntistock:h=!1}=t,[d,g]=m.useState(null),{general:p,setIsAntistock:I}=e.useGeneralStore(),{setApiUrls:j}=e.useApiStore(),{setBlocks:l,setSourceBlocks:C,setHeader:x,setFooter:_,setAnnouncement:f,setSettings:v}=e.useBlocksStore(),{themeSettings:S}=e.useThemeSettingsStore(),{settings:R,setSettings:w}=e.useSettingsStore(),D=e.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"":window.location.hostname,te=localStorage.getItem("shopPassword"),Z=localStorage.getItem("shopId")||"",M=localStorage.getItem("draftId")||"";return m.useEffect(()=>{I(h)},[h,I]),m.useEffect(()=>{Z||localStorage.setItem("shopId",(p==null?void 0:p.info.id)||"15124f8d-2c8c-4dda-a04c-31c16816f9b6")},[p]),m.useEffect(()=>{M||localStorage.setItem("draftId","ca18cf24-6659-4015-b1ab-9ebe9fa64e74")},[M]),m.useEffect(()=>{!D&&!h&&localStorage.setItem("fakeDomain","drafts-ca18cf24-6659-4015-b1ab-9ebe9fa64e74.bgng.io"),!D&&h&&localStorage.setItem("fakeDomain","eva8.astck.io")},[D]),m.useEffect(()=>{if(S&&R){const b=_n(S,R);wn(S),vn(b)}},[S,JSON.stringify(R),window.location.hostname]),m.useEffect(()=>{const E=new o().blockSettings;w(E)},[]),m.useLayoutEffect(()=>{const b={};Object.keys(n).map(F=>{b[F]=n[F]}),C(b),l(b),x(s),_(i),f(r),v(o),u&&j(u);const E=e.createBrowserRouter([{element:e.jsxRuntimeExports.jsx(El,{shopDomain:D,shopId:Z,shopPassword:te||void 0,shopLogo:c,children:e.jsxRuntimeExports.jsx(e.ReCaptchaProvider,{children:e.jsxRuntimeExports.jsx(Sl,{children:e.jsxRuntimeExports.jsx(e.Outlet,{})})})}),errorElement:e.jsxRuntimeExports.jsx(Cl,{}),children:[{path:"/admin/builder/*",element:e.jsxRuntimeExports.jsx(Yc,{children:e.jsxRuntimeExports.jsx(Gc,{blocks:n,settings:o,header:s,footer:i,announcement:r})}),errorElement:e.jsxRuntimeExports.jsx(Xc,{})},...a,{path:"/checkout",element:e.jsxRuntimeExports.jsx(Eo,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:e.jsxRuntimeExports.jsx(Oh,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:e.jsxRuntimeExports.jsx(ch,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(c2,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(Bh,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Subscriptions",!0)},{path:h?"/account":"/customer-dash",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100dvh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[e.jsxRuntimeExports.jsx(e.RenderAnnouncement,{}),e.jsxRuntimeExports.jsx(e.RenderHeader,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:"1 1 auto"},children:e.jsxRuntimeExports.jsx(e.CustomerDashboard,{})}),e.jsxRuntimeExports.jsx(e.RenderFooter,{})]}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title=h?"Account":"Customer Dashboard",!0)},{path:"/validation",element:e.jsxRuntimeExports.jsx(rl,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100dvh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[e.jsxRuntimeExports.jsx(e.RenderHeader,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsxRuntimeExports.jsx(e.ReCaptchaProvider,{children:e.jsxRuntimeExports.jsx(bh,{})})}),e.jsxRuntimeExports.jsx(e.RenderFooter,{})]}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:e.jsxRuntimeExports.jsx(Cn,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{})}]}]);g(E)},[p]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:d&&e.jsxRuntimeExports.jsx(e.RouterProvider,{router:d})})};exports.ReCaptchaProvider=e.ReCaptchaProvider;exports.aspectRatioOptions=e.aspectRatioOptions;exports.formatPrice=e.formatPrice;exports.parseDraftJsText=e.parseDraftJsText;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useAdaptiveStyles=e.useAdaptiveStyles;exports.useCart=e.useCart;exports.useReCaptcha=e.useReCaptcha;exports.App=p2;exports.Checkout=Eo;exports.ColorVariables=ho;exports.hotReload=kn;exports.iconNames=To;exports.removeNotification=u2;exports.showNotification=d2;exports.useBuilderPages=Tn;exports.useCreateTicket=Nn;exports.useGeneralInfo=l2;
|
package/dist/builder.es.js
CHANGED
|
@@ -7500,7 +7500,7 @@ const ou = "data:image/svg+xml,%3csvg%20width='204'%20height='241'%20viewBox='0%
|
|
|
7500
7500
|
}, _u = "_notifications_2ywhg_1", Cu = {
|
|
7501
7501
|
notifications: _u
|
|
7502
7502
|
}, Su = () => (f.useEffect(() => {
|
|
7503
|
-
document.title = "
|
|
7503
|
+
document.title = "Temporarily Unavailable";
|
|
7504
7504
|
}, []), /* @__PURE__ */ e.jsx(
|
|
7505
7505
|
"div",
|
|
7506
7506
|
{
|