@billgangcom/theme-lib 1.76.0 → 1.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,4 +128,4 @@
128
128
  `))+1))}const a="#".repeat(o),u=n.enter("headingAtx"),l=n.enter("phrasing");i.move(a+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
129
129
  `,...i.current()});return/^[\t ]/.test(d)&&(d=ar(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),l(),u(),d}ec.peek=cC;function ec(e){return e.value||""}function cC(){return"<"}tc.peek=lC;function tc(e,t,n,r){const o=jo(n),i=o==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=n.enter("label");const l=n.createTracker(r);let d=l.move("![");return d+=l.move(n.safe(e.alt,{before:d,after:"]",...l.current()})),d+=l.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=l.move("<"),d+=l.move(n.safe(e.url,{before:d,after:">",...l.current()})),d+=l.move(">")):(u=n.enter("destinationRaw"),d+=l.move(n.safe(e.url,{before:d,after:e.title?" ":")",...l.current()}))),u(),e.title&&(u=n.enter(`title${i}`),d+=l.move(" "+o),d+=l.move(n.safe(e.title,{before:d,after:o,...l.current()})),d+=l.move(o),u()),d+=l.move(")"),a(),d}function lC(){return"!"}nc.peek=dC;function nc(e,t,n,r){const o=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(r);let l=u.move("![");const d=n.safe(e.alt,{before:l,after:"]",...u.current()});l+=u.move(d+"]["),a();const m=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...u.current()});return a(),n.stack=m,i(),o==="full"||!d||d!==h?l+=u.move(h+"]"):o==="shortcut"?l=l.slice(0,-1):l+=u.move("]"),l}function dC(){return"!"}rc.peek=hC;function rc(e,t,n){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const a=n.unsafe[i],u=n.compilePattern(a);let l;if(a.atBreak)for(;l=u.exec(r);){let d=l.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(l.index+1)}}return o+r+o}function hC(){return"`"}function sc(e,t){const n=xo(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))}oc.peek=mC;function oc(e,t,n,r){const o=jo(n),i=o==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,l;if(sc(e,n)){const m=n.stack;n.stack=[],u=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),u(),n.stack=m,h}u=n.enter("link"),l=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(e,{before:d,after:"](",...a.current()})),d+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(e.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(l=n.enter("destinationRaw"),d+=a.move(n.safe(e.url,{before:d,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${i}`),d+=a.move(" "+o),d+=a.move(n.safe(e.title,{before:d,after:o,...a.current()})),d+=a.move(o),l()),d+=a.move(")"),u(),d}function mC(e,t,n){return sc(e,n)?"<":"["}ic.peek=pC;function ic(e,t,n,r){const o=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(r);let l=u.move("[");const d=n.containerPhrasing(e,{before:l,after:"]",...u.current()});l+=u.move(d+"]["),a();const m=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...u.current()});return a(),n.stack=m,i(),o==="full"||!d||d!==h?l+=u.move(h+"]"):o==="shortcut"?l=l.slice(0,-1):l+=u.move("]"),l}function pC(){return"["}function vo(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=vo(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 gC(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 ac(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 xC(e,t,n,r){const o=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?gC(n):vo(n);const u=e.ordered?a==="."?")":".":fC(n);let l=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&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&&(l=!0),ac(n)===a&&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"){l=!0;break}}}}l&&(a=u),n.bulletCurrent=a;const d=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=i,o(),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 o=EC(n);let i=n.bulletCurrent||vo(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const u=n.createTracker(r);u.move(i+" ".repeat(a-i.length)),u.shift(a);const l=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),m);return l(),d;function m(h,f,p){return f?(p?"":" ".repeat(a))+h:(p?i:i+" ".repeat(a-i.length))+h}}function IC(e,t,n,r){const o=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),o(),a}const TC=ns(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function _C(e,t,n,r){return(e.children.some(function(a){return TC(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function CC(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}uc.peek=SC;function uc(e,t,n,r){const o=CC(n),i=n.enter("strong"),a=n.createTracker(r),u=a.move(o+o);let l=a.move(n.containerPhrasing(e,{after:o,before:u,...a.current()}));const d=l.charCodeAt(0),m=Qr(r.before.charCodeAt(r.before.length-1),d,o);m.inside&&(l=ar(d)+l.slice(1));const h=l.charCodeAt(l.length-1),f=Qr(r.after.charCodeAt(0),h,o);f.inside&&(l=l.slice(0,-1)+ar(h));const p=a.move(o+o);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:m.outside},u+l+p}function SC(e,t,n){return n.options.strong||"*"}function yC(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 RC(e,t,n){const r=(ac(n)+(n.options.ruleSpaces?" ":"")).repeat(kC(n));return n.options.ruleSpaces?r.slice(0,-1):r}const cc={blockquote:Q_,break:aa,code:nC,definition:sC,emphasis:Ju,hardBreak:aa,heading:uC,html:ec,image:tc,imageReference:nc,inlineCode:rc,link:oc,linkReference:ic,list:xC,listItem:bC,paragraph:IC,root:_C,strong:uc,text:yC,thematicBreak:RC};function AC(){return{enter:{table:NC,tableData:ua,tableHeader:ua,tableRow:LC},exit:{codeText:jC,table:wC,tableData:$s,tableHeader:$s,tableRow:$s}}}function NC(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 LC(e){this.enter({type:"tableRow",children:[]},e)}function $s(e){this.exit(e)}function ua(e){this.enter({type:"tableCell",children:[]},e)}function jC(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,o=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
130
130
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:a,tableCell:l,tableRow:u}};function a(p,g,x,C){return d(m(p,x,C),p.align)}function u(p,g,x,C){const b=h(p,x,C),R=d([b]);return R.slice(0,R.indexOf(`
131
- `))}function l(p,g,x,C){const b=x.enter("tableCell"),R=x.enter("phrasing"),S=x.containerPhrasing(p,{...C,before:i,after:i});return R(),b(),S}function d(p,g){return Y_(p,{align:g,alignDelimiters:r,padding:n,stringLength:o})}function m(p,g,x){const C=p.children;let b=-1;const R=[],S=g.enter("table");for(;++b<C.length;)R[b]=h(C[b],g,x);return S(),R}function h(p,g,x){const C=p.children;let b=-1;const R=[],S=g.enter("tableRow");for(;++b<C.length;)R[b]=l(C[b],p,g,x);return S(),R}function f(p,g,x){let C=cc.inlineCode(p,g,x);return x.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function DC(){return{exit:{taskListCheckValueChecked:ca,taskListCheckValueUnchecked:ca,paragraph:BC}}}function OC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:MC}}}function ca(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function BC(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let i=-1,a;for(;++i<o.length;){const u=o[i];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function MC(e,t,n,r){const o=e.children[0],i=typeof e.checked=="boolean"&&o&&o.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);i&&u.move(a);let l=cc.listItem(e,t,n,{...r,...u.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),l;function d(m){return m+a}}function FC(){return[x_(),M_(),$_(),AC(),DC()]}function HC(e){return{extensions:[E_(),F_(e),z_(),PC(e),OC()]}}const UC={tokenize:GC,partial:!0},lc={tokenize:YC,partial:!0},dc={tokenize:XC,partial:!0},hc={tokenize:QC,partial:!0},$C={tokenize:KC,partial:!0},mc={name:"wwwAutolink",tokenize:qC,previous:fc},pc={name:"protocolAutolink",tokenize:VC,previous:gc},Pt={name:"emailAutolink",tokenize:WC,previous:xc},St={};function zC(){return{text:St}}let Zt=48;for(;Zt<123;)St[Zt]=Pt,Zt++,Zt===58?Zt=65:Zt===91&&(Zt=97);St[43]=Pt;St[45]=Pt;St[46]=Pt;St[95]=Pt;St[72]=[Pt,pc];St[104]=[Pt,pc];St[87]=[Pt,mc];St[119]=[Pt,mc];function WC(e,t,n){const r=this;let o,i;return a;function a(h){return!co(h)||!xc.call(r,r.previous)||Po(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return co(h)?(e.consume(h),u):h===64?(e.consume(h),l):n(h)}function l(h){return h===46?e.check($C,m,d)(h):h===45||h===95||Me(h)?(i=!0,e.consume(h),l):m(h)}function d(h){return e.consume(h),o=!0,l}function m(h){return i&&o&&ze(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function qC(e,t,n){const r=this;return o;function o(a){return a!==87&&a!==119||!fc.call(r,r.previous)||Po(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(UC,e.attempt(lc,e.attempt(dc,i),n),n)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function VC(e,t,n){const r=this;let o="",i=!1;return a;function a(h){return(h===72||h===104)&&gc.call(r,r.previous)&&!Po(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(ze(h)&&o.length<5)return o+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const f=o.toLowerCase();if(f==="http"||f==="https")return e.consume(h),l}return n(h)}function l(h){return h===47?(e.consume(h),i?d:(i=!0,l)):n(h)}function d(h){return h===null||qr(h)||Ie(h)||on(h)||Jr(h)?n(h):e.attempt(lc,e.attempt(dc,m),n)(h)}function m(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function GC(e,t,n){let r=0;return o;function o(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),o):a===46&&r===3?(e.consume(a),i):n(a)}function i(a){return a===null?n(a):t(a)}}function YC(e,t,n){let r,o,i;return a;function a(d){return d===46||d===95?e.check(hc,l,u)(d):d===null||Ie(d)||on(d)||d!==45&&Jr(d)?l(d):(i=!0,e.consume(d),a)}function u(d){return d===95?r=!0:(o=r,r=void 0),e.consume(d),a}function l(d){return o||r||!i?n(d):t(d)}}function XC(e,t){let n=0,r=0;return o;function o(a){return a===40?(n++,e.consume(a),o):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(hc,t,i)(a):a===null||Ie(a)||on(a)?t(a):(e.consume(a),o)}function i(a){return a===41&&r++,e.consume(a),o}}function 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),i):u===93?(e.consume(u),o):u===60||u===null||Ie(u)||on(u)?t(u):n(u)}function o(u){return u===null||u===40||u===91||Ie(u)||on(u)?t(u):r(u)}function i(u){return ze(u)?a(u):n(u)}function a(u){return u===59?(e.consume(u),r):ze(u)?(e.consume(u),a):n(u)}}function KC(e,t,n){return r;function r(i){return e.consume(i),o}function o(i){return Me(i)?n(i):t(i)}}function fc(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ie(e)}function gc(e){return!ze(e)}function xc(e){return!(e===47||co(e))}function co(e){return e===43||e===45||e===46||e===95||Me(e)}function Po(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:iS,partial:!0};function JC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:rS,continuation:{tokenize:sS},exit:oS}},text:{91:{name:"gfmFootnoteCall",tokenize:nS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:eS,resolveTo:tS}}}}function eS(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;o--;){const l=r.events[o][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return u;function u(l){if(!a||!a._balanced)return n(l);const d=mt(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}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)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function nS(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(h){if(i>999||h===93&&!a||h===null||h===91||Ie(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return o.includes(mt(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Ie(h)||(a=!0),i++,e.consume(h),h===92?m:d}function m(h){return h===91||h===92||h===93?(e.consume(h),i++,d):d(h)}}function rS(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,u;return l;function l(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(g)}function m(g){if(a>999||g===93&&!u||g===null||g===91||Ie(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return i=mt(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ie(g)||(u=!0),a++,e.consume(g),g===92?h:m}function h(g){return g===91||g===92||g===93?(e.consume(g),a++,m):m(g)}function f(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),o.includes(i)||o.push(i),pe(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function sS(e,t,n){return e.check(mr,t,e.attempt(ZC,t,n))}function oS(e){e.exit("gfmFootnoteDefinition")}function iS(e,t,n){const r=this;return pe(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function aS(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(a,u){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let d=l;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[l][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[l][1].end)},h={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",m,u],["enter",a[d][1],u],["exit",a[d][1],u],["enter",h,u]],p=u.parser.constructs.insideSpan.null;p&&Ke(f,f.length,0,es(p,a.slice(d+1,l),u)),Ke(f,f.length,0,[["exit",h,u],["enter",a[l][1],u],["exit",a[l][1],u],["exit",m,u]]),Ke(a,d-1,l-d+3,f),l=d+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,u,l){const d=this.previous,m=this.events;let h=0;return f;function f(g){return d===126&&m[m.length-1][1].type!=="characterEscape"?l(g):(a.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const x=_n(d);if(g===126)return h>1?l(g):(a.consume(g),h++,p);if(h<2&&!n)return l(g);const C=a.exit("strikethroughSequenceTemporary"),b=_n(g);return C._open=!b||b===2&&!!x,C._close=!x||x===2&&!!b,u(g)}}}class uS{constructor(){this.map=[]}add(t,n,r){cS(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function cS(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function lS(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function dS(){return{flow:{null:{name:"table",tokenize:hS,resolveAll:mS}}}}function hS(e,t,n){const r=this;let o=0,i=0,a;return u;function u(w){let $=r.events.length-1;for(;$>-1;){const G=r.events[$][1].type;if(G==="lineEnding"||G==="linePrefix")$--;else break}const B=$>-1?r.events[$][1].type:null,H=B==="tableHead"||B==="tableRow"?A:l;return H===A&&r.parser.lazy[r.now().line]?n(w):H(w)}function l(w){return e.enter("tableHead"),e.enter("tableRow"),d(w)}function d(w){return w===124||(a=!0,i+=1),m(w)}function m(w){return w===null?n(w):J(w)?i>1?(i=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):(i+=1,a&&(a=!1,o+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),a=!0,m):(e.enter("data"),h(w)))}function h(w){return w===null||w===124||Ie(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"),a=!1,de(w)?pe(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):g(w))}function g(w){return w===45||w===58?C(w):w===124?(a=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),x):L(w)}function x(w){return de(w)?pe(e,C,"whitespace")(w):C(w)}function C(w){return w===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(i+=1,b(w)):w===null||J(w)?P(w):L(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),R(w)):L(w)}function R(w){return w===45?(e.consume(w),R):w===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(w))}function S(w){return de(w)?pe(e,P,"whitespace")(w):P(w)}function P(w){return w===124?g(w):w===null||J(w)?!a||o!==i?L(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):L(w)}function L(w){return n(w)}function A(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||Ie(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,o=0,i=[0,0,0,0],a=[0,0,0,0],u=!1,l=0,d,m,h;const f=new uS;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(u=!1,l!==0&&(la(f,t,l,d,m),m=void 0,l=0),d={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",d,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,m={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",m,t]])),o=g.type==="tableDelimiterRow"?2:m?3:1):o&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],h=Dr(f,t,i,o,void 0,h),i=[0,0,0,0]),a[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],h=Dr(f,t,i,o,void 0,h)),i=a,a=[i[1],n,0,0])):g.type==="tableHead"?(u=!0,l=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(l=n,i[1]!==0?(a[0]=a[1],h=Dr(f,t,i,o,n,h)):a[1]!==0&&(h=Dr(f,t,a,o,n,h)),o=0):o&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&la(f,t,l,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=lS(t.events,n))}return e}function Dr(e,t,n,r,o,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(i.end=Object.assign({},gn(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=gn(t.events,n[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const d=gn(t.events,n[2]),m=gn(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 g=n[2]+1,x=n[3]-n[2]-1;e.add(g,x,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return o!==void 0&&(i.end=Object.assign({},gn(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function la(e,t,n,r,o){const i=[],a=gn(t.events,n);o&&(o.end=Object.assign({},a),i.push(["exit",o,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function gn(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const pS={name:"tasklistCheck",tokenize:gS};function fS(){return{text:{91:pS}}}function gS(e,t,n){const r=this;return o;function o(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Ie(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(l)}function u(l){return J(l)?t(l):de(l)?e.check({tokenize:xS},t,n)(l):n(l)}}function xS(e,t,n){return pe(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function ES(e){return Da([zC(),JC(),aS(e),dS(),fS()])}const bS={};function IS(e){const t=this,n=e||bS,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(ES(n)),i.push(FC()),a.push(HC(n))}const Do=({isOrder:e,product:t})=>{var i;const{shopGeneral:n}=s.useStorefrontStore(),r=t.subscriptionSettings,{cart:o}=s.useCart();return console.log(t.description),s.jsxRuntimeExports.jsxs("div",{className:`${Ne.checkoutProduct} ${e?Ne.isOrder:""}`,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:`${Ne.productImage} ${e?Ne.isOrderImage:""}`,children:t!=null&&t.image?s.jsxRuntimeExports.jsx("img",{className:Ne.image,src:s.convertCfImageIdToUrl(t.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image",fill:"var(--text-secondary)"})}),s.jsxRuntimeExports.jsx("div",{className:Ne.productInfo,children:s.jsxRuntimeExports.jsxs("div",{className:Ne.productHeader,children:[s.jsxRuntimeExports.jsx("h2",{className:Ne.productName,id:"h5",children:t.name}),s.jsxRuntimeExports.jsxs("span",{className:Ne.quantityBadge,id:"md",children:[t.price.quantity,"x"]})]})}),t.chargeType==="RECURRING"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:r&&`${s.formatPrice(r.price)} / ${s.normalizeInterval(r.recurringIntervalDays||0)}${r.entryFee?" + "+s.formatPrice(r.entryFee):""}`}),t.chargeType==="ONE_TIME"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:t.variantsGateways&&o.gateway&&t.variantsGateways.some(a=>a.name===o.gateway&&a.overrodePrice)?s.formatPrice(((i=t.variantsGateways.find(a=>a.name===o.gateway))==null?void 0:i.overrodePrice)||t.price):s.formatPrice(t.price)})]}),t.description&&s.jsxRuntimeExports.jsx("p",{className:Ne.productDescription,children:s.jsxRuntimeExports.jsx(ru,{remarkPlugins:[IS],rehypePlugins:[d_],components:{a:({node:a,...u})=>s.jsxRuntimeExports.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer",className:Ne.link})},children:t.description})}),t.deliveryCategories&&s.jsxRuntimeExports.jsx("div",{className:Ne.deliveryCategories,children:t.deliveryCategories.map(a=>s.jsxRuntimeExports.jsx(s.DeliveryItem,{deliveryConfiguration:a},a.id))}),t.customerNote&&s.jsxRuntimeExports.jsxs("div",{className:Ne.customerNote,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.noteHeader,children:[(n==null?void 0:n.info.logo)&&s.jsxRuntimeExports.jsx("div",{className:Ne.logoContainer,children:s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(n==null?void 0:n.info.logo.cfId)})}),s.jsxRuntimeExports.jsx("p",{className:Ne.shopName,id:"md",children:n==null?void 0:n.info.name})]}),s.jsxRuntimeExports.jsx("p",{className:Ne.noteContent,id:"md",children:t.customerNote})]})]})},TS="_coupon_dkjzv_1",_S="_couponApplied_dkjzv_7",CS="_discount_dkjzv_17",SS="_removeButton_dkjzv_23",yS="_removeButtonText_dkjzv_27",kS="_couponInput_dkjzv_31",RS="_couponInputContainer_dkjzv_37",Mt={coupon:TS,couponApplied:_S,discount:CS,removeButton:SS,removeButtonText:yS,couponInput:kS,couponInputContainer:RS},AS=({applyCoupon:e,couponData:t,discount:n,removeCoupon:r,gateway:o})=>{const[i,a]=k.useState(null),[u,l]=k.useState(!1);return s.jsxRuntimeExports.jsxs("div",{className:Mt.coupon,children:[u&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Mt.skeleton,children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!u&&(t?s.jsxRuntimeExports.jsxs("div",{className:Mt.couponApplied,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"}),s.jsxRuntimeExports.jsxs("p",{id:"md",children:[i," is applied"," ",s.jsxRuntimeExports.jsxs("span",{className:Mt.discount,children:["-",n," ",!t.isFixed&&`(${t.discount}%)`]})]}),s.jsxRuntimeExports.jsx("button",{className:Mt.removeButton,onClick:r,children:s.jsxRuntimeExports.jsx("span",{className:Mt.removeButtonText,children:"Remove"})})]}):s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInput,children:[s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"Enter a discount code",value:i||"",onChange:d=>{a(d===""?null:d)}}),s.jsxRuntimeExports.jsx(s.Button$1,{onClick:async()=>{l(!0),i&&await e(i),l(!1)},disabled:!o||!i,type:"Primary",children:"Apply"})]}),!o&&s.jsxRuntimeExports.jsx(s.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},NS=({cart:e,products:t,applyCoupon:n,applyCouponPending:r,coupon:o,totalAndDiscount:i,removeCoupon:a})=>{var x;const{priceAdjusment:u}=s.useCartStore(),[l,d]=k.useState(!1),m=k.useMemo(()=>e.parts.map(C=>{const b=t.find(S=>S.id===C.productId),R=b==null?void 0:b.variants.find(S=>S.id===C.productVariantId);return C.chargeType==="RECURRING"&&d(!0),{id:(b==null?void 0:b.id)||0,image:b==null?void 0:b.images[0],name:(R==null?void 0:R.name)||"",description:(R==null?void 0:R.description)||"",price:{quantity:C.quantity,amount:(R==null?void 0:R.price.amount)||0,currency:R==null?void 0:R.price.currency},subscriptionSettings:R==null?void 0:R.subscriptionSettings,chargeType:C.chargeType,variantsGateways:R==null?void 0:R.gateways}}),[e,t]),h=((x=m[0])==null?void 0:x.price.currency)||"USD",f=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),p=k.useMemo(()=>o&&!o.isFixed&&o.discount===100?i.total:i.totalWithDiscount?i.total-i.totalWithDiscount:0,[i,o]),g=u?(u==null?void 0:u.fixedAmount)+Math.round((i.totalWithDiscount!==void 0?i.totalWithDiscount:i.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(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:Kt.headerSection,children:[s.jsxRuntimeExports.jsx("header",{className:Kt.header,children:s.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),s.jsxRuntimeExports.jsx("div",{className:Kt.productsContainer,children:m.map(C=>s.jsxRuntimeExports.jsx(Do,{product:C},C.id))}),s.jsxRuntimeExports.jsx("div",{className:Kt.couponContainer,children:s.jsxRuntimeExports.jsx(AS,{applyCoupon:n,applyCouponPending:r,couponData:o,discount:f.format(p),removeCoupon:a,gateway:e.gateway})}),s.jsxRuntimeExports.jsx(dr,{formatter:f,coupon:o,total:i.total,discount:p,totalWithDiscount:i.totalWithDiscount,feeOrDiscount:l?null:g})]}),s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutFooter,children:s.jsxRuntimeExports.jsx(vt,{})})]})})},wS="_checkoutOperational_6gxie_1",LS="_innerContainer_6gxie_17",jS="_paymentMethodsSection_6gxie_22",vS="_socialConnectSection_6gxie_28",PS="_socialConnectLabel_6gxie_31",DS="_socialConnectContent_6gxie_35",OS="_continueButton_6gxie_39",BS="_button_6gxie_43",MS="_checkoutFooter_6gxie_47",Nt={checkoutOperational:wS,innerContainer:LS,paymentMethodsSection:jS,socialConnectSection:vS,socialConnectLabel:PS,socialConnectContent:DS,continueButton:OS,button:BS,checkoutFooter:MS},FS="_customFields_uhcib_2",HS="_checkboxWrapper_uhcib_9",US="_textareaWrapper_uhcib_16",$S="_inputWrapper_uhcib_17",zS="_requiredStar_uhcib_27",xn={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:xn.customFields,children:n})},qS=({customField:e,setCustomFields:t})=>{const n=r=>{t(o=>o.map(i=>i.name===e.name?{...i,value:r}:i))};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:o,regex:i,required:a,onValueChange:u})=>{if(k.useEffect(()=>{r===""&&n!==void 0&&u(String(n))},[]),t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return s.jsxRuntimeExports.jsxs("label",{className:xn.checkboxWrapper,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:r==="true",onChange:d=>u(d?"true":"false")}),s.jsxRuntimeExports.jsxs("p",{className:xn.checkboxLabel,children:[e,a&&s.jsxRuntimeExports.jsx("span",{className:xn.requiredStar,children:"*"})]})]});if(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return s.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(n??""),required:a});const l=d=>{(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:i?new RegExp(i):/.*/).test(d)&&u(d)};return t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?s.jsxRuntimeExports.jsx("div",{className:xn.textareaWrapper,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{label:e,value:r,placeholder:o,onChange:l,required:a})}):s.jsxRuntimeExports.jsx("div",{className:xn.inputWrapper,children:s.jsxRuntimeExports.jsx(s.Input$1,{type:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":o,label:e,value:r,required:a,onChange:l})})},GS="_connectedContainer_1rxr8_1",YS="_userInfo_1rxr8_10",XS="_avatar_1rxr8_16",QS="_avatarImage_1rxr8_26",Or={connectedContainer:GS,userInfo:YS,avatar:XS,avatarImage:QS},KS=({customerEmail:e})=>{const{discordInfo:t,setDiscordInfo:n}=s.useDiscordStore(),{notifications:r,setNotifications:o}=s.useNotificationStore(),[i,a]=k.useState(!1),[u,l]=k.useState(0),[d,m]=k.useState(null),h=20,f=x=>{var C,b,R,S;return(b=(C=x==null?void 0:x.response)==null?void 0:C.data)!=null&&b.error?x.response.data.error:(S=(R=x==null?void 0:x.response)==null?void 0:R.data)!=null&&S.message?x.response.data.message:x!=null&&x.message?x.message:"Failed to connect to Discord. Please try again later."},p=(x,C)=>{o([...r,{id:s.v4(),message:x,status:C}])};k.useEffect(()=>{if(d&&i){const x=setInterval(()=>{d.closed&&(clearInterval(x),a(!1),m(null))},1e3);return()=>clearInterval(x)}},[d,i]);const g=()=>{e.trim()!==""&&(a(!0),l(0),ul({customerEmail:e}).then(({data:x})=>{const C=window.open(x.redirectUrl);m(C),(!C||C.closed||typeof C.closed>"u")&&setTimeout(()=>{const S=document.createElement("a");S.href=x.redirectUrl,S.target="_blank",S.click()});let b;const R=()=>{if(l(S=>S+1),u>=h||C&&C.closed){u>=h&&p("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(b);return}cl({id:x.id,customerEmail:e}).then(({data:S})=>{n({authorized:!0,id:S.discordId,avatar:S.avatar,username:S.username}),C&&C.close(),a(!1),m(null),p("Discord successfully connected!","success"),clearTimeout(b)}).catch(S=>{var P;if(console.log("Waiting for authorization...",S,{newWindow:C}),C&&C.closed){a(!1),clearTimeout(b);return}if((P=S==null?void 0:S.response)!=null&&P.status&&S.response.status!==404&&S.response.status>=400){p(f(S),"error"),a(!1),clearTimeout(b);return}clearTimeout(b),b=setTimeout(R,1500)})};R()}).catch(x=>{console.log("Could not initiate Discord authorization",x),p(f(x),"error"),a(!1)}))};return t!=null&&t.authorized?s.jsxRuntimeExports.jsxs("div",{className:Or.connectedContainer,children:[s.jsxRuntimeExports.jsxs("div",{className:Or.userInfo,children:[s.jsxRuntimeExports.jsx("div",{className:Or.avatar,children:t.avatar?s.jsxRuntimeExports.jsx("img",{className:Or.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(Af,{})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,children:"Reconnect"})]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:i,children:i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"DiscordLogo"}),s.jsxRuntimeExports.jsx(s.StableText,{children:"Connect Your Discord"})]})})},ZS="_paymentMethodsContainer_a3he6_2",JS={paymentMethodsContainer:ZS},e3="_bottomSheet_1x8kc_1",t3="_content_1x8kc_8",n3="_description_1x8kc_11",r3="_title_1x8kc_15",s3="_buttonGroup_1x8kc_19",o3="_buttonWrapper_1x8kc_29",i3="_fullWidthButton_1x8kc_32",a3="_modal_1x8kc_36",u3="_header_1x8kc_43",wt={bottomSheet:e3,content:t3,description:n3,title:r3,buttonGroup:s3,buttonWrapper:o3,fullWidthButton:i3,modal:a3,header:u3},c3=({setIsOpen:e,balance:t})=>{const n=s.useNavigate(),{setIsOpen:r}=s.useModalStore(),o=()=>{n("/top-up?redirectRoute=checkout")};function i(){r(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:wt.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:wt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:wt.title,children:"Insufficient Customer Balance"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:wt.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:wt.content,children:s.jsxRuntimeExports.jsxs("p",{className:wt.description,children:["You currently have ",t&&s.formatPrice(t)," in your balance. After topping up the required amount, you can continue to checkout."]})}),s.jsxRuntimeExports.jsxs("div",{className:wt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:wt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:wt.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:o,children:"Add Balance"})})]})]})]})},Ec=({align:e,gateway:t,gatewayDisplayName:n,selected:r,onSelect:o,total:i,onSignInClick:a,reversed:u})=>{const{token:l}=s.useStorefrontStore(),{balance:d}=s.useCustomerDashboardStore(),[m,h]=k.useState(!1),{setIsOpen:f}=s.useModalStore(),p=g=>{g.stopPropagation(),o&&o(t),d&&d.amount<i&&(h(!0),f(!0))};return k.useEffect(()=>{},[d,i]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(s.styles$3.paymentMethod,{[s.styles$3.selected]:r,[s.styles$3.alignColumn]:e==="column",[s.styles$3.reversed]:u}),onClick: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:["(",l?d&&s.formatPrice(d):s.jsxRuntimeExports.jsx("a",{className:s.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),s.jsxRuntimeExports.jsx("div",{className:s.styles$3.iconContainer,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}),m&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>h(!1),children:s.jsxRuntimeExports.jsx(c3,{setIsOpen:h,balance:d})})]})},bc=({possibleGateways:e,setGateway:t,totalAndDiscount:n,onSignInClick:r,setPaymentMethod:o})=>{const[i,a]=k.useState(),[u,l]=k.useState(),{setPriceAdjustment:d}=s.useCartStore(),[m,h]=k.useState(null),f=(p,g)=>{var x;u!==g&&(t(g),d(((x=m==null?void 0:m.find(C=>C.name===g))==null?void 0:x.priceAdjustment)||null)),o(p),a(p),l(g)};return k.useEffect(()=>{const p=async()=>{const{data:g}=await s.fetchGatewaysDetail([...e.availableGateways,...e.requiresSignInGateways]);h(g)};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(Ec,{gateway:p.name,gatewayDisplayName:p.displayName,onSelect:g=>{l(g),u!==g&&t(g)},selected:p.name===u,total:n.total,onSignInClick:r,reversed:!0},p.name):p.paymentMethods.map(g=>s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{paymentMethod:g,gateway:p.name,gatewayDisplayName:p.displayName,gatewayLogoCfId:p.logoCfImageId,poweredByLogoCfId:p.poweredByImageCfImageId,onSelect:x=>f(x,p.name),selected:i===g&&u===p.name},`${p.name}-${g}`)))}),!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%"})})]})},l3="_modal_14r0b_1",d3={modal:l3},h3=({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:d3.modal,onClick:o=>o.stopPropagation(),children:s.jsxRuntimeExports.jsx(s.Auth,{inModal:!0})})},m3=({getPossibleGateways:e,setGateway:t,getDiscordSettings:n,cart:r,products:o,submitCart:i,reset:a,setCustomFieldsToCart:u,totalAndDiscount:l,setDiscordSocialConnectId:d,setPaymentMethod:m})=>{const h=k.useMemo(()=>n(),[]),[f,p]=k.useState([]),{balance:g,setBalance:x}=s.useCustomerDashboardStore(),{token:C}=s.useStorefrontStore(),{executeRecaptcha:b}=s.useReCaptcha(),{discordInfo:R}=s.useDiscordStore(),{customerEmail:S,setCustomerEmail:P}=s.useCartStore(),L=R!=null&&R.authorized?R.id:void 0,A=s.useNavigate(),q=k.useMemo(()=>e(),[r.parts]),[V,K]=k.useState(!1),{setIsOpen:w}=s.useModalStore(),{notifications:$,setNotifications:B}=s.useNotificationStore();k.useEffect(()=>{const Y=s.getCommonCustomFields(r.parts,o).map(W=>W.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...W,value:String(W.defaultValue)}:W);p([...Y])},[]),k.useEffect(()=>{const X=s.getCommonCustomFields(r.parts,o);p(Y=>{const W=new Map(Y.map(Q=>[Q.name,Q]));return X.map(Q=>{const _=W.get(Q.name);return _&&_.value?{...Q,value:_.value}:Q.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...Q,value:String(Q.defaultValue)}:Q})})},[r.parts,o]),k.useEffect(()=>{C&&(async()=>{const Y=await s.getBalance();x(Y)})()},[C]);function H(X){return X&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(X)}const G=()=>{const X=[];return f.forEach(Y=>{var W;Y.required&&!((W=Y.value)!=null&&W.toString().trim())&&X.push({message:`Field "${Y.name}" is required.`,status:"error",id:s.v4()})}),X.length>0?(B([...$,...X]),!1):!0},z=async X=>{if(X.stopPropagation(),r.gateway==="Balance"&&!C){w(!0),K(!0);return}if(!G())return;const Y=Object.fromEntries(f.map(Q=>[Q.name,Q.value||""]));u({...Y}),L&&h.isEnabled&&d(L);const W=await b();if(W){const Q=await i(W),_=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(_).length>10){const Ee=Date.now()-864e5;Object.keys(_).forEach(Re=>{_[Re].createdAt<=Ee&&delete _[Re]})}"order"in Q?_[Q.order.id]={createdAt:Date.now(),fullAccessToken:Q.order.fullAccessToken}:_[Q.id]={createdAt:Date.now(),fullAccessToken:Q.fullAccessToken},localStorage.setItem("orders",JSON.stringify(_)),A(`/orders/${"order"in Q?Q.order.id:Q.id}/${"order"in Q?Q.order.fullAccessToken:Q.fullAccessToken}`),setTimeout(()=>a(),0)}};return s.jsxRuntimeExports.jsxs("div",{className:Nt.checkoutOperational,children:[s.jsxRuntimeExports.jsxs("div",{className:Nt.innerContainer,children:[r.parts.length>0&&s.jsxRuntimeExports.jsx(bc,{possibleGateways:q,setGateway:t,setPaymentMethod:m,balance:g,totalAndDiscount:l,onSignInClick:()=>{K(!0),w(!0)}}),s.jsxRuntimeExports.jsx("div",{className:Nt.paymentMethodsSection,children:s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"mail@mail.com",value:S||"",onChange:X=>P(X),disabled:!!C,label:"Email Address"})}),s.jsxRuntimeExports.jsx(WS,{customFields:f,setCustomFields:p}),h.isEnabled&&s.jsxRuntimeExports.jsxs("div",{className:Nt.socialConnectSection,children:[s.jsxRuntimeExports.jsx("p",{className:Nt.socialConnectLabel,id:"md",children:"Social Connect"}),s.jsxRuntimeExports.jsx("div",{className:Nt.socialConnectContent,children:s.jsxRuntimeExports.jsx(KS,{customerEmail:S||""})})]}),s.jsxRuntimeExports.jsxs("div",{className:Nt.continueButton,children:[s.jsxRuntimeExports.jsx(s.Button$1,{onClick:z,disabled:!r.gateway||!H(S||"")||h.isRequired&&!(R!=null&&R.authorized),className:Nt.button,children:"Continue to Checkout"}),s.jsxRuntimeExports.jsx(s.TermsOfService,{}),s.jsxRuntimeExports.jsx(s.SecuredBySsl,{})]}),s.jsxRuntimeExports.jsx(vt,{className:Nt.checkoutFooter})]}),V&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>K(!1),children:s.jsxRuntimeExports.jsx(h3,{setIsOpen:K})})]})},p3="_mt1_1t7v2_1",f3="_notifyBlock_1t7v2_13",g3="_notifyHeader_1t7v2_19",x3="_notifyContent_1t7v2_25",E3="_buttonBlock_1t7v2_30",b3="_imageBlock_1t7v2_34",I3="_imageContainer_1t7v2_42",T3="_sectionBlock_1t7v2_54",_3="_sectionTitle_1t7v2_61",C3="_sectionSubtitle_1t7v2_64",S3="_inputContainer_1t7v2_69",pt={mt1:p3,notifyBlock:f3,notifyHeader:g3,notifyContent:x3,buttonBlock:E3,imageBlock:b3,imageContainer:I3,sectionBlock:T3,sectionTitle:_3,sectionSubtitle:C3,inputContainer:S3},y3=({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"})})]})})},k3=({props:e})=>s.jsxRuntimeExports.jsx(s.Button$1,{className:pt.buttonBlock,onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),R3=({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:""})})}),A3=({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})]}),N3=({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(Ic,{block:n},r))]})},Ic=({block:e})=>{switch(e.type){case"Section":return s.jsxRuntimeExports.jsx(N3,{...e});case"ReadOnlyTextInput":return s.jsxRuntimeExports.jsx(y3,{...e});case"Notify":return s.jsxRuntimeExports.jsx(A3,{...e});case"Button":return s.jsxRuntimeExports.jsx(k3,{...e});case"Image":return s.jsxRuntimeExports.jsx(R3,{...e});default:return null}},w3="_bottomSheet_1x4sq_1",L3="_content_1x4sq_8",j3="_agreementList_1x4sq_11",v3="_agreementItem_1x4sq_16",P3="_warning_1x4sq_23",D3="_buttonGroup_1x4sq_31",O3="_buttonWrapper_1x4sq_41",B3="_fullWidthButton_1x4sq_44",M3="_modal_1x4sq_48",F3="_header_1x4sq_55",Je={bottomSheet:w3,content:L3,agreementList:j3,agreementItem:v3,warning:P3,buttonGroup:D3,buttonWrapper:O3,fullWidthButton:B3,modal:M3,header:F3},H3=({setIsOpen:e,price:t})=>{const[n,r]=k.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Je.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.content,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.agreementList,children:[s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSendAsFF,onChange:a=>r({...n,agreeToSendAsFF:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSend,onChange:a=>r({...n,agreeToSend:a})}),s.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",s.formatPrice(t)," ",t.currency]})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToNotAddNote,onChange:a=>r({...n,agreeToNotAddNote:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),s.jsxRuntimeExports.jsx("div",{className:Je.warning,children:s.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",s.formatPrice(t)," ",t.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",children:s.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),s.jsxRuntimeExports.jsx("div",{className:Je.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:i,children:"Continue to Payment"})})]})]})]})},U3="_chargeItemsContainer_qmv3w_4",$3="_chargeItemsInner_qmv3w_20",z3="_productsContainer_qmv3w_27",W3="_chargeHeader_qmv3w_41",q3="_chargeTitle_qmv3w_49",V3="_chargeDescription_qmv3w_55",G3="_copyButton_qmv3w_61",Y3="_productsList_qmv3w_73",X3="_trackingContainer_qmv3w_81",Q3="_footerContainer_qmv3w_91",Et={chargeItemsContainer:U3,chargeItemsInner:$3,productsContainer:z3,chargeHeader:W3,chargeTitle:q3,chargeDescription:V3,copyButton:G3,productsList:Y3,trackingContainer:X3,footerContainer:Q3},K3=({charge:e})=>{var i;const t=s.useCopy(),n=(e==null?void 0:e.price.currency)||"USD",r=new Intl.NumberFormat("en-US",{style:"currency",currency:n}),o=k.useMemo(()=>{var a;return((a=e==null?void 0:e.order)==null?void 0:a.partOrders.map(u=>{var l,d,m,h,f,p;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:((l=u.productWithVariant)==null?void 0:l.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(lr,{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})]}),((i=e.order)==null?void 0:i.id)&&s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",className:Et.copyButton,onClick:()=>{var a;return t(((a=e.order)==null?void 0:a.id)||"")},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),"Copy Order ID"]})]}),s.jsxRuntimeExports.jsxs("div",{style:{flex:1},children:[!!o.length&&s.jsxRuntimeExports.jsx("div",{className:Et.productsList,children:o.map(a=>s.jsxRuntimeExports.jsx(Do,{product:a},a.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})]})]})]})})},Z3="_checkoutOrderMainData_hqf60_1",J3="_orderDetailRow_hqf60_6",ey="_chargeIdRow_hqf60_16",ty="_detailLabel_hqf60_25",ny="_detailValue_hqf60_29",ry="_chargeIdContainer_hqf60_33",sy="_chargeId_hqf60_16",oy="_copyIcon_hqf60_51",Ue={checkoutOrderMainData:Z3,orderDetailRow:J3,chargeIdRow:ey,detailLabel:ty,detailValue:ny,chargeIdContainer:ry,chargeId:sy,copyIcon:oy},Tc=({lastUpdate:e,invoiceId:t,email:n,paymentType:r})=>{const o=s.useCopy(),[i,a]=k.useState(null),u=i==null?void 0:i.find(d=>d.name===r);k.useEffect(()=>{i||(async()=>{const m=[r],h=await s.getGatewaysDetail(m);a(h)})()},[r,i]);const l=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(),g=d.getHours(),x=d.getMinutes().toString().padStart(2,"0"),C=d.getSeconds().toString().padStart(2,"0"),b=g>=12?"PM":"AM",R=(g%12||12).toString().padStart(2,"0");return`${f} ${h}, ${p} at ${R}:${x}:${C} ${b}`};return s.jsxRuntimeExports.jsxs("div",{className:Ue.checkoutOrderMainData,children:[s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Last Updated"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:l(new Date(e))})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Payment Type"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Email"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:n})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Charge ID"}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdContainer,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.chargeId,id:"md",children:t}),s.jsxRuntimeExports.jsx("div",{className:Ue.copyIcon,onClick:()=>o(t),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})]})]})},iy="_bottomSheet_1yai1_1",ay="_formContainer_1yai1_8",uy="_error_1yai1_14",cy="_buttonGroup_1yai1_18",ly="_buttonWrapper_1yai1_28",dy="_fullWidthButton_1yai1_31",hy="_modal_1yai1_41",my="_header_1yai1_48",Ft={bottomSheet:iy,formContainer:ay,error:uy,buttonGroup:cy,buttonWrapper:ly,fullWidthButton:dy,modal:hy,header:my},py=({chargeId:e,setIsOpen:t})=>{const[n,r]=k.useState(""),[o,i]=k.useState(""),{setIsOpen:a}=s.useModalStore(),u=m=>{try{return new URL(m),!0}catch{return!1}},l=async m=>{if(m.preventDefault(),!n){i("The link field cannot be empty.");return}if(!u(n)){i("Please enter a valid URL");return}await nl({url:n},e)&&(alert("CashApp successfully verified"),t(!1))},d=()=>{a(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ft.modal,onClick: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:l,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),i("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),o&&s.jsxRuntimeExports.jsx("p",{className:Ft.error,children:o})]})}),s.jsxRuntimeExports.jsxs("div",{className:Ft.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:d,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ft.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},fy="_container_1opbn_1",gy="_productDetails_1opbn_8",xy="_imageContainer_1opbn_14",Ey="_image_1opbn_14",by="_textContainer_1opbn_32",Iy="_header_1opbn_40",Ty="_title_1opbn_46",_y="_price_1opbn_53",Cy="_badgeContainer_1opbn_57",Sy="_description_1opbn_61",bt={container:fy,productDetails:gy,imageContainer:xy,image:Ey,textContainer:by,header:Iy,title:Ty,price:_y,badgeContainer:Cy,description:Sy},yy=({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})]}),ky="_card_69liy_1",Ry="_price_69liy_10",Ay="_interval_69liy_17",Ny="_name_69liy_22",wy="_description_69liy_28",Ly="_currentPlan_69liy_32",jy="_selectButton_69liy_45",vy="_progressSection_69liy_50",Py="_progressLabel_69liy_54",Dy="_bottomSheet_69liy_60",Oy="_title_69liy_69",By="_typeSelector_69liy_80",My="_typeOption_69liy_90",Fy="_active_69liy_100",Hy="_saveTag_69liy_108",Uy="_planSelector_69liy_117",$y="_modal_69liy_127",zy="_inactive_69liy_148",Wy="_notMounted_69liy_151",qy="_closeButton_69liy_157",Se={card:ky,price:Ry,interval:Ay,name:Ny,description:wy,currentPlan:Ly,selectButton:jy,progressSection:vy,progressLabel:Py,bottomSheet:Dy,title:Oy,typeSelector:By,typeOption:My,active:Fy,saveTag:Hy,planSelector:Uy,modal:$y,inactive:zy,notMounted:Wy,closeButton:qy},Vy=({variant:e,onSelect:t,isCurrent:n})=>{const r=e.subscriptionSettings.recurringIntervalDays===30?"month":e.subscriptionSettings.recurringIntervalDays===365?"year":"period",o=e.subscriptionSettings.price.amount.toFixed(2),i=e.subscriptionSettings.recurringIntervalDays,a=10;return s.jsxRuntimeExports.jsxs("div",{className:Se.card,onClick:t,children:[s.jsxRuntimeExports.jsxs("h2",{className:Se.price,children:["$",o," ",s.jsxRuntimeExports.jsxs("span",{className:Se.interval,children:["/ ",r]})]}),s.jsxRuntimeExports.jsx("h3",{className:Se.name,children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:Se.description,children:e.description}),n?s.jsxRuntimeExports.jsxs("div",{className:Se.currentPlan,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check"}),"Your current Plan"]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",className:Se.selectButton,children:"Select"}),n&&s.jsxRuntimeExports.jsxs("div",{className:Se.progressSection,children:[s.jsxRuntimeExports.jsx(xa,{percent:a/i*100,disablePercentLabel:!0}),s.jsxRuntimeExports.jsxs("p",{className:Se.progressLabel,children:["Used: ",a," of ",i," days"]})]})]})},Gy=({isOpen:e,setIsOpen:t,subscription:n})=>{const[r,o]=k.useState(null),[i,a]=k.useState(null),[u,l]=k.useState(null),{id:d,accessToken:m}=s.useParams(),[h,f]=k.useState(!1),[p,g]=k.useState(!1),{setIsOpen:x}=s.useModalStore();k.useEffect(()=>{e&&f(!0)},[e]);const C=()=>{t(!1)},[b,R]=k.useState(null);k.useEffect(()=>{d&&m&&(async()=>{if(d&&m){const{data:A}=await s.getSubscriptionUpgradePlans({id:d,accessToken:m});R(A)}})()},[d,m]),k.useEffect(()=>{var L;if(b!=null&&b.data.types[0]){const A=(L=b.data.types.flatMap(q=>q.productVariants).find(q=>q.data.id===(n==null?void 0:n.variantId)))==null?void 0:L.data;A&&(l(A),a(A))}},[b,n]),k.useEffect(()=>{b!=null&&b.data.types[0]&&o(b==null?void 0:b.data.types[0])},[b==null?void 0:b.data.types]);const S=L=>{o(L),a(null)},P=L=>{a(L),x(!0),g(!0)};return s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.modal,{[Se.active]:e,[Se.inactive]:!e&&h,[Se.notMounted]:!h}),onClick:L=>L.stopPropagation(),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:C,hoverable:!0,className:Se.closeButton,fill:"var(--text-primary)"}),s.jsxRuntimeExports.jsxs("div",{className:Se.bottomSheet,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Se.title,children:"Change Plan"}),s.jsxRuntimeExports.jsx("p",{className:Se.description,children:b==null?void 0:b.data.description}),s.jsxRuntimeExports.jsx("div",{className:Se.typeSelector,children:b==null?void 0:b.data.types.map(L=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.typeOption,{[Se.active]:(r==null?void 0:r.id)===L.id}),onClick:()=>S(L),children:[L.name,L.name==="Yearly"&&s.jsxRuntimeExports.jsx("span",{className:Se.saveTag,children:"Save %"})]},L.id))}),r&&s.jsxRuntimeExports.jsx("div",{className:Se.planSelector,children:r.productVariants.map(L=>s.jsxRuntimeExports.jsx(Vy,{variant:L.data,isSelected:(i==null?void 0:i.id)===L.data.id,isCurrent:(u==null?void 0:u.id)===L.data.id,onSelect:()=>P(L.data)},L.data.id))})]}),p&&i&&n&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>{g(!1)},children:s.jsxRuntimeExports.jsx(Bk,{setIsOpen:g,selectedVariant:i,subscription:n})})]})},Yy="_container_nb625_1",Xy="_title_nb625_11",Qy="_subtitle_nb625_16",Ky="_info_nb625_20",Br={container:Yy,title:Xy,subtitle:Qy,info:Ky},Zy=()=>{const{subscription:e}=s.useSubscriptionStore(),[t,n]=s.extractDateAndTime((e==null?void 0:e.activeTo)||""),[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Br.container,children:[s.jsxRuntimeExports.jsxs("div",{className:Br.info,children:[s.jsxRuntimeExports.jsx("p",{className:Br.title,children:"Expiration Date"}),s.jsxRuntimeExports.jsxs("p",{className:Br.subtitle,children:[t," at ",n]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:a=>{a.stopPropagation(),i(!0),o(!0)},children:"Extend"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(tR,{setIsOpen:o})})]})},Jy="_couponContainer_1sspa_1",ek="_iconWrapper_1sspa_10",tk="_details_1sspa_21",nk="_title_1sspa_25",rk="_progress_1sspa_29",sk="_foreverText_1sspa_34",fn={couponContainer:Jy,iconWrapper:ek,details:tk,title:nk,progress:rk,foreverText:sk},ok=({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(xa,{color:"#C2C2C2",percent:r,disablePercentLabel:!0})}),s.jsxRuntimeExports.jsx("p",{className:fn.foreverText,children:"Forever discount code"})]})]})},ik="_paymentMethodContainer_1g0da_4",ak="_paymentMethodTitle_1g0da_15",uk="_activeMethod_1g0da_20",ck="_noMethod_1g0da_28",lk="_activeMethodPaymentMethod_1g0da_37",dk="_paymentMethodLogo_1g0da_47",hk="_paymentMethodNumber_1g0da_57",mk="_method_1g0da_61",Wt={paymentMethodContainer:ik,paymentMethodTitle:ak,activeMethod:uk,noMethod:ck,activeMethodPaymentMethod:lk,paymentMethodLogo:dk,paymentMethodNumber:hk,method:mk},pk="_paymentMethods_1gev0_1",fk="_modal_1gev0_14",gk="_header_1gev0_28",xk="_content_1gev0_37",Jt={paymentMethods:pk,modal:fk,header:gk,content:xk},Ek=e=>{const{setIsLoading:t,setIsOpen:n}=e,{subscription:r,setSubscription:o}=s.useSubscriptionStore();if(!r)return null;const{id:i}=s.useParams(),a=s.useNavigate(),{notifications:u,setNotifications:l}=s.useNotificationStore(),{setPaymentMethod:d,setGateway:m,cart:h}=s.useCart(),{setIsOpen:f}=s.useModalStore();async function p(){if(g(),t(!0),i&&r){const{data:x}=await s.changeSubscriptionGateway(i,h.gateway);x.isReconnectPaymentNeeded?a(`/charges/${x.chargeId}`):(l([...u,{status:"success",id:s.v4(),message:"Your action has been successfully completed"}]),o({...r,gatewayName:h.gateway}))}else l([...u,{status:"error",id:s.v4(),message:"Your action has been failed. Try again!"}]);t(!1)}function g(){f(!1),setTimeout(()=>{n(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:Jt.modal,onClick:x=>{x.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:g,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Jt.content,children:[(r==null?void 0:r.availableGateways)&&s.jsxRuntimeExports.jsx(bc,{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:()=>a("/customer-dash")}),s.jsxRuntimeExports.jsxs("div",{className:Jt.paymentMethods,children:[s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,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"})})]})]})]})},bk="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",Ik=()=>{var g,x,C;const{subscription:e}=s.useSubscriptionStore(),{cart:t,setPaymentMethod:n}=s.useCart(),r=s.useNavigate(),[o,i]=k.useState(null),[a,u]=k.useState(!1),[l,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 R=await s.getGatewaysDetail(e.availableGateways);i(R)})()},[]),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(Tk,{gatewayInfo:e.gatewayInfo}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h==="Balance"&&s.jsxRuntimeExports.jsx(Ec,{gateway:h,gatewayDisplayName:h,total:(e==null?void 0:e.price.amount)||0,onSignInClick:()=>r("/customer-dash")}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&!h&&s.jsxRuntimeExports.jsx("span",{className:Wt.noMethod,children:"Payment method is not set"}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h&&s.jsxRuntimeExports.jsx("div",{className:Wt.activeMethod,children:o&&s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(g=o.find(b=>b.name===h))==null?void 0:g.logoCfImageId,gatewayDisplayName:(x=o.find(b=>b.name===h))==null?void 0:x.displayName,gateway:h,poweredByLogoCfId:(C=o.find(b=>b.name===h))==null?void 0:C.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"})]}),l&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>d(!1),children:s.jsxRuntimeExports.jsx(Ek,{setIsLoading:u,setIsOpen:d})})]})},Tk=({gatewayInfo:e})=>{var t,n,r,o,i;return s.jsxRuntimeExports.jsxs("div",{className:Wt.method,children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodLogo,children:[((t=e.card)==null?void 0:t.brand.toLowerCase())==="visa"&&s.jsxRuntimeExports.jsx(s.Visa,{}),((n=e.card)==null?void 0:n.brand.toLowerCase())==="mastercard"&&s.jsxRuntimeExports.jsx("img",{src:bk,alt:"",width:22}),((r=e.card)==null?void 0:r.brand.toLowerCase())!=="visa"&&((o=e.card)==null?void 0:o.brand.toLowerCase())!=="mastercard"&&s.jsxRuntimeExports.jsx(s.Icon,{name:"CreditCard",width:22})]}),s.jsxRuntimeExports.jsxs("p",{className:Wt.paymentMethodNumber,children:["•••• •••• •••• ",(i=e.card)==null?void 0:i.last4]})]})},_k="_subscriptionProductContainer_83ibx_4",Ck="_subscriptionProductImage_83ibx_15",Sk="_subscriptionProductInfo_83ibx_32",yk="_name_83ibx_37",kk="_price_83ibx_40",Vn={subscriptionProductContainer:_k,subscriptionProductImage:Ck,subscriptionProductInfo:Sk,name:yk,price:kk},Rk=({subscription:e,id:t,accessToken:n})=>{const[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Vn.subscriptionProductContainer,onClick:a=>a.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:a=>{a.preventDefault(),o(!0),i(!0)},children:"Cancel"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(pR,{accessToken:n,id:t,isOpen:r,setIsOpen:o})})]})},Ak="_content_5ctxw_1",Nk="_selectedPlan_5ctxw_37",wk="_planName_5ctxw_44",Lk="_description_5ctxw_48",jk="_price_5ctxw_51",vk="_buttonGroup_5ctxw_79",Pk="_buttonWrapper_5ctxw_84",Dk="_modal_5ctxw_88",Ok="_header_5ctxw_95",ct={content:Ak,selectedPlan:Nk,planName:wk,description:Lk,price:jk,buttonGroup:vk,buttonWrapper:Pk,modal:Dk,header:Ok},Bk=({setIsOpen:e,selectedVariant:t,subscription:n})=>{if(!t)return null;const{setIsOpen:r}=s.useModalStore(),o=()=>{i()},i=()=>{r(!1),setTimeout(()=>{e(!1)},300)},a=(t.subscriptionSettings.compareAtPrice||t.subscriptionSettings.price).amount,u=t.subscriptionSettings.compareAtPrice?t.subscriptionSettings.compareAtPrice.amount-t.subscriptionSettings.price.amount:t.subscriptionSettings.price.amount,l=a-u,d=new Intl.NumberFormat("en-US",{style:"currency",currency:n.price.currency});return s.jsxRuntimeExports.jsxs("div",{className:ct.modal,children:[s.jsxRuntimeExports.jsxs("div",{className:ct.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:()=>i(),fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:ct.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:ct.content,children:[s.jsxRuntimeExports.jsxs("div",{className:ct.selectedPlan,children:[s.jsxRuntimeExports.jsx("h2",{className:ct.planName,children:t.name}),s.jsxRuntimeExports.jsx("p",{className:ct.description,children:t.description}),s.jsxRuntimeExports.jsxs("p",{className:ct.price,children:["$",t.subscriptionSettings.price.amount.toFixed(2)," /"," ",t.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),s.jsxRuntimeExports.jsx(dr,{formatter:d,coupon:null,total:l,discount:u})]}),s.jsxRuntimeExports.jsxs("div",{className:ct.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:ct.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>i(),children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:ct.buttonWrapper,children:s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Primary",onClick:o,children:["Upgrade for $",l.toFixed(2)]})})]})]})]})},Mk="_reviewMessage_1t8u4_1",Fk="_leaveReviewContainer_1t8u4_11",Hk="_leaveReviewTitle_1t8u4_20",zs={reviewMessage:Mk,leaveReviewContainer:Fk,leaveReviewTitle:Hk},Uk=({review:e,orderId:t,className:n})=>{const[r,o]=k.useState((e==null?void 0:e.rating)||0),[i,a]=k.useState(!1),{setIsOpen:u}=s.useModalStore(),{notifications:l,setNotifications:d}=s.useNotificationStore(),m=async h=>{e&&"accessToken"in e&&(await il({comment:h,rating:r},t,e.accessToken),d([...l,{status:"success",id:s.v4(),message:"Review left successfully"}]),a(!1))};return k.useEffect(()=>{e&&r&&"accessToken"in e&&!e.rating&&(u(!0),a(!0))},[r]),e?e.rating&&"accessToken"in e?s.jsxRuntimeExports.jsxs("div",{className: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:o,disabled:!!e.rating||!("accessToken"in e)}),i&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>a(!1),children:s.jsxRuntimeExports.jsx(Xk,{setIsOpen:a,onSubmit:m})})]}):null},$k="_bottomSheet_1bcyj_1",zk="_content_1bcyj_7",Wk="_title_1bcyj_18",qk="_buttonGroup_1bcyj_22",Vk="_buttonWrapper_1bcyj_33",Gk="_modal_1bcyj_37",Yk="_header_1bcyj_44",Ht={bottomSheet:$k,content:zk,title:Wk,buttonGroup:qk,buttonWrapper:Vk,modal:Gk,header:Yk},Xk=({setIsOpen:e,onSubmit:t})=>{const[n,r]=k.useState(""),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ht.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ht.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ht.title,children:"Review Description"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Ht.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.content,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{placeholder:"Great product and fast checkout...",value:n,onChange:a=>r(a),label:"Describe your review in detail below"})}),s.jsxRuntimeExports.jsxs("div",{className:Ht.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!n,onClick:()=>{i(),t(n)},children:"Submit"})})]})]})]})},Qk="_container_1idhv_1",Kk="_buttonGroup_1idhv_8",Zk="_buttonWrapper_1idhv_15",Jk="_header_1idhv_19",eR="_content_1idhv_28",en={container:Qk,buttonGroup:Kk,buttonWrapper:Zk,header:Jk,content:eR},tR=({setIsOpen:e})=>{const{subscription:t}=s.useSubscriptionStore(),{getTotalAndDiscount:n,cart:r,coupon:o}=s.useCart(),[i,a]=k.useState(1),u=s.useNavigate(),{setIsOpen:l}=s.useModalStore(),{setNotifications:d,notifications:m}=s.useNotificationStore(),[h,f]=k.useState(!1),p=k.useMemo(()=>n(),[o,r]),g=k.useMemo(()=>p.totalWithDiscount?p.total-p.totalWithDiscount:0,[p]);if(h)return s.jsxRuntimeExports.jsx(s.ProcessingPaymentModal,{});const x=(t==null?void 0:t.price.currency)||"USD",C=new Intl.NumberFormat("en-US",{style:"currency",currency:x});async function b(){var S;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/${(S=P.data)==null?void 0:S.id}/${P.data.fullAccessToken}`)}catch(P){const L=P;d([...m,{id:s.v4(),message:`Order creation failed: ${L.message}`,status:"error"}]),R()}finally{f(!1)}}function R(){l(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:en.container,onClick:S=>S.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:R,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:en.content,children:[s.jsxRuntimeExports.jsx(Zf,{step:i,totalSteps:12,onStepChange:a,label:"How long would you like to extend your subscription for?"}),s.jsxRuntimeExports.jsx(dr,{formatter:C,coupon:o,total:p.total,discount:g,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:R,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:b,children:"Extend"})})]})]})]})},nR="_bottomSheet_uw5jb_1",rR="_content_uw5jb_7",sR="_radioGroup_uw5jb_11",oR="_confirmation_uw5jb_26",iR="_iconWrapper_uw5jb_33",aR="_title_uw5jb_42",uR="_message_uw5jb_48",cR="_buttonGroup_uw5jb_54",lR="_buttonWrapper_uw5jb_64",dR="_modal_uw5jb_68",hR="_header_uw5jb_77",je={bottomSheet:nR,content:rR,radioGroup:sR,confirmation:oR,iconWrapper:iR,title:aR,message:uR,buttonGroup:cR,buttonWrapper:lR,modal:dR,header:hR},mR={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},pR=({isOpen:e,setIsOpen:t,id:n,accessToken:r})=>{const[o,i]=k.useState(0),[a,u]=k.useState(!1),[l,d]=k.useState(""),[m,h]=k.useState(""),{setIsOpen:f}=s.useModalStore(),p=async()=>{if(!l)return;u(!0);const x=await s.cancelSubscription(n,r,{reason:l==="Other reason"?m:l});u(!1),x&&i(2)};k.useEffect(()=>{e||(i(0),d(""),h(""))},[e]);const g=()=>{f(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:je.modal,onClick:x=>x.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:mR[o]||""}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:g,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:je.content,children:[o===0&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),s.jsxRuntimeExports.jsxs("div",{className:je.radioGroup,children:[s.jsxRuntimeExports.jsx(s.Radio,{defaultValue:l,onChange:x=>d(x),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"}),l==="Other reason"&&s.jsxRuntimeExports.jsx(s.Textarea$1,{value:m,onChange:x=>h(x),placeholder:"Describe the reason..."})]}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:()=>l&&i(1),disabled:!l,children:"Continue"})})]})]}),o===1&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:p,disabled:a,children:"Cancel it anyway"})})]})]}),o===2&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:`${je.confirmation}`,children:[s.jsxRuntimeExports.jsx("div",{className:je.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"})}),s.jsxRuntimeExports.jsx("p",{className:je.title,children:"Subscription Cancelled"}),s.jsxRuntimeExports.jsx("p",{className:je.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),s.jsxRuntimeExports.jsx("div",{className:je.buttonGroup,children:s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,children:"Close"})})})]})]})]})},fR="_checkoutContainer_wkomn_1",gR="_loaderContainer_wkomn_20",Ws={checkoutContainer:fR,loaderContainer:gR},xR=()=>{const{cart:e,products:t,pending:n,getTotalAndDiscount:r,getPossibleGateways:o,submitCart:i,setGateway:a,applyCoupon:u,setDiscordSocialConnectId:l,setCustomFields:d,applyCouponPending:m,coupon:h,removeCoupon:f,getDiscordSettings:p,setPaymentMethod:g,reset:x}=s.useCart(),C=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(NS,{cart:e,products:t,applyCoupon:u,applyCouponPending:m,coupon:h,removeCoupon:f,totalAndDiscount:C}),s.jsxRuntimeExports.jsx(m3,{cart:e,getPossibleGateways:o,setGateway:a,getDiscordSettings:p,products:t,submitCart:i,totalAndDiscount:C,setCustomFieldsToCart:d,setDiscordSocialConnectId:l,setPaymentMethod:g,reset:x})]})},ER="_chargePageContainer_1a200_1",bR="_chargeItems_1a200_14",IR="_mainContent_1a200_25",TR="_contentWrapper_1a200_36",_R="_statusBlock_1a200_41",CR="_notPaidSection_1a200_45",SR="_footer_1a200_53",yR="_loaderContainer_1a200_63",Ut={chargePageContainer:ER,chargeItems:bR,mainContent:IR,contentWrapper:TR,statusBlock:_R,notPaidSection:CR,footer:SR,loaderContainer:yR},kR=()=>{const{id:e}=s.useParams(),[t,n]=s.useSearchParams(),[r,o]=k.useState(!1),[i,a]=k.useState(),[u,l]=k.useState(!0),d=s.useNavigate(),m=k.useRef(),{setIsOpen:h}=s.useModalStore();return k.useEffect(()=>{const f=async(g,x=!1)=>{x||o(!0);const{data:C}=await al(g);o(!1),a(C)},p=setInterval(()=>{e&&f(e,!0)},5e3);return e&&f(e),()=>{clearInterval(p)}},[]),k.useEffect(()=>{const f=setTimeout(()=>{console.log("charge timeout",i);const p=t.get("redirectRoute");(i==null?void 0:i.status)===s.ChargeStatus.Paid&&i.redirectUrl&&!m.current&&window.open(i.redirectUrl,"_self"),(i==null?void 0:i.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)},[i]),k.useEffect(()=>{((i==null?void 0:i.gateway)==="PayPalFF"||(i==null?void 0:i.gateway)==="Сashapp")&&h(!0)},[i]),r?s.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:Ut.chargePageContainer,children:[s.jsxRuntimeExports.jsx("div",{className:Ut.chargeItems,children:s.jsxRuntimeExports.jsx(K3,{charge:i})}),s.jsxRuntimeExports.jsx("div",{className:Ut.mainContent,children:s.jsxRuntimeExports.jsxs("div",{className:Ut.contentWrapper,children:[i&&(i==null?void 0:i.status)!==s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx(s.ChargeStatusBlock,{charge:i}),i&&s.jsxRuntimeExports.jsx("div",{className:`${Ut.statusBlock}`,children:s.jsxRuntimeExports.jsx(Tc,{lastUpdate:i.expiresAt,email:i.customerForCharge.email,invoiceId:i.id,paymentType:i.gateway})}),(i==null?void 0:i.status)===s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx("div",{className:Ut.notPaidSection,children:i==null?void 0:i.displayPaymentInfo.map((f,p)=>s.jsxRuntimeExports.jsx(Ic,{block:f},p))}),s.jsxRuntimeExports.jsx(vt,{className:Ut.footer})]})}),(i==null?void 0:i.gateway)==="PayPalFF"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>l(!1),children:s.jsxRuntimeExports.jsx(H3,{price:i.price,setIsOpen:l})}),(i==null?void 0:i.gateway)==="Сashapp"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(py,{setIsOpen:l,chargeId:i.id})})]})},RR="_wrapper_1fax2_1",AR="_title_1fax2_20",NR="_container_1fax2_26",wR="_content_1fax2_36",LR="_messages_1fax2_46",jR="_input_1fax2_58",vR="_textarea_1fax2_64",PR="_message_1fax2_46",DR="_messageDate_1fax2_88",OR="_myMessage_1fax2_94",BR="_otherMessage_1fax2_101",MR="_button_1fax2_108",FR="_loadingMessage_1fax2_117",$e={wrapper:RR,title:AR,container:NR,content:wR,messages:LR,input:jR,textarea:vR,message:PR,messageDate:DR,myMessage:OR,otherMessage:BR,button:MR,loadingMessage:FR},HR=()=>{const e=window.location.pathname.split("/"),t=e[e.length-1],n=e[e.length-2],[r,o]=k.useState(!0),[i,a]=k.useState(null),[u,l]=k.useState(""),[d,m]=k.useState(null),{executeRecaptcha:h}=s.useReCaptcha(),f=async()=>{if(n&&t){const{data:x}=await s.fetchTicket(n,t);a(x),o(!1)}};k.useEffect(()=>{f();const x=setInterval(()=>{f()},5e3);return()=>clearInterval(x)},[]);const p=async()=>{const x=await h();if(!n||!t||!x||!u.trim())return;const C={content:u,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};a(b=>b?{...b,messages:[...b.messages,C]}:null),m(C.id),l("");try{await s.sendTicketMessage(n,t,u,x),await f()}finally{setTimeout(()=>{m(null)},1e4)}},g=x=>{const C=new Date,b=new Date(x),R=Math.floor((C.getTime()-b.getTime())/1e3);if(R<60)return"right now";if(R<3600){const S=Math.floor(R/60);return`${S} minute${S>1?"s":""} ago`}else if(R<10800){const S=Math.floor(R/3600);return`${S} hour${S>1?"s":""} ago`}else return b.getFullYear()===C.getFullYear()?b.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):b.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return s.jsxRuntimeExports.jsx("div",{className:$e.wrapper,children:r&&!i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs("div",{className:$e.container,children:[s.jsxRuntimeExports.jsx("div",{className:$e.title,children:`#${n} (${i==null?void 0:i.title})`}),s.jsxRuntimeExports.jsxs("div",{className:$e.content,children:[s.jsxRuntimeExports.jsx("div",{className:$e.messages,children:i==null?void 0:i.messages.sort((x,C)=>new Date(x.createdAt).getTime()-new Date(C.createdAt).getTime()).map(x=>s.jsxRuntimeExports.jsxs("div",{className:s.clx($e.message,{[$e.myMessage]:!x.isSellerReply,[$e.otherMessage]:x.isSellerReply,[$e.loadingMessage]:d===x.id}),children:[s.jsxRuntimeExports.jsx("div",{className:$e.messageContent,children:s.splitTextIntoSpans(x.content,!1)}),d!==x.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:g(x.createdAt)}),d===x.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:s.jsxRuntimeExports.jsx(s.Loader,{})})]},x.id))}),s.jsxRuntimeExports.jsxs("div",{className:$e.input,children:[s.jsxRuntimeExports.jsx("textarea",{className:$e.textarea,value:u,placeholder:"What worries you?",onChange:x=>l(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.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"})})]})]})]})})},UR="_subscriptionContainer_1j6ol_1",$R="_leftSection_1j6ol_15",zR="_content_1j6ol_26",WR="_mainContent_1j6ol_33",qR="_detailsSection_1j6ol_37",VR="_buttonGroup_1j6ol_50",GR="_detailsContent_1j6ol_57",tn={subscriptionContainer:UR,leftSection:$R,content:zR,mainContent:WR,detailsSection:qR,buttonGroup:VR,detailsContent:GR},YR=()=>{const{id:e,accessToken:t}=s.useParams(),{subscription:n,setSubscription:r}=s.useSubscriptionStore(),{setIsOpen:o}=s.useModalStore(),[i,a]=k.useState(!1),[u,l]=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;l(!0);const{data:f}=await s.fetchSubscription(e,t);r({...f}),l(!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(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:tn.mainContent,children:[n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),s.jsxRuntimeExports.jsx(yy,{subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),s.jsxRuntimeExports.jsx("div",{className:tn.buttonGroup,children:n.pricingPlanExists&&s.jsxRuntimeExports.jsx(s.Button$1,{onClick:h=>{h.stopPropagation(),o(!0),a(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),s.jsxRuntimeExports.jsx(vt,{})]})]})}),s.jsxRuntimeExports.jsx("div",{className:tn.detailsSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.detailsContent,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(n==null?void 0:n.coupon)&&s.jsxRuntimeExports.jsx(ok,{coupon:n.coupon,currency:n.price.currency||"USD"}),n&&s.jsxRuntimeExports.jsx(Rk,{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(Ik,{}),n.activeTo&&s.jsxRuntimeExports.jsx(Zy,{})]}),s.jsxRuntimeExports.jsx(vt,{className:"flex md:hidden"})]})})]}),s.jsxRuntimeExports.jsx(Gy,{isOpen:i,setIsOpen:a,subscription:n})]})},XR="_topUpContainer_1pag6_1",QR="_formWrapper_1pag6_15",KR="_header_1pag6_29",ZR="_footer_1pag6_82",JR="_wrapper_1pag6_105",Gn={topUpContainer:XR,formWrapper:QR,header:KR,footer:ZR,wrapper:JR},eA=()=>{const{gatewaysDetail:e,setGatewaysDetail:t,balanceSettings:n,setBalanceSettings:r}=s.useCustomerDashboardStore();return k.useEffect(()=>{!e&&n&&(async()=>{const i=await s.getGatewaysDetail(n!=null&&n.isEnabled?(n==null?void 0:n.topUpSettings.gateways)||[]:[]);t(i)})()},[e,n]),k.useEffect(()=>{n||(async()=>{const i=await s.getBalanceSettings();r(i)})()},[n]),s.jsxRuntimeExports.jsxs("div",{className:Gn.wrapper,children:[s.jsxRuntimeExports.jsx(lr,{className:Gn.header}),s.jsxRuntimeExports.jsx("div",{className:Gn.topUpContainer,children:n?s.jsxRuntimeExports.jsx("div",{className:Gn.formWrapper,children:s.jsxRuntimeExports.jsx(s.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):s.jsxRuntimeExports.jsx(s.Loader,{})}),s.jsxRuntimeExports.jsx("div",{className:Gn.footer,children:s.jsxRuntimeExports.jsx(vt,{})})]})},tA="_orderPage_1nvve_1",nA="_leftSection_1nvve_15",rA="_content_1nvve_35",sA="_main_1nvve_42",oA="_statusBlock_1nvve_54",iA="_timelineBlock_1nvve_58",aA="_footer_1nvve_62",uA="_rightSection_1nvve_71",cA="_header_1nvve_84",lA="_productList_1nvve_92",dA="_mobileFooter_1nvve_99",hA="_loaderContainer_1nvve_108",mA="_orderMainData_1nvve_116",pA="_prices_1nvve_123",fA="_headerTitle_1nvve_127",gA="_headerDescription_1nvve_131",De={orderPage:tA,leftSection:nA,content:rA,main:sA,statusBlock:oA,timelineBlock:iA,footer:aA,rightSection:uA,header:cA,productList:lA,mobileFooter:dA,loaderContainer:hA,orderMainData:mA,prices:pA,headerTitle:fA,headerDescription:gA},xA=()=>{var h,f,p;const{id:e,accessToken:t}=s.useParams(),n=s.useNavigate(),[r,o]=k.useState(),[i,a]=k.useState(!1),u=s.useCopy(),l=((h=r==null?void 0:r.rawPrice)==null?void 0:h.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:l}),m=k.useMemo(()=>(r==null?void 0:r.partOrders.map(g=>{var x,C,b,R;return{id:(g==null?void 0:g.id)||0,image:g.productWithVariant.image,name:((x=g.productWithVariant)==null?void 0:x.name)||"",description:((C=g.productWithVariant)==null?void 0:C.description)||"",price:{quantity:g.quantity,amount:((b=g.productWithVariant)==null?void 0:b.price.amount)||0,currency:(R=g.productWithVariant)==null?void 0:R.price.currency},deliveryCategories:"deliveryCategories"in g?g.deliveryCategories:void 0,customerNote:g.customerNote,chargeType:g.chargeType||"ONE_TIME"}}))||[],[r]);return k.useLayoutEffect(()=>{if(e&&!t){const g=JSON.parse(localStorage.getItem("orders")||"{}");g[e]&&n(`/orders/${e}/${g[e].fullAccessToken}`)}},[e]),k.useEffect(()=>{const g=async(C,b=!1)=>{b||a(!0);const{data:R}=await(t?s.fetchAuthorizedOrder(`${C}/${t}`):s.fetchOrder(C));a(!1),R.charge.status===s.ChargeStatus.NotPaid&&n(`/charges/${R.charge.id}`,{replace:!0}),o(R)};e&&g(e);const x=setInterval(()=>{e&&g(e,!0)},5e3);return()=>{clearInterval(x)}},[]),i?s.jsxRuntimeExports.jsx("div",{className:De.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:De.orderPage,children:[s.jsxRuntimeExports.jsx("div",{className:De.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[s.jsxRuntimeExports.jsx(lr,{}),r&&s.jsxRuntimeExports.jsxs("div",{className:De.main,children:[s.jsxRuntimeExports.jsx(s.OrderStatusBlock,{className:De.statusBlock,orderStatus:r.status}),s.jsxRuntimeExports.jsxs("div",{className:De.orderMainData,children:[s.jsxRuntimeExports.jsx(Tc,{lastUpdate:r.createdAt,paymentType:r.charge.gateway,email:r.charge.customerForCharge.email,invoiceId:r.charge.id}),"accessToken"in r.review&&s.jsxRuntimeExports.jsx(Uk,{orderId:r.id,review:r.review})]}),r.charge&&s.jsxRuntimeExports.jsx(s.TrackPayment,{className:De.timelineBlock,timeline:r.charge.timeline}),s.jsxRuntimeExports.jsx(vt,{className:De.footer})]})]})}),s.jsxRuntimeExports.jsx("div",{className:De.rightSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[(r==null?void 0:r.charge.name)&&s.jsxRuntimeExports.jsxs("header",{className:De.header,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:De.headerTitle,children:r.charge.name}),r.charge.description&&s.jsxRuntimeExports.jsx("p",{className:De.headerDescription,children:r.charge.description})]}),s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",onClick:()=>u((r==null?void 0:r.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),s.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:De.productList,children:m.map(g=>s.jsxRuntimeExports.jsx(Do,{product:g,isOrder:!0},g.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:De.prices,isShowSubtotal:!1}),s.jsxRuntimeExports.jsx(vt,{className:De.mobileFooter})]})]})})]})},EA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState();n(t.filter(r=>r.id!==e))},bA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState(),r=s.v4();return n([...t,{id:r,...e}]),r},IA=e=>{const{blocks:t,settings:n,header:r,footer:o,announcement:i,routes:a=[]}=e,[u,l]=k.useState(null),{general:d}=s.useGeneralStore(),{setBlocks:m,setSourceBlocks:h,setHeader:f,setFooter:p,setAnnouncement:g,setSettings:x}=s.useBlocksStore(),{setHeader:C,setFooter:b,setAnnouncement:R}=s.useLayersStore(),{themeSettings:S}=s.useThemeSettingsStore(),{settings:P,setSettings:L}=s.useSettingsStore(),A=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,q=localStorage.getItem("shopPassword"),V=localStorage.getItem("shopId")||"";return k.useEffect(()=>{V||localStorage.setItem("shopId",(d==null?void 0:d.info.id)||"")},[d]),k.useEffect(()=>{if(S&&P){const K=hl(S,P);El(S),ml(K)}},[S,P,window.location.hostname]),k.useEffect(()=>{const K={};Object.keys(t).map(Q=>{K[Q]=t[Q]}),h(K),m(K),f(r),p(o),g(i),x(n);const w=new r,$=JSON.parse(JSON.stringify(w));C($,!1);const B=new o,H=JSON.parse(JSON.stringify(B));b(H,!1);const G=new i,z=JSON.parse(JSON.stringify(G));R(z,!1);const X=new n,Y=JSON.parse(JSON.stringify(X));L(Y);const W=s.createBrowserRouter([{element:s.jsxRuntimeExports.jsx(uf,{shopDomain:A,shopId:V,shopPassword:q||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:o,announcement:i})}),errorElement:s.jsxRuntimeExports.jsx(Fp,{})},{path:"/checkout",element:s.jsxRuntimeExports.jsx(xR,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:s.jsxRuntimeExports.jsx(eA,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:s.jsxRuntimeExports.jsx(kR,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(xA,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(YR,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),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(At,{}),loader:()=>(document.title="Customer Dashboard",!0)},{path:"/validation",element:s.jsxRuntimeExports.jsx(Xp,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),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(HR,{})})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(At,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:s.jsxRuntimeExports.jsx(dl,{}),errorElement:s.jsxRuntimeExports.jsx(At,{})},...a]}]);l(W)},[d]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:u&&s.jsxRuntimeExports.jsx(s.RouterProvider,{router:u})})};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=IA;exports.ColorVariables=da;exports.hotReload=bl;exports.iconNames=Cc;exports.removeNotification=EA;exports.showNotification=bA;exports.useBuilderPages=Tl;exports.useCreateTicket=Il;
131
+ `))}function l(p,g,x,C){const b=x.enter("tableCell"),R=x.enter("phrasing"),S=x.containerPhrasing(p,{...C,before:i,after:i});return R(),b(),S}function d(p,g){return Y_(p,{align:g,alignDelimiters:r,padding:n,stringLength:o})}function m(p,g,x){const C=p.children;let b=-1;const R=[],S=g.enter("table");for(;++b<C.length;)R[b]=h(C[b],g,x);return S(),R}function h(p,g,x){const C=p.children;let b=-1;const R=[],S=g.enter("tableRow");for(;++b<C.length;)R[b]=l(C[b],p,g,x);return S(),R}function f(p,g,x){let C=cc.inlineCode(p,g,x);return x.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function DC(){return{exit:{taskListCheckValueChecked:ca,taskListCheckValueUnchecked:ca,paragraph:BC}}}function OC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:MC}}}function ca(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function BC(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let i=-1,a;for(;++i<o.length;){const u=o[i];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function MC(e,t,n,r){const o=e.children[0],i=typeof e.checked=="boolean"&&o&&o.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);i&&u.move(a);let l=cc.listItem(e,t,n,{...r,...u.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),l;function d(m){return m+a}}function FC(){return[x_(),M_(),$_(),AC(),DC()]}function HC(e){return{extensions:[E_(),F_(e),z_(),PC(e),OC()]}}const UC={tokenize:GC,partial:!0},lc={tokenize:YC,partial:!0},dc={tokenize:XC,partial:!0},hc={tokenize:QC,partial:!0},$C={tokenize:KC,partial:!0},mc={name:"wwwAutolink",tokenize:qC,previous:fc},pc={name:"protocolAutolink",tokenize:VC,previous:gc},Pt={name:"emailAutolink",tokenize:WC,previous:xc},St={};function zC(){return{text:St}}let Zt=48;for(;Zt<123;)St[Zt]=Pt,Zt++,Zt===58?Zt=65:Zt===91&&(Zt=97);St[43]=Pt;St[45]=Pt;St[46]=Pt;St[95]=Pt;St[72]=[Pt,pc];St[104]=[Pt,pc];St[87]=[Pt,mc];St[119]=[Pt,mc];function WC(e,t,n){const r=this;let o,i;return a;function a(h){return!co(h)||!xc.call(r,r.previous)||Po(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return co(h)?(e.consume(h),u):h===64?(e.consume(h),l):n(h)}function l(h){return h===46?e.check($C,m,d)(h):h===45||h===95||Me(h)?(i=!0,e.consume(h),l):m(h)}function d(h){return e.consume(h),o=!0,l}function m(h){return i&&o&&ze(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function qC(e,t,n){const r=this;return o;function o(a){return a!==87&&a!==119||!fc.call(r,r.previous)||Po(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(UC,e.attempt(lc,e.attempt(dc,i),n),n)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function VC(e,t,n){const r=this;let o="",i=!1;return a;function a(h){return(h===72||h===104)&&gc.call(r,r.previous)&&!Po(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(ze(h)&&o.length<5)return o+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const f=o.toLowerCase();if(f==="http"||f==="https")return e.consume(h),l}return n(h)}function l(h){return h===47?(e.consume(h),i?d:(i=!0,l)):n(h)}function d(h){return h===null||qr(h)||Ie(h)||on(h)||Jr(h)?n(h):e.attempt(lc,e.attempt(dc,m),n)(h)}function m(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function GC(e,t,n){let r=0;return o;function o(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),o):a===46&&r===3?(e.consume(a),i):n(a)}function i(a){return a===null?n(a):t(a)}}function YC(e,t,n){let r,o,i;return a;function a(d){return d===46||d===95?e.check(hc,l,u)(d):d===null||Ie(d)||on(d)||d!==45&&Jr(d)?l(d):(i=!0,e.consume(d),a)}function u(d){return d===95?r=!0:(o=r,r=void 0),e.consume(d),a}function l(d){return o||r||!i?n(d):t(d)}}function XC(e,t){let n=0,r=0;return o;function o(a){return a===40?(n++,e.consume(a),o):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(hc,t,i)(a):a===null||Ie(a)||on(a)?t(a):(e.consume(a),o)}function i(a){return a===41&&r++,e.consume(a),o}}function 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),i):u===93?(e.consume(u),o):u===60||u===null||Ie(u)||on(u)?t(u):n(u)}function o(u){return u===null||u===40||u===91||Ie(u)||on(u)?t(u):r(u)}function i(u){return ze(u)?a(u):n(u)}function a(u){return u===59?(e.consume(u),r):ze(u)?(e.consume(u),a):n(u)}}function KC(e,t,n){return r;function r(i){return e.consume(i),o}function o(i){return Me(i)?n(i):t(i)}}function fc(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ie(e)}function gc(e){return!ze(e)}function xc(e){return!(e===47||co(e))}function co(e){return e===43||e===45||e===46||e===95||Me(e)}function Po(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:iS,partial:!0};function JC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:rS,continuation:{tokenize:sS},exit:oS}},text:{91:{name:"gfmFootnoteCall",tokenize:nS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:eS,resolveTo:tS}}}}function eS(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;o--;){const l=r.events[o][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return u;function u(l){if(!a||!a._balanced)return n(l);const d=mt(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}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)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function nS(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(h){if(i>999||h===93&&!a||h===null||h===91||Ie(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return o.includes(mt(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Ie(h)||(a=!0),i++,e.consume(h),h===92?m:d}function m(h){return h===91||h===92||h===93?(e.consume(h),i++,d):d(h)}}function rS(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,u;return l;function l(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(g)}function m(g){if(a>999||g===93&&!u||g===null||g===91||Ie(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return i=mt(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ie(g)||(u=!0),a++,e.consume(g),g===92?h:m}function h(g){return g===91||g===92||g===93?(e.consume(g),a++,m):m(g)}function f(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),o.includes(i)||o.push(i),pe(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function sS(e,t,n){return e.check(mr,t,e.attempt(ZC,t,n))}function oS(e){e.exit("gfmFootnoteDefinition")}function iS(e,t,n){const r=this;return pe(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function aS(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(a,u){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let d=l;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[l][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[l][1].end)},h={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",m,u],["enter",a[d][1],u],["exit",a[d][1],u],["enter",h,u]],p=u.parser.constructs.insideSpan.null;p&&Ke(f,f.length,0,es(p,a.slice(d+1,l),u)),Ke(f,f.length,0,[["exit",h,u],["enter",a[l][1],u],["exit",a[l][1],u],["exit",m,u]]),Ke(a,d-1,l-d+3,f),l=d+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,u,l){const d=this.previous,m=this.events;let h=0;return f;function f(g){return d===126&&m[m.length-1][1].type!=="characterEscape"?l(g):(a.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const x=_n(d);if(g===126)return h>1?l(g):(a.consume(g),h++,p);if(h<2&&!n)return l(g);const C=a.exit("strikethroughSequenceTemporary"),b=_n(g);return C._open=!b||b===2&&!!x,C._close=!x||x===2&&!!b,u(g)}}}class uS{constructor(){this.map=[]}add(t,n,r){cS(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function cS(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function lS(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function dS(){return{flow:{null:{name:"table",tokenize:hS,resolveAll:mS}}}}function hS(e,t,n){const r=this;let o=0,i=0,a;return u;function u(w){let $=r.events.length-1;for(;$>-1;){const G=r.events[$][1].type;if(G==="lineEnding"||G==="linePrefix")$--;else break}const B=$>-1?r.events[$][1].type:null,H=B==="tableHead"||B==="tableRow"?A:l;return H===A&&r.parser.lazy[r.now().line]?n(w):H(w)}function l(w){return e.enter("tableHead"),e.enter("tableRow"),d(w)}function d(w){return w===124||(a=!0,i+=1),m(w)}function m(w){return w===null?n(w):J(w)?i>1?(i=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):(i+=1,a&&(a=!1,o+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),a=!0,m):(e.enter("data"),h(w)))}function h(w){return w===null||w===124||Ie(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"),a=!1,de(w)?pe(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):g(w))}function g(w){return w===45||w===58?C(w):w===124?(a=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),x):L(w)}function x(w){return de(w)?pe(e,C,"whitespace")(w):C(w)}function C(w){return w===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(i+=1,b(w)):w===null||J(w)?P(w):L(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),R(w)):L(w)}function R(w){return w===45?(e.consume(w),R):w===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(w))}function S(w){return de(w)?pe(e,P,"whitespace")(w):P(w)}function P(w){return w===124?g(w):w===null||J(w)?!a||o!==i?L(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):L(w)}function L(w){return n(w)}function A(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||Ie(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,o=0,i=[0,0,0,0],a=[0,0,0,0],u=!1,l=0,d,m,h;const f=new uS;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(u=!1,l!==0&&(la(f,t,l,d,m),m=void 0,l=0),d={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",d,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,m={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",m,t]])),o=g.type==="tableDelimiterRow"?2:m?3:1):o&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],h=Dr(f,t,i,o,void 0,h),i=[0,0,0,0]),a[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],h=Dr(f,t,i,o,void 0,h)),i=a,a=[i[1],n,0,0])):g.type==="tableHead"?(u=!0,l=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(l=n,i[1]!==0?(a[0]=a[1],h=Dr(f,t,i,o,n,h)):a[1]!==0&&(h=Dr(f,t,a,o,n,h)),o=0):o&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&la(f,t,l,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=lS(t.events,n))}return e}function Dr(e,t,n,r,o,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(i.end=Object.assign({},gn(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=gn(t.events,n[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const d=gn(t.events,n[2]),m=gn(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 g=n[2]+1,x=n[3]-n[2]-1;e.add(g,x,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return o!==void 0&&(i.end=Object.assign({},gn(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function la(e,t,n,r,o){const i=[],a=gn(t.events,n);o&&(o.end=Object.assign({},a),i.push(["exit",o,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function gn(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const pS={name:"tasklistCheck",tokenize:gS};function fS(){return{text:{91:pS}}}function gS(e,t,n){const r=this;return o;function o(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Ie(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(l)}function u(l){return J(l)?t(l):de(l)?e.check({tokenize:xS},t,n)(l):n(l)}}function xS(e,t,n){return pe(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function ES(e){return Da([zC(),JC(),aS(e),dS(),fS()])}const bS={};function IS(e){const t=this,n=e||bS,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(ES(n)),i.push(FC()),a.push(HC(n))}const Do=({isOrder:e,product:t})=>{var i;const{shopGeneral:n}=s.useStorefrontStore(),r=t.subscriptionSettings,{cart:o}=s.useCart();return console.log(t.description),s.jsxRuntimeExports.jsxs("div",{className:`${Ne.checkoutProduct} ${e?Ne.isOrder:""}`,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:`${Ne.productImage} ${e?Ne.isOrderImage:""}`,children:t!=null&&t.image?s.jsxRuntimeExports.jsx("img",{className:Ne.image,src:s.convertCfImageIdToUrl(t.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image",fill:"var(--text-secondary)"})}),s.jsxRuntimeExports.jsx("div",{className:Ne.productInfo,children:s.jsxRuntimeExports.jsxs("div",{className:Ne.productHeader,children:[s.jsxRuntimeExports.jsx("h2",{className:Ne.productName,id:"h5",children:t.name}),s.jsxRuntimeExports.jsxs("span",{className:Ne.quantityBadge,id:"md",children:[t.price.quantity,"x"]})]})}),t.chargeType==="RECURRING"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:r&&`${s.formatPrice(r.price)} / ${s.normalizeInterval(r.recurringIntervalDays||0)}${r.entryFee?" + "+s.formatPrice(r.entryFee):""}`}),t.chargeType==="ONE_TIME"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:t.variantsGateways&&o.gateway&&t.variantsGateways.some(a=>a.name===o.gateway&&a.overrodePrice)?s.formatPrice(((i=t.variantsGateways.find(a=>a.name===o.gateway))==null?void 0:i.overrodePrice)||t.price):s.formatPrice(t.price)})]}),t.description&&s.jsxRuntimeExports.jsx("p",{className:Ne.productDescription,children:s.jsxRuntimeExports.jsx(ru,{remarkPlugins:[IS],rehypePlugins:[d_],components:{a:({node:a,...u})=>s.jsxRuntimeExports.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer",className:Ne.link})},children:t.description})}),t.deliveryCategories&&s.jsxRuntimeExports.jsx("div",{className:Ne.deliveryCategories,children:t.deliveryCategories.map(a=>s.jsxRuntimeExports.jsx(s.DeliveryItem,{deliveryConfiguration:a},a.id))}),t.customerNote&&s.jsxRuntimeExports.jsxs("div",{className:Ne.customerNote,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.noteHeader,children:[(n==null?void 0:n.info.logo)&&s.jsxRuntimeExports.jsx("div",{className:Ne.logoContainer,children:s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(n==null?void 0:n.info.logo.cfId)})}),s.jsxRuntimeExports.jsx("p",{className:Ne.shopName,id:"md",children:n==null?void 0:n.info.name})]}),s.jsxRuntimeExports.jsx("p",{className:Ne.noteContent,id:"md",children:t.customerNote})]})]})},TS="_coupon_dkjzv_1",_S="_couponApplied_dkjzv_7",CS="_discount_dkjzv_17",SS="_removeButton_dkjzv_23",yS="_removeButtonText_dkjzv_27",kS="_couponInput_dkjzv_31",RS="_couponInputContainer_dkjzv_37",Mt={coupon:TS,couponApplied:_S,discount:CS,removeButton:SS,removeButtonText:yS,couponInput:kS,couponInputContainer:RS},AS=({applyCoupon:e,couponData:t,discount:n,removeCoupon:r,gateway:o})=>{const[i,a]=k.useState(null),[u,l]=k.useState(!1);return s.jsxRuntimeExports.jsxs("div",{className:Mt.coupon,children:[u&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Mt.skeleton,children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!u&&(t?s.jsxRuntimeExports.jsxs("div",{className:Mt.couponApplied,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"}),s.jsxRuntimeExports.jsxs("p",{id:"md",children:[i," is applied"," ",s.jsxRuntimeExports.jsxs("span",{className:Mt.discount,children:["-",n," ",!t.isFixed&&`(${t.discount}%)`]})]}),s.jsxRuntimeExports.jsx("button",{className:Mt.removeButton,onClick:r,children:s.jsxRuntimeExports.jsx("span",{className:Mt.removeButtonText,children:"Remove"})})]}):s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInput,children:[s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"Enter a discount code",value:i||"",onChange:d=>{a(d===""?null:d)}}),s.jsxRuntimeExports.jsx(s.Button$1,{onClick:async()=>{l(!0),i&&await e(i),l(!1)},disabled:!o||!i,type:"Primary",children:"Apply"})]}),!o&&s.jsxRuntimeExports.jsx(s.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},NS=({cart:e,products:t,applyCoupon:n,applyCouponPending:r,coupon:o,totalAndDiscount:i,removeCoupon:a})=>{var x;const{priceAdjusment:u}=s.useCartStore(),[l,d]=k.useState(!1),m=k.useMemo(()=>e.parts.map(C=>{const b=t.find(S=>S.id===C.productId),R=b==null?void 0:b.variants.find(S=>S.id===C.productVariantId);return C.chargeType==="RECURRING"&&d(!0),{id:(b==null?void 0:b.id)||0,image:b==null?void 0:b.images[0],name:(R==null?void 0:R.name)||"",description:(R==null?void 0:R.description)||"",price:{quantity:C.quantity,amount:(R==null?void 0:R.price.amount)||0,currency:R==null?void 0:R.price.currency},subscriptionSettings:R==null?void 0:R.subscriptionSettings,chargeType:C.chargeType,variantsGateways:R==null?void 0:R.gateways}}),[e,t]),h=((x=m[0])==null?void 0:x.price.currency)||"USD",f=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),p=k.useMemo(()=>o&&!o.isFixed&&o.discount===100?i.total:i.totalWithDiscount?i.total-i.totalWithDiscount:0,[i,o]),g=u?(u==null?void 0:u.fixedAmount)+Math.round((i.totalWithDiscount!==void 0?i.totalWithDiscount:i.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(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:Kt.headerSection,children:[s.jsxRuntimeExports.jsx("header",{className:Kt.header,children:s.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),s.jsxRuntimeExports.jsx("div",{className:Kt.productsContainer,children:m.map(C=>s.jsxRuntimeExports.jsx(Do,{product:C},C.id))}),s.jsxRuntimeExports.jsx("div",{className:Kt.couponContainer,children:s.jsxRuntimeExports.jsx(AS,{applyCoupon:n,applyCouponPending:r,couponData:o,discount:f.format(p),removeCoupon:a,gateway:e.gateway})}),s.jsxRuntimeExports.jsx(dr,{formatter:f,coupon:o,total:i.total,discount:p,totalWithDiscount:i.totalWithDiscount,feeOrDiscount:l?null:g})]}),s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutFooter,children:s.jsxRuntimeExports.jsx(vt,{})})]})})},wS="_checkoutOperational_6gxie_1",LS="_innerContainer_6gxie_17",jS="_paymentMethodsSection_6gxie_22",vS="_socialConnectSection_6gxie_28",PS="_socialConnectLabel_6gxie_31",DS="_socialConnectContent_6gxie_35",OS="_continueButton_6gxie_39",BS="_button_6gxie_43",MS="_checkoutFooter_6gxie_47",Nt={checkoutOperational:wS,innerContainer:LS,paymentMethodsSection:jS,socialConnectSection:vS,socialConnectLabel:PS,socialConnectContent:DS,continueButton:OS,button:BS,checkoutFooter:MS},FS="_customFields_uhcib_2",HS="_checkboxWrapper_uhcib_9",US="_textareaWrapper_uhcib_16",$S="_inputWrapper_uhcib_17",zS="_requiredStar_uhcib_27",xn={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:xn.customFields,children:n})},qS=({customField:e,setCustomFields:t})=>{const n=r=>{t(o=>o.map(i=>i.name===e.name?{...i,value:r}:i))};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:o,regex:i,required:a,onValueChange:u})=>{if(k.useEffect(()=>{r===""&&n!==void 0&&u(String(n))},[]),t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return s.jsxRuntimeExports.jsxs("label",{className:xn.checkboxWrapper,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:r==="true",onChange:d=>u(d?"true":"false")}),s.jsxRuntimeExports.jsxs("p",{className:xn.checkboxLabel,children:[e,a&&s.jsxRuntimeExports.jsx("span",{className:xn.requiredStar,children:"*"})]})]});if(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return s.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(n??""),required:a});const l=d=>{(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:i?new RegExp(i):/.*/).test(d)&&u(d)};return t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?s.jsxRuntimeExports.jsx("div",{className:xn.textareaWrapper,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{label:e,value:r,placeholder:o,onChange:l,required:a})}):s.jsxRuntimeExports.jsx("div",{className:xn.inputWrapper,children:s.jsxRuntimeExports.jsx(s.Input$1,{type:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":o,label:e,value:r,required:a,onChange:l})})},GS="_connectedContainer_1rxr8_1",YS="_userInfo_1rxr8_10",XS="_avatar_1rxr8_16",QS="_avatarImage_1rxr8_26",Or={connectedContainer:GS,userInfo:YS,avatar:XS,avatarImage:QS},KS=({customerEmail:e})=>{const{discordInfo:t,setDiscordInfo:n}=s.useDiscordStore(),{notifications:r,setNotifications:o}=s.useNotificationStore(),[i,a]=k.useState(!1),[u,l]=k.useState(0),[d,m]=k.useState(null),h=20,f=x=>{var C,b,R,S;return(b=(C=x==null?void 0:x.response)==null?void 0:C.data)!=null&&b.error?x.response.data.error:(S=(R=x==null?void 0:x.response)==null?void 0:R.data)!=null&&S.message?x.response.data.message:x!=null&&x.message?x.message:"Failed to connect to Discord. Please try again later."},p=(x,C)=>{o([...r,{id:s.v4(),message:x,status:C}])};k.useEffect(()=>{if(d&&i){const x=setInterval(()=>{d.closed&&(clearInterval(x),a(!1),m(null))},1e3);return()=>clearInterval(x)}},[d,i]);const g=()=>{e.trim()!==""&&(a(!0),l(0),ul({customerEmail:e}).then(({data:x})=>{const C=window.open(x.redirectUrl);m(C),(!C||C.closed||typeof C.closed>"u")&&setTimeout(()=>{const S=document.createElement("a");S.href=x.redirectUrl,S.target="_blank",S.click()});let b;const R=()=>{if(l(S=>S+1),u>=h||C&&C.closed){u>=h&&p("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(b);return}cl({id:x.id,customerEmail:e}).then(({data:S})=>{n({authorized:!0,id:S.discordId,avatar:S.avatar,username:S.username}),C&&C.close(),a(!1),m(null),p("Discord successfully connected!","success"),clearTimeout(b)}).catch(S=>{var P;if(console.log("Waiting for authorization...",S,{newWindow:C}),C&&C.closed){a(!1),clearTimeout(b);return}if((P=S==null?void 0:S.response)!=null&&P.status&&S.response.status!==404&&S.response.status>=400){p(f(S),"error"),a(!1),clearTimeout(b);return}clearTimeout(b),b=setTimeout(R,1500)})};R()}).catch(x=>{console.log("Could not initiate Discord authorization",x),p(f(x),"error"),a(!1)}))};return t!=null&&t.authorized?s.jsxRuntimeExports.jsxs("div",{className:Or.connectedContainer,children:[s.jsxRuntimeExports.jsxs("div",{className:Or.userInfo,children:[s.jsxRuntimeExports.jsx("div",{className:Or.avatar,children:t.avatar?s.jsxRuntimeExports.jsx("img",{className:Or.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(Af,{})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,children:"Reconnect"})]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:i,children:i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"DiscordLogo"}),s.jsxRuntimeExports.jsx(s.StableText,{children:"Connect Your Discord"})]})})},ZS="_paymentMethodsContainer_a3he6_2",JS={paymentMethodsContainer:ZS},e3="_bottomSheet_1x8kc_1",t3="_content_1x8kc_8",n3="_description_1x8kc_11",r3="_title_1x8kc_15",s3="_buttonGroup_1x8kc_19",o3="_buttonWrapper_1x8kc_29",i3="_fullWidthButton_1x8kc_32",a3="_modal_1x8kc_36",u3="_header_1x8kc_43",wt={bottomSheet:e3,content:t3,description:n3,title:r3,buttonGroup:s3,buttonWrapper:o3,fullWidthButton:i3,modal:a3,header:u3},c3=({setIsOpen:e,balance:t})=>{const n=s.useNavigate(),{setIsOpen:r}=s.useModalStore(),o=()=>{n("/top-up?redirectRoute=checkout")};function i(){r(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:wt.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:wt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:wt.title,children:"Insufficient Customer Balance"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:wt.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:wt.content,children:s.jsxRuntimeExports.jsxs("p",{className:wt.description,children:["You currently have ",t&&s.formatPrice(t)," in your balance. After topping up the required amount, you can continue to checkout."]})}),s.jsxRuntimeExports.jsxs("div",{className:wt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:wt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:wt.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:o,children:"Add Balance"})})]})]})]})},Ec=({align:e,gateway:t,gatewayDisplayName:n,selected:r,onSelect:o,total:i,onSignInClick:a,reversed:u})=>{const{token:l}=s.useStorefrontStore(),{balance:d}=s.useCustomerDashboardStore(),[m,h]=k.useState(!1),{setIsOpen:f}=s.useModalStore(),p=g=>{g.stopPropagation(),o&&o(t),d&&d.amount<i&&(h(!0),f(!0))};return k.useEffect(()=>{},[d,i]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(s.styles$3.paymentMethod,{[s.styles$3.selected]:r,[s.styles$3.alignColumn]:e==="column",[s.styles$3.reversed]:u}),onClick: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:["(",l?d&&s.formatPrice(d):s.jsxRuntimeExports.jsx("a",{className:s.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),s.jsxRuntimeExports.jsx("div",{className:s.styles$3.iconContainer,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}),m&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>h(!1),children:s.jsxRuntimeExports.jsx(c3,{setIsOpen:h,balance:d})})]})},bc=({possibleGateways:e,setGateway:t,totalAndDiscount:n,onSignInClick:r,setPaymentMethod:o})=>{const[i,a]=k.useState(),[u,l]=k.useState(),{setPriceAdjustment:d}=s.useCartStore(),[m,h]=k.useState(null),f=(p,g)=>{var x;u!==g&&(t(g),d(((x=m==null?void 0:m.find(C=>C.name===g))==null?void 0:x.priceAdjustment)||null)),o(p),a(p),l(g)};return k.useEffect(()=>{const p=async()=>{const{data:g}=await s.fetchGatewaysDetail([...e.availableGateways,...e.requiresSignInGateways]);h(g)};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(Ec,{gateway:p.name,gatewayDisplayName:p.displayName,onSelect:g=>{l(g),u!==g&&t(g)},selected:p.name===u,total:n.total,onSignInClick:r,reversed:!0},p.name):p.paymentMethods.map(g=>s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{paymentMethod:g,gateway:p.name,gatewayDisplayName:p.displayName,gatewayLogoCfId:p.logoCfImageId,poweredByLogoCfId:p.poweredByImageCfImageId,onSelect:x=>f(x,p.name),selected:i===g&&u===p.name},`${p.name}-${g}`)))}),!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%"})})]})},l3="_modal_14r0b_1",d3={modal:l3},h3=({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:d3.modal,onClick:o=>o.stopPropagation(),children:s.jsxRuntimeExports.jsx(s.Auth,{inModal:!0})})},m3=({getPossibleGateways:e,setGateway:t,getDiscordSettings:n,cart:r,products:o,submitCart:i,reset:a,setCustomFieldsToCart:u,totalAndDiscount:l,setDiscordSocialConnectId:d,setPaymentMethod:m})=>{const h=k.useMemo(()=>n(),[]),[f,p]=k.useState([]),{balance:g,setBalance:x}=s.useCustomerDashboardStore(),{token:C}=s.useStorefrontStore(),{executeRecaptcha:b}=s.useReCaptcha(),{discordInfo:R}=s.useDiscordStore(),{customerEmail:S,setCustomerEmail:P}=s.useCartStore(),L=R!=null&&R.authorized?R.id:void 0,A=s.useNavigate(),q=k.useMemo(()=>e(),[r.parts]),[V,K]=k.useState(!1),{setIsOpen:w}=s.useModalStore(),{notifications:$,setNotifications:B}=s.useNotificationStore();k.useEffect(()=>{const Y=s.getCommonCustomFields(r.parts,o).map(W=>W.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...W,value:String(W.defaultValue)}:W);p([...Y])},[]),k.useEffect(()=>{const X=s.getCommonCustomFields(r.parts,o);p(Y=>{const W=new Map(Y.map(Q=>[Q.name,Q]));return X.map(Q=>{const _=W.get(Q.name);return _&&_.value?{...Q,value:_.value}:Q.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...Q,value:String(Q.defaultValue)}:Q})})},[r.parts,o]),k.useEffect(()=>{C&&(async()=>{const Y=await s.getBalance();x(Y)})()},[C]);function H(X){return X&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(X)}const G=()=>{const X=[];return f.forEach(Y=>{var W;Y.required&&!((W=Y.value)!=null&&W.toString().trim())&&X.push({message:`Field "${Y.name}" is required.`,status:"error",id:s.v4()})}),X.length>0?(B([...$,...X]),!1):!0},z=async X=>{if(X.stopPropagation(),r.gateway==="Balance"&&!C){w(!0),K(!0);return}if(!G())return;const Y=Object.fromEntries(f.map(Q=>[Q.name,Q.value||""]));u({...Y}),L&&h.isEnabled&&d(L);const W=await b();if(W){const Q=await i(W),_=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(_).length>10){const Ee=Date.now()-864e5;Object.keys(_).forEach(Re=>{_[Re].createdAt<=Ee&&delete _[Re]})}"order"in Q?_[Q.order.id]={createdAt:Date.now(),fullAccessToken:Q.order.fullAccessToken}:_[Q.id]={createdAt:Date.now(),fullAccessToken:Q.fullAccessToken},localStorage.setItem("orders",JSON.stringify(_)),A(`/orders/${"order"in Q?Q.order.id:Q.id}/${"order"in Q?Q.order.fullAccessToken:Q.fullAccessToken}`),setTimeout(()=>a(),0)}};return s.jsxRuntimeExports.jsxs("div",{className:Nt.checkoutOperational,children:[s.jsxRuntimeExports.jsxs("div",{className:Nt.innerContainer,children:[r.parts.length>0&&s.jsxRuntimeExports.jsx(bc,{possibleGateways:q,setGateway:t,setPaymentMethod:m,balance:g,totalAndDiscount:l,onSignInClick:()=>{K(!0),w(!0)}}),s.jsxRuntimeExports.jsx("div",{className:Nt.paymentMethodsSection,children:s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"mail@mail.com",value:S||"",onChange:X=>P(X),disabled:!!C,label:"Email Address"})}),s.jsxRuntimeExports.jsx(WS,{customFields:f,setCustomFields:p}),h.isEnabled&&s.jsxRuntimeExports.jsxs("div",{className:Nt.socialConnectSection,children:[s.jsxRuntimeExports.jsx("p",{className:Nt.socialConnectLabel,id:"md",children:"Social Connect"}),s.jsxRuntimeExports.jsx("div",{className:Nt.socialConnectContent,children:s.jsxRuntimeExports.jsx(KS,{customerEmail:S||""})})]}),s.jsxRuntimeExports.jsxs("div",{className:Nt.continueButton,children:[s.jsxRuntimeExports.jsx(s.Button$1,{onClick:z,disabled:!r.gateway||!H(S||"")||h.isRequired&&!(R!=null&&R.authorized),className:Nt.button,children:"Continue to Checkout"}),s.jsxRuntimeExports.jsx(s.TermsOfService,{}),s.jsxRuntimeExports.jsx(s.SecuredBySsl,{})]}),s.jsxRuntimeExports.jsx(vt,{className:Nt.checkoutFooter})]}),V&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>K(!1),children:s.jsxRuntimeExports.jsx(h3,{setIsOpen:K})})]})},p3="_mt1_1t7v2_1",f3="_notifyBlock_1t7v2_13",g3="_notifyHeader_1t7v2_19",x3="_notifyContent_1t7v2_25",E3="_buttonBlock_1t7v2_30",b3="_imageBlock_1t7v2_34",I3="_imageContainer_1t7v2_42",T3="_sectionBlock_1t7v2_54",_3="_sectionTitle_1t7v2_61",C3="_sectionSubtitle_1t7v2_64",S3="_inputContainer_1t7v2_69",pt={mt1:p3,notifyBlock:f3,notifyHeader:g3,notifyContent:x3,buttonBlock:E3,imageBlock:b3,imageContainer:I3,sectionBlock:T3,sectionTitle:_3,sectionSubtitle:C3,inputContainer:S3},y3=({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"})})]})})},k3=({props:e})=>s.jsxRuntimeExports.jsx(s.Button$1,{className:pt.buttonBlock,onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),R3=({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:""})})}),A3=({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})]}),N3=({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(Ic,{block:n},r))]})},Ic=({block:e})=>{switch(e.type){case"Section":return s.jsxRuntimeExports.jsx(N3,{...e});case"ReadOnlyTextInput":return s.jsxRuntimeExports.jsx(y3,{...e});case"Notify":return s.jsxRuntimeExports.jsx(A3,{...e});case"Button":return s.jsxRuntimeExports.jsx(k3,{...e});case"Image":return s.jsxRuntimeExports.jsx(R3,{...e});default:return null}},w3="_bottomSheet_1x4sq_1",L3="_content_1x4sq_8",j3="_agreementList_1x4sq_11",v3="_agreementItem_1x4sq_16",P3="_warning_1x4sq_23",D3="_buttonGroup_1x4sq_31",O3="_buttonWrapper_1x4sq_41",B3="_fullWidthButton_1x4sq_44",M3="_modal_1x4sq_48",F3="_header_1x4sq_55",Je={bottomSheet:w3,content:L3,agreementList:j3,agreementItem:v3,warning:P3,buttonGroup:D3,buttonWrapper:O3,fullWidthButton:B3,modal:M3,header:F3},H3=({setIsOpen:e,price:t})=>{const[n,r]=k.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Je.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.content,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.agreementList,children:[s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSendAsFF,onChange:a=>r({...n,agreeToSendAsFF:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSend,onChange:a=>r({...n,agreeToSend:a})}),s.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",s.formatPrice(t)," ",t.currency]})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToNotAddNote,onChange:a=>r({...n,agreeToNotAddNote:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),s.jsxRuntimeExports.jsx("div",{className:Je.warning,children:s.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",s.formatPrice(t)," ",t.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",children:s.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),s.jsxRuntimeExports.jsx("div",{className:Je.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:i,children:"Continue to Payment"})})]})]})]})},U3="_chargeItemsContainer_qmv3w_4",$3="_chargeItemsInner_qmv3w_20",z3="_productsContainer_qmv3w_27",W3="_chargeHeader_qmv3w_41",q3="_chargeTitle_qmv3w_49",V3="_chargeDescription_qmv3w_55",G3="_copyButton_qmv3w_61",Y3="_productsList_qmv3w_73",X3="_trackingContainer_qmv3w_81",Q3="_footerContainer_qmv3w_91",Et={chargeItemsContainer:U3,chargeItemsInner:$3,productsContainer:z3,chargeHeader:W3,chargeTitle:q3,chargeDescription:V3,copyButton:G3,productsList:Y3,trackingContainer:X3,footerContainer:Q3},K3=({charge:e})=>{var i;const t=s.useCopy(),n=(e==null?void 0:e.price.currency)||"USD",r=new Intl.NumberFormat("en-US",{style:"currency",currency:n}),o=k.useMemo(()=>{var a;return((a=e==null?void 0:e.order)==null?void 0:a.partOrders.map(u=>{var l,d,m,h,f,p;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:((l=u.productWithVariant)==null?void 0:l.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(lr,{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})]}),((i=e.order)==null?void 0:i.id)&&s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",className:Et.copyButton,onClick:()=>{var a;return t(((a=e.order)==null?void 0:a.id)||"")},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),"Copy Order ID"]})]}),s.jsxRuntimeExports.jsxs("div",{style:{flex:1},children:[!!o.length&&s.jsxRuntimeExports.jsx("div",{className:Et.productsList,children:o.map(a=>s.jsxRuntimeExports.jsx(Do,{product:a},a.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})]})]})]})})},Z3="_checkoutOrderMainData_hqf60_1",J3="_orderDetailRow_hqf60_6",ey="_chargeIdRow_hqf60_16",ty="_detailLabel_hqf60_25",ny="_detailValue_hqf60_29",ry="_chargeIdContainer_hqf60_33",sy="_chargeId_hqf60_16",oy="_copyIcon_hqf60_51",Ue={checkoutOrderMainData:Z3,orderDetailRow:J3,chargeIdRow:ey,detailLabel:ty,detailValue:ny,chargeIdContainer:ry,chargeId:sy,copyIcon:oy},Tc=({lastUpdate:e,invoiceId:t,email:n,paymentType:r})=>{const o=s.useCopy(),[i,a]=k.useState(null),u=i==null?void 0:i.find(d=>d.name===r);k.useEffect(()=>{i||(async()=>{const m=[r],h=await s.getGatewaysDetail(m);a(h)})()},[r,i]);const l=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(),g=d.getHours(),x=d.getMinutes().toString().padStart(2,"0"),C=d.getSeconds().toString().padStart(2,"0"),b=g>=12?"PM":"AM",R=(g%12||12).toString().padStart(2,"0");return`${f} ${h}, ${p} at ${R}:${x}:${C} ${b}`};return s.jsxRuntimeExports.jsxs("div",{className:Ue.checkoutOrderMainData,children:[s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Last Updated"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:l(new Date(e))})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Payment Type"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Email"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:n})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Charge ID"}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdContainer,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.chargeId,id:"md",children:t}),s.jsxRuntimeExports.jsx("div",{className:Ue.copyIcon,onClick:()=>o(t),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})]})]})},iy="_bottomSheet_1yai1_1",ay="_formContainer_1yai1_8",uy="_error_1yai1_14",cy="_buttonGroup_1yai1_18",ly="_buttonWrapper_1yai1_28",dy="_fullWidthButton_1yai1_31",hy="_modal_1yai1_41",my="_header_1yai1_48",Ft={bottomSheet:iy,formContainer:ay,error:uy,buttonGroup:cy,buttonWrapper:ly,fullWidthButton:dy,modal:hy,header:my},py=({chargeId:e,setIsOpen:t})=>{const[n,r]=k.useState(""),[o,i]=k.useState(""),{setIsOpen:a}=s.useModalStore(),u=m=>{try{return new URL(m),!0}catch{return!1}},l=async m=>{if(m.preventDefault(),!n){i("The link field cannot be empty.");return}if(!u(n)){i("Please enter a valid URL");return}await nl({url:n},e)&&(alert("CashApp successfully verified"),t(!1))},d=()=>{a(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ft.modal,onClick: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:l,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),i("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),o&&s.jsxRuntimeExports.jsx("p",{className:Ft.error,children:o})]})}),s.jsxRuntimeExports.jsxs("div",{className:Ft.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:d,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ft.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},fy="_container_1opbn_1",gy="_productDetails_1opbn_8",xy="_imageContainer_1opbn_14",Ey="_image_1opbn_14",by="_textContainer_1opbn_32",Iy="_header_1opbn_40",Ty="_title_1opbn_46",_y="_price_1opbn_53",Cy="_badgeContainer_1opbn_57",Sy="_description_1opbn_61",bt={container:fy,productDetails:gy,imageContainer:xy,image:Ey,textContainer:by,header:Iy,title:Ty,price:_y,badgeContainer:Cy,description:Sy},yy=({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})]}),ky="_card_69liy_1",Ry="_price_69liy_10",Ay="_interval_69liy_17",Ny="_name_69liy_22",wy="_description_69liy_28",Ly="_currentPlan_69liy_32",jy="_selectButton_69liy_45",vy="_progressSection_69liy_50",Py="_progressLabel_69liy_54",Dy="_bottomSheet_69liy_60",Oy="_title_69liy_69",By="_typeSelector_69liy_80",My="_typeOption_69liy_90",Fy="_active_69liy_100",Hy="_saveTag_69liy_108",Uy="_planSelector_69liy_117",$y="_modal_69liy_127",zy="_inactive_69liy_148",Wy="_notMounted_69liy_151",qy="_closeButton_69liy_157",Se={card:ky,price:Ry,interval:Ay,name:Ny,description:wy,currentPlan:Ly,selectButton:jy,progressSection:vy,progressLabel:Py,bottomSheet:Dy,title:Oy,typeSelector:By,typeOption:My,active:Fy,saveTag:Hy,planSelector:Uy,modal:$y,inactive:zy,notMounted:Wy,closeButton:qy},Vy=({variant:e,onSelect:t,isCurrent:n})=>{const r=e.subscriptionSettings.recurringIntervalDays===30?"month":e.subscriptionSettings.recurringIntervalDays===365?"year":"period",o=e.subscriptionSettings.price.amount.toFixed(2),i=e.subscriptionSettings.recurringIntervalDays,a=10;return s.jsxRuntimeExports.jsxs("div",{className:Se.card,onClick:t,children:[s.jsxRuntimeExports.jsxs("h2",{className:Se.price,children:["$",o," ",s.jsxRuntimeExports.jsxs("span",{className:Se.interval,children:["/ ",r]})]}),s.jsxRuntimeExports.jsx("h3",{className:Se.name,children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:Se.description,children:e.description}),n?s.jsxRuntimeExports.jsxs("div",{className:Se.currentPlan,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check"}),"Your current Plan"]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",className:Se.selectButton,children:"Select"}),n&&s.jsxRuntimeExports.jsxs("div",{className:Se.progressSection,children:[s.jsxRuntimeExports.jsx(xa,{percent:a/i*100,disablePercentLabel:!0}),s.jsxRuntimeExports.jsxs("p",{className:Se.progressLabel,children:["Used: ",a," of ",i," days"]})]})]})},Gy=({isOpen:e,setIsOpen:t,subscription:n})=>{const[r,o]=k.useState(null),[i,a]=k.useState(null),[u,l]=k.useState(null),{id:d,accessToken:m}=s.useParams(),[h,f]=k.useState(!1),[p,g]=k.useState(!1),{setIsOpen:x}=s.useModalStore();k.useEffect(()=>{e&&f(!0)},[e]);const C=()=>{t(!1)},[b,R]=k.useState(null);k.useEffect(()=>{d&&m&&(async()=>{if(d&&m){const{data:A}=await s.getSubscriptionUpgradePlans({id:d,accessToken:m});R(A)}})()},[d,m]),k.useEffect(()=>{var L;if(b!=null&&b.data.types[0]){const A=(L=b.data.types.flatMap(q=>q.productVariants).find(q=>q.data.id===(n==null?void 0:n.variantId)))==null?void 0:L.data;A&&(l(A),a(A))}},[b,n]),k.useEffect(()=>{b!=null&&b.data.types[0]&&o(b==null?void 0:b.data.types[0])},[b==null?void 0:b.data.types]);const S=L=>{o(L),a(null)},P=L=>{a(L),x(!0),g(!0)};return s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.modal,{[Se.active]:e,[Se.inactive]:!e&&h,[Se.notMounted]:!h}),onClick:L=>L.stopPropagation(),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:C,hoverable:!0,className:Se.closeButton,fill:"var(--text-primary)"}),s.jsxRuntimeExports.jsxs("div",{className:Se.bottomSheet,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Se.title,children:"Change Plan"}),s.jsxRuntimeExports.jsx("p",{className:Se.description,children:b==null?void 0:b.data.description}),s.jsxRuntimeExports.jsx("div",{className:Se.typeSelector,children:b==null?void 0:b.data.types.map(L=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.typeOption,{[Se.active]:(r==null?void 0:r.id)===L.id}),onClick:()=>S(L),children:[L.name,L.name==="Yearly"&&s.jsxRuntimeExports.jsx("span",{className:Se.saveTag,children:"Save %"})]},L.id))}),r&&s.jsxRuntimeExports.jsx("div",{className:Se.planSelector,children:r.productVariants.map(L=>s.jsxRuntimeExports.jsx(Vy,{variant:L.data,isSelected:(i==null?void 0:i.id)===L.data.id,isCurrent:(u==null?void 0:u.id)===L.data.id,onSelect:()=>P(L.data)},L.data.id))})]}),p&&i&&n&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>{g(!1)},children:s.jsxRuntimeExports.jsx(Bk,{setIsOpen:g,selectedVariant:i,subscription:n})})]})},Yy="_container_nb625_1",Xy="_title_nb625_11",Qy="_subtitle_nb625_16",Ky="_info_nb625_20",Br={container:Yy,title:Xy,subtitle:Qy,info:Ky},Zy=()=>{const{subscription:e}=s.useSubscriptionStore(),[t,n]=s.extractDateAndTime((e==null?void 0:e.activeTo)||""),[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Br.container,children:[s.jsxRuntimeExports.jsxs("div",{className:Br.info,children:[s.jsxRuntimeExports.jsx("p",{className:Br.title,children:"Expiration Date"}),s.jsxRuntimeExports.jsxs("p",{className:Br.subtitle,children:[t," at ",n]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:a=>{a.stopPropagation(),i(!0),o(!0)},children:"Extend"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(tR,{setIsOpen:o})})]})},Jy="_couponContainer_1sspa_1",ek="_iconWrapper_1sspa_10",tk="_details_1sspa_21",nk="_title_1sspa_25",rk="_progress_1sspa_29",sk="_foreverText_1sspa_34",fn={couponContainer:Jy,iconWrapper:ek,details:tk,title:nk,progress:rk,foreverText:sk},ok=({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(xa,{color:"#C2C2C2",percent:r,disablePercentLabel:!0})}),s.jsxRuntimeExports.jsx("p",{className:fn.foreverText,children:"Forever discount code"})]})]})},ik="_paymentMethodContainer_1g0da_4",ak="_paymentMethodTitle_1g0da_15",uk="_activeMethod_1g0da_20",ck="_noMethod_1g0da_28",lk="_activeMethodPaymentMethod_1g0da_37",dk="_paymentMethodLogo_1g0da_47",hk="_paymentMethodNumber_1g0da_57",mk="_method_1g0da_61",Wt={paymentMethodContainer:ik,paymentMethodTitle:ak,activeMethod:uk,noMethod:ck,activeMethodPaymentMethod:lk,paymentMethodLogo:dk,paymentMethodNumber:hk,method:mk},pk="_paymentMethods_1gev0_1",fk="_modal_1gev0_14",gk="_header_1gev0_28",xk="_content_1gev0_37",Jt={paymentMethods:pk,modal:fk,header:gk,content:xk},Ek=e=>{const{setIsLoading:t,setIsOpen:n}=e,{subscription:r,setSubscription:o}=s.useSubscriptionStore();if(!r)return null;const{id:i}=s.useParams(),a=s.useNavigate(),{notifications:u,setNotifications:l}=s.useNotificationStore(),{setPaymentMethod:d,setGateway:m,cart:h}=s.useCart(),{setIsOpen:f}=s.useModalStore();async function p(){if(g(),t(!0),i&&r){const{data:x}=await s.changeSubscriptionGateway(i,h.gateway);x.isReconnectPaymentNeeded?a(`/charges/${x.chargeId}`):(l([...u,{status:"success",id:s.v4(),message:"Your action has been successfully completed"}]),o({...r,gatewayName:h.gateway}))}else l([...u,{status:"error",id:s.v4(),message:"Your action has been failed. Try again!"}]);t(!1)}function g(){f(!1),setTimeout(()=>{n(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:Jt.modal,onClick:x=>{x.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:g,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Jt.content,children:[(r==null?void 0:r.availableGateways)&&s.jsxRuntimeExports.jsx(bc,{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:()=>a("/customer-dash")}),s.jsxRuntimeExports.jsxs("div",{className:Jt.paymentMethods,children:[s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,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"})})]})]})]})},bk="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",Ik=()=>{var g,x,C;const{subscription:e}=s.useSubscriptionStore(),{cart:t,setPaymentMethod:n}=s.useCart(),r=s.useNavigate(),[o,i]=k.useState(null),[a,u]=k.useState(!1),[l,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 R=await s.getGatewaysDetail(e.availableGateways);i(R)})()},[]),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(Tk,{gatewayInfo:e.gatewayInfo}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h==="Balance"&&s.jsxRuntimeExports.jsx(Ec,{gateway:h,gatewayDisplayName:h,total:(e==null?void 0:e.price.amount)||0,onSignInClick:()=>r("/customer-dash")}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&!h&&s.jsxRuntimeExports.jsx("span",{className:Wt.noMethod,children:"Payment method is not set"}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h&&s.jsxRuntimeExports.jsx("div",{className:Wt.activeMethod,children:o&&s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(g=o.find(b=>b.name===h))==null?void 0:g.logoCfImageId,gatewayDisplayName:(x=o.find(b=>b.name===h))==null?void 0:x.displayName,gateway:h,poweredByLogoCfId:(C=o.find(b=>b.name===h))==null?void 0:C.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"})]}),l&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>d(!1),children:s.jsxRuntimeExports.jsx(Ek,{setIsLoading:u,setIsOpen:d})})]})},Tk=({gatewayInfo:e})=>{var t,n,r,o,i;return s.jsxRuntimeExports.jsxs("div",{className:Wt.method,children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodLogo,children:[((t=e.card)==null?void 0:t.brand.toLowerCase())==="visa"&&s.jsxRuntimeExports.jsx(s.Visa,{}),((n=e.card)==null?void 0:n.brand.toLowerCase())==="mastercard"&&s.jsxRuntimeExports.jsx("img",{src:bk,alt:"",width:22}),((r=e.card)==null?void 0:r.brand.toLowerCase())!=="visa"&&((o=e.card)==null?void 0:o.brand.toLowerCase())!=="mastercard"&&s.jsxRuntimeExports.jsx(s.Icon,{name:"CreditCard",width:22})]}),s.jsxRuntimeExports.jsxs("p",{className:Wt.paymentMethodNumber,children:["•••• •••• •••• ",(i=e.card)==null?void 0:i.last4]})]})},_k="_subscriptionProductContainer_83ibx_4",Ck="_subscriptionProductImage_83ibx_15",Sk="_subscriptionProductInfo_83ibx_32",yk="_name_83ibx_37",kk="_price_83ibx_40",Vn={subscriptionProductContainer:_k,subscriptionProductImage:Ck,subscriptionProductInfo:Sk,name:yk,price:kk},Rk=({subscription:e,id:t,accessToken:n})=>{const[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Vn.subscriptionProductContainer,onClick:a=>a.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:a=>{a.preventDefault(),o(!0),i(!0)},children:"Cancel"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(pR,{accessToken:n,id:t,isOpen:r,setIsOpen:o})})]})},Ak="_content_5ctxw_1",Nk="_selectedPlan_5ctxw_37",wk="_planName_5ctxw_44",Lk="_description_5ctxw_48",jk="_price_5ctxw_51",vk="_buttonGroup_5ctxw_79",Pk="_buttonWrapper_5ctxw_84",Dk="_modal_5ctxw_88",Ok="_header_5ctxw_95",ct={content:Ak,selectedPlan:Nk,planName:wk,description:Lk,price:jk,buttonGroup:vk,buttonWrapper:Pk,modal:Dk,header:Ok},Bk=({setIsOpen:e,selectedVariant:t,subscription:n})=>{if(!t)return null;const{setIsOpen:r}=s.useModalStore(),o=()=>{i()},i=()=>{r(!1),setTimeout(()=>{e(!1)},300)},a=(t.subscriptionSettings.compareAtPrice||t.subscriptionSettings.price).amount,u=t.subscriptionSettings.compareAtPrice?t.subscriptionSettings.compareAtPrice.amount-t.subscriptionSettings.price.amount:t.subscriptionSettings.price.amount,l=a-u,d=new Intl.NumberFormat("en-US",{style:"currency",currency:n.price.currency});return s.jsxRuntimeExports.jsxs("div",{className:ct.modal,children:[s.jsxRuntimeExports.jsxs("div",{className:ct.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:()=>i(),fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:ct.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:ct.content,children:[s.jsxRuntimeExports.jsxs("div",{className:ct.selectedPlan,children:[s.jsxRuntimeExports.jsx("h2",{className:ct.planName,children:t.name}),s.jsxRuntimeExports.jsx("p",{className:ct.description,children:t.description}),s.jsxRuntimeExports.jsxs("p",{className:ct.price,children:["$",t.subscriptionSettings.price.amount.toFixed(2)," /"," ",t.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),s.jsxRuntimeExports.jsx(dr,{formatter:d,coupon:null,total:l,discount:u})]}),s.jsxRuntimeExports.jsxs("div",{className:ct.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:ct.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>i(),children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:ct.buttonWrapper,children:s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Primary",onClick:o,children:["Upgrade for $",l.toFixed(2)]})})]})]})]})},Mk="_reviewMessage_1t8u4_1",Fk="_leaveReviewContainer_1t8u4_11",Hk="_leaveReviewTitle_1t8u4_20",zs={reviewMessage:Mk,leaveReviewContainer:Fk,leaveReviewTitle:Hk},Uk=({review:e,orderId:t,className:n})=>{const[r,o]=k.useState((e==null?void 0:e.rating)||0),[i,a]=k.useState(!1),{setIsOpen:u}=s.useModalStore(),{notifications:l,setNotifications:d}=s.useNotificationStore(),m=async h=>{e&&"accessToken"in e&&(await il({comment:h,rating:r},t,e.accessToken),d([...l,{status:"success",id:s.v4(),message:"Review left successfully"}]),a(!1))};return k.useEffect(()=>{e&&r&&"accessToken"in e&&!e.rating&&(u(!0),a(!0))},[r]),e?e.rating&&"accessToken"in e?s.jsxRuntimeExports.jsxs("div",{className: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:o,disabled:!!e.rating||!("accessToken"in e)}),i&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>a(!1),children:s.jsxRuntimeExports.jsx(Xk,{setIsOpen:a,onSubmit:m})})]}):null},$k="_bottomSheet_1bcyj_1",zk="_content_1bcyj_7",Wk="_title_1bcyj_18",qk="_buttonGroup_1bcyj_22",Vk="_buttonWrapper_1bcyj_33",Gk="_modal_1bcyj_37",Yk="_header_1bcyj_44",Ht={bottomSheet:$k,content:zk,title:Wk,buttonGroup:qk,buttonWrapper:Vk,modal:Gk,header:Yk},Xk=({setIsOpen:e,onSubmit:t})=>{const[n,r]=k.useState(""),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ht.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ht.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ht.title,children:"Review Description"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Ht.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.content,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{placeholder:"Great product and fast checkout...",value:n,onChange:a=>r(a),label:"Describe your review in detail below"})}),s.jsxRuntimeExports.jsxs("div",{className:Ht.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!n,onClick:()=>{i(),t(n)},children:"Submit"})})]})]})]})},Qk="_container_1idhv_1",Kk="_buttonGroup_1idhv_8",Zk="_buttonWrapper_1idhv_15",Jk="_header_1idhv_19",eR="_content_1idhv_28",en={container:Qk,buttonGroup:Kk,buttonWrapper:Zk,header:Jk,content:eR},tR=({setIsOpen:e})=>{const{subscription:t}=s.useSubscriptionStore(),{getTotalAndDiscount:n,cart:r,coupon:o}=s.useCart(),[i,a]=k.useState(1),u=s.useNavigate(),{setIsOpen:l}=s.useModalStore(),{setNotifications:d,notifications:m}=s.useNotificationStore(),[h,f]=k.useState(!1),p=k.useMemo(()=>n(),[o,r]),g=k.useMemo(()=>p.totalWithDiscount?p.total-p.totalWithDiscount:0,[p]);if(h)return s.jsxRuntimeExports.jsx(s.ProcessingPaymentModal,{});const x=(t==null?void 0:t.price.currency)||"USD",C=new Intl.NumberFormat("en-US",{style:"currency",currency:x});async function b(){var S;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/${(S=P.data)==null?void 0:S.id}/${P.data.fullAccessToken}`)}catch(P){const L=P;d([...m,{id:s.v4(),message:`Order creation failed: ${L.message}`,status:"error"}]),R()}finally{f(!1)}}function R(){l(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:en.container,onClick:S=>S.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:R,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:en.content,children:[s.jsxRuntimeExports.jsx(Zf,{step:i,totalSteps:12,onStepChange:a,label:"How long would you like to extend your subscription for?"}),s.jsxRuntimeExports.jsx(dr,{formatter:C,coupon:o,total:p.total,discount:g,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:R,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:b,children:"Extend"})})]})]})]})},nR="_bottomSheet_uw5jb_1",rR="_content_uw5jb_7",sR="_radioGroup_uw5jb_11",oR="_confirmation_uw5jb_26",iR="_iconWrapper_uw5jb_33",aR="_title_uw5jb_42",uR="_message_uw5jb_48",cR="_buttonGroup_uw5jb_54",lR="_buttonWrapper_uw5jb_64",dR="_modal_uw5jb_68",hR="_header_uw5jb_77",je={bottomSheet:nR,content:rR,radioGroup:sR,confirmation:oR,iconWrapper:iR,title:aR,message:uR,buttonGroup:cR,buttonWrapper:lR,modal:dR,header:hR},mR={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},pR=({isOpen:e,setIsOpen:t,id:n,accessToken:r})=>{const[o,i]=k.useState(0),[a,u]=k.useState(!1),[l,d]=k.useState(""),[m,h]=k.useState(""),{setIsOpen:f}=s.useModalStore(),p=async()=>{if(!l)return;u(!0);const x=await s.cancelSubscription(n,r,{reason:l==="Other reason"?m:l});u(!1),x&&i(2)};k.useEffect(()=>{e||(i(0),d(""),h(""))},[e]);const g=()=>{f(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:je.modal,onClick:x=>x.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:mR[o]||""}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:g,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:je.content,children:[o===0&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),s.jsxRuntimeExports.jsxs("div",{className:je.radioGroup,children:[s.jsxRuntimeExports.jsx(s.Radio,{defaultValue:l,onChange:x=>d(x),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"}),l==="Other reason"&&s.jsxRuntimeExports.jsx(s.Textarea$1,{value:m,onChange:x=>h(x),placeholder:"Describe the reason..."})]}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:()=>l&&i(1),disabled:!l,children:"Continue"})})]})]}),o===1&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:p,disabled:a,children:"Cancel it anyway"})})]})]}),o===2&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:`${je.confirmation}`,children:[s.jsxRuntimeExports.jsx("div",{className:je.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"})}),s.jsxRuntimeExports.jsx("p",{className:je.title,children:"Subscription Cancelled"}),s.jsxRuntimeExports.jsx("p",{className:je.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),s.jsxRuntimeExports.jsx("div",{className:je.buttonGroup,children:s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:g,children:"Close"})})})]})]})]})},fR="_checkoutContainer_wkomn_1",gR="_loaderContainer_wkomn_20",Ws={checkoutContainer:fR,loaderContainer:gR},xR=()=>{const{cart:e,products:t,pending:n,getTotalAndDiscount:r,getPossibleGateways:o,submitCart:i,setGateway:a,applyCoupon:u,setDiscordSocialConnectId:l,setCustomFields:d,applyCouponPending:m,coupon:h,removeCoupon:f,getDiscordSettings:p,setPaymentMethod:g,reset:x}=s.useCart(),C=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(NS,{cart:e,products:t,applyCoupon:u,applyCouponPending:m,coupon:h,removeCoupon:f,totalAndDiscount:C}),s.jsxRuntimeExports.jsx(m3,{cart:e,getPossibleGateways:o,setGateway:a,getDiscordSettings:p,products:t,submitCart:i,totalAndDiscount:C,setCustomFieldsToCart:d,setDiscordSocialConnectId:l,setPaymentMethod:g,reset:x})]})},ER="_chargePageContainer_1a200_1",bR="_chargeItems_1a200_14",IR="_mainContent_1a200_25",TR="_contentWrapper_1a200_36",_R="_statusBlock_1a200_41",CR="_notPaidSection_1a200_45",SR="_footer_1a200_53",yR="_loaderContainer_1a200_63",Ut={chargePageContainer:ER,chargeItems:bR,mainContent:IR,contentWrapper:TR,statusBlock:_R,notPaidSection:CR,footer:SR,loaderContainer:yR},kR=()=>{const{id:e}=s.useParams(),[t,n]=s.useSearchParams(),[r,o]=k.useState(!1),[i,a]=k.useState(),[u,l]=k.useState(!0),d=s.useNavigate(),m=k.useRef(),{setIsOpen:h}=s.useModalStore();return k.useEffect(()=>{const f=async(g,x=!1)=>{x||o(!0);const{data:C}=await al(g);o(!1),a(C)},p=setInterval(()=>{e&&f(e,!0)},5e3);return e&&f(e),()=>{clearInterval(p)}},[]),k.useEffect(()=>{const f=setTimeout(()=>{console.log("charge timeout",i);const p=t.get("redirectRoute");(i==null?void 0:i.status)===s.ChargeStatus.Paid&&i.redirectUrl&&!m.current&&window.open(i.redirectUrl,"_self"),(i==null?void 0:i.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)},[i]),k.useEffect(()=>{((i==null?void 0:i.gateway)==="PayPalFF"||(i==null?void 0:i.gateway)==="Сashapp")&&h(!0)},[i]),r?s.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:Ut.chargePageContainer,children:[s.jsxRuntimeExports.jsx("div",{className:Ut.chargeItems,children:s.jsxRuntimeExports.jsx(K3,{charge:i})}),s.jsxRuntimeExports.jsx("div",{className:Ut.mainContent,children:s.jsxRuntimeExports.jsxs("div",{className:Ut.contentWrapper,children:[i&&(i==null?void 0:i.status)!==s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx(s.ChargeStatusBlock,{charge:i}),i&&s.jsxRuntimeExports.jsx("div",{className:`${Ut.statusBlock}`,children:s.jsxRuntimeExports.jsx(Tc,{lastUpdate:i.expiresAt,email:i.customerForCharge.email,invoiceId:i.id,paymentType:i.gateway})}),(i==null?void 0:i.status)===s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx("div",{className:Ut.notPaidSection,children:i==null?void 0:i.displayPaymentInfo.map((f,p)=>s.jsxRuntimeExports.jsx(Ic,{block:f},p))}),s.jsxRuntimeExports.jsx(vt,{className:Ut.footer})]})}),(i==null?void 0:i.gateway)==="PayPalFF"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>l(!1),children:s.jsxRuntimeExports.jsx(H3,{price:i.price,setIsOpen:l})}),(i==null?void 0:i.gateway)==="Сashapp"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(py,{setIsOpen:l,chargeId:i.id})})]})},RR="_wrapper_1fax2_1",AR="_title_1fax2_20",NR="_container_1fax2_26",wR="_content_1fax2_36",LR="_messages_1fax2_46",jR="_input_1fax2_58",vR="_textarea_1fax2_64",PR="_message_1fax2_46",DR="_messageDate_1fax2_88",OR="_myMessage_1fax2_94",BR="_otherMessage_1fax2_101",MR="_button_1fax2_108",FR="_loadingMessage_1fax2_117",$e={wrapper:RR,title:AR,container:NR,content:wR,messages:LR,input:jR,textarea:vR,message:PR,messageDate:DR,myMessage:OR,otherMessage:BR,button:MR,loadingMessage:FR},HR=()=>{const e=window.location.pathname.split("/"),t=e[e.length-1],n=e[e.length-2],[r,o]=k.useState(!0),[i,a]=k.useState(null),[u,l]=k.useState(""),[d,m]=k.useState(null),{executeRecaptcha:h}=s.useReCaptcha(),f=async()=>{if(n&&t){const{data:x}=await s.fetchTicket(n,t);a(x),o(!1)}};k.useEffect(()=>{f();const x=setInterval(()=>{f()},5e3);return()=>clearInterval(x)},[]);const p=async()=>{const x=await h();if(!n||!t||!x||!u.trim())return;const C={content:u,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};a(b=>b?{...b,messages:[...b.messages,C]}:null),m(C.id),l("");try{await s.sendTicketMessage(n,t,u,x),await f()}finally{setTimeout(()=>{m(null)},1e4)}},g=x=>{const C=new Date,b=new Date(x),R=Math.floor((C.getTime()-b.getTime())/1e3);if(R<60)return"right now";if(R<3600){const S=Math.floor(R/60);return`${S} minute${S>1?"s":""} ago`}else if(R<10800){const S=Math.floor(R/3600);return`${S} hour${S>1?"s":""} ago`}else return b.getFullYear()===C.getFullYear()?b.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):b.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return s.jsxRuntimeExports.jsx("div",{className:$e.wrapper,children:r&&!i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs("div",{className:$e.container,children:[s.jsxRuntimeExports.jsx("div",{className:$e.title,children:`#${n} (${i==null?void 0:i.title})`}),s.jsxRuntimeExports.jsxs("div",{className:$e.content,children:[s.jsxRuntimeExports.jsx("div",{className:$e.messages,children:i==null?void 0:i.messages.sort((x,C)=>new Date(x.createdAt).getTime()-new Date(C.createdAt).getTime()).map(x=>s.jsxRuntimeExports.jsxs("div",{className:s.clx($e.message,{[$e.myMessage]:!x.isSellerReply,[$e.otherMessage]:x.isSellerReply,[$e.loadingMessage]:d===x.id}),children:[s.jsxRuntimeExports.jsx("div",{className:$e.messageContent,children:s.splitTextIntoSpans(x.content,!1)}),d!==x.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:g(x.createdAt)}),d===x.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:s.jsxRuntimeExports.jsx(s.Loader,{})})]},x.id))}),s.jsxRuntimeExports.jsxs("div",{className:$e.input,children:[s.jsxRuntimeExports.jsx("textarea",{className:$e.textarea,value:u,placeholder:"What worries you?",onChange:x=>l(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.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"})})]})]})]})})},UR="_subscriptionContainer_1j6ol_1",$R="_leftSection_1j6ol_15",zR="_content_1j6ol_26",WR="_mainContent_1j6ol_33",qR="_detailsSection_1j6ol_37",VR="_buttonGroup_1j6ol_50",GR="_detailsContent_1j6ol_57",tn={subscriptionContainer:UR,leftSection:$R,content:zR,mainContent:WR,detailsSection:qR,buttonGroup:VR,detailsContent:GR},YR=()=>{const{id:e,accessToken:t}=s.useParams(),{subscription:n,setSubscription:r}=s.useSubscriptionStore(),{setIsOpen:o}=s.useModalStore(),[i,a]=k.useState(!1),[u,l]=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;l(!0);const{data:f}=await s.fetchSubscription(e,t);r({...f}),l(!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(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:tn.mainContent,children:[n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),s.jsxRuntimeExports.jsx(yy,{subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),s.jsxRuntimeExports.jsx("div",{className:tn.buttonGroup,children:n.pricingPlanExists&&s.jsxRuntimeExports.jsx(s.Button$1,{onClick:h=>{h.stopPropagation(),o(!0),a(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),s.jsxRuntimeExports.jsx(vt,{})]})]})}),s.jsxRuntimeExports.jsx("div",{className:tn.detailsSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.detailsContent,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(n==null?void 0:n.coupon)&&s.jsxRuntimeExports.jsx(ok,{coupon:n.coupon,currency:n.price.currency||"USD"}),n&&s.jsxRuntimeExports.jsx(Rk,{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(Ik,{}),n.activeTo&&s.jsxRuntimeExports.jsx(Zy,{})]}),s.jsxRuntimeExports.jsx(vt,{className:"flex md:hidden"})]})})]}),s.jsxRuntimeExports.jsx(Gy,{isOpen:i,setIsOpen:a,subscription:n})]})},XR="_topUpContainer_1pag6_1",QR="_formWrapper_1pag6_15",KR="_header_1pag6_29",ZR="_footer_1pag6_82",JR="_wrapper_1pag6_105",Gn={topUpContainer:XR,formWrapper:QR,header:KR,footer:ZR,wrapper:JR},eA=()=>{const{gatewaysDetail:e,setGatewaysDetail:t,balanceSettings:n,setBalanceSettings:r}=s.useCustomerDashboardStore();return k.useEffect(()=>{!e&&n&&(async()=>{const i=await s.getGatewaysDetail(n!=null&&n.isEnabled?(n==null?void 0:n.topUpSettings.gateways)||[]:[]);t(i)})()},[e,n]),k.useEffect(()=>{n||(async()=>{const i=await s.getBalanceSettings();r(i)})()},[n]),s.jsxRuntimeExports.jsxs("div",{className:Gn.wrapper,children:[s.jsxRuntimeExports.jsx(lr,{className:Gn.header}),s.jsxRuntimeExports.jsx("div",{className:Gn.topUpContainer,children:n?s.jsxRuntimeExports.jsx("div",{className:Gn.formWrapper,children:s.jsxRuntimeExports.jsx(s.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):s.jsxRuntimeExports.jsx(s.Loader,{})}),s.jsxRuntimeExports.jsx("div",{className:Gn.footer,children:s.jsxRuntimeExports.jsx(vt,{})})]})},tA="_orderPage_1nvve_1",nA="_leftSection_1nvve_15",rA="_content_1nvve_35",sA="_main_1nvve_42",oA="_statusBlock_1nvve_54",iA="_timelineBlock_1nvve_58",aA="_footer_1nvve_62",uA="_rightSection_1nvve_71",cA="_header_1nvve_84",lA="_productList_1nvve_92",dA="_mobileFooter_1nvve_99",hA="_loaderContainer_1nvve_108",mA="_orderMainData_1nvve_116",pA="_prices_1nvve_123",fA="_headerTitle_1nvve_127",gA="_headerDescription_1nvve_131",De={orderPage:tA,leftSection:nA,content:rA,main:sA,statusBlock:oA,timelineBlock:iA,footer:aA,rightSection:uA,header:cA,productList:lA,mobileFooter:dA,loaderContainer:hA,orderMainData:mA,prices:pA,headerTitle:fA,headerDescription:gA},xA=()=>{var h,f,p;const{id:e,accessToken:t}=s.useParams(),n=s.useNavigate(),[r,o]=k.useState(),[i,a]=k.useState(!1),u=s.useCopy(),l=((h=r==null?void 0:r.rawPrice)==null?void 0:h.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:l}),m=k.useMemo(()=>(r==null?void 0:r.partOrders.map(g=>{var x,C,b,R;return{id:(g==null?void 0:g.id)||0,image:g.productWithVariant.image,name:((x=g.productWithVariant)==null?void 0:x.name)||"",description:((C=g.productWithVariant)==null?void 0:C.description)||"",price:{quantity:g.quantity,amount:((b=g.productWithVariant)==null?void 0:b.price.amount)||0,currency:(R=g.productWithVariant)==null?void 0:R.price.currency},deliveryCategories:"deliveryCategories"in g?g.deliveryCategories:void 0,customerNote:g.customerNote,chargeType:g.chargeType||"ONE_TIME"}}))||[],[r]);return k.useLayoutEffect(()=>{if(e&&!t){const g=JSON.parse(localStorage.getItem("orders")||"{}");g[e]&&n(`/orders/${e}/${g[e].fullAccessToken}`)}},[e]),k.useEffect(()=>{const g=async(C,b=!1)=>{b||a(!0);const{data:R}=await(t?s.fetchAuthorizedOrder(`${C}/${t}`):s.fetchOrder(C));a(!1),R.charge.status===s.ChargeStatus.NotPaid&&n(`/charges/${R.charge.id}`,{replace:!0}),o(R)};e&&g(e);const x=setInterval(()=>{e&&g(e,!0)},5e3);return()=>{clearInterval(x)}},[]),i?s.jsxRuntimeExports.jsx("div",{className:De.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:De.orderPage,children:[s.jsxRuntimeExports.jsx("div",{className:De.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[s.jsxRuntimeExports.jsx(lr,{}),r&&s.jsxRuntimeExports.jsxs("div",{className:De.main,children:[s.jsxRuntimeExports.jsx(s.OrderStatusBlock,{className:De.statusBlock,orderStatus:r.status}),s.jsxRuntimeExports.jsxs("div",{className:De.orderMainData,children:[s.jsxRuntimeExports.jsx(Tc,{lastUpdate:r.createdAt,paymentType:r.charge.gateway,email:r.charge.customerForCharge.email,invoiceId:r.charge.id}),"accessToken"in r.review&&s.jsxRuntimeExports.jsx(Uk,{orderId:r.id,review:r.review})]}),r.charge&&s.jsxRuntimeExports.jsx(s.TrackPayment,{className:De.timelineBlock,timeline:r.charge.timeline}),s.jsxRuntimeExports.jsx(vt,{className:De.footer})]})]})}),s.jsxRuntimeExports.jsx("div",{className:De.rightSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[(r==null?void 0:r.charge.name)&&s.jsxRuntimeExports.jsxs("header",{className:De.header,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:De.headerTitle,children:r.charge.name}),r.charge.description&&s.jsxRuntimeExports.jsx("p",{className:De.headerDescription,children:r.charge.description})]}),s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",onClick:()=>u((r==null?void 0:r.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),s.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:De.productList,children:m.map(g=>s.jsxRuntimeExports.jsx(Do,{product:g,isOrder:!0},g.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:De.prices,isShowSubtotal:!1}),s.jsxRuntimeExports.jsx(vt,{className:De.mobileFooter})]})]})})]})},EA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState();n(t.filter(r=>r.id!==e))},bA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState(),r=s.v4();return n([...t,{id:r,...e}]),r},IA=e=>{const{blocks:t,settings:n,header:r,footer:o,announcement:i,routes:a=[]}=e,[u,l]=k.useState(null),{general:d}=s.useGeneralStore(),{setBlocks:m,setSourceBlocks:h,setHeader:f,setFooter:p,setAnnouncement:g,setSettings:x}=s.useBlocksStore(),{setHeader:C,setFooter:b,setAnnouncement:R}=s.useLayersStore(),{themeSettings:S}=s.useThemeSettingsStore(),{settings:P,setSettings:L}=s.useSettingsStore(),A=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,q=localStorage.getItem("shopPassword"),V=localStorage.getItem("shopId")||"";return k.useEffect(()=>{V||localStorage.setItem("shopId",(d==null?void 0:d.info.id)||"")},[d]),k.useEffect(()=>{if(S&&P){const K=hl(S,P);El(S),ml(K)}},[S,P,window.location.hostname]),k.useEffect(()=>{const K={};Object.keys(t).map(Q=>{K[Q]=t[Q]}),h(K),m(K),f(r),p(o),g(i),x(n);const w=new r,$=JSON.parse(JSON.stringify(w));C($,!1);const B=new o,H=JSON.parse(JSON.stringify(B));b(H,!1);const G=new i,z=JSON.parse(JSON.stringify(G));R(z,!1);const X=new n,Y=JSON.parse(JSON.stringify(X));L(Y);const W=s.createBrowserRouter([{element:s.jsxRuntimeExports.jsx(uf,{shopDomain:A,shopId:V,shopPassword:q||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:o,announcement:i})}),errorElement:s.jsxRuntimeExports.jsx(Fp,{})},...a,{path:"/checkout",element:s.jsxRuntimeExports.jsx(xR,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:s.jsxRuntimeExports.jsx(eA,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:s.jsxRuntimeExports.jsx(kR,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(xA,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(YR,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),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(At,{}),loader:()=>(document.title="Customer Dashboard",!0)},{path:"/validation",element:s.jsxRuntimeExports.jsx(Xp,{}),errorElement:s.jsxRuntimeExports.jsx(At,{}),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(HR,{})})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(At,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:s.jsxRuntimeExports.jsx(dl,{}),errorElement:s.jsxRuntimeExports.jsx(At,{})}]}]);l(W)},[d]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:u&&s.jsxRuntimeExports.jsx(s.RouterProvider,{router:u})})};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=IA;exports.ColorVariables=da;exports.hotReload=bl;exports.iconNames=Cc;exports.removeNotification=EA;exports.showNotification=bA;exports.useBuilderPages=Tl;exports.useCreateTicket=Il;
@@ -27122,6 +27122,7 @@ const Ui = ({ isOrder: e, product: t }) => {
27122
27122
  ) }),
27123
27123
  errorElement: /* @__PURE__ */ s.jsx(r2, {})
27124
27124
  },
27125
+ ...i,
27125
27126
  {
27126
27127
  path: "/checkout",
27127
27128
  element: /* @__PURE__ */ s.jsx(O6, {}),
@@ -27231,8 +27232,7 @@ const Ui = ({ isOrder: e, product: t }) => {
27231
27232
  path: "*",
27232
27233
  element: /* @__PURE__ */ s.jsx(v0, {}),
27233
27234
  errorElement: /* @__PURE__ */ s.jsx(Xt, {})
27234
- },
27235
- ...i
27235
+ }
27236
27236
  ]
27237
27237
  }
27238
27238
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@billgangcom/theme-lib",
3
- "version": "1.76.0",
3
+ "version": "1.76.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"