@billgangcom/theme-lib 1.73.3 → 1.74.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.
package/dist/App.d.ts CHANGED
@@ -16,3 +16,4 @@ export { ReCaptchaProvider, useReCaptcha } from './storefront/utils/recapcha';
16
16
  export { useAdaptiveStyles } from './storefront/utils/useAdaptiveStyles';
17
17
  export { formatPrice } from './storefront/utils';
18
18
  export type { TypeFontKeys } from './builder/constants/text-font-keys';
19
+ export { useCart } from './storefront/hooks/useCart';
@@ -128,4 +128,4 @@
128
128
  `))+1))}const o="#".repeat(i),u=n.enter("headingAtx"),c=n.enter("phrasing");a.move(o+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
129
129
  `,...a.current()});return/^[\t ]/.test(d)&&(d=or(d.charCodeAt(0))+d.slice(1)),d=d?o+" "+d:o,n.options.closeAtx&&(d+=" "+o),c(),u(),d}el.peek=lC;function el(e){return e.value||""}function lC(){return"<"}tl.peek=cC;function tl(e,t,n,r){const i=ji(n),a=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let u=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(e.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(u=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),u(),e.title&&(u=n.enter(`title${a}`),d+=c.move(" "+i),d+=c.move(n.safe(e.title,{before:d,after:i,...c.current()})),d+=c.move(i),u()),d+=c.move(")"),o(),d}function cC(){return"!"}nl.peek=dC;function nl(e,t,n,r){const i=e.referenceType,a=n.enter("imageReference");let o=n.enter("label");const u=n.createTracker(r);let c=u.move("![");const d=n.safe(e.alt,{before:c,after:"]",...u.current()});c+=u.move(d+"]["),o();const m=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return o(),n.stack=m,a(),i==="full"||!d||d!==h?c+=u.move(h+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function dC(){return"!"}rl.peek=hC;function rl(e,t,n){let r=e.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const o=n.unsafe[a],u=n.compilePattern(o);let c;if(o.atBreak)for(;c=u.exec(r);){let d=c.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(c.index+1)}}return i+r+i}function hC(){return"`"}function sl(e,t){const n=xi(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}il.peek=mC;function il(e,t,n,r){const i=ji(n),a=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let u,c;if(sl(e,n)){const m=n.stack;n.stack=[],u=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),u(),n.stack=m,h}u=n.enter("link"),c=n.enter("label");let d=o.move("[");return d+=o.move(n.containerPhrasing(e,{before:d,after:"](",...o.current()})),d+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=o.move("<"),d+=o.move(n.safe(e.url,{before:d,after:">",...o.current()})),d+=o.move(">")):(c=n.enter("destinationRaw"),d+=o.move(n.safe(e.url,{before:d,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),d+=o.move(" "+i),d+=o.move(n.safe(e.title,{before:d,after:i,...o.current()})),d+=o.move(i),c()),d+=o.move(")"),u(),d}function mC(e,t,n){return sl(e,n)?"<":"["}al.peek=pC;function al(e,t,n,r){const i=e.referenceType,a=n.enter("linkReference");let o=n.enter("label");const u=n.createTracker(r);let c=u.move("[");const d=n.containerPhrasing(e,{before:c,after:"]",...u.current()});c+=u.move(d+"]["),o();const m=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return o(),n.stack=m,a(),i==="full"||!d||d!==h?c+=u.move(h+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function pC(){return"["}function Li(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function fC(e){const t=Li(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function xC(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ol(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function gC(e,t,n,r){const i=n.enter("list"),a=n.bulletCurrent;let o=e.ordered?xC(n):Li(n);const u=e.ordered?o==="."?")":".":fC(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),ol(n)===o&&m){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=u),n.bulletCurrent=o;const d=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),d}function EC(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function bC(e,t,n,r){const i=EC(n);let a=n.bulletCurrent||Li(n);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const u=n.createTracker(r);u.move(a+" ".repeat(o-a.length)),u.shift(o);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),m);return c(),d;function m(h,f,p){return f?(p?"":" ".repeat(o))+h:(p?a:a+" ".repeat(o-a.length))+h}}function _C(e,t,n,r){const i=n.enter("paragraph"),a=n.enter("phrasing"),o=n.containerPhrasing(e,r);return a(),i(),o}const TC=ns(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function CC(e,t,n,r){return(e.children.some(function(o){return TC(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function SC(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}ul.peek=yC;function ul(e,t,n,r){const i=SC(n),a=n.enter("strong"),o=n.createTracker(r),u=o.move(i+i);let c=o.move(n.containerPhrasing(e,{after:i,before:u,...o.current()}));const d=c.charCodeAt(0),m=Qr(r.before.charCodeAt(r.before.length-1),d,i);m.inside&&(c=or(d)+c.slice(1));const h=c.charCodeAt(c.length-1),f=Qr(r.after.charCodeAt(0),h,i);f.inside&&(c=c.slice(0,-1)+or(h));const p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:m.outside},u+c+p}function yC(e,t,n){return n.options.strong||"*"}function RC(e,t,n,r){return n.safe(e.value,r)}function kC(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function AC(e,t,n){const r=(ol(n)+(n.options.ruleSpaces?" ":"")).repeat(kC(n));return n.options.ruleSpaces?r.slice(0,-1):r}const ll={blockquote:Q3,break:ao,code:nC,definition:sC,emphasis:Ju,hardBreak:ao,heading:uC,html:el,image:tl,imageReference:nl,inlineCode:rl,link:il,linkReference:al,list:gC,listItem:bC,paragraph:_C,root:CC,strong:ul,text:RC,thematicBreak:AC};function NC(){return{enter:{table:IC,tableData:oo,tableHeader:oo,tableRow:jC},exit:{codeText:LC,table:wC,tableData:$s,tableHeader:$s,tableRow:$s}}}function IC(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function wC(e){this.exit(e),this.data.inTable=void 0}function jC(e){this.enter({type:"tableRow",children:[]},e)}function $s(e){this.exit(e)}function oo(e){this.enter({type:"tableCell",children:[]},e)}function LC(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,vC));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function vC(e,t){return t==="|"?t:e}function PC(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
130
130
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:u}};function o(p,x,g,S){return d(m(p,g,S),p.align)}function u(p,x,g,S){const b=h(p,g,S),A=d([b]);return A.slice(0,A.indexOf(`
131
- `))}function c(p,x,g,S){const b=g.enter("tableCell"),A=g.enter("phrasing"),y=g.containerPhrasing(p,{...S,before:a,after:a});return A(),b(),y}function d(p,x){return G3(p,{align:x,alignDelimiters:r,padding:n,stringLength:i})}function m(p,x,g){const S=p.children;let b=-1;const A=[],y=x.enter("table");for(;++b<S.length;)A[b]=h(S[b],x,g);return y(),A}function h(p,x,g){const S=p.children;let b=-1;const A=[],y=x.enter("tableRow");for(;++b<S.length;)A[b]=c(S[b],p,x,g);return y(),A}function f(p,x,g){let S=ll.inlineCode(p,x,g);return g.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function OC(){return{exit:{taskListCheckValueChecked:uo,taskListCheckValueUnchecked:uo,paragraph:MC}}}function DC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:BC}}}function uo(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function MC(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let a=-1,o;for(;++a<i.length;){const u=i[a];if(u.type==="paragraph"){o=u;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function BC(e,t,n,r){const i=e.children[0],a=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(o);let c=ll.listItem(e,t,n,{...r,...u.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(m){return m+o}}function FC(){return[g3(),B3(),$3(),NC(),OC()]}function HC(e){return{extensions:[E3(),F3(e),z3(),PC(e),DC()]}}const UC={tokenize:YC,partial:!0},cl={tokenize:GC,partial:!0},dl={tokenize:XC,partial:!0},hl={tokenize:QC,partial:!0},$C={tokenize:KC,partial:!0},ml={name:"wwwAutolink",tokenize:qC,previous:fl},pl={name:"protocolAutolink",tokenize:VC,previous:xl},Pt={name:"emailAutolink",tokenize:WC,previous:gl},yt={};function zC(){return{text:yt}}let Zt=48;for(;Zt<123;)yt[Zt]=Pt,Zt++,Zt===58?Zt=65:Zt===91&&(Zt=97);yt[43]=Pt;yt[45]=Pt;yt[46]=Pt;yt[95]=Pt;yt[72]=[Pt,pl];yt[104]=[Pt,pl];yt[87]=[Pt,ml];yt[119]=[Pt,ml];function WC(e,t,n){const r=this;let i,a;return o;function o(h){return!li(h)||!gl.call(r,r.previous)||vi(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return li(h)?(e.consume(h),u):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check($C,m,d)(h):h===45||h===95||Be(h)?(a=!0,e.consume(h),c):m(h)}function d(h){return e.consume(h),i=!0,c}function m(h){return a&&i&&ze(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function qC(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!fl.call(r,r.previous)||vi(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(UC,e.attempt(cl,e.attempt(dl,a),n),n)(o))}function a(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function VC(e,t,n){const r=this;let i="",a=!1;return o;function o(h){return(h===72||h===104)&&xl.call(r,r.previous)&&!vi(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(ze(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),a?d:(a=!0,c)):n(h)}function d(h){return h===null||qr(h)||_e(h)||an(h)||Jr(h)?n(h):e.attempt(cl,e.attempt(dl,m),n)(h)}function m(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function YC(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),a):n(o)}function a(o){return o===null?n(o):t(o)}}function GC(e,t,n){let r,i,a;return o;function o(d){return d===46||d===95?e.check(hl,c,u)(d):d===null||_e(d)||an(d)||d!==45&&Jr(d)?c(d):(a=!0,e.consume(d),o)}function u(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),o}function c(d){return i||r||!a?n(d):t(d)}}function XC(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(hl,t,a)(o):o===null||_e(o)||an(o)?t(o):(e.consume(o),i)}function a(o){return o===41&&r++,e.consume(o),i}}function QC(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),a):u===93?(e.consume(u),i):u===60||u===null||_e(u)||an(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||_e(u)||an(u)?t(u):r(u)}function a(u){return ze(u)?o(u):n(u)}function o(u){return u===59?(e.consume(u),r):ze(u)?(e.consume(u),o):n(u)}}function KC(e,t,n){return r;function r(a){return e.consume(a),i}function i(a){return Be(a)?n(a):t(a)}}function fl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||_e(e)}function xl(e){return!ze(e)}function gl(e){return!(e===47||li(e))}function li(e){return e===43||e===45||e===46||e===95||Be(e)}function vi(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ZC={tokenize:aS,partial:!0};function JC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:rS,continuation:{tokenize:sS},exit:iS}},text:{91:{name:"gfmFootnoteCall",tokenize:nS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:eS,resolveTo:tS}}}}function eS(e,t,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!o||!o._balanced)return n(c);const d=mt(r.sliceSerialize({start:o.end,end:r.now()}));return d.codePointAt(0)!==94||!a.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function tS(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function nS(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,o;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(h){if(a>999||h===93&&!o||h===null||h===91||_e(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(mt(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return _e(h)||(o=!0),a++,e.consume(h),h===92?m:d}function m(h){return h===91||h===92||h===93?(e.consume(h),a++,d):d(h)}}function rS(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,o=0,u;return c;function c(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(x)}function m(x){if(o>999||x===93&&!u||x===null||x===91||_e(x))return n(x);if(x===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return a=mt(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return _e(x)||(u=!0),o++,e.consume(x),x===92?h:m}function h(x){return x===91||x===92||x===93?(e.consume(x),o++,m):m(x)}function f(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),i.includes(a)||i.push(a),pe(e,p,"gfmFootnoteDefinitionWhitespace")):n(x)}function p(x){return t(x)}}function sS(e,t,n){return e.check(mr,t,e.attempt(ZC,t,n))}function iS(e){e.exit("gfmFootnoteDefinition")}function aS(e,t,n){const r=this;return pe(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(a):n(a)}}function oS(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,u){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let d=c;for(;d--;)if(o[d][0]==="exit"&&o[d][1].type==="strikethroughSequenceTemporary"&&o[d][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[d][1].end.offset-o[d][1].start.offset){o[c][1].type="strikethroughSequence",o[d][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},o[d][1].start),end:Object.assign({},o[c][1].end)},h={type:"strikethroughText",start:Object.assign({},o[d][1].end),end:Object.assign({},o[c][1].start)},f=[["enter",m,u],["enter",o[d][1],u],["exit",o[d][1],u],["enter",h,u]],p=u.parser.constructs.insideSpan.null;p&&Ke(f,f.length,0,es(p,o.slice(d+1,c),u)),Ke(f,f.length,0,[["exit",h,u],["enter",o[c][1],u],["exit",o[c][1],u],["exit",m,u]]),Ke(o,d-1,c-d+3,f),c=d+f.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function a(o,u,c){const d=this.previous,m=this.events;let h=0;return f;function f(x){return d===126&&m[m.length-1][1].type!=="characterEscape"?c(x):(o.enter("strikethroughSequenceTemporary"),p(x))}function p(x){const g=Cn(d);if(x===126)return h>1?c(x):(o.consume(x),h++,p);if(h<2&&!n)return c(x);const S=o.exit("strikethroughSequenceTemporary"),b=Cn(x);return S._open=!b||b===2&&!!g,S._close=!g||g===2&&!!b,u(x)}}}class uS{constructor(){this.map=[]}add(t,n,r){lS(this,t,n,r)}consume(t){if(this.map.sort(function(a,o){return a[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const a of i)t.push(a);i=r.pop()}this.map.length=0}}function lS(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function cS(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function dS(){return{flow:{null:{name:"table",tokenize:hS,resolveAll:mS}}}}function hS(e,t,n){const r=this;let i=0,a=0,o;return u;function u(w){let $=r.events.length-1;for(;$>-1;){const Y=r.events[$][1].type;if(Y==="lineEnding"||Y==="linePrefix")$--;else break}const M=$>-1?r.events[$][1].type:null,H=M==="tableHead"||M==="tableRow"?N:c;return H===N&&r.parser.lazy[r.now().line]?n(w):H(w)}function c(w){return e.enter("tableHead"),e.enter("tableRow"),d(w)}function d(w){return w===124||(o=!0,a+=1),m(w)}function m(w){return w===null?n(w):J(w)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),p):n(w):de(w)?pe(e,m,"whitespace")(w):(a+=1,o&&(o=!1,i+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),o=!0,m):(e.enter("data"),h(w)))}function h(w){return w===null||w===124||_e(w)?(e.exit("data"),m(w)):(e.consume(w),w===92?f:h)}function f(w){return w===92||w===124?(e.consume(w),h):h(w)}function p(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(e.enter("tableDelimiterRow"),o=!1,de(w)?pe(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):x(w))}function x(w){return w===45||w===58?S(w):w===124?(o=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),g):j(w)}function g(w){return de(w)?pe(e,S,"whitespace")(w):S(w)}function S(w){return w===58?(a+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(a+=1,b(w)):w===null||J(w)?P(w):j(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),A(w)):j(w)}function A(w){return w===45?(e.consume(w),A):w===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(w))}function y(w){return de(w)?pe(e,P,"whitespace")(w):P(w)}function P(w){return w===124?x(w):w===null||J(w)?!o||i!==a?j(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):j(w)}function j(w){return n(w)}function N(w){return e.enter("tableRow"),q(w)}function q(w){return w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),q):w===null||J(w)?(e.exit("tableRow"),t(w)):de(w)?pe(e,q,"whitespace")(w):(e.enter("data"),V(w))}function V(w){return w===null||w===124||_e(w)?(e.exit("data"),q(w)):(e.consume(w),w===92?K:V)}function K(w){return w===92||w===124?(e.consume(w),V):V(w)}}function mS(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],u=!1,c=0,d,m,h;const f=new uS;for(;++n<e.length;){const p=e[n],x=p[1];p[0]==="enter"?x.type==="tableHead"?(u=!1,c!==0&&(lo(f,t,c,d,m),m=void 0,c=0),d={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",d,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,h=void 0,a=[0,0,0,0],o=[0,n+1,0,0],u&&(u=!1,m={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",m,t]])),i=x.type==="tableDelimiterRow"?2:m?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],h=Or(f,t,a,i,void 0,h),a=[0,0,0,0]),o[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],h=Or(f,t,a,i,void 0,h)),a=o,o=[a[1],n,0,0])):x.type==="tableHead"?(u=!0,c=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(c=n,a[1]!==0?(o[0]=o[1],h=Or(f,t,a,i,n,h)):o[1]!==0&&(h=Or(f,t,o,i,n,h)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&lo(f,t,c,d,m),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=cS(t.events,n))}return e}function Or(e,t,n,r,i,a){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},xn(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const c=xn(t.events,n[1]);if(a={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const d=xn(t.events,n[2]),m=xn(t.events,n[3]),h={type:u,start:Object.assign({},d),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,g=n[3]-n[2]-1;e.add(x,g,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return i!==void 0&&(a.end=Object.assign({},xn(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function lo(e,t,n,r,i){const a=[],o=xn(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function xn(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const pS={name:"tasklistCheck",tokenize:xS};function fS(){return{text:{91:pS}}}function xS(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),a)}function a(c){return _e(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return J(c)?t(c):de(c)?e.check({tokenize:gS},t,n)(c):n(c)}}function gS(e,t,n){return pe(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function ES(e){return Oo([zC(),JC(),oS(e),dS(),fS()])}const bS={};function _S(e){const t=this,n=e||bS,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(ES(n)),a.push(FC()),o.push(HC(n))}const Pi=({isOrder:e,product:t})=>{var a;const{shopGeneral:n}=s.useStorefrontStore(),r=t.subscriptionSettings,{cart:i}=s.useCart();return console.log(t.description),s.jsxRuntimeExports.jsxs("div",{className:`${Ie.checkoutProduct} ${e?Ie.isOrder:""}`,children:[s.jsxRuntimeExports.jsxs("div",{className:Ie.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:`${Ie.productImage} ${e?Ie.isOrderImage:""}`,children:t!=null&&t.image?s.jsxRuntimeExports.jsx("img",{className:Ie.image,src:s.convertCfImageIdToUrl(t.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image",fill:"var(--text-secondary)"})}),s.jsxRuntimeExports.jsx("div",{className:Ie.productInfo,children:s.jsxRuntimeExports.jsxs("div",{className:Ie.productHeader,children:[s.jsxRuntimeExports.jsx("h2",{className:Ie.productName,id:"h5",children:t.name}),s.jsxRuntimeExports.jsxs("span",{className:Ie.quantityBadge,id:"md",children:[t.price.quantity,"x"]})]})}),t.chargeType==="RECURRING"&&s.jsxRuntimeExports.jsx("p",{className:Ie.productPrice,id:"md",children:r&&`${s.formatPrice(r.price)} / ${s.normalizeInterval(r.recurringIntervalDays||0)}${r.entryFee?" + "+s.formatPrice(r.entryFee):""}`}),t.chargeType==="ONE_TIME"&&s.jsxRuntimeExports.jsx("p",{className:Ie.productPrice,id:"md",children:t.variantsGateways&&i.gateway&&t.variantsGateways.some(o=>o.name===i.gateway&&o.overrodePrice)?s.formatPrice(((a=t.variantsGateways.find(o=>o.name===i.gateway))==null?void 0:a.overrodePrice)||t.price):s.formatPrice(t.price)})]}),t.description&&s.jsxRuntimeExports.jsx("p",{className:Ie.productDescription,children:s.jsxRuntimeExports.jsx(ru,{remarkPlugins:[_S],rehypePlugins:[d3],components:{a:({node:o,...u})=>s.jsxRuntimeExports.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer",className:Ie.link})},children:t.description})}),t.deliveryCategories&&s.jsxRuntimeExports.jsx("div",{className:Ie.deliveryCategories,children:t.deliveryCategories.map(o=>s.jsxRuntimeExports.jsx(s.DeliveryItem,{deliveryConfiguration:o},o.id))}),t.customerNote&&s.jsxRuntimeExports.jsxs("div",{className:Ie.customerNote,children:[s.jsxRuntimeExports.jsxs("div",{className:Ie.noteHeader,children:[(n==null?void 0:n.info.logo)&&s.jsxRuntimeExports.jsx("div",{className:Ie.logoContainer,children:s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(n==null?void 0:n.info.logo.cfId)})}),s.jsxRuntimeExports.jsx("p",{className:Ie.shopName,id:"md",children:n==null?void 0:n.info.name})]}),s.jsxRuntimeExports.jsx("p",{className:Ie.noteContent,id:"md",children:t.customerNote})]})]})},TS="_coupon_dkjzv_1",CS="_couponApplied_dkjzv_7",SS="_discount_dkjzv_17",yS="_removeButton_dkjzv_23",RS="_removeButtonText_dkjzv_27",kS="_couponInput_dkjzv_31",AS="_couponInputContainer_dkjzv_37",Bt={coupon:TS,couponApplied:CS,discount:SS,removeButton:yS,removeButtonText:RS,couponInput:kS,couponInputContainer:AS},NS=({applyCoupon:e,couponData:t,discount:n,removeCoupon:r,gateway:i})=>{const[a,o]=k.useState(null),[u,c]=k.useState(!1);return s.jsxRuntimeExports.jsxs("div",{className:Bt.coupon,children:[u&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Bt.skeleton,children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!u&&(t?s.jsxRuntimeExports.jsxs("div",{className:Bt.couponApplied,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"}),s.jsxRuntimeExports.jsxs("p",{id:"md",children:[a," is applied"," ",s.jsxRuntimeExports.jsxs("span",{className:Bt.discount,children:["-",n," ",!t.isFixed&&`(${t.discount}%)`]})]}),s.jsxRuntimeExports.jsx("button",{className:Bt.removeButton,onClick:r,children:s.jsxRuntimeExports.jsx("span",{className:Bt.removeButtonText,children:"Remove"})})]}):s.jsxRuntimeExports.jsxs("div",{className:Bt.couponInput,children:[s.jsxRuntimeExports.jsxs("div",{className:Bt.couponInputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"Enter a discount code",value:a||"",onChange:d=>{o(d===""?null:d)}}),s.jsxRuntimeExports.jsx(s.Button$1,{onClick:async()=>{c(!0),a&&await e(a),c(!1)},disabled:!i||!a,type:"Primary",children:"Apply"})]}),!i&&s.jsxRuntimeExports.jsx(s.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},IS=({cart:e,products:t,applyCoupon:n,applyCouponPending:r,coupon:i,totalAndDiscount:a,removeCoupon:o})=>{var g;const{priceAdjusment:u}=s.useCartStore(),[c,d]=k.useState(!1),m=k.useMemo(()=>e.parts.map(S=>{const b=t.find(y=>y.id===S.productId),A=b==null?void 0:b.variants.find(y=>y.id===S.productVariantId);return S.chargeType==="RECURRING"&&d(!0),{id:(b==null?void 0:b.id)||0,image:b==null?void 0:b.images[0],name:(A==null?void 0:A.name)||"",description:(A==null?void 0:A.description)||"",price:{quantity:S.quantity,amount:(A==null?void 0:A.price.amount)||0,currency:A==null?void 0:A.price.currency},subscriptionSettings:A==null?void 0:A.subscriptionSettings,chargeType:S.chargeType,variantsGateways:A==null?void 0:A.gateways}}),[e,t]),h=((g=m[0])==null?void 0:g.price.currency)||"USD",f=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),p=k.useMemo(()=>i&&!i.isFixed&&i.discount===100?a.total:a.totalWithDiscount?a.total-a.totalWithDiscount:0,[a,i]),x=u?(u==null?void 0:u.fixedAmount)+Math.round((a.totalWithDiscount!==void 0?a.totalWithDiscount:a.total-p)*((u==null?void 0:u.percentage)/100)):null;return s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:Kt.innerContainer,children:[s.jsxRuntimeExports.jsx(cr,{}),s.jsxRuntimeExports.jsxs("div",{className:Kt.headerSection,children:[s.jsxRuntimeExports.jsx("header",{className:Kt.header,children:s.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),s.jsxRuntimeExports.jsx("div",{className:Kt.productsContainer,children:m.map(S=>s.jsxRuntimeExports.jsx(Pi,{product:S},S.id))}),s.jsxRuntimeExports.jsx("div",{className:Kt.couponContainer,children:s.jsxRuntimeExports.jsx(NS,{applyCoupon:n,applyCouponPending:r,couponData:i,discount:f.format(p),removeCoupon:o,gateway:e.gateway})}),s.jsxRuntimeExports.jsx(dr,{formatter:f,coupon:i,total:a.total,discount:p,totalWithDiscount:a.totalWithDiscount,feeOrDiscount:c?null:x})]}),s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutFooter,children:s.jsxRuntimeExports.jsx(vt,{})})]})})},wS="_checkoutOperational_6gxie_1",jS="_innerContainer_6gxie_17",LS="_paymentMethodsSection_6gxie_22",vS="_socialConnectSection_6gxie_28",PS="_socialConnectLabel_6gxie_31",OS="_socialConnectContent_6gxie_35",DS="_continueButton_6gxie_39",MS="_button_6gxie_43",BS="_checkoutFooter_6gxie_47",It={checkoutOperational:wS,innerContainer:jS,paymentMethodsSection:LS,socialConnectSection:vS,socialConnectLabel:PS,socialConnectContent:OS,continueButton:DS,button:MS,checkoutFooter:BS},FS="_customFields_uhcib_2",HS="_checkboxWrapper_uhcib_9",US="_textareaWrapper_uhcib_16",$S="_inputWrapper_uhcib_17",zS="_requiredStar_uhcib_27",gn={customFields:FS,checkboxWrapper:HS,textareaWrapper:US,inputWrapper:$S,requiredStar:zS},WS=({customFields:e,setCustomFields:t})=>{if(e.length===0)return null;const n=e.map(r=>s.jsxRuntimeExports.jsx(qS,{customField:r,setCustomFields:t},r.name));return s.jsxRuntimeExports.jsx("div",{className:gn.customFields,children:n})},qS=({customField:e,setCustomFields:t})=>{const n=r=>{t(i=>i.map(a=>a.name===e.name?{...a,value:r}:a))};return s.jsxRuntimeExports.jsx(VS,{value:e.value??"",placeholder:e.placeholder,required:e.required,defaultValue:e.defaultValue,type:e.type,onValueChange:n,label:e.name,regex:e.regex})},VS=({label:e,type:t,defaultValue:n,value:r,placeholder:i,regex:a,required:o,onValueChange:u})=>{if(k.useEffect(()=>{r===""&&n!==void 0&&u(String(n))},[]),t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return s.jsxRuntimeExports.jsxs("label",{className:gn.checkboxWrapper,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:r==="true",onChange:d=>u(d?"true":"false")}),s.jsxRuntimeExports.jsxs("p",{className:gn.checkboxLabel,children:[e,o&&s.jsxRuntimeExports.jsx("span",{className:gn.requiredStar,children:"*"})]})]});if(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return s.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(n??""),required:o});const c=d=>{(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:a?new RegExp(a):/.*/).test(d)&&u(d)};return t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?s.jsxRuntimeExports.jsx("div",{className:gn.textareaWrapper,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{label:e,value:r,placeholder:i,onChange:c,required:o})}):s.jsxRuntimeExports.jsx("div",{className:gn.inputWrapper,children:s.jsxRuntimeExports.jsx(s.Input$1,{type:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":i,label:e,value:r,required:o,onChange:c})})},YS="_connectedContainer_1rxr8_1",GS="_userInfo_1rxr8_10",XS="_avatar_1rxr8_16",QS="_avatarImage_1rxr8_26",Dr={connectedContainer:YS,userInfo:GS,avatar:XS,avatarImage:QS},KS=({customerEmail:e})=>{const{discordInfo:t,setDiscordInfo:n}=s.useDiscordStore(),{notifications:r,setNotifications:i}=s.useNotificationStore(),[a,o]=k.useState(!1),[u,c]=k.useState(0),[d,m]=k.useState(null),h=20,f=g=>{var S,b,A,y;return(b=(S=g==null?void 0:g.response)==null?void 0:S.data)!=null&&b.error?g.response.data.error:(y=(A=g==null?void 0:g.response)==null?void 0:A.data)!=null&&y.message?g.response.data.message:g!=null&&g.message?g.message:"Failed to connect to Discord. Please try again later."},p=(g,S)=>{i([...r,{id:s.v4(),message:g,status:S}])};k.useEffect(()=>{if(d&&a){const g=setInterval(()=>{d.closed&&(clearInterval(g),o(!1),m(null))},1e3);return()=>clearInterval(g)}},[d,a]);const x=()=>{e.trim()!==""&&(o(!0),c(0),uc({customerEmail:e}).then(({data:g})=>{const S=window.open(g.redirectUrl);m(S),(!S||S.closed||typeof S.closed>"u")&&setTimeout(()=>{const y=document.createElement("a");y.href=g.redirectUrl,y.target="_blank",y.click()});let b;const A=()=>{if(c(y=>y+1),u>=h||S&&S.closed){u>=h&&p("Authorization timeout. Please try again.","error"),o(!1),clearTimeout(b);return}lc({id:g.id,customerEmail:e}).then(({data:y})=>{n({authorized:!0,id:y.discordId,avatar:y.avatar,username:y.username}),S&&S.close(),o(!1),m(null),p("Discord successfully connected!","success"),clearTimeout(b)}).catch(y=>{var P;if(console.log("Waiting for authorization...",y,{newWindow:S}),S&&S.closed){o(!1),clearTimeout(b);return}if((P=y==null?void 0:y.response)!=null&&P.status&&y.response.status!==404&&y.response.status>=400){p(f(y),"error"),o(!1),clearTimeout(b);return}clearTimeout(b),b=setTimeout(A,1500)})};A()}).catch(g=>{console.log("Could not initiate Discord authorization",g),p(f(g),"error"),o(!1)}))};return t!=null&&t.authorized?s.jsxRuntimeExports.jsxs("div",{className:Dr.connectedContainer,children:[s.jsxRuntimeExports.jsxs("div",{className:Dr.userInfo,children:[s.jsxRuntimeExports.jsx("div",{className:Dr.avatar,children:t.avatar?s.jsxRuntimeExports.jsx("img",{className:Dr.avatarImage,src:`https://cdn.discordapp.com/avatars/${t.id}/${t.avatar}.png?size=256`}):s.jsxRuntimeExports.jsx(s.Icon,{name:"UserCircle"})}),s.jsxRuntimeExports.jsx("p",{children:t.username}),s.jsxRuntimeExports.jsx(Nf,{})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Reconnect"})]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:a,children:a?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"DiscordLogo"}),s.jsxRuntimeExports.jsx(s.StableText,{children:"Connect Your Discord"})]})})},ZS="_paymentMethodsContainer_a3he6_2",JS={paymentMethodsContainer:ZS},ey="_bottomSheet_1x8kc_1",ty="_content_1x8kc_8",ny="_description_1x8kc_11",ry="_title_1x8kc_15",sy="_buttonGroup_1x8kc_19",iy="_buttonWrapper_1x8kc_29",ay="_fullWidthButton_1x8kc_32",oy="_modal_1x8kc_36",uy="_header_1x8kc_43",wt={bottomSheet:ey,content:ty,description:ny,title:ry,buttonGroup:sy,buttonWrapper:iy,fullWidthButton:ay,modal:oy,header:uy},ly=({setIsOpen:e,balance:t})=>{const n=s.useNavigate(),{setIsOpen:r}=s.useModalStore(),i=()=>{n("/top-up?redirectRoute=checkout")};function a(){r(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:wt.modal,onClick:o=>o.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:wt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:wt.title,children:"Insufficient Customer Balance"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:a,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:wt.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:wt.content,children:s.jsxRuntimeExports.jsxs("p",{className:wt.description,children:["You currently have ",t&&s.formatPrice(t)," in your balance. After topping up the required amount, you can continue to checkout."]})}),s.jsxRuntimeExports.jsxs("div",{className:wt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:wt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:a,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:wt.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:i,children:"Add Balance"})})]})]})]})},El=({align:e,gateway:t,gatewayDisplayName:n,selected:r,onSelect:i,total:a,onSignInClick:o,reversed:u})=>{const{token:c}=s.useStorefrontStore(),{balance:d}=s.useCustomerDashboardStore(),[m,h]=k.useState(!1),{setIsOpen:f}=s.useModalStore(),p=x=>{x.stopPropagation(),i&&i(t),d&&d.amount<a&&(h(!0),f(!0))};return k.useEffect(()=>{},[d,a]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(s.styles$3.paymentMethod,{[s.styles$3.selected]:r,[s.styles$3.alignColumn]:e==="column",[s.styles$3.reversed]:u}),onClick:p,children:[s.jsxRuntimeExports.jsxs("p",{className:s.styles$3.paymentText,id:"md",children:[n," ",s.jsxRuntimeExports.jsxs("span",{className:s.styles$3.balanceText,id:"md",children:["(",c?d&&s.formatPrice(d):s.jsxRuntimeExports.jsx("a",{className:s.styles$3.signInLink,onClick:o,id:"md",children:"Sign in"}),")"]})]}),s.jsxRuntimeExports.jsx("div",{className:s.styles$3.iconContainer,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}),m&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>h(!1),children:s.jsxRuntimeExports.jsx(ly,{setIsOpen:h,balance:d})})]})},bl=({possibleGateways:e,setGateway:t,totalAndDiscount:n,onSignInClick:r,setPaymentMethod:i})=>{const[a,o]=k.useState(),[u,c]=k.useState(),{setPriceAdjustment:d}=s.useCartStore(),[m,h]=k.useState(null),f=(p,x)=>{var g;u!==x&&(t(x),d(((g=m==null?void 0:m.find(S=>S.name===x))==null?void 0:g.priceAdjustment)||null)),i(p),o(p),c(x)};return k.useEffect(()=>{const p=async()=>{const{data:x}=await s.fetchGatewaysDetail([...e.availableGateways,...e.requiresSignInGateways]);h(x)};e.availableGateways.length&&p()},[]),k.useLayoutEffect(()=>{d(null)},[]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[m&&s.jsxRuntimeExports.jsx("div",{className:JS.paymentMethodsContainer,children:m==null?void 0:m.map(p=>p.name==="Balance"?s.jsxRuntimeExports.jsx(El,{gateway:p.name,gatewayDisplayName:p.displayName,onSelect:x=>{c(x),u!==x&&t(x)},selected:p.name===u,total:n.total,onSignInClick:r,reversed:!0},p.name):p.paymentMethods.map(x=>s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{paymentMethod:x,gateway:p.name,gatewayDisplayName:p.displayName,gatewayLogoCfId:p.logoCfImageId,poweredByLogoCfId:p.poweredByImageCfImageId,onSelect:g=>f(g,p.name),selected:a===x&&u===p.name},`${p.name}-${x}`)))}),!m&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:"100%",height:"220px",viewBox:"0 0 600 220",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"5",ry:"5",width:"100%",height:"100%"})})]})},cy="_modal_14r0b_1",dy={modal:cy},hy=({setIsOpen:e})=>{const{token:t}=s.useStorefrontStore(),{setIsOpen:n}=s.useModalStore();k.useEffect(()=>{t&&r()},[t]);const r=()=>{n(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsx("div",{className:dy.modal,onClick:i=>i.stopPropagation(),children:s.jsxRuntimeExports.jsx(s.Auth,{inModal:!0})})},my=({getPossibleGateways:e,setGateway:t,getDiscordSettings:n,cart:r,products:i,submitCart:a,reset:o,setCustomFieldsToCart:u,totalAndDiscount:c,setDiscordSocialConnectId:d,setPaymentMethod:m})=>{const h=k.useMemo(()=>n(),[]),[f,p]=k.useState([]),{balance:x,setBalance:g}=s.useCustomerDashboardStore(),{token:S}=s.useStorefrontStore(),{executeRecaptcha:b}=s.useReCaptcha(),{discordInfo:A}=s.useDiscordStore(),{customerEmail:y,setCustomerEmail:P}=s.useCartStore(),j=A!=null&&A.authorized?A.id:void 0,N=s.useNavigate(),q=k.useMemo(()=>e(),[r.parts]),[V,K]=k.useState(!1),{setIsOpen:w}=s.useModalStore(),{notifications:$,setNotifications:M}=s.useNotificationStore();k.useEffect(()=>{const G=s.getCommonCustomFields(r.parts,i).map(W=>W.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...W,value:String(W.defaultValue)}:W);p([...G])},[]),k.useEffect(()=>{const X=s.getCommonCustomFields(r.parts,i);p(G=>{const W=new Map(G.map(Q=>[Q.name,Q]));return X.map(Q=>{const C=W.get(Q.name);return C&&C.value?{...Q,value:C.value}:Q.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...Q,value:String(Q.defaultValue)}:Q})})},[r.parts,i]),k.useEffect(()=>{S&&(async()=>{const G=await s.getBalance();g(G)})()},[S]);function H(X){return X&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(X)}const Y=()=>{const X=[];return f.forEach(G=>{var W;G.required&&!((W=G.value)!=null&&W.toString().trim())&&X.push({message:`Field "${G.name}" is required.`,status:"error",id:s.v4()})}),X.length>0?(M([...$,...X]),!1):!0},z=async X=>{if(X.stopPropagation(),r.gateway==="Balance"&&!S){w(!0),K(!0);return}if(!Y())return;const G=Object.fromEntries(f.map(Q=>[Q.name,Q.value||""]));u({...G}),j&&h.isEnabled&&d(j);const W=await b();if(W){const Q=await a(W),C=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(C).length>10){const Ee=Date.now()-864e5;Object.keys(C).forEach(Ae=>{C[Ae].createdAt<=Ee&&delete C[Ae]})}"order"in Q?C[Q.order.id]={createdAt:Date.now(),fullAccessToken:Q.order.fullAccessToken}:C[Q.id]={createdAt:Date.now(),fullAccessToken:Q.fullAccessToken},localStorage.setItem("orders",JSON.stringify(C)),N(`/orders/${"order"in Q?Q.order.id:Q.id}/${"order"in Q?Q.order.fullAccessToken:Q.fullAccessToken}`),setTimeout(()=>o(),0)}};return s.jsxRuntimeExports.jsxs("div",{className:It.checkoutOperational,children:[s.jsxRuntimeExports.jsxs("div",{className:It.innerContainer,children:[r.parts.length>0&&s.jsxRuntimeExports.jsx(bl,{possibleGateways:q,setGateway:t,setPaymentMethod:m,balance:x,totalAndDiscount:c,onSignInClick:()=>{K(!0),w(!0)}}),s.jsxRuntimeExports.jsx("div",{className:It.paymentMethodsSection,children:s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"mail@mail.com",value:y||"",onChange:X=>P(X),disabled:!!S,label:"Email Address"})}),s.jsxRuntimeExports.jsx(WS,{customFields:f,setCustomFields:p}),h.isEnabled&&s.jsxRuntimeExports.jsxs("div",{className:It.socialConnectSection,children:[s.jsxRuntimeExports.jsx("p",{className:It.socialConnectLabel,id:"md",children:"Social Connect"}),s.jsxRuntimeExports.jsx("div",{className:It.socialConnectContent,children:s.jsxRuntimeExports.jsx(KS,{customerEmail:y||""})})]}),s.jsxRuntimeExports.jsxs("div",{className:It.continueButton,children:[s.jsxRuntimeExports.jsx(s.Button$1,{onClick:z,disabled:!r.gateway||!H(y||"")||h.isRequired&&!(A!=null&&A.authorized),className:It.button,children:"Continue to Checkout"}),s.jsxRuntimeExports.jsx(s.TermsOfService,{}),s.jsxRuntimeExports.jsx(s.SecuredBySsl,{})]}),s.jsxRuntimeExports.jsx(vt,{className:It.checkoutFooter})]}),V&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>K(!1),children:s.jsxRuntimeExports.jsx(hy,{setIsOpen:K})})]})},py="_mt1_1t7v2_1",fy="_notifyBlock_1t7v2_13",xy="_notifyHeader_1t7v2_19",gy="_notifyContent_1t7v2_25",Ey="_buttonBlock_1t7v2_30",by="_imageBlock_1t7v2_34",_y="_imageContainer_1t7v2_42",Ty="_sectionBlock_1t7v2_54",Cy="_sectionTitle_1t7v2_61",Sy="_sectionSubtitle_1t7v2_64",yy="_inputContainer_1t7v2_69",pt={mt1:py,notifyBlock:fy,notifyHeader:xy,notifyContent:gy,buttonBlock:Ey,imageBlock:by,imageContainer:_y,sectionBlock:Ty,sectionTitle:Cy,sectionSubtitle:Sy,inputContainer:yy},Ry=({props:e})=>{const t=s.useCopy();return s.jsxRuntimeExports.jsx("div",{className:pt.mt1,children:s.jsxRuntimeExports.jsxs("div",{className:pt.inputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:e.text,disabled:!0,onChange:()=>{}}),e.shownCopyButton&&s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>t(e.text),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})})},ky=({props:e})=>s.jsxRuntimeExports.jsx(s.Button$1,{className:pt.buttonBlock,onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),Ay=({props:e})=>s.jsxRuntimeExports.jsx("div",{className:pt.imageBlock,children:s.jsxRuntimeExports.jsx("div",{className:pt.imageContainer,children:s.jsxRuntimeExports.jsx("img",{src:e.src,alt:""})})}),Ny=({props:e})=>s.jsxRuntimeExports.jsxs("div",{className:pt.notifyBlock,children:[s.jsxRuntimeExports.jsxs("div",{className:pt.notifyHeader,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),s.jsxRuntimeExports.jsx("p",{children:e.heading})]}),s.jsxRuntimeExports.jsx("p",{className:pt.notifyContent,children:e.content})]}),Iy=({props:e})=>{var t;return s.jsxRuntimeExports.jsxs("div",{className:pt.sectionBlock,children:[s.jsxRuntimeExports.jsx("p",{className:pt.sectionTitle,children:e.title}),s.jsxRuntimeExports.jsx("span",{className:pt.sectionSubtitle,children:e.subTitle}),(t=e.children)==null?void 0:t.map((n,r)=>s.jsxRuntimeExports.jsx(_l,{block:n},r))]})},_l=({block:e})=>{switch(e.type){case"Section":return s.jsxRuntimeExports.jsx(Iy,{...e});case"ReadOnlyTextInput":return s.jsxRuntimeExports.jsx(Ry,{...e});case"Notify":return s.jsxRuntimeExports.jsx(Ny,{...e});case"Button":return s.jsxRuntimeExports.jsx(ky,{...e});case"Image":return s.jsxRuntimeExports.jsx(Ay,{...e});default:return null}},wy="_bottomSheet_1x4sq_1",jy="_content_1x4sq_8",Ly="_agreementList_1x4sq_11",vy="_agreementItem_1x4sq_16",Py="_warning_1x4sq_23",Oy="_buttonGroup_1x4sq_31",Dy="_buttonWrapper_1x4sq_41",My="_fullWidthButton_1x4sq_44",By="_modal_1x4sq_48",Fy="_header_1x4sq_55",Je={bottomSheet:wy,content:jy,agreementList:Ly,agreementItem:vy,warning:Py,buttonGroup:Oy,buttonWrapper:Dy,fullWidthButton:My,modal:By,header:Fy},Hy=({setIsOpen:e,price:t})=>{const[n,r]=k.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:i}=s.useModalStore(),a=()=>{i(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Je.modal,onClick:o=>o.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:a,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.content,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.agreementList,children:[s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSendAsFF,onChange:o=>r({...n,agreeToSendAsFF:o})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSend,onChange:o=>r({...n,agreeToSend:o})}),s.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",s.formatPrice(t)," ",t.currency]})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToNotAddNote,onChange:o=>r({...n,agreeToNotAddNote:o})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),s.jsxRuntimeExports.jsx("div",{className:Je.warning,children:s.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",s.formatPrice(t)," ",t.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",children:s.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),s.jsxRuntimeExports.jsx("div",{className:Je.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:a,children:"Continue to Payment"})})]})]})]})},Uy="_chargeItemsContainer_qmv3w_4",$y="_chargeItemsInner_qmv3w_20",zy="_productsContainer_qmv3w_27",Wy="_chargeHeader_qmv3w_41",qy="_chargeTitle_qmv3w_49",Vy="_chargeDescription_qmv3w_55",Yy="_copyButton_qmv3w_61",Gy="_productsList_qmv3w_73",Xy="_trackingContainer_qmv3w_81",Qy="_footerContainer_qmv3w_91",Et={chargeItemsContainer:Uy,chargeItemsInner:$y,productsContainer:zy,chargeHeader:Wy,chargeTitle:qy,chargeDescription:Vy,copyButton:Yy,productsList:Gy,trackingContainer:Xy,footerContainer:Qy},Ky=({charge:e})=>{var a;const t=s.useCopy(),n=(e==null?void 0:e.price.currency)||"USD",r=new Intl.NumberFormat("en-US",{style:"currency",currency:n}),i=k.useMemo(()=>{var o;return((o=e==null?void 0:e.order)==null?void 0:o.partOrders.map(u=>{var c,d,m,h,f,p;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:((c=u.productWithVariant)==null?void 0:c.variantName)||"",description:((d=u.productWithVariant)==null?void 0:d.description)||"",price:{quantity:u.quantity,amount:((m=u.productWithVariant)==null?void 0:m.price.amount)||0,currency:(h=u.productWithVariant)==null?void 0:h.price.currency},subscriptionSettings:(f=e.order)!=null&&f.subscriptionOrderId?(p=u.productWithVariant)==null?void 0:p.subscriptionSettings:null}}))||[]},[e]);return s.jsxRuntimeExports.jsx("div",{className:Et.chargeItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:Et.chargeItemsInner,children:[s.jsxRuntimeExports.jsx(cr,{expiresAt:e==null?void 0:e.expiresAt}),s.jsxRuntimeExports.jsxs("div",{className:Et.productsContainer,children:[(e==null?void 0:e.name)&&s.jsxRuntimeExports.jsxs("header",{className:Et.chargeHeader,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:Et.chargeTitle,id:"h5",children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:Et.chargeDescription,id:"md",children:e.description})]}),((a=e.order)==null?void 0:a.id)&&s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",className:Et.copyButton,onClick:()=>{var o;return t(((o=e.order)==null?void 0:o.id)||"")},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),"Copy Order ID"]})]}),s.jsxRuntimeExports.jsxs("div",{style:{flex:1},children:[!!i.length&&s.jsxRuntimeExports.jsx("div",{className:Et.productsList,children:i.map(o=>s.jsxRuntimeExports.jsx(Pi,{product:o},o.id))}),s.jsxRuntimeExports.jsx(dr,{formatter:r,coupon:null,total:(e==null?void 0:e.price.amount)||0,discount:0,totalWithDiscount:(e==null?void 0:e.price.amount)||0,isShowSubtotal:!1})]}),s.jsxRuntimeExports.jsxs("div",{children:[e&&s.jsxRuntimeExports.jsx("div",{className:Et.trackingContainer,children:s.jsxRuntimeExports.jsx(s.TrackPayment,{timeline:e.timeline})}),s.jsxRuntimeExports.jsx(vt,{className:Et.footerContainer})]})]})]})})},Zy="_checkoutOrderMainData_hqf60_1",Jy="_orderDetailRow_hqf60_6",e5="_chargeIdRow_hqf60_16",t5="_detailLabel_hqf60_25",n5="_detailValue_hqf60_29",r5="_chargeIdContainer_hqf60_33",s5="_chargeId_hqf60_16",i5="_copyIcon_hqf60_51",Ue={checkoutOrderMainData:Zy,orderDetailRow:Jy,chargeIdRow:e5,detailLabel:t5,detailValue:n5,chargeIdContainer:r5,chargeId:s5,copyIcon:i5},Tl=({lastUpdate:e,invoiceId:t,email:n,paymentType:r})=>{const i=s.useCopy(),[a,o]=k.useState(null),u=a==null?void 0:a.find(d=>d.name===r);k.useEffect(()=>{a||(async()=>{const m=[r],h=await s.getGatewaysDetail(m);o(h)})()},[r,a]);const c=d=>{const m=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h=d.getDate().toString().padStart(2,"0"),f=m[d.getMonth()],p=d.getFullYear(),x=d.getHours(),g=d.getMinutes().toString().padStart(2,"0"),S=d.getSeconds().toString().padStart(2,"0"),b=x>=12?"PM":"AM",A=(x%12||12).toString().padStart(2,"0");return`${f} ${h}, ${p} at ${A}:${g}:${S} ${b}`};return s.jsxRuntimeExports.jsxs("div",{className:Ue.checkoutOrderMainData,children:[s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Last Updated"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:c(new Date(e))})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Payment Type"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Email"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:n})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Charge ID"}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdContainer,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.chargeId,id:"md",children:t}),s.jsxRuntimeExports.jsx("div",{className:Ue.copyIcon,onClick:()=>i(t),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})]})]})},a5="_bottomSheet_1yai1_1",o5="_formContainer_1yai1_8",u5="_error_1yai1_14",l5="_buttonGroup_1yai1_18",c5="_buttonWrapper_1yai1_28",d5="_fullWidthButton_1yai1_31",h5="_modal_1yai1_41",m5="_header_1yai1_48",Ft={bottomSheet:a5,formContainer:o5,error:u5,buttonGroup:l5,buttonWrapper:c5,fullWidthButton:d5,modal:h5,header:m5},p5=({chargeId:e,setIsOpen:t})=>{const[n,r]=k.useState(""),[i,a]=k.useState(""),{setIsOpen:o}=s.useModalStore(),u=m=>{try{return new URL(m),!0}catch{return!1}},c=async m=>{if(m.preventDefault(),!n){a("The link field cannot be empty.");return}if(!u(n)){a("Please enter a valid URL");return}await nc({url:n},e)&&(alert("CashApp successfully verified"),t(!1))},d=()=>{o(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ft.modal,onClick:m=>m.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ft.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:d,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsx("form",{onSubmit:c,children:s.jsxRuntimeExports.jsxs("div",{className:Ft.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.formContainer,children:s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:n,onChange:m=>{r(m),a("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),i&&s.jsxRuntimeExports.jsx("p",{className:Ft.error,children:i})]})}),s.jsxRuntimeExports.jsxs("div",{className:Ft.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:d,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ft.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},f5="_container_1opbn_1",x5="_productDetails_1opbn_8",g5="_imageContainer_1opbn_14",E5="_image_1opbn_14",b5="_textContainer_1opbn_32",_5="_header_1opbn_40",T5="_title_1opbn_46",C5="_price_1opbn_53",S5="_badgeContainer_1opbn_57",y5="_description_1opbn_61",bt={container:f5,productDetails:x5,imageContainer:g5,image:E5,textContainer:b5,header:_5,title:T5,price:C5,badgeContainer:S5,description:y5},R5=({subscription:e})=>s.jsxRuntimeExports.jsxs("div",{className:bt.container,children:[s.jsxRuntimeExports.jsxs("div",{className:bt.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:bt.imageContainer,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{className:bt.image,src:s.convertCfImageIdToUrl(e.image.cfId),alt:e==null?void 0:e.name}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:bt.textContainer,children:[s.jsxRuntimeExports.jsx("div",{className:bt.header,children:s.jsxRuntimeExports.jsx("h2",{className:bt.title,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:bt.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx("div",{className:bt.badgeContainer,children:s.jsxRuntimeExports.jsx(s.SubscriptionStatusBadge,{status:e.status})})]}),e.description&&s.jsxRuntimeExports.jsx(ru,{className:bt.description,children:e.description})]}),k5="_card_69liy_1",A5="_price_69liy_10",N5="_interval_69liy_17",I5="_name_69liy_22",w5="_description_69liy_28",j5="_currentPlan_69liy_32",L5="_selectButton_69liy_45",v5="_progressSection_69liy_50",P5="_progressLabel_69liy_54",O5="_bottomSheet_69liy_60",D5="_title_69liy_69",M5="_typeSelector_69liy_80",B5="_typeOption_69liy_90",F5="_active_69liy_100",H5="_saveTag_69liy_108",U5="_planSelector_69liy_117",$5="_modal_69liy_127",z5="_inactive_69liy_148",W5="_notMounted_69liy_151",q5="_closeButton_69liy_157",ye={card:k5,price:A5,interval:N5,name:I5,description:w5,currentPlan:j5,selectButton:L5,progressSection:v5,progressLabel:P5,bottomSheet:O5,title:D5,typeSelector:M5,typeOption:B5,active:F5,saveTag:H5,planSelector:U5,modal:$5,inactive:z5,notMounted:W5,closeButton:q5},V5=({variant:e,onSelect:t,isCurrent:n})=>{const r=e.subscriptionSettings.recurringIntervalDays===30?"month":e.subscriptionSettings.recurringIntervalDays===365?"year":"period",i=e.subscriptionSettings.price.amount.toFixed(2),a=e.subscriptionSettings.recurringIntervalDays,o=10;return s.jsxRuntimeExports.jsxs("div",{className:ye.card,onClick:t,children:[s.jsxRuntimeExports.jsxs("h2",{className:ye.price,children:["$",i," ",s.jsxRuntimeExports.jsxs("span",{className:ye.interval,children:["/ ",r]})]}),s.jsxRuntimeExports.jsx("h3",{className:ye.name,children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:ye.description,children:e.description}),n?s.jsxRuntimeExports.jsxs("div",{className:ye.currentPlan,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check"}),"Your current Plan"]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",className:ye.selectButton,children:"Select"}),n&&s.jsxRuntimeExports.jsxs("div",{className:ye.progressSection,children:[s.jsxRuntimeExports.jsx(go,{percent:o/a*100,disablePercentLabel:!0}),s.jsxRuntimeExports.jsxs("p",{className:ye.progressLabel,children:["Used: ",o," of ",a," days"]})]})]})},Y5=({isOpen:e,setIsOpen:t,subscription:n})=>{const[r,i]=k.useState(null),[a,o]=k.useState(null),[u,c]=k.useState(null),{id:d,accessToken:m}=s.useParams(),[h,f]=k.useState(!1),[p,x]=k.useState(!1),{setIsOpen:g}=s.useModalStore();k.useEffect(()=>{e&&f(!0)},[e]);const S=()=>{t(!1)},[b,A]=k.useState(null);k.useEffect(()=>{d&&m&&(async()=>{if(d&&m){const{data:N}=await s.getSubscriptionUpgradePlans({id:d,accessToken:m});A(N)}})()},[d,m]),k.useEffect(()=>{var j;if(b!=null&&b.data.types[0]){const N=(j=b.data.types.flatMap(q=>q.productVariants).find(q=>q.data.id===(n==null?void 0:n.variantId)))==null?void 0:j.data;N&&(c(N),o(N))}},[b,n]),k.useEffect(()=>{b!=null&&b.data.types[0]&&i(b==null?void 0:b.data.types[0])},[b==null?void 0:b.data.types]);const y=j=>{i(j),o(null)},P=j=>{o(j),g(!0),x(!0)};return s.jsxRuntimeExports.jsxs("div",{className:s.clx(ye.modal,{[ye.active]:e,[ye.inactive]:!e&&h,[ye.notMounted]:!h}),onClick:j=>j.stopPropagation(),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:S,hoverable:!0,className:ye.closeButton,fill:"var(--text-primary)"}),s.jsxRuntimeExports.jsxs("div",{className:ye.bottomSheet,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:ye.title,children:"Change Plan"}),s.jsxRuntimeExports.jsx("p",{className:ye.description,children:b==null?void 0:b.data.description}),s.jsxRuntimeExports.jsx("div",{className:ye.typeSelector,children:b==null?void 0:b.data.types.map(j=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(ye.typeOption,{[ye.active]:(r==null?void 0:r.id)===j.id}),onClick:()=>y(j),children:[j.name,j.name==="Yearly"&&s.jsxRuntimeExports.jsx("span",{className:ye.saveTag,children:"Save %"})]},j.id))}),r&&s.jsxRuntimeExports.jsx("div",{className:ye.planSelector,children:r.productVariants.map(j=>s.jsxRuntimeExports.jsx(V5,{variant:j.data,isSelected:(a==null?void 0:a.id)===j.data.id,isCurrent:(u==null?void 0:u.id)===j.data.id,onSelect:()=>P(j.data)},j.data.id))})]}),p&&a&&n&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>{x(!1)},children:s.jsxRuntimeExports.jsx(MR,{setIsOpen:x,selectedVariant:a,subscription:n})})]})},G5="_container_nb625_1",X5="_title_nb625_11",Q5="_subtitle_nb625_16",K5="_info_nb625_20",Mr={container:G5,title:X5,subtitle:Q5,info:K5},Z5=()=>{const{subscription:e}=s.useSubscriptionStore(),[t,n]=s.extractDateAndTime((e==null?void 0:e.activeTo)||""),[r,i]=k.useState(!1),{setIsOpen:a}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Mr.container,children:[s.jsxRuntimeExports.jsxs("div",{className:Mr.info,children:[s.jsxRuntimeExports.jsx("p",{className:Mr.title,children:"Expiration Date"}),s.jsxRuntimeExports.jsxs("p",{className:Mr.subtitle,children:[t," at ",n]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:o=>{o.stopPropagation(),a(!0),i(!0)},children:"Extend"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>i(!1),children:s.jsxRuntimeExports.jsx(t6,{setIsOpen:i})})]})},J5="_couponContainer_1sspa_1",eR="_iconWrapper_1sspa_10",tR="_details_1sspa_21",nR="_title_1sspa_25",rR="_progress_1sspa_29",sR="_foreverText_1sspa_34",fn={couponContainer:J5,iconWrapper:eR,details:tR,title:nR,progress:rR,foreverText:sR},iR=({coupon:e,currency:t})=>{const n=e.isFixed?s.formatPrice({amount:e.discount,currency:t}):`${e.discount}%`,r=e.initialCouponDurationForSubscriptions?s.percentageDifference(e.initialCouponDurationForSubscriptions,e.currentCouponDurationForSubscriptions||1):100;return s.jsxRuntimeExports.jsxs("div",{className:fn.couponContainer,children:[s.jsxRuntimeExports.jsx("div",{className:fn.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CheckCircle"})}),s.jsxRuntimeExports.jsxs("div",{className:fn.details,children:[s.jsxRuntimeExports.jsxs("p",{className:fn.title,children:[e.name,", ",n," discount"]}),s.jsxRuntimeExports.jsx("div",{className:fn.progress,children:s.jsxRuntimeExports.jsx(go,{color:"#C2C2C2",percent:r,disablePercentLabel:!0})}),s.jsxRuntimeExports.jsx("p",{className:fn.foreverText,children:"Forever discount code"})]})]})},aR="_paymentMethodContainer_1g0da_4",oR="_paymentMethodTitle_1g0da_15",uR="_activeMethod_1g0da_20",lR="_noMethod_1g0da_28",cR="_activeMethodPaymentMethod_1g0da_37",dR="_paymentMethodLogo_1g0da_47",hR="_paymentMethodNumber_1g0da_57",mR="_method_1g0da_61",Wt={paymentMethodContainer:aR,paymentMethodTitle:oR,activeMethod:uR,noMethod:lR,activeMethodPaymentMethod:cR,paymentMethodLogo:dR,paymentMethodNumber:hR,method:mR},pR="_paymentMethods_1gev0_1",fR="_modal_1gev0_14",xR="_header_1gev0_28",gR="_content_1gev0_37",Jt={paymentMethods:pR,modal:fR,header:xR,content:gR},ER=e=>{const{setIsLoading:t,setIsOpen:n}=e,{subscription:r,setSubscription:i}=s.useSubscriptionStore();if(!r)return null;const{id:a}=s.useParams(),o=s.useNavigate(),{notifications:u,setNotifications:c}=s.useNotificationStore(),{setPaymentMethod:d,setGateway:m,cart:h}=s.useCart(),{setIsOpen:f}=s.useModalStore();async function p(){if(x(),t(!0),a&&r){const{data:g}=await s.changeSubscriptionGateway(a,h.gateway);g.isReconnectPaymentNeeded?o(`/charges/${g.chargeId}`):(c([...u,{status:"success",id:s.v4(),message:"Your action has been successfully completed"}]),i({...r,gatewayName:h.gateway}))}else c([...u,{status:"error",id:s.v4(),message:"Your action has been failed. Try again!"}]);t(!1)}function x(){f(!1),setTimeout(()=>{n(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:Jt.modal,onClick:g=>{g.stopPropagation()},children:[s.jsxRuntimeExports.jsxs("div",{className:Jt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Jt.title,children:"Choose Payment Method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Jt.content,children:[(r==null?void 0:r.availableGateways)&&s.jsxRuntimeExports.jsx(bl,{possibleGateways:{availableGateways:r.availableGateways,requiresSignInGateways:r.availableGateways},setGateway:m,setPaymentMethod:d,totalAndDiscount:{total:(r==null?void 0:r.price.amount)||0,totalWithDiscount:r==null?void 0:r.price.amount},onSignInClick:()=>o("/customer-dash")}),s.jsxRuntimeExports.jsxs("div",{className:Jt.paymentMethods,children:[s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!h.gateway,onClick:()=>p(),children:"Continue"})})]})]})]})},bR="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20131.39%2086.9'%3e%3cdefs%3e%3cstyle%3e.a{opacity:0;}.b{fill:%23fff;}.c{fill:%23ff5f00;}.d{fill:%23eb001b;}.e{fill:%23f79e1b;}%3c/style%3e%3c/defs%3e%3ctitle%3eAsset%201%3c/title%3e%3cg%20class='a'%3e%3crect%20class='b'%20width='131.39'%20height='86.9'/%3e%3c/g%3e%3crect%20class='c'%20x='48.37'%20y='15.14'%20width='34.66'%20height='56.61'/%3e%3cpath%20class='d'%20d='M51.94,43.45a35.94,35.94,0,0,1,13.75-28.3,36,36,0,1,0,0,56.61A35.94,35.94,0,0,1,51.94,43.45Z'/%3e%3cpath%20class='e'%20d='M120.5,65.76V64.6H121v-.24h-1.19v.24h.47v1.16Zm2.31,0v-1.4h-.36l-.42,1-.42-1h-.36v1.4h.26V64.7l.39.91h.27l.39-.91v1.06Z'/%3e%3cpath%20class='e'%20d='M123.94,43.45a36,36,0,0,1-58.25,28.3,36,36,0,0,0,0-56.61,36,36,0,0,1,58.25,28.3Z'/%3e%3c/svg%3e",_R=()=>{var x,g,S;const{subscription:e}=s.useSubscriptionStore(),{cart:t,setPaymentMethod:n}=s.useCart(),r=s.useNavigate(),[i,a]=k.useState(null),[o,u]=k.useState(!1),[c,d]=k.useState(!1),{setIsOpen:m}=s.useModalStore();if(!e)return null;const[h,f]=k.useState(e.gatewayName||t.gateway),p=t.paymentMethod;return k.useEffect(()=>{(async()=>{const A=await s.getGatewaysDetail(e.availableGateways);a(A)})()},[]),k.useEffect(()=>{t.gateway!==h&&f(t.gateway)},[t.gateway]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodContainer,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("p",{className:Wt.paymentMethodTitle,children:"Active Payment Method"}),e.gatewayInfo&&Object.keys(e.gatewayInfo).length>0&&s.jsxRuntimeExports.jsx(TR,{gatewayInfo:e.gatewayInfo}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h==="Balance"&&s.jsxRuntimeExports.jsx(El,{gateway:h,gatewayDisplayName:h,total:(e==null?void 0:e.price.amount)||0,onSignInClick:()=>r("/customer-dash")}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&!h&&s.jsxRuntimeExports.jsx("span",{className:Wt.noMethod,children:"Payment method is not set"}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h&&s.jsxRuntimeExports.jsx("div",{className:Wt.activeMethod,children:i&&s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(x=i.find(b=>b.name===h))==null?void 0:x.logoCfImageId,gatewayDisplayName:(g=i.find(b=>b.name===h))==null?void 0:g.displayName,gateway:h,poweredByLogoCfId:(S=i.find(b=>b.name===h))==null?void 0:S.poweredByImageCfImageId,className:Wt.activeMethodPaymentMethod,selected:p===h,onSelect:b=>{n(b)}},h)})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:b=>{b.stopPropagation(),m(!0),d(!0)},children:t.gateway?"Change":"Manage"})]}),c&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>d(!1),children:s.jsxRuntimeExports.jsx(ER,{setIsLoading:u,setIsOpen:d})})]})},TR=({gatewayInfo:e})=>{var t,n,r,i,a;return s.jsxRuntimeExports.jsxs("div",{className:Wt.method,children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodLogo,children:[((t=e.card)==null?void 0:t.brand.toLowerCase())==="visa"&&s.jsxRuntimeExports.jsx(s.Visa,{}),((n=e.card)==null?void 0:n.brand.toLowerCase())==="mastercard"&&s.jsxRuntimeExports.jsx("img",{src:bR,alt:"",width:22}),((r=e.card)==null?void 0:r.brand.toLowerCase())!=="visa"&&((i=e.card)==null?void 0:i.brand.toLowerCase())!=="mastercard"&&s.jsxRuntimeExports.jsx(s.Icon,{name:"CreditCard",width:22})]}),s.jsxRuntimeExports.jsxs("p",{className:Wt.paymentMethodNumber,children:["•••• •••• •••• ",(a=e.card)==null?void 0:a.last4]})]})},CR="_subscriptionProductContainer_83ibx_4",SR="_subscriptionProductImage_83ibx_15",yR="_subscriptionProductInfo_83ibx_32",RR="_name_83ibx_37",kR="_price_83ibx_40",Vn={subscriptionProductContainer:CR,subscriptionProductImage:SR,subscriptionProductInfo:yR,name:RR,price:kR},AR=({subscription:e,id:t,accessToken:n})=>{const[r,i]=k.useState(!1),{setIsOpen:a}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Vn.subscriptionProductContainer,onClick:o=>o.stopPropagation(),children:[s.jsxRuntimeExports.jsx("div",{className:Vn.subscriptionProductImage,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(e.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:Vn.subscriptionProductInfo,children:[s.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:s.jsxRuntimeExports.jsx("h2",{className:Vn.name,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:Vn.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:o=>{o.preventDefault(),i(!0),a(!0)},children:"Cancel"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>i(!1),children:s.jsxRuntimeExports.jsx(p6,{accessToken:n,id:t,isOpen:r,setIsOpen:i})})]})},NR="_content_5ctxw_1",IR="_selectedPlan_5ctxw_37",wR="_planName_5ctxw_44",jR="_description_5ctxw_48",LR="_price_5ctxw_51",vR="_buttonGroup_5ctxw_79",PR="_buttonWrapper_5ctxw_84",OR="_modal_5ctxw_88",DR="_header_5ctxw_95",lt={content:NR,selectedPlan:IR,planName:wR,description:jR,price:LR,buttonGroup:vR,buttonWrapper:PR,modal:OR,header:DR},MR=({setIsOpen:e,selectedVariant:t,subscription:n})=>{if(!t)return null;const{setIsOpen:r}=s.useModalStore(),i=()=>{a()},a=()=>{r(!1),setTimeout(()=>{e(!1)},300)},o=(t.subscriptionSettings.compareAtPrice||t.subscriptionSettings.price).amount,u=t.subscriptionSettings.compareAtPrice?t.subscriptionSettings.compareAtPrice.amount-t.subscriptionSettings.price.amount:t.subscriptionSettings.price.amount,c=o-u,d=new Intl.NumberFormat("en-US",{style:"currency",currency:n.price.currency});return s.jsxRuntimeExports.jsxs("div",{className:lt.modal,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:()=>a(),fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.content,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.selectedPlan,children:[s.jsxRuntimeExports.jsx("h2",{className:lt.planName,children:t.name}),s.jsxRuntimeExports.jsx("p",{className:lt.description,children:t.description}),s.jsxRuntimeExports.jsxs("p",{className:lt.price,children:["$",t.subscriptionSettings.price.amount.toFixed(2)," /"," ",t.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),s.jsxRuntimeExports.jsx(dr,{formatter:d,coupon:null,total:c,discount:u})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>a(),children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Primary",onClick:i,children:["Upgrade for $",c.toFixed(2)]})})]})]})]})},BR="_reviewMessage_1t8u4_1",FR="_leaveReviewContainer_1t8u4_11",HR="_leaveReviewTitle_1t8u4_20",zs={reviewMessage:BR,leaveReviewContainer:FR,leaveReviewTitle:HR},UR=({review:e,orderId:t,className:n})=>{const[r,i]=k.useState((e==null?void 0:e.rating)||0),[a,o]=k.useState(!1),{setIsOpen:u}=s.useModalStore(),{notifications:c,setNotifications:d}=s.useNotificationStore(),m=async h=>{e&&"accessToken"in e&&(await ac({comment:h,rating:r},t,e.accessToken),d([...c,{status:"success",id:s.v4(),message:"Review left successfully"}]),o(!1))};return k.useEffect(()=>{e&&r&&"accessToken"in e&&!e.rating&&(u(!0),o(!0))},[r]),e?e.rating&&"accessToken"in e?s.jsxRuntimeExports.jsxs("div",{className:zs.reviewMessage,children:["You left a ",e.rating," star rating"]}):s.jsxRuntimeExports.jsxs("div",{className:s.clx(zs.leaveReviewContainer,n),children:[s.jsxRuntimeExports.jsx("p",{className:zs.leaveReviewTitle,children:"Leave a review"}),s.jsxRuntimeExports.jsx(Hf,{rating:r,setRating:i,disabled:!!e.rating||!("accessToken"in e)}),a&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(XR,{setIsOpen:o,onSubmit:m})})]}):null},$R="_bottomSheet_1bcyj_1",zR="_content_1bcyj_7",WR="_title_1bcyj_18",qR="_buttonGroup_1bcyj_22",VR="_buttonWrapper_1bcyj_33",YR="_modal_1bcyj_37",GR="_header_1bcyj_44",Ht={bottomSheet:$R,content:zR,title:WR,buttonGroup:qR,buttonWrapper:VR,modal:YR,header:GR},XR=({setIsOpen:e,onSubmit:t})=>{const[n,r]=k.useState(""),{setIsOpen:i}=s.useModalStore(),a=()=>{i(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ht.modal,onClick:o=>o.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ht.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ht.title,children:"Review Description"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:a,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Ht.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.content,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{placeholder:"Great product and fast checkout...",value:n,onChange:o=>r(o),label:"Describe your review in detail below"})}),s.jsxRuntimeExports.jsxs("div",{className:Ht.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:a,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!n,onClick:()=>{a(),t(n)},children:"Submit"})})]})]})]})},QR="_container_1idhv_1",KR="_buttonGroup_1idhv_8",ZR="_buttonWrapper_1idhv_15",JR="_header_1idhv_19",e6="_content_1idhv_28",en={container:QR,buttonGroup:KR,buttonWrapper:ZR,header:JR,content:e6},t6=({setIsOpen:e})=>{const{subscription:t}=s.useSubscriptionStore(),{getTotalAndDiscount:n,cart:r,coupon:i}=s.useCart(),[a,o]=k.useState(1),u=s.useNavigate(),{setIsOpen:c}=s.useModalStore(),{setNotifications:d,notifications:m}=s.useNotificationStore(),[h,f]=k.useState(!1),p=k.useMemo(()=>n(),[i,r]),x=k.useMemo(()=>p.totalWithDiscount?p.total-p.totalWithDiscount:0,[p]);if(h)return s.jsxRuntimeExports.jsx(s.ProcessingPaymentModal,{});const g=(t==null?void 0:t.price.currency)||"USD",S=new Intl.NumberFormat("en-US",{style:"currency",currency:g});async function b(){var y;f(!0);try{const{data:P}=await s.extendSubscription((t==null?void 0:t.id)||"",{});d([{id:s.v4(),message:"Order created successfully",status:"success"}]),u(`/orders/${(y=P.data)==null?void 0:y.id}/${P.data.fullAccessToken}`)}catch(P){const j=P;d([...m,{id:s.v4(),message:`Order creation failed: ${j.message}`,status:"error"}]),A()}finally{f(!1)}}function A(){c(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:en.container,onClick:y=>y.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:en.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:en.title,children:"Extend Subscription"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:A,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:en.content,children:[s.jsxRuntimeExports.jsx(Zf,{step:a,totalSteps:12,onStepChange:o,label:"How long would you like to extend your subscription for?"}),s.jsxRuntimeExports.jsx(dr,{formatter:S,coupon:i,total:p.total,discount:x,totalWithDiscount:p.totalWithDiscount}),s.jsxRuntimeExports.jsxs("div",{className:en.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:A,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:b,children:"Extend"})})]})]})]})},n6="_bottomSheet_uw5jb_1",r6="_content_uw5jb_7",s6="_radioGroup_uw5jb_11",i6="_confirmation_uw5jb_26",a6="_iconWrapper_uw5jb_33",o6="_title_uw5jb_42",u6="_message_uw5jb_48",l6="_buttonGroup_uw5jb_54",c6="_buttonWrapper_uw5jb_64",d6="_modal_uw5jb_68",h6="_header_uw5jb_77",Le={bottomSheet:n6,content:r6,radioGroup:s6,confirmation:i6,iconWrapper:a6,title:o6,message:u6,buttonGroup:l6,buttonWrapper:c6,modal:d6,header:h6},m6={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},p6=({isOpen:e,setIsOpen:t,id:n,accessToken:r})=>{const[i,a]=k.useState(0),[o,u]=k.useState(!1),[c,d]=k.useState(""),[m,h]=k.useState(""),{setIsOpen:f}=s.useModalStore(),p=async()=>{if(!c)return;u(!0);const g=await s.cancelSubscription(n,r,{reason:c==="Other reason"?m:c});u(!1),g&&a(2)};k.useEffect(()=>{e||(a(0),d(""),h(""))},[e]);const x=()=>{f(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Le.modal,onClick:g=>g.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Le.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:m6[i]||""}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Le.content,children:[i===0&&s.jsxRuntimeExports.jsxs("div",{className:Le.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),s.jsxRuntimeExports.jsxs("div",{className:Le.radioGroup,children:[s.jsxRuntimeExports.jsx(s.Radio,{defaultValue:c,onChange:g=>d(g),options:[{value:"Found another company",label:"Found another company"},{value:"Expensive",label:"Expensive"},{value:"Technical problems",label:"Technical problems"},{value:"Support problems",label:"Support problems"},{value:"Other reason",label:"Other reason"}],flexDirection:"column"}),c==="Other reason"&&s.jsxRuntimeExports.jsx(s.Textarea$1,{value:m,onChange:g=>h(g),placeholder:"Describe the reason..."})]}),s.jsxRuntimeExports.jsxs("div",{className:Le.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Le.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:Le.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:()=>c&&a(1),disabled:!c,children:"Continue"})})]})]}),i===1&&s.jsxRuntimeExports.jsxs("div",{className:Le.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),s.jsxRuntimeExports.jsxs("div",{className:Le.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Le.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:Le.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:p,disabled:o,children:"Cancel it anyway"})})]})]}),i===2&&s.jsxRuntimeExports.jsxs("div",{className:Le.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:`${Le.confirmation}`,children:[s.jsxRuntimeExports.jsx("div",{className:Le.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"})}),s.jsxRuntimeExports.jsx("p",{className:Le.title,children:"Subscription Cancelled"}),s.jsxRuntimeExports.jsx("p",{className:Le.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),s.jsxRuntimeExports.jsx("div",{className:Le.buttonGroup,children:s.jsxRuntimeExports.jsx("div",{className:Le.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Close"})})})]})]})]})},f6="_checkoutContainer_wkomn_1",x6="_loaderContainer_wkomn_20",Ws={checkoutContainer:f6,loaderContainer:x6},g6=()=>{const{cart:e,products:t,pending:n,getTotalAndDiscount:r,getPossibleGateways:i,submitCart:a,setGateway:o,applyCoupon:u,setDiscordSocialConnectId:c,setCustomFields:d,applyCouponPending:m,coupon:h,removeCoupon:f,getDiscordSettings:p,setPaymentMethod:x,reset:g}=s.useCart(),S=k.useMemo(()=>r(),[h,e]),b=s.useNavigate();return k.useEffect(()=>{if(e.parts.length===0)try{b(-1)}catch{b("/")}},[e.parts]),n?s.jsxRuntimeExports.jsx("div",{className:Ws.checkoutContainer,children:s.jsxRuntimeExports.jsx("div",{className:Ws.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})})}):s.jsxRuntimeExports.jsxs("div",{className:Ws.checkoutContainer,children:[s.jsxRuntimeExports.jsx(IS,{cart:e,products:t,applyCoupon:u,applyCouponPending:m,coupon:h,removeCoupon:f,totalAndDiscount:S}),s.jsxRuntimeExports.jsx(my,{cart:e,getPossibleGateways:i,setGateway:o,getDiscordSettings:p,products:t,submitCart:a,totalAndDiscount:S,setCustomFieldsToCart:d,setDiscordSocialConnectId:c,setPaymentMethod:x,reset:g})]})},E6="_chargePageContainer_1a200_1",b6="_chargeItems_1a200_14",_6="_mainContent_1a200_25",T6="_contentWrapper_1a200_36",C6="_statusBlock_1a200_41",S6="_notPaidSection_1a200_45",y6="_footer_1a200_53",R6="_loaderContainer_1a200_63",Ut={chargePageContainer:E6,chargeItems:b6,mainContent:_6,contentWrapper:T6,statusBlock:C6,notPaidSection:S6,footer:y6,loaderContainer:R6},k6=()=>{const{id:e}=s.useParams(),[t,n]=s.useSearchParams(),[r,i]=k.useState(!1),[a,o]=k.useState(),[u,c]=k.useState(!0),d=s.useNavigate(),m=k.useRef(),{setIsOpen:h}=s.useModalStore();return k.useEffect(()=>{const f=async(x,g=!1)=>{g||i(!0);const{data:S}=await oc(x);i(!1),o(S)},p=setInterval(()=>{e&&f(e,!0)},5e3);return e&&f(e),()=>{clearInterval(p)}},[]),k.useEffect(()=>{const f=setTimeout(()=>{console.log("charge timeout",a);const p=t.get("redirectRoute");(a==null?void 0:a.status)===s.ChargeStatus.Paid&&a.redirectUrl&&!m.current&&window.open(a.redirectUrl,"_self"),(a==null?void 0:a.status)===s.ChargeStatus.Paid&&m.current&&d(m.current,{replace:!0}),p&&m&&(m.current=p,t.delete("redirectRoute"),n(t))},1e3);return()=>clearTimeout(f)},[a]),k.useEffect(()=>{((a==null?void 0:a.gateway)==="PayPalFF"||(a==null?void 0:a.gateway)==="Сashapp")&&h(!0)},[a]),r?s.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:Ut.chargePageContainer,children:[s.jsxRuntimeExports.jsx("div",{className:Ut.chargeItems,children:s.jsxRuntimeExports.jsx(Ky,{charge:a})}),s.jsxRuntimeExports.jsx("div",{className:Ut.mainContent,children:s.jsxRuntimeExports.jsxs("div",{className:Ut.contentWrapper,children:[a&&(a==null?void 0:a.status)!==s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx(s.ChargeStatusBlock,{charge:a}),a&&s.jsxRuntimeExports.jsx("div",{className:`${Ut.statusBlock}`,children:s.jsxRuntimeExports.jsx(Tl,{lastUpdate:a.expiresAt,email:a.customerForCharge.email,invoiceId:a.id,paymentType:a.gateway})}),(a==null?void 0:a.status)===s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx("div",{className:Ut.notPaidSection,children:a==null?void 0:a.displayPaymentInfo.map((f,p)=>s.jsxRuntimeExports.jsx(_l,{block:f},p))}),s.jsxRuntimeExports.jsx(vt,{className:Ut.footer})]})}),(a==null?void 0:a.gateway)==="PayPalFF"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>c(!1),children:s.jsxRuntimeExports.jsx(Hy,{price:a.price,setIsOpen:c})}),(a==null?void 0:a.gateway)==="Сashapp"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>i(!1),children:s.jsxRuntimeExports.jsx(p5,{setIsOpen:c,chargeId:a.id})})]})},A6="_wrapper_1fax2_1",N6="_title_1fax2_20",I6="_container_1fax2_26",w6="_content_1fax2_36",j6="_messages_1fax2_46",L6="_input_1fax2_58",v6="_textarea_1fax2_64",P6="_message_1fax2_46",O6="_messageDate_1fax2_88",D6="_myMessage_1fax2_94",M6="_otherMessage_1fax2_101",B6="_button_1fax2_108",F6="_loadingMessage_1fax2_117",$e={wrapper:A6,title:N6,container:I6,content:w6,messages:j6,input:L6,textarea:v6,message:P6,messageDate:O6,myMessage:D6,otherMessage:M6,button:B6,loadingMessage:F6},H6=()=>{const e=window.location.pathname.split("/"),t=e[e.length-1],n=e[e.length-2],[r,i]=k.useState(!0),[a,o]=k.useState(null),[u,c]=k.useState(""),[d,m]=k.useState(null),{executeRecaptcha:h}=s.useReCaptcha(),f=async()=>{if(n&&t){const{data:g}=await s.fetchTicket(n,t);o(g),i(!1)}};k.useEffect(()=>{f();const g=setInterval(()=>{f()},5e3);return()=>clearInterval(g)},[]);const p=async()=>{const g=await h();if(!n||!t||!g||!u.trim())return;const S={content:u,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};o(b=>b?{...b,messages:[...b.messages,S]}:null),m(S.id),c("");try{await s.sendTicketMessage(n,t,u,g),await f()}finally{setTimeout(()=>{m(null)},1e4)}},x=g=>{const S=new Date,b=new Date(g),A=Math.floor((S.getTime()-b.getTime())/1e3);if(A<60)return"right now";if(A<3600){const y=Math.floor(A/60);return`${y} minute${y>1?"s":""} ago`}else if(A<10800){const y=Math.floor(A/3600);return`${y} hour${y>1?"s":""} ago`}else return b.getFullYear()===S.getFullYear()?b.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):b.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return s.jsxRuntimeExports.jsx("div",{className:$e.wrapper,children:r&&!a?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs("div",{className:$e.container,children:[s.jsxRuntimeExports.jsx("div",{className:$e.title,children:`#${n} (${a==null?void 0:a.title})`}),s.jsxRuntimeExports.jsxs("div",{className:$e.content,children:[s.jsxRuntimeExports.jsx("div",{className:$e.messages,children:a==null?void 0:a.messages.sort((g,S)=>new Date(g.createdAt).getTime()-new Date(S.createdAt).getTime()).map(g=>s.jsxRuntimeExports.jsxs("div",{className:s.clx($e.message,{[$e.myMessage]:!g.isSellerReply,[$e.otherMessage]:g.isSellerReply,[$e.loadingMessage]:d===g.id}),children:[s.jsxRuntimeExports.jsx("div",{className:$e.messageContent,children:s.splitTextIntoSpans(g.content,!1)}),d!==g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:x(g.createdAt)}),d===g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:s.jsxRuntimeExports.jsx(s.Loader,{})})]},g.id))}),s.jsxRuntimeExports.jsxs("div",{className:$e.input,children:[s.jsxRuntimeExports.jsx("textarea",{className:$e.textarea,value:u,placeholder:"What worries you?",onChange:g=>c(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),p())},style:{resize:"none",maxHeight:"150px",overflowY:"auto"}}),s.jsxRuntimeExports.jsx("div",{className:$e.button,onClick:p,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"PaperPlaneRight"})})]})]})]})})},U6="_subscriptionContainer_1j6ol_1",$6="_leftSection_1j6ol_15",z6="_content_1j6ol_26",W6="_mainContent_1j6ol_33",q6="_detailsSection_1j6ol_37",V6="_buttonGroup_1j6ol_50",Y6="_detailsContent_1j6ol_57",tn={subscriptionContainer:U6,leftSection:$6,content:z6,mainContent:W6,detailsSection:q6,buttonGroup:V6,detailsContent:Y6},G6=()=>{const{id:e,accessToken:t}=s.useParams(),{subscription:n,setSubscription:r}=s.useSubscriptionStore(),{setIsOpen:i}=s.useModalStore(),[a,o]=k.useState(!1),[u,c]=k.useState(!1);k.useLayoutEffect(()=>{r(null)},[e,t]);const{balanceSettings:d,setBalanceSettings:m}=s.useCustomerDashboardStore();return k.useEffect(()=>{e&&t&&(async()=>{if(!e||!t)return;c(!0);const{data:f}=await s.fetchSubscription(e,t);r({...f}),c(!1)})()},[e,t]),k.useEffect(()=>{d||(async()=>{const f=await s.getBalanceSettings();m(f)})()},[d]),u?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:tn.subscriptionContainer,children:[s.jsxRuntimeExports.jsx("div",{className:tn.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.content,children:[s.jsxRuntimeExports.jsx(cr,{}),s.jsxRuntimeExports.jsxs("div",{className:tn.mainContent,children:[n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),s.jsxRuntimeExports.jsx(R5,{subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),s.jsxRuntimeExports.jsx("div",{className:tn.buttonGroup,children:n.pricingPlanExists&&s.jsxRuntimeExports.jsx(s.Button$1,{onClick:h=>{h.stopPropagation(),i(!0),o(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),s.jsxRuntimeExports.jsx(vt,{})]})]})}),s.jsxRuntimeExports.jsx("div",{className:tn.detailsSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.detailsContent,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(n==null?void 0:n.coupon)&&s.jsxRuntimeExports.jsx(iR,{coupon:n.coupon,currency:n.price.currency||"USD"}),n&&s.jsxRuntimeExports.jsx(AR,{id:e||"",accessToken:t||"",subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(_R,{}),n.activeTo&&s.jsxRuntimeExports.jsx(Z5,{})]}),s.jsxRuntimeExports.jsx(vt,{className:"flex md:hidden"})]})})]}),s.jsxRuntimeExports.jsx(Y5,{isOpen:a,setIsOpen:o,subscription:n})]})},X6="_topUpContainer_1pag6_1",Q6="_formWrapper_1pag6_15",K6="_header_1pag6_29",Z6="_footer_1pag6_82",J6="_wrapper_1pag6_105",Yn={topUpContainer:X6,formWrapper:Q6,header:K6,footer:Z6,wrapper:J6},ek=()=>{const{gatewaysDetail:e,setGatewaysDetail:t,balanceSettings:n,setBalanceSettings:r}=s.useCustomerDashboardStore();return k.useEffect(()=>{!e&&n&&(async()=>{const a=await s.getGatewaysDetail(n!=null&&n.isEnabled?(n==null?void 0:n.topUpSettings.gateways)||[]:[]);t(a)})()},[e,n]),k.useEffect(()=>{n||(async()=>{const a=await s.getBalanceSettings();r(a)})()},[n]),s.jsxRuntimeExports.jsxs("div",{className:Yn.wrapper,children:[s.jsxRuntimeExports.jsx(cr,{className:Yn.header}),s.jsxRuntimeExports.jsx("div",{className:Yn.topUpContainer,children:n?s.jsxRuntimeExports.jsx("div",{className:Yn.formWrapper,children:s.jsxRuntimeExports.jsx(s.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):s.jsxRuntimeExports.jsx(s.Loader,{})}),s.jsxRuntimeExports.jsx("div",{className:Yn.footer,children:s.jsxRuntimeExports.jsx(vt,{})})]})},tk="_orderPage_1nvve_1",nk="_leftSection_1nvve_15",rk="_content_1nvve_35",sk="_main_1nvve_42",ik="_statusBlock_1nvve_54",ak="_timelineBlock_1nvve_58",ok="_footer_1nvve_62",uk="_rightSection_1nvve_71",lk="_header_1nvve_84",ck="_productList_1nvve_92",dk="_mobileFooter_1nvve_99",hk="_loaderContainer_1nvve_108",mk="_orderMainData_1nvve_116",pk="_prices_1nvve_123",fk="_headerTitle_1nvve_127",xk="_headerDescription_1nvve_131",Oe={orderPage:tk,leftSection:nk,content:rk,main:sk,statusBlock:ik,timelineBlock:ak,footer:ok,rightSection:uk,header:lk,productList:ck,mobileFooter:dk,loaderContainer:hk,orderMainData:mk,prices:pk,headerTitle:fk,headerDescription:xk},gk=()=>{var h,f,p;const{id:e,accessToken:t}=s.useParams(),n=s.useNavigate(),[r,i]=k.useState(),[a,o]=k.useState(!1),u=s.useCopy(),c=((h=r==null?void 0:r.rawPrice)==null?void 0:h.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:c}),m=k.useMemo(()=>(r==null?void 0:r.partOrders.map(x=>{var g,S,b,A;return{id:(x==null?void 0:x.id)||0,image:x.productWithVariant.image,name:((g=x.productWithVariant)==null?void 0:g.name)||"",description:((S=x.productWithVariant)==null?void 0:S.description)||"",price:{quantity:x.quantity,amount:((b=x.productWithVariant)==null?void 0:b.price.amount)||0,currency:(A=x.productWithVariant)==null?void 0:A.price.currency},deliveryCategories:"deliveryCategories"in x?x.deliveryCategories:void 0,customerNote:x.customerNote,chargeType:x.chargeType||"ONE_TIME"}}))||[],[r]);return k.useLayoutEffect(()=>{if(e&&!t){const x=JSON.parse(localStorage.getItem("orders")||"{}");x[e]&&n(`/orders/${e}/${x[e].fullAccessToken}`)}},[e]),k.useEffect(()=>{const x=async(S,b=!1)=>{b||o(!0);const{data:A}=await(t?s.fetchAuthorizedOrder(`${S}/${t}`):s.fetchOrder(S));o(!1),A.charge.status===s.ChargeStatus.NotPaid&&n(`/charges/${A.charge.id}`,{replace:!0}),i(A)};e&&x(e);const g=setInterval(()=>{e&&x(e,!0)},5e3);return()=>{clearInterval(g)}},[]),a?s.jsxRuntimeExports.jsx("div",{className:Oe.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:Oe.orderPage,children:[s.jsxRuntimeExports.jsx("div",{className:Oe.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:Oe.content,children:[s.jsxRuntimeExports.jsx(cr,{}),r&&s.jsxRuntimeExports.jsxs("div",{className:Oe.main,children:[s.jsxRuntimeExports.jsx(s.OrderStatusBlock,{className:Oe.statusBlock,orderStatus:r.status}),s.jsxRuntimeExports.jsxs("div",{className:Oe.orderMainData,children:[s.jsxRuntimeExports.jsx(Tl,{lastUpdate:r.createdAt,paymentType:r.charge.gateway,email:r.charge.customerForCharge.email,invoiceId:r.charge.id}),"accessToken"in r.review&&s.jsxRuntimeExports.jsx(UR,{orderId:r.id,review:r.review})]}),r.charge&&s.jsxRuntimeExports.jsx(s.TrackPayment,{className:Oe.timelineBlock,timeline:r.charge.timeline}),s.jsxRuntimeExports.jsx(vt,{className:Oe.footer})]})]})}),s.jsxRuntimeExports.jsx("div",{className:Oe.rightSection,children:s.jsxRuntimeExports.jsxs("div",{className:Oe.content,children:[(r==null?void 0:r.charge.name)&&s.jsxRuntimeExports.jsxs("header",{className:Oe.header,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:Oe.headerTitle,children:r.charge.name}),r.charge.description&&s.jsxRuntimeExports.jsx("p",{className:Oe.headerDescription,children:r.charge.description})]}),s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",onClick:()=>u((r==null?void 0:r.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),s.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:Oe.productList,children:m.map(x=>s.jsxRuntimeExports.jsx(Pi,{product:x,isOrder:!0},x.id))}),s.jsxRuntimeExports.jsx(dr,{formatter:d,coupon:null,total:((f=r==null?void 0:r.charge)==null?void 0:f.price.amount)||0,discount:0,totalWithDiscount:((p=r==null?void 0:r.charge)==null?void 0:p.price.amount)||0,className:Oe.prices,isShowSubtotal:!1}),s.jsxRuntimeExports.jsx(vt,{className:Oe.mobileFooter})]})]})})]})},Ek=e=>{const{blocks:t,settings:n,header:r,footer:i,announcement:a}=e,[o,u]=k.useState(null),{general:c}=s.useGeneralStore(),{setBlocks:d,setSourceBlocks:m,setHeader:h,setFooter:f,setAnnouncement:p,setSettings:x}=s.useBlocksStore(),{setHeader:g,setFooter:S,setAnnouncement:b}=s.useLayersStore(),{themeSettings:A}=s.useThemeSettingsStore(),{settings:y,setSettings:P}=s.useSettingsStore(),j=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,N=localStorage.getItem("shopPassword"),q=localStorage.getItem("shopId")||"";return k.useEffect(()=>{q||localStorage.setItem("shopId",(c==null?void 0:c.info.id)||"")},[c]),k.useEffect(()=>{if(A&&y){const V=hc(A,y);Ec(A),mc(V)}},[A,y,window.location.hostname]),k.useEffect(()=>{const V={};Object.keys(t).map(W=>{V[W]=t[W]}),m(V),d(V),h(r),f(i),p(a),x(n);const K=new r,w=JSON.parse(JSON.stringify(K));g(w,!1);const $=new i,M=JSON.parse(JSON.stringify($));S(M,!1);const H=new a,Y=JSON.parse(JSON.stringify(H));b(Y,!1);const z=new n,X=JSON.parse(JSON.stringify(z));P(X);const G=s.createBrowserRouter([{element:s.jsxRuntimeExports.jsx(uf,{shopDomain:j,shopId:q,shopPassword:N||void 0,children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(nf,{children:s.jsxRuntimeExports.jsx(s.Outlet,{})})})}),errorElement:s.jsxRuntimeExports.jsx(rf,{}),children:[{path:"/admin/builder/*",element:s.jsxRuntimeExports.jsx(Hp,{children:s.jsxRuntimeExports.jsx(Pp,{blocks:t,settings:n,header:r,footer:i,announcement:a})}),errorElement:s.jsxRuntimeExports.jsx(Fp,{})},{path:"/checkout",element:s.jsxRuntimeExports.jsx(g6,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:s.jsxRuntimeExports.jsx(ek,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:s.jsxRuntimeExports.jsx(k6,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(gk,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(G6,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Subscriptions",!0)},{path:"/customer-dash",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderAnnouncement,{}),s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:"1 1 auto"},children:s.jsxRuntimeExports.jsx(s.CustomerDashboard,{})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Customer Dashboard",!0)},{path:"/validation",element:s.jsxRuntimeExports.jsx(Xp,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(H6,{})})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:s.jsxRuntimeExports.jsx(dc,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{})}]}]);u(G)},[c]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:o&&s.jsxRuntimeExports.jsx(s.RouterProvider,{router:o})})};exports.ReCaptchaProvider=s.ReCaptchaProvider;exports.aspectRatioOptions=s.aspectRatioOptions;exports.formatPrice=s.formatPrice;exports.splitTextIntoSpans=s.splitTextIntoSpans;exports.useAdaptiveStyles=s.useAdaptiveStyles;exports.useReCaptcha=s.useReCaptcha;exports.App=Ek;exports.ColorVariables=co;exports.hotReload=bc;exports.iconNames=Sl;exports.useBuilderPages=Tc;exports.useCreateTicket=_c;
131
+ `))}function c(p,x,g,S){const b=g.enter("tableCell"),A=g.enter("phrasing"),y=g.containerPhrasing(p,{...S,before:a,after:a});return A(),b(),y}function d(p,x){return G3(p,{align:x,alignDelimiters:r,padding:n,stringLength:i})}function m(p,x,g){const S=p.children;let b=-1;const A=[],y=x.enter("table");for(;++b<S.length;)A[b]=h(S[b],x,g);return y(),A}function h(p,x,g){const S=p.children;let b=-1;const A=[],y=x.enter("tableRow");for(;++b<S.length;)A[b]=c(S[b],p,x,g);return y(),A}function f(p,x,g){let S=ll.inlineCode(p,x,g);return g.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function OC(){return{exit:{taskListCheckValueChecked:uo,taskListCheckValueUnchecked:uo,paragraph:MC}}}function DC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:BC}}}function uo(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function MC(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let a=-1,o;for(;++a<i.length;){const u=i[a];if(u.type==="paragraph"){o=u;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function BC(e,t,n,r){const i=e.children[0],a=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(o);let c=ll.listItem(e,t,n,{...r,...u.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(m){return m+o}}function FC(){return[g3(),B3(),$3(),NC(),OC()]}function HC(e){return{extensions:[E3(),F3(e),z3(),PC(e),DC()]}}const UC={tokenize:YC,partial:!0},cl={tokenize:GC,partial:!0},dl={tokenize:XC,partial:!0},hl={tokenize:QC,partial:!0},$C={tokenize:KC,partial:!0},ml={name:"wwwAutolink",tokenize:qC,previous:fl},pl={name:"protocolAutolink",tokenize:VC,previous:xl},Pt={name:"emailAutolink",tokenize:WC,previous:gl},yt={};function zC(){return{text:yt}}let Zt=48;for(;Zt<123;)yt[Zt]=Pt,Zt++,Zt===58?Zt=65:Zt===91&&(Zt=97);yt[43]=Pt;yt[45]=Pt;yt[46]=Pt;yt[95]=Pt;yt[72]=[Pt,pl];yt[104]=[Pt,pl];yt[87]=[Pt,ml];yt[119]=[Pt,ml];function WC(e,t,n){const r=this;let i,a;return o;function o(h){return!li(h)||!gl.call(r,r.previous)||vi(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return li(h)?(e.consume(h),u):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check($C,m,d)(h):h===45||h===95||Be(h)?(a=!0,e.consume(h),c):m(h)}function d(h){return e.consume(h),i=!0,c}function m(h){return a&&i&&ze(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function qC(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!fl.call(r,r.previous)||vi(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(UC,e.attempt(cl,e.attempt(dl,a),n),n)(o))}function a(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function VC(e,t,n){const r=this;let i="",a=!1;return o;function o(h){return(h===72||h===104)&&xl.call(r,r.previous)&&!vi(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(ze(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),a?d:(a=!0,c)):n(h)}function d(h){return h===null||qr(h)||_e(h)||an(h)||Jr(h)?n(h):e.attempt(cl,e.attempt(dl,m),n)(h)}function m(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function YC(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),a):n(o)}function a(o){return o===null?n(o):t(o)}}function GC(e,t,n){let r,i,a;return o;function o(d){return d===46||d===95?e.check(hl,c,u)(d):d===null||_e(d)||an(d)||d!==45&&Jr(d)?c(d):(a=!0,e.consume(d),o)}function u(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),o}function c(d){return i||r||!a?n(d):t(d)}}function XC(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(hl,t,a)(o):o===null||_e(o)||an(o)?t(o):(e.consume(o),i)}function a(o){return o===41&&r++,e.consume(o),i}}function QC(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),a):u===93?(e.consume(u),i):u===60||u===null||_e(u)||an(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||_e(u)||an(u)?t(u):r(u)}function a(u){return ze(u)?o(u):n(u)}function o(u){return u===59?(e.consume(u),r):ze(u)?(e.consume(u),o):n(u)}}function KC(e,t,n){return r;function r(a){return e.consume(a),i}function i(a){return Be(a)?n(a):t(a)}}function fl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||_e(e)}function xl(e){return!ze(e)}function gl(e){return!(e===47||li(e))}function li(e){return e===43||e===45||e===46||e===95||Be(e)}function vi(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ZC={tokenize:aS,partial:!0};function JC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:rS,continuation:{tokenize:sS},exit:iS}},text:{91:{name:"gfmFootnoteCall",tokenize:nS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:eS,resolveTo:tS}}}}function eS(e,t,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!o||!o._balanced)return n(c);const d=mt(r.sliceSerialize({start:o.end,end:r.now()}));return d.codePointAt(0)!==94||!a.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function tS(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function nS(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,o;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(h){if(a>999||h===93&&!o||h===null||h===91||_e(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(mt(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return _e(h)||(o=!0),a++,e.consume(h),h===92?m:d}function m(h){return h===91||h===92||h===93?(e.consume(h),a++,d):d(h)}}function rS(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,o=0,u;return c;function c(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(x)}function m(x){if(o>999||x===93&&!u||x===null||x===91||_e(x))return n(x);if(x===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return a=mt(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return _e(x)||(u=!0),o++,e.consume(x),x===92?h:m}function h(x){return x===91||x===92||x===93?(e.consume(x),o++,m):m(x)}function f(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),i.includes(a)||i.push(a),pe(e,p,"gfmFootnoteDefinitionWhitespace")):n(x)}function p(x){return t(x)}}function sS(e,t,n){return e.check(mr,t,e.attempt(ZC,t,n))}function iS(e){e.exit("gfmFootnoteDefinition")}function aS(e,t,n){const r=this;return pe(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(a):n(a)}}function oS(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,u){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let d=c;for(;d--;)if(o[d][0]==="exit"&&o[d][1].type==="strikethroughSequenceTemporary"&&o[d][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[d][1].end.offset-o[d][1].start.offset){o[c][1].type="strikethroughSequence",o[d][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},o[d][1].start),end:Object.assign({},o[c][1].end)},h={type:"strikethroughText",start:Object.assign({},o[d][1].end),end:Object.assign({},o[c][1].start)},f=[["enter",m,u],["enter",o[d][1],u],["exit",o[d][1],u],["enter",h,u]],p=u.parser.constructs.insideSpan.null;p&&Ke(f,f.length,0,es(p,o.slice(d+1,c),u)),Ke(f,f.length,0,[["exit",h,u],["enter",o[c][1],u],["exit",o[c][1],u],["exit",m,u]]),Ke(o,d-1,c-d+3,f),c=d+f.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function a(o,u,c){const d=this.previous,m=this.events;let h=0;return f;function f(x){return d===126&&m[m.length-1][1].type!=="characterEscape"?c(x):(o.enter("strikethroughSequenceTemporary"),p(x))}function p(x){const g=Cn(d);if(x===126)return h>1?c(x):(o.consume(x),h++,p);if(h<2&&!n)return c(x);const S=o.exit("strikethroughSequenceTemporary"),b=Cn(x);return S._open=!b||b===2&&!!g,S._close=!g||g===2&&!!b,u(x)}}}class uS{constructor(){this.map=[]}add(t,n,r){lS(this,t,n,r)}consume(t){if(this.map.sort(function(a,o){return a[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const a of i)t.push(a);i=r.pop()}this.map.length=0}}function lS(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function cS(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function dS(){return{flow:{null:{name:"table",tokenize:hS,resolveAll:mS}}}}function hS(e,t,n){const r=this;let i=0,a=0,o;return u;function u(w){let $=r.events.length-1;for(;$>-1;){const Y=r.events[$][1].type;if(Y==="lineEnding"||Y==="linePrefix")$--;else break}const M=$>-1?r.events[$][1].type:null,H=M==="tableHead"||M==="tableRow"?N:c;return H===N&&r.parser.lazy[r.now().line]?n(w):H(w)}function c(w){return e.enter("tableHead"),e.enter("tableRow"),d(w)}function d(w){return w===124||(o=!0,a+=1),m(w)}function m(w){return w===null?n(w):J(w)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),p):n(w):de(w)?pe(e,m,"whitespace")(w):(a+=1,o&&(o=!1,i+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),o=!0,m):(e.enter("data"),h(w)))}function h(w){return w===null||w===124||_e(w)?(e.exit("data"),m(w)):(e.consume(w),w===92?f:h)}function f(w){return w===92||w===124?(e.consume(w),h):h(w)}function p(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(e.enter("tableDelimiterRow"),o=!1,de(w)?pe(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):x(w))}function x(w){return w===45||w===58?S(w):w===124?(o=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),g):j(w)}function g(w){return de(w)?pe(e,S,"whitespace")(w):S(w)}function S(w){return w===58?(a+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(a+=1,b(w)):w===null||J(w)?P(w):j(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),A(w)):j(w)}function A(w){return w===45?(e.consume(w),A):w===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(w))}function y(w){return de(w)?pe(e,P,"whitespace")(w):P(w)}function P(w){return w===124?x(w):w===null||J(w)?!o||i!==a?j(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):j(w)}function j(w){return n(w)}function N(w){return e.enter("tableRow"),q(w)}function q(w){return w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),q):w===null||J(w)?(e.exit("tableRow"),t(w)):de(w)?pe(e,q,"whitespace")(w):(e.enter("data"),V(w))}function V(w){return w===null||w===124||_e(w)?(e.exit("data"),q(w)):(e.consume(w),w===92?K:V)}function K(w){return w===92||w===124?(e.consume(w),V):V(w)}}function mS(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],u=!1,c=0,d,m,h;const f=new uS;for(;++n<e.length;){const p=e[n],x=p[1];p[0]==="enter"?x.type==="tableHead"?(u=!1,c!==0&&(lo(f,t,c,d,m),m=void 0,c=0),d={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",d,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,h=void 0,a=[0,0,0,0],o=[0,n+1,0,0],u&&(u=!1,m={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",m,t]])),i=x.type==="tableDelimiterRow"?2:m?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],h=Or(f,t,a,i,void 0,h),a=[0,0,0,0]),o[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],h=Or(f,t,a,i,void 0,h)),a=o,o=[a[1],n,0,0])):x.type==="tableHead"?(u=!0,c=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(c=n,a[1]!==0?(o[0]=o[1],h=Or(f,t,a,i,n,h)):o[1]!==0&&(h=Or(f,t,o,i,n,h)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&lo(f,t,c,d,m),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=cS(t.events,n))}return e}function Or(e,t,n,r,i,a){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},xn(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const c=xn(t.events,n[1]);if(a={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const d=xn(t.events,n[2]),m=xn(t.events,n[3]),h={type:u,start:Object.assign({},d),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,g=n[3]-n[2]-1;e.add(x,g,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return i!==void 0&&(a.end=Object.assign({},xn(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function lo(e,t,n,r,i){const a=[],o=xn(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function xn(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const pS={name:"tasklistCheck",tokenize:xS};function fS(){return{text:{91:pS}}}function xS(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),a)}function a(c){return _e(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return J(c)?t(c):de(c)?e.check({tokenize:gS},t,n)(c):n(c)}}function gS(e,t,n){return pe(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function ES(e){return Oo([zC(),JC(),oS(e),dS(),fS()])}const bS={};function _S(e){const t=this,n=e||bS,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(ES(n)),a.push(FC()),o.push(HC(n))}const Pi=({isOrder:e,product:t})=>{var a;const{shopGeneral:n}=s.useStorefrontStore(),r=t.subscriptionSettings,{cart:i}=s.useCart();return console.log(t.description),s.jsxRuntimeExports.jsxs("div",{className:`${Ie.checkoutProduct} ${e?Ie.isOrder:""}`,children:[s.jsxRuntimeExports.jsxs("div",{className:Ie.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:`${Ie.productImage} ${e?Ie.isOrderImage:""}`,children:t!=null&&t.image?s.jsxRuntimeExports.jsx("img",{className:Ie.image,src:s.convertCfImageIdToUrl(t.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image",fill:"var(--text-secondary)"})}),s.jsxRuntimeExports.jsx("div",{className:Ie.productInfo,children:s.jsxRuntimeExports.jsxs("div",{className:Ie.productHeader,children:[s.jsxRuntimeExports.jsx("h2",{className:Ie.productName,id:"h5",children:t.name}),s.jsxRuntimeExports.jsxs("span",{className:Ie.quantityBadge,id:"md",children:[t.price.quantity,"x"]})]})}),t.chargeType==="RECURRING"&&s.jsxRuntimeExports.jsx("p",{className:Ie.productPrice,id:"md",children:r&&`${s.formatPrice(r.price)} / ${s.normalizeInterval(r.recurringIntervalDays||0)}${r.entryFee?" + "+s.formatPrice(r.entryFee):""}`}),t.chargeType==="ONE_TIME"&&s.jsxRuntimeExports.jsx("p",{className:Ie.productPrice,id:"md",children:t.variantsGateways&&i.gateway&&t.variantsGateways.some(o=>o.name===i.gateway&&o.overrodePrice)?s.formatPrice(((a=t.variantsGateways.find(o=>o.name===i.gateway))==null?void 0:a.overrodePrice)||t.price):s.formatPrice(t.price)})]}),t.description&&s.jsxRuntimeExports.jsx("p",{className:Ie.productDescription,children:s.jsxRuntimeExports.jsx(ru,{remarkPlugins:[_S],rehypePlugins:[d3],components:{a:({node:o,...u})=>s.jsxRuntimeExports.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer",className:Ie.link})},children:t.description})}),t.deliveryCategories&&s.jsxRuntimeExports.jsx("div",{className:Ie.deliveryCategories,children:t.deliveryCategories.map(o=>s.jsxRuntimeExports.jsx(s.DeliveryItem,{deliveryConfiguration:o},o.id))}),t.customerNote&&s.jsxRuntimeExports.jsxs("div",{className:Ie.customerNote,children:[s.jsxRuntimeExports.jsxs("div",{className:Ie.noteHeader,children:[(n==null?void 0:n.info.logo)&&s.jsxRuntimeExports.jsx("div",{className:Ie.logoContainer,children:s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(n==null?void 0:n.info.logo.cfId)})}),s.jsxRuntimeExports.jsx("p",{className:Ie.shopName,id:"md",children:n==null?void 0:n.info.name})]}),s.jsxRuntimeExports.jsx("p",{className:Ie.noteContent,id:"md",children:t.customerNote})]})]})},TS="_coupon_dkjzv_1",CS="_couponApplied_dkjzv_7",SS="_discount_dkjzv_17",yS="_removeButton_dkjzv_23",RS="_removeButtonText_dkjzv_27",kS="_couponInput_dkjzv_31",AS="_couponInputContainer_dkjzv_37",Bt={coupon:TS,couponApplied:CS,discount:SS,removeButton:yS,removeButtonText:RS,couponInput:kS,couponInputContainer:AS},NS=({applyCoupon:e,couponData:t,discount:n,removeCoupon:r,gateway:i})=>{const[a,o]=k.useState(null),[u,c]=k.useState(!1);return s.jsxRuntimeExports.jsxs("div",{className:Bt.coupon,children:[u&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Bt.skeleton,children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!u&&(t?s.jsxRuntimeExports.jsxs("div",{className:Bt.couponApplied,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"}),s.jsxRuntimeExports.jsxs("p",{id:"md",children:[a," is applied"," ",s.jsxRuntimeExports.jsxs("span",{className:Bt.discount,children:["-",n," ",!t.isFixed&&`(${t.discount}%)`]})]}),s.jsxRuntimeExports.jsx("button",{className:Bt.removeButton,onClick:r,children:s.jsxRuntimeExports.jsx("span",{className:Bt.removeButtonText,children:"Remove"})})]}):s.jsxRuntimeExports.jsxs("div",{className:Bt.couponInput,children:[s.jsxRuntimeExports.jsxs("div",{className:Bt.couponInputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"Enter a discount code",value:a||"",onChange:d=>{o(d===""?null:d)}}),s.jsxRuntimeExports.jsx(s.Button$1,{onClick:async()=>{c(!0),a&&await e(a),c(!1)},disabled:!i||!a,type:"Primary",children:"Apply"})]}),!i&&s.jsxRuntimeExports.jsx(s.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},IS=({cart:e,products:t,applyCoupon:n,applyCouponPending:r,coupon:i,totalAndDiscount:a,removeCoupon:o})=>{var g;const{priceAdjusment:u}=s.useCartStore(),[c,d]=k.useState(!1),m=k.useMemo(()=>e.parts.map(S=>{const b=t.find(y=>y.id===S.productId),A=b==null?void 0:b.variants.find(y=>y.id===S.productVariantId);return S.chargeType==="RECURRING"&&d(!0),{id:(b==null?void 0:b.id)||0,image:b==null?void 0:b.images[0],name:(A==null?void 0:A.name)||"",description:(A==null?void 0:A.description)||"",price:{quantity:S.quantity,amount:(A==null?void 0:A.price.amount)||0,currency:A==null?void 0:A.price.currency},subscriptionSettings:A==null?void 0:A.subscriptionSettings,chargeType:S.chargeType,variantsGateways:A==null?void 0:A.gateways}}),[e,t]),h=((g=m[0])==null?void 0:g.price.currency)||"USD",f=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),p=k.useMemo(()=>i&&!i.isFixed&&i.discount===100?a.total:a.totalWithDiscount?a.total-a.totalWithDiscount:0,[a,i]),x=u?(u==null?void 0:u.fixedAmount)+Math.round((a.totalWithDiscount!==void 0?a.totalWithDiscount:a.total-p)*((u==null?void 0:u.percentage)/100)):null;return s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:Kt.innerContainer,children:[s.jsxRuntimeExports.jsx(cr,{}),s.jsxRuntimeExports.jsxs("div",{className:Kt.headerSection,children:[s.jsxRuntimeExports.jsx("header",{className:Kt.header,children:s.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),s.jsxRuntimeExports.jsx("div",{className:Kt.productsContainer,children:m.map(S=>s.jsxRuntimeExports.jsx(Pi,{product:S},S.id))}),s.jsxRuntimeExports.jsx("div",{className:Kt.couponContainer,children:s.jsxRuntimeExports.jsx(NS,{applyCoupon:n,applyCouponPending:r,couponData:i,discount:f.format(p),removeCoupon:o,gateway:e.gateway})}),s.jsxRuntimeExports.jsx(dr,{formatter:f,coupon:i,total:a.total,discount:p,totalWithDiscount:a.totalWithDiscount,feeOrDiscount:c?null:x})]}),s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutFooter,children:s.jsxRuntimeExports.jsx(vt,{})})]})})},wS="_checkoutOperational_6gxie_1",jS="_innerContainer_6gxie_17",LS="_paymentMethodsSection_6gxie_22",vS="_socialConnectSection_6gxie_28",PS="_socialConnectLabel_6gxie_31",OS="_socialConnectContent_6gxie_35",DS="_continueButton_6gxie_39",MS="_button_6gxie_43",BS="_checkoutFooter_6gxie_47",It={checkoutOperational:wS,innerContainer:jS,paymentMethodsSection:LS,socialConnectSection:vS,socialConnectLabel:PS,socialConnectContent:OS,continueButton:DS,button:MS,checkoutFooter:BS},FS="_customFields_uhcib_2",HS="_checkboxWrapper_uhcib_9",US="_textareaWrapper_uhcib_16",$S="_inputWrapper_uhcib_17",zS="_requiredStar_uhcib_27",gn={customFields:FS,checkboxWrapper:HS,textareaWrapper:US,inputWrapper:$S,requiredStar:zS},WS=({customFields:e,setCustomFields:t})=>{if(e.length===0)return null;const n=e.map(r=>s.jsxRuntimeExports.jsx(qS,{customField:r,setCustomFields:t},r.name));return s.jsxRuntimeExports.jsx("div",{className:gn.customFields,children:n})},qS=({customField:e,setCustomFields:t})=>{const n=r=>{t(i=>i.map(a=>a.name===e.name?{...a,value:r}:a))};return s.jsxRuntimeExports.jsx(VS,{value:e.value??"",placeholder:e.placeholder,required:e.required,defaultValue:e.defaultValue,type:e.type,onValueChange:n,label:e.name,regex:e.regex})},VS=({label:e,type:t,defaultValue:n,value:r,placeholder:i,regex:a,required:o,onValueChange:u})=>{if(k.useEffect(()=>{r===""&&n!==void 0&&u(String(n))},[]),t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return s.jsxRuntimeExports.jsxs("label",{className:gn.checkboxWrapper,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:r==="true",onChange:d=>u(d?"true":"false")}),s.jsxRuntimeExports.jsxs("p",{className:gn.checkboxLabel,children:[e,o&&s.jsxRuntimeExports.jsx("span",{className:gn.requiredStar,children:"*"})]})]});if(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return s.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(n??""),required:o});const c=d=>{(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:a?new RegExp(a):/.*/).test(d)&&u(d)};return t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?s.jsxRuntimeExports.jsx("div",{className:gn.textareaWrapper,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{label:e,value:r,placeholder:i,onChange:c,required:o})}):s.jsxRuntimeExports.jsx("div",{className:gn.inputWrapper,children:s.jsxRuntimeExports.jsx(s.Input$1,{type:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":i,label:e,value:r,required:o,onChange:c})})},YS="_connectedContainer_1rxr8_1",GS="_userInfo_1rxr8_10",XS="_avatar_1rxr8_16",QS="_avatarImage_1rxr8_26",Dr={connectedContainer:YS,userInfo:GS,avatar:XS,avatarImage:QS},KS=({customerEmail:e})=>{const{discordInfo:t,setDiscordInfo:n}=s.useDiscordStore(),{notifications:r,setNotifications:i}=s.useNotificationStore(),[a,o]=k.useState(!1),[u,c]=k.useState(0),[d,m]=k.useState(null),h=20,f=g=>{var S,b,A,y;return(b=(S=g==null?void 0:g.response)==null?void 0:S.data)!=null&&b.error?g.response.data.error:(y=(A=g==null?void 0:g.response)==null?void 0:A.data)!=null&&y.message?g.response.data.message:g!=null&&g.message?g.message:"Failed to connect to Discord. Please try again later."},p=(g,S)=>{i([...r,{id:s.v4(),message:g,status:S}])};k.useEffect(()=>{if(d&&a){const g=setInterval(()=>{d.closed&&(clearInterval(g),o(!1),m(null))},1e3);return()=>clearInterval(g)}},[d,a]);const x=()=>{e.trim()!==""&&(o(!0),c(0),uc({customerEmail:e}).then(({data:g})=>{const S=window.open(g.redirectUrl);m(S),(!S||S.closed||typeof S.closed>"u")&&setTimeout(()=>{const y=document.createElement("a");y.href=g.redirectUrl,y.target="_blank",y.click()});let b;const A=()=>{if(c(y=>y+1),u>=h||S&&S.closed){u>=h&&p("Authorization timeout. Please try again.","error"),o(!1),clearTimeout(b);return}lc({id:g.id,customerEmail:e}).then(({data:y})=>{n({authorized:!0,id:y.discordId,avatar:y.avatar,username:y.username}),S&&S.close(),o(!1),m(null),p("Discord successfully connected!","success"),clearTimeout(b)}).catch(y=>{var P;if(console.log("Waiting for authorization...",y,{newWindow:S}),S&&S.closed){o(!1),clearTimeout(b);return}if((P=y==null?void 0:y.response)!=null&&P.status&&y.response.status!==404&&y.response.status>=400){p(f(y),"error"),o(!1),clearTimeout(b);return}clearTimeout(b),b=setTimeout(A,1500)})};A()}).catch(g=>{console.log("Could not initiate Discord authorization",g),p(f(g),"error"),o(!1)}))};return t!=null&&t.authorized?s.jsxRuntimeExports.jsxs("div",{className:Dr.connectedContainer,children:[s.jsxRuntimeExports.jsxs("div",{className:Dr.userInfo,children:[s.jsxRuntimeExports.jsx("div",{className:Dr.avatar,children:t.avatar?s.jsxRuntimeExports.jsx("img",{className:Dr.avatarImage,src:`https://cdn.discordapp.com/avatars/${t.id}/${t.avatar}.png?size=256`}):s.jsxRuntimeExports.jsx(s.Icon,{name:"UserCircle"})}),s.jsxRuntimeExports.jsx("p",{children:t.username}),s.jsxRuntimeExports.jsx(Nf,{})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Reconnect"})]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:a,children:a?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"DiscordLogo"}),s.jsxRuntimeExports.jsx(s.StableText,{children:"Connect Your Discord"})]})})},ZS="_paymentMethodsContainer_a3he6_2",JS={paymentMethodsContainer:ZS},ey="_bottomSheet_1x8kc_1",ty="_content_1x8kc_8",ny="_description_1x8kc_11",ry="_title_1x8kc_15",sy="_buttonGroup_1x8kc_19",iy="_buttonWrapper_1x8kc_29",ay="_fullWidthButton_1x8kc_32",oy="_modal_1x8kc_36",uy="_header_1x8kc_43",wt={bottomSheet:ey,content:ty,description:ny,title:ry,buttonGroup:sy,buttonWrapper:iy,fullWidthButton:ay,modal:oy,header:uy},ly=({setIsOpen:e,balance:t})=>{const n=s.useNavigate(),{setIsOpen:r}=s.useModalStore(),i=()=>{n("/top-up?redirectRoute=checkout")};function a(){r(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:wt.modal,onClick:o=>o.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:wt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:wt.title,children:"Insufficient Customer Balance"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:a,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:wt.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:wt.content,children:s.jsxRuntimeExports.jsxs("p",{className:wt.description,children:["You currently have ",t&&s.formatPrice(t)," in your balance. After topping up the required amount, you can continue to checkout."]})}),s.jsxRuntimeExports.jsxs("div",{className:wt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:wt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:a,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:wt.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:i,children:"Add Balance"})})]})]})]})},El=({align:e,gateway:t,gatewayDisplayName:n,selected:r,onSelect:i,total:a,onSignInClick:o,reversed:u})=>{const{token:c}=s.useStorefrontStore(),{balance:d}=s.useCustomerDashboardStore(),[m,h]=k.useState(!1),{setIsOpen:f}=s.useModalStore(),p=x=>{x.stopPropagation(),i&&i(t),d&&d.amount<a&&(h(!0),f(!0))};return k.useEffect(()=>{},[d,a]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(s.styles$3.paymentMethod,{[s.styles$3.selected]:r,[s.styles$3.alignColumn]:e==="column",[s.styles$3.reversed]:u}),onClick:p,children:[s.jsxRuntimeExports.jsxs("p",{className:s.styles$3.paymentText,id:"md",children:[n," ",s.jsxRuntimeExports.jsxs("span",{className:s.styles$3.balanceText,id:"md",children:["(",c?d&&s.formatPrice(d):s.jsxRuntimeExports.jsx("a",{className:s.styles$3.signInLink,onClick:o,id:"md",children:"Sign in"}),")"]})]}),s.jsxRuntimeExports.jsx("div",{className:s.styles$3.iconContainer,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}),m&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>h(!1),children:s.jsxRuntimeExports.jsx(ly,{setIsOpen:h,balance:d})})]})},bl=({possibleGateways:e,setGateway:t,totalAndDiscount:n,onSignInClick:r,setPaymentMethod:i})=>{const[a,o]=k.useState(),[u,c]=k.useState(),{setPriceAdjustment:d}=s.useCartStore(),[m,h]=k.useState(null),f=(p,x)=>{var g;u!==x&&(t(x),d(((g=m==null?void 0:m.find(S=>S.name===x))==null?void 0:g.priceAdjustment)||null)),i(p),o(p),c(x)};return k.useEffect(()=>{const p=async()=>{const{data:x}=await s.fetchGatewaysDetail([...e.availableGateways,...e.requiresSignInGateways]);h(x)};e.availableGateways.length&&p()},[]),k.useLayoutEffect(()=>{d(null)},[]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[m&&s.jsxRuntimeExports.jsx("div",{className:JS.paymentMethodsContainer,children:m==null?void 0:m.map(p=>p.name==="Balance"?s.jsxRuntimeExports.jsx(El,{gateway:p.name,gatewayDisplayName:p.displayName,onSelect:x=>{c(x),u!==x&&t(x)},selected:p.name===u,total:n.total,onSignInClick:r,reversed:!0},p.name):p.paymentMethods.map(x=>s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{paymentMethod:x,gateway:p.name,gatewayDisplayName:p.displayName,gatewayLogoCfId:p.logoCfImageId,poweredByLogoCfId:p.poweredByImageCfImageId,onSelect:g=>f(g,p.name),selected:a===x&&u===p.name},`${p.name}-${x}`)))}),!m&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:"100%",height:"220px",viewBox:"0 0 600 220",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"5",ry:"5",width:"100%",height:"100%"})})]})},cy="_modal_14r0b_1",dy={modal:cy},hy=({setIsOpen:e})=>{const{token:t}=s.useStorefrontStore(),{setIsOpen:n}=s.useModalStore();k.useEffect(()=>{t&&r()},[t]);const r=()=>{n(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsx("div",{className:dy.modal,onClick:i=>i.stopPropagation(),children:s.jsxRuntimeExports.jsx(s.Auth,{inModal:!0})})},my=({getPossibleGateways:e,setGateway:t,getDiscordSettings:n,cart:r,products:i,submitCart:a,reset:o,setCustomFieldsToCart:u,totalAndDiscount:c,setDiscordSocialConnectId:d,setPaymentMethod:m})=>{const h=k.useMemo(()=>n(),[]),[f,p]=k.useState([]),{balance:x,setBalance:g}=s.useCustomerDashboardStore(),{token:S}=s.useStorefrontStore(),{executeRecaptcha:b}=s.useReCaptcha(),{discordInfo:A}=s.useDiscordStore(),{customerEmail:y,setCustomerEmail:P}=s.useCartStore(),j=A!=null&&A.authorized?A.id:void 0,N=s.useNavigate(),q=k.useMemo(()=>e(),[r.parts]),[V,K]=k.useState(!1),{setIsOpen:w}=s.useModalStore(),{notifications:$,setNotifications:M}=s.useNotificationStore();k.useEffect(()=>{const G=s.getCommonCustomFields(r.parts,i).map(W=>W.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...W,value:String(W.defaultValue)}:W);p([...G])},[]),k.useEffect(()=>{const X=s.getCommonCustomFields(r.parts,i);p(G=>{const W=new Map(G.map(Q=>[Q.name,Q]));return X.map(Q=>{const C=W.get(Q.name);return C&&C.value?{...Q,value:C.value}:Q.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...Q,value:String(Q.defaultValue)}:Q})})},[r.parts,i]),k.useEffect(()=>{S&&(async()=>{const G=await s.getBalance();g(G)})()},[S]);function H(X){return X&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(X)}const Y=()=>{const X=[];return f.forEach(G=>{var W;G.required&&!((W=G.value)!=null&&W.toString().trim())&&X.push({message:`Field "${G.name}" is required.`,status:"error",id:s.v4()})}),X.length>0?(M([...$,...X]),!1):!0},z=async X=>{if(X.stopPropagation(),r.gateway==="Balance"&&!S){w(!0),K(!0);return}if(!Y())return;const G=Object.fromEntries(f.map(Q=>[Q.name,Q.value||""]));u({...G}),j&&h.isEnabled&&d(j);const W=await b();if(W){const Q=await a(W),C=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(C).length>10){const Ee=Date.now()-864e5;Object.keys(C).forEach(Ae=>{C[Ae].createdAt<=Ee&&delete C[Ae]})}"order"in Q?C[Q.order.id]={createdAt:Date.now(),fullAccessToken:Q.order.fullAccessToken}:C[Q.id]={createdAt:Date.now(),fullAccessToken:Q.fullAccessToken},localStorage.setItem("orders",JSON.stringify(C)),N(`/orders/${"order"in Q?Q.order.id:Q.id}/${"order"in Q?Q.order.fullAccessToken:Q.fullAccessToken}`),setTimeout(()=>o(),0)}};return s.jsxRuntimeExports.jsxs("div",{className:It.checkoutOperational,children:[s.jsxRuntimeExports.jsxs("div",{className:It.innerContainer,children:[r.parts.length>0&&s.jsxRuntimeExports.jsx(bl,{possibleGateways:q,setGateway:t,setPaymentMethod:m,balance:x,totalAndDiscount:c,onSignInClick:()=>{K(!0),w(!0)}}),s.jsxRuntimeExports.jsx("div",{className:It.paymentMethodsSection,children:s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"mail@mail.com",value:y||"",onChange:X=>P(X),disabled:!!S,label:"Email Address"})}),s.jsxRuntimeExports.jsx(WS,{customFields:f,setCustomFields:p}),h.isEnabled&&s.jsxRuntimeExports.jsxs("div",{className:It.socialConnectSection,children:[s.jsxRuntimeExports.jsx("p",{className:It.socialConnectLabel,id:"md",children:"Social Connect"}),s.jsxRuntimeExports.jsx("div",{className:It.socialConnectContent,children:s.jsxRuntimeExports.jsx(KS,{customerEmail:y||""})})]}),s.jsxRuntimeExports.jsxs("div",{className:It.continueButton,children:[s.jsxRuntimeExports.jsx(s.Button$1,{onClick:z,disabled:!r.gateway||!H(y||"")||h.isRequired&&!(A!=null&&A.authorized),className:It.button,children:"Continue to Checkout"}),s.jsxRuntimeExports.jsx(s.TermsOfService,{}),s.jsxRuntimeExports.jsx(s.SecuredBySsl,{})]}),s.jsxRuntimeExports.jsx(vt,{className:It.checkoutFooter})]}),V&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>K(!1),children:s.jsxRuntimeExports.jsx(hy,{setIsOpen:K})})]})},py="_mt1_1t7v2_1",fy="_notifyBlock_1t7v2_13",xy="_notifyHeader_1t7v2_19",gy="_notifyContent_1t7v2_25",Ey="_buttonBlock_1t7v2_30",by="_imageBlock_1t7v2_34",_y="_imageContainer_1t7v2_42",Ty="_sectionBlock_1t7v2_54",Cy="_sectionTitle_1t7v2_61",Sy="_sectionSubtitle_1t7v2_64",yy="_inputContainer_1t7v2_69",pt={mt1:py,notifyBlock:fy,notifyHeader:xy,notifyContent:gy,buttonBlock:Ey,imageBlock:by,imageContainer:_y,sectionBlock:Ty,sectionTitle:Cy,sectionSubtitle:Sy,inputContainer:yy},Ry=({props:e})=>{const t=s.useCopy();return s.jsxRuntimeExports.jsx("div",{className:pt.mt1,children:s.jsxRuntimeExports.jsxs("div",{className:pt.inputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:e.text,disabled:!0,onChange:()=>{}}),e.shownCopyButton&&s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>t(e.text),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})})},ky=({props:e})=>s.jsxRuntimeExports.jsx(s.Button$1,{className:pt.buttonBlock,onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),Ay=({props:e})=>s.jsxRuntimeExports.jsx("div",{className:pt.imageBlock,children:s.jsxRuntimeExports.jsx("div",{className:pt.imageContainer,children:s.jsxRuntimeExports.jsx("img",{src:e.src,alt:""})})}),Ny=({props:e})=>s.jsxRuntimeExports.jsxs("div",{className:pt.notifyBlock,children:[s.jsxRuntimeExports.jsxs("div",{className:pt.notifyHeader,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),s.jsxRuntimeExports.jsx("p",{children:e.heading})]}),s.jsxRuntimeExports.jsx("p",{className:pt.notifyContent,children:e.content})]}),Iy=({props:e})=>{var t;return s.jsxRuntimeExports.jsxs("div",{className:pt.sectionBlock,children:[s.jsxRuntimeExports.jsx("p",{className:pt.sectionTitle,children:e.title}),s.jsxRuntimeExports.jsx("span",{className:pt.sectionSubtitle,children:e.subTitle}),(t=e.children)==null?void 0:t.map((n,r)=>s.jsxRuntimeExports.jsx(_l,{block:n},r))]})},_l=({block:e})=>{switch(e.type){case"Section":return s.jsxRuntimeExports.jsx(Iy,{...e});case"ReadOnlyTextInput":return s.jsxRuntimeExports.jsx(Ry,{...e});case"Notify":return s.jsxRuntimeExports.jsx(Ny,{...e});case"Button":return s.jsxRuntimeExports.jsx(ky,{...e});case"Image":return s.jsxRuntimeExports.jsx(Ay,{...e});default:return null}},wy="_bottomSheet_1x4sq_1",jy="_content_1x4sq_8",Ly="_agreementList_1x4sq_11",vy="_agreementItem_1x4sq_16",Py="_warning_1x4sq_23",Oy="_buttonGroup_1x4sq_31",Dy="_buttonWrapper_1x4sq_41",My="_fullWidthButton_1x4sq_44",By="_modal_1x4sq_48",Fy="_header_1x4sq_55",Je={bottomSheet:wy,content:jy,agreementList:Ly,agreementItem:vy,warning:Py,buttonGroup:Oy,buttonWrapper:Dy,fullWidthButton:My,modal:By,header:Fy},Hy=({setIsOpen:e,price:t})=>{const[n,r]=k.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:i}=s.useModalStore(),a=()=>{i(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Je.modal,onClick:o=>o.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:a,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.content,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.agreementList,children:[s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSendAsFF,onChange:o=>r({...n,agreeToSendAsFF:o})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSend,onChange:o=>r({...n,agreeToSend:o})}),s.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",s.formatPrice(t)," ",t.currency]})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToNotAddNote,onChange:o=>r({...n,agreeToNotAddNote:o})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),s.jsxRuntimeExports.jsx("div",{className:Je.warning,children:s.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",s.formatPrice(t)," ",t.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",children:s.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),s.jsxRuntimeExports.jsx("div",{className:Je.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:a,children:"Continue to Payment"})})]})]})]})},Uy="_chargeItemsContainer_qmv3w_4",$y="_chargeItemsInner_qmv3w_20",zy="_productsContainer_qmv3w_27",Wy="_chargeHeader_qmv3w_41",qy="_chargeTitle_qmv3w_49",Vy="_chargeDescription_qmv3w_55",Yy="_copyButton_qmv3w_61",Gy="_productsList_qmv3w_73",Xy="_trackingContainer_qmv3w_81",Qy="_footerContainer_qmv3w_91",Et={chargeItemsContainer:Uy,chargeItemsInner:$y,productsContainer:zy,chargeHeader:Wy,chargeTitle:qy,chargeDescription:Vy,copyButton:Yy,productsList:Gy,trackingContainer:Xy,footerContainer:Qy},Ky=({charge:e})=>{var a;const t=s.useCopy(),n=(e==null?void 0:e.price.currency)||"USD",r=new Intl.NumberFormat("en-US",{style:"currency",currency:n}),i=k.useMemo(()=>{var o;return((o=e==null?void 0:e.order)==null?void 0:o.partOrders.map(u=>{var c,d,m,h,f,p;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:((c=u.productWithVariant)==null?void 0:c.variantName)||"",description:((d=u.productWithVariant)==null?void 0:d.description)||"",price:{quantity:u.quantity,amount:((m=u.productWithVariant)==null?void 0:m.price.amount)||0,currency:(h=u.productWithVariant)==null?void 0:h.price.currency},subscriptionSettings:(f=e.order)!=null&&f.subscriptionOrderId?(p=u.productWithVariant)==null?void 0:p.subscriptionSettings:null}}))||[]},[e]);return s.jsxRuntimeExports.jsx("div",{className:Et.chargeItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:Et.chargeItemsInner,children:[s.jsxRuntimeExports.jsx(cr,{expiresAt:e==null?void 0:e.expiresAt}),s.jsxRuntimeExports.jsxs("div",{className:Et.productsContainer,children:[(e==null?void 0:e.name)&&s.jsxRuntimeExports.jsxs("header",{className:Et.chargeHeader,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:Et.chargeTitle,id:"h5",children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:Et.chargeDescription,id:"md",children:e.description})]}),((a=e.order)==null?void 0:a.id)&&s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",className:Et.copyButton,onClick:()=>{var o;return t(((o=e.order)==null?void 0:o.id)||"")},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),"Copy Order ID"]})]}),s.jsxRuntimeExports.jsxs("div",{style:{flex:1},children:[!!i.length&&s.jsxRuntimeExports.jsx("div",{className:Et.productsList,children:i.map(o=>s.jsxRuntimeExports.jsx(Pi,{product:o},o.id))}),s.jsxRuntimeExports.jsx(dr,{formatter:r,coupon:null,total:(e==null?void 0:e.price.amount)||0,discount:0,totalWithDiscount:(e==null?void 0:e.price.amount)||0,isShowSubtotal:!1})]}),s.jsxRuntimeExports.jsxs("div",{children:[e&&s.jsxRuntimeExports.jsx("div",{className:Et.trackingContainer,children:s.jsxRuntimeExports.jsx(s.TrackPayment,{timeline:e.timeline})}),s.jsxRuntimeExports.jsx(vt,{className:Et.footerContainer})]})]})]})})},Zy="_checkoutOrderMainData_hqf60_1",Jy="_orderDetailRow_hqf60_6",e5="_chargeIdRow_hqf60_16",t5="_detailLabel_hqf60_25",n5="_detailValue_hqf60_29",r5="_chargeIdContainer_hqf60_33",s5="_chargeId_hqf60_16",i5="_copyIcon_hqf60_51",Ue={checkoutOrderMainData:Zy,orderDetailRow:Jy,chargeIdRow:e5,detailLabel:t5,detailValue:n5,chargeIdContainer:r5,chargeId:s5,copyIcon:i5},Tl=({lastUpdate:e,invoiceId:t,email:n,paymentType:r})=>{const i=s.useCopy(),[a,o]=k.useState(null),u=a==null?void 0:a.find(d=>d.name===r);k.useEffect(()=>{a||(async()=>{const m=[r],h=await s.getGatewaysDetail(m);o(h)})()},[r,a]);const c=d=>{const m=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h=d.getDate().toString().padStart(2,"0"),f=m[d.getMonth()],p=d.getFullYear(),x=d.getHours(),g=d.getMinutes().toString().padStart(2,"0"),S=d.getSeconds().toString().padStart(2,"0"),b=x>=12?"PM":"AM",A=(x%12||12).toString().padStart(2,"0");return`${f} ${h}, ${p} at ${A}:${g}:${S} ${b}`};return s.jsxRuntimeExports.jsxs("div",{className:Ue.checkoutOrderMainData,children:[s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Last Updated"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:c(new Date(e))})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Payment Type"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Email"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:n})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Charge ID"}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdContainer,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.chargeId,id:"md",children:t}),s.jsxRuntimeExports.jsx("div",{className:Ue.copyIcon,onClick:()=>i(t),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})]})]})},a5="_bottomSheet_1yai1_1",o5="_formContainer_1yai1_8",u5="_error_1yai1_14",l5="_buttonGroup_1yai1_18",c5="_buttonWrapper_1yai1_28",d5="_fullWidthButton_1yai1_31",h5="_modal_1yai1_41",m5="_header_1yai1_48",Ft={bottomSheet:a5,formContainer:o5,error:u5,buttonGroup:l5,buttonWrapper:c5,fullWidthButton:d5,modal:h5,header:m5},p5=({chargeId:e,setIsOpen:t})=>{const[n,r]=k.useState(""),[i,a]=k.useState(""),{setIsOpen:o}=s.useModalStore(),u=m=>{try{return new URL(m),!0}catch{return!1}},c=async m=>{if(m.preventDefault(),!n){a("The link field cannot be empty.");return}if(!u(n)){a("Please enter a valid URL");return}await nc({url:n},e)&&(alert("CashApp successfully verified"),t(!1))},d=()=>{o(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ft.modal,onClick:m=>m.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ft.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:d,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsx("form",{onSubmit:c,children:s.jsxRuntimeExports.jsxs("div",{className:Ft.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.formContainer,children:s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:n,onChange:m=>{r(m),a("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),i&&s.jsxRuntimeExports.jsx("p",{className:Ft.error,children:i})]})}),s.jsxRuntimeExports.jsxs("div",{className:Ft.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:d,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ft.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},f5="_container_1opbn_1",x5="_productDetails_1opbn_8",g5="_imageContainer_1opbn_14",E5="_image_1opbn_14",b5="_textContainer_1opbn_32",_5="_header_1opbn_40",T5="_title_1opbn_46",C5="_price_1opbn_53",S5="_badgeContainer_1opbn_57",y5="_description_1opbn_61",bt={container:f5,productDetails:x5,imageContainer:g5,image:E5,textContainer:b5,header:_5,title:T5,price:C5,badgeContainer:S5,description:y5},R5=({subscription:e})=>s.jsxRuntimeExports.jsxs("div",{className:bt.container,children:[s.jsxRuntimeExports.jsxs("div",{className:bt.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:bt.imageContainer,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{className:bt.image,src:s.convertCfImageIdToUrl(e.image.cfId),alt:e==null?void 0:e.name}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:bt.textContainer,children:[s.jsxRuntimeExports.jsx("div",{className:bt.header,children:s.jsxRuntimeExports.jsx("h2",{className:bt.title,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:bt.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx("div",{className:bt.badgeContainer,children:s.jsxRuntimeExports.jsx(s.SubscriptionStatusBadge,{status:e.status})})]}),e.description&&s.jsxRuntimeExports.jsx(ru,{className:bt.description,children:e.description})]}),k5="_card_69liy_1",A5="_price_69liy_10",N5="_interval_69liy_17",I5="_name_69liy_22",w5="_description_69liy_28",j5="_currentPlan_69liy_32",L5="_selectButton_69liy_45",v5="_progressSection_69liy_50",P5="_progressLabel_69liy_54",O5="_bottomSheet_69liy_60",D5="_title_69liy_69",M5="_typeSelector_69liy_80",B5="_typeOption_69liy_90",F5="_active_69liy_100",H5="_saveTag_69liy_108",U5="_planSelector_69liy_117",$5="_modal_69liy_127",z5="_inactive_69liy_148",W5="_notMounted_69liy_151",q5="_closeButton_69liy_157",ye={card:k5,price:A5,interval:N5,name:I5,description:w5,currentPlan:j5,selectButton:L5,progressSection:v5,progressLabel:P5,bottomSheet:O5,title:D5,typeSelector:M5,typeOption:B5,active:F5,saveTag:H5,planSelector:U5,modal:$5,inactive:z5,notMounted:W5,closeButton:q5},V5=({variant:e,onSelect:t,isCurrent:n})=>{const r=e.subscriptionSettings.recurringIntervalDays===30?"month":e.subscriptionSettings.recurringIntervalDays===365?"year":"period",i=e.subscriptionSettings.price.amount.toFixed(2),a=e.subscriptionSettings.recurringIntervalDays,o=10;return s.jsxRuntimeExports.jsxs("div",{className:ye.card,onClick:t,children:[s.jsxRuntimeExports.jsxs("h2",{className:ye.price,children:["$",i," ",s.jsxRuntimeExports.jsxs("span",{className:ye.interval,children:["/ ",r]})]}),s.jsxRuntimeExports.jsx("h3",{className:ye.name,children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:ye.description,children:e.description}),n?s.jsxRuntimeExports.jsxs("div",{className:ye.currentPlan,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check"}),"Your current Plan"]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",className:ye.selectButton,children:"Select"}),n&&s.jsxRuntimeExports.jsxs("div",{className:ye.progressSection,children:[s.jsxRuntimeExports.jsx(go,{percent:o/a*100,disablePercentLabel:!0}),s.jsxRuntimeExports.jsxs("p",{className:ye.progressLabel,children:["Used: ",o," of ",a," days"]})]})]})},Y5=({isOpen:e,setIsOpen:t,subscription:n})=>{const[r,i]=k.useState(null),[a,o]=k.useState(null),[u,c]=k.useState(null),{id:d,accessToken:m}=s.useParams(),[h,f]=k.useState(!1),[p,x]=k.useState(!1),{setIsOpen:g}=s.useModalStore();k.useEffect(()=>{e&&f(!0)},[e]);const S=()=>{t(!1)},[b,A]=k.useState(null);k.useEffect(()=>{d&&m&&(async()=>{if(d&&m){const{data:N}=await s.getSubscriptionUpgradePlans({id:d,accessToken:m});A(N)}})()},[d,m]),k.useEffect(()=>{var j;if(b!=null&&b.data.types[0]){const N=(j=b.data.types.flatMap(q=>q.productVariants).find(q=>q.data.id===(n==null?void 0:n.variantId)))==null?void 0:j.data;N&&(c(N),o(N))}},[b,n]),k.useEffect(()=>{b!=null&&b.data.types[0]&&i(b==null?void 0:b.data.types[0])},[b==null?void 0:b.data.types]);const y=j=>{i(j),o(null)},P=j=>{o(j),g(!0),x(!0)};return s.jsxRuntimeExports.jsxs("div",{className:s.clx(ye.modal,{[ye.active]:e,[ye.inactive]:!e&&h,[ye.notMounted]:!h}),onClick:j=>j.stopPropagation(),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:S,hoverable:!0,className:ye.closeButton,fill:"var(--text-primary)"}),s.jsxRuntimeExports.jsxs("div",{className:ye.bottomSheet,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:ye.title,children:"Change Plan"}),s.jsxRuntimeExports.jsx("p",{className:ye.description,children:b==null?void 0:b.data.description}),s.jsxRuntimeExports.jsx("div",{className:ye.typeSelector,children:b==null?void 0:b.data.types.map(j=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(ye.typeOption,{[ye.active]:(r==null?void 0:r.id)===j.id}),onClick:()=>y(j),children:[j.name,j.name==="Yearly"&&s.jsxRuntimeExports.jsx("span",{className:ye.saveTag,children:"Save %"})]},j.id))}),r&&s.jsxRuntimeExports.jsx("div",{className:ye.planSelector,children:r.productVariants.map(j=>s.jsxRuntimeExports.jsx(V5,{variant:j.data,isSelected:(a==null?void 0:a.id)===j.data.id,isCurrent:(u==null?void 0:u.id)===j.data.id,onSelect:()=>P(j.data)},j.data.id))})]}),p&&a&&n&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>{x(!1)},children:s.jsxRuntimeExports.jsx(MR,{setIsOpen:x,selectedVariant:a,subscription:n})})]})},G5="_container_nb625_1",X5="_title_nb625_11",Q5="_subtitle_nb625_16",K5="_info_nb625_20",Mr={container:G5,title:X5,subtitle:Q5,info:K5},Z5=()=>{const{subscription:e}=s.useSubscriptionStore(),[t,n]=s.extractDateAndTime((e==null?void 0:e.activeTo)||""),[r,i]=k.useState(!1),{setIsOpen:a}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Mr.container,children:[s.jsxRuntimeExports.jsxs("div",{className:Mr.info,children:[s.jsxRuntimeExports.jsx("p",{className:Mr.title,children:"Expiration Date"}),s.jsxRuntimeExports.jsxs("p",{className:Mr.subtitle,children:[t," at ",n]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:o=>{o.stopPropagation(),a(!0),i(!0)},children:"Extend"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>i(!1),children:s.jsxRuntimeExports.jsx(t6,{setIsOpen:i})})]})},J5="_couponContainer_1sspa_1",eR="_iconWrapper_1sspa_10",tR="_details_1sspa_21",nR="_title_1sspa_25",rR="_progress_1sspa_29",sR="_foreverText_1sspa_34",fn={couponContainer:J5,iconWrapper:eR,details:tR,title:nR,progress:rR,foreverText:sR},iR=({coupon:e,currency:t})=>{const n=e.isFixed?s.formatPrice({amount:e.discount,currency:t}):`${e.discount}%`,r=e.initialCouponDurationForSubscriptions?s.percentageDifference(e.initialCouponDurationForSubscriptions,e.currentCouponDurationForSubscriptions||1):100;return s.jsxRuntimeExports.jsxs("div",{className:fn.couponContainer,children:[s.jsxRuntimeExports.jsx("div",{className:fn.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CheckCircle"})}),s.jsxRuntimeExports.jsxs("div",{className:fn.details,children:[s.jsxRuntimeExports.jsxs("p",{className:fn.title,children:[e.name,", ",n," discount"]}),s.jsxRuntimeExports.jsx("div",{className:fn.progress,children:s.jsxRuntimeExports.jsx(go,{color:"#C2C2C2",percent:r,disablePercentLabel:!0})}),s.jsxRuntimeExports.jsx("p",{className:fn.foreverText,children:"Forever discount code"})]})]})},aR="_paymentMethodContainer_1g0da_4",oR="_paymentMethodTitle_1g0da_15",uR="_activeMethod_1g0da_20",lR="_noMethod_1g0da_28",cR="_activeMethodPaymentMethod_1g0da_37",dR="_paymentMethodLogo_1g0da_47",hR="_paymentMethodNumber_1g0da_57",mR="_method_1g0da_61",Wt={paymentMethodContainer:aR,paymentMethodTitle:oR,activeMethod:uR,noMethod:lR,activeMethodPaymentMethod:cR,paymentMethodLogo:dR,paymentMethodNumber:hR,method:mR},pR="_paymentMethods_1gev0_1",fR="_modal_1gev0_14",xR="_header_1gev0_28",gR="_content_1gev0_37",Jt={paymentMethods:pR,modal:fR,header:xR,content:gR},ER=e=>{const{setIsLoading:t,setIsOpen:n}=e,{subscription:r,setSubscription:i}=s.useSubscriptionStore();if(!r)return null;const{id:a}=s.useParams(),o=s.useNavigate(),{notifications:u,setNotifications:c}=s.useNotificationStore(),{setPaymentMethod:d,setGateway:m,cart:h}=s.useCart(),{setIsOpen:f}=s.useModalStore();async function p(){if(x(),t(!0),a&&r){const{data:g}=await s.changeSubscriptionGateway(a,h.gateway);g.isReconnectPaymentNeeded?o(`/charges/${g.chargeId}`):(c([...u,{status:"success",id:s.v4(),message:"Your action has been successfully completed"}]),i({...r,gatewayName:h.gateway}))}else c([...u,{status:"error",id:s.v4(),message:"Your action has been failed. Try again!"}]);t(!1)}function x(){f(!1),setTimeout(()=>{n(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:Jt.modal,onClick:g=>{g.stopPropagation()},children:[s.jsxRuntimeExports.jsxs("div",{className:Jt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Jt.title,children:"Choose Payment Method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Jt.content,children:[(r==null?void 0:r.availableGateways)&&s.jsxRuntimeExports.jsx(bl,{possibleGateways:{availableGateways:r.availableGateways,requiresSignInGateways:r.availableGateways},setGateway:m,setPaymentMethod:d,totalAndDiscount:{total:(r==null?void 0:r.price.amount)||0,totalWithDiscount:r==null?void 0:r.price.amount},onSignInClick:()=>o("/customer-dash")}),s.jsxRuntimeExports.jsxs("div",{className:Jt.paymentMethods,children:[s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!h.gateway,onClick:()=>p(),children:"Continue"})})]})]})]})},bR="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20131.39%2086.9'%3e%3cdefs%3e%3cstyle%3e.a{opacity:0;}.b{fill:%23fff;}.c{fill:%23ff5f00;}.d{fill:%23eb001b;}.e{fill:%23f79e1b;}%3c/style%3e%3c/defs%3e%3ctitle%3eAsset%201%3c/title%3e%3cg%20class='a'%3e%3crect%20class='b'%20width='131.39'%20height='86.9'/%3e%3c/g%3e%3crect%20class='c'%20x='48.37'%20y='15.14'%20width='34.66'%20height='56.61'/%3e%3cpath%20class='d'%20d='M51.94,43.45a35.94,35.94,0,0,1,13.75-28.3,36,36,0,1,0,0,56.61A35.94,35.94,0,0,1,51.94,43.45Z'/%3e%3cpath%20class='e'%20d='M120.5,65.76V64.6H121v-.24h-1.19v.24h.47v1.16Zm2.31,0v-1.4h-.36l-.42,1-.42-1h-.36v1.4h.26V64.7l.39.91h.27l.39-.91v1.06Z'/%3e%3cpath%20class='e'%20d='M123.94,43.45a36,36,0,0,1-58.25,28.3,36,36,0,0,0,0-56.61,36,36,0,0,1,58.25,28.3Z'/%3e%3c/svg%3e",_R=()=>{var x,g,S;const{subscription:e}=s.useSubscriptionStore(),{cart:t,setPaymentMethod:n}=s.useCart(),r=s.useNavigate(),[i,a]=k.useState(null),[o,u]=k.useState(!1),[c,d]=k.useState(!1),{setIsOpen:m}=s.useModalStore();if(!e)return null;const[h,f]=k.useState(e.gatewayName||t.gateway),p=t.paymentMethod;return k.useEffect(()=>{(async()=>{const A=await s.getGatewaysDetail(e.availableGateways);a(A)})()},[]),k.useEffect(()=>{t.gateway!==h&&f(t.gateway)},[t.gateway]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodContainer,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("p",{className:Wt.paymentMethodTitle,children:"Active Payment Method"}),e.gatewayInfo&&Object.keys(e.gatewayInfo).length>0&&s.jsxRuntimeExports.jsx(TR,{gatewayInfo:e.gatewayInfo}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h==="Balance"&&s.jsxRuntimeExports.jsx(El,{gateway:h,gatewayDisplayName:h,total:(e==null?void 0:e.price.amount)||0,onSignInClick:()=>r("/customer-dash")}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&!h&&s.jsxRuntimeExports.jsx("span",{className:Wt.noMethod,children:"Payment method is not set"}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h&&s.jsxRuntimeExports.jsx("div",{className:Wt.activeMethod,children:i&&s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(x=i.find(b=>b.name===h))==null?void 0:x.logoCfImageId,gatewayDisplayName:(g=i.find(b=>b.name===h))==null?void 0:g.displayName,gateway:h,poweredByLogoCfId:(S=i.find(b=>b.name===h))==null?void 0:S.poweredByImageCfImageId,className:Wt.activeMethodPaymentMethod,selected:p===h,onSelect:b=>{n(b)}},h)})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:b=>{b.stopPropagation(),m(!0),d(!0)},children:t.gateway?"Change":"Manage"})]}),c&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>d(!1),children:s.jsxRuntimeExports.jsx(ER,{setIsLoading:u,setIsOpen:d})})]})},TR=({gatewayInfo:e})=>{var t,n,r,i,a;return s.jsxRuntimeExports.jsxs("div",{className:Wt.method,children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodLogo,children:[((t=e.card)==null?void 0:t.brand.toLowerCase())==="visa"&&s.jsxRuntimeExports.jsx(s.Visa,{}),((n=e.card)==null?void 0:n.brand.toLowerCase())==="mastercard"&&s.jsxRuntimeExports.jsx("img",{src:bR,alt:"",width:22}),((r=e.card)==null?void 0:r.brand.toLowerCase())!=="visa"&&((i=e.card)==null?void 0:i.brand.toLowerCase())!=="mastercard"&&s.jsxRuntimeExports.jsx(s.Icon,{name:"CreditCard",width:22})]}),s.jsxRuntimeExports.jsxs("p",{className:Wt.paymentMethodNumber,children:["•••• •••• •••• ",(a=e.card)==null?void 0:a.last4]})]})},CR="_subscriptionProductContainer_83ibx_4",SR="_subscriptionProductImage_83ibx_15",yR="_subscriptionProductInfo_83ibx_32",RR="_name_83ibx_37",kR="_price_83ibx_40",Vn={subscriptionProductContainer:CR,subscriptionProductImage:SR,subscriptionProductInfo:yR,name:RR,price:kR},AR=({subscription:e,id:t,accessToken:n})=>{const[r,i]=k.useState(!1),{setIsOpen:a}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Vn.subscriptionProductContainer,onClick:o=>o.stopPropagation(),children:[s.jsxRuntimeExports.jsx("div",{className:Vn.subscriptionProductImage,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(e.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:Vn.subscriptionProductInfo,children:[s.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:s.jsxRuntimeExports.jsx("h2",{className:Vn.name,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:Vn.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:o=>{o.preventDefault(),i(!0),a(!0)},children:"Cancel"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>i(!1),children:s.jsxRuntimeExports.jsx(p6,{accessToken:n,id:t,isOpen:r,setIsOpen:i})})]})},NR="_content_5ctxw_1",IR="_selectedPlan_5ctxw_37",wR="_planName_5ctxw_44",jR="_description_5ctxw_48",LR="_price_5ctxw_51",vR="_buttonGroup_5ctxw_79",PR="_buttonWrapper_5ctxw_84",OR="_modal_5ctxw_88",DR="_header_5ctxw_95",lt={content:NR,selectedPlan:IR,planName:wR,description:jR,price:LR,buttonGroup:vR,buttonWrapper:PR,modal:OR,header:DR},MR=({setIsOpen:e,selectedVariant:t,subscription:n})=>{if(!t)return null;const{setIsOpen:r}=s.useModalStore(),i=()=>{a()},a=()=>{r(!1),setTimeout(()=>{e(!1)},300)},o=(t.subscriptionSettings.compareAtPrice||t.subscriptionSettings.price).amount,u=t.subscriptionSettings.compareAtPrice?t.subscriptionSettings.compareAtPrice.amount-t.subscriptionSettings.price.amount:t.subscriptionSettings.price.amount,c=o-u,d=new Intl.NumberFormat("en-US",{style:"currency",currency:n.price.currency});return s.jsxRuntimeExports.jsxs("div",{className:lt.modal,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:()=>a(),fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.content,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.selectedPlan,children:[s.jsxRuntimeExports.jsx("h2",{className:lt.planName,children:t.name}),s.jsxRuntimeExports.jsx("p",{className:lt.description,children:t.description}),s.jsxRuntimeExports.jsxs("p",{className:lt.price,children:["$",t.subscriptionSettings.price.amount.toFixed(2)," /"," ",t.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),s.jsxRuntimeExports.jsx(dr,{formatter:d,coupon:null,total:c,discount:u})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>a(),children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Primary",onClick:i,children:["Upgrade for $",c.toFixed(2)]})})]})]})]})},BR="_reviewMessage_1t8u4_1",FR="_leaveReviewContainer_1t8u4_11",HR="_leaveReviewTitle_1t8u4_20",zs={reviewMessage:BR,leaveReviewContainer:FR,leaveReviewTitle:HR},UR=({review:e,orderId:t,className:n})=>{const[r,i]=k.useState((e==null?void 0:e.rating)||0),[a,o]=k.useState(!1),{setIsOpen:u}=s.useModalStore(),{notifications:c,setNotifications:d}=s.useNotificationStore(),m=async h=>{e&&"accessToken"in e&&(await ac({comment:h,rating:r},t,e.accessToken),d([...c,{status:"success",id:s.v4(),message:"Review left successfully"}]),o(!1))};return k.useEffect(()=>{e&&r&&"accessToken"in e&&!e.rating&&(u(!0),o(!0))},[r]),e?e.rating&&"accessToken"in e?s.jsxRuntimeExports.jsxs("div",{className:zs.reviewMessage,children:["You left a ",e.rating," star rating"]}):s.jsxRuntimeExports.jsxs("div",{className:s.clx(zs.leaveReviewContainer,n),children:[s.jsxRuntimeExports.jsx("p",{className:zs.leaveReviewTitle,children:"Leave a review"}),s.jsxRuntimeExports.jsx(Hf,{rating:r,setRating:i,disabled:!!e.rating||!("accessToken"in e)}),a&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(XR,{setIsOpen:o,onSubmit:m})})]}):null},$R="_bottomSheet_1bcyj_1",zR="_content_1bcyj_7",WR="_title_1bcyj_18",qR="_buttonGroup_1bcyj_22",VR="_buttonWrapper_1bcyj_33",YR="_modal_1bcyj_37",GR="_header_1bcyj_44",Ht={bottomSheet:$R,content:zR,title:WR,buttonGroup:qR,buttonWrapper:VR,modal:YR,header:GR},XR=({setIsOpen:e,onSubmit:t})=>{const[n,r]=k.useState(""),{setIsOpen:i}=s.useModalStore(),a=()=>{i(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ht.modal,onClick:o=>o.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ht.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ht.title,children:"Review Description"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:a,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Ht.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.content,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{placeholder:"Great product and fast checkout...",value:n,onChange:o=>r(o),label:"Describe your review in detail below"})}),s.jsxRuntimeExports.jsxs("div",{className:Ht.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:a,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!n,onClick:()=>{a(),t(n)},children:"Submit"})})]})]})]})},QR="_container_1idhv_1",KR="_buttonGroup_1idhv_8",ZR="_buttonWrapper_1idhv_15",JR="_header_1idhv_19",e6="_content_1idhv_28",en={container:QR,buttonGroup:KR,buttonWrapper:ZR,header:JR,content:e6},t6=({setIsOpen:e})=>{const{subscription:t}=s.useSubscriptionStore(),{getTotalAndDiscount:n,cart:r,coupon:i}=s.useCart(),[a,o]=k.useState(1),u=s.useNavigate(),{setIsOpen:c}=s.useModalStore(),{setNotifications:d,notifications:m}=s.useNotificationStore(),[h,f]=k.useState(!1),p=k.useMemo(()=>n(),[i,r]),x=k.useMemo(()=>p.totalWithDiscount?p.total-p.totalWithDiscount:0,[p]);if(h)return s.jsxRuntimeExports.jsx(s.ProcessingPaymentModal,{});const g=(t==null?void 0:t.price.currency)||"USD",S=new Intl.NumberFormat("en-US",{style:"currency",currency:g});async function b(){var y;f(!0);try{const{data:P}=await s.extendSubscription((t==null?void 0:t.id)||"",{});d([{id:s.v4(),message:"Order created successfully",status:"success"}]),u(`/orders/${(y=P.data)==null?void 0:y.id}/${P.data.fullAccessToken}`)}catch(P){const j=P;d([...m,{id:s.v4(),message:`Order creation failed: ${j.message}`,status:"error"}]),A()}finally{f(!1)}}function A(){c(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:en.container,onClick:y=>y.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:en.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:en.title,children:"Extend Subscription"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:A,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:en.content,children:[s.jsxRuntimeExports.jsx(Zf,{step:a,totalSteps:12,onStepChange:o,label:"How long would you like to extend your subscription for?"}),s.jsxRuntimeExports.jsx(dr,{formatter:S,coupon:i,total:p.total,discount:x,totalWithDiscount:p.totalWithDiscount}),s.jsxRuntimeExports.jsxs("div",{className:en.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:A,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:b,children:"Extend"})})]})]})]})},n6="_bottomSheet_uw5jb_1",r6="_content_uw5jb_7",s6="_radioGroup_uw5jb_11",i6="_confirmation_uw5jb_26",a6="_iconWrapper_uw5jb_33",o6="_title_uw5jb_42",u6="_message_uw5jb_48",l6="_buttonGroup_uw5jb_54",c6="_buttonWrapper_uw5jb_64",d6="_modal_uw5jb_68",h6="_header_uw5jb_77",Le={bottomSheet:n6,content:r6,radioGroup:s6,confirmation:i6,iconWrapper:a6,title:o6,message:u6,buttonGroup:l6,buttonWrapper:c6,modal:d6,header:h6},m6={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},p6=({isOpen:e,setIsOpen:t,id:n,accessToken:r})=>{const[i,a]=k.useState(0),[o,u]=k.useState(!1),[c,d]=k.useState(""),[m,h]=k.useState(""),{setIsOpen:f}=s.useModalStore(),p=async()=>{if(!c)return;u(!0);const g=await s.cancelSubscription(n,r,{reason:c==="Other reason"?m:c});u(!1),g&&a(2)};k.useEffect(()=>{e||(a(0),d(""),h(""))},[e]);const x=()=>{f(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Le.modal,onClick:g=>g.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Le.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:m6[i]||""}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Le.content,children:[i===0&&s.jsxRuntimeExports.jsxs("div",{className:Le.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),s.jsxRuntimeExports.jsxs("div",{className:Le.radioGroup,children:[s.jsxRuntimeExports.jsx(s.Radio,{defaultValue:c,onChange:g=>d(g),options:[{value:"Found another company",label:"Found another company"},{value:"Expensive",label:"Expensive"},{value:"Technical problems",label:"Technical problems"},{value:"Support problems",label:"Support problems"},{value:"Other reason",label:"Other reason"}],flexDirection:"column"}),c==="Other reason"&&s.jsxRuntimeExports.jsx(s.Textarea$1,{value:m,onChange:g=>h(g),placeholder:"Describe the reason..."})]}),s.jsxRuntimeExports.jsxs("div",{className:Le.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Le.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:Le.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:()=>c&&a(1),disabled:!c,children:"Continue"})})]})]}),i===1&&s.jsxRuntimeExports.jsxs("div",{className:Le.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),s.jsxRuntimeExports.jsxs("div",{className:Le.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Le.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:Le.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:p,disabled:o,children:"Cancel it anyway"})})]})]}),i===2&&s.jsxRuntimeExports.jsxs("div",{className:Le.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:`${Le.confirmation}`,children:[s.jsxRuntimeExports.jsx("div",{className:Le.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"})}),s.jsxRuntimeExports.jsx("p",{className:Le.title,children:"Subscription Cancelled"}),s.jsxRuntimeExports.jsx("p",{className:Le.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),s.jsxRuntimeExports.jsx("div",{className:Le.buttonGroup,children:s.jsxRuntimeExports.jsx("div",{className:Le.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Close"})})})]})]})]})},f6="_checkoutContainer_wkomn_1",x6="_loaderContainer_wkomn_20",Ws={checkoutContainer:f6,loaderContainer:x6},g6=()=>{const{cart:e,products:t,pending:n,getTotalAndDiscount:r,getPossibleGateways:i,submitCart:a,setGateway:o,applyCoupon:u,setDiscordSocialConnectId:c,setCustomFields:d,applyCouponPending:m,coupon:h,removeCoupon:f,getDiscordSettings:p,setPaymentMethod:x,reset:g}=s.useCart(),S=k.useMemo(()=>r(),[h,e]),b=s.useNavigate();return k.useEffect(()=>{if(e.parts.length===0)try{b(-1)}catch{b("/")}},[e.parts]),n?s.jsxRuntimeExports.jsx("div",{className:Ws.checkoutContainer,children:s.jsxRuntimeExports.jsx("div",{className:Ws.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})})}):s.jsxRuntimeExports.jsxs("div",{className:Ws.checkoutContainer,children:[s.jsxRuntimeExports.jsx(IS,{cart:e,products:t,applyCoupon:u,applyCouponPending:m,coupon:h,removeCoupon:f,totalAndDiscount:S}),s.jsxRuntimeExports.jsx(my,{cart:e,getPossibleGateways:i,setGateway:o,getDiscordSettings:p,products:t,submitCart:a,totalAndDiscount:S,setCustomFieldsToCart:d,setDiscordSocialConnectId:c,setPaymentMethod:x,reset:g})]})},E6="_chargePageContainer_1a200_1",b6="_chargeItems_1a200_14",_6="_mainContent_1a200_25",T6="_contentWrapper_1a200_36",C6="_statusBlock_1a200_41",S6="_notPaidSection_1a200_45",y6="_footer_1a200_53",R6="_loaderContainer_1a200_63",Ut={chargePageContainer:E6,chargeItems:b6,mainContent:_6,contentWrapper:T6,statusBlock:C6,notPaidSection:S6,footer:y6,loaderContainer:R6},k6=()=>{const{id:e}=s.useParams(),[t,n]=s.useSearchParams(),[r,i]=k.useState(!1),[a,o]=k.useState(),[u,c]=k.useState(!0),d=s.useNavigate(),m=k.useRef(),{setIsOpen:h}=s.useModalStore();return k.useEffect(()=>{const f=async(x,g=!1)=>{g||i(!0);const{data:S}=await oc(x);i(!1),o(S)},p=setInterval(()=>{e&&f(e,!0)},5e3);return e&&f(e),()=>{clearInterval(p)}},[]),k.useEffect(()=>{const f=setTimeout(()=>{console.log("charge timeout",a);const p=t.get("redirectRoute");(a==null?void 0:a.status)===s.ChargeStatus.Paid&&a.redirectUrl&&!m.current&&window.open(a.redirectUrl,"_self"),(a==null?void 0:a.status)===s.ChargeStatus.Paid&&m.current&&d(m.current,{replace:!0}),p&&m&&(m.current=p,t.delete("redirectRoute"),n(t))},1e3);return()=>clearTimeout(f)},[a]),k.useEffect(()=>{((a==null?void 0:a.gateway)==="PayPalFF"||(a==null?void 0:a.gateway)==="Сashapp")&&h(!0)},[a]),r?s.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:Ut.chargePageContainer,children:[s.jsxRuntimeExports.jsx("div",{className:Ut.chargeItems,children:s.jsxRuntimeExports.jsx(Ky,{charge:a})}),s.jsxRuntimeExports.jsx("div",{className:Ut.mainContent,children:s.jsxRuntimeExports.jsxs("div",{className:Ut.contentWrapper,children:[a&&(a==null?void 0:a.status)!==s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx(s.ChargeStatusBlock,{charge:a}),a&&s.jsxRuntimeExports.jsx("div",{className:`${Ut.statusBlock}`,children:s.jsxRuntimeExports.jsx(Tl,{lastUpdate:a.expiresAt,email:a.customerForCharge.email,invoiceId:a.id,paymentType:a.gateway})}),(a==null?void 0:a.status)===s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx("div",{className:Ut.notPaidSection,children:a==null?void 0:a.displayPaymentInfo.map((f,p)=>s.jsxRuntimeExports.jsx(_l,{block:f},p))}),s.jsxRuntimeExports.jsx(vt,{className:Ut.footer})]})}),(a==null?void 0:a.gateway)==="PayPalFF"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>c(!1),children:s.jsxRuntimeExports.jsx(Hy,{price:a.price,setIsOpen:c})}),(a==null?void 0:a.gateway)==="Сashapp"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>i(!1),children:s.jsxRuntimeExports.jsx(p5,{setIsOpen:c,chargeId:a.id})})]})},A6="_wrapper_1fax2_1",N6="_title_1fax2_20",I6="_container_1fax2_26",w6="_content_1fax2_36",j6="_messages_1fax2_46",L6="_input_1fax2_58",v6="_textarea_1fax2_64",P6="_message_1fax2_46",O6="_messageDate_1fax2_88",D6="_myMessage_1fax2_94",M6="_otherMessage_1fax2_101",B6="_button_1fax2_108",F6="_loadingMessage_1fax2_117",$e={wrapper:A6,title:N6,container:I6,content:w6,messages:j6,input:L6,textarea:v6,message:P6,messageDate:O6,myMessage:D6,otherMessage:M6,button:B6,loadingMessage:F6},H6=()=>{const e=window.location.pathname.split("/"),t=e[e.length-1],n=e[e.length-2],[r,i]=k.useState(!0),[a,o]=k.useState(null),[u,c]=k.useState(""),[d,m]=k.useState(null),{executeRecaptcha:h}=s.useReCaptcha(),f=async()=>{if(n&&t){const{data:g}=await s.fetchTicket(n,t);o(g),i(!1)}};k.useEffect(()=>{f();const g=setInterval(()=>{f()},5e3);return()=>clearInterval(g)},[]);const p=async()=>{const g=await h();if(!n||!t||!g||!u.trim())return;const S={content:u,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};o(b=>b?{...b,messages:[...b.messages,S]}:null),m(S.id),c("");try{await s.sendTicketMessage(n,t,u,g),await f()}finally{setTimeout(()=>{m(null)},1e4)}},x=g=>{const S=new Date,b=new Date(g),A=Math.floor((S.getTime()-b.getTime())/1e3);if(A<60)return"right now";if(A<3600){const y=Math.floor(A/60);return`${y} minute${y>1?"s":""} ago`}else if(A<10800){const y=Math.floor(A/3600);return`${y} hour${y>1?"s":""} ago`}else return b.getFullYear()===S.getFullYear()?b.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):b.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return s.jsxRuntimeExports.jsx("div",{className:$e.wrapper,children:r&&!a?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs("div",{className:$e.container,children:[s.jsxRuntimeExports.jsx("div",{className:$e.title,children:`#${n} (${a==null?void 0:a.title})`}),s.jsxRuntimeExports.jsxs("div",{className:$e.content,children:[s.jsxRuntimeExports.jsx("div",{className:$e.messages,children:a==null?void 0:a.messages.sort((g,S)=>new Date(g.createdAt).getTime()-new Date(S.createdAt).getTime()).map(g=>s.jsxRuntimeExports.jsxs("div",{className:s.clx($e.message,{[$e.myMessage]:!g.isSellerReply,[$e.otherMessage]:g.isSellerReply,[$e.loadingMessage]:d===g.id}),children:[s.jsxRuntimeExports.jsx("div",{className:$e.messageContent,children:s.splitTextIntoSpans(g.content,!1)}),d!==g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:x(g.createdAt)}),d===g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:s.jsxRuntimeExports.jsx(s.Loader,{})})]},g.id))}),s.jsxRuntimeExports.jsxs("div",{className:$e.input,children:[s.jsxRuntimeExports.jsx("textarea",{className:$e.textarea,value:u,placeholder:"What worries you?",onChange:g=>c(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),p())},style:{resize:"none",maxHeight:"150px",overflowY:"auto"}}),s.jsxRuntimeExports.jsx("div",{className:$e.button,onClick:p,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"PaperPlaneRight"})})]})]})]})})},U6="_subscriptionContainer_1j6ol_1",$6="_leftSection_1j6ol_15",z6="_content_1j6ol_26",W6="_mainContent_1j6ol_33",q6="_detailsSection_1j6ol_37",V6="_buttonGroup_1j6ol_50",Y6="_detailsContent_1j6ol_57",tn={subscriptionContainer:U6,leftSection:$6,content:z6,mainContent:W6,detailsSection:q6,buttonGroup:V6,detailsContent:Y6},G6=()=>{const{id:e,accessToken:t}=s.useParams(),{subscription:n,setSubscription:r}=s.useSubscriptionStore(),{setIsOpen:i}=s.useModalStore(),[a,o]=k.useState(!1),[u,c]=k.useState(!1);k.useLayoutEffect(()=>{r(null)},[e,t]);const{balanceSettings:d,setBalanceSettings:m}=s.useCustomerDashboardStore();return k.useEffect(()=>{e&&t&&(async()=>{if(!e||!t)return;c(!0);const{data:f}=await s.fetchSubscription(e,t);r({...f}),c(!1)})()},[e,t]),k.useEffect(()=>{d||(async()=>{const f=await s.getBalanceSettings();m(f)})()},[d]),u?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:tn.subscriptionContainer,children:[s.jsxRuntimeExports.jsx("div",{className:tn.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.content,children:[s.jsxRuntimeExports.jsx(cr,{}),s.jsxRuntimeExports.jsxs("div",{className:tn.mainContent,children:[n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),s.jsxRuntimeExports.jsx(R5,{subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),s.jsxRuntimeExports.jsx("div",{className:tn.buttonGroup,children:n.pricingPlanExists&&s.jsxRuntimeExports.jsx(s.Button$1,{onClick:h=>{h.stopPropagation(),i(!0),o(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),s.jsxRuntimeExports.jsx(vt,{})]})]})}),s.jsxRuntimeExports.jsx("div",{className:tn.detailsSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.detailsContent,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(n==null?void 0:n.coupon)&&s.jsxRuntimeExports.jsx(iR,{coupon:n.coupon,currency:n.price.currency||"USD"}),n&&s.jsxRuntimeExports.jsx(AR,{id:e||"",accessToken:t||"",subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(_R,{}),n.activeTo&&s.jsxRuntimeExports.jsx(Z5,{})]}),s.jsxRuntimeExports.jsx(vt,{className:"flex md:hidden"})]})})]}),s.jsxRuntimeExports.jsx(Y5,{isOpen:a,setIsOpen:o,subscription:n})]})},X6="_topUpContainer_1pag6_1",Q6="_formWrapper_1pag6_15",K6="_header_1pag6_29",Z6="_footer_1pag6_82",J6="_wrapper_1pag6_105",Yn={topUpContainer:X6,formWrapper:Q6,header:K6,footer:Z6,wrapper:J6},ek=()=>{const{gatewaysDetail:e,setGatewaysDetail:t,balanceSettings:n,setBalanceSettings:r}=s.useCustomerDashboardStore();return k.useEffect(()=>{!e&&n&&(async()=>{const a=await s.getGatewaysDetail(n!=null&&n.isEnabled?(n==null?void 0:n.topUpSettings.gateways)||[]:[]);t(a)})()},[e,n]),k.useEffect(()=>{n||(async()=>{const a=await s.getBalanceSettings();r(a)})()},[n]),s.jsxRuntimeExports.jsxs("div",{className:Yn.wrapper,children:[s.jsxRuntimeExports.jsx(cr,{className:Yn.header}),s.jsxRuntimeExports.jsx("div",{className:Yn.topUpContainer,children:n?s.jsxRuntimeExports.jsx("div",{className:Yn.formWrapper,children:s.jsxRuntimeExports.jsx(s.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):s.jsxRuntimeExports.jsx(s.Loader,{})}),s.jsxRuntimeExports.jsx("div",{className:Yn.footer,children:s.jsxRuntimeExports.jsx(vt,{})})]})},tk="_orderPage_1nvve_1",nk="_leftSection_1nvve_15",rk="_content_1nvve_35",sk="_main_1nvve_42",ik="_statusBlock_1nvve_54",ak="_timelineBlock_1nvve_58",ok="_footer_1nvve_62",uk="_rightSection_1nvve_71",lk="_header_1nvve_84",ck="_productList_1nvve_92",dk="_mobileFooter_1nvve_99",hk="_loaderContainer_1nvve_108",mk="_orderMainData_1nvve_116",pk="_prices_1nvve_123",fk="_headerTitle_1nvve_127",xk="_headerDescription_1nvve_131",Oe={orderPage:tk,leftSection:nk,content:rk,main:sk,statusBlock:ik,timelineBlock:ak,footer:ok,rightSection:uk,header:lk,productList:ck,mobileFooter:dk,loaderContainer:hk,orderMainData:mk,prices:pk,headerTitle:fk,headerDescription:xk},gk=()=>{var h,f,p;const{id:e,accessToken:t}=s.useParams(),n=s.useNavigate(),[r,i]=k.useState(),[a,o]=k.useState(!1),u=s.useCopy(),c=((h=r==null?void 0:r.rawPrice)==null?void 0:h.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:c}),m=k.useMemo(()=>(r==null?void 0:r.partOrders.map(x=>{var g,S,b,A;return{id:(x==null?void 0:x.id)||0,image:x.productWithVariant.image,name:((g=x.productWithVariant)==null?void 0:g.name)||"",description:((S=x.productWithVariant)==null?void 0:S.description)||"",price:{quantity:x.quantity,amount:((b=x.productWithVariant)==null?void 0:b.price.amount)||0,currency:(A=x.productWithVariant)==null?void 0:A.price.currency},deliveryCategories:"deliveryCategories"in x?x.deliveryCategories:void 0,customerNote:x.customerNote,chargeType:x.chargeType||"ONE_TIME"}}))||[],[r]);return k.useLayoutEffect(()=>{if(e&&!t){const x=JSON.parse(localStorage.getItem("orders")||"{}");x[e]&&n(`/orders/${e}/${x[e].fullAccessToken}`)}},[e]),k.useEffect(()=>{const x=async(S,b=!1)=>{b||o(!0);const{data:A}=await(t?s.fetchAuthorizedOrder(`${S}/${t}`):s.fetchOrder(S));o(!1),A.charge.status===s.ChargeStatus.NotPaid&&n(`/charges/${A.charge.id}`,{replace:!0}),i(A)};e&&x(e);const g=setInterval(()=>{e&&x(e,!0)},5e3);return()=>{clearInterval(g)}},[]),a?s.jsxRuntimeExports.jsx("div",{className:Oe.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:Oe.orderPage,children:[s.jsxRuntimeExports.jsx("div",{className:Oe.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:Oe.content,children:[s.jsxRuntimeExports.jsx(cr,{}),r&&s.jsxRuntimeExports.jsxs("div",{className:Oe.main,children:[s.jsxRuntimeExports.jsx(s.OrderStatusBlock,{className:Oe.statusBlock,orderStatus:r.status}),s.jsxRuntimeExports.jsxs("div",{className:Oe.orderMainData,children:[s.jsxRuntimeExports.jsx(Tl,{lastUpdate:r.createdAt,paymentType:r.charge.gateway,email:r.charge.customerForCharge.email,invoiceId:r.charge.id}),"accessToken"in r.review&&s.jsxRuntimeExports.jsx(UR,{orderId:r.id,review:r.review})]}),r.charge&&s.jsxRuntimeExports.jsx(s.TrackPayment,{className:Oe.timelineBlock,timeline:r.charge.timeline}),s.jsxRuntimeExports.jsx(vt,{className:Oe.footer})]})]})}),s.jsxRuntimeExports.jsx("div",{className:Oe.rightSection,children:s.jsxRuntimeExports.jsxs("div",{className:Oe.content,children:[(r==null?void 0:r.charge.name)&&s.jsxRuntimeExports.jsxs("header",{className:Oe.header,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:Oe.headerTitle,children:r.charge.name}),r.charge.description&&s.jsxRuntimeExports.jsx("p",{className:Oe.headerDescription,children:r.charge.description})]}),s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",onClick:()=>u((r==null?void 0:r.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),s.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:Oe.productList,children:m.map(x=>s.jsxRuntimeExports.jsx(Pi,{product:x,isOrder:!0},x.id))}),s.jsxRuntimeExports.jsx(dr,{formatter:d,coupon:null,total:((f=r==null?void 0:r.charge)==null?void 0:f.price.amount)||0,discount:0,totalWithDiscount:((p=r==null?void 0:r.charge)==null?void 0:p.price.amount)||0,className:Oe.prices,isShowSubtotal:!1}),s.jsxRuntimeExports.jsx(vt,{className:Oe.mobileFooter})]})]})})]})},Ek=e=>{const{blocks:t,settings:n,header:r,footer:i,announcement:a}=e,[o,u]=k.useState(null),{general:c}=s.useGeneralStore(),{setBlocks:d,setSourceBlocks:m,setHeader:h,setFooter:f,setAnnouncement:p,setSettings:x}=s.useBlocksStore(),{setHeader:g,setFooter:S,setAnnouncement:b}=s.useLayersStore(),{themeSettings:A}=s.useThemeSettingsStore(),{settings:y,setSettings:P}=s.useSettingsStore(),j=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,N=localStorage.getItem("shopPassword"),q=localStorage.getItem("shopId")||"";return k.useEffect(()=>{q||localStorage.setItem("shopId",(c==null?void 0:c.info.id)||"")},[c]),k.useEffect(()=>{if(A&&y){const V=hc(A,y);Ec(A),mc(V)}},[A,y,window.location.hostname]),k.useEffect(()=>{const V={};Object.keys(t).map(W=>{V[W]=t[W]}),m(V),d(V),h(r),f(i),p(a),x(n);const K=new r,w=JSON.parse(JSON.stringify(K));g(w,!1);const $=new i,M=JSON.parse(JSON.stringify($));S(M,!1);const H=new a,Y=JSON.parse(JSON.stringify(H));b(Y,!1);const z=new n,X=JSON.parse(JSON.stringify(z));P(X);const G=s.createBrowserRouter([{element:s.jsxRuntimeExports.jsx(uf,{shopDomain:j,shopId:q,shopPassword:N||void 0,children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(nf,{children:s.jsxRuntimeExports.jsx(s.Outlet,{})})})}),errorElement:s.jsxRuntimeExports.jsx(rf,{}),children:[{path:"/admin/builder/*",element:s.jsxRuntimeExports.jsx(Hp,{children:s.jsxRuntimeExports.jsx(Pp,{blocks:t,settings:n,header:r,footer:i,announcement:a})}),errorElement:s.jsxRuntimeExports.jsx(Fp,{})},{path:"/checkout",element:s.jsxRuntimeExports.jsx(g6,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:s.jsxRuntimeExports.jsx(ek,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:s.jsxRuntimeExports.jsx(k6,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(gk,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(G6,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Subscriptions",!0)},{path:"/customer-dash",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderAnnouncement,{}),s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:"1 1 auto"},children:s.jsxRuntimeExports.jsx(s.CustomerDashboard,{})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Customer Dashboard",!0)},{path:"/validation",element:s.jsxRuntimeExports.jsx(Xp,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(H6,{})})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:s.jsxRuntimeExports.jsx(dc,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{})}]}]);u(G)},[c]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:o&&s.jsxRuntimeExports.jsx(s.RouterProvider,{router:o})})};exports.ReCaptchaProvider=s.ReCaptchaProvider;exports.aspectRatioOptions=s.aspectRatioOptions;exports.formatPrice=s.formatPrice;exports.splitTextIntoSpans=s.splitTextIntoSpans;exports.useAdaptiveStyles=s.useAdaptiveStyles;exports.useCart=s.useCart;exports.useReCaptcha=s.useReCaptcha;exports.App=Ek;exports.ColorVariables=co;exports.hotReload=bc;exports.iconNames=Sl;exports.useBuilderPages=Tc;exports.useCreateTicket=_c;