@billgangcom/theme-lib 1.43.0 → 1.44.0
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.
|
@@ -138,12 +138,17 @@ Valid keys: `+JSON.stringify(Object.keys(W),null," "));var $=We(ue,re,Y,ce,J+".
|
|
|
138
138
|
}
|
|
139
139
|
}`,WE=e=>{switch(e){case"success":return GE;case"info":return YE;case"warning":return qE;case"error":return KE;default:return null}},zE=Array(12).fill(0),ZE=({visible:e})=>y.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},y.createElement("div",{className:"sonner-spinner"},zE.map((t,r)=>y.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),GE=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),qE=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},y.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),YE=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),KE=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),XE=()=>{let[e,t]=y.useState(document.hidden);return y.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},Vu=1,JE=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,o=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Vu++,a=this.toasts.find(c=>c.id===o),s=e.dismissible===void 0?!0:e.dismissible;return a?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...e,id:o,title:r}),{...c,...e,id:o,dismissible:s,title:r}):c):this.addToast({title:r,...n,dismissible:s,id:o}),o},this.dismiss=e=>(e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),o=r!==void 0;return n.then(async a=>{if(ej(a)&&!a.ok){o=!1;let s=typeof t.error=="function"?await t.error(`HTTP error! status: ${a.status}`):t.error,c=typeof t.description=="function"?await t.description(`HTTP error! status: ${a.status}`):t.description;this.create({id:r,type:"error",message:s,description:c})}else if(t.success!==void 0){o=!1;let s=typeof t.success=="function"?await t.success(a):t.success,c=typeof t.description=="function"?await t.description(a):t.description;this.create({id:r,type:"success",message:s,description:c})}}).catch(async a=>{if(t.error!==void 0){o=!1;let s=typeof t.error=="function"?await t.error(a):t.error,c=typeof t.description=="function"?await t.description(a):t.description;this.create({id:r,type:"error",message:s,description:c})}}).finally(()=>{var a;o&&(this.dismiss(r),r=void 0),(a=t.finally)==null||a.call(t)}),r},this.custom=(e,t)=>{let r=(t==null?void 0:t.id)||Vu++;return this.create({jsx:e(r),id:r,...t}),r},this.subscribers=[],this.toasts=[]}},wr=new JE,QE=(e,t)=>{let r=(t==null?void 0:t.id)||Vu++;return wr.addToast({title:e,...t,id:r}),r},ej=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",tj=QE,rj=()=>wr.toasts;Object.assign(tj,{success:wr.success,info:wr.info,warning:wr.warning,error:wr.error,custom:wr.custom,message:wr.message,promise:wr.promise,dismiss:wr.dismiss,loading:wr.loading},{getHistory:rj});function nj(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}nj(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
140
140
|
`);function Si(e){return e.label!==void 0}var oj=3,aj="32px",sj=4e3,ij=356,lj=14,cj=20,uj=200;function dj(...e){return e.filter(Boolean).join(" ")}var fj=e=>{var t,r,n,o,a,s,c,u,d,f;let{invert:h,toast:p,unstyled:v,interacting:m,setHeights:g,visibleToasts:x,heights:b,index:C,toasts:_,expanded:w,removeToast:S,defaultRichColors:A,closeButton:T,style:E,cancelButtonStyle:k,actionButtonStyle:R,className:D="",descriptionClassName:M="",duration:G,position:V,gap:Q,loadingIcon:H,expandByDefault:K,classNames:te,icons:ee,closeButtonAriaLabel:W="Close toast",pauseWhenPageIsHidden:U,cn:O}=e,[q,Y]=y.useState(!1),[ce,J]=y.useState(!1),[ue,ie]=y.useState(!1),[ve,re]=y.useState(!1),[We,$]=y.useState(0),[pe,ye]=y.useState(0),Ae=y.useRef(null),Fe=y.useRef(null),Oe=C===0,de=C+1<=x,be=p.type,Be=p.dismissible!==!1,Re=p.className||"",Qe=p.descriptionClassName||"",st=y.useMemo(()=>b.findIndex(_e=>_e.toastId===p.id)||0,[b,p.id]),Nt=y.useMemo(()=>{var _e;return(_e=p.closeButton)!=null?_e:T},[p.closeButton,T]),_t=y.useMemo(()=>p.duration||G||sj,[p.duration,G]),At=y.useRef(0),it=y.useRef(0),Yt=y.useRef(0),Rt=y.useRef(null),[It,Ye]=V.split("-"),lr=y.useMemo(()=>b.reduce((_e,qe,ze)=>ze>=st?_e:_e+qe.height,0),[b,st]),br=XE(),xo=p.invert||h,Ht=be==="loading";it.current=y.useMemo(()=>st*Q+lr,[st,lr]),y.useEffect(()=>{Y(!0)},[]),y.useLayoutEffect(()=>{if(!q)return;let _e=Fe.current,qe=_e.style.height;_e.style.height="auto";let ze=_e.getBoundingClientRect().height;_e.style.height=qe,ye(ze),g(xt=>xt.find(Ze=>Ze.toastId===p.id)?xt.map(Ze=>Ze.toastId===p.id?{...Ze,height:ze}:Ze):[{toastId:p.id,height:ze,position:p.position},...xt])},[q,p.title,p.description,g,p.id]);let Kt=y.useCallback(()=>{J(!0),$(it.current),g(_e=>_e.filter(qe=>qe.toastId!==p.id)),setTimeout(()=>{S(p)},uj)},[p,S,g,it]);y.useEffect(()=>{if(p.promise&&be==="loading"||p.duration===1/0||p.type==="loading")return;let _e,qe=_t;return w||m||U&&br?(()=>{if(Yt.current<At.current){let ze=new Date().getTime()-At.current;qe=qe-ze}Yt.current=new Date().getTime()})():qe!==1/0&&(At.current=new Date().getTime(),_e=setTimeout(()=>{var ze;(ze=p.onAutoClose)==null||ze.call(p,p),Kt()},qe)),()=>clearTimeout(_e)},[w,m,K,p,_t,Kt,p.promise,be,U,br]),y.useEffect(()=>{let _e=Fe.current;if(_e){let qe=_e.getBoundingClientRect().height;return ye(qe),g(ze=>[{toastId:p.id,height:qe,position:p.position},...ze]),()=>g(ze=>ze.filter(xt=>xt.toastId!==p.id))}},[g,p.id]),y.useEffect(()=>{p.delete&&Kt()},[Kt,p.delete]);function In(){return ee!=null&&ee.loading?y.createElement("div",{className:"sonner-loader","data-visible":be==="loading"},ee.loading):H?y.createElement("div",{className:"sonner-loader","data-visible":be==="loading"},H):y.createElement(ZE,{visible:be==="loading"})}return y.createElement("li",{"aria-live":p.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Fe,className:O(D,Re,te==null?void 0:te.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,te==null?void 0:te.default,te==null?void 0:te[be],(r=p==null?void 0:p.classNames)==null?void 0:r[be]),"data-sonner-toast":"","data-rich-colors":(n=p.richColors)!=null?n:A,"data-styled":!(p.jsx||p.unstyled||v),"data-mounted":q,"data-promise":!!p.promise,"data-removed":ce,"data-visible":de,"data-y-position":It,"data-x-position":Ye,"data-index":C,"data-front":Oe,"data-swiping":ue,"data-dismissible":Be,"data-type":be,"data-invert":xo,"data-swipe-out":ve,"data-expanded":!!(w||K&&q),style:{"--index":C,"--toasts-before":C,"--z-index":_.length-C,"--offset":`${ce?We:it.current}px`,"--initial-height":K?"auto":`${pe}px`,...E,...p.style},onPointerDown:_e=>{Ht||!Be||(Ae.current=new Date,$(it.current),_e.target.setPointerCapture(_e.pointerId),_e.target.tagName!=="BUTTON"&&(ie(!0),Rt.current={x:_e.clientX,y:_e.clientY}))},onPointerUp:()=>{var _e,qe,ze,xt;if(ve||!Be)return;Rt.current=null;let Ze=Number(((_e=Fe.current)==null?void 0:_e.style.getPropertyValue("--swipe-amount").replace("px",""))||0),ut=new Date().getTime()-((qe=Ae.current)==null?void 0:qe.getTime()),wt=Math.abs(Ze)/ut;if(Math.abs(Ze)>=cj||wt>.11){$(it.current),(ze=p.onDismiss)==null||ze.call(p,p),Kt(),re(!0);return}(xt=Fe.current)==null||xt.style.setProperty("--swipe-amount","0px"),ie(!1)},onPointerMove:_e=>{var qe;if(!Rt.current||!Be)return;let ze=_e.clientY-Rt.current.y,xt=_e.clientX-Rt.current.x,Ze=(It==="top"?Math.min:Math.max)(0,ze),ut=_e.pointerType==="touch"?10:2;Math.abs(Ze)>ut?(qe=Fe.current)==null||qe.style.setProperty("--swipe-amount",`${ze}px`):Math.abs(xt)>ut&&(Rt.current=null)}},Nt&&!p.jsx?y.createElement("button",{"aria-label":W,"data-disabled":Ht,"data-close-button":!0,onClick:Ht||!Be?()=>{}:()=>{var _e;Kt(),(_e=p.onDismiss)==null||_e.call(p,p)},className:O(te==null?void 0:te.closeButton,(o=p==null?void 0:p.classNames)==null?void 0:o.closeButton)},y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},y.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,p.jsx||y.isValidElement(p.title)?p.jsx||p.title:y.createElement(y.Fragment,null,be||p.icon||p.promise?y.createElement("div",{"data-icon":"",className:O(te==null?void 0:te.icon,(a=p==null?void 0:p.classNames)==null?void 0:a.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||In():null,p.type!=="loading"?p.icon||(ee==null?void 0:ee[be])||WE(be):null):null,y.createElement("div",{"data-content":"",className:O(te==null?void 0:te.content,(s=p==null?void 0:p.classNames)==null?void 0:s.content)},y.createElement("div",{"data-title":"",className:O(te==null?void 0:te.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},p.title),p.description?y.createElement("div",{"data-description":"",className:O(M,Qe,te==null?void 0:te.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},p.description):null),y.isValidElement(p.cancel)?p.cancel:p.cancel&&Si(p.cancel)?y.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||k,onClick:_e=>{var qe,ze;Si(p.cancel)&&Be&&((ze=(qe=p.cancel).onClick)==null||ze.call(qe,_e),Kt())},className:O(te==null?void 0:te.cancelButton,(d=p==null?void 0:p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,y.isValidElement(p.action)?p.action:p.action&&Si(p.action)?y.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||R,onClick:_e=>{var qe,ze;Si(p.action)&&(_e.defaultPrevented||((ze=(qe=p.action).onClick)==null||ze.call(qe,_e),Kt()))},className:O(te==null?void 0:te.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function Dh(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var hj=e=>{let{invert:t,position:r="bottom-right",hotkey:n=["altKey","KeyT"],expand:o,closeButton:a,className:s,offset:c,theme:u="light",richColors:d,duration:f,style:h,visibleToasts:p=oj,toastOptions:v,dir:m=Dh(),gap:g=lj,loadingIcon:x,icons:b,containerAriaLabel:C="Notifications",pauseWhenPageIsHidden:_,cn:w=dj}=e,[S,A]=y.useState([]),T=y.useMemo(()=>Array.from(new Set([r].concat(S.filter(U=>U.position).map(U=>U.position)))),[S,r]),[E,k]=y.useState([]),[R,D]=y.useState(!1),[M,G]=y.useState(!1),[V,Q]=y.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=y.useRef(null),K=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),te=y.useRef(null),ee=y.useRef(!1),W=y.useCallback(U=>{var O;(O=S.find(q=>q.id===U.id))!=null&&O.delete||wr.dismiss(U.id),A(q=>q.filter(({id:Y})=>Y!==U.id))},[S]);return y.useEffect(()=>wr.subscribe(U=>{if(U.dismiss){A(O=>O.map(q=>q.id===U.id?{...q,delete:!0}:q));return}setTimeout(()=>{Ur.flushSync(()=>{A(O=>{let q=O.findIndex(Y=>Y.id===U.id);return q!==-1?[...O.slice(0,q),{...O[q],...U},...O.slice(q+1)]:[U,...O]})})})}),[]),y.useEffect(()=>{if(u!=="system"){Q(u);return}u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Q("dark"):Q("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:U})=>{Q(U?"dark":"light")})},[u]),y.useEffect(()=>{S.length<=1&&D(!1)},[S]),y.useEffect(()=>{let U=O=>{var q,Y;n.every(ce=>O[ce]||O.code===ce)&&(D(!0),(q=H.current)==null||q.focus()),O.code==="Escape"&&(document.activeElement===H.current||(Y=H.current)!=null&&Y.contains(document.activeElement))&&D(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[n]),y.useEffect(()=>{if(H.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,ee.current=!1)}},[H.current]),S.length?y.createElement("section",{"aria-label":`${C} ${K}`,tabIndex:-1},T.map((U,O)=>{var q;let[Y,ce]=U.split("-");return y.createElement("ol",{key:U,dir:m==="auto"?Dh():m,tabIndex:-1,ref:H,className:s,"data-sonner-toaster":!0,"data-theme":V,"data-y-position":Y,"data-x-position":ce,style:{"--front-toast-height":`${((q=E[0])==null?void 0:q.height)||0}px`,"--offset":typeof c=="number"?`${c}px`:c||aj,"--width":`${ij}px`,"--gap":`${g}px`,...h},onBlur:J=>{ee.current&&!J.currentTarget.contains(J.relatedTarget)&&(ee.current=!1,te.current&&(te.current.focus({preventScroll:!0}),te.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||ee.current||(ee.current=!0,te.current=J.relatedTarget)},onMouseEnter:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{M||D(!1)},onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||G(!0)},onPointerUp:()=>G(!1)},S.filter(J=>!J.position&&O===0||J.position===U).map((J,ue)=>{var ie,ve;return y.createElement(fj,{key:J.id,icons:b,index:ue,toast:J,defaultRichColors:d,duration:(ie=v==null?void 0:v.duration)!=null?ie:f,className:v==null?void 0:v.className,descriptionClassName:v==null?void 0:v.descriptionClassName,invert:t,visibleToasts:p,closeButton:(ve=v==null?void 0:v.closeButton)!=null?ve:a,interacting:M,position:U,style:v==null?void 0:v.style,unstyled:v==null?void 0:v.unstyled,classNames:v==null?void 0:v.classNames,cancelButtonStyle:v==null?void 0:v.cancelButtonStyle,actionButtonStyle:v==null?void 0:v.actionButtonStyle,removeToast:W,toasts:S.filter(re=>re.position==J.position),heights:E.filter(re=>re.position==J.position),setHeights:k,expandByDefault:o,gap:g,loadingIcon:x,expanded:R,pauseWhenPageIsHidden:_,cn:w})}))})):null};function tn(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function Ho(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const wm=6048e5,pj=864e5;let mj={};function tc(){return mj}function Ls(e,t){var c,u,d,f;const r=tc(),n=(t==null?void 0:t.weekStartsOn)??((u=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??r.weekStartsOn??((f=(d=r.locale)==null?void 0:d.options)==null?void 0:f.weekStartsOn)??0,o=tn(e),a=o.getDay(),s=(a<n?7:0)+a-n;return o.setDate(o.getDate()-s),o.setHours(0,0,0,0),o}function bl(e){return Ls(e,{weekStartsOn:1})}function Sm(e){const t=tn(e),r=t.getFullYear(),n=Ho(e,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const o=bl(n),a=Ho(e,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const s=bl(a);return t.getTime()>=o.getTime()?r+1:t.getTime()>=s.getTime()?r:r-1}function Oh(e){const t=tn(e);return t.setHours(0,0,0,0),t}function Mh(e){const t=tn(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function gj(e,t){const r=Oh(e),n=Oh(t),o=+r-Mh(r),a=+n-Mh(n);return Math.round((o-a)/pj)}function vj(e){const t=Sm(e),r=Ho(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),bl(r)}function xj(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function yj(e){if(!xj(e)&&typeof e!="number")return!1;const t=tn(e);return!isNaN(Number(t))}function bj(e){const t=tn(e),r=Ho(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}const Cj={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},wj=(e,t,r)=>{let n;const o=Cj[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function $c(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const Sj={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ej={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},jj={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},_j={date:$c({formats:Sj,defaultWidth:"full"}),time:$c({formats:Ej,defaultWidth:"full"}),dateTime:$c({formats:jj,defaultWidth:"full"})},Tj={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Pj=(e,t,r,n)=>Tj[e];function Qa(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const s=e.defaultFormattingWidth||e.defaultWidth,c=r!=null&&r.width?String(r.width):s;o=e.formattingValues[c]||e.formattingValues[s]}else{const s=e.defaultWidth,c=r!=null&&r.width?String(r.width):e.defaultWidth;o=e.values[c]||e.values[s]}const a=e.argumentCallback?e.argumentCallback(t):t;return o[a]}}const Nj={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Rj={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},kj={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Aj={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Lj={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Dj={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Oj=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Mj={ordinalNumber:Oj,era:Qa({values:Nj,defaultWidth:"wide"}),quarter:Qa({values:Rj,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Qa({values:kj,defaultWidth:"wide"}),day:Qa({values:Aj,defaultWidth:"wide"}),dayPeriod:Qa({values:Lj,defaultWidth:"wide",formattingValues:Dj,defaultFormattingWidth:"wide"})};function es(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;const s=a[0],c=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(c)?Fj(c,h=>h.test(s)):Ij(c,h=>h.test(s));let d;d=e.valueCallback?e.valueCallback(u):u,d=r.valueCallback?r.valueCallback(d):d;const f=t.slice(s.length);return{value:d,rest:f}}}function Ij(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function Fj(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function Bj(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const o=n[0],a=t.match(e.parsePattern);if(!a)return null;let s=e.valueCallback?e.valueCallback(a[0]):a[0];s=r.valueCallback?r.valueCallback(s):s;const c=t.slice(o.length);return{value:s,rest:c}}}const Hj=/^(\d+)(th|st|nd|rd)?/i,Vj=/\d+/i,$j={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Uj={any:[/^b/i,/^(a|c)/i]},Wj={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},zj={any:[/1/i,/2/i,/3/i,/4/i]},Zj={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Gj={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},qj={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Yj={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Kj={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Xj={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Jj={ordinalNumber:Bj({matchPattern:Hj,parsePattern:Vj,valueCallback:e=>parseInt(e,10)}),era:es({matchPatterns:$j,defaultMatchWidth:"wide",parsePatterns:Uj,defaultParseWidth:"any"}),quarter:es({matchPatterns:Wj,defaultMatchWidth:"wide",parsePatterns:zj,defaultParseWidth:"any",valueCallback:e=>e+1}),month:es({matchPatterns:Zj,defaultMatchWidth:"wide",parsePatterns:Gj,defaultParseWidth:"any"}),day:es({matchPatterns:qj,defaultMatchWidth:"wide",parsePatterns:Yj,defaultParseWidth:"any"}),dayPeriod:es({matchPatterns:Kj,defaultMatchWidth:"any",parsePatterns:Xj,defaultParseWidth:"any"})},Qj={code:"en-US",formatDistance:wj,formatLong:_j,formatRelative:Pj,localize:Mj,match:Jj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function e_(e){const t=tn(e);return gj(t,bj(t))+1}function t_(e){const t=tn(e),r=+bl(t)-+vj(t);return Math.round(r/wm)+1}function Em(e,t){var f,h,p,v;const r=tn(e),n=r.getFullYear(),o=tc(),a=(t==null?void 0:t.firstWeekContainsDate)??((h=(f=t==null?void 0:t.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??o.firstWeekContainsDate??((v=(p=o.locale)==null?void 0:p.options)==null?void 0:v.firstWeekContainsDate)??1,s=Ho(e,0);s.setFullYear(n+1,0,a),s.setHours(0,0,0,0);const c=Ls(s,t),u=Ho(e,0);u.setFullYear(n,0,a),u.setHours(0,0,0,0);const d=Ls(u,t);return r.getTime()>=c.getTime()?n+1:r.getTime()>=d.getTime()?n:n-1}function r_(e,t){var c,u,d,f;const r=tc(),n=(t==null?void 0:t.firstWeekContainsDate)??((u=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??r.firstWeekContainsDate??((f=(d=r.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,o=Em(e,t),a=Ho(e,0);return a.setFullYear(o,0,n),a.setHours(0,0,0,0),Ls(a,t)}function n_(e,t){const r=tn(e),n=+Ls(r,t)-+r_(r,t);return Math.round(n/wm)+1}function nt(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const $n={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return nt(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):nt(r+1,2)},d(e,t){return nt(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return nt(e.getHours()%12||12,t.length)},H(e,t){return nt(e.getHours(),t.length)},m(e,t){return nt(e.getMinutes(),t.length)},s(e,t){return nt(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),o=Math.trunc(n*Math.pow(10,r-3));return nt(o,t.length)}},ta={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ih={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return $n.y(e,t)},Y:function(e,t,r,n){const o=Em(e,n),a=o>0?o:1-o;if(t==="YY"){const s=a%100;return nt(s,2)}return t==="Yo"?r.ordinalNumber(a,{unit:"year"}):nt(a,t.length)},R:function(e,t){const r=Sm(e);return nt(r,t.length)},u:function(e,t){const r=e.getFullYear();return nt(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return nt(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return nt(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return $n.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return nt(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const o=n_(e,n);return t==="wo"?r.ordinalNumber(o,{unit:"week"}):nt(o,t.length)},I:function(e,t,r){const n=t_(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):nt(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):$n.d(e,t)},D:function(e,t,r){const n=e_(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):nt(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const o=e.getDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return nt(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});case"eeee":default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const o=e.getDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return nt(a,t.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});case"cccc":default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),o=n===0?7:n;switch(t){case"i":return String(o);case"ii":return nt(o,t.length);case"io":return r.ordinalNumber(o,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let o;switch(n===12?o=ta.noon:n===0?o=ta.midnight:o=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let o;switch(n>=17?o=ta.evening:n>=12?o=ta.afternoon:n>=4?o=ta.morning:o=ta.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return $n.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):$n.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):nt(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):nt(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):$n.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):$n.s(e,t)},S:function(e,t){return $n.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return Bh(n);case"XXXX":case"XX":return bo(n);case"XXXXX":case"XXX":default:return bo(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return Bh(n);case"xxxx":case"xx":return bo(n);case"xxxxx":case"xxx":default:return bo(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Fh(n,":");case"OOOO":default:return"GMT"+bo(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Fh(n,":");case"zzzz":default:return"GMT"+bo(n,":")}},t:function(e,t,r){const n=Math.trunc(e.getTime()/1e3);return nt(n,t.length)},T:function(e,t,r){const n=e.getTime();return nt(n,t.length)}};function Fh(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=Math.trunc(n/60),a=n%60;return a===0?r+String(o):r+String(o)+t+nt(a,2)}function Bh(e,t){return e%60===0?(e>0?"-":"+")+nt(Math.abs(e)/60,2):bo(e,t)}function bo(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=nt(Math.trunc(n/60),2),a=nt(n%60,2);return r+o+t+a}const Hh=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},jm=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},o_=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],o=r[2];if(!o)return Hh(e,t);let a;switch(n){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",Hh(n,t)).replace("{{time}}",jm(o,t))},a_={p:jm,P:o_},s_=/^D+$/,i_=/^Y+$/,l_=["D","DD","YY","YYYY"];function c_(e){return s_.test(e)}function u_(e){return i_.test(e)}function d_(e,t,r){const n=f_(e,t,r);if(console.warn(n),l_.includes(e))throw new RangeError(n)}function f_(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const h_=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,p_=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,m_=/^'([^]*?)'?$/,g_=/''/g,v_=/[a-zA-Z]/;function $u(e,t,r){var f,h,p,v;const n=tc(),o=n.locale??Qj,a=n.firstWeekContainsDate??((h=(f=n.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,s=n.weekStartsOn??((v=(p=n.locale)==null?void 0:p.options)==null?void 0:v.weekStartsOn)??0,c=tn(e);if(!yj(c))throw new RangeError("Invalid time value");let u=t.match(p_).map(m=>{const g=m[0];if(g==="p"||g==="P"){const x=a_[g];return x(m,o.formatLong)}return m}).join("").match(h_).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const g=m[0];if(g==="'")return{isToken:!1,value:x_(m)};if(Ih[g])return{isToken:!0,value:m};if(g.match(v_))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:m}});o.localize.preprocessor&&(u=o.localize.preprocessor(c,u));const d={firstWeekContainsDate:a,weekStartsOn:s,locale:o};return u.map(m=>{if(!m.isToken)return m.value;const g=m.value;(u_(g)||c_(g))&&d_(g,t,String(e));const x=Ih[g[0]];return x(c,g,o.localize,d)}).join("")}function x_(e){const t=e.match(m_);return t?t[1].replace(g_,"'"):e}var Uc="Balance",Ei={Number:"NUMBER",Text:"TEXT",Textarea:"LARGE_TEXT",Checkbox:"CHECK_BOX",Hidden:"HIDDEN"},_m={recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null},Vh=(e,t)=>{const{productId:r,productVariantId:n,quantity:o}=t,a=e.find(c=>c.id===r);if(!a)throw new Error("Product does not exist");const s=a.variants.find(c=>c.id===n);if(!s)throw new Error("Variant does not exist");if(o!==void 0&&s.quantity.available<o)throw new Error("Not enough quantity available");return s},y_=(e,t)=>e.reduce((r,n)=>{var s;const o=t.find(c=>(c==null?void 0:c.id)===n.productId),a=o==null?void 0:o.variants.find(c=>c.id===n.productVariantId);return a?a.subscriptionSettings?r+a.subscriptionSettings.price.amount+(((s=a.subscriptionSettings.entryFee)==null?void 0:s.amount)||0):r+a.price.amount*n.quantity:r},0),b_=(e,t)=>({isRequired:t.some(n=>{var a;const o=e.find(s=>(s==null?void 0:s.id)===n.productId);return(a=o==null?void 0:o.variants.find(s=>s.id===n.productVariantId))==null?void 0:a.discordSettings.isRequired}),isEnabled:t.some(n=>{var a;const o=e.find(s=>(s==null?void 0:s.id)===n.productId);return(a=o==null?void 0:o.variants.find(s=>s.id===n.productVariantId))==null?void 0:a.discordSettings.isEnabled})}),$h=e=>new Set(e.gateways.map(t=>t.name)),Uh={availableGateways:[],requiresSignInGateways:[]},Wh=(e,t)=>{var a;if(t.length===0)return Uh;const r=(a=t[0])==null?void 0:a.variants[0];if(!r)return Uh;const n=$h(r);for(const s of e){const c=t.find(f=>f.id===s.productId);if(!c)continue;const u=c.variants.find(f=>f.id===s.productVariantId);if(!u)continue;const d=$h(u);for(const f of n)d.has(f)||n.delete(f)}return!le.get(ho)&&n.has(Uc)?(n.delete(Uc),{availableGateways:[...n],requiresSignInGateways:[Uc]}):{availableGateways:[...n],requiresSignInGateways:[]}},C_=(e,t)=>{if(e.length===0)return[];const n=e.map(a=>{const s=t.find(u=>u.id===a.productId),c=s==null?void 0:s.variants.find(u=>u.id===a.productVariantId);return(c==null?void 0:c.customFields)??[]}).flat().reduce((a,s)=>{const c=a[s.name];return c?(s.required&&!c.required&&(a[s.name]=s),a):(a[s.name]=s,a)},{});return Object.values(n).map(a=>({...a,valueAtom:Ke("")}))},w_=(e,t)=>{const r=t.find(o=>o.id===e.productId),n=r==null?void 0:r.variants.find(o=>o.id===e.productVariantId);if(n!=null&&n.subscriptionSettings)return!0},Ds=Ke(null).pipe(vd("customerEmail")),ft=Ke({..._m,customerEmail:""}),ra=Ke(null),zt=Ke([]),S_=Ke([]),ni=()=>{const[e,t]=y.useState(!1),[r,n]=y.useState(!1),[o,a]=he(Ds),[,s]=he(po),c=y.useCallback(async v=>{t(!0);const m=await Ux(v);return zt(le,[...le.get(zt),...m]),t(!1),m},[zt]),u=y.useCallback(async v=>{t(!0);const m=await Vx(v);return zt(le,m.products),t(!1),m},[zt]),d=y.useCallback(async v=>{var C;n(!0);const{gateway:m,parts:g}=le.get(ft);if(!m)throw n(!1),ua("There should be a gateway for the coupon"),new Error("There should be a gateway for the coupon");const x=g.map(_=>_.productId),b=await Sx({gateway:m,couponName:v,productIds:x}).catch(_=>{console.log(_)});if(n(!1),(C=b.data.restrictToProductIds)!=null&&C.length&&!x.every(_=>{var w;return(w=b.data.restrictToProductIds)==null?void 0:w.includes(_)}))throw ua("Coupon can't be applied to such products"),new Error("Coupon can't be applied to such products");return ft(le,_=>({..._,coupon:v})),ra(le,b.data),s(_=>[..._,{isActive:!0,status:!0,id:new Date().getTime(),message:"Coupon applied successfully"}]),b.data},[ft,ra]),f=y.useCallback(async v=>{zt(le,[...le.get(zt),...v])},[zt]),h=y.useCallback(async v=>{const m=le.get(zt);Vh(m,v);const g=le.get(ft).parts;if(g.some(x=>x.productId===v.productId&&x.productVariantId===v.productVariantId))throw new Error("Product with same ID and VariantID already exists in the cart");if(g.length&&!Wh([...g,v],m).availableGateways.length)throw new Error("No common payment gateways available");ft(le,x=>({...x,parts:[...x.parts,v]}))},[ft,zt]),p=y.useMemo(()=>({reset(){ft(le,{customerEmail:o||"",..._m})},addProducts:f,addProductToCart:h,removeProduct({productId:v,productVariantId:m}){ft(le,g=>({...g,parts:g.parts.filter(x=>x.productId!==v&&x.productVariantId!==m)}))},getPossibleGateways(){return Wh(le.get(ft).parts,le.get(zt))},removeCoupon(){ra(le,null)},getDiscordSettings(){const v=le.get(zt),m=le.get(ft);return b_(v,m.parts)},setRecaptcha(v){ft(le,m=>({...m,recaptcha:v}))},updateQuantityOfProduct(v){const m=le.get(zt);Vh(m,v),ft(le,g=>({...g,parts:le.get(ft).parts.map(x=>x.productId===v.productId&&x.productVariantId===v.productVariantId?{...x,quantity:v.quantity}:x)}))},getTotalAndDiscount(){const v=y_(le.get(ft).parts,le.get(zt)),m=le.get(ra);let g;return m&&m.discount&&(g=m.isFixed?Math.max(0,v-m.discount):v*(1-m.discount/100)),{total:v,totalWithDiscount:g}},setGateway(v){ft(le,m=>({...m,gateway:v})),le.get(ft).coupon&&d(le.get(ft).coupon)},setPaymentMethod(v){ft(le,m=>({...m,paymentMethod:v}))},async submitCart(){t(!0);const v=le.get(ft);let m;return v.parts&&w_(v.parts[0],le.get(zt))?m=await Px({...v,partOrder:v.parts[0],referralCode:localStorage.getItem("referralCode")}).catch(g=>{console.log(g)}):m=await Tx({...le.get(ft),referralCode:localStorage.getItem("referralCode")}).catch(g=>{console.log(g)}),t(!1),m&&s(g=>[...g,{isActive:!0,status:!0,id:new Date().getTime(),message:"Order created successfully"}]),m},setDiscordSocialConnectId(v){ft(le,m=>({...m,discordSocialConnectId:v}))},setCustomFields(v){ft(le,m=>({...m,customFields:v}))}}),[o,zt,ft,ra,d,h]);return y.useEffect(()=>{ft(le,v=>({...v,customerEmail:o??""}))},[o]),{cart:he(ft)[0],products:he(zt)[0],coupon:he(ra)[0],pending:e,applyCouponPending:r,getProducts:c,applyCoupon:d,setCustomerEmail:a,getPages:u,...p}},h1="-";function E_(e){const t=__(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;function o(s){const c=s.split(h1);return c[0]===""&&c.length!==1&&c.shift(),Tm(c,t)||j_(s)}function a(s,c){const u=r[s]||[];return c&&n[s]?[...u,...n[s]]:u}return{getClassGroupId:o,getConflictingClassGroupIds:a}}function Tm(e,t){var s;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),o=n?Tm(e.slice(1),n):void 0;if(o)return o;if(t.validators.length===0)return;const a=e.join(h1);return(s=t.validators.find(({validator:c})=>c(a)))==null?void 0:s.classGroupId}var zh=/^\[(.+)\]$/;function j_(e){if(zh.test(e)){const t=zh.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}}function __(e){const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return P_(Object.entries(e.classGroups),r).forEach(([a,s])=>{Uu(s,n,a,t)}),n}function Uu(e,t,r,n){e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:Zh(t,o);a.classGroupId=r;return}if(typeof o=="function"){if(T_(o)){Uu(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([a,s])=>{Uu(s,Zh(t,a),r,n)})})}function Zh(e,t){let r=e;return t.split(h1).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r}function T_(e){return e.isThemeGetter}function P_(e,t){return t?e.map(([r,n])=>{const o=n.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([s,c])=>[t+s,c])):a);return[r,o]}):e}function N_(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;function o(a,s){r.set(a,s),t++,t>e&&(t=0,n=r,r=new Map)}return{get(a){let s=r.get(a);if(s!==void 0)return s;if((s=n.get(a))!==void 0)return o(a,s),s},set(a,s){r.has(a)?r.set(a,s):o(a,s)}}}var Pm="!";function R_(e){const t=e.separator,r=t.length===1,n=t[0],o=t.length;return function(s){const c=[];let u=0,d=0,f;for(let g=0;g<s.length;g++){let x=s[g];if(u===0){if(x===n&&(r||s.slice(g,g+o)===t)){c.push(s.slice(d,g)),d=g+o;continue}if(x==="/"){f=g;continue}}x==="["?u++:x==="]"&&u--}const h=c.length===0?s:s.substring(d),p=h.startsWith(Pm),v=p?h.substring(1):h,m=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:m}}}function k_(e){if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t}function A_(e){return{cache:N_(e.cacheSize),splitModifiers:R_(e),...E_(e)}}var L_=/\s+/;function D_(e,t){const{splitModifiers:r,getClassGroupId:n,getConflictingClassGroupIds:o}=t,a=new Set;return e.trim().split(L_).map(s=>{const{modifiers:c,hasImportantModifier:u,baseClassName:d,maybePostfixModifierPosition:f}=r(s);let h=n(f?d.substring(0,f):d),p=!!f;if(!h){if(!f)return{isTailwindClass:!1,originalClassName:s};if(h=n(d),!h)return{isTailwindClass:!1,originalClassName:s};p=!1}const v=k_(c).join(":");return{isTailwindClass:!0,modifierId:u?v+Pm:v,classGroupId:h,originalClassName:s,hasPostfixModifier:p}}).reverse().filter(s=>{if(!s.isTailwindClass)return!0;const{modifierId:c,classGroupId:u,hasPostfixModifier:d}=s,f=c+u;return a.has(f)?!1:(a.add(f),o(u,d).forEach(h=>a.add(c+h)),!0)}).reverse().map(s=>s.originalClassName).join(" ")}function O_(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Nm(t))&&(n&&(n+=" "),n+=r);return n}function Nm(e){if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Nm(e[n]))&&(r&&(r+=" "),r+=t);return r}function M_(e,...t){let r,n,o,a=s;function s(u){const d=t.reduce((f,h)=>h(f),e());return r=A_(d),n=r.cache.get,o=r.cache.set,a=c,c(u)}function c(u){const d=n(u);if(d)return d;const f=D_(u,r);return o(u,f),f}return function(){return a(O_.apply(null,arguments))}}function ht(e){const t=r=>r[e]||[];return t.isThemeGetter=!0,t}var Rm=/^\[(?:([a-z-]+):)?(.+)\]$/i,I_=/^\d+\/\d+$/,F_=new Set(["px","full","screen"]),B_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,H_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,V_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,$_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,U_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function bn(e){return No(e)||F_.has(e)||I_.test(e)}function Un(e){return Ha(e,"length",X_)}function No(e){return!!e&&!Number.isNaN(Number(e))}function ji(e){return Ha(e,"number",No)}function ts(e){return!!e&&Number.isInteger(Number(e))}function W_(e){return e.endsWith("%")&&No(e.slice(0,-1))}function He(e){return Rm.test(e)}function Wn(e){return B_.test(e)}var z_=new Set(["length","size","percentage"]);function Z_(e){return Ha(e,z_,km)}function G_(e){return Ha(e,"position",km)}var q_=new Set(["image","url"]);function Y_(e){return Ha(e,q_,Q_)}function K_(e){return Ha(e,"",J_)}function rs(){return!0}function Ha(e,t,r){const n=Rm.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1}function X_(e){return H_.test(e)&&!V_.test(e)}function km(){return!1}function J_(e){return $_.test(e)}function Q_(e){return U_.test(e)}function eT(){const e=ht("colors"),t=ht("spacing"),r=ht("blur"),n=ht("brightness"),o=ht("borderColor"),a=ht("borderRadius"),s=ht("borderSpacing"),c=ht("borderWidth"),u=ht("contrast"),d=ht("grayscale"),f=ht("hueRotate"),h=ht("invert"),p=ht("gap"),v=ht("gradientColorStops"),m=ht("gradientColorStopPositions"),g=ht("inset"),x=ht("margin"),b=ht("opacity"),C=ht("padding"),_=ht("saturate"),w=ht("scale"),S=ht("sepia"),A=ht("skew"),T=ht("space"),E=ht("translate"),k=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",He,t],M=()=>[He,t],G=()=>["",bn,Un],V=()=>["auto",No,He],Q=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>["start","end","center","between","around","evenly","stretch"],ee=()=>["","0",He],W=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[No,ji],O=()=>[No,He];return{cacheSize:500,separator:":",theme:{colors:[rs],spacing:[bn,Un],blur:["none","",Wn,He],brightness:U(),borderColor:[e],borderRadius:["none","","full",Wn,He],borderSpacing:M(),borderWidth:G(),contrast:U(),grayscale:ee(),hueRotate:O(),invert:ee(),gap:M(),gradientColorStops:[e],gradientColorStopPositions:[W_,Un],inset:D(),margin:D(),opacity:U(),padding:M(),saturate:U(),scale:U(),sepia:ee(),skew:O(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",He]}],container:["container"],columns:[{columns:[Wn]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Q(),He]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ts,He]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",He]}],grow:[{grow:ee()}],shrink:[{shrink:ee()}],order:[{order:["first","last","none",ts,He]}],"grid-cols":[{"grid-cols":[rs]}],"col-start-end":[{col:["auto",{span:["full",ts,He]},He]}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":[rs]}],"row-start-end":[{row:["auto",{span:[ts,He]},He]}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",He]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",He]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...te()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...te(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...te(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",He,t]}],"min-w":[{"min-w":[He,t,"min","max","fit"]}],"max-w":[{"max-w":[He,t,"none","full","min","max","fit","prose",{screen:[Wn]},Wn]}],h:[{h:[He,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[He,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[He,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[He,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Wn,Un]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ji]}],"font-family":[{font:[rs]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",He]}],"line-clamp":[{"line-clamp":["none",No,ji]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",bn,He]}],"list-image":[{"list-image":["none",He]}],"list-style-type":[{list:["none","disc","decimal",He]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",bn,Un]}],"underline-offset":[{"underline-offset":["auto",bn,He]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",He]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",He]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Q(),G_]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Z_]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Y_]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...H(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:H()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...H()]}],"outline-offset":[{"outline-offset":[bn,He]}],"outline-w":[{outline:[bn,Un]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[bn,Un]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Wn,K_]}],"shadow-color":[{shadow:[rs]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...K(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":K()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Wn,He]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[h]}],saturate:[{saturate:[_]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",He]}],duration:[{duration:O()}],ease:[{ease:["linear","in","out","in-out",He]}],delay:[{delay:O()}],animate:[{animate:["none","spin","ping","pulse","bounce",He]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[ts,He]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",He]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",He]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",He]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[bn,Un,ji]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}var vo=M_(eT),tT=({isActive:e,setIsActive:t,children:r,title:n,disabledToClose:o,withoutHeader:a,full:s,className:c})=>{const[u,d]=y.useState(!1),f=y.useRef(null),h=p=>{var v,m;if(p)return(v=f.current)==null||v.classList.add("block"),(m=f.current)==null||m.classList.remove("hidden"),setTimeout(()=>{d(!0)},10);if(!o)return d(!1),setTimeout(()=>{var g,x;(g=f.current)==null||g.classList.add("hidden"),(x=f.current)==null||x.classList.remove("block")},300)};return y.useEffect(()=>{h(e)},[e]),l.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-50",ref:f,children:[l.jsx("div",{className:`absolute top-0 left-0 right-0 bottom-0 bg-[rgba(37,37,37,0.24)] opacity-0 transition-opacity ${u&&"opacity-100"}`,onClick:()=>t(!1)}),l.jsxs("div",{className:vo("absolute w-full h-[80%] rounded-t-xl bottom-0 bg-surface100 translate-y-full duration-300 transition-all md:w-[640px] md:opacity-0 md:h-auto md:left-1/2 md:-translate-x-1/2 md:scale-50 md:top-1/2 md:bottom-auto md:rounded-xl md:-translate-y-1/2",u&&"translate-y-0 md:-translate-y-1/2 md:scale-[1] md:opacity-100",s&&"w-full md:w-full h-full md:h-full md:rounded-none rounded-none",c),children:[!a&&l.jsx("header",{className:"py-4 px-6 flex justify-between items-center border-b border-borderDefault",children:l.jsx("h1",{className:"text-xl font-bold",children:n})}),l.jsx("div",{className:"absolute top-6 right-6 w-5 h-5 flex items-center justify-center cursor-pointer text-textSecondary hover:text-textPrimary",onClick:()=>t(!1),children:l.jsx(zp,{})}),l.jsx("div",{className:"p-6 h-[92%]",children:r})]})]})},On=tT,Se=({onClick:e,style:t,className:r="",children:n,disabled:o=!1,type:a="Primary"})=>{const s=a==="Primary"?`flex items-center justify-center py-[10px] transition ease-in-out duration-300 px-[16px] h-[var(--button-height)] bg-[var(--button-primary-background)] text-[var(--button-primary-size)] shadow-[var(--button-primary-box-shadow)] hover:bg-[var(--surface-action1Hover)] rounded-[var(--button-primary-radius)] disabled:opacity-70 disabled:cursor-not-allowed ${r}`:`flex items-center justify-center py-[10px] transition ease-in-out duration-300 px-[16px] h-[var(--button-height)] bg-[var(--button-secondary-background)] text-[var(--button-secondary-size)] text-[var(--text-secondary)] shadow-[var(--button-secondary-box-shadow)] hover:bg-[var(--surface-action2Hover)] rounded-[var(--button-secondary-radius)] disabled:opacity-70 disabled:cursor-not-allowed ${r}`;return l.jsx("button",{className:s,onClick:e,style:t,disabled:o,children:n})},oi=()=>{const[e,t]=he(po);return r=>{navigator.clipboard.writeText(r),t([...e,{status:!0,message:"Successfully copied",title:"Success",isActive:!0,id:new Date().getTime()}])}},rT=({isActive:e,setIsActive:t,deliveryConfiguration:r})=>{const n=oi(),o=r.type==="DISCORD";let a=r.type==="SERIALS"?r.deliveryItems.map(s=>s.serialKey).join(`
|
|
141
|
-
`):r.deliveryItems[0].textData;return l.jsx(On,{title:"Thank you for the purchase!",isActive:e,setIsActive:t,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"flex-1",children:o?l.jsx("div",{className:"p-3 mt-2 w-full bg-surface0 rounded-custom overflow-auto",style:{scrollbarWidth:"thin"},children:l.jsx("p",{className:"text-textSecondary",children:"Discord role has been granted"})}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{children:"Content"}),l.jsxs(Se,{className:"text-textSecondary gap-1",type:"Secondary",onClick:()=>n(a),children:[l.jsx(_a,{}),"Copy to Clipboard"]})]}),l.jsx("div",{className:"p-3 mt-2 w-full h-[276px] bg-surface0 rounded-custom overflow-auto",style:{scrollbarWidth:"thin"},children:l.jsx("p",{className:"text-textSecondary",children:a})})]})}),l.jsx("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,{type:"Secondary",className:"w-full",onClick:()=>t(!1),children:"Close"})})})]})})},nT=rT,Am={TEXT:"View",SERIALS:"View",EBOOK:"View",LINK:"Visit",DOWNLOAD:"",CUSTOM:"View",DISCORD:"Access"},Lm={TEXT:"Content",SERIALS:"Content",EBOOK:"Ebook",LINK:"Link",DOWNLOAD:"Download",CUSTOM:"Content",DISCORD:"Discord"},Dm={TEXT:l.jsx(Ec,{}),SERIALS:l.jsx(Ec,{}),EBOOK:l.jsx(Kv,{}),LINK:l.jsx(cl,{}),DOWNLOAD:l.jsx(Yv,{}),CUSTOM:l.jsx(Ec,{}),DISCORD:l.jsx(qv,{})},oT=({deliveryConfiguration:e})=>{const t=e.type;return t==="TEXT"||t==="CUSTOM"||t==="SERIALS"||t==="DISCORD"?l.jsx(aT,{deliveryConfiguration:e}):l.jsx(sT,{deliveryConfiguration:e})},aT=({deliveryConfiguration:e})=>{const t=e.type,[r,n]=y.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"py-2 px-4 min-w-[120px] flex gap-1 justify-center bg-surface0 rounded-custom cursor-pointer",onClick:()=>n(!0),children:[Dm[t],l.jsx("p",{className:"text-textSecondary text-sm",children:e.customName??`${Am[t]} ${Lm[t]}`})]}),l.jsx(nT,{deliveryConfiguration:e,isActive:r,setIsActive:n})]})},sT=({deliveryConfiguration:e})=>{const t=e.type;return l.jsxs("div",{className:"py-2 px-4 min-w-[120px] flex gap-1 justify-center bg-surface0 rounded-custom cursor-pointer",onClick:()=>window.open(e.deliveryItems[0].textData,"_blank"),children:[Dm[t],l.jsx("p",{className:"text-textSecondary text-sm",children:e.customName??`${Am[t]} ${Lm[t]}`})]})},iT=oT,lT=({isOrder:e,product:t})=>{const[r]=he(Pa),n=t.subscriptionSettings;return l.jsxs("div",{className:e?"pb-6 border-b border-borderDefault last-of-type:border-none last-of-type:pb-0":void 0,children:[l.jsxs("div",{className:"w-full flex items-center gap-3",children:[l.jsx("div",{className:`min-w-12 h-12 flex items-center justify-center bg-surface100 rounded-custom overflow-hidden ${e&&"!bg-surface0"}`,children:t!=null&&t.image?l.jsx("img",{className:"w-full h-full object-contain",src:Fr(t.image.cfId),alt:t==null?void 0:t.name}):l.jsx(Ul,{})}),l.jsxs("div",{className:"text-sm w-full max-w-[65%]",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h2",{children:t.name}),l.jsxs("span",{className:"block text-sm text-textSecondary px-1 h-5 bg-borderDefault rounded-sm",children:[t.price.quantity,"x"]})]}),l.jsx("p",{className:"text-textSecondary overflow-ellipsis overflow-hidden whitespace-nowrap max-w-full",children:t.description})]}),l.jsx("p",{className:"font-semibold text-base max-w-[40%] w-full text-right",children:n?`${kt(n.price)} / ${ox(n.recurringIntervalDays||0)}${n.entryFee?" + "+kt(n.entryFee):""}`:kt(t.price)})]}),t.deliveryCategories&&l.jsx("div",{className:"w-full flex gap-3 flex-wrap mt-4",children:t.deliveryCategories.map(o=>l.jsx(iT,{deliveryConfiguration:o},o.id))}),t.customerNote&&l.jsxs("div",{className:"py-3 px-4 mt-4 bg-surface0 rounded-lg",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[(r==null?void 0:r.info.logo)&&l.jsx("div",{className:"w-6 h-6 flex items-center justify-center border border-borderDefault rounded-[50%] bg-surface100 overflow-hidden",children:l.jsx("img",{src:Fr(r==null?void 0:r.info.logo.cfId),alt:r.info.name})}),l.jsx("p",{className:"font-medium",children:r==null?void 0:r.info.name})]}),l.jsx("p",{className:"mt-1 text-sm text-textSecondary",children:t.customerNote})]})]})},p1=lT,cT={primary:"bg-surface0",secondary:"bg-surface100"},Mn=y.forwardRef(({icon:e=null,iconPosition:t=0,className:r="",variant:n,...o},a)=>l.jsxs("div",{className:`relative flex items-center w-full ${r}`,children:[e&&t===0&&l.jsx("div",{className:"absolute inset-y-0 left-4 flex items-center",children:e}),l.jsx("input",{ref:a,className:`outline-brandDefault block h-12 w-full rounded-custom border-none bg-surface0 p-3 align-middle placeholder:text-surface200 ${e?t===0?"pl-9":"pr-10":""} ${n&&cT[n]}`,...o}),e&&t===1&&l.jsx("div",{className:"absolute inset-y-0 right-[14px] flex items-center",children:e})]})),uT=({content:e})=>l.jsx("div",{className:"w-[160px] py-1 px-2 rounded-sm bg-textPrimary text-surface100",children:l.jsx("p",{className:"text-xs",children:e})}),dT=uT,fT=({applyCoupon:e,applyCouponPending:t,couponData:r,discount:n,removeCoupon:o,gateway:a})=>{const[s,c]=y.useState("");return l.jsx("div",{children:r?l.jsxs("div",{className:"w-full h-12 px-4 gap-4 flex items-center bg-surface100 rounded-custom ",children:[l.jsx(Gs,{}),l.jsxs("p",{children:[s," is applied"," ",l.jsxs("span",{className:"ml-1 text-base text-textSecondary",children:["-",n," ",!r.isFixed&&`(${r.discount}%)`]})]}),l.jsx(Se,{className:"ml-auto",type:"Secondary",onClick:o,children:"Remove"})]}):l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Mn,{variant:"secondary",placeholder:"Enter a discount code",value:s,onChange:u=>c(u.target.value)}),l.jsxs(Qw,{children:[l.jsx(rS,{render:l.jsx("div",{children:l.jsx(Se,{className:"cursor-pointer",onClick:()=>e(s),disabled:!a,children:"Apply"})}),children:"Tooltip"}),!a&&l.jsx(Jw,{children:l.jsx(dT,{content:"The discount is related to the method of payment. Select to enter."})})]})]})})},hT=fT,pT=({className:e})=>{const[t]=he(Xp),[r]=he(Jp),[n]=he(Qp);return l.jsxs("footer",{className:`flex items-center justify-between h-14 mt-6 ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("p",{className:"text-textSecondary text-sm",children:"Powered by"}),l.jsx(Jv,{})]}),l.jsx("nav",{children:l.jsxs("ul",{className:"list-none flex gap-6 text-xs text-textSecondary",children:[(t==null?void 0:t.showTermsOfServiceOnProduct)&&l.jsx("li",{className:"hover:underline",children:l.jsx("a",{href:t.termsOfService,target:"_blank",children:"Terms"})}),(r==null?void 0:r.showPrivacyPolicyOnProduct)&&l.jsx("li",{className:"hover:underline",children:l.jsx("a",{href:r.privacyPolicy,target:"_blank",children:"Privacy"})}),(n==null?void 0:n.showRefundPolicyOnProduct)&&l.jsx("li",{className:"hover:underline",children:l.jsx("a",{href:n.refundPolicy,target:"_blank",children:"Refund"})})]})})]})},kn=pT,mT=({expiresAt:e})=>{const[t,r]=y.useState(n());function n(){const o=new Date,a=new Date(e).getTime()-o.getTime();if(a<=0)return{hours:0,minutes:0,seconds:0};const s=Math.floor(a/(1e3*60*60)),c=Math.floor(a%(1e3*60*60)/(1e3*60)),u=Math.floor(a%(1e3*60)/1e3);return{hours:String(s).padStart(2,"0"),minutes:String(c).padStart(2,"0"),seconds:String(u).padStart(2,"0")}}return y.useEffect(()=>{const o=setInterval(()=>{r(n())},1e3);return()=>clearInterval(o)},[e]),t.hours===0&&t.minutes===0&&t.seconds===0?null:l.jsxs("div",{className:"flex gap-1 items-center px-2.5 h-8 bg-borderDefault rounded-custom text-textSecondary ",children:[l.jsx(Vi,{}),l.jsxs("p",{className:"text-base",children:[t.hours,":",t.minutes,":",t.seconds]})]})},gT=mT,vT=({className:e,expiresAt:t})=>{const[r]=he(Pa),n=Hr();return l.jsxs("header",{className:`px-5 w-full flex items-center justify-between h-14 border-b border-borderDefault bg-surface100 md:h-auto md:bg-transparent md:border-none md:px-0 ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-5",children:[l.jsx("div",{className:"h-6 flex items-center ",children:l.jsx("div",{className:"w-5 h-5 -rotate-90 cursor-pointer text-textSecondary hover:text-textPrimary",onClick:()=>n(-1),children:l.jsx(Bp,{})})}),(r==null?void 0:r.info.logo)&&l.jsx("div",{className:"w-auto h-5 pl-4 border-l",children:l.jsx("img",{className:"w-full h-full object-contain",src:Fr(r.info.logo.cfId),alt:r.info.name})})]}),t&&l.jsx(gT,{expiresAt:t})]})},ai=vT,xT=({formatter:e,coupon:t,discount:r,totalWithDiscount:n,total:o,className:a})=>l.jsxs("div",{className:vo("mt-6 py-5 px-6 w-full flex flex-col gap-3 bg-borderDefault rounded-lg ",a),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.jsx("p",{children:e.format(o)})]}),t&&l.jsxs("div",{className:"w-full flex items-center justify-between gap-3 text-base",children:[l.jsxs("p",{className:"text-textSecondary",children:["Discount ",!t.isFixed&&`(${t.discount}%)`]}),l.jsxs("p",{children:["-",e.format(r)]})]}),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.jsx("p",{className:"font-semibold",children:n?e.format(n):e.format(o)})]})]}),rc=xT,yT=({cart:e,products:t,applyCoupon:r,applyCouponPending:n,coupon:o,totalAndDiscount:a,removeCoupon:s})=>{var h;const c=y.useMemo(()=>e.parts.map(p=>{const v=t.find(g=>g.id===p.productId),m=v==null?void 0:v.variants.find(g=>g.id===p.productVariantId);return{id:(v==null?void 0:v.id)||0,image:v==null?void 0:v.images[0],name:(m==null?void 0:m.name)||"",description:(m==null?void 0:m.description)||"",price:{quantity:p.quantity,amount:(m==null?void 0:m.price.amount)||0,currency:m==null?void 0:m.price.currency},subscriptionSettings:m==null?void 0:m.subscriptionSettings}}),[e,t]),u=((h=c[0])==null?void 0:h.price.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:u}),f=y.useMemo(()=>a.totalWithDiscount?a.total-a.totalWithDiscount:0,[a]);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,{}),l.jsxs("div",{className:"md:w-full md:h-full md:flex md:flex-col px-4 md:px-0",children:[l.jsx("header",{className:"flex justify-between items-center mt-6",children:l.jsx("h1",{className:"font-bold text-textPrimary text-lg",children:"Checkout"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("div",{className:"mt-6 w-full flex flex-col gap-4",children:c.map(p=>l.jsx(p1,{product:p},p.id))}),l.jsx("div",{className:"mt-6",children:l.jsx(hT,{applyCoupon:r,applyCouponPending:n,couponData:o,discount:d.format(f),removeCoupon:s,gateway:e.gateway})}),l.jsx(rc,{formatter:d,coupon:o,total:a.total,discount:f,totalWithDiscount:a.totalWithDiscount})]}),l.jsx("div",{children:l.jsx(kn,{className:"hidden md:flex"})})]})]})})},bT=yT,CT=({onCheckedChange:e,checked:t,...r})=>l.jsxs("label",{className:`w-5 h-5 flex items-center justify-center border border-borderHover rounded-[6px] transition-all cursor-pointer ${t&&"!border-brandDefault bg-brandLight"}`,children:[l.jsx("input",{className:"appearance-none",type:"checkbox",checked:t,onChange:n=>e&&e(n.target.checked),...r}),t&&l.jsx(Wv,{})]}),cs=CT,wT={primary:"bg-surface0",secondary:"bg-surface100"},ST=({variant:e,className:t,...r})=>{var n;return l.jsxs("div",{className:"relative",children:[l.jsx("textarea",{className:`outline-brandDefault block min-h-[96px] w-full rounded-custom border-none bg-surface0 p-3 align-middle placeholder:text-surface200 ${r.maxLength&&"pb-9"} ${e&&wT[e]} ${t}`,...r}),r.maxLength&&l.jsxs("span",{className:"absolute right-3 bottom-3 text-sm text-surface200",children:[((n=r.value)==null?void 0:n.toString().length)||0,"/",r.maxLength]})]})},m1=ST,ET=({customFields:e})=>{if(e.length===0)return null;const t=e.map(r=>l.jsx(jT,{customField:r},r.name));return l.jsx("div",{className:"flex flex-col gap-3 mt-8",children:t})},jT=({customField:e})=>{const[t,r]=he(e.valueAtom);return l.jsx(_T,{value:t,placeholder:e.placeholder,required:e.required,defaultValue:e.defaultValue,type:e.type,onValueChange:r,label:e.name,regex:e.regex})},_T=({label:e,type:t,defaultValue:r,value:n,placeholder:o,regex:a,required:s,onValueChange:c})=>{if(t===Ei.Checkbox)return l.jsxs("label",{className:mr("flex","gap-2","items-center","cursor-pointer"),children:[l.jsx(cs,{defaultChecked:typeof r=="boolean"?r:void 0,required:s,checked:!!n,onCheckedChange:d=>c(d)}),l.jsx("p",{className:"text-sm ",children:e})]});if(t==Ei.Hidden)return l.jsx("input",{type:"hidden",value:typeof r!="boolean"?r:void 0,required:s});const u=d=>{let f=/^\d*$/;t!=Ei.Number&&(f=a?new RegExp(a):new RegExp("")),f.test(d.target.value)&&c(d.target.value)};return t==Ei.Textarea?l.jsxs("div",{className:mr("flex","flex-col","gap-1"),children:[l.jsx("p",{className:"text-sm text-textSecondary",children:e}),l.jsx(m1,{value:n,placeholder:o,required:s,onChange:u})]}):l.jsxs("div",{className:mr("flex","flex-col","gap-1"),children:[l.jsx("p",{className:"text-sm text-textSecondary",children:e}),l.jsx(Mn,{value:n,placeholder:o,required:s,onChange:u})]})},TT=ET,PT=({className:e})=>l.jsxs("div",{className:vo("w-fit flex items-center rounded-custom gap-1 p-1 pl-[6px] bg-successBackground text-successText",e),children:[l.jsx(Zv,{}),l.jsx("p",{className:"text-sm",children:"Active"})]}),NT=PT,Om=Ke(null).pipe(vd("customerDiscordConnection")),RT=({customerEmail:e})=>{const[t,r]=y.useState({authorized:!1}),[n,o]=y.useState(),[a,s]=he(Om);y.useEffect(()=>{(async()=>{if(!(!a||a.email!==e))try{const d=await Mf({id:a.id,customerEmail:a.email});r({authorized:!0,id:d.discordId,avatar:d.avatar,username:d.username})}catch(d){s(null),console.log("Still waiting for authorization.",d)}})()},[]);const c=()=>{e===null||e.trim()===""||wx({customerEmail:e}).then(({id:u,redirectUrl:d})=>{let f=null;try{f=window.open(d)}catch(p){console.log("Error opening window:",p,f)}(!f||f.closed||typeof f.closed>"u")&&setTimeout(()=>{const p=document.createElement("a");p.href=d,p.target="_blank",p.click()});const h=setInterval(()=>{Mf({id:u,customerEmail:e}).then(p=>{r({authorized:!0,id:p.discordId,avatar:p.avatar,username:p.username}),s({id:u,email:e}),clearInterval(h),f&&f.close()}).catch(p=>{console.log("Still waiting for authorization.",p,{newWindow:f})}),console.log("dasf")},3e3);o(h)}).catch(u=>{console.log("Could not initiate Discord authorization",u)})};return y.useEffect(()=>()=>{n&&clearInterval(n)},[n]),t.authorized?l.jsxs("div",{className:"px-4 py-3 bg-surface0 rounded-custom flex justify-between items-center ",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-5 h-5 flex items-center justify-center rounded-[50%] overflow-hidden",children:t.avatar?l.jsx("img",{className:"w-full h-full object-cover",src:`https://cdn.discordapp.com/avatars/${t.id}/${t.avatar}.png?size=256`,alt:t.username}):l.jsx(Uv,{})}),l.jsx("p",{children:t.username}),l.jsx(NT,{})]}),l.jsx(Se,{type:"Secondary",onClick:c,children:"Reconnect"})]}):l.jsxs(Se,{type:"Secondary",className:"text-textSecondary gap-1 w-full",onClick:c,children:[l.jsx(Xv,{}),"Connect Your Discord"]})},kT=RT,AT=()=>l.jsxs("div",{className:"p-3 mt-4 flex items-center gap-2 rounded-custom bg-surface0",children:[l.jsx("div",{className:"min-w-4",children:l.jsx($p,{})}),l.jsx("p",{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."})]}),Mm=AT,LT=()=>l.jsxs("div",{className:"p-3 mt-4 flex items-center gap-2 rounded-custom bg-surface0",children:[l.jsx("div",{className:"min-w-4",children:l.jsx(Up,{})}),l.jsx("p",{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."})]}),Im=LT,Fm=(e=>(e.BankCard="BANK_CARD",e.BankTransfer="BANK_TRANSFER",e.PayPal="PAYPAL",e.CashApp="CASHAPP",e.Crypto="CRYPTO",e.AppleGooglePay="APPLE_AND_GOOGLE_PAY",e.Custom="CUSTOM",e))(Fm||{}),DT={CASHAPP:l.jsx(Hv,{}),APPLE_AND_GOOGLE_PAY:l.jsx($v,{}),BANK_CARD:l.jsx(Bv,{}),CRYPTO:l.jsx(Fv,{}),PAYPAL:l.jsx(Vv,{}),CUSTOM:l.jsx("div",{}),BANK_TRANSFER:l.jsx(zv,{})},OT={CASHAPP:"Cash App",APPLE_AND_GOOGLE_PAY:"Apple Pay / Google Pay",BANK_CARD:"Debit / Credit Card",CRYPTO:"Cryptocurrency",PAYPAL:"PayPal",CUSTOM:"",BANK_TRANSFER:"Bank Transfer"},MT=({align:e,paymentMethod:t,gatewayDisplayName:r,gateway:n,gatewayLogoCfId:o,poweredByLogoCfId:a,selected:s,onSelect:c})=>{const u=t==="CUSTOM";return l.jsxs("div",{className:`h-14 px-4 flex justify-between items-center border border-borderDefault rounded-lg md:flex-col-reverse md:items-start md:gap-2 md:min-h-[92px] cursor-pointer md:p-4 ${s&&"border-brandDefault"} ${e==="column"&&"flex-col-reverse h-[92px] p-4 !items-start"}`,onClick:()=>c&&c(t),children:[l.jsx("p",{className:"text-base",children:u?r:OT[t]}),l.jsxs("div",{className:"flex gap-4 items-center md:justify-between md:w-full",children:[u?l.jsx("div",{className:"w-auto h-6",children:l.jsx("img",{className:"w-full h-full object-contain",src:Fr(o),alt:r})}):DT[t],a&&l.jsx("div",{className:"w-auto h-6",children:l.jsx("img",{className:"w-full h-full object-contain",src:Fr(a),alt:r})})]})]})},g1=MT,IT={primary:mr("border-x-borderLoadingSpinner","border-t-borderLoadingSpinner","border-b-transparent")},FT={default:mr("w-12 h-12 border-4"),small:mr("w-5 h-5 border-2")},tr=({variant:e="primary",size:t="small"})=>l.jsx("div",{className:"flex justify-center items-center w-full h-full",children:l.jsx("div",{className:`${mr("border-2","border-solid","rounded-full","animate-spin",IT[e],FT[t])}`})}),BT=({isActive:e,setIsActive:t,balance:r})=>{const n=Hr(),o=()=>{const a=`${le.get(to).TopUp}?redirectRoute=${le.get(to).Checkout}`;n(a)};return l.jsx(On,{title:"Insufficient Customer Balance",isActive:e,setIsActive:t,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"flex-1",children:l.jsxs("p",{className:"text-textSecondary",children:["You currently have ",r&&kt(r)," in your balance. After topping up the required amount, you can continue to checkout."]})}),l.jsxs("div",{className:"flex gap-3 md:w-[40%] md:ml-auto mt-8",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{type:"Secondary",className:"w-full",onClick:()=>t(!1),children:"Cancel"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{type:"Primary",className:"w-full",onClick:o,children:"Add Balance"})})]})]})})},HT=BT,VT=({align:e,gateway:t,gatewayDisplayName:r,selected:n,onSelect:o,balance:a,total:s,onSignInClick:c})=>{const[u]=he(ho),[d,f]=y.useState(!1),h=()=>{o&&o(t),a&&a.amount<s&&f(!0)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`h-14 px-4 flex justify-between items-center border border-borderDefault rounded-lg md:flex-col-reverse md:items-start md:gap-2 md:h-[92px] cursor-pointer md:p-4 ${n&&"border-brandDefault"} ${e==="column"&&"flex-col-reverse h-[92px] p-4 !items-start"}`,onClick:h,children:[l.jsxs("p",{className:"text-base",children:[r," ",l.jsxs("span",{className:"text-textSecondary",children:["(",u?a&&kt(a):l.jsx("a",{className:"text-brandDefault hover:underline cursor-pointer",onClick:c,children:"Sign in"}),")"]})]}),l.jsx("div",{className:"flex gap-4 items-center md:justify-between md:w-full",children:l.jsx(bv,{})})]}),l.jsx(HT,{isActive:d,setIsActive:f,balance:a})]})},Bm=VT,$T=({possibleGateways:e,setGateway:t,balance:r,totalAndDiscount:n,onSignInClick:o,setPaymentMethod:a})=>{const[s,c]=y.useState(),[u,d]=y.useState(),[f,h]=y.useState(),[p,v]=y.useState(!1),m=(g,x)=>{t(x),a(g),c(g),d(x)};return y.useEffect(()=>{const g=async()=>{v(!0);const x=await qp([...e.availableGateways,...e.requiresSignInGateways]);h(x),v(!1)};e.availableGateways.length&&g()},[]),p?l.jsx(tr,{variant:"secondary"}):l.jsx("div",{className:"grid grid-cols-1 gap-2 pb-6 border-b border-borderDefault md:grid-cols-2 md:gap-3",children:f==null?void 0:f.map(g=>g.name==="Balance"?l.jsx(Bm,{gateway:g.name,gatewayDisplayName:g.displayName,onSelect:x=>{d(x),t(x)},selected:g.name===u,balance:r,total:n.total,onSignInClick:o}):g.paymentMethods.map(x=>l.jsx(g1,{paymentMethod:x,gateway:g.name,gatewayDisplayName:g.displayName,gatewayLogoCfId:g.logoCfImageId,poweredByLogoCfId:g.poweredByImageCfImageId,onSelect:()=>m(x,g.name),selected:s===x&&u===g.name},g.name+x)))})},Hm=$T,UT=P.array(P.object({name:P.string(),displayName:P.string(),logoCfImageId:P.string(),poweredByImageCfImageId:P.string().optional(),paymentMethods:P.array(P.nativeEnum(Fm))})),Yr=Ut(async(e,t)=>kr(await qp(t),UT)).pipe(xr(null)),WT=P.object({gateways:P.array(P.string()),currency:P.string()}),zT=P.object({topUpBonusEnabled:P.literal(!0),minimumTopUpForBonus:P.number(),bonusPercent:P.number().int()}),ZT=P.object({topUpBonusEnabled:P.literal(!1),minimumTopUpForBonus:P.number().optional(),bonusPercent:P.number().int().optional()}),GT=P.object({cashbackEnabled:P.literal(!0),cashbackPercent:P.number().int()}),qT=P.object({cashbackEnabled:P.literal(!1),cashbackPercent:P.number().int().optional()}),YT=WT.and(zT.or(ZT).and(GT.or(qT))),KT=P.object({isEnabled:P.literal(!1)}),XT=P.object({isEnabled:P.literal(!0),topUpSettings:YT}),JT=XT.or(KT),Vo=Ut(async e=>{var r;const t=kr(await vx(),JT);if(t.isEnabled){const n=(r=t==null?void 0:t.topUpSettings)==null?void 0:r.gateways;n&&Yr(e,n)}return t}).pipe(xr(null));Qr(Vo.dataAtom,Vo);var QT=P.object({currency:P.string(),manualBalance:P.number(),realBalance:P.number()}),$o=Ut(async()=>{const e=kr(await gx(),QT);return{amount:e.realBalance+e.manualBalance,currency:e.currency}}).pipe(xr(null));Qr($o.dataAtom,$o);var eP="6LdQiIIpAAAAAAkhvhS9zuo5WNS5mAzZrALD9cCa",Vm=y.createContext(void 0),$m=({children:e})=>{const t=y.useRef(null),r=async()=>{var n,o;try{tP();const a=await((n=t==null?void 0:t.current)==null?void 0:n.executeAsync());return await((o=t==null?void 0:t.current)==null?void 0:o.reset()),a??null}catch(a){console.error(a)}return null};return l.jsxs(Vm.Provider,{value:{recaptchaRef:t,executeRecaptcha:r},children:[e,l.jsx(RS,{sitekey:eP,size:"invisible",ref:t})]})},v1=()=>{const e=y.useContext(Vm);if(e===void 0)throw new Error("useReCaptcha must be used within a ReCaptchaProvider");return e},tP=()=>{var t,r;const e=(r=(t=[...document.getElementsByTagName("iframe")].find(n=>n.src.includes("google.com/recaptcha/api2/bframe")))==null?void 0:t.parentNode)==null?void 0:r.parentNode;e&&new MutationObserver(()=>{(e.style.visibility!=="visible"||e.style.opacity!=="1")&&(e.style.opacity="1",e.style.visibility="visible")}).observe(e,{attributeFilter:["style"]})},Jo=(e,t,r)=>{const n=t.safeParse(e.values);if(!n.success){const o=n.error.issues;for(const a of o)r.setError(PE(r.names,a.path),a.message)}},rP=y.forwardRef(({value:e,onChange:t,onComplete:r},n)=>l.jsx(Cm,{ref:n,value:e,onChange:t,onComplete:r,maxLength:6,containerClassName:"group flex items-center mt-2",render:({slots:o})=>l.jsx("div",{className:"flex w-full justify-between gap-1.5",children:o.map(a=>l.jsx(nP,{...a},crypto.randomUUID()))})}));function nP({char:e,isActive:t}){return l.jsx("div",{className:mr("relative w-20 h-20","flex items-center justify-center","transition-all duration-300","border border-custom rounded-custom","group-hover:border-brandDefault/20 group-focus-within:border-brandDefault/20","outline outline-0 outline-brandDefault/20",t&&"outline-2 outline-brandDefault"),children:e?l.jsx("div",{children:e}):l.jsx("div",{className:"text-surface200",children:"0"})})}var oP=P.object({email:P.string().trim().min(1,{message:"The email field cannot be empty."}).email({message:"Please enter a valid email."})}),aP=P.object({otp:P.string().regex(/^[0-9]{6}$/,{message:"Invalid verification code. The code should be a six-digit number. Please try again"})}),Um=({title:e,subtitle:t})=>l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"font-bold text-xxl mb-1",children:e}),l.jsx("div",{className:"text-textSecondary mb-6",children:t})]}),Wm=({name:e})=>l.jsx(oo,{className:"text-signalDanger mb-5",name:e}),sP=()=>{const e=en(Zp),[{email:t}]=he(va),{executeRecaptcha:r}=v1(),n=qo({defaultValues:{email:t||""}});return n.useValidate(o=>Jo(o,oP,n)),n.useSubmit(async o=>{const a=await r();a&&await e({email:o.values.email,recaptcha:a})}),l.jsxs(Ko,{store:n,children:[l.jsx(Um,{title:"Sign In",subtitle:"To continue, you’ll need to enter your email address below."}),l.jsx(Js,{name:n.names.email,className:"text-sm text-textSecondary mb-1",children:"Email Address"}),l.jsx(La,{className:"mt-1",name:n.names.email,render:l.jsx(Mn,{placeholder:"Enter your email address"})}),l.jsx(Wm,{name:n.names.email.toString()}),l.jsx(Da,{render:l.jsx(Se,{className:"w-full h-11"}),children:"Sign In"})]})},iP=()=>{const[e,t]=he(va),r=en(Gp),{executeRecaptcha:n}=v1(),o=qo({defaultValues:{otp:""}});o.useValidate(c=>Jo(c,aP,o)),o.useSubmit(async c=>{const u=await n();u!==null&&await r({otp:c.values.otp,recaptcha:u})});const a=()=>t({requested:!1}),s=o.useValue(o.names.otp);return l.jsxs(Ko,{store:o,children:[l.jsx(Um,{title:"Check Your Email",subtitle:`Enter the 6-digit code we sent to ${e.email}`}),l.jsx(Js,{name:o.names.otp,className:"text-sm text-textSecondary mb-1",children:"Code"}),l.jsx(cb,{name:o.names.otp,render:()=>l.jsx(rP,{onChange:c=>o.setValue(o.names.otp,c),value:s,onComplete:o.submit})}),l.jsx(Wm,{name:o.names.otp.toString()}),l.jsxs("div",{className:"flex",children:[l.jsx(Se,{onClick:a,type:"Secondary",className:"w-[120px] h-11 mr-4",children:"Back"}),l.jsx(Da,{render:l.jsx(Se,{className:"flex-1 h-11"}),children:"Sign In"})]})]})},zm=({inModal:e})=>{const[t]=he(va);he(Pa);const[r]=he(n=>n.spy(Gp.pendingAtom)+n.spy(Zp.pendingAtom)>0);return l.jsx("div",{className:vo("w-full h-full flex-center"),children:r?l.jsx(tr,{}):l.jsx("div",{className:`max-w-[480px] w-full mx-4 ${e&&"max-w-full mx-0"}`,children:t.requested?l.jsx(iP,{}):l.jsx(sP,{})})})},lP=({isActive:e,setIsActive:t})=>{const[r]=he(ho);return y.useEffect(()=>{r&&t(!1)},[r]),l.jsx(On,{title:"",withoutHeader:!0,isActive:e,setIsActive:t,children:l.jsx(zm,{inModal:!0})})},cP=lP,uP=({customerEmail:e,getPossibleGateways:t,setGateway:r,getDiscordSettings:n,cart:o,products:a,submitCart:s,setCustomFieldsToCart:c,totalAndDiscount:u,setDiscordSocialConnectId:d,setRecaptcha:f,setPaymentMethod:h})=>{var V;const[p,v]=y.useState(!1),m=y.useMemo(()=>n(),[o]),[g,x]=he(S_),[b,C]=y.useState({}),[_]=he(ho),[w]=he($o.dataAtom),S=en($o),{executeRecaptcha:A}=v1(),T=(V=le.get(Om))==null?void 0:V.id,E=Hr(),k=y.useMemo(()=>t(),[o.parts]),[R,D]=y.useState(!1),M=()=>{const Q={...b};g.forEach(H=>{H.required&&!le.get(H.valueAtom).trim()?C({...b,[H.name]:`Field ${H.name} is required but has an empty value.`}):(delete Q[H.name],C(Q))})},G=async()=>{if(o.gateway==="Balance"&&!_)return D(!0);const Q={};M(),g.forEach(K=>Q[K.name]=le.get(K.valueAtom)),c(Q),T&&m.isEnabled&&d(T);const H=await A();if(H&&(f(H),!Object.keys(b).length)){const K=await s();E(`${le.get(to).Order}/${"order"in K.data?K.data.order.id:K.data.id}`)}};return y.useEffect(()=>{x(C_(o.parts,a))},[o.parts,a]),y.useEffect(()=>{_&&S()},[_]),l.jsxs("div",{className:"px-4 py-6 bg-surface100 mt-10 md:mt-0 md:w-full md:p-10 md:pr-4 md:max-h-svh md:overflow-auto",children:[l.jsxs("div",{className:"md:max-w-[520px]",children:[l.jsx(Hm,{possibleGateways:k,setGateway:r,setPaymentMethod:h,balance:w,totalAndDiscount:u,onSignInClick:()=>D(!0)}),l.jsxs("div",{className:"mt-8 pb-6 border-b border-borderDefault",children:[l.jsx("p",{className:"text-textSecondary text-sm",children:"Email Address"}),l.jsx(Mn,{className:"mt-1",placeholder:"mail@mail.com",value:e||"",onChange:Q=>Ds(le,Q.target.value),disabled:!!_}),l.jsxs("label",{className:"flex gap-2 text-sm mt-3",children:[l.jsx(cs,{checked:p,onCheckedChange:v}),l.jsx("p",{children:"I agree to receive email updates about my order"})]})]}),l.jsx(TT,{customFields:g}),m.isEnabled&&l.jsxs("div",{className:"mt-5",children:[l.jsx("p",{className:"text-textSecondary text-sm",children:"Social Connect"}),l.jsx("div",{className:"mt-1",children:l.jsx(kT,{customerEmail:e||""})})]}),l.jsxs("div",{className:"mt-10",children:[l.jsx(Se,{size:"lg",className:"w-full",onClick:G,disabled:(m.isRequired?!T:!1)||!o.gateway,children:"Continue to Checkout"}),l.jsx(Mm,{}),l.jsx(Im,{})]}),l.jsx(kn,{className:"mt-10 flex md:hidden"})]}),l.jsx(cP,{isActive:R,setIsActive:D})]})},dP=uP,fP=P.object({email:P.string()}),Cl=Ut(async()=>kr(await hx(),fP)).pipe(xr(null));Qr(Cl.dataAtom,Cl);var hP=()=>{const[e]=he(Ds),{cart:t,products:r,pending:n,addProductToCart:o,getTotalAndDiscount:a,getPossibleGateways:s,submitCart:c,setGateway:u,setRecaptcha:d,applyCoupon:f,setDiscordSocialConnectId:h,setCustomFields:p,applyCouponPending:v,coupon:m,removeCoupon:g,getDiscordSettings:x,getPages:b,setPaymentMethod:C}=ni(),_=y.useMemo(()=>a(),[m,t]),[w]=he(Cl.dataAtom);return y.useEffect(()=>{w&&Ds(le,w.email)},[w]),n?l.jsx(tr,{}):l.jsxs("div",{className:"min-h-svh bg-surface0 md:flex",children:[l.jsx(bT,{cart:t,products:r,applyCoupon:f,applyCouponPending:v,coupon:m,removeCoupon:g,totalAndDiscount:_}),l.jsx(dP,{cart:t,getPossibleGateways:s,customerEmail:e,setGateway:u,getDiscordSettings:x,products:r,submitCart:c,totalAndDiscount:_,setCustomFieldsToCart:p,setDiscordSocialConnectId:h,setRecaptcha:d,setPaymentMethod:C})]})},pP=hP,mP=()=>l.jsx($m,{children:l.jsx(pP,{})}),gP=mP,vP=({email:e,balance:t})=>l.jsxs("div",{className:"mb-4 hidden xl:flex w-full flex-col items-center rounded-2xl bg-surface0 py-4",children:[l.jsx("div",{className:"mb-1 font-bold",children:e}),l.jsxs("div",{className:"rounded-xl bg-brandLight px-2 py-1 text-sm text-brandDefault",children:["Balance: ",t]})]}),xP=vP,yP={sm:"w-4 h-4",s:"w-4 h-4",m:"w-[21px] h-[21px]",l:"w-[28px] h-[28px]"},bP={iconPrimary:"fill-iconPrimary",iconSecondary:"fill-iconSecondary",iconAction:"fill-iconAction",textPrimary:"fill-textPrimary",textSecondary:"fill-textSecondary",surface100:"fill-surface100",signalDanger:"fill-signalDanger"},CP={s:"",sm:"icon-wrapper w-10 h-10",m:"icon-wrapper w-11 h-11",l:"icon-wrapper w-12 h-12"},An=({Icon:e,color:t="iconPrimary",size:r="s",className:n})=>l.jsx("div",{className:mr(CP[r],n),children:l.jsx("div",{className:mr(bP[t],yP[r],"flex-center"),children:e&&l.jsx(e,{})})}),wP=[["Home",Nv],["Orders",Op],["Rewards",Dp],["Balance",Cv],["Subscriptions",Gv]],Gh=({children:e,className:t="",onClick:r})=>l.jsx("button",{type:"button",className:vo("xl:border-none flex cursor-pointer items-center py-3 pl-2 pr-4 xl:pr-0 border-b border-transparent w-full outline-offset-[-1px] outline-brandDefault xl:rounded-custom",t),onClick:r,children:e}),SP=xv(({ctx:e})=>{const[t]=he(Wu),r=en(Su);return l.jsxs("div",{className:"xl:flex xl:flex-col flex overflow-x-auto gap-1",children:[wP.map(([n,o])=>{const a=n===t;return l.jsxs(Gh,{onClick:()=>Wu(e,n),className:`flex-1 ${a?"xl:bg-surface100 text-textPrimary border-textPrimary":"text-textSecondary bg-surface0 xl:hover:bg-surface100"}`,children:[l.jsx("div",{className:"mr-2",children:l.jsx(An,{Icon:o,color:a?"textPrimary":"textSecondary"})}),l.jsx("div",{children:n})]},n)}),l.jsxs(Gh,{className:"text-iconAction xl:mt-1 text-nowrap",onClick:r,children:[l.jsx("div",{className:"mr-2",children:l.jsx(An,{Icon:Tv,color:"iconAction",size:"s"})}),l.jsx("div",{children:"Sign Out"})]})]})}),EP=SP,jP=()=>{const[e]=he(Cl.dataAtom),[t]=he($o.dataAtom);return!e||!t?null:l.jsxs("div",{className:"w-full xl:border-r-custom border-borderDefault px-4 xl:py-6 xl:max-w-[320px] xl:pr-4",children:[l.jsx(xP,{email:e.email,balance:kt(t)}),l.jsx(EP,{})]})},si=({title:e,description:t})=>l.jsxs("div",{className:mr("flex-center","flex-1","flex-col"),children:[l.jsx("div",{className:"w-7 h-7 text-iconSecondary",children:l.jsx(Hp,{})}),l.jsx("div",{className:"font-bold text-h2 text-textSecondary mt-3 mb-1",children:e}),l.jsx("div",{className:"text-p text-textSecondary",children:t})]}),nc=({title:e,description:t})=>l.jsxs("div",{className:"mt-2 mb-4 ml-4",children:[l.jsx("div",{className:"font-bold text-lg",children:e}),t&&l.jsx("div",{className:"text-textSecondary",children:t})]}),_i=(e,t)=>Array.from({length:t-e+1},(r,n)=>e+n),_P=(e,t,r)=>{const n=r*2+3+2;if(t<=n)return _i(1,t);const o=Math.max(e-r,1),a=Math.min(e+r,t),s=o>2,c=a<t-2;return!s&&c?[..._i(1,3+2*r),"right-ellipsis",t]:s&&!c?[1,"left-ellipsis",..._i(t-(3+2*r)+1,t)]:[1,"left-ellipsis",..._i(o,a),"right-ellipsis",t]},TP=({currentPage:e,totalPages:t,onPageChange:r,siblingCount:n=1})=>{const o=u=>{const d=n*2+1;r(u?Math.max(e-d,1):Math.min(e+d,t))},a=e===1,s=e===t,c=u=>l.jsx(Se,{type:typeof u=="number"&&u===e?"Primary":"Secondary",onClick:()=>typeof u=="string"?o(u==="left-ellipsis"):r(u),"aria-current":typeof u=="number"&&u===e?"page":void 0,children:typeof u=="string"?"…":u},u);return l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx(Se,{type:"Secondary",onClick:()=>!a&&r(e-1),disabled:a,children:l.jsx(Dv,{})}),_P(e,t,n).map(c),l.jsx(Se,{type:"Secondary",onClick:()=>!s&&r(e+1),disabled:s,children:l.jsx(Ov,{})})]})},PP=(e,t,r)=>{const n=(e-1)*r+1,o=Math.min(e*r,t);return`Showing ${n}-${o} entries of ${t}`},x1=({className:e,totalCount:t,...r})=>{const n=Math.ceil(t/Eu);return n<2?null:l.jsxs("div",{className:`flex lg:h-[72px] justify-start align-middle items-start lg:justify-between p-4 lg:flex-row flex-col mt-auto ${e}`,children:[l.jsx("div",{className:"text-textSecondary flex-center mb-2",children:PP(r.currentPage,t,Eu)}),l.jsx("div",{className:"flex-center",children:l.jsx(TP,{...r,totalPages:n})})]})},NP=y.forwardRef(({className:e,style:t,...r},n)=>l.jsx("div",{ref:n,...r,className:mr("fixed","inset-4","m-auto","z-50","h-fit","overflow-x-auto","rounded-3xl","bg-white",e),style:{maxHeight:"calc(100vh - 2 * 12px)",maxWidth:650,...t}})),oc=({store:e,children:t,title:r})=>l.jsx(MC,{store:e,children:l.jsxs(OC,{render:l.jsx(NP,{}),backdrop:l.jsx("div",{className:"bg-[rgba(37,37,37,0.24)]"}),children:[l.jsxs("div",{className:"py-4 px-6 border-borderDefault border-b flex",children:[l.jsx("div",{className:"text-xl font-bold",children:r}),l.jsx(z2,{className:"ml-auto",children:l.jsx(Iv,{})})]}),l.jsx("div",{className:"py-4 px-6",children:t})]})}),y1=Ke(1),Zm=(e=>(e.Added="ADDED",e.Removed="REMOVED",e))(Zm||{}),RP=P.object({id:P.string().uuid(),price:qs,createdAt:P.string().datetime(),description:P.string(),status:P.nativeEnum(Zm)}),kP=P.object({list:P.array(RP),totalCount:P.number()}),Os=Ut(async e=>kr(await _x({PageNumber:e.get(y1)}),kP)).pipe(xr(null));y1.onChange(e=>{Os(e)});Qr(Os.dataAtom,Os);var AP=P.object({data:P.object({chargeId:P.string()})}),wl=Ut(async(e,{price:t,gateway:r,customerEmail:n})=>kr(await bx({customerEmail:n,price:t,gateway:r}),AP)).pipe(xr(null)),LP=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"})}),DP=({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 mb-4",children:[l.jsx(Ip,{}),l.jsx("div",{className:"ml-2",children:e>0||Number.isNaN(e)?`Enter another ${kt({amount:e,currency:r})} and receive an additional bonus of
|
|
141
|
+
`):r.deliveryItems[0].textData;return l.jsx(On,{title:"Thank you for the purchase!",isActive:e,setIsActive:t,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"flex-1",children:o?l.jsx("div",{className:"p-3 mt-2 w-full bg-surface0 rounded-custom overflow-auto",style:{scrollbarWidth:"thin"},children:l.jsx("p",{className:"text-textSecondary",children:"Discord role has been granted"})}):l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{children:"Content"}),l.jsxs(Se,{className:"text-textSecondary gap-1",type:"Secondary",onClick:()=>n(a),children:[l.jsx(_a,{}),l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Copy to Clipboard"})]})]}),l.jsx("div",{className:"p-3 mt-2 w-full h-[276px] bg-surface0 rounded-custom overflow-auto",style:{scrollbarWidth:"thin"},children:l.jsx("p",{className:"text-textSecondary",children:a})})]})}),l.jsx("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,{type:"Secondary",className:"w-full",onClick:()=>t(!1),children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Close"})})})})]})})},nT=rT,Am={TEXT:"View",SERIALS:"View",EBOOK:"View",LINK:"Visit",DOWNLOAD:"",CUSTOM:"View",DISCORD:"Access"},Lm={TEXT:"Content",SERIALS:"Content",EBOOK:"Ebook",LINK:"Link",DOWNLOAD:"Download",CUSTOM:"Content",DISCORD:"Discord"},Dm={TEXT:l.jsx(Ec,{}),SERIALS:l.jsx(Ec,{}),EBOOK:l.jsx(Kv,{}),LINK:l.jsx(cl,{}),DOWNLOAD:l.jsx(Yv,{}),CUSTOM:l.jsx(Ec,{}),DISCORD:l.jsx(qv,{})},oT=({deliveryConfiguration:e})=>{const t=e.type;return t==="TEXT"||t==="CUSTOM"||t==="SERIALS"||t==="DISCORD"?l.jsx(aT,{deliveryConfiguration:e}):l.jsx(sT,{deliveryConfiguration:e})},aT=({deliveryConfiguration:e})=>{const t=e.type,[r,n]=y.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"py-2 px-4 min-w-[120px] flex gap-1 justify-center bg-surface0 rounded-custom cursor-pointer",onClick:()=>n(!0),children:[Dm[t],l.jsx("p",{className:"text-textSecondary text-sm",children:e.customName??`${Am[t]} ${Lm[t]}`})]}),l.jsx(nT,{deliveryConfiguration:e,isActive:r,setIsActive:n})]})},sT=({deliveryConfiguration:e})=>{const t=e.type;return l.jsxs("div",{className:"py-2 px-4 min-w-[120px] flex gap-1 justify-center bg-surface0 rounded-custom cursor-pointer",onClick:()=>window.open(e.deliveryItems[0].textData,"_blank"),children:[Dm[t],l.jsx("p",{className:"text-textSecondary text-sm",children:e.customName??`${Am[t]} ${Lm[t]}`})]})},iT=oT,lT=({isOrder:e,product:t})=>{const[r]=he(Pa),n=t.subscriptionSettings;return l.jsxs("div",{className:e?"pb-6 border-b border-borderDefault last-of-type:border-none last-of-type:pb-0":void 0,children:[l.jsxs("div",{className:"w-full flex items-center gap-3",children:[l.jsx("div",{className:`min-w-12 h-12 flex items-center justify-center bg-surface100 rounded-custom overflow-hidden ${e&&"!bg-surface0"}`,children:t!=null&&t.image?l.jsx("img",{className:"w-full h-full object-contain",src:Fr(t.image.cfId),alt:t==null?void 0:t.name}):l.jsx(Ul,{})}),l.jsxs("div",{className:"text-sm w-full max-w-[65%]",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h2",{children:t.name}),l.jsxs("span",{className:"block text-sm text-textSecondary px-1 h-5 bg-borderDefault rounded-sm",children:[t.price.quantity,"x"]})]}),l.jsx("p",{className:"text-textSecondary overflow-ellipsis overflow-hidden whitespace-nowrap max-w-full",children:t.description})]}),l.jsx("p",{className:"font-semibold text-base max-w-[40%] w-full text-right",children:n?`${kt(n.price)} / ${ox(n.recurringIntervalDays||0)}${n.entryFee?" + "+kt(n.entryFee):""}`:kt(t.price)})]}),t.deliveryCategories&&l.jsx("div",{className:"w-full flex gap-3 flex-wrap mt-4",children:t.deliveryCategories.map(o=>l.jsx(iT,{deliveryConfiguration:o},o.id))}),t.customerNote&&l.jsxs("div",{className:"py-3 px-4 mt-4 bg-surface0 rounded-lg",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[(r==null?void 0:r.info.logo)&&l.jsx("div",{className:"w-6 h-6 flex items-center justify-center border border-borderDefault rounded-[50%] bg-surface100 overflow-hidden",children:l.jsx("img",{src:Fr(r==null?void 0:r.info.logo.cfId),alt:r.info.name})}),l.jsx("p",{className:"font-medium",children:r==null?void 0:r.info.name})]}),l.jsx("p",{className:"mt-1 text-sm text-textSecondary",children:t.customerNote})]})]})},p1=lT,Mn=y.forwardRef(({icon:e=null,iconPosition:t=0,className:r="",...n},o)=>l.jsxs("div",{className:`relative flex items-center w-full ${r}`,children:[e&&t===0&&l.jsx("div",{className:"absolute inset-y-0 left-4 flex items-center",children:e}),l.jsx("input",{ref:o,className:`
|
|
142
|
+
block w-full rounded-input border-input h-input p-3
|
|
143
|
+
bg-inputFieldColor text-inputColor placeholder:text-surface200
|
|
144
|
+
outline-none
|
|
145
|
+
${e?t===0?"pl-9":"pr-10":""}
|
|
146
|
+
`,...n}),e&&t===1&&l.jsx("div",{className:"absolute inset-y-0 right-4 flex items-center",children:e})]})),cT=({content:e})=>l.jsx("div",{className:"w-[160px] py-1 px-2 rounded-sm bg-textPrimary text-surface100",children:l.jsx("p",{className:"text-xs",children:e})}),uT=cT,dT=({applyCoupon:e,applyCouponPending:t,couponData:r,discount:n,removeCoupon:o,gateway:a})=>{const[s,c]=y.useState("");return l.jsx("div",{children:r?l.jsxs("div",{className:"w-full h-12 px-4 gap-4 flex items-center bg-surface100 rounded-custom ",children:[l.jsx(Gs,{}),l.jsxs("p",{children:[s," is applied"," ",l.jsxs("span",{className:"ml-1 text-base text-textSecondary",children:["-",n," ",!r.isFixed&&`(${r.discount}%)`]})]}),l.jsx(Se,{className:"ml-auto",type:"Secondary",onClick:o,children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Remove"})})]}):l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Mn,{variant:"secondary",placeholder:"Enter a discount code",value:s,onChange:u=>c(u.target.value)}),l.jsxs(Qw,{children:[l.jsx(rS,{render:l.jsx("div",{children:l.jsx(Se,{className:"cursor-pointer",onClick:()=>e(s),disabled:!a,children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Apply"})})}),children:"Tooltip"}),!a&&l.jsx(Jw,{children:l.jsx(uT,{content:"The discount is related to the method of payment. Select to enter."})})]})]})})},fT=dT,hT=({className:e})=>{const[t]=he(Xp),[r]=he(Jp),[n]=he(Qp);return l.jsxs("footer",{className:`flex items-center justify-between h-14 mt-6 ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("p",{className:"text-textSecondary text-sm",children:"Powered by"}),l.jsx(Jv,{})]}),l.jsx("nav",{children:l.jsxs("ul",{className:"list-none flex gap-6 text-xs text-textSecondary",children:[(t==null?void 0:t.showTermsOfServiceOnProduct)&&l.jsx("li",{className:"hover:underline",children:l.jsx("a",{href:t.termsOfService,target:"_blank",children:"Terms"})}),(r==null?void 0:r.showPrivacyPolicyOnProduct)&&l.jsx("li",{className:"hover:underline",children:l.jsx("a",{href:r.privacyPolicy,target:"_blank",children:"Privacy"})}),(n==null?void 0:n.showRefundPolicyOnProduct)&&l.jsx("li",{className:"hover:underline",children:l.jsx("a",{href:n.refundPolicy,target:"_blank",children:"Refund"})})]})})]})},kn=hT,pT=({expiresAt:e})=>{const[t,r]=y.useState(n());function n(){const o=new Date,a=new Date(e).getTime()-o.getTime();if(a<=0)return{hours:0,minutes:0,seconds:0};const s=Math.floor(a/(1e3*60*60)),c=Math.floor(a%(1e3*60*60)/(1e3*60)),u=Math.floor(a%(1e3*60)/1e3);return{hours:String(s).padStart(2,"0"),minutes:String(c).padStart(2,"0"),seconds:String(u).padStart(2,"0")}}return y.useEffect(()=>{const o=setInterval(()=>{r(n())},1e3);return()=>clearInterval(o)},[e]),t.hours===0&&t.minutes===0&&t.seconds===0?null:l.jsxs("div",{className:"flex gap-1 items-center px-2.5 h-8 bg-borderDefault rounded-custom text-textSecondary ",children:[l.jsx(Vi,{}),l.jsxs("p",{className:"text-base",children:[t.hours,":",t.minutes,":",t.seconds]})]})},mT=pT,gT=({className:e,expiresAt:t})=>{const[r]=he(Pa),n=Hr();return l.jsxs("header",{className:`px-5 w-full flex items-center justify-between h-14 border-b border-borderDefault bg-surface100 md:h-auto md:bg-transparent md:border-none md:px-0 ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-5",children:[l.jsx("div",{className:"h-6 flex items-center ",children:l.jsx("div",{className:"w-5 h-5 -rotate-90 cursor-pointer text-textSecondary hover:text-textPrimary",onClick:()=>n(-1),children:l.jsx(Bp,{})})}),(r==null?void 0:r.info.logo)&&l.jsx("div",{className:"w-auto h-5 pl-4 border-l",children:l.jsx("img",{className:"w-full h-full object-contain",src:Fr(r.info.logo.cfId),alt:r.info.name})})]}),t&&l.jsx(mT,{expiresAt:t})]})},ai=gT,vT=({formatter:e,coupon:t,discount:r,totalWithDiscount:n,total:o,className:a})=>l.jsxs("div",{className:vo("mt-6 py-5 px-6 w-full flex flex-col gap-3 bg-borderDefault rounded-lg ",a),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.jsx("p",{children:e.format(o)})]}),t&&l.jsxs("div",{className:"w-full flex items-center justify-between gap-3 text-base",children:[l.jsxs("p",{className:"text-textSecondary",children:["Discount ",!t.isFixed&&`(${t.discount}%)`]}),l.jsxs("p",{children:["-",e.format(r)]})]}),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.jsx("p",{className:"font-semibold",children:n?e.format(n):e.format(o)})]})]}),rc=vT,xT=({cart:e,products:t,applyCoupon:r,applyCouponPending:n,coupon:o,totalAndDiscount:a,removeCoupon:s})=>{var h;const c=y.useMemo(()=>e.parts.map(p=>{const v=t.find(g=>g.id===p.productId),m=v==null?void 0:v.variants.find(g=>g.id===p.productVariantId);return{id:(v==null?void 0:v.id)||0,image:v==null?void 0:v.images[0],name:(m==null?void 0:m.name)||"",description:(m==null?void 0:m.description)||"",price:{quantity:p.quantity,amount:(m==null?void 0:m.price.amount)||0,currency:m==null?void 0:m.price.currency},subscriptionSettings:m==null?void 0:m.subscriptionSettings}}),[e,t]),u=((h=c[0])==null?void 0:h.price.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:u}),f=y.useMemo(()=>a.totalWithDiscount?a.total-a.totalWithDiscount:0,[a]);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,{}),l.jsxs("div",{className:"md:w-full md:h-full md:flex md:flex-col px-4 md:px-0",children:[l.jsx("header",{className:"flex justify-between items-center mt-6",children:l.jsx("h1",{className:"font-bold text-textPrimary text-lg",children:"Checkout"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("div",{className:"mt-6 w-full flex flex-col gap-4",children:c.map(p=>l.jsx(p1,{product:p},p.id))}),l.jsx("div",{className:"mt-6",children:l.jsx(fT,{applyCoupon:r,applyCouponPending:n,couponData:o,discount:d.format(f),removeCoupon:s,gateway:e.gateway})}),l.jsx(rc,{formatter:d,coupon:o,total:a.total,discount:f,totalWithDiscount:a.totalWithDiscount})]}),l.jsx("div",{children:l.jsx(kn,{className:"hidden md:flex"})})]})]})})},yT=xT,bT=({onCheckedChange:e,checked:t,...r})=>l.jsxs("label",{className:`w-5 h-5 flex items-center justify-center border border-borderHover rounded-[6px] transition-all cursor-pointer ${t&&"!border-brandDefault bg-brandLight"}`,children:[l.jsx("input",{className:"appearance-none",type:"checkbox",checked:t,onChange:n=>e&&e(n.target.checked),...r}),t&&l.jsx(Wv,{})]}),cs=bT,CT={primary:"bg-surface0",secondary:"bg-surface100"},wT=({variant:e,className:t,...r})=>{var n;return l.jsxs("div",{className:"relative",children:[l.jsx("textarea",{className:`outline-brandDefault block min-h-[96px] w-full rounded-custom border-none bg-surface0 p-3 align-middle placeholder:text-surface200 ${r.maxLength&&"pb-9"} ${e&&CT[e]} ${t}`,...r}),r.maxLength&&l.jsxs("span",{className:"absolute right-3 bottom-3 text-sm text-surface200",children:[((n=r.value)==null?void 0:n.toString().length)||0,"/",r.maxLength]})]})},m1=wT,ST=({customFields:e})=>{if(e.length===0)return null;const t=e.map(r=>l.jsx(ET,{customField:r},r.name));return l.jsx("div",{className:"flex flex-col gap-3 mt-8",children:t})},ET=({customField:e})=>{const[t,r]=he(e.valueAtom);return l.jsx(jT,{value:t,placeholder:e.placeholder,required:e.required,defaultValue:e.defaultValue,type:e.type,onValueChange:r,label:e.name,regex:e.regex})},jT=({label:e,type:t,defaultValue:r,value:n,placeholder:o,regex:a,required:s,onValueChange:c})=>{if(t===Ei.Checkbox)return l.jsxs("label",{className:mr("flex","gap-2","items-center","cursor-pointer"),children:[l.jsx(cs,{defaultChecked:typeof r=="boolean"?r:void 0,required:s,checked:!!n,onCheckedChange:d=>c(d)}),l.jsx("p",{className:"text-sm ",children:e})]});if(t==Ei.Hidden)return l.jsx("input",{type:"hidden",value:typeof r!="boolean"?r:void 0,required:s});const u=d=>{let f=/^\d*$/;t!=Ei.Number&&(f=a?new RegExp(a):new RegExp("")),f.test(d.target.value)&&c(d.target.value)};return t==Ei.Textarea?l.jsxs("div",{className:mr("flex","flex-col","gap-1"),children:[l.jsx("p",{className:"text-sm text-textSecondary",children:e}),l.jsx(m1,{value:n,placeholder:o,required:s,onChange:u})]}):l.jsxs("div",{className:mr("flex","flex-col","gap-1"),children:[l.jsx("p",{className:"text-sm text-textSecondary",children:e}),l.jsx(Mn,{value:n,placeholder:o,required:s,onChange:u})]})},_T=ST,TT=({className:e})=>l.jsxs("div",{className:vo("w-fit flex items-center rounded-custom gap-1 p-1 pl-[6px] bg-successBackground text-successText",e),children:[l.jsx(Zv,{}),l.jsx("p",{className:"text-sm",children:"Active"})]}),PT=TT,Om=Ke(null).pipe(vd("customerDiscordConnection")),NT=({customerEmail:e})=>{const[t,r]=y.useState({authorized:!1}),[n,o]=y.useState(),[a,s]=he(Om);y.useEffect(()=>{(async()=>{if(!(!a||a.email!==e))try{const d=await Mf({id:a.id,customerEmail:a.email});r({authorized:!0,id:d.discordId,avatar:d.avatar,username:d.username})}catch(d){s(null),console.log("Still waiting for authorization.",d)}})()},[]);const c=()=>{e===null||e.trim()===""||wx({customerEmail:e}).then(({id:u,redirectUrl:d})=>{let f=null;try{f=window.open(d)}catch(p){console.log("Error opening window:",p,f)}(!f||f.closed||typeof f.closed>"u")&&setTimeout(()=>{const p=document.createElement("a");p.href=d,p.target="_blank",p.click()});const h=setInterval(()=>{Mf({id:u,customerEmail:e}).then(p=>{r({authorized:!0,id:p.discordId,avatar:p.avatar,username:p.username}),s({id:u,email:e}),clearInterval(h),f&&f.close()}).catch(p=>{console.log("Still waiting for authorization.",p,{newWindow:f})}),console.log("dasf")},3e3);o(h)}).catch(u=>{console.log("Could not initiate Discord authorization",u)})};return y.useEffect(()=>()=>{n&&clearInterval(n)},[n]),t.authorized?l.jsxs("div",{className:"px-4 py-3 bg-surface0 rounded-custom flex justify-between items-center ",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-5 h-5 flex items-center justify-center rounded-[50%] overflow-hidden",children:t.avatar?l.jsx("img",{className:"w-full h-full object-cover",src:`https://cdn.discordapp.com/avatars/${t.id}/${t.avatar}.png?size=256`,alt:t.username}):l.jsx(Uv,{})}),l.jsx("p",{children:t.username}),l.jsx(PT,{})]}),l.jsx(Se,{type:"Secondary",onClick:c,children:"Reconnect"})]}):l.jsxs(Se,{type:"Secondary",className:"text-textSecondary gap-1 w-full",onClick:c,children:[l.jsx(Xv,{}),l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Connect Your Discord"})]})},RT=NT,kT=()=>l.jsxs("div",{className:"p-3 mt-4 flex items-center gap-2 rounded-custom bg-surface0",children:[l.jsx("div",{className:"min-w-4",children:l.jsx($p,{})}),l.jsx("p",{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."})]}),Mm=kT,AT=()=>l.jsxs("div",{className:"p-3 mt-4 flex items-center gap-2 rounded-custom bg-surface0",children:[l.jsx("div",{className:"min-w-4",children:l.jsx(Up,{})}),l.jsx("p",{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."})]}),Im=AT,Fm=(e=>(e.BankCard="BANK_CARD",e.BankTransfer="BANK_TRANSFER",e.PayPal="PAYPAL",e.CashApp="CASHAPP",e.Crypto="CRYPTO",e.AppleGooglePay="APPLE_AND_GOOGLE_PAY",e.Custom="CUSTOM",e))(Fm||{}),LT={CASHAPP:l.jsx(Hv,{}),APPLE_AND_GOOGLE_PAY:l.jsx($v,{}),BANK_CARD:l.jsx(Bv,{}),CRYPTO:l.jsx(Fv,{}),PAYPAL:l.jsx(Vv,{}),CUSTOM:l.jsx("div",{}),BANK_TRANSFER:l.jsx(zv,{})},DT={CASHAPP:"Cash App",APPLE_AND_GOOGLE_PAY:"Apple Pay / Google Pay",BANK_CARD:"Debit / Credit Card",CRYPTO:"Cryptocurrency",PAYPAL:"PayPal",CUSTOM:"",BANK_TRANSFER:"Bank Transfer"},OT=({align:e,paymentMethod:t,gatewayDisplayName:r,gateway:n,gatewayLogoCfId:o,poweredByLogoCfId:a,selected:s,onSelect:c})=>{const u=t==="CUSTOM";return l.jsxs("div",{className:`h-14 px-4 flex justify-between items-center border border-borderDefault rounded-lg md:flex-col-reverse md:items-start md:gap-2 md:min-h-[92px] cursor-pointer md:p-4 ${s&&"border-brandDefault"} ${e==="column"&&"flex-col-reverse h-[92px] p-4 !items-start"}`,onClick:()=>c&&c(t),children:[l.jsx("p",{className:"text-base",children:u?r:DT[t]}),l.jsxs("div",{className:"flex gap-4 items-center md:justify-between md:w-full",children:[u?l.jsx("div",{className:"w-auto h-6",children:l.jsx("img",{className:"w-full h-full object-contain",src:Fr(o),alt:r})}):LT[t],a&&l.jsx("div",{className:"w-auto h-6",children:l.jsx("img",{className:"w-full h-full object-contain",src:Fr(a),alt:r})})]})]})},g1=OT,MT={primary:mr("border-x-borderLoadingSpinner","border-t-borderLoadingSpinner","border-b-transparent")},IT={default:mr("w-12 h-12 border-4"),small:mr("w-5 h-5 border-2")},tr=({variant:e="primary",size:t="small"})=>l.jsx("div",{className:"flex justify-center items-center w-full h-full",children:l.jsx("div",{className:`${mr("border-2","border-solid","rounded-full","animate-spin",MT[e],IT[t])}`})}),FT=({isActive:e,setIsActive:t,balance:r})=>{const n=Hr(),o=()=>{const a=`${le.get(to).TopUp}?redirectRoute=${le.get(to).Checkout}`;n(a)};return l.jsx(On,{title:"Insufficient Customer Balance",isActive:e,setIsActive:t,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsx("div",{className:"flex-1",children:l.jsxs("p",{className:"text-textSecondary",children:["You currently have ",r&&kt(r)," in your balance. After topping up the required amount, you can continue to checkout."]})}),l.jsxs("div",{className:"flex gap-3 md:w-[40%] md:ml-auto mt-8",children:[l.jsx("div",{className:"w-fit",children:l.jsx(Se,{type:"Secondary",className:"w-full",onClick:()=>t(!1),children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{type:"Primary",className:"w-full",onClick:o,children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Add Balance"})})})]})]})})},BT=FT,HT=({align:e,gateway:t,gatewayDisplayName:r,selected:n,onSelect:o,balance:a,total:s,onSignInClick:c})=>{const[u]=he(ho),[d,f]=y.useState(!1),h=()=>{o&&o(t),a&&a.amount<s&&f(!0)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`h-14 px-4 flex justify-between items-center border border-borderDefault rounded-lg md:flex-col-reverse md:items-start md:gap-2 md:h-[92px] cursor-pointer md:p-4 ${n&&"border-brandDefault"} ${e==="column"&&"flex-col-reverse h-[92px] p-4 !items-start"}`,onClick:h,children:[l.jsxs("p",{className:"text-base",children:[r," ",l.jsxs("span",{className:"text-textSecondary",children:["(",u?a&&kt(a):l.jsx("a",{className:"text-brandDefault hover:underline cursor-pointer",onClick:c,children:"Sign in"}),")"]})]}),l.jsx("div",{className:"flex gap-4 items-center md:justify-between md:w-full",children:l.jsx(bv,{})})]}),l.jsx(BT,{isActive:d,setIsActive:f,balance:a})]})},Bm=HT,VT=({possibleGateways:e,setGateway:t,balance:r,totalAndDiscount:n,onSignInClick:o,setPaymentMethod:a})=>{const[s,c]=y.useState(),[u,d]=y.useState(),[f,h]=y.useState(),[p,v]=y.useState(!1),m=(g,x)=>{t(x),a(g),c(g),d(x)};return y.useEffect(()=>{const g=async()=>{v(!0);const x=await qp([...e.availableGateways,...e.requiresSignInGateways]);h(x),v(!1)};e.availableGateways.length&&g()},[]),p?l.jsx(tr,{}):l.jsx("div",{className:"grid grid-cols-1 gap-2 pb-6 border-b border-borderDefault md:grid-cols-2 md:gap-3",children:f==null?void 0:f.map(g=>g.name==="Balance"?l.jsx(Bm,{gateway:g.name,gatewayDisplayName:g.displayName,onSelect:x=>{d(x),t(x)},selected:g.name===u,balance:r,total:n.total,onSignInClick:o}):g.paymentMethods.map(x=>l.jsx(g1,{paymentMethod:x,gateway:g.name,gatewayDisplayName:g.displayName,gatewayLogoCfId:g.logoCfImageId,poweredByLogoCfId:g.poweredByImageCfImageId,onSelect:()=>m(x,g.name),selected:s===x&&u===g.name},g.name+x)))})},Hm=VT,$T=P.array(P.object({name:P.string(),displayName:P.string(),logoCfImageId:P.string(),poweredByImageCfImageId:P.string().optional(),paymentMethods:P.array(P.nativeEnum(Fm))})),Yr=Ut(async(e,t)=>kr(await qp(t),$T)).pipe(xr(null)),UT=P.object({gateways:P.array(P.string()),currency:P.string()}),WT=P.object({topUpBonusEnabled:P.literal(!0),minimumTopUpForBonus:P.number(),bonusPercent:P.number().int()}),zT=P.object({topUpBonusEnabled:P.literal(!1),minimumTopUpForBonus:P.number().optional(),bonusPercent:P.number().int().optional()}),ZT=P.object({cashbackEnabled:P.literal(!0),cashbackPercent:P.number().int()}),GT=P.object({cashbackEnabled:P.literal(!1),cashbackPercent:P.number().int().optional()}),qT=UT.and(WT.or(zT).and(ZT.or(GT))),YT=P.object({isEnabled:P.literal(!1)}),KT=P.object({isEnabled:P.literal(!0),topUpSettings:qT}),XT=KT.or(YT),Vo=Ut(async e=>{var r;const t=kr(await vx(),XT);if(t.isEnabled){const n=(r=t==null?void 0:t.topUpSettings)==null?void 0:r.gateways;n&&Yr(e,n)}return t}).pipe(xr(null));Qr(Vo.dataAtom,Vo);var JT=P.object({currency:P.string(),manualBalance:P.number(),realBalance:P.number()}),$o=Ut(async()=>{const e=kr(await gx(),JT);return{amount:e.realBalance+e.manualBalance,currency:e.currency}}).pipe(xr(null));Qr($o.dataAtom,$o);var QT="6LdQiIIpAAAAAAkhvhS9zuo5WNS5mAzZrALD9cCa",Vm=y.createContext(void 0),$m=({children:e})=>{const t=y.useRef(null),r=async()=>{var n,o;try{eP();const a=await((n=t==null?void 0:t.current)==null?void 0:n.executeAsync());return await((o=t==null?void 0:t.current)==null?void 0:o.reset()),a??null}catch(a){console.error(a)}return null};return l.jsxs(Vm.Provider,{value:{recaptchaRef:t,executeRecaptcha:r},children:[e,l.jsx(RS,{sitekey:QT,size:"invisible",ref:t})]})},v1=()=>{const e=y.useContext(Vm);if(e===void 0)throw new Error("useReCaptcha must be used within a ReCaptchaProvider");return e},eP=()=>{var t,r;const e=(r=(t=[...document.getElementsByTagName("iframe")].find(n=>n.src.includes("google.com/recaptcha/api2/bframe")))==null?void 0:t.parentNode)==null?void 0:r.parentNode;e&&new MutationObserver(()=>{(e.style.visibility!=="visible"||e.style.opacity!=="1")&&(e.style.opacity="1",e.style.visibility="visible")}).observe(e,{attributeFilter:["style"]})},Jo=(e,t,r)=>{const n=t.safeParse(e.values);if(!n.success){const o=n.error.issues;for(const a of o)r.setError(PE(r.names,a.path),a.message)}},tP=y.forwardRef(({value:e,onChange:t,onComplete:r},n)=>l.jsx(Cm,{ref:n,value:e,onChange:t,onComplete:r,maxLength:6,containerClassName:"group flex items-center mt-2",render:({slots:o})=>l.jsx("div",{className:"flex w-full justify-between gap-1.5",children:o.map(a=>l.jsx(rP,{...a},crypto.randomUUID()))})}));function rP({char:e,isActive:t}){return l.jsx("div",{className:mr("relative w-20 h-20","flex items-center justify-center","transition-all duration-300","border border-custom rounded-custom","group-hover:border-brandDefault/20 group-focus-within:border-brandDefault/20","outline outline-0 outline-brandDefault/20",t&&"outline-2 outline-brandDefault"),children:e?l.jsx("div",{children:e}):l.jsx("div",{className:"text-surface200",children:"0"})})}var nP=P.object({email:P.string().trim().min(1,{message:"The email field cannot be empty."}).email({message:"Please enter a valid email."})}),oP=P.object({otp:P.string().regex(/^[0-9]{6}$/,{message:"Invalid verification code. The code should be a six-digit number. Please try again"})}),Um=({title:e,subtitle:t})=>l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"font-bold text-xxl mb-1",children:e}),l.jsx("div",{className:"text-textSecondary mb-6",children:t})]}),Wm=({name:e})=>l.jsx(oo,{className:"text-signalDanger mb-5",name:e}),aP=()=>{const e=en(Zp),[{email:t}]=he(va),{executeRecaptcha:r}=v1(),n=qo({defaultValues:{email:t||""}});return n.useValidate(o=>Jo(o,nP,n)),n.useSubmit(async o=>{const a=await r();a&&await e({email:o.values.email,recaptcha:a})}),l.jsxs(Ko,{store:n,children:[l.jsx(Um,{title:"Sign In",subtitle:"To continue, you’ll need to enter your email address below."}),l.jsx(Js,{name:n.names.email,className:"text-sm text-textSecondary mb-1",children:"Email Address"}),l.jsx(La,{className:"mt-1",name:n.names.email,render:l.jsx(Mn,{placeholder:"Enter your email address"})}),l.jsx(Wm,{name:n.names.email.toString()}),l.jsx(Da,{render:l.jsx(Se,{type:"Primary",className:"w-full h-11"}),children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Sign In"})})]})},sP=()=>{const[e,t]=he(va),r=en(Gp),{executeRecaptcha:n}=v1(),o=qo({defaultValues:{otp:""}});o.useValidate(c=>Jo(c,oP,o)),o.useSubmit(async c=>{const u=await n();u!==null&&await r({otp:c.values.otp,recaptcha:u})});const a=()=>t({requested:!1}),s=o.useValue(o.names.otp);return l.jsxs(Ko,{store:o,children:[l.jsx(Um,{title:"Check Your Email",subtitle:`Enter the 6-digit code we sent to ${e.email}`}),l.jsx(Js,{name:o.names.otp,className:"text-sm text-textSecondary mb-1",children:"Code"}),l.jsx(cb,{name:o.names.otp,render:()=>l.jsx(tP,{onChange:c=>o.setValue(o.names.otp,c),value:s,onComplete:o.submit})}),l.jsx(Wm,{name:o.names.otp.toString()}),l.jsxs("div",{className:"flex",children:[l.jsx(Se,{onClick:a,type:"Secondary",className:"w-[120px] h-11 mr-4",children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Back"})}),l.jsx(Da,{render:l.jsx(Se,{type:"Primary",className:"flex-1 h-11"}),children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Sign In"})})]})]})},zm=({inModal:e})=>{const[t]=he(va);he(Pa);const[r]=he(n=>n.spy(Gp.pendingAtom)+n.spy(Zp.pendingAtom)>0);return l.jsx("div",{className:vo("w-full h-full flex-center"),children:r?l.jsx(tr,{}):l.jsx("div",{className:`max-w-[480px] w-full mx-4 ${e&&"max-w-full mx-0"}`,children:t.requested?l.jsx(sP,{}):l.jsx(aP,{})})})},iP=({isActive:e,setIsActive:t})=>{const[r]=he(ho);return y.useEffect(()=>{r&&t(!1)},[r]),l.jsx(On,{title:"",withoutHeader:!0,isActive:e,setIsActive:t,children:l.jsx(zm,{inModal:!0})})},lP=iP,cP=({customerEmail:e,getPossibleGateways:t,setGateway:r,getDiscordSettings:n,cart:o,products:a,submitCart:s,setCustomFieldsToCart:c,totalAndDiscount:u,setDiscordSocialConnectId:d,setRecaptcha:f,setPaymentMethod:h})=>{var V;const[p,v]=y.useState(!1),m=y.useMemo(()=>n(),[o]),[g,x]=he(S_),[b,C]=y.useState({}),[_]=he(ho),[w]=he($o.dataAtom),S=en($o),{executeRecaptcha:A}=v1(),T=(V=le.get(Om))==null?void 0:V.id,E=Hr(),k=y.useMemo(()=>t(),[o.parts]),[R,D]=y.useState(!1),M=()=>{const Q={...b};g.forEach(H=>{H.required&&!le.get(H.valueAtom).trim()?C({...b,[H.name]:`Field ${H.name} is required but has an empty value.`}):(delete Q[H.name],C(Q))})},G=async()=>{if(o.gateway==="Balance"&&!_)return D(!0);const Q={};M(),g.forEach(K=>Q[K.name]=le.get(K.valueAtom)),c(Q),T&&m.isEnabled&&d(T);const H=await A();if(H&&(f(H),!Object.keys(b).length)){const K=await s();E(`${le.get(to).Order}/${"order"in K.data?K.data.order.id:K.data.id}`)}};return y.useEffect(()=>{x(C_(o.parts,a))},[o.parts,a]),y.useEffect(()=>{_&&S()},[_]),l.jsxs("div",{className:"px-4 py-6 bg-surface100 mt-10 md:mt-0 md:w-full md:p-10 md:pr-4 md:max-h-svh md:overflow-auto",children:[l.jsxs("div",{className:"md:max-w-[520px]",children:[l.jsx(Hm,{possibleGateways:k,setGateway:r,setPaymentMethod:h,balance:w,totalAndDiscount:u,onSignInClick:()=>D(!0)}),l.jsxs("div",{className:"mt-8 pb-6 border-b border-borderDefault",children:[l.jsx("p",{className:"text-textSecondary text-sm",children:"Email Address"}),l.jsx(Mn,{className:"mt-1",placeholder:"mail@mail.com",value:e||"",onChange:Q=>Ds(le,Q.target.value),disabled:!!_}),l.jsxs("label",{className:"flex gap-2 text-sm mt-3",children:[l.jsx(cs,{checked:p,onCheckedChange:v}),l.jsx("p",{children:"I agree to receive email updates about my order"})]})]}),l.jsx(_T,{customFields:g}),m.isEnabled&&l.jsxs("div",{className:"mt-5",children:[l.jsx("p",{className:"text-textSecondary text-sm",children:"Social Connect"}),l.jsx("div",{className:"mt-1",children:l.jsx(RT,{customerEmail:e||""})})]}),l.jsxs("div",{className:"mt-10",children:[l.jsx(Se,{className:"w-full",onClick:G,disabled:(m.isRequired?!T:!1)||!o.gateway,children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Continue to Checkout"})}),l.jsx(Mm,{}),l.jsx(Im,{})]}),l.jsx(kn,{className:"mt-10 flex md:hidden"})]}),l.jsx(lP,{isActive:R,setIsActive:D})]})},uP=cP,dP=P.object({email:P.string()}),Cl=Ut(async()=>kr(await hx(),dP)).pipe(xr(null));Qr(Cl.dataAtom,Cl);var fP=()=>{const[e]=he(Ds),{cart:t,products:r,pending:n,addProductToCart:o,getTotalAndDiscount:a,getPossibleGateways:s,submitCart:c,setGateway:u,setRecaptcha:d,applyCoupon:f,setDiscordSocialConnectId:h,setCustomFields:p,applyCouponPending:v,coupon:m,removeCoupon:g,getDiscordSettings:x,getPages:b,setPaymentMethod:C}=ni(),_=y.useMemo(()=>a(),[m,t]),[w]=he(Cl.dataAtom);return y.useEffect(()=>{w&&Ds(le,w.email)},[w]),n?l.jsx(tr,{}):l.jsxs("div",{className:"min-h-svh bg-surface0 md:flex",children:[l.jsx(yT,{cart:t,products:r,applyCoupon:f,applyCouponPending:v,coupon:m,removeCoupon:g,totalAndDiscount:_}),l.jsx(uP,{cart:t,getPossibleGateways:s,customerEmail:e,setGateway:u,getDiscordSettings:x,products:r,submitCart:c,totalAndDiscount:_,setCustomFieldsToCart:p,setDiscordSocialConnectId:h,setRecaptcha:d,setPaymentMethod:C})]})},hP=fP,pP=()=>l.jsx($m,{children:l.jsx(hP,{})}),mP=pP,gP=({email:e,balance:t})=>l.jsxs("div",{className:"mb-4 hidden xl:flex w-full flex-col items-center rounded-2xl bg-surface0 py-4",children:[l.jsx("div",{className:"mb-1 font-bold",children:e}),l.jsxs("div",{className:"rounded-xl bg-brandLight px-2 py-1 text-sm text-brandDefault",children:["Balance: ",t]})]}),vP=gP,xP={sm:"w-4 h-4",s:"w-4 h-4",m:"w-[21px] h-[21px]",l:"w-[28px] h-[28px]"},yP={iconPrimary:"fill-iconPrimary",iconSecondary:"fill-iconSecondary",iconAction:"fill-iconAction",textPrimary:"fill-textPrimary",textSecondary:"fill-textSecondary",surface100:"fill-surface100",signalDanger:"fill-signalDanger"},bP={s:"",sm:"icon-wrapper w-10 h-10",m:"icon-wrapper w-11 h-11",l:"icon-wrapper w-12 h-12"},An=({Icon:e,color:t="iconPrimary",size:r="s",className:n})=>l.jsx("div",{className:mr(bP[r],n),children:l.jsx("div",{className:mr(yP[t],xP[r],"flex-center"),children:e&&l.jsx(e,{})})}),CP=[["Home",Nv],["Orders",Op],["Rewards",Dp],["Balance",Cv],["Subscriptions",Gv]],Gh=({children:e,className:t="",onClick:r})=>l.jsx("button",{type:"button",className:vo("xl:border-none flex cursor-pointer items-center py-3 pl-2 pr-4 xl:pr-0 border-b border-transparent w-full outline-offset-[-1px] outline-brandDefault xl:rounded-custom",t),onClick:r,children:e}),wP=xv(({ctx:e})=>{const[t]=he(Wu),r=en(Su);return l.jsxs("div",{className:"xl:flex xl:flex-col flex overflow-x-auto gap-1",children:[CP.map(([n,o])=>{const a=n===t;return l.jsxs(Gh,{onClick:()=>Wu(e,n),className:`flex-1 ${a?"xl:bg-surface100 text-textPrimary border-textPrimary":"text-textSecondary bg-surface0 xl:hover:bg-surface100"}`,children:[l.jsx("div",{className:"mr-2",children:l.jsx(An,{Icon:o,color:a?"textPrimary":"textSecondary"})}),l.jsx("div",{children:n})]},n)}),l.jsxs(Gh,{className:"text-iconAction xl:mt-1 text-nowrap",onClick:r,children:[l.jsx("div",{className:"mr-2",children:l.jsx(An,{Icon:Tv,color:"iconAction",size:"s"})}),l.jsx("div",{children:"Sign Out"})]})]})}),SP=wP,EP=()=>{const[e]=he(Cl.dataAtom),[t]=he($o.dataAtom);return!e||!t?null:l.jsxs("div",{className:"w-full xl:border-r-custom border-borderDefault px-4 xl:py-6 xl:max-w-[320px] xl:pr-4",children:[l.jsx(vP,{email:e.email,balance:kt(t)}),l.jsx(SP,{})]})},si=({title:e,description:t})=>l.jsxs("div",{className:mr("flex-center","flex-1","flex-col"),children:[l.jsx("div",{className:"w-7 h-7 text-iconSecondary",children:l.jsx(Hp,{})}),l.jsx("div",{className:"font-bold text-h2 text-textSecondary mt-3 mb-1",children:e}),l.jsx("div",{className:"text-p text-textSecondary",children:t})]}),nc=({title:e,description:t})=>l.jsxs("div",{className:"mt-2 mb-4 ml-4",children:[l.jsx("div",{className:"font-bold text-lg",children:e}),t&&l.jsx("div",{className:"text-textSecondary",children:t})]}),_i=(e,t)=>Array.from({length:t-e+1},(r,n)=>e+n),jP=(e,t,r)=>{const n=r*2+3+2;if(t<=n)return _i(1,t);const o=Math.max(e-r,1),a=Math.min(e+r,t),s=o>2,c=a<t-2;return!s&&c?[..._i(1,3+2*r),"right-ellipsis",t]:s&&!c?[1,"left-ellipsis",..._i(t-(3+2*r)+1,t)]:[1,"left-ellipsis",..._i(o,a),"right-ellipsis",t]},_P=({currentPage:e,totalPages:t,onPageChange:r,siblingCount:n=1})=>{const o=u=>{const d=n*2+1;r(u?Math.max(e-d,1):Math.min(e+d,t))},a=e===1,s=e===t,c=u=>l.jsx(Se,{type:typeof u=="number"&&u===e?"Primary":"Secondary",onClick:()=>typeof u=="string"?o(u==="left-ellipsis"):r(u),"aria-current":typeof u=="number"&&u===e?"page":void 0,children:typeof u=="string"?"…":u},u);return l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx(Se,{type:"Secondary",onClick:()=>!a&&r(e-1),disabled:a,children:l.jsx(Dv,{})}),jP(e,t,n).map(c),l.jsx(Se,{type:"Secondary",onClick:()=>!s&&r(e+1),disabled:s,children:l.jsx(Ov,{})})]})},TP=(e,t,r)=>{const n=(e-1)*r+1,o=Math.min(e*r,t);return`Showing ${n}-${o} entries of ${t}`},x1=({className:e,totalCount:t,...r})=>{const n=Math.ceil(t/Eu);return n<2?null:l.jsxs("div",{className:`flex lg:h-[72px] justify-start align-middle items-start lg:justify-between p-4 lg:flex-row flex-col mt-auto ${e}`,children:[l.jsx("div",{className:"text-textSecondary flex-center mb-2",children:TP(r.currentPage,t,Eu)}),l.jsx("div",{className:"flex-center",children:l.jsx(_P,{...r,totalPages:n})})]})},PP=y.forwardRef(({className:e,style:t,...r},n)=>l.jsx("div",{ref:n,...r,className:mr("fixed","inset-4","m-auto","z-50","h-fit","overflow-x-auto","rounded-3xl","bg-white",e),style:{maxHeight:"calc(100vh - 2 * 12px)",maxWidth:650,...t}})),oc=({store:e,children:t,title:r})=>l.jsx(MC,{store:e,children:l.jsxs(OC,{render:l.jsx(PP,{}),backdrop:l.jsx("div",{className:"bg-[rgba(37,37,37,0.24)]"}),children:[l.jsxs("div",{className:"py-4 px-6 border-borderDefault border-b flex",children:[l.jsx("div",{className:"text-xl font-bold",children:r}),l.jsx(z2,{className:"ml-auto",children:l.jsx(Iv,{})})]}),l.jsx("div",{className:"py-4 px-6",children:t})]})}),y1=Ke(1),Zm=(e=>(e.Added="ADDED",e.Removed="REMOVED",e))(Zm||{}),NP=P.object({id:P.string().uuid(),price:qs,createdAt:P.string().datetime(),description:P.string(),status:P.nativeEnum(Zm)}),RP=P.object({list:P.array(NP),totalCount:P.number()}),Os=Ut(async e=>kr(await _x({PageNumber:e.get(y1)}),RP)).pipe(xr(null));y1.onChange(e=>{Os(e)});Qr(Os.dataAtom,Os);var kP=P.object({data:P.object({chargeId:P.string()})}),wl=Ut(async(e,{price:t,gateway:r,customerEmail:n})=>kr(await bx({customerEmail:n,price:t,gateway:r}),kP)).pipe(xr(null)),AP=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"})}),LP=({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 mb-4",children:[l.jsx(Ip,{}),l.jsx("div",{className:"ml-2",children:e>0||Number.isNaN(e)?`Enter another ${kt({amount:e,currency:r})} and receive an additional bonus of
|
|
142
147
|
${t}%`:`You will receive an additional bonus of
|
|
143
|
-
${t}%`})]}),OP=e=>{const[t]=he(Yr.dataAtom),[r]=he(wl.pendingAtom),n=qo({defaultValues:{amount:"",gateway:""}}),o=en(wl),a=Oa({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=>Jo(m,LP,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:Fp}),l.jsx("span",{className:"ml-1 text-[var(--text-inverted)]",children:"Add balance"})]}),l.jsx(oc,{store:a,title:"Top Up Account Balance",children:l.jsxs(Ko,{store:n,children:[l.jsx(Js,{className:"text-sm text-textSecondary",name:n.names.amount,children:"Enter Amount"}),l.jsx(La,{name:n.names.amount,render:l.jsx(Mn,{placeholder:"0",icon:l.jsx(Vp,{})})}),l.jsx(oo,{className:"text-signalDanger",name:n.names.amount}),d&&v!==void 0&&l.jsx(DP,{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:mr("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:Fr(m.logoCfImageId),className:"mb-4 h-6"}),l.jsx("div",{children:m.displayName})]},m.name))}),l.jsx(oo,{className:"text-signalDanger mb-4",name:n.names.gateway}),l.jsx(Da,{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-custom items-center mb-4",children:[l.jsx("div",{className:"h-[20px] w-[20px] mr-[10px] flex-center",children:l.jsx($p,{})}),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-custom items-center",children:[l.jsx("div",{className:"h-[20px] w-[20px] mr-[10px] flex-center",children:l.jsx(Up,{})}),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."})]})]})})]})},MP={ADDED:Fp,REMOVED:Av},IP={ADDED:"+",REMOVED:"-"},FP={ADDED:"text-successText",REMOVED:"text-textPrimary"},BP={ADDED:"Added to your balance",REMOVED:"Payment"},HP=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},VP=({id:e,price:t,status:r})=>{const n=kt(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:MP[r]}),l.jsxs("div",{className:"ml-3",children:[l.jsx("div",{children:BP[r]}),l.jsxs("div",{className:"text-textSecondary text-sm",children:["ID: ",e]})]})]}),l.jsxs("div",{className:`${FP[r]} font-semibold`,children:[IP[r]," ",n]})]},e)},$P=()=>{const[e]=he(Os.dataAtom),[t]=he($o.dataAtom),[r]=he(Vo.dataAtom),[n,o]=he(y1),[a]=he(c=>c.spy(Os.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=HP(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(VP)]},d)),l.jsx(x1,{currentPage:n,totalCount:e.totalCount,onPageChange:o})]})}return l.jsx(si,{title:"Transaction History",description:"When you top up your account balance or receive a refund from our team, you'll see a history of transactions here."})};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&&kt(t)}),(r==null?void 0:r.isEnabled)&&l.jsx(OP,{...r}),l.jsxs("div",{className:"flex w-full md:w-auto",children:[l.jsx(Se,{type:"Secondary",className:"mr-2 md:mr-4 flex-center w-full md:w-auto shrink",children:"Contact support"}),l.jsx(Se,{type:"Secondary",className:"rounded-xl h-9 w-9",children:l.jsx(An,{Icon:Lv})})]})]})]}),l.jsx(nc,{title:"Transactions"}),l.jsx("div",{className:"flex flex-col flex-1",children:s()})]})},UP=P.object({id:P.number(),cfId:P.string()}),qh=P.object({name:P.string(),image:UP,amountSpentUsd:P.number().optional(),purchasedTimes:P.number().int()}),WP=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:qs.optional(),spendMoreUsdForNextPlace:P.number(),topSpenderProduct:qh.optional(),favoriteProduct:qh.optional()}),Ms=Ut(async()=>kr(await px(),WP)).pipe(xr(null));Qr(Ms.dataAtom,Ms);var zP=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()})}),Sl=Ut(async()=>kr(await xx(),zP)).pipe(xr(null)),ZP=Ut(async(e,t)=>{await yx(t),await Ms(e)}).pipe(xr(null));Qr(Sl.dataAtom,Sl);var GP=({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})]})]}),qP=[{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"}],YP=()=>l.jsx("div",{children:qP.map(({caption:e,description:t},r,n)=>l.jsx(GP,{caption:e,description:t,index:r+1,bar:r+1!==n.length},e))}),KP=YP,XP=P.object({referralCode:P.string().min(3,{message:"Referral Code should have minimum length of 3"})}),JP=()=>{const e=qo({defaultValues:{referralCode:""}}),t=Oa({defaultOpen:!1}),r=e.useValue(e.names.referralCode),n=en(ZP);return e.useSubmit(()=>{n({referralCode:r}),t.hide()}),e.useValidate(o=>Jo(o,XP,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(Ko,{store:e,children:[l.jsx(Js,{className:"text-sm text-textSecondary",name:e.names.referralCode,children:"Affiliate Code"}),l.jsx(La,{name:e.names.referralCode,render:l.jsx(Mn,{placeholder:"Enter code here (e.g Join)"})}),l.jsx(oo,{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(kv,{})}),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(z2,{render:l.jsx(Se,{type:"Secondary",className:"mr-3",children:"Cancel"})}),l.jsx(Da,{render:l.jsx(Se,{children:"Create"})})]})]})})]})},QP=JP,eN=()=>{const[e]=he(Sl.dataAtom),[t]=he(c=>c.spy(Sl.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(_a,{})})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mb-6",children:l.jsx(QP,{})}),l.jsx(KP,{})]})]})})},tN=eN,rN=({Icon:e,title:t,value:r,image:n,imageName:o,children:a,className:s})=>{const[c,u]=y.useState(!0),[d,f]=y.useState(!1),h=()=>{u(!1)},p=()=>{u(!1),f(!0)};return l.jsxs("div",{className:`relative flex w-full flex-col justify-between rounded-custom border-custom 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(Mv,{})}),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:"iconAction",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]})]})},on=rN,nN="Billgang",oN="D4RK",Yh=({children:e})=>l.jsx("div",{className:"gap-2 w-full lg:gap-4 grid grid-cols-1 col-span-2 lg:col-span-1",children:e}),aN=()=>{const[e]=he(Ms.dataAtom),[t]=he(r=>r.spy(Ms.pendingAtom));return he(Vo.dataAtom),t?l.jsx(tr,{}):e?l.jsxs("div",{className:"flex w-full gap-4 lg:pb-6",children:[l.jsx(tN,{}),l.jsxs(Yh,{children:[l.jsx(on,{Icon:Pv,title:"Customer since",value:ax(e.createdAt)}),l.jsx(on,{Icon:Op,title:"Total spent",value:kt({amount:e.totalSpent})}),l.jsx(on,{Icon:Dp,title:"Top",value:`#${e.ratingPlacement}`,children:l.jsxs("div",{className:"text-xs text-textSecondary flex items-center mt-2",children:[l.jsx(An,{Icon:Bp,className:"mx-1"}),"Spend $",e.spendMoreUsdForNextPlace," more to be #",e.ratingPlacement+1]})}),l.jsx(on,{Icon:Sd,title:"Average review",value:e.averageReview})]}),e.topSpenderProduct&&l.jsx(on,{className:"col-span-2 lg:col-span-1",image:Fr(e.topSpenderProduct.image.cfId),imageName:e.topSpenderProduct.name,Icon:wv,title:"Top spent",value:`${kt({amount:e.topSpenderProduct.amountSpentUsd||0})} spent`}),l.jsxs(Yh,{children:[l.jsx(on,{Icon:Mp,title:"Purchases",value:e.totalPurchases}),l.jsx(on,{Icon:Rv,title:"Visits",value:e.visits}),l.jsx(on,{Icon:Ev,title:"Powered by",value:nN}),l.jsx(on,{Icon:yv,title:"Store",value:oN})]}),e.favoriteProduct&&l.jsx(on,{image:Fr(e.favoriteProduct.image.cfId),imageName:e.favoriteProduct.name,Icon:jv,title:"Favorite product",value:`bought ${e.favoriteProduct.purchasedTimes} times`})]}):null},b1=Ke(1),Gm=(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))(Gm||{}),sN=P.object({id:P.string(),status:P.nativeEnum(Gm),price:qs,gatewayName:P.string(),time:P.string(),review:P.object({rating:P.number()}).optional()}),iN=P.object({list:P.array(sN),totalCount:P.number()}),Uo=Ut(async e=>kr(await Ex({PageNumber:e.get(b1)}),iN)).pipe(xr(null));b1.onChange(e=>{Uo(e)});Qr(Uo.dataAtom,Uo);var lN=()=>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"})}),cN=()=>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"})}),uN=()=>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"})]}),dN={1:lN,2:cN,3:uN},fN={1:"bg-successBackground text-successText",2:"bg-warningBackground text-warningText",3:"bg-signalDangerBackground text-signalDanger"},hN=({status:e,variant:t})=>{const r=dN[t];return l.jsxs("div",{className:mr("flex items-center justify-start rounded-full p-[4px_8px]",fN[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}),Ir=({children:e,className:t})=>l.jsx(_r,{className:`text-sm text-textSecondary uppercase ${t}`,children:e}),pN=({children:e,className:t})=>l.jsx("div",{className:vo("overflow-x-auto grid grid-cols-[minmax(120px,auto)_repeat(5,minmax(min-content,auto))]",t),children:e}),qm=pN,mN={NEW:2,PENDING:2,COMPLETED:1,CANCELLED:3,EXPIRED:3,FULL_DELIVERY_FAILURE:3,PARTIALLY_DELIVERED:2,REFUNDED:1,FAILED:3},gN=(e,t)=>{const r=t.find(n=>n.name===e);return r?l.jsxs(l.Fragment,{children:[l.jsx("img",{alt:r.displayName,src:Fr(r.logoCfImageId),className:"h-6 mr-1"}),l.jsx("div",{children:r.displayName})]}):null},vN=({item:e,gatewaysDetail:t})=>{const[r,n]=ul(e.time);return l.jsxs(y.Fragment,{children:[l.jsx(_r,{children:e.id}),l.jsx(_r,{children:l.jsx(hN,{status:e.status,variant:mN[e.status]})}),l.jsx(_r,{children:kt(e.price)}),l.jsx(_r,{children:gN(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:Sd}),l.jsx("div",{className:"ml-1",children:e.review.rating})]}):"None"})]},e.id)},xN=()=>{var c;const[e]=he(Uo.dataAtom),[t,r]=he(b1),[n]=he(u=>u.spy(Uo.pendingAtom)>0),[o]=he(Yr.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(qm,{children:[l.jsx(Ir,{children:"Invoice ID"}),l.jsx(Ir,{children:"Status"}),l.jsx(Ir,{children:"Value"}),l.jsx(Ir,{children:"Payment"}),l.jsx(Ir,{children:"Date"}),l.jsx(Ir,{children:"Review"}),s&&e.list.map(u=>l.jsx(vN,{item:u,gatewaysDetail:o},u.id))]}),s&&l.jsx(x1,{currentPage:t,totalCount:e.totalCount,onPageChange:r}),n?l.jsx(tr,{}):a?l.jsx(si,{title:"Orders are empty",description:"Order history will be collected here"}):null]})},yN=xN,bN=()=>{var o;const[e]=he(a=>a.spy(Uo.pendingAtom)>0),[t]=he(Uo.dataAtom),[r]=he(Yr.dataAtom),n=!((o=t==null?void 0:t.list)!=null&&o.length)||!r;return l.jsx(l.Fragment,{children:e?l.jsx(tr,{}):n?l.jsx(si,{title:"No Orders",description:"When you purchase products from our website, you'll see a history of orders here."}):l.jsxs(l.Fragment,{children:[l.jsx(nc,{title:"Orders"}),l.jsx(yN,{})]})})},CN=P.object({id:P.number(),variantId:P.number(),productName:P.string(),variantName:P.string(),quantity:P.number()}),Ti=P.object({balance:qs}),Pi=P.object({productsWithVariants:P.array(CN)}),wN=P.union([P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:Ti,ruleType:P.literal("SPEND_AMOUNT"),ruleOptions:P.object({forEach:P.number()})}),P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:Ti,ruleType:P.literal("ORDER_COUNT"),ruleOptions:P.object({ordersCount:P.number()})}),P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:Ti,ruleType:P.literal("REFER_FRIEND"),ruleOptions:P.object({minReferrals:P.number(),minCompletedOrders:P.number()})}),P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:Ti,ruleType:P.literal("LEAVE_REVIEW"),ruleOptions:P.object({minReviews:P.number(),minStars:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Pi,ruleType:P.literal("SPEND_AMOUNT"),ruleOptions:P.object({forEach:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Pi,ruleType:P.literal("ORDER_COUNT"),ruleOptions:P.object({ordersCount:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Pi,ruleType:P.literal("REFER_FRIEND"),ruleOptions:P.object({minReferrals:P.number(),minCompletedOrders:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Pi,ruleType:P.literal("LEAVE_REVIEW"),ruleOptions:P.object({minReviews:P.number(),minStars:P.number()})})]),SN=P.object({id:P.number(),progress:P.number(),createdAt:P.string(),completedAt:P.string().optional(),rewardRule:wN}),EN=P.array(SN),El=Ut(async()=>kr(await mx(),EN)).pipe(xr(null));Qr(El.dataAtom,El);var jN=()=>{const[e]=he(El.dataAtom),[t]=he(o=>o.spy(El.pendingAtom)>0),r=!(e!=null&&e.length),n=!t&&!r;return l.jsx(l.Fragment,{children:t?l.jsx(tr,{}):r?l.jsx(si,{title:"Rewards Unavailable",description:"Check back in the future to join our reward program."}):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(_N,{achievement:o},o.id))})]})})},_N=({achievement:e})=>{const[t,r]=kN(e),[n,o,a]=AN(e),s=o===a;return l.jsxs("div",{className:"flex flex-col border border-borderDefault rounded-2xl p-6 items-center",children:[l.jsx(TN,{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(_v,{})," ",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:Mp}),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,{type:s?"Primary":"Secondary",className:"w-full mt-auto",children:s?"Claim":PN(e)})]})},TN=({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,"%"]})]})},Ni=e=>{switch(e.rewardRule.rewardType){case"BALANCE":return`${kt(e.rewardRule.rewardOptions.balance)} on the balance`;case"PRODUCT":return`products: ${e.rewardRule.rewardOptions.productsWithVariants.map(t=>`${t.quantity} ${t.productName} (${t.variantName})`).join()}`}},PN=e=>{switch(e.rewardRule.rewardType){case"BALANCE":return kt(e.rewardRule.rewardOptions.balance);case"PRODUCT":return`${e.rewardRule.rewardOptions.productsWithVariants.map(t=>`${t.quantity} ${t.productName} (${t.variantName})`).join()}`}},NN=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 ${Ni(e)}. You've spent $${e.progress} so far.`;case"ORDER_COUNT":return`Place ${e.rewardRule.ruleOptions.ordersCount} orders to receive a reward of ${Ni(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 ${Ni(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 ${Ni(e)}. You've left ${e.progress} reviews so far.`}},RN=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}`}},kN=e=>[RN(e),NN(e)],AN=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]},Ym=(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))(Ym||{}),C1=Ke(1),Km=P.object({id:P.string(),productName:P.string(),status:P.nativeEnum(Ym),price:qs,gatewayName:P.string(),createdAt:P.string(),accessToken:P.string(),recurringInterval:P.string(),currentChargeAttempt:P.number(),nextChargeAttemptAt:P.string().optional(),activeTo:P.string().optional()}),LN=P.object({list:P.array(Km),totalCount:P.number()}),Wo=Ut(async e=>kr(await jx({PageNumber:e.get(C1)}),LN)).pipe(xr(null));C1.onChange(e=>{Wo(e)});Qr(Wo.dataAtom,Wo);var DN={ACTIVE:{icon:l.jsx(Ed,{}),title:"Active",className:"text-successText bg-successBackground"},AWAITING_PAYMENT:{icon:l.jsx(Vi,{}),title:"Awaiting Payment",className:"bg-warningBackground text-warningText"},CANCELLED:{icon:l.jsx(En,{}),title:"Cancelled",className:"text-signalDanger bg-signalDangerBackground"},CHANGED_GATEWAY:{icon:l.jsx(Cu,{}),title:"Upgraded",className:"text-signalDanger bg-signalDangerBackground"},EXPIRED:{icon:l.jsx(En,{}),title:"Expired",className:"text-signalDanger bg-signalDangerBackground"},RIAL:{icon:l.jsx(Vi,{}),title:"Active",className:"text-textSecondary bg-surface0"},PAST_DUE:{icon:l.jsx(Vi,{}),title:"Trial",className:"text-signalDanger bg-signalDangerBackground"},REPLACED:{icon:l.jsx(Cu,{}),title:"Replaced",className:"text-textSecondary bg-surface0"}},ON=({status:e})=>{const t=DN[e];return l.jsxs("div",{className:vo("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})]})},Xm=ON,MN=(e,t)=>{const r=t.find(n=>n.name===e);return r?l.jsxs(l.Fragment,{children:[l.jsx("img",{alt:r.displayName,src:Fr(r.logoCfImageId),className:"h-6 mr-1"}),l.jsx("div",{children:r.displayName})]}):null},IN=({item:e,gatewaysDetail:t})=>{const[r,n]=ul(e.createdAt),[o]=ul(e.activeTo||"");return l.jsxs(y.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-custom",children:l.jsx(Ul,{})}),l.jsxs("div",{children:[l.jsx(j0,{to:`${le.get(to).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(Xm,{status:e.status})}),l.jsx(_r,{children:kt(e.price)}),l.jsx(_r,{children:MN(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)},FN=()=>{var u;const[e]=he(Wo.dataAtom),[t,r]=he(C1),[n]=he(d=>d.spy(Wo.pendingAtom)>0),[o]=he(Yr.dataAtom),a=en(Yr),s=!(e!=null&&e.list.length)||!o,c=!n&&!s;return y.useEffect(()=>{a([])},[]),l.jsxs("div",{className:"border border-borderDefault rounded-2xl flex justify-between flex-col flex-1",children:[l.jsxs(qm,{className:"overflow-x-auto grid grid-cols-[minmax(120px,auto)_minmax(0,20%)_repeat(4,minmax(min-content,auto))]",children:[l.jsx(Ir,{className:"w-full",children:"Product name"}),l.jsx(Ir,{children:"ID"}),l.jsx(Ir,{children:"Status"}),l.jsx(Ir,{children:"Value"}),l.jsx(Ir,{children:"Payment"}),l.jsx(Ir,{children:"Date"}),c&&((u=e==null?void 0:e.list)==null?void 0:u.map(d=>l.jsx(IN,{item:d,gatewaysDetail:o},d.id)))]}),c&&l.jsx(x1,{currentPage:t,totalCount:e==null?void 0:e.totalCount,onPageChange:r})]})},BN=FN,HN=()=>{const[e]=he(Wo.dataAtom),[t]=he(o=>o.spy(Wo.pendingAtom)>0),[r]=he(Yr.dataAtom),n=!(e!=null&&e.list.length)||!r;return l.jsx(l.Fragment,{children:t?l.jsx(tr,{}):n?l.jsx(si,{title:"Subscriptions History",description:"When you subscribe to a product on our website, you'll see a history of your subscriptions here."}):l.jsxs(l.Fragment,{children:[l.jsx(nc,{title:"Subscriptions"}),l.jsx(BN,{})]})})},VN=HN,Wu=Ke("Home"),$N={Home:aN,Orders:bN,Rewards:jN,Balance:$P,Subscriptions:VN},UN=()=>{const[e]=he(ho),[t]=he(Wu),r=$N[t];return e?l.jsxs("main",{className:"h-full w-full max-w-maxWidthStore m-auto flex flex-grow flex-col xl:flex-row",children:[l.jsx(jP,{}),l.jsx("div",{className:"xl:p-6 xl:pr-10 px-4 py-6 flex flex-col w-full flex-1",children:l.jsx(r,{})})]}):l.jsx(zm,{})},WN=()=>l.jsxs($m,{children:[l.jsx(UN,{}),l.jsx(hj,{richColors:!0,closeButton:!0})]}),zN=WN,ZN=({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:$u(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(_a,{})})]})]})]})},Jm=ZN,Ri={PAID:"Paid",PENDING:"Pending",EXPIRED:"Expired",CANCELLED:"Cancelled",NOT_PAID:"Not Paid"},GN={PAID:{displayName:Ri.PAID,displayMessage:"The invoice has been completed and the product has been delivered.",type:"success"},PENDING:{displayName:Ri.PENDING,displayMessage:"The invoice has been created and we are now waiting to receive the payment.",type:"warning"},EXPIRED:{displayName:Ri.EXPIRED,displayMessage:"Your payment has expired due to the payment not being sent in time.",type:"error"},CANCELLED:{displayName:Ri.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"}},qN=({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:$u(new Date(e),"dd.MM.yyyy")}),l.jsxs("p",{children:["11:12:10 PM ",$u(new Date(e),"hh:mm:ss aa")]})]}),l.jsx("p",{className:"mt-2",children:GN[t].displayMessage})]}),YN=({timeline:e})=>{const[t,r]=y.useState(!1);return l.jsxs("div",{className:"relative",children:[l.jsxs("div",{className:`py-4 px-6 bg-surface100 rounded-custom 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(qN,{date:e[n],chargeStatus:n},n))})]}),l.jsxs("div",{className:"px-3 h-12 pr-4 flex justify-between items-center bg-surface100 rounded-custom cursor-pointer",onClick:()=>r(!t),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Qv,{}),l.jsx("p",{className:"text-sm",children:"Track Payment"})]}),l.jsx(ex,{})]})]})},Qm=YN,KN=({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=y.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,{type:"Secondary",className:"gap-1",onClick:()=>{var a;return t(((a=e==null?void 0:e.order)==null?void 0:a.id)||"")},children:[l.jsx(_a,{}),"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(p1,{product:a},a.id))}),l.jsx(rc,{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(Qm,{timeline:e.timeline})}),l.jsx(kn,{className:"hidden md:flex"})]})]})]})})},XN=KN,JN=({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(Mn,{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(_a,{})})]})})},QN=({props:e})=>l.jsx(Se,{className:"w-full",size:"lg",onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),eR=({props:e})=>l.jsx("div",{className:"w-full flex justify-center py-4 bg-surface0 rounded-custom",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:""})})}),tR=({props:e})=>l.jsxs("div",{className:"p-3 rounded-custom 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(Hp,{})}),l.jsx("p",{children:e.heading})]}),l.jsx("p",{className:"text-textSecondary mt-2",children:e.content})]}),rR=({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(e5,{block:r},n))]})},e5=({block:e})=>{switch(e.type){case"Section":return l.jsx(rR,{...e});case"ReadOnlyTextInput":return l.jsx(JN,{...e});case"Notify":return l.jsx(tR,{...e});case"Button":return l.jsx(QN,{...e});case"Image":return l.jsx(eR,{...e});default:return null}},nR=e5,oR=({isActive:e,setIsActive:t,price:r})=>{const[n,o]=y.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1});return l.jsx(On,{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(cs,{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(cs,{checked:n.agreeToSend,onCheckedChange:a=>o({...n,agreeToSend:a})}),l.jsxs("p",{children:["I agree to send the payment of ",kt(r)," ",r.currency]})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(cs,{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 ",kt(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,{type:"Secondary",className:"w-full",children:"Cancel"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{type:"Primary",className:"w-full",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:()=>t(!1),children:"Continue to Payment"})})]})]})})},aR=oR,sR=P.object({link:P.coerce.string().url().min(1,{message:"The link field cannot be empty."})}),iR=({isActive:e,setIsActive:t,chargeId:r})=>{const n=qo({defaultValues:{link:""}});return n.useValidate(o=>Jo(o,sR,n)),n.onSubmit(async o=>{await Cx({url:o.values.link},r)&&po(le,s=>[...s,{isActive:!0,title:"Success",message:"CashApp successfully verified",id:new Date().getTime(),status:!0}])}),l.jsx(On,{title:"CashApp Verify",setIsActive:t,isActive:e,children:l.jsx(Ko,{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(La,{className:"mt-1",name:n.names.link,render:l.jsx(Mn,{placeholder:"https://cash.app/payments/0000"})}),l.jsx(oo,{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,{type:"Secondary",className:"w-full",children:"Cancel"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{type:"Primary",className:"w-full",children:"Verify"})})]})]})})})},lR=iR,cR={PAID:"Paid",PENDING:"Pending",EXPIRED:"Expired",CANCELLED:"Cancelled",NOT_PAID:"Not Paid"},uR={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."},dR={PAID:l.jsx("div",{className:"p-3 rounded-custom bg-surface0 text-successText",children:l.jsx(Gs,{})}),PENDING:l.jsx("div",{className:"p-3 rounded-custom bg-surface0",children:l.jsx(wu,{})}),EXPIRED:l.jsx("div",{className:"p-3 rounded-custom bg-surface0",children:l.jsx(En,{})}),CANCELLED:l.jsx("div",{className:"p-3 rounded-custom bg-surface0",children:l.jsx(En,{})}),NOT_PAID:l.jsx("div",{className:"p-3 rounded-custom bg-surface0",children:l.jsx(En,{})})},fR=({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:[dR[t],l.jsx("h2",{className:"font-bold",children:cR[t]}),l.jsx("p",{className:"text-sm text-textSecondary",children:uR[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(to).Order}/${(n=e.order)==null?void 0:n.id}`)},children:[l.jsx(cl,{}),"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,{type:"Secondary",className:"w-full gap-1",onClick:()=>{var n;return window.open(`https://${(n=le.get(Pa))==null?void 0:n.info.domain}`)},children:[l.jsx(cl,{}),"Visit Website"]})}),l.jsx("div",{className:"w-full",children:l.jsxs(Se,{type:"Secondary",className:"w-full gap-1",children:[l.jsx(Wp,{}),"Contact Support"]})})]})]})},hR=fR,pR=()=>{const{id:e}=$s(),[t,r]=T0(),[n,o]=y.useState(!1),[a,s]=y.useState(),[c,u]=y.useState(!0),d=Hr(),f=y.useRef();return y.useEffect(()=>{const h=async(v,m=!1)=>{m||o(!0);const g=await Mx(v);o(!1),s(g)},p=setInterval(()=>{e&&h(e,!0)},5e3);return e&&h(e),()=>{clearInterval(p)}},[]),y.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,{}):l.jsxs("div",{className:"min-h-svh bg-surface0 md:flex",children:[l.jsx(XN,{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(hR,{charge:a}),a&&l.jsx("div",{className:`w-full ${a.status!=="NOT_PAID"&&"mt-5"}`,children:l.jsx(Jm,{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(nR,{block:h}))}),l.jsx(kn,{className:"mt-10 flex md:hidden"})]})}),(a==null?void 0:a.gateway)==="PayPalFF"&&l.jsx(aR,{price:a.price,isActive:c,setIsActive:u}),(a==null?void 0:a.gateway)==="Сashapp"&&l.jsx(lR,{isActive:c,setIsActive:u,chargeId:a.id})]})},mR=pR,gR=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"})}),vR=({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(Ip,{}),l.jsx("div",{className:"ml-2",children:e>0||Number.isNaN(e)?`Enter another ${kt({amount:e,currency:r})} and receive an additional bonus of
|
|
148
|
+
${t}%`})]}),DP=e=>{const[t]=he(Yr.dataAtom),[r]=he(wl.pendingAtom),n=qo({defaultValues:{amount:"",gateway:""}}),o=en(wl),a=Oa({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=>Jo(m,AP,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:Fp}),l.jsx("span",{className:"ml-1 text-[var(--text-inverted)]",children:"Add balance"})]}),l.jsx(oc,{store:a,title:"Top Up Account Balance",children:l.jsxs(Ko,{store:n,children:[l.jsx(Js,{className:"text-sm text-textSecondary",name:n.names.amount,children:"Enter Amount"}),l.jsx(La,{name:n.names.amount,render:l.jsx(Mn,{placeholder:"0",icon:l.jsx(Vp,{})})}),l.jsx(oo,{className:"text-signalDanger",name:n.names.amount}),d&&v!==void 0&&l.jsx(LP,{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:mr("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:Fr(m.logoCfImageId),className:"mb-4 h-6"}),l.jsx("div",{children:m.displayName})]},m.name))}),l.jsx(oo,{className:"text-signalDanger mb-4",name:n.names.gateway}),l.jsx(Da,{render:l.jsx(Se,{className:"w-full mt-10 mb-4 h-11 py-3",children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Continue to Checkout"})})}),r?l.jsx(tr,{}):null,l.jsxs("div",{className:"p-3 bg-surface0 flex rounded-custom items-center mb-4",children:[l.jsx("div",{className:"h-[20px] w-[20px] mr-[10px] flex-center",children:l.jsx($p,{})}),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-custom items-center",children:[l.jsx("div",{className:"h-[20px] w-[20px] mr-[10px] flex-center",children:l.jsx(Up,{})}),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."})]})]})})]})},OP={ADDED:Fp,REMOVED:Av},MP={ADDED:"+",REMOVED:"-"},IP={ADDED:"text-successText",REMOVED:"text-textPrimary"},FP={ADDED:"Added to your balance",REMOVED:"Payment"},BP=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},HP=({id:e,price:t,status:r})=>{const n=kt(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:OP[r]}),l.jsxs("div",{className:"ml-3",children:[l.jsx("div",{children:FP[r]}),l.jsxs("div",{className:"text-textSecondary text-sm",children:["ID: ",e]})]})]}),l.jsxs("div",{className:`${IP[r]} font-semibold`,children:[MP[r]," ",n]})]},e)},VP=()=>{const[e]=he(Os.dataAtom),[t]=he($o.dataAtom),[r]=he(Vo.dataAtom),[n,o]=he(y1),[a]=he(c=>c.spy(Os.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=BP(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(HP)]},d)),l.jsx(x1,{currentPage:n,totalCount:e.totalCount,onPageChange:o})]})}return l.jsx(si,{title:"Transaction History",description:"When you top up your account balance or receive a refund from our team, you'll see a history of transactions here."})};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&&kt(t)}),(r==null?void 0:r.isEnabled)&&l.jsx(DP,{...r}),l.jsxs("div",{className:"flex w-full md:w-auto",children:[l.jsx(Se,{type:"Secondary",className:"mr-2 md:mr-4 flex-center w-full md:w-auto shrink",children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Contact support"})}),l.jsx(Se,{type:"Secondary",className:"rounded-xl h-9 w-9",children:l.jsx(An,{Icon:Lv})})]})]})]}),l.jsx(nc,{title:"Transactions"}),l.jsx("div",{className:"flex flex-col flex-1",children:s()})]})},$P=P.object({id:P.number(),cfId:P.string()}),qh=P.object({name:P.string(),image:$P,amountSpentUsd:P.number().optional(),purchasedTimes:P.number().int()}),UP=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:qs.optional(),spendMoreUsdForNextPlace:P.number(),topSpenderProduct:qh.optional(),favoriteProduct:qh.optional()}),Ms=Ut(async()=>kr(await px(),UP)).pipe(xr(null));Qr(Ms.dataAtom,Ms);var WP=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()})}),Sl=Ut(async()=>kr(await xx(),WP)).pipe(xr(null)),zP=Ut(async(e,t)=>{await yx(t),await Ms(e)}).pipe(xr(null));Qr(Sl.dataAtom,Sl);var ZP=({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})]})]}),GP=[{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"}],qP=()=>l.jsx("div",{children:GP.map(({caption:e,description:t},r,n)=>l.jsx(ZP,{caption:e,description:t,index:r+1,bar:r+1!==n.length},e))}),YP=qP,KP=P.object({referralCode:P.string().min(3,{message:"Referral Code should have minimum length of 3"})}),XP=()=>{const e=qo({defaultValues:{referralCode:""}}),t=Oa({defaultOpen:!1}),r=e.useValue(e.names.referralCode),n=en(zP);return e.useSubmit(()=>{n({referralCode:r}),t.hide()}),e.useValidate(o=>Jo(o,KP,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(Ko,{store:e,children:[l.jsx(Js,{className:"text-sm text-textSecondary",name:e.names.referralCode,children:"Affiliate Code"}),l.jsx(La,{name:e.names.referralCode,render:l.jsx(Mn,{placeholder:"Enter code here (e.g Join)"})}),l.jsx(oo,{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(kv,{})}),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(z2,{render:l.jsx(Se,{type:"Secondary",className:"mr-3",children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),l.jsx(Da,{render:l.jsx(Se,{children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Create"})})})]})]})})]})},JP=XP,QP=()=>{const[e]=he(Sl.dataAtom),[t]=he(c=>c.spy(Sl.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(_a,{})})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mb-6",children:l.jsx(JP,{})}),l.jsx(YP,{})]})]})})},eN=QP,tN=({Icon:e,title:t,value:r,image:n,imageName:o,children:a,className:s})=>{const[c,u]=y.useState(!0),[d,f]=y.useState(!1),h=()=>{u(!1)},p=()=>{u(!1),f(!0)};return l.jsxs("div",{className:`relative flex w-full flex-col justify-between rounded-custom border-custom 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(Mv,{})}),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:"iconAction",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]})]})},on=tN,rN="Billgang",nN="D4RK",Yh=({children:e})=>l.jsx("div",{className:"gap-2 w-full lg:gap-4 grid grid-cols-1 col-span-2 lg:col-span-1",children:e}),oN=()=>{const[e]=he(Ms.dataAtom),[t]=he(r=>r.spy(Ms.pendingAtom));return he(Vo.dataAtom),t?l.jsx(tr,{}):e?l.jsxs("div",{className:"flex w-full gap-4 lg:pb-6",children:[l.jsx(eN,{}),l.jsxs(Yh,{children:[l.jsx(on,{Icon:Pv,title:"Customer since",value:ax(e.createdAt)}),l.jsx(on,{Icon:Op,title:"Total spent",value:kt({amount:e.totalSpent})}),l.jsx(on,{Icon:Dp,title:"Top",value:`#${e.ratingPlacement}`,children:l.jsxs("div",{className:"text-xs text-textSecondary flex items-center mt-2",children:[l.jsx(An,{Icon:Bp,className:"mx-1"}),"Spend $",e.spendMoreUsdForNextPlace," more to be #",e.ratingPlacement+1]})}),l.jsx(on,{Icon:Sd,title:"Average review",value:e.averageReview})]}),e.topSpenderProduct&&l.jsx(on,{className:"col-span-2 lg:col-span-1",image:Fr(e.topSpenderProduct.image.cfId),imageName:e.topSpenderProduct.name,Icon:wv,title:"Top spent",value:`${kt({amount:e.topSpenderProduct.amountSpentUsd||0})} spent`}),l.jsxs(Yh,{children:[l.jsx(on,{Icon:Mp,title:"Purchases",value:e.totalPurchases}),l.jsx(on,{Icon:Rv,title:"Visits",value:e.visits}),l.jsx(on,{Icon:Ev,title:"Powered by",value:rN}),l.jsx(on,{Icon:yv,title:"Store",value:nN})]}),e.favoriteProduct&&l.jsx(on,{image:Fr(e.favoriteProduct.image.cfId),imageName:e.favoriteProduct.name,Icon:jv,title:"Favorite product",value:`bought ${e.favoriteProduct.purchasedTimes} times`})]}):null},b1=Ke(1),Gm=(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))(Gm||{}),aN=P.object({id:P.string(),status:P.nativeEnum(Gm),price:qs,gatewayName:P.string(),time:P.string(),review:P.object({rating:P.number()}).optional()}),sN=P.object({list:P.array(aN),totalCount:P.number()}),Uo=Ut(async e=>kr(await Ex({PageNumber:e.get(b1)}),sN)).pipe(xr(null));b1.onChange(e=>{Uo(e)});Qr(Uo.dataAtom,Uo);var iN=()=>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"})}),lN=()=>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"})}),cN=()=>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"})]}),uN={1:iN,2:lN,3:cN},dN={1:"bg-successBackground text-successText",2:"bg-warningBackground text-warningText",3:"bg-signalDangerBackground text-signalDanger"},fN=({status:e,variant:t})=>{const r=uN[t];return l.jsxs("div",{className:mr("flex items-center justify-start rounded-full p-[4px_8px]",dN[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}),Ir=({children:e,className:t})=>l.jsx(_r,{className:`text-sm text-textSecondary uppercase ${t}`,children:e}),hN=({children:e,className:t})=>l.jsx("div",{className:vo("overflow-x-auto grid grid-cols-[minmax(120px,auto)_repeat(5,minmax(min-content,auto))]",t),children:e}),qm=hN,pN={NEW:2,PENDING:2,COMPLETED:1,CANCELLED:3,EXPIRED:3,FULL_DELIVERY_FAILURE:3,PARTIALLY_DELIVERED:2,REFUNDED:1,FAILED:3},mN=(e,t)=>{const r=t.find(n=>n.name===e);return r?l.jsxs(l.Fragment,{children:[l.jsx("img",{alt:r.displayName,src:Fr(r.logoCfImageId),className:"h-6 mr-1"}),l.jsx("div",{children:r.displayName})]}):null},gN=({item:e,gatewaysDetail:t})=>{const[r,n]=ul(e.time);return l.jsxs(y.Fragment,{children:[l.jsx(_r,{children:e.id}),l.jsx(_r,{children:l.jsx(fN,{status:e.status,variant:pN[e.status]})}),l.jsx(_r,{children:kt(e.price)}),l.jsx(_r,{children:mN(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:Sd}),l.jsx("div",{className:"ml-1",children:e.review.rating})]}):"None"})]},e.id)},vN=()=>{var c;const[e]=he(Uo.dataAtom),[t,r]=he(b1),[n]=he(u=>u.spy(Uo.pendingAtom)>0),[o]=he(Yr.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(qm,{children:[l.jsx(Ir,{children:"Invoice ID"}),l.jsx(Ir,{children:"Status"}),l.jsx(Ir,{children:"Value"}),l.jsx(Ir,{children:"Payment"}),l.jsx(Ir,{children:"Date"}),l.jsx(Ir,{children:"Review"}),s&&e.list.map(u=>l.jsx(gN,{item:u,gatewaysDetail:o},u.id))]}),s&&l.jsx(x1,{currentPage:t,totalCount:e.totalCount,onPageChange:r}),n?l.jsx(tr,{}):a?l.jsx(si,{title:"Orders are empty",description:"Order history will be collected here"}):null]})},xN=vN,yN=()=>{var o;const[e]=he(a=>a.spy(Uo.pendingAtom)>0),[t]=he(Uo.dataAtom),[r]=he(Yr.dataAtom),n=!((o=t==null?void 0:t.list)!=null&&o.length)||!r;return l.jsx(l.Fragment,{children:e?l.jsx(tr,{}):n?l.jsx(si,{title:"No Orders",description:"When you purchase products from our website, you'll see a history of orders here."}):l.jsxs(l.Fragment,{children:[l.jsx(nc,{title:"Orders"}),l.jsx(xN,{})]})})},bN=P.object({id:P.number(),variantId:P.number(),productName:P.string(),variantName:P.string(),quantity:P.number()}),Ti=P.object({balance:qs}),Pi=P.object({productsWithVariants:P.array(bN)}),CN=P.union([P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:Ti,ruleType:P.literal("SPEND_AMOUNT"),ruleOptions:P.object({forEach:P.number()})}),P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:Ti,ruleType:P.literal("ORDER_COUNT"),ruleOptions:P.object({ordersCount:P.number()})}),P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:Ti,ruleType:P.literal("REFER_FRIEND"),ruleOptions:P.object({minReferrals:P.number(),minCompletedOrders:P.number()})}),P.object({id:P.number(),rewardType:P.literal("BALANCE"),rewardOptions:Ti,ruleType:P.literal("LEAVE_REVIEW"),ruleOptions:P.object({minReviews:P.number(),minStars:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Pi,ruleType:P.literal("SPEND_AMOUNT"),ruleOptions:P.object({forEach:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Pi,ruleType:P.literal("ORDER_COUNT"),ruleOptions:P.object({ordersCount:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Pi,ruleType:P.literal("REFER_FRIEND"),ruleOptions:P.object({minReferrals:P.number(),minCompletedOrders:P.number()})}),P.object({id:P.number(),rewardType:P.literal("PRODUCT"),rewardOptions:Pi,ruleType:P.literal("LEAVE_REVIEW"),ruleOptions:P.object({minReviews:P.number(),minStars:P.number()})})]),wN=P.object({id:P.number(),progress:P.number(),createdAt:P.string(),completedAt:P.string().optional(),rewardRule:CN}),SN=P.array(wN),El=Ut(async()=>kr(await mx(),SN)).pipe(xr(null));Qr(El.dataAtom,El);var EN=()=>{const[e]=he(El.dataAtom),[t]=he(o=>o.spy(El.pendingAtom)>0),r=!(e!=null&&e.length),n=!t&&!r;return l.jsx(l.Fragment,{children:t?l.jsx(tr,{}):r?l.jsx(si,{title:"Rewards Unavailable",description:"Check back in the future to join our reward program."}):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(jN,{achievement:o},o.id))})]})})},jN=({achievement:e})=>{const[t,r]=RN(e),[n,o,a]=kN(e),s=o===a;return l.jsxs("div",{className:"flex flex-col border border-borderDefault rounded-2xl p-6 items-center",children:[l.jsx(_N,{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(_v,{})," ",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:Mp}),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,{type:s?"Primary":"Secondary",className:"w-full mt-auto",children:s?l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Claim"}):TN(e)})]})},_N=({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,"%"]})]})},Ni=e=>{switch(e.rewardRule.rewardType){case"BALANCE":return`${kt(e.rewardRule.rewardOptions.balance)} on the balance`;case"PRODUCT":return`products: ${e.rewardRule.rewardOptions.productsWithVariants.map(t=>`${t.quantity} ${t.productName} (${t.variantName})`).join()}`}},TN=e=>{switch(e.rewardRule.rewardType){case"BALANCE":return kt(e.rewardRule.rewardOptions.balance);case"PRODUCT":return`${e.rewardRule.rewardOptions.productsWithVariants.map(t=>`${t.quantity} ${t.productName} (${t.variantName})`).join()}`}},PN=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 ${Ni(e)}. You've spent $${e.progress} so far.`;case"ORDER_COUNT":return`Place ${e.rewardRule.ruleOptions.ordersCount} orders to receive a reward of ${Ni(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 ${Ni(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 ${Ni(e)}. You've left ${e.progress} reviews so far.`}},NN=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}`}},RN=e=>[NN(e),PN(e)],kN=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]},Ym=(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))(Ym||{}),C1=Ke(1),Km=P.object({id:P.string(),productName:P.string(),status:P.nativeEnum(Ym),price:qs,gatewayName:P.string(),createdAt:P.string(),accessToken:P.string(),recurringInterval:P.string(),currentChargeAttempt:P.number(),nextChargeAttemptAt:P.string().optional(),activeTo:P.string().optional()}),AN=P.object({list:P.array(Km),totalCount:P.number()}),Wo=Ut(async e=>kr(await jx({PageNumber:e.get(C1)}),AN)).pipe(xr(null));C1.onChange(e=>{Wo(e)});Qr(Wo.dataAtom,Wo);var LN={ACTIVE:{icon:l.jsx(Ed,{}),title:"Active",className:"text-successText bg-successBackground"},AWAITING_PAYMENT:{icon:l.jsx(Vi,{}),title:"Awaiting Payment",className:"bg-warningBackground text-warningText"},CANCELLED:{icon:l.jsx(En,{}),title:"Cancelled",className:"text-signalDanger bg-signalDangerBackground"},CHANGED_GATEWAY:{icon:l.jsx(Cu,{}),title:"Upgraded",className:"text-signalDanger bg-signalDangerBackground"},EXPIRED:{icon:l.jsx(En,{}),title:"Expired",className:"text-signalDanger bg-signalDangerBackground"},RIAL:{icon:l.jsx(Vi,{}),title:"Active",className:"text-textSecondary bg-surface0"},PAST_DUE:{icon:l.jsx(Vi,{}),title:"Trial",className:"text-signalDanger bg-signalDangerBackground"},REPLACED:{icon:l.jsx(Cu,{}),title:"Replaced",className:"text-textSecondary bg-surface0"}},DN=({status:e})=>{const t=LN[e];return l.jsxs("div",{className:vo("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})]})},Xm=DN,ON=(e,t)=>{const r=t.find(n=>n.name===e);return r?l.jsxs(l.Fragment,{children:[l.jsx("img",{alt:r.displayName,src:Fr(r.logoCfImageId),className:"h-6 mr-1"}),l.jsx("div",{children:r.displayName})]}):null},MN=({item:e,gatewaysDetail:t})=>{const[r,n]=ul(e.createdAt),[o]=ul(e.activeTo||"");return l.jsxs(y.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-custom",children:l.jsx(Ul,{})}),l.jsxs("div",{children:[l.jsx(j0,{to:`${le.get(to).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(Xm,{status:e.status})}),l.jsx(_r,{children:kt(e.price)}),l.jsx(_r,{children:ON(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)},IN=()=>{var u;const[e]=he(Wo.dataAtom),[t,r]=he(C1),[n]=he(d=>d.spy(Wo.pendingAtom)>0),[o]=he(Yr.dataAtom),a=en(Yr),s=!(e!=null&&e.list.length)||!o,c=!n&&!s;return y.useEffect(()=>{a([])},[]),l.jsxs("div",{className:"border border-borderDefault rounded-2xl flex justify-between flex-col flex-1",children:[l.jsxs(qm,{className:"overflow-x-auto grid grid-cols-[minmax(120px,auto)_minmax(0,20%)_repeat(4,minmax(min-content,auto))]",children:[l.jsx(Ir,{className:"w-full",children:"Product name"}),l.jsx(Ir,{children:"ID"}),l.jsx(Ir,{children:"Status"}),l.jsx(Ir,{children:"Value"}),l.jsx(Ir,{children:"Payment"}),l.jsx(Ir,{children:"Date"}),c&&((u=e==null?void 0:e.list)==null?void 0:u.map(d=>l.jsx(MN,{item:d,gatewaysDetail:o},d.id)))]}),c&&l.jsx(x1,{currentPage:t,totalCount:e==null?void 0:e.totalCount,onPageChange:r})]})},FN=IN,BN=()=>{const[e]=he(Wo.dataAtom),[t]=he(o=>o.spy(Wo.pendingAtom)>0),[r]=he(Yr.dataAtom),n=!(e!=null&&e.list.length)||!r;return l.jsx(l.Fragment,{children:t?l.jsx(tr,{}):n?l.jsx(si,{title:"Subscriptions History",description:"When you subscribe to a product on our website, you'll see a history of your subscriptions here."}):l.jsxs(l.Fragment,{children:[l.jsx(nc,{title:"Subscriptions"}),l.jsx(FN,{})]})})},HN=BN,Wu=Ke("Home"),VN={Home:oN,Orders:yN,Rewards:EN,Balance:VP,Subscriptions:HN},$N=()=>{const[e]=he(ho),[t]=he(Wu),r=VN[t];return e?l.jsxs("main",{className:"h-full w-full max-w-maxWidthStore m-auto flex flex-grow flex-col xl:flex-row",children:[l.jsx(EP,{}),l.jsx("div",{className:"xl:p-6 xl:pr-10 px-4 py-6 flex flex-col w-full flex-1",children:l.jsx(r,{})})]}):l.jsx(zm,{})},UN=()=>l.jsxs($m,{children:[l.jsx($N,{}),l.jsx(hj,{richColors:!0,closeButton:!0})]}),WN=UN,zN=({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:$u(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(_a,{})})]})]})]})},Jm=zN,Ri={PAID:"Paid",PENDING:"Pending",EXPIRED:"Expired",CANCELLED:"Cancelled",NOT_PAID:"Not Paid"},ZN={PAID:{displayName:Ri.PAID,displayMessage:"The invoice has been completed and the product has been delivered.",type:"success"},PENDING:{displayName:Ri.PENDING,displayMessage:"The invoice has been created and we are now waiting to receive the payment.",type:"warning"},EXPIRED:{displayName:Ri.EXPIRED,displayMessage:"Your payment has expired due to the payment not being sent in time.",type:"error"},CANCELLED:{displayName:Ri.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"}},GN=({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:$u(new Date(e),"dd.MM.yyyy")}),l.jsxs("p",{children:["11:12:10 PM ",$u(new Date(e),"hh:mm:ss aa")]})]}),l.jsx("p",{className:"mt-2",children:ZN[t].displayMessage})]}),qN=({timeline:e})=>{const[t,r]=y.useState(!1);return l.jsxs("div",{className:"relative",children:[l.jsxs("div",{className:`py-4 px-6 bg-surface100 rounded-custom 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(GN,{date:e[n],chargeStatus:n},n))})]}),l.jsxs("div",{className:"px-3 h-12 pr-4 flex justify-between items-center bg-surface100 rounded-custom cursor-pointer",onClick:()=>r(!t),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Qv,{}),l.jsx("p",{className:"text-sm",children:"Track Payment"})]}),l.jsx(ex,{})]})]})},Qm=qN,YN=({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=y.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,{type:"Secondary",className:"gap-1",onClick:()=>{var a;return t(((a=e==null?void 0:e.order)==null?void 0:a.id)||"")},children:[l.jsx(_a,{}),l.jsx("span",{className:"text-[var(--text-secondary)]",children:"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(p1,{product:a},a.id))}),l.jsx(rc,{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(Qm,{timeline:e.timeline})}),l.jsx(kn,{className:"hidden md:flex"})]})]})]})})},KN=YN,XN=({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(Mn,{value:e.text,disabled:!0}),e.shownCopyButton&&l.jsx(Se,{className:"h-12 w-12",type:"Secondary",onClick:()=>t(e.text),children:l.jsx(_a,{})})]})})},JN=({props:e})=>l.jsx(Se,{className:"w-full",onClick:()=>window.open(e.url,"_blank","noopener"),children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:e.text})}),QN=({props:e})=>l.jsx("div",{className:"w-full flex justify-center py-4 bg-surface0 rounded-custom",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:""})})}),eR=({props:e})=>l.jsxs("div",{className:"p-3 rounded-custom 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(Hp,{})}),l.jsx("p",{children:e.heading})]}),l.jsx("p",{className:"text-textSecondary mt-2",children:e.content})]}),tR=({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(e5,{block:r},n))]})},e5=({block:e})=>{switch(e.type){case"Section":return l.jsx(tR,{...e});case"ReadOnlyTextInput":return l.jsx(XN,{...e});case"Notify":return l.jsx(eR,{...e});case"Button":return l.jsx(JN,{...e});case"Image":return l.jsx(QN,{...e});default:return null}},rR=e5,nR=({isActive:e,setIsActive:t,price:r})=>{const[n,o]=y.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1});return l.jsx(On,{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(cs,{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(cs,{checked:n.agreeToSend,onCheckedChange:a=>o({...n,agreeToSend:a})}),l.jsxs("p",{children:["I agree to send the payment of ",kt(r)," ",r.currency]})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(cs,{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 ",kt(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,{type:"Secondary",className:"w-full",children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{type:"Primary",className:"w-full",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:()=>t(!1),children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Continue to Payment"})})})]})]})})},oR=nR,aR=P.object({link:P.coerce.string().url().min(1,{message:"The link field cannot be empty."})}),sR=({isActive:e,setIsActive:t,chargeId:r})=>{const n=qo({defaultValues:{link:""}});return n.useValidate(o=>Jo(o,aR,n)),n.onSubmit(async o=>{await Cx({url:o.values.link},r)&&po(le,s=>[...s,{isActive:!0,title:"Success",message:"CashApp successfully verified",id:new Date().getTime(),status:!0}])}),l.jsx(On,{title:"CashApp Verify",setIsActive:t,isActive:e,children:l.jsx(Ko,{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(La,{className:"mt-1",name:n.names.link,render:l.jsx(Mn,{placeholder:"https://cash.app/payments/0000"})}),l.jsx(oo,{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,{type:"Secondary",className:"w-full",children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{type:"Primary",className:"w-full",children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Verify"})})})]})]})})})},iR=sR,lR={PAID:"Paid",PENDING:"Pending",EXPIRED:"Expired",CANCELLED:"Cancelled",NOT_PAID:"Not Paid"},cR={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."},uR={PAID:l.jsx("div",{className:"p-3 rounded-custom bg-surface0 text-successText",children:l.jsx(Gs,{})}),PENDING:l.jsx("div",{className:"p-3 rounded-custom bg-surface0",children:l.jsx(wu,{})}),EXPIRED:l.jsx("div",{className:"p-3 rounded-custom bg-surface0",children:l.jsx(En,{})}),CANCELLED:l.jsx("div",{className:"p-3 rounded-custom bg-surface0",children:l.jsx(En,{})}),NOT_PAID:l.jsx("div",{className:"p-3 rounded-custom bg-surface0",children:l.jsx(En,{})})},dR=({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:[uR[t],l.jsx("h2",{className:"font-bold",children:lR[t]}),l.jsx("p",{className:"text-sm text-textSecondary",children:cR[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(to).Order}/${(n=e.order)==null?void 0:n.id}`)},children:[l.jsx(cl,{}),l.jsx("span",{className:"text-[var(--text-inverted)]",children:"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,{type:"Secondary",className:"w-full gap-1",onClick:()=>{var n;return window.open(`https://${(n=le.get(Pa))==null?void 0:n.info.domain}`)},children:[l.jsx(cl,{}),l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Visit Website"})]})}),l.jsx("div",{className:"w-full",children:l.jsxs(Se,{type:"Secondary",className:"w-full gap-1",children:[l.jsx(Wp,{}),l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Contact Support"})]})})]})]})},fR=dR,hR=()=>{const{id:e}=$s(),[t,r]=T0(),[n,o]=y.useState(!1),[a,s]=y.useState(),[c,u]=y.useState(!0),d=Hr(),f=y.useRef();return y.useEffect(()=>{const h=async(v,m=!1)=>{m||o(!0);const g=await Mx(v);o(!1),s(g)},p=setInterval(()=>{e&&h(e,!0)},5e3);return e&&h(e),()=>{clearInterval(p)}},[]),y.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,{}):l.jsxs("div",{className:"min-h-svh bg-surface0 md:flex",children:[l.jsx(KN,{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(fR,{charge:a}),a&&l.jsx("div",{className:`w-full ${a.status!=="NOT_PAID"&&"mt-5"}`,children:l.jsx(Jm,{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(rR,{block:h}))}),l.jsx(kn,{className:"mt-10 flex md:hidden"})]})}),(a==null?void 0:a.gateway)==="PayPalFF"&&l.jsx(oR,{price:a.price,isActive:c,setIsActive:u}),(a==null?void 0:a.gateway)==="Сashapp"&&l.jsx(iR,{isActive:c,setIsActive:u,chargeId:a.id})]})},pR=hR,mR=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"})}),gR=({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(Ip,{}),l.jsx("div",{className:"ml-2",children:e>0||Number.isNaN(e)?`Enter another ${kt({amount:e,currency:r})} and receive an additional bonus of
|
|
144
149
|
${t}%`:`You will receive an additional bonus of
|
|
145
|
-
${t}%`})]}),xR=()=>{const[e]=he(Yr.dataAtom),[t]=he(Yr.pendingAtom),r=qo({defaultValues:{amount:"",gateway:""}}),[n,o]=T0(),a=Hr(),s=en(wl);he(wl.pendingAtom);const[c]=he(Vo.dataAtom),[u]=he(Vo.pendingAtom),[d,f]=y.useState(),h=y.useRef();r.useSubmit(async()=>{const w=await s({price:{amount:v,currency:m},gateway:p,customerEmail:le.get(Ds)}),S=le.get(to).Charge;a(`${S}/${w.data.chargeId}${h.current&&`?redirectRoute=${h.current}`}`)});const p=r.useValue(r.names.gateway),v=r.useValue(r.names.amount);if(r.useValidate(w=>Jo(w,gR,r)),y.useEffect(()=>{const w=n.get("redirectRoute");w&&h&&(h.current=w,n.delete("redirectRoute"),o(n))},[n]),!c||!(c!=null&&c.isEnabled))return null;const{topUpSettings:{currency:m,topUpBonusEnabled:g,bonusPercent:x,minimumTopUpForBonus:b}}=c,C=Number(v),_=g&&!Number.isNaN(C)?b-Number(C):b;return t||u?l.jsx(tr,{}):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(Ko,{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(La,{className:"mt-1",name:r.names.amount,render:l.jsx(Mn,{placeholder:"0",icon:l.jsx(Vp,{}),type:"number"})}),l.jsx(oo,{className:"text-signalDanger",name:r.names.amount})]}),g&&_!==void 0&&l.jsx(vR,{enterAnother:_,bonusPercent:x,currency:m}),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(w=>w.paymentMethods.map(S=>l.jsx(g1,{align:"column",paymentMethod:S,gatewayLogoCfId:w.logoCfImageId,gatewayDisplayName:w.displayName,gateway:w.name,poweredByLogoCfId:w.poweredByImageCfImageId,selected:p===w.name&&S===d,onSelect:()=>{r.setValue(r.names.gateway,w.name),f(S)}})))}),l.jsx(oo,{className:"text-signalDanger mb-4",name:r.names.gateway}),l.jsxs("div",{className:"mt-10",children:[l.jsx(Da,{render:l.jsx(Se,{className:"w-full",children:"Continue to Checkout"})}),l.jsx(Mm,{}),l.jsx(Im,{})]})]})}),l.jsx("div",{className:"p-4 pt-0",children:l.jsx(kn,{className:"md:hidden"})})]})})},yR=xR,bR={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"},CR={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."},wR={COMPLETED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(Gs,{})}),PENDING:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(wu,{})}),NEW:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(wu,{})}),EXPIRED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(En,{})}),CANCELLED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(En,{})}),FAILED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(En,{})}),FULL_DELIVERY_FAILURE:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(Cu,{})}),PARTIALLY_DELIVERED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(Of,{})}),REFUNDED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(Of,{})})},SR=({orderStatus:e})=>l.jsxs("div",{className:"flex flex-col items-center justify-center text-center gap-2",children:[wR[e],l.jsx("h2",{className:"font-bold",children:bR[e]}),l.jsx("p",{className:"text-sm text-textSecondary",children:CR[e]}),l.jsxs("div",{className:"w-full flex gap-2 mt-3",children:[l.jsx("div",{className:"w-full",children:l.jsxs(Se,{type:"Secondary",className:"w-full gap-1",onClick:()=>{var t;return window.open(`https://${(t=le.get(Pa))==null?void 0:t.info.domain}`)},children:[l.jsx(cl,{}),"Visit Website"]})}),l.jsx("div",{className:"w-full",children:l.jsxs(Se,{type:"Secondary",className:"w-full gap-1",children:[l.jsx(Wp,{}),"Contact Support"]})})]})]}),ER=SR,jR=({setRating:e,rating:t,disabled:r})=>{const[n,o]=y.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(Sv,{},c)}):l.jsx("div",{id:c.toString(),className:"w-5 text-textSecondary",onMouseEnter:a,onClick:()=>s(c),children:l.jsx(Sd,{})},c))})},_R=jR,TR=({isActive:e,setIsActive:t,onSubmit:r,isLoading:n})=>{const[o,a]=y.useState("");return l.jsx(On,{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(m1,{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,{type:"Secondary",className:"w-full",onClick:()=>t(!1),children:"Cancel"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{type:"Primary",className:"w-full",disabled:!o,onClick:()=>r(o),children:"Submit"})})]})]})})},PR=TR,NR=({review:e,orderId:t})=>{const[r,n]=y.useState((e==null?void 0:e.rating)||0),[o,a]=y.useState(!1),[,s]=he(po),[c,u]=y.useState(!1),d=async f=>{e&&"accessToken"in e&&(u(!0),await Nx({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 y.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-custom bg-surface100 font-bold",children:["You left a ",e.rating," star rating"]}):l.jsxs("div",{className:"p-4 flex justify-between rounded-custom bg-surface100",children:[l.jsx("p",{className:"text-base font-bold",children:"Leave a review"}),l.jsx(_R,{rating:r,setRating:n,disabled:!!e.rating||!("accessToken"in e)}),l.jsx(PR,{isActive:o,setIsActive:a,onSubmit:d,isLoading:c})]}):null},RR=NR,kR=()=>{var h,p,v;const{id:e,accessToken:t}=$s(),r=Hr(),[n,o]=y.useState(),[a,s]=y.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=y.useMemo(()=>(n==null?void 0:n.partOrders.map(m=>{var g,x,b,C;return{id:(m==null?void 0:m.id)||0,image:m.productWithVariant.image,name:((g=m.productWithVariant)==null?void 0:g.name)||"",description:((x=m.productWithVariant)==null?void 0:x.description)||"",price:{quantity:m.quantity,amount:((b=m.productWithVariant)==null?void 0:b.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 y.useEffect(()=>{const m=async(x,b=!1)=>{b||s(!0);const C=await(t?Ox(`${x}/${t}`):Dx(x));s(!1),C.charge.status==="NOT_PAID"&&r(`${le.get(to).Charge}/${C.charge.id}`),o(C)};e&&m(e);const g=setInterval(()=>{e&&m(e,!0)},5e3);return()=>{clearInterval(g)}},[]),a?l.jsx(tr,{}):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(ER,{orderStatus:n.status}),l.jsx("div",{className:"mt-4",children:l.jsx(Jm,{lastUpdate:n.createdAt,paymentType:n.charge.gateway,email:n.charge.customerForCharge.email,invoiceId:n.id})}),l.jsx("div",{className:"mt-6",children:l.jsx(RR,{orderId:n.id,review:n.review})})]}),l.jsxs("div",{children:[n.charge&&l.jsx("div",{className:"mt-6",children:l.jsx(Qm,{timeline:n.charge.timeline})}),l.jsx(kn,{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,{type:"Secondary",className:"gap-1 text-textSecondary",onClick:()=>c((n==null?void 0:n.id)||""),children:[l.jsx(_a,{}),"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(p1,{product:m,isOrder:!0},m.id))}),l.jsx(rc,{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(kn,{className:"flex md:hidden"})]})]})})]})},AR=kR,LR=({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-custom overflow-hidden",children:e!=null&&e.image?l.jsx("img",{className:"w-full h-full object-contain",src:Fr(e.image.cfId),alt:e==null?void 0:e.name}):l.jsx(Ul,{})}),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:[kt(e.price)," / ",e.recurringInterval]})]}),l.jsx("div",{className:"min-w-fit",children:l.jsx(Xm,{status:e.status})})]}),e.description&&l.jsx("p",{className:"mt-4 text-textSecondary",children:e.description})]}),DR=LR,OR=({onCheckedChange:e,checked:t,...r})=>{var o,a;const n=y.useRef(null);return l.jsxs("label",{className:vo("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%]"})]})},ns=OR,MR=P.object({reason:P.string().min(1,{message:"The reason field cannot be empty."}),otherReason:P.string().optional()}),IR={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},FR=({isActive:e,setIsActive:t,id:r,accessToken:n})=>{const o=qo({defaultValues:{reason:"",otherReason:""}}),[a,s]=y.useState(0),[c,u]=y.useState(!1);o.useValidate(f=>Jo(f,MR,o));const d=o.useValue("reason");return o.useSubmit(async f=>{u(!0);const h=await Ax(r,n,{reason:f.values.reason==="Other reason"?f.values.otherReason:f.values.reason});u(!1),h&&(po(le,p=>[...p,{isActive:!0,title:"Success",message:"Subscription successfully canceled",id:new Date().getTime(),status:!0}]),s(2))}),y.useEffect(()=>{e||s(0)},[e]),l.jsx(On,{title:IR[a]||"",setIsActive:t,isActive:e,children:l.jsxs(Ko,{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(wb,{className:"flex flex-col gap-3 mt-4",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Xa,{value:"Found another company",name:o.names.reason,render:l.jsx(ns,{})}),l.jsx("p",{children:"Found another company"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Xa,{value:"Expensive",name:o.names.reason,render:l.jsx(ns,{})}),l.jsx("p",{children:"Expensive"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Xa,{value:"Technical problems",name:o.names.reason,render:l.jsx(ns,{})}),l.jsx("p",{children:"Technical problems"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Xa,{value:"Support problems",name:o.names.reason,render:l.jsx(ns,{})}),l.jsx("p",{children:"Support problems"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Xa,{value:"Other reason",name:o.names.reason,render:l.jsx(ns,{})}),l.jsx("p",{children:"Other reason"})]}),d==="Other reason"&&l.jsx(La,{name:o.names.otherReason,placeholder:"Describe the reason...",render:l.jsx(m1,{maxLength:150})})]}),l.jsx(oo,{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,{type:"Secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:"Stay with us"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{type:"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,{type:"Secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:"Stay with us"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Da,{render:l.jsx(Se,{type:"Primary",className:"w-full",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-custom bg-surface0",children:l.jsx(Gs,{})}),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,{type:"Secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:"Close"})})})]})]})})},BR=FR,HR=({subscription:e,id:t,accessToken:r})=>{const[n,o]=y.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-custom overflow-hidden",children:e!=null&&e.image?l.jsx("img",{className:"w-full h-full object-contain",src:Fr(e.image.cfId),alt:e==null?void 0:e.name}):l.jsx(Ul,{})}),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:[kt(e.price)," / ",e.recurringInterval]})]}),l.jsx(Se,{variant:"link",onClick:()=>o(!0),children:"Cancel"}),l.jsx(BR,{accessToken:r,id:t,isActive:n,setIsActive:o})]})},VR=HR,$R=P.object({isFixed:P.boolean(),discount:P.number(),name:P.string(),initialCouponDurationForSubscriptions:P.number().optional(),currentCouponDurationForSubscriptions:P.number().optional()}),UR=Km.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:$R.optional(),variantId:P.number(),pricingPlanExists:P.boolean()}),t5=P.object({amount:P.number(),currency:P.string()}),WR=P.object({price:t5,recurringIntervalDays:P.number()}),zR=P.object({name:P.string(),required:P.boolean(),placeholder:P.string(),defaultValue:P.string(),regex:P.string(),type:P.string()}),ZR=P.object({id:P.number(),name:P.string(),description:P.string().optional(),shortDescription:P.string().optional(),price:t5,chargeTypes:P.array(P.string()),subscriptionSettings:WR,quantity:P.object({restrictions:P.any()}),deliveryTime:P.number(),gateways:P.array(P.object({name:P.string()})),customFields:P.array(zR),warranty:P.object({text:P.string(),durationMilliseconds:P.number()}).optional(),discordSettings:P.object({isEnabled:P.boolean(),isRequired:P.boolean()})}),GR=P.object({id:P.string(),name:P.string(),productVariants:P.array(P.object({data:ZR,position:P.number(),isHighlighted:P.boolean()})),position:P.number()}),qR=P.object({id:P.string(),name:P.string(),description:P.string(),types:P.array(GR)}),YR=P.object({data:qR}),qn=Ut(async(e,{id:t,accessToken:r})=>kr(await Rx(t,r),UR)).pipe(xr(null)),Wc=Ut(async(e,{id:t,accessToken:r})=>kr(await kx(t,r),YR)).pipe(xr(null)),KR=({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]"})})]}),r5=KR,XR=({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-custom bg-successBackground text-successText",children:l.jsx(Ed,{})}),l.jsxs("div",{className:"w-full",children:[l.jsxs("p",{className:"font-bold",children:[e.name,","," ",e.isFixed?kt({amount:e.discount,currency:t}):e.discount+"%"," ","discount"]}),l.jsx("div",{className:"mt-2 w-full",children:l.jsx(r5,{color:"#C2C2C2",percent:e.initialCouponDurationForSubscriptions?nx(e.initialCouponDurationForSubscriptions,e.currentCouponDurationForSubscriptions||1):100,disablePercentLabel:!0})}),l.jsx("p",{className:"mt-1 text-sm text-textSecondary",children:"Forever discount code"})]})]}),JR=XR,QR=e=>{const{totalSteps:t,step:r,onStepChange:n,label:o}=e,[a,s]=y.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)})})]})]})},ek=QR,tk=e=>{const{setIsLoading:t,dialogStore:r}=e,{id:n}=$s(),o=Hr(),[a]=he(qn.dataAtom),[,s]=he(po),{setPaymentMethod:c,setGateway:u,cart:d}=ni();function f(){r.hide()}async function h(){if(t(!0),n){const{data:p}=await Lx(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(Hm,{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,{type:"Secondary",className:"w-fit",onClick:f,children:"Cancel"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{type:d.gateway?"Primary":"Secondary",className:"w-fit",disabled:!d.gateway,onClick:h,children:"Continue"})})]})]})},rk=({setIsLoading:e})=>{const{cart:t}=ni(),r=Hr(),[n]=he(qn.dataAtom),[o]=he(Yr.dataAtom),a=en(Yr);y.useEffect(()=>{a([])},[]);const s=Oa({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(Bm,{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(g1,{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(tk,{setIsLoading:e,dialogStore:s})})]})},w1=rk,nk=({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,{})}),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})]}),n5=nk,ok=({dialogStore:e})=>{const{getTotalAndDiscount:t,cart:r,coupon:n}=ni(),[o]=he(qn.dataAtom),[a,s]=y.useState(1),[c,u]=y.useState(!1),d=y.useMemo(()=>t(),[n,r]),f=y.useMemo(()=>d.totalWithDiscount?d.total-d.totalWithDiscount:0,[d]);if(c)return l.jsx(n5,{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(ek,{step:a,totalSteps:12,onStepChange:s,label:"How long would you like to extend your subscription for?"}),l.jsx(w1,{setIsLoading:u}),l.jsx(rc,{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,{type:"Secondary",className:"w-full",onClick:()=>e.hide(),children:"Cancel"})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{type:"Primary",className:"w-full",onClick:v,children:"Extend"})})]})]})},ak=()=>{const[e]=he(qn.dataAtom),[t,r]=ul((e==null?void 0:e.activeTo)||""),n=Oa({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(ok,{dialogStore:n})})]})},sk=ak,ik=({isActive:e,setIsActive:t,selectedVariant:r})=>{if(!r)return null;const[n,o]=y.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(On,{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-custom bg-surface0 border border-borderDefault p-1",children:[l.jsx("div",{className:"w-full text-center cursor-pointer border-custom border-borderDefault 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(w1,{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,{type:"Secondary",className:"w-full",onClick:()=>t(!1),children:"Stay with us"})}),l.jsx("div",{className:"w-fit",children:l.jsxs(Se,{type:"Primary",className:"w-full",onClick:a,children:["Upgrade for $",u.toFixed(2)]})})]})]})})},lk=ik,ck=({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-custom",children:[l.jsx(Gs,{}),"Your current Plan"]}):l.jsx(Se,{type:"Secondary",className:"w-full mt-6 p-3",children:"Select"}),n&&l.jsxs("div",{className:"w-full mt-3",children:[l.jsx(r5,{percent:c/s*100,disablePercentLabel:!0}),l.jsxs("p",{className:"text-textSecondary text-sm mt-2",children:["Used: ",c," of ",s," days"]})]})]})},uk=({isActive:e,setIsActive:t})=>{const r=en(Wc),[n,o]=y.useState(null),[a,s]=y.useState(null),[c,u]=y.useState(!1),[d,f]=y.useState(null),[h]=he(qn.dataAtom),{id:p,accessToken:v}=$s();y.useEffect(()=>{p&&v&&r({id:p,accessToken:v})},[p,v,r]);const[m]=he(Wc.dataAtom),[g]=he(Wc.pendingAtom);y.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]),y.useEffect(()=>{m!=null&&m.data.types[0]&&o(m==null?void 0:m.data.types[0])},[m==null?void 0:m.data.types]);const x=C=>{o(C),s(null)},b=C=>{s(C),u(!0)};return l.jsxs(On,{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-custom 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:()=>x(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(ck,{variant:C.data,isSelected:(a==null?void 0:a.id)===C.data.id,isCurrent:(d==null?void 0:d.id)===C.data.id,onSelect:()=>b(C.data)},C.data.id))}),g&&l.jsx("p",{children:"Loading..."})]}),a&&l.jsx(lk,{isActive:c,setIsActive:u,selectedVariant:a})]})},dk=uk,fk=()=>{const{id:e,accessToken:t}=$s(),[r]=he(qn.dataAtom),[n]=he(qn.pendingAtom),o=en(qn),[a,s]=y.useState(!1),[c,u]=y.useState(!1);return y.useEffect(()=>{e&&t&&o({id:e,accessToken:t})},[]),n?l.jsx(tr,{}):c?l.jsx(n5,{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(dk,{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(DR,{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,{className:"w-full",onClick:()=>s(!0),children:"Change Plan"})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{type:"Secondary",className:"w-full",children:"Cancel Plan"})})]})]}),l.jsx(kn,{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(JR,{coupon:r.coupon,currency:r.price.currency||"USD"}),r&&l.jsx(VR,{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(w1,{setIsLoading:u}),l.jsx(sk,{}),l.jsx(kn,{className:"flex md:hidden"})]})]})})]})},hk=fk;const pk="_button_1gxoe_1",mk="_primary_1gxoe_14",gk="_secondary_1gxoe_22",vk="_tertiary_1gxoe_30",xk="_content_1gxoe_38",yk="_withoutHover_1gxoe_45",na={button:pk,primary:mk,secondary:gk,tertiary:vk,content:xk,withoutHover:yk},zu=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:Qt(na.button,o,{[na.primary]:c==="Primary",[na.secondary]:c==="Secondary",[na.tertiary]:c==="Tertiary",[na.withoutHover]:u}),onClick:r,style:{...n,fontSize:s==="m"?14:s==="s"?12:16},disabled:a,children:c==="Tertiary"?l.jsxs("div",{className:na.content,children:[t,l.jsx(dn,{name:"ArrowRight",fill:"#757575",width:20,height:20})]}):l.jsx(l.Fragment,{children:t})})},bk="_customCheckbox_w9x8g_1",Ck="_checkboxBox_w9x8g_7",wk="_checked_w9x8g_23",Sk="_icon_w9x8g_31",ki={customCheckbox:bk,checkboxBox:Ck,checked:wk,icon:Sk},Ek=e=>{const{value:t,onChange:r}=e,[n,o]=y.useState(t),a=()=>{o(!n),r(!n)};return y.useEffect(()=>{o(t)},[t]),l.jsxs("label",{className:ki.customCheckbox,onClick:s=>s.stopPropagation(),children:[l.jsx("input",{type:"checkbox",checked:n,onChange:a,style:{display:"none"}}),l.jsx("span",{className:Qt(ki.checkboxBox,{[ki.checked]:n})}),n&&l.jsx("div",{className:ki.icon,children:l.jsx(dn,{name:"Check",width:14,height:14,fill:"#ff3f19"})})]})},jk=e=>{const{label:t,onChange:r,activeImage:n}=e,{setOpenModal:o,setOnChange:a}=sd();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(dn,{name:"Plus",width:20,height:20,fill:"#757575"})}),l.jsx("span",{className:pt.text,children:n?"Change Image":"Select Image"})]})]})})},_k=()=>{const{setOpenModal:e,onChange:t}=sd(),{setIsOpen:r}=id(),[n,o]=y.useState(!1),a=()=>{var x;(x=s.current)==null||x.click()},s=y.useRef(null),[c,u]=y.useState([]),[d,f]=y.useState(!1),h=async x=>{var S;const b=((S=x.target.files)==null?void 0:S[0])||null;if(!b)return;const C=new FormData;C.append("file",b),f(!0);const{data:_}=await v8(C),w=[...c];w.unshift({..._.data,cfId:_.data.path}),u([...w]),f(!1)},p=x=>{x.preventDefault(),o(!1);const b=x.dataTransfer.files;if(b&&b.length>0){const _={target:{files:[b[0]]}};h(_)}},v=()=>{r(!1),setTimeout(()=>{e(!1),r(!0)},300)},m=x=>{const C=[...c].map(_=>_.id===x.id?{...x}:_);u([...C])};y.useEffect(()=>{(async()=>{const{data:b}=await g8(),C=b.data.map(_=>({..._,isSelected:!1}));u(C)})()},[]);function g(){const x=c.filter(b=>b.isSelected).map(b=>b.cfId);t==null||t(x)}return l.jsxs("div",{onClick:x=>x.stopPropagation(),className:pt.modal,children:[l.jsxs("div",{className:pt.top,children:[l.jsx("h4",{className:pt.title,children:"Select Image"}),l.jsx(dn,{name:"X",width:20,height:20,hoverable:!0,onClick:v})]}),l.jsxs("div",{className:pt.modalContent,children:[l.jsxs("div",{className:pt.top,children:[l.jsx("div",{}),l.jsxs("div",{children:["Selected: ",c.filter(x=>x.isSelected).length," images"]})]}),l.jsxs("div",{className:pt.images,children:[l.jsxs("div",{className:pt.input,onDragOver:x=>x.preventDefault(),onDragEnter:()=>o(!0),onDragLeave:()=>o(!1),onDrop:p,children:[l.jsxs("div",{onClick:a,className:Qt(pt.add,{[pt.dragging]:n}),children:[l.jsx("div",{className:pt.icon,children:l.jsx(dn,{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:s,style:{display:"none"},onChange:h,multiple:!1,accept:"image/*"})]}),d&&l.jsx(Kh,{}),c.map(x=>l.jsx(Tk,{image:x,updateImage:m},x.id)),c.length===0&&[...new Array(5)].map((x,b)=>l.jsx(Kh,{},b))]})]}),l.jsxs("div",{className:pt.bottom,children:[l.jsx(zu,{className:pt.cancel,onClick:v,type:"Secondary",children:"Cancel"}),l.jsx(zu,{onClick:()=>{e(!1),g()},children:"Select"})]})]})},Tk=e=>{const{image:t,updateImage:r}=e;return l.jsxs("div",{className:Qt(pt.image,{[pt.selected]:t.isSelected}),onClick:()=>{r({...t,isSelected:!t.isSelected})},children:[l.jsx("div",{className:pt.checkbox,children:l.jsx(Ek,{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)},Kh=()=>l.jsx("div",{className:pt.loading,children:l.jsx("div",{className:pt.spinner})}),Pk="_wrapper_187gl_1",Nk="_label_187gl_9",Rk="_input_187gl_17",kk="_required_187gl_47",Ak="_paddingless_187gl_54",Lk="_content_187gl_58",Dk="_borderless_187gl_66",Ok="_rightIcon_187gl_77",Mk="_inputPostfix_187gl_83",Cn={wrapper:Pk,label:Nk,input:Rk,required:kk,paddingless:Ak,content:Lk,borderless:Dk,rightIcon:Ok,inputPostfix:Mk},Ik=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:x}=e,[b,C]=y.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:Cn.wrapper,children:[n&&l.jsx("label",{className:Cn.label,htmlFor:n,children:n}),l.jsxs("div",{className:Cn.content,children:[l.jsx("input",{id:n,type:a||"text",onChange:S=>{if(a==="text")t(S.target.value);else{const A=_(S.target.value);t(A)}},value:o,autoComplete:"off",placeholder:u||"Type something...",className:Qt(Cn.input,{[Cn.required]:b&&f&&!w(o),[Cn.paddingless]:p,[Cn.borderless]:v}),min:a==="number"?s:void 0,max:a==="number"?c:void 0,disabled:d,onFocus:()=>{v||C(!0)},style:r}),x&&l.jsx("span",{className:Cn.inputPostfix,children:x}),g&&l.jsx("div",{className:Cn.rightIcon,children:l.jsx(dn,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:20,height:20})}),m&&l.jsx("div",{children:l.jsx(dn,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})};function Fk(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return y.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const ac=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Va(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function S1(e){return"nodeType"in e}function yr(e){var t,r;return e?Va(e)?e:S1(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function E1(e){const{Document:t}=yr(e);return e instanceof t}function ii(e){return Va(e)?!1:e instanceof yr(e).HTMLElement}function o5(e){return e instanceof yr(e).SVGElement}function $a(e){return e?Va(e)?e.document:S1(e)?E1(e)?e:ii(e)||o5(e)?e.ownerDocument:document:document:document}const gn=ac?y.useLayoutEffect:y.useEffect;function j1(e){const t=y.useRef(e);return gn(()=>{t.current=e}),y.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 Bk(){const e=y.useRef(null),t=y.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=y.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Is(e,t){t===void 0&&(t=[e]);const r=y.useRef(e);return gn(()=>{r.current!==e&&(r.current=e)},t),r}function li(e,t){const r=y.useRef();return y.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function jl(e){const t=j1(e),r=y.useRef(null),n=y.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,n]}function Zu(e){const t=y.useRef();return y.useEffect(()=>{t.current=e},[e]),t.current}let zc={};function ci(e,t){return y.useMemo(()=>{if(t)return t;const r=zc[e]==null?0:zc[e]+1;return zc[e]=r,e+"-"+r},[e,t])}function a5(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 ha=a5(1),_l=a5(-1);function Hk(e){return"clientX"in e&&"clientY"in e}function _1(e){if(!e)return!1;const{KeyboardEvent:t}=yr(e.target);return t&&e instanceof t}function Vk(e){if(!e)return!1;const{TouchEvent:t}=yr(e.target);return t&&e instanceof t}function Gu(e){if(Vk(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 Hk(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}}}),Xh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function $k(e){return e.matches(Xh)?e:e.querySelector(Xh)}const Uk={display:"none"};function Wk(e){let{id:t,value:r}=e;return y.createElement("div",{id:t,style:Uk},r)}function zk(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 y.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Zk(){const[e,t]=y.useState("");return{announce:y.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const s5=y.createContext(null);function Gk(e){const t=y.useContext(s5);y.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function qk(){const[e]=y.useState(()=>new Set),t=y.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[y.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 Yk={draggable:`
|
|
150
|
+
${t}%`})]}),vR=()=>{const[e]=he(Yr.dataAtom),[t]=he(Yr.pendingAtom),r=qo({defaultValues:{amount:"",gateway:""}}),[n,o]=T0(),a=Hr(),s=en(wl);he(wl.pendingAtom);const[c]=he(Vo.dataAtom),[u]=he(Vo.pendingAtom),[d,f]=y.useState(),h=y.useRef();r.useSubmit(async()=>{const w=await s({price:{amount:v,currency:m},gateway:p,customerEmail:le.get(Ds)}),S=le.get(to).Charge;a(`${S}/${w.data.chargeId}${h.current&&`?redirectRoute=${h.current}`}`)});const p=r.useValue(r.names.gateway),v=r.useValue(r.names.amount);if(r.useValidate(w=>Jo(w,mR,r)),y.useEffect(()=>{const w=n.get("redirectRoute");w&&h&&(h.current=w,n.delete("redirectRoute"),o(n))},[n]),!c||!(c!=null&&c.isEnabled))return null;const{topUpSettings:{currency:m,topUpBonusEnabled:g,bonusPercent:x,minimumTopUpForBonus:b}}=c,C=Number(v),_=g&&!Number.isNaN(C)?b-Number(C):b;return t||u?l.jsx(tr,{}):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(Ko,{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(La,{className:"mt-1",name:r.names.amount,render:l.jsx(Mn,{placeholder:"0",icon:l.jsx(Vp,{}),type:"number"})}),l.jsx(oo,{className:"text-signalDanger",name:r.names.amount})]}),g&&_!==void 0&&l.jsx(gR,{enterAnother:_,bonusPercent:x,currency:m}),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(w=>w.paymentMethods.map(S=>l.jsx(g1,{align:"column",paymentMethod:S,gatewayLogoCfId:w.logoCfImageId,gatewayDisplayName:w.displayName,gateway:w.name,poweredByLogoCfId:w.poweredByImageCfImageId,selected:p===w.name&&S===d,onSelect:()=>{r.setValue(r.names.gateway,w.name),f(S)}})))}),l.jsx(oo,{className:"text-signalDanger mb-4",name:r.names.gateway}),l.jsxs("div",{className:"mt-10",children:[l.jsx(Da,{render:l.jsx(Se,{className:"w-full",children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Continue to Checkout"})})}),l.jsx(Mm,{}),l.jsx(Im,{})]})]})}),l.jsx("div",{className:"p-4 pt-0",children:l.jsx(kn,{className:"md:hidden"})})]})})},xR=vR,yR={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"},bR={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."},CR={COMPLETED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(Gs,{})}),PENDING:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(wu,{})}),NEW:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(wu,{})}),EXPIRED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(En,{})}),CANCELLED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(En,{})}),FAILED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(En,{})}),FULL_DELIVERY_FAILURE:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(Cu,{})}),PARTIALLY_DELIVERED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(Of,{})}),REFUNDED:l.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-custom bg-surface100",children:l.jsx(Of,{})})},wR=({orderStatus:e})=>l.jsxs("div",{className:"flex flex-col items-center justify-center text-center gap-2",children:[CR[e],l.jsx("h2",{className:"font-bold",children:yR[e]}),l.jsx("p",{className:"text-sm text-textSecondary",children:bR[e]}),l.jsxs("div",{className:"w-full flex gap-2 mt-3",children:[l.jsx("div",{className:"w-full",children:l.jsxs(Se,{type:"Secondary",className:"w-full gap-1",onClick:()=>{var t;return window.open(`https://${(t=le.get(Pa))==null?void 0:t.info.domain}`)},children:[l.jsx(cl,{}),l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Visit Website"})]})}),l.jsx("div",{className:"w-full",children:l.jsxs(Se,{type:"Secondary",className:"w-full gap-1",children:[l.jsx(Wp,{}),l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Contact Support"})]})})]})]}),SR=wR,ER=({setRating:e,rating:t,disabled:r})=>{const[n,o]=y.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(Sv,{},c)}):l.jsx("div",{id:c.toString(),className:"w-5 text-textSecondary",onMouseEnter:a,onClick:()=>s(c),children:l.jsx(Sd,{})},c))})},jR=ER,_R=({isActive:e,setIsActive:t,onSubmit:r,isLoading:n})=>{const[o,a]=y.useState("");return l.jsx(On,{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(m1,{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,{type:"Secondary",className:"w-full",onClick:()=>t(!1),children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{type:"Primary",className:"w-full",disabled:!o,onClick:()=>r(o),children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Submit"})})})]})]})})},TR=_R,PR=({review:e,orderId:t})=>{const[r,n]=y.useState((e==null?void 0:e.rating)||0),[o,a]=y.useState(!1),[,s]=he(po),[c,u]=y.useState(!1),d=async f=>{e&&"accessToken"in e&&(u(!0),await Nx({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 y.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-custom bg-surface100 font-bold",children:["You left a ",e.rating," star rating"]}):l.jsxs("div",{className:"p-4 flex justify-between rounded-custom bg-surface100",children:[l.jsx("p",{className:"text-base font-bold",children:"Leave a review"}),l.jsx(jR,{rating:r,setRating:n,disabled:!!e.rating||!("accessToken"in e)}),l.jsx(TR,{isActive:o,setIsActive:a,onSubmit:d,isLoading:c})]}):null},NR=PR,RR=()=>{var h,p,v;const{id:e,accessToken:t}=$s(),r=Hr(),[n,o]=y.useState(),[a,s]=y.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=y.useMemo(()=>(n==null?void 0:n.partOrders.map(m=>{var g,x,b,C;return{id:(m==null?void 0:m.id)||0,image:m.productWithVariant.image,name:((g=m.productWithVariant)==null?void 0:g.name)||"",description:((x=m.productWithVariant)==null?void 0:x.description)||"",price:{quantity:m.quantity,amount:((b=m.productWithVariant)==null?void 0:b.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 y.useEffect(()=>{const m=async(x,b=!1)=>{b||s(!0);const C=await(t?Ox(`${x}/${t}`):Dx(x));s(!1),C.charge.status==="NOT_PAID"&&r(`${le.get(to).Charge}/${C.charge.id}`),o(C)};e&&m(e);const g=setInterval(()=>{e&&m(e,!0)},5e3);return()=>{clearInterval(g)}},[]),a?l.jsx(tr,{}):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(SR,{orderStatus:n.status}),l.jsx("div",{className:"mt-4",children:l.jsx(Jm,{lastUpdate:n.createdAt,paymentType:n.charge.gateway,email:n.charge.customerForCharge.email,invoiceId:n.id})}),l.jsx("div",{className:"mt-6",children:l.jsx(NR,{orderId:n.id,review:n.review})})]}),l.jsxs("div",{children:[n.charge&&l.jsx("div",{className:"mt-6",children:l.jsx(Qm,{timeline:n.charge.timeline})}),l.jsx(kn,{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,{type:"Secondary",className:"gap-1 text-textSecondary",onClick:()=>c((n==null?void 0:n.id)||""),children:[l.jsx(_a,{}),l.jsx("span",{className:"text-[var(--text-secondary)]",children:"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(p1,{product:m,isOrder:!0},m.id))}),l.jsx(rc,{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(kn,{className:"flex md:hidden"})]})]})})]})},kR=RR,AR=({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-custom overflow-hidden",children:e!=null&&e.image?l.jsx("img",{className:"w-full h-full object-contain",src:Fr(e.image.cfId),alt:e==null?void 0:e.name}):l.jsx(Ul,{})}),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:[kt(e.price)," / ",e.recurringInterval]})]}),l.jsx("div",{className:"min-w-fit",children:l.jsx(Xm,{status:e.status})})]}),e.description&&l.jsx("p",{className:"mt-4 text-textSecondary",children:e.description})]}),LR=AR,DR=({onCheckedChange:e,checked:t,...r})=>{var o,a;const n=y.useRef(null);return l.jsxs("label",{className:vo("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%]"})]})},ns=DR,OR=P.object({reason:P.string().min(1,{message:"The reason field cannot be empty."}),otherReason:P.string().optional()}),MR={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},IR=({isActive:e,setIsActive:t,id:r,accessToken:n})=>{const o=qo({defaultValues:{reason:"",otherReason:""}}),[a,s]=y.useState(0),[c,u]=y.useState(!1);o.useValidate(f=>Jo(f,OR,o));const d=o.useValue("reason");return o.useSubmit(async f=>{u(!0);const h=await Ax(r,n,{reason:f.values.reason==="Other reason"?f.values.otherReason:f.values.reason});u(!1),h&&(po(le,p=>[...p,{isActive:!0,title:"Success",message:"Subscription successfully canceled",id:new Date().getTime(),status:!0}]),s(2))}),y.useEffect(()=>{e||s(0)},[e]),l.jsx(On,{title:MR[a]||"",setIsActive:t,isActive:e,children:l.jsxs(Ko,{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(wb,{className:"flex flex-col gap-3 mt-4",children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Xa,{value:"Found another company",name:o.names.reason,render:l.jsx(ns,{})}),l.jsx("p",{children:"Found another company"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Xa,{value:"Expensive",name:o.names.reason,render:l.jsx(ns,{})}),l.jsx("p",{children:"Expensive"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Xa,{value:"Technical problems",name:o.names.reason,render:l.jsx(ns,{})}),l.jsx("p",{children:"Technical problems"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Xa,{value:"Support problems",name:o.names.reason,render:l.jsx(ns,{})}),l.jsx("p",{children:"Support problems"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(Xa,{value:"Other reason",name:o.names.reason,render:l.jsx(ns,{})}),l.jsx("p",{children:"Other reason"})]}),d==="Other reason"&&l.jsx(La,{name:o.names.otherReason,placeholder:"Describe the reason...",render:l.jsx(m1,{maxLength:150})})]}),l.jsx(oo,{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,{type:"Secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Stay with us"})})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{type:"Primary",className:"w-full",onClick:f=>{f.preventDefault(),s(1)},children:l.jsx("span",{className:"text-[var(--text-inverted)]",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,{type:"Secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Stay with us"})})}),l.jsx("div",{className:"w-fit",children:l.jsx(Da,{render:l.jsx(Se,{type:"Primary",className:"w-full",children:l.jsx("span",{className:"text-[var(--text-inverted)]",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-custom bg-surface0",children:l.jsx(Gs,{})}),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,{type:"Secondary",className:"w-full",onClick:f=>{f.preventDefault(),t(!1)},children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Close"})})})})]})]})})},FR=IR,BR=({subscription:e,id:t,accessToken:r})=>{const[n,o]=y.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-custom overflow-hidden",children:e!=null&&e.image?l.jsx("img",{className:"w-full h-full object-contain",src:Fr(e.image.cfId),alt:e==null?void 0:e.name}):l.jsx(Ul,{})}),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:[kt(e.price)," / ",e.recurringInterval]})]}),l.jsx(Se,{type:"Secondary",onClick:()=>o(!0),children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})}),l.jsx(FR,{accessToken:r,id:t,isActive:n,setIsActive:o})]})},HR=BR,VR=P.object({isFixed:P.boolean(),discount:P.number(),name:P.string(),initialCouponDurationForSubscriptions:P.number().optional(),currentCouponDurationForSubscriptions:P.number().optional()}),$R=Km.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:VR.optional(),variantId:P.number(),pricingPlanExists:P.boolean()}),t5=P.object({amount:P.number(),currency:P.string()}),UR=P.object({price:t5,recurringIntervalDays:P.number()}),WR=P.object({name:P.string(),required:P.boolean(),placeholder:P.string(),defaultValue:P.string(),regex:P.string(),type:P.string()}),zR=P.object({id:P.number(),name:P.string(),description:P.string().optional(),shortDescription:P.string().optional(),price:t5,chargeTypes:P.array(P.string()),subscriptionSettings:UR,quantity:P.object({restrictions:P.any()}),deliveryTime:P.number(),gateways:P.array(P.object({name:P.string()})),customFields:P.array(WR),warranty:P.object({text:P.string(),durationMilliseconds:P.number()}).optional(),discordSettings:P.object({isEnabled:P.boolean(),isRequired:P.boolean()})}),ZR=P.object({id:P.string(),name:P.string(),productVariants:P.array(P.object({data:zR,position:P.number(),isHighlighted:P.boolean()})),position:P.number()}),GR=P.object({id:P.string(),name:P.string(),description:P.string(),types:P.array(ZR)}),qR=P.object({data:GR}),qn=Ut(async(e,{id:t,accessToken:r})=>kr(await Rx(t,r),$R)).pipe(xr(null)),Wc=Ut(async(e,{id:t,accessToken:r})=>kr(await kx(t,r),qR)).pipe(xr(null)),YR=({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]"})})]}),r5=YR,KR=({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-custom bg-successBackground text-successText",children:l.jsx(Ed,{})}),l.jsxs("div",{className:"w-full",children:[l.jsxs("p",{className:"font-bold",children:[e.name,","," ",e.isFixed?kt({amount:e.discount,currency:t}):e.discount+"%"," ","discount"]}),l.jsx("div",{className:"mt-2 w-full",children:l.jsx(r5,{color:"#C2C2C2",percent:e.initialCouponDurationForSubscriptions?nx(e.initialCouponDurationForSubscriptions,e.currentCouponDurationForSubscriptions||1):100,disablePercentLabel:!0})}),l.jsx("p",{className:"mt-1 text-sm text-textSecondary",children:"Forever discount code"})]})]}),XR=KR,JR=e=>{const{totalSteps:t,step:r,onStepChange:n,label:o}=e,[a,s]=y.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)})})]})]})},QR=JR,ek=e=>{const{setIsLoading:t,dialogStore:r}=e,{id:n}=$s(),o=Hr(),[a]=he(qn.dataAtom),[,s]=he(po),{setPaymentMethod:c,setGateway:u,cart:d}=ni();function f(){r.hide()}async function h(){if(t(!0),n){const{data:p}=await Lx(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(Hm,{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,{type:"Secondary",className:"w-fit",onClick:f,children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{type:d.gateway?"Primary":"Secondary",className:"w-fit",disabled:!d.gateway,onClick:h,children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Continue"})})})]})]})},tk=({setIsLoading:e})=>{const{cart:t}=ni(),r=Hr(),[n]=he(qn.dataAtom),[o]=he(Yr.dataAtom),a=en(Yr);y.useEffect(()=>{a([])},[]);const s=Oa({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(Bm,{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(g1,{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,{onClick:c,children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:t.gateway?"Change":"Manage"})}),l.jsx(oc,{store:s,title:"Choose new Payment Method",children:l.jsx(ek,{setIsLoading:e,dialogStore:s})})]})},w1=tk,rk=({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,{})}),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})]}),n5=rk,nk=({dialogStore:e})=>{const{getTotalAndDiscount:t,cart:r,coupon:n}=ni(),[o]=he(qn.dataAtom),[a,s]=y.useState(1),[c,u]=y.useState(!1),d=y.useMemo(()=>t(),[n,r]),f=y.useMemo(()=>d.totalWithDiscount?d.total-d.totalWithDiscount:0,[d]);if(c)return l.jsx(n5,{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(QR,{step:a,totalSteps:12,onStepChange:s,label:"How long would you like to extend your subscription for?"}),l.jsx(w1,{setIsLoading:u}),l.jsx(rc,{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,{type:"Secondary",className:"w-full",onClick:()=>e.hide(),children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{type:"Primary",className:"w-full",onClick:v,children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Extend"})})})]})]})},ok=()=>{const[e]=he(qn.dataAtom),[t,r]=ul((e==null?void 0:e.activeTo)||""),n=Oa({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,{onClick:()=>n.show(),children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Extend"})})]}),l.jsx(oc,{store:n,title:"Extend Subscription",children:l.jsx(nk,{dialogStore:n})})]})},ak=ok,sk=({isActive:e,setIsActive:t,selectedVariant:r})=>{if(!r)return null;const[n,o]=y.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(On,{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-custom bg-surface0 border border-borderDefault p-1",children:[l.jsx("div",{className:"w-full text-center cursor-pointer border-custom border-borderDefault 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(w1,{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,{type:"Secondary",className:"w-full",onClick:()=>t(!1),children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Stay with us"})})}),l.jsx("div",{className:"w-fit",children:l.jsx(Se,{type:"Primary",className:"w-full",onClick:a,children:l.jsxs("span",{className:"text-[var(--text-inverted)]",children:["Upgrade for $",u.toFixed(2)]})})})]})]})})},ik=sk,lk=({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-custom",children:[l.jsx(Gs,{}),"Your current Plan"]}):l.jsx(Se,{type:"Secondary",className:"w-full mt-6 p-3",children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Select"})}),n&&l.jsxs("div",{className:"w-full mt-3",children:[l.jsx(r5,{percent:c/s*100,disablePercentLabel:!0}),l.jsxs("p",{className:"text-textSecondary text-sm mt-2",children:["Used: ",c," of ",s," days"]})]})]})},ck=({isActive:e,setIsActive:t})=>{const r=en(Wc),[n,o]=y.useState(null),[a,s]=y.useState(null),[c,u]=y.useState(!1),[d,f]=y.useState(null),[h]=he(qn.dataAtom),{id:p,accessToken:v}=$s();y.useEffect(()=>{p&&v&&r({id:p,accessToken:v})},[p,v,r]);const[m]=he(Wc.dataAtom),[g]=he(Wc.pendingAtom);y.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]),y.useEffect(()=>{m!=null&&m.data.types[0]&&o(m==null?void 0:m.data.types[0])},[m==null?void 0:m.data.types]);const x=C=>{o(C),s(null)},b=C=>{s(C),u(!0)};return l.jsxs(On,{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-custom 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:()=>x(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(lk,{variant:C.data,isSelected:(a==null?void 0:a.id)===C.data.id,isCurrent:(d==null?void 0:d.id)===C.data.id,onSelect:()=>b(C.data)},C.data.id))}),g&&l.jsx("p",{children:"Loading..."})]}),a&&l.jsx(ik,{isActive:c,setIsActive:u,selectedVariant:a})]})},uk=ck,dk=()=>{const{id:e,accessToken:t}=$s(),[r]=he(qn.dataAtom),[n]=he(qn.pendingAtom),o=en(qn),[a,s]=y.useState(!1),[c,u]=y.useState(!1);return y.useEffect(()=>{e&&t&&o({id:e,accessToken:t})},[]),n?l.jsx(tr,{}):c?l.jsx(n5,{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(uk,{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(LR,{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,{className:"w-full",onClick:()=>s(!0),children:l.jsx("span",{className:"text-[var(--text-inverted)]",children:"Change Plan"})})}),l.jsx("div",{className:"w-full",children:l.jsx(Se,{type:"Secondary",className:"w-full",children:l.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel Plan"})})})]})]}),l.jsx(kn,{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(XR,{coupon:r.coupon,currency:r.price.currency||"USD"}),r&&l.jsx(HR,{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(w1,{setIsLoading:u}),l.jsx(ak,{}),l.jsx(kn,{className:"flex md:hidden"})]})]})})]})},fk=dk;const hk="_button_1gxoe_1",pk="_primary_1gxoe_14",mk="_secondary_1gxoe_22",gk="_tertiary_1gxoe_30",vk="_content_1gxoe_38",xk="_withoutHover_1gxoe_45",na={button:hk,primary:pk,secondary:mk,tertiary:gk,content:vk,withoutHover:xk},zu=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:Qt(na.button,o,{[na.primary]:c==="Primary",[na.secondary]:c==="Secondary",[na.tertiary]:c==="Tertiary",[na.withoutHover]:u}),onClick:r,style:{...n,fontSize:s==="m"?14:s==="s"?12:16},disabled:a,children:c==="Tertiary"?l.jsxs("div",{className:na.content,children:[t,l.jsx(dn,{name:"ArrowRight",fill:"#757575",width:20,height:20})]}):l.jsx(l.Fragment,{children:t})})},yk="_customCheckbox_w9x8g_1",bk="_checkboxBox_w9x8g_7",Ck="_checked_w9x8g_23",wk="_icon_w9x8g_31",ki={customCheckbox:yk,checkboxBox:bk,checked:Ck,icon:wk},Sk=e=>{const{value:t,onChange:r}=e,[n,o]=y.useState(t),a=()=>{o(!n),r(!n)};return y.useEffect(()=>{o(t)},[t]),l.jsxs("label",{className:ki.customCheckbox,onClick:s=>s.stopPropagation(),children:[l.jsx("input",{type:"checkbox",checked:n,onChange:a,style:{display:"none"}}),l.jsx("span",{className:Qt(ki.checkboxBox,{[ki.checked]:n})}),n&&l.jsx("div",{className:ki.icon,children:l.jsx(dn,{name:"Check",width:14,height:14,fill:"#ff3f19"})})]})},Ek=e=>{const{label:t,onChange:r,activeImage:n}=e,{setOpenModal:o,setOnChange:a}=sd();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(dn,{name:"Plus",width:20,height:20,fill:"#757575"})}),l.jsx("span",{className:pt.text,children:n?"Change Image":"Select Image"})]})]})})},jk=()=>{const{setOpenModal:e,onChange:t}=sd(),{setIsOpen:r}=id(),[n,o]=y.useState(!1),a=()=>{var x;(x=s.current)==null||x.click()},s=y.useRef(null),[c,u]=y.useState([]),[d,f]=y.useState(!1),h=async x=>{var S;const b=((S=x.target.files)==null?void 0:S[0])||null;if(!b)return;const C=new FormData;C.append("file",b),f(!0);const{data:_}=await v8(C),w=[...c];w.unshift({..._.data,cfId:_.data.path}),u([...w]),f(!1)},p=x=>{x.preventDefault(),o(!1);const b=x.dataTransfer.files;if(b&&b.length>0){const _={target:{files:[b[0]]}};h(_)}},v=()=>{r(!1),setTimeout(()=>{e(!1),r(!0)},300)},m=x=>{const C=[...c].map(_=>_.id===x.id?{...x}:_);u([...C])};y.useEffect(()=>{(async()=>{const{data:b}=await g8(),C=b.data.map(_=>({..._,isSelected:!1}));u(C)})()},[]);function g(){const x=c.filter(b=>b.isSelected).map(b=>b.cfId);t==null||t(x)}return l.jsxs("div",{onClick:x=>x.stopPropagation(),className:pt.modal,children:[l.jsxs("div",{className:pt.top,children:[l.jsx("h4",{className:pt.title,children:"Select Image"}),l.jsx(dn,{name:"X",width:20,height:20,hoverable:!0,onClick:v})]}),l.jsxs("div",{className:pt.modalContent,children:[l.jsxs("div",{className:pt.top,children:[l.jsx("div",{}),l.jsxs("div",{children:["Selected: ",c.filter(x=>x.isSelected).length," images"]})]}),l.jsxs("div",{className:pt.images,children:[l.jsxs("div",{className:pt.input,onDragOver:x=>x.preventDefault(),onDragEnter:()=>o(!0),onDragLeave:()=>o(!1),onDrop:p,children:[l.jsxs("div",{onClick:a,className:Qt(pt.add,{[pt.dragging]:n}),children:[l.jsx("div",{className:pt.icon,children:l.jsx(dn,{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:s,style:{display:"none"},onChange:h,multiple:!1,accept:"image/*"})]}),d&&l.jsx(Kh,{}),c.map(x=>l.jsx(_k,{image:x,updateImage:m},x.id)),c.length===0&&[...new Array(5)].map((x,b)=>l.jsx(Kh,{},b))]})]}),l.jsxs("div",{className:pt.bottom,children:[l.jsx(zu,{className:pt.cancel,onClick:v,type:"Secondary",children:"Cancel"}),l.jsx(zu,{onClick:()=>{e(!1),g()},children:"Select"})]})]})},_k=e=>{const{image:t,updateImage:r}=e;return l.jsxs("div",{className:Qt(pt.image,{[pt.selected]:t.isSelected}),onClick:()=>{r({...t,isSelected:!t.isSelected})},children:[l.jsx("div",{className:pt.checkbox,children:l.jsx(Sk,{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)},Kh=()=>l.jsx("div",{className:pt.loading,children:l.jsx("div",{className:pt.spinner})}),Tk="_wrapper_187gl_1",Pk="_label_187gl_9",Nk="_input_187gl_17",Rk="_required_187gl_47",kk="_paddingless_187gl_54",Ak="_content_187gl_58",Lk="_borderless_187gl_66",Dk="_rightIcon_187gl_77",Ok="_inputPostfix_187gl_83",Cn={wrapper:Tk,label:Pk,input:Nk,required:Rk,paddingless:kk,content:Ak,borderless:Lk,rightIcon:Dk,inputPostfix:Ok},Mk=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:x}=e,[b,C]=y.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:Cn.wrapper,children:[n&&l.jsx("label",{className:Cn.label,htmlFor:n,children:n}),l.jsxs("div",{className:Cn.content,children:[l.jsx("input",{id:n,type:a||"text",onChange:S=>{if(a==="text")t(S.target.value);else{const A=_(S.target.value);t(A)}},value:o,autoComplete:"off",placeholder:u||"Type something...",className:Qt(Cn.input,{[Cn.required]:b&&f&&!w(o),[Cn.paddingless]:p,[Cn.borderless]:v}),min:a==="number"?s:void 0,max:a==="number"?c:void 0,disabled:d,onFocus:()=>{v||C(!0)},style:r}),x&&l.jsx("span",{className:Cn.inputPostfix,children:x}),g&&l.jsx("div",{className:Cn.rightIcon,children:l.jsx(dn,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:20,height:20})}),m&&l.jsx("div",{children:l.jsx(dn,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})};function Ik(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return y.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const ac=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Va(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function S1(e){return"nodeType"in e}function yr(e){var t,r;return e?Va(e)?e:S1(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function E1(e){const{Document:t}=yr(e);return e instanceof t}function ii(e){return Va(e)?!1:e instanceof yr(e).HTMLElement}function o5(e){return e instanceof yr(e).SVGElement}function $a(e){return e?Va(e)?e.document:S1(e)?E1(e)?e:ii(e)||o5(e)?e.ownerDocument:document:document:document}const gn=ac?y.useLayoutEffect:y.useEffect;function j1(e){const t=y.useRef(e);return gn(()=>{t.current=e}),y.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 Fk(){const e=y.useRef(null),t=y.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=y.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Is(e,t){t===void 0&&(t=[e]);const r=y.useRef(e);return gn(()=>{r.current!==e&&(r.current=e)},t),r}function li(e,t){const r=y.useRef();return y.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function jl(e){const t=j1(e),r=y.useRef(null),n=y.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,n]}function Zu(e){const t=y.useRef();return y.useEffect(()=>{t.current=e},[e]),t.current}let zc={};function ci(e,t){return y.useMemo(()=>{if(t)return t;const r=zc[e]==null?0:zc[e]+1;return zc[e]=r,e+"-"+r},[e,t])}function a5(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 ha=a5(1),_l=a5(-1);function Bk(e){return"clientX"in e&&"clientY"in e}function _1(e){if(!e)return!1;const{KeyboardEvent:t}=yr(e.target);return t&&e instanceof t}function Hk(e){if(!e)return!1;const{TouchEvent:t}=yr(e.target);return t&&e instanceof t}function Gu(e){if(Hk(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 Bk(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}}}),Xh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Vk(e){return e.matches(Xh)?e:e.querySelector(Xh)}const $k={display:"none"};function Uk(e){let{id:t,value:r}=e;return y.createElement("div",{id:t,style:$k},r)}function Wk(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 y.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function zk(){const[e,t]=y.useState("");return{announce:y.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const s5=y.createContext(null);function Zk(e){const t=y.useContext(s5);y.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Gk(){const[e]=y.useState(()=>new Set),t=y.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[y.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 qk={draggable:`
|
|
146
151
|
To pick up a draggable item, press the space bar.
|
|
147
152
|
While dragging, use the arrow keys to move the item.
|
|
148
153
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
149
|
-
`},Kk={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Xk(e){let{announcements:t=Kk,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Yk}=e;const{announce:a,announcement:s}=Zk(),c=ci("DndLiveRegion"),[u,d]=y.useState(!1);if(y.useEffect(()=>{d(!0)},[]),Gk(y.useMemo(()=>({onDragStart(h){let{active:p}=h;a(t.onDragStart({active:p}))},onDragMove(h){let{active:p,over:v}=h;t.onDragMove&&a(t.onDragMove({active:p,over:v}))},onDragOver(h){let{active:p,over:v}=h;a(t.onDragOver({active:p,over:v}))},onDragEnd(h){let{active:p,over:v}=h;a(t.onDragEnd({active:p,over:v}))},onDragCancel(h){let{active:p,over:v}=h;a(t.onDragCancel({active:p,over:v}))}}),[a,t])),!u)return null;const f=y.createElement(y.Fragment,null,y.createElement(Wk,{id:n,value:o.draggable}),y.createElement(zk,{id:c,announcement:s}));return r?Ur.createPortal(f,r):f}var Ft;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ft||(Ft={}));function Tl(){}function Jk(e,t){return y.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Qk(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return y.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Kr=Object.freeze({x:0,y:0});function eA(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function tA(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function rA(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=o-n,c=a-r;if(n<o&&r<a){const u=t.width*t.height,d=e.width*e.height,f=s*c,h=f/(u+d-f);return Number(h.toFixed(4))}return 0}const nA=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:s}=a,c=r.get(s);if(c){const u=rA(c,t);u>0&&o.push({id:s,data:{droppableContainer:a,value:u}})}}return o.sort(eA)};function oA(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function i5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Kr}function aA(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((s,c)=>({...s,top:s.top+e*c.y,bottom:s.bottom+e*c.y,left:s.left+e*c.x,right:s.right+e*c.x}),{...r})}}const sA=aA(1);function iA(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function lA(e,t,r){const n=iA(t);if(!n)return e;const{scaleX:o,scaleY:a,x:s,y:c}=n,u=e.left-s-(1-o)*parseFloat(r),d=e.top-c-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),f=o?e.width/o:e.width,h=a?e.height/a:e.height;return{width:f,height:h,top:d,right:u+f,bottom:d+h,left:u}}const cA={ignoreTransform:!1};function Ua(e,t){t===void 0&&(t=cA);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=yr(e).getComputedStyle(e);d&&(r=lA(r,d,f))}const{top:n,left:o,width:a,height:s,bottom:c,right:u}=r;return{top:n,left:o,width:a,height:s,bottom:c,right:u}}function Jh(e){return Ua(e,{ignoreTransform:!0})}function uA(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function dA(e,t){return t===void 0&&(t=yr(e).getComputedStyle(e)),t.position==="fixed"}function fA(e,t){t===void 0&&(t=yr(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?r.test(a):!1})}function T1(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(E1(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!ii(o)||o5(o)||r.includes(o))return r;const a=yr(e).getComputedStyle(o);return o!==e&&fA(o,a)&&r.push(o),dA(o,a)?r:n(o.parentNode)}return e?n(e):r}function l5(e){const[t]=T1(e,1);return t??null}function Zc(e){return!ac||!e?null:Va(e)?e:S1(e)?E1(e)||e===$a(e).scrollingElement?window:ii(e)?e:null:null}function c5(e){return Va(e)?e.scrollX:e.scrollLeft}function u5(e){return Va(e)?e.scrollY:e.scrollTop}function qu(e){return{x:c5(e),y:u5(e)}}var $t;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})($t||($t={}));function d5(e){return!ac||!e?!1:e===document.scrollingElement}function f5(e){const t={x:0,y:0},r=d5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,c=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:s,isRight:c,maxScroll:n,minScroll:t}}const hA={x:.2,y:.2};function pA(e,t,r,n,o){let{top:a,left:s,right:c,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=hA);const{isTop:d,isBottom:f,isLeft:h,isRight:p}=f5(e),v={x:0,y:0},m={x:0,y:0},g={height:t.height*o.y,width:t.width*o.x};return!d&&a<=t.top+g.height?(v.y=$t.Backward,m.y=n*Math.abs((t.top+g.height-a)/g.height)):!f&&u>=t.bottom-g.height&&(v.y=$t.Forward,m.y=n*Math.abs((t.bottom-g.height-u)/g.height)),!p&&c>=t.right-g.width?(v.x=$t.Forward,m.x=n*Math.abs((t.right-g.width-c)/g.width)):!h&&s<=t.left+g.width&&(v.x=$t.Backward,m.x=n*Math.abs((t.left+g.width-s)/g.width)),{direction:v,speed:m}}function mA(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}const{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function h5(e){return e.reduce((t,r)=>ha(t,qu(r)),Kr)}function gA(e){return e.reduce((t,r)=>t+c5(r),0)}function vA(e){return e.reduce((t,r)=>t+u5(r),0)}function xA(e,t){if(t===void 0&&(t=Ua),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);l5(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const yA=[["x",["left","right"],gA],["y",["top","bottom"],vA]];class P1{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=T1(r),o=h5(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,c]of yA)for(const u of s)Object.defineProperty(this,u,{get:()=>{const d=c(n),f=o[a]-d;return this.rect[u]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class us{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var o;(o=this.target)==null||o.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function bA(e){const{EventTarget:t}=yr(e);return e instanceof t?e:$a(e)}function Gc(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Mr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Mr||(Mr={}));function Qh(e){e.preventDefault()}function CA(e){e.stopPropagation()}var Je;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Je||(Je={}));const p5={start:[Je.Space,Je.Enter],cancel:[Je.Esc],end:[Je.Space,Je.Enter,Je.Tab]},wA=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Je.Right:return{...r,x:r.x+25};case Je.Left:return{...r,x:r.x-25};case Je.Down:return{...r,y:r.y+25};case Je.Up:return{...r,y:r.y-25}}};class m5{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new us($a(r)),this.windowListeners=new us(yr(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Mr.Resize,this.handleCancel),this.windowListeners.add(Mr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Mr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&xA(n),r(Kr)}handleKeyDown(t){if(_1(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=p5,coordinateGetter:s=wA,scrollBehavior:c="smooth"}=o,{code:u}=t;if(a.end.includes(u)){this.handleEnd(t);return}if(a.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=n.current,f=d?{x:d.left,y:d.top}:Kr;this.referenceCoordinates||(this.referenceCoordinates=f);const h=s(t,{active:r,context:n.current,currentCoordinates:f});if(h){const p=_l(h,f),v={x:0,y:0},{scrollableAncestors:m}=n.current;for(const g of m){const x=t.code,{isTop:b,isRight:C,isLeft:_,isBottom:w,maxScroll:S,minScroll:A}=f5(g),T=mA(g),E={x:Math.min(x===Je.Right?T.right-T.width/2:T.right,Math.max(x===Je.Right?T.left:T.left+T.width/2,h.x)),y:Math.min(x===Je.Down?T.bottom-T.height/2:T.bottom,Math.max(x===Je.Down?T.top:T.top+T.height/2,h.y))},k=x===Je.Right&&!C||x===Je.Left&&!_,R=x===Je.Down&&!w||x===Je.Up&&!b;if(k&&E.x!==h.x){const D=g.scrollLeft+p.x,M=x===Je.Right&&D<=S.x||x===Je.Left&&D>=A.x;if(M&&!p.y){g.scrollTo({left:D,behavior:c});return}M?v.x=g.scrollLeft-D:v.x=x===Je.Right?g.scrollLeft-S.x:g.scrollLeft-A.x,v.x&&g.scrollBy({left:-v.x,behavior:c});break}else if(R&&E.y!==h.y){const D=g.scrollTop+p.y,M=x===Je.Down&&D<=S.y||x===Je.Up&&D>=A.y;if(M&&!p.x){g.scrollTo({top:D,behavior:c});return}M?v.y=g.scrollTop-D:v.y=x===Je.Down?g.scrollTop-S.y:g.scrollTop-A.y,v.y&&g.scrollBy({top:-v.y,behavior:c});break}}this.handleMove(t,ha(_l(h,this.referenceCoordinates),v))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}m5.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=p5,onActivation:o}=t,{active:a}=r;const{code:s}=e.nativeEvent;if(n.start.includes(s)){const c=a.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function e0(e){return!!(e&&"distance"in e)}function t0(e){return!!(e&&"delay"in e)}class N1{constructor(t,r,n){var o;n===void 0&&(n=bA(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:s}=a;this.props=t,this.events=r,this.document=$a(s),this.documentListeners=new us(this.document),this.listeners=new us(n),this.windowListeners=new us(yr(s)),this.initialCoordinates=(o=Gu(a))!=null?o:Kr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Mr.Resize,this.handleCancel),this.windowListeners.add(Mr.DragStart,Qh),this.windowListeners.add(Mr.VisibilityChange,this.handleCancel),this.windowListeners.add(Mr.ContextMenu,Qh),this.documentListeners.add(Mr.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(t0(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(e0(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:o}=this.props;o(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Mr.Click,CA,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Mr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:s,options:{activationConstraint:c}}=a;if(!o)return;const u=(r=Gu(t))!=null?r:Kr,d=_l(o,u);if(!n&&c){if(e0(c)){if(c.tolerance!=null&&Gc(d,c.tolerance))return this.handleCancel();if(Gc(d,c.distance))return this.handleStart()}if(t0(c)&&Gc(d,c.tolerance))return this.handleCancel();this.handlePending(c,d);return}t.cancelable&&t.preventDefault(),s(u)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Je.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const SA={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class R1 extends N1{constructor(t){const{event:r}=t,n=$a(r.target);super(t,SA,n)}}R1.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const EA={move:{name:"mousemove"},end:{name:"mouseup"}};var Yu;(function(e){e[e.RightClick=2]="RightClick"})(Yu||(Yu={}));class jA extends N1{constructor(t){super(t,EA,$a(t.event.target))}}jA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Yu.RightClick?!1:(n==null||n({event:r}),!0)}}];const qc={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class _A extends N1{constructor(t){super(t,qc)}static setup(){return window.addEventListener(qc.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(qc.move.name,t)};function t(){}}}_A.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:o}=r;return o.length>1?!1:(n==null||n({event:r}),!0)}}];var ds;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ds||(ds={}));var Pl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Pl||(Pl={}));function TA(e){let{acceleration:t,activator:r=ds.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:s=5,order:c=Pl.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:p}=e;const v=NA({delta:h,disabled:!a}),[m,g]=Bk(),x=y.useRef({x:0,y:0}),b=y.useRef({x:0,y:0}),C=y.useMemo(()=>{switch(r){case ds.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case ds.DraggableRect:return o}},[r,o,u]),_=y.useRef(null),w=y.useCallback(()=>{const A=_.current;if(!A)return;const T=x.current.x*b.current.x,E=x.current.y*b.current.y;A.scrollBy(T,E)},[]),S=y.useMemo(()=>c===Pl.TreeOrder?[...d].reverse():d,[c,d]);y.useEffect(()=>{if(!a||!d.length||!C){g();return}for(const A of S){if((n==null?void 0:n(A))===!1)continue;const T=d.indexOf(A),E=f[T];if(!E)continue;const{direction:k,speed:R}=pA(A,E,C,t,p);for(const D of["x","y"])v[D][k[D]]||(R[D]=0,k[D]=0);if(R.x>0||R.y>0){g(),_.current=A,m(w,s),x.current=R,b.current=k;return}}x.current={x:0,y:0},b.current={x:0,y:0},g()},[t,w,n,g,a,s,JSON.stringify(C),JSON.stringify(v),m,d,S,f,JSON.stringify(p)])}const PA={x:{[$t.Backward]:!1,[$t.Forward]:!1},y:{[$t.Backward]:!1,[$t.Forward]:!1}};function NA(e){let{delta:t,disabled:r}=e;const n=Zu(t);return li(o=>{if(r||!n||!o)return PA;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[$t.Backward]:o.x[$t.Backward]||a.x===-1,[$t.Forward]:o.x[$t.Forward]||a.x===1},y:{[$t.Backward]:o.y[$t.Backward]||a.y===-1,[$t.Forward]:o.y[$t.Forward]||a.y===1}}},[r,t,n])}function RA(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return li(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function kA(e,t){return y.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,n)}));return[...r,...a]},[]),[e,t])}var Bs;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Bs||(Bs={}));var Ku;(function(e){e.Optimized="optimized"})(Ku||(Ku={}));const r0=new Map;function AA(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,s]=y.useState(null),{frequency:c,measure:u,strategy:d}=o,f=y.useRef(e),h=x(),p=Is(h),v=y.useCallback(function(b){b===void 0&&(b=[]),!p.current&&s(C=>C===null?b:C.concat(b.filter(_=>!C.includes(_))))},[p]),m=y.useRef(null),g=li(b=>{if(h&&!r)return r0;if(!b||b===r0||f.current!==e||a!=null){const C=new Map;for(let _ of e){if(!_)continue;if(a&&a.length>0&&!a.includes(_.id)&&_.rect.current){C.set(_.id,_.rect.current);continue}const w=_.node.current,S=w?new P1(u(w),w):null;_.rect.current=S,S&&C.set(_.id,S)}return C}return b},[e,a,r,h,u]);return y.useEffect(()=>{f.current=e},[e]),y.useEffect(()=>{h||v()},[r,h]),y.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),y.useEffect(()=>{h||typeof c!="number"||m.current!==null||(m.current=setTimeout(()=>{v(),m.current=null},c))},[c,h,v,...n]),{droppableRects:g,measureDroppableContainers:v,measuringScheduled:a!=null};function x(){switch(d){case Bs.Always:return!1;case Bs.BeforeDragging:return r;default:return!r}}}function g5(e,t){return li(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function LA(e,t){return g5(e,t)}function DA(e){let{callback:t,disabled:r}=e;const n=j1(t),o=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return y.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function sc(e){let{callback:t,disabled:r}=e;const n=j1(t),o=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return y.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function OA(e){return new P1(Ua(e),e)}function n0(e,t,r){t===void 0&&(t=OA);const[n,o]=y.useState(null);function a(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??r)!=null?d:null}const f=t(e);return JSON.stringify(u)===JSON.stringify(f)?u:f})}const s=DA({callback(u){if(e)for(const d of u){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){a();break}}}}),c=sc({callback:a});return gn(()=>{a(),e?(c==null||c.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(c==null||c.disconnect(),s==null||s.disconnect())},[e]),n}function MA(e){const t=g5(e);return i5(e,t)}const o0=[];function IA(e){const t=y.useRef(e),r=li(n=>e?n&&n!==o0&&e&&t.current&&e.parentNode===t.current.parentNode?n:T1(e):o0,[e]);return y.useEffect(()=>{t.current=e},[e]),r}function FA(e){const[t,r]=y.useState(null),n=y.useRef(e),o=y.useCallback(a=>{const s=Zc(a.target);s&&r(c=>c?(c.set(s,qu(s)),new Map(c)):null)},[]);return y.useEffect(()=>{const a=n.current;if(e!==a){s(a);const c=e.map(u=>{const d=Zc(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,qu(d)]):null}).filter(u=>u!=null);r(c.length?new Map(c):null),n.current=e}return()=>{s(e),s(a)};function s(c){c.forEach(u=>{const d=Zc(u);d==null||d.removeEventListener("scroll",o)})}},[o,e]),y.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>ha(a,s),Kr):h5(e):Kr,[e,t])}function a0(e,t){t===void 0&&(t=[]);const r=y.useRef(null);return y.useEffect(()=>{r.current=null},t),y.useEffect(()=>{const n=e!==Kr;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?_l(e,r.current):Kr}function BA(e){y.useEffect(()=>{if(!ac)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function HA(e,t){return y.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=s=>{a(s,t)},r},{}),[e,t])}function v5(e){return y.useMemo(()=>e?uA(e):null,[e])}const s0=[];function VA(e,t){t===void 0&&(t=Ua);const[r]=e,n=v5(r?yr(r):null),[o,a]=y.useState(s0);function s(){a(()=>e.length?e.map(u=>d5(u)?n:new P1(t(u),u)):s0)}const c=sc({callback:s});return gn(()=>{c==null||c.disconnect(),s(),e.forEach(u=>c==null?void 0:c.observe(u))},[e]),o}function $A(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ii(t)?t:e}function UA(e){let{measure:t}=e;const[r,n]=y.useState(null),o=y.useCallback(d=>{for(const{target:f}of d)if(ii(f)){n(h=>{const p=t(f);return h?{...h,width:p.width,height:p.height}:p});break}},[t]),a=sc({callback:o}),s=y.useCallback(d=>{const f=$A(d);a==null||a.disconnect(),f&&(a==null||a.observe(f)),n(f?t(f):null)},[t,a]),[c,u]=jl(s);return y.useMemo(()=>({nodeRef:c,rect:r,setRef:u}),[r,c,u])}const WA=[{sensor:R1,options:{}},{sensor:m5,options:{}}],zA={current:{}},zi={draggable:{measure:Jh},droppable:{measure:Jh,strategy:Bs.WhileDragging,frequency:Ku.Optimized},dragOverlay:{measure:Ua}};class fs extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const ZA={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new fs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Tl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:zi,measureDroppableContainers:Tl,windowRect:null,measuringScheduled:!1},GA={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Tl,draggableNodes:new Map,over:null,measureDroppableContainers:Tl},ic=y.createContext(GA),x5=y.createContext(ZA);function qA(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new fs}}}function YA(e,t){switch(t.type){case Ft.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ft.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ft.DragEnd:case Ft.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ft.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new fs(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case Ft.SetDroppableDisabled:{const{id:r,key:n,disabled:o}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const s=new fs(e.droppable.containers);return s.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case Ft.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new fs(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function KA(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=y.useContext(ic),a=Zu(n),s=Zu(r==null?void 0:r.id);return y.useEffect(()=>{if(!t&&!n&&a&&s!=null){if(!_1(a)||document.activeElement===a.target)return;const c=o.get(s);if(!c)return;const{activatorNode:u,node:d}=c;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[u.current,d.current]){if(!f)continue;const h=$k(f);if(h){h.focus();break}}})}},[n,t,o,s,a]),null}function XA(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function JA(e){return y.useMemo(()=>({draggable:{...zi.draggable,...e==null?void 0:e.draggable},droppable:{...zi.droppable,...e==null?void 0:e.droppable},dragOverlay:{...zi.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function QA(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=y.useRef(!1),{x:s,y:c}=typeof o=="boolean"?{x:o,y:o}:o;gn(()=>{if(!s&&!c||!t){a.current=!1;return}if(a.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=r(d),h=i5(f,n);if(s||(h.x=0),c||(h.y=0),a.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const p=l5(d);p&&p.scrollBy({top:h.y,left:h.x})}},[t,s,c,n,r])}const y5=y.createContext({...Kr,scaleX:1,scaleY:1});var Zn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Zn||(Zn={}));const eL=y.memo(function(t){var r,n,o,a;let{id:s,accessibility:c,autoScroll:u=!0,children:d,sensors:f=WA,collisionDetection:h=nA,measuring:p,modifiers:v,...m}=t;const g=y.useReducer(YA,void 0,qA),[x,b]=g,[C,_]=qk(),[w,S]=y.useState(Zn.Uninitialized),A=w===Zn.Initialized,{draggable:{active:T,nodes:E,translate:k},droppable:{containers:R}}=x,D=T!=null?E.get(T):null,M=y.useRef({initial:null,translated:null}),G=y.useMemo(()=>{var Ze;return T!=null?{id:T,data:(Ze=D==null?void 0:D.data)!=null?Ze:zA,rect:M}:null},[T,D]),V=y.useRef(null),[Q,H]=y.useState(null),[K,te]=y.useState(null),ee=Is(m,Object.values(m)),W=ci("DndDescribedBy",s),U=y.useMemo(()=>R.getEnabled(),[R]),O=JA(p),{droppableRects:q,measureDroppableContainers:Y,measuringScheduled:ce}=AA(U,{dragging:A,dependencies:[k.x,k.y],config:O.droppable}),J=RA(E,T),ue=y.useMemo(()=>K?Gu(K):null,[K]),ie=xt(),ve=LA(J,O.draggable.measure);QA({activeNode:T!=null?E.get(T):null,config:ie.layoutShiftCompensation,initialRect:ve,measure:O.draggable.measure});const re=n0(J,O.draggable.measure,ve),We=n0(J?J.parentElement:null),$=y.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pe=R.getNodeFor((r=$.current.over)==null?void 0:r.id),ye=UA({measure:O.dragOverlay.measure}),Ae=(n=ye.nodeRef.current)!=null?n:J,Fe=A?(o=ye.rect)!=null?o:re:null,Oe=!!(ye.nodeRef.current&&ye.rect),de=MA(Oe?null:re),be=v5(Ae?yr(Ae):null),Be=IA(A?pe??J:null),Re=VA(Be),Qe=XA(v,{transform:{x:k.x-de.x,y:k.y-de.y,scaleX:1,scaleY:1},activatorEvent:K,active:G,activeNodeRect:re,containerNodeRect:We,draggingNodeRect:Fe,over:$.current.over,overlayNodeRect:ye.rect,scrollableAncestors:Be,scrollableAncestorRects:Re,windowRect:be}),st=ue?ha(ue,k):null,Nt=FA(Be),_t=a0(Nt),At=a0(Nt,[re]),it=ha(Qe,_t),Yt=Fe?sA(Fe,Qe):null,Rt=G&&Yt?h({active:G,collisionRect:Yt,droppableRects:q,droppableContainers:U,pointerCoordinates:st}):null,It=tA(Rt,"id"),[Ye,lr]=y.useState(null),br=Oe?Qe:ha(Qe,At),xo=oA(br,(a=Ye==null?void 0:Ye.rect)!=null?a:null,re),Ht=y.useRef(null),Kt=y.useCallback((Ze,ut)=>{let{sensor:wt,options:cr}=ut;if(V.current==null)return;const Wt=E.get(V.current);if(!Wt)return;const Vt=Ze.nativeEvent,rr=new wt({active:V.current,activeNode:Wt,event:Vt,options:cr,context:$,onAbort(yt){if(!E.get(yt))return;const{onDragAbort:Xt}=ee.current,ur={id:yt};Xt==null||Xt(ur),C({type:"onDragAbort",event:ur})},onPending(yt,nr,Xt,ur){if(!E.get(yt))return;const{onDragPending:N}=ee.current,L={id:yt,constraint:nr,initialCoordinates:Xt,offset:ur};N==null||N(L),C({type:"onDragPending",event:L})},onStart(yt){const nr=V.current;if(nr==null)return;const Xt=E.get(nr);if(!Xt)return;const{onDragStart:ur}=ee.current,xn={activatorEvent:Vt,active:{id:nr,data:Xt.data,rect:M}};Ur.unstable_batchedUpdates(()=>{ur==null||ur(xn),S(Zn.Initializing),b({type:Ft.DragStart,initialCoordinates:yt,active:nr}),C({type:"onDragStart",event:xn}),H(Ht.current),te(Vt)})},onMove(yt){b({type:Ft.DragMove,coordinates:yt})},onEnd:Lr(Ft.DragEnd),onCancel:Lr(Ft.DragCancel)});Ht.current=rr;function Lr(yt){return async function(){const{active:Xt,collisions:ur,over:xn,scrollAdjustedTranslate:N}=$.current;let L=null;if(Xt&&N){const{cancelDrop:B}=ee.current;L={activatorEvent:Vt,active:Xt,collisions:ur,delta:N,over:xn},yt===Ft.DragEnd&&typeof B=="function"&&await Promise.resolve(B(L))&&(yt=Ft.DragCancel)}V.current=null,Ur.unstable_batchedUpdates(()=>{b({type:yt}),S(Zn.Uninitialized),lr(null),H(null),te(null),Ht.current=null;const B=yt===Ft.DragEnd?"onDragEnd":"onDragCancel";if(L){const j=ee.current[B];j==null||j(L),C({type:B,event:L})}})}}},[E]),In=y.useCallback((Ze,ut)=>(wt,cr)=>{const Wt=wt.nativeEvent,Vt=E.get(cr);if(V.current!==null||!Vt||Wt.dndKit||Wt.defaultPrevented)return;const rr={active:Vt};Ze(wt,ut.options,rr)===!0&&(Wt.dndKit={capturedBy:ut.sensor},V.current=cr,Kt(wt,ut))},[E,Kt]),_e=kA(f,In);BA(f),gn(()=>{re&&w===Zn.Initializing&&S(Zn.Initialized)},[re,w]),y.useEffect(()=>{const{onDragMove:Ze}=ee.current,{active:ut,activatorEvent:wt,collisions:cr,over:Wt}=$.current;if(!ut||!wt)return;const Vt={active:ut,activatorEvent:wt,collisions:cr,delta:{x:it.x,y:it.y},over:Wt};Ur.unstable_batchedUpdates(()=>{Ze==null||Ze(Vt),C({type:"onDragMove",event:Vt})})},[it.x,it.y]),y.useEffect(()=>{const{active:Ze,activatorEvent:ut,collisions:wt,droppableContainers:cr,scrollAdjustedTranslate:Wt}=$.current;if(!Ze||V.current==null||!ut||!Wt)return;const{onDragOver:Vt}=ee.current,rr=cr.get(It),Lr=rr&&rr.rect.current?{id:rr.id,rect:rr.rect.current,data:rr.data,disabled:rr.disabled}:null,yt={active:Ze,activatorEvent:ut,collisions:wt,delta:{x:Wt.x,y:Wt.y},over:Lr};Ur.unstable_batchedUpdates(()=>{lr(Lr),Vt==null||Vt(yt),C({type:"onDragOver",event:yt})})},[It]),gn(()=>{$.current={activatorEvent:K,active:G,activeNode:J,collisionRect:Yt,collisions:Rt,droppableRects:q,draggableNodes:E,draggingNode:Ae,draggingNodeRect:Fe,droppableContainers:R,over:Ye,scrollableAncestors:Be,scrollAdjustedTranslate:it},M.current={initial:Fe,translated:Yt}},[G,J,Rt,Yt,E,Ae,Fe,q,R,Ye,Be,it]),TA({...ie,delta:k,draggingRect:Yt,pointerCoordinates:st,scrollableAncestors:Be,scrollableAncestorRects:Re});const qe=y.useMemo(()=>({active:G,activeNode:J,activeNodeRect:re,activatorEvent:K,collisions:Rt,containerNodeRect:We,dragOverlay:ye,draggableNodes:E,droppableContainers:R,droppableRects:q,over:Ye,measureDroppableContainers:Y,scrollableAncestors:Be,scrollableAncestorRects:Re,measuringConfiguration:O,measuringScheduled:ce,windowRect:be}),[G,J,re,K,Rt,We,ye,E,R,q,Ye,Y,Be,Re,O,ce,be]),ze=y.useMemo(()=>({activatorEvent:K,activators:_e,active:G,activeNodeRect:re,ariaDescribedById:{draggable:W},dispatch:b,draggableNodes:E,over:Ye,measureDroppableContainers:Y}),[K,_e,G,re,b,W,E,Ye,Y]);return y.createElement(s5.Provider,{value:_},y.createElement(ic.Provider,{value:ze},y.createElement(x5.Provider,{value:qe},y.createElement(y5.Provider,{value:xo},d)),y.createElement(KA,{disabled:(c==null?void 0:c.restoreFocus)===!1})),y.createElement(Xk,{...c,hiddenTextDescribedById:W}));function xt(){const Ze=(Q==null?void 0:Q.autoScrollEnabled)===!1,ut=typeof u=="object"?u.enabled===!1:u===!1,wt=A&&!Ze&&!ut;return typeof u=="object"?{...u,enabled:wt}:{enabled:wt}}}),tL=y.createContext(null),i0="button",rL="Draggable";function nL(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=ci(rL),{activators:s,activatorEvent:c,active:u,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:p}=y.useContext(ic),{role:v=i0,roleDescription:m="draggable",tabIndex:g=0}=o??{},x=(u==null?void 0:u.id)===t,b=y.useContext(x?y5:tL),[C,_]=jl(),[w,S]=jl(),A=HA(s,t),T=Is(r);gn(()=>(h.set(t,{id:t,key:a,node:C,activatorNode:w,data:T}),()=>{const k=h.get(t);k&&k.key===a&&h.delete(t)}),[h,t]);const E=y.useMemo(()=>({role:v,tabIndex:g,"aria-disabled":n,"aria-pressed":x&&v===i0?!0:void 0,"aria-roledescription":m,"aria-describedby":f.draggable}),[n,v,g,x,m,f.draggable]);return{active:u,activatorEvent:c,activeNodeRect:d,attributes:E,isDragging:x,listeners:n?void 0:A,node:C,over:p,setNodeRef:_,setActivatorNodeRef:S,transform:b}}function oL(){return y.useContext(x5)}const aL="Droppable",sL={timeout:25};function iL(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=ci(aL),{active:s,dispatch:c,over:u,measureDroppableContainers:d}=y.useContext(ic),f=y.useRef({disabled:r}),h=y.useRef(!1),p=y.useRef(null),v=y.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:x}={...sL,...o},b=Is(g??n),C=y.useCallback(()=>{if(!h.current){h.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(b.current)?b.current:[b.current]),v.current=null},x)},[x]),_=sc({callback:C,disabled:m||!s}),w=y.useCallback((E,k)=>{_&&(k&&(_.unobserve(k),h.current=!1),E&&_.observe(E))},[_]),[S,A]=jl(w),T=Is(t);return y.useEffect(()=>{!_||!S.current||(_.disconnect(),h.current=!1,_.observe(S.current))},[S,_]),y.useEffect(()=>(c({type:Ft.RegisterDroppable,element:{id:n,key:a,disabled:r,node:S,rect:p,data:T}}),()=>c({type:Ft.UnregisterDroppable,key:a,id:n})),[n]),y.useEffect(()=>{r!==f.current.disabled&&(c({type:Ft.SetDroppableDisabled,id:n,key:a,disabled:r}),f.current.disabled=r)},[n,a,r,c]),{active:s,rect:p,isOver:(u==null?void 0:u.id)===n,node:S,over:u,setNodeRef:A}}function b5(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function lL(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function Ai(e){return e!==null&&e>=0}function cL(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function uL(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const C5=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=b5(t,n,r),s=t[o],c=a[o];return!c||!s?null:{x:c.left-s.left,y:c.top-s.top,scaleX:c.width/s.width,scaleY:c.height/s.height}},Li={scaleX:1,scaleY:1},dL=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:o,rects:a,overIndex:s}=e;const c=(t=a[r])!=null?t:n;if(!c)return null;if(o===r){const d=a[s];return d?{x:0,y:r<s?d.top+d.height-(c.top+c.height):d.top-c.top,...Li}:null}const u=fL(a,o,r);return o>r&&o<=s?{x:0,y:-c.height-u,...Li}:o<r&&o>=s?{x:0,y:c.height+u,...Li}:{x:0,y:0,...Li}};function fL(e,t,r){const n=e[t],o=e[t-1],a=e[t+1];return n?r<t?o?n.top-(o.top+o.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):o?n.top-(o.top+o.height):0:0}const w5="Sortable",S5=y.createContext({activeIndex:-1,containerId:w5,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:C5,disabled:{draggable:!1,droppable:!1}});function hL(e){let{children:t,id:r,items:n,strategy:o=C5,disabled:a=!1}=e;const{active:s,dragOverlay:c,droppableRects:u,over:d,measureDroppableContainers:f}=oL(),h=ci(w5,r),p=c.rect!==null,v=y.useMemo(()=>n.map(A=>typeof A=="object"&&"id"in A?A.id:A),[n]),m=s!=null,g=s?v.indexOf(s.id):-1,x=d?v.indexOf(d.id):-1,b=y.useRef(v),C=!cL(v,b.current),_=x!==-1&&g===-1||C,w=uL(a);gn(()=>{C&&m&&f(v)},[C,v,m,f]),y.useEffect(()=>{b.current=v},[v]);const S=y.useMemo(()=>({activeIndex:g,containerId:h,disabled:w,disableTransforms:_,items:v,overIndex:x,useDragOverlay:p,sortedRects:lL(v,u),strategy:o}),[g,h,w.draggable,w.droppable,_,v,x,u,p,o]);return y.createElement(S5.Provider,{value:S},t)}const pL=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return b5(r,n,o).indexOf(t)},mL=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:s,previousItems:c,previousContainerId:u,transition:d}=e;return!d||!n||c!==a&&o===s?!1:r?!0:s!==o&&t===u},gL={duration:200,easing:"ease"},E5="transform",vL=Fs.Transition.toString({property:E5,duration:0,easing:"linear"}),xL={roleDescription:"sortable"};function yL(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,s]=y.useState(null),c=y.useRef(r);return gn(()=>{if(!t&&r!==c.current&&n.current){const u=o.current;if(u){const d=Ua(n.current,{ignoreTransform:!0}),f={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(f.x||f.y)&&s(f)}}r!==c.current&&(c.current=r)},[t,r,n,o]),y.useEffect(()=>{a&&s(null)},[a]),a}function bL(e){let{animateLayoutChanges:t=mL,attributes:r,disabled:n,data:o,getNewIndex:a=pL,id:s,strategy:c,resizeObserverConfig:u,transition:d=gL}=e;const{items:f,containerId:h,activeIndex:p,disabled:v,disableTransforms:m,sortedRects:g,overIndex:x,useDragOverlay:b,strategy:C}=y.useContext(S5),_=CL(n,v),w=f.indexOf(s),S=y.useMemo(()=>({sortable:{containerId:h,index:w,items:f},...o}),[h,o,w,f]),A=y.useMemo(()=>f.slice(f.indexOf(s)),[f,s]),{rect:T,node:E,isOver:k,setNodeRef:R}=iL({id:s,data:S,disabled:_.droppable,resizeObserverConfig:{updateMeasurementsFor:A,...u}}),{active:D,activatorEvent:M,activeNodeRect:G,attributes:V,setNodeRef:Q,listeners:H,isDragging:K,over:te,setActivatorNodeRef:ee,transform:W}=nL({id:s,data:S,attributes:{...xL,...r},disabled:_.draggable}),U=Fk(R,Q),O=!!D,q=O&&!m&&Ai(p)&&Ai(x),Y=!b&&K,ce=Y&&q?W:null,ue=q?ce??(c??C)({rects:g,activeNodeRect:G,activeIndex:p,overIndex:x,index:w}):null,ie=Ai(p)&&Ai(x)?a({id:s,items:f,activeIndex:p,overIndex:x}):w,ve=D==null?void 0:D.id,re=y.useRef({activeId:ve,items:f,newIndex:ie,containerId:h}),We=f!==re.current.items,$=t({active:D,containerId:h,isDragging:K,isSorting:O,id:s,index:w,items:f,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:d,wasDragging:re.current.activeId!=null}),pe=yL({disabled:!$,index:w,node:E,rect:T});return y.useEffect(()=>{O&&re.current.newIndex!==ie&&(re.current.newIndex=ie),h!==re.current.containerId&&(re.current.containerId=h),f!==re.current.items&&(re.current.items=f)},[O,ie,h,f]),y.useEffect(()=>{if(ve===re.current.activeId)return;if(ve!=null&&re.current.activeId==null){re.current.activeId=ve;return}const Ae=setTimeout(()=>{re.current.activeId=ve},50);return()=>clearTimeout(Ae)},[ve]),{active:D,activeIndex:p,attributes:V,data:S,rect:T,index:w,newIndex:ie,items:f,isOver:k,isSorting:O,isDragging:K,listeners:H,node:E,overIndex:x,over:te,setNodeRef:U,setActivatorNodeRef:ee,setDroppableNodeRef:R,setDraggableNodeRef:Q,transform:pe??ue,transition:ye()};function ye(){if(pe||We&&re.current.newIndex===w)return vL;if(!(Y&&!_1(M)||!d)&&(O||$))return Fs.Transition.toString({...d,property:E5})}}function CL(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}Je.Down,Je.Right,Je.Up,Je.Left;const wL="_wrapper_3dnl4_1",SL="_label_3dnl4_10",EL="_textarea_3dnl4_18",jL="_length_3dnl4_46",Di={wrapper:wL,label:SL,textarea:EL,length:jL},_L=e=>{const{onChange:t,label:r,value:n,maxLength:o,placeholder:a="Type something..."}=e,[s,c]=y.useState(n.length);return l.jsxs("div",{className:Di.wrapper,children:[r&&l.jsx("label",{className:Di.label,htmlFor:r,children:r}),l.jsx("textarea",{id:r,defaultValue:n,onChange:u=>{c(u.target.value.length),t(u.target.value)},placeholder:a,className:Di.textarea,maxLength:o}),o&&l.jsxs("div",{className:Di.length,children:[s,"/",o]})]})};exports.API_URL=wa;exports.BillgangProvider=zx;exports.Button=zu;exports.CSS=Fs;exports.ChooseImage=jk;exports.ChooseImageModal=_k;exports.DndContext=eL;exports.Fuse=zo;exports.GOOGLE_FONTS_API=T6;exports.Icon=dn;exports.Input=Ik;exports.Loader=p7;exports.Modal=o7;exports.PointerSensor=R1;exports.RouterProvider=l6;exports.Select=m4;exports.SortableContext=hL;exports.Switch=u7;exports.Textarea=_L;exports.axios=gt;exports.charge_default=mR;exports.checkout_app_default=gP;exports.clx=Qt;exports.createBrowserRouter=t6;exports.customerDashboard_default=zN;exports.deletePage=m8;exports.getDynamicPage=y8;exports.getThemeAndSettings=b8;exports.jsxRuntimeExports=l;exports.navbarBlocks=P0;exports.order_default=AR;exports.request=fo;exports.resetSettings=x8;exports.sizeOptions=P6;exports.subscription_default=hk;exports.top_up_balance_default=yR;exports.updateSettings=p8;exports.useBlocksStore=j6;exports.useCart=ni;exports.useChooseImageStore=sd;exports.useColorPickerStore=$6;exports.useConfirmationModalStore=Z6;exports.useDeviceStore=_6;exports.useErrorStore=z6;exports.useFontsStore=H6;exports.useHistoryStore=oa;exports.useLayersStore=as;exports.useLocation=co;exports.useModalStore=id;exports.useNavbarStore=R6;exports.useNavigate=Hr;exports.useNotificationStore=W6;exports.usePagesStore=R0;exports.usePreviewStore=L6;exports.useSensor=Jk;exports.useSensors=Qk;exports.useSettingsStore=V6;exports.useShareLinkStore=U6;exports.useSortable=bL;exports.useSubmodalStore=F6;exports.useThemeSettingsStore=B6;exports.useTooltipStore=G6;exports.v4=Ki;exports.verticalListSortingStrategy=dL;exports.weightOptions=N6;
|
|
154
|
+
`},Yk={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Kk(e){let{announcements:t=Yk,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=qk}=e;const{announce:a,announcement:s}=zk(),c=ci("DndLiveRegion"),[u,d]=y.useState(!1);if(y.useEffect(()=>{d(!0)},[]),Zk(y.useMemo(()=>({onDragStart(h){let{active:p}=h;a(t.onDragStart({active:p}))},onDragMove(h){let{active:p,over:v}=h;t.onDragMove&&a(t.onDragMove({active:p,over:v}))},onDragOver(h){let{active:p,over:v}=h;a(t.onDragOver({active:p,over:v}))},onDragEnd(h){let{active:p,over:v}=h;a(t.onDragEnd({active:p,over:v}))},onDragCancel(h){let{active:p,over:v}=h;a(t.onDragCancel({active:p,over:v}))}}),[a,t])),!u)return null;const f=y.createElement(y.Fragment,null,y.createElement(Uk,{id:n,value:o.draggable}),y.createElement(Wk,{id:c,announcement:s}));return r?Ur.createPortal(f,r):f}var Ft;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ft||(Ft={}));function Tl(){}function Xk(e,t){return y.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Jk(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return y.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Kr=Object.freeze({x:0,y:0});function Qk(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function eA(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function tA(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=o-n,c=a-r;if(n<o&&r<a){const u=t.width*t.height,d=e.width*e.height,f=s*c,h=f/(u+d-f);return Number(h.toFixed(4))}return 0}const rA=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:s}=a,c=r.get(s);if(c){const u=tA(c,t);u>0&&o.push({id:s,data:{droppableContainer:a,value:u}})}}return o.sort(Qk)};function nA(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function i5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Kr}function oA(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((s,c)=>({...s,top:s.top+e*c.y,bottom:s.bottom+e*c.y,left:s.left+e*c.x,right:s.right+e*c.x}),{...r})}}const aA=oA(1);function sA(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function iA(e,t,r){const n=sA(t);if(!n)return e;const{scaleX:o,scaleY:a,x:s,y:c}=n,u=e.left-s-(1-o)*parseFloat(r),d=e.top-c-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),f=o?e.width/o:e.width,h=a?e.height/a:e.height;return{width:f,height:h,top:d,right:u+f,bottom:d+h,left:u}}const lA={ignoreTransform:!1};function Ua(e,t){t===void 0&&(t=lA);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=yr(e).getComputedStyle(e);d&&(r=iA(r,d,f))}const{top:n,left:o,width:a,height:s,bottom:c,right:u}=r;return{top:n,left:o,width:a,height:s,bottom:c,right:u}}function Jh(e){return Ua(e,{ignoreTransform:!0})}function cA(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function uA(e,t){return t===void 0&&(t=yr(e).getComputedStyle(e)),t.position==="fixed"}function dA(e,t){t===void 0&&(t=yr(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?r.test(a):!1})}function T1(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(E1(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!ii(o)||o5(o)||r.includes(o))return r;const a=yr(e).getComputedStyle(o);return o!==e&&dA(o,a)&&r.push(o),uA(o,a)?r:n(o.parentNode)}return e?n(e):r}function l5(e){const[t]=T1(e,1);return t??null}function Zc(e){return!ac||!e?null:Va(e)?e:S1(e)?E1(e)||e===$a(e).scrollingElement?window:ii(e)?e:null:null}function c5(e){return Va(e)?e.scrollX:e.scrollLeft}function u5(e){return Va(e)?e.scrollY:e.scrollTop}function qu(e){return{x:c5(e),y:u5(e)}}var $t;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})($t||($t={}));function d5(e){return!ac||!e?!1:e===document.scrollingElement}function f5(e){const t={x:0,y:0},r=d5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,c=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:s,isRight:c,maxScroll:n,minScroll:t}}const fA={x:.2,y:.2};function hA(e,t,r,n,o){let{top:a,left:s,right:c,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=fA);const{isTop:d,isBottom:f,isLeft:h,isRight:p}=f5(e),v={x:0,y:0},m={x:0,y:0},g={height:t.height*o.y,width:t.width*o.x};return!d&&a<=t.top+g.height?(v.y=$t.Backward,m.y=n*Math.abs((t.top+g.height-a)/g.height)):!f&&u>=t.bottom-g.height&&(v.y=$t.Forward,m.y=n*Math.abs((t.bottom-g.height-u)/g.height)),!p&&c>=t.right-g.width?(v.x=$t.Forward,m.x=n*Math.abs((t.right-g.width-c)/g.width)):!h&&s<=t.left+g.width&&(v.x=$t.Backward,m.x=n*Math.abs((t.left+g.width-s)/g.width)),{direction:v,speed:m}}function pA(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}const{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function h5(e){return e.reduce((t,r)=>ha(t,qu(r)),Kr)}function mA(e){return e.reduce((t,r)=>t+c5(r),0)}function gA(e){return e.reduce((t,r)=>t+u5(r),0)}function vA(e,t){if(t===void 0&&(t=Ua),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);l5(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const xA=[["x",["left","right"],mA],["y",["top","bottom"],gA]];class P1{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=T1(r),o=h5(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,c]of xA)for(const u of s)Object.defineProperty(this,u,{get:()=>{const d=c(n),f=o[a]-d;return this.rect[u]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class us{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var o;(o=this.target)==null||o.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function yA(e){const{EventTarget:t}=yr(e);return e instanceof t?e:$a(e)}function Gc(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Mr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Mr||(Mr={}));function Qh(e){e.preventDefault()}function bA(e){e.stopPropagation()}var Je;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Je||(Je={}));const p5={start:[Je.Space,Je.Enter],cancel:[Je.Esc],end:[Je.Space,Je.Enter,Je.Tab]},CA=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Je.Right:return{...r,x:r.x+25};case Je.Left:return{...r,x:r.x-25};case Je.Down:return{...r,y:r.y+25};case Je.Up:return{...r,y:r.y-25}}};class m5{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new us($a(r)),this.windowListeners=new us(yr(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Mr.Resize,this.handleCancel),this.windowListeners.add(Mr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Mr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&vA(n),r(Kr)}handleKeyDown(t){if(_1(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=p5,coordinateGetter:s=CA,scrollBehavior:c="smooth"}=o,{code:u}=t;if(a.end.includes(u)){this.handleEnd(t);return}if(a.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=n.current,f=d?{x:d.left,y:d.top}:Kr;this.referenceCoordinates||(this.referenceCoordinates=f);const h=s(t,{active:r,context:n.current,currentCoordinates:f});if(h){const p=_l(h,f),v={x:0,y:0},{scrollableAncestors:m}=n.current;for(const g of m){const x=t.code,{isTop:b,isRight:C,isLeft:_,isBottom:w,maxScroll:S,minScroll:A}=f5(g),T=pA(g),E={x:Math.min(x===Je.Right?T.right-T.width/2:T.right,Math.max(x===Je.Right?T.left:T.left+T.width/2,h.x)),y:Math.min(x===Je.Down?T.bottom-T.height/2:T.bottom,Math.max(x===Je.Down?T.top:T.top+T.height/2,h.y))},k=x===Je.Right&&!C||x===Je.Left&&!_,R=x===Je.Down&&!w||x===Je.Up&&!b;if(k&&E.x!==h.x){const D=g.scrollLeft+p.x,M=x===Je.Right&&D<=S.x||x===Je.Left&&D>=A.x;if(M&&!p.y){g.scrollTo({left:D,behavior:c});return}M?v.x=g.scrollLeft-D:v.x=x===Je.Right?g.scrollLeft-S.x:g.scrollLeft-A.x,v.x&&g.scrollBy({left:-v.x,behavior:c});break}else if(R&&E.y!==h.y){const D=g.scrollTop+p.y,M=x===Je.Down&&D<=S.y||x===Je.Up&&D>=A.y;if(M&&!p.x){g.scrollTo({top:D,behavior:c});return}M?v.y=g.scrollTop-D:v.y=x===Je.Down?g.scrollTop-S.y:g.scrollTop-A.y,v.y&&g.scrollBy({top:-v.y,behavior:c});break}}this.handleMove(t,ha(_l(h,this.referenceCoordinates),v))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}m5.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=p5,onActivation:o}=t,{active:a}=r;const{code:s}=e.nativeEvent;if(n.start.includes(s)){const c=a.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function e0(e){return!!(e&&"distance"in e)}function t0(e){return!!(e&&"delay"in e)}class N1{constructor(t,r,n){var o;n===void 0&&(n=yA(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:s}=a;this.props=t,this.events=r,this.document=$a(s),this.documentListeners=new us(this.document),this.listeners=new us(n),this.windowListeners=new us(yr(s)),this.initialCoordinates=(o=Gu(a))!=null?o:Kr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Mr.Resize,this.handleCancel),this.windowListeners.add(Mr.DragStart,Qh),this.windowListeners.add(Mr.VisibilityChange,this.handleCancel),this.windowListeners.add(Mr.ContextMenu,Qh),this.documentListeners.add(Mr.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(t0(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(e0(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:o}=this.props;o(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Mr.Click,bA,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Mr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:s,options:{activationConstraint:c}}=a;if(!o)return;const u=(r=Gu(t))!=null?r:Kr,d=_l(o,u);if(!n&&c){if(e0(c)){if(c.tolerance!=null&&Gc(d,c.tolerance))return this.handleCancel();if(Gc(d,c.distance))return this.handleStart()}if(t0(c)&&Gc(d,c.tolerance))return this.handleCancel();this.handlePending(c,d);return}t.cancelable&&t.preventDefault(),s(u)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Je.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const wA={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class R1 extends N1{constructor(t){const{event:r}=t,n=$a(r.target);super(t,wA,n)}}R1.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const SA={move:{name:"mousemove"},end:{name:"mouseup"}};var Yu;(function(e){e[e.RightClick=2]="RightClick"})(Yu||(Yu={}));class EA extends N1{constructor(t){super(t,SA,$a(t.event.target))}}EA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Yu.RightClick?!1:(n==null||n({event:r}),!0)}}];const qc={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class jA extends N1{constructor(t){super(t,qc)}static setup(){return window.addEventListener(qc.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(qc.move.name,t)};function t(){}}}jA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:o}=r;return o.length>1?!1:(n==null||n({event:r}),!0)}}];var ds;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ds||(ds={}));var Pl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Pl||(Pl={}));function _A(e){let{acceleration:t,activator:r=ds.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:s=5,order:c=Pl.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:p}=e;const v=PA({delta:h,disabled:!a}),[m,g]=Fk(),x=y.useRef({x:0,y:0}),b=y.useRef({x:0,y:0}),C=y.useMemo(()=>{switch(r){case ds.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case ds.DraggableRect:return o}},[r,o,u]),_=y.useRef(null),w=y.useCallback(()=>{const A=_.current;if(!A)return;const T=x.current.x*b.current.x,E=x.current.y*b.current.y;A.scrollBy(T,E)},[]),S=y.useMemo(()=>c===Pl.TreeOrder?[...d].reverse():d,[c,d]);y.useEffect(()=>{if(!a||!d.length||!C){g();return}for(const A of S){if((n==null?void 0:n(A))===!1)continue;const T=d.indexOf(A),E=f[T];if(!E)continue;const{direction:k,speed:R}=hA(A,E,C,t,p);for(const D of["x","y"])v[D][k[D]]||(R[D]=0,k[D]=0);if(R.x>0||R.y>0){g(),_.current=A,m(w,s),x.current=R,b.current=k;return}}x.current={x:0,y:0},b.current={x:0,y:0},g()},[t,w,n,g,a,s,JSON.stringify(C),JSON.stringify(v),m,d,S,f,JSON.stringify(p)])}const TA={x:{[$t.Backward]:!1,[$t.Forward]:!1},y:{[$t.Backward]:!1,[$t.Forward]:!1}};function PA(e){let{delta:t,disabled:r}=e;const n=Zu(t);return li(o=>{if(r||!n||!o)return TA;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[$t.Backward]:o.x[$t.Backward]||a.x===-1,[$t.Forward]:o.x[$t.Forward]||a.x===1},y:{[$t.Backward]:o.y[$t.Backward]||a.y===-1,[$t.Forward]:o.y[$t.Forward]||a.y===1}}},[r,t,n])}function NA(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return li(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function RA(e,t){return y.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,n)}));return[...r,...a]},[]),[e,t])}var Bs;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Bs||(Bs={}));var Ku;(function(e){e.Optimized="optimized"})(Ku||(Ku={}));const r0=new Map;function kA(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,s]=y.useState(null),{frequency:c,measure:u,strategy:d}=o,f=y.useRef(e),h=x(),p=Is(h),v=y.useCallback(function(b){b===void 0&&(b=[]),!p.current&&s(C=>C===null?b:C.concat(b.filter(_=>!C.includes(_))))},[p]),m=y.useRef(null),g=li(b=>{if(h&&!r)return r0;if(!b||b===r0||f.current!==e||a!=null){const C=new Map;for(let _ of e){if(!_)continue;if(a&&a.length>0&&!a.includes(_.id)&&_.rect.current){C.set(_.id,_.rect.current);continue}const w=_.node.current,S=w?new P1(u(w),w):null;_.rect.current=S,S&&C.set(_.id,S)}return C}return b},[e,a,r,h,u]);return y.useEffect(()=>{f.current=e},[e]),y.useEffect(()=>{h||v()},[r,h]),y.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),y.useEffect(()=>{h||typeof c!="number"||m.current!==null||(m.current=setTimeout(()=>{v(),m.current=null},c))},[c,h,v,...n]),{droppableRects:g,measureDroppableContainers:v,measuringScheduled:a!=null};function x(){switch(d){case Bs.Always:return!1;case Bs.BeforeDragging:return r;default:return!r}}}function g5(e,t){return li(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function AA(e,t){return g5(e,t)}function LA(e){let{callback:t,disabled:r}=e;const n=j1(t),o=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return y.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function sc(e){let{callback:t,disabled:r}=e;const n=j1(t),o=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return y.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function DA(e){return new P1(Ua(e),e)}function n0(e,t,r){t===void 0&&(t=DA);const[n,o]=y.useState(null);function a(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??r)!=null?d:null}const f=t(e);return JSON.stringify(u)===JSON.stringify(f)?u:f})}const s=LA({callback(u){if(e)for(const d of u){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){a();break}}}}),c=sc({callback:a});return gn(()=>{a(),e?(c==null||c.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(c==null||c.disconnect(),s==null||s.disconnect())},[e]),n}function OA(e){const t=g5(e);return i5(e,t)}const o0=[];function MA(e){const t=y.useRef(e),r=li(n=>e?n&&n!==o0&&e&&t.current&&e.parentNode===t.current.parentNode?n:T1(e):o0,[e]);return y.useEffect(()=>{t.current=e},[e]),r}function IA(e){const[t,r]=y.useState(null),n=y.useRef(e),o=y.useCallback(a=>{const s=Zc(a.target);s&&r(c=>c?(c.set(s,qu(s)),new Map(c)):null)},[]);return y.useEffect(()=>{const a=n.current;if(e!==a){s(a);const c=e.map(u=>{const d=Zc(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,qu(d)]):null}).filter(u=>u!=null);r(c.length?new Map(c):null),n.current=e}return()=>{s(e),s(a)};function s(c){c.forEach(u=>{const d=Zc(u);d==null||d.removeEventListener("scroll",o)})}},[o,e]),y.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>ha(a,s),Kr):h5(e):Kr,[e,t])}function a0(e,t){t===void 0&&(t=[]);const r=y.useRef(null);return y.useEffect(()=>{r.current=null},t),y.useEffect(()=>{const n=e!==Kr;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?_l(e,r.current):Kr}function FA(e){y.useEffect(()=>{if(!ac)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function BA(e,t){return y.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=s=>{a(s,t)},r},{}),[e,t])}function v5(e){return y.useMemo(()=>e?cA(e):null,[e])}const s0=[];function HA(e,t){t===void 0&&(t=Ua);const[r]=e,n=v5(r?yr(r):null),[o,a]=y.useState(s0);function s(){a(()=>e.length?e.map(u=>d5(u)?n:new P1(t(u),u)):s0)}const c=sc({callback:s});return gn(()=>{c==null||c.disconnect(),s(),e.forEach(u=>c==null?void 0:c.observe(u))},[e]),o}function VA(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ii(t)?t:e}function $A(e){let{measure:t}=e;const[r,n]=y.useState(null),o=y.useCallback(d=>{for(const{target:f}of d)if(ii(f)){n(h=>{const p=t(f);return h?{...h,width:p.width,height:p.height}:p});break}},[t]),a=sc({callback:o}),s=y.useCallback(d=>{const f=VA(d);a==null||a.disconnect(),f&&(a==null||a.observe(f)),n(f?t(f):null)},[t,a]),[c,u]=jl(s);return y.useMemo(()=>({nodeRef:c,rect:r,setRef:u}),[r,c,u])}const UA=[{sensor:R1,options:{}},{sensor:m5,options:{}}],WA={current:{}},zi={draggable:{measure:Jh},droppable:{measure:Jh,strategy:Bs.WhileDragging,frequency:Ku.Optimized},dragOverlay:{measure:Ua}};class fs extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const zA={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new fs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Tl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:zi,measureDroppableContainers:Tl,windowRect:null,measuringScheduled:!1},ZA={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Tl,draggableNodes:new Map,over:null,measureDroppableContainers:Tl},ic=y.createContext(ZA),x5=y.createContext(zA);function GA(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new fs}}}function qA(e,t){switch(t.type){case Ft.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ft.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ft.DragEnd:case Ft.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ft.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new fs(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case Ft.SetDroppableDisabled:{const{id:r,key:n,disabled:o}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const s=new fs(e.droppable.containers);return s.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case Ft.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new fs(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function YA(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=y.useContext(ic),a=Zu(n),s=Zu(r==null?void 0:r.id);return y.useEffect(()=>{if(!t&&!n&&a&&s!=null){if(!_1(a)||document.activeElement===a.target)return;const c=o.get(s);if(!c)return;const{activatorNode:u,node:d}=c;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[u.current,d.current]){if(!f)continue;const h=Vk(f);if(h){h.focus();break}}})}},[n,t,o,s,a]),null}function KA(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function XA(e){return y.useMemo(()=>({draggable:{...zi.draggable,...e==null?void 0:e.draggable},droppable:{...zi.droppable,...e==null?void 0:e.droppable},dragOverlay:{...zi.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function JA(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=y.useRef(!1),{x:s,y:c}=typeof o=="boolean"?{x:o,y:o}:o;gn(()=>{if(!s&&!c||!t){a.current=!1;return}if(a.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=r(d),h=i5(f,n);if(s||(h.x=0),c||(h.y=0),a.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const p=l5(d);p&&p.scrollBy({top:h.y,left:h.x})}},[t,s,c,n,r])}const y5=y.createContext({...Kr,scaleX:1,scaleY:1});var Zn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Zn||(Zn={}));const QA=y.memo(function(t){var r,n,o,a;let{id:s,accessibility:c,autoScroll:u=!0,children:d,sensors:f=UA,collisionDetection:h=rA,measuring:p,modifiers:v,...m}=t;const g=y.useReducer(qA,void 0,GA),[x,b]=g,[C,_]=Gk(),[w,S]=y.useState(Zn.Uninitialized),A=w===Zn.Initialized,{draggable:{active:T,nodes:E,translate:k},droppable:{containers:R}}=x,D=T!=null?E.get(T):null,M=y.useRef({initial:null,translated:null}),G=y.useMemo(()=>{var Ze;return T!=null?{id:T,data:(Ze=D==null?void 0:D.data)!=null?Ze:WA,rect:M}:null},[T,D]),V=y.useRef(null),[Q,H]=y.useState(null),[K,te]=y.useState(null),ee=Is(m,Object.values(m)),W=ci("DndDescribedBy",s),U=y.useMemo(()=>R.getEnabled(),[R]),O=XA(p),{droppableRects:q,measureDroppableContainers:Y,measuringScheduled:ce}=kA(U,{dragging:A,dependencies:[k.x,k.y],config:O.droppable}),J=NA(E,T),ue=y.useMemo(()=>K?Gu(K):null,[K]),ie=xt(),ve=AA(J,O.draggable.measure);JA({activeNode:T!=null?E.get(T):null,config:ie.layoutShiftCompensation,initialRect:ve,measure:O.draggable.measure});const re=n0(J,O.draggable.measure,ve),We=n0(J?J.parentElement:null),$=y.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pe=R.getNodeFor((r=$.current.over)==null?void 0:r.id),ye=$A({measure:O.dragOverlay.measure}),Ae=(n=ye.nodeRef.current)!=null?n:J,Fe=A?(o=ye.rect)!=null?o:re:null,Oe=!!(ye.nodeRef.current&&ye.rect),de=OA(Oe?null:re),be=v5(Ae?yr(Ae):null),Be=MA(A?pe??J:null),Re=HA(Be),Qe=KA(v,{transform:{x:k.x-de.x,y:k.y-de.y,scaleX:1,scaleY:1},activatorEvent:K,active:G,activeNodeRect:re,containerNodeRect:We,draggingNodeRect:Fe,over:$.current.over,overlayNodeRect:ye.rect,scrollableAncestors:Be,scrollableAncestorRects:Re,windowRect:be}),st=ue?ha(ue,k):null,Nt=IA(Be),_t=a0(Nt),At=a0(Nt,[re]),it=ha(Qe,_t),Yt=Fe?aA(Fe,Qe):null,Rt=G&&Yt?h({active:G,collisionRect:Yt,droppableRects:q,droppableContainers:U,pointerCoordinates:st}):null,It=eA(Rt,"id"),[Ye,lr]=y.useState(null),br=Oe?Qe:ha(Qe,At),xo=nA(br,(a=Ye==null?void 0:Ye.rect)!=null?a:null,re),Ht=y.useRef(null),Kt=y.useCallback((Ze,ut)=>{let{sensor:wt,options:cr}=ut;if(V.current==null)return;const Wt=E.get(V.current);if(!Wt)return;const Vt=Ze.nativeEvent,rr=new wt({active:V.current,activeNode:Wt,event:Vt,options:cr,context:$,onAbort(yt){if(!E.get(yt))return;const{onDragAbort:Xt}=ee.current,ur={id:yt};Xt==null||Xt(ur),C({type:"onDragAbort",event:ur})},onPending(yt,nr,Xt,ur){if(!E.get(yt))return;const{onDragPending:N}=ee.current,L={id:yt,constraint:nr,initialCoordinates:Xt,offset:ur};N==null||N(L),C({type:"onDragPending",event:L})},onStart(yt){const nr=V.current;if(nr==null)return;const Xt=E.get(nr);if(!Xt)return;const{onDragStart:ur}=ee.current,xn={activatorEvent:Vt,active:{id:nr,data:Xt.data,rect:M}};Ur.unstable_batchedUpdates(()=>{ur==null||ur(xn),S(Zn.Initializing),b({type:Ft.DragStart,initialCoordinates:yt,active:nr}),C({type:"onDragStart",event:xn}),H(Ht.current),te(Vt)})},onMove(yt){b({type:Ft.DragMove,coordinates:yt})},onEnd:Lr(Ft.DragEnd),onCancel:Lr(Ft.DragCancel)});Ht.current=rr;function Lr(yt){return async function(){const{active:Xt,collisions:ur,over:xn,scrollAdjustedTranslate:N}=$.current;let L=null;if(Xt&&N){const{cancelDrop:B}=ee.current;L={activatorEvent:Vt,active:Xt,collisions:ur,delta:N,over:xn},yt===Ft.DragEnd&&typeof B=="function"&&await Promise.resolve(B(L))&&(yt=Ft.DragCancel)}V.current=null,Ur.unstable_batchedUpdates(()=>{b({type:yt}),S(Zn.Uninitialized),lr(null),H(null),te(null),Ht.current=null;const B=yt===Ft.DragEnd?"onDragEnd":"onDragCancel";if(L){const j=ee.current[B];j==null||j(L),C({type:B,event:L})}})}}},[E]),In=y.useCallback((Ze,ut)=>(wt,cr)=>{const Wt=wt.nativeEvent,Vt=E.get(cr);if(V.current!==null||!Vt||Wt.dndKit||Wt.defaultPrevented)return;const rr={active:Vt};Ze(wt,ut.options,rr)===!0&&(Wt.dndKit={capturedBy:ut.sensor},V.current=cr,Kt(wt,ut))},[E,Kt]),_e=RA(f,In);FA(f),gn(()=>{re&&w===Zn.Initializing&&S(Zn.Initialized)},[re,w]),y.useEffect(()=>{const{onDragMove:Ze}=ee.current,{active:ut,activatorEvent:wt,collisions:cr,over:Wt}=$.current;if(!ut||!wt)return;const Vt={active:ut,activatorEvent:wt,collisions:cr,delta:{x:it.x,y:it.y},over:Wt};Ur.unstable_batchedUpdates(()=>{Ze==null||Ze(Vt),C({type:"onDragMove",event:Vt})})},[it.x,it.y]),y.useEffect(()=>{const{active:Ze,activatorEvent:ut,collisions:wt,droppableContainers:cr,scrollAdjustedTranslate:Wt}=$.current;if(!Ze||V.current==null||!ut||!Wt)return;const{onDragOver:Vt}=ee.current,rr=cr.get(It),Lr=rr&&rr.rect.current?{id:rr.id,rect:rr.rect.current,data:rr.data,disabled:rr.disabled}:null,yt={active:Ze,activatorEvent:ut,collisions:wt,delta:{x:Wt.x,y:Wt.y},over:Lr};Ur.unstable_batchedUpdates(()=>{lr(Lr),Vt==null||Vt(yt),C({type:"onDragOver",event:yt})})},[It]),gn(()=>{$.current={activatorEvent:K,active:G,activeNode:J,collisionRect:Yt,collisions:Rt,droppableRects:q,draggableNodes:E,draggingNode:Ae,draggingNodeRect:Fe,droppableContainers:R,over:Ye,scrollableAncestors:Be,scrollAdjustedTranslate:it},M.current={initial:Fe,translated:Yt}},[G,J,Rt,Yt,E,Ae,Fe,q,R,Ye,Be,it]),_A({...ie,delta:k,draggingRect:Yt,pointerCoordinates:st,scrollableAncestors:Be,scrollableAncestorRects:Re});const qe=y.useMemo(()=>({active:G,activeNode:J,activeNodeRect:re,activatorEvent:K,collisions:Rt,containerNodeRect:We,dragOverlay:ye,draggableNodes:E,droppableContainers:R,droppableRects:q,over:Ye,measureDroppableContainers:Y,scrollableAncestors:Be,scrollableAncestorRects:Re,measuringConfiguration:O,measuringScheduled:ce,windowRect:be}),[G,J,re,K,Rt,We,ye,E,R,q,Ye,Y,Be,Re,O,ce,be]),ze=y.useMemo(()=>({activatorEvent:K,activators:_e,active:G,activeNodeRect:re,ariaDescribedById:{draggable:W},dispatch:b,draggableNodes:E,over:Ye,measureDroppableContainers:Y}),[K,_e,G,re,b,W,E,Ye,Y]);return y.createElement(s5.Provider,{value:_},y.createElement(ic.Provider,{value:ze},y.createElement(x5.Provider,{value:qe},y.createElement(y5.Provider,{value:xo},d)),y.createElement(YA,{disabled:(c==null?void 0:c.restoreFocus)===!1})),y.createElement(Kk,{...c,hiddenTextDescribedById:W}));function xt(){const Ze=(Q==null?void 0:Q.autoScrollEnabled)===!1,ut=typeof u=="object"?u.enabled===!1:u===!1,wt=A&&!Ze&&!ut;return typeof u=="object"?{...u,enabled:wt}:{enabled:wt}}}),eL=y.createContext(null),i0="button",tL="Draggable";function rL(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=ci(tL),{activators:s,activatorEvent:c,active:u,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:p}=y.useContext(ic),{role:v=i0,roleDescription:m="draggable",tabIndex:g=0}=o??{},x=(u==null?void 0:u.id)===t,b=y.useContext(x?y5:eL),[C,_]=jl(),[w,S]=jl(),A=BA(s,t),T=Is(r);gn(()=>(h.set(t,{id:t,key:a,node:C,activatorNode:w,data:T}),()=>{const k=h.get(t);k&&k.key===a&&h.delete(t)}),[h,t]);const E=y.useMemo(()=>({role:v,tabIndex:g,"aria-disabled":n,"aria-pressed":x&&v===i0?!0:void 0,"aria-roledescription":m,"aria-describedby":f.draggable}),[n,v,g,x,m,f.draggable]);return{active:u,activatorEvent:c,activeNodeRect:d,attributes:E,isDragging:x,listeners:n?void 0:A,node:C,over:p,setNodeRef:_,setActivatorNodeRef:S,transform:b}}function nL(){return y.useContext(x5)}const oL="Droppable",aL={timeout:25};function sL(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=ci(oL),{active:s,dispatch:c,over:u,measureDroppableContainers:d}=y.useContext(ic),f=y.useRef({disabled:r}),h=y.useRef(!1),p=y.useRef(null),v=y.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:x}={...aL,...o},b=Is(g??n),C=y.useCallback(()=>{if(!h.current){h.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(b.current)?b.current:[b.current]),v.current=null},x)},[x]),_=sc({callback:C,disabled:m||!s}),w=y.useCallback((E,k)=>{_&&(k&&(_.unobserve(k),h.current=!1),E&&_.observe(E))},[_]),[S,A]=jl(w),T=Is(t);return y.useEffect(()=>{!_||!S.current||(_.disconnect(),h.current=!1,_.observe(S.current))},[S,_]),y.useEffect(()=>(c({type:Ft.RegisterDroppable,element:{id:n,key:a,disabled:r,node:S,rect:p,data:T}}),()=>c({type:Ft.UnregisterDroppable,key:a,id:n})),[n]),y.useEffect(()=>{r!==f.current.disabled&&(c({type:Ft.SetDroppableDisabled,id:n,key:a,disabled:r}),f.current.disabled=r)},[n,a,r,c]),{active:s,rect:p,isOver:(u==null?void 0:u.id)===n,node:S,over:u,setNodeRef:A}}function b5(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function iL(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function Ai(e){return e!==null&&e>=0}function lL(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function cL(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const C5=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=b5(t,n,r),s=t[o],c=a[o];return!c||!s?null:{x:c.left-s.left,y:c.top-s.top,scaleX:c.width/s.width,scaleY:c.height/s.height}},Li={scaleX:1,scaleY:1},uL=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:o,rects:a,overIndex:s}=e;const c=(t=a[r])!=null?t:n;if(!c)return null;if(o===r){const d=a[s];return d?{x:0,y:r<s?d.top+d.height-(c.top+c.height):d.top-c.top,...Li}:null}const u=dL(a,o,r);return o>r&&o<=s?{x:0,y:-c.height-u,...Li}:o<r&&o>=s?{x:0,y:c.height+u,...Li}:{x:0,y:0,...Li}};function dL(e,t,r){const n=e[t],o=e[t-1],a=e[t+1];return n?r<t?o?n.top-(o.top+o.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):o?n.top-(o.top+o.height):0:0}const w5="Sortable",S5=y.createContext({activeIndex:-1,containerId:w5,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:C5,disabled:{draggable:!1,droppable:!1}});function fL(e){let{children:t,id:r,items:n,strategy:o=C5,disabled:a=!1}=e;const{active:s,dragOverlay:c,droppableRects:u,over:d,measureDroppableContainers:f}=nL(),h=ci(w5,r),p=c.rect!==null,v=y.useMemo(()=>n.map(A=>typeof A=="object"&&"id"in A?A.id:A),[n]),m=s!=null,g=s?v.indexOf(s.id):-1,x=d?v.indexOf(d.id):-1,b=y.useRef(v),C=!lL(v,b.current),_=x!==-1&&g===-1||C,w=cL(a);gn(()=>{C&&m&&f(v)},[C,v,m,f]),y.useEffect(()=>{b.current=v},[v]);const S=y.useMemo(()=>({activeIndex:g,containerId:h,disabled:w,disableTransforms:_,items:v,overIndex:x,useDragOverlay:p,sortedRects:iL(v,u),strategy:o}),[g,h,w.draggable,w.droppable,_,v,x,u,p,o]);return y.createElement(S5.Provider,{value:S},t)}const hL=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return b5(r,n,o).indexOf(t)},pL=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:s,previousItems:c,previousContainerId:u,transition:d}=e;return!d||!n||c!==a&&o===s?!1:r?!0:s!==o&&t===u},mL={duration:200,easing:"ease"},E5="transform",gL=Fs.Transition.toString({property:E5,duration:0,easing:"linear"}),vL={roleDescription:"sortable"};function xL(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,s]=y.useState(null),c=y.useRef(r);return gn(()=>{if(!t&&r!==c.current&&n.current){const u=o.current;if(u){const d=Ua(n.current,{ignoreTransform:!0}),f={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(f.x||f.y)&&s(f)}}r!==c.current&&(c.current=r)},[t,r,n,o]),y.useEffect(()=>{a&&s(null)},[a]),a}function yL(e){let{animateLayoutChanges:t=pL,attributes:r,disabled:n,data:o,getNewIndex:a=hL,id:s,strategy:c,resizeObserverConfig:u,transition:d=mL}=e;const{items:f,containerId:h,activeIndex:p,disabled:v,disableTransforms:m,sortedRects:g,overIndex:x,useDragOverlay:b,strategy:C}=y.useContext(S5),_=bL(n,v),w=f.indexOf(s),S=y.useMemo(()=>({sortable:{containerId:h,index:w,items:f},...o}),[h,o,w,f]),A=y.useMemo(()=>f.slice(f.indexOf(s)),[f,s]),{rect:T,node:E,isOver:k,setNodeRef:R}=sL({id:s,data:S,disabled:_.droppable,resizeObserverConfig:{updateMeasurementsFor:A,...u}}),{active:D,activatorEvent:M,activeNodeRect:G,attributes:V,setNodeRef:Q,listeners:H,isDragging:K,over:te,setActivatorNodeRef:ee,transform:W}=rL({id:s,data:S,attributes:{...vL,...r},disabled:_.draggable}),U=Ik(R,Q),O=!!D,q=O&&!m&&Ai(p)&&Ai(x),Y=!b&&K,ce=Y&&q?W:null,ue=q?ce??(c??C)({rects:g,activeNodeRect:G,activeIndex:p,overIndex:x,index:w}):null,ie=Ai(p)&&Ai(x)?a({id:s,items:f,activeIndex:p,overIndex:x}):w,ve=D==null?void 0:D.id,re=y.useRef({activeId:ve,items:f,newIndex:ie,containerId:h}),We=f!==re.current.items,$=t({active:D,containerId:h,isDragging:K,isSorting:O,id:s,index:w,items:f,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:d,wasDragging:re.current.activeId!=null}),pe=xL({disabled:!$,index:w,node:E,rect:T});return y.useEffect(()=>{O&&re.current.newIndex!==ie&&(re.current.newIndex=ie),h!==re.current.containerId&&(re.current.containerId=h),f!==re.current.items&&(re.current.items=f)},[O,ie,h,f]),y.useEffect(()=>{if(ve===re.current.activeId)return;if(ve!=null&&re.current.activeId==null){re.current.activeId=ve;return}const Ae=setTimeout(()=>{re.current.activeId=ve},50);return()=>clearTimeout(Ae)},[ve]),{active:D,activeIndex:p,attributes:V,data:S,rect:T,index:w,newIndex:ie,items:f,isOver:k,isSorting:O,isDragging:K,listeners:H,node:E,overIndex:x,over:te,setNodeRef:U,setActivatorNodeRef:ee,setDroppableNodeRef:R,setDraggableNodeRef:Q,transform:pe??ue,transition:ye()};function ye(){if(pe||We&&re.current.newIndex===w)return gL;if(!(Y&&!_1(M)||!d)&&(O||$))return Fs.Transition.toString({...d,property:E5})}}function bL(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}Je.Down,Je.Right,Je.Up,Je.Left;const CL="_wrapper_3dnl4_1",wL="_label_3dnl4_10",SL="_textarea_3dnl4_18",EL="_length_3dnl4_46",Di={wrapper:CL,label:wL,textarea:SL,length:EL},jL=e=>{const{onChange:t,label:r,value:n,maxLength:o,placeholder:a="Type something..."}=e,[s,c]=y.useState(n.length);return l.jsxs("div",{className:Di.wrapper,children:[r&&l.jsx("label",{className:Di.label,htmlFor:r,children:r}),l.jsx("textarea",{id:r,defaultValue:n,onChange:u=>{c(u.target.value.length),t(u.target.value)},placeholder:a,className:Di.textarea,maxLength:o}),o&&l.jsxs("div",{className:Di.length,children:[s,"/",o]})]})};exports.API_URL=wa;exports.BillgangProvider=zx;exports.Button=zu;exports.CSS=Fs;exports.ChooseImage=Ek;exports.ChooseImageModal=jk;exports.DndContext=QA;exports.Fuse=zo;exports.GOOGLE_FONTS_API=T6;exports.Icon=dn;exports.Input=Mk;exports.Loader=p7;exports.Modal=o7;exports.PointerSensor=R1;exports.RouterProvider=l6;exports.Select=m4;exports.SortableContext=fL;exports.Switch=u7;exports.Textarea=jL;exports.axios=gt;exports.charge_default=pR;exports.checkout_app_default=mP;exports.clx=Qt;exports.createBrowserRouter=t6;exports.customerDashboard_default=WN;exports.deletePage=m8;exports.getDynamicPage=y8;exports.getThemeAndSettings=b8;exports.jsxRuntimeExports=l;exports.navbarBlocks=P0;exports.order_default=kR;exports.request=fo;exports.resetSettings=x8;exports.sizeOptions=P6;exports.subscription_default=fk;exports.top_up_balance_default=xR;exports.updateSettings=p8;exports.useBlocksStore=j6;exports.useCart=ni;exports.useChooseImageStore=sd;exports.useColorPickerStore=$6;exports.useConfirmationModalStore=Z6;exports.useDeviceStore=_6;exports.useErrorStore=z6;exports.useFontsStore=H6;exports.useHistoryStore=oa;exports.useLayersStore=as;exports.useLocation=co;exports.useModalStore=id;exports.useNavbarStore=R6;exports.useNavigate=Hr;exports.useNotificationStore=W6;exports.usePagesStore=R0;exports.usePreviewStore=L6;exports.useSensor=Xk;exports.useSensors=Jk;exports.useSettingsStore=V6;exports.useShareLinkStore=U6;exports.useSortable=yL;exports.useSubmodalStore=F6;exports.useThemeSettingsStore=B6;exports.useTooltipStore=G6;exports.v4=Ki;exports.verticalListSortingStrategy=uL;exports.weightOptions=N6;
|