@billgangcom/theme-lib 1.36.0 → 1.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/constants/theme-settings.d.ts +0 -1
- package/dist/builder.cjs.js +3 -3
- package/dist/builder.es.js +50 -70
- package/dist/{index-DwwDB4Kw.js → index-CAh3qv6L.js} +7 -8
- package/dist/{index-BnJDbbG8.cjs → index-D1mPV-lW.cjs} +2 -2
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +607 -620
- package/package.json +1 -1
|
@@ -4587,8 +4587,8 @@ const xi = Wt(
|
|
|
4587
4587
|
}
|
|
4588
4588
|
},
|
|
4589
4589
|
borders: {
|
|
4590
|
-
radius:
|
|
4591
|
-
thickness:
|
|
4590
|
+
radius: 10,
|
|
4591
|
+
thickness: 1
|
|
4592
4592
|
},
|
|
4593
4593
|
buttons: {
|
|
4594
4594
|
primary: {
|
|
@@ -4643,13 +4643,12 @@ const xi = Wt(
|
|
|
4643
4643
|
inputs: {
|
|
4644
4644
|
general: {
|
|
4645
4645
|
height: 48,
|
|
4646
|
-
name: "Style Name",
|
|
4647
4646
|
size: 48,
|
|
4648
|
-
color: "
|
|
4647
|
+
color: "#000000"
|
|
4649
4648
|
},
|
|
4650
4649
|
field: {
|
|
4651
4650
|
active: !0,
|
|
4652
|
-
color: "
|
|
4651
|
+
color: "#000000",
|
|
4653
4652
|
opacity: 40
|
|
4654
4653
|
},
|
|
4655
4654
|
border: {
|
|
@@ -4657,12 +4656,12 @@ const xi = Wt(
|
|
|
4657
4656
|
style: "solid",
|
|
4658
4657
|
radius: 0,
|
|
4659
4658
|
thickness: 0,
|
|
4660
|
-
color: "
|
|
4659
|
+
color: "#000000"
|
|
4661
4660
|
},
|
|
4662
4661
|
label: {
|
|
4663
4662
|
height: 48,
|
|
4664
4663
|
size: 48,
|
|
4665
|
-
color: "
|
|
4664
|
+
color: "#000000",
|
|
4666
4665
|
alignment: "left"
|
|
4667
4666
|
}
|
|
4668
4667
|
}
|
|
@@ -29854,7 +29853,7 @@ const foe = "_button_1gxoe_1", hoe = "_primary_1gxoe_14", poe = "_secondary_1gxo
|
|
|
29854
29853
|
] }),
|
|
29855
29854
|
/* @__PURE__ */ i.jsxs("div", { className: xt.modalContent, children: [
|
|
29856
29855
|
/* @__PURE__ */ i.jsxs("div", { className: xt.top, children: [
|
|
29857
|
-
/* @__PURE__ */ i.jsx("div", {
|
|
29856
|
+
/* @__PURE__ */ i.jsx("div", {}),
|
|
29858
29857
|
/* @__PURE__ */ i.jsxs("div", { children: [
|
|
29859
29858
|
"Selected: ",
|
|
29860
29859
|
s.filter((p) => p.isSelected).length,
|
|
@@ -58,7 +58,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
58
58
|
* LICENSE.md file in the root directory of this source tree.
|
|
59
59
|
*
|
|
60
60
|
* @license MIT
|
|
61
|
-
*/function Xn(){return Xn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xn.apply(this,arguments)}function nd(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}const Oi="get",Mi="application/x-www-form-urlencoded";function kl(e){return e!=null&&typeof e.tagName=="string"}function H3(e){return kl(e)&&e.tagName.toLowerCase()==="button"}function V3(e){return kl(e)&&e.tagName.toLowerCase()==="form"}function $3(e){return kl(e)&&e.tagName.toLowerCase()==="input"}function U3(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function W3(e,t){return e.button===0&&(!t||t==="_self")&&!U3(e)}function Xc(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}function z3(e,t){let r=Xc(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(a=>{r.append(o,a)})}),r}let hi=null;function Z3(){if(hi===null)try{new FormData(document.createElement("form"),0),hi=!1}catch{hi=!0}return hi}const q3=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function dc(e){return e!=null&&!q3.has(e)?(process.env.NODE_ENV!=="production"&&Bt(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+Mi+'"')),null):e}function G3(e,t){let r,n,o,a,s;if(V3(e)){let c=e.getAttribute("action");n=c?Zr(c,t):null,r=e.getAttribute("method")||Oi,o=dc(e.getAttribute("enctype"))||Mi,a=new FormData(e)}else if(H3(e)||$3(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||c.getAttribute("action");if(n=u?Zr(u,t):null,r=e.getAttribute("formmethod")||c.getAttribute("method")||Oi,o=dc(e.getAttribute("formenctype"))||dc(c.getAttribute("enctype"))||Mi,a=new FormData(c,e),!Z3()){let{name:d,type:f,value:h}=e;if(f==="image"){let p=d?d+".":"";a.append(p+"x","0"),a.append(p+"y","0")}else d&&a.append(d,h)}}else{if(kl(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Oi,n=null,o=Mi,s=e}return a&&o==="text/plain"&&(s=a,a=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:a,body:s}}const Y3=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],K3=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],X3=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"],J3="6";try{window.__reactRouterVersion=J3}catch{}function Q3(e,t){return n3({basename:void 0,future:Xn({},void 0,{v7_prependBasename:!0}),history:T5({window:void 0}),hydrationData:e6(),routes:e,mapRouteProperties:B3,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function e6(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Xn({},t,{errors:t6(t.errors)})),t}function t6(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,o]of t)if(o&&o.__type==="RouteErrorResponse")r[n]=new Zi(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let a=window[o.__subType];if(typeof a=="function")try{let s=new a(o.message);s.stack="",r[n]=s}catch{}}if(r[n]==null){let a=new Error(o.message);a.stack="",r[n]=a}}else r[n]=o;return r}const od=I.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(od.displayName="ViewTransition");const C0=I.createContext(new Map);process.env.NODE_ENV!=="production"&&(C0.displayName="Fetchers");const r6="startTransition",K1=I[r6],n6="flushSync",X1=E5[n6];function o6(e){K1?K1(e):e()}function Za(e){X1?X1(e):e()}class a6{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function s6(e){let{fallbackElement:t,router:r,future:n}=e,[o,a]=I.useState(r.state),[s,c]=I.useState(),[u,d]=I.useState({isTransitioning:!1}),[f,h]=I.useState(),[p,v]=I.useState(),[m,g]=I.useState(),b=I.useRef(new Map),{v7_startTransition:y}=n||{},C=I.useCallback(E=>{y?o6(E):E()},[y]),_=I.useCallback((E,A)=>{let{deletedFetchers:R,unstable_flushSync:D,unstable_viewTransitionOpts:M}=A;R.forEach(V=>b.current.delete(V)),E.fetchers.forEach((V,Q)=>{V.data!==void 0&&b.current.set(Q,V.data)});let q=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!M||q){D?Za(()=>a(E)):C(()=>a(E));return}if(D){Za(()=>{p&&(f&&f.resolve(),p.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:M.currentLocation,nextLocation:M.nextLocation})});let V=r.window.document.startViewTransition(()=>{Za(()=>a(E))});V.finished.finally(()=>{Za(()=>{h(void 0),v(void 0),c(void 0),d({isTransitioning:!1})})}),Za(()=>v(V));return}p?(f&&f.resolve(),p.skipTransition(),g({state:E,currentLocation:M.currentLocation,nextLocation:M.nextLocation})):(c(E),d({isTransitioning:!0,flushSync:!1,currentLocation:M.currentLocation,nextLocation:M.nextLocation}))},[r.window,p,f,b,C]);I.useLayoutEffect(()=>r.subscribe(_),[r,_]),I.useEffect(()=>{u.isTransitioning&&!u.flushSync&&h(new a6)},[u]),I.useEffect(()=>{if(f&&s&&r.window){let E=s,A=f.promise,R=r.window.document.startViewTransition(async()=>{C(()=>a(E)),await A});R.finished.finally(()=>{h(void 0),v(void 0),c(void 0),d({isTransitioning:!1})}),v(R)}},[C,s,f,r.window]),I.useEffect(()=>{f&&s&&o.location.key===s.location.key&&f.resolve()},[f,p,o.location,s]),I.useEffect(()=>{!u.isTransitioning&&m&&(c(m.state),d({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),g(void 0))},[u.isTransitioning,m]),I.useEffect(()=>{process.env.NODE_ENV!=="production"&&Bt(t==null||!r.future.v7_partialHydration,"`<RouterProvider fallbackElement>` is deprecated when using `v7_partialHydration`, use a `HydrateFallback` component instead")},[]);let w=I.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:E=>r.navigate(E),push:(E,A,R)=>r.navigate(E,{state:A,preventScrollReset:R==null?void 0:R.preventScrollReset}),replace:(E,A,R)=>r.navigate(E,{replace:!0,state:A,preventScrollReset:R==null?void 0:R.preventScrollReset})}),[r]),S=r.basename||"/",k=I.useMemo(()=>({router:r,navigator:w,static:!1,basename:S}),[r,w,S]),T=I.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return I.createElement(I.Fragment,null,I.createElement(ba.Provider,{value:k},I.createElement(Nl.Provider,{value:o},I.createElement(C0.Provider,{value:b.current},I.createElement(od.Provider,{value:u},I.createElement(F3,{basename:S,location:o.location,navigationType:o.historyAction,navigator:w,future:T},o.initialized||r.future.v7_partialHydration?I.createElement(i6,{routes:r.routes,future:r.future,state:o}):t))))),null)}const i6=I.memo(l6);function l6(e){let{routes:t,future:r,state:n}=e;return _3(t,void 0,n,r)}process.env.NODE_ENV;const c6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",u6=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,w0=I.forwardRef(function(t,r){let{onClick:n,relative:o,reloadDocument:a,replace:s,state:c,target:u,to:d,preventScrollReset:f,unstable_viewTransition:h}=t,p=nd(t,Y3),{basename:v}=I.useContext(Kr),m,g=!1;if(typeof d=="string"&&u6.test(d)&&(m=d,c6))try{let _=new URL(window.location.href),w=d.startsWith("//")?new URL(_.protocol+d):new URL(d),S=Zr(w.pathname,v);w.origin===_.origin&&S!=null?d=S+w.search+w.hash:g=!0}catch{process.env.NODE_ENV!=="production"&&Bt(!1,'<Link to="'+d+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let b=E3(d,{relative:o}),y=h6(d,{replace:s,state:c,target:u,preventScrollReset:f,relative:o,unstable_viewTransition:h});function C(_){n&&n(_),_.defaultPrevented||y(_)}return I.createElement("a",Xn({},p,{href:m||b,onClick:g||a?n:C,ref:r,target:u}))});process.env.NODE_ENV!=="production"&&(w0.displayName="Link");const S0=I.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:o=!1,className:a="",end:s=!1,style:c,to:u,unstable_viewTransition:d,children:f}=t,h=nd(t,K3),p=Us(u,{relative:h.relative}),v=uo(),m=I.useContext(Nl),{navigator:g,basename:b}=I.useContext(Kr),y=m!=null&&b6(p)&&d===!0,C=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,_=v.pathname,w=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;o||(_=_.toLowerCase(),w=w?w.toLowerCase():null,C=C.toLowerCase()),w&&b&&(w=Zr(w,b)||w);const S=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let k=_===C||!s&&_.startsWith(C)&&_.charAt(S)==="/",T=w!=null&&(w===C||!s&&w.startsWith(C)&&w.charAt(C.length)==="/"),E={isActive:k,isPending:T,isTransitioning:y},A=k?n:void 0,R;typeof a=="function"?R=a(E):R=[a,k?"active":null,T?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let D=typeof c=="function"?c(E):c;return I.createElement(w0,Xn({},h,{"aria-current":A,className:R,ref:r,style:D,to:u,unstable_viewTransition:d}),typeof f=="function"?f(E):f)});process.env.NODE_ENV!=="production"&&(S0.displayName="NavLink");const d6=I.forwardRef((e,t)=>{let{fetcherKey:r,navigate:n,reloadDocument:o,replace:a,state:s,method:c=Oi,action:u,onSubmit:d,relative:f,preventScrollReset:h,unstable_viewTransition:p}=e,v=nd(e,X3),m=v6(),g=x6(u,{relative:f}),b=c.toLowerCase()==="get"?"get":"post",y=C=>{if(d&&d(C),C.defaultPrevented)return;C.preventDefault();let _=C.nativeEvent.submitter,w=(_==null?void 0:_.getAttribute("formmethod"))||c;m(_||C.currentTarget,{fetcherKey:r,method:w,navigate:n,replace:a,state:s,relative:f,preventScrollReset:h,unstable_viewTransition:p})};return I.createElement("form",Xn({ref:t,method:b,action:g,onSubmit:o?d:y},v))});process.env.NODE_ENV!=="production"&&(d6.displayName="Form");process.env.NODE_ENV;var Gi;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Gi||(Gi={}));var J1;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(J1||(J1={}));function f6(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function E0(e){let t=I.useContext(ba);return t||(process.env.NODE_ENV!=="production"?Ee(!1,f6(e)):Ee(!1)),t}function h6(e,t){let{target:r,replace:n,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:c}=t===void 0?{}:t,u=Hr(),d=uo(),f=Us(e,{relative:s});return I.useCallback(h=>{if(W3(h,r)){h.preventDefault();let p=n!==void 0?n:Kn(d)===Kn(f);u(e,{replace:p,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:c})}},[d,u,f,n,o,r,e,a,s,c])}function j0(e){process.env.NODE_ENV!=="production"&&Bt(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=I.useRef(Xc(e)),r=I.useRef(!1),n=uo(),o=I.useMemo(()=>z3(n.search,r.current?null:t.current),[n.search]),a=Hr(),s=I.useCallback((c,u)=>{const d=Xc(typeof c=="function"?c(o):c);r.current=!0,a("?"+d,u)},[a,o]);return[o,s]}function p6(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let m6=0,g6=()=>"__"+String(++m6)+"__";function v6(){let{router:e}=E0(Gi.UseSubmit),{basename:t}=I.useContext(Kr),r=O3();return I.useCallback(function(n,o){o===void 0&&(o={}),p6();let{action:a,method:s,encType:c,formData:u,body:d}=G3(n,t);if(o.navigate===!1){let f=o.fetcherKey||g6();e.fetch(f,r,o.action||a,{preventScrollReset:o.preventScrollReset,formData:u,body:d,formMethod:o.method||s,formEncType:o.encType||c,unstable_flushSync:o.unstable_flushSync})}else e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:u,body:d,formMethod:o.method||s,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:r,unstable_flushSync:o.unstable_flushSync,unstable_viewTransition:o.unstable_viewTransition})},[e,t,r])}function x6(e,t){let{relative:r}=t===void 0?{}:t,{basename:n}=I.useContext(Kr),o=I.useContext(gn);o||(process.env.NODE_ENV!=="production"?Ee(!1,"useFormAction must be used inside a RouteContext"):Ee(!1));let[a]=o.matches.slice(-1),s=Xn({},Us(e||".",{relative:r})),c=uo();if(e==null){s.search=c.search;let u=new URLSearchParams(s.search);u.has("index")&&u.get("index")===""&&(u.delete("index"),s.search=u.toString()?"?"+u.toString():"")}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:sn([n,s.pathname])),Kn(s)}function b6(e,t){t===void 0&&(t={});let r=I.useContext(od);r==null&&(process.env.NODE_ENV!=="production"?Ee(!1,"`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):Ee(!1));let{basename:n}=E0(Gi.useViewTransitionState),o=Us(e,{relative:t.relative});if(!r.isTransitioning)return!1;let a=Zr(r.currentLocation.pathname,n)||r.currentLocation.pathname,s=Zr(r.nextLocation.pathname,n)||r.nextLocation.pathname;return zi(o.pathname,s)!=null||zi(o.pathname,a)!=null}const Q1=e=>{let t;const r=new Set,n=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),r.forEach(v=>v(t,p))}},o=()=>t,c={setState:n,getState:o,getInitialState:()=>u,subscribe:d=>(r.add(d),()=>r.delete(d))},u=t=e(n,o,c);return c},y6=e=>e?Q1(e):Q1,C6=e=>e;function w6(e,t=C6){const r=x.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return x.useDebugValue(r),r}const ef=e=>{const t=y6(e),r=n=>w6(t,n);return Object.assign(r,t),r},Ht=e=>e?ef(e):ef,S6=Ht(e=>({blocks:null,setBlocks:t=>e(()=>({blocks:t})),activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t})),sourceBlocks:{},setSourceBlocks:t=>e(()=>({sourceBlocks:t})),currentInstance:null,setCurrentInstance:t=>e(()=>({currentInstance:t}))})),E6=Ht(e=>({currentDevice:{icon:"Desktop",value:"desktop"},setCurrentDevice:t=>e(()=>({currentDevice:t}))}));Ht(e=>({pageData:null,setPageData:t=>e(()=>({pageData:t}))}));const _0=[{icon:"TreeStructure",name:"Layers"},{icon:"Plus",name:"Add"},{icon:"Palette",name:"Theme"},{icon:"Gear",name:"Settings"}],ya="https://g-api.billgang.com",j6="https://www.googleapis.com/webfonts/v1/webfonts",T0="https://stores-api.billgang.com",_6=Array.from({length:122/2+1},(e,t)=>String(6+t*2)),T6=["100","200","300","400","500","600","700","800","900"],P6=Ht(e=>({activeBlock:_0[0],setActiveBlock:t=>e(()=>({activeBlock:t}))}));function N6(e,t){let r;try{r=e()}catch{return}return{getItem:o=>{var a;const s=u=>u===null?null:JSON.parse(u,void 0),c=(a=r.getItem(o))!=null?a:null;return c instanceof Promise?c.then(s):s(c)},setItem:(o,a)=>r.setItem(o,JSON.stringify(a,void 0)),removeItem:o=>r.removeItem(o)}}const Jc=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return Jc(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Jc(n)(r)}}}},R6=(e,t)=>(r,n,o)=>{let a={storage:N6(()=>localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...t},s=!1;const c=new Set,u=new Set;let d=a.storage;if(!d)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...g)},n,o);const f=()=>{const g=a.partialize({...n()});return d.setItem(a.name,{state:g,version:a.version})},h=o.setState;o.setState=(g,b)=>{h(g,b),f()};const p=e((...g)=>{r(...g),f()},n,o);o.getInitialState=()=>p;let v;const m=()=>{var g,b;if(!d)return;s=!1,c.forEach(C=>{var _;return C((_=n())!=null?_:p)});const y=((b=a.onRehydrateStorage)==null?void 0:b.call(a,(g=n())!=null?g:p))||void 0;return Jc(d.getItem.bind(d))(a.name).then(C=>{if(C)if(typeof C.version=="number"&&C.version!==a.version){if(a.migrate)return[!0,a.migrate(C.state,C.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,C.state];return[!1,void 0]}).then(C=>{var _;const[w,S]=C;if(v=a.merge(S,(_=n())!=null?_:p),r(v,!0),w)return f()}).then(()=>{y==null||y(v,void 0),v=n(),s=!0,u.forEach(C=>C(v))}).catch(C=>{y==null||y(void 0,C)})};return o.persist={setOptions:g=>{a={...a,...g},g.storage&&(d=g.storage)},clearStorage:()=>{d==null||d.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:g=>(c.add(g),()=>{c.delete(g)}),onFinishHydration:g=>(u.add(g),()=>{u.delete(g)})},a.skipHydration||m(),v||p},Al=R6,k6=Ht(Al(e=>({onPreview:!0,setOnPreview:t=>e(()=>({onPreview:t})),activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t}))}),{name:"preview-storage",partialize:e=>{const{onPreview:t}=e;return{onPreview:t}}}));var qt=[];for(var fc=0;fc<256;++fc)qt.push((fc+256).toString(16).slice(1));function A6(e,t=0){return(qt[e[t+0]]+qt[e[t+1]]+qt[e[t+2]]+qt[e[t+3]]+"-"+qt[e[t+4]]+qt[e[t+5]]+"-"+qt[e[t+6]]+qt[e[t+7]]+"-"+qt[e[t+8]]+qt[e[t+9]]+"-"+qt[e[t+10]]+qt[e[t+11]]+qt[e[t+12]]+qt[e[t+13]]+qt[e[t+14]]+qt[e[t+15]]).toLowerCase()}var pi,L6=new Uint8Array(16);function D6(){if(!pi&&(pi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pi(L6)}var O6=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const tf={randomUUID:O6};function Yi(e,t,r){if(tf.randomUUID&&!t&&!e)return tf.randomUUID();e=e||{};var n=e.random||(e.rng||D6)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,A6(n)}const ns=Ht(Al((e,t)=>({header:null,blocks:{},footer:null,currentBlock:null,positionBlock:null,setBlocks:r=>{e({blocks:r})},setHeader:r=>{e({header:r})},setFooter:r=>{e({footer:r})},createPage:r=>{const n=t().blocks;n[r]={data:{},order:[]},e({blocks:n})},deletePage:r=>{const n=t().blocks;delete n[r],e({blocks:n})},updatePage:(r,n)=>{const o=t().blocks;if(o[n])return;const a=o[r];delete o[r],o[n]=a,e({blocks:o})},setCurrentBlock:r=>{e({currentBlock:r})},setPositionBlock:(r,n=!1)=>{const{blocks:o}=t(),{currentPage:a,pages:s}=P0.getState();if(!a||!s||!s[a]||!o[s[a].path]){console.error("Cannot set position: invalid page or block data");return}const c=s[a].path,u=o[c],d=r?u.order.indexOf(r):-1;if(d===-1&&r){console.error(`Block with ID "${r}" not found in page "${c}"`);return}const f=d!==-1?d+(n?1:0):u.order.length;e({positionBlock:f})},addBlock:(r,n)=>{const o=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));ra.getState().addHistory(o);const a={...t().blocks},s=a[r]||{data:{},order:[]},c=t().positionBlock,u=Yi(),d={name:n.name,value:n.value};s.data[u]=d,c===null||c>=s.order.length?s.order.push(u):s.order.splice(c,0,u),e({blocks:{...a,[r]:{data:s.data,order:s.order}}})},editBlock:(r,n,o)=>{const a=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));ra.getState().addHistory(a);const s=t().blocks,c=s[r]||{};c.data[n]={name:o.name,value:{...o.value}},e({blocks:{...s,[r]:c}})},removeBlock:(r,n)=>{const o=structuredClone(t().blocks);ra.getState().addHistory(o);const a=structuredClone(t().blocks),s=a[r];if(!s){console.error(`Page at path "${r}" does not exist.`);return}delete s.data[n],s.order=s.order.filter(c=>c!==n),e({blocks:{...a,[r]:s}})},moveBlock:(r,n,o)=>e(a=>{const s=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));if(ra.getState().addHistory(s),!a.blocks[r])return console.error(`Path ${r} does not exist in blocks`),a;const c={...a.blocks[r]},u=[...c.order];if(n<0||o<0||n>=u.length||o>=u.length)return console.error(`Invalid indices: fromIndex=${n}, toIndex=${o}`),a;const[d]=u.splice(n,1);return u.splice(o,0,d),{blocks:{...a.blocks,[r]:{...c,order:u}}}}),duplicateBlock:(r,n)=>{const o=structuredClone(t().blocks);ra.getState().addHistory(o);const a=structuredClone(t().blocks),s=a[r];if(!s||!s.data[n]){console.error(`Block with ID "${n}" not found in page "${r}"`);return}const c=Yi(),u=s.data[n],d={name:u.name,value:{...u.value}};s.data[c]=d;const f=s.order.indexOf(n);if(f===-1){console.error(`Block ID "${n}" not found in order array`);return}s.order.splice(f+1,0,c),e({blocks:{...a,[r]:s}})}}),{name:"layers-storage",partialize:e=>{const{blocks:t,header:r,footer:n}=e;return{blocks:t,header:r,footer:n}}})),M6=Ht((e,t)=>({isModalVisible:!1,hoverBlockId:null,isMouseOverModal:!1,hideTimeout:null,setHoverBlockId:r=>{e({hoverBlockId:r})},showModal:(r,n="hoverBlockId")=>{t().hideTimeout&&clearTimeout(t().hideTimeout),e({isModalVisible:!0,[n]:r})},hideModal:(r="hoverBlockId")=>{e({isModalVisible:!1,[r]:null})},startHideTimeout:()=>{if(!t().isMouseOverModal){const r=setTimeout(()=>{e({isModalVisible:!1,hoverBlockId:null,keyBlock:null})},500);e({hideTimeout:r})}},clearHideTimeout:()=>{t().hideTimeout&&(clearTimeout(t().hideTimeout),e({hideTimeout:null}))},setMouseOverModal:r=>{e({isMouseOverModal:r})},isPreviewVisible:!1,showPreview:(r,n="hoverBlockId")=>{e({isPreviewVisible:!0,[n]:r})},hidePreview:(r="hoverBlockId")=>{e({isPreviewVisible:!1,[r]:null})},keyBlock:null,setKeyBlock:r=>{e({keyBlock:r})}})),I6=Ht(e=>({activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t})),activeFont:null,setActiveFont:t=>e(()=>({activeFont:t})),setThemeSettings:t=>e(()=>({themeSettings:t})),themeSettings:{colors:{text:{primary:"#252525",secondary:"#757575",tertiary:"#C2C2C2",inverted:"#FFFFFF",action:"#FF3F19",actionHover:"#DA2400",disabled:"#C2C2C2",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",link:"#3683F7"},icon:{primary:"#252525",secondary:"#555555",tertiary:"#C2C2C2",inverted:"#FFFFFF",action:"#FF3F19",actionHover:"#DA2400",disabled:"#C2C2C2",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",link:"#3683F7"},border:{primary:"#C2C2C2",secondary:"#E6E6E6",action:"#FF3F19",actionHover:"#DA2400",disabled:"#E6E6E6",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",focus:"#FF3F19"},surface:{primary:"#FFFFFF",secondary:"#F8F8F8",action1:"#FF3F19",action1Hover:"#DA2400",action2:"#FFFFFF",action2Hover:"#F8F8F8",disabled:"#C2C2C2",warning:"#FAF4E6",error:"#FAE6E6",success:"#E5FADD",information:"#E9F1FE",modal:"rgba(1, 1, 4, 0.4)"}},fonts:{heading:{h1:{font:"Archivo",weight:"900",size:48},h2:{font:"Archivo",weight:"700",size:32},h3:{font:"Archivo",weight:"600",size:24},h4:{font:"Archivo",weight:"500",size:16},h5:{font:"Archivo",weight:"400",size:16},h6:{font:"Archivo",weight:"400",size:16}},paragraph:{text:{font:"Archivo",size:48,weight:"400"}}},borders:{radius:52,thickness:52},buttons:{primary:{size:26,alignment:"left",radius:32,height:40,background:"#ff3f19",hover:!0,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}},secondary:{size:26,alignment:"left",radius:10,height:20,background:"#c2c2c2",hover:!1,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}},tertiary:{size:12,alignment:"left",radius:30,height:30,background:"#c2c2c2",hover:!0,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}}},inputs:{general:{height:48,name:"Style Name",size:48,color:"black"},field:{active:!0,color:"black",opacity:40},border:{active:!0,style:"solid",radius:0,thickness:0,color:"black"},label:{height:48,size:48,color:"black",alignment:"left"}}},updateColor:(t,r,n)=>e(o=>{const a={...o.themeSettings.colors,[t]:{...o.themeSettings.colors[t],[r]:n}};return{themeSettings:{...o.themeSettings,colors:a}}}),updateFont:(t,r,n,o)=>e(a=>{const s={...a.themeSettings.fonts,[t]:{...a.themeSettings.fonts[t],[r]:{...a.themeSettings.fonts[t][r],[n]:o}}};return{themeSettings:{...a.themeSettings,fonts:s}}}),updateBorder:(t,r)=>e(n=>{const o={...n.themeSettings.borders,[t]:r};return{themeSettings:{...n.themeSettings,borders:o}}}),updateButton:(t,r,n)=>e(o=>{const a={...o.themeSettings.buttons[t],[r]:n},s={...o.themeSettings.buttons,[t]:a};return{themeSettings:{...o.themeSettings,buttons:s}}}),updateInput:(t,r,n)=>e(o=>({themeSettings:{...o.themeSettings,inputs:{...o.themeSettings.inputs,[t]:{...o.themeSettings.inputs[t],[n]:r}}}}))})),F6=Ht(Al(e=>({fonts:[],setFonts:t=>e(()=>({fonts:t}))}),{name:"fonts-storage"})),B6=Ht(e=>({settings:null,setSettings:t=>e(()=>({settings:t}))})),H6=Ht()(e=>({color:"default",initialColor:"",setInitialColor:t=>e(()=>({initialColor:t})),colorChange:()=>{},update:()=>{},activeLabel:null,modalPosition:{left:0,top:0},showModal:!1,dragging:!1,hue:0,saturation:100,brightness:100,alpha:100,isGradientActive:!0,isGradient:!1,setIsGradient:t=>e(()=>({isGradient:t})),gradientDirection:"vertical",setGradientDirection:t=>e(()=>({gradientDirection:t})),hue2:0,saturation2:100,brightness2:100,alpha2:100,setHue2:t=>e(()=>({hue2:t})),setSaturation2:t=>e(()=>({saturation2:t})),setBrightness2:t=>e(()=>({brightness2:t})),setAlpha2:t=>e(()=>({alpha2:t})),activeColorIndex:1,setActiveColorIndex:t=>e(()=>({activeColorIndex:t})),setModalPosition:t=>e(()=>({modalPosition:t})),setHue:t=>e(()=>({hue:t})),setSaturation:t=>e(()=>({saturation:t})),setBrightness:t=>e(()=>({brightness:t})),setShowModal:t=>e(()=>({showModal:t})),setDragging:t=>e(()=>({dragging:t})),setActiveLabel:t=>e(()=>({activeLabel:t})),setColor:t=>e(()=>({color:t})),setUpdate:t=>e(()=>({update:t})),setColorChange:t=>e(()=>({colorChange:t})),setAlpha:t=>e(()=>({alpha:t})),setIsGradientActive:t=>e(()=>({isGradientActive:t})),resetColors:()=>e(()=>({color:"default",initialColor:"",activeLabel:null,modalPosition:{left:0,top:0},showModal:!1,dragging:!1,hue:0,saturation:100,brightness:100,alpha:100,isGradient:!1,gradientDirection:"vertical",hue2:0,saturation2:100,brightness2:100,alpha2:100,activeColorIndex:1,isGradientActive:!0}))})),P0=Ht(Al((e,t)=>({pages:null,currentPage:"/",setPages:r=>e(()=>({pages:r})),pageContext:{listings:null,products:null,reviews:null,categories:null,faqs:null,general:null},isOpenModal:!1,isOpenSelectModal:!1,isEdit:!1,editedPage:null,setEditedPage:r=>e(()=>({editedPage:r})),setCurrentPage:r=>e(()=>({currentPage:r})),setPageContext:r=>e(()=>({pageContext:r})),setIsOpenModal:r=>e(()=>({isOpenModal:r})),setIsOpenSelectModal:r=>e(()=>({isOpenSelectModal:r})),setIsEdit:r=>e(()=>({isEdit:r})),createPage:r=>{const n=t().pages,o=Yi();if(n)n[o]=r,e({pages:n});else{const a=t().setPages;a({});const s=t().pages;s[o]=r,e({pages:s})}},updatePage:(r,n)=>{const o=t().pages;o&&(o[r]={...n},e({pages:o}))},deletePage:r=>{const n=t().pages;n&&(delete n[r],e({pages:n}))}}),{name:"pages-storage",partialize:e=>{const{pages:t,pageContext:r}=e;return{pages:t,pageContext:r}}})),ad=Ht(e=>({openModal:!1,setOpenModal:t=>e(()=>({openModal:t})),onChange:null,setOnChange:t=>e(()=>({onChange:t}))})),ra=Ht((e,t)=>({past:[],future:[],addHistory:r=>{const{past:n}=t();e({past:[...n,r],future:[]})},undo:()=>{const{past:r,future:n}=t();if(r.length===0)return;const o=r[r.length-1],a=r.slice(0,-1);e({past:a,future:[ns.getState().blocks,...n]}),ns.getState().setBlocks(o)},redo:()=>{const{past:r,future:n}=t();if(n.length===0)return;const o=n[0],a=n.slice(1);e({past:[...r,ns.getState().blocks],future:a}),ns.getState().setBlocks(o)}})),V6=Ht(e=>({isOpenModal:!1,setIsOpenModal:t=>e(()=>({isOpenModal:t}))})),$6=Ht(e=>({notification:null,setNotification:t=>e(()=>({notification:t}))})),U6=Ht(e=>({error:null,setError:t=>e(()=>({error:t}))})),W6=Ht(e=>({title:null,description:null,onConfirm:null,setTitle:t=>e(()=>({title:t})),setDescription:t=>e(()=>({description:t})),setOnConfirm:t=>e(()=>({onConfirm:t}))})),z6=Ht(e=>({showTooltip:!1,setShowTooltip:t=>e({showTooltip:t})}));var N0={exports:{}};/*!
|
|
61
|
+
*/function Xn(){return Xn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xn.apply(this,arguments)}function nd(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}const Oi="get",Mi="application/x-www-form-urlencoded";function kl(e){return e!=null&&typeof e.tagName=="string"}function H3(e){return kl(e)&&e.tagName.toLowerCase()==="button"}function V3(e){return kl(e)&&e.tagName.toLowerCase()==="form"}function $3(e){return kl(e)&&e.tagName.toLowerCase()==="input"}function U3(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function W3(e,t){return e.button===0&&(!t||t==="_self")&&!U3(e)}function Xc(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}function z3(e,t){let r=Xc(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(a=>{r.append(o,a)})}),r}let hi=null;function Z3(){if(hi===null)try{new FormData(document.createElement("form"),0),hi=!1}catch{hi=!0}return hi}const q3=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function dc(e){return e!=null&&!q3.has(e)?(process.env.NODE_ENV!=="production"&&Bt(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+Mi+'"')),null):e}function G3(e,t){let r,n,o,a,s;if(V3(e)){let c=e.getAttribute("action");n=c?Zr(c,t):null,r=e.getAttribute("method")||Oi,o=dc(e.getAttribute("enctype"))||Mi,a=new FormData(e)}else if(H3(e)||$3(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||c.getAttribute("action");if(n=u?Zr(u,t):null,r=e.getAttribute("formmethod")||c.getAttribute("method")||Oi,o=dc(e.getAttribute("formenctype"))||dc(c.getAttribute("enctype"))||Mi,a=new FormData(c,e),!Z3()){let{name:d,type:f,value:h}=e;if(f==="image"){let p=d?d+".":"";a.append(p+"x","0"),a.append(p+"y","0")}else d&&a.append(d,h)}}else{if(kl(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Oi,n=null,o=Mi,s=e}return a&&o==="text/plain"&&(s=a,a=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:a,body:s}}const Y3=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],K3=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],X3=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"],J3="6";try{window.__reactRouterVersion=J3}catch{}function Q3(e,t){return n3({basename:void 0,future:Xn({},void 0,{v7_prependBasename:!0}),history:T5({window:void 0}),hydrationData:e6(),routes:e,mapRouteProperties:B3,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function e6(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Xn({},t,{errors:t6(t.errors)})),t}function t6(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,o]of t)if(o&&o.__type==="RouteErrorResponse")r[n]=new Zi(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let a=window[o.__subType];if(typeof a=="function")try{let s=new a(o.message);s.stack="",r[n]=s}catch{}}if(r[n]==null){let a=new Error(o.message);a.stack="",r[n]=a}}else r[n]=o;return r}const od=I.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(od.displayName="ViewTransition");const C0=I.createContext(new Map);process.env.NODE_ENV!=="production"&&(C0.displayName="Fetchers");const r6="startTransition",K1=I[r6],n6="flushSync",X1=E5[n6];function o6(e){K1?K1(e):e()}function Za(e){X1?X1(e):e()}class a6{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function s6(e){let{fallbackElement:t,router:r,future:n}=e,[o,a]=I.useState(r.state),[s,c]=I.useState(),[u,d]=I.useState({isTransitioning:!1}),[f,h]=I.useState(),[p,v]=I.useState(),[m,g]=I.useState(),b=I.useRef(new Map),{v7_startTransition:y}=n||{},C=I.useCallback(E=>{y?o6(E):E()},[y]),_=I.useCallback((E,A)=>{let{deletedFetchers:R,unstable_flushSync:D,unstable_viewTransitionOpts:M}=A;R.forEach(V=>b.current.delete(V)),E.fetchers.forEach((V,Q)=>{V.data!==void 0&&b.current.set(Q,V.data)});let q=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!M||q){D?Za(()=>a(E)):C(()=>a(E));return}if(D){Za(()=>{p&&(f&&f.resolve(),p.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:M.currentLocation,nextLocation:M.nextLocation})});let V=r.window.document.startViewTransition(()=>{Za(()=>a(E))});V.finished.finally(()=>{Za(()=>{h(void 0),v(void 0),c(void 0),d({isTransitioning:!1})})}),Za(()=>v(V));return}p?(f&&f.resolve(),p.skipTransition(),g({state:E,currentLocation:M.currentLocation,nextLocation:M.nextLocation})):(c(E),d({isTransitioning:!0,flushSync:!1,currentLocation:M.currentLocation,nextLocation:M.nextLocation}))},[r.window,p,f,b,C]);I.useLayoutEffect(()=>r.subscribe(_),[r,_]),I.useEffect(()=>{u.isTransitioning&&!u.flushSync&&h(new a6)},[u]),I.useEffect(()=>{if(f&&s&&r.window){let E=s,A=f.promise,R=r.window.document.startViewTransition(async()=>{C(()=>a(E)),await A});R.finished.finally(()=>{h(void 0),v(void 0),c(void 0),d({isTransitioning:!1})}),v(R)}},[C,s,f,r.window]),I.useEffect(()=>{f&&s&&o.location.key===s.location.key&&f.resolve()},[f,p,o.location,s]),I.useEffect(()=>{!u.isTransitioning&&m&&(c(m.state),d({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),g(void 0))},[u.isTransitioning,m]),I.useEffect(()=>{process.env.NODE_ENV!=="production"&&Bt(t==null||!r.future.v7_partialHydration,"`<RouterProvider fallbackElement>` is deprecated when using `v7_partialHydration`, use a `HydrateFallback` component instead")},[]);let w=I.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:E=>r.navigate(E),push:(E,A,R)=>r.navigate(E,{state:A,preventScrollReset:R==null?void 0:R.preventScrollReset}),replace:(E,A,R)=>r.navigate(E,{replace:!0,state:A,preventScrollReset:R==null?void 0:R.preventScrollReset})}),[r]),S=r.basename||"/",k=I.useMemo(()=>({router:r,navigator:w,static:!1,basename:S}),[r,w,S]),T=I.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return I.createElement(I.Fragment,null,I.createElement(ba.Provider,{value:k},I.createElement(Nl.Provider,{value:o},I.createElement(C0.Provider,{value:b.current},I.createElement(od.Provider,{value:u},I.createElement(F3,{basename:S,location:o.location,navigationType:o.historyAction,navigator:w,future:T},o.initialized||r.future.v7_partialHydration?I.createElement(i6,{routes:r.routes,future:r.future,state:o}):t))))),null)}const i6=I.memo(l6);function l6(e){let{routes:t,future:r,state:n}=e;return _3(t,void 0,n,r)}process.env.NODE_ENV;const c6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",u6=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,w0=I.forwardRef(function(t,r){let{onClick:n,relative:o,reloadDocument:a,replace:s,state:c,target:u,to:d,preventScrollReset:f,unstable_viewTransition:h}=t,p=nd(t,Y3),{basename:v}=I.useContext(Kr),m,g=!1;if(typeof d=="string"&&u6.test(d)&&(m=d,c6))try{let _=new URL(window.location.href),w=d.startsWith("//")?new URL(_.protocol+d):new URL(d),S=Zr(w.pathname,v);w.origin===_.origin&&S!=null?d=S+w.search+w.hash:g=!0}catch{process.env.NODE_ENV!=="production"&&Bt(!1,'<Link to="'+d+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let b=E3(d,{relative:o}),y=h6(d,{replace:s,state:c,target:u,preventScrollReset:f,relative:o,unstable_viewTransition:h});function C(_){n&&n(_),_.defaultPrevented||y(_)}return I.createElement("a",Xn({},p,{href:m||b,onClick:g||a?n:C,ref:r,target:u}))});process.env.NODE_ENV!=="production"&&(w0.displayName="Link");const S0=I.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:o=!1,className:a="",end:s=!1,style:c,to:u,unstable_viewTransition:d,children:f}=t,h=nd(t,K3),p=Us(u,{relative:h.relative}),v=uo(),m=I.useContext(Nl),{navigator:g,basename:b}=I.useContext(Kr),y=m!=null&&b6(p)&&d===!0,C=g.encodeLocation?g.encodeLocation(p).pathname:p.pathname,_=v.pathname,w=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;o||(_=_.toLowerCase(),w=w?w.toLowerCase():null,C=C.toLowerCase()),w&&b&&(w=Zr(w,b)||w);const S=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let k=_===C||!s&&_.startsWith(C)&&_.charAt(S)==="/",T=w!=null&&(w===C||!s&&w.startsWith(C)&&w.charAt(C.length)==="/"),E={isActive:k,isPending:T,isTransitioning:y},A=k?n:void 0,R;typeof a=="function"?R=a(E):R=[a,k?"active":null,T?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let D=typeof c=="function"?c(E):c;return I.createElement(w0,Xn({},h,{"aria-current":A,className:R,ref:r,style:D,to:u,unstable_viewTransition:d}),typeof f=="function"?f(E):f)});process.env.NODE_ENV!=="production"&&(S0.displayName="NavLink");const d6=I.forwardRef((e,t)=>{let{fetcherKey:r,navigate:n,reloadDocument:o,replace:a,state:s,method:c=Oi,action:u,onSubmit:d,relative:f,preventScrollReset:h,unstable_viewTransition:p}=e,v=nd(e,X3),m=v6(),g=x6(u,{relative:f}),b=c.toLowerCase()==="get"?"get":"post",y=C=>{if(d&&d(C),C.defaultPrevented)return;C.preventDefault();let _=C.nativeEvent.submitter,w=(_==null?void 0:_.getAttribute("formmethod"))||c;m(_||C.currentTarget,{fetcherKey:r,method:w,navigate:n,replace:a,state:s,relative:f,preventScrollReset:h,unstable_viewTransition:p})};return I.createElement("form",Xn({ref:t,method:b,action:g,onSubmit:o?d:y},v))});process.env.NODE_ENV!=="production"&&(d6.displayName="Form");process.env.NODE_ENV;var Gi;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Gi||(Gi={}));var J1;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(J1||(J1={}));function f6(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function E0(e){let t=I.useContext(ba);return t||(process.env.NODE_ENV!=="production"?Ee(!1,f6(e)):Ee(!1)),t}function h6(e,t){let{target:r,replace:n,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:c}=t===void 0?{}:t,u=Hr(),d=uo(),f=Us(e,{relative:s});return I.useCallback(h=>{if(W3(h,r)){h.preventDefault();let p=n!==void 0?n:Kn(d)===Kn(f);u(e,{replace:p,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:c})}},[d,u,f,n,o,r,e,a,s,c])}function j0(e){process.env.NODE_ENV!=="production"&&Bt(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=I.useRef(Xc(e)),r=I.useRef(!1),n=uo(),o=I.useMemo(()=>z3(n.search,r.current?null:t.current),[n.search]),a=Hr(),s=I.useCallback((c,u)=>{const d=Xc(typeof c=="function"?c(o):c);r.current=!0,a("?"+d,u)},[a,o]);return[o,s]}function p6(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let m6=0,g6=()=>"__"+String(++m6)+"__";function v6(){let{router:e}=E0(Gi.UseSubmit),{basename:t}=I.useContext(Kr),r=O3();return I.useCallback(function(n,o){o===void 0&&(o={}),p6();let{action:a,method:s,encType:c,formData:u,body:d}=G3(n,t);if(o.navigate===!1){let f=o.fetcherKey||g6();e.fetch(f,r,o.action||a,{preventScrollReset:o.preventScrollReset,formData:u,body:d,formMethod:o.method||s,formEncType:o.encType||c,unstable_flushSync:o.unstable_flushSync})}else e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:u,body:d,formMethod:o.method||s,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:r,unstable_flushSync:o.unstable_flushSync,unstable_viewTransition:o.unstable_viewTransition})},[e,t,r])}function x6(e,t){let{relative:r}=t===void 0?{}:t,{basename:n}=I.useContext(Kr),o=I.useContext(gn);o||(process.env.NODE_ENV!=="production"?Ee(!1,"useFormAction must be used inside a RouteContext"):Ee(!1));let[a]=o.matches.slice(-1),s=Xn({},Us(e||".",{relative:r})),c=uo();if(e==null){s.search=c.search;let u=new URLSearchParams(s.search);u.has("index")&&u.get("index")===""&&(u.delete("index"),s.search=u.toString()?"?"+u.toString():"")}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:sn([n,s.pathname])),Kn(s)}function b6(e,t){t===void 0&&(t={});let r=I.useContext(od);r==null&&(process.env.NODE_ENV!=="production"?Ee(!1,"`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):Ee(!1));let{basename:n}=E0(Gi.useViewTransitionState),o=Us(e,{relative:t.relative});if(!r.isTransitioning)return!1;let a=Zr(r.currentLocation.pathname,n)||r.currentLocation.pathname,s=Zr(r.nextLocation.pathname,n)||r.nextLocation.pathname;return zi(o.pathname,s)!=null||zi(o.pathname,a)!=null}const Q1=e=>{let t;const r=new Set,n=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),r.forEach(v=>v(t,p))}},o=()=>t,c={setState:n,getState:o,getInitialState:()=>u,subscribe:d=>(r.add(d),()=>r.delete(d))},u=t=e(n,o,c);return c},y6=e=>e?Q1(e):Q1,C6=e=>e;function w6(e,t=C6){const r=x.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return x.useDebugValue(r),r}const ef=e=>{const t=y6(e),r=n=>w6(t,n);return Object.assign(r,t),r},Ht=e=>e?ef(e):ef,S6=Ht(e=>({blocks:null,setBlocks:t=>e(()=>({blocks:t})),activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t})),sourceBlocks:{},setSourceBlocks:t=>e(()=>({sourceBlocks:t})),currentInstance:null,setCurrentInstance:t=>e(()=>({currentInstance:t}))})),E6=Ht(e=>({currentDevice:{icon:"Desktop",value:"desktop"},setCurrentDevice:t=>e(()=>({currentDevice:t}))}));Ht(e=>({pageData:null,setPageData:t=>e(()=>({pageData:t}))}));const _0=[{icon:"TreeStructure",name:"Layers"},{icon:"Plus",name:"Add"},{icon:"Palette",name:"Theme"},{icon:"Gear",name:"Settings"}],ya="https://g-api.billgang.com",j6="https://www.googleapis.com/webfonts/v1/webfonts",T0="https://stores-api.billgang.com",_6=Array.from({length:122/2+1},(e,t)=>String(6+t*2)),T6=["100","200","300","400","500","600","700","800","900"],P6=Ht(e=>({activeBlock:_0[0],setActiveBlock:t=>e(()=>({activeBlock:t}))}));function N6(e,t){let r;try{r=e()}catch{return}return{getItem:o=>{var a;const s=u=>u===null?null:JSON.parse(u,void 0),c=(a=r.getItem(o))!=null?a:null;return c instanceof Promise?c.then(s):s(c)},setItem:(o,a)=>r.setItem(o,JSON.stringify(a,void 0)),removeItem:o=>r.removeItem(o)}}const Jc=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return Jc(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Jc(n)(r)}}}},R6=(e,t)=>(r,n,o)=>{let a={storage:N6(()=>localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...t},s=!1;const c=new Set,u=new Set;let d=a.storage;if(!d)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...g)},n,o);const f=()=>{const g=a.partialize({...n()});return d.setItem(a.name,{state:g,version:a.version})},h=o.setState;o.setState=(g,b)=>{h(g,b),f()};const p=e((...g)=>{r(...g),f()},n,o);o.getInitialState=()=>p;let v;const m=()=>{var g,b;if(!d)return;s=!1,c.forEach(C=>{var _;return C((_=n())!=null?_:p)});const y=((b=a.onRehydrateStorage)==null?void 0:b.call(a,(g=n())!=null?g:p))||void 0;return Jc(d.getItem.bind(d))(a.name).then(C=>{if(C)if(typeof C.version=="number"&&C.version!==a.version){if(a.migrate)return[!0,a.migrate(C.state,C.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,C.state];return[!1,void 0]}).then(C=>{var _;const[w,S]=C;if(v=a.merge(S,(_=n())!=null?_:p),r(v,!0),w)return f()}).then(()=>{y==null||y(v,void 0),v=n(),s=!0,u.forEach(C=>C(v))}).catch(C=>{y==null||y(void 0,C)})};return o.persist={setOptions:g=>{a={...a,...g},g.storage&&(d=g.storage)},clearStorage:()=>{d==null||d.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:g=>(c.add(g),()=>{c.delete(g)}),onFinishHydration:g=>(u.add(g),()=>{u.delete(g)})},a.skipHydration||m(),v||p},Al=R6,k6=Ht(Al(e=>({onPreview:!0,setOnPreview:t=>e(()=>({onPreview:t})),activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t}))}),{name:"preview-storage",partialize:e=>{const{onPreview:t}=e;return{onPreview:t}}}));var qt=[];for(var fc=0;fc<256;++fc)qt.push((fc+256).toString(16).slice(1));function A6(e,t=0){return(qt[e[t+0]]+qt[e[t+1]]+qt[e[t+2]]+qt[e[t+3]]+"-"+qt[e[t+4]]+qt[e[t+5]]+"-"+qt[e[t+6]]+qt[e[t+7]]+"-"+qt[e[t+8]]+qt[e[t+9]]+"-"+qt[e[t+10]]+qt[e[t+11]]+qt[e[t+12]]+qt[e[t+13]]+qt[e[t+14]]+qt[e[t+15]]).toLowerCase()}var pi,L6=new Uint8Array(16);function D6(){if(!pi&&(pi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pi(L6)}var O6=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const tf={randomUUID:O6};function Yi(e,t,r){if(tf.randomUUID&&!t&&!e)return tf.randomUUID();e=e||{};var n=e.random||(e.rng||D6)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,A6(n)}const ns=Ht(Al((e,t)=>({header:null,blocks:{},footer:null,currentBlock:null,positionBlock:null,setBlocks:r=>{e({blocks:r})},setHeader:r=>{e({header:r})},setFooter:r=>{e({footer:r})},createPage:r=>{const n=t().blocks;n[r]={data:{},order:[]},e({blocks:n})},deletePage:r=>{const n=t().blocks;delete n[r],e({blocks:n})},updatePage:(r,n)=>{const o=t().blocks;if(o[n])return;const a=o[r];delete o[r],o[n]=a,e({blocks:o})},setCurrentBlock:r=>{e({currentBlock:r})},setPositionBlock:(r,n=!1)=>{const{blocks:o}=t(),{currentPage:a,pages:s}=P0.getState();if(!a||!s||!s[a]||!o[s[a].path]){console.error("Cannot set position: invalid page or block data");return}const c=s[a].path,u=o[c],d=r?u.order.indexOf(r):-1;if(d===-1&&r){console.error(`Block with ID "${r}" not found in page "${c}"`);return}const f=d!==-1?d+(n?1:0):u.order.length;e({positionBlock:f})},addBlock:(r,n)=>{const o=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));ra.getState().addHistory(o);const a={...t().blocks},s=a[r]||{data:{},order:[]},c=t().positionBlock,u=Yi(),d={name:n.name,value:n.value};s.data[u]=d,c===null||c>=s.order.length?s.order.push(u):s.order.splice(c,0,u),e({blocks:{...a,[r]:{data:s.data,order:s.order}}})},editBlock:(r,n,o)=>{const a=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));ra.getState().addHistory(a);const s=t().blocks,c=s[r]||{};c.data[n]={name:o.name,value:{...o.value}},e({blocks:{...s,[r]:c}})},removeBlock:(r,n)=>{const o=structuredClone(t().blocks);ra.getState().addHistory(o);const a=structuredClone(t().blocks),s=a[r];if(!s){console.error(`Page at path "${r}" does not exist.`);return}delete s.data[n],s.order=s.order.filter(c=>c!==n),e({blocks:{...a,[r]:s}})},moveBlock:(r,n,o)=>e(a=>{const s=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));if(ra.getState().addHistory(s),!a.blocks[r])return console.error(`Path ${r} does not exist in blocks`),a;const c={...a.blocks[r]},u=[...c.order];if(n<0||o<0||n>=u.length||o>=u.length)return console.error(`Invalid indices: fromIndex=${n}, toIndex=${o}`),a;const[d]=u.splice(n,1);return u.splice(o,0,d),{blocks:{...a.blocks,[r]:{...c,order:u}}}}),duplicateBlock:(r,n)=>{const o=structuredClone(t().blocks);ra.getState().addHistory(o);const a=structuredClone(t().blocks),s=a[r];if(!s||!s.data[n]){console.error(`Block with ID "${n}" not found in page "${r}"`);return}const c=Yi(),u=s.data[n],d={name:u.name,value:{...u.value}};s.data[c]=d;const f=s.order.indexOf(n);if(f===-1){console.error(`Block ID "${n}" not found in order array`);return}s.order.splice(f+1,0,c),e({blocks:{...a,[r]:s}})}}),{name:"layers-storage",partialize:e=>{const{blocks:t,header:r,footer:n}=e;return{blocks:t,header:r,footer:n}}})),M6=Ht((e,t)=>({isModalVisible:!1,hoverBlockId:null,isMouseOverModal:!1,hideTimeout:null,setHoverBlockId:r=>{e({hoverBlockId:r})},showModal:(r,n="hoverBlockId")=>{t().hideTimeout&&clearTimeout(t().hideTimeout),e({isModalVisible:!0,[n]:r})},hideModal:(r="hoverBlockId")=>{e({isModalVisible:!1,[r]:null})},startHideTimeout:()=>{if(!t().isMouseOverModal){const r=setTimeout(()=>{e({isModalVisible:!1,hoverBlockId:null,keyBlock:null})},500);e({hideTimeout:r})}},clearHideTimeout:()=>{t().hideTimeout&&(clearTimeout(t().hideTimeout),e({hideTimeout:null}))},setMouseOverModal:r=>{e({isMouseOverModal:r})},isPreviewVisible:!1,showPreview:(r,n="hoverBlockId")=>{e({isPreviewVisible:!0,[n]:r})},hidePreview:(r="hoverBlockId")=>{e({isPreviewVisible:!1,[r]:null})},keyBlock:null,setKeyBlock:r=>{e({keyBlock:r})}})),I6=Ht(e=>({activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t})),activeFont:null,setActiveFont:t=>e(()=>({activeFont:t})),setThemeSettings:t=>e(()=>({themeSettings:t})),themeSettings:{colors:{text:{primary:"#252525",secondary:"#757575",tertiary:"#C2C2C2",inverted:"#FFFFFF",action:"#FF3F19",actionHover:"#DA2400",disabled:"#C2C2C2",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",link:"#3683F7"},icon:{primary:"#252525",secondary:"#555555",tertiary:"#C2C2C2",inverted:"#FFFFFF",action:"#FF3F19",actionHover:"#DA2400",disabled:"#C2C2C2",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",link:"#3683F7"},border:{primary:"#C2C2C2",secondary:"#E6E6E6",action:"#FF3F19",actionHover:"#DA2400",disabled:"#E6E6E6",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",focus:"#FF3F19"},surface:{primary:"#FFFFFF",secondary:"#F8F8F8",action1:"#FF3F19",action1Hover:"#DA2400",action2:"#FFFFFF",action2Hover:"#F8F8F8",disabled:"#C2C2C2",warning:"#FAF4E6",error:"#FAE6E6",success:"#E5FADD",information:"#E9F1FE",modal:"rgba(1, 1, 4, 0.4)"}},fonts:{heading:{h1:{font:"Archivo",weight:"900",size:48},h2:{font:"Archivo",weight:"700",size:32},h3:{font:"Archivo",weight:"600",size:24},h4:{font:"Archivo",weight:"500",size:16},h5:{font:"Archivo",weight:"400",size:16},h6:{font:"Archivo",weight:"400",size:16}},paragraph:{text:{font:"Archivo",size:48,weight:"400"}}},borders:{radius:10,thickness:1},buttons:{primary:{size:26,alignment:"left",radius:32,height:40,background:"#ff3f19",hover:!0,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}},secondary:{size:26,alignment:"left",radius:10,height:20,background:"#c2c2c2",hover:!1,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}},tertiary:{size:12,alignment:"left",radius:30,height:30,background:"#c2c2c2",hover:!0,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}}},inputs:{general:{height:48,size:48,color:"#000000"},field:{active:!0,color:"#000000",opacity:40},border:{active:!0,style:"solid",radius:0,thickness:0,color:"#000000"},label:{height:48,size:48,color:"#000000",alignment:"left"}}},updateColor:(t,r,n)=>e(o=>{const a={...o.themeSettings.colors,[t]:{...o.themeSettings.colors[t],[r]:n}};return{themeSettings:{...o.themeSettings,colors:a}}}),updateFont:(t,r,n,o)=>e(a=>{const s={...a.themeSettings.fonts,[t]:{...a.themeSettings.fonts[t],[r]:{...a.themeSettings.fonts[t][r],[n]:o}}};return{themeSettings:{...a.themeSettings,fonts:s}}}),updateBorder:(t,r)=>e(n=>{const o={...n.themeSettings.borders,[t]:r};return{themeSettings:{...n.themeSettings,borders:o}}}),updateButton:(t,r,n)=>e(o=>{const a={...o.themeSettings.buttons[t],[r]:n},s={...o.themeSettings.buttons,[t]:a};return{themeSettings:{...o.themeSettings,buttons:s}}}),updateInput:(t,r,n)=>e(o=>({themeSettings:{...o.themeSettings,inputs:{...o.themeSettings.inputs,[t]:{...o.themeSettings.inputs[t],[n]:r}}}}))})),F6=Ht(Al(e=>({fonts:[],setFonts:t=>e(()=>({fonts:t}))}),{name:"fonts-storage"})),B6=Ht(e=>({settings:null,setSettings:t=>e(()=>({settings:t}))})),H6=Ht()(e=>({color:"default",initialColor:"",setInitialColor:t=>e(()=>({initialColor:t})),colorChange:()=>{},update:()=>{},activeLabel:null,modalPosition:{left:0,top:0},showModal:!1,dragging:!1,hue:0,saturation:100,brightness:100,alpha:100,isGradientActive:!0,isGradient:!1,setIsGradient:t=>e(()=>({isGradient:t})),gradientDirection:"vertical",setGradientDirection:t=>e(()=>({gradientDirection:t})),hue2:0,saturation2:100,brightness2:100,alpha2:100,setHue2:t=>e(()=>({hue2:t})),setSaturation2:t=>e(()=>({saturation2:t})),setBrightness2:t=>e(()=>({brightness2:t})),setAlpha2:t=>e(()=>({alpha2:t})),activeColorIndex:1,setActiveColorIndex:t=>e(()=>({activeColorIndex:t})),setModalPosition:t=>e(()=>({modalPosition:t})),setHue:t=>e(()=>({hue:t})),setSaturation:t=>e(()=>({saturation:t})),setBrightness:t=>e(()=>({brightness:t})),setShowModal:t=>e(()=>({showModal:t})),setDragging:t=>e(()=>({dragging:t})),setActiveLabel:t=>e(()=>({activeLabel:t})),setColor:t=>e(()=>({color:t})),setUpdate:t=>e(()=>({update:t})),setColorChange:t=>e(()=>({colorChange:t})),setAlpha:t=>e(()=>({alpha:t})),setIsGradientActive:t=>e(()=>({isGradientActive:t})),resetColors:()=>e(()=>({color:"default",initialColor:"",activeLabel:null,modalPosition:{left:0,top:0},showModal:!1,dragging:!1,hue:0,saturation:100,brightness:100,alpha:100,isGradient:!1,gradientDirection:"vertical",hue2:0,saturation2:100,brightness2:100,alpha2:100,activeColorIndex:1,isGradientActive:!0}))})),P0=Ht(Al((e,t)=>({pages:null,currentPage:"/",setPages:r=>e(()=>({pages:r})),pageContext:{listings:null,products:null,reviews:null,categories:null,faqs:null,general:null},isOpenModal:!1,isOpenSelectModal:!1,isEdit:!1,editedPage:null,setEditedPage:r=>e(()=>({editedPage:r})),setCurrentPage:r=>e(()=>({currentPage:r})),setPageContext:r=>e(()=>({pageContext:r})),setIsOpenModal:r=>e(()=>({isOpenModal:r})),setIsOpenSelectModal:r=>e(()=>({isOpenSelectModal:r})),setIsEdit:r=>e(()=>({isEdit:r})),createPage:r=>{const n=t().pages,o=Yi();if(n)n[o]=r,e({pages:n});else{const a=t().setPages;a({});const s=t().pages;s[o]=r,e({pages:s})}},updatePage:(r,n)=>{const o=t().pages;o&&(o[r]={...n},e({pages:o}))},deletePage:r=>{const n=t().pages;n&&(delete n[r],e({pages:n}))}}),{name:"pages-storage",partialize:e=>{const{pages:t,pageContext:r}=e;return{pages:t,pageContext:r}}})),ad=Ht(e=>({openModal:!1,setOpenModal:t=>e(()=>({openModal:t})),onChange:null,setOnChange:t=>e(()=>({onChange:t}))})),ra=Ht((e,t)=>({past:[],future:[],addHistory:r=>{const{past:n}=t();e({past:[...n,r],future:[]})},undo:()=>{const{past:r,future:n}=t();if(r.length===0)return;const o=r[r.length-1],a=r.slice(0,-1);e({past:a,future:[ns.getState().blocks,...n]}),ns.getState().setBlocks(o)},redo:()=>{const{past:r,future:n}=t();if(n.length===0)return;const o=n[0],a=n.slice(1);e({past:[...r,ns.getState().blocks],future:a}),ns.getState().setBlocks(o)}})),V6=Ht(e=>({isOpenModal:!1,setIsOpenModal:t=>e(()=>({isOpenModal:t}))})),$6=Ht(e=>({notification:null,setNotification:t=>e(()=>({notification:t}))})),U6=Ht(e=>({error:null,setError:t=>e(()=>({error:t}))})),W6=Ht(e=>({title:null,description:null,onConfirm:null,setTitle:t=>e(()=>({title:t})),setDescription:t=>e(()=>({description:t})),setOnConfirm:t=>e(()=>({onConfirm:t}))})),z6=Ht(e=>({showTooltip:!1,setShowTooltip:t=>e({showTooltip:t})}));var N0={exports:{}};/*!
|
|
62
62
|
Copyright (c) 2018 Jed Watson.
|
|
63
63
|
Licensed under the MIT License (MIT), see
|
|
64
64
|
http://jedwatson.github.io/classnames
|
|
@@ -142,7 +142,7 @@ Valid keys: `+JSON.stringify(Object.keys(W),null," "));var $=We(ue,re,Y,ce,J+".
|
|
|
142
142
|
${t}%`:`You will receive an additional bonus of
|
|
143
143
|
${t}%`})]}),AP=e=>{const[t]=ge(kn.dataAtom),[r]=ge(Cl.pendingAtom),n=Zo({defaultValues:{amount:"",gateway:""}}),o=Qr(Cl),a=La({defaultOpen:!1});n.useSubmit(async()=>{const m=await o({price:{amount:c,currency:u},gateway:s});console.log({order:m}),a.hide()});const s=n.useValue(n.names.gateway),c=n.useValue(n.names.amount);if(n.useValidate(m=>Ko(m,RP,n)),!e||!(e!=null&&e.isEnabled))return null;const{topUpSettings:{currency:u,topUpBonusEnabled:d,bonusPercent:f,minimumTopUpForBonus:h}}=e,p=Number(c),v=d&&!Number.isNaN(p)?h-Number(p):h;return l.jsxs(l.Fragment,{children:[l.jsxs(Se,{onClick:a.show,className:"md:mr-4 flex-center mb-2 md:mb-0 w-full md:w-auto",children:[l.jsx(An,{color:"surface100",Icon:M2}),l.jsx("span",{className:"ml-1",children:"Add balance"})]}),l.jsx(oc,{store:a,title:"Top Up Account Balance",children:l.jsxs(Go,{store:n,children:[l.jsx(Js,{className:"text-sm text-textSecondary",name:n.names.amount,children:"Enter Amount"}),l.jsx(ka,{name:n.names.amount,render:l.jsx(In,{placeholder:"0",icon:l.jsx(B2,{})})}),l.jsx(ao,{className:"text-signalDanger",name:n.names.amount}),d&&v!==void 0&&l.jsx(kP,{enterAnother:v,bonusPercent:f,currency:u}),t&&l.jsx("div",{className:"pt-6 mt-6 border-borderDefault border-t w-full grid gap-3 grid-cols-2",children:t.map((m,g)=>l.jsxs("button",{type:"button",className:jt("p-4 rounded-2xl border flex flex-col justify-start",s===m.name?"border-brandDefault":"border-borderDefault",t.length-1===g&&"col-span-2"),onClick:()=>n.setValue(n.names.gateway,m.name),children:[l.jsx("img",{alt:m.displayName,src:kr(m.logoCfImageId),className:"mb-4 h-6"}),l.jsx("div",{children:m.displayName})]},m.name))}),l.jsx(ao,{className:"text-signalDanger mb-4",name:n.names.gateway}),l.jsx(Aa,{render:l.jsx(Se,{className:"w-full mt-10 mb-4 h-11 py-3",children:"Continue to Checkout"})}),r?l.jsx(tr,{}):null,l.jsxs("div",{className:"p-3 bg-surface0 flex rounded-base items-center mb-4",children:[l.jsx("div",{className:"h-[20px] w-[20px] mr-[10px] flex-center",children:l.jsx(H2,{})}),l.jsx("div",{className:"text-xs text-textSecondary",children:"By continuing to checkout, you agree to our terms of service and allow us to charge your payment method for this order."})]}),l.jsxs("div",{className:"p-3 bg-surface0 flex rounded-base items-center",children:[l.jsx("div",{className:"h-[20px] w-[20px] mr-[10px] flex-center",children:l.jsx(V2,{})}),l.jsx("div",{className:"text-xs text-textSecondary",children:"Your data is secured by extended validation SSL certificates (256-bit encryption). This complies with the strongest payment security standard available today."})]})]})})]})},LP={ADDED:M2,REMOVED:Tv},DP={ADDED:"+",REMOVED:"-"},OP={ADDED:"text-successText",REMOVED:"text-textPrimary"},MP={ADDED:"Added to your balance",REMOVED:"Payment"},IP=e=>{var n;const t={},r=new Date;for(const o of e){const a=new Date(o.createdAt),s=a.toDateString()===r.toDateString()?"Today":a.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});t[s]||(t[s]=[]),(n=t[s])==null||n.push(o)}return t},FP=({id:e,price:t,status:r})=>{const n=At(t).slice(r==="REMOVED"?1:0);return l.jsxs("div",{className:"p-[12px_16px] flex items-center",children:[l.jsxs("div",{className:"mr-auto flex-center",children:[l.jsx(An,{color:"textPrimary",size:"m",Icon:LP[r]}),l.jsxs("div",{className:"ml-3",children:[l.jsx("div",{children:MP[r]}),l.jsxs("div",{className:"text-textSecondary text-sm",children:["ID: ",e]})]})]}),l.jsxs("div",{className:`${OP[r]} font-semibold`,children:[DP[r]," ",n]})]},e)},BP=()=>{const[e]=ge(Ls.dataAtom),[t]=ge($o.dataAtom),[r]=ge(Vo.dataAtom),[n,o]=ge(v1),[a]=ge(c=>c.spy(Ls.pendingAtom)+c.spy($o.pendingAtom)+c.spy(Vo.pendingAtom)>0),s=()=>{var c;if((c=e==null?void 0:e.list)!=null&&c.length){const u=IP(e.list);return l.jsxs(l.Fragment,{children:[Object.entries(u).map(([d,f])=>l.jsxs("div",{children:[l.jsx("div",{className:"p-[12px_16px_10px] text-textSecondary text-sm w-full border-b-[1px] border-borderDefault",children:d}),f.map(FP)]},d)),l.jsx(g1,{currentPage:n,totalCount:e.totalCount,onPageChange:o})]})}return l.jsx(rc,{title:"Transactions are empty",description:"This is where all your transactions will be"})};return a?l.jsx(tr,{}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"p-6 border rounded-2xl border-borderDefault mb-4",children:[l.jsx("div",{className:"text-textSecondary",children:"Your balance"}),l.jsxs("div",{className:"flex items-center flex-col md:flex-row",children:[l.jsx("div",{className:"text-xxl font-bold mr-auto leading-10 mb-4 md:mb-0",children:t&&At(t)}),(r==null?void 0:r.isEnabled)&&l.jsx(AP,{...r}),l.jsxs("div",{className:"flex w-full md:w-auto",children:[l.jsx(Se,{variant:"secondary",className:"mr-2 md:mr-4 flex-center w-full md:w-auto shrink",children:"Contact support"}),l.jsx(Se,{variant:"secondary",isSquare:!0,className:"rounded-xl h-9 w-9",children:l.jsx(An,{Icon:Pv})})]})]})]}),l.jsx(nc,{title:"Transactions"}),l.jsx("div",{className:"flex flex-col flex-1",children:s()})]})},HP=P.object({id:P.number(),cfId:P.string()}),Zh=P.object({name:P.string(),image:HP,amountSpentUsd:P.number().optional(),purchasedTimes:P.number().int()}),VP=P.object({totalSpent:P.number(),totalPurchases:P.number().int(),averageReview:P.number(),visits:P.number().int(),createdAt:P.string().datetime(),ratingPlacement:P.number().int(),balance:Gs.optional(),spendMoreUsdForNextPlace:P.number(),topSpenderProduct:Zh.optional(),favoriteProduct:Zh.optional()}),Ds=Wt(async()=>Ar(await cx(),VP)).pipe(xr(null));Jr(Ds.dataAtom,Ds);var $P=P.object({data:P.object({isAvailable:P.boolean(),isActivated:P.boolean(),earnPercent:P.number().optional(),info:P.object({referralCode:P.string(),totalReferrals:P.number(),totalRevenueUsd:P.number()}).optional()})}),wl=Wt(async()=>Ar(await hx(),$P)).pipe(xr(null)),UP=Wt(async(e,t)=>{await px(t),await Ds(e)}).pipe(xr(null));Jr(wl.dataAtom,wl);var WP=({caption:e,description:t,index:r,bar:n=!0})=>l.jsxs("div",{className:"flex text-sm text-textSecondary",children:[l.jsxs("div",{className:"mb-1 mr-2 flex flex-col items-center",children:[l.jsx("div",{className:"flex-center mb-1 h-6 w-6 rounded-full bg-borderDefault font-bold",children:r}),n&&l.jsx("div",{className:"h-[38px] w-1 rounded-2xl bg-borderDefault"})]}),l.jsxs("div",{children:[l.jsx("div",{className:"mb-1 font-bold uppercase",children:e}),l.jsx("div",{children:t})]})]}),zP=[{caption:"Share link",description:"Send the link to your friends in all convenient ways"},{caption:"Purchase",description:"They buy a product from our store"},{caption:"Percentages",description:"You get rewards"}],ZP=()=>l.jsx("div",{children:zP.map(({caption:e,description:t},r,n)=>l.jsx(WP,{caption:e,description:t,index:r+1,bar:r+1!==n.length},e))}),qP=ZP,GP=P.object({referralCode:P.string().min(3,{message:"Referral Code should have minimum length of 3"})}),YP=()=>{const e=Zo({defaultValues:{referralCode:""}}),t=La({defaultOpen:!1}),r=e.useValue(e.names.referralCode),n=Qr(UP);return e.useSubmit(()=>{n({referralCode:r}),t.hide()}),e.useValidate(o=>Ko(o,GP,e)),l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:t.show,children:"Join the referral program "}),l.jsx(oc,{store:t,title:"Create an affiliate code",children:l.jsxs(Go,{store:e,children:[l.jsx(Js,{className:"text-sm text-textSecondary",name:e.names.referralCode,children:"Affiliate Code"}),l.jsx(ka,{name:e.names.referralCode,render:l.jsx(In,{placeholder:"Enter code here (e.g Join)"})}),l.jsx(ao,{className:"text-signalDanger",name:e.names.referralCode}),l.jsxs("div",{className:"p-3 bg-surface0 flex rounded-xl items-center mb-8 mt-4",children:[l.jsx("div",{className:"h-[20px] w-[20px] mr-[10px] flex-center",children:l.jsx(_v,{})}),l.jsx("div",{className:"text-sm text-textSecondary",children:"Once you join our referral program, you’ll gain access to special deals, rewards, and potentially earn a percentage (%) of revenue."})]}),l.jsxs("div",{className:"justify-end flex",children:[l.jsx(Up,{render:l.jsx(Se,{variant:"secondary",className:"mr-3",children:"Cancel"})}),l.jsx(Aa,{render:l.jsx(Se,{children:"Create"})})]})]})})]})},KP=YP,XP=()=>{const[e]=ge(wl.dataAtom),[t]=ge(c=>c.spy(wl.pendingAtom));if(t)return l.jsx(tr,{});if(!e)return null;const{isAvailable:r,isActivated:n,info:o}=e.data,a=o==null?void 0:o.referralCode;if(!r)return null;const s=`https://demo.sellpass.io/?r=${a}`;return l.jsx("div",{className:"col-span-2 lg:col-span-4 row-span-2",children:l.jsxs("div",{className:"h-full rounded-xl border border-borderDefault p-6",children:[l.jsx("div",{className:"text-xxl font-bold",children:"Refer friends"}),l.jsx("div",{className:"mb-3 text-textSecondary",children:"Refer friends. Earn rewards. Make bank."}),n?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-sm text-textSecondary mb-1",children:"Affiliate Code"}),l.jsx("div",{className:"rounded-xl bg-surface0 text-textPrimary border-textPrimary p-3 mb-4",children:a}),l.jsx("div",{className:"text-sm text-textSecondary mb-1",children:"Affiliate Link"}),l.jsxs("div",{className:"rounded-xl bg-surface0 text-textPrimary border-textPrimary p-3 flex justify-between",children:[l.jsx("div",{children:s}),l.jsx("button",{type:"button",onClick:()=>navigator.clipboard.writeText(s),children:l.jsx(Ea,{})})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mb-6",children:l.jsx(KP,{})}),l.jsx(qP,{})]})]})})},JP=XP,QP=({Icon:e,title:t,value:r,image:n,imageName:o,children:a,className:s})=>{const[c,u]=x.useState(!0),[d,f]=x.useState(!1),h=()=>{u(!1)},p=()=>{u(!1),f(!0)};return l.jsxs("div",{className:`relative flex w-full flex-col justify-between rounded-xl border-[1px] border-borderDefault flex-auto ${s}`,children:[n&&l.jsxs(l.Fragment,{children:[l.jsx("img",{src:n,alt:"FallbackImage",style:{display:"none"},onError:p,onLoad:h}),c||d?l.jsxs("div",{className:"flex h-full min-h-[300px] flex-col rounded-xl bg-surface0 p-4",children:[l.jsx("div",{className:"flex-center flex-1",children:l.jsx(kv,{})}),l.jsx("div",{className:"font-semibold mt-auto",children:o})]}):l.jsx("div",{style:{backgroundImage:`linear-gradient(rgba(0,0,0,0.5),rgba(0,0,0,0.5)),url('${n}')`},className:"flex h-full min-h-[300px] flex-col justify-end rounded-xl bg-cover bg-no-repeat p-4 text-white",children:l.jsx("div",{children:l.jsx("div",{className:"font-semibold",children:o})})})]}),l.jsxs("div",{className:`px-4 py-4 ${a?"lg:py-3":"lg:p-6"}`,children:[l.jsxs("div",{className:`flex lg:flex-row ${n?"":"flex-col"}`,children:[l.jsx(An,{Icon:e,color:"brandDefault",size:"l",className:"lg:mb-0 mb-1"}),l.jsxs("div",{className:n?"ml-3":"lg:ml-3",children:[l.jsx("div",{className:"text-sm text-textSecondary",children:t}),l.jsx("div",{className:"text-lg font-bold",children:r})]})]}),a]})]})},nn=QP,eN="Billgang",tN="D4RK",qh=({children:e})=>l.jsx("div",{className:"gap-2 lg:gap-4 grid grid-cols-2 lg:grid-cols-1 col-span-2 lg:col-span-1 ",children:e}),rN=()=>{const[e]=ge(Ds.dataAtom),[t]=ge(r=>r.spy(Ds.pendingAtom));return ge(Vo.dataAtom),t?l.jsx(tr,{}):e?l.jsxs("div",{className:"grid w-full gap-4 grid-cols-2 lg:grid-cols-4 lg:pb-6",children:[l.jsx(JP,{}),l.jsxs(qh,{children:[l.jsx(nn,{Icon:Sv,title:"Customer since",value:ex(e.createdAt)}),l.jsx(nn,{Icon:L2,title:"Total spent",value:At({amount:e.totalSpent})}),l.jsx(nn,{Icon:A2,title:"Top",value:`#${e.ratingPlacement}`,children:l.jsxs("div",{className:"text-xs text-textSecondary flex items-center mt-2",children:[l.jsx(An,{Icon:I2,className:"mx-1"}),"Spend $",e.spendMoreUsdForNextPlace," more to be #",e.ratingPlacement+1]})}),l.jsx(nn,{Icon:Cd,title:"Average review",value:e.averageReview})]}),e.topSpenderProduct&&l.jsx(nn,{className:"col-span-2 lg:col-span-1",image:kr(e.topSpenderProduct.image.cfId),imageName:e.topSpenderProduct.name,Icon:vv,title:"Top spent",value:`${At({amount:e.topSpenderProduct.amountSpentUsd||0})} spent`}),l.jsxs(qh,{children:[l.jsx(nn,{Icon:D2,title:"Purchases",value:e.totalPurchases}),l.jsx(nn,{Icon:jv,title:"Visits",value:e.visits}),l.jsx(nn,{Icon:bv,title:"Powered by",value:eN}),l.jsx(nn,{Icon:pv,title:"Store",value:tN})]}),e.favoriteProduct&&l.jsx(nn,{image:kr(e.favoriteProduct.image.cfId),imageName:e.favoriteProduct.name,Icon:yv,title:"Favorite product",value:`bought ${e.favoriteProduct.purchasedTimes} times`})]}):null},x1=Ke(1),zm=(e=>(e.New="NEW",e.Pending="PENDING",e.Completed="COMPLETED",e.Cancelled="CANCELLED",e.Expired="EXPIRED",e.FullDeliveryFailure="FULL_DELIVERY_FAILURE",e.PartiallyDelivered="PARTIALLY_DELIVERED",e.Refunded="REFUNDED",e.Failed="FAILED",e))(zm||{}),nN=P.object({id:P.string(),status:P.nativeEnum(zm),price:Gs,gatewayName:P.string(),time:P.string(),review:P.object({rating:P.number()}).optional()}),oN=P.object({list:P.array(nN),totalCount:P.number()}),Os=Wt(async e=>Ar(await bx({PageNumber:e.get(x1)}),oN)).pipe(xr(null));x1.onChange(e=>{Os(e)});Jr(Os.dataAtom,Os);var aN=()=>l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:l.jsx("path",{d:"M11.2105 5.91453C11.2628 5.96677 11.3043 6.02881 11.3326 6.0971C11.3609 6.16538 11.3754 6.23858 11.3754 6.3125C11.3754 6.38642 11.3609 6.45962 11.3326 6.5279C11.3043 6.59619 11.2628 6.65823 11.2105 6.71047L7.27297 10.648C7.22073 10.7003 7.15869 10.7418 7.09041 10.7701C7.02212 10.7984 6.94892 10.8129 6.875 10.8129C6.80108 10.8129 6.72789 10.7984 6.6596 10.7701C6.59131 10.7418 6.52928 10.7003 6.47703 10.648L4.78953 8.96047C4.68399 8.85492 4.62469 8.71177 4.62469 8.5625C4.62469 8.41323 4.68399 8.27008 4.78953 8.16453C4.89508 8.05898 5.03824 7.99969 5.1875 7.99969C5.33677 7.99969 5.47992 8.05898 5.58547 8.16453L6.875 9.45477L10.4145 5.91453C10.4668 5.86223 10.5288 5.82074 10.5971 5.79244C10.6654 5.76413 10.7386 5.74956 10.8125 5.74956C10.8864 5.74956 10.9596 5.76413 11.0279 5.79244C11.0962 5.82074 11.1582 5.86223 11.2105 5.91453ZM15.3125 8C15.3125 9.44628 14.8836 10.8601 14.0801 12.0626C13.2766 13.2651 12.1346 14.2024 10.7984 14.7559C9.46219 15.3093 7.99189 15.4541 6.57341 15.172C5.15492 14.8898 3.85196 14.1934 2.82928 13.1707C1.80661 12.148 1.11017 10.8451 0.828011 9.4266C0.545857 8.00811 0.690668 6.53781 1.24413 5.20163C1.7976 3.86544 2.73486 2.72339 3.9374 1.91988C5.13993 1.11637 6.55373 0.6875 8 0.6875C9.93877 0.689547 11.7975 1.46063 13.1685 2.83154C14.5394 4.20246 15.3105 6.06123 15.3125 8ZM14.1875 8C14.1875 6.77623 13.8246 5.57994 13.1447 4.56241C12.4648 3.54488 11.4985 2.75181 10.3679 2.2835C9.23724 1.81518 7.99314 1.69264 6.79288 1.93139C5.59262 2.17014 4.49012 2.75944 3.62478 3.62478C2.75944 4.49011 2.17014 5.59262 1.93139 6.79288C1.69265 7.99314 1.81518 9.23724 2.2835 10.3679C2.75182 11.4985 3.54488 12.4648 4.56241 13.1447C5.57994 13.8246 6.77623 14.1875 8 14.1875C9.64046 14.1856 11.2132 13.5331 12.3732 12.3732C13.5331 11.2132 14.1856 9.64046 14.1875 8Z",fill:"#338B13"})}),sN=()=>l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:l.jsx("path",{d:"M8 0.6875C6.55373 0.6875 5.13993 1.11637 3.9374 1.91988C2.73486 2.72339 1.7976 3.86544 1.24413 5.20163C0.690668 6.53781 0.545857 8.00811 0.828011 9.4266C1.11017 10.8451 1.80661 12.148 2.82928 13.1707C3.85196 14.1934 5.15492 14.8898 6.57341 15.172C7.99189 15.4541 9.46219 15.3093 10.7984 14.7559C12.1346 14.2024 13.2766 13.2651 14.0801 12.0626C14.8836 10.8601 15.3125 9.44628 15.3125 8C15.3105 6.06123 14.5394 4.20246 13.1685 2.83154C11.7975 1.46063 9.93877 0.689547 8 0.6875ZM8 14.1875C6.77623 14.1875 5.57994 13.8246 4.56241 13.1447C3.54488 12.4648 2.75182 11.4985 2.2835 10.3679C1.81518 9.23724 1.69265 7.99314 1.93139 6.79288C2.17014 5.59262 2.75944 4.49011 3.62478 3.62478C4.49012 2.75944 5.59262 2.17014 6.79288 1.93139C7.99314 1.69264 9.23724 1.81518 10.3679 2.2835C11.4985 2.75181 12.4648 3.54488 13.1447 4.56241C13.8246 5.57994 14.1875 6.77623 14.1875 8C14.1856 9.64046 13.5331 11.2132 12.3732 12.3732C11.2132 13.5331 9.64046 14.1856 8 14.1875ZM12.5 8C12.5 8.14918 12.4407 8.29226 12.3353 8.39775C12.2298 8.50324 12.0867 8.5625 11.9375 8.5625H8C7.85082 8.5625 7.70775 8.50324 7.60226 8.39775C7.49677 8.29226 7.4375 8.14918 7.4375 8V4.0625C7.4375 3.91332 7.49677 3.77024 7.60226 3.66475C7.70775 3.55926 7.85082 3.5 8 3.5C8.14919 3.5 8.29226 3.55926 8.39775 3.66475C8.50324 3.77024 8.5625 3.91332 8.5625 4.0625V7.4375H11.9375C12.0867 7.4375 12.2298 7.49676 12.3353 7.60225C12.4407 7.70774 12.5 7.85082 12.5 8Z",fill:"#C1972A"})}),iN=()=>l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[l.jsx("path",{d:"M9 17.0625C4.5525 17.0625 0.9375 13.4475 0.9375 9C0.9375 4.5525 4.5525 0.9375 9 0.9375C13.4475 0.9375 17.0625 4.5525 17.0625 9C17.0625 13.4475 13.4475 17.0625 9 17.0625ZM9 2.0625C5.175 2.0625 2.0625 5.175 2.0625 9C2.0625 12.825 5.175 15.9375 9 15.9375C12.825 15.9375 15.9375 12.825 15.9375 9C15.9375 5.175 12.825 2.0625 9 2.0625Z",fill:"#C12A2A"}),l.jsx("path",{d:"M6.87752 11.685C6.73502 11.685 6.59252 11.6325 6.48002 11.52C6.26252 11.3025 6.26252 10.9425 6.48002 10.725L10.725 6.48C10.9425 6.2625 11.3025 6.2625 11.52 6.48C11.7375 6.6975 11.7375 7.0575 11.52 7.275L7.27502 11.52C7.17002 11.6325 7.02002 11.685 6.87752 11.685Z",fill:"#C12A2A"}),l.jsx("path",{d:"M11.1225 11.685C10.98 11.685 10.8375 11.6325 10.725 11.52L6.48002 7.275C6.26252 7.0575 6.26252 6.6975 6.48002 6.48C6.69752 6.2625 7.05752 6.2625 7.27502 6.48L11.52 10.725C11.7375 10.9425 11.7375 11.3025 11.52 11.52C11.4075 11.6325 11.265 11.685 11.1225 11.685Z",fill:"#C12A2A"})]}),lN={1:aN,2:sN,3:iN},cN={1:"bg-successBackground text-successText",2:"bg-warningBackground text-warningText",3:"bg-signalDangerBackground text-signalDanger"},uN=({status:e,variant:t})=>{const r=lN[t];return l.jsxs("div",{className:jt("flex items-center justify-start rounded-full p-[4px_8px]",cN[t]),children:[l.jsx(r,{}),l.jsx("span",{className:"ml-1",children:e})]})},_r=({children:e,className:t})=>l.jsx("div",{className:`truncate border-b border-borderDefault p-4 pr-6 justify-start flex items-center ${t}`,children:e}),Fr=({children:e,className:t})=>l.jsx(_r,{className:`text-sm text-textSecondary uppercase ${t}`,children:e}),dN=({children:e,className:t})=>l.jsx("div",{className:On("overflow-x-auto grid grid-cols-[minmax(120px,auto)_repeat(5,minmax(min-content,auto))]",t),children:e}),Zm=dN,fN={NEW:2,PENDING:2,COMPLETED:1,CANCELLED:3,EXPIRED:3,FULL_DELIVERY_FAILURE:3,PARTIALLY_DELIVERED:2,REFUNDED:1,FAILED:3},hN=(e,t)=>{const r=t.find(n=>n.name===e);return r?l.jsxs(l.Fragment,{children:[l.jsx("img",{alt:r.displayName,src:kr(r.logoCfImageId),className:"h-6 mr-1"}),l.jsx("div",{children:r.displayName})]}):null},pN=({item:e,gatewaysDetail:t})=>{const[r,n]=cl(e.time);return l.jsxs(x.Fragment,{children:[l.jsx(_r,{children:e.id}),l.jsx(_r,{children:l.jsx(uN,{status:e.status,variant:fN[e.status]})}),l.jsx(_r,{children:At(e.price)}),l.jsx(_r,{children:hN(e.gatewayName,t)}),l.jsx(_r,{children:l.jsxs("div",{children:[l.jsx("div",{children:r}),l.jsx("div",{className:"text-xs text-textSecondary",children:n})]})}),l.jsx(_r,{children:e.review?l.jsxs("div",{className:"flex-center ",children:[l.jsx(An,{className:"text-brandDefault",Icon:Cd}),l.jsx("div",{className:"ml-1",children:e.review.rating})]}):"None"})]},e.id)},mN=()=>{var c;const[e]=ge(Os.dataAtom),[t,r]=ge(x1),[n]=ge(u=>u.spy(Os.pendingAtom)>0),[o]=ge(kn.dataAtom),a=!((c=e==null?void 0:e.list)!=null&&c.length)||!o,s=!n&&!a;return l.jsxs("div",{className:"border border-borderDefault rounded-2xl flex justify-between flex-col flex-1",children:[l.jsxs(Zm,{children:[l.jsx(Fr,{children:"Invoice ID"}),l.jsx(Fr,{children:"Status"}),l.jsx(Fr,{children:"Value"}),l.jsx(Fr,{children:"Payment"}),l.jsx(Fr,{children:"Date"}),l.jsx(Fr,{children:"Review"}),s&&e.list.map(u=>l.jsx(pN,{item:u,gatewaysDetail:o},u.id))]}),s&&l.jsx(g1,{currentPage:t,totalCount:e.totalCount,onPageChange:r}),n?l.jsx(tr,{}):a?l.jsx(rc,{title:"Orders are empty",description:"Order history will be collected here"}):null]})},gN=mN,vN=()=>l.jsxs(l.Fragment,{children:[l.jsx(nc,{title:"Orders"}),l.jsx(gN,{})]}),xN=P.object({id:P.number(),variantId:P.number(),productName:P.string(),variantName:P.string(),quantity:P.number()}),_i=P.object({balance:Gs}),Ti=P.object({productsWithVariants:P.array(xN)}),bN=P.union([P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:_i,ruleType:P.literal("SPEND_AMOUNT"),ruleOptions:P.object({forEach:P.number()})}),P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:_i,ruleType:P.literal("ORDER_COUNT"),ruleOptions:P.object({ordersCount:P.number()})}),P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:_i,ruleType:P.literal("REFER_FRIEND"),ruleOptions:P.object({minReferrals:P.number(),minCompletedOrders:P.number()})}),P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:_i,ruleType:P.literal("LEAVE_REVIEW"),ruleOptions:P.object({minReviews:P.number(),minStars:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Ti,ruleType:P.literal("SPEND_AMOUNT"),ruleOptions:P.object({forEach:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Ti,ruleType:P.literal("ORDER_COUNT"),ruleOptions:P.object({ordersCount:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Ti,ruleType:P.literal("REFER_FRIEND"),ruleOptions:P.object({minReferrals:P.number(),minCompletedOrders:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Ti,ruleType:P.literal("LEAVE_REVIEW"),ruleOptions:P.object({minReviews:P.number(),minStars:P.number()})})]),yN=P.object({id:P.number(),progress:P.number(),createdAt:P.string(),completedAt:P.string().optional(),rewardRule:bN}),CN=P.array(yN),Sl=Wt(async()=>Ar(await ux(),CN)).pipe(xr(null));Jr(Sl.dataAtom,Sl);var wN=()=>{const[e]=ge(Sl.dataAtom),[t]=ge(o=>o.spy(Sl.pendingAtom)>0),r=!(e!=null&&e.length),n=!t&&!r;return l.jsxs(l.Fragment,{children:[l.jsx(nc,{title:"Rewards",description:"To unlock an exclusive reward, complete everything on this checklist"}),l.jsx("div",{className:"justify-between grid gap-4 grid-cols-1 lg:grid-cols-2 xl:grid-cols-3",children:n&&e.map(o=>l.jsx(SN,{achievement:o},o.id))}),t?l.jsx(tr,{}):r?l.jsx(rc,{title:"Rewards are empty",description:"Rewards will be collected here"}):null]})},SN=({achievement:e})=>{const[t,r]=PN(e),[n,o,a]=NN(e),s=o===a;return l.jsxs("div",{className:"flex flex-col border border-borderDefault rounded-2xl p-6 items-center",children:[l.jsx(EN,{percentage:n}),l.jsx("div",{className:`mt-3 rounded-xl px-2 py-1 items-start flex ${s?"text-brandDefault bg-brandLight":"text-textSecondary bg-surface0"}`,children:s?l.jsxs("div",{className:"flex items-center",children:[l.jsx(Cv,{})," ",l.jsx("span",{className:"ml-1",children:"Completed!"})]}):`Done: ${o} / ${a}`}),l.jsxs("span",{className:"items-center font-semibold flex mb-1 mt-4",children:[l.jsx(An,{className:"icon-wrapper w-6 h-6 rounded-lg",Icon:D2}),l.jsx("div",{className:"ml-2 text-center",children:t})]}),l.jsx("span",{className:"bg-surface100 text-center mb-4 text-sm",children:r}),l.jsx(Se,{variant:s?"primary":"secondary",className:"w-full mt-auto",children:s?"Claim":jN(e)})]})},EN=({percentage:e,radius:t=40,strokeWidth:r=8})=>{const n=t+r/2,o=n*2,a=2*Math.PI*t,s=a-e/100*a;return l.jsxs("div",{style:{width:o,height:o},className:"flex items-center justify-center overflow-hidden",children:[l.jsxs("svg",{"aria-hidden":"true",width:o,height:o,children:[l.jsx("circle",{cx:n,cy:n,r:t,fill:"transparent",className:"stroke-borderDefault",strokeWidth:r}),l.jsx("circle",{cx:n,cy:n,r:t,fill:"transparent",strokeWidth:r,strokeDasharray:`${a} ${a}`,strokeDashoffset:s,className:"stroke-brandDefault",transform:`rotate(-90 ${n} ${n})`})]}),l.jsxs("span",{className:"absolute text-lg font-bold text-brandDefault",children:[e,"%"]})]})},Pi=e=>{switch(e.rewardRule.rewardType){case"BALANCE":return`${At(e.rewardRule.rewardOptions.balance)} on the balance`;case"PRODUCT":return`products: ${e.rewardRule.rewardOptions.productsWithVariants.map(t=>`${t.quantity} ${t.productName} (${t.variantName})`).join()}`}},jN=e=>{switch(e.rewardRule.rewardType){case"BALANCE":return At(e.rewardRule.rewardOptions.balance);case"PRODUCT":return`${e.rewardRule.rewardOptions.productsWithVariants.map(t=>`${t.quantity} ${t.productName} (${t.variantName})`).join()}`}},_N=e=>{switch(e.rewardRule.ruleType){case"SPEND_AMOUNT":return`Spend $${e.rewardRule.ruleOptions.forEach} in total purchases at our store to receive a reward of ${Pi(e)}. You've spent $${e.progress} so far.`;case"ORDER_COUNT":return`Place ${e.rewardRule.ruleOptions.ordersCount} orders to receive a reward of ${Pi(e)}. You've made ${e.progress} orders so far.`;case"REFER_FRIEND":return`On your referral link should sign up ${e.rewardRule.ruleOptions.minReferrals} people and make at least ${e.rewardRule.ruleOptions.minCompletedOrders} purchase to receive a reward of ${Pi(e)}. You've referred ${e.progress} friends so far.`;case"LEAVE_REVIEW":return`Leave ${e.rewardRule.ruleOptions.minReviews} reviews with a minimum rating of ${e.rewardRule.ruleOptions.minStars} to receive a reward of ${Pi(e)}. You've left ${e.progress} reviews so far.`}},TN=e=>{switch(e.rewardRule.ruleType){case"SPEND_AMOUNT":return`Spend $${e.rewardRule.ruleOptions.forEach} at our store`;case"ORDER_COUNT":return`Make ${e.rewardRule.ruleOptions.ordersCount} orders`;case"REFER_FRIEND":return`Refer ${e.rewardRule.ruleOptions.minReferrals} friends to our store`;case"LEAVE_REVIEW":return`Leave ${e.rewardRule.ruleOptions.minReviews} reviews with a minimum rating of ${e.rewardRule.ruleOptions.minStars}`}},PN=e=>[TN(e),_N(e)],NN=e=>{let t;switch(e.rewardRule.ruleType){case"SPEND_AMOUNT":t=e.rewardRule.ruleOptions.forEach;break;case"ORDER_COUNT":t=e.rewardRule.ruleOptions.ordersCount;break;case"REFER_FRIEND":t=e.rewardRule.ruleOptions.minReferrals;break;case"LEAVE_REVIEW":t=e.rewardRule.ruleOptions.minReviews;break}return[Math.round((e.progress/t*100+Number.EPSILON)*100)/100,e.progress,t]},qm=(e=>(e.RIAL="RIAL",e.AWAITING_PAYMENT="AWAITING_PAYMENT",e.ACTIVE="ACTIVE",e.PAST_DUE="PAST_DUE",e.CANCELLED="CANCELLED",e.EXPIRED="EXPIRED",e.CHANGED_GATEWAY="CHANGED_GATEWAY",e.REPLACED="REPLACED",e))(qm||{}),b1=Ke(1),Gm=P.object({id:P.string(),productName:P.string(),status:P.nativeEnum(qm),price:Gs,gatewayName:P.string(),createdAt:P.string(),accessToken:P.string(),recurringInterval:P.string(),currentChargeAttempt:P.number(),nextChargeAttemptAt:P.string().optional(),activeTo:P.string().optional()}),RN=P.object({list:P.array(Gm),totalCount:P.number()}),Ms=Wt(async e=>Ar(await yx({PageNumber:e.get(b1)}),RN)).pipe(xr(null));b1.onChange(e=>{Ms(e)});Jr(Ms.dataAtom,Ms);var kN={ACTIVE:{icon:l.jsx(wd,{}),title:"Active",className:"text-successText bg-successBackground"},AWAITING_PAYMENT:{icon:l.jsx(Hi,{}),title:"Awaiting Payment",className:"bg-warningBackground text-warningText"},CANCELLED:{icon:l.jsx(Sn,{}),title:"Cancelled",className:"text-signalDanger bg-signalDangerBackground"},CHANGED_GATEWAY:{icon:l.jsx(yu,{}),title:"Upgraded",className:"text-signalDanger bg-signalDangerBackground"},EXPIRED:{icon:l.jsx(Sn,{}),title:"Expired",className:"text-signalDanger bg-signalDangerBackground"},RIAL:{icon:l.jsx(Hi,{}),title:"Active",className:"text-textSecondary bg-surface0"},PAST_DUE:{icon:l.jsx(Hi,{}),title:"Trial",className:"text-signalDanger bg-signalDangerBackground"},REPLACED:{icon:l.jsx(yu,{}),title:"Replaced",className:"text-textSecondary bg-surface0"}},AN=({status:e})=>{const t=kN[e];return l.jsxs("div",{className:On("w-fit flex items-center justify-start rounded-full gap-1 py-1 px-2 text-sm",t.className),children:[t.icon,l.jsx("p",{children:t.title})]})},Ym=AN,LN=(e,t)=>{const r=t.find(n=>n.name===e);return r?l.jsxs(l.Fragment,{children:[l.jsx("img",{alt:r.displayName,src:kr(r.logoCfImageId),className:"h-6 mr-1"}),l.jsx("div",{children:r.displayName})]}):null},DN=({item:e,gatewaysDetail:t})=>{const[r,n]=cl(e.createdAt),[o]=cl(e.activeTo||"");return l.jsxs(x.Fragment,{children:[l.jsx(_r,{children:l.jsxs("div",{className:"flex gap-2 items-center w-full",children:[l.jsx("div",{className:"min-w-8 h-8 flex justify-center items-center bg-surface0 rounded-base",children:l.jsx($l,{})}),l.jsxs("div",{children:[l.jsx(S0,{to:`${le.get(ro).Subscription}/${e.id}/${e.accessToken}`,className:"overflow-ellipsis overflow-hidden whitespace-nowrap w-full hover:underline",children:e.productName}),l.jsx("p",{className:"text-xs text-textSecondary",children:e.activeTo&&"expires at "+o})]})]})}),l.jsx(_r,{className:"w-full",children:l.jsx("p",{className:"overflow-ellipsis overflow-hidden whitespace-nowrap w-full max-w-[100%]",children:e.id})}),l.jsx(_r,{children:l.jsx(Ym,{status:e.status})}),l.jsx(_r,{children:At(e.price)}),l.jsx(_r,{children:LN(e.gatewayName,t)}),l.jsx(_r,{children:l.jsxs("div",{children:[l.jsx("div",{children:r}),l.jsx("div",{className:"text-xs text-textSecondary",children:n})]})})]},e.id)},ON=()=>{var u;const[e]=ge(Ms.dataAtom),[t,r]=ge(b1),[n]=ge(d=>d.spy(Ms.pendingAtom)>0),[o]=ge(kn.dataAtom),a=Qr(kn),s=!(e!=null&&e.list.length)||!o,c=!n&&!s;return x.useEffect(()=>{a([])},[]),l.jsxs("div",{className:"border border-borderDefault rounded-2xl flex justify-between flex-col flex-1",children:[l.jsxs(Zm,{className:"overflow-x-auto grid grid-cols-[minmax(120px,auto)_minmax(0,20%)_repeat(4,minmax(min-content,auto))]",children:[l.jsx(Fr,{className:"w-full",children:"Product name"}),l.jsx(Fr,{children:"ID"}),l.jsx(Fr,{children:"Status"}),l.jsx(Fr,{children:"Value"}),l.jsx(Fr,{children:"Payment"}),l.jsx(Fr,{children:"Date"}),c&&((u=e==null?void 0:e.list)==null?void 0:u.map(d=>l.jsx(DN,{item:d,gatewaysDetail:o},d.id)))]}),c&&l.jsx(g1,{currentPage:t,totalCount:e==null?void 0:e.totalCount,onPageChange:r}),n?l.jsx(tr,{}):s?l.jsx(rc,{title:"Subscriptions are empty",description:"Subscription history will be collected here"}):null]})},MN=ON,IN=()=>l.jsxs(l.Fragment,{children:[l.jsx(nc,{title:"Subscriptions"}),l.jsx(MN,{})]}),FN=IN,Uu=Ke("Home"),BN={Home:rN,Orders:vN,Rewards:wN,Balance:BP,Subscriptions:FN},HN=()=>{const[e]=ge(po),[t]=ge(Uu),r=BN[t];return e?l.jsxs("main",{className:"h-full flex flex-grow flex-col xl:flex-row",children:[l.jsx(wP,{}),l.jsx("div",{className:"xl:p-6 xl:pr-10 px-4 py-6 flex flex-col max-w-[1120px] w-full flex-1",children:l.jsx(r,{})})]}):l.jsx(Um,{})},VN=()=>l.jsxs(Hm,{children:[l.jsx(HN,{}),l.jsx(lj,{richColors:!0,closeButton:!0})]}),$N=VN,UN=({lastUpdate:e,invoiceId:t,email:r,paymentType:n})=>{const o=oi();return l.jsxs("div",{className:"flex flex-col ",children:[l.jsxs("div",{className:"py-3 w-full flex items-center justify-between text-base border-b border-borderDefault",children:[l.jsx("p",{className:"text-textSecondary",children:"Last Updated"}),l.jsx("p",{children:Vu(new Date(e),"MMM dd, yyyy 'at' hh:mm:ss aa")})]}),l.jsxs("div",{className:"py-3 w-full flex items-center justify-between text-base border-b border-borderDefault",children:[l.jsx("p",{className:"text-textSecondary",children:"Payment Type"}),l.jsx("p",{children:n})]}),l.jsxs("div",{className:"py-3 w-full flex items-center justify-between text-base border-b border-borderDefault",children:[l.jsx("p",{className:"text-textSecondary",children:"Email"}),l.jsx("p",{children:r})]}),l.jsxs("div",{className:"py-3 w-full flex items-center justify-between text-base ]",children:[l.jsx("p",{className:"text-textSecondary",children:"Charge ID"}),l.jsxs("div",{className:"flex items-center justify-end gap-2.5 max-w-[80%] w-full",children:[l.jsx("p",{className:"overflow-ellipsis overflow-hidden whitespace-nowrap max-w-[80%]",children:t}),l.jsx("div",{className:"text-textSecondary hover:text-textPrimary cursor-pointer",onClick:()=>o(t),children:l.jsx(Ea,{})})]})]})]})},Km=UN,Ni={PAID:"Paid",PENDING:"Pending",EXPIRED:"Expired",CANCELLED:"Cancelled",NOT_PAID:"Not Paid"},WN={PAID:{displayName:Ni.PAID,displayMessage:"The invoice has been completed and the product has been delivered.",type:"success"},PENDING:{displayName:Ni.PENDING,displayMessage:"The invoice has been created and we are now waiting to receive the payment.",type:"warning"},EXPIRED:{displayName:Ni.EXPIRED,displayMessage:"Your payment has expired due to the payment not being sent in time.",type:"error"},CANCELLED:{displayName:Ni.CANCELLED,displayMessage:"The order has been canceled. The payment was not sent within the time limit.",type:"error"},NOT_PAID:{displayName:"New",displayMessage:"The charge has been created and is awaiting payment.",type:"success"}},zN=({date:e,chargeStatus:t})=>l.jsxs("div",{className:"",children:[l.jsxs("div",{className:"flex justify-between text-sm text-textSecondary",children:[l.jsx("p",{className:"font-semibold",children:Vu(new Date(e),"dd.MM.yyyy")}),l.jsxs("p",{children:["11:12:10 PM ",Vu(new Date(e),"hh:mm:ss aa")]})]}),l.jsx("p",{className:"mt-2",children:WN[t].displayMessage})]}),ZN=({timeline:e})=>{const[t,r]=x.useState(!1);return l.jsxs("div",{className:"relative",children:[l.jsxs("div",{className:`py-4 px-6 bg-surface100 rounded-base absolute w-full bottom-[60px] z-50 shadow-shadow0 transition-all invisible opacity-0 ${t&&"opacity-100 !visible"}`,children:[l.jsx("header",{className:"pb-4",children:l.jsx("h2",{className:"font-bold text-lg",children:"Track Payment"})}),l.jsx("div",{className:"flex flex-col gap-4 max-h-[230px] overflow-auto ",style:{scrollbarWidth:"thin"},children:Object.keys(e).map(n=>l.jsx(zN,{date:e[n],chargeStatus:n},n))})]}),l.jsxs("div",{className:"px-3 h-12 pr-4 flex justify-between items-center bg-surface100 rounded-base cursor-pointer",onClick:()=>r(!t),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Gv,{}),l.jsx("p",{className:"text-sm",children:"Track Payment"})]}),l.jsx(Yv,{})]})]})},Xm=ZN,qN=({charge:e})=>{const t=oi(),r=(e==null?void 0:e.price.currency)||"USD",n=new Intl.NumberFormat("en-US",{style:"currency",currency:r}),o=x.useMemo(()=>{var a;return((a=e==null?void 0:e.order)==null?void 0:a.partOrders.map(s=>{var c,u,d,f;return{id:(s==null?void 0:s.id)||0,image:s.productWithVariant.image,name:((c=s.productWithVariant)==null?void 0:c.name)||"",description:((u=s.productWithVariant)==null?void 0:u.description)||"",price:{quantity:s.quantity,amount:((d=s.productWithVariant)==null?void 0:d.price.amount)||0,currency:(f=s.productWithVariant)==null?void 0:f.price.currency}}}))||[]},[e]);return l.jsx("div",{className:"md:h-svh md:flex md:flex-col md:items-end md:w-full md:p-10 md:pl-4 md:pb-6",children:l.jsxs("div",{className:"md:max-w-[520px] md:w-full md:h-full",children:[l.jsx(ai,{expiresAt:e==null?void 0:e.expiresAt}),l.jsxs("div",{className:"md:w-full md:h-full md:flex md:flex-col px-4 md:px-0",children:[(e==null?void 0:e.name)&&l.jsxs("header",{className:"flex justify-between items-start mt-6",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"font-bold text-textPrimary text-lg",children:e==null?void 0:e.name}),(e==null?void 0:e.description)&&l.jsx("p",{className:"text-textSecondary text-sm",children:e==null?void 0:e.description})]}),l.jsxs(Se,{variant:"light",className:"gap-1",onClick:()=>{var a;return t(((a=e==null?void 0:e.order)==null?void 0:a.id)||"")},children:[l.jsx(Ea,{}),"Copy ID"]})]}),l.jsxs("div",{className:"flex-1",children:[!!o.length&&l.jsx("div",{className:"mt-6 w-full flex flex-col gap-4",children:o.map(a=>l.jsx(f1,{product:a},a.id))}),l.jsx(tc,{formatter:n,coupon:null,total:(e==null?void 0:e.price.amount)||0,discount:0,totalWithDiscount:(e==null?void 0:e.price.amount)||0})]}),l.jsxs("div",{children:[e&&l.jsx("div",{className:"mt-6",children:l.jsx(Xm,{timeline:e.timeline})}),l.jsx(Rn,{className:"hidden md:flex"})]})]})]})})},GN=qN,YN=({props:e})=>{const t=oi();return l.jsx("div",{className:"mt-1",children:l.jsxs("div",{className:"flex gap-2 mt-1",children:[l.jsx(In,{value:e.text,disabled:!0}),e.shownCopyButton&&l.jsx(Se,{className:"h-12 w-12",variant:"secondary",isSquare:!0,onClick:()=>t(e.text),children:l.jsx(Ea,{})})]})})},KN=({props:e})=>l.jsx(Se,{className:"w-full",size:"lg",onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),XN=({props:e})=>l.jsx("div",{className:"w-full flex justify-center py-4 bg-surface0 rounded-base",children:l.jsx("div",{className:"w-40 h-40 rounded-lg bg-surface100",children:l.jsx("img",{className:"w-full h-full object-contain",src:e.src,alt:""})})}),JN=({props:e})=>l.jsxs("div",{className:"p-3 rounded-base bg-surface0 text-xs",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"min-w-4 w-4",children:l.jsx(F2,{})}),l.jsx("p",{children:e.heading})]}),l.jsx("p",{className:"text-textSecondary mt-2",children:e.content})]}),QN=({props:e})=>{var t;return l.jsxs("div",{className:"pb-6 border-b border-borderDefault",children:[l.jsx("p",{className:"",children:e.title}),l.jsx("span",{className:"text-textSecondary text-sm",children:e.subTitle}),(t=e.children)==null?void 0:t.map((r,n)=>l.jsx(Jm,{block:r},n))]})},Jm=({block:e})=>{switch(e.type){case"Section":return l.jsx(QN,{...e});case"ReadOnlyTextInput":return l.jsx(YN,{...e});case"Notify":return l.jsx(JN,{...e});case"Button":return l.jsx(KN,{...e});case"Image":return l.jsx(XN,{...e});default:return null}},eR=Jm,tR=({isActive:e,setIsActive:t,price:r})=>{const[n,o]=x.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1});return l.jsx(Mn,{title:"Note",setIsActive:()=>{},isActive:e,disabledToClose:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(is,{checked:n.agreeToSendAsFF,onCheckedChange:a=>o({...n,agreeToSendAsFF:a})}),l.jsx("p",{children:"I agree to send the payment as friends & family"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(is,{checked:n.agreeToSend,onCheckedChange:a=>o({...n,agreeToSend:a})}),l.jsxs("p",{children:["I agree to send the payment of ",At(r)," ",r.currency]})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(is,{checked:n.agreeToNotAddNote,onCheckedChange:a=>o({...n,agreeToNotAddNote:a})}),l.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),l.jsx("div",{className:"py-3 px-4 text-textSecondary rounded-lg bg-surface0 mt-4",children:l.jsxs("p",{children:["Please note that you are required to send the exact payment of ",At(r)," ",r.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),l.jsxs("div",{className:"flex gap-3 md:w-[50%] md:ml-auto mt-8",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",children:"Cancel"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{variant:"primary",className:"w-full",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:()=>t(!1),children:"Continue to Payment"})})]})]})})},rR=tR,nR=P.object({link:P.coerce.string().url().min(1,{message:"The link field cannot be empty."})}),oR=({isActive:e,setIsActive:t,chargeId:r})=>{const n=Zo({defaultValues:{link:""}});return n.useValidate(o=>Ko(o,nR,n)),n.onSubmit(async o=>{await gx({url:o.values.link},r)&&mo(le,s=>[...s,{isActive:!0,title:"Success",message:"CashApp successfully verified",id:new Date().getTime(),status:!0}])}),l.jsx(Mn,{title:"CashApp Verify",setIsActive:t,isActive:e,children:l.jsx(Go,{store:n,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"flex-1",children:l.jsxs("div",{children:[l.jsx("p",{children:"Enter Cashapp Link"}),l.jsx(ka,{className:"mt-1",name:n.names.link,render:l.jsx(In,{placeholder:"https://cash.app/payments/0000"})}),l.jsx(ao,{className:"text-signalDanger",name:n.names.link})]})}),l.jsxs("div",{className:"flex gap-3 md:w-[50%] md:ml-auto mt-8",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onSubmit:o=>o.preventDefault(),children:"Cancel"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{variant:"primary",className:"w-full",children:"Verify"})})]})]})})})},aR=oR,sR={PAID:"Paid",PENDING:"Pending",EXPIRED:"Expired",CANCELLED:"Cancelled",NOT_PAID:"Not Paid"},iR={PAID:"Your payment has successfully been processed. Tap on the button below to be redirected back to our website.",PENDING:"Your payment is currently pending. We recommend checking back shortly for confirmation.",EXPIRED:"Your payment has expired due to the payment not being sent in time. If you already sent the payment, please contact us below.",CANCELLED:"You canceled the warrant. If there are any problems, please contact support",NOT_PAID:"Your payment has expired due to the payment not being sent in time. If you already sent the payment, please contact us below."},lR={PAID:l.jsx("div",{className:"p-3 rounded-base bg-surface0 text-successText",children:l.jsx(qs,{})}),PENDING:l.jsx("div",{className:"p-3 rounded-base bg-surface0",children:l.jsx(Cu,{})}),EXPIRED:l.jsx("div",{className:"p-3 rounded-base bg-surface0",children:l.jsx(Sn,{})}),CANCELLED:l.jsx("div",{className:"p-3 rounded-base bg-surface0",children:l.jsx(Sn,{})}),NOT_PAID:l.jsx("div",{className:"p-3 rounded-base bg-surface0",children:l.jsx(Sn,{})})},cR=({charge:e})=>{const t=e.status,r=Hr();return l.jsxs("div",{className:"flex flex-col items-center justify-center text-center gap-2",children:[lR[t],l.jsx("h2",{className:"font-bold",children:sR[t]}),l.jsx("p",{className:"text-sm text-textSecondary",children:iR[t]}),t==="PAID"?l.jsx("div",{className:"mt-3",children:l.jsxs(Se,{className:"gap-1 w-[256px]",onClick:()=>{var n;return r(`${le.get(ro).Order}/${(n=e.order)==null?void 0:n.id}`)},children:[l.jsx(ll,{}),"Pick up Order"]})}):l.jsxs("div",{className:"w-full flex gap-2 mt-3",children:[l.jsx("div",{className:"w-full",children:l.jsxs(Se,{variant:"secondary",className:"w-full gap-1",onClick:()=>{var n;return window.open(`https://${(n=le.get(_a))==null?void 0:n.info.domain}`)},children:[l.jsx(ll,{}),"Visit Website"]})}),l.jsx("div",{className:"w-full",children:l.jsxs(Se,{variant:"secondary",className:"w-full gap-1",children:[l.jsx($2,{}),"Contact Support"]})})]})]})},uR=cR,dR=()=>{const{id:e}=$s(),[t,r]=j0(),[n,o]=x.useState(!1),[a,s]=x.useState(),[c,u]=x.useState(!0),d=Hr(),f=x.useRef();return x.useEffect(()=>{const h=async(v,m=!1)=>{m||o(!0);const g=await kx(v);o(!1),s(g)},p=setInterval(()=>{e&&h(e,!0)},5e3);return e&&h(e),()=>{clearInterval(p)}},[]),x.useEffect(()=>{const h=t.get("redirectRoute");(a==null?void 0:a.status)==="PAID"&&a.redirectUrl&&!f.current&&window.open(a.redirectUrl,"_self"),(a==null?void 0:a.status)==="PAID"&&f.current&&d(f.current),h&&f&&(f.current=h,t.delete("redirectRoute"),r(t))},[a]),n?l.jsx(tr,{variant:"secondary"}):l.jsxs("div",{className:"min-h-svh bg-surface0 md:flex",children:[l.jsx(GN,{charge:a}),l.jsx("div",{className:"px-4 py-6 bg-surface100 mt-10 md:mt-0 md:w-full md:p-10 md:pr-4",children:l.jsxs("div",{className:"md:max-w-[520px]",children:[a&&(a==null?void 0:a.status)!=="NOT_PAID"&&l.jsx(uR,{charge:a}),a&&l.jsx("div",{className:`w-full ${a.status!=="NOT_PAID"&&"mt-5"}`,children:l.jsx(Km,{lastUpdate:a.expiresAt,email:a.customerForCharge.email,invoiceId:a.id,paymentType:a.gateway})}),(a==null?void 0:a.status)==="NOT_PAID"&&l.jsx("div",{className:"mt-6 flex flex-col gap-4 pt-6 border-t border-borderDefault ",children:a==null?void 0:a.displayPaymentInfo.map(h=>l.jsx(eR,{block:h}))}),l.jsx(Rn,{className:"mt-10 flex md:hidden"})]})}),(a==null?void 0:a.gateway)==="PayPalFF"&&l.jsx(rR,{price:a.price,isActive:c,setIsActive:u}),(a==null?void 0:a.gateway)==="Сashapp"&&l.jsx(aR,{isActive:c,setIsActive:u,chargeId:a.id})]})},fR=dR,hR=P.object({amount:P.coerce.number({message:"The balance field should be number."}).min(1,{message:"The balance field cannot be empty."}),gateway:P.string().min(1,{message:"Select pay method"})}),pR=({enterAnother:e,bonusPercent:t,currency:r})=>l.jsxs("div",{className:"text-sm text-brandDefault py-2 px-3 inline-flex bg-surface0 rounded-xl mt-3",children:[l.jsx(O2,{}),l.jsx("div",{className:"ml-2",children:e>0||Number.isNaN(e)?`Enter another ${At({amount:e,currency:r})} and receive an additional bonus of
|
|
144
144
|
${t}%`:`You will receive an additional bonus of
|
|
145
|
-
${t}%`})]}),mR=()=>{const[e]=ge(kn.dataAtom),[t]=ge(kn.pendingAtom),r=Zo({defaultValues:{amount:"",gateway:""}}),[n,o]=j0(),a=Hr(),s=Qr(Cl),[c]=ge(Cl.pendingAtom),[u]=ge(Vo.dataAtom),[d]=ge(Vo.pendingAtom),[f,h]=x.useState(),p=x.useRef();r.useSubmit(async()=>{const S=await s({price:{amount:m,currency:g},gateway:v,customerEmail:le.get(As)}),k=le.get(ro).Charge;a(`${k}/${S.data.chargeId}${p.current&&`?redirectRoute=${p.current}`}`)});const v=r.useValue(r.names.gateway),m=r.useValue(r.names.amount);if(r.useValidate(S=>Ko(S,hR,r)),x.useEffect(()=>{const S=n.get("redirectRoute");S&&p&&(p.current=S,n.delete("redirectRoute"),o(n))},[n]),!u||!(u!=null&&u.isEnabled))return null;const{topUpSettings:{currency:g,topUpBonusEnabled:b,bonusPercent:y,minimumTopUpForBonus:C}}=u,_=Number(m),w=b&&!Number.isNaN(_)?C-Number(_):C;return t||d?l.jsx(tr,{variant:"secondary"}):l.jsx("div",{className:"md:flex md:justify-center",children:l.jsxs("div",{className:"min-h-svh flex flex-col md:max-w-[520px] md:mt-5",children:[l.jsx(ai,{className:"md:hidden"}),l.jsx(Go,{store:r,children:l.jsxs("div",{className:"flex-1 px-4 mt-6 pb-4",children:[l.jsx("h1",{className:"text-lg font-bold",children:"Top Up Account Balance"}),l.jsxs("div",{className:"mt-2.5",children:[l.jsx(Js,{className:"text-sm text-textSecondary",name:r.names.amount,children:"Enter Amount"}),l.jsx(ka,{className:"mt-1",name:r.names.amount,render:l.jsx(In,{placeholder:"0",icon:l.jsx(B2,{}),type:"number"})}),l.jsx(ao,{className:"text-signalDanger",name:r.names.amount})]}),b&&w!==void 0&&l.jsx(pR,{enterAnother:w,bonusPercent:y,currency:g}),l.jsx("div",{className:"grid grid-cols-2 gap-3 pt-6 border-t border-borderDefault mt-6",children:e==null?void 0:e.map(S=>S.paymentMethods.map(k=>l.jsx(p1,{align:"column",paymentMethod:k,gatewayLogoCfId:S.logoCfImageId,gatewayDisplayName:S.displayName,gateway:S.name,poweredByLogoCfId:S.poweredByImageCfImageId,selected:v===S.name&&k===f,onSelect:()=>{r.setValue(r.names.gateway,S.name),h(k)}})))}),l.jsx(ao,{className:"text-signalDanger mb-4",name:r.names.gateway}),l.jsxs("div",{className:"mt-10",children:[l.jsx(Aa,{render:l.jsx(Se,{size:"lg",className:"w-full",isLoading:!!c,children:"Continue to Checkout"})}),l.jsx(Dm,{}),l.jsx(Om,{})]})]})}),l.jsx("div",{className:"p-4 pt-0",children:l.jsx(Rn,{className:"md:hidden"})})]})})},gR=mR,vR={NEW:"New",PENDING:"Order Pending",EXPIRED:"Order Expired",CANCELLED:"Order Canceled",FAILED:"Order Failed",FULL_DELIVERY_FAILURE:"Delivery Failure",PARTIALLY_DELIVERED:"Partial Delivery Failure",REFUNDED:"Order Refunded",COMPLETED:"Order Completed"},xR={NEW:"New",PENDING:"Your order is currently pending. We recommend checking back shortly for confirmation.",EXPIRED:"Your order has expired due to the payment not being sent in time. If you already sent the payment, please contact us below.",CANCELLED:"You canceled the warrant. If there are any problems, please contact support",FAILED:"Order Failed",FULL_DELIVERY_FAILURE:"Your payment was successful but the product is currently out of stock. Please contact us below to get this sorted.",PARTIALLY_DELIVERED:"Your payment was successful but some products were out stock. Please contact us below to get this sorted.",REFUNDED:"Order Refunded",COMPLETED:"Your order has successfully been processed. View your products below or check your email for additional information."},bR={COMPLETED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(qs,{})}),PENDING:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Cu,{})}),NEW:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Cu,{})}),EXPIRED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Sn,{})}),CANCELLED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Sn,{})}),FAILED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Sn,{})}),FULL_DELIVERY_FAILURE:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(yu,{})}),PARTIALLY_DELIVERED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Lf,{})}),REFUNDED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Lf,{})})},yR=({orderStatus:e})=>l.jsxs("div",{className:"flex flex-col items-center justify-center text-center gap-2",children:[bR[e],l.jsx("h2",{className:"font-bold",children:vR[e]}),l.jsx("p",{className:"text-sm text-textSecondary",children:xR[e]}),l.jsxs("div",{className:"w-full flex gap-2 mt-3",children:[l.jsx("div",{className:"w-full",children:l.jsxs(Se,{variant:"light",className:"w-full gap-1",onClick:()=>{var t;return window.open(`https://${(t=le.get(_a))==null?void 0:t.info.domain}`)},children:[l.jsx(ll,{}),"Visit Website"]})}),l.jsx("div",{className:"w-full",children:l.jsxs(Se,{variant:"light",className:"w-full gap-1",children:[l.jsx($2,{}),"Contact Support"]})})]})]}),CR=yR,wR=({setRating:e,rating:t,disabled:r})=>{const[n,o]=x.useState(0),a=c=>{!r&&o(+c.currentTarget.id)},s=c=>{!r&&e(c)};return l.jsx("div",{className:"flex gap-[6px] cursor-pointer",onMouseLeave:()=>o(0),children:[1,2,3,4,5].map(c=>t>=c||n>=c?l.jsx("div",{id:c.toString(),className:"w-5",onMouseEnter:a,onClick:()=>s(c),children:l.jsx(xv,{},c)}):l.jsx("div",{id:c.toString(),className:"w-5 text-textSecondary",onMouseEnter:a,onClick:()=>s(c),children:l.jsx(Cd,{})},c))})},SR=wR,ER=({isActive:e,setIsActive:t,onSubmit:r,isLoading:n})=>{const[o,a]=x.useState("");return l.jsx(Mn,{title:"Review Description",isActive:e,setIsActive:t,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-textSecondary text-sm",children:"Describe your review in detail below:"}),l.jsx(h1,{className:"mt-2",maxLength:150,placeholder:"Great product and fast checkout...",value:o,onChange:s=>a(s.target.value)})]}),l.jsxs("div",{className:"flex gap-3 md:w-[40%] md:ml-auto mt-8",children:[l.jsx("div",{className:"w-full",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:()=>t(!1),children:"Cancel"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{variant:"primary",className:"w-full",disabled:!o,onClick:()=>r(o),isLoading:n,children:"Submit"})})]})]})})},jR=ER,_R=({review:e,orderId:t})=>{const[r,n]=x.useState((e==null?void 0:e.rating)||0),[o,a]=x.useState(!1),[,s]=ge(mo),[c,u]=x.useState(!1),d=async f=>{e&&"accessToken"in e&&(u(!0),await Ex({comment:f,rating:r},t,e.accessToken),u(!1),s(h=>[...h,{isActive:!0,status:!0,id:new Date().getTime(),message:"Review left successfully"}]),a(!1))};return x.useEffect(()=>{e&&r&&"accessToken"in e&&!e.rating&&a(!0)},[r]),e?e.rating&&"accessToken"in e?l.jsxs("div",{className:"p-4 flex justify-between rounded-base bg-surface100 font-bold",children:["You left a ",e.rating," star rating"]}):l.jsxs("div",{className:"p-4 flex justify-between rounded-base bg-surface100",children:[l.jsx("p",{className:"text-base font-bold",children:"Leave a review"}),l.jsx(SR,{rating:r,setRating:n,disabled:!!e.rating||!("accessToken"in e)}),l.jsx(jR,{isActive:o,setIsActive:a,onSubmit:d,isLoading:c})]}):null},TR=_R,PR=()=>{var h,p,v;const{id:e,accessToken:t}=$s(),r=Hr(),[n,o]=x.useState(),[a,s]=x.useState(!1),c=oi(),u=((h=n==null?void 0:n.rawPrice)==null?void 0:h.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:u}),f=x.useMemo(()=>(n==null?void 0:n.partOrders.map(m=>{var g,b,y,C;return{id:(m==null?void 0:m.id)||0,image:m.productWithVariant.image,name:((g=m.productWithVariant)==null?void 0:g.name)||"",description:((b=m.productWithVariant)==null?void 0:b.description)||"",price:{quantity:m.quantity,amount:((y=m.productWithVariant)==null?void 0:y.price.amount)||0,currency:(C=m.productWithVariant)==null?void 0:C.price.currency},deliveryCategories:"deliveryCategories"in m?m.deliveryCategories:void 0,customerNote:m.customerNote}}))||[],[n]);return x.useEffect(()=>{const m=async(b,y=!1)=>{y||s(!0);const C=await(t?Rx(`${b}/${t}`):Nx(b));s(!1),C.charge.status==="NOT_PAID"&&r(`${le.get(ro).Charge}/${C.charge.id}`),o(C)};e&&m(e);const g=setInterval(()=>{e&&m(e,!0)},5e3);return()=>{clearInterval(g)}},[]),a?l.jsx(tr,{variant:"secondary"}):l.jsxs("div",{className:"min-h-svh bg-surface0 md:flex",children:[l.jsx("div",{className:"md:h-svh md:flex md:flex-col md:items-end md:w-full md:p-10 md:pl-4 md:pb-6",children:l.jsxs("div",{className:"md:max-w-[520px] md:w-full md:h-full",children:[l.jsx(ai,{}),n&&l.jsxs("div",{className:"pt-8 md:pt-0 md:w-full md:h-full md:flex md:flex-col px-4 md:px-0",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx(CR,{orderStatus:n.status}),l.jsx("div",{className:"mt-4",children:l.jsx(Km,{lastUpdate:n.createdAt,paymentType:n.charge.gateway,email:n.charge.customerForCharge.email,invoiceId:n.id})}),l.jsx("div",{className:"mt-6",children:l.jsx(TR,{orderId:n.id,review:n.review})})]}),l.jsxs("div",{children:[n.charge&&l.jsx("div",{className:"mt-6",children:l.jsx(Xm,{timeline:n.charge.timeline})}),l.jsx(Rn,{className:"hidden md:flex"})]})]})]})}),l.jsx("div",{className:"px-4 py-6 bg-surface100 mt-10 md:mt-0 md:w-full md:p-10 md:pr-4",children:l.jsxs("div",{className:"md:max-w-[520px]",children:[(n==null?void 0:n.charge.name)&&l.jsxs("header",{className:"flex justify-between items-start mt-6",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"font-bold text-textPrimary text-lg",children:n.charge.name}),n.charge.description&&l.jsx("p",{className:"text-textSecondary text-sm",children:n.charge.description})]}),l.jsxs(Se,{variant:"secondary",className:"gap-1 text-textSecondary",onClick:()=>c((n==null?void 0:n.id)||""),children:[l.jsx(Ea,{}),"Copy ID"]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"mt-6 w-full flex flex-col gap-4",children:f.map(m=>l.jsx(f1,{product:m,isOrder:!0},m.id))}),l.jsx(tc,{className:"bg-surface0",formatter:d,coupon:null,total:((p=n==null?void 0:n.charge)==null?void 0:p.price.amount)||0,discount:0,totalWithDiscount:((v=n==null?void 0:n.charge)==null?void 0:v.price.amount)||0}),l.jsx(Rn,{className:"flex md:hidden"})]})]})})]})},NR=PR,RR=({subscription:e})=>l.jsxs("div",{className:"p-6 mt-3 bg-surface100 rounded-lg",children:[l.jsxs("div",{className:"w-full flex items-start gap-3",children:[l.jsx("div",{className:"min-w-12 h-12 flex items-center justify-center bg-surface0 rounded-base overflow-hidden",children:e!=null&&e.image?l.jsx("img",{className:"w-full h-full object-contain",src:kr(e.image.cfId),alt:e==null?void 0:e.name}):l.jsx($l,{})}),l.jsxs("div",{className:"text-base w-full",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"font-bold overflow-ellipsis overflow-hidden whitespace-nowrap max-w-full",children:e.name})}),l.jsxs("p",{className:"text-textSecondary ",children:[At(e.price)," / ",e.recurringInterval]})]}),l.jsx("div",{className:"min-w-fit",children:l.jsx(Ym,{status:e.status})})]}),e.description&&l.jsx("p",{className:"mt-4 text-textSecondary",children:e.description})]}),kR=RR,AR=({onCheckedChange:e,checked:t,...r})=>{var o,a;const n=x.useRef(null);return l.jsxs("label",{className:On("w-5 h-5 flex items-center justify-center border border-borderHover rounded-[50%] transition-all cursor-pointer",((o=n.current)==null?void 0:o.checked)&&"border-brandDefault bg-brandLight"),onClick:()=>{var s;return(s=n.current)==null?void 0:s.click()},children:[l.jsx("input",{className:"appearance-none",type:"radio",...r,ref:n}),((a=n.current)==null?void 0:a.checked)&&l.jsx("span",{className:"w-2 h-2 bg-brandDefault rounded-[50%]"})]})},ts=AR,LR=P.object({reason:P.string().min(1,{message:"The reason field cannot be empty."}),otherReason:P.string().optional()}),DR={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},OR=({isActive:e,setIsActive:t,id:r,accessToken:n})=>{const o=Zo({defaultValues:{reason:"",otherReason:""}}),[a,s]=x.useState(0),[c,u]=x.useState(!1);o.useValidate(f=>Ko(f,LR,o));const d=o.useValue("reason");return o.useSubmit(async f=>{u(!0);const h=await Tx(r,n,{reason:f.values.reason==="Other reason"?f.values.otherReason:f.values.reason});u(!1),h&&(mo(le,p=>[...p,{isActive:!0,title:"Success",message:"Subscription successfully canceled",id:new Date().getTime(),status:!0}]),s(2))}),x.useEffect(()=>{e||s(0)},[e]),l.jsx(Mn,{title:DR[a]||"",setIsActive:t,isActive:e,children:l.jsxs(Go,{store:o,children:[a===0&&l.jsxs("div",{className:"h-full flex flex-col -mt-2",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-textSecondary",children:"Before you cancel your subscription can you tell us why?"}),l.jsxs(vy,{className:"flex flex-col gap-3 mt-4",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Ya,{value:"Found another company",name:o.names.reason,render:l.jsx(ts,{})}),l.jsx("p",{children:"Found another company"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Ya,{value:"Expensive",name:o.names.reason,render:l.jsx(ts,{})}),l.jsx("p",{children:"Expensive"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Ya,{value:"Technical problems",name:o.names.reason,render:l.jsx(ts,{})}),l.jsx("p",{children:"Technical problems"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Ya,{value:"Support problems",name:o.names.reason,render:l.jsx(ts,{})}),l.jsx("p",{children:"Support problems"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Ya,{value:"Other reason",name:o.names.reason,render:l.jsx(ts,{})}),l.jsx("p",{children:"Other reason"})]}),d==="Other reason"&&l.jsx(ka,{name:o.names.otherReason,placeholder:"Describe the reason...",render:l.jsx(h1,{maxLength:150})})]}),l.jsx(ao,{className:"text-signalDanger mt-2",name:o.names.reason})]}),l.jsxs("div",{className:"flex gap-3 md:w-fit md:ml-auto mt-8",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:"Stay with us"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"primary",className:"w-full",onClick:f=>{f.preventDefault(),s(1)},children:"Continue"})})]})]}),a===1&&l.jsxs("div",{className:"h-full flex flex-col -mt-2",children:[l.jsx("div",{className:"flex-1 ",children:l.jsxs("p",{className:"text-textSecondary",children:["You’ll lose access to all of the features and content available within this subscription."," "]})}),l.jsxs("div",{className:"flex gap-3 md:w-fit md:ml-auto mt-8",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:"Stay with us"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Aa,{render:l.jsx(Se,{variant:"primary",className:"w-full",isLoading:c,children:"Cancel it anyway"})})})]})]}),a===2&&l.jsxs("div",{className:"h-full flex flex-col -mt-2",children:[l.jsxs("div",{className:"flex-1 flex items-center justify-center flex-col text-center",children:[l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface0",children:l.jsx(qs,{})}),l.jsx("p",{className:"font-bold mt-4",children:"Subscription Cancelled"}),l.jsx("p",{className:"text-textSecondary mt-2 max-w-[368px]",children:"You’ll lose access to all of the features and content available within this subscription."})]}),l.jsx("div",{className:"flex gap-3 md:w-fit md:ml-auto mt-8",children:l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:"Close"})})})]})]})})},MR=OR,IR=({subscription:e,id:t,accessToken:r})=>{const[n,o]=x.useState(!1);return l.jsxs("div",{className:"p-6 w-full flex items-center gap-3 border border-borderDefault rounded-lg",children:[l.jsx("div",{className:"min-w-12 h-12 flex items-center justify-center bg-surface0 rounded-base overflow-hidden",children:e!=null&&e.image?l.jsx("img",{className:"w-full h-full object-contain",src:kr(e.image.cfId),alt:e==null?void 0:e.name}):l.jsx($l,{})}),l.jsxs("div",{className:"text-base w-full max-w-[85%]",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"font-bold ",children:e.name})}),l.jsxs("p",{className:"text-textSecondary overflow-ellipsis overflow-hidden whitespace-nowrap max-w-full",children:[At(e.price)," / ",e.recurringInterval]})]}),l.jsx(Se,{variant:"link",onClick:()=>o(!0),children:"Cancel"}),l.jsx(MR,{accessToken:r,id:t,isActive:n,setIsActive:o})]})},FR=IR,BR=P.object({isFixed:P.boolean(),discount:P.number(),name:P.string(),initialCouponDurationForSubscriptions:P.number().optional(),currentCouponDurationForSubscriptions:P.number().optional()}),HR=Gm.extend({productDescription:P.string().optional(),productImage:P.object({id:P.number(),cfId:P.string()}).optional(),availableGateways:P.array(P.string()),gatewayInfo:P.object({card:P.object({brand:P.string(),last4:P.string(),expires:P.string()}).optional()}).optional(),coupon:BR.optional(),variantId:P.number(),pricingPlanExists:P.boolean()}),Qm=P.object({amount:P.number(),currency:P.string()}),VR=P.object({price:Qm,recurringIntervalDays:P.number()}),$R=P.object({name:P.string(),required:P.boolean(),placeholder:P.string(),defaultValue:P.string(),regex:P.string(),type:P.string()}),UR=P.object({id:P.number(),name:P.string(),description:P.string().optional(),shortDescription:P.string().optional(),price:Qm,chargeTypes:P.array(P.string()),subscriptionSettings:VR,quantity:P.object({restrictions:P.any()}),deliveryTime:P.number(),gateways:P.array(P.object({name:P.string()})),customFields:P.array($R),warranty:P.object({text:P.string(),durationMilliseconds:P.number()}).optional(),discordSettings:P.object({isEnabled:P.boolean(),isRequired:P.boolean()})}),WR=P.object({id:P.string(),name:P.string(),productVariants:P.array(P.object({data:UR,position:P.number(),isHighlighted:P.boolean()})),position:P.number()}),zR=P.object({id:P.string(),name:P.string(),description:P.string(),types:P.array(WR)}),ZR=P.object({data:zR}),Yn=Wt(async(e,{id:t,accessToken:r})=>Ar(await jx(t,r),HR)).pipe(xr(null)),Uc=Wt(async(e,{id:t,accessToken:r})=>Ar(await _x(t,r),ZR)).pipe(xr(null)),qR=({color:e,percent:t,disablePercentLabel:r})=>l.jsxs("div",{className:"flex gap-1 items-center text-s",children:[!r&&l.jsxs("p",{children:[t,"%"]}),l.jsx("div",{className:"h-[4px] w-full flex items-center flex-1 bg-surface0 rounded-[100px]",children:l.jsx("div",{style:{width:`${t}%`,background:e},className:" h-[4px] bg-textPrimary rounded-[100px]"})})]}),e5=qR,GR=({coupon:e,currency:t})=>l.jsxs("div",{className:"flex items-center gap-3 p-6 border border-borderDefault rounded-lg",children:[l.jsx("div",{className:"min-w-12 h-12 flex items-center justify-center rounded-base bg-successBackground text-successText",children:l.jsx(wd,{})}),l.jsxs("div",{className:"w-full",children:[l.jsxs("p",{className:"font-bold",children:[e.name,","," ",e.isFixed?At({amount:e.discount,currency:t}):e.discount+"%"," ","discount"]}),l.jsx("div",{className:"mt-2 w-full",children:l.jsx(e5,{color:"#C2C2C2",percent:e.initialCouponDurationForSubscriptions?Jv(e.initialCouponDurationForSubscriptions,e.currentCouponDurationForSubscriptions||1):100,disablePercentLabel:!0})}),l.jsx("p",{className:"mt-1 text-sm text-textSecondary",children:"Forever discount code"})]})]}),YR=GR,KR=e=>{const{totalSteps:t,step:r,onStepChange:n,label:o}=e,[a,s]=x.useState(r),c=a===1?0:(a-1)/(t-1)*100,u=d=>{s(d),n(d)};return l.jsxs("div",{className:"flex flex-col items-center w-full space-y-4 h-[calc(fit-content + 50px)]",children:[o&&l.jsx("div",{className:"text-textSecondary mb-2 text-left w-full",children:o}),l.jsxs("div",{className:"relative w-full h-1 bg-gray-200 rounded-lg",children:[l.jsx("div",{className:"absolute top-0 left-0 h-1 bg-red-500 rounded-lg transition-all duration-300 ease-in-out",style:{width:`${Math.ceil(c)}%`}}),l.jsx("div",{className:"absolute flex justify-between items-center w-full h-full",children:[...Array(t)].map((d,f)=>{const h=f+1,p=h<=a,v=h===a;return l.jsxs("div",{className:"relative flex items-center justify-center cursor-pointer",onClick:()=>u(h),children:[l.jsx("div",{className:`${v?"w-4 h-4":"w-3 h-3"} rounded-3xl transition-colors duration-300 ${p?"bg-red-500":"bg-gray-300"}`}),v&&l.jsxs("div",{className:"absolute top-8 transform text-sm text-white bg-black py-1 px-3 rounded-lg flex items-center gap-1",style:{transform:`translateX(calc(50% - ${c<99?"40px":"70px"}))`},children:[l.jsx("span",{children:a}),l.jsx("span",{children:a===1?"month":"months"})]})]},h)})})]})]})},XR=KR,JR=e=>{const{setIsLoading:t,dialogStore:r}=e,{id:n}=$s(),o=Hr(),[a]=ge(Yn.dataAtom),[,s]=ge(mo),{setPaymentMethod:c,setGateway:u,cart:d}=ni();function f(){r.hide()}async function h(){if(t(!0),n){const{data:p}=await Px(n,d.gateway);p.isReconnectPaymentNeeded?o(`/charges/${p.chargeId}`):s(v=>[...v,{title:"Success",isActive:!0,status:!0,id:new Date().getTime(),message:"Your action has been successfully completed"}])}else s(p=>[...p,{title:"Error",isActive:!0,status:!1,id:new Date().getTime(),message:"Your action has been failed. Try again!"}]);t(!1)}return l.jsxs(l.Fragment,{children:[(a==null?void 0:a.availableGateways)&&l.jsx(Fm,{possibleGateways:{availableGateways:a.availableGateways,requiresSignInGateways:a.availableGateways},setGateway:u,setPaymentMethod:c,totalAndDiscount:{total:(a==null?void 0:a.price.amount)||0,totalWithDiscount:a==null?void 0:a.price.amount},onSignInClick:()=>o("/customer-dash")}),l.jsxs("div",{className:"flex gap-3 justify-end md:w-[50%] md:ml-auto mt-8",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-fit",onClick:f,children:"Cancel"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:d.gateway?"primary":"secondary",className:"w-fit",disabled:!d.gateway,onClick:h,children:"Continue"})})]})]})},QR=({setIsLoading:e})=>{const{cart:t}=ni(),r=Hr(),[n]=ge(Yn.dataAtom),[o]=ge(kn.dataAtom),a=Qr(kn);x.useEffect(()=>{a([])},[]);const s=La({defaultOpen:!1});function c(){s.show()}return console.log(o),l.jsxs("div",{className:"p-6 mt-6 flex items-center justify-between border border-borderDefault rounded-lg",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-bold",children:"Active Payment Method"}),t.gateway?l.jsx("div",{className:"flex items-center gap-3 mt-1",children:t.gateway==="Balance"?l.jsx(Im,{gateway:t.gateway,gatewayDisplayName:t.gateway,total:(n==null?void 0:n.price.amount)||0,onSignInClick:()=>r("/customer-dash")}):o==null?void 0:o.filter(u=>u.name===t.gateway).map(u=>u.paymentMethods.filter(d=>d===t.paymentMethod).map(d=>l.jsx(p1,{align:"column",paymentMethod:d,gatewayLogoCfId:u.logoCfImageId,gatewayDisplayName:u.displayName,gateway:u.name,poweredByLogoCfId:u.poweredByImageCfImageId})))}):l.jsx("span",{children:"Payment method is not set"})]}),l.jsx(Se,{variant:"link",onClick:c,children:t.gateway?"Change":"Manage"}),l.jsx(oc,{store:s,title:"Choose new Payment Method",children:l.jsx(JR,{setIsLoading:e,dialogStore:s})})]})},y1=QR,ek=({description:e,title:t})=>l.jsxs("div",{className:"h-full bg-surface100 flex flex-col justify-center items-center",children:[l.jsx("div",{children:l.jsx(tr,{variant:"secondary"})}),l.jsx("h1",{className:"mt-4 text-xl font-bold",children:t}),l.jsx("p",{className:"mt-2 text-base text-textSecondary max-w-[456px] text-center",children:e})]}),t5=ek,tk=({dialogStore:e})=>{const{getTotalAndDiscount:t,cart:r,coupon:n}=ni(),[o]=ge(Yn.dataAtom),[a,s]=x.useState(1),[c,u]=x.useState(!1),d=x.useMemo(()=>t(),[n,r]),f=x.useMemo(()=>d.totalWithDiscount?d.total-d.totalWithDiscount:0,[d]);if(c)return l.jsx(t5,{title:"Processing Payment",description:"This payment is currently being processed. If you're here, it simply means that the payment was created but not complete."});const h=(o==null?void 0:o.price.currency)||"USD",p=new Intl.NumberFormat("en-US",{style:"currency",currency:h});function v(){u(!0),u(!1)}return l.jsxs("div",{className:"p-3",children:[l.jsx(XR,{step:a,totalSteps:12,onStepChange:s,label:"How long would you like to extend your subscription for?"}),l.jsx(y1,{setIsLoading:u}),l.jsx(tc,{className:"bg-surface0",formatter:p,coupon:n,total:d.total,discount:f,totalWithDiscount:d.totalWithDiscount}),l.jsxs("div",{className:"flex gap-3 items-center justify-end",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:()=>e.hide(),children:"Cancel"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"primary",className:"w-full",onClick:v,children:"Extend"})})]})]})},rk=()=>{const[e]=ge(Yn.dataAtom),[t,r]=cl((e==null?void 0:e.activeTo)||""),n=La({defaultOpen:!1});return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between gap-3 p-6 border border-borderDefault rounded-lg",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-bold",children:"Expiration Date"}),l.jsxs("p",{className:"text-textSecondary",children:[t," at ",r]})]}),l.jsx(Se,{variant:"link",onClick:()=>n.show(),children:"Extend"})]}),l.jsx(oc,{store:n,title:"Extend Subscription",children:l.jsx(tk,{dialogStore:n})})]})},nk=rk,ok=({isActive:e,setIsActive:t,selectedVariant:r})=>{if(!r)return null;const[n,o]=x.useState(!1),a=()=>{console.log("Selected Variant:",r),t(!1)},s=r.subscriptionSettings.price.amount,c=r.subscriptionSettings.recurringIntervalDays===365?s*.2:0,u=s-c;return l.jsx(Mn,{className:"md:w-[720px]",title:"Choose upgrade method",setIsActive:t,isActive:e,children:l.jsxs("div",{className:"h-full flex flex-col -mt-2",children:[l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"w-full flex mt-6 rounded-base bg-surface0 border border-borderDefault p-1",children:[l.jsx("div",{className:"w-full text-center cursor-pointer rounded-sm p-[6px] transition-all text-textSecondary text-sm hover:bg-surface100 hover:text-textPrimary",children:"Upgrade now"}),l.jsx("div",{className:"w-full flex gap-2 justify-center items-center text-center cursor-pointer rounded-sm p-[6px] transition-all text-textSecondary text-sm hover:bg-surface100 hover:text-textPrimary",children:"Upgrade after Sep 11"})]}),l.jsxs("div",{className:"mt-4 p-4 border rounded-lg bg-surface100",children:[l.jsx("h2",{className:"text-xl font-bold",children:r.name}),l.jsx("p",{className:"text-textSecondary",children:r.description}),l.jsxs("p",{className:"mt-2 font-semibold",children:["$",r.subscriptionSettings.price.amount.toFixed(2)," /"," ",r.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),l.jsx(y1,{setIsLoading:o}),l.jsxs("div",{className:"mt-6 py-5 px-6 w-full flex flex-col gap-3 bg-surface0 rounded-lg ",children:[l.jsxs("div",{className:"w-full flex items-center justify-between gap-3 text-base",children:[l.jsx("p",{className:"text-textSecondary",children:"Subtotal"}),l.jsxs("p",{children:["$",s.toFixed(2)]})]}),c>0&&l.jsxs("div",{className:"w-full flex items-center justify-between gap-3 text-base",children:[l.jsx("p",{className:"text-textSecondary",children:"20% discount for prepaid"}),l.jsxs("p",{children:["-$",c.toFixed(2)]})]}),l.jsxs("div",{className:"w-full flex items-center justify-between gap-3 text-base",children:[l.jsx("p",{className:"font-semibold",children:"Total Due"}),l.jsxs("p",{className:"font-semibold",children:["$",u.toFixed(2)]})]})]})]}),l.jsxs("div",{className:"flex gap-3 md:w-fit md:ml-auto mt-4",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:()=>t(!1),children:"Stay with us"})}),l.jsx("div",{className:"w-fit",children:l.jsxs(Se,{variant:"primary",className:"w-full",onClick:a,children:["Upgrade for $",u.toFixed(2)]})})]})]})})},ak=ok,sk=({variant:e,isSelected:t,onSelect:r,isCurrent:n})=>{const o=e.subscriptionSettings.recurringIntervalDays===30?"month":e.subscriptionSettings.recurringIntervalDays===365?"year":"period",a=e.subscriptionSettings.price.amount.toFixed(2),s=e.subscriptionSettings.recurringIntervalDays,c=10;return l.jsxs("div",{className:"w-full p-4 cursor-pointer rounded-lg flex flex-col items-start",onClick:r,children:[l.jsxs("h2",{className:"text-xxl flex items-center gap-2 font-bold",children:["$",a," ",l.jsxs("span",{className:"text-base font-normal text-textSecondary",children:[" / ",o]})]}),l.jsx("h3",{className:"font-medium mt-4 flex-auto text-xl",children:e.name}),e.description&&l.jsx("p",{className:"mt-1 text-textSecondary",children:e.description}),n?l.jsxs("div",{className:"w-full flex items-center justify-center gap-2 mt-6 p-3 text-sm text-brandDefault border border-borderDefault rounded-base",children:[l.jsx(qs,{}),"Your current Plan"]}):l.jsx(Se,{variant:"secondary",className:"w-full mt-6 p-3",size:"xl",children:"Select"}),n&&l.jsxs("div",{className:"w-full mt-3",children:[l.jsx(e5,{percent:c/s*100,disablePercentLabel:!0}),l.jsxs("p",{className:"text-textSecondary text-sm mt-2",children:["Used: ",c," of ",s," days"]})]})]})},ik=({isActive:e,setIsActive:t})=>{const r=Qr(Uc),[n,o]=x.useState(null),[a,s]=x.useState(null),[c,u]=x.useState(!1),[d,f]=x.useState(null),[h]=ge(Yn.dataAtom),{id:p,accessToken:v}=$s();x.useEffect(()=>{p&&v&&r({id:p,accessToken:v})},[p,v,r]);const[m]=ge(Uc.dataAtom),[g]=ge(Uc.pendingAtom);x.useEffect(()=>{var C;if(m!=null&&m.data.types[0]){const _=(C=m.data.types.flatMap(w=>w.productVariants).find(w=>w.data.id===(h==null?void 0:h.variantId)))==null?void 0:C.data;_&&(f(_),s(_))}},[m,h]),x.useEffect(()=>{m!=null&&m.data.types[0]&&o(m==null?void 0:m.data.types[0])},[m==null?void 0:m.data.types]);const b=C=>{o(C),s(null)},y=C=>{s(C),u(!0)};return l.jsxs(Mn,{isActive:e,setIsActive:t,title:"",withoutHeader:!0,full:!0,children:[l.jsxs("div",{className:"h-full flex flex-col justify-center items-center ",children:[l.jsx("h1",{className:"font-bold text-xxl",children:"Change Plan"}),l.jsx("p",{className:"max-w-[800px] text-textSecondary mt-3 text-center",children:m==null?void 0:m.data.description}),l.jsx("div",{className:"max-w-[376px] w-full flex mt-6 rounded-base bg-surface0 border border-borderDefault p-1",children:m==null?void 0:m.data.types.map(C=>l.jsxs("div",{className:`w-full text-center cursor-pointer rounded-sm p-[6px] transition-all text-sm ${(n==null?void 0:n.id)===C.id?"bg-surface100 text-textPrimary":"text-textSecondary hover:bg-surface100 hover:text-textPrimary"}`,onClick:()=>b(C),children:[C.name,C.name==="Yearly"&&l.jsx("span",{className:"border border-brandDefault text-brandDefault py-[2px] px-2 rounded-sm text-xs ml-1",children:"Save %"})]},C.id))}),n&&l.jsx("div",{className:"py-2 px-6 mt-6 w-full flex gap-4 border border-borderDefault rounded-[32px]",children:n.productVariants.map(C=>l.jsx(sk,{variant:C.data,isSelected:(a==null?void 0:a.id)===C.data.id,isCurrent:(d==null?void 0:d.id)===C.data.id,onSelect:()=>y(C.data)},C.data.id))}),g&&l.jsx("p",{children:"Loading..."})]}),a&&l.jsx(ak,{isActive:c,setIsActive:u,selectedVariant:a})]})},lk=ik,ck=()=>{const{id:e,accessToken:t}=$s(),[r]=ge(Yn.dataAtom),[n]=ge(Yn.pendingAtom),o=Qr(Yn),[a,s]=x.useState(!1),[c,u]=x.useState(!1);return x.useEffect(()=>{e&&t&&o({id:e,accessToken:t})},[]),n?l.jsx(tr,{variant:"secondary"}):c?l.jsx(t5,{title:"Processing Payment",description:"This payment is currently being processed. If you're here, it simply means that the payment was created but not complete."}):l.jsxs("div",{className:"min-h-svh bg-surface0 md:flex",children:[l.jsx(lk,{isActive:a,setIsActive:s}),l.jsx("div",{className:"md:h-svh md:flex md:flex-col md:items-end md:w-full md:p-10 md:pl-4 md:pb-6",children:l.jsxs("div",{className:"md:max-w-[520px] md:w-full md:h-full",children:[l.jsx(ai,{}),l.jsxs("div",{className:"pt-8 md:w-full md:h-full md:flex md:flex-col px-4 md:px-0",children:[r&&l.jsxs("div",{className:"flex-1",children:[l.jsx("h1",{className:"text-lg font-bold",children:"Your Subscription"}),l.jsx(kR,{subscription:{price:r.price,name:r.productName,description:r.productDescription,status:r.status,image:r.productImage,recurringInterval:r.recurringInterval}}),l.jsxs("div",{className:"flex mt-3 gap-3",children:[r.pricingPlanExists&&l.jsx("div",{className:"w-full",children:l.jsx(Se,{size:"lg",className:"w-full",onClick:()=>s(!0),children:"Change Plan"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{variant:"danger",size:"lg",className:"w-full",children:"Cancel Plan"})})]})]}),l.jsx(Rn,{className:"hidden md:flex"})]})]})}),l.jsx("div",{className:"px-4 py-6 bg-surface100 mt-10 md:mt-0 md:w-full md:p-10 md:pr-4",children:l.jsxs("div",{className:"md:max-w-[520px]",children:[l.jsx("h1",{className:"font-bold text-lg",children:"Details"}),l.jsxs("div",{className:"mt-3 flex flex-col gap-3",children:[(r==null?void 0:r.coupon)&&l.jsx(YR,{coupon:r.coupon,currency:r.price.currency||"USD"}),r&&l.jsx(FR,{id:e||"",accessToken:t||"",subscription:{price:r.price,name:r.productName,description:r.productDescription,status:r.status,image:r.productImage,recurringInterval:r.recurringInterval}}),l.jsx(y1,{setIsLoading:u}),l.jsx(nk,{}),l.jsx(Rn,{className:"flex md:hidden"})]})]})})]})},uk=ck;const dk="_button_1gxoe_1",fk="_primary_1gxoe_14",hk="_secondary_1gxoe_22",pk="_tertiary_1gxoe_30",mk="_content_1gxoe_38",gk="_withoutHover_1gxoe_45",ta={button:dk,primary:fk,secondary:hk,tertiary:pk,content:mk,withoutHover:gk},Wu=e=>{const{children:t,onClick:r,style:n,className:o,disabled:a=!1,size:s="m",type:c="Primary",withoutHover:u=!1}=e;return l.jsx("button",{className:ar(ta.button,o,{[ta.primary]:c==="Primary",[ta.secondary]:c==="Secondary",[ta.tertiary]:c==="Tertiary",[ta.withoutHover]:u}),onClick:r,style:{...n,fontSize:s==="m"?14:s==="s"?12:16},disabled:a,children:c==="Tertiary"?l.jsxs("div",{className:ta.content,children:[l.jsx(un,{name:"ArrowRight",fill:"#757575",width:20,height:20}),t]}):l.jsx(l.Fragment,{children:t})})},vk="_customCheckbox_w9x8g_1",xk="_checkboxBox_w9x8g_7",bk="_checked_w9x8g_23",yk="_icon_w9x8g_31",Ri={customCheckbox:vk,checkboxBox:xk,checked:bk,icon:yk},Ck=e=>{const{value:t,onChange:r}=e,[n,o]=x.useState(t),a=()=>{o(!n),r(!n)};return l.jsxs("label",{className:Ri.customCheckbox,children:[l.jsx("input",{type:"checkbox",checked:n,onChange:a,style:{display:"none"}}),l.jsx("span",{className:ar(Ri.checkboxBox,{[Ri.checked]:n})}),n&&l.jsx("div",{className:Ri.icon,children:l.jsx(un,{name:"Check",width:14,height:14,fill:"#ff3f19"})})]})},wk=e=>{const{label:t,onChange:r,activeImage:n}=e,{setOpenModal:o,setOnChange:a}=ad();return l.jsx(l.Fragment,{children:l.jsxs("div",{className:pt.wrapper,onClick:s=>s.stopPropagation(),children:[t&&l.jsx("h4",{className:pt.label,children:t}),l.jsxs("div",{onClick:()=>{a(r),o(!0)},className:pt.content,children:[l.jsx("div",{className:pt.icon,children:n?l.jsx("img",{src:`https://imagedelivery.net/${n}/w=156,h=156`,alt:"image",style:{width:"20px",height:"20px",objectFit:"contain"}}):l.jsx(un,{name:"Plus",width:20,height:20,fill:"#757575"})}),l.jsx("span",{className:pt.text,children:n?"Change image":"Select image"})]})]})})},Sk=()=>{const{setOpenModal:e,onChange:t}=ad(),[r,n]=x.useState(!1),o=()=>{var m;(m=a.current)==null||m.click()},a=x.useRef(null),[s,c]=x.useState([]),[u,d]=x.useState(!1),f=async m=>{var _;const g=((_=m.target.files)==null?void 0:_[0])||null;if(!g)return;const b=new FormData;b.append("file",g),d(!0);const{data:y}=await f8(b),C=[...s];C.unshift({...y.data,cfId:y.data.path}),c([...C]),d(!1)},h=m=>{m.preventDefault(),n(!1);const g=m.dataTransfer.files;if(g&&g.length>0){const y={target:{files:[g[0]]}};f(y)}},p=m=>{const b=[...s].map(y=>y.id===m.id?{...m}:y);c([...b])};x.useEffect(()=>{(async()=>{const{data:g}=await d8(),b=g.data.map(y=>({...y,isSelected:!1}));c(b)})()},[]);function v(){const m=s.filter(g=>g.isSelected).map(g=>g.cfId);t==null||t(m)}return l.jsxs("div",{onClick:m=>m.stopPropagation(),className:pt.modal,children:[l.jsxs("div",{className:pt.top,children:[l.jsx("h4",{className:pt.title,children:"Select Image"}),l.jsx(un,{name:"X",width:20,height:20,hoverable:!0,onClick:()=>e(!1)})]}),l.jsxs("div",{className:pt.modalContent,children:[l.jsxs("div",{className:pt.top,children:[l.jsx("div",{children:"Search"}),l.jsxs("div",{children:["Selected: ",s.filter(m=>m.isSelected).length," images"]})]}),l.jsxs("div",{className:pt.images,children:[l.jsxs("div",{className:pt.input,onDragOver:m=>m.preventDefault(),onDragEnter:()=>n(!0),onDragLeave:()=>n(!1),onDrop:h,children:[l.jsxs("div",{onClick:o,className:ar(pt.add,{[pt.dragging]:r}),children:[l.jsx("div",{className:pt.icon,children:l.jsx(un,{name:"Plus",width:20,height:20,fill:"#757575"})}),l.jsxs("div",{className:pt.description,children:[l.jsx("span",{children:"Drag and drop images here, or "}),l.jsx("span",{className:pt.highlight,children:"click to browse"}),l.jsx("br",{}),l.jsx("span",{className:pt.accent,children:"up to 10MB."})]})]}),l.jsx("input",{type:"file",ref:a,style:{display:"none"},onChange:f,multiple:!1,accept:"image/*"})]}),u&&l.jsx(Gh,{}),s.map(m=>l.jsx(Ek,{image:m,updateImage:p},m.id)),s.length===0&&[...new Array(5)].map((m,g)=>l.jsx(Gh,{},g))]})]}),l.jsxs("div",{className:pt.bottom,children:[l.jsx(Wu,{className:pt.cancel,onClick:()=>e(!1),type:"Secondary",children:"Cancel"}),l.jsx(Wu,{onClick:()=>{e(!1),v()},children:"Select"})]})]})},Ek=e=>{const{image:t,updateImage:r}=e;return l.jsxs("div",{className:ar(pt.image,{[pt.selected]:t.isSelected}),children:[l.jsx("div",{className:pt.checkbox,children:l.jsx(Ck,{value:t.isSelected,onChange:n=>{r({...t,isSelected:n})}})}),l.jsx("img",{src:`https://imagedelivery.net/${t.cfId}/w=156,h=156`,alt:"image",style:{objectFit:"contain",width:"156px",height:"100px"}})]},t.id)},Gh=()=>l.jsx("div",{className:pt.loading,children:l.jsx("div",{className:pt.spinner})}),jk="_wrapper_187gl_1",_k="_label_187gl_9",Tk="_input_187gl_17",Pk="_required_187gl_47",Nk="_paddingless_187gl_54",Rk="_content_187gl_58",kk="_borderless_187gl_66",Ak="_rightIcon_187gl_77",Lk="_inputPostfix_187gl_83",yn={wrapper:jk,label:_k,input:Tk,required:Pk,paddingless:Nk,content:Rk,borderless:kk,rightIcon:Ak,inputPostfix:Lk},Dk=e=>{const{onChange:t,style:r,label:n,value:o,type:a,min:s,max:c,placeholder:u,disabled:d=!1,required:f=!1,regex:h,paddingless:p=!1,borderless:v=!1,editable:m=!1,isSearch:g=!1,postfix:b}=e,[y,C]=x.useState(!1);function _(S){return Number(S)<0?String(s):S}function w(S){return!f||!h?!0:new RegExp(h).test(S)}return l.jsxs("div",{className:yn.wrapper,children:[n&&l.jsx("label",{className:yn.label,htmlFor:n,children:n}),l.jsxs("div",{className:yn.content,children:[l.jsx("input",{id:n,type:a||"text",onChange:S=>{if(a==="text")t(S.target.value);else{const k=_(S.target.value);t(k)}},value:o,autoComplete:"off",placeholder:u||"Type something...",className:ar(yn.input,{[yn.required]:y&&f&&!w(o),[yn.paddingless]:p,[yn.borderless]:v}),min:a==="number"?s:void 0,max:a==="number"?c:void 0,disabled:d,onFocus:()=>{v||C(!0)},style:r}),b&&l.jsx("span",{className:yn.inputPostfix,children:b}),g&&l.jsx("div",{className:yn.rightIcon,children:l.jsx(un,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:20,height:20})}),m&&l.jsx("div",{children:l.jsx(un,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})};function Ok(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return x.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const ac=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ba(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function C1(e){return"nodeType"in e}function br(e){var t,r;return e?Ba(e)?e:C1(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function w1(e){const{Document:t}=br(e);return e instanceof t}function si(e){return Ba(e)?!1:e instanceof br(e).HTMLElement}function r5(e){return e instanceof br(e).SVGElement}function Ha(e){return e?Ba(e)?e.document:C1(e)?w1(e)?e:si(e)||r5(e)?e.ownerDocument:document:document:document}const mn=ac?x.useLayoutEffect:x.useEffect;function S1(e){const t=x.useRef(e);return mn(()=>{t.current=e}),x.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function Mk(){const e=x.useRef(null),t=x.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=x.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Is(e,t){t===void 0&&(t=[e]);const r=x.useRef(e);return mn(()=>{r.current!==e&&(r.current=e)},t),r}function ii(e,t){const r=x.useRef();return x.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function El(e){const t=S1(e),r=x.useRef(null),n=x.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,n]}function zu(e){const t=x.useRef();return x.useEffect(()=>{t.current=e},[e]),t.current}let Wc={};function li(e,t){return x.useMemo(()=>{if(t)return t;const r=Wc[e]==null?0:Wc[e]+1;return Wc[e]=r,e+"-"+r},[e,t])}function n5(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,s)=>{const c=Object.entries(s);for(const[u,d]of c){const f=a[u];f!=null&&(a[u]=f+e*d)}return a},{...t})}}const da=n5(1),jl=n5(-1);function Ik(e){return"clientX"in e&&"clientY"in e}function E1(e){if(!e)return!1;const{KeyboardEvent:t}=br(e.target);return t&&e instanceof t}function Fk(e){if(!e)return!1;const{TouchEvent:t}=br(e.target);return t&&e instanceof t}function Zu(e){if(Fk(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Ik(e)?{x:e.clientX,y:e.clientY}:null}const Fs=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Fs.Translate.toString(e),Fs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Yh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Bk(e){return e.matches(Yh)?e:e.querySelector(Yh)}const Hk={display:"none"};function Vk(e){let{id:t,value:r}=e;return x.createElement("div",{id:t,style:Hk},r)}function $k(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return x.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Uk(){const[e,t]=x.useState("");return{announce:x.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const o5=x.createContext(null);function Wk(e){const t=x.useContext(o5);x.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function zk(){const[e]=x.useState(()=>new Set),t=x.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[x.useCallback(n=>{let{type:o,event:a}=n;e.forEach(s=>{var c;return(c=s[o])==null?void 0:c.call(s,a)})},[e]),t]}const Zk={draggable:`
|
|
145
|
+
${t}%`})]}),mR=()=>{const[e]=ge(kn.dataAtom),[t]=ge(kn.pendingAtom),r=Zo({defaultValues:{amount:"",gateway:""}}),[n,o]=j0(),a=Hr(),s=Qr(Cl),[c]=ge(Cl.pendingAtom),[u]=ge(Vo.dataAtom),[d]=ge(Vo.pendingAtom),[f,h]=x.useState(),p=x.useRef();r.useSubmit(async()=>{const S=await s({price:{amount:m,currency:g},gateway:v,customerEmail:le.get(As)}),k=le.get(ro).Charge;a(`${k}/${S.data.chargeId}${p.current&&`?redirectRoute=${p.current}`}`)});const v=r.useValue(r.names.gateway),m=r.useValue(r.names.amount);if(r.useValidate(S=>Ko(S,hR,r)),x.useEffect(()=>{const S=n.get("redirectRoute");S&&p&&(p.current=S,n.delete("redirectRoute"),o(n))},[n]),!u||!(u!=null&&u.isEnabled))return null;const{topUpSettings:{currency:g,topUpBonusEnabled:b,bonusPercent:y,minimumTopUpForBonus:C}}=u,_=Number(m),w=b&&!Number.isNaN(_)?C-Number(_):C;return t||d?l.jsx(tr,{variant:"secondary"}):l.jsx("div",{className:"md:flex md:justify-center",children:l.jsxs("div",{className:"min-h-svh flex flex-col md:max-w-[520px] md:mt-5",children:[l.jsx(ai,{className:"md:hidden"}),l.jsx(Go,{store:r,children:l.jsxs("div",{className:"flex-1 px-4 mt-6 pb-4",children:[l.jsx("h1",{className:"text-lg font-bold",children:"Top Up Account Balance"}),l.jsxs("div",{className:"mt-2.5",children:[l.jsx(Js,{className:"text-sm text-textSecondary",name:r.names.amount,children:"Enter Amount"}),l.jsx(ka,{className:"mt-1",name:r.names.amount,render:l.jsx(In,{placeholder:"0",icon:l.jsx(B2,{}),type:"number"})}),l.jsx(ao,{className:"text-signalDanger",name:r.names.amount})]}),b&&w!==void 0&&l.jsx(pR,{enterAnother:w,bonusPercent:y,currency:g}),l.jsx("div",{className:"grid grid-cols-2 gap-3 pt-6 border-t border-borderDefault mt-6",children:e==null?void 0:e.map(S=>S.paymentMethods.map(k=>l.jsx(p1,{align:"column",paymentMethod:k,gatewayLogoCfId:S.logoCfImageId,gatewayDisplayName:S.displayName,gateway:S.name,poweredByLogoCfId:S.poweredByImageCfImageId,selected:v===S.name&&k===f,onSelect:()=>{r.setValue(r.names.gateway,S.name),h(k)}})))}),l.jsx(ao,{className:"text-signalDanger mb-4",name:r.names.gateway}),l.jsxs("div",{className:"mt-10",children:[l.jsx(Aa,{render:l.jsx(Se,{size:"lg",className:"w-full",isLoading:!!c,children:"Continue to Checkout"})}),l.jsx(Dm,{}),l.jsx(Om,{})]})]})}),l.jsx("div",{className:"p-4 pt-0",children:l.jsx(Rn,{className:"md:hidden"})})]})})},gR=mR,vR={NEW:"New",PENDING:"Order Pending",EXPIRED:"Order Expired",CANCELLED:"Order Canceled",FAILED:"Order Failed",FULL_DELIVERY_FAILURE:"Delivery Failure",PARTIALLY_DELIVERED:"Partial Delivery Failure",REFUNDED:"Order Refunded",COMPLETED:"Order Completed"},xR={NEW:"New",PENDING:"Your order is currently pending. We recommend checking back shortly for confirmation.",EXPIRED:"Your order has expired due to the payment not being sent in time. If you already sent the payment, please contact us below.",CANCELLED:"You canceled the warrant. If there are any problems, please contact support",FAILED:"Order Failed",FULL_DELIVERY_FAILURE:"Your payment was successful but the product is currently out of stock. Please contact us below to get this sorted.",PARTIALLY_DELIVERED:"Your payment was successful but some products were out stock. Please contact us below to get this sorted.",REFUNDED:"Order Refunded",COMPLETED:"Your order has successfully been processed. View your products below or check your email for additional information."},bR={COMPLETED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(qs,{})}),PENDING:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Cu,{})}),NEW:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Cu,{})}),EXPIRED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Sn,{})}),CANCELLED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Sn,{})}),FAILED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Sn,{})}),FULL_DELIVERY_FAILURE:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(yu,{})}),PARTIALLY_DELIVERED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Lf,{})}),REFUNDED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface100",children:l.jsx(Lf,{})})},yR=({orderStatus:e})=>l.jsxs("div",{className:"flex flex-col items-center justify-center text-center gap-2",children:[bR[e],l.jsx("h2",{className:"font-bold",children:vR[e]}),l.jsx("p",{className:"text-sm text-textSecondary",children:xR[e]}),l.jsxs("div",{className:"w-full flex gap-2 mt-3",children:[l.jsx("div",{className:"w-full",children:l.jsxs(Se,{variant:"light",className:"w-full gap-1",onClick:()=>{var t;return window.open(`https://${(t=le.get(_a))==null?void 0:t.info.domain}`)},children:[l.jsx(ll,{}),"Visit Website"]})}),l.jsx("div",{className:"w-full",children:l.jsxs(Se,{variant:"light",className:"w-full gap-1",children:[l.jsx($2,{}),"Contact Support"]})})]})]}),CR=yR,wR=({setRating:e,rating:t,disabled:r})=>{const[n,o]=x.useState(0),a=c=>{!r&&o(+c.currentTarget.id)},s=c=>{!r&&e(c)};return l.jsx("div",{className:"flex gap-[6px] cursor-pointer",onMouseLeave:()=>o(0),children:[1,2,3,4,5].map(c=>t>=c||n>=c?l.jsx("div",{id:c.toString(),className:"w-5",onMouseEnter:a,onClick:()=>s(c),children:l.jsx(xv,{},c)}):l.jsx("div",{id:c.toString(),className:"w-5 text-textSecondary",onMouseEnter:a,onClick:()=>s(c),children:l.jsx(Cd,{})},c))})},SR=wR,ER=({isActive:e,setIsActive:t,onSubmit:r,isLoading:n})=>{const[o,a]=x.useState("");return l.jsx(Mn,{title:"Review Description",isActive:e,setIsActive:t,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-textSecondary text-sm",children:"Describe your review in detail below:"}),l.jsx(h1,{className:"mt-2",maxLength:150,placeholder:"Great product and fast checkout...",value:o,onChange:s=>a(s.target.value)})]}),l.jsxs("div",{className:"flex gap-3 md:w-[40%] md:ml-auto mt-8",children:[l.jsx("div",{className:"w-full",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:()=>t(!1),children:"Cancel"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{variant:"primary",className:"w-full",disabled:!o,onClick:()=>r(o),isLoading:n,children:"Submit"})})]})]})})},jR=ER,_R=({review:e,orderId:t})=>{const[r,n]=x.useState((e==null?void 0:e.rating)||0),[o,a]=x.useState(!1),[,s]=ge(mo),[c,u]=x.useState(!1),d=async f=>{e&&"accessToken"in e&&(u(!0),await Ex({comment:f,rating:r},t,e.accessToken),u(!1),s(h=>[...h,{isActive:!0,status:!0,id:new Date().getTime(),message:"Review left successfully"}]),a(!1))};return x.useEffect(()=>{e&&r&&"accessToken"in e&&!e.rating&&a(!0)},[r]),e?e.rating&&"accessToken"in e?l.jsxs("div",{className:"p-4 flex justify-between rounded-base bg-surface100 font-bold",children:["You left a ",e.rating," star rating"]}):l.jsxs("div",{className:"p-4 flex justify-between rounded-base bg-surface100",children:[l.jsx("p",{className:"text-base font-bold",children:"Leave a review"}),l.jsx(SR,{rating:r,setRating:n,disabled:!!e.rating||!("accessToken"in e)}),l.jsx(jR,{isActive:o,setIsActive:a,onSubmit:d,isLoading:c})]}):null},TR=_R,PR=()=>{var h,p,v;const{id:e,accessToken:t}=$s(),r=Hr(),[n,o]=x.useState(),[a,s]=x.useState(!1),c=oi(),u=((h=n==null?void 0:n.rawPrice)==null?void 0:h.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:u}),f=x.useMemo(()=>(n==null?void 0:n.partOrders.map(m=>{var g,b,y,C;return{id:(m==null?void 0:m.id)||0,image:m.productWithVariant.image,name:((g=m.productWithVariant)==null?void 0:g.name)||"",description:((b=m.productWithVariant)==null?void 0:b.description)||"",price:{quantity:m.quantity,amount:((y=m.productWithVariant)==null?void 0:y.price.amount)||0,currency:(C=m.productWithVariant)==null?void 0:C.price.currency},deliveryCategories:"deliveryCategories"in m?m.deliveryCategories:void 0,customerNote:m.customerNote}}))||[],[n]);return x.useEffect(()=>{const m=async(b,y=!1)=>{y||s(!0);const C=await(t?Rx(`${b}/${t}`):Nx(b));s(!1),C.charge.status==="NOT_PAID"&&r(`${le.get(ro).Charge}/${C.charge.id}`),o(C)};e&&m(e);const g=setInterval(()=>{e&&m(e,!0)},5e3);return()=>{clearInterval(g)}},[]),a?l.jsx(tr,{variant:"secondary"}):l.jsxs("div",{className:"min-h-svh bg-surface0 md:flex",children:[l.jsx("div",{className:"md:h-svh md:flex md:flex-col md:items-end md:w-full md:p-10 md:pl-4 md:pb-6",children:l.jsxs("div",{className:"md:max-w-[520px] md:w-full md:h-full",children:[l.jsx(ai,{}),n&&l.jsxs("div",{className:"pt-8 md:pt-0 md:w-full md:h-full md:flex md:flex-col px-4 md:px-0",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx(CR,{orderStatus:n.status}),l.jsx("div",{className:"mt-4",children:l.jsx(Km,{lastUpdate:n.createdAt,paymentType:n.charge.gateway,email:n.charge.customerForCharge.email,invoiceId:n.id})}),l.jsx("div",{className:"mt-6",children:l.jsx(TR,{orderId:n.id,review:n.review})})]}),l.jsxs("div",{children:[n.charge&&l.jsx("div",{className:"mt-6",children:l.jsx(Xm,{timeline:n.charge.timeline})}),l.jsx(Rn,{className:"hidden md:flex"})]})]})]})}),l.jsx("div",{className:"px-4 py-6 bg-surface100 mt-10 md:mt-0 md:w-full md:p-10 md:pr-4",children:l.jsxs("div",{className:"md:max-w-[520px]",children:[(n==null?void 0:n.charge.name)&&l.jsxs("header",{className:"flex justify-between items-start mt-6",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"font-bold text-textPrimary text-lg",children:n.charge.name}),n.charge.description&&l.jsx("p",{className:"text-textSecondary text-sm",children:n.charge.description})]}),l.jsxs(Se,{variant:"secondary",className:"gap-1 text-textSecondary",onClick:()=>c((n==null?void 0:n.id)||""),children:[l.jsx(Ea,{}),"Copy ID"]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"mt-6 w-full flex flex-col gap-4",children:f.map(m=>l.jsx(f1,{product:m,isOrder:!0},m.id))}),l.jsx(tc,{className:"bg-surface0",formatter:d,coupon:null,total:((p=n==null?void 0:n.charge)==null?void 0:p.price.amount)||0,discount:0,totalWithDiscount:((v=n==null?void 0:n.charge)==null?void 0:v.price.amount)||0}),l.jsx(Rn,{className:"flex md:hidden"})]})]})})]})},NR=PR,RR=({subscription:e})=>l.jsxs("div",{className:"p-6 mt-3 bg-surface100 rounded-lg",children:[l.jsxs("div",{className:"w-full flex items-start gap-3",children:[l.jsx("div",{className:"min-w-12 h-12 flex items-center justify-center bg-surface0 rounded-base overflow-hidden",children:e!=null&&e.image?l.jsx("img",{className:"w-full h-full object-contain",src:kr(e.image.cfId),alt:e==null?void 0:e.name}):l.jsx($l,{})}),l.jsxs("div",{className:"text-base w-full",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"font-bold overflow-ellipsis overflow-hidden whitespace-nowrap max-w-full",children:e.name})}),l.jsxs("p",{className:"text-textSecondary ",children:[At(e.price)," / ",e.recurringInterval]})]}),l.jsx("div",{className:"min-w-fit",children:l.jsx(Ym,{status:e.status})})]}),e.description&&l.jsx("p",{className:"mt-4 text-textSecondary",children:e.description})]}),kR=RR,AR=({onCheckedChange:e,checked:t,...r})=>{var o,a;const n=x.useRef(null);return l.jsxs("label",{className:On("w-5 h-5 flex items-center justify-center border border-borderHover rounded-[50%] transition-all cursor-pointer",((o=n.current)==null?void 0:o.checked)&&"border-brandDefault bg-brandLight"),onClick:()=>{var s;return(s=n.current)==null?void 0:s.click()},children:[l.jsx("input",{className:"appearance-none",type:"radio",...r,ref:n}),((a=n.current)==null?void 0:a.checked)&&l.jsx("span",{className:"w-2 h-2 bg-brandDefault rounded-[50%]"})]})},ts=AR,LR=P.object({reason:P.string().min(1,{message:"The reason field cannot be empty."}),otherReason:P.string().optional()}),DR={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},OR=({isActive:e,setIsActive:t,id:r,accessToken:n})=>{const o=Zo({defaultValues:{reason:"",otherReason:""}}),[a,s]=x.useState(0),[c,u]=x.useState(!1);o.useValidate(f=>Ko(f,LR,o));const d=o.useValue("reason");return o.useSubmit(async f=>{u(!0);const h=await Tx(r,n,{reason:f.values.reason==="Other reason"?f.values.otherReason:f.values.reason});u(!1),h&&(mo(le,p=>[...p,{isActive:!0,title:"Success",message:"Subscription successfully canceled",id:new Date().getTime(),status:!0}]),s(2))}),x.useEffect(()=>{e||s(0)},[e]),l.jsx(Mn,{title:DR[a]||"",setIsActive:t,isActive:e,children:l.jsxs(Go,{store:o,children:[a===0&&l.jsxs("div",{className:"h-full flex flex-col -mt-2",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-textSecondary",children:"Before you cancel your subscription can you tell us why?"}),l.jsxs(vy,{className:"flex flex-col gap-3 mt-4",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Ya,{value:"Found another company",name:o.names.reason,render:l.jsx(ts,{})}),l.jsx("p",{children:"Found another company"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Ya,{value:"Expensive",name:o.names.reason,render:l.jsx(ts,{})}),l.jsx("p",{children:"Expensive"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Ya,{value:"Technical problems",name:o.names.reason,render:l.jsx(ts,{})}),l.jsx("p",{children:"Technical problems"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Ya,{value:"Support problems",name:o.names.reason,render:l.jsx(ts,{})}),l.jsx("p",{children:"Support problems"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Ya,{value:"Other reason",name:o.names.reason,render:l.jsx(ts,{})}),l.jsx("p",{children:"Other reason"})]}),d==="Other reason"&&l.jsx(ka,{name:o.names.otherReason,placeholder:"Describe the reason...",render:l.jsx(h1,{maxLength:150})})]}),l.jsx(ao,{className:"text-signalDanger mt-2",name:o.names.reason})]}),l.jsxs("div",{className:"flex gap-3 md:w-fit md:ml-auto mt-8",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:"Stay with us"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"primary",className:"w-full",onClick:f=>{f.preventDefault(),s(1)},children:"Continue"})})]})]}),a===1&&l.jsxs("div",{className:"h-full flex flex-col -mt-2",children:[l.jsx("div",{className:"flex-1 ",children:l.jsxs("p",{className:"text-textSecondary",children:["You’ll lose access to all of the features and content available within this subscription."," "]})}),l.jsxs("div",{className:"flex gap-3 md:w-fit md:ml-auto mt-8",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:"Stay with us"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Aa,{render:l.jsx(Se,{variant:"primary",className:"w-full",isLoading:c,children:"Cancel it anyway"})})})]})]}),a===2&&l.jsxs("div",{className:"h-full flex flex-col -mt-2",children:[l.jsxs("div",{className:"flex-1 flex items-center justify-center flex-col text-center",children:[l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-base bg-surface0",children:l.jsx(qs,{})}),l.jsx("p",{className:"font-bold mt-4",children:"Subscription Cancelled"}),l.jsx("p",{className:"text-textSecondary mt-2 max-w-[368px]",children:"You’ll lose access to all of the features and content available within this subscription."})]}),l.jsx("div",{className:"flex gap-3 md:w-fit md:ml-auto mt-8",children:l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:"Close"})})})]})]})})},MR=OR,IR=({subscription:e,id:t,accessToken:r})=>{const[n,o]=x.useState(!1);return l.jsxs("div",{className:"p-6 w-full flex items-center gap-3 border border-borderDefault rounded-lg",children:[l.jsx("div",{className:"min-w-12 h-12 flex items-center justify-center bg-surface0 rounded-base overflow-hidden",children:e!=null&&e.image?l.jsx("img",{className:"w-full h-full object-contain",src:kr(e.image.cfId),alt:e==null?void 0:e.name}):l.jsx($l,{})}),l.jsxs("div",{className:"text-base w-full max-w-[85%]",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"font-bold ",children:e.name})}),l.jsxs("p",{className:"text-textSecondary overflow-ellipsis overflow-hidden whitespace-nowrap max-w-full",children:[At(e.price)," / ",e.recurringInterval]})]}),l.jsx(Se,{variant:"link",onClick:()=>o(!0),children:"Cancel"}),l.jsx(MR,{accessToken:r,id:t,isActive:n,setIsActive:o})]})},FR=IR,BR=P.object({isFixed:P.boolean(),discount:P.number(),name:P.string(),initialCouponDurationForSubscriptions:P.number().optional(),currentCouponDurationForSubscriptions:P.number().optional()}),HR=Gm.extend({productDescription:P.string().optional(),productImage:P.object({id:P.number(),cfId:P.string()}).optional(),availableGateways:P.array(P.string()),gatewayInfo:P.object({card:P.object({brand:P.string(),last4:P.string(),expires:P.string()}).optional()}).optional(),coupon:BR.optional(),variantId:P.number(),pricingPlanExists:P.boolean()}),Qm=P.object({amount:P.number(),currency:P.string()}),VR=P.object({price:Qm,recurringIntervalDays:P.number()}),$R=P.object({name:P.string(),required:P.boolean(),placeholder:P.string(),defaultValue:P.string(),regex:P.string(),type:P.string()}),UR=P.object({id:P.number(),name:P.string(),description:P.string().optional(),shortDescription:P.string().optional(),price:Qm,chargeTypes:P.array(P.string()),subscriptionSettings:VR,quantity:P.object({restrictions:P.any()}),deliveryTime:P.number(),gateways:P.array(P.object({name:P.string()})),customFields:P.array($R),warranty:P.object({text:P.string(),durationMilliseconds:P.number()}).optional(),discordSettings:P.object({isEnabled:P.boolean(),isRequired:P.boolean()})}),WR=P.object({id:P.string(),name:P.string(),productVariants:P.array(P.object({data:UR,position:P.number(),isHighlighted:P.boolean()})),position:P.number()}),zR=P.object({id:P.string(),name:P.string(),description:P.string(),types:P.array(WR)}),ZR=P.object({data:zR}),Yn=Wt(async(e,{id:t,accessToken:r})=>Ar(await jx(t,r),HR)).pipe(xr(null)),Uc=Wt(async(e,{id:t,accessToken:r})=>Ar(await _x(t,r),ZR)).pipe(xr(null)),qR=({color:e,percent:t,disablePercentLabel:r})=>l.jsxs("div",{className:"flex gap-1 items-center text-s",children:[!r&&l.jsxs("p",{children:[t,"%"]}),l.jsx("div",{className:"h-[4px] w-full flex items-center flex-1 bg-surface0 rounded-[100px]",children:l.jsx("div",{style:{width:`${t}%`,background:e},className:" h-[4px] bg-textPrimary rounded-[100px]"})})]}),e5=qR,GR=({coupon:e,currency:t})=>l.jsxs("div",{className:"flex items-center gap-3 p-6 border border-borderDefault rounded-lg",children:[l.jsx("div",{className:"min-w-12 h-12 flex items-center justify-center rounded-base bg-successBackground text-successText",children:l.jsx(wd,{})}),l.jsxs("div",{className:"w-full",children:[l.jsxs("p",{className:"font-bold",children:[e.name,","," ",e.isFixed?At({amount:e.discount,currency:t}):e.discount+"%"," ","discount"]}),l.jsx("div",{className:"mt-2 w-full",children:l.jsx(e5,{color:"#C2C2C2",percent:e.initialCouponDurationForSubscriptions?Jv(e.initialCouponDurationForSubscriptions,e.currentCouponDurationForSubscriptions||1):100,disablePercentLabel:!0})}),l.jsx("p",{className:"mt-1 text-sm text-textSecondary",children:"Forever discount code"})]})]}),YR=GR,KR=e=>{const{totalSteps:t,step:r,onStepChange:n,label:o}=e,[a,s]=x.useState(r),c=a===1?0:(a-1)/(t-1)*100,u=d=>{s(d),n(d)};return l.jsxs("div",{className:"flex flex-col items-center w-full space-y-4 h-[calc(fit-content + 50px)]",children:[o&&l.jsx("div",{className:"text-textSecondary mb-2 text-left w-full",children:o}),l.jsxs("div",{className:"relative w-full h-1 bg-gray-200 rounded-lg",children:[l.jsx("div",{className:"absolute top-0 left-0 h-1 bg-red-500 rounded-lg transition-all duration-300 ease-in-out",style:{width:`${Math.ceil(c)}%`}}),l.jsx("div",{className:"absolute flex justify-between items-center w-full h-full",children:[...Array(t)].map((d,f)=>{const h=f+1,p=h<=a,v=h===a;return l.jsxs("div",{className:"relative flex items-center justify-center cursor-pointer",onClick:()=>u(h),children:[l.jsx("div",{className:`${v?"w-4 h-4":"w-3 h-3"} rounded-3xl transition-colors duration-300 ${p?"bg-red-500":"bg-gray-300"}`}),v&&l.jsxs("div",{className:"absolute top-8 transform text-sm text-white bg-black py-1 px-3 rounded-lg flex items-center gap-1",style:{transform:`translateX(calc(50% - ${c<99?"40px":"70px"}))`},children:[l.jsx("span",{children:a}),l.jsx("span",{children:a===1?"month":"months"})]})]},h)})})]})]})},XR=KR,JR=e=>{const{setIsLoading:t,dialogStore:r}=e,{id:n}=$s(),o=Hr(),[a]=ge(Yn.dataAtom),[,s]=ge(mo),{setPaymentMethod:c,setGateway:u,cart:d}=ni();function f(){r.hide()}async function h(){if(t(!0),n){const{data:p}=await Px(n,d.gateway);p.isReconnectPaymentNeeded?o(`/charges/${p.chargeId}`):s(v=>[...v,{title:"Success",isActive:!0,status:!0,id:new Date().getTime(),message:"Your action has been successfully completed"}])}else s(p=>[...p,{title:"Error",isActive:!0,status:!1,id:new Date().getTime(),message:"Your action has been failed. Try again!"}]);t(!1)}return l.jsxs(l.Fragment,{children:[(a==null?void 0:a.availableGateways)&&l.jsx(Fm,{possibleGateways:{availableGateways:a.availableGateways,requiresSignInGateways:a.availableGateways},setGateway:u,setPaymentMethod:c,totalAndDiscount:{total:(a==null?void 0:a.price.amount)||0,totalWithDiscount:a==null?void 0:a.price.amount},onSignInClick:()=>o("/customer-dash")}),l.jsxs("div",{className:"flex gap-3 justify-end md:w-[50%] md:ml-auto mt-8",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-fit",onClick:f,children:"Cancel"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:d.gateway?"primary":"secondary",className:"w-fit",disabled:!d.gateway,onClick:h,children:"Continue"})})]})]})},QR=({setIsLoading:e})=>{const{cart:t}=ni(),r=Hr(),[n]=ge(Yn.dataAtom),[o]=ge(kn.dataAtom),a=Qr(kn);x.useEffect(()=>{a([])},[]);const s=La({defaultOpen:!1});function c(){s.show()}return console.log(o),l.jsxs("div",{className:"p-6 mt-6 flex items-center justify-between border border-borderDefault rounded-lg",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-bold",children:"Active Payment Method"}),t.gateway?l.jsx("div",{className:"flex items-center gap-3 mt-1",children:t.gateway==="Balance"?l.jsx(Im,{gateway:t.gateway,gatewayDisplayName:t.gateway,total:(n==null?void 0:n.price.amount)||0,onSignInClick:()=>r("/customer-dash")}):o==null?void 0:o.filter(u=>u.name===t.gateway).map(u=>u.paymentMethods.filter(d=>d===t.paymentMethod).map(d=>l.jsx(p1,{align:"column",paymentMethod:d,gatewayLogoCfId:u.logoCfImageId,gatewayDisplayName:u.displayName,gateway:u.name,poweredByLogoCfId:u.poweredByImageCfImageId})))}):l.jsx("span",{children:"Payment method is not set"})]}),l.jsx(Se,{variant:"link",onClick:c,children:t.gateway?"Change":"Manage"}),l.jsx(oc,{store:s,title:"Choose new Payment Method",children:l.jsx(JR,{setIsLoading:e,dialogStore:s})})]})},y1=QR,ek=({description:e,title:t})=>l.jsxs("div",{className:"h-full bg-surface100 flex flex-col justify-center items-center",children:[l.jsx("div",{children:l.jsx(tr,{variant:"secondary"})}),l.jsx("h1",{className:"mt-4 text-xl font-bold",children:t}),l.jsx("p",{className:"mt-2 text-base text-textSecondary max-w-[456px] text-center",children:e})]}),t5=ek,tk=({dialogStore:e})=>{const{getTotalAndDiscount:t,cart:r,coupon:n}=ni(),[o]=ge(Yn.dataAtom),[a,s]=x.useState(1),[c,u]=x.useState(!1),d=x.useMemo(()=>t(),[n,r]),f=x.useMemo(()=>d.totalWithDiscount?d.total-d.totalWithDiscount:0,[d]);if(c)return l.jsx(t5,{title:"Processing Payment",description:"This payment is currently being processed. If you're here, it simply means that the payment was created but not complete."});const h=(o==null?void 0:o.price.currency)||"USD",p=new Intl.NumberFormat("en-US",{style:"currency",currency:h});function v(){u(!0),u(!1)}return l.jsxs("div",{className:"p-3",children:[l.jsx(XR,{step:a,totalSteps:12,onStepChange:s,label:"How long would you like to extend your subscription for?"}),l.jsx(y1,{setIsLoading:u}),l.jsx(tc,{className:"bg-surface0",formatter:p,coupon:n,total:d.total,discount:f,totalWithDiscount:d.totalWithDiscount}),l.jsxs("div",{className:"flex gap-3 items-center justify-end",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:()=>e.hide(),children:"Cancel"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"primary",className:"w-full",onClick:v,children:"Extend"})})]})]})},rk=()=>{const[e]=ge(Yn.dataAtom),[t,r]=cl((e==null?void 0:e.activeTo)||""),n=La({defaultOpen:!1});return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between gap-3 p-6 border border-borderDefault rounded-lg",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-bold",children:"Expiration Date"}),l.jsxs("p",{className:"text-textSecondary",children:[t," at ",r]})]}),l.jsx(Se,{variant:"link",onClick:()=>n.show(),children:"Extend"})]}),l.jsx(oc,{store:n,title:"Extend Subscription",children:l.jsx(tk,{dialogStore:n})})]})},nk=rk,ok=({isActive:e,setIsActive:t,selectedVariant:r})=>{if(!r)return null;const[n,o]=x.useState(!1),a=()=>{console.log("Selected Variant:",r),t(!1)},s=r.subscriptionSettings.price.amount,c=r.subscriptionSettings.recurringIntervalDays===365?s*.2:0,u=s-c;return l.jsx(Mn,{className:"md:w-[720px]",title:"Choose upgrade method",setIsActive:t,isActive:e,children:l.jsxs("div",{className:"h-full flex flex-col -mt-2",children:[l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"w-full flex mt-6 rounded-base bg-surface0 border border-borderDefault p-1",children:[l.jsx("div",{className:"w-full text-center cursor-pointer rounded-sm p-[6px] transition-all text-textSecondary text-sm hover:bg-surface100 hover:text-textPrimary",children:"Upgrade now"}),l.jsx("div",{className:"w-full flex gap-2 justify-center items-center text-center cursor-pointer rounded-sm p-[6px] transition-all text-textSecondary text-sm hover:bg-surface100 hover:text-textPrimary",children:"Upgrade after Sep 11"})]}),l.jsxs("div",{className:"mt-4 p-4 border rounded-lg bg-surface100",children:[l.jsx("h2",{className:"text-xl font-bold",children:r.name}),l.jsx("p",{className:"text-textSecondary",children:r.description}),l.jsxs("p",{className:"mt-2 font-semibold",children:["$",r.subscriptionSettings.price.amount.toFixed(2)," /"," ",r.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),l.jsx(y1,{setIsLoading:o}),l.jsxs("div",{className:"mt-6 py-5 px-6 w-full flex flex-col gap-3 bg-surface0 rounded-lg ",children:[l.jsxs("div",{className:"w-full flex items-center justify-between gap-3 text-base",children:[l.jsx("p",{className:"text-textSecondary",children:"Subtotal"}),l.jsxs("p",{children:["$",s.toFixed(2)]})]}),c>0&&l.jsxs("div",{className:"w-full flex items-center justify-between gap-3 text-base",children:[l.jsx("p",{className:"text-textSecondary",children:"20% discount for prepaid"}),l.jsxs("p",{children:["-$",c.toFixed(2)]})]}),l.jsxs("div",{className:"w-full flex items-center justify-between gap-3 text-base",children:[l.jsx("p",{className:"font-semibold",children:"Total Due"}),l.jsxs("p",{className:"font-semibold",children:["$",u.toFixed(2)]})]})]})]}),l.jsxs("div",{className:"flex gap-3 md:w-fit md:ml-auto mt-4",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{variant:"secondary",className:"w-full",onClick:()=>t(!1),children:"Stay with us"})}),l.jsx("div",{className:"w-fit",children:l.jsxs(Se,{variant:"primary",className:"w-full",onClick:a,children:["Upgrade for $",u.toFixed(2)]})})]})]})})},ak=ok,sk=({variant:e,isSelected:t,onSelect:r,isCurrent:n})=>{const o=e.subscriptionSettings.recurringIntervalDays===30?"month":e.subscriptionSettings.recurringIntervalDays===365?"year":"period",a=e.subscriptionSettings.price.amount.toFixed(2),s=e.subscriptionSettings.recurringIntervalDays,c=10;return l.jsxs("div",{className:"w-full p-4 cursor-pointer rounded-lg flex flex-col items-start",onClick:r,children:[l.jsxs("h2",{className:"text-xxl flex items-center gap-2 font-bold",children:["$",a," ",l.jsxs("span",{className:"text-base font-normal text-textSecondary",children:[" / ",o]})]}),l.jsx("h3",{className:"font-medium mt-4 flex-auto text-xl",children:e.name}),e.description&&l.jsx("p",{className:"mt-1 text-textSecondary",children:e.description}),n?l.jsxs("div",{className:"w-full flex items-center justify-center gap-2 mt-6 p-3 text-sm text-brandDefault border border-borderDefault rounded-base",children:[l.jsx(qs,{}),"Your current Plan"]}):l.jsx(Se,{variant:"secondary",className:"w-full mt-6 p-3",size:"xl",children:"Select"}),n&&l.jsxs("div",{className:"w-full mt-3",children:[l.jsx(e5,{percent:c/s*100,disablePercentLabel:!0}),l.jsxs("p",{className:"text-textSecondary text-sm mt-2",children:["Used: ",c," of ",s," days"]})]})]})},ik=({isActive:e,setIsActive:t})=>{const r=Qr(Uc),[n,o]=x.useState(null),[a,s]=x.useState(null),[c,u]=x.useState(!1),[d,f]=x.useState(null),[h]=ge(Yn.dataAtom),{id:p,accessToken:v}=$s();x.useEffect(()=>{p&&v&&r({id:p,accessToken:v})},[p,v,r]);const[m]=ge(Uc.dataAtom),[g]=ge(Uc.pendingAtom);x.useEffect(()=>{var C;if(m!=null&&m.data.types[0]){const _=(C=m.data.types.flatMap(w=>w.productVariants).find(w=>w.data.id===(h==null?void 0:h.variantId)))==null?void 0:C.data;_&&(f(_),s(_))}},[m,h]),x.useEffect(()=>{m!=null&&m.data.types[0]&&o(m==null?void 0:m.data.types[0])},[m==null?void 0:m.data.types]);const b=C=>{o(C),s(null)},y=C=>{s(C),u(!0)};return l.jsxs(Mn,{isActive:e,setIsActive:t,title:"",withoutHeader:!0,full:!0,children:[l.jsxs("div",{className:"h-full flex flex-col justify-center items-center ",children:[l.jsx("h1",{className:"font-bold text-xxl",children:"Change Plan"}),l.jsx("p",{className:"max-w-[800px] text-textSecondary mt-3 text-center",children:m==null?void 0:m.data.description}),l.jsx("div",{className:"max-w-[376px] w-full flex mt-6 rounded-base bg-surface0 border border-borderDefault p-1",children:m==null?void 0:m.data.types.map(C=>l.jsxs("div",{className:`w-full text-center cursor-pointer rounded-sm p-[6px] transition-all text-sm ${(n==null?void 0:n.id)===C.id?"bg-surface100 text-textPrimary":"text-textSecondary hover:bg-surface100 hover:text-textPrimary"}`,onClick:()=>b(C),children:[C.name,C.name==="Yearly"&&l.jsx("span",{className:"border border-brandDefault text-brandDefault py-[2px] px-2 rounded-sm text-xs ml-1",children:"Save %"})]},C.id))}),n&&l.jsx("div",{className:"py-2 px-6 mt-6 w-full flex gap-4 border border-borderDefault rounded-[32px]",children:n.productVariants.map(C=>l.jsx(sk,{variant:C.data,isSelected:(a==null?void 0:a.id)===C.data.id,isCurrent:(d==null?void 0:d.id)===C.data.id,onSelect:()=>y(C.data)},C.data.id))}),g&&l.jsx("p",{children:"Loading..."})]}),a&&l.jsx(ak,{isActive:c,setIsActive:u,selectedVariant:a})]})},lk=ik,ck=()=>{const{id:e,accessToken:t}=$s(),[r]=ge(Yn.dataAtom),[n]=ge(Yn.pendingAtom),o=Qr(Yn),[a,s]=x.useState(!1),[c,u]=x.useState(!1);return x.useEffect(()=>{e&&t&&o({id:e,accessToken:t})},[]),n?l.jsx(tr,{variant:"secondary"}):c?l.jsx(t5,{title:"Processing Payment",description:"This payment is currently being processed. If you're here, it simply means that the payment was created but not complete."}):l.jsxs("div",{className:"min-h-svh bg-surface0 md:flex",children:[l.jsx(lk,{isActive:a,setIsActive:s}),l.jsx("div",{className:"md:h-svh md:flex md:flex-col md:items-end md:w-full md:p-10 md:pl-4 md:pb-6",children:l.jsxs("div",{className:"md:max-w-[520px] md:w-full md:h-full",children:[l.jsx(ai,{}),l.jsxs("div",{className:"pt-8 md:w-full md:h-full md:flex md:flex-col px-4 md:px-0",children:[r&&l.jsxs("div",{className:"flex-1",children:[l.jsx("h1",{className:"text-lg font-bold",children:"Your Subscription"}),l.jsx(kR,{subscription:{price:r.price,name:r.productName,description:r.productDescription,status:r.status,image:r.productImage,recurringInterval:r.recurringInterval}}),l.jsxs("div",{className:"flex mt-3 gap-3",children:[r.pricingPlanExists&&l.jsx("div",{className:"w-full",children:l.jsx(Se,{size:"lg",className:"w-full",onClick:()=>s(!0),children:"Change Plan"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{variant:"danger",size:"lg",className:"w-full",children:"Cancel Plan"})})]})]}),l.jsx(Rn,{className:"hidden md:flex"})]})]})}),l.jsx("div",{className:"px-4 py-6 bg-surface100 mt-10 md:mt-0 md:w-full md:p-10 md:pr-4",children:l.jsxs("div",{className:"md:max-w-[520px]",children:[l.jsx("h1",{className:"font-bold text-lg",children:"Details"}),l.jsxs("div",{className:"mt-3 flex flex-col gap-3",children:[(r==null?void 0:r.coupon)&&l.jsx(YR,{coupon:r.coupon,currency:r.price.currency||"USD"}),r&&l.jsx(FR,{id:e||"",accessToken:t||"",subscription:{price:r.price,name:r.productName,description:r.productDescription,status:r.status,image:r.productImage,recurringInterval:r.recurringInterval}}),l.jsx(y1,{setIsLoading:u}),l.jsx(nk,{}),l.jsx(Rn,{className:"flex md:hidden"})]})]})})]})},uk=ck;const dk="_button_1gxoe_1",fk="_primary_1gxoe_14",hk="_secondary_1gxoe_22",pk="_tertiary_1gxoe_30",mk="_content_1gxoe_38",gk="_withoutHover_1gxoe_45",ta={button:dk,primary:fk,secondary:hk,tertiary:pk,content:mk,withoutHover:gk},Wu=e=>{const{children:t,onClick:r,style:n,className:o,disabled:a=!1,size:s="m",type:c="Primary",withoutHover:u=!1}=e;return l.jsx("button",{className:ar(ta.button,o,{[ta.primary]:c==="Primary",[ta.secondary]:c==="Secondary",[ta.tertiary]:c==="Tertiary",[ta.withoutHover]:u}),onClick:r,style:{...n,fontSize:s==="m"?14:s==="s"?12:16},disabled:a,children:c==="Tertiary"?l.jsxs("div",{className:ta.content,children:[l.jsx(un,{name:"ArrowRight",fill:"#757575",width:20,height:20}),t]}):l.jsx(l.Fragment,{children:t})})},vk="_customCheckbox_w9x8g_1",xk="_checkboxBox_w9x8g_7",bk="_checked_w9x8g_23",yk="_icon_w9x8g_31",Ri={customCheckbox:vk,checkboxBox:xk,checked:bk,icon:yk},Ck=e=>{const{value:t,onChange:r}=e,[n,o]=x.useState(t),a=()=>{o(!n),r(!n)};return l.jsxs("label",{className:Ri.customCheckbox,children:[l.jsx("input",{type:"checkbox",checked:n,onChange:a,style:{display:"none"}}),l.jsx("span",{className:ar(Ri.checkboxBox,{[Ri.checked]:n})}),n&&l.jsx("div",{className:Ri.icon,children:l.jsx(un,{name:"Check",width:14,height:14,fill:"#ff3f19"})})]})},wk=e=>{const{label:t,onChange:r,activeImage:n}=e,{setOpenModal:o,setOnChange:a}=ad();return l.jsx(l.Fragment,{children:l.jsxs("div",{className:pt.wrapper,onClick:s=>s.stopPropagation(),children:[t&&l.jsx("h4",{className:pt.label,children:t}),l.jsxs("div",{onClick:()=>{a(r),o(!0)},className:pt.content,children:[l.jsx("div",{className:pt.icon,children:n?l.jsx("img",{src:`https://imagedelivery.net/${n}/w=156,h=156`,alt:"image",style:{width:"20px",height:"20px",objectFit:"contain"}}):l.jsx(un,{name:"Plus",width:20,height:20,fill:"#757575"})}),l.jsx("span",{className:pt.text,children:n?"Change image":"Select image"})]})]})})},Sk=()=>{const{setOpenModal:e,onChange:t}=ad(),[r,n]=x.useState(!1),o=()=>{var m;(m=a.current)==null||m.click()},a=x.useRef(null),[s,c]=x.useState([]),[u,d]=x.useState(!1),f=async m=>{var _;const g=((_=m.target.files)==null?void 0:_[0])||null;if(!g)return;const b=new FormData;b.append("file",g),d(!0);const{data:y}=await f8(b),C=[...s];C.unshift({...y.data,cfId:y.data.path}),c([...C]),d(!1)},h=m=>{m.preventDefault(),n(!1);const g=m.dataTransfer.files;if(g&&g.length>0){const y={target:{files:[g[0]]}};f(y)}},p=m=>{const b=[...s].map(y=>y.id===m.id?{...m}:y);c([...b])};x.useEffect(()=>{(async()=>{const{data:g}=await d8(),b=g.data.map(y=>({...y,isSelected:!1}));c(b)})()},[]);function v(){const m=s.filter(g=>g.isSelected).map(g=>g.cfId);t==null||t(m)}return l.jsxs("div",{onClick:m=>m.stopPropagation(),className:pt.modal,children:[l.jsxs("div",{className:pt.top,children:[l.jsx("h4",{className:pt.title,children:"Select Image"}),l.jsx(un,{name:"X",width:20,height:20,hoverable:!0,onClick:()=>e(!1)})]}),l.jsxs("div",{className:pt.modalContent,children:[l.jsxs("div",{className:pt.top,children:[l.jsx("div",{}),l.jsxs("div",{children:["Selected: ",s.filter(m=>m.isSelected).length," images"]})]}),l.jsxs("div",{className:pt.images,children:[l.jsxs("div",{className:pt.input,onDragOver:m=>m.preventDefault(),onDragEnter:()=>n(!0),onDragLeave:()=>n(!1),onDrop:h,children:[l.jsxs("div",{onClick:o,className:ar(pt.add,{[pt.dragging]:r}),children:[l.jsx("div",{className:pt.icon,children:l.jsx(un,{name:"Plus",width:20,height:20,fill:"#757575"})}),l.jsxs("div",{className:pt.description,children:[l.jsx("span",{children:"Drag and drop images here, or "}),l.jsx("span",{className:pt.highlight,children:"click to browse"}),l.jsx("br",{}),l.jsx("span",{className:pt.accent,children:"up to 10MB."})]})]}),l.jsx("input",{type:"file",ref:a,style:{display:"none"},onChange:f,multiple:!1,accept:"image/*"})]}),u&&l.jsx(Gh,{}),s.map(m=>l.jsx(Ek,{image:m,updateImage:p},m.id)),s.length===0&&[...new Array(5)].map((m,g)=>l.jsx(Gh,{},g))]})]}),l.jsxs("div",{className:pt.bottom,children:[l.jsx(Wu,{className:pt.cancel,onClick:()=>e(!1),type:"Secondary",children:"Cancel"}),l.jsx(Wu,{onClick:()=>{e(!1),v()},children:"Select"})]})]})},Ek=e=>{const{image:t,updateImage:r}=e;return l.jsxs("div",{className:ar(pt.image,{[pt.selected]:t.isSelected}),children:[l.jsx("div",{className:pt.checkbox,children:l.jsx(Ck,{value:t.isSelected,onChange:n=>{r({...t,isSelected:n})}})}),l.jsx("img",{src:`https://imagedelivery.net/${t.cfId}/w=156,h=156`,alt:"image",style:{objectFit:"contain",width:"156px",height:"100px"}})]},t.id)},Gh=()=>l.jsx("div",{className:pt.loading,children:l.jsx("div",{className:pt.spinner})}),jk="_wrapper_187gl_1",_k="_label_187gl_9",Tk="_input_187gl_17",Pk="_required_187gl_47",Nk="_paddingless_187gl_54",Rk="_content_187gl_58",kk="_borderless_187gl_66",Ak="_rightIcon_187gl_77",Lk="_inputPostfix_187gl_83",yn={wrapper:jk,label:_k,input:Tk,required:Pk,paddingless:Nk,content:Rk,borderless:kk,rightIcon:Ak,inputPostfix:Lk},Dk=e=>{const{onChange:t,style:r,label:n,value:o,type:a,min:s,max:c,placeholder:u,disabled:d=!1,required:f=!1,regex:h,paddingless:p=!1,borderless:v=!1,editable:m=!1,isSearch:g=!1,postfix:b}=e,[y,C]=x.useState(!1);function _(S){return Number(S)<0?String(s):S}function w(S){return!f||!h?!0:new RegExp(h).test(S)}return l.jsxs("div",{className:yn.wrapper,children:[n&&l.jsx("label",{className:yn.label,htmlFor:n,children:n}),l.jsxs("div",{className:yn.content,children:[l.jsx("input",{id:n,type:a||"text",onChange:S=>{if(a==="text")t(S.target.value);else{const k=_(S.target.value);t(k)}},value:o,autoComplete:"off",placeholder:u||"Type something...",className:ar(yn.input,{[yn.required]:y&&f&&!w(o),[yn.paddingless]:p,[yn.borderless]:v}),min:a==="number"?s:void 0,max:a==="number"?c:void 0,disabled:d,onFocus:()=>{v||C(!0)},style:r}),b&&l.jsx("span",{className:yn.inputPostfix,children:b}),g&&l.jsx("div",{className:yn.rightIcon,children:l.jsx(un,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:20,height:20})}),m&&l.jsx("div",{children:l.jsx(un,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})};function Ok(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return x.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const ac=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ba(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function C1(e){return"nodeType"in e}function br(e){var t,r;return e?Ba(e)?e:C1(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function w1(e){const{Document:t}=br(e);return e instanceof t}function si(e){return Ba(e)?!1:e instanceof br(e).HTMLElement}function r5(e){return e instanceof br(e).SVGElement}function Ha(e){return e?Ba(e)?e.document:C1(e)?w1(e)?e:si(e)||r5(e)?e.ownerDocument:document:document:document}const mn=ac?x.useLayoutEffect:x.useEffect;function S1(e){const t=x.useRef(e);return mn(()=>{t.current=e}),x.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function Mk(){const e=x.useRef(null),t=x.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=x.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Is(e,t){t===void 0&&(t=[e]);const r=x.useRef(e);return mn(()=>{r.current!==e&&(r.current=e)},t),r}function ii(e,t){const r=x.useRef();return x.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function El(e){const t=S1(e),r=x.useRef(null),n=x.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,n]}function zu(e){const t=x.useRef();return x.useEffect(()=>{t.current=e},[e]),t.current}let Wc={};function li(e,t){return x.useMemo(()=>{if(t)return t;const r=Wc[e]==null?0:Wc[e]+1;return Wc[e]=r,e+"-"+r},[e,t])}function n5(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,s)=>{const c=Object.entries(s);for(const[u,d]of c){const f=a[u];f!=null&&(a[u]=f+e*d)}return a},{...t})}}const da=n5(1),jl=n5(-1);function Ik(e){return"clientX"in e&&"clientY"in e}function E1(e){if(!e)return!1;const{KeyboardEvent:t}=br(e.target);return t&&e instanceof t}function Fk(e){if(!e)return!1;const{TouchEvent:t}=br(e.target);return t&&e instanceof t}function Zu(e){if(Fk(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Ik(e)?{x:e.clientX,y:e.clientY}:null}const Fs=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Fs.Translate.toString(e),Fs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Yh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Bk(e){return e.matches(Yh)?e:e.querySelector(Yh)}const Hk={display:"none"};function Vk(e){let{id:t,value:r}=e;return x.createElement("div",{id:t,style:Hk},r)}function $k(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return x.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Uk(){const[e,t]=x.useState("");return{announce:x.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const o5=x.createContext(null);function Wk(e){const t=x.useContext(o5);x.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function zk(){const[e]=x.useState(()=>new Set),t=x.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[x.useCallback(n=>{let{type:o,event:a}=n;e.forEach(s=>{var c;return(c=s[o])==null?void 0:c.call(s,a)})},[e]),t]}const Zk={draggable:`
|
|
146
146
|
To pick up a draggable item, press the space bar.
|
|
147
147
|
While dragging, use the arrow keys to move the item.
|
|
148
148
|
Press space again to drop the item in its new position, or press escape to cancel.
|