@billgangcom/theme-lib 1.78.2 → 1.78.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder.cjs.js +2 -2
- package/dist/builder.es.js +300 -300
- package/dist/{index-CCqpqQ4t.js → index-CeDBTH_B.js} +36 -36
- package/dist/index.es.js +1 -1
- package/dist/lib/createTicket.d.ts +1 -1
- package/dist/ui.es.js +2 -2
- package/package.json +1 -1
package/dist/builder.cjs.js
CHANGED
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
`,n+=` --border-sm: var(--scale-1);
|
|
97
97
|
`,n+=` --border-md: var(--scale-2);
|
|
98
98
|
`,n+=` --border-lg: var(--scale-4);
|
|
99
|
-
`,n+="}",n},pc=e=>{const t=document.getElementById("dynamic-styles");if(t)t.innerHTML=e;else{const n=document.createElement("style");n.id="dynamic-styles",n.innerHTML=e,document.head.appendChild(n)}},zr=new Set,mc=e=>{const t=new Map;return Object.entries(e).forEach(([n,r])=>{typeof r=="object"&&Object.entries(r).forEach(([o,i])=>{var a,u;if(i&&i.font){const c=i.font.replace(/\s+/g,"+");t.has(c)||t.set(c,new Set),(a=t.get(c))==null||a.add(i.weight),(u=t.get(c))==null||u.add(i.boldWeight)}})}),t},fc=e=>{const t=new Map;return Object.entries(e).forEach(([n,r])=>{typeof r=="object"&&Object.keys(r).forEach(o=>{var i;if(o==="font"&&r[o]){const a=r[o].replace(/\s+/g,"+");t.has(a)||t.set(a,new Set),(i=t.get(a))==null||i.add("400")}})}),t},gc=e=>{zr.forEach(t=>{if(!e.has(t)){const n=document.querySelector(`link[data-font="${t}"]`);n&&n.remove(),zr.delete(t)}})},xc=e=>{const t=new Set;e.forEach((n,r)=>{const o=Array.from(n).join(";"),i=`${r}:wght@${o}`;if(t.add(i),!zr.has(i)){const a=document.createElement("link");a.rel="stylesheet",a.href=`https://fonts.googleapis.com/css2?family=${i}&display=swap`,a.setAttribute("data-font",i),document.head.appendChild(a),zr.add(i)}}),gc(t)},Ec=e=>{if(e.fonts){const t=mc(e.fonts.desktop),n=fc(e.buttons),r=new Map(t);n.forEach((o,i)=>{if(r.has(i)){const a=r.get(i);o.forEach(u=>a==null?void 0:a.add(u))}else r.set(i,new Set(o))}),xc(r)}};function bc(){try{const{editBlock:e,currentBlock:t,blocks:n,setHeader:r,setFooter:o,setAnnouncement:i}=s.useLayersStore.getState(),{currentPage:a,pages:u}=s.usePagesStore.getState(),{currentInstance:c,settingsInstance:d}=s.useBlocksStore.getState(),{setSettings:p}=s.useSettingsStore.getState();if(t||p(d),c&&t){if(t==="header")r(c);else if(t==="footer")o(c);else if(t==="announcement")i(c);else if(t==="header"||t==="footer"||t==="announcement")throw new Error(`Missing ${t} data.`)}if(c&&u&&t&&!["header","footer","announcement"].includes(t)){const h={blockSettings:{}};if(!c.blockSettings)throw new Error("currentInstance.blockSettings is undefined.");if(Object.keys(c.blockSettings).filter(f=>!["displayName","isAddable"].includes(f)).forEach(f=>{h.blockSettings[f]=c.blockSettings[f]}),!u[a])throw new Error(`Page "${a}" does not exist.`);if(!n[u[a].path].data||!n[u[a].path].data[t])throw new Error(`Layer or block for page "${u[a].path}" and block "${t}" does not exist.`);e(u[a].path,t,{name:n[u[a].path].data[t].name,value:h})}}catch(e){console.error("Error in hotReload function:",e)}}const Ic=()=>{const e=s.useApiStore.getState().apiUrls,t=s.useNavigate(),{notifications:n,setNotifications:r}=s.useNotificationStore();return async(o,i,a,u,c)=>{const d=s.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,p=`${e.slApi}/v1/public/${d}/tickets`;try{const h=await s.request({method:"post",url:p,body:{title:o,firstMessage:i,email:u,recaptcha:a,tsId:c},withToken:!1});return r([...n,{id:s.v4(),message:"Ticket created successfully. We will contact you by mail",status:"success"}]),t(`/ticket/${h.data.id}/${h.data.accessToken}`),h}catch(h){r([...n,{id:s.v4(),message:`Error: ${h}. Please try again later.`,status:"error"}])}}},Tc=()=>{const{pages:e}=s.usePagesStore(),[t,n]=k.useState(e);return k.useEffect(()=>{n(e)},[e]),t},_c="_tooltip_4hruj_1",Cc={tooltip:_c},Tn=e=>{const{text:t}=e,{setShowTooltip:n}=s.useTooltipStore();return k.useEffect(()=>(n(!0),()=>{n(!1)}),[]),s.jsxRuntimeExports.jsx("div",{className:Cc.tooltip,children:t})},Sc=()=>{const{undo:e,redo:t,past:n,future:r}=s.useHistoryStore(),[o,i]=k.useState(!1),[a,u]=k.useState(!1),[c,d]=k.useState(!1),[p,h]=k.useState(!1),[f,m]=k.useState(null),{notifications:x,setNotifications:g}=s.useNotificationStore();return k.useEffect(()=>{i(n.length===0)},[n]),k.useEffect(()=>{u(r.length===0)},[r]),s.jsxRuntimeExports.jsxs("div",{className:Dn.buttons,children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(Dn.button,{[Dn.disabled]:o}),onMouseEnter:()=>{const C=setTimeout(()=>{h(!0),d(!1)},200);m(C)},onMouseLeave:()=>{f&&clearTimeout(f),h(!1),d(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{o||(e(),g([...x,{id:s.v4(),message:"Changes undone",status:"success"}]))},fill:o?"#757575":"#252525"}),p&&s.jsxRuntimeExports.jsx(Tn,{text:o?"Nothing to undo":"Click to undo changes"})]}),s.jsxRuntimeExports.jsxs("div",{className:s.clx(Dn.button,{[Dn.disabled]:a}),onMouseEnter:()=>{const C=setTimeout(()=>{d(!0),h(!1)},200);m(C)},onMouseLeave:()=>{f&&clearTimeout(f),d(!1),h(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||(t(),g([...x,{id:s.v4(),message:"Changes redone",status:"success"}]))},fill:a?"#757575":"#252525"}),c&&s.jsxRuntimeExports.jsx(Tn,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},yc="_devices_ls6k9_1",kc="_device_ls6k9_1",Rc="_active_ls6k9_27",zs={devices:yc,device:kc,active:Rc},Ac=()=>s.jsxRuntimeExports.jsx("div",{className:zs.devices,children:Tl.map(e=>s.jsxRuntimeExports.jsx(Nc,{device:e}))}),Nc=e=>{const{device:t}=e,{currentDevice:n,setCurrentDevice:r}=s.useDeviceStore(),[o,i]=k.useState(!1),[a,u]=k.useState(null);return s.jsxRuntimeExports.jsxs("div",{className:s.clx(zs.device,{[zs.active]:n.value===t.value}),onClick:()=>r(t),onMouseEnter:()=>{const c=setTimeout(()=>{i(!0)},200);u(c)},onMouseLeave:()=>{a&&clearTimeout(a),i(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:t.icon,fill:n.value===t.value?"#252525":"#757575",width:20,height:20}),o&&s.jsxRuntimeExports.jsx(Tn,{text:`Switch to ${t.value} view`})]},t.value)},wc="_preview_1x3m8_2",Lc="_active_1x3m8_19",hs={preview:wc,active:Lc},jc=()=>{const{onPreview:e}=s.usePreviewStore(),[t,n]=k.useState(!1),[r,o]=k.useState(null);return s.jsxRuntimeExports.jsxs("a",{href:"/",className:s.clx(hs.preview,{[hs.active]:e}),target:"_blank",onMouseEnter:()=>{const i=setTimeout(()=>{n(!0)},200);o(i)},onMouseLeave:()=>{r&&clearTimeout(r),n(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"ArrowUpRight",width:20,height:20}),s.jsxRuntimeExports.jsx("span",{className:hs.text,children:"Preview"}),t&&s.jsxRuntimeExports.jsx(Tn,{text:"Open draft theme in new tab"})]})},vc="_settings_u4cv4_1",Pc={settings:vc},Dc="_pages_167qp_1",Oc="_text_167qp_21",Bc="_modal_167qp_27",Mc="_open_167qp_46",Fc="_page_167qp_1",Hc="_hoverable_167qp_61",Uc="_separator_167qp_65",$c="_button_167qp_70",zc="_items_167qp_85",it={pages:Dc,default:"_default_167qp_5",text:Oc,modal:Bc,open:Mc,page:Fc,hoverable:Hc,separator:Uc,button:$c,items:zc},ca=async e=>{const t=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId"),o=`${s.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/pages/${encodeURIComponent(e)}`;return await s.request({url:o,withToken:!0,method:"delete"})},Wc=()=>{const{currentPage:e,setCurrentPage:t,setIsOpenModal:n,pages:r,setIsEdit:o,setEditedPage:i,deletePage:a,setIsOpenSelectModal:u}=s.usePagesStore(),{deletePage:c,setCurrentBlock:d}=s.useLayersStore(),[p,h]=k.useState(null),{setTitle:f,setDescription:m,setOnConfirm:x}=s.useConfirmationModalStore(),[g,C]=k.useState(!1),b=k.useRef(null);s.useOnClickOutside(b,()=>{g&&C(!1)}),k.useEffect(()=>{g?u(!0):setTimeout(()=>{u(!1)},300)},[g]);const A=y=>y?y.replace(/_/g," ").split(" ").map(P=>P.charAt(0).toUpperCase()+P.slice(1)).join(" "):"";return s.jsxRuntimeExports.jsxs("div",{className:it.pages,ref:b,children:[s.jsxRuntimeExports.jsxs("div",{className:it.default,onClick:y=>{y.stopPropagation(),C(P=>!P)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:r&&r[e]&&r[e].icon||"File",fill:"#252525",width:20,height:20}),s.jsxRuntimeExports.jsx("span",{className:it.text,children:r&&r[e]&&s.defaultPagePaths.includes(r[e].path)?`${A(r[e].name)} page`:r&&r[e]&&r[e].name}),s.jsxRuntimeExports.jsx("div",{style:{transform:g?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease",display:"flex"},children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CaretDown",width:20,height:20})})]}),s.jsxRuntimeExports.jsxs("div",{className:s.clx(it.modal,{[it.open]:g}),onClick:y=>y.stopPropagation(),children:[r&&s.jsxRuntimeExports.jsx("div",{className:it.items,children:Object.keys(r).map(y=>{const P=r[y];return s.jsxRuntimeExports.jsxs("div",{className:s.clx(it.page,{[it.hoverable]:p===y}),onMouseEnter:()=>h(y),onMouseLeave:()=>h(null),onClick:()=>{h(null),o(!1),d(null),t(y),C(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:P.icon,fill:"#252525"}),s.jsxRuntimeExports.jsx("span",{className:it.text,children:s.defaultPagePaths.includes(P.path)?`${A(P.name)} page`:P.name}),p===y&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Gear",fill:"#757575",onClick:L=>{L.stopPropagation(),o(!0),i(y),n(!0)}}),!s.defaultPagePaths.includes(P.path)&&s.jsxRuntimeExports.jsx(s.Icon,{name:"Trash",fill:"#C12A2A",onClick:L=>{L.stopPropagation(),f("Delete Page"),m(`Are you sure you want to delete ${P.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),x(()=>{L.stopPropagation(),r[e].path===P.path&&t(Object.keys(r)[0]),a(y),c(P.name),ca(P.path)})}})]}),r[e]&&r[e].name===P.name&&s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"#FF3F19"})]},y)})}),s.jsxRuntimeExports.jsx("div",{className:it.separator}),s.jsxRuntimeExports.jsxs(s.Button,{className:it.button,onClick:y=>{y.stopPropagation(),n(!0)},size:"l",children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Plus",fill:"#ff3f19"}),s.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},qc="_zoom_fu0hj_1",Po={zoom:qc},Vc=()=>{const{zoomLevel:e,setZoomLevel:t}=s.usePreviewStore();return s.jsxRuntimeExports.jsxs("label",{htmlFor:"zoom",className:Po.zoom,children:[s.jsxRuntimeExports.jsx("label",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},htmlFor:"zoom",children:s.jsxRuntimeExports.jsx(s.Icon,{name:"MagnifyingGlassMinus",width:20,height:20})}),s.jsxRuntimeExports.jsx("input",{id:"zoom",type:"number",min:25,max:250,value:(e*100).toFixed(0),onChange:n=>{const r=Number(n.target.value);t(r/100)},className:Po.input}),s.jsxRuntimeExports.jsx("span",{children:"%"})]})},Gc=()=>s.jsxRuntimeExports.jsxs("div",{className:Pc.settings,children:[s.jsxRuntimeExports.jsx(Wc,{}),s.jsxRuntimeExports.jsx(Vc,{})]}),Yc="_theme_1e5wq_1",Xc="_text_1e5wq_13",Do={theme:Yc,text:Xc},Qc=()=>s.jsxRuntimeExports.jsx("div",{className:Do.theme,children:s.jsxRuntimeExports.jsx("div",{className:Do.text,children:"Live Theme"})}),Kc=async(e,t,n)=>{const r=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),a=`${s.useApiStore.getState().apiUrls.api}/v2/builder/shops/${r}/drafts/${o}/${t}`;return await s.request({url:a,withToken:!0,method:e,body:n})};function On(e,t){try{return t.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(i=>i&&i.type===e).map(i=>{if(i.value===void 0)throw new Error("item.value is undefined.");return i.value}).flat()}).flat().filter(r=>r).map(r=>e==="ListingIds"?r.listingId:r)}catch(n){return console.error("Error in getValues function:",n),[]}}function Zc(e,t,n){return Jc(e,t)?(n.reviews||[]).length*3:0}function Jc(e,t){return t.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(i=>i&&i.type===e).map(i=>{if(i.value===void 0)throw new Error("item.value is undefined.");return i.value}).flat()}).flat().filter(r=>r).length>0}function ed(e,t){if(t){const n=Object.keys(t).find(r=>t[r].path===e);if(n)return t[n]}return null}const td=({setIsLoading:e,isLoading:t})=>{const{themeSettings:n}=s.useThemeSettingsStore(),{settings:r}=s.useSettingsStore(),[o,i]=k.useState(null),[a,u]=k.useState(!1),{setNotifications:c,notifications:d}=s.useNotificationStore(),{header:p,footer:h,announcement:f,blocks:m}=s.useLayersStore(),{pageContext:x}=s.usePagesStore(),{pages:g}=s.usePagesStore(),C=async()=>{if(a)o&&clearTimeout(o);else{e(!0);const A=Object.keys(m).map(L=>{const R=ed(L,g);return m[L]&&m[L].data&&(R!=null&&R.path)?{id:R?R.id:L,name:R?R.name:L,path:R.path,layout:{...m[L]},neededProductIds:[...On("ProductId",Object.values(m[L].data))],neededCategoryIds:[...On("CategoryId",Object.values(m[L].data))],neededAnnouncementIds:[...On("AnnouncementId",Object.values(m[L].data))],neededListingIds:[...On("ListingIds",Object.values(m[L].data))],neededFaqIds:[...On("FaqsIds",Object.values(m[L].data))],neededReviewCount:Zc("ReviewCount",Object.values(m[L].data),x),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(L=>L),y={settings:{...r==null?void 0:r.blockSettings},header:p,footer:h,announcement:f},{status:P}=await Kc("post","save",{themeSettings:n,settings:y,updatedPages:A});c([...d,{id:s.v4(),message:P===200?"Settings saved":"Error",status:P===200?"success":"error"}]),e(!1)}u(!0);const b=setTimeout(()=>{u(!1)},2e3);i(b)};return s.jsxRuntimeExports.jsx(s.Button,{onClick:C,disabled:t,children:s.jsxRuntimeExports.jsx("span",{style:{userSelect:"none"},children:"Save"})})},nd=()=>{const{isOpenSelectModal:e}=s.usePagesStore(),[t,n]=k.useState(!1),{showTooltip:r}=s.useTooltipStore();return s.jsxRuntimeExports.jsxs("div",{className:br.header,style:{zIndex:e?5e4:r?501:50},children:[s.jsxRuntimeExports.jsxs("div",{className:br.left,children:[s.jsxRuntimeExports.jsx(Ac,{}),s.jsxRuntimeExports.jsx(jc,{})]}),s.jsxRuntimeExports.jsx("div",{className:br.center,children:s.jsxRuntimeExports.jsx(Gc,{})}),s.jsxRuntimeExports.jsxs("div",{className:br.right,children:[s.jsxRuntimeExports.jsx(Qc,{}),s.jsxRuntimeExports.jsx(Sc,{}),s.jsxRuntimeExports.jsx(td,{setIsLoading:n,isLoading:t}),t&&s.jsxRuntimeExports.jsx(Vt,{})]})]})},rd="_exit_ovvox_1",sd="_text_ovvox_11",od="_exitLink_ovvox_16",ps={exit:rd,text:sd,exitLink:od},id=()=>s.jsxRuntimeExports.jsx("div",{className:ps.exit,children:s.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:ps.exitLink,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"SignOut",width:20,height:20}),s.jsxRuntimeExports.jsx("span",{className:ps.text,children:"Exit"})]})}),ad="_navbar_1podc_1",ud="_main_1podc_6",ld="_block_1podc_13",cd="_active_1podc_29",Tr={navbar:ad,main:ud,block:ld,active:cd},dd=()=>{const{activeBlock:e}=s.useNavbarStore(),{setActiveBlock:t}=s.useBlocksStore(),{setCurrentBlock:n}=s.useLayersStore(),{setActiveBlock:r}=s.useThemeSettingsStore(),{setActiveBlock:o}=s.usePreviewStore(),i=s.useNavigate();function a(u){switch(t(null),n(null),r(null),o({id:null,neededScroll:!1}),u.name){case"Layers":i("/admin/builder");break;case"Add":i("/admin/builder/add");break;case"Theme":i("/admin/builder/theme");break;case"Settings":i("/admin/builder/settings");break}}return s.jsxRuntimeExports.jsxs("div",{className:Tr.navbar,children:[s.jsxRuntimeExports.jsx(id,{}),s.jsxRuntimeExports.jsx("div",{className:Tr.main,children:s.navbarBlocks.map(u=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(Tr.block,{[Tr.active]:e.icon===u.icon}),onClick:()=>a(u),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:u.icon,fill:e.icon===u.icon?"#252525":"#757575"}),s.jsxRuntimeExports.jsx("span",{children:u.name})]},u.icon))})]})},hd="_preview_gb2ye_1",pd="_main_gb2ye_15",md="_content_gb2ye_25",fd="_loading_gb2ye_34",gd="_previewLoading_gb2ye_65",Bn={preview:hd,main:pd,content:md,loading:fd,previewLoading:gd},xd="_header_11zku_2",Ed="_circles_11zku_16",bd="_circle_11zku_16",Id="_red_11zku_32",Td="_green_11zku_36",_d="_yellow_11zku_40",Cd="_input_11zku_44",Sd="_main_11zku_55",yd="_text_11zku_63",kd="_copy_11zku_75",gt={header:xd,circles:Ed,circle:bd,red:Id,green:Td,yellow:_d,input:Cd,main:Sd,text:yd,copy:kd},Rd=["red","yellow","green"],Ad=()=>{const{currentDevice:e}=s.useDeviceStore(),t=(o,i)=>o.length>i?o.slice(0,i)+"...":o,{notifications:n,setNotifications:r}=s.useNotificationStore();return s.jsxRuntimeExports.jsxs("div",{className:gt.header,children:[s.jsxRuntimeExports.jsx("div",{className:gt.circles,children:Rd.map(o=>s.jsxRuntimeExports.jsx("div",{className:s.clx(gt.circle,{[gt.red]:o==="red",[gt.yellow]:o==="yellow",[gt.green]:o==="green"})},o))}),s.jsxRuntimeExports.jsx("div",{className:gt.input,children:s.jsxRuntimeExports.jsxs("div",{className:gt.main,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),s.jsxRuntimeExports.jsx("span",{className:gt.text,children:e.value==="mobile"?t(window.location.origin,35):e.value==="desktop"?t(window.location.origin,200):t(window.location.origin,100)})]})}),s.jsxRuntimeExports.jsx(s.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),r([...n,{id:s.v4(),status:"success",message:"Domain copied to clipboard"}])},className:gt.copy,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy",width:20,height:20,fill:"#252525"})})]})},Ct=e=>e?e.replace(/_/g," ").split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" and "):"",da=(e,t,n,r,o,i,a)=>{const u=e.currentTarget.getBoundingClientRect(),c=window.innerHeight-u.bottom,d=u.top,p=window.innerWidth-u.right,h=u.left;let f,m;return f=u.bottom+r+window.scrollY,m=u.left,(c<t||c<o)&&(d>=t+a?f=u.top-t-r+window.scrollY:f=window.scrollY+a),f-window.scrollY<a&&(f=window.scrollY+a),(p<n||p<i)&&(h>=n?m=u.right-n:m=(window.innerWidth-n)/2),m<u.right+i&&(m=u.right+i),m<u.right&&m+n>u.left&&f<u.bottom&&f+t>u.top&&(p>=n+i?m=u.right+r+i:c>=t?f=u.bottom+r+window.scrollY:(f=window.scrollY+a,m=(window.innerWidth-n)/2)),{top:f,left:m}},Nd="_results_1pahy_1",Oo={results:Nd};function wd(e,t){return t?new t[e]().blockSettings.isAddable:!1}function Bo(e,t){return e?Object.keys(e||{}).reduce((n,r)=>(wd(r,t)&&n.push({name:r,displayName:s.getDisplayName(r,t)}),n),[]):[]}const Ld="_product_yggw5_1",jd="_name_yggw5_15",Mo={product:Ld,name:jd},vd=e=>{const{blockId:t,setSearchValue:n}=e,{sourceBlocks:r,setActiveBlock:o}=s.useBlocksStore(),{hideModal:i,hoverBlockId:a,isModalVisible:u,showPreview:c,hidePreview:d,clearHideTimeout:p,startHideTimeout:h,setHoverBlockTopPosition:f}=s.useSubmodalStore();function m(C){n(""),o(C),i("keyBlock")}function x(C,b){const A=window.innerHeight,y=400,P=10;let L=b.clientY-120;L+y>A&&(L=A-y-P),L<P&&(L=P),a||i("keyBlock"),c(C,"keyBlock"),p(),f(L)}function g(){u?h("keyBlock"):d("keyBlock"),f(null)}return s.jsxRuntimeExports.jsxs("div",{className:Mo.product,onClick:()=>m(t),onMouseEnter:C=>x(t,C),onMouseLeave:g,children:[nr[t]?s.jsxRuntimeExports.jsx("img",{src:nr[t]}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Cards"}),s.jsxRuntimeExports.jsx("span",{className:Mo.name,children:s.getDisplayName(t,r)}),s.jsxRuntimeExports.jsx(s.Icon,{name:"CaretRight",width:20,height:20})]},t)},ha=()=>{const{blocks:e,sourceBlocks:t}=s.useBlocksStore(),[n,r]=k.useState(""),[o,i]=k.useState([]),a=k.useMemo(()=>Bo(e,t),[e,t]),u=k.useMemo(()=>new s.Fuse(a,{keys:["displayName"],threshold:.4}),[a]);return k.useEffect(()=>{if(n.trim()==="")i(Bo(e,t));else{const c=u.search(n);i(c.map(d=>d.item))}},[n,u]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:r,value:n,style:{marginBottom:10}}),s.jsxRuntimeExports.jsx("div",{className:Oo.results,children:o.length>0?o.map(c=>s.jsxRuntimeExports.jsx(vd,{blockId:c.name,setSearchValue:r})):s.jsxRuntimeExports.jsx("div",{className:Oo.noResults,children:"No sections found"})})]})},Pd="_wrapper_1k1cr_1",Dd="_submodal_1k1cr_14",Ws={wrapper:Pd,submodal:Dd},Od=({children:e,positionTop:t,positionLeft:n})=>{const{keyBlock:r,startHideTimeout:o,clearHideTimeout:i,setMouseOverModal:a}=s.useSubmodalStore();return r?s.jsxRuntimeExports.jsx("div",{className:Ws.wrapper,style:t?{top:t,left:n||void 0}:{},onMouseEnter:()=>{i(),a(!0)},onMouseLeave:()=>{a(!1),o()},children:e}):null},Bd=({children:e})=>{const{hoverBlockId:t,startHideTimeout:n,clearHideTimeout:r,setMouseOverModal:o}=s.useSubmodalStore();return t?s.jsxRuntimeExports.jsx("div",{className:s.clx(Ws.wrapper,Ws.submodal),onMouseEnter:()=>{r(),o(!0)},onMouseLeave:()=>{o(!1),n()},children:e}):null},Md="_applyButton_1a9kh_2",Fd="_content_1a9kh_7",Hd="_title_1a9kh_14",Ud="_label_1a9kh_21",$d="_colorValue_1a9kh_40",zd="_colorMap_1a9kh_48",Wd="_indicator_1a9kh_57",qd="_hueSlider_1a9kh_66",Vd="_slider_1a9kh_97",Gd="_buttons_1a9kh_102",Yd="_name_1a9kh_109",Xd="_secondary_1a9kh_114",Qd="_input_1a9kh_122",Kd="_modal_1a9kh_160",Zd="_alphaSlider_1a9kh_249",Jd="_alphaBackground_1a9kh_257",e0="_alphaGradient_1a9kh_268",t0="_chargeTypes_1a9kh_297",n0="_charge_1a9kh_297",r0="_chargeActive_1a9kh_326",s0="_gradient_1a9kh_334",o0="_color_1a9kh_40",i0="_colorActive_1a9kh_355",a0="_gradientWrapper_1a9kh_362",u0="_subtitle_1a9kh_368",l0="_colorTypes_1a9kh_375",c0="_colorType_1a9kh_375",d0="_colorTypeActive_1a9kh_399",h0="_colorsWrapper_1a9kh_404",p0="_colors_1a9kh_404",le={applyButton:Md,content:Fd,title:Hd,label:Ud,colorValue:$d,colorMap:zd,indicator:Wd,hueSlider:qd,slider:Vd,buttons:Gd,name:Yd,secondary:Xd,input:Qd,modal:Kd,alphaSlider:Zd,alphaBackground:Jd,alphaGradient:e0,chargeTypes:t0,charge:n0,chargeActive:r0,gradient:s0,color:o0,colorActive:i0,gradientWrapper:a0,subtitle:u0,colorTypes:l0,colorType:c0,colorTypeActive:d0,colorsWrapper:h0,colors:p0},m0=()=>{const{modalPosition:e,color:t,initialColor:n,setShowModal:r,hue:o,saturation:i,brightness:a,alpha:u,dragging:c,setDragging:d,setHue:p,setSaturation:h,setBrightness:f,setAlpha:m,colorChange:x,setColor:g,update:C,isGradient:b,setIsGradient:A,gradientDirection:y,setGradientDirection:P,hue2:L,saturation2:R,brightness2:q,alpha2:Y,setHue2:K,setSaturation2:w,setBrightness2:$,setAlpha2:B,activeColorIndex:H,setActiveColorIndex:V,isGradientActive:z}=s.useColorPickerStore(),Z=(ie,te,Ee)=>{te/=100,Ee/=100;const re=ke=>(ke+ie/60)%6,pe=ke=>Ee*(1-te*Math.max(0,Math.min(re(ke),4-re(ke),1))),ue=Math.round(255*pe(5)),xe=Math.round(255*pe(3)),ge=Math.round(255*pe(1));return{r:ue,g:xe,b:ge}},G=ie=>ie.toString(16).padStart(2,"0"),W=(ie,te,Ee,re)=>{const{r:pe,g:ue,b:xe}=Z(ie,te,Ee),ge=Math.round(re/100*255);return`#${G(pe)}${G(ue)}${G(xe)}${G(ge)}`},J=(ie,te,Ee,re)=>{if(b)if(H===1){p(ie),h(te),f(Ee),m(re);const pe=W(ie,te,Ee,re),ue=W(L,R,q,Y),ge=`linear-gradient(${y==="vertical"?"0deg":"90deg"}, ${pe} 0%, ${ue} 100%)`;x(ge),g(ge)}else{K(ie),w(te),$(Ee),B(re);const pe=W(ie,te,Ee,re),ue=W(o,i,a,u),ge=`linear-gradient(${y==="vertical"?"0deg":"90deg"}, ${ue} 0%, ${pe} 100%)`;x(ge),g(ge)}else{const pe=W(ie,te,Ee,re);x(pe),g(pe)}},T=(ie,te,Ee)=>{const{width:re,height:pe}=Ee.getBoundingClientRect(),ue=Math.max(0,Math.min(ie/re*100,100)),xe=Math.max(0,Math.min(100-te/pe*100,100));b?H===1?(h(ue),f(xe),J(o,ue,xe,u)):(w(ue),$(xe),J(L,ue,xe,Y)):(h(ue),f(xe),J(o,ue,xe,u))},ce=ie=>{const{offsetX:te,offsetY:Ee}=ie.nativeEvent;d(!0),T(te,Ee,ie.currentTarget)},ye=ie=>{if(c){const te=document.querySelector(`.${le.colorMap}`),{left:Ee,top:re}=te.getBoundingClientRect(),pe=ie.clientX-Ee,ue=ie.clientY-re;T(pe,ue,te)}},S=()=>{d(!1)};k.useEffect(()=>{function ie(re){const pe=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,ue=re.match(pe);if(ue){const xe=ue[1],ge=ue[2],ke=ue[3];return{angle:xe,col1:ge,col2:ke}}return null}function te(re){const pe=parseInt(re.slice(1,3),16),ue=parseInt(re.slice(3,5),16),xe=parseInt(re.slice(5,7),16),ge=parseInt(re.slice(7,9),16)/255*100,{h:ke,s:Ot,b:v}=Ee(pe,ue,xe);return{h:ke,s:Ot,b:v,a:ge}}function Ee(re,pe,ue){re/=255,pe/=255,ue/=255;const xe=Math.max(re,pe,ue),ge=Math.min(re,pe,ue);let ke=0;const Ot=xe-ge,v=(xe===0?0:Ot/xe)*100,U=xe*100;if(xe===ge)ke=0;else switch(xe){case re:ke=((pe-ue)/Ot+(pe<ue?6:0))*60;break;case pe:ke=((ue-re)/Ot+2)*60;break;case ue:ke=((re-pe)/Ot+4)*60;break}return{h:ke,s:v,b:U}}if(n&&n.startsWith("linear-gradient")){const re=ie(n);if(re){const{angle:pe,col1:ue,col2:xe}=re,ge=te(ue),ke=te(xe);A(!0),P(pe==="0deg"?"vertical":"horizontal"),p(ge.h),h(ge.s),f(ge.b),m(ge.a),K(ke.h),w(ke.s),$(ke.b),B(ke.a),V(1)}}else if(n){const pe=function(xe){let ge=xe;return ge.length===7?ge+"ff":ge.length===9?ge:ge.length===4?ge[0]+ge[1].repeat(2)+ge[2].repeat(2)+ge[3].repeat(2)+"ff":"#000000ff"}(n),ue=te(pe);A(!1),p(ue.h),h(ue.s),f(ue.b),m(ue.a)}},[n,A,P,p,h,f,m,K,w,$,B,V]),k.useEffect(()=>{let ie,te,Ee,re;b?H===1?(ie=o,te=i,Ee=a,re=u):(ie=L,te=R,Ee=q,re=Y):(ie=o,te=i,Ee=a,re=u),J(ie,te,Ee,re)},[b,y,H,o,i,a,u,L,R,q,Y]),k.useEffect(()=>{const ie=Ee=>ye(Ee),te=()=>S();return c?(document.addEventListener("mousemove",ie),document.addEventListener("mouseup",te)):(document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",te)),()=>{document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",te)}},[c,b,y]);function ae(){if(!b)C(t);else{const ie=W(o,i,a,u),te=W(L,R,q,Y),re=`linear-gradient(${y==="vertical"?"0deg":"90deg"}, ${ie} 0%, ${te} 100%)`;C(re)}r(!1)}function Ae(){r(!1),x(n)}const ee=b?H===1?o:L:o,Oe=b?H===1?i:R:i,st=b?H===1?a:q:a,Dt=b?H===1?u:Y:u,{r:kt,g:Yt,b:xr}=Z(ee,Oe,st),us=`linear-gradient(to right, rgba(${kt}, ${Yt}, ${xr}, 0), rgba(${kt}, ${Yt}, ${xr}, 1))`,Er=W(o,i,a,u),jn=W(L,R,q,Y);return s.jsxRuntimeExports.jsxs("div",{className:le.modal,onClick:ie=>ie.stopPropagation(),style:{top:`${e.top}px`,left:`${e.left}px`},children:[s.jsxRuntimeExports.jsx("h2",{className:le.title,children:"Color"}),z&&s.jsxRuntimeExports.jsxs("div",{className:le.colorTypes,children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(le.colorType,{[le.colorTypeActive]:!b}),onClick:()=>A(!1),children:[s.jsxRuntimeExports.jsx("div",{style:{background:"#757575",width:"16px",height:"16px",borderRadius:"50%"}}),"Solid"]}),s.jsxRuntimeExports.jsxs("div",{className:s.clx(le.colorType,{[le.colorTypeActive]:b}),onClick:()=>A(!0),children:[s.jsxRuntimeExports.jsx("div",{style:{background:"linear-gradient(to bottom, #757575 0%, #DBDBDB 100%)",width:"16px",height:"16px",borderRadius:"50%"}}),"Linear"]})]}),b&&z&&s.jsxRuntimeExports.jsxs("div",{className:le.colorsWrapper,children:[s.jsxRuntimeExports.jsx("div",{className:le.colors,style:{background:`linear-gradient(90deg, ${Er} 0%, ${jn} 100%)`}}),s.jsxRuntimeExports.jsx("div",{className:s.clx(le.color,{[le.colorActive]:H===1}),onClick:()=>V(1),style:{background:Er}}),s.jsxRuntimeExports.jsx("div",{className:s.clx(le.color,{[le.colorActive]:H===2}),onClick:()=>V(2),style:{background:jn}})]}),s.jsxRuntimeExports.jsx("div",{className:le.colorMap,onMouseDown:ce,style:{background:`
|
|
99
|
+
`,n+="}",n},pc=e=>{const t=document.getElementById("dynamic-styles");if(t)t.innerHTML=e;else{const n=document.createElement("style");n.id="dynamic-styles",n.innerHTML=e,document.head.appendChild(n)}},zr=new Set,mc=e=>{const t=new Map;return Object.entries(e).forEach(([n,r])=>{typeof r=="object"&&Object.entries(r).forEach(([o,i])=>{var a,u;if(i&&i.font){const c=i.font.replace(/\s+/g,"+");t.has(c)||t.set(c,new Set),(a=t.get(c))==null||a.add(i.weight),(u=t.get(c))==null||u.add(i.boldWeight)}})}),t},fc=e=>{const t=new Map;return Object.entries(e).forEach(([n,r])=>{typeof r=="object"&&Object.keys(r).forEach(o=>{var i;if(o==="font"&&r[o]){const a=r[o].replace(/\s+/g,"+");t.has(a)||t.set(a,new Set),(i=t.get(a))==null||i.add("400")}})}),t},gc=e=>{zr.forEach(t=>{if(!e.has(t)){const n=document.querySelector(`link[data-font="${t}"]`);n&&n.remove(),zr.delete(t)}})},xc=e=>{const t=new Set;e.forEach((n,r)=>{const o=Array.from(n).join(";"),i=`${r}:wght@${o}`;if(t.add(i),!zr.has(i)){const a=document.createElement("link");a.rel="stylesheet",a.href=`https://fonts.googleapis.com/css2?family=${i}&display=swap`,a.setAttribute("data-font",i),document.head.appendChild(a),zr.add(i)}}),gc(t)},Ec=e=>{if(e.fonts){const t=mc(e.fonts.desktop),n=fc(e.buttons),r=new Map(t);n.forEach((o,i)=>{if(r.has(i)){const a=r.get(i);o.forEach(u=>a==null?void 0:a.add(u))}else r.set(i,new Set(o))}),xc(r)}};function bc(){try{const{editBlock:e,currentBlock:t,blocks:n,setHeader:r,setFooter:o,setAnnouncement:i}=s.useLayersStore.getState(),{currentPage:a,pages:u}=s.usePagesStore.getState(),{currentInstance:c,settingsInstance:d}=s.useBlocksStore.getState(),{setSettings:p}=s.useSettingsStore.getState();if(t||p(d),c&&t){if(t==="header")r(c);else if(t==="footer")o(c);else if(t==="announcement")i(c);else if(t==="header"||t==="footer"||t==="announcement")throw new Error(`Missing ${t} data.`)}if(c&&u&&t&&!["header","footer","announcement"].includes(t)){const h={blockSettings:{}};if(!c.blockSettings)throw new Error("currentInstance.blockSettings is undefined.");if(Object.keys(c.blockSettings).filter(f=>!["displayName","isAddable"].includes(f)).forEach(f=>{h.blockSettings[f]=c.blockSettings[f]}),!u[a])throw new Error(`Page "${a}" does not exist.`);if(!n[u[a].path].data||!n[u[a].path].data[t])throw new Error(`Layer or block for page "${u[a].path}" and block "${t}" does not exist.`);e(u[a].path,t,{name:n[u[a].path].data[t].name,value:h})}}catch(e){console.error("Error in hotReload function:",e)}}const Ic=()=>{const e=s.useApiStore.getState().apiUrls,t=s.useNavigate(),{notifications:n,setNotifications:r}=s.useNotificationStore();return async(o,i,a,u)=>{const c=s.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,d=`${e.slApi}/v1/public/${c}/tickets`;try{const p=await s.request({method:"post",url:d,body:{title:o,firstMessage:i,email:u,recaptcha:a,tsId:s.getTsId()},withToken:!1});return r([...n,{id:s.v4(),message:"Ticket created successfully. We will contact you by mail",status:"success"}]),t(`/ticket/${p.data.id}/${p.data.accessToken}`),p}catch(p){r([...n,{id:s.v4(),message:`Error: ${p}. Please try again later.`,status:"error"}])}}},Tc=()=>{const{pages:e}=s.usePagesStore(),[t,n]=k.useState(e);return k.useEffect(()=>{n(e)},[e]),t},_c="_tooltip_4hruj_1",Cc={tooltip:_c},Tn=e=>{const{text:t}=e,{setShowTooltip:n}=s.useTooltipStore();return k.useEffect(()=>(n(!0),()=>{n(!1)}),[]),s.jsxRuntimeExports.jsx("div",{className:Cc.tooltip,children:t})},Sc=()=>{const{undo:e,redo:t,past:n,future:r}=s.useHistoryStore(),[o,i]=k.useState(!1),[a,u]=k.useState(!1),[c,d]=k.useState(!1),[p,h]=k.useState(!1),[f,m]=k.useState(null),{notifications:x,setNotifications:g}=s.useNotificationStore();return k.useEffect(()=>{i(n.length===0)},[n]),k.useEffect(()=>{u(r.length===0)},[r]),s.jsxRuntimeExports.jsxs("div",{className:Dn.buttons,children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(Dn.button,{[Dn.disabled]:o}),onMouseEnter:()=>{const C=setTimeout(()=>{h(!0),d(!1)},200);m(C)},onMouseLeave:()=>{f&&clearTimeout(f),h(!1),d(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{o||(e(),g([...x,{id:s.v4(),message:"Changes undone",status:"success"}]))},fill:o?"#757575":"#252525"}),p&&s.jsxRuntimeExports.jsx(Tn,{text:o?"Nothing to undo":"Click to undo changes"})]}),s.jsxRuntimeExports.jsxs("div",{className:s.clx(Dn.button,{[Dn.disabled]:a}),onMouseEnter:()=>{const C=setTimeout(()=>{d(!0),h(!1)},200);m(C)},onMouseLeave:()=>{f&&clearTimeout(f),d(!1),h(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||(t(),g([...x,{id:s.v4(),message:"Changes redone",status:"success"}]))},fill:a?"#757575":"#252525"}),c&&s.jsxRuntimeExports.jsx(Tn,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},yc="_devices_ls6k9_1",kc="_device_ls6k9_1",Rc="_active_ls6k9_27",zs={devices:yc,device:kc,active:Rc},Ac=()=>s.jsxRuntimeExports.jsx("div",{className:zs.devices,children:Tl.map(e=>s.jsxRuntimeExports.jsx(Nc,{device:e}))}),Nc=e=>{const{device:t}=e,{currentDevice:n,setCurrentDevice:r}=s.useDeviceStore(),[o,i]=k.useState(!1),[a,u]=k.useState(null);return s.jsxRuntimeExports.jsxs("div",{className:s.clx(zs.device,{[zs.active]:n.value===t.value}),onClick:()=>r(t),onMouseEnter:()=>{const c=setTimeout(()=>{i(!0)},200);u(c)},onMouseLeave:()=>{a&&clearTimeout(a),i(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:t.icon,fill:n.value===t.value?"#252525":"#757575",width:20,height:20}),o&&s.jsxRuntimeExports.jsx(Tn,{text:`Switch to ${t.value} view`})]},t.value)},wc="_preview_1x3m8_2",Lc="_active_1x3m8_19",hs={preview:wc,active:Lc},jc=()=>{const{onPreview:e}=s.usePreviewStore(),[t,n]=k.useState(!1),[r,o]=k.useState(null);return s.jsxRuntimeExports.jsxs("a",{href:"/",className:s.clx(hs.preview,{[hs.active]:e}),target:"_blank",onMouseEnter:()=>{const i=setTimeout(()=>{n(!0)},200);o(i)},onMouseLeave:()=>{r&&clearTimeout(r),n(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"ArrowUpRight",width:20,height:20}),s.jsxRuntimeExports.jsx("span",{className:hs.text,children:"Preview"}),t&&s.jsxRuntimeExports.jsx(Tn,{text:"Open draft theme in new tab"})]})},vc="_settings_u4cv4_1",Pc={settings:vc},Dc="_pages_167qp_1",Oc="_text_167qp_21",Bc="_modal_167qp_27",Mc="_open_167qp_46",Fc="_page_167qp_1",Hc="_hoverable_167qp_61",Uc="_separator_167qp_65",$c="_button_167qp_70",zc="_items_167qp_85",it={pages:Dc,default:"_default_167qp_5",text:Oc,modal:Bc,open:Mc,page:Fc,hoverable:Hc,separator:Uc,button:$c,items:zc},ca=async e=>{const t=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId"),o=`${s.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/pages/${encodeURIComponent(e)}`;return await s.request({url:o,withToken:!0,method:"delete"})},Wc=()=>{const{currentPage:e,setCurrentPage:t,setIsOpenModal:n,pages:r,setIsEdit:o,setEditedPage:i,deletePage:a,setIsOpenSelectModal:u}=s.usePagesStore(),{deletePage:c,setCurrentBlock:d}=s.useLayersStore(),[p,h]=k.useState(null),{setTitle:f,setDescription:m,setOnConfirm:x}=s.useConfirmationModalStore(),[g,C]=k.useState(!1),b=k.useRef(null);s.useOnClickOutside(b,()=>{g&&C(!1)}),k.useEffect(()=>{g?u(!0):setTimeout(()=>{u(!1)},300)},[g]);const A=y=>y?y.replace(/_/g," ").split(" ").map(P=>P.charAt(0).toUpperCase()+P.slice(1)).join(" "):"";return s.jsxRuntimeExports.jsxs("div",{className:it.pages,ref:b,children:[s.jsxRuntimeExports.jsxs("div",{className:it.default,onClick:y=>{y.stopPropagation(),C(P=>!P)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:r&&r[e]&&r[e].icon||"File",fill:"#252525",width:20,height:20}),s.jsxRuntimeExports.jsx("span",{className:it.text,children:r&&r[e]&&s.defaultPagePaths.includes(r[e].path)?`${A(r[e].name)} page`:r&&r[e]&&r[e].name}),s.jsxRuntimeExports.jsx("div",{style:{transform:g?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease",display:"flex"},children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CaretDown",width:20,height:20})})]}),s.jsxRuntimeExports.jsxs("div",{className:s.clx(it.modal,{[it.open]:g}),onClick:y=>y.stopPropagation(),children:[r&&s.jsxRuntimeExports.jsx("div",{className:it.items,children:Object.keys(r).map(y=>{const P=r[y];return s.jsxRuntimeExports.jsxs("div",{className:s.clx(it.page,{[it.hoverable]:p===y}),onMouseEnter:()=>h(y),onMouseLeave:()=>h(null),onClick:()=>{h(null),o(!1),d(null),t(y),C(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:P.icon,fill:"#252525"}),s.jsxRuntimeExports.jsx("span",{className:it.text,children:s.defaultPagePaths.includes(P.path)?`${A(P.name)} page`:P.name}),p===y&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Gear",fill:"#757575",onClick:L=>{L.stopPropagation(),o(!0),i(y),n(!0)}}),!s.defaultPagePaths.includes(P.path)&&s.jsxRuntimeExports.jsx(s.Icon,{name:"Trash",fill:"#C12A2A",onClick:L=>{L.stopPropagation(),f("Delete Page"),m(`Are you sure you want to delete ${P.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),x(()=>{L.stopPropagation(),r[e].path===P.path&&t(Object.keys(r)[0]),a(y),c(P.name),ca(P.path)})}})]}),r[e]&&r[e].name===P.name&&s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"#FF3F19"})]},y)})}),s.jsxRuntimeExports.jsx("div",{className:it.separator}),s.jsxRuntimeExports.jsxs(s.Button,{className:it.button,onClick:y=>{y.stopPropagation(),n(!0)},size:"l",children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Plus",fill:"#ff3f19"}),s.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},qc="_zoom_fu0hj_1",Po={zoom:qc},Vc=()=>{const{zoomLevel:e,setZoomLevel:t}=s.usePreviewStore();return s.jsxRuntimeExports.jsxs("label",{htmlFor:"zoom",className:Po.zoom,children:[s.jsxRuntimeExports.jsx("label",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},htmlFor:"zoom",children:s.jsxRuntimeExports.jsx(s.Icon,{name:"MagnifyingGlassMinus",width:20,height:20})}),s.jsxRuntimeExports.jsx("input",{id:"zoom",type:"number",min:25,max:250,value:(e*100).toFixed(0),onChange:n=>{const r=Number(n.target.value);t(r/100)},className:Po.input}),s.jsxRuntimeExports.jsx("span",{children:"%"})]})},Gc=()=>s.jsxRuntimeExports.jsxs("div",{className:Pc.settings,children:[s.jsxRuntimeExports.jsx(Wc,{}),s.jsxRuntimeExports.jsx(Vc,{})]}),Yc="_theme_1e5wq_1",Xc="_text_1e5wq_13",Do={theme:Yc,text:Xc},Qc=()=>s.jsxRuntimeExports.jsx("div",{className:Do.theme,children:s.jsxRuntimeExports.jsx("div",{className:Do.text,children:"Live Theme"})}),Kc=async(e,t,n)=>{const r=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),a=`${s.useApiStore.getState().apiUrls.api}/v2/builder/shops/${r}/drafts/${o}/${t}`;return await s.request({url:a,withToken:!0,method:e,body:n})};function On(e,t){try{return t.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(i=>i&&i.type===e).map(i=>{if(i.value===void 0)throw new Error("item.value is undefined.");return i.value}).flat()}).flat().filter(r=>r).map(r=>e==="ListingIds"?r.listingId:r)}catch(n){return console.error("Error in getValues function:",n),[]}}function Zc(e,t,n){return Jc(e,t)?(n.reviews||[]).length*3:0}function Jc(e,t){return t.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(i=>i&&i.type===e).map(i=>{if(i.value===void 0)throw new Error("item.value is undefined.");return i.value}).flat()}).flat().filter(r=>r).length>0}function ed(e,t){if(t){const n=Object.keys(t).find(r=>t[r].path===e);if(n)return t[n]}return null}const td=({setIsLoading:e,isLoading:t})=>{const{themeSettings:n}=s.useThemeSettingsStore(),{settings:r}=s.useSettingsStore(),[o,i]=k.useState(null),[a,u]=k.useState(!1),{setNotifications:c,notifications:d}=s.useNotificationStore(),{header:p,footer:h,announcement:f,blocks:m}=s.useLayersStore(),{pageContext:x}=s.usePagesStore(),{pages:g}=s.usePagesStore(),C=async()=>{if(a)o&&clearTimeout(o);else{e(!0);const A=Object.keys(m).map(L=>{const R=ed(L,g);return m[L]&&m[L].data&&(R!=null&&R.path)?{id:R?R.id:L,name:R?R.name:L,path:R.path,layout:{...m[L]},neededProductIds:[...On("ProductId",Object.values(m[L].data))],neededCategoryIds:[...On("CategoryId",Object.values(m[L].data))],neededAnnouncementIds:[...On("AnnouncementId",Object.values(m[L].data))],neededListingIds:[...On("ListingIds",Object.values(m[L].data))],neededFaqIds:[...On("FaqsIds",Object.values(m[L].data))],neededReviewCount:Zc("ReviewCount",Object.values(m[L].data),x),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(L=>L),y={settings:{...r==null?void 0:r.blockSettings},header:p,footer:h,announcement:f},{status:P}=await Kc("post","save",{themeSettings:n,settings:y,updatedPages:A});c([...d,{id:s.v4(),message:P===200?"Settings saved":"Error",status:P===200?"success":"error"}]),e(!1)}u(!0);const b=setTimeout(()=>{u(!1)},2e3);i(b)};return s.jsxRuntimeExports.jsx(s.Button,{onClick:C,disabled:t,children:s.jsxRuntimeExports.jsx("span",{style:{userSelect:"none"},children:"Save"})})},nd=()=>{const{isOpenSelectModal:e}=s.usePagesStore(),[t,n]=k.useState(!1),{showTooltip:r}=s.useTooltipStore();return s.jsxRuntimeExports.jsxs("div",{className:br.header,style:{zIndex:e?5e4:r?501:50},children:[s.jsxRuntimeExports.jsxs("div",{className:br.left,children:[s.jsxRuntimeExports.jsx(Ac,{}),s.jsxRuntimeExports.jsx(jc,{})]}),s.jsxRuntimeExports.jsx("div",{className:br.center,children:s.jsxRuntimeExports.jsx(Gc,{})}),s.jsxRuntimeExports.jsxs("div",{className:br.right,children:[s.jsxRuntimeExports.jsx(Qc,{}),s.jsxRuntimeExports.jsx(Sc,{}),s.jsxRuntimeExports.jsx(td,{setIsLoading:n,isLoading:t}),t&&s.jsxRuntimeExports.jsx(Vt,{})]})]})},rd="_exit_ovvox_1",sd="_text_ovvox_11",od="_exitLink_ovvox_16",ps={exit:rd,text:sd,exitLink:od},id=()=>s.jsxRuntimeExports.jsx("div",{className:ps.exit,children:s.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:ps.exitLink,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"SignOut",width:20,height:20}),s.jsxRuntimeExports.jsx("span",{className:ps.text,children:"Exit"})]})}),ad="_navbar_1podc_1",ud="_main_1podc_6",ld="_block_1podc_13",cd="_active_1podc_29",Tr={navbar:ad,main:ud,block:ld,active:cd},dd=()=>{const{activeBlock:e}=s.useNavbarStore(),{setActiveBlock:t}=s.useBlocksStore(),{setCurrentBlock:n}=s.useLayersStore(),{setActiveBlock:r}=s.useThemeSettingsStore(),{setActiveBlock:o}=s.usePreviewStore(),i=s.useNavigate();function a(u){switch(t(null),n(null),r(null),o({id:null,neededScroll:!1}),u.name){case"Layers":i("/admin/builder");break;case"Add":i("/admin/builder/add");break;case"Theme":i("/admin/builder/theme");break;case"Settings":i("/admin/builder/settings");break}}return s.jsxRuntimeExports.jsxs("div",{className:Tr.navbar,children:[s.jsxRuntimeExports.jsx(id,{}),s.jsxRuntimeExports.jsx("div",{className:Tr.main,children:s.navbarBlocks.map(u=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(Tr.block,{[Tr.active]:e.icon===u.icon}),onClick:()=>a(u),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:u.icon,fill:e.icon===u.icon?"#252525":"#757575"}),s.jsxRuntimeExports.jsx("span",{children:u.name})]},u.icon))})]})},hd="_preview_gb2ye_1",pd="_main_gb2ye_15",md="_content_gb2ye_25",fd="_loading_gb2ye_34",gd="_previewLoading_gb2ye_65",Bn={preview:hd,main:pd,content:md,loading:fd,previewLoading:gd},xd="_header_11zku_2",Ed="_circles_11zku_16",bd="_circle_11zku_16",Id="_red_11zku_32",Td="_green_11zku_36",_d="_yellow_11zku_40",Cd="_input_11zku_44",Sd="_main_11zku_55",yd="_text_11zku_63",kd="_copy_11zku_75",gt={header:xd,circles:Ed,circle:bd,red:Id,green:Td,yellow:_d,input:Cd,main:Sd,text:yd,copy:kd},Rd=["red","yellow","green"],Ad=()=>{const{currentDevice:e}=s.useDeviceStore(),t=(o,i)=>o.length>i?o.slice(0,i)+"...":o,{notifications:n,setNotifications:r}=s.useNotificationStore();return s.jsxRuntimeExports.jsxs("div",{className:gt.header,children:[s.jsxRuntimeExports.jsx("div",{className:gt.circles,children:Rd.map(o=>s.jsxRuntimeExports.jsx("div",{className:s.clx(gt.circle,{[gt.red]:o==="red",[gt.yellow]:o==="yellow",[gt.green]:o==="green"})},o))}),s.jsxRuntimeExports.jsx("div",{className:gt.input,children:s.jsxRuntimeExports.jsxs("div",{className:gt.main,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),s.jsxRuntimeExports.jsx("span",{className:gt.text,children:e.value==="mobile"?t(window.location.origin,35):e.value==="desktop"?t(window.location.origin,200):t(window.location.origin,100)})]})}),s.jsxRuntimeExports.jsx(s.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),r([...n,{id:s.v4(),status:"success",message:"Domain copied to clipboard"}])},className:gt.copy,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy",width:20,height:20,fill:"#252525"})})]})},Ct=e=>e?e.replace(/_/g," ").split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" and "):"",da=(e,t,n,r,o,i,a)=>{const u=e.currentTarget.getBoundingClientRect(),c=window.innerHeight-u.bottom,d=u.top,p=window.innerWidth-u.right,h=u.left;let f,m;return f=u.bottom+r+window.scrollY,m=u.left,(c<t||c<o)&&(d>=t+a?f=u.top-t-r+window.scrollY:f=window.scrollY+a),f-window.scrollY<a&&(f=window.scrollY+a),(p<n||p<i)&&(h>=n?m=u.right-n:m=(window.innerWidth-n)/2),m<u.right+i&&(m=u.right+i),m<u.right&&m+n>u.left&&f<u.bottom&&f+t>u.top&&(p>=n+i?m=u.right+r+i:c>=t?f=u.bottom+r+window.scrollY:(f=window.scrollY+a,m=(window.innerWidth-n)/2)),{top:f,left:m}},Nd="_results_1pahy_1",Oo={results:Nd};function wd(e,t){return t?new t[e]().blockSettings.isAddable:!1}function Bo(e,t){return e?Object.keys(e||{}).reduce((n,r)=>(wd(r,t)&&n.push({name:r,displayName:s.getDisplayName(r,t)}),n),[]):[]}const Ld="_product_yggw5_1",jd="_name_yggw5_15",Mo={product:Ld,name:jd},vd=e=>{const{blockId:t,setSearchValue:n}=e,{sourceBlocks:r,setActiveBlock:o}=s.useBlocksStore(),{hideModal:i,hoverBlockId:a,isModalVisible:u,showPreview:c,hidePreview:d,clearHideTimeout:p,startHideTimeout:h,setHoverBlockTopPosition:f}=s.useSubmodalStore();function m(C){n(""),o(C),i("keyBlock")}function x(C,b){const A=window.innerHeight,y=400,P=10;let L=b.clientY-120;L+y>A&&(L=A-y-P),L<P&&(L=P),a||i("keyBlock"),c(C,"keyBlock"),p(),f(L)}function g(){u?h("keyBlock"):d("keyBlock"),f(null)}return s.jsxRuntimeExports.jsxs("div",{className:Mo.product,onClick:()=>m(t),onMouseEnter:C=>x(t,C),onMouseLeave:g,children:[nr[t]?s.jsxRuntimeExports.jsx("img",{src:nr[t]}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Cards"}),s.jsxRuntimeExports.jsx("span",{className:Mo.name,children:s.getDisplayName(t,r)}),s.jsxRuntimeExports.jsx(s.Icon,{name:"CaretRight",width:20,height:20})]},t)},ha=()=>{const{blocks:e,sourceBlocks:t}=s.useBlocksStore(),[n,r]=k.useState(""),[o,i]=k.useState([]),a=k.useMemo(()=>Bo(e,t),[e,t]),u=k.useMemo(()=>new s.Fuse(a,{keys:["displayName"],threshold:.4}),[a]);return k.useEffect(()=>{if(n.trim()==="")i(Bo(e,t));else{const c=u.search(n);i(c.map(d=>d.item))}},[n,u]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:r,value:n,style:{marginBottom:10}}),s.jsxRuntimeExports.jsx("div",{className:Oo.results,children:o.length>0?o.map(c=>s.jsxRuntimeExports.jsx(vd,{blockId:c.name,setSearchValue:r})):s.jsxRuntimeExports.jsx("div",{className:Oo.noResults,children:"No sections found"})})]})},Pd="_wrapper_1k1cr_1",Dd="_submodal_1k1cr_14",Ws={wrapper:Pd,submodal:Dd},Od=({children:e,positionTop:t,positionLeft:n})=>{const{keyBlock:r,startHideTimeout:o,clearHideTimeout:i,setMouseOverModal:a}=s.useSubmodalStore();return r?s.jsxRuntimeExports.jsx("div",{className:Ws.wrapper,style:t?{top:t,left:n||void 0}:{},onMouseEnter:()=>{i(),a(!0)},onMouseLeave:()=>{a(!1),o()},children:e}):null},Bd=({children:e})=>{const{hoverBlockId:t,startHideTimeout:n,clearHideTimeout:r,setMouseOverModal:o}=s.useSubmodalStore();return t?s.jsxRuntimeExports.jsx("div",{className:s.clx(Ws.wrapper,Ws.submodal),onMouseEnter:()=>{r(),o(!0)},onMouseLeave:()=>{o(!1),n()},children:e}):null},Md="_applyButton_1a9kh_2",Fd="_content_1a9kh_7",Hd="_title_1a9kh_14",Ud="_label_1a9kh_21",$d="_colorValue_1a9kh_40",zd="_colorMap_1a9kh_48",Wd="_indicator_1a9kh_57",qd="_hueSlider_1a9kh_66",Vd="_slider_1a9kh_97",Gd="_buttons_1a9kh_102",Yd="_name_1a9kh_109",Xd="_secondary_1a9kh_114",Qd="_input_1a9kh_122",Kd="_modal_1a9kh_160",Zd="_alphaSlider_1a9kh_249",Jd="_alphaBackground_1a9kh_257",e0="_alphaGradient_1a9kh_268",t0="_chargeTypes_1a9kh_297",n0="_charge_1a9kh_297",r0="_chargeActive_1a9kh_326",s0="_gradient_1a9kh_334",o0="_color_1a9kh_40",i0="_colorActive_1a9kh_355",a0="_gradientWrapper_1a9kh_362",u0="_subtitle_1a9kh_368",l0="_colorTypes_1a9kh_375",c0="_colorType_1a9kh_375",d0="_colorTypeActive_1a9kh_399",h0="_colorsWrapper_1a9kh_404",p0="_colors_1a9kh_404",le={applyButton:Md,content:Fd,title:Hd,label:Ud,colorValue:$d,colorMap:zd,indicator:Wd,hueSlider:qd,slider:Vd,buttons:Gd,name:Yd,secondary:Xd,input:Qd,modal:Kd,alphaSlider:Zd,alphaBackground:Jd,alphaGradient:e0,chargeTypes:t0,charge:n0,chargeActive:r0,gradient:s0,color:o0,colorActive:i0,gradientWrapper:a0,subtitle:u0,colorTypes:l0,colorType:c0,colorTypeActive:d0,colorsWrapper:h0,colors:p0},m0=()=>{const{modalPosition:e,color:t,initialColor:n,setShowModal:r,hue:o,saturation:i,brightness:a,alpha:u,dragging:c,setDragging:d,setHue:p,setSaturation:h,setBrightness:f,setAlpha:m,colorChange:x,setColor:g,update:C,isGradient:b,setIsGradient:A,gradientDirection:y,setGradientDirection:P,hue2:L,saturation2:R,brightness2:q,alpha2:Y,setHue2:K,setSaturation2:w,setBrightness2:$,setAlpha2:B,activeColorIndex:H,setActiveColorIndex:V,isGradientActive:z}=s.useColorPickerStore(),Z=(ie,te,Ee)=>{te/=100,Ee/=100;const re=ke=>(ke+ie/60)%6,pe=ke=>Ee*(1-te*Math.max(0,Math.min(re(ke),4-re(ke),1))),ue=Math.round(255*pe(5)),xe=Math.round(255*pe(3)),ge=Math.round(255*pe(1));return{r:ue,g:xe,b:ge}},G=ie=>ie.toString(16).padStart(2,"0"),W=(ie,te,Ee,re)=>{const{r:pe,g:ue,b:xe}=Z(ie,te,Ee),ge=Math.round(re/100*255);return`#${G(pe)}${G(ue)}${G(xe)}${G(ge)}`},J=(ie,te,Ee,re)=>{if(b)if(H===1){p(ie),h(te),f(Ee),m(re);const pe=W(ie,te,Ee,re),ue=W(L,R,q,Y),ge=`linear-gradient(${y==="vertical"?"0deg":"90deg"}, ${pe} 0%, ${ue} 100%)`;x(ge),g(ge)}else{K(ie),w(te),$(Ee),B(re);const pe=W(ie,te,Ee,re),ue=W(o,i,a,u),ge=`linear-gradient(${y==="vertical"?"0deg":"90deg"}, ${ue} 0%, ${pe} 100%)`;x(ge),g(ge)}else{const pe=W(ie,te,Ee,re);x(pe),g(pe)}},T=(ie,te,Ee)=>{const{width:re,height:pe}=Ee.getBoundingClientRect(),ue=Math.max(0,Math.min(ie/re*100,100)),xe=Math.max(0,Math.min(100-te/pe*100,100));b?H===1?(h(ue),f(xe),J(o,ue,xe,u)):(w(ue),$(xe),J(L,ue,xe,Y)):(h(ue),f(xe),J(o,ue,xe,u))},ce=ie=>{const{offsetX:te,offsetY:Ee}=ie.nativeEvent;d(!0),T(te,Ee,ie.currentTarget)},ye=ie=>{if(c){const te=document.querySelector(`.${le.colorMap}`),{left:Ee,top:re}=te.getBoundingClientRect(),pe=ie.clientX-Ee,ue=ie.clientY-re;T(pe,ue,te)}},S=()=>{d(!1)};k.useEffect(()=>{function ie(re){const pe=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,ue=re.match(pe);if(ue){const xe=ue[1],ge=ue[2],ke=ue[3];return{angle:xe,col1:ge,col2:ke}}return null}function te(re){const pe=parseInt(re.slice(1,3),16),ue=parseInt(re.slice(3,5),16),xe=parseInt(re.slice(5,7),16),ge=parseInt(re.slice(7,9),16)/255*100,{h:ke,s:Ot,b:v}=Ee(pe,ue,xe);return{h:ke,s:Ot,b:v,a:ge}}function Ee(re,pe,ue){re/=255,pe/=255,ue/=255;const xe=Math.max(re,pe,ue),ge=Math.min(re,pe,ue);let ke=0;const Ot=xe-ge,v=(xe===0?0:Ot/xe)*100,U=xe*100;if(xe===ge)ke=0;else switch(xe){case re:ke=((pe-ue)/Ot+(pe<ue?6:0))*60;break;case pe:ke=((ue-re)/Ot+2)*60;break;case ue:ke=((re-pe)/Ot+4)*60;break}return{h:ke,s:v,b:U}}if(n&&n.startsWith("linear-gradient")){const re=ie(n);if(re){const{angle:pe,col1:ue,col2:xe}=re,ge=te(ue),ke=te(xe);A(!0),P(pe==="0deg"?"vertical":"horizontal"),p(ge.h),h(ge.s),f(ge.b),m(ge.a),K(ke.h),w(ke.s),$(ke.b),B(ke.a),V(1)}}else if(n){const pe=function(xe){let ge=xe;return ge.length===7?ge+"ff":ge.length===9?ge:ge.length===4?ge[0]+ge[1].repeat(2)+ge[2].repeat(2)+ge[3].repeat(2)+"ff":"#000000ff"}(n),ue=te(pe);A(!1),p(ue.h),h(ue.s),f(ue.b),m(ue.a)}},[n,A,P,p,h,f,m,K,w,$,B,V]),k.useEffect(()=>{let ie,te,Ee,re;b?H===1?(ie=o,te=i,Ee=a,re=u):(ie=L,te=R,Ee=q,re=Y):(ie=o,te=i,Ee=a,re=u),J(ie,te,Ee,re)},[b,y,H,o,i,a,u,L,R,q,Y]),k.useEffect(()=>{const ie=Ee=>ye(Ee),te=()=>S();return c?(document.addEventListener("mousemove",ie),document.addEventListener("mouseup",te)):(document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",te)),()=>{document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",te)}},[c,b,y]);function ae(){if(!b)C(t);else{const ie=W(o,i,a,u),te=W(L,R,q,Y),re=`linear-gradient(${y==="vertical"?"0deg":"90deg"}, ${ie} 0%, ${te} 100%)`;C(re)}r(!1)}function Ae(){r(!1),x(n)}const ee=b?H===1?o:L:o,Oe=b?H===1?i:R:i,st=b?H===1?a:q:a,Dt=b?H===1?u:Y:u,{r:kt,g:Yt,b:xr}=Z(ee,Oe,st),us=`linear-gradient(to right, rgba(${kt}, ${Yt}, ${xr}, 0), rgba(${kt}, ${Yt}, ${xr}, 1))`,Er=W(o,i,a,u),jn=W(L,R,q,Y);return s.jsxRuntimeExports.jsxs("div",{className:le.modal,onClick:ie=>ie.stopPropagation(),style:{top:`${e.top}px`,left:`${e.left}px`},children:[s.jsxRuntimeExports.jsx("h2",{className:le.title,children:"Color"}),z&&s.jsxRuntimeExports.jsxs("div",{className:le.colorTypes,children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(le.colorType,{[le.colorTypeActive]:!b}),onClick:()=>A(!1),children:[s.jsxRuntimeExports.jsx("div",{style:{background:"#757575",width:"16px",height:"16px",borderRadius:"50%"}}),"Solid"]}),s.jsxRuntimeExports.jsxs("div",{className:s.clx(le.colorType,{[le.colorTypeActive]:b}),onClick:()=>A(!0),children:[s.jsxRuntimeExports.jsx("div",{style:{background:"linear-gradient(to bottom, #757575 0%, #DBDBDB 100%)",width:"16px",height:"16px",borderRadius:"50%"}}),"Linear"]})]}),b&&z&&s.jsxRuntimeExports.jsxs("div",{className:le.colorsWrapper,children:[s.jsxRuntimeExports.jsx("div",{className:le.colors,style:{background:`linear-gradient(90deg, ${Er} 0%, ${jn} 100%)`}}),s.jsxRuntimeExports.jsx("div",{className:s.clx(le.color,{[le.colorActive]:H===1}),onClick:()=>V(1),style:{background:Er}}),s.jsxRuntimeExports.jsx("div",{className:s.clx(le.color,{[le.colorActive]:H===2}),onClick:()=>V(2),style:{background:jn}})]}),s.jsxRuntimeExports.jsx("div",{className:le.colorMap,onMouseDown:ce,style:{background:`
|
|
100
100
|
linear-gradient(to top, black, transparent),
|
|
101
101
|
linear-gradient(to right, hsl(${ee}, 100%, 100%), hsl(${ee}, 100%, 50%))
|
|
102
102
|
`},children:s.jsxRuntimeExports.jsx("div",{className:le.indicator,style:{position:"absolute",left:`${Oe}%`,top:`${100-st}%`,transform:"translate(-50%, -50%)"}})}),s.jsxRuntimeExports.jsx("div",{className:le.hueSlider,style:{bottom:b?"175px":"100px"},children:s.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:ee,onChange:ie=>{const te=Number(ie.target.value);b?H===1?J(te,i,a,u):J(te,R,q,Y):(p(te),J(te,i,a,u))},className:le.slider})}),s.jsxRuntimeExports.jsxs("div",{className:le.alphaSlider,style:{bottom:b?"150px":"75px"},children:[s.jsxRuntimeExports.jsx("div",{className:le.alphaBackground}),s.jsxRuntimeExports.jsx("div",{className:le.alphaGradient,style:{background:us}}),s.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"100",value:Dt,onChange:ie=>{const te=Number(ie.target.value);b?H===1?J(o,i,a,te):J(L,R,q,te):(m(te),J(o,i,a,te))},className:le.slider})]}),b&&z&&s.jsxRuntimeExports.jsxs("div",{className:le.gradientWrapper,children:[s.jsxRuntimeExports.jsx("h3",{className:le.subtitle,children:"Rotation"}),s.jsxRuntimeExports.jsx("div",{className:le.gradient,children:s.jsxRuntimeExports.jsxs("div",{className:le.chargeTypes,children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(le.charge,{[le.chargeActive]:y==="horizontal"}),onClick:()=>P("horizontal"),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"ArrowsHorizontal",width:20,height:20}),"Horizontal"]}),s.jsxRuntimeExports.jsxs("div",{className:s.clx(le.charge,{[le.chargeActive]:y==="vertical"}),onClick:()=>P("vertical"),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"ArrowsVertical",width:20,height:20}),"Vertical"]})]})})]}),s.jsxRuntimeExports.jsxs("div",{className:le.buttons,children:[s.jsxRuntimeExports.jsx(s.Button,{onClick:Ae,className:s.clx(le.applyButton,le.cancelButton),type:"Secondary",children:"Cancel"}),s.jsxRuntimeExports.jsx(s.Button,{onClick:ae,className:le.applyButton,children:"Apply"})]})]})},f0=()=>{const{onPreview:e,zoomLevel:t}=s.usePreviewStore(),{keyBlock:n,hoverBlockId:r,isModalVisible:o,hoverBlockTopPosition:i}=s.useSubmodalStore(),{settings:a}=s.useSettingsStore(),{sourceBlocks:u}=s.useBlocksStore(),{pageContext:c}=s.usePagesStore(),{showModal:d}=s.useColorPickerStore(),{currentDevice:p}=s.useDeviceStore(),{isLoadingThemeSettings:h}=s.useThemeSettingsStore(),{isLoadingLayers:f}=s.useLayersStore(),m=y=>y?!u||!u[y]?s.jsxRuntimeExports.jsx(s.ErrorableBlock,{error:`Block "${y}" does not exist in blocks.`}):new u[y]().renderPreview(a,c):s.jsxRuntimeExports.jsx(s.ErrorableBlock,{error:"Block or block.name is undefined."});function x(){if(p.value==="desktop")return t>=1?"100%":`${(t*100).toFixed(2)}%`;{const y=p.value==="tablet"?768:425;return t>=1?`${y}px`:`${(y*t).toFixed(2)}px`}}function g(){switch(p.value){case"desktop":return"100%";case"tablet":return 768;case"mobile":return 425;default:return"100%"}}const{isOpenSelectModal:C}=s.usePagesStore(),b=k.useRef(null),A=y=>{b.current&&(b.current.scrollTop+=y.deltaY)};return s.jsxRuntimeExports.jsxs("div",{className:Bn.preview,style:{zIndex:d&&!C?5e3:500},onWheel:y=>{y.stopPropagation(),A(y)},children:[o&&s.jsxRuntimeExports.jsx(Bd,{children:s.jsxRuntimeExports.jsx(ha,{})}),s.jsxRuntimeExports.jsxs(Od,{positionTop:i,positionLeft:!r&&n?void 0:250,children:[!h&&!f&&s.jsxRuntimeExports.jsx(s.RenderBlock,{render:m,block:n},n),(h||!n||f)&&s.jsxRuntimeExports.jsx("div",{className:Bn.previewLoading,children:s.jsxRuntimeExports.jsx(Vt,{})})]}),d&&s.jsxRuntimeExports.jsx(m0,{}),e&&s.jsxRuntimeExports.jsxs("div",{className:Bn.main,style:{width:g()},children:[s.jsxRuntimeExports.jsx(Ad,{}),s.jsxRuntimeExports.jsx("div",{style:{borderLeft:x()==="100%"?"none":"var(--default-border)",borderRight:x()==="100%"?"none":"var(--default-border)",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 160px)",overflowY:"scroll",overflowX:"hidden"},onScroll:y=>{y.stopPropagation()},onWheel:y=>{y.stopPropagation()},children:!h&&!f?s.jsxRuntimeExports.jsx("div",{className:Bn.content,style:{width:x()},children:s.jsxRuntimeExports.jsx(s.PreviewContent,{scrollableRef:b})}):s.jsxRuntimeExports.jsx("div",{className:Bn.loading,children:s.jsxRuntimeExports.jsx(Vt,{})})})]})]})},g0="_sidebar_1xtkj_1",x0="_title_1xtkj_11",Fo={sidebar:g0,title:x0},E0="_layers_1jhzw_1",b0="_wrapper_1jhzw_9",I0="_draggingWrapper_1jhzw_17",T0="_block_1jhzw_21",_0="_dragging_1jhzw_17",C0="_active_1jhzw_56",S0="_add_1jhzw_63",y0="_addTop_1jhzw_79",k0="_visible_1jhzw_95",R0="_button_1jhzw_99",A0="_nameBlock_1jhzw_158",N0="_loader_1jhzw_162",w0="_actions_1jhzw_171",L0="_deleteButton_1jhzw_179",Be={layers:E0,wrapper:b0,draggingWrapper:I0,block:T0,dragging:_0,active:C0,add:S0,addTop:y0,visible:k0,button:R0,nameBlock:A0,loader:N0,actions:w0,deleteButton:L0},j0="_block_sj4cc_1",v0="_title_sj4cc_17",P0="_actions_sj4cc_21",Qt={block:j0,title:v0,actions:P0},ms={header:"Header",footer:"Footer",announcement:"Announcement"},fs=({id:e})=>{const{setCurrentBlock:t}=s.useLayersStore(),{activeBlock:n}=s.usePreviewStore(),[r,o]=k.useState(!1);function i(a){t(a)}return s.jsxRuntimeExports.jsxs("div",{className:s.clx(Qt.block,{[Qt.active]:n.id===e,[Qt.header]:e==="header",[Qt.footer]:e==="footer",[Qt.announcement]:e==="announcement"}),onClick:()=>i(e),onMouseOver:()=>o(!0),onMouseLeave:()=>o(!1),children:[nr[ms[e]]?s.jsxRuntimeExports.jsx("img",{src:nr[ms[e]],width:20,height:20}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Cards",width:20,height:20}),s.jsxRuntimeExports.jsx("span",{className:Qt.title,children:ms[e]}),s.jsxRuntimeExports.jsx("div",{className:Qt.actions,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"PushPin",hoverable:!0,width:20,height:20,fill:"#757575"})})]})},D0=({id:e,name:t,onClick:n,isDragging:r,icon:o})=>{const{activeBlock:i,setActiveBlock:a}=s.usePreviewStore(),{showPreview:u,hidePreview:c,showModal:d,hideModal:p,clearHideTimeout:h,startHideTimeout:f,hoverBlockId:m,isModalVisible:x}=s.useSubmodalStore(),{setPositionBlock:g}=s.useLayersStore(),[C,b]=k.useState(!1),[A,y]=k.useState(!1),[P,L]=k.useState(!1),[R,q]=k.useState(!1),[Y,K]=k.useState(null),w=k.useRef(null),{attributes:$,listeners:B,setNodeRef:H,transform:V,transition:z}=s.useSortable({id:e}),Z={transform:s.CSS.Transform.toString(V),transition:z},{setTitle:G,setDescription:W,setOnConfirm:J}=s.useConfirmationModalStore(),{pages:T,currentPage:ce}=s.usePagesStore(),{removeBlock:ye}=s.useLayersStore(),S=ee=>{ee.stopPropagation(),w.current&&clearTimeout(w.current),a({id:e,neededScroll:!0}),x&&p(),u(e),h()},ae=(ee,Oe=!0)=>{ee.stopPropagation(),c(),d(e),h(),g(e,Oe)},Ae=ee=>{ee.stopPropagation(),a({id:null,neededScroll:!1}),x?f():c()};return k.useEffect(()=>{L(!1),b(!1),y(!1),q(!1)},[r]),k.useEffect(()=>{x||(y(!1),b(!1))},[x]),s.jsxRuntimeExports.jsxs("div",{ref:H,style:Z,className:s.clx(Be.wrapper,{[Be.draggingWrapper]:r&&i.id===e}),onClick:ee=>{ee.stopPropagation(),n(e)},onMouseEnter:S,onMouseLeave:Ae,...$,...B,children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(Be.block,{[Be.dragging]:r&&i.id===e,[Be.active]:!r&&i.id===e}),children:[o?s.jsxRuntimeExports.jsx("img",{src:o,width:20,height:20}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Cards",width:20,height:20}),s.jsxRuntimeExports.jsx("span",{className:Be.nameBlock,children:t}),m===e&&!r&&s.jsxRuntimeExports.jsx("div",{className:s.clx(Be.addTop,{[Be.visible]:A}),onMouseEnter:()=>{y(!0)},onMouseLeave:()=>{y(!1)},children:s.jsxRuntimeExports.jsxs("button",{className:Be.button,onClick:ee=>ae(ee,!1),onMouseEnter:()=>{const ee=setTimeout(()=>{r||q(!0)},200);K(ee)},onMouseLeave:()=>{Y&&clearTimeout(Y),q(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Plus",fill:"#fff"}),R&&s.jsxRuntimeExports.jsx(Tn,{text:"Click to add a section"})]})}),m===e&&!r&&s.jsxRuntimeExports.jsx("div",{className:s.clx(Be.add,{[Be.visible]:C}),onMouseEnter:()=>{b(!0)},onMouseLeave:()=>{b(!1)},children:s.jsxRuntimeExports.jsxs("button",{className:Be.button,onClick:ee=>ae(ee),onMouseEnter:()=>{const ee=setTimeout(()=>{r||L(!0)},200);K(ee)},onMouseLeave:()=>{Y&&clearTimeout(Y),L(!1)},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Plus",fill:"#fff"}),P&&s.jsxRuntimeExports.jsx(Tn,{text:"Click to add a section"})]})})]}),m===e&&!r&&s.jsxRuntimeExports.jsxs("div",{className:Be.actions,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20}),s.jsxRuntimeExports.jsx("div",{className:Be.deleteButton,onClick:ee=>{ee.stopPropagation(),G("Remove Block"),W(`Are you sure you want to delete ${t||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),J(()=>{T&&ye(T[ce].path,e)})},children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Trash",fill:"#C12A2A",hoverable:!0,width:20,height:20})})]})]})},O0=()=>{const{blocks:e,setCurrentBlock:t,currentBlock:n,moveBlock:r,isLoadingLayers:o,announcement:i}=s.useLayersStore(),{currentPage:a,pages:u}=s.usePagesStore(),{setMouseOverModal:c,setHoverBlockId:d}=s.useSubmodalStore(),{sourceBlocks:p}=s.useBlocksStore();function h(b){t(b),c(!1),d(null)}const f=s.useSensors(s.useSensor(s.PointerSensor,{activationConstraint:{distance:5}})),[m,x]=k.useState(!1),g=()=>{x(!0)},C=b=>{x(!1);const{active:A,over:y}=b;if(y&&A.id!==y.id&&u&&u[a]){const P=u[a].path,L=e[P].order,R=L.indexOf(A.id),q=L.indexOf(y.id);R!==-1&&q!==-1&&r(P,R,q)}};return s.jsxRuntimeExports.jsx("div",{className:Be.layers,children:o?s.jsxRuntimeExports.jsx("div",{className:Be.loader,children:s.jsxRuntimeExports.jsx(Vt,{})}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[i&&s.jsxRuntimeExports.jsx(fs,{id:"announcement"}),s.jsxRuntimeExports.jsx(fs,{id:"header"}),!n&&s.jsxRuntimeExports.jsx(s.DndContext,{sensors:f,onDragEnd:C,onDragStart:g,children:u&&u[a]&&e[u[a].path]&&s.jsxRuntimeExports.jsx(s.SortableContext,{items:e[u[a].path].order,strategy:s.verticalListSortingStrategy,children:e[u[a].path].order.map((b,A)=>s.jsxRuntimeExports.jsx(D0,{id:b,name:s.getDisplayName(e[u[a].path].data[b].name,p),index:A,onClick:h,isDragging:m,icon:nr[e[u[a].path].data[b].name]},b))})}),s.jsxRuntimeExports.jsx(fs,{id:"footer"})]})})},B0="_loader_eyvkk_1",M0={loader:B0},F0=()=>{const{isLoadingSettings:e}=s.useSettingsStore();return e?s.jsxRuntimeExports.jsx("div",{className:M0.loader,children:s.jsxRuntimeExports.jsx(Vt,{})}):s.jsxRuntimeExports.jsx(H0,{})},H0=()=>{const{settings:e}=s.useSettingsStore(),{settings:t,setSettingsInstance:n}=s.useBlocksStore();if(!e)return null;const{setError:r}=s.useErrorStore(),o=new t(e.blockSettings);k.useEffect(()=>{n(o)},[e]);try{return o.renderSettings()}catch(i){throw console.error("Error rendering settings:",i),r({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),i}},U0="_theme_a1one_1",$0="_block_a1one_8",z0="_name_a1one_23",W0="_loader_a1one_27",_r={theme:U0,block:$0,name:z0,loader:W0},q0=()=>{const e=s.useNavigate(),{isLoadingThemeSettings:t,setActiveBlock:n}=s.useThemeSettingsStore();function r(o){switch(o==null?void 0:o.name){case"Colors":e("/admin/builder/theme/colors"),n(dt[0]);break;case"Fonts":e("/admin/builder/theme/fonts"),n(dt[1]);break;case"Borders":e("/admin/builder/theme/borders"),n(dt[2]);break;case"Buttons":e("/admin/builder/theme/buttons"),n(dt[3]);break;case"Inputs":e("/admin/builder/theme/inputs"),n(dt[4]);break}}return s.jsxRuntimeExports.jsx("div",{className:_r.theme,children:t?s.jsxRuntimeExports.jsx("div",{className:_r.loader,children:s.jsxRuntimeExports.jsx(Vt,{})}):dt.map(o=>s.jsxRuntimeExports.jsxs("div",{onClick:()=>r(o),className:s.clx(_r.block),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:o.icon}),s.jsxRuntimeExports.jsx("span",{className:_r.name,children:o.name}),s.jsxRuntimeExports.jsx(s.Icon,{name:"CaretRight"})]},o.icon))})},V0="_render_7e826_9",G0="_open_7e826_24",Y0="_close_7e826_51",X0="_clicked_7e826_55",Q0="_loading_7e826_72",K0="_settings_7e826_76",dn={render:V0,open:G0,close:Y0,clicked:X0,loading:Q0,settings:K0},Z0=({block:e})=>{const{pageContext:t}=s.usePagesStore(),{setError:n}=s.useErrorStore();try{return e.renderSettings(t)}catch(r){throw console.error("Error rendering settings:",r),n({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),r}},J0="_wrapper_15ju8_1",eh="_header_15ju8_8",th="_title_15ju8_15",nh="_colorWrapper_15ju8_21",rh="_name_15ju8_35",sh="_color_15ju8_21",oh="_value_15ju8_47",ih="_length_15ju8_51",et={wrapper:J0,header:eh,title:th,colorWrapper:nh,name:rh,color:sh,value:oh,length:ih},ah=e=>{const{colors:t}=e,{themeSettings:n}=s.useThemeSettingsStore(),[r,o]=k.useState(!0);k.useEffect(()=>{t.length<=3&&o(!0)},[]);function i(a){const u=a.replace("--",""),[c,d]=u.split("-"),p=`${d.charAt(0).toUpperCase()+d.slice(1)} ${c.charAt(0).toUpperCase()+c.slice(1)}`,[h,f]=u.split("-");return{name:p,field:h,variable:f}}return s.jsxRuntimeExports.jsxs("div",{className:et.wrapper,children:[s.jsxRuntimeExports.jsxs("div",{className:et.header,children:[s.jsxRuntimeExports.jsx("div",{className:et.title,children:"Section Colors"}),!r&&s.jsxRuntimeExports.jsxs("div",{className:s.clx(et.value,et.length),onClick:()=>o(!0),children:["+",t.length]})]}),r&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{className:et.colors,children:t.map(a=>{const u=i(a),{variable:c,name:d,field:p}=u;return s.jsxRuntimeExports.jsx(uh,{color:n.colors[p][c],name:d})})}),t.length>3&&s.jsxRuntimeExports.jsxs("div",{className:s.clx(et.value,et.length),onClick:()=>o(!1),children:["Hide ",t.length," colors"]})]})]})},uh=e=>{const{name:t,color:n}=e,{setActiveLabel:r,setModalPosition:o,setInitialColor:i,setShowModal:a,setUpdate:u,setColor:c,setColorChange:d,colorChange:p,setIsGradientActive:h}=s.useColorPickerStore(),{updateColor:f}=s.useThemeSettingsStore(),m=(C,b)=>A=>{f(C,b,A)};k.useEffect(()=>{const C=()=>{a(!1),r(null),i(n),u(()=>{}),c(n),d(()=>{})};return document.body.addEventListener("click",C),()=>{document.body.removeEventListener("click",C)}},[]);const x=C=>{const b=t.split("/")[0],A=b.split(" ")[0].toLowerCase(),y=b.split(" ")[1].toLowerCase();C.stopPropagation(),a(!0),d(p),u(R=>m(y,A)(R)),i(n),c(n),h(y==="surface");const{top:P,left:L}=da(C,550,288,10,20,230,80);o({top:y==="surface"?P:P+125,left:L-200})};function g(C){return C.length>15?C.slice(0,15)+"...":C}return s.jsxRuntimeExports.jsxs("div",{className:et.colorWrapper,onClick:x,children:[s.jsxRuntimeExports.jsx("div",{className:et.color,style:{background:n}}),s.jsxRuntimeExports.jsx("div",{className:et.name,children:t}),s.jsxRuntimeExports.jsx("div",{className:et.value,children:g(n)})]})},lh="_back_1sznl_1",ch="_title_1sznl_9",dh="_deleteButton_1sznl_17",hh="_backIcon_1sznl_30",Cr={back:lh,title:ch,deleteButton:dh,backIcon:hh},ph=({onClick:e,setIsClicked:t,getDisplayName:n})=>{var f,m;const{activeBlock:r}=s.useBlocksStore(),{setTitle:o,setDescription:i,setOnConfirm:a}=s.useConfirmationModalStore(),{blocks:u,currentBlock:c,removeBlock:d}=s.useLayersStore(),{currentPage:p,pages:h}=s.usePagesStore();return s.jsxRuntimeExports.jsxs("div",{className:Cr.back,children:[s.jsxRuntimeExports.jsx("div",{className:Cr.backIcon,onClick:()=>e(),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),s.jsxRuntimeExports.jsx("h3",{className:Cr.title,children:r&&n(r)||h&&h[p]&&u[h[p].path]&&c&&n((f=u[h[p].path].data[c])==null?void 0:f.name)||c&&Ct(c)||"Loading"}),c&&h&&!["header","footer","announcement"].includes(c)&&u[h[p].path].data[c]&&n((m=u[h[p].path].data[c])==null?void 0:m.name)!=="unknown name"&&s.jsxRuntimeExports.jsx("button",{onClick:x=>{var g;x.stopPropagation(),o("Remove Block"),i(`Are you sure you want to delete ${n((g=u[h[p].path].data[c])==null?void 0:g.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),a(()=>{t(!0),d(h[p].path,c),e(!0)})},className:Cr.deleteButton,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A"})})]})},mh=()=>{const e=s.useNavigate(),[t,n]=k.useState(!1),{header:r,footer:o,announcement:i,sourceBlocks:a,activeBlock:u,setActiveBlock:c,currentInstance:d,setCurrentInstance:p}=s.useBlocksStore(),{setActiveBlock:h}=s.usePreviewStore(),{blocks:f,addBlock:m,editBlock:x,currentBlock:g,setCurrentBlock:C,header:b,footer:A,announcement:y,isLoadingLayers:P}=s.useLayersStore(),{currentPage:L,pages:R}=s.usePagesStore(),{past:q,future:Y}=s.useHistoryStore();function K(B=!1){if(R&&d&&g&&!["header","footer","announcement"].includes(g)&&!B){const H={blockSettings:{}};Object.keys(d.blockSettings).filter(V=>!["displayName","isAddable"].includes(V)).map(V=>{H.blockSettings[V]=d.blockSettings[V]}),x(R[L].path,g,{name:f[R[L].path].data[g].name,value:H})}c(null),C(null),h({id:null,neededScroll:!1}),setTimeout(()=>{n(!1)},150),p(null)}function w(B){var Z;if(!R||!L||!B)return null;if(B==="header"){const G=new r;return Object.keys(G.blockSettings).forEach(W=>{G.blockSettings[W]=b==null?void 0:b.blockSettings[W]}),Object.keys(G.blockColors).forEach(W=>{G.blockColors[W]=b==null?void 0:b.blockColors[W]}),G}if(B==="footer"){const G=new o;return Object.keys(G.blockSettings).forEach(W=>{G.blockSettings[W]=A==null?void 0:A.blockSettings[W]}),Object.keys(G.blockColors).forEach(W=>{G.blockColors[W]=A==null?void 0:A.blockColors[W]}),G}if(B==="announcement"){const G=new i;return Object.keys(G.blockSettings).forEach(W=>{G.blockSettings[W]=y==null?void 0:y.blockSettings[W]}),Object.keys(G.blockColors).forEach(W=>{G.blockColors[W]=y==null?void 0:y.blockColors[W]}),G}const H=f[R[L].path];if(!H||!H.data[B])return null;const V=H.data[B];return!V||!a[V.name]?null:new a[V.name]((Z=V.value)==null?void 0:Z.blockSettings)}k.useEffect(()=>{if(g){const B=w(g);p(B)}else p(null)},[g,q,Y,u]),k.useEffect(()=>{if(u&&R&&!g){const B={blockSettings:{},blockColors:{}},H=new a[u];p(H),Object.keys(H.blockSettings).filter(z=>!["displayName","isAddable"].includes(z)).map(z=>{B.blockSettings[z]=H.blockSettings[z]}),Object.keys(H.blockColors).filter(z=>!["displayName","isAddable"].includes(z)).map(z=>{B.blockColors[z]=H.blockColors[z]});const V=m(R[L].path,{name:u,value:B});h({id:V,neededScroll:!0}),C(V),e("/admin/builder")}},[u,q,Y]);function $(B){if(!a)return"unknown name";if(!a[B])return g==="header"?b==null?void 0:b.blockSettings.displayName:g==="footer"?A==null?void 0:A.blockSettings.displayName:g==="announcement"?y==null?void 0:y.blockSettings.displayName:"unknown name";const H=new a[B];return!H.blockSettings||!H.blockSettings.displayName?"unknown name":H.blockSettings.displayName}return s.jsxRuntimeExports.jsxs("div",{className:s.clx(dn.render,{[dn.open]:g,[dn.close]:!g,[dn.clicked]:t}),onClick:B=>B.stopPropagation(),style:{opacity:P?0:1},children:[s.jsxRuntimeExports.jsx(ph,{onClick:K,setIsClicked:n,getDisplayName:$}),s.jsxRuntimeExports.jsxs("div",{className:dn.settings,children:[d&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(Z0,{block:d}),s.jsxRuntimeExports.jsx(ah,{colors:d.blockColors})]}),!u&&!g&&s.jsxRuntimeExports.jsx("div",{className:dn.loading,children:"Loading"})]})]})},fh="_header_9rrfr_1",gh="_title_9rrfr_9",xh="_backIcon_9rrfr_15",gs={header:fh,title:gh,backIcon:xh},ar=({onClick:e,title:t})=>s.jsxRuntimeExports.jsxs("div",{className:gs.header,children:[s.jsxRuntimeExports.jsx("div",{className:gs.backIcon,onClick:e,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),s.jsxRuntimeExports.jsx("span",{className:gs.title,children:t})]}),Eh="_options_ymds7_1",bh={options:Eh},Ih="_wrapper_kzokw_1",Th="_open_kzokw_16",_h="_close_kzokw_20",xs={wrapper:Ih,open:Th,close:_h},ur=e=>{const{isOpen:t,isClose:n,children:r}=e;return s.jsxRuntimeExports.jsx("div",{className:s.clx(xs.wrapper,{[xs.open]:t,[xs.close]:n}),children:r})},Ch=()=>{var d,p;const{activeBlock:e,themeSettings:t,updateBorder:n,setActiveBlock:r}=s.useThemeSettingsStore();function o(h,f){n(f,h)}const i=s.useNavigate();function a(){r(null),i("/admin/builder/theme")}const u=k.useMemo(()=>t.borders,[t]),c=(e==null?void 0:e.name)==="Borders";return s.jsxRuntimeExports.jsxs(ur,{isOpen:c,isClose:!c,children:[s.jsxRuntimeExports.jsx(ar,{onClick:a,title:"Borders Style"}),s.jsxRuntimeExports.jsxs("div",{className:bh.options,children:[s.jsxRuntimeExports.jsx(s.Select,{label:"Border Radius (px)",options:Object.keys(ls),value:((d=Object.entries(ls).find(([h,f])=>f===u.radius))==null?void 0:d[0])||"None",onChange:h=>o(ls[h],"radius")}),s.jsxRuntimeExports.jsx(s.Select,{label:"Border Thickness (px)",options:Object.keys(cs),value:((p=Object.entries(cs).find(([h,f])=>f===u.thickness))==null?void 0:p[0])||"None",onChange:h=>o(cs[h],"thickness")})]})]})},Sh="_options_jo38w_1",yh="_alignments_jo38w_9",kh="_blocks_jo38w_15",Rh="_alignment_jo38w_9",Ah="_active_jo38w_34",Nh="_chargeTypes_jo38w_41",wh="_charge_jo38w_41",Lh="_chargeActive_jo38w_69",jh="_sliderContainer_jo38w_83",vh="_shadowInputs_jo38w_91",Ph="_label_jo38w_102",Dh="_shadowInputsRow_jo38w_111",Oh="_shadowInputsOpen_jo38w_119",We={options:Sh,alignments:yh,blocks:kh,alignment:Rh,active:Ah,chargeTypes:Nh,charge:wh,chargeActive:Lh,sliderContainer:jh,shadowInputs:vh,label:Ph,shadowInputsRow:Dh,shadowInputsOpen:Oh};function Es(e){return(e.includes("linear-gradient")||e.includes("radial-gradient"))&&/^linear-gradient\(\d+deg,\s*#[A-Fa-f0-9]{8}\s+\d+%,\s*#[A-Fa-f0-9]{8}\s+\d+%\)$/.test(e)?!0:/^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(e)}const ht=e=>{const{initialColor:t,onChange:n,title:r,labelStyle:o="primary",isGradientActive:i=!0}=e,[a,u]=k.useState(t);k.useEffect(()=>{u(t)},[t]);const{setActiveLabel:c,setModalPosition:d,setInitialColor:p,setShowModal:h,setUpdate:f,setColor:m,setColorChange:x,setIsGradientActive:g,colorChange:C}=s.useColorPickerStore();k.useEffect(()=>{const P=()=>{h(!1),c(null),p(t),f(()=>{}),m(t),x(()=>{})};return document.body.addEventListener("click",P),()=>{document.body.removeEventListener("click",P)}},[t]);const b=P=>{P.stopPropagation(),h(!0),x(u),f(n),p(t),m(a),g(i);const{top:L,left:R}=da(P,600,288,10,20,230,80);d({top:L,left:R})},A=P=>{const L=P.target.value;u(L),Es(L)&&(n(L),m(L),x(C))},y=()=>{Es(a)||u(t)};return s.jsxRuntimeExports.jsxs("div",{className:le.content,children:[s.jsxRuntimeExports.jsx("span",{className:s.clx(le.name,{[le.secondary]:o==="secondary"}),children:r}),s.jsxRuntimeExports.jsxs("label",{className:le.label,onClick:P=>P.stopPropagation(),children:[s.jsxRuntimeExports.jsx("div",{className:le.colorValue,style:{background:Es(a)?a:t},onClick:b}),s.jsxRuntimeExports.jsx("input",{type:"text",value:a.includes("linear-gradient")?a:a.toUpperCase(),onChange:A,onBlur:y,className:le.input,style:{textTransform:a.includes("linear-gradient")?"none":"uppercase"}})]})]})},Bh=["left","center","right"],Mh=()=>{const{activeBlock:e,themeSettings:t,updateButton:n,setActiveBlock:r}=s.useThemeSettingsStore(),{fonts:o}=s.useFontsStore(),[i,a]=k.useState("primary");function u(g,C){n(i,C,g)}const[c,d]=k.useState(!1),p=t.buttons[i],h=s.useNavigate();function f(){r(null),h("/admin/builder/theme")}const m=(e==null?void 0:e.name)==="Buttons";function x(g,C){u({...p.boxShadow,[g]:C},"boxShadow")}return s.jsxRuntimeExports.jsxs(ur,{isOpen:m,isClose:!m,children:[s.jsxRuntimeExports.jsx(ar,{onClick:f,title:"Buttons Style"}),s.jsxRuntimeExports.jsx("div",{className:We.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(g=>s.jsxRuntimeExports.jsx("div",{className:s.clx(We.charge,{[We.chargeActive]:i===g}),onClick:()=>a(g),children:g.charAt(0).toUpperCase()+g.slice(1)},g))}),p&&s.jsxRuntimeExports.jsxs("div",{className:We.options,children:[s.jsxRuntimeExports.jsx(s.Input,{label:"Height (px)",value:String(p.height),onChange:g=>u(Number(g),"height"),type:"number",min:0}),s.jsxRuntimeExports.jsx(s.Select,{label:"Font Size (px)",value:String(p.size),onChange:g=>u(Number(g),"size"),options:$r}),s.jsxRuntimeExports.jsx(s.Input,{label:"Border Radius (px)",value:String(p.radius),onChange:g=>u(Number(g),"radius"),type:"number",min:0}),s.jsxRuntimeExports.jsx(s.Select,{label:"Font",value:p.font,onChange:g=>u(g,"font"),options:[...o.filter(g=>g.name!==p.font).map(g=>g.name)]}),s.jsxRuntimeExports.jsx(ht,{initialColor:p.color,onChange:g=>u(g,"color"),title:"Text Color",labelStyle:"secondary",isGradientActive:!1}),s.jsxRuntimeExports.jsx(ht,{initialColor:p.background,onChange:g=>u(g,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),s.jsxRuntimeExports.jsxs("div",{className:We.sliderContainer,children:[s.jsxRuntimeExports.jsx("h4",{className:We.label,children:"Shadow"}),s.jsxRuntimeExports.jsx(s.Button,{type:"Secondary",onClick:()=>d(!c),style:{padding:5,display:"flex"},children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CaretUp",style:{rotate:c?"0deg":"-180deg",transition:"0.3s rotate ease"}})})]}),s.jsxRuntimeExports.jsxs("div",{className:s.clx(We.shadowInputs,{[We.shadowInputsOpen]:c}),children:[s.jsxRuntimeExports.jsxs("div",{className:We.shadowInputsRow,children:[s.jsxRuntimeExports.jsx(s.Input,{label:"Left (px)",value:String(p.boxShadow.left),onChange:g=>x("left",Number(g)),type:"number"}),s.jsxRuntimeExports.jsx(s.Input,{label:"Top (px)",value:String(p.boxShadow.top),onChange:g=>x("top",Number(g)),type:"number"}),s.jsxRuntimeExports.jsx(s.Input,{label:"Blur (px)",value:String(p.boxShadow.blur),onChange:g=>x("blur",Number(g)),type:"number"}),s.jsxRuntimeExports.jsx("div",{style:{flex:1,whiteSpace:"nowrap"},children:s.jsxRuntimeExports.jsx(s.Input,{label:"Spread (px)",value:String(p.boxShadow.spread),onChange:g=>x("spread",Number(g)),type:"number"})})]}),s.jsxRuntimeExports.jsx(ht,{initialColor:p.boxShadow.color,onChange:g=>x("color",g),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),s.jsxRuntimeExports.jsxs("div",{className:We.alignments,children:[s.jsxRuntimeExports.jsx("h4",{className:We.label,children:"Alignment Type"}),s.jsxRuntimeExports.jsx("div",{className:We.blocks,children:Bh.map(g=>s.jsxRuntimeExports.jsx("div",{className:s.clx(We.alignment,{[We.active]:p.alignment===g}),onClick:()=>{u(g,"alignment")},children:s.jsxRuntimeExports.jsx(s.Icon,{name:g==="center"?"AlignCenterHorizontal":g==="left"?"AlignLeft":"AlignRight",fill:p.alignment===g?"#252525":"#757575"})},g))})]}),s.jsxRuntimeExports.jsx(s.Switch,{label:"Enable Hover",onChange:g=>u(g,"hover"),current:p.hover}),p.hover&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(ht,{initialColor:p.colorHover,onChange:g=>u(g,"colorHover"),title:"Hover Text Color",labelStyle:"secondary",isGradientActive:!1}),s.jsxRuntimeExports.jsx(ht,{initialColor:p.backgroundHover,onChange:g=>u(g,"backgroundHover"),title:"Hover Background Color",labelStyle:"secondary",isGradientActive:!0})]})]})]})},Fh="_category_hxy9u_1",Hh="_categoryTitle_hxy9u_19",bs={category:Fh,categoryTitle:Hh},Uh=()=>{const{themeSettings:e,setActiveColorCategory:t}=s.useThemeSettingsStore();function n(r){t(r)}return s.jsxRuntimeExports.jsx("div",{className:bs.wrapper,children:Object.keys(e.colors).map(r=>r==="icon"?s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{}):s.jsxRuntimeExports.jsxs("div",{className:bs.category,onClick:()=>n(r),children:[s.jsxRuntimeExports.jsxs("h2",{className:bs.categoryTitle,children:[r==="text"?"Text & Icon":Ct(r)," Colors"]}),s.jsxRuntimeExports.jsx(s.Icon,{name:"CaretRight",width:24,height:24})]},r))})},$h="_options_ikvjo_38",zh={options:$h},Wh=()=>{const{activeBlock:e,setActiveFont:t,activeFont:n,themeSettings:r,updateFont:o}=s.useThemeSettingsStore(),{fonts:i}=s.useFontsStore(),[a,u]=k.useState(null);function c(){t(null)}function d(g,C){a&&n&&o("desktop",a,n,C,g)}const[p,h]=k.useState([]),f=k.useMemo(()=>n?r.fonts.desktop.heading[n]?(u("heading"),r.fonts.desktop.heading[n]):r.fonts.desktop.body[n]?(u("body"),r.fonts.desktop.body[n]):(u(null),null):null,[n,r]);k.useEffect(()=>{if(f){const g=i.find(C=>C.name===f.font);g&&(h(g.weights),g.weights.includes(f.boldWeight)||d("400","boldWeight"),g.weights.includes(f.weight)||d("400","weight"))}},[f,n]);const m=!!((e==null?void 0:e.name)==="Fonts"&&n),x=(e==null?void 0:e.name)!=="Fonts"||!n;return s.jsxRuntimeExports.jsxs(ur,{isOpen:m,isClose:x,children:[s.jsxRuntimeExports.jsx(ar,{onClick:c,title:"Font Style"}),n&&f&&s.jsxRuntimeExports.jsxs("div",{className:zh.options,children:[s.jsxRuntimeExports.jsx(s.Select,{label:"Font",value:f.font,onChange:g=>d(g,"font"),options:[...i.filter(g=>g.name!==f.font).map(g=>g.name)]}),s.jsxRuntimeExports.jsx(s.Select,{label:"Size",value:String(f.size),onChange:g=>d(g,"size"),options:$r}),s.jsxRuntimeExports.jsx(s.Select,{label:"Default Weight",value:String(f.weight),onChange:g=>d(g,"weight"),options:p}),s.jsxRuntimeExports.jsx(s.Select,{label:"Bold Weight",value:String(f.boldWeight),onChange:g=>d(g,"boldWeight"),options:p}),s.jsxRuntimeExports.jsx(s.Select,{label:"Case",value:String(f.case).charAt(0).toUpperCase()+String(f.case).slice(1),onChange:g=>d(g.toLowerCase(),"case"),options:["Normal","Uppercase","Lowercase","Capitalize"].filter(g=>g.toLowerCase()!==String(f.case))})]})]})},qh="_wrapper_mkmxa_1",Vh="_category_mkmxa_5",Gh="_categoryTitle_mkmxa_11",Yh="_font_mkmxa_17",Xh="_content_mkmxa_32",Qh="_icon_mkmxa_39",Kh="_paragraph_mkmxa_50",Lt={wrapper:qh,category:Vh,categoryTitle:Gh,font:Yh,content:Xh,icon:Qh,paragraph:Kh},Zh={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",h7:"h7",lg:"large",md:"medium",sm:"small"},Jh=e=>{const{font:t,size:n,id:r,category:o}=e,{setActiveFont:i}=s.useThemeSettingsStore();return s.jsxRuntimeExports.jsxs("div",{className:Lt.font,onClick:()=>i(r),children:[s.jsxRuntimeExports.jsx("div",{className:s.clx(Lt.icon,{[Lt.paragraph]:o==="paragraph"}),children:s.jsxRuntimeExports.jsx(s.Icon,{name:o==="paragraph"?"TextB":"TextH"})}),s.jsxRuntimeExports.jsxs("div",{className:Lt.content,children:[s.jsxRuntimeExports.jsx("h2",{className:Lt.categoryTitle,children:Ct(Zh[r])}),s.jsxRuntimeExports.jsx("span",{className:Lt.value,children:`${t}, ${n}px`})]})]})},ep=()=>{const{themeSettings:e,setActiveFont:t,activeBlock:n}=s.useThemeSettingsStore();k.useEffect(()=>(r(),()=>{r()}),[]);function r(){t(null)}if(n!=null&&n.name)return s.jsxRuntimeExports.jsx("div",{className:Lt.wrapper,children:Object.entries(e.fonts.desktop).sort(([o],[i])=>o==="heading"?-1:i==="heading"?1:0).map(([o,i])=>s.jsxRuntimeExports.jsxs("div",{className:Lt.category,children:[s.jsxRuntimeExports.jsx("h2",{className:Lt.categoryTitle,children:Ct(o)}),Object.entries(i).map(([a,u])=>s.jsxRuntimeExports.jsx(Jh,{id:a,category:o,...u},a))]},o))})},tp="_wrapper_16ym0_2",np="_categoryTitle_16ym0_12",rp="_title_16ym0_74",sp="_field_16ym0_82",op="_alignments_16ym0_92",ip="_lineField_16ym0_98",ap="_style_16ym0_106",up="_header_16ym0_113",ct={wrapper:tp,categoryTitle:np,title:rp,field:sp,alignments:op,lineField:ip,style:ap,header:up},lp="_blocks_emecf_1",cp="_block_emecf_1",dp="_active_emecf_21",Is={blocks:lp,block:cp,active:dp},Ho=e=>{const{items:t,selectedItem:n,onSelect:r,getIconName:o}=e;return s.jsxRuntimeExports.jsx("div",{className:Is.blocks,children:t.map(i=>s.jsxRuntimeExports.jsx("div",{className:s.clx(Is.block,{[Is.active]:n===i}),onClick:()=>r(i),children:s.jsxRuntimeExports.jsx(s.Icon,{name:o(i),fill:n===i?"#252525":"#757575"})},String(i)))})},hp=["left","center","right"],pp=["solid","dashed"],Mn=e=>{const{title:t,children:n,rightAddon:r}=e;return s.jsxRuntimeExports.jsxs("div",{className:ct.field,children:[s.jsxRuntimeExports.jsxs("div",{className:ct.header,children:[s.jsxRuntimeExports.jsx("h4",{className:ct.categoryTitle,children:t}),r]}),n]})},mp=()=>{const{themeSettings:e,updateInput:t}=s.useThemeSettingsStore(),n=k.useMemo(()=>e.inputs,[e]),r=(i,a,u)=>{t(i,a,u)},o=i=>a=>{t(i,a,"color")};return s.jsxRuntimeExports.jsxs("div",{className:ct.wrapper,children:[s.jsxRuntimeExports.jsxs(Mn,{title:"General",children:[s.jsxRuntimeExports.jsx(s.Input,{label:"Height (px)",value:String(n.general.height),onChange:i=>r("general",i,"height"),type:"number",min:0}),s.jsxRuntimeExports.jsx(s.Select,{label:"Font Size (px)",onChange:i=>r("general",i,"size"),value:String(n.general.size),options:$r}),s.jsxRuntimeExports.jsx(ht,{initialColor:Ct(n.general.color),onChange:o("general"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})]}),s.jsxRuntimeExports.jsx(Mn,{title:"Field Fill",rightAddon:s.jsxRuntimeExports.jsx("div",{className:ct.switch,children:s.jsxRuntimeExports.jsx(s.Switch,{onChange:i=>r("field",i,"active"),current:n.field.active})}),children:s.jsxRuntimeExports.jsx(ht,{initialColor:n.field.color,onChange:o("field"),title:"Color",labelStyle:"secondary"})}),s.jsxRuntimeExports.jsx(Mn,{title:"Placeholder",children:s.jsxRuntimeExports.jsx(ht,{initialColor:Ct(n.placeholder.color),onChange:o("placeholder"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})}),s.jsxRuntimeExports.jsxs(Mn,{title:"Border",rightAddon:s.jsxRuntimeExports.jsx("div",{className:ct.switch,children:s.jsxRuntimeExports.jsx(s.Switch,{onChange:i=>r("border",i,"active"),current:n.border.active})}),children:[s.jsxRuntimeExports.jsxs("div",{className:ct.lineField,children:[s.jsxRuntimeExports.jsxs("div",{className:ct.style,children:[s.jsxRuntimeExports.jsx("span",{className:ct.title,children:"Style"}),s.jsxRuntimeExports.jsx(Ho,{items:pp,selectedItem:n.border.style,onSelect:i=>r("border",i,"style"),getIconName:i=>i==="solid"?"Minus":"Selection"})]}),s.jsxRuntimeExports.jsx(s.Input,{label:"Radius (px)",value:String(n.border.radius),onChange:i=>r("border",i,"radius"),type:"number",min:0})]}),s.jsxRuntimeExports.jsx(s.Input,{label:"Thickness (px)",value:String(n.border.thickness),onChange:i=>r("border",i,"thickness"),type:"number",min:0}),s.jsxRuntimeExports.jsx(ht,{initialColor:Ct(n.border.color),onChange:o("border"),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),s.jsxRuntimeExports.jsxs(Mn,{title:"Label",children:[s.jsxRuntimeExports.jsx(s.Input,{label:"Line Height (px)",value:String(n.label.height),onChange:i=>r("label",i,"height"),type:"number",min:0}),s.jsxRuntimeExports.jsx(s.Select,{label:"Font Size (px)",onChange:i=>r("label",i,"size"),value:String(n.label.size),options:$r}),s.jsxRuntimeExports.jsx(ht,{initialColor:Ct(n.label.color),onChange:o("label"),title:"Color",labelStyle:"secondary",isGradientActive:!1}),s.jsxRuntimeExports.jsxs("div",{className:ct.alignments,children:[s.jsxRuntimeExports.jsx("h4",{className:ct.title,children:"Alignment Type"}),s.jsxRuntimeExports.jsx(Ho,{items:hp,selectedItem:n.label.alignment,onSelect:i=>r("label",i,"alignment"),getIconName:i=>i==="center"?"AlignCenterHorizontal":i==="left"?"AlignLeft":"AlignRight"})]})]})]})},fp="_wrapper_1yw63_2",gp="_color_1yw63_24",xp="_content_1yw63_33",Ep="_preview_1yw63_42",bp="_container_1yw63_52",Ip="_buttonWrapper_1yw63_62",Tp="_button_1yw63_62",_p="_buttonBorder_1yw63_80",Cp="_buttonBackground_1yw63_83",Sp="_text_1yw63_87",yp="_textText_1yw63_93",kp="_icon_1yw63_97",Rp="_iconIcon_1yw63_100",Ap="_annotation_1yw63_104",Np="_annotationText_1yw63_111",wp="_label_1yw63_116",Lp="_circle_1yw63_127",jp="_line_1yw63_140",vp="_circle1_1yw63_154",Pp="_circle2_1yw63_159",Dp="_annotationIcon_1yw63_164",Op="_annotationBorder_1yw63_192",Bp="_line1_1yw63_203",Mp="_line2_1yw63_210",Fp="_circle3_1yw63_227",Hp="_circle4_1yw63_232",Up="_annotationSurface_1yw63_237",X={wrapper:fp,color:gp,content:xp,preview:Ep,container:bp,buttonWrapper:Ip,button:Tp,buttonBorder:_p,buttonBackground:Cp,text:Sp,textText:yp,icon:kp,iconIcon:Rp,annotation:Ap,annotationText:Np,label:wp,circle:Lp,line:jp,circle1:vp,circle2:Pp,annotationIcon:Dp,annotationBorder:Op,line1:Bp,line2:Mp,circle3:Fp,circle4:Hp,annotationSurface:Up},$p=()=>{const{activeColorCategory:e}=s.useThemeSettingsStore();return s.jsxRuntimeExports.jsx("div",{className:X.container,children:s.jsxRuntimeExports.jsxs("div",{className:X.buttonWrapper,children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(X.button,{[X.buttonBorder]:e==="border",[X.buttonBackground]:e==="surface"}),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Smiley",className:s.clx(X.icon,{[X.iconIcon]:e==="text"}),width:22,height:22,fill:"#757575"}),s.jsxRuntimeExports.jsx("span",{className:s.clx(X.text,{[X.textText]:e==="text"}),children:"Button Example"})]}),e==="text"&&s.jsxRuntimeExports.jsxs("div",{className:s.clx(X.annotation,X.annotationText),children:[s.jsxRuntimeExports.jsx("div",{className:X.label,children:"Text Color"}),s.jsxRuntimeExports.jsx("div",{className:X.line}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.circle,X.circle1)}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.circle,X.circle2)})]}),e==="text"&&s.jsxRuntimeExports.jsxs("div",{className:s.clx(X.annotation,X.annotationIcon),children:[s.jsxRuntimeExports.jsx("div",{className:X.label,children:"Icon Color"}),s.jsxRuntimeExports.jsx("div",{className:X.line}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.circle,X.circle1)}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.circle,X.circle2)})]}),e==="border"&&s.jsxRuntimeExports.jsxs("div",{className:s.clx(X.annotation,X.annotationBorder),children:[s.jsxRuntimeExports.jsx("div",{className:X.label,children:"Border Color"}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.line,X.line1)}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.line,X.line2)}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.circle,X.circle1)}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.circle,X.circle2)}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.circle,X.circle3)}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.circle,X.circle4)})]}),e==="surface"&&s.jsxRuntimeExports.jsxs("div",{className:s.clx(X.annotation,X.annotationSurface),children:[s.jsxRuntimeExports.jsx("div",{className:X.label,children:"Surface Color"}),s.jsxRuntimeExports.jsx("div",{className:X.line}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.circle,X.circle1)}),s.jsxRuntimeExports.jsx("div",{className:s.clx(X.circle,X.circle2)})]})]})})},zp={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"]},Wp=()=>{const{activeBlock:e,setActiveColorCategory:t,activeColorCategory:n,themeSettings:r,updateColor:o}=s.useThemeSettingsStore();function i(){t(null)}function a(p,h,f){o(p,h,f)}const u=!!((e==null?void 0:e.name)==="Colors"&&n),c=(e==null?void 0:e.name)!=="Colors"||!n,d=n?zp[n]:[];return s.jsxRuntimeExports.jsxs(ur,{isOpen:u,isClose:c,children:[s.jsxRuntimeExports.jsx(ar,{onClick:i,title:n==="text"?"Text & Icon Colors":`${Ct(n)} Colors`}),n&&s.jsxRuntimeExports.jsxs("div",{className:X.wrapper,children:[s.jsxRuntimeExports.jsx($p,{}),d.map(p=>{const h=r.colors[n][p];return typeof h!="string"?null:s.jsxRuntimeExports.jsx("div",{className:X.color,children:s.jsxRuntimeExports.jsxs("div",{className:X.content,children:[s.jsxRuntimeExports.jsx("div",{className:X.preview,style:{background:h}}),s.jsxRuntimeExports.jsx(ht,{title:Ct(p),initialColor:h,onChange:f=>a(n,p,f),isGradientActive:n==="surface"})]})},p)})]})]})},qp="_loader_1p5lr_1",Vp={loader:qp},Gp=()=>{const{activeBlock:e,themeSettings:t,isLoadingThemeSettings:n}=s.useThemeSettingsStore();return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:n?s.jsxRuntimeExports.jsx("div",{className:Vp.loader,children:s.jsxRuntimeExports.jsx(Vt,{})}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[(e==null?void 0:e.name)==="Fonts"&&t.fonts&&s.jsxRuntimeExports.jsx(ep,{}),(e==null?void 0:e.name)==="Fonts"&&t.fonts&&s.jsxRuntimeExports.jsx(Wh,{}),(e==null?void 0:e.name)==="Colors"&&t.colors&&s.jsxRuntimeExports.jsx(Uh,{}),(e==null?void 0:e.name)==="Colors"&&t.colors&&s.jsxRuntimeExports.jsx(Wp,{}),(e==null?void 0:e.name)==="Inputs"&&t.inputs&&s.jsxRuntimeExports.jsx(mp,{}),(e==null?void 0:e.name)==="Borders"&&t.borders&&s.jsxRuntimeExports.jsx(Ch,{}),(e==null?void 0:e.name)==="Buttons"&&t.buttons&&s.jsxRuntimeExports.jsx(Mh,{})]})})},Yp=()=>{const{activeBlock:e,setActiveBlock:t}=s.useThemeSettingsStore(),{activeBlock:n}=s.useNavbarStore(),r=s.useNavigate();function o(){t(null),r("/admin/builder/theme")}const i=!!e,a=!e||n.name!=="Theme";return s.jsxRuntimeExports.jsxs(ur,{isOpen:i,isClose:a,children:[s.jsxRuntimeExports.jsx(ar,{onClick:o,title:(e==null?void 0:e.name)||""}),s.jsxRuntimeExports.jsx(Gp,{})]})},Xp=()=>{const{activeBlock:e}=s.useNavbarStore(),{showTooltip:t}=s.useTooltipStore();function n(){switch(e.name){case"Layers":return"Layers";case"Add":return"Add Sections";case"Theme":return"Theme Settings";case"Settings":return"Settings"}}return s.jsxRuntimeExports.jsxs("div",{className:Fo.sidebar,style:{zIndex:t?50:"auto"},children:[s.jsxRuntimeExports.jsx("h3",{className:Fo.title,children:n()}),e.name==="Layers"&&s.jsxRuntimeExports.jsx(O0,{}),e.name==="Add"&&s.jsxRuntimeExports.jsx(ha,{}),s.jsxRuntimeExports.jsx(mh,{}),s.jsxRuntimeExports.jsx(Yp,{}),e.name==="Theme"&&s.jsxRuntimeExports.jsx(q0,{}),e.name==="Settings"&&s.jsxRuntimeExports.jsx(F0,{})]})},Qp="_wrapper_no6if_1",Kp="_header_no6if_12",Zp="_content_no6if_23",Jp="_buttons_no6if_44",em="_label_no6if_51",tm="_description_no6if_52",nm="_preview_no6if_60",rm="_block_no6if_66",sm="_slug_no6if_75",om="_title_no6if_81",im="_closeIcon_no6if_87",at={wrapper:Qp,header:Kp,content:Zp,buttons:Jp,label:em,description:tm,preview:nm,block:rm,slug:sm,title:om,closeIcon:im},am=()=>{var K,w,$,B,H,V,z;const{setIsOpenModal:e,pages:t,createPage:n,updatePage:r,isEdit:o,setIsEdit:i,editedPage:a,setEditedPage:u,pageContext:c}=s.usePagesStore(),{setIsOpen:d}=s.useModalStore(),{createPage:p,updatePage:h}=s.useLayersStore(),[f,m]=k.useState(a?t&&((K=t[a])==null?void 0:K.path):""),[x,g]=k.useState(a?t&&((w=t[a])==null?void 0:w.name):""),[C,b]=k.useState(a?t&&(($=t[a])==null?void 0:$.seo)&&((H=(B=t[a])==null?void 0:B.seo)==null?void 0:H.pageDescription)||"":`${c.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`),[A,y]=k.useState(a&&t&&(V=t[a])!=null&&V.isPrivate?"private":"public");function P(){m(""),g(""),b(""),y("public"),i(!1),u(null)}function L(){d(!1),setTimeout(()=>{P(),e(!1),d(!0)},300)}k.useEffect(()=>()=>{L()},[]);function R(Z){return Z[0]==="/"?Z:"/"+Z}function q(){n({path:R(f),name:x||f||"",icon:"File",seo:{pageTitle:x||"",pageDescription:C||""},visibility:A||"public"}),p(R(f)),L()}function Y(){t&&(s.defaultPagePaths.includes(t[a].path)||ca(t[a].path),h(t[a].path||"",f||""),r(a,{path:R(f),name:x||f,icon:t[a].icon||"File",seo:{pageTitle:x||"",pageDescription:C||""},visibility:A||"public"})),L()}return s.jsxRuntimeExports.jsxs("div",{className:at.wrapper,onClick:Z=>Z.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:at.header,children:[s.jsxRuntimeExports.jsx("h2",{children:o?"Edit Page":"Create New Page"}),s.jsxRuntimeExports.jsx("div",{className:at.closeIcon,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:L})})]}),s.jsxRuntimeExports.jsxs("div",{className:at.content,children:[s.jsxRuntimeExports.jsx(s.Input,{label:"Page Slug",onChange:Z=>m(Z),value:f,placeholder:"path-to-page",disabled:!!(a&&t&&((z=t[a])!=null&&z.name)&&s.defaultPagePaths.includes(t[a].path)),required:!0,regex:"^.+$"}),s.jsxRuntimeExports.jsx(s.Input,{label:"Page Title",onChange:Z=>{g(Z)},value:x.charAt(0).toUpperCase()+x.slice(1),placeholder:"Contact us"}),s.jsxRuntimeExports.jsx(s.Textarea,{label:"Description",onChange:Z=>b(Z),value:C,placeholder:`${c.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`,maxLength:150}),s.jsxRuntimeExports.jsxs("div",{className:at.preview,children:[s.jsxRuntimeExports.jsx("span",{className:at.label,children:"Preview"}),s.jsxRuntimeExports.jsxs("div",{className:at.block,children:[s.jsxRuntimeExports.jsx("span",{className:at.slug,children:f||"yoursite.url"}),s.jsxRuntimeExports.jsx("span",{className:at.title,children:x||"My Blank Page"}),s.jsxRuntimeExports.jsx("span",{className:at.description,children:C||"It is My Description"})]})]})]}),s.jsxRuntimeExports.jsxs("div",{className:at.buttons,children:[s.jsxRuntimeExports.jsx(s.Button,{onClick:L,type:"Secondary",children:"Cancel"}),s.jsxRuntimeExports.jsx(s.Button,{onClick:o?Y:q,disabled:f.length===0,children:o?"Update":"Create"})]})]})},um="_layout_1pjho_1",lm="_main_1pjho_10",cm="_content_1pjho_18",dm="_notifications_1pjho_26",Sr={layout:um,main:lm,content:cm,notifications:dm},hm="_notification_2jmah_1",pm="_text_2jmah_22",mm="_timer_2jmah_27",fm="_warning_2jmah_32",gm="_error_2jmah_37",xm="_success_2jmah_42",hn={notification:hm,text:pm,timer:mm,warning:fm,error:gm,success:xm},Uo={warning:"#C1972A",error:"#FF3F19",success:"#338B13"},pa=e=>{const{type:t,message:n,style:r,padding:o,timer:i,id:a,element:u}=e,[c,d]=k.useState(i),{setNotifications:p}=s.useNotificationStore();function h(){const m=s.useNotificationStore.getState().notifications.filter(x=>x.id!==a);p([...m])}return k.useEffect(()=>{const f=setTimeout(()=>{h()},i*1e3);return()=>clearTimeout(f)},[i]),k.useEffect(()=>{const f=setInterval(()=>d(m=>m-1),1e3);return()=>clearInterval(f)},[c]),u?u({type:t,message:n,style:r,padding:o,timer:i,id:a}):s.jsxRuntimeExports.jsx("div",{style:{padding:o,position:"relative"},children:s.jsxRuntimeExports.jsxs("div",{className:s.clx(hn.notification,{[hn.warning]:t==="warning",[hn.error]:t==="error",[hn.success]:t==="success"}),style:r,children:[s.jsxRuntimeExports.jsx("div",{children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Info",fill:Uo[t],width:20,height:20})}),s.jsxRuntimeExports.jsx("div",{className:hn.text,children:n}),i&&s.jsxRuntimeExports.jsx("div",{className:hn.timer,children:c}),s.jsxRuntimeExports.jsx("div",{style:{display:"flex"},children:s.jsxRuntimeExports.jsx(s.Icon,{name:"X",fill:Uo[t],width:20,height:20,hoverable:!0,onClick:()=>h()})})]})})},Em="_modal_1h74q_1",bm="_title_1h74q_14",Im="_buttons_1h74q_20",yr={modal:Em,title:bm,buttons:Im},ma=()=>{const{title:e,description:t,onConfirm:n,setTitle:r,setDescription:o,setOnConfirm:i}=s.useConfirmationModalStore(),{setIsOpen:a}=s.useModalStore();function u(){a(!1),setTimeout(()=>{r(null),o(null),i(null),a(!0)},300)}return e&&t&&n&&s.jsxRuntimeExports.jsxs("div",{className:yr.modal,onClick:c=>c.stopPropagation(),children:[s.jsxRuntimeExports.jsx("div",{className:yr.title,children:e}),s.jsxRuntimeExports.jsx("div",{className:yr.description,children:t}),s.jsxRuntimeExports.jsxs("div",{className:yr.buttons,children:[s.jsxRuntimeExports.jsx(s.Button,{onClick:u,children:"Cancel"}),s.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{n(),u()},type:"Secondary",children:"Confirm"})]})]})},Tm="_modal_270ti_1",_m="_padding_270ti_17",Cm="_content_270ti_21",Sm="_close_270ti_42",kr={modal:Tm,padding:_m,content:Cm,close:Sm},Br=e=>{const{close:t,children:n,withAnimation:r=!0,hasPadding:o=!0}=e,{isOpen:i,setIsOpen:a}=s.useModalStore();return k.useEffect(()=>{const u=()=>{a(!1),r?setTimeout(()=>{t(!1),a(!0)},300):(t(!1),a(!0))};return document.body.addEventListener("click",u),()=>{document.body.removeEventListener("click",u)}},[]),s.jsxRuntimeExports.jsx("div",{className:s.clx(kr.modal,{[kr.padding]:o}),children:r?s.jsxRuntimeExports.jsx("div",{className:s.clx(kr.content,{[kr.close]:!i}),children:n}):s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:n})})},ym=()=>{const{isOpenModal:e,setIsOpenModal:t}=s.usePagesStore(),{openModal:n,setOpenModal:r}=s.useChooseImageStore(),{notifications:o}=s.useNotificationStore(),{title:i,description:a,setTitle:u,setDescription:c,setOnConfirm:d}=s.useConfirmationModalStore();return s.jsxRuntimeExports.jsxs("div",{id:"builder",children:[s.jsxRuntimeExports.jsxs("div",{className:Sr.layout,children:[s.jsxRuntimeExports.jsx(dd,{}),s.jsxRuntimeExports.jsxs("main",{className:Sr.main,children:[s.jsxRuntimeExports.jsx(nd,{}),s.jsxRuntimeExports.jsxs("div",{className:Sr.content,children:[s.jsxRuntimeExports.jsx(Xp,{}),s.jsxRuntimeExports.jsx(f0,{})]})]})]}),i&&a&&s.jsxRuntimeExports.jsx(Br,{close:()=>{u(null),c(null),d(null)},children:s.jsxRuntimeExports.jsx(ma,{})}),e&&s.jsxRuntimeExports.jsx(Br,{close:t,children:s.jsxRuntimeExports.jsx(am,{})}),n&&s.jsxRuntimeExports.jsx(Br,{close:r,children:s.jsxRuntimeExports.jsx(s.ChooseImageModal,{})}),o.length>0&&s.jsxRuntimeExports.jsx("div",{className:Sr.notifications,children:o.map(p=>s.jsxRuntimeExports.jsx(pa,{type:p.status,message:p.message,timer:p.timer||10,id:p.id,element:p.component},p.id))})]})};async function pn(e,t){const n=localStorage.getItem("shopId")||void 0,o=`${s.useApiStore.getState().apiUrls.api}/${e}/builder/shops/${n}/${t}`;return(await s.request({url:o,withToken:!0,method:"get"})).data}async function km(){try{const[e,t,n,r,o,i,a,u]=await Promise.allSettled([pn("v1","general"),pn("v1","faqs"),pn("v1","listings"),pn("v1","products"),pn("v1","reviews"),pn("v1","categories"),{data:null},{data:null}]);return{general:e,faqs:t,listings:n,products:r,reviews:o,categories:i,fullPosts:a,posts:u}}catch(e){throw console.error("Error fetching page data:",e),e}}async function Rm(){const e=s.useApiStore.getState().apiUrls;try{const{data:t}=await s.axios.get(`${e.googleFonts}?key=AIzaSyAEsTbjAPUz_TeuFCq4z4LPK9w_vst0Pfw`);return t.items}catch(t){throw console.error("Error fetching page data:",t),t}}async function Am(){var o;const e=localStorage.getItem("shopId"),t=localStorage.getItem("draftId"),r=`${s.useApiStore.getState().apiUrls.api}/v2/builder/shops/${e}/drafts/${t}/pages`;try{return(await s.request({url:r,withToken:!0,method:"get"})).data}catch(i){return{data:[],status:(o=i.response)==null?void 0:o.status}}}async function Nm(){const e=localStorage.getItem("shopId")||void 0,t=localStorage.getItem("draftId")||void 0,r=`${s.useApiStore.getState().apiUrls.api}/v2/builder/shops/${e}/drafts/${t}/all`;return(await s.request({url:r,withToken:!0,method:"get"})).data}const wm=e=>{const{blocks:t,settings:n,header:r,footer:o,announcement:i}=e,{setBlocks:a,setSourceBlocks:u,setHeader:c,setFooter:d,setAnnouncement:p,setSettings:h}=s.useBlocksStore(),{fonts:f,setFonts:m}=s.useFontsStore(),{setSettings:x}=s.useSettingsStore(),{setPageContext:g}=s.usePagesStore(),{setThemeSettings:C,setIsLoadingThemeSettings:b}=s.useThemeSettingsStore(),{setIsLoadingSettings:A}=s.useSettingsStore(),{notifications:y,setNotifications:P}=s.useNotificationStore(),{setBlocks:L,blocks:R,createPage:q,setIsLoadingLayers:Y,setHeader:K,setAnnouncement:w,setFooter:$}=s.useLayersStore(),{setPages:B,setCurrentPage:H}=s.usePagesStore();return k.useEffect(()=>{b(!0),Y(!0),A(!0);const V={};Object.keys(t).forEach(Z=>{V[Z]=t[Z]}),u(V),a(V),c(r),d(o),p(i),h(n),(async()=>{const Z={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null,fullPosts:null,posts:null},G=await km();Object.keys(G).map(ae=>{const Ae=ae;Z[Ae]=G[Ae].value.data}),g(Z);const{data:W}=await Nm(),{themeSettings:J,layers:T,settings:ce}=W||{};if(ce){if(ce.settings){const ae=new n;ae.blockSettings={displayName:"Settings",isAddable:!1,...ce.settings},x(ae)}ce.header&&K(ce.header),ce.footer&&$(ce.footer),ce.announcement&&w(ce.announcement)}else{const ae=new n;x(ae)}J&&C(J);const ye=await Am(),S={};if(ye.status>=400&&P([...y,{id:s.v4(),message:"Error fetching pages",status:"error"}]),ye.data.length>0?(ye.data.forEach(ae=>{var Ae,ee;R[ae.path]||q(ae.path),S[ae.id||ae.path]={...ae,icon:s.pages[ae.path]?s.pages[ae.path].icon:"File",name:ae.name||((Ae=ae.seo)==null?void 0:Ae.pageTitle)||((ee=s.pages[ae.path])==null?void 0:ee.name)||ae.path}}),B(S),H(Object.keys(S)[0])):(B(s.pages),H(Object.keys(s.pages)[0])),f.length===0){const ae=await Rm();m([...ae.map(Ae=>{const ee=Ae.variants.map(Oe=>{if(!Oe.includes("italic"))return Oe==="regular"?"400":Oe}).filter(Oe=>Oe!==void 0);return{name:Ae.family,weights:ee}})])}L(T),b(!1),Y(!1),A(!1)})()},[]),s.jsxRuntimeExports.jsx(ym,{})};function Lm(){const e=new URL(window.location.href);window.history.replaceState(null,"",e.pathname+e.hash)}function jm(){const e=new URLSearchParams(document.location.search),t=e.get("shopId")||localStorage.getItem("shopId"),n=e.get("sellerAccessToken")||localStorage.getItem("sellerAccessToken"),r=e.get("draftId")||localStorage.getItem("draftId");return Lm(),n&&localStorage.setItem("sellerAccessToken",n),t&&localStorage.setItem("shopId",t),r&&localStorage.setItem("draftId",r),!!(n&&t&&r)}const vm="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",Pm=e=>{const{blocks:t,settings:n,header:r,footer:o,announcement:i}=e,[a,u]=k.useState(!0),c=s.useNavigate(),d=s.useLocation();return k.useEffect(()=>{const p=d.pathname;if(p.startsWith("/admin/builder")){p==="/admin/builder/add"?document.title="Add Section | Builder":p==="/admin/builder/theme"?document.title="Theme Settings | Builder":p==="/admin/builder/settings"?document.title="Settings | Builder":document.title="Builder | Billgang";let h=document.querySelector("link[rel~='icon']");h||(h=document.createElement("link"),h.rel="icon",document.head.appendChild(h)),h&&(h.href=vm)}},[d]),k.useEffect(()=>{u(!0),jm()?u(!1):c("/")},[]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:a?s.jsxRuntimeExports.jsx(Vt,{}):s.jsxRuntimeExports.jsx(wm,{blocks:t,settings:n,header:r,footer:o,announcement:i})})},Dm="_wrapper_1yd2j_1",Om="_error_1yd2j_11",Bm="_title_1yd2j_21",Mm="_buttons_1yd2j_29",Fn={wrapper:Dm,error:Om,title:Bm,buttons:Mm},$o=async e=>{const t=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId"),o=`${s.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/reset`;return await s.request({url:o,withToken:!0,method:"post",body:e})},Fm=()=>{const{error:e,setError:t}=s.useErrorStore(),{pages:n}=s.usePagesStore(),{setIsOpen:r}=s.useModalStore(),{title:o,description:i,setOnConfirm:a,setTitle:u,setDescription:c}=s.useConfirmationModalStore(),{setBlocks:d}=s.useLayersStore();async function p(){await $o({resetSettings:(e==null?void 0:e.failedSettings)??!1,resetThemeSettings:(e==null?void 0:e.failedThemeSettings)??!1,resetPageIds:(e==null?void 0:e.failedPageIds)??[]}),t(null),d({}),window.location.reload()}async function h(){const f=[];n&&Object.keys(n).map(m=>n[m].id).filter(m=>m!==void 0).map(m=>f.push(m)),await $o({resetSettings:!0,resetThemeSettings:!0,resetPageIds:f}),t(null)}return s.jsxRuntimeExports.jsxs("div",{className:Fn.wrapper,children:[s.jsxRuntimeExports.jsxs("div",{className:Fn.error,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:Fn.title,children:"Oops! Something went wrong"}),s.jsxRuntimeExports.jsx("span",{className:Fn.message,children:(e==null?void 0:e.message)||""})]}),s.jsxRuntimeExports.jsxs("div",{className:Fn.buttons,children:[s.jsxRuntimeExports.jsx(s.Button,{type:"Primary",onClick:p,children:"Reset Settings"}),s.jsxRuntimeExports.jsx(s.Button,{type:"Secondary",onClick:f=>{f.stopPropagation(),u("Reset All Settings"),c("Are you sure you want to reset all settings? This is irreversible."),a(async()=>{await h()})},children:"Reset All Settings"})]})]}),o&&i&&s.jsxRuntimeExports.jsx(Br,{close:()=>{r(!1),setTimeout(()=>{u(null),c(null),a(null),r(!0)},300)},children:s.jsxRuntimeExports.jsx(ma,{})})]})},Hm=e=>{const{children:t}=e,{pathname:n}=s.useLocation(),{setActiveBlock:r}=s.useNavbarStore(),{setActiveBlock:o}=s.useThemeSettingsStore(),{setActiveBlock:i}=s.usePreviewStore();return k.useEffect(()=>{switch(i({id:null,neededScroll:!1}),n){case"/admin/builder":r(s.navbarBlocks[0]);break;case"/admin/builder/add":r(s.navbarBlocks[1]);break;case"/admin/builder/theme":r(s.navbarBlocks[2]);break;case"/admin/builder/settings":r(s.navbarBlocks[3]);break;case"/admin/builder/theme/colors":r(s.navbarBlocks[2]),o(dt[0]);break;case"/admin/builder/theme/fonts":r(s.navbarBlocks[2]),o(dt[1]);break;case"/admin/builder/theme/borders":r(s.navbarBlocks[2]),o(dt[2]);break;case"/admin/builder/theme/buttons":r(s.navbarBlocks[2]),o(dt[3]);break;case"/admin/builder/theme/inputs":r(s.navbarBlocks[2]),o(dt[4]);break}},[n]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:t})},Um="_lock_1mxa7_1",$m="_wrapper_1mxa7_12",zm="_content_1mxa7_22",Wm="_info_1mxa7_31",qm="_buttons_1mxa7_38",Vm="_button_1mxa7_38",Gm="_input_1mxa7_50",Ym="_error_1mxa7_57",ut={lock:Um,wrapper:$m,content:zm,info:Wm,buttons:qm,button:Vm,input:Gm,error:Ym},Xm=()=>{const[e,t]=k.useState(!1),[n,r]=k.useState(!1),[o,i]=k.useState(""),{general:a,setGeneral:u}=s.useGeneralStore(),{setShopPassword:c}=s.useStorefrontStore(),d=s.useLocation(),p=s.useNavigate();k.useEffect(()=>{if(a&&(!a.info.passwordProtected||a.isPasswordValid)){const f=d.state.from==="/validation"?"/":d.state.from;p(f)}},[a]),k.useEffect(()=>{a||(async()=>{var g;t(!0);const m=localStorage.getItem("shopPassword")||"",x=await $s(m);if(x.isPasswordValid){const C=((g=d.state)==null?void 0:g.from)||"/";p(C)}u(x),t(!1)})()},[a]);async function h(){var m;t(!0);const f=await $s(o);if(!f.isPasswordValid)r(!0);else{localStorage.setItem("shopPassword",o),c(o);const x=((m=d.state)==null?void 0:m.from)||"/";p(x),u(f)}t(!1)}return s.jsxRuntimeExports.jsxs("div",{className:ut.wrapper,children:[!e&&s.jsxRuntimeExports.jsxs("div",{className:ut.content,children:[s.jsxRuntimeExports.jsx("div",{className:ut.lock,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Lock",fill:"var(--text-secondary)",width:64,height:64})}),s.jsxRuntimeExports.jsxs("div",{className:ut.info,children:[s.jsxRuntimeExports.jsx("h2",{id:"h2",className:ut.title,children:"The store is password protected"}),s.jsxRuntimeExports.jsx("p",{id:"p",className:ut.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"})]}),s.jsxRuntimeExports.jsxs("div",{className:ut.input,children:[s.jsxRuntimeExports.jsx(s.Input$1,{type:"password",onChange:f=>{r(!1),i(f)},value:o,placeholder:"Password",required:!0}),s.jsxRuntimeExports.jsx("span",{className:ut.error,children:n&&"Incorrect password"})]}),s.jsxRuntimeExports.jsxs("div",{className:ut.buttons,children:[s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",className:ut.button,onClick:()=>p("/contact"),children:"Contact Support"}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",className:ut.button,disabled:n,onClick:h,children:"Submit"})]})]}),e&&s.jsxRuntimeExports.jsx(s.Loader,{})]})},Qm="_notifications_2ywhg_1",Km={notifications:Qm},Zm=({children:e})=>{const t=s.useLocation(),{token:n,setToken:r}=s.useStorefrontStore(),{dashInfo:o,setDashInfo:i}=s.useCustomerDashboardStore(),{shopPassword:a}=s.useStorefrontStore(),u=s.useNavigate(),[c,d]=s.useSearchParams(),{notifications:p}=s.useNotificationStore(),[h,f]=k.useState(!0),{setCustomerEmail:m}=s.useCartStore(),{setThemeSettings:x,themeSettings:g}=s.useThemeSettingsStore(),{settings:C,setSettings:b}=s.useSettingsStore(),{setHeader:A,setFooter:y,setAnnouncement:P,header:L,footer:R,announcement:q}=s.useLayersStore(),{general:Y,setGeneral:K}=s.useGeneralStore(),{pageContext:w,setPageContext:$}=s.usePagesStore();s.useTrackingAnalytics((Y==null?void 0:Y.info.id)||localStorage.getItem("shopId")||"");const B=async()=>{const H=await s.getDynamicPage(encodeURIComponent("/products"));if(H){const{data:V}=H;$({...w,listings:V.listings})}};return k.useEffect(()=>{const H=localStorage.getItem("token");if(H&&(!n||!o))try{const V=s.jwtDecode(H);i(V),r(H),m(V.email)}catch(V){console.error("Failed to decode token:",V),localStorage.removeItem("token"),r(""),i(null)}},[n,o]),k.useEffect(()=>{const H=c.get("r");H&&(localStorage.setItem("referralCode",H),c.delete("r"),d(c),u({pathname:t.pathname,search:c.toString()},{replace:!0}))},[c,t]),k.useEffect(()=>{!t.pathname.startsWith("/products")&&!t.pathname.startsWith("/admin/builder")&&Y&&(Y.info.passwordProtected&&a||Y.isPasswordValid)&&B()},[Y,a]),k.useEffect(()=>{f(!0);const H=async()=>{if(!Y){const z=await $s(a);z.isPasswordValid||t.pathname.includes("/admin/builder")||u("/validation",{state:{from:t.pathname}}),K(z)}},V=async()=>{const{settings:z,theme:Z}=(await tc()).data;if(z&&C){const G=C;if(z.settings?(Object.keys(z.settings).map(W=>{G.blockSettings[W]=z.settings[W]}),b(G)):b(C),z.header&&L){const W=L;Object.keys(z.header).map(J=>{W[J]=z.header[J]}),A(W)}if(z.footer&&R){const W=R;Object.keys(z.footer).map(J=>{W[J]=z.footer[J]}),y(W)}if(z.announcement&&q){const W=q;Object.keys(z.announcement).map(J=>{W[J]=z.announcement[J]}),P(W)}}else b(C);x(g),x(Z||g),f(!1)};t.pathname.startsWith("/validation")||H(),V()},[]),t.pathname.startsWith("/admin/builder")?s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:e}):s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:h?s.jsxRuntimeExports.jsx("div",{style:{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center"},children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[e,p.length>0&&s.jsxRuntimeExports.jsx("div",{className:Km.notifications,children:p.map(H=>s.jsxRuntimeExports.jsx(pa,{type:H.status,message:H.message,timer:H.timer||10,id:H.id,element:H.component},H.id))})]})})},Jm=()=>(k.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),s.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:s.jsxRuntimeExports.jsx(s.Loader,{})})),ef="_wrapper_rccv2_1",tf="_content_rccv2_11",nf="_title_rccv2_21",Ts={wrapper:ef,content:tf,title:nf},Nt=()=>{const e=s.useNavigate();return s.jsxRuntimeExports.jsx("div",{className:Ts.wrapper,children:s.jsxRuntimeExports.jsxs("div",{className:Ts.content,children:[s.jsxRuntimeExports.jsx("h1",{className:Ts.title,children:"Something went wrong"}),s.jsxRuntimeExports.jsx(s.Button,{type:"Primary",onClick:()=>{e("/")},children:"Go to Home"})]})})},rf=({children:e,shopDomain:t,shopId:n,shopPassword:r,shopLogo:o})=>{const{setShopDomain:i,setShopId:a,setShopPassword:u,setShopTerms:c,setShopPrivacyPolicy:d,setShopRefundPolicy:p,setShopLogo:h}=s.useStorefrontStore();return k.useLayoutEffect(()=>{const f=async()=>{const{data:g}=await rc();c(g)},m=async()=>{const{data:g}=await oc();d(g)},x=async()=>{const{data:g}=await sc();p(g)};i(t),a(n),r&&u(r),o&&h(o),f(),m(),x()},[t,n,r]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:e})},sf="_checkoutItemsContainer_1kn61_2",of="_innerContainer_1kn61_16",af="_headerSection_1kn61_22",uf="_header_1kn61_22",lf="_productsContainer_1kn61_47",cf="_couponContainer_1kn61_54",df="_checkoutFooter_1kn61_58",Kt={checkoutItemsContainer:sf,innerContainer:of,headerSection:af,header:uf,productsContainer:lf,couponContainer:cf,checkoutFooter:df},hf="_checkoutFooter_1dzvc_1",pf="_footerBranding_1dzvc_9",mf="_poweredText_1dzvc_14",ff="_footerNav_1dzvc_19",Rr={checkoutFooter:hf,footerBranding:pf,poweredText:mf,footerNav:ff},gf="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",vt=({className:e})=>{const{shopTerms:t,shopPrivacyPolicy:n,shopRefundPolicy:r,shopLogo:o}=s.useStorefrontStore();return s.jsxRuntimeExports.jsxs("footer",{className:`${Rr.checkoutFooter} ${e}`,children:[s.jsxRuntimeExports.jsxs("div",{className:Rr.footerBranding,children:[s.jsxRuntimeExports.jsx("p",{className:Rr.poweredText,id:"md",children:"Powered by"}),o||s.jsxRuntimeExports.jsx("img",{src:gf,alt:"Billgang"})]}),s.jsxRuntimeExports.jsx("nav",{children:s.jsxRuntimeExports.jsxs("ul",{className:Rr.footerNav,children:[(t==null?void 0:t.showTermsOfServiceOnProduct)&&s.jsxRuntimeExports.jsx("li",{children:s.jsxRuntimeExports.jsx("a",{href:t.termsOfService,target:"_blank",rel:"noopener noreferrer",children:"Terms"})}),(n==null?void 0:n.showPrivacyPolicyOnProduct)&&s.jsxRuntimeExports.jsx("li",{children:s.jsxRuntimeExports.jsx("a",{href:n.privacyPolicy,target:"_blank",rel:"noopener noreferrer",children:"Privacy"})}),(r==null?void 0:r.showRefundPolicyOnProduct)&&s.jsxRuntimeExports.jsx("li",{children:s.jsxRuntimeExports.jsx("a",{href:r.refundPolicy,target:"_blank",rel:"noopener noreferrer",children:"Refund"})})]})})]})},xf="_checkoutHeader_d2mbf_1",Ef="_leftContainer_d2mbf_20",bf="_backArrow_d2mbf_26",If="_logoContainer_d2mbf_38",Tf="_logo_d2mbf_38",Hn={checkoutHeader:xf,leftContainer:Ef,backArrow:bf,logoContainer:If,logo:Tf},_f="_activeBadge_1yb5i_1",Cf="_activeBadgeText_1yb5i_12",zo={activeBadge:_f,activeBadgeText:Cf},Sf=({className:e})=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(zo.activeBadge,e),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",width:20,height:20}),s.jsxRuntimeExports.jsx("p",{className:zo.activeBadgeText,children:"Active"})]}),yf="_timerContainer_105jf_2",kf="_timerText_105jf_12",Wo={timerContainer:yf,timerText:kf},Rf=({expiresAt:e})=>{const[t,n]=k.useState(r());function r(){const o=new Date,i=new Date(e).getTime()-o.getTime();if(i<=0)return{hours:"00",minutes:"00",seconds:"00"};const a=Math.floor(i/(1e3*60*60)),u=Math.floor(i%(1e3*60*60)/(1e3*60)),c=Math.floor(i%(1e3*60)/1e3);return{hours:String(a).padStart(2,"0"),minutes:String(u).padStart(2,"0"),seconds:String(c).padStart(2,"0")}}return k.useEffect(()=>{const o=setInterval(()=>{n(r())},1e3);return()=>clearInterval(o)},[e]),t.hours==="00"&&t.minutes==="00"&&t.seconds==="00"?null:s.jsxRuntimeExports.jsxs("div",{className:Wo.timerContainer,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Clock"}),s.jsxRuntimeExports.jsxs("p",{className:Wo.timerText,id:"md",children:[t.hours,":",t.minutes,":",t.seconds]})]})},Af="_progressBar_mcabf_4",Nf="_progressBarLabel_mcabf_12",wf="_progressBarTrack_mcabf_17",Lf="_progressBarFill_mcabf_28",Ar={progressBar:Af,progressBarLabel:Nf,progressBarTrack:wf,progressBarFill:Lf},fa=({color:e,percent:t,disablePercentLabel:n})=>s.jsxRuntimeExports.jsxs("div",{className:Ar.progressBar,children:[!n&&s.jsxRuntimeExports.jsxs("p",{className:Ar.progressBarLabel,children:[t,"%"]}),s.jsxRuntimeExports.jsx("div",{className:Ar.progressBarTrack,children:s.jsxRuntimeExports.jsx("div",{style:{width:`${t}%`,background:e||void 0},className:Ar.progressBarFill})})]}),jf="_rating_1bpps_4",vf="_disabled_1bpps_9",Pf="_ratingStar_1bpps_14",Df="_inactive_1bpps_22",Nr={rating:jf,disabled:vf,ratingStar:Pf,inactive:Df},Of=({setRating:e,rating:t,disabled:n})=>{const[r,o]=k.useState(0),i=u=>{n||o(+u.currentTarget.id)},a=u=>{n||e(u)};return s.jsxRuntimeExports.jsx("div",{className:s.clx(Nr.rating,{[Nr.disabled]:n}),onMouseLeave:()=>o(0),children:[1,2,3,4,5].map(u=>s.jsxRuntimeExports.jsx("div",{id:u.toString(),className:s.clx(Nr.ratingStar,{[Nr.inactive]:!(t>=u||r>=u)}),onMouseEnter:i,onClick:()=>a(u),children:t>=u||r>=u?s.jsxRuntimeExports.jsx(s.FilledStar,{}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Star",fill:"var(--text-secondary)",width:22,height:21})},u))})},Bf="_inputRange_iv6ow_4",Mf="_inputRangeLabel_iv6ow_14",Ff="_progressBar_iv6ow_22",Hf="_progressBarFill_iv6ow_29",Uf="_stepsContainer_iv6ow_40",$f="_step_iv6ow_40",zf="_stepDot_iv6ow_57",Wf="_current_iv6ow_61",qf="_active_iv6ow_69",Vf="_inactive_iv6ow_72",Gf="_tooltip_iv6ow_77",Ze={inputRange:Bf,inputRangeLabel:Mf,progressBar:Ff,progressBarFill:Hf,stepsContainer:Uf,step:$f,stepDot:zf,current:Wf,default:"_default_iv6ow_65",active:qf,inactive:Vf,tooltip:Gf},Yf=({totalSteps:e,step:t,onStepChange:n,label:r})=>{const[o,i]=k.useState(t),a=o===1?0:(o-1)/(e-1)*100,u=c=>{i(c),n(c)};return s.jsxRuntimeExports.jsxs("div",{className:Ze.inputRange,children:[r&&s.jsxRuntimeExports.jsx("div",{className:Ze.inputRangeLabel,children:r}),s.jsxRuntimeExports.jsxs("div",{className:Ze.progressBar,children:[s.jsxRuntimeExports.jsx("div",{className:Ze.progressBarFill,style:{width:`${Math.ceil(a)}%`}}),s.jsxRuntimeExports.jsx("div",{className:Ze.stepsContainer,children:[...Array(e)].map((c,d)=>{const p=d+1,h=p<=o,f=p===o;return s.jsxRuntimeExports.jsxs("div",{className:Ze.step,onClick:()=>u(p),children:[s.jsxRuntimeExports.jsx("div",{className:s.clx(Ze.stepDot,f?Ze.current:Ze.default,h?Ze.active:Ze.inactive)}),f&&s.jsxRuntimeExports.jsxs("div",{className:Ze.tooltip,style:{transform:`translateX(calc(50% - ${a<99?"40px":"70px"}))`},children:[s.jsxRuntimeExports.jsx("span",{children:o}),s.jsxRuntimeExports.jsx("span",{children:o===1?"month":"months"})]})]},p)})})]})]})},lr=({className:e,expiresAt:t})=>{const{shopGeneral:n}=s.useStorefrontStore(),r=s.useNavigate();return s.jsxRuntimeExports.jsxs("header",{className:`${Hn.checkoutHeader} ${e}`,children:[s.jsxRuntimeExports.jsxs("div",{className:Hn.leftContainer,children:[s.jsxRuntimeExports.jsx("div",{className:Hn.backArrow,onClick:()=>{window.history.length>2?r(-1):r("/")},children:s.jsxRuntimeExports.jsx(s.Icon,{name:"ArrowUp"})}),(n==null?void 0:n.info.logo)&&s.jsxRuntimeExports.jsx("div",{className:Hn.logoContainer,children:s.jsxRuntimeExports.jsx("img",{className:Hn.logo,src:s.convertCfImageIdToUrl(n.info.logo.cfId)})})]}),t&&s.jsxRuntimeExports.jsx(Rf,{expiresAt:t})]})},Xf="_checkoutPrices_vp75r_1",Qf="_priceRow_vp75r_12",Kf="_label_vp75r_22",Zf="_totalRow_vp75r_26",Jf="_totalLabel_vp75r_37",e1="_totalValue_vp75r_42",xt={checkoutPrices:Xf,priceRow:Qf,label:Kf,totalRow:Zf,totalLabel:Jf,totalValue:e1},cr=({formatter:e,coupon:t,discount:n,totalWithDiscount:r,total:o,className:i,isShowSubtotal:a=!0,feeOrDiscount:u})=>{const c=Math.max(0,n),{priceAdjusment:d}=s.useCartStore(),h=(()=>{const f=r!==void 0?r:o-c;return!d||u===null||u===void 0?Math.max(f,0):d.isDiscount?Math.max(f-u,0):Math.max(f+u,0)})();return s.jsxRuntimeExports.jsxs("div",{className:`${xt.checkoutPrices} ${i||""}`,children:[a&&s.jsxRuntimeExports.jsxs("div",{className:xt.priceRow,children:[s.jsxRuntimeExports.jsx("p",{className:xt.label,id:"md",children:"Subtotal"}),s.jsxRuntimeExports.jsx("p",{id:"md",children:e.format(o)})]}),(t||c>0)&&s.jsxRuntimeExports.jsxs("div",{className:xt.priceRow,children:[s.jsxRuntimeExports.jsxs("p",{className:xt.label,id:"md",children:["Discount ",t&&!(t!=null&&t.isFixed)&&`(${t==null?void 0:t.discount}%)`]}),s.jsxRuntimeExports.jsx("p",{id:"md",children:t&&!(t!=null&&t.isFixed)&&(t==null?void 0:t.discount)===100?`-${e.format(o)}`:`-${e.format(c)}`})]}),u!=null&&u!==0&&d&&(d.fixedAmount!==0||d.percentage!==0)&&s.jsxRuntimeExports.jsxs("div",{className:xt.priceRow,children:[s.jsxRuntimeExports.jsxs("p",{className:xt.label,id:"md-bold",children:[d.isDiscount?"Discount: ":"Fee: ",d.percentage!==0&&d.fixedAmount===0&&`(${d.percentage}%)`,d.fixedAmount!==0&&d.percentage===0&&`(${e.format(d.fixedAmount)})`,d.percentage!==0&&d.fixedAmount!==0&&`(${d.percentage}% + ${e.format(d.fixedAmount)})`]}),s.jsxRuntimeExports.jsx("p",{id:"md-bold",children:e.format(u)})]}),s.jsxRuntimeExports.jsxs("div",{className:xt.totalRow,children:[s.jsxRuntimeExports.jsx("p",{className:xt.totalLabel,id:"md-bold",children:"Total Due"}),s.jsxRuntimeExports.jsx("p",{className:xt.totalValue,id:"md-bold",children:e.format(h)})]})]})},t1="_checkoutProduct_1nxq7_1",n1="_isOrder_1nxq7_1",r1="_productDetails_1nxq7_10",s1="_productImage_1nxq7_16",o1="_isOrderImage_1nxq7_26",i1="_image_1nxq7_30",a1="_productInfo_1nxq7_35",u1="_productHeader_1nxq7_40",l1="_quantityBadge_1nxq7_46",c1="_productDescription_1nxq7_57",d1="_productPrice_1nxq7_64",h1="_deliveryCategories_1nxq7_73",p1="_customerNote_1nxq7_81",m1="_noteHeader_1nxq7_88",f1="_logoContainer_1nxq7_94",g1="_shopName_1nxq7_106",x1="_noteContent_1nxq7_110",E1="_productName_1nxq7_116",b1="_link_1nxq7_121",Ne={checkoutProduct:t1,isOrder:n1,productDetails:r1,productImage:s1,isOrderImage:o1,image:i1,productInfo:a1,productHeader:u1,quantityBadge:l1,productDescription:c1,productPrice:d1,deliveryCategories:h1,customerNote:p1,noteHeader:m1,logoContainer:f1,shopName:g1,noteContent:x1,productName:E1,link:b1};function qo(e){const t=[],n=String(e||"");let r=n.indexOf(","),o=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(o,r).trim();(a||!i)&&t.push(a),o=r+1,r=n.indexOf(",",o)}return t}function ga(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const I1=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,T1=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_1={};function Vo(e,t){return(_1.jsx?T1:I1).test(e)}const C1=/[ \t\n\f\r]/g;function S1(e){return typeof e=="object"?e.type==="text"?Go(e.value):!1:Go(e)}function Go(e){return e.replace(C1,"")===""}let dr=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};dr.prototype.normal={};dr.prototype.property={};dr.prototype.space=void 0;function xa(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new dr(n,r,t)}function rr(e){return e.toLowerCase()}let Ge=class{constructor(t,n){this.attribute=n,this.property=t}};Ge.prototype.attribute="";Ge.prototype.booleanish=!1;Ge.prototype.boolean=!1;Ge.prototype.commaOrSpaceSeparated=!1;Ge.prototype.commaSeparated=!1;Ge.prototype.defined=!1;Ge.prototype.mustUseProperty=!1;Ge.prototype.number=!1;Ge.prototype.overloadedBoolean=!1;Ge.prototype.property="";Ge.prototype.spaceSeparated=!1;Ge.prototype.space=void 0;let y1=0;const se=an(),we=an(),Ea=an(),M=an(),Te=an(),bn=an(),Xe=an();function an(){return 2**++y1}const qs=Object.freeze(Object.defineProperty({__proto__:null,boolean:se,booleanish:we,commaOrSpaceSeparated:Xe,commaSeparated:bn,number:M,overloadedBoolean:Ea,spaceSeparated:Te},Symbol.toStringTag,{value:"Module"})),_s=Object.keys(qs);let uo=class extends Ge{constructor(t,n,r,o){let i=-1;if(super(t,n),Yo(this,"space",o),typeof r=="number")for(;++i<_s.length;){const a=_s[i];Yo(this,_s[i],(r&qs[a])===qs[a])}}};uo.prototype.defined=!0;function Yo(e,t,n){n&&(e[t]=n)}function yn(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new uo(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[rr(r)]=r,n[rr(i.attribute)]=r}return new dr(t,n,e.space)}const ba=yn({properties:{ariaActiveDescendant:null,ariaAtomic:we,ariaAutoComplete:null,ariaBusy:we,ariaChecked:we,ariaColCount:M,ariaColIndex:M,ariaColSpan:M,ariaControls:Te,ariaCurrent:null,ariaDescribedBy:Te,ariaDetails:null,ariaDisabled:we,ariaDropEffect:Te,ariaErrorMessage:null,ariaExpanded:we,ariaFlowTo:Te,ariaGrabbed:we,ariaHasPopup:null,ariaHidden:we,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Te,ariaLevel:M,ariaLive:null,ariaModal:we,ariaMultiLine:we,ariaMultiSelectable:we,ariaOrientation:null,ariaOwns:Te,ariaPlaceholder:null,ariaPosInSet:M,ariaPressed:we,ariaReadOnly:we,ariaRelevant:null,ariaRequired:we,ariaRoleDescription:Te,ariaRowCount:M,ariaRowIndex:M,ariaRowSpan:M,ariaSelected:we,ariaSetSize:M,ariaSort:null,ariaValueMax:M,ariaValueMin:M,ariaValueNow:M,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Ia(e,t){return t in e?e[t]:t}function Ta(e,t){return Ia(e,t.toLowerCase())}const k1=yn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:bn,acceptCharset:Te,accessKey:Te,action:null,allow:null,allowFullScreen:se,allowPaymentRequest:se,allowUserMedia:se,alt:null,as:null,async:se,autoCapitalize:null,autoComplete:Te,autoFocus:se,autoPlay:se,blocking:Te,capture:null,charSet:null,checked:se,cite:null,className:Te,cols:M,colSpan:null,content:null,contentEditable:we,controls:se,controlsList:Te,coords:M|bn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:se,defer:se,dir:null,dirName:null,disabled:se,download:Ea,draggable:we,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:se,formTarget:null,headers:Te,height:M,hidden:se,high:M,href:null,hrefLang:null,htmlFor:Te,httpEquiv:Te,id:null,imageSizes:null,imageSrcSet:null,inert:se,inputMode:null,integrity:null,is:null,isMap:se,itemId:null,itemProp:Te,itemRef:Te,itemScope:se,itemType:Te,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:se,low:M,manifest:null,max:null,maxLength:M,media:null,method:null,min:null,minLength:M,multiple:se,muted:se,name:null,nonce:null,noModule:se,noValidate:se,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:se,optimum:M,pattern:null,ping:Te,placeholder:null,playsInline:se,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:se,referrerPolicy:null,rel:Te,required:se,reversed:se,rows:M,rowSpan:M,sandbox:Te,scope:null,scoped:se,seamless:se,selected:se,shadowRootClonable:se,shadowRootDelegatesFocus:se,shadowRootMode:null,shape:null,size:M,sizes:null,slot:null,span:M,spellCheck:we,src:null,srcDoc:null,srcLang:null,srcSet:null,start:M,step:null,style:null,tabIndex:M,target:null,title:null,translate:null,type:null,typeMustMatch:se,useMap:null,value:we,width:M,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Te,axis:null,background:null,bgColor:null,border:M,borderColor:null,bottomMargin:M,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:se,declare:se,event:null,face:null,frame:null,frameBorder:null,hSpace:M,leftMargin:M,link:null,longDesc:null,lowSrc:null,marginHeight:M,marginWidth:M,noResize:se,noHref:se,noShade:se,noWrap:se,object:null,profile:null,prompt:null,rev:null,rightMargin:M,rules:null,scheme:null,scrolling:we,standby:null,summary:null,text:null,topMargin:M,valueType:null,version:null,vAlign:null,vLink:null,vSpace:M,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:se,disableRemotePlayback:se,prefix:null,property:null,results:M,security:null,unselectable:null},space:"html",transform:Ta}),R1=yn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Xe,accentHeight:M,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:M,amplitude:M,arabicForm:null,ascent:M,attributeName:null,attributeType:null,azimuth:M,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:M,by:null,calcMode:null,capHeight:M,className:Te,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:M,diffuseConstant:M,direction:null,display:null,dur:null,divisor:M,dominantBaseline:null,download:se,dx:null,dy:null,edgeMode:null,editable:null,elevation:M,enableBackground:null,end:null,event:null,exponent:M,externalResourcesRequired:null,fill:null,fillOpacity:M,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:bn,g2:bn,glyphName:bn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:M,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:M,horizOriginX:M,horizOriginY:M,id:null,ideographic:M,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:M,k:M,k1:M,k2:M,k3:M,k4:M,kernelMatrix:Xe,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:M,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:M,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:M,overlineThickness:M,paintOrder:null,panose1:null,path:null,pathLength:M,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Te,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:M,pointsAtY:M,pointsAtZ:M,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Xe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Xe,rev:Xe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Xe,requiredFeatures:Xe,requiredFonts:Xe,requiredFormats:Xe,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:M,specularExponent:M,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:M,strikethroughThickness:M,string:null,stroke:null,strokeDashArray:Xe,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:M,strokeOpacity:M,strokeWidth:null,style:null,surfaceScale:M,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Xe,tabIndex:M,tableValues:null,target:null,targetX:M,targetY:M,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Xe,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:M,underlineThickness:M,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:M,values:null,vAlphabetic:M,vMathematical:M,vectorEffect:null,vHanging:M,vIdeographic:M,version:null,vertAdvY:M,vertOriginX:M,vertOriginY:M,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:M,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ia}),_a=yn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Ca=yn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ta}),Sa=yn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),A1={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},N1=/[A-Z]/g,Xo=/-[a-z]/g,w1=/^data[-\w.:]+$/i;function lo(e,t){const n=rr(t);let r=t,o=Ge;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&w1.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Xo,j1);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Xo.test(i)){let a=i.replace(N1,L1);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}o=uo}return new o(r,t)}function L1(e){return"-"+e.toLowerCase()}function j1(e){return e.charAt(1).toUpperCase()}const Qr=xa([ba,k1,_a,Ca,Sa],"html"),kn=xa([ba,R1,_a,Ca,Sa],"svg");function Qo(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function ya(e){return e.join(" ").trim()}var ka={},Ko=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,v1=/\n/g,P1=/^\s*/,D1=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,O1=/^:\s*/,B1=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,M1=/^[;\s]*/,F1=/^\s+|\s+$/g,H1=`
|
|
@@ -128,4 +128,4 @@
|
|
|
128
128
|
`))+1))}const a="#".repeat(o),u=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
|
|
129
129
|
`,...i.current()});return/^[\t ]/.test(d)&&(d=ir(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),c(),u(),d}Zu.peek=oC;function Zu(e){return e.value||""}function oC(){return"<"}Ju.peek=iC;function Ju(e,t,n,r){const o=No(n),i=o==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(e.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(u=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),u(),e.title&&(u=n.enter(`title${i}`),d+=c.move(" "+o),d+=c.move(n.safe(e.title,{before:d,after:o,...c.current()})),d+=c.move(o),u()),d+=c.move(")"),a(),d}function iC(){return"!"}el.peek=aC;function el(e,t,n,r){const o=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(r);let c=u.move("![");const d=n.safe(e.alt,{before:c,after:"]",...u.current()});c+=u.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return a(),n.stack=p,i(),o==="full"||!d||d!==h?c+=u.move(h+"]"):o==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function aC(){return"!"}tl.peek=uC;function tl(e,t,n){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const a=n.unsafe[i],u=n.compilePattern(a);let c;if(a.atBreak)for(;c=u.exec(r);){let d=c.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(c.index+1)}}return o+r+o}function uC(){return"`"}function nl(e,t){const n=mo(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}rl.peek=lC;function rl(e,t,n,r){const o=No(n),i=o==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,c;if(nl(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),u(),n.stack=p,h}u=n.enter("link"),c=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(e,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(e.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=n.enter("destinationRaw"),d+=a.move(n.safe(e.url,{before:d,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${i}`),d+=a.move(" "+o),d+=a.move(n.safe(e.title,{before:d,after:o,...a.current()})),d+=a.move(o),c()),d+=a.move(")"),u(),d}function lC(e,t,n){return nl(e,n)?"<":"["}sl.peek=cC;function sl(e,t,n,r){const o=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(r);let c=u.move("[");const d=n.containerPhrasing(e,{before:c,after:"]",...u.current()});c+=u.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return a(),n.stack=p,i(),o==="full"||!d||d!==h?c+=u.move(h+"]"):o==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function cC(){return"["}function wo(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function dC(e){const t=wo(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function hC(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ol(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function pC(e,t,n,r){const o=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?hC(n):wo(n);const u=e.ordered?a==="."?")":".":dC(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),ol(n)===a&&p){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=u),n.bulletCurrent=a;const d=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=i,o(),d}function mC(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function fC(e,t,n,r){const o=mC(n);let i=n.bulletCurrent||wo(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const u=n.createTracker(r);u.move(i+" ".repeat(a-i.length)),u.shift(a);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),p);return c(),d;function p(h,f,m){return f?(m?"":" ".repeat(a))+h:(m?i:i+" ".repeat(a-i.length))+h}}function gC(e,t,n,r){const o=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),o(),a}const xC=ts(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function EC(e,t,n,r){return(e.children.some(function(a){return xC(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function bC(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}il.peek=IC;function il(e,t,n,r){const o=bC(n),i=n.enter("strong"),a=n.createTracker(r),u=a.move(o+o);let c=a.move(n.containerPhrasing(e,{after:o,before:u,...a.current()}));const d=c.charCodeAt(0),p=Xr(r.before.charCodeAt(r.before.length-1),d,o);p.inside&&(c=ir(d)+c.slice(1));const h=c.charCodeAt(c.length-1),f=Xr(r.after.charCodeAt(0),h,o);f.inside&&(c=c.slice(0,-1)+ir(h));const m=a.move(o+o);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:p.outside},u+c+m}function IC(e,t,n){return n.options.strong||"*"}function TC(e,t,n,r){return n.safe(e.value,r)}function _C(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function CC(e,t,n){const r=(ol(n)+(n.options.ruleSpaces?" ":"")).repeat(_C(n));return n.options.ruleSpaces?r.slice(0,-1):r}const al={blockquote:V_,break:sa,code:Z_,definition:eC,emphasis:Ku,hardBreak:sa,heading:sC,html:Zu,image:Ju,imageReference:el,inlineCode:tl,link:rl,linkReference:sl,list:pC,listItem:fC,paragraph:gC,root:EC,strong:il,text:TC,thematicBreak:CC};function SC(){return{enter:{table:yC,tableData:oa,tableHeader:oa,tableRow:RC},exit:{codeText:AC,table:kC,tableData:Fs,tableHeader:Fs,tableRow:Fs}}}function yC(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function kC(e){this.exit(e),this.data.inTable=void 0}function RC(e){this.enter({type:"tableRow",children:[]},e)}function Fs(e){this.exit(e)}function oa(e){this.enter({type:"tableCell",children:[]},e)}function AC(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,NC));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function NC(e,t){return t==="|"?t:e}function wC(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
130
130
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:a,tableCell:c,tableRow:u}};function a(m,x,g,C){return d(p(m,g,C),m.align)}function u(m,x,g,C){const b=h(m,g,C),A=d([b]);return A.slice(0,A.indexOf(`
|
|
131
|
-
`))}function c(m,x,g,C){const b=g.enter("tableCell"),A=g.enter("phrasing"),y=g.containerPhrasing(m,{...C,before:i,after:i});return A(),b(),y}function d(m,x){return W_(m,{align:x,alignDelimiters:r,padding:n,stringLength:o})}function p(m,x,g){const C=m.children;let b=-1;const A=[],y=x.enter("table");for(;++b<C.length;)A[b]=h(C[b],x,g);return y(),A}function h(m,x,g){const C=m.children;let b=-1;const A=[],y=x.enter("tableRow");for(;++b<C.length;)A[b]=c(C[b],m,x,g);return y(),A}function f(m,x,g){let C=al.inlineCode(m,x,g);return g.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function LC(){return{exit:{taskListCheckValueChecked:ia,taskListCheckValueUnchecked:ia,paragraph:vC}}}function jC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:PC}}}function ia(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function vC(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let i=-1,a;for(;++i<o.length;){const u=o[i];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function PC(e,t,n,r){const o=e.children[0],i=typeof e.checked=="boolean"&&o&&o.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);i&&u.move(a);let c=al.listItem(e,t,n,{...r,...u.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(p){return p+a}}function DC(){return[p_(),P_(),M_(),SC(),LC()]}function OC(e){return{extensions:[m_(),D_(e),F_(),wC(e),jC()]}}const BC={tokenize:zC,partial:!0},ul={tokenize:WC,partial:!0},ll={tokenize:qC,partial:!0},cl={tokenize:VC,partial:!0},MC={tokenize:GC,partial:!0},dl={name:"wwwAutolink",tokenize:UC,previous:pl},hl={name:"protocolAutolink",tokenize:$C,previous:ml},Pt={name:"emailAutolink",tokenize:HC,previous:fl},yt={};function FC(){return{text:yt}}let Zt=48;for(;Zt<123;)yt[Zt]=Pt,Zt++,Zt===58?Zt=65:Zt===91&&(Zt=97);yt[43]=Pt;yt[45]=Pt;yt[46]=Pt;yt[95]=Pt;yt[72]=[Pt,hl];yt[104]=[Pt,hl];yt[87]=[Pt,dl];yt[119]=[Pt,dl];function HC(e,t,n){const r=this;let o,i;return a;function a(h){return!io(h)||!fl.call(r,r.previous)||Lo(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return io(h)?(e.consume(h),u):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(MC,p,d)(h):h===45||h===95||Me(h)?(i=!0,e.consume(h),c):p(h)}function d(h){return e.consume(h),o=!0,c}function p(h){return i&&o&&ze(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function UC(e,t,n){const r=this;return o;function o(a){return a!==87&&a!==119||!pl.call(r,r.previous)||Lo(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(BC,e.attempt(ul,e.attempt(ll,i),n),n)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function $C(e,t,n){const r=this;let o="",i=!1;return a;function a(h){return(h===72||h===104)&&ml.call(r,r.previous)&&!Lo(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(ze(h)&&o.length<5)return o+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const f=o.toLowerCase();if(f==="http"||f==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?d:(i=!0,c)):n(h)}function d(h){return h===null||Wr(h)||Ie(h)||on(h)||Zr(h)?n(h):e.attempt(ul,e.attempt(ll,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function zC(e,t,n){let r=0;return o;function o(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),o):a===46&&r===3?(e.consume(a),i):n(a)}function i(a){return a===null?n(a):t(a)}}function WC(e,t,n){let r,o,i;return a;function a(d){return d===46||d===95?e.check(cl,c,u)(d):d===null||Ie(d)||on(d)||d!==45&&Zr(d)?c(d):(i=!0,e.consume(d),a)}function u(d){return d===95?r=!0:(o=r,r=void 0),e.consume(d),a}function c(d){return o||r||!i?n(d):t(d)}}function qC(e,t){let n=0,r=0;return o;function o(a){return a===40?(n++,e.consume(a),o):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(cl,t,i)(a):a===null||Ie(a)||on(a)?t(a):(e.consume(a),o)}function i(a){return a===41&&r++,e.consume(a),o}}function VC(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),i):u===93?(e.consume(u),o):u===60||u===null||Ie(u)||on(u)?t(u):n(u)}function o(u){return u===null||u===40||u===91||Ie(u)||on(u)?t(u):r(u)}function i(u){return ze(u)?a(u):n(u)}function a(u){return u===59?(e.consume(u),r):ze(u)?(e.consume(u),a):n(u)}}function GC(e,t,n){return r;function r(i){return e.consume(i),o}function o(i){return Me(i)?n(i):t(i)}}function pl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ie(e)}function ml(e){return!ze(e)}function fl(e){return!(e===47||io(e))}function io(e){return e===43||e===45||e===46||e===95||Me(e)}function Lo(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const YC={tokenize:nS,partial:!0};function XC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:JC,continuation:{tokenize:eS},exit:tS}},text:{91:{name:"gfmFootnoteCall",tokenize:ZC},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:QC,resolveTo:KC}}}}function QC(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;o--;){const c=r.events[o][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!a||!a._balanced)return n(c);const d=pt(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function KC(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function ZC(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(h){if(i>999||h===93&&!a||h===null||h===91||Ie(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return o.includes(pt(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Ie(h)||(a=!0),i++,e.consume(h),h===92?p:d}function p(h){return h===91||h===92||h===93?(e.consume(h),i++,d):d(h)}}function JC(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,u;return c;function c(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(x)}function p(x){if(a>999||x===93&&!u||x===null||x===91||Ie(x))return n(x);if(x===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=pt(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ie(x)||(u=!0),a++,e.consume(x),x===92?h:p}function h(x){return x===91||x===92||x===93?(e.consume(x),a++,p):p(x)}function f(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),o.includes(i)||o.push(i),fe(e,m,"gfmFootnoteDefinitionWhitespace")):n(x)}function m(x){return t(x)}}function eS(e,t,n){return e.check(hr,t,e.attempt(YC,t,n))}function tS(e){e.exit("gfmFootnoteDefinition")}function nS(e,t,n){const r=this;return fe(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function rS(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(a,u){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},h={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},f=[["enter",p,u],["enter",a[d][1],u],["exit",a[d][1],u],["enter",h,u]],m=u.parser.constructs.insideSpan.null;m&&Ke(f,f.length,0,Jr(m,a.slice(d+1,c),u)),Ke(f,f.length,0,[["exit",h,u],["enter",a[c][1],u],["exit",a[c][1],u],["exit",p,u]]),Ke(a,d-1,c-d+3,f),c=d+f.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function i(a,u,c){const d=this.previous,p=this.events;let h=0;return f;function f(x){return d===126&&p[p.length-1][1].type!=="characterEscape"?c(x):(a.enter("strikethroughSequenceTemporary"),m(x))}function m(x){const g=_n(d);if(x===126)return h>1?c(x):(a.consume(x),h++,m);if(h<2&&!n)return c(x);const C=a.exit("strikethroughSequenceTemporary"),b=_n(x);return C._open=!b||b===2&&!!g,C._close=!g||g===2&&!!b,u(x)}}}class sS{constructor(){this.map=[]}add(t,n,r){oS(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function oS(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function iS(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function aS(){return{flow:{null:{name:"table",tokenize:uS,resolveAll:lS}}}}function uS(e,t,n){const r=this;let o=0,i=0,a;return u;function u(w){let $=r.events.length-1;for(;$>-1;){const V=r.events[$][1].type;if(V==="lineEnding"||V==="linePrefix")$--;else break}const B=$>-1?r.events[$][1].type:null,H=B==="tableHead"||B==="tableRow"?R:c;return H===R&&r.parser.lazy[r.now().line]?n(w):H(w)}function c(w){return e.enter("tableHead"),e.enter("tableRow"),d(w)}function d(w){return w===124||(a=!0,i+=1),p(w)}function p(w){return w===null?n(w):Q(w)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),m):n(w):he(w)?fe(e,p,"whitespace")(w):(i+=1,a&&(a=!1,o+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),h(w)))}function h(w){return w===null||w===124||Ie(w)?(e.exit("data"),p(w)):(e.consume(w),w===92?f:h)}function f(w){return w===92||w===124?(e.consume(w),h):h(w)}function m(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(e.enter("tableDelimiterRow"),a=!1,he(w)?fe(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):x(w))}function x(w){return w===45||w===58?C(w):w===124?(a=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),g):L(w)}function g(w){return he(w)?fe(e,C,"whitespace")(w):C(w)}function C(w){return w===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(i+=1,b(w)):w===null||Q(w)?P(w):L(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),A(w)):L(w)}function A(w){return w===45?(e.consume(w),A):w===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(w))}function y(w){return he(w)?fe(e,P,"whitespace")(w):P(w)}function P(w){return w===124?x(w):w===null||Q(w)?!a||o!==i?L(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):L(w)}function L(w){return n(w)}function R(w){return e.enter("tableRow"),q(w)}function q(w){return w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),q):w===null||Q(w)?(e.exit("tableRow"),t(w)):he(w)?fe(e,q,"whitespace")(w):(e.enter("data"),Y(w))}function Y(w){return w===null||w===124||Ie(w)?(e.exit("data"),q(w)):(e.consume(w),w===92?K:Y)}function K(w){return w===92||w===124?(e.consume(w),Y):Y(w)}}function lS(e,t){let n=-1,r=!0,o=0,i=[0,0,0,0],a=[0,0,0,0],u=!1,c=0,d,p,h;const f=new sS;for(;++n<e.length;){const m=e[n],x=m[1];m[0]==="enter"?x.type==="tableHead"?(u=!1,c!==0&&(aa(f,t,c,d,p),p=void 0,c=0),d={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",d,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",p,t]])),o=x.type==="tableDelimiterRow"?2:p?3:1):o&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],h=Pr(f,t,i,o,void 0,h),i=[0,0,0,0]),a[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],h=Pr(f,t,i,o,void 0,h)),i=a,a=[i[1],n,0,0])):x.type==="tableHead"?(u=!0,c=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(c=n,i[1]!==0?(a[0]=a[1],h=Pr(f,t,i,o,n,h)):a[1]!==0&&(h=Pr(f,t,a,o,n,h)),o=0):o&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&aa(f,t,c,d,p),f.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=iS(t.events,n))}return e}function Pr(e,t,n,r,o,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(i.end=Object.assign({},gn(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=gn(t.events,n[1]);if(i={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const d=gn(t.events,n[2]),p=gn(t.events,n[3]),h={type:u,start:Object.assign({},d),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,g=n[3]-n[2]-1;e.add(x,g,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return o!==void 0&&(i.end=Object.assign({},gn(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function aa(e,t,n,r,o){const i=[],a=gn(t.events,n);o&&(o.end=Object.assign({},a),i.push(["exit",o,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function gn(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const cS={name:"tasklistCheck",tokenize:hS};function dS(){return{text:{91:cS}}}function hS(e,t,n){const r=this;return o;function o(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Ie(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return Q(c)?t(c):he(c)?e.check({tokenize:pS},t,n)(c):n(c)}}function pS(e,t,n){return fe(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function mS(e){return va([FC(),XC(),rS(e),aS(),dS()])}const fS={};function gS(e){const t=this,n=e||fS,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(mS(n)),i.push(DC()),a.push(OC(n))}const jo=({isOrder:e,product:t})=>{var i;const{shopGeneral:n}=s.useStorefrontStore(),r=t.subscriptionSettings,{cart:o}=s.useCart();return console.log(t.description),s.jsxRuntimeExports.jsxs("div",{className:`${Ne.checkoutProduct} ${e?Ne.isOrder:""}`,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:`${Ne.productImage} ${e?Ne.isOrderImage:""}`,children:t!=null&&t.image?s.jsxRuntimeExports.jsx("img",{className:Ne.image,src:s.convertCfImageIdToUrl(t.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image",fill:"var(--text-secondary)"})}),s.jsxRuntimeExports.jsx("div",{className:Ne.productInfo,children:s.jsxRuntimeExports.jsxs("div",{className:Ne.productHeader,children:[s.jsxRuntimeExports.jsx("h2",{className:Ne.productName,id:"h5",children:t.name}),s.jsxRuntimeExports.jsxs("span",{className:Ne.quantityBadge,id:"md",children:[t.price.quantity,"x"]})]})}),t.chargeType==="RECURRING"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:r&&`${s.formatPrice(r.price)} / ${s.normalizeInterval(r.recurringIntervalDays||0)}${r.entryFee?" + "+s.formatPrice(r.entryFee):""}`}),t.chargeType==="ONE_TIME"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:t.variantsGateways&&o.gateway&&t.variantsGateways.some(a=>a.name===o.gateway&&a.overrodePrice)?s.formatPrice(((i=t.variantsGateways.find(a=>a.name===o.gateway))==null?void 0:i.overrodePrice)||t.price):s.formatPrice(t.price)})]}),t.description&&s.jsxRuntimeExports.jsx("p",{className:Ne.productDescription,children:s.jsxRuntimeExports.jsx(tu,{remarkPlugins:[gS],rehypePlugins:[a_],components:{a:({node:a,...u})=>s.jsxRuntimeExports.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer",className:Ne.link})},children:t.description})}),t.deliveryCategories&&s.jsxRuntimeExports.jsx("div",{className:Ne.deliveryCategories,children:t.deliveryCategories.map(a=>s.jsxRuntimeExports.jsx(s.DeliveryItem,{deliveryConfiguration:a},a.id))}),t.customerNote&&s.jsxRuntimeExports.jsxs("div",{className:Ne.customerNote,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.noteHeader,children:[(n==null?void 0:n.info.logo)&&s.jsxRuntimeExports.jsx("div",{className:Ne.logoContainer,children:s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(n==null?void 0:n.info.logo.cfId)})}),s.jsxRuntimeExports.jsx("p",{className:Ne.shopName,id:"md",children:n==null?void 0:n.info.name})]}),s.jsxRuntimeExports.jsx("p",{className:Ne.noteContent,id:"md",children:t.customerNote})]})]})},xS="_coupon_dkjzv_1",ES="_couponApplied_dkjzv_7",bS="_discount_dkjzv_17",IS="_removeButton_dkjzv_23",TS="_removeButtonText_dkjzv_27",_S="_couponInput_dkjzv_31",CS="_couponInputContainer_dkjzv_37",Mt={coupon:xS,couponApplied:ES,discount:bS,removeButton:IS,removeButtonText:TS,couponInput:_S,couponInputContainer:CS},SS=({applyCoupon:e,couponData:t,discount:n,removeCoupon:r,gateway:o})=>{const[i,a]=k.useState(null),[u,c]=k.useState(!1);return s.jsxRuntimeExports.jsxs("div",{className:Mt.coupon,children:[u&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Mt.skeleton,children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!u&&(t?s.jsxRuntimeExports.jsxs("div",{className:Mt.couponApplied,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"}),s.jsxRuntimeExports.jsxs("p",{id:"md",children:[i," is applied"," ",s.jsxRuntimeExports.jsxs("span",{className:Mt.discount,children:["-",n," ",!t.isFixed&&`(${t.discount}%)`]})]}),s.jsxRuntimeExports.jsx("button",{className:Mt.removeButton,onClick:r,children:s.jsxRuntimeExports.jsx("span",{className:Mt.removeButtonText,children:"Remove"})})]}):s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInput,children:[s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"Enter a discount code",value:i||"",onChange:d=>{a(d===""?null:d)}}),s.jsxRuntimeExports.jsx(s.Button$1,{onClick:async()=>{c(!0),i&&await e(i),c(!1)},disabled:!o||!i,type:"Primary",children:"Apply"})]}),!o&&s.jsxRuntimeExports.jsx(s.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},yS=({cart:e,products:t,applyCoupon:n,applyCouponPending:r,coupon:o,totalAndDiscount:i,removeCoupon:a})=>{var g;const{priceAdjusment:u}=s.useCartStore(),[c,d]=k.useState(!1),p=k.useMemo(()=>e.parts.map(C=>{const b=t.find(y=>y.id===C.productId),A=b==null?void 0:b.variants.find(y=>y.id===C.productVariantId);return C.chargeType==="RECURRING"&&d(!0),{id:(b==null?void 0:b.id)||0,image:b==null?void 0:b.images[0],name:(A==null?void 0:A.name)||"",description:(A==null?void 0:A.description)||"",price:{quantity:C.quantity,amount:(A==null?void 0:A.price.amount)||0,currency:A==null?void 0:A.price.currency},subscriptionSettings:A==null?void 0:A.subscriptionSettings,chargeType:C.chargeType,variantsGateways:A==null?void 0:A.gateways}}),[e,t]),h=((g=p[0])==null?void 0:g.price.currency)||"USD",f=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),m=k.useMemo(()=>o&&!o.isFixed&&o.discount===100?i.total:i.totalWithDiscount?i.total-i.totalWithDiscount:0,[i,o]),x=u?(u==null?void 0:u.fixedAmount)+Math.round((i.totalWithDiscount!==void 0?i.totalWithDiscount:i.total-m)*((u==null?void 0:u.percentage)/100)):null;return s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:Kt.innerContainer,children:[s.jsxRuntimeExports.jsx(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:Kt.headerSection,children:[s.jsxRuntimeExports.jsx("header",{className:Kt.header,children:s.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),s.jsxRuntimeExports.jsx("div",{className:Kt.productsContainer,children:p.map(C=>s.jsxRuntimeExports.jsx(jo,{product:C},C.id))}),s.jsxRuntimeExports.jsx("div",{className:Kt.couponContainer,children:s.jsxRuntimeExports.jsx(SS,{applyCoupon:n,applyCouponPending:r,couponData:o,discount:f.format(m),removeCoupon:a,gateway:e.gateway})}),s.jsxRuntimeExports.jsx(cr,{formatter:f,coupon:o,total:i.total,discount:m,totalWithDiscount:i.totalWithDiscount,feeOrDiscount:c?null:x})]}),s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutFooter,children:s.jsxRuntimeExports.jsx(vt,{})})]})})},kS="_checkoutOperational_1gpn5_1",RS="_innerContainer_1gpn5_16",AS="_antistock_1gpn5_25",NS="_paymentMethodsSection_1gpn5_30",wS="_socialConnectSection_1gpn5_36",LS="_socialConnectLabel_1gpn5_39",jS="_socialConnectContent_1gpn5_43",vS="_continueButton_1gpn5_47",PS="_button_1gpn5_51",DS="_checkoutFooter_1gpn5_55",Et={checkoutOperational:kS,innerContainer:RS,antistock:AS,paymentMethodsSection:NS,socialConnectSection:wS,socialConnectLabel:LS,socialConnectContent:jS,continueButton:vS,button:PS,checkoutFooter:DS},OS="_customFields_uhcib_2",BS="_checkboxWrapper_uhcib_9",MS="_textareaWrapper_uhcib_16",FS="_inputWrapper_uhcib_17",HS="_requiredStar_uhcib_27",xn={customFields:OS,checkboxWrapper:BS,textareaWrapper:MS,inputWrapper:FS,requiredStar:HS},US=({customFields:e,setCustomFields:t})=>{if(e.length===0)return null;const n=e.map(r=>s.jsxRuntimeExports.jsx($S,{customField:r,setCustomFields:t},r.name));return s.jsxRuntimeExports.jsx("div",{className:xn.customFields,children:n})},$S=({customField:e,setCustomFields:t})=>{const n=r=>{t(o=>o.map(i=>i.name===e.name?{...i,value:r}:i))};return s.jsxRuntimeExports.jsx(zS,{value:e.value??"",placeholder:e.placeholder,required:e.required,defaultValue:e.defaultValue,type:e.type,onValueChange:n,label:e.name,regex:e.regex})},zS=({label:e,type:t,defaultValue:n,value:r,placeholder:o,regex:i,required:a,onValueChange:u})=>{if(k.useEffect(()=>{r===""&&n!==void 0&&u(String(n))},[]),t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return s.jsxRuntimeExports.jsxs("label",{className:xn.checkboxWrapper,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:r==="true",onChange:d=>u(d?"true":"false")}),s.jsxRuntimeExports.jsxs("p",{className:xn.checkboxLabel,children:[e,a&&s.jsxRuntimeExports.jsx("span",{className:xn.requiredStar,children:"*"})]})]});if(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return s.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(n??""),required:a});const c=d=>{(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:i?new RegExp(i):/.*/).test(d)&&u(d)};return t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?s.jsxRuntimeExports.jsx("div",{className:xn.textareaWrapper,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{label:e,value:r,placeholder:o,onChange:c,required:a})}):s.jsxRuntimeExports.jsx("div",{className:xn.inputWrapper,children:s.jsxRuntimeExports.jsx(s.Input$1,{type:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":o,label:e,value:r,required:a,onChange:c})})},WS="_connectedContainer_1rxr8_1",qS="_userInfo_1rxr8_10",VS="_avatar_1rxr8_16",GS="_avatarImage_1rxr8_26",Dr={connectedContainer:WS,userInfo:qS,avatar:VS,avatarImage:GS},YS=({customerEmail:e})=>{const{discordInfo:t,setDiscordInfo:n}=s.useDiscordStore(),{notifications:r,setNotifications:o}=s.useNotificationStore(),[i,a]=k.useState(!1),[u,c]=k.useState(0),[d,p]=k.useState(null),h=20,f=g=>{var C,b,A,y;return(b=(C=g==null?void 0:g.response)==null?void 0:C.data)!=null&&b.error?g.response.data.error:(y=(A=g==null?void 0:g.response)==null?void 0:A.data)!=null&&y.message?g.response.data.message:g!=null&&g.message?g.message:"Failed to connect to Discord. Please try again later."},m=(g,C)=>{o([...r,{id:s.v4(),message:g,status:C}])};k.useEffect(()=>{if(d&&i){const g=setInterval(()=>{d.closed&&(clearInterval(g),a(!1),p(null))},1e3);return()=>clearInterval(g)}},[d,i]);const x=()=>{e.trim()!==""&&(a(!0),c(0),uc({customerEmail:e,tsId:s.getTsId()}).then(({data:g})=>{const C=window.open(g.redirectUrl);p(C),(!C||C.closed||typeof C.closed>"u")&&setTimeout(()=>{const y=document.createElement("a");y.href=g.redirectUrl,y.target="_blank",y.click()});let b;const A=()=>{if(c(y=>y+1),u>=h||C&&C.closed){u>=h&&m("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(b);return}lc({id:g.id,customerEmail:e}).then(({data:y})=>{n({authorized:!0,id:y.discordId,avatar:y.avatar,username:y.username}),C&&C.close(),a(!1),p(null),m("Discord successfully connected!","success"),clearTimeout(b)}).catch(y=>{var P;if(console.log("Waiting for authorization...",y,{newWindow:C}),C&&C.closed){a(!1),clearTimeout(b);return}if((P=y==null?void 0:y.response)!=null&&P.status&&y.response.status!==404&&y.response.status>=400){m(f(y),"error"),a(!1),clearTimeout(b);return}clearTimeout(b),b=setTimeout(A,1500)})};A()}).catch(g=>{console.log("Could not initiate Discord authorization",g),m(f(g),"error"),a(!1)}))};return t!=null&&t.authorized?s.jsxRuntimeExports.jsxs("div",{className:Dr.connectedContainer,children:[s.jsxRuntimeExports.jsxs("div",{className:Dr.userInfo,children:[s.jsxRuntimeExports.jsx("div",{className:Dr.avatar,children:t.avatar?s.jsxRuntimeExports.jsx("img",{className:Dr.avatarImage,src:`https://cdn.discordapp.com/avatars/${t.id}/${t.avatar}.png?size=256`}):s.jsxRuntimeExports.jsx(s.Icon,{name:"UserCircle"})}),s.jsxRuntimeExports.jsx("p",{children:t.username}),s.jsxRuntimeExports.jsx(Sf,{})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Reconnect"})]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:i,children:i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"DiscordLogo"}),s.jsxRuntimeExports.jsx(s.StableText,{children:"Connect Your Discord"})]})})},XS="_paymentMethodsContainer_1pfqr_2",QS="_antistock_1pfqr_15",ua={paymentMethodsContainer:XS,antistock:QS},KS="_bottomSheet_1x8kc_1",ZS="_content_1x8kc_8",JS="_description_1x8kc_11",e3="_title_1x8kc_15",t3="_buttonGroup_1x8kc_19",n3="_buttonWrapper_1x8kc_29",r3="_fullWidthButton_1x8kc_32",s3="_modal_1x8kc_36",o3="_header_1x8kc_43",wt={bottomSheet:KS,content:ZS,description:JS,title:e3,buttonGroup:t3,buttonWrapper:n3,fullWidthButton:r3,modal:s3,header:o3},i3=({setIsOpen:e,balance:t})=>{const n=s.useNavigate(),{setIsOpen:r}=s.useModalStore(),o=()=>{n("/top-up?redirectRoute=checkout")};function i(){r(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:wt.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:wt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:wt.title,children:"Insufficient Customer Balance"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:wt.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:wt.content,children:s.jsxRuntimeExports.jsxs("p",{className:wt.description,children:["You currently have ",t&&s.formatPrice(t)," in your balance. After topping up the required amount, you can continue to checkout."]})}),s.jsxRuntimeExports.jsxs("div",{className:wt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:wt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:wt.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:o,children:"Add Balance"})})]})]})]})},gl=({align:e,gateway:t,gatewayDisplayName:n,selected:r,onSelect:o,total:i,onSignInClick:a,reversed:u})=>{const{token:c}=s.useStorefrontStore(),{balance:d}=s.useCustomerDashboardStore(),[p,h]=k.useState(!1),{setIsOpen:f}=s.useModalStore(),m=x=>{x.stopPropagation(),o&&o(t),d&&d.amount<i&&(h(!0),f(!0))};return k.useEffect(()=>{},[d,i]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(s.styles$3.paymentMethod,{[s.styles$3.selected]:r,[s.styles$3.alignColumn]:e==="column",[s.styles$3.reversed]:u}),onClick:m,children:[s.jsxRuntimeExports.jsxs("p",{className:s.styles$3.paymentText,id:"md",children:[n," ",s.jsxRuntimeExports.jsxs("span",{className:s.styles$3.balanceText,id:"md",children:["(",c?d&&s.formatPrice(d):s.jsxRuntimeExports.jsx("a",{className:s.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),s.jsxRuntimeExports.jsx("div",{className:s.styles$3.iconContainer,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}),p&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>h(!1),children:s.jsxRuntimeExports.jsx(i3,{setIsOpen:h,balance:d})})]})},xl=({possibleGateways:e,setGateway:t,totalAndDiscount:n,onSignInClick:r,setPaymentMethod:o,isAntistock:i=!1})=>{const[a,u]=k.useState(),[c,d]=k.useState(),{setPriceAdjustment:p}=s.useCartStore(),[h,f]=k.useState(null),m=(x,g)=>{var C;c!==g&&(t(g),p(((C=h==null?void 0:h.find(b=>b.name===g))==null?void 0:C.priceAdjustment)||null)),o(x),u(x),d(g)};return k.useEffect(()=>{if(h&&h.length>0){const x=h[0];if(x.name==="Balance")d(x.name),t(x.name),p(x.priceAdjustment||null);else if(x.paymentMethods&&x.paymentMethods.length>0){const g=x.paymentMethods[0];u(g),d(x.name),t(x.name),o(g),p(x.priceAdjustment||null)}}},[h]),k.useEffect(()=>{const x=async()=>{const{data:g}=await s.fetchGatewaysDetail([...e.availableGateways,...e.requiresSignInGateways]);f(g)};e.availableGateways.length&&x()},[]),k.useLayoutEffect(()=>{p(null)},[]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[h&&s.jsxRuntimeExports.jsx("div",{className:s.clx(ua.paymentMethodsContainer,{[ua.antistock]:i}),children:h==null?void 0:h.map(x=>x.name==="Balance"?s.jsxRuntimeExports.jsx(gl,{gateway:x.name,gatewayDisplayName:x.displayName,onSelect:g=>{d(g),c!==g&&t(g)},selected:x.name===c,total:n.total,onSignInClick:r,reversed:!0},x.name):x.paymentMethods.map(g=>s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{paymentMethod:g,gateway:x.name,gatewayDisplayName:x.displayName,gatewayLogoCfId:x.logoCfImageId,poweredByLogoCfId:x.poweredByImageCfImageId,onSelect:C=>m(C,x.name),selected:a===g&&c===x.name},`${x.name}-${g}`)))}),!h&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:"100%",height:"220px",viewBox:"0 0 600 220",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"5",ry:"5",width:"100%",height:"100%"})})]})},a3="_modal_14r0b_1",u3={modal:a3},l3=({setIsOpen:e})=>{const{token:t}=s.useStorefrontStore(),{setIsOpen:n}=s.useModalStore();k.useEffect(()=>{t&&r()},[t]);const r=()=>{n(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsx("div",{className:u3.modal,onClick:o=>o.stopPropagation(),children:s.jsxRuntimeExports.jsx(s.Auth,{inModal:!0})})},c3=({getPossibleGateways:e,setGateway:t,getDiscordSettings:n,cart:r,products:o,submitCart:i,reset:a,setCustomFieldsToCart:u,totalAndDiscount:c,setDiscordSocialConnectId:d,setPaymentMethod:p,isAntistock:h})=>{const f=k.useMemo(()=>n(),[]),[m,x]=k.useState([]),{balance:g,setBalance:C}=s.useCustomerDashboardStore(),{token:b}=s.useStorefrontStore(),{executeRecaptcha:A}=s.useReCaptcha(),{discordInfo:y}=s.useDiscordStore(),{customerEmail:P,setCustomerEmail:L}=s.useCartStore(),R=y!=null&&y.authorized?y.id:void 0,q=s.useNavigate(),Y=k.useMemo(()=>e(),[r.parts]),[K,w]=k.useState(!1),{setIsOpen:$}=s.useModalStore(),{notifications:B,setNotifications:H}=s.useNotificationStore();k.useEffect(()=>{const W=s.getCommonCustomFields(r.parts,o).map(J=>J.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...J,value:String(J.defaultValue)}:J);x([...W])},[]),k.useEffect(()=>{const G=s.getCommonCustomFields(r.parts,o);x(W=>{const J=new Map(W.map(T=>[T.name,T]));return G.map(T=>{const ce=J.get(T.name);return ce&&ce.value?{...T,value:ce.value}:T.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...T,value:String(T.defaultValue)}:T})})},[r.parts,o]),k.useEffect(()=>{b&&(async()=>{const W=await s.getBalance();C(W)})()},[b]);function V(G){return G&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(G)}const z=()=>{const G=[];return m.forEach(W=>{var J;W.required&&!((J=W.value)!=null&&J.toString().trim())&&G.push({message:`Field "${W.name}" is required.`,status:"error",id:s.v4()})}),G.length>0?(H([...B,...G]),!1):!0},Z=async G=>{if(G.stopPropagation(),r.gateway==="Balance"&&!b){$(!0),w(!0);return}if(!z())return;const W=Object.fromEntries(m.map(T=>[T.name,T.value||""]));u({...W}),R&&f.isEnabled&&d(R);const J=await A();if(J){const T=await i(J),ce=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(ce).length>10){const ye=Date.now()-864e5;Object.keys(ce).forEach(S=>{ce[S].createdAt<=ye&&delete ce[S]})}"order"in T?ce[T.order.id]={createdAt:Date.now(),fullAccessToken:T.order.fullAccessToken}:ce[T.id]={createdAt:Date.now(),fullAccessToken:T.fullAccessToken},localStorage.setItem("orders",JSON.stringify(ce)),q(`/orders/${"order"in T?T.order.id:T.id}/${"order"in T?T.order.fullAccessToken:T.fullAccessToken}`),setTimeout(()=>a(),0)}};return s.jsxRuntimeExports.jsxs("div",{className:Et.checkoutOperational,children:[s.jsxRuntimeExports.jsxs("div",{className:Et.innerContainer,children:[r.parts.length>0&&s.jsxRuntimeExports.jsx(xl,{possibleGateways:Y,setGateway:t,setPaymentMethod:p,balance:g,totalAndDiscount:c,onSignInClick:()=>{w(!0),$(!0)},isAntistock:h}),s.jsxRuntimeExports.jsx("div",{className:s.clx(Et.paymentMethodsSection,{[Et.antistock]:h}),children:s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"mail@mail.com",value:P||"",onChange:G=>L(G),disabled:!!b,label:"Email Address"})}),s.jsxRuntimeExports.jsx(US,{customFields:m,setCustomFields:x}),f.isEnabled&&s.jsxRuntimeExports.jsxs("div",{className:Et.socialConnectSection,children:[s.jsxRuntimeExports.jsx("p",{className:Et.socialConnectLabel,id:"md",children:"Social Connect"}),s.jsxRuntimeExports.jsx("div",{className:Et.socialConnectContent,children:s.jsxRuntimeExports.jsx(YS,{customerEmail:P||""})})]}),s.jsxRuntimeExports.jsxs("div",{className:Et.continueButton,children:[s.jsxRuntimeExports.jsx(s.Button$1,{onClick:Z,disabled:!r.gateway||!V(P||"")||f.isRequired&&!(y!=null&&y.authorized),className:Et.button,children:"Continue to Checkout"}),!h&&s.jsxRuntimeExports.jsx(s.TermsOfService,{}),s.jsxRuntimeExports.jsx(s.SecuredBySsl,{})]}),s.jsxRuntimeExports.jsx(vt,{className:Et.checkoutFooter})]}),K&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>w(!1),children:s.jsxRuntimeExports.jsx(l3,{setIsOpen:w})})]})},d3="_mt1_1t7v2_1",h3="_notifyBlock_1t7v2_13",p3="_notifyHeader_1t7v2_19",m3="_notifyContent_1t7v2_25",f3="_buttonBlock_1t7v2_30",g3="_imageBlock_1t7v2_34",x3="_imageContainer_1t7v2_42",E3="_sectionBlock_1t7v2_54",b3="_sectionTitle_1t7v2_61",I3="_sectionSubtitle_1t7v2_64",T3="_inputContainer_1t7v2_69",mt={mt1:d3,notifyBlock:h3,notifyHeader:p3,notifyContent:m3,buttonBlock:f3,imageBlock:g3,imageContainer:x3,sectionBlock:E3,sectionTitle:b3,sectionSubtitle:I3,inputContainer:T3},_3=({props:e})=>{const t=s.useCopy();return s.jsxRuntimeExports.jsx("div",{className:mt.mt1,children:s.jsxRuntimeExports.jsxs("div",{className:mt.inputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:e.text,disabled:!0,onChange:()=>{}}),e.shownCopyButton&&s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>t(e.text),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})})},C3=({props:e})=>s.jsxRuntimeExports.jsx(s.Button$1,{className:mt.buttonBlock,onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),S3=({props:e})=>s.jsxRuntimeExports.jsx("div",{className:mt.imageBlock,children:s.jsxRuntimeExports.jsx("div",{className:mt.imageContainer,children:s.jsxRuntimeExports.jsx("img",{src:e.src,alt:""})})}),y3=({props:e})=>s.jsxRuntimeExports.jsxs("div",{className:mt.notifyBlock,children:[s.jsxRuntimeExports.jsxs("div",{className:mt.notifyHeader,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),s.jsxRuntimeExports.jsx("p",{children:e.heading})]}),s.jsxRuntimeExports.jsx("p",{className:mt.notifyContent,children:e.content})]}),k3=({props:e})=>{var t;return s.jsxRuntimeExports.jsxs("div",{className:mt.sectionBlock,children:[s.jsxRuntimeExports.jsx("p",{className:mt.sectionTitle,children:e.title}),s.jsxRuntimeExports.jsx("span",{className:mt.sectionSubtitle,children:e.subTitle}),(t=e.children)==null?void 0:t.map((n,r)=>s.jsxRuntimeExports.jsx(El,{block:n},r))]})},El=({block:e})=>{switch(e.type){case"Section":return s.jsxRuntimeExports.jsx(k3,{...e});case"ReadOnlyTextInput":return s.jsxRuntimeExports.jsx(_3,{...e});case"Notify":return s.jsxRuntimeExports.jsx(y3,{...e});case"Button":return s.jsxRuntimeExports.jsx(C3,{...e});case"Image":return s.jsxRuntimeExports.jsx(S3,{...e});default:return null}},R3="_bottomSheet_1x4sq_1",A3="_content_1x4sq_8",N3="_agreementList_1x4sq_11",w3="_agreementItem_1x4sq_16",L3="_warning_1x4sq_23",j3="_buttonGroup_1x4sq_31",v3="_buttonWrapper_1x4sq_41",P3="_fullWidthButton_1x4sq_44",D3="_modal_1x4sq_48",O3="_header_1x4sq_55",Je={bottomSheet:R3,content:A3,agreementList:N3,agreementItem:w3,warning:L3,buttonGroup:j3,buttonWrapper:v3,fullWidthButton:P3,modal:D3,header:O3},B3=({setIsOpen:e,price:t})=>{const[n,r]=k.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Je.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.content,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.agreementList,children:[s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSendAsFF,onChange:a=>r({...n,agreeToSendAsFF:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSend,onChange:a=>r({...n,agreeToSend:a})}),s.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",s.formatPrice(t)," ",t.currency]})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToNotAddNote,onChange:a=>r({...n,agreeToNotAddNote:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),s.jsxRuntimeExports.jsx("div",{className:Je.warning,children:s.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",s.formatPrice(t)," ",t.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",children:s.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),s.jsxRuntimeExports.jsx("div",{className:Je.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:i,children:"Continue to Payment"})})]})]})]})},M3="_chargeItemsContainer_qmv3w_4",F3="_chargeItemsInner_qmv3w_20",H3="_productsContainer_qmv3w_27",U3="_chargeHeader_qmv3w_41",$3="_chargeTitle_qmv3w_49",z3="_chargeDescription_qmv3w_55",W3="_copyButton_qmv3w_61",q3="_productsList_qmv3w_73",V3="_trackingContainer_qmv3w_81",G3="_footerContainer_qmv3w_91",bt={chargeItemsContainer:M3,chargeItemsInner:F3,productsContainer:H3,chargeHeader:U3,chargeTitle:$3,chargeDescription:z3,copyButton:W3,productsList:q3,trackingContainer:V3,footerContainer:G3},Y3=({charge:e})=>{var i;const t=s.useCopy(),n=(e==null?void 0:e.price.currency)||"USD",r=new Intl.NumberFormat("en-US",{style:"currency",currency:n}),o=k.useMemo(()=>{var a;return((a=e==null?void 0:e.order)==null?void 0:a.partOrders.map(u=>{var c,d,p,h,f,m;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:((c=u.productWithVariant)==null?void 0:c.variantName)||"",description:((d=u.productWithVariant)==null?void 0:d.description)||"",price:{quantity:u.quantity,amount:((p=u.productWithVariant)==null?void 0:p.price.amount)||0,currency:(h=u.productWithVariant)==null?void 0:h.price.currency},subscriptionSettings:(f=e.order)!=null&&f.subscriptionOrderId?(m=u.productWithVariant)==null?void 0:m.subscriptionSettings:null}}))||[]},[e]);return s.jsxRuntimeExports.jsx("div",{className:bt.chargeItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:bt.chargeItemsInner,children:[s.jsxRuntimeExports.jsx(lr,{expiresAt:e==null?void 0:e.expiresAt}),s.jsxRuntimeExports.jsxs("div",{className:bt.productsContainer,children:[(e==null?void 0:e.name)&&s.jsxRuntimeExports.jsxs("header",{className:bt.chargeHeader,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:bt.chargeTitle,id:"h5",children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:bt.chargeDescription,id:"md",children:e.description})]}),((i=e.order)==null?void 0:i.id)&&s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",className:bt.copyButton,onClick:()=>{var a;return t(((a=e.order)==null?void 0:a.id)||"")},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),"Copy Order ID"]})]}),s.jsxRuntimeExports.jsxs("div",{style:{flex:1},children:[!!o.length&&s.jsxRuntimeExports.jsx("div",{className:bt.productsList,children:o.map(a=>s.jsxRuntimeExports.jsx(jo,{product:a},a.id))}),s.jsxRuntimeExports.jsx(cr,{formatter:r,coupon:null,total:(e==null?void 0:e.price.amount)||0,discount:0,totalWithDiscount:(e==null?void 0:e.price.amount)||0,isShowSubtotal:!1})]}),s.jsxRuntimeExports.jsxs("div",{children:[e&&s.jsxRuntimeExports.jsx("div",{className:bt.trackingContainer,children:s.jsxRuntimeExports.jsx(s.TrackPayment,{timeline:e.timeline})}),s.jsxRuntimeExports.jsx(vt,{className:bt.footerContainer})]})]})]})})},X3="_checkoutOrderMainData_hqf60_1",Q3="_orderDetailRow_hqf60_6",K3="_chargeIdRow_hqf60_16",Z3="_detailLabel_hqf60_25",J3="_detailValue_hqf60_29",ey="_chargeIdContainer_hqf60_33",ty="_chargeId_hqf60_16",ny="_copyIcon_hqf60_51",Ue={checkoutOrderMainData:X3,orderDetailRow:Q3,chargeIdRow:K3,detailLabel:Z3,detailValue:J3,chargeIdContainer:ey,chargeId:ty,copyIcon:ny},bl=({lastUpdate:e,invoiceId:t,email:n,paymentType:r})=>{const o=s.useCopy(),[i,a]=k.useState(null),u=i==null?void 0:i.find(d=>d.name===r);k.useEffect(()=>{i||(async()=>{const p=[r],h=await s.getGatewaysDetail(p);a(h)})()},[r,i]);const c=d=>{const p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h=d.getDate().toString().padStart(2,"0"),f=p[d.getMonth()],m=d.getFullYear(),x=d.getHours(),g=d.getMinutes().toString().padStart(2,"0"),C=d.getSeconds().toString().padStart(2,"0"),b=x>=12?"PM":"AM",A=(x%12||12).toString().padStart(2,"0");return`${f} ${h}, ${m} at ${A}:${g}:${C} ${b}`};return s.jsxRuntimeExports.jsxs("div",{className:Ue.checkoutOrderMainData,children:[s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Last Updated"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:c(new Date(e))})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Payment Type"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Email"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:n})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Charge ID"}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdContainer,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.chargeId,id:"md",children:t}),s.jsxRuntimeExports.jsx("div",{className:Ue.copyIcon,onClick:()=>o(t),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})]})]})},ry="_bottomSheet_1yai1_1",sy="_formContainer_1yai1_8",oy="_error_1yai1_14",iy="_buttonGroup_1yai1_18",ay="_buttonWrapper_1yai1_28",uy="_fullWidthButton_1yai1_31",ly="_modal_1yai1_41",cy="_header_1yai1_48",Ft={bottomSheet:ry,formContainer:sy,error:oy,buttonGroup:iy,buttonWrapper:ay,fullWidthButton:uy,modal:ly,header:cy},dy=({chargeId:e,setIsOpen:t})=>{const[n,r]=k.useState(""),[o,i]=k.useState(""),{setIsOpen:a}=s.useModalStore(),u=p=>{try{return new URL(p),!0}catch{return!1}},c=async p=>{if(p.preventDefault(),!n){i("The link field cannot be empty.");return}if(!u(n)){i("Please enter a valid URL");return}await nc({url:n},e)&&(alert("CashApp successfully verified"),t(!1))},d=()=>{a(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ft.modal,onClick:p=>p.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ft.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:d,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsx("form",{onSubmit:c,children:s.jsxRuntimeExports.jsxs("div",{className:Ft.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.formContainer,children:s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:n,onChange:p=>{r(p),i("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),o&&s.jsxRuntimeExports.jsx("p",{className:Ft.error,children:o})]})}),s.jsxRuntimeExports.jsxs("div",{className:Ft.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:d,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ft.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},hy="_container_1opbn_1",py="_productDetails_1opbn_8",my="_imageContainer_1opbn_14",fy="_image_1opbn_14",gy="_textContainer_1opbn_32",xy="_header_1opbn_40",Ey="_title_1opbn_46",by="_price_1opbn_53",Iy="_badgeContainer_1opbn_57",Ty="_description_1opbn_61",It={container:hy,productDetails:py,imageContainer:my,image:fy,textContainer:gy,header:xy,title:Ey,price:by,badgeContainer:Iy,description:Ty},_y=({subscription:e})=>s.jsxRuntimeExports.jsxs("div",{className:It.container,children:[s.jsxRuntimeExports.jsxs("div",{className:It.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:It.imageContainer,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{className:It.image,src:s.convertCfImageIdToUrl(e.image.cfId),alt:e==null?void 0:e.name}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:It.textContainer,children:[s.jsxRuntimeExports.jsx("div",{className:It.header,children:s.jsxRuntimeExports.jsx("h2",{className:It.title,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:It.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx("div",{className:It.badgeContainer,children:s.jsxRuntimeExports.jsx(s.SubscriptionStatusBadge,{status:e.status})})]}),e.description&&s.jsxRuntimeExports.jsx(tu,{className:It.description,children:e.description})]}),Cy="_card_69liy_1",Sy="_price_69liy_10",yy="_interval_69liy_17",ky="_name_69liy_22",Ry="_description_69liy_28",Ay="_currentPlan_69liy_32",Ny="_selectButton_69liy_45",wy="_progressSection_69liy_50",Ly="_progressLabel_69liy_54",jy="_bottomSheet_69liy_60",vy="_title_69liy_69",Py="_typeSelector_69liy_80",Dy="_typeOption_69liy_90",Oy="_active_69liy_100",By="_saveTag_69liy_108",My="_planSelector_69liy_117",Fy="_modal_69liy_127",Hy="_inactive_69liy_148",Uy="_notMounted_69liy_151",$y="_closeButton_69liy_157",Se={card:Cy,price:Sy,interval:yy,name:ky,description:Ry,currentPlan:Ay,selectButton:Ny,progressSection:wy,progressLabel:Ly,bottomSheet:jy,title:vy,typeSelector:Py,typeOption:Dy,active:Oy,saveTag:By,planSelector:My,modal:Fy,inactive:Hy,notMounted:Uy,closeButton:$y},zy=({variant:e,onSelect:t,isCurrent:n})=>{const r=e.subscriptionSettings.recurringIntervalDays===30?"month":e.subscriptionSettings.recurringIntervalDays===365?"year":"period",o=e.subscriptionSettings.price.amount.toFixed(2),i=e.subscriptionSettings.recurringIntervalDays,a=10;return s.jsxRuntimeExports.jsxs("div",{className:Se.card,onClick:t,children:[s.jsxRuntimeExports.jsxs("h2",{className:Se.price,children:["$",o," ",s.jsxRuntimeExports.jsxs("span",{className:Se.interval,children:["/ ",r]})]}),s.jsxRuntimeExports.jsx("h3",{className:Se.name,children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:Se.description,children:e.description}),n?s.jsxRuntimeExports.jsxs("div",{className:Se.currentPlan,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check"}),"Your current Plan"]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",className:Se.selectButton,children:"Select"}),n&&s.jsxRuntimeExports.jsxs("div",{className:Se.progressSection,children:[s.jsxRuntimeExports.jsx(fa,{percent:a/i*100,disablePercentLabel:!0}),s.jsxRuntimeExports.jsxs("p",{className:Se.progressLabel,children:["Used: ",a," of ",i," days"]})]})]})},Wy=({isOpen:e,setIsOpen:t,subscription:n})=>{const[r,o]=k.useState(null),[i,a]=k.useState(null),[u,c]=k.useState(null),{id:d,accessToken:p}=s.useParams(),[h,f]=k.useState(!1),[m,x]=k.useState(!1),{setIsOpen:g}=s.useModalStore();k.useEffect(()=>{e&&f(!0)},[e]);const C=()=>{t(!1)},[b,A]=k.useState(null);k.useEffect(()=>{d&&p&&(async()=>{if(d&&p){const{data:R}=await s.getSubscriptionUpgradePlans({id:d,accessToken:p});A(R)}})()},[d,p]),k.useEffect(()=>{var L;if(b!=null&&b.data.types[0]){const R=(L=b.data.types.flatMap(q=>q.productVariants).find(q=>q.data.id===(n==null?void 0:n.variantId)))==null?void 0:L.data;R&&(c(R),a(R))}},[b,n]),k.useEffect(()=>{b!=null&&b.data.types[0]&&o(b==null?void 0:b.data.types[0])},[b==null?void 0:b.data.types]);const y=L=>{o(L),a(null)},P=L=>{a(L),g(!0),x(!0)};return s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.modal,{[Se.active]:e,[Se.inactive]:!e&&h,[Se.notMounted]:!h}),onClick:L=>L.stopPropagation(),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:C,hoverable:!0,className:Se.closeButton,fill:"var(--text-primary)"}),s.jsxRuntimeExports.jsxs("div",{className:Se.bottomSheet,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Se.title,children:"Change Plan"}),s.jsxRuntimeExports.jsx("p",{className:Se.description,children:b==null?void 0:b.data.description}),s.jsxRuntimeExports.jsx("div",{className:Se.typeSelector,children:b==null?void 0:b.data.types.map(L=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.typeOption,{[Se.active]:(r==null?void 0:r.id)===L.id}),onClick:()=>y(L),children:[L.name,L.name==="Yearly"&&s.jsxRuntimeExports.jsx("span",{className:Se.saveTag,children:"Save %"})]},L.id))}),r&&s.jsxRuntimeExports.jsx("div",{className:Se.planSelector,children:r.productVariants.map(L=>s.jsxRuntimeExports.jsx(zy,{variant:L.data,isSelected:(i==null?void 0:i.id)===L.data.id,isCurrent:(u==null?void 0:u.id)===L.data.id,onSelect:()=>P(L.data)},L.data.id))})]}),m&&i&&n&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>{x(!1)},children:s.jsxRuntimeExports.jsx(Pk,{setIsOpen:x,selectedVariant:i,subscription:n})})]})},qy="_container_nb625_1",Vy="_title_nb625_11",Gy="_subtitle_nb625_16",Yy="_info_nb625_20",Or={container:qy,title:Vy,subtitle:Gy,info:Yy},Xy=()=>{const{subscription:e}=s.useSubscriptionStore(),[t,n]=s.extractDateAndTime((e==null?void 0:e.activeTo)||""),[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Or.container,children:[s.jsxRuntimeExports.jsxs("div",{className:Or.info,children:[s.jsxRuntimeExports.jsx("p",{className:Or.title,children:"Expiration Date"}),s.jsxRuntimeExports.jsxs("p",{className:Or.subtitle,children:[t," at ",n]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:a=>{a.stopPropagation(),i(!0),o(!0)},children:"Extend"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(Zk,{setIsOpen:o})})]})},Qy="_couponContainer_1sspa_1",Ky="_iconWrapper_1sspa_10",Zy="_details_1sspa_21",Jy="_title_1sspa_25",ek="_progress_1sspa_29",tk="_foreverText_1sspa_34",fn={couponContainer:Qy,iconWrapper:Ky,details:Zy,title:Jy,progress:ek,foreverText:tk},nk=({coupon:e,currency:t})=>{const n=e.isFixed?s.formatPrice({amount:e.discount,currency:t}):`${e.discount}%`,r=e.initialCouponDurationForSubscriptions?s.percentageDifference(e.initialCouponDurationForSubscriptions,e.currentCouponDurationForSubscriptions||1):100;return s.jsxRuntimeExports.jsxs("div",{className:fn.couponContainer,children:[s.jsxRuntimeExports.jsx("div",{className:fn.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CheckCircle"})}),s.jsxRuntimeExports.jsxs("div",{className:fn.details,children:[s.jsxRuntimeExports.jsxs("p",{className:fn.title,children:[e.name,", ",n," discount"]}),s.jsxRuntimeExports.jsx("div",{className:fn.progress,children:s.jsxRuntimeExports.jsx(fa,{color:"#C2C2C2",percent:r,disablePercentLabel:!0})}),s.jsxRuntimeExports.jsx("p",{className:fn.foreverText,children:"Forever discount code"})]})]})},rk="_paymentMethodContainer_1g0da_4",sk="_paymentMethodTitle_1g0da_15",ok="_activeMethod_1g0da_20",ik="_noMethod_1g0da_28",ak="_activeMethodPaymentMethod_1g0da_37",uk="_paymentMethodLogo_1g0da_47",lk="_paymentMethodNumber_1g0da_57",ck="_method_1g0da_61",Wt={paymentMethodContainer:rk,paymentMethodTitle:sk,activeMethod:ok,noMethod:ik,activeMethodPaymentMethod:ak,paymentMethodLogo:uk,paymentMethodNumber:lk,method:ck},dk="_paymentMethods_1gev0_1",hk="_modal_1gev0_14",pk="_header_1gev0_28",mk="_content_1gev0_37",Jt={paymentMethods:dk,modal:hk,header:pk,content:mk},fk=e=>{const{setIsLoading:t,setIsOpen:n}=e,{subscription:r,setSubscription:o}=s.useSubscriptionStore();if(!r)return null;const{id:i}=s.useParams(),a=s.useNavigate(),{notifications:u,setNotifications:c}=s.useNotificationStore(),{setPaymentMethod:d,setGateway:p,cart:h}=s.useCart(),{setIsOpen:f}=s.useModalStore();async function m(){if(x(),t(!0),i&&r){const{data:g}=await s.changeSubscriptionGateway(i,h.gateway);g.isReconnectPaymentNeeded?a(`/charges/${g.chargeId}`):(c([...u,{status:"success",id:s.v4(),message:"Your action has been successfully completed"}]),o({...r,gatewayName:h.gateway}))}else c([...u,{status:"error",id:s.v4(),message:"Your action has been failed. Try again!"}]);t(!1)}function x(){f(!1),setTimeout(()=>{n(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:Jt.modal,onClick:g=>{g.stopPropagation()},children:[s.jsxRuntimeExports.jsxs("div",{className:Jt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Jt.title,children:"Choose Payment Method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Jt.content,children:[(r==null?void 0:r.availableGateways)&&s.jsxRuntimeExports.jsx(xl,{possibleGateways:{availableGateways:r.availableGateways,requiresSignInGateways:r.availableGateways},setGateway:p,setPaymentMethod:d,totalAndDiscount:{total:(r==null?void 0:r.price.amount)||0,totalWithDiscount:r==null?void 0:r.price.amount},onSignInClick:()=>a("/customer-dash")}),s.jsxRuntimeExports.jsxs("div",{className:Jt.paymentMethods,children:[s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!h.gateway,onClick:()=>m(),children:"Continue"})})]})]})]})},gk="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",xk=()=>{var x,g,C;const{subscription:e}=s.useSubscriptionStore(),{cart:t,setPaymentMethod:n}=s.useCart(),r=s.useNavigate(),[o,i]=k.useState(null),[a,u]=k.useState(!1),[c,d]=k.useState(!1),{setIsOpen:p}=s.useModalStore();if(!e)return null;const[h,f]=k.useState(e.gatewayName||t.gateway),m=t.paymentMethod;return k.useEffect(()=>{(async()=>{const A=await s.getGatewaysDetail(e.availableGateways);i(A)})()},[]),k.useEffect(()=>{t.gateway!==h&&f(t.gateway)},[t.gateway]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodContainer,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("p",{className:Wt.paymentMethodTitle,children:"Active Payment Method"}),e.gatewayInfo&&Object.keys(e.gatewayInfo).length>0&&s.jsxRuntimeExports.jsx(Ek,{gatewayInfo:e.gatewayInfo}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h==="Balance"&&s.jsxRuntimeExports.jsx(gl,{gateway:h,gatewayDisplayName:h,total:(e==null?void 0:e.price.amount)||0,onSignInClick:()=>r("/customer-dash")}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&!h&&s.jsxRuntimeExports.jsx("span",{className:Wt.noMethod,children:"Payment method is not set"}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h&&s.jsxRuntimeExports.jsx("div",{className:Wt.activeMethod,children:o&&s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(x=o.find(b=>b.name===h))==null?void 0:x.logoCfImageId,gatewayDisplayName:(g=o.find(b=>b.name===h))==null?void 0:g.displayName,gateway:h,poweredByLogoCfId:(C=o.find(b=>b.name===h))==null?void 0:C.poweredByImageCfImageId,className:Wt.activeMethodPaymentMethod,selected:m===h,onSelect:b=>{n(b)}},h)})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:b=>{b.stopPropagation(),p(!0),d(!0)},children:t.gateway?"Change":"Manage"})]}),c&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>d(!1),children:s.jsxRuntimeExports.jsx(fk,{setIsLoading:u,setIsOpen:d})})]})},Ek=({gatewayInfo:e})=>{var t,n,r,o,i;return s.jsxRuntimeExports.jsxs("div",{className:Wt.method,children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodLogo,children:[((t=e.card)==null?void 0:t.brand.toLowerCase())==="visa"&&s.jsxRuntimeExports.jsx(s.Visa,{}),((n=e.card)==null?void 0:n.brand.toLowerCase())==="mastercard"&&s.jsxRuntimeExports.jsx("img",{src:gk,alt:"",width:22}),((r=e.card)==null?void 0:r.brand.toLowerCase())!=="visa"&&((o=e.card)==null?void 0:o.brand.toLowerCase())!=="mastercard"&&s.jsxRuntimeExports.jsx(s.Icon,{name:"CreditCard",width:22})]}),s.jsxRuntimeExports.jsxs("p",{className:Wt.paymentMethodNumber,children:["•••• •••• •••• ",(i=e.card)==null?void 0:i.last4]})]})},bk="_subscriptionProductContainer_83ibx_4",Ik="_subscriptionProductImage_83ibx_15",Tk="_subscriptionProductInfo_83ibx_32",_k="_name_83ibx_37",Ck="_price_83ibx_40",qn={subscriptionProductContainer:bk,subscriptionProductImage:Ik,subscriptionProductInfo:Tk,name:_k,price:Ck},Sk=({subscription:e,id:t,accessToken:n})=>{const[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:qn.subscriptionProductContainer,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsx("div",{className:qn.subscriptionProductImage,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(e.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:qn.subscriptionProductInfo,children:[s.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:s.jsxRuntimeExports.jsx("h2",{className:qn.name,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:qn.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:a=>{a.preventDefault(),o(!0),i(!0)},children:"Cancel"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(dR,{accessToken:n,id:t,isOpen:r,setIsOpen:o})})]})},yk="_content_5ctxw_1",kk="_selectedPlan_5ctxw_37",Rk="_planName_5ctxw_44",Ak="_description_5ctxw_48",Nk="_price_5ctxw_51",wk="_buttonGroup_5ctxw_79",Lk="_buttonWrapper_5ctxw_84",jk="_modal_5ctxw_88",vk="_header_5ctxw_95",lt={content:yk,selectedPlan:kk,planName:Rk,description:Ak,price:Nk,buttonGroup:wk,buttonWrapper:Lk,modal:jk,header:vk},Pk=({setIsOpen:e,selectedVariant:t,subscription:n})=>{if(!t)return null;const{setIsOpen:r}=s.useModalStore(),o=()=>{i()},i=()=>{r(!1),setTimeout(()=>{e(!1)},300)},a=(t.subscriptionSettings.compareAtPrice||t.subscriptionSettings.price).amount,u=t.subscriptionSettings.compareAtPrice?t.subscriptionSettings.compareAtPrice.amount-t.subscriptionSettings.price.amount:t.subscriptionSettings.price.amount,c=a-u,d=new Intl.NumberFormat("en-US",{style:"currency",currency:n.price.currency});return s.jsxRuntimeExports.jsxs("div",{className:lt.modal,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:()=>i(),fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.content,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.selectedPlan,children:[s.jsxRuntimeExports.jsx("h2",{className:lt.planName,children:t.name}),s.jsxRuntimeExports.jsx("p",{className:lt.description,children:t.description}),s.jsxRuntimeExports.jsxs("p",{className:lt.price,children:["$",t.subscriptionSettings.price.amount.toFixed(2)," /"," ",t.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),s.jsxRuntimeExports.jsx(cr,{formatter:d,coupon:null,total:c,discount:u})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>i(),children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Primary",onClick:o,children:["Upgrade for $",c.toFixed(2)]})})]})]})]})},Dk="_reviewMessage_1t8u4_1",Ok="_leaveReviewContainer_1t8u4_11",Bk="_leaveReviewTitle_1t8u4_20",Hs={reviewMessage:Dk,leaveReviewContainer:Ok,leaveReviewTitle:Bk},Mk=({review:e,orderId:t,className:n})=>{const[r,o]=k.useState((e==null?void 0:e.rating)||0),[i,a]=k.useState(!1),{setIsOpen:u}=s.useModalStore(),{notifications:c,setNotifications:d}=s.useNotificationStore(),p=async h=>{e&&"accessToken"in e&&(await ic({comment:h,rating:r,tsId:s.getTsId()},t,e.accessToken),d([...c,{status:"success",id:s.v4(),message:"Review left successfully"}]),a(!1))};return k.useEffect(()=>{e&&r&&"accessToken"in e&&!e.rating&&(u(!0),a(!0))},[r]),e?e.rating&&"accessToken"in e?s.jsxRuntimeExports.jsxs("div",{className:Hs.reviewMessage,children:["You left a ",e.rating," star rating"]}):s.jsxRuntimeExports.jsxs("div",{className:s.clx(Hs.leaveReviewContainer,n),children:[s.jsxRuntimeExports.jsx("p",{className:Hs.leaveReviewTitle,children:"Leave a review"}),s.jsxRuntimeExports.jsx(Of,{rating:r,setRating:o,disabled:!!e.rating||!("accessToken"in e)}),i&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>a(!1),children:s.jsxRuntimeExports.jsx(Vk,{setIsOpen:a,onSubmit:p})})]}):null},Fk="_bottomSheet_1bcyj_1",Hk="_content_1bcyj_7",Uk="_title_1bcyj_18",$k="_buttonGroup_1bcyj_22",zk="_buttonWrapper_1bcyj_33",Wk="_modal_1bcyj_37",qk="_header_1bcyj_44",Ht={bottomSheet:Fk,content:Hk,title:Uk,buttonGroup:$k,buttonWrapper:zk,modal:Wk,header:qk},Vk=({setIsOpen:e,onSubmit:t})=>{const[n,r]=k.useState(""),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ht.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ht.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ht.title,children:"Review Description"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Ht.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.content,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{placeholder:"Great product and fast checkout...",value:n,onChange:a=>r(a),label:"Describe your review in detail below"})}),s.jsxRuntimeExports.jsxs("div",{className:Ht.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!n,onClick:()=>{i(),t(n)},children:"Submit"})})]})]})]})},Gk="_container_1idhv_1",Yk="_buttonGroup_1idhv_8",Xk="_buttonWrapper_1idhv_15",Qk="_header_1idhv_19",Kk="_content_1idhv_28",en={container:Gk,buttonGroup:Yk,buttonWrapper:Xk,header:Qk,content:Kk},Zk=({setIsOpen:e})=>{const{subscription:t}=s.useSubscriptionStore(),{getTotalAndDiscount:n,cart:r,coupon:o}=s.useCart(),[i,a]=k.useState(1),u=s.useNavigate(),{setIsOpen:c}=s.useModalStore(),{setNotifications:d,notifications:p}=s.useNotificationStore(),[h,f]=k.useState(!1),m=k.useMemo(()=>n(),[o,r]),x=k.useMemo(()=>m.totalWithDiscount?m.total-m.totalWithDiscount:0,[m]);if(h)return s.jsxRuntimeExports.jsx(s.ProcessingPaymentModal,{});const g=(t==null?void 0:t.price.currency)||"USD",C=new Intl.NumberFormat("en-US",{style:"currency",currency:g});async function b(){var y;f(!0);try{const{data:P}=await s.extendSubscription((t==null?void 0:t.id)||"",{});d([{id:s.v4(),message:"Order created successfully",status:"success"}]),u(`/orders/${(y=P.data)==null?void 0:y.id}/${P.data.fullAccessToken}`)}catch(P){const L=P;d([...p,{id:s.v4(),message:`Order creation failed: ${L.message}`,status:"error"}]),A()}finally{f(!1)}}function A(){c(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:en.container,onClick:y=>y.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:en.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:en.title,children:"Extend Subscription"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:A,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:en.content,children:[s.jsxRuntimeExports.jsx(Yf,{step:i,totalSteps:12,onStepChange:a,label:"How long would you like to extend your subscription for?"}),s.jsxRuntimeExports.jsx(cr,{formatter:C,coupon:o,total:m.total,discount:x,totalWithDiscount:m.totalWithDiscount}),s.jsxRuntimeExports.jsxs("div",{className:en.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:A,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:b,children:"Extend"})})]})]})]})},Jk="_bottomSheet_uw5jb_1",eR="_content_uw5jb_7",tR="_radioGroup_uw5jb_11",nR="_confirmation_uw5jb_26",rR="_iconWrapper_uw5jb_33",sR="_title_uw5jb_42",oR="_message_uw5jb_48",iR="_buttonGroup_uw5jb_54",aR="_buttonWrapper_uw5jb_64",uR="_modal_uw5jb_68",lR="_header_uw5jb_77",je={bottomSheet:Jk,content:eR,radioGroup:tR,confirmation:nR,iconWrapper:rR,title:sR,message:oR,buttonGroup:iR,buttonWrapper:aR,modal:uR,header:lR},cR={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},dR=({isOpen:e,setIsOpen:t,id:n,accessToken:r})=>{const[o,i]=k.useState(0),[a,u]=k.useState(!1),[c,d]=k.useState(""),[p,h]=k.useState(""),{setIsOpen:f}=s.useModalStore(),m=async()=>{if(!c)return;u(!0);const g=await s.cancelSubscription(n,r,{reason:c==="Other reason"?p:c});u(!1),g&&i(2)};k.useEffect(()=>{e||(i(0),d(""),h(""))},[e]);const x=()=>{f(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:je.modal,onClick:g=>g.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:cR[o]||""}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:je.content,children:[o===0&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),s.jsxRuntimeExports.jsxs("div",{className:je.radioGroup,children:[s.jsxRuntimeExports.jsx(s.Radio,{defaultValue:c,onChange:g=>d(g),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"}),c==="Other reason"&&s.jsxRuntimeExports.jsx(s.Textarea$1,{value:p,onChange:g=>h(g),placeholder:"Describe the reason..."})]}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:()=>c&&i(1),disabled:!c,children:"Continue"})})]})]}),o===1&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:m,disabled:a,children:"Cancel it anyway"})})]})]}),o===2&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:`${je.confirmation}`,children:[s.jsxRuntimeExports.jsx("div",{className:je.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"})}),s.jsxRuntimeExports.jsx("p",{className:je.title,children:"Subscription Cancelled"}),s.jsxRuntimeExports.jsx("p",{className:je.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),s.jsxRuntimeExports.jsx("div",{className:je.buttonGroup,children:s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Close"})})})]})]})]})},hR="_checkoutContainer_wkomn_1",pR="_loaderContainer_wkomn_20",Us={checkoutContainer:hR,loaderContainer:pR},Il=()=>{const{isAntistock:e}=s.useGeneralStore(),{cart:t,products:n,pending:r,getTotalAndDiscount:o,getPossibleGateways:i,submitCart:a,setGateway:u,applyCoupon:c,setDiscordSocialConnectId:d,setCustomFields:p,applyCouponPending:h,coupon:f,removeCoupon:m,getDiscordSettings:x,setPaymentMethod:g,reset:C}=s.useCart(),b=k.useMemo(()=>o(),[f,t]),A=s.useNavigate();return k.useEffect(()=>{if(t.parts.length===0)try{A(-1)}catch{A("/")}},[t.parts]),r?s.jsxRuntimeExports.jsx("div",{className:Us.checkoutContainer,children:s.jsxRuntimeExports.jsx("div",{className:Us.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})})}):s.jsxRuntimeExports.jsxs("div",{className:Us.checkoutContainer,children:[s.jsxRuntimeExports.jsx(yS,{cart:t,products:n,applyCoupon:c,applyCouponPending:h,coupon:f,removeCoupon:m,totalAndDiscount:b}),s.jsxRuntimeExports.jsx(c3,{cart:t,getPossibleGateways:i,setGateway:u,getDiscordSettings:x,products:n,submitCart:a,totalAndDiscount:b,setCustomFieldsToCart:p,setDiscordSocialConnectId:d,setPaymentMethod:g,reset:C,isAntistock:e})]})},mR="_chargePageContainer_1a200_1",fR="_chargeItems_1a200_14",gR="_mainContent_1a200_25",xR="_contentWrapper_1a200_36",ER="_statusBlock_1a200_41",bR="_notPaidSection_1a200_45",IR="_footer_1a200_53",TR="_loaderContainer_1a200_63",Ut={chargePageContainer:mR,chargeItems:fR,mainContent:gR,contentWrapper:xR,statusBlock:ER,notPaidSection:bR,footer:IR,loaderContainer:TR},_R=()=>{const{id:e}=s.useParams(),[t,n]=s.useSearchParams(),[r,o]=k.useState(!1),[i,a]=k.useState(),[u,c]=k.useState(!0),d=s.useNavigate(),p=k.useRef(),{setIsOpen:h}=s.useModalStore();return k.useEffect(()=>{const f=async(x,g=!1)=>{g||o(!0);const{data:C}=await ac(x);o(!1),a(C)},m=setInterval(()=>{e&&f(e,!0)},5e3);return e&&f(e),()=>{clearInterval(m)}},[]),k.useEffect(()=>{const f=setTimeout(()=>{console.log("charge timeout",i);const m=t.get("redirectRoute");(i==null?void 0:i.status)===s.ChargeStatus.Paid&&i.redirectUrl&&!p.current&&window.open(i.redirectUrl,"_self"),(i==null?void 0:i.status)===s.ChargeStatus.Paid&&p.current&&d(p.current,{replace:!0}),m&&p&&(p.current=m,t.delete("redirectRoute"),n(t))},1e3);return()=>clearTimeout(f)},[i]),k.useEffect(()=>{((i==null?void 0:i.gateway)==="PayPalFF"||(i==null?void 0:i.gateway)==="Сashapp")&&h(!0)},[i]),r?s.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:Ut.chargePageContainer,children:[s.jsxRuntimeExports.jsx("div",{className:Ut.chargeItems,children:s.jsxRuntimeExports.jsx(Y3,{charge:i})}),s.jsxRuntimeExports.jsx("div",{className:Ut.mainContent,children:s.jsxRuntimeExports.jsxs("div",{className:Ut.contentWrapper,children:[i&&(i==null?void 0:i.status)!==s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx(s.ChargeStatusBlock,{charge:i}),i&&s.jsxRuntimeExports.jsx("div",{className:`${Ut.statusBlock}`,children:s.jsxRuntimeExports.jsx(bl,{lastUpdate:i.expiresAt,email:i.customerForCharge.email,invoiceId:i.id,paymentType:i.gateway})}),(i==null?void 0:i.status)===s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx("div",{className:Ut.notPaidSection,children:i==null?void 0:i.displayPaymentInfo.map((f,m)=>s.jsxRuntimeExports.jsx(El,{block:f},m))}),s.jsxRuntimeExports.jsx(vt,{className:Ut.footer})]})}),(i==null?void 0:i.gateway)==="PayPalFF"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>c(!1),children:s.jsxRuntimeExports.jsx(B3,{price:i.price,setIsOpen:c})}),(i==null?void 0:i.gateway)==="Сashapp"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(dy,{setIsOpen:c,chargeId:i.id})})]})},CR="_wrapper_o0iab_1",SR="_title_o0iab_23",yR="_container_o0iab_30",kR="_content_o0iab_41",RR="_messages_o0iab_52",AR="_input_o0iab_70",NR="_textarea_o0iab_83",wR="_message_o0iab_52",LR="_messageDate_o0iab_125",jR="_myMessage_o0iab_131",vR="_otherMessage_o0iab_138",PR="_button_o0iab_145",DR="_loadingMessage_o0iab_166",$e={wrapper:CR,title:SR,container:yR,content:kR,messages:RR,input:AR,textarea:NR,message:wR,messageDate:LR,myMessage:jR,otherMessage:vR,button:PR,loadingMessage:DR},OR=()=>{const e=window.location.pathname.split("/"),t=e[e.length-1],n=e[e.length-2],[r,o]=k.useState(!0),[i,a]=k.useState(null),[u,c]=k.useState(""),[d,p]=k.useState(null),{executeRecaptcha:h}=s.useReCaptcha(),f=async()=>{if(n&&t){const{data:g}=await s.fetchTicket(n,t);a(g),o(!1)}};k.useEffect(()=>{f();const g=setInterval(()=>{f()},5e3);return()=>clearInterval(g)},[]);const m=async()=>{const g=await h();if(!n||!t||!g||!u.trim())return;const C={content:u,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};a(b=>b?{...b,messages:[...b.messages,C]}:null),p(C.id),c("");try{await s.sendTicketMessage(n,t,u,g,s.getTsId()),await f()}finally{setTimeout(()=>{p(null)},1e4)}},x=g=>{const C=new Date,b=new Date(g),A=Math.floor((C.getTime()-b.getTime())/1e3);if(A<60)return"right now";if(A<3600){const y=Math.floor(A/60);return`${y} minute${y>1?"s":""} ago`}else if(A<10800){const y=Math.floor(A/3600);return`${y} hour${y>1?"s":""} ago`}else return b.getFullYear()===C.getFullYear()?b.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):b.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return s.jsxRuntimeExports.jsx("div",{className:$e.wrapper,children:r&&!i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs("div",{className:$e.container,children:[s.jsxRuntimeExports.jsx("div",{className:$e.title,children:`#${n} (${i==null?void 0:i.title})`}),s.jsxRuntimeExports.jsxs("div",{className:$e.content,children:[s.jsxRuntimeExports.jsx("div",{className:$e.messages,children:i==null?void 0:i.messages.sort((g,C)=>new Date(g.createdAt).getTime()-new Date(C.createdAt).getTime()).map(g=>s.jsxRuntimeExports.jsxs("div",{className:s.clx($e.message,{[$e.myMessage]:!g.isSellerReply,[$e.otherMessage]:g.isSellerReply,[$e.loadingMessage]:d===g.id}),children:[s.jsxRuntimeExports.jsx("div",{className:$e.messageContent,children:s.splitTextIntoSpans(g.content,!1)}),d!==g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:x(g.createdAt)}),d===g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:s.jsxRuntimeExports.jsx(s.Loader,{})})]},g.id))}),s.jsxRuntimeExports.jsxs("div",{className:$e.input,children:[s.jsxRuntimeExports.jsx("textarea",{className:$e.textarea,value:u,placeholder:"What worries you?",onChange:g=>c(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),m())}}),s.jsxRuntimeExports.jsx("div",{className:$e.button,onClick:m,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"PaperPlaneRight"})})]})]})]})})},BR="_subscriptionContainer_1j6ol_1",MR="_leftSection_1j6ol_15",FR="_content_1j6ol_26",HR="_mainContent_1j6ol_33",UR="_detailsSection_1j6ol_37",$R="_buttonGroup_1j6ol_50",zR="_detailsContent_1j6ol_57",tn={subscriptionContainer:BR,leftSection:MR,content:FR,mainContent:HR,detailsSection:UR,buttonGroup:$R,detailsContent:zR},WR=()=>{const{id:e,accessToken:t}=s.useParams(),{subscription:n,setSubscription:r}=s.useSubscriptionStore(),{setIsOpen:o}=s.useModalStore(),[i,a]=k.useState(!1),[u,c]=k.useState(!1);k.useLayoutEffect(()=>{r(null)},[e,t]);const{balanceSettings:d,setBalanceSettings:p}=s.useCustomerDashboardStore();return k.useEffect(()=>{e&&t&&(async()=>{if(!e||!t)return;c(!0);const{data:f}=await s.fetchSubscription(e,t);r({...f}),c(!1)})()},[e,t]),k.useEffect(()=>{d||(async()=>{const f=await s.getBalanceSettings();p(f)})()},[d]),u?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:tn.subscriptionContainer,children:[s.jsxRuntimeExports.jsx("div",{className:tn.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.content,children:[s.jsxRuntimeExports.jsx(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:tn.mainContent,children:[n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),s.jsxRuntimeExports.jsx(_y,{subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),s.jsxRuntimeExports.jsx("div",{className:tn.buttonGroup,children:n.pricingPlanExists&&s.jsxRuntimeExports.jsx(s.Button$1,{onClick:h=>{h.stopPropagation(),o(!0),a(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),s.jsxRuntimeExports.jsx(vt,{})]})]})}),s.jsxRuntimeExports.jsx("div",{className:tn.detailsSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.detailsContent,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(n==null?void 0:n.coupon)&&s.jsxRuntimeExports.jsx(nk,{coupon:n.coupon,currency:n.price.currency||"USD"}),n&&s.jsxRuntimeExports.jsx(Sk,{id:e||"",accessToken:t||"",subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(xk,{}),n.activeTo&&s.jsxRuntimeExports.jsx(Xy,{})]}),s.jsxRuntimeExports.jsx(vt,{className:"flex md:hidden"})]})})]}),s.jsxRuntimeExports.jsx(Wy,{isOpen:i,setIsOpen:a,subscription:n})]})},qR="_topUpContainer_1pag6_1",VR="_formWrapper_1pag6_15",GR="_header_1pag6_29",YR="_footer_1pag6_82",XR="_wrapper_1pag6_105",Vn={topUpContainer:qR,formWrapper:VR,header:GR,footer:YR,wrapper:XR},QR=()=>{const{gatewaysDetail:e,setGatewaysDetail:t,balanceSettings:n,setBalanceSettings:r}=s.useCustomerDashboardStore();return k.useEffect(()=>{!e&&n&&(async()=>{const i=await s.getGatewaysDetail(n!=null&&n.isEnabled?(n==null?void 0:n.topUpSettings.gateways)||[]:[]);t(i)})()},[e,n]),k.useEffect(()=>{n||(async()=>{const i=await s.getBalanceSettings();r(i)})()},[n]),s.jsxRuntimeExports.jsxs("div",{className:Vn.wrapper,children:[s.jsxRuntimeExports.jsx(lr,{className:Vn.header}),s.jsxRuntimeExports.jsx("div",{className:Vn.topUpContainer,children:n?s.jsxRuntimeExports.jsx("div",{className:Vn.formWrapper,children:s.jsxRuntimeExports.jsx(s.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):s.jsxRuntimeExports.jsx(s.Loader,{})}),s.jsxRuntimeExports.jsx("div",{className:Vn.footer,children:s.jsxRuntimeExports.jsx(vt,{})})]})},KR="_orderPage_1nvve_1",ZR="_leftSection_1nvve_15",JR="_content_1nvve_35",eA="_main_1nvve_42",tA="_statusBlock_1nvve_54",nA="_timelineBlock_1nvve_58",rA="_footer_1nvve_62",sA="_rightSection_1nvve_71",oA="_header_1nvve_84",iA="_productList_1nvve_92",aA="_mobileFooter_1nvve_99",uA="_loaderContainer_1nvve_108",lA="_orderMainData_1nvve_116",cA="_prices_1nvve_123",dA="_headerTitle_1nvve_127",hA="_headerDescription_1nvve_131",De={orderPage:KR,leftSection:ZR,content:JR,main:eA,statusBlock:tA,timelineBlock:nA,footer:rA,rightSection:sA,header:oA,productList:iA,mobileFooter:aA,loaderContainer:uA,orderMainData:lA,prices:cA,headerTitle:dA,headerDescription:hA},pA=()=>{var h,f,m;const{id:e,accessToken:t}=s.useParams(),n=s.useNavigate(),[r,o]=k.useState(),[i,a]=k.useState(!1),u=s.useCopy(),c=((h=r==null?void 0:r.rawPrice)==null?void 0:h.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:c}),p=k.useMemo(()=>(r==null?void 0:r.partOrders.map(x=>{var g,C,b,A;return{id:(x==null?void 0:x.id)||0,image:x.productWithVariant.image,name:((g=x.productWithVariant)==null?void 0:g.name)||"",description:((C=x.productWithVariant)==null?void 0:C.description)||"",price:{quantity:x.quantity,amount:((b=x.productWithVariant)==null?void 0:b.price.amount)||0,currency:(A=x.productWithVariant)==null?void 0:A.price.currency},deliveryCategories:"deliveryCategories"in x?x.deliveryCategories:void 0,customerNote:x.customerNote,chargeType:x.chargeType||"ONE_TIME"}}))||[],[r]);return k.useLayoutEffect(()=>{if(e&&!t){const x=JSON.parse(localStorage.getItem("orders")||"{}");x[e]&&n(`/orders/${e}/${x[e].fullAccessToken}`)}},[e]),k.useEffect(()=>{const x=async(C,b=!1)=>{b||a(!0);const{data:A}=await(t?s.fetchAuthorizedOrder(`${C}/${t}`):s.fetchOrder(C));a(!1),A.charge.status===s.ChargeStatus.NotPaid&&n(`/charges/${A.charge.id}`,{replace:!0}),o(A)};e&&x(e);const g=setInterval(()=>{e&&x(e,!0)},5e3);return()=>{clearInterval(g)}},[]),i?s.jsxRuntimeExports.jsx("div",{className:De.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:De.orderPage,children:[s.jsxRuntimeExports.jsx("div",{className:De.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[s.jsxRuntimeExports.jsx(lr,{}),r&&s.jsxRuntimeExports.jsxs("div",{className:De.main,children:[s.jsxRuntimeExports.jsx(s.OrderStatusBlock,{className:De.statusBlock,orderStatus:r.status}),s.jsxRuntimeExports.jsxs("div",{className:De.orderMainData,children:[s.jsxRuntimeExports.jsx(bl,{lastUpdate:r.createdAt,paymentType:r.charge.gateway,email:r.charge.customerForCharge.email,invoiceId:r.charge.id}),"accessToken"in r.review&&s.jsxRuntimeExports.jsx(Mk,{orderId:r.id,review:r.review})]}),r.charge&&s.jsxRuntimeExports.jsx(s.TrackPayment,{className:De.timelineBlock,timeline:r.charge.timeline}),s.jsxRuntimeExports.jsx(vt,{className:De.footer})]})]})}),s.jsxRuntimeExports.jsx("div",{className:De.rightSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[(r==null?void 0:r.charge.name)&&s.jsxRuntimeExports.jsxs("header",{className:De.header,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:De.headerTitle,children:r.charge.name}),r.charge.description&&s.jsxRuntimeExports.jsx("p",{className:De.headerDescription,children:r.charge.description})]}),s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",onClick:()=>u((r==null?void 0:r.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),s.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:De.productList,children:p.map(x=>s.jsxRuntimeExports.jsx(jo,{product:x,isOrder:!0},x.id))}),s.jsxRuntimeExports.jsx(cr,{formatter:d,coupon:null,total:((f=r==null?void 0:r.charge)==null?void 0:f.price.amount)||0,discount:0,totalWithDiscount:((m=r==null?void 0:r.charge)==null?void 0:m.price.amount)||0,className:De.prices,isShowSubtotal:!1}),s.jsxRuntimeExports.jsx(vt,{className:De.mobileFooter})]})]})})]})},mA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState();n(t.filter(r=>r.id!==e))},fA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState(),r=s.v4();return n([...t,{id:r,...e}]),r},gA=e=>{const{blocks:t,settings:n,header:r,footer:o,announcement:i,routes:a=[],shopLogo:u,apiURLs:c,isAntistock:d=!1}=e,[p,h]=k.useState(null),{general:f,setIsAntistock:m}=s.useGeneralStore(),{setApiUrls:x}=s.useApiStore(),{setBlocks:g,setSourceBlocks:C,setHeader:b,setFooter:A,setAnnouncement:y,setSettings:P}=s.useBlocksStore(),{setHeader:L,setFooter:R,setAnnouncement:q}=s.useLayersStore(),{themeSettings:Y}=s.useThemeSettingsStore(),{settings:K,setSettings:w}=s.useSettingsStore(),$=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,B=localStorage.getItem("shopPassword"),H=localStorage.getItem("shopId")||"";return k.useEffect(()=>{m(d)},[d,m]),k.useEffect(()=>{H||localStorage.setItem("shopId",(f==null?void 0:f.info.id)||"")},[f]),k.useEffect(()=>{if(Y&&K){const V=hc(Y,K);Ec(Y),pc(V)}},[Y,K,window.location.hostname]),k.useEffect(()=>{const V={};Object.keys(t).map(ae=>{V[ae]=t[ae]}),C(V),g(V),b(r),A(o),y(i),P(n),c&&x(c);const z=new r,Z=JSON.parse(JSON.stringify(z));L(Z,!1);const G=new o,W=JSON.parse(JSON.stringify(G));R(W,!1);const J=new i,T=JSON.parse(JSON.stringify(J));q(T,!1);const ce=new n,ye=JSON.parse(JSON.stringify(ce));w(ye);const S=s.createBrowserRouter([{element:s.jsxRuntimeExports.jsx(rf,{shopDomain:$,shopId:H,shopPassword:B||void 0,shopLogo:u,children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(Zm,{children:s.jsxRuntimeExports.jsx(s.Outlet,{})})})}),errorElement:s.jsxRuntimeExports.jsx(Jm,{}),children:[{path:"/admin/builder/*",element:s.jsxRuntimeExports.jsx(Hm,{children:s.jsxRuntimeExports.jsx(Pm,{blocks:t,settings:n,header:r,footer:o,announcement:i})}),errorElement:s.jsxRuntimeExports.jsx(Fm,{})},...a,{path:"/checkout",element:s.jsxRuntimeExports.jsx(Il,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:s.jsxRuntimeExports.jsx(QR,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:s.jsxRuntimeExports.jsx(_R,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(pA,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(WR,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Subscriptions",!0)},{path:"/customer-dash",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderAnnouncement,{}),s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:"1 1 auto"},children:s.jsxRuntimeExports.jsx(s.CustomerDashboard,{})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Customer Dashboard",!0)},{path:"/validation",element:s.jsxRuntimeExports.jsx(Xm,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(OR,{})})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:s.jsxRuntimeExports.jsx(dc,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{})}]}]);h(S)},[f]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:p&&s.jsxRuntimeExports.jsx(s.RouterProvider,{router:p})})};exports.ReCaptchaProvider=s.ReCaptchaProvider;exports.aspectRatioOptions=s.aspectRatioOptions;exports.formatPrice=s.formatPrice;exports.splitTextIntoSpans=s.splitTextIntoSpans;exports.useAdaptiveStyles=s.useAdaptiveStyles;exports.useCart=s.useCart;exports.useReCaptcha=s.useReCaptcha;exports.App=gA;exports.Checkout=Il;exports.ColorVariables=la;exports.hotReload=bc;exports.iconNames=_l;exports.removeNotification=mA;exports.showNotification=fA;exports.useBuilderPages=Tc;exports.useCreateTicket=Ic;
|
|
131
|
+
`))}function c(m,x,g,C){const b=g.enter("tableCell"),A=g.enter("phrasing"),y=g.containerPhrasing(m,{...C,before:i,after:i});return A(),b(),y}function d(m,x){return W_(m,{align:x,alignDelimiters:r,padding:n,stringLength:o})}function p(m,x,g){const C=m.children;let b=-1;const A=[],y=x.enter("table");for(;++b<C.length;)A[b]=h(C[b],x,g);return y(),A}function h(m,x,g){const C=m.children;let b=-1;const A=[],y=x.enter("tableRow");for(;++b<C.length;)A[b]=c(C[b],m,x,g);return y(),A}function f(m,x,g){let C=al.inlineCode(m,x,g);return g.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function LC(){return{exit:{taskListCheckValueChecked:ia,taskListCheckValueUnchecked:ia,paragraph:vC}}}function jC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:PC}}}function ia(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function vC(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let i=-1,a;for(;++i<o.length;){const u=o[i];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function PC(e,t,n,r){const o=e.children[0],i=typeof e.checked=="boolean"&&o&&o.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);i&&u.move(a);let c=al.listItem(e,t,n,{...r,...u.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(p){return p+a}}function DC(){return[p_(),P_(),M_(),SC(),LC()]}function OC(e){return{extensions:[m_(),D_(e),F_(),wC(e),jC()]}}const BC={tokenize:zC,partial:!0},ul={tokenize:WC,partial:!0},ll={tokenize:qC,partial:!0},cl={tokenize:VC,partial:!0},MC={tokenize:GC,partial:!0},dl={name:"wwwAutolink",tokenize:UC,previous:pl},hl={name:"protocolAutolink",tokenize:$C,previous:ml},Pt={name:"emailAutolink",tokenize:HC,previous:fl},yt={};function FC(){return{text:yt}}let Zt=48;for(;Zt<123;)yt[Zt]=Pt,Zt++,Zt===58?Zt=65:Zt===91&&(Zt=97);yt[43]=Pt;yt[45]=Pt;yt[46]=Pt;yt[95]=Pt;yt[72]=[Pt,hl];yt[104]=[Pt,hl];yt[87]=[Pt,dl];yt[119]=[Pt,dl];function HC(e,t,n){const r=this;let o,i;return a;function a(h){return!io(h)||!fl.call(r,r.previous)||Lo(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return io(h)?(e.consume(h),u):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(MC,p,d)(h):h===45||h===95||Me(h)?(i=!0,e.consume(h),c):p(h)}function d(h){return e.consume(h),o=!0,c}function p(h){return i&&o&&ze(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function UC(e,t,n){const r=this;return o;function o(a){return a!==87&&a!==119||!pl.call(r,r.previous)||Lo(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(BC,e.attempt(ul,e.attempt(ll,i),n),n)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function $C(e,t,n){const r=this;let o="",i=!1;return a;function a(h){return(h===72||h===104)&&ml.call(r,r.previous)&&!Lo(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(ze(h)&&o.length<5)return o+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const f=o.toLowerCase();if(f==="http"||f==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?d:(i=!0,c)):n(h)}function d(h){return h===null||Wr(h)||Ie(h)||on(h)||Zr(h)?n(h):e.attempt(ul,e.attempt(ll,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function zC(e,t,n){let r=0;return o;function o(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),o):a===46&&r===3?(e.consume(a),i):n(a)}function i(a){return a===null?n(a):t(a)}}function WC(e,t,n){let r,o,i;return a;function a(d){return d===46||d===95?e.check(cl,c,u)(d):d===null||Ie(d)||on(d)||d!==45&&Zr(d)?c(d):(i=!0,e.consume(d),a)}function u(d){return d===95?r=!0:(o=r,r=void 0),e.consume(d),a}function c(d){return o||r||!i?n(d):t(d)}}function qC(e,t){let n=0,r=0;return o;function o(a){return a===40?(n++,e.consume(a),o):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(cl,t,i)(a):a===null||Ie(a)||on(a)?t(a):(e.consume(a),o)}function i(a){return a===41&&r++,e.consume(a),o}}function VC(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),i):u===93?(e.consume(u),o):u===60||u===null||Ie(u)||on(u)?t(u):n(u)}function o(u){return u===null||u===40||u===91||Ie(u)||on(u)?t(u):r(u)}function i(u){return ze(u)?a(u):n(u)}function a(u){return u===59?(e.consume(u),r):ze(u)?(e.consume(u),a):n(u)}}function GC(e,t,n){return r;function r(i){return e.consume(i),o}function o(i){return Me(i)?n(i):t(i)}}function pl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ie(e)}function ml(e){return!ze(e)}function fl(e){return!(e===47||io(e))}function io(e){return e===43||e===45||e===46||e===95||Me(e)}function Lo(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const YC={tokenize:nS,partial:!0};function XC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:JC,continuation:{tokenize:eS},exit:tS}},text:{91:{name:"gfmFootnoteCall",tokenize:ZC},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:QC,resolveTo:KC}}}}function QC(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;o--;){const c=r.events[o][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!a||!a._balanced)return n(c);const d=pt(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function KC(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function ZC(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(h){if(i>999||h===93&&!a||h===null||h===91||Ie(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return o.includes(pt(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Ie(h)||(a=!0),i++,e.consume(h),h===92?p:d}function p(h){return h===91||h===92||h===93?(e.consume(h),i++,d):d(h)}}function JC(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,u;return c;function c(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(x)}function p(x){if(a>999||x===93&&!u||x===null||x===91||Ie(x))return n(x);if(x===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=pt(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ie(x)||(u=!0),a++,e.consume(x),x===92?h:p}function h(x){return x===91||x===92||x===93?(e.consume(x),a++,p):p(x)}function f(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),o.includes(i)||o.push(i),fe(e,m,"gfmFootnoteDefinitionWhitespace")):n(x)}function m(x){return t(x)}}function eS(e,t,n){return e.check(hr,t,e.attempt(YC,t,n))}function tS(e){e.exit("gfmFootnoteDefinition")}function nS(e,t,n){const r=this;return fe(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function rS(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(a,u){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},h={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},f=[["enter",p,u],["enter",a[d][1],u],["exit",a[d][1],u],["enter",h,u]],m=u.parser.constructs.insideSpan.null;m&&Ke(f,f.length,0,Jr(m,a.slice(d+1,c),u)),Ke(f,f.length,0,[["exit",h,u],["enter",a[c][1],u],["exit",a[c][1],u],["exit",p,u]]),Ke(a,d-1,c-d+3,f),c=d+f.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function i(a,u,c){const d=this.previous,p=this.events;let h=0;return f;function f(x){return d===126&&p[p.length-1][1].type!=="characterEscape"?c(x):(a.enter("strikethroughSequenceTemporary"),m(x))}function m(x){const g=_n(d);if(x===126)return h>1?c(x):(a.consume(x),h++,m);if(h<2&&!n)return c(x);const C=a.exit("strikethroughSequenceTemporary"),b=_n(x);return C._open=!b||b===2&&!!g,C._close=!g||g===2&&!!b,u(x)}}}class sS{constructor(){this.map=[]}add(t,n,r){oS(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function oS(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function iS(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function aS(){return{flow:{null:{name:"table",tokenize:uS,resolveAll:lS}}}}function uS(e,t,n){const r=this;let o=0,i=0,a;return u;function u(w){let $=r.events.length-1;for(;$>-1;){const V=r.events[$][1].type;if(V==="lineEnding"||V==="linePrefix")$--;else break}const B=$>-1?r.events[$][1].type:null,H=B==="tableHead"||B==="tableRow"?R:c;return H===R&&r.parser.lazy[r.now().line]?n(w):H(w)}function c(w){return e.enter("tableHead"),e.enter("tableRow"),d(w)}function d(w){return w===124||(a=!0,i+=1),p(w)}function p(w){return w===null?n(w):Q(w)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),m):n(w):he(w)?fe(e,p,"whitespace")(w):(i+=1,a&&(a=!1,o+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),h(w)))}function h(w){return w===null||w===124||Ie(w)?(e.exit("data"),p(w)):(e.consume(w),w===92?f:h)}function f(w){return w===92||w===124?(e.consume(w),h):h(w)}function m(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(e.enter("tableDelimiterRow"),a=!1,he(w)?fe(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):x(w))}function x(w){return w===45||w===58?C(w):w===124?(a=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),g):L(w)}function g(w){return he(w)?fe(e,C,"whitespace")(w):C(w)}function C(w){return w===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(i+=1,b(w)):w===null||Q(w)?P(w):L(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),A(w)):L(w)}function A(w){return w===45?(e.consume(w),A):w===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(w))}function y(w){return he(w)?fe(e,P,"whitespace")(w):P(w)}function P(w){return w===124?x(w):w===null||Q(w)?!a||o!==i?L(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):L(w)}function L(w){return n(w)}function R(w){return e.enter("tableRow"),q(w)}function q(w){return w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),q):w===null||Q(w)?(e.exit("tableRow"),t(w)):he(w)?fe(e,q,"whitespace")(w):(e.enter("data"),Y(w))}function Y(w){return w===null||w===124||Ie(w)?(e.exit("data"),q(w)):(e.consume(w),w===92?K:Y)}function K(w){return w===92||w===124?(e.consume(w),Y):Y(w)}}function lS(e,t){let n=-1,r=!0,o=0,i=[0,0,0,0],a=[0,0,0,0],u=!1,c=0,d,p,h;const f=new sS;for(;++n<e.length;){const m=e[n],x=m[1];m[0]==="enter"?x.type==="tableHead"?(u=!1,c!==0&&(aa(f,t,c,d,p),p=void 0,c=0),d={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",d,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",p,t]])),o=x.type==="tableDelimiterRow"?2:p?3:1):o&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],h=Pr(f,t,i,o,void 0,h),i=[0,0,0,0]),a[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],h=Pr(f,t,i,o,void 0,h)),i=a,a=[i[1],n,0,0])):x.type==="tableHead"?(u=!0,c=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(c=n,i[1]!==0?(a[0]=a[1],h=Pr(f,t,i,o,n,h)):a[1]!==0&&(h=Pr(f,t,a,o,n,h)),o=0):o&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&aa(f,t,c,d,p),f.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=iS(t.events,n))}return e}function Pr(e,t,n,r,o,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(i.end=Object.assign({},gn(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=gn(t.events,n[1]);if(i={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const d=gn(t.events,n[2]),p=gn(t.events,n[3]),h={type:u,start:Object.assign({},d),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,g=n[3]-n[2]-1;e.add(x,g,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return o!==void 0&&(i.end=Object.assign({},gn(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function aa(e,t,n,r,o){const i=[],a=gn(t.events,n);o&&(o.end=Object.assign({},a),i.push(["exit",o,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function gn(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const cS={name:"tasklistCheck",tokenize:hS};function dS(){return{text:{91:cS}}}function hS(e,t,n){const r=this;return o;function o(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Ie(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return Q(c)?t(c):he(c)?e.check({tokenize:pS},t,n)(c):n(c)}}function pS(e,t,n){return fe(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function mS(e){return va([FC(),XC(),rS(e),aS(),dS()])}const fS={};function gS(e){const t=this,n=e||fS,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(mS(n)),i.push(DC()),a.push(OC(n))}const jo=({isOrder:e,product:t})=>{var i;const{shopGeneral:n}=s.useStorefrontStore(),r=t.subscriptionSettings,{cart:o}=s.useCart();return console.log(t.description),s.jsxRuntimeExports.jsxs("div",{className:`${Ne.checkoutProduct} ${e?Ne.isOrder:""}`,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:`${Ne.productImage} ${e?Ne.isOrderImage:""}`,children:t!=null&&t.image?s.jsxRuntimeExports.jsx("img",{className:Ne.image,src:s.convertCfImageIdToUrl(t.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image",fill:"var(--text-secondary)"})}),s.jsxRuntimeExports.jsx("div",{className:Ne.productInfo,children:s.jsxRuntimeExports.jsxs("div",{className:Ne.productHeader,children:[s.jsxRuntimeExports.jsx("h2",{className:Ne.productName,id:"h5",children:t.name}),s.jsxRuntimeExports.jsxs("span",{className:Ne.quantityBadge,id:"md",children:[t.price.quantity,"x"]})]})}),t.chargeType==="RECURRING"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:r&&`${s.formatPrice(r.price)} / ${s.normalizeInterval(r.recurringIntervalDays||0)}${r.entryFee?" + "+s.formatPrice(r.entryFee):""}`}),t.chargeType==="ONE_TIME"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:t.variantsGateways&&o.gateway&&t.variantsGateways.some(a=>a.name===o.gateway&&a.overrodePrice)?s.formatPrice(((i=t.variantsGateways.find(a=>a.name===o.gateway))==null?void 0:i.overrodePrice)||t.price):s.formatPrice(t.price)})]}),t.description&&s.jsxRuntimeExports.jsx("p",{className:Ne.productDescription,children:s.jsxRuntimeExports.jsx(tu,{remarkPlugins:[gS],rehypePlugins:[a_],components:{a:({node:a,...u})=>s.jsxRuntimeExports.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer",className:Ne.link})},children:t.description})}),t.deliveryCategories&&s.jsxRuntimeExports.jsx("div",{className:Ne.deliveryCategories,children:t.deliveryCategories.map(a=>s.jsxRuntimeExports.jsx(s.DeliveryItem,{deliveryConfiguration:a},a.id))}),t.customerNote&&s.jsxRuntimeExports.jsxs("div",{className:Ne.customerNote,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.noteHeader,children:[(n==null?void 0:n.info.logo)&&s.jsxRuntimeExports.jsx("div",{className:Ne.logoContainer,children:s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(n==null?void 0:n.info.logo.cfId)})}),s.jsxRuntimeExports.jsx("p",{className:Ne.shopName,id:"md",children:n==null?void 0:n.info.name})]}),s.jsxRuntimeExports.jsx("p",{className:Ne.noteContent,id:"md",children:t.customerNote})]})]})},xS="_coupon_dkjzv_1",ES="_couponApplied_dkjzv_7",bS="_discount_dkjzv_17",IS="_removeButton_dkjzv_23",TS="_removeButtonText_dkjzv_27",_S="_couponInput_dkjzv_31",CS="_couponInputContainer_dkjzv_37",Mt={coupon:xS,couponApplied:ES,discount:bS,removeButton:IS,removeButtonText:TS,couponInput:_S,couponInputContainer:CS},SS=({applyCoupon:e,couponData:t,discount:n,removeCoupon:r,gateway:o})=>{const[i,a]=k.useState(null),[u,c]=k.useState(!1);return s.jsxRuntimeExports.jsxs("div",{className:Mt.coupon,children:[u&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Mt.skeleton,children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!u&&(t?s.jsxRuntimeExports.jsxs("div",{className:Mt.couponApplied,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"}),s.jsxRuntimeExports.jsxs("p",{id:"md",children:[i," is applied"," ",s.jsxRuntimeExports.jsxs("span",{className:Mt.discount,children:["-",n," ",!t.isFixed&&`(${t.discount}%)`]})]}),s.jsxRuntimeExports.jsx("button",{className:Mt.removeButton,onClick:r,children:s.jsxRuntimeExports.jsx("span",{className:Mt.removeButtonText,children:"Remove"})})]}):s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInput,children:[s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"Enter a discount code",value:i||"",onChange:d=>{a(d===""?null:d)}}),s.jsxRuntimeExports.jsx(s.Button$1,{onClick:async()=>{c(!0),i&&await e(i),c(!1)},disabled:!o||!i,type:"Primary",children:"Apply"})]}),!o&&s.jsxRuntimeExports.jsx(s.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},yS=({cart:e,products:t,applyCoupon:n,applyCouponPending:r,coupon:o,totalAndDiscount:i,removeCoupon:a})=>{var g;const{priceAdjusment:u}=s.useCartStore(),[c,d]=k.useState(!1),p=k.useMemo(()=>e.parts.map(C=>{const b=t.find(y=>y.id===C.productId),A=b==null?void 0:b.variants.find(y=>y.id===C.productVariantId);return C.chargeType==="RECURRING"&&d(!0),{id:(b==null?void 0:b.id)||0,image:b==null?void 0:b.images[0],name:(A==null?void 0:A.name)||"",description:(A==null?void 0:A.description)||"",price:{quantity:C.quantity,amount:(A==null?void 0:A.price.amount)||0,currency:A==null?void 0:A.price.currency},subscriptionSettings:A==null?void 0:A.subscriptionSettings,chargeType:C.chargeType,variantsGateways:A==null?void 0:A.gateways}}),[e,t]),h=((g=p[0])==null?void 0:g.price.currency)||"USD",f=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),m=k.useMemo(()=>o&&!o.isFixed&&o.discount===100?i.total:i.totalWithDiscount?i.total-i.totalWithDiscount:0,[i,o]),x=u?(u==null?void 0:u.fixedAmount)+Math.round((i.totalWithDiscount!==void 0?i.totalWithDiscount:i.total-m)*((u==null?void 0:u.percentage)/100)):null;return s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:Kt.innerContainer,children:[s.jsxRuntimeExports.jsx(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:Kt.headerSection,children:[s.jsxRuntimeExports.jsx("header",{className:Kt.header,children:s.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),s.jsxRuntimeExports.jsx("div",{className:Kt.productsContainer,children:p.map(C=>s.jsxRuntimeExports.jsx(jo,{product:C},C.id))}),s.jsxRuntimeExports.jsx("div",{className:Kt.couponContainer,children:s.jsxRuntimeExports.jsx(SS,{applyCoupon:n,applyCouponPending:r,couponData:o,discount:f.format(m),removeCoupon:a,gateway:e.gateway})}),s.jsxRuntimeExports.jsx(cr,{formatter:f,coupon:o,total:i.total,discount:m,totalWithDiscount:i.totalWithDiscount,feeOrDiscount:c?null:x})]}),s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutFooter,children:s.jsxRuntimeExports.jsx(vt,{})})]})})},kS="_checkoutOperational_1gpn5_1",RS="_innerContainer_1gpn5_16",AS="_antistock_1gpn5_25",NS="_paymentMethodsSection_1gpn5_30",wS="_socialConnectSection_1gpn5_36",LS="_socialConnectLabel_1gpn5_39",jS="_socialConnectContent_1gpn5_43",vS="_continueButton_1gpn5_47",PS="_button_1gpn5_51",DS="_checkoutFooter_1gpn5_55",Et={checkoutOperational:kS,innerContainer:RS,antistock:AS,paymentMethodsSection:NS,socialConnectSection:wS,socialConnectLabel:LS,socialConnectContent:jS,continueButton:vS,button:PS,checkoutFooter:DS},OS="_customFields_uhcib_2",BS="_checkboxWrapper_uhcib_9",MS="_textareaWrapper_uhcib_16",FS="_inputWrapper_uhcib_17",HS="_requiredStar_uhcib_27",xn={customFields:OS,checkboxWrapper:BS,textareaWrapper:MS,inputWrapper:FS,requiredStar:HS},US=({customFields:e,setCustomFields:t})=>{if(e.length===0)return null;const n=e.map(r=>s.jsxRuntimeExports.jsx($S,{customField:r,setCustomFields:t},r.name));return s.jsxRuntimeExports.jsx("div",{className:xn.customFields,children:n})},$S=({customField:e,setCustomFields:t})=>{const n=r=>{t(o=>o.map(i=>i.name===e.name?{...i,value:r}:i))};return s.jsxRuntimeExports.jsx(zS,{value:e.value??"",placeholder:e.placeholder,required:e.required,defaultValue:e.defaultValue,type:e.type,onValueChange:n,label:e.name,regex:e.regex})},zS=({label:e,type:t,defaultValue:n,value:r,placeholder:o,regex:i,required:a,onValueChange:u})=>{if(k.useEffect(()=>{r===""&&n!==void 0&&u(String(n))},[]),t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return s.jsxRuntimeExports.jsxs("label",{className:xn.checkboxWrapper,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:r==="true",onChange:d=>u(d?"true":"false")}),s.jsxRuntimeExports.jsxs("p",{className:xn.checkboxLabel,children:[e,a&&s.jsxRuntimeExports.jsx("span",{className:xn.requiredStar,children:"*"})]})]});if(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return s.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(n??""),required:a});const c=d=>{(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:i?new RegExp(i):/.*/).test(d)&&u(d)};return t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?s.jsxRuntimeExports.jsx("div",{className:xn.textareaWrapper,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{label:e,value:r,placeholder:o,onChange:c,required:a})}):s.jsxRuntimeExports.jsx("div",{className:xn.inputWrapper,children:s.jsxRuntimeExports.jsx(s.Input$1,{type:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":o,label:e,value:r,required:a,onChange:c})})},WS="_connectedContainer_1rxr8_1",qS="_userInfo_1rxr8_10",VS="_avatar_1rxr8_16",GS="_avatarImage_1rxr8_26",Dr={connectedContainer:WS,userInfo:qS,avatar:VS,avatarImage:GS},YS=({customerEmail:e})=>{const{discordInfo:t,setDiscordInfo:n}=s.useDiscordStore(),{notifications:r,setNotifications:o}=s.useNotificationStore(),[i,a]=k.useState(!1),[u,c]=k.useState(0),[d,p]=k.useState(null),h=20,f=g=>{var C,b,A,y;return(b=(C=g==null?void 0:g.response)==null?void 0:C.data)!=null&&b.error?g.response.data.error:(y=(A=g==null?void 0:g.response)==null?void 0:A.data)!=null&&y.message?g.response.data.message:g!=null&&g.message?g.message:"Failed to connect to Discord. Please try again later."},m=(g,C)=>{o([...r,{id:s.v4(),message:g,status:C}])};k.useEffect(()=>{if(d&&i){const g=setInterval(()=>{d.closed&&(clearInterval(g),a(!1),p(null))},1e3);return()=>clearInterval(g)}},[d,i]);const x=()=>{e.trim()!==""&&(a(!0),c(0),uc({customerEmail:e,tsId:s.getTsId()}).then(({data:g})=>{const C=window.open(g.redirectUrl);p(C),(!C||C.closed||typeof C.closed>"u")&&setTimeout(()=>{const y=document.createElement("a");y.href=g.redirectUrl,y.target="_blank",y.click()});let b;const A=()=>{if(c(y=>y+1),u>=h||C&&C.closed){u>=h&&m("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(b);return}lc({id:g.id,customerEmail:e}).then(({data:y})=>{n({authorized:!0,id:y.id,avatar:y.avatar,username:y.username}),C&&C.close(),a(!1),p(null),m("Discord successfully connected!","success"),clearTimeout(b)}).catch(y=>{var P;if(console.log("Waiting for authorization...",y,{newWindow:C}),C&&C.closed){a(!1),clearTimeout(b);return}if((P=y==null?void 0:y.response)!=null&&P.status&&y.response.status!==404&&y.response.status>=400){m(f(y),"error"),a(!1),clearTimeout(b);return}clearTimeout(b),b=setTimeout(A,1500)})};A()}).catch(g=>{console.log("Could not initiate Discord authorization",g),m(f(g),"error"),a(!1)}))};return t!=null&&t.authorized?s.jsxRuntimeExports.jsxs("div",{className:Dr.connectedContainer,children:[s.jsxRuntimeExports.jsxs("div",{className:Dr.userInfo,children:[s.jsxRuntimeExports.jsx("div",{className:Dr.avatar,children:t.avatar?s.jsxRuntimeExports.jsx("img",{className:Dr.avatarImage,src:`https://cdn.discordapp.com/avatars/${t.id}/${t.avatar}.png?size=256`}):s.jsxRuntimeExports.jsx(s.Icon,{name:"UserCircle"})}),s.jsxRuntimeExports.jsx("p",{children:t.username}),s.jsxRuntimeExports.jsx(Sf,{})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Reconnect"})]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:i,children:i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"DiscordLogo"}),s.jsxRuntimeExports.jsx(s.StableText,{children:"Connect Your Discord"})]})})},XS="_paymentMethodsContainer_1pfqr_2",QS="_antistock_1pfqr_15",ua={paymentMethodsContainer:XS,antistock:QS},KS="_bottomSheet_1x8kc_1",ZS="_content_1x8kc_8",JS="_description_1x8kc_11",e3="_title_1x8kc_15",t3="_buttonGroup_1x8kc_19",n3="_buttonWrapper_1x8kc_29",r3="_fullWidthButton_1x8kc_32",s3="_modal_1x8kc_36",o3="_header_1x8kc_43",wt={bottomSheet:KS,content:ZS,description:JS,title:e3,buttonGroup:t3,buttonWrapper:n3,fullWidthButton:r3,modal:s3,header:o3},i3=({setIsOpen:e,balance:t})=>{const n=s.useNavigate(),{setIsOpen:r}=s.useModalStore(),o=()=>{n("/top-up?redirectRoute=checkout")};function i(){r(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:wt.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:wt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:wt.title,children:"Insufficient Customer Balance"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:wt.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:wt.content,children:s.jsxRuntimeExports.jsxs("p",{className:wt.description,children:["You currently have ",t&&s.formatPrice(t)," in your balance. After topping up the required amount, you can continue to checkout."]})}),s.jsxRuntimeExports.jsxs("div",{className:wt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:wt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:wt.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:o,children:"Add Balance"})})]})]})]})},gl=({align:e,gateway:t,gatewayDisplayName:n,selected:r,onSelect:o,total:i,onSignInClick:a,reversed:u})=>{const{token:c}=s.useStorefrontStore(),{balance:d}=s.useCustomerDashboardStore(),[p,h]=k.useState(!1),{setIsOpen:f}=s.useModalStore(),m=x=>{x.stopPropagation(),o&&o(t),d&&d.amount<i&&(h(!0),f(!0))};return k.useEffect(()=>{},[d,i]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(s.styles$3.paymentMethod,{[s.styles$3.selected]:r,[s.styles$3.alignColumn]:e==="column",[s.styles$3.reversed]:u}),onClick:m,children:[s.jsxRuntimeExports.jsxs("p",{className:s.styles$3.paymentText,id:"md",children:[n," ",s.jsxRuntimeExports.jsxs("span",{className:s.styles$3.balanceText,id:"md",children:["(",c?d&&s.formatPrice(d):s.jsxRuntimeExports.jsx("a",{className:s.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),s.jsxRuntimeExports.jsx("div",{className:s.styles$3.iconContainer,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}),p&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>h(!1),children:s.jsxRuntimeExports.jsx(i3,{setIsOpen:h,balance:d})})]})},xl=({possibleGateways:e,setGateway:t,totalAndDiscount:n,onSignInClick:r,setPaymentMethod:o,isAntistock:i=!1})=>{const[a,u]=k.useState(),[c,d]=k.useState(),{setPriceAdjustment:p}=s.useCartStore(),[h,f]=k.useState(null),m=(x,g)=>{var C;c!==g&&(t(g),p(((C=h==null?void 0:h.find(b=>b.name===g))==null?void 0:C.priceAdjustment)||null)),o(x),u(x),d(g)};return k.useEffect(()=>{if(h&&h.length>0){const x=h[0];if(x.name==="Balance")d(x.name),t(x.name),p(x.priceAdjustment||null);else if(x.paymentMethods&&x.paymentMethods.length>0){const g=x.paymentMethods[0];u(g),d(x.name),t(x.name),o(g),p(x.priceAdjustment||null)}}},[h]),k.useEffect(()=>{const x=async()=>{const{data:g}=await s.fetchGatewaysDetail([...e.availableGateways,...e.requiresSignInGateways]);f(g)};e.availableGateways.length&&x()},[]),k.useLayoutEffect(()=>{p(null)},[]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[h&&s.jsxRuntimeExports.jsx("div",{className:s.clx(ua.paymentMethodsContainer,{[ua.antistock]:i}),children:h==null?void 0:h.map(x=>x.name==="Balance"?s.jsxRuntimeExports.jsx(gl,{gateway:x.name,gatewayDisplayName:x.displayName,onSelect:g=>{d(g),c!==g&&t(g)},selected:x.name===c,total:n.total,onSignInClick:r,reversed:!0},x.name):x.paymentMethods.map(g=>s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{paymentMethod:g,gateway:x.name,gatewayDisplayName:x.displayName,gatewayLogoCfId:x.logoCfImageId,poweredByLogoCfId:x.poweredByImageCfImageId,onSelect:C=>m(C,x.name),selected:a===g&&c===x.name},`${x.name}-${g}`)))}),!h&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:"100%",height:"220px",viewBox:"0 0 600 220",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"5",ry:"5",width:"100%",height:"100%"})})]})},a3="_modal_14r0b_1",u3={modal:a3},l3=({setIsOpen:e})=>{const{token:t}=s.useStorefrontStore(),{setIsOpen:n}=s.useModalStore();k.useEffect(()=>{t&&r()},[t]);const r=()=>{n(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsx("div",{className:u3.modal,onClick:o=>o.stopPropagation(),children:s.jsxRuntimeExports.jsx(s.Auth,{inModal:!0})})},c3=({getPossibleGateways:e,setGateway:t,getDiscordSettings:n,cart:r,products:o,submitCart:i,reset:a,setCustomFieldsToCart:u,totalAndDiscount:c,setDiscordSocialConnectId:d,setPaymentMethod:p,isAntistock:h})=>{const f=k.useMemo(()=>n(),[]),[m,x]=k.useState([]),{balance:g,setBalance:C}=s.useCustomerDashboardStore(),{token:b}=s.useStorefrontStore(),{executeRecaptcha:A}=s.useReCaptcha(),{discordInfo:y}=s.useDiscordStore(),{customerEmail:P,setCustomerEmail:L}=s.useCartStore(),R=y!=null&&y.authorized?y.id:void 0,q=s.useNavigate(),Y=k.useMemo(()=>e(),[r.parts]),[K,w]=k.useState(!1),{setIsOpen:$}=s.useModalStore(),{notifications:B,setNotifications:H}=s.useNotificationStore();k.useEffect(()=>{const W=s.getCommonCustomFields(r.parts,o).map(J=>J.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...J,value:String(J.defaultValue)}:J);x([...W])},[]),k.useEffect(()=>{const G=s.getCommonCustomFields(r.parts,o);x(W=>{const J=new Map(W.map(T=>[T.name,T]));return G.map(T=>{const ce=J.get(T.name);return ce&&ce.value?{...T,value:ce.value}:T.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...T,value:String(T.defaultValue)}:T})})},[r.parts,o]),k.useEffect(()=>{b&&(async()=>{const W=await s.getBalance();C(W)})()},[b]);function V(G){return G&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(G)}const z=()=>{const G=[];return m.forEach(W=>{var J;W.required&&!((J=W.value)!=null&&J.toString().trim())&&G.push({message:`Field "${W.name}" is required.`,status:"error",id:s.v4()})}),G.length>0?(H([...B,...G]),!1):!0},Z=async G=>{if(G.stopPropagation(),r.gateway==="Balance"&&!b){$(!0),w(!0);return}if(!z())return;const W=Object.fromEntries(m.map(T=>[T.name,T.value||""]));u({...W}),R&&f.isEnabled&&d(R);const J=await A();if(J){const T=await i(J),ce=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(ce).length>10){const ye=Date.now()-864e5;Object.keys(ce).forEach(S=>{ce[S].createdAt<=ye&&delete ce[S]})}"order"in T?ce[T.order.id]={createdAt:Date.now(),fullAccessToken:T.order.fullAccessToken}:ce[T.id]={createdAt:Date.now(),fullAccessToken:T.fullAccessToken},localStorage.setItem("orders",JSON.stringify(ce)),q(`/orders/${"order"in T?T.order.id:T.id}/${"order"in T?T.order.fullAccessToken:T.fullAccessToken}`),setTimeout(()=>a(),0)}};return s.jsxRuntimeExports.jsxs("div",{className:Et.checkoutOperational,children:[s.jsxRuntimeExports.jsxs("div",{className:Et.innerContainer,children:[r.parts.length>0&&s.jsxRuntimeExports.jsx(xl,{possibleGateways:Y,setGateway:t,setPaymentMethod:p,balance:g,totalAndDiscount:c,onSignInClick:()=>{w(!0),$(!0)},isAntistock:h}),s.jsxRuntimeExports.jsx("div",{className:s.clx(Et.paymentMethodsSection,{[Et.antistock]:h}),children:s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"mail@mail.com",value:P||"",onChange:G=>L(G),disabled:!!b,label:"Email Address"})}),s.jsxRuntimeExports.jsx(US,{customFields:m,setCustomFields:x}),f.isEnabled&&s.jsxRuntimeExports.jsxs("div",{className:Et.socialConnectSection,children:[s.jsxRuntimeExports.jsx("p",{className:Et.socialConnectLabel,id:"md",children:"Social Connect"}),s.jsxRuntimeExports.jsx("div",{className:Et.socialConnectContent,children:s.jsxRuntimeExports.jsx(YS,{customerEmail:P||""})})]}),s.jsxRuntimeExports.jsxs("div",{className:Et.continueButton,children:[s.jsxRuntimeExports.jsx(s.Button$1,{onClick:Z,disabled:!r.gateway||!V(P||"")||f.isRequired&&!(y!=null&&y.authorized),className:Et.button,children:"Continue to Checkout"}),!h&&s.jsxRuntimeExports.jsx(s.TermsOfService,{}),s.jsxRuntimeExports.jsx(s.SecuredBySsl,{})]}),s.jsxRuntimeExports.jsx(vt,{className:Et.checkoutFooter})]}),K&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>w(!1),children:s.jsxRuntimeExports.jsx(l3,{setIsOpen:w})})]})},d3="_mt1_1t7v2_1",h3="_notifyBlock_1t7v2_13",p3="_notifyHeader_1t7v2_19",m3="_notifyContent_1t7v2_25",f3="_buttonBlock_1t7v2_30",g3="_imageBlock_1t7v2_34",x3="_imageContainer_1t7v2_42",E3="_sectionBlock_1t7v2_54",b3="_sectionTitle_1t7v2_61",I3="_sectionSubtitle_1t7v2_64",T3="_inputContainer_1t7v2_69",mt={mt1:d3,notifyBlock:h3,notifyHeader:p3,notifyContent:m3,buttonBlock:f3,imageBlock:g3,imageContainer:x3,sectionBlock:E3,sectionTitle:b3,sectionSubtitle:I3,inputContainer:T3},_3=({props:e})=>{const t=s.useCopy();return s.jsxRuntimeExports.jsx("div",{className:mt.mt1,children:s.jsxRuntimeExports.jsxs("div",{className:mt.inputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:e.text,disabled:!0,onChange:()=>{}}),e.shownCopyButton&&s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>t(e.text),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})})},C3=({props:e})=>s.jsxRuntimeExports.jsx(s.Button$1,{className:mt.buttonBlock,onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),S3=({props:e})=>s.jsxRuntimeExports.jsx("div",{className:mt.imageBlock,children:s.jsxRuntimeExports.jsx("div",{className:mt.imageContainer,children:s.jsxRuntimeExports.jsx("img",{src:e.src,alt:""})})}),y3=({props:e})=>s.jsxRuntimeExports.jsxs("div",{className:mt.notifyBlock,children:[s.jsxRuntimeExports.jsxs("div",{className:mt.notifyHeader,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),s.jsxRuntimeExports.jsx("p",{children:e.heading})]}),s.jsxRuntimeExports.jsx("p",{className:mt.notifyContent,children:e.content})]}),k3=({props:e})=>{var t;return s.jsxRuntimeExports.jsxs("div",{className:mt.sectionBlock,children:[s.jsxRuntimeExports.jsx("p",{className:mt.sectionTitle,children:e.title}),s.jsxRuntimeExports.jsx("span",{className:mt.sectionSubtitle,children:e.subTitle}),(t=e.children)==null?void 0:t.map((n,r)=>s.jsxRuntimeExports.jsx(El,{block:n},r))]})},El=({block:e})=>{switch(e.type){case"Section":return s.jsxRuntimeExports.jsx(k3,{...e});case"ReadOnlyTextInput":return s.jsxRuntimeExports.jsx(_3,{...e});case"Notify":return s.jsxRuntimeExports.jsx(y3,{...e});case"Button":return s.jsxRuntimeExports.jsx(C3,{...e});case"Image":return s.jsxRuntimeExports.jsx(S3,{...e});default:return null}},R3="_bottomSheet_1x4sq_1",A3="_content_1x4sq_8",N3="_agreementList_1x4sq_11",w3="_agreementItem_1x4sq_16",L3="_warning_1x4sq_23",j3="_buttonGroup_1x4sq_31",v3="_buttonWrapper_1x4sq_41",P3="_fullWidthButton_1x4sq_44",D3="_modal_1x4sq_48",O3="_header_1x4sq_55",Je={bottomSheet:R3,content:A3,agreementList:N3,agreementItem:w3,warning:L3,buttonGroup:j3,buttonWrapper:v3,fullWidthButton:P3,modal:D3,header:O3},B3=({setIsOpen:e,price:t})=>{const[n,r]=k.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Je.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.content,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.agreementList,children:[s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSendAsFF,onChange:a=>r({...n,agreeToSendAsFF:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSend,onChange:a=>r({...n,agreeToSend:a})}),s.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",s.formatPrice(t)," ",t.currency]})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToNotAddNote,onChange:a=>r({...n,agreeToNotAddNote:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),s.jsxRuntimeExports.jsx("div",{className:Je.warning,children:s.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",s.formatPrice(t)," ",t.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",children:s.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),s.jsxRuntimeExports.jsx("div",{className:Je.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:i,children:"Continue to Payment"})})]})]})]})},M3="_chargeItemsContainer_qmv3w_4",F3="_chargeItemsInner_qmv3w_20",H3="_productsContainer_qmv3w_27",U3="_chargeHeader_qmv3w_41",$3="_chargeTitle_qmv3w_49",z3="_chargeDescription_qmv3w_55",W3="_copyButton_qmv3w_61",q3="_productsList_qmv3w_73",V3="_trackingContainer_qmv3w_81",G3="_footerContainer_qmv3w_91",bt={chargeItemsContainer:M3,chargeItemsInner:F3,productsContainer:H3,chargeHeader:U3,chargeTitle:$3,chargeDescription:z3,copyButton:W3,productsList:q3,trackingContainer:V3,footerContainer:G3},Y3=({charge:e})=>{var i;const t=s.useCopy(),n=(e==null?void 0:e.price.currency)||"USD",r=new Intl.NumberFormat("en-US",{style:"currency",currency:n}),o=k.useMemo(()=>{var a;return((a=e==null?void 0:e.order)==null?void 0:a.partOrders.map(u=>{var c,d,p,h,f,m;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:((c=u.productWithVariant)==null?void 0:c.variantName)||"",description:((d=u.productWithVariant)==null?void 0:d.description)||"",price:{quantity:u.quantity,amount:((p=u.productWithVariant)==null?void 0:p.price.amount)||0,currency:(h=u.productWithVariant)==null?void 0:h.price.currency},subscriptionSettings:(f=e.order)!=null&&f.subscriptionOrderId?(m=u.productWithVariant)==null?void 0:m.subscriptionSettings:null}}))||[]},[e]);return s.jsxRuntimeExports.jsx("div",{className:bt.chargeItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:bt.chargeItemsInner,children:[s.jsxRuntimeExports.jsx(lr,{expiresAt:e==null?void 0:e.expiresAt}),s.jsxRuntimeExports.jsxs("div",{className:bt.productsContainer,children:[(e==null?void 0:e.name)&&s.jsxRuntimeExports.jsxs("header",{className:bt.chargeHeader,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:bt.chargeTitle,id:"h5",children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:bt.chargeDescription,id:"md",children:e.description})]}),((i=e.order)==null?void 0:i.id)&&s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",className:bt.copyButton,onClick:()=>{var a;return t(((a=e.order)==null?void 0:a.id)||"")},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),"Copy Order ID"]})]}),s.jsxRuntimeExports.jsxs("div",{style:{flex:1},children:[!!o.length&&s.jsxRuntimeExports.jsx("div",{className:bt.productsList,children:o.map(a=>s.jsxRuntimeExports.jsx(jo,{product:a},a.id))}),s.jsxRuntimeExports.jsx(cr,{formatter:r,coupon:null,total:(e==null?void 0:e.price.amount)||0,discount:0,totalWithDiscount:(e==null?void 0:e.price.amount)||0,isShowSubtotal:!1})]}),s.jsxRuntimeExports.jsxs("div",{children:[e&&s.jsxRuntimeExports.jsx("div",{className:bt.trackingContainer,children:s.jsxRuntimeExports.jsx(s.TrackPayment,{timeline:e.timeline})}),s.jsxRuntimeExports.jsx(vt,{className:bt.footerContainer})]})]})]})})},X3="_checkoutOrderMainData_hqf60_1",Q3="_orderDetailRow_hqf60_6",K3="_chargeIdRow_hqf60_16",Z3="_detailLabel_hqf60_25",J3="_detailValue_hqf60_29",ey="_chargeIdContainer_hqf60_33",ty="_chargeId_hqf60_16",ny="_copyIcon_hqf60_51",Ue={checkoutOrderMainData:X3,orderDetailRow:Q3,chargeIdRow:K3,detailLabel:Z3,detailValue:J3,chargeIdContainer:ey,chargeId:ty,copyIcon:ny},bl=({lastUpdate:e,invoiceId:t,email:n,paymentType:r})=>{const o=s.useCopy(),[i,a]=k.useState(null),u=i==null?void 0:i.find(d=>d.name===r);k.useEffect(()=>{i||(async()=>{const p=[r],h=await s.getGatewaysDetail(p);a(h)})()},[r,i]);const c=d=>{const p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h=d.getDate().toString().padStart(2,"0"),f=p[d.getMonth()],m=d.getFullYear(),x=d.getHours(),g=d.getMinutes().toString().padStart(2,"0"),C=d.getSeconds().toString().padStart(2,"0"),b=x>=12?"PM":"AM",A=(x%12||12).toString().padStart(2,"0");return`${f} ${h}, ${m} at ${A}:${g}:${C} ${b}`};return s.jsxRuntimeExports.jsxs("div",{className:Ue.checkoutOrderMainData,children:[s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Last Updated"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:c(new Date(e))})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Payment Type"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Email"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:n})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Charge ID"}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdContainer,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.chargeId,id:"md",children:t}),s.jsxRuntimeExports.jsx("div",{className:Ue.copyIcon,onClick:()=>o(t),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})]})]})},ry="_bottomSheet_1yai1_1",sy="_formContainer_1yai1_8",oy="_error_1yai1_14",iy="_buttonGroup_1yai1_18",ay="_buttonWrapper_1yai1_28",uy="_fullWidthButton_1yai1_31",ly="_modal_1yai1_41",cy="_header_1yai1_48",Ft={bottomSheet:ry,formContainer:sy,error:oy,buttonGroup:iy,buttonWrapper:ay,fullWidthButton:uy,modal:ly,header:cy},dy=({chargeId:e,setIsOpen:t})=>{const[n,r]=k.useState(""),[o,i]=k.useState(""),{setIsOpen:a}=s.useModalStore(),u=p=>{try{return new URL(p),!0}catch{return!1}},c=async p=>{if(p.preventDefault(),!n){i("The link field cannot be empty.");return}if(!u(n)){i("Please enter a valid URL");return}await nc({url:n},e)&&(alert("CashApp successfully verified"),t(!1))},d=()=>{a(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ft.modal,onClick:p=>p.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ft.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:d,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsx("form",{onSubmit:c,children:s.jsxRuntimeExports.jsxs("div",{className:Ft.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.formContainer,children:s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:n,onChange:p=>{r(p),i("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),o&&s.jsxRuntimeExports.jsx("p",{className:Ft.error,children:o})]})}),s.jsxRuntimeExports.jsxs("div",{className:Ft.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:d,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ft.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},hy="_container_1opbn_1",py="_productDetails_1opbn_8",my="_imageContainer_1opbn_14",fy="_image_1opbn_14",gy="_textContainer_1opbn_32",xy="_header_1opbn_40",Ey="_title_1opbn_46",by="_price_1opbn_53",Iy="_badgeContainer_1opbn_57",Ty="_description_1opbn_61",It={container:hy,productDetails:py,imageContainer:my,image:fy,textContainer:gy,header:xy,title:Ey,price:by,badgeContainer:Iy,description:Ty},_y=({subscription:e})=>s.jsxRuntimeExports.jsxs("div",{className:It.container,children:[s.jsxRuntimeExports.jsxs("div",{className:It.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:It.imageContainer,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{className:It.image,src:s.convertCfImageIdToUrl(e.image.cfId),alt:e==null?void 0:e.name}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:It.textContainer,children:[s.jsxRuntimeExports.jsx("div",{className:It.header,children:s.jsxRuntimeExports.jsx("h2",{className:It.title,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:It.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx("div",{className:It.badgeContainer,children:s.jsxRuntimeExports.jsx(s.SubscriptionStatusBadge,{status:e.status})})]}),e.description&&s.jsxRuntimeExports.jsx(tu,{className:It.description,children:e.description})]}),Cy="_card_69liy_1",Sy="_price_69liy_10",yy="_interval_69liy_17",ky="_name_69liy_22",Ry="_description_69liy_28",Ay="_currentPlan_69liy_32",Ny="_selectButton_69liy_45",wy="_progressSection_69liy_50",Ly="_progressLabel_69liy_54",jy="_bottomSheet_69liy_60",vy="_title_69liy_69",Py="_typeSelector_69liy_80",Dy="_typeOption_69liy_90",Oy="_active_69liy_100",By="_saveTag_69liy_108",My="_planSelector_69liy_117",Fy="_modal_69liy_127",Hy="_inactive_69liy_148",Uy="_notMounted_69liy_151",$y="_closeButton_69liy_157",Se={card:Cy,price:Sy,interval:yy,name:ky,description:Ry,currentPlan:Ay,selectButton:Ny,progressSection:wy,progressLabel:Ly,bottomSheet:jy,title:vy,typeSelector:Py,typeOption:Dy,active:Oy,saveTag:By,planSelector:My,modal:Fy,inactive:Hy,notMounted:Uy,closeButton:$y},zy=({variant:e,onSelect:t,isCurrent:n})=>{const r=e.subscriptionSettings.recurringIntervalDays===30?"month":e.subscriptionSettings.recurringIntervalDays===365?"year":"period",o=e.subscriptionSettings.price.amount.toFixed(2),i=e.subscriptionSettings.recurringIntervalDays,a=10;return s.jsxRuntimeExports.jsxs("div",{className:Se.card,onClick:t,children:[s.jsxRuntimeExports.jsxs("h2",{className:Se.price,children:["$",o," ",s.jsxRuntimeExports.jsxs("span",{className:Se.interval,children:["/ ",r]})]}),s.jsxRuntimeExports.jsx("h3",{className:Se.name,children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:Se.description,children:e.description}),n?s.jsxRuntimeExports.jsxs("div",{className:Se.currentPlan,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check"}),"Your current Plan"]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",className:Se.selectButton,children:"Select"}),n&&s.jsxRuntimeExports.jsxs("div",{className:Se.progressSection,children:[s.jsxRuntimeExports.jsx(fa,{percent:a/i*100,disablePercentLabel:!0}),s.jsxRuntimeExports.jsxs("p",{className:Se.progressLabel,children:["Used: ",a," of ",i," days"]})]})]})},Wy=({isOpen:e,setIsOpen:t,subscription:n})=>{const[r,o]=k.useState(null),[i,a]=k.useState(null),[u,c]=k.useState(null),{id:d,accessToken:p}=s.useParams(),[h,f]=k.useState(!1),[m,x]=k.useState(!1),{setIsOpen:g}=s.useModalStore();k.useEffect(()=>{e&&f(!0)},[e]);const C=()=>{t(!1)},[b,A]=k.useState(null);k.useEffect(()=>{d&&p&&(async()=>{if(d&&p){const{data:R}=await s.getSubscriptionUpgradePlans({id:d,accessToken:p});A(R)}})()},[d,p]),k.useEffect(()=>{var L;if(b!=null&&b.data.types[0]){const R=(L=b.data.types.flatMap(q=>q.productVariants).find(q=>q.data.id===(n==null?void 0:n.variantId)))==null?void 0:L.data;R&&(c(R),a(R))}},[b,n]),k.useEffect(()=>{b!=null&&b.data.types[0]&&o(b==null?void 0:b.data.types[0])},[b==null?void 0:b.data.types]);const y=L=>{o(L),a(null)},P=L=>{a(L),g(!0),x(!0)};return s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.modal,{[Se.active]:e,[Se.inactive]:!e&&h,[Se.notMounted]:!h}),onClick:L=>L.stopPropagation(),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:C,hoverable:!0,className:Se.closeButton,fill:"var(--text-primary)"}),s.jsxRuntimeExports.jsxs("div",{className:Se.bottomSheet,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Se.title,children:"Change Plan"}),s.jsxRuntimeExports.jsx("p",{className:Se.description,children:b==null?void 0:b.data.description}),s.jsxRuntimeExports.jsx("div",{className:Se.typeSelector,children:b==null?void 0:b.data.types.map(L=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.typeOption,{[Se.active]:(r==null?void 0:r.id)===L.id}),onClick:()=>y(L),children:[L.name,L.name==="Yearly"&&s.jsxRuntimeExports.jsx("span",{className:Se.saveTag,children:"Save %"})]},L.id))}),r&&s.jsxRuntimeExports.jsx("div",{className:Se.planSelector,children:r.productVariants.map(L=>s.jsxRuntimeExports.jsx(zy,{variant:L.data,isSelected:(i==null?void 0:i.id)===L.data.id,isCurrent:(u==null?void 0:u.id)===L.data.id,onSelect:()=>P(L.data)},L.data.id))})]}),m&&i&&n&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>{x(!1)},children:s.jsxRuntimeExports.jsx(Pk,{setIsOpen:x,selectedVariant:i,subscription:n})})]})},qy="_container_nb625_1",Vy="_title_nb625_11",Gy="_subtitle_nb625_16",Yy="_info_nb625_20",Or={container:qy,title:Vy,subtitle:Gy,info:Yy},Xy=()=>{const{subscription:e}=s.useSubscriptionStore(),[t,n]=s.extractDateAndTime((e==null?void 0:e.activeTo)||""),[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Or.container,children:[s.jsxRuntimeExports.jsxs("div",{className:Or.info,children:[s.jsxRuntimeExports.jsx("p",{className:Or.title,children:"Expiration Date"}),s.jsxRuntimeExports.jsxs("p",{className:Or.subtitle,children:[t," at ",n]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:a=>{a.stopPropagation(),i(!0),o(!0)},children:"Extend"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(Zk,{setIsOpen:o})})]})},Qy="_couponContainer_1sspa_1",Ky="_iconWrapper_1sspa_10",Zy="_details_1sspa_21",Jy="_title_1sspa_25",ek="_progress_1sspa_29",tk="_foreverText_1sspa_34",fn={couponContainer:Qy,iconWrapper:Ky,details:Zy,title:Jy,progress:ek,foreverText:tk},nk=({coupon:e,currency:t})=>{const n=e.isFixed?s.formatPrice({amount:e.discount,currency:t}):`${e.discount}%`,r=e.initialCouponDurationForSubscriptions?s.percentageDifference(e.initialCouponDurationForSubscriptions,e.currentCouponDurationForSubscriptions||1):100;return s.jsxRuntimeExports.jsxs("div",{className:fn.couponContainer,children:[s.jsxRuntimeExports.jsx("div",{className:fn.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CheckCircle"})}),s.jsxRuntimeExports.jsxs("div",{className:fn.details,children:[s.jsxRuntimeExports.jsxs("p",{className:fn.title,children:[e.name,", ",n," discount"]}),s.jsxRuntimeExports.jsx("div",{className:fn.progress,children:s.jsxRuntimeExports.jsx(fa,{color:"#C2C2C2",percent:r,disablePercentLabel:!0})}),s.jsxRuntimeExports.jsx("p",{className:fn.foreverText,children:"Forever discount code"})]})]})},rk="_paymentMethodContainer_1g0da_4",sk="_paymentMethodTitle_1g0da_15",ok="_activeMethod_1g0da_20",ik="_noMethod_1g0da_28",ak="_activeMethodPaymentMethod_1g0da_37",uk="_paymentMethodLogo_1g0da_47",lk="_paymentMethodNumber_1g0da_57",ck="_method_1g0da_61",Wt={paymentMethodContainer:rk,paymentMethodTitle:sk,activeMethod:ok,noMethod:ik,activeMethodPaymentMethod:ak,paymentMethodLogo:uk,paymentMethodNumber:lk,method:ck},dk="_paymentMethods_1gev0_1",hk="_modal_1gev0_14",pk="_header_1gev0_28",mk="_content_1gev0_37",Jt={paymentMethods:dk,modal:hk,header:pk,content:mk},fk=e=>{const{setIsLoading:t,setIsOpen:n}=e,{subscription:r,setSubscription:o}=s.useSubscriptionStore();if(!r)return null;const{id:i}=s.useParams(),a=s.useNavigate(),{notifications:u,setNotifications:c}=s.useNotificationStore(),{setPaymentMethod:d,setGateway:p,cart:h}=s.useCart(),{setIsOpen:f}=s.useModalStore();async function m(){if(x(),t(!0),i&&r){const{data:g}=await s.changeSubscriptionGateway(i,h.gateway);g.isReconnectPaymentNeeded?a(`/charges/${g.chargeId}`):(c([...u,{status:"success",id:s.v4(),message:"Your action has been successfully completed"}]),o({...r,gatewayName:h.gateway}))}else c([...u,{status:"error",id:s.v4(),message:"Your action has been failed. Try again!"}]);t(!1)}function x(){f(!1),setTimeout(()=>{n(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:Jt.modal,onClick:g=>{g.stopPropagation()},children:[s.jsxRuntimeExports.jsxs("div",{className:Jt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Jt.title,children:"Choose Payment Method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Jt.content,children:[(r==null?void 0:r.availableGateways)&&s.jsxRuntimeExports.jsx(xl,{possibleGateways:{availableGateways:r.availableGateways,requiresSignInGateways:r.availableGateways},setGateway:p,setPaymentMethod:d,totalAndDiscount:{total:(r==null?void 0:r.price.amount)||0,totalWithDiscount:r==null?void 0:r.price.amount},onSignInClick:()=>a("/customer-dash")}),s.jsxRuntimeExports.jsxs("div",{className:Jt.paymentMethods,children:[s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!h.gateway,onClick:()=>m(),children:"Continue"})})]})]})]})},gk="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",xk=()=>{var x,g,C;const{subscription:e}=s.useSubscriptionStore(),{cart:t,setPaymentMethod:n}=s.useCart(),r=s.useNavigate(),[o,i]=k.useState(null),[a,u]=k.useState(!1),[c,d]=k.useState(!1),{setIsOpen:p}=s.useModalStore();if(!e)return null;const[h,f]=k.useState(e.gatewayName||t.gateway),m=t.paymentMethod;return k.useEffect(()=>{(async()=>{const A=await s.getGatewaysDetail(e.availableGateways);i(A)})()},[]),k.useEffect(()=>{t.gateway!==h&&f(t.gateway)},[t.gateway]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodContainer,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("p",{className:Wt.paymentMethodTitle,children:"Active Payment Method"}),e.gatewayInfo&&Object.keys(e.gatewayInfo).length>0&&s.jsxRuntimeExports.jsx(Ek,{gatewayInfo:e.gatewayInfo}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h==="Balance"&&s.jsxRuntimeExports.jsx(gl,{gateway:h,gatewayDisplayName:h,total:(e==null?void 0:e.price.amount)||0,onSignInClick:()=>r("/customer-dash")}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&!h&&s.jsxRuntimeExports.jsx("span",{className:Wt.noMethod,children:"Payment method is not set"}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h&&s.jsxRuntimeExports.jsx("div",{className:Wt.activeMethod,children:o&&s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(x=o.find(b=>b.name===h))==null?void 0:x.logoCfImageId,gatewayDisplayName:(g=o.find(b=>b.name===h))==null?void 0:g.displayName,gateway:h,poweredByLogoCfId:(C=o.find(b=>b.name===h))==null?void 0:C.poweredByImageCfImageId,className:Wt.activeMethodPaymentMethod,selected:m===h,onSelect:b=>{n(b)}},h)})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:b=>{b.stopPropagation(),p(!0),d(!0)},children:t.gateway?"Change":"Manage"})]}),c&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>d(!1),children:s.jsxRuntimeExports.jsx(fk,{setIsLoading:u,setIsOpen:d})})]})},Ek=({gatewayInfo:e})=>{var t,n,r,o,i;return s.jsxRuntimeExports.jsxs("div",{className:Wt.method,children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodLogo,children:[((t=e.card)==null?void 0:t.brand.toLowerCase())==="visa"&&s.jsxRuntimeExports.jsx(s.Visa,{}),((n=e.card)==null?void 0:n.brand.toLowerCase())==="mastercard"&&s.jsxRuntimeExports.jsx("img",{src:gk,alt:"",width:22}),((r=e.card)==null?void 0:r.brand.toLowerCase())!=="visa"&&((o=e.card)==null?void 0:o.brand.toLowerCase())!=="mastercard"&&s.jsxRuntimeExports.jsx(s.Icon,{name:"CreditCard",width:22})]}),s.jsxRuntimeExports.jsxs("p",{className:Wt.paymentMethodNumber,children:["•••• •••• •••• ",(i=e.card)==null?void 0:i.last4]})]})},bk="_subscriptionProductContainer_83ibx_4",Ik="_subscriptionProductImage_83ibx_15",Tk="_subscriptionProductInfo_83ibx_32",_k="_name_83ibx_37",Ck="_price_83ibx_40",qn={subscriptionProductContainer:bk,subscriptionProductImage:Ik,subscriptionProductInfo:Tk,name:_k,price:Ck},Sk=({subscription:e,id:t,accessToken:n})=>{const[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:qn.subscriptionProductContainer,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsx("div",{className:qn.subscriptionProductImage,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(e.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:qn.subscriptionProductInfo,children:[s.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:s.jsxRuntimeExports.jsx("h2",{className:qn.name,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:qn.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:a=>{a.preventDefault(),o(!0),i(!0)},children:"Cancel"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(dR,{accessToken:n,id:t,isOpen:r,setIsOpen:o})})]})},yk="_content_5ctxw_1",kk="_selectedPlan_5ctxw_37",Rk="_planName_5ctxw_44",Ak="_description_5ctxw_48",Nk="_price_5ctxw_51",wk="_buttonGroup_5ctxw_79",Lk="_buttonWrapper_5ctxw_84",jk="_modal_5ctxw_88",vk="_header_5ctxw_95",lt={content:yk,selectedPlan:kk,planName:Rk,description:Ak,price:Nk,buttonGroup:wk,buttonWrapper:Lk,modal:jk,header:vk},Pk=({setIsOpen:e,selectedVariant:t,subscription:n})=>{if(!t)return null;const{setIsOpen:r}=s.useModalStore(),o=()=>{i()},i=()=>{r(!1),setTimeout(()=>{e(!1)},300)},a=(t.subscriptionSettings.compareAtPrice||t.subscriptionSettings.price).amount,u=t.subscriptionSettings.compareAtPrice?t.subscriptionSettings.compareAtPrice.amount-t.subscriptionSettings.price.amount:t.subscriptionSettings.price.amount,c=a-u,d=new Intl.NumberFormat("en-US",{style:"currency",currency:n.price.currency});return s.jsxRuntimeExports.jsxs("div",{className:lt.modal,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:()=>i(),fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.content,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.selectedPlan,children:[s.jsxRuntimeExports.jsx("h2",{className:lt.planName,children:t.name}),s.jsxRuntimeExports.jsx("p",{className:lt.description,children:t.description}),s.jsxRuntimeExports.jsxs("p",{className:lt.price,children:["$",t.subscriptionSettings.price.amount.toFixed(2)," /"," ",t.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),s.jsxRuntimeExports.jsx(cr,{formatter:d,coupon:null,total:c,discount:u})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>i(),children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Primary",onClick:o,children:["Upgrade for $",c.toFixed(2)]})})]})]})]})},Dk="_reviewMessage_1t8u4_1",Ok="_leaveReviewContainer_1t8u4_11",Bk="_leaveReviewTitle_1t8u4_20",Hs={reviewMessage:Dk,leaveReviewContainer:Ok,leaveReviewTitle:Bk},Mk=({review:e,orderId:t,className:n})=>{const[r,o]=k.useState((e==null?void 0:e.rating)||0),[i,a]=k.useState(!1),{setIsOpen:u}=s.useModalStore(),{notifications:c,setNotifications:d}=s.useNotificationStore(),p=async h=>{e&&"accessToken"in e&&(await ic({comment:h,rating:r,tsId:s.getTsId()},t,e.accessToken),d([...c,{status:"success",id:s.v4(),message:"Review left successfully"}]),a(!1))};return k.useEffect(()=>{e&&r&&"accessToken"in e&&!e.rating&&(u(!0),a(!0))},[r]),e?e.rating&&"accessToken"in e?s.jsxRuntimeExports.jsxs("div",{className:Hs.reviewMessage,children:["You left a ",e.rating," star rating"]}):s.jsxRuntimeExports.jsxs("div",{className:s.clx(Hs.leaveReviewContainer,n),children:[s.jsxRuntimeExports.jsx("p",{className:Hs.leaveReviewTitle,children:"Leave a review"}),s.jsxRuntimeExports.jsx(Of,{rating:r,setRating:o,disabled:!!e.rating||!("accessToken"in e)}),i&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>a(!1),children:s.jsxRuntimeExports.jsx(Vk,{setIsOpen:a,onSubmit:p})})]}):null},Fk="_bottomSheet_1bcyj_1",Hk="_content_1bcyj_7",Uk="_title_1bcyj_18",$k="_buttonGroup_1bcyj_22",zk="_buttonWrapper_1bcyj_33",Wk="_modal_1bcyj_37",qk="_header_1bcyj_44",Ht={bottomSheet:Fk,content:Hk,title:Uk,buttonGroup:$k,buttonWrapper:zk,modal:Wk,header:qk},Vk=({setIsOpen:e,onSubmit:t})=>{const[n,r]=k.useState(""),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ht.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ht.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ht.title,children:"Review Description"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Ht.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.content,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{placeholder:"Great product and fast checkout...",value:n,onChange:a=>r(a),label:"Describe your review in detail below"})}),s.jsxRuntimeExports.jsxs("div",{className:Ht.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!n,onClick:()=>{i(),t(n)},children:"Submit"})})]})]})]})},Gk="_container_1idhv_1",Yk="_buttonGroup_1idhv_8",Xk="_buttonWrapper_1idhv_15",Qk="_header_1idhv_19",Kk="_content_1idhv_28",en={container:Gk,buttonGroup:Yk,buttonWrapper:Xk,header:Qk,content:Kk},Zk=({setIsOpen:e})=>{const{subscription:t}=s.useSubscriptionStore(),{getTotalAndDiscount:n,cart:r,coupon:o}=s.useCart(),[i,a]=k.useState(1),u=s.useNavigate(),{setIsOpen:c}=s.useModalStore(),{setNotifications:d,notifications:p}=s.useNotificationStore(),[h,f]=k.useState(!1),m=k.useMemo(()=>n(),[o,r]),x=k.useMemo(()=>m.totalWithDiscount?m.total-m.totalWithDiscount:0,[m]);if(h)return s.jsxRuntimeExports.jsx(s.ProcessingPaymentModal,{});const g=(t==null?void 0:t.price.currency)||"USD",C=new Intl.NumberFormat("en-US",{style:"currency",currency:g});async function b(){var y;f(!0);try{const{data:P}=await s.extendSubscription((t==null?void 0:t.id)||"",{});d([{id:s.v4(),message:"Order created successfully",status:"success"}]),u(`/orders/${(y=P.data)==null?void 0:y.id}/${P.data.fullAccessToken}`)}catch(P){const L=P;d([...p,{id:s.v4(),message:`Order creation failed: ${L.message}`,status:"error"}]),A()}finally{f(!1)}}function A(){c(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:en.container,onClick:y=>y.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:en.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:en.title,children:"Extend Subscription"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:A,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:en.content,children:[s.jsxRuntimeExports.jsx(Yf,{step:i,totalSteps:12,onStepChange:a,label:"How long would you like to extend your subscription for?"}),s.jsxRuntimeExports.jsx(cr,{formatter:C,coupon:o,total:m.total,discount:x,totalWithDiscount:m.totalWithDiscount}),s.jsxRuntimeExports.jsxs("div",{className:en.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:A,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:b,children:"Extend"})})]})]})]})},Jk="_bottomSheet_uw5jb_1",eR="_content_uw5jb_7",tR="_radioGroup_uw5jb_11",nR="_confirmation_uw5jb_26",rR="_iconWrapper_uw5jb_33",sR="_title_uw5jb_42",oR="_message_uw5jb_48",iR="_buttonGroup_uw5jb_54",aR="_buttonWrapper_uw5jb_64",uR="_modal_uw5jb_68",lR="_header_uw5jb_77",je={bottomSheet:Jk,content:eR,radioGroup:tR,confirmation:nR,iconWrapper:rR,title:sR,message:oR,buttonGroup:iR,buttonWrapper:aR,modal:uR,header:lR},cR={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},dR=({isOpen:e,setIsOpen:t,id:n,accessToken:r})=>{const[o,i]=k.useState(0),[a,u]=k.useState(!1),[c,d]=k.useState(""),[p,h]=k.useState(""),{setIsOpen:f}=s.useModalStore(),m=async()=>{if(!c)return;u(!0);const g=await s.cancelSubscription(n,r,{reason:c==="Other reason"?p:c});u(!1),g&&i(2)};k.useEffect(()=>{e||(i(0),d(""),h(""))},[e]);const x=()=>{f(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:je.modal,onClick:g=>g.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:cR[o]||""}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:je.content,children:[o===0&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),s.jsxRuntimeExports.jsxs("div",{className:je.radioGroup,children:[s.jsxRuntimeExports.jsx(s.Radio,{defaultValue:c,onChange:g=>d(g),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"}),c==="Other reason"&&s.jsxRuntimeExports.jsx(s.Textarea$1,{value:p,onChange:g=>h(g),placeholder:"Describe the reason..."})]}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:()=>c&&i(1),disabled:!c,children:"Continue"})})]})]}),o===1&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:m,disabled:a,children:"Cancel it anyway"})})]})]}),o===2&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:`${je.confirmation}`,children:[s.jsxRuntimeExports.jsx("div",{className:je.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"})}),s.jsxRuntimeExports.jsx("p",{className:je.title,children:"Subscription Cancelled"}),s.jsxRuntimeExports.jsx("p",{className:je.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),s.jsxRuntimeExports.jsx("div",{className:je.buttonGroup,children:s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Close"})})})]})]})]})},hR="_checkoutContainer_wkomn_1",pR="_loaderContainer_wkomn_20",Us={checkoutContainer:hR,loaderContainer:pR},Il=()=>{const{isAntistock:e}=s.useGeneralStore(),{cart:t,products:n,pending:r,getTotalAndDiscount:o,getPossibleGateways:i,submitCart:a,setGateway:u,applyCoupon:c,setDiscordSocialConnectId:d,setCustomFields:p,applyCouponPending:h,coupon:f,removeCoupon:m,getDiscordSettings:x,setPaymentMethod:g,reset:C}=s.useCart(),b=k.useMemo(()=>o(),[f,t]),A=s.useNavigate();return k.useEffect(()=>{if(t.parts.length===0)try{A(-1)}catch{A("/")}},[t.parts]),r?s.jsxRuntimeExports.jsx("div",{className:Us.checkoutContainer,children:s.jsxRuntimeExports.jsx("div",{className:Us.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})})}):s.jsxRuntimeExports.jsxs("div",{className:Us.checkoutContainer,children:[s.jsxRuntimeExports.jsx(yS,{cart:t,products:n,applyCoupon:c,applyCouponPending:h,coupon:f,removeCoupon:m,totalAndDiscount:b}),s.jsxRuntimeExports.jsx(c3,{cart:t,getPossibleGateways:i,setGateway:u,getDiscordSettings:x,products:n,submitCart:a,totalAndDiscount:b,setCustomFieldsToCart:p,setDiscordSocialConnectId:d,setPaymentMethod:g,reset:C,isAntistock:e})]})},mR="_chargePageContainer_1a200_1",fR="_chargeItems_1a200_14",gR="_mainContent_1a200_25",xR="_contentWrapper_1a200_36",ER="_statusBlock_1a200_41",bR="_notPaidSection_1a200_45",IR="_footer_1a200_53",TR="_loaderContainer_1a200_63",Ut={chargePageContainer:mR,chargeItems:fR,mainContent:gR,contentWrapper:xR,statusBlock:ER,notPaidSection:bR,footer:IR,loaderContainer:TR},_R=()=>{const{id:e}=s.useParams(),[t,n]=s.useSearchParams(),[r,o]=k.useState(!1),[i,a]=k.useState(),[u,c]=k.useState(!0),d=s.useNavigate(),p=k.useRef(),{setIsOpen:h}=s.useModalStore();return k.useEffect(()=>{const f=async(x,g=!1)=>{g||o(!0);const{data:C}=await ac(x);o(!1),a(C)},m=setInterval(()=>{e&&f(e,!0)},5e3);return e&&f(e),()=>{clearInterval(m)}},[]),k.useEffect(()=>{const f=setTimeout(()=>{console.log("charge timeout",i);const m=t.get("redirectRoute");(i==null?void 0:i.status)===s.ChargeStatus.Paid&&i.redirectUrl&&!p.current&&window.open(i.redirectUrl,"_self"),(i==null?void 0:i.status)===s.ChargeStatus.Paid&&p.current&&d(p.current,{replace:!0}),m&&p&&(p.current=m,t.delete("redirectRoute"),n(t))},1e3);return()=>clearTimeout(f)},[i]),k.useEffect(()=>{((i==null?void 0:i.gateway)==="PayPalFF"||(i==null?void 0:i.gateway)==="Сashapp")&&h(!0)},[i]),r?s.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:Ut.chargePageContainer,children:[s.jsxRuntimeExports.jsx("div",{className:Ut.chargeItems,children:s.jsxRuntimeExports.jsx(Y3,{charge:i})}),s.jsxRuntimeExports.jsx("div",{className:Ut.mainContent,children:s.jsxRuntimeExports.jsxs("div",{className:Ut.contentWrapper,children:[i&&(i==null?void 0:i.status)!==s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx(s.ChargeStatusBlock,{charge:i}),i&&s.jsxRuntimeExports.jsx("div",{className:`${Ut.statusBlock}`,children:s.jsxRuntimeExports.jsx(bl,{lastUpdate:i.expiresAt,email:i.customerForCharge.email,invoiceId:i.id,paymentType:i.gateway})}),(i==null?void 0:i.status)===s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx("div",{className:Ut.notPaidSection,children:i==null?void 0:i.displayPaymentInfo.map((f,m)=>s.jsxRuntimeExports.jsx(El,{block:f},m))}),s.jsxRuntimeExports.jsx(vt,{className:Ut.footer})]})}),(i==null?void 0:i.gateway)==="PayPalFF"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>c(!1),children:s.jsxRuntimeExports.jsx(B3,{price:i.price,setIsOpen:c})}),(i==null?void 0:i.gateway)==="Сashapp"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(dy,{setIsOpen:c,chargeId:i.id})})]})},CR="_wrapper_o0iab_1",SR="_title_o0iab_23",yR="_container_o0iab_30",kR="_content_o0iab_41",RR="_messages_o0iab_52",AR="_input_o0iab_70",NR="_textarea_o0iab_83",wR="_message_o0iab_52",LR="_messageDate_o0iab_125",jR="_myMessage_o0iab_131",vR="_otherMessage_o0iab_138",PR="_button_o0iab_145",DR="_loadingMessage_o0iab_166",$e={wrapper:CR,title:SR,container:yR,content:kR,messages:RR,input:AR,textarea:NR,message:wR,messageDate:LR,myMessage:jR,otherMessage:vR,button:PR,loadingMessage:DR},OR=()=>{const e=window.location.pathname.split("/"),t=e[e.length-1],n=e[e.length-2],[r,o]=k.useState(!0),[i,a]=k.useState(null),[u,c]=k.useState(""),[d,p]=k.useState(null),{executeRecaptcha:h}=s.useReCaptcha(),f=async()=>{if(n&&t){const{data:g}=await s.fetchTicket(n,t);a(g),o(!1)}};k.useEffect(()=>{f();const g=setInterval(()=>{f()},5e3);return()=>clearInterval(g)},[]);const m=async()=>{const g=await h();if(!n||!t||!g||!u.trim())return;const C={content:u,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};a(b=>b?{...b,messages:[...b.messages,C]}:null),p(C.id),c("");try{await s.sendTicketMessage(n,t,u,g,s.getTsId()),await f()}finally{setTimeout(()=>{p(null)},1e4)}},x=g=>{const C=new Date,b=new Date(g),A=Math.floor((C.getTime()-b.getTime())/1e3);if(A<60)return"right now";if(A<3600){const y=Math.floor(A/60);return`${y} minute${y>1?"s":""} ago`}else if(A<10800){const y=Math.floor(A/3600);return`${y} hour${y>1?"s":""} ago`}else return b.getFullYear()===C.getFullYear()?b.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):b.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return s.jsxRuntimeExports.jsx("div",{className:$e.wrapper,children:r&&!i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs("div",{className:$e.container,children:[s.jsxRuntimeExports.jsx("div",{className:$e.title,children:`#${n} (${i==null?void 0:i.title})`}),s.jsxRuntimeExports.jsxs("div",{className:$e.content,children:[s.jsxRuntimeExports.jsx("div",{className:$e.messages,children:i==null?void 0:i.messages.sort((g,C)=>new Date(g.createdAt).getTime()-new Date(C.createdAt).getTime()).map(g=>s.jsxRuntimeExports.jsxs("div",{className:s.clx($e.message,{[$e.myMessage]:!g.isSellerReply,[$e.otherMessage]:g.isSellerReply,[$e.loadingMessage]:d===g.id}),children:[s.jsxRuntimeExports.jsx("div",{className:$e.messageContent,children:s.splitTextIntoSpans(g.content,!1)}),d!==g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:x(g.createdAt)}),d===g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:s.jsxRuntimeExports.jsx(s.Loader,{})})]},g.id))}),s.jsxRuntimeExports.jsxs("div",{className:$e.input,children:[s.jsxRuntimeExports.jsx("textarea",{className:$e.textarea,value:u,placeholder:"What worries you?",onChange:g=>c(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),m())}}),s.jsxRuntimeExports.jsx("div",{className:$e.button,onClick:m,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"PaperPlaneRight"})})]})]})]})})},BR="_subscriptionContainer_1j6ol_1",MR="_leftSection_1j6ol_15",FR="_content_1j6ol_26",HR="_mainContent_1j6ol_33",UR="_detailsSection_1j6ol_37",$R="_buttonGroup_1j6ol_50",zR="_detailsContent_1j6ol_57",tn={subscriptionContainer:BR,leftSection:MR,content:FR,mainContent:HR,detailsSection:UR,buttonGroup:$R,detailsContent:zR},WR=()=>{const{id:e,accessToken:t}=s.useParams(),{subscription:n,setSubscription:r}=s.useSubscriptionStore(),{setIsOpen:o}=s.useModalStore(),[i,a]=k.useState(!1),[u,c]=k.useState(!1);k.useLayoutEffect(()=>{r(null)},[e,t]);const{balanceSettings:d,setBalanceSettings:p}=s.useCustomerDashboardStore();return k.useEffect(()=>{e&&t&&(async()=>{if(!e||!t)return;c(!0);const{data:f}=await s.fetchSubscription(e,t);r({...f}),c(!1)})()},[e,t]),k.useEffect(()=>{d||(async()=>{const f=await s.getBalanceSettings();p(f)})()},[d]),u?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:tn.subscriptionContainer,children:[s.jsxRuntimeExports.jsx("div",{className:tn.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.content,children:[s.jsxRuntimeExports.jsx(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:tn.mainContent,children:[n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),s.jsxRuntimeExports.jsx(_y,{subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),s.jsxRuntimeExports.jsx("div",{className:tn.buttonGroup,children:n.pricingPlanExists&&s.jsxRuntimeExports.jsx(s.Button$1,{onClick:h=>{h.stopPropagation(),o(!0),a(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),s.jsxRuntimeExports.jsx(vt,{})]})]})}),s.jsxRuntimeExports.jsx("div",{className:tn.detailsSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.detailsContent,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(n==null?void 0:n.coupon)&&s.jsxRuntimeExports.jsx(nk,{coupon:n.coupon,currency:n.price.currency||"USD"}),n&&s.jsxRuntimeExports.jsx(Sk,{id:e||"",accessToken:t||"",subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(xk,{}),n.activeTo&&s.jsxRuntimeExports.jsx(Xy,{})]}),s.jsxRuntimeExports.jsx(vt,{className:"flex md:hidden"})]})})]}),s.jsxRuntimeExports.jsx(Wy,{isOpen:i,setIsOpen:a,subscription:n})]})},qR="_topUpContainer_1pag6_1",VR="_formWrapper_1pag6_15",GR="_header_1pag6_29",YR="_footer_1pag6_82",XR="_wrapper_1pag6_105",Vn={topUpContainer:qR,formWrapper:VR,header:GR,footer:YR,wrapper:XR},QR=()=>{const{gatewaysDetail:e,setGatewaysDetail:t,balanceSettings:n,setBalanceSettings:r}=s.useCustomerDashboardStore();return k.useEffect(()=>{!e&&n&&(async()=>{const i=await s.getGatewaysDetail(n!=null&&n.isEnabled?(n==null?void 0:n.topUpSettings.gateways)||[]:[]);t(i)})()},[e,n]),k.useEffect(()=>{n||(async()=>{const i=await s.getBalanceSettings();r(i)})()},[n]),s.jsxRuntimeExports.jsxs("div",{className:Vn.wrapper,children:[s.jsxRuntimeExports.jsx(lr,{className:Vn.header}),s.jsxRuntimeExports.jsx("div",{className:Vn.topUpContainer,children:n?s.jsxRuntimeExports.jsx("div",{className:Vn.formWrapper,children:s.jsxRuntimeExports.jsx(s.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):s.jsxRuntimeExports.jsx(s.Loader,{})}),s.jsxRuntimeExports.jsx("div",{className:Vn.footer,children:s.jsxRuntimeExports.jsx(vt,{})})]})},KR="_orderPage_1nvve_1",ZR="_leftSection_1nvve_15",JR="_content_1nvve_35",eA="_main_1nvve_42",tA="_statusBlock_1nvve_54",nA="_timelineBlock_1nvve_58",rA="_footer_1nvve_62",sA="_rightSection_1nvve_71",oA="_header_1nvve_84",iA="_productList_1nvve_92",aA="_mobileFooter_1nvve_99",uA="_loaderContainer_1nvve_108",lA="_orderMainData_1nvve_116",cA="_prices_1nvve_123",dA="_headerTitle_1nvve_127",hA="_headerDescription_1nvve_131",De={orderPage:KR,leftSection:ZR,content:JR,main:eA,statusBlock:tA,timelineBlock:nA,footer:rA,rightSection:sA,header:oA,productList:iA,mobileFooter:aA,loaderContainer:uA,orderMainData:lA,prices:cA,headerTitle:dA,headerDescription:hA},pA=()=>{var h,f,m;const{id:e,accessToken:t}=s.useParams(),n=s.useNavigate(),[r,o]=k.useState(),[i,a]=k.useState(!1),u=s.useCopy(),c=((h=r==null?void 0:r.rawPrice)==null?void 0:h.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:c}),p=k.useMemo(()=>(r==null?void 0:r.partOrders.map(x=>{var g,C,b,A;return{id:(x==null?void 0:x.id)||0,image:x.productWithVariant.image,name:((g=x.productWithVariant)==null?void 0:g.name)||"",description:((C=x.productWithVariant)==null?void 0:C.description)||"",price:{quantity:x.quantity,amount:((b=x.productWithVariant)==null?void 0:b.price.amount)||0,currency:(A=x.productWithVariant)==null?void 0:A.price.currency},deliveryCategories:"deliveryCategories"in x?x.deliveryCategories:void 0,customerNote:x.customerNote,chargeType:x.chargeType||"ONE_TIME"}}))||[],[r]);return k.useLayoutEffect(()=>{if(e&&!t){const x=JSON.parse(localStorage.getItem("orders")||"{}");x[e]&&n(`/orders/${e}/${x[e].fullAccessToken}`)}},[e]),k.useEffect(()=>{const x=async(C,b=!1)=>{b||a(!0);const{data:A}=await(t?s.fetchAuthorizedOrder(`${C}/${t}`):s.fetchOrder(C));a(!1),A.charge.status===s.ChargeStatus.NotPaid&&n(`/charges/${A.charge.id}`,{replace:!0}),o(A)};e&&x(e);const g=setInterval(()=>{e&&x(e,!0)},5e3);return()=>{clearInterval(g)}},[]),i?s.jsxRuntimeExports.jsx("div",{className:De.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:De.orderPage,children:[s.jsxRuntimeExports.jsx("div",{className:De.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[s.jsxRuntimeExports.jsx(lr,{}),r&&s.jsxRuntimeExports.jsxs("div",{className:De.main,children:[s.jsxRuntimeExports.jsx(s.OrderStatusBlock,{className:De.statusBlock,orderStatus:r.status}),s.jsxRuntimeExports.jsxs("div",{className:De.orderMainData,children:[s.jsxRuntimeExports.jsx(bl,{lastUpdate:r.createdAt,paymentType:r.charge.gateway,email:r.charge.customerForCharge.email,invoiceId:r.charge.id}),"accessToken"in r.review&&s.jsxRuntimeExports.jsx(Mk,{orderId:r.id,review:r.review})]}),r.charge&&s.jsxRuntimeExports.jsx(s.TrackPayment,{className:De.timelineBlock,timeline:r.charge.timeline}),s.jsxRuntimeExports.jsx(vt,{className:De.footer})]})]})}),s.jsxRuntimeExports.jsx("div",{className:De.rightSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[(r==null?void 0:r.charge.name)&&s.jsxRuntimeExports.jsxs("header",{className:De.header,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:De.headerTitle,children:r.charge.name}),r.charge.description&&s.jsxRuntimeExports.jsx("p",{className:De.headerDescription,children:r.charge.description})]}),s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",onClick:()=>u((r==null?void 0:r.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),s.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:De.productList,children:p.map(x=>s.jsxRuntimeExports.jsx(jo,{product:x,isOrder:!0},x.id))}),s.jsxRuntimeExports.jsx(cr,{formatter:d,coupon:null,total:((f=r==null?void 0:r.charge)==null?void 0:f.price.amount)||0,discount:0,totalWithDiscount:((m=r==null?void 0:r.charge)==null?void 0:m.price.amount)||0,className:De.prices,isShowSubtotal:!1}),s.jsxRuntimeExports.jsx(vt,{className:De.mobileFooter})]})]})})]})},mA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState();n(t.filter(r=>r.id!==e))},fA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState(),r=s.v4();return n([...t,{id:r,...e}]),r},gA=e=>{const{blocks:t,settings:n,header:r,footer:o,announcement:i,routes:a=[],shopLogo:u,apiURLs:c,isAntistock:d=!1}=e,[p,h]=k.useState(null),{general:f,setIsAntistock:m}=s.useGeneralStore(),{setApiUrls:x}=s.useApiStore(),{setBlocks:g,setSourceBlocks:C,setHeader:b,setFooter:A,setAnnouncement:y,setSettings:P}=s.useBlocksStore(),{setHeader:L,setFooter:R,setAnnouncement:q}=s.useLayersStore(),{themeSettings:Y}=s.useThemeSettingsStore(),{settings:K,setSettings:w}=s.useSettingsStore(),$=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,B=localStorage.getItem("shopPassword"),H=localStorage.getItem("shopId")||"";return k.useEffect(()=>{m(d)},[d,m]),k.useEffect(()=>{H||localStorage.setItem("shopId",(f==null?void 0:f.info.id)||"")},[f]),k.useEffect(()=>{if(Y&&K){const V=hc(Y,K);Ec(Y),pc(V)}},[Y,K,window.location.hostname]),k.useEffect(()=>{const V={};Object.keys(t).map(ae=>{V[ae]=t[ae]}),C(V),g(V),b(r),A(o),y(i),P(n),c&&x(c);const z=new r,Z=JSON.parse(JSON.stringify(z));L(Z,!1);const G=new o,W=JSON.parse(JSON.stringify(G));R(W,!1);const J=new i,T=JSON.parse(JSON.stringify(J));q(T,!1);const ce=new n,ye=JSON.parse(JSON.stringify(ce));w(ye);const S=s.createBrowserRouter([{element:s.jsxRuntimeExports.jsx(rf,{shopDomain:$,shopId:H,shopPassword:B||void 0,shopLogo:u,children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(Zm,{children:s.jsxRuntimeExports.jsx(s.Outlet,{})})})}),errorElement:s.jsxRuntimeExports.jsx(Jm,{}),children:[{path:"/admin/builder/*",element:s.jsxRuntimeExports.jsx(Hm,{children:s.jsxRuntimeExports.jsx(Pm,{blocks:t,settings:n,header:r,footer:o,announcement:i})}),errorElement:s.jsxRuntimeExports.jsx(Fm,{})},...a,{path:"/checkout",element:s.jsxRuntimeExports.jsx(Il,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:s.jsxRuntimeExports.jsx(QR,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:s.jsxRuntimeExports.jsx(_R,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(pA,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(WR,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Subscriptions",!0)},{path:"/customer-dash",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderAnnouncement,{}),s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:"1 1 auto"},children:s.jsxRuntimeExports.jsx(s.CustomerDashboard,{})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Customer Dashboard",!0)},{path:"/validation",element:s.jsxRuntimeExports.jsx(Xm,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(OR,{})})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:s.jsxRuntimeExports.jsx(dc,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{})}]}]);h(S)},[f]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:p&&s.jsxRuntimeExports.jsx(s.RouterProvider,{router:p})})};exports.ReCaptchaProvider=s.ReCaptchaProvider;exports.aspectRatioOptions=s.aspectRatioOptions;exports.formatPrice=s.formatPrice;exports.splitTextIntoSpans=s.splitTextIntoSpans;exports.useAdaptiveStyles=s.useAdaptiveStyles;exports.useCart=s.useCart;exports.useReCaptcha=s.useReCaptcha;exports.App=gA;exports.Checkout=Il;exports.ColorVariables=la;exports.hotReload=bc;exports.iconNames=_l;exports.removeNotification=mA;exports.showNotification=fA;exports.useBuilderPages=Tc;exports.useCreateTicket=Ic;
|