@billgangcom/theme-lib 1.105.0 → 1.106.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder.cjs.js +4 -4
- package/dist/builder.es.js +866 -837
- package/dist/{index-C-gzIzcy.js → index-D5nvpvqe.js} +4 -2
- package/dist/{index-CGYkmUYN.cjs → index-DvKlS7S2.cjs} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/storefront/components/CheckoutPrices/index.d.ts +1 -0
- package/dist/storefront/models/balance.d.ts +5 -0
- package/dist/storefront/store/useCartStore.d.ts +11 -1
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +2 -2
- package/package.json +1 -1
|
@@ -12428,7 +12428,8 @@ const li = st((e) => ({
|
|
|
12428
12428
|
applyCouponPending: !1,
|
|
12429
12429
|
customerEmail: mo ? mo.email : "",
|
|
12430
12430
|
recaptcha: "",
|
|
12431
|
-
|
|
12431
|
+
priceAdjustment: null,
|
|
12432
|
+
serviceFee: null,
|
|
12432
12433
|
setCart: (t) => e((n) => ({
|
|
12433
12434
|
cart: typeof t == "function" ? t(n.cart) : t
|
|
12434
12435
|
})),
|
|
@@ -12440,7 +12441,8 @@ const li = st((e) => ({
|
|
|
12440
12441
|
setPending: (t) => e({ pending: t }),
|
|
12441
12442
|
setApplyCouponPending: (t) => e({ applyCouponPending: t }),
|
|
12442
12443
|
setCustomerEmail: (t) => e({ customerEmail: t }),
|
|
12443
|
-
setPriceAdjustment: (t) => e({
|
|
12444
|
+
setPriceAdjustment: (t) => e({ priceAdjustment: t }),
|
|
12445
|
+
setServiceFee: (t) => e({ serviceFee: t })
|
|
12444
12446
|
})), Ki = st((e) => ({
|
|
12445
12447
|
page: 1,
|
|
12446
12448
|
setPage: (t) => e(() => ({ page: t })),
|
|
@@ -66,7 +66,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
66
66
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[b1]=this[b1]={accessors:{}}).accessors,i=this.prototype;function a(u){const s=Ji(u);r[s]||(qC(i,u),r[s]=!0)}return Y.isArray(t)?t.forEach(a):a(t),this}};Bn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Y.reduceDescriptors(Bn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});Y.freezeMethods(Bn);function Cc(e,t){const n=this||Ya,r=t||n,i=Bn.from(r.headers);let a=r.data;return Y.forEach(e,function(s){a=s.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function $p(e){return!!(e&&e.__CANCEL__)}function Di(e,t,n){je.call(this,e??"canceled",je.ERR_CANCELED,t,n),this.name="CanceledError"}Y.inherits(Di,je,{__CANCEL__:!0});function qp(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new je("Request failed with status code "+n.status,[je.ERR_BAD_REQUEST,je.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function WC(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function GC(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,a=0,u;return t=t!==void 0?t:1e3,function(c){const l=Date.now(),f=r[a];u||(u=l),n[i]=c,r[i]=l;let h=a,g=0;for(;h!==i;)g+=n[h++],h=h%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),l-u<t)return;const m=f&&l-f;return m?Math.round(g*1e3/m):void 0}}function ZC(e,t){let n=0,r=1e3/t,i,a;const u=(l,f=Date.now())=>{n=f,i=null,a&&(clearTimeout(a),a=null),e.apply(null,l)};return[(...l)=>{const f=Date.now(),h=f-n;h>=r?u(l,f):(i=l,a||(a=setTimeout(()=>{a=null,u(i)},r-h)))},()=>i&&u(i)]}const ss=(e,t,n=3)=>{let r=0;const i=GC(50,250);return ZC(a=>{const u=a.loaded,s=a.lengthComputable?a.total:void 0,c=u-r,l=i(c),f=u<=s;r=u;const h={loaded:u,total:s,progress:s?u/s:void 0,bytes:c,rate:l||void 0,estimated:l&&s&&f?(s-u)/l:void 0,event:a,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(h)},n)},C1=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},I1=e=>(...t)=>Y.asap(()=>e(...t)),YC=En.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,En.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(En.origin),En.navigator&&/(msie|trident)/i.test(En.navigator.userAgent)):()=>!0,XC=En.hasStandardBrowserEnv?{write(e,t,n,r,i,a){const u=[e+"="+encodeURIComponent(t)];Y.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),Y.isString(r)&&u.push("path="+r),Y.isString(i)&&u.push("domain="+i),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function KC(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function JC(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Wp(e,t,n){let r=!KC(t);return e&&r||n==!1?JC(e,t):t}const y1=e=>e instanceof Bn?{...e}:e;function Go(e,t){t=t||{};const n={};function r(l,f,h,g){return Y.isPlainObject(l)&&Y.isPlainObject(f)?Y.merge.call({caseless:g},l,f):Y.isPlainObject(f)?Y.merge({},f):Y.isArray(f)?f.slice():f}function i(l,f,h,g){if(Y.isUndefined(f)){if(!Y.isUndefined(l))return r(void 0,l,h,g)}else return r(l,f,h,g)}function a(l,f){if(!Y.isUndefined(f))return r(void 0,f)}function u(l,f){if(Y.isUndefined(f)){if(!Y.isUndefined(l))return r(void 0,l)}else return r(void 0,f)}function s(l,f,h){if(h in t)return r(l,f);if(h in e)return r(void 0,l)}const c={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:s,headers:(l,f,h)=>i(y1(l),y1(f),h,!0)};return Y.forEach(Object.keys(Object.assign({},e,t)),function(f){const h=c[f]||i,g=h(e[f],t[f],f);Y.isUndefined(g)&&h!==s||(n[f]=g)}),n}const Gp=e=>{const t=Go({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:a,headers:u,auth:s}=t;t.headers=u=Bn.from(u),t.url=Up(Wp(t.baseURL,t.url),e.params,e.paramsSerializer),s&&u.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let c;if(Y.isFormData(n)){if(En.hasStandardBrowserEnv||En.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((c=u.getContentType())!==!1){const[l,...f]=c?c.split(";").map(h=>h.trim()).filter(Boolean):[];u.setContentType([l||"multipart/form-data",...f].join("; "))}}if(En.hasStandardBrowserEnv&&(r&&Y.isFunction(r)&&(r=r(t)),r||r!==!1&&YC(t.url))){const l=i&&a&&XC.read(a);l&&u.set(i,l)}return t},QC=typeof XMLHttpRequest<"u",eI=QC&&function(e){return new Promise(function(n,r){const i=Gp(e);let a=i.data;const u=Bn.from(i.headers).normalize();let{responseType:s,onUploadProgress:c,onDownloadProgress:l}=i,f,h,g,m,b;function C(){m&&m(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(f),i.signal&&i.signal.removeEventListener("abort",f)}let I=new XMLHttpRequest;I.open(i.method.toUpperCase(),i.url,!0),I.timeout=i.timeout;function E(){if(!I)return;const S=Bn.from("getAllResponseHeaders"in I&&I.getAllResponseHeaders()),_={data:!s||s==="text"||s==="json"?I.responseText:I.response,status:I.status,statusText:I.statusText,headers:S,config:e,request:I};qp(function(x){n(x),C()},function(x){r(x),C()},_),I=null}"onloadend"in I?I.onloadend=E:I.onreadystatechange=function(){!I||I.readyState!==4||I.status===0&&!(I.responseURL&&I.responseURL.indexOf("file:")===0)||setTimeout(E)},I.onabort=function(){I&&(r(new je("Request aborted",je.ECONNABORTED,e,I)),I=null)},I.onerror=function(){r(new je("Network Error",je.ERR_NETWORK,e,I)),I=null},I.ontimeout=function(){let T=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const _=i.transitional||Vp;i.timeoutErrorMessage&&(T=i.timeoutErrorMessage),r(new je(T,_.clarifyTimeoutError?je.ETIMEDOUT:je.ECONNABORTED,e,I)),I=null},a===void 0&&u.setContentType(null),"setRequestHeader"in I&&Y.forEach(u.toJSON(),function(T,_){I.setRequestHeader(_,T)}),Y.isUndefined(i.withCredentials)||(I.withCredentials=!!i.withCredentials),s&&s!=="json"&&(I.responseType=i.responseType),l&&([g,b]=ss(l,!0),I.addEventListener("progress",g)),c&&I.upload&&([h,m]=ss(c),I.upload.addEventListener("progress",h),I.upload.addEventListener("loadend",m)),(i.cancelToken||i.signal)&&(f=S=>{I&&(r(!S||S.type?new Di(null,e,I):S),I.abort(),I=null)},i.cancelToken&&i.cancelToken.subscribe(f),i.signal&&(i.signal.aborted?f():i.signal.addEventListener("abort",f)));const y=WC(i.url);if(y&&En.protocols.indexOf(y)===-1){r(new je("Unsupported protocol "+y+":",je.ERR_BAD_REQUEST,e));return}I.send(a||null)})},tI=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const a=function(l){if(!i){i=!0,s();const f=l instanceof Error?l:this.reason;r.abort(f instanceof je?f:new Di(f instanceof Error?f.message:f))}};let u=t&&setTimeout(()=>{u=null,a(new je(`timeout ${t} of ms exceeded`,je.ETIMEDOUT))},t);const s=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(a):l.removeEventListener("abort",a)}),e=null)};e.forEach(l=>l.addEventListener("abort",a));const{signal:c}=r;return c.unsubscribe=()=>Y.asap(s),c}},nI=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},rI=async function*(e,t){for await(const n of oI(e))yield*nI(n,t)},oI=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},E1=(e,t,n,r)=>{const i=rI(e,t);let a=0,u,s=c=>{u||(u=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:l,value:f}=await i.next();if(l){s(),c.close();return}let h=f.byteLength;if(n){let g=a+=h;n(g)}c.enqueue(new Uint8Array(f))}catch(l){throw s(l),l}},cancel(c){return s(c),i.return()}},{highWaterMark:2})},Ps=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Zp=Ps&&typeof ReadableStream=="function",iI=Ps&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Yp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},aI=Zp&&Yp(()=>{let e=!1;const t=new Request(En.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),S1=64*1024,Al=Zp&&Yp(()=>Y.isReadableStream(new Response("").body)),cs={stream:Al&&(e=>e.body)};Ps&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!cs[t]&&(cs[t]=Y.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new je(`Response type '${t}' is not supported`,je.ERR_NOT_SUPPORT,r)})})})(new Response);const uI=async e=>{if(e==null)return 0;if(Y.isBlob(e))return e.size;if(Y.isSpecCompliantForm(e))return(await new Request(En.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(Y.isArrayBufferView(e)||Y.isArrayBuffer(e))return e.byteLength;if(Y.isURLSearchParams(e)&&(e=e+""),Y.isString(e))return(await iI(e)).byteLength},sI=async(e,t)=>{const n=Y.toFiniteNumber(e.getContentLength());return n??uI(t)},cI=Ps&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:a,timeout:u,onDownloadProgress:s,onUploadProgress:c,responseType:l,headers:f,withCredentials:h="same-origin",fetchOptions:g}=Gp(e);l=l?(l+"").toLowerCase():"text";let m=tI([i,a&&a.toAbortSignal()],u),b;const C=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let I;try{if(c&&aI&&n!=="get"&&n!=="head"&&(I=await sI(f,r))!==0){let _=new Request(t,{method:"POST",body:r,duplex:"half"}),v;if(Y.isFormData(r)&&(v=_.headers.get("content-type"))&&f.setContentType(v),_.body){const[x,M]=C1(I,ss(I1(c)));r=E1(_.body,S1,x,M)}}Y.isString(h)||(h=h?"include":"omit");const E="credentials"in Request.prototype;b=new Request(t,{...g,signal:m,method:n.toUpperCase(),headers:f.normalize().toJSON(),body:r,duplex:"half",credentials:E?h:void 0});let y=await fetch(b);const S=Al&&(l==="stream"||l==="response");if(Al&&(s||S&&C)){const _={};["status","statusText","headers"].forEach(H=>{_[H]=y[H]});const v=Y.toFiniteNumber(y.headers.get("content-length")),[x,M]=s&&C1(v,ss(I1(s),!0))||[];y=new Response(E1(y.body,S1,x,()=>{M&&M(),C&&C()}),_)}l=l||"text";let T=await cs[Y.findKey(cs,l)||"text"](y,e);return!S&&C&&C(),await new Promise((_,v)=>{qp(_,v,{data:T,headers:Bn.from(y.headers),status:y.status,statusText:y.statusText,config:e,request:b})})}catch(E){throw C&&C(),E&&E.name==="TypeError"&&/fetch/i.test(E.message)?Object.assign(new je("Network Error",je.ERR_NETWORK,e,b),{cause:E.cause||E}):je.from(E,E&&E.code,e,b)}}),kl={http:_C,xhr:eI,fetch:cI};Y.forEach(kl,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const x1=e=>`- ${e}`,lI=e=>Y.isFunction(e)||e===null||e===!1,Xp={getAdapter:e=>{e=Y.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let a=0;a<t;a++){n=e[a];let u;if(r=n,!lI(n)&&(r=kl[(u=String(n)).toLowerCase()],r===void 0))throw new je(`Unknown adapter '${u}'`);if(r)break;i[u||"#"+a]=r}if(!r){const a=Object.entries(i).map(([s,c])=>`adapter ${s} `+(c===!1?"is not supported by the environment":"is not available in the build"));let u=t?a.length>1?`since :
|
|
67
67
|
`+a.map(x1).join(`
|
|
68
68
|
`):" "+x1(a[0]):"as no adapter specified";throw new je("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return r},adapters:kl};function Ic(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Di(null,e)}function _1(e){return Ic(e),e.headers=Bn.from(e.headers),e.data=Cc.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Xp.getAdapter(e.adapter||Ya.adapter)(e).then(function(r){return Ic(e),r.data=Cc.call(e,e.transformResponse,r),r.headers=Bn.from(r.headers),r},function(r){return $p(r)||(Ic(e),r&&r.response&&(r.response.data=Cc.call(e,e.transformResponse,r.response),r.response.headers=Bn.from(r.response.headers))),Promise.reject(r)})}const Kp="1.8.1",Os={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Os[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const T1={};Os.transitional=function(t,n,r){function i(a,u){return"[Axios v"+Kp+"] Transitional option '"+a+"'"+u+(r?". "+r:"")}return(a,u,s)=>{if(t===!1)throw new je(i(u," has been removed"+(n?" in "+n:"")),je.ERR_DEPRECATED);return n&&!T1[u]&&(T1[u]=!0,console.warn(i(u," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,u,s):!0}};Os.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function dI(e,t,n){if(typeof e!="object")throw new je("options must be an object",je.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const a=r[i],u=t[a];if(u){const s=e[a],c=s===void 0||u(s,a,e);if(c!==!0)throw new je("option "+a+" must be "+c,je.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new je("Unknown option "+a,je.ERR_BAD_OPTION)}}const Gu={assertOptions:dI,validators:Os},_r=Gu.validators;let zo=class{constructor(t){this.defaults=t,this.interceptors={request:new g1,response:new g1}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const a=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?a&&!String(r.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
69
|
-
`+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Go(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:a}=n;r!==void 0&&Gu.assertOptions(r,{silentJSONParsing:_r.transitional(_r.boolean),forcedJSONParsing:_r.transitional(_r.boolean),clarifyTimeoutError:_r.transitional(_r.boolean)},!1),i!=null&&(Y.isFunction(i)?n.paramsSerializer={serialize:i}:Gu.assertOptions(i,{encode:_r.function,serialize:_r.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Gu.assertOptions(n,{baseUrl:_r.spelling("baseURL"),withXsrfToken:_r.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=a&&Y.merge(a.common,a[n.method]);a&&Y.forEach(["delete","get","head","post","put","patch","common"],b=>{delete a[b]}),n.headers=Bn.concat(u,a);const s=[];let c=!0;this.interceptors.request.forEach(function(C){typeof C.runWhen=="function"&&C.runWhen(n)===!1||(c=c&&C.synchronous,s.unshift(C.fulfilled,C.rejected))});const l=[];this.interceptors.response.forEach(function(C){l.push(C.fulfilled,C.rejected)});let f,h=0,g;if(!c){const b=[_1.bind(this),void 0];for(b.unshift.apply(b,s),b.push.apply(b,l),g=b.length,f=Promise.resolve(n);h<g;)f=f.then(b[h++],b[h++]);return f}g=s.length;let m=n;for(h=0;h<g;){const b=s[h++],C=s[h++];try{m=b(m)}catch(I){C.call(this,I);break}}try{f=_1.call(this,m)}catch(b){return Promise.reject(b)}for(h=0,g=l.length;h<g;)f=f.then(l[h++],l[h++]);return f}getUri(t){t=Go(this.defaults,t);const n=Wp(t.baseURL,t.url,t.allowAbsoluteUrls);return Up(n,t.params,t.paramsSerializer)}};Y.forEach(["delete","get","head","options"],function(t){zo.prototype[t]=function(n,r){return this.request(Go(r||{},{method:t,url:n,data:(r||{}).data}))}});Y.forEach(["post","put","patch"],function(t){function n(r){return function(a,u,s){return this.request(Go(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:u}))}}zo.prototype[t]=n(),zo.prototype[t+"Form"]=n(!0)});let fI=class Jp{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(i=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](i);r._listeners=null}),this.promise.then=i=>{let a;const u=new Promise(s=>{r.subscribe(s),a=s}).then(i);return u.cancel=function(){r.unsubscribe(a)},u},t(function(a,u,s){r.reason||(r.reason=new Di(a,u,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Jp(function(i){t=i}),cancel:t}}};function hI(e){return function(n){return e.apply(null,n)}}function pI(e){return Y.isObject(e)&&e.isAxiosError===!0}const vl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(vl).forEach(([e,t])=>{vl[t]=e});function Qp(e){const t=new zo(e),n=Lp(zo.prototype.request,t);return Y.extend(n,zo.prototype,t,{allOwnKeys:!0}),Y.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Qp(Go(e,i))},n}const ft=Qp(Ya);ft.Axios=zo;ft.CanceledError=Di;ft.CancelToken=fI;ft.isCancel=$p;ft.VERSION=Kp;ft.toFormData=Rs;ft.AxiosError=je;ft.Cancel=ft.CanceledError;ft.all=function(t){return Promise.all(t)};ft.spread=hI;ft.isAxiosError=pI;ft.mergeConfig=Go;ft.AxiosHeaders=Bn;ft.formToJSON=e=>zp(Y.isHTMLForm(e)?new FormData(e):e);ft.getAdapter=Xp.getAdapter;ft.HttpStatusCode=vl;ft.default=ft;const{Axios:p$,AxiosError:mI,CanceledError:m$,isCancel:g$,CancelToken:b$,VERSION:C$,all:I$,Cancel:y$,isAxiosError:E$,spread:S$,toFormData:x$,AxiosHeaders:_$,HttpStatusCode:T$,formToJSON:w$,getAdapter:A$,mergeConfig:k$}=ft,Iu="https://localhost:5043",st=async e=>{var g,m;const{url:t,withToken:n,method:r,body:i,contentType:a,typeToken:u="seller"}=e,s=n?localStorage.getItem("sellerAccessToken"):null,c=n?localStorage.getItem("token"):null,l=u==="seller"?s:c,f=localStorage.getItem("dv"),h={"Content-Type":a||"application/json"};n&&l&&(h.Authorization=`Bearer ${l}`);try{let b=null;switch(r){case"get":b=await ft.get(f?Iu:t,{headers:h});break;case"post":b=await ft.post(f?Iu:t,i,{headers:h});break;case"put":b=await ft.put(f?Iu:t,i,{headers:h});break;case"delete":b=await ft.delete(f?Iu:t,{headers:h});break}return{data:b==null?void 0:b.data,status:b==null?void 0:b.status,headers:b==null?void 0:b.headers}}catch(b){const C=b,I=(g=C.response)==null?void 0:g.data;let E="Something Went Wrong";I&&(E=I.errors[0]);const y=(m=C.response)==null?void 0:m.status;if(y===401){const{logoutCustomer:S}=await Promise.resolve().then(()=>HE);await S(),window.location.reload()}throw new mI(E,(y==null?void 0:y.toString())||"400")}},gI="https://g-api.billgang.com",bI="https://www.googleapis.com/webfonts/v1/webfonts",CI="https://stores-api.billgang.com",II="https://sl-api.billgang.com",yI="https://customers-api.billgang.com",EI="https://cashapp-api.billgang.com",SI={api:gI,googleFonts:bI,storeApi:CI,slApi:II,customersApi:yI,cashappApi:EI};var Vt=(e=>(e.Home="Home",e.Orders="Orders",e.Rewards="Rewards",e.Balance="Balance",e.Subscriptions="Subscriptions",e.Tickets="Tickets",e))(Vt||{}),la=(e=>(e.Home="Home",e.Orders="Orders",e.Rewards="Rewards",e.Balance="Balance",e.Tickets="Tickets",e))(la||{});const xI=[{caption:"Share link",description:"Send the link to your friends in all convenient ways"},{caption:"Purchase",description:"They buy a product from our store"},{caption:"Percentages",description:"You get rewards"}],Jn=ut(e=>({route:Vt.Home,setRoute:t=>e(()=>({route:t})),dashInfo:null,setDashInfo:t=>e(()=>({dashInfo:t})),balance:null,setBalance:t=>e(()=>({balance:t})),otpRequest:{requested:!1,email:""},setOtpRequest:t=>e(()=>({otpRequest:t})),balanceSettings:null,setBalanceSettings:t=>e(()=>({balanceSettings:t})),gatewaysDetail:null,setGatewaysDetail:t=>e(()=>({gatewaysDetail:t}))})),Ao=ut(e=>({token:localStorage.getItem("token")||null,setToken:t=>e(()=>({token:t})),shopDomain:"",setShopDomain:t=>e(()=>({shopDomain:t})),shopId:"",setShopId:t=>e(()=>({shopId:t})),shopLogo:null,setShopLogo:t=>e(()=>({shopLogo:t})),shopPassword:localStorage.getItem("shopPassword")||"",setShopPassword:t=>e(()=>({shopPassword:t})),shopGeneral:null,setShopGeneral:t=>e(()=>({shopGeneral:t})),shopTerms:null,setShopTerms:t=>e(()=>({shopTerms:t})),shopPrivacyPolicy:null,setShopPrivacyPolicy:t=>e(()=>({shopPrivacyPolicy:t})),shopRefundPolicy:null,setShopRefundPolicy:t=>e(()=>({shopRefundPolicy:t}))}));class da extends Error{}da.prototype.name="InvalidTokenError";function _I(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function TI(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return _I(t)}catch{return atob(t)}}function e2(e,t){if(typeof e!="string")throw new da("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,r=e.split(".")[n];if(typeof r!="string")throw new da(`Invalid token specified: missing part #${n+1}`);let i;try{i=TI(r)}catch(a){throw new da(`Invalid token specified: invalid base64 for part #${n+1} (${a.message})`)}try{return JSON.parse(i)}catch(a){throw new da(`Invalid token specified: invalid json for part #${n+1} (${a.message})`)}}const ir=(e,t="300")=>e==="not found"?"empty":`https://imagedelivery.net/${e}/w=${t}`,Dn=e=>{const t=new Intl.NumberFormat("en-US",{style:"currency",currency:e.currency||"USD"});let n=e.amount;return e.quantity&&(n=n*e.quantity),t.format(n)},wI=(e,t)=>{if(e===0)throw new Error("Old value cannot be zero, as it would result in division by zero.");return(t-e)/Math.abs(e)*100},AI=e=>{if(Math.abs(e-365)<=15){const a=Math.round(e/365);return a===1?"year":`${a} years`}else if(Math.abs(e-30)<=5){const a=Math.round(e/30);return a===1?"month":`${a} months`}else return`${e} days`},kI=e=>new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),Ra=e=>{const t=new Date(e),n={day:"2-digit",month:"2-digit",year:"numeric"},r={hour:"2-digit",minute:"2-digit"},i=t.toLocaleString("en-US",n),a=t.toLocaleString("en-US",r);return[i,a]},Ll=e=>{const t=window.localStorage.getItem(e);if(t===null)return null;try{return JSON.parse(t)}catch{return t}},w1=(e,t)=>{(t===null||typeof t!="object")&&window.localStorage.setItem(e,String(t));const n=JSON.stringify(t);window.localStorage.setItem(e,n)},yc="f10120ab-7ebb-4785-b240-7428edaa3c4e",Qi="https://t-api.billgang.com",ea="https://internal-t-api.antistock.io",fa="I",vI=10*1e3,LI=15*1e3,DI=15*60*1e3,xo=()=>{var t;const e=Ll(fa);return((t=e==null?void 0:e.s)==null?void 0:t.i)||null},NI=(e,t="production",n)=>{const{pathname:r}=Kr(),i=k.useRef(),a=k.useRef(document.visibilityState);k.useEffect(()=>{if(!e)return;const u=()=>Date.now(),s=async()=>(await st({url:`${n?ea:Qi}/${e}/t/p`,method:"post",withToken:!1})).data.data.id,c=async b=>(await st({url:`${n?ea:Qi}/${e}/t/p/${t==="development"?yc:b}/s`,method:"post",withToken:!1})).data.data.id,l=async(b,C,I,E)=>{const y=t==="development"?yc:b;try{return(await st({url:`${n?ea:Qi}/${e}/t/p/${y}/s/${C}/e`,method:"post",withToken:!1,body:{url:I,oldEventId:E},contentType:"application/json"})).data.data.id}catch{return C=await c(b),(await st({url:`${n?ea:Qi}/${e}/t/p/${y}/s/${C}/e`,method:"post",withToken:!1,body:{url:I},contentType:"application/json"})).data.data.id}},f=async(b,C,I)=>{await st({url:`${n?ea:Qi}/${e}/t/p/${t==="development"?yc:b}/s/${C}/e/${I}/h`,method:"post",withToken:!1});const y=Ll(fa);y&&(y.s.u=u().toString(),y.lu=u().toString(),w1(fa,y))},h=(b,C,I)=>{i.current&&clearInterval(i.current),i.current=setInterval(async()=>{if(document.visibilityState==="visible")try{await f(b,C,I)}catch{await g()}},vI)},g=async()=>{var E,y,S,T;const b=`${window.location.hostname}${r}`,C=Ll(fa),I=u();try{let _=C==null?void 0:C.p;_||(_=await s());let v=(E=C==null?void 0:C.s)==null?void 0:E.i;const x=Number(((y=C==null?void 0:C.s)==null?void 0:y.u)||((S=C==null?void 0:C.s)==null?void 0:S.c)),M=!v||I-x>DI;(!v||M)&&(v=await c(_));const H=Number((C==null?void 0:C.lu)||0),A=I-H>LI,j=await l(_,v,b,C!=null&&C.l&&!A?C.l:void 0),F={p:_,s:{i:v,c:((T=C==null?void 0:C.s)==null?void 0:T.c)??I.toString(),u:I.toString()},l:j,lu:I.toString()};w1(fa,F),h(_,v,j)}catch(_){console.error("[TrackingAnalytics] error",_)}};g();const m=()=>{document.visibilityState==="visible"&&a.current!=="visible"&&g(),a.current=document.visibilityState};return document.addEventListener("visibilitychange",m),()=>{i.current&&clearInterval(i.current),document.removeEventListener("visibilitychange",m)}},[r,e,t])},RI={customerEmail:"",recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null,tsId:xo()};let hi=null;const A1=localStorage.getItem("token");if(A1)try{hi=e2(JSON.parse(A1)||"")}catch{hi=null}const Gr=ut(e=>({cart:{...RI,customerEmail:hi?hi.email:""},products:[],coupon:null,pending:!1,applyCouponPending:!1,customerEmail:hi?hi.email:"",recaptcha:"",priceAdjusment:null,setCart:t=>e(n=>({cart:typeof t=="function"?t(n.cart):t})),setProducts:t=>e(n=>({products:typeof t=="function"?t(n.products):t})),setRecaptcha:t=>e({recaptcha:t}),setCoupon:t=>e({coupon:t}),setPending:t=>e({pending:t}),setApplyCouponPending:t=>e({applyCouponPending:t}),setCustomerEmail:t=>e({customerEmail:t}),setPriceAdjustment:t=>e({priceAdjusment:t})})),Xo=ut(e=>({page:1,setPage:t=>e(()=>({page:t})),resetPage:()=>e(()=>({page:1}))})),t2=ut(e=>({discordInfo:null,setDiscordInfo:t=>e(()=>({discordInfo:t}))})),PI=ut(e=>({subscription:null,setSubscription:t=>e({subscription:t})})),Lt=ut(e=>({apiUrls:SI,setApiUrls:t=>e(()=>({apiUrls:t}))})),OI=async()=>{const e=localStorage.getItem("shopId")||void 0,n=`${Lt.getState().apiUrls.api}/v1/dash/shops/${e}/images`;return await st({url:n,withToken:!0,method:"get"})},MI=async e=>{const t=localStorage.getItem("shopId")||void 0,r=`${Lt.getState().apiUrls.api}/v1/dash/shops/${t}/images`;return await st({url:r,withToken:!0,method:"post",body:e,contentType:"mutlipart/form-data"})},FI="_customCheckbox_w9x8g_1",BI="_checkboxBox_w9x8g_7",HI="_checked_w9x8g_23",jI="_icon_w9x8g_31",yu={customCheckbox:FI,checkboxBox:BI,checked:HI,icon:jI},n2=e=>{const{value:t,onChange:n}=e,[r,i]=k.useState(t),a=()=>{i(!r),n(!r)};return k.useEffect(()=>{i(t)},[t]),d.jsxs("label",{className:yu.customCheckbox,onClick:u=>u.stopPropagation(),children:[d.jsx("input",{type:"checkbox",checked:r,onChange:a,style:{display:"none"}}),d.jsx("span",{className:ge(yu.checkboxBox,{[yu.checked]:r})}),r&&d.jsx("div",{className:yu.icon,children:d.jsx(ie,{name:"Check",width:14,height:14,fill:"#ff3f19"})})]})},UI="_button_1gxoe_1",VI="_primary_1gxoe_14",zI="_secondary_1gxoe_22",$I="_tertiary_1gxoe_30",qI="_content_1gxoe_38",WI="_withoutHover_1gxoe_45",ii={button:UI,primary:VI,secondary:zI,tertiary:$I,content:qI,withoutHover:WI},Ei=e=>{const{children:t,onClick:n,style:r,className:i,disabled:a=!1,size:u="m",type:s="Primary",withoutHover:c=!1}=e;return d.jsx("button",{className:ge(ii.button,i,{[ii.primary]:s==="Primary",[ii.secondary]:s==="Secondary",[ii.tertiary]:s==="Tertiary",[ii.withoutHover]:c}),onClick:n,style:{...r,fontSize:u==="m"?14:u==="s"?12:16},disabled:a,children:s==="Tertiary"?d.jsxs("div",{className:ii.content,children:[t,d.jsx(ie,{name:"ArrowRight",fill:"#757575",width:20,height:20})]}):d.jsx(d.Fragment,{children:t})})},GI="_tip_q9ixw_1",ZI="_text_q9ixw_12",YI="_warning_q9ixw_18",XI="_error_q9ixw_23",KI="_success_q9ixw_28",JI="_hide_q9ixw_33",ai={tip:GI,text:ZI,warning:YI,error:XI,success:KI,hide:JI},k1={warning:"#C1972A",error:"#FF3F19",success:"#338B13"},r2=e=>{const{type:t,message:n,style:r,padding:i,id:a}=e,[u,s]=k.useState(!1);return d.jsx("div",{style:{padding:i},children:d.jsxs("div",{className:ge(ai.tip,{[ai.warning]:t==="warning",[ai.error]:t==="error",[ai.success]:t==="success",[ai.hide]:u}),style:r,children:[d.jsx("div",{children:d.jsx(ie,{name:"Info",fill:k1[t],width:20,height:20})}),d.jsx("div",{className:ai.text,id:a,children:n}),d.jsx("div",{children:d.jsx(ie,{name:"X",fill:k1[t],width:20,height:20,hoverable:!0,onClick:()=>s(!0)})})]})})},Xa=e=>{const{label:t,onChange:n,activeImage:r,tip:i}=e,{setOpenModal:a,setOnChange:u,setTip:s}=Sd();return d.jsx(d.Fragment,{children:d.jsxs("div",{className:Et.wrapper,onClick:c=>c.stopPropagation(),children:[t&&d.jsx("h4",{className:Et.label,children:t}),d.jsxs("div",{onClick:()=>{u(n),a(!0),i&&s(i)},className:Et.content,children:[d.jsx("div",{className:Et.icon,children:r?d.jsx("img",{src:`https://imagedelivery.net/${r}/w=156,h=156`,alt:"image",style:{width:"20px",height:"20px",objectFit:"contain"}}):d.jsx(ie,{name:"Plus",width:20,height:20,fill:"#757575"})}),d.jsx("span",{className:Et.text,children:r?"Change Image":"Select Image"}),r&&d.jsx(ie,{name:"X",width:20,height:18,fill:"#ff3f19",hoverable:!0,onClick:c=>{c.stopPropagation(),n([])}})]})]})})},QI=()=>{const{setOpenModal:e,onChange:t,tip:n,setTip:r}=Sd(),{setIsOpen:i}=eo(),[a,u]=k.useState(!1),s=()=>{var y;(y=c.current)==null||y.click()},c=k.useRef(null),[l,f]=k.useState([]),[h,g]=k.useState(!1),m=async y=>{var x;const S=((x=y.target.files)==null?void 0:x[0])||null;if(!S)return;const T=new FormData;T.append("file",S),g(!0);const{data:_}=await MI(T),v=[...l];v.unshift({..._.data,cfId:_.data.path}),f([...v]),g(!1)},b=y=>{y.preventDefault(),u(!1);const S=y.dataTransfer.files;if(S&&S.length>0){const _={target:{files:[S[0]]}};m(_)}},C=()=>{i(!1),r(""),setTimeout(()=>{e(!1),i(!0)},300)},I=y=>{const S=l.map(T=>({...T,isSelected:T.id===y.id?!T.isSelected:!1}));f([...S])};function E(){const y=l.find(S=>S.isSelected);y&&(t==null||t([y.cfId]))}return k.useEffect(()=>{(async()=>{const{data:S}=await OI(),T=S.data.map(_=>({..._,isSelected:!1}));f(T)})()},[]),d.jsxs("div",{onClick:y=>y.stopPropagation(),className:Et.modal,children:[d.jsxs("div",{className:Et.top,children:[d.jsx("h4",{className:Et.title,children:"Select Image"}),d.jsx(ie,{name:"X",width:20,height:20,hoverable:!0,onClick:C})]}),n&&d.jsx(r2,{type:"warning",message:n,padding:5}),d.jsx("div",{className:Et.modalContent,children:d.jsxs("div",{className:Et.images,children:[d.jsxs("div",{className:Et.input,onDragOver:y=>y.preventDefault(),onDragEnter:()=>u(!0),onDragLeave:()=>u(!1),onDrop:b,children:[d.jsxs("div",{onClick:s,className:ge(Et.add,{[Et.dragging]:a}),children:[d.jsx("div",{className:Et.icon,children:d.jsx(ie,{name:"Plus",width:20,height:20,fill:"#757575"})}),d.jsxs("div",{className:Et.description,children:[d.jsx("span",{children:"Drag and drop images here, or "}),d.jsx("span",{className:Et.highlight,children:"click to browse"}),d.jsx("br",{}),d.jsx("span",{className:Et.accent,children:"up to 10MB."})]})]}),d.jsx("input",{type:"file",ref:c,style:{display:"none"},onChange:m,multiple:!1,accept:"image/*"})]}),h&&d.jsx(v1,{}),l.map(y=>d.jsx(e7,{image:y,updateImage:I},y.id)),l.length===0&&[...new Array(5)].map((y,S)=>d.jsx(v1,{},S))]})}),d.jsxs("div",{className:Et.bottom,children:[d.jsx(Ei,{className:Et.cancel,onClick:C,type:"Secondary",children:"Cancel"}),d.jsx(Ei,{onClick:()=>{e(!1),E()},children:"Select"})]})]})},e7=e=>{const{image:t,updateImage:n}=e;return d.jsxs("div",{className:ge(Et.image,{[Et.selected]:t.isSelected}),onClick:()=>{n({...t,isSelected:!t.isSelected})},children:[d.jsx("div",{className:Et.checkbox,children:d.jsx(n2,{value:t.isSelected,onChange:r=>{n({...t,isSelected:r})}})}),d.jsx("img",{src:`https://imagedelivery.net/${t.cfId}/w=156,h=156`,alt:"image",style:{objectFit:"contain",width:"156px",height:"100px"}})]},t.id)},v1=()=>d.jsx("div",{className:Et.loading,children:d.jsx("div",{className:Et.spinner})}),t7="_title_1uycf_1",n7="_subtitle_1uycf_5",r7="_text_1uycf_13",o7="_top_1uycf_20",i7="_itemsBlock_1uycf_29",a7="_textSettings_1uycf_35",ui={title:t7,subtitle:n7,text:r7,top:o7,itemsBlock:i7,textSettings:a7},u7="_typeTexts_1gfda_1",s7="_block_1gfda_8",c7="_active_1gfda_25",Ec={typeTexts:u7,block:s7,active:c7},l7=["bold","italic","underline","strike-through"],kd=e=>{const{typesText:t,setTypesText:n}=e;function r(i){switch(i){case"bold":return"TextB";case"italic":return"TextItalic";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return d.jsx("div",{className:Ec.typeTexts,children:l7.map(i=>d.jsx("div",{className:ge(Ec.block,{[Ec.active]:t.includes(i)}),onClick:()=>{const a=[...t];if(a.includes(i)){const u=a.filter(s=>s!==i);n(u)}else a.push(i),n(a)},children:d.jsx(ie,{name:r(i),fill:t.includes(i)?"#252525":"#757575",width:20,height:20})},String(i)))})},d7="_wrapper_34cvp_1",f7="_label_34cvp_10",h7="_textarea_34cvp_18",p7="_length_34cvp_46",m7="_full_34cvp_54",ta={wrapper:d7,label:f7,textarea:h7,length:p7,full:m7},vd=e=>{const{onChange:t,label:n,value:r,maxLength:i,placeholder:a="Type something..."}=e,[u,s]=k.useState(r.length);return d.jsxs("div",{className:ta.wrapper,children:[n&&d.jsx("label",{className:ta.label,htmlFor:n,children:n}),d.jsx("textarea",{id:n,value:r,onChange:c=>{s(c.target.value.length),t(c.target.value)},placeholder:a,className:ta.textarea,maxLength:i}),i&&d.jsxs("div",{className:ge(ta.length,{[ta.full]:u===i}),children:[u,"/",i]})]})},Ld=e=>{const{typeFont:t,setTypeFont:n}=e,[r,i]=k.useState([]),a=()=>{const u=document.documentElement,s=getComputedStyle(u),c=["h1","h2","h3","h4","h5","h6","h7"].map(f=>s.getPropertyValue(`--font-heading-${f}-size`).trim()),l=["lg","md","sm"].map(f=>s.getPropertyValue(`--font-body-${f}-size`).trim());return c.push(...l),c};return k.useEffect(()=>{const u=a();u.every(s=>s)&&i(u)},[]),d.jsx(So,{label:"Type Text",options:Object.values(gu),onChange:u=>n(Object.keys(gu).find(s=>gu[s]===u)),value:gu[t],postfixs:r})},g7="_alignTexts_xs0ug_1",b7="_block_xs0ug_10",C7="_active_xs0ug_28",Sc={alignTexts:g7,block:b7,active:C7},I7=["left","center","right"],o2=e=>{const{alignText:t,setAlignText:n}=e;function r(i){switch(i){case"left":return"TextAlignLeft";case"center":return"TextAlignCenter";case"right":return"TextAlignRight"}}return d.jsx("div",{className:Sc.alignTexts,children:I7.map(i=>d.jsx("div",{className:ge(Sc.block,{[Sc.active]:t===i}),onClick:()=>{n(i)},children:d.jsx(ie,{name:r(i),fill:t===i?"#252525":"#757575",width:20,height:20})},String(i)))})},Dd=e=>{const{typesText:t,isActiveText:n,setIsActiveText:r,text:i,setText:a,setTypesText:u,title:s,subtitle:c="Items",typeFont:l,setTypeFont:f,alignText:h,setAlignText:g}=e;return d.jsxs("div",{className:ui.text,children:[(s||n!==void 0)&&d.jsxs("div",{className:ui.top,children:[s&&d.jsx("h3",{className:ui.title,children:s}),n!==void 0&&r&&d.jsx(Or,{current:n,onChange:m=>r(m)})]}),(n===void 0||n)&&d.jsxs("div",{className:ui.itemsBlock,children:[d.jsx("h5",{className:ui.subtitle,children:c}),d.jsx(vd,{onChange:m=>a(m),value:i}),d.jsxs("div",{className:ui.textSettings,children:[d.jsx(kd,{typesText:t,setTypesText:u}),d.jsx(o2,{alignText:h,setAlignText:g})]}),d.jsx(Ld,{typeFont:l,setTypeFont:f})]})]})},y7="_title_msd5s_1",E7="_subtitle_msd5s_5",S7="_productsBlock_msd5s_14",x7="_top_msd5s_26",_7="_products_msd5s_14",T7="_product_msd5s_14",w7="_button_msd5s_80",A7="_disabled_msd5s_91",k7="_buttons_msd5s_118",v7="_modal_msd5s_125",L7="_link_msd5s_146",D7="_modalOptions_msd5s_152",N7="_addButton_msd5s_165",R7="_deleteButton_msd5s_180",P7="_closeIcon_msd5s_192",Mt={title:y7,subtitle:E7,productsBlock:S7,top:x7,products:_7,product:T7,button:w7,disabled:A7,buttons:k7,modal:v7,link:L7,modalOptions:D7,addButton:N7,deleteButton:R7,closeIcon:P7},O7=k.forwardRef((e,t)=>{const{activeItem:n,setActiveItem:r,popupPosition:i,modalOptions:a,setIsOpenModal:u}=e;vi(t,()=>{r(null),u(!1)});function s(c,l){return c.length>l?`${c.slice(0,l)}...`:c}return d.jsxs("div",{ref:t,className:Mt.modal,onClick:c=>{c.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[d.jsxs("div",{className:Mt.top,children:[d.jsx("h3",{className:Mt.title,children:s(n.name["en-US"],20)}),d.jsx("div",{className:Mt.closeIcon,children:d.jsx(ie,{name:"X",height:20,width:20,onClick:()=>{r(null),u(!1)}})})]}),d.jsx("div",{className:Mt.modalOptions,children:a.map(c=>{if(c.type==="image")return d.jsx(Xa,{label:"Put up an attractive image",activeImage:n[c.field],onChange:l=>{const f={...n,[c.field]:l};r(f)}},String(c.field));if(c.type==="text")return d.jsx(Dd,{isActiveText:!0,typesText:n[c.field.type],setTypesText:l=>{const f={...n,[c.field.type]:l};r(f)},alignText:n[c.field.alignText],setAlignText:l=>{const f={...n,[c.field.alignText]:l};r(f)},text:n[c.field.text]["en-US"]||"",setText:l=>{const f={...n,[c.field.text]:{"en-US":l}};r(f)},typeFont:n[c.field.typeFont],setTypeFont:l=>{const f={...n,[c.field.typeFont]:l};r(f)},subtitle:c.label});if(c.type==="input")return d.jsx(ur,{onChange:l=>{const f={...n,[c.field]:l};r(f)},value:n[c.field]||"",label:c.label,placeholder:c.placeholder});if(c.type==="inputSwitch")return d.jsxs("div",{className:Mt.link,children:[d.jsx(ur,{onChange:l=>{const f={...n,[c.field.text]:l};r(f)},value:n[c.field.text]||"",label:c.inputLabel,placeholder:c.placeholder}),d.jsx(Or,{current:!!n[c.field.switch]||!1,label:c.switchLabel,onChange:l=>{const f={...n,[c.field.switch]:l};r(f)}})]});if(c.type==="list")return d.jsx(R2,{items:n[c.field]||[],setItems:l=>{const f={...n,[c.field]:l};r(f)},itemsType:"select",draggable:c.draggable||!1,itemsOptions:c.itemsOptions,deletable:c.deletable||!1,editable:c.editable||!1,subtitle:c.label,addableOptions:c.addableOptions,modalOptions:c.modalOptions});if(c.type==="select")return d.jsx(So,{options:c.itemsOptions,onChange:l=>{const f={...n,[c.field]:l};r(f)},label:c.label,value:n[c.field]||"String",leftAddonOptions:c.leftAddonOptions,switcher:c.switcher?{value:!!n[c.switcher],onChange:l=>{if(c.switcher==="isActive"){const f={...n,[c.switcher]:l};r(f)}}}:void 0});if(c.type==="selectTypeFont")return d.jsx(Ld,{typeFont:n[c.field],setTypeFont:l=>{const f={...n,[c.field]:l};r(f)}});if(c.type==="selectInfiniteList")return d.jsx(_d,{options:c.itemsOptions,onChange:l=>{const f={...n,[c.field]:l};r(f)},label:c.label,value:n[c.field]||"String",leftAddonOptions:c.leftAddonOptions,switcher:c.switcher?{value:!!n[c.switcher],onChange:l=>{if(c.switcher==="isActive"){const f={...n,[c.switcher]:l};r(f)}}}:void 0})})})]})}),M7="_other_1a1tk_1",F7="_subtitle_1a1tk_7",B7="_items_1a1tk_14",xc={other:M7,subtitle:F7,items:B7},i2=e=>{const{items:t,otherTitle:n,tagsTitle:r}=e;return d.jsxs("div",{className:xc.other,children:[d.jsx("h5",{className:xc.subtitle,children:n||r}),d.jsx("div",{className:xc.items,children:t.map((i,a)=>d.jsx(Or,{current:i.isItem,onChange:u=>i.setIsItem(u),label:i.label,hasBackground:!0,paddingless:!1},a))})]})};function H7(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return k.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const Ms=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ni(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Nd(e){return"nodeType"in e}function jn(e){var t,n;return e?Ni(e)?e:Nd(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Rd(e){const{Document:t}=jn(e);return e instanceof t}function Ka(e){return Ni(e)?!1:e instanceof jn(e).HTMLElement}function a2(e){return e instanceof jn(e).SVGElement}function Ri(e){return e?Ni(e)?e.document:Nd(e)?Rd(e)?e:Ka(e)||a2(e)?e.ownerDocument:document:document:document}const Pr=Ms?k.useLayoutEffect:k.useEffect;function Pd(e){const t=k.useRef(e);return Pr(()=>{t.current=e}),k.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function j7(){const e=k.useRef(null),t=k.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Pa(e,t){t===void 0&&(t=[e]);const n=k.useRef(e);return Pr(()=>{n.current!==e&&(n.current=e)},t),n}function Ja(e,t){const n=k.useRef();return k.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ls(e){const t=Pd(e),n=k.useRef(null),r=k.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function Dl(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let _c={};function Qa(e,t){return k.useMemo(()=>{if(t)return t;const n=_c[e]==null?0:_c[e]+1;return _c[e]=n,e+"-"+n},[e,t])}function u2(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((a,u)=>{const s=Object.entries(u);for(const[c,l]of s){const f=a[c];f!=null&&(a[c]=f+e*l)}return a},{...t})}}const mi=u2(1),ds=u2(-1);function U7(e){return"clientX"in e&&"clientY"in e}function Od(e){if(!e)return!1;const{KeyboardEvent:t}=jn(e.target);return t&&e instanceof t}function V7(e){if(!e)return!1;const{TouchEvent:t}=jn(e.target);return t&&e instanceof t}function Nl(e){if(V7(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return U7(e)?{x:e.clientX,y:e.clientY}:null}const Si=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Si.Translate.toString(e),Si.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),L1="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function z7(e){return e.matches(L1)?e:e.querySelector(L1)}const $7={display:"none"};function q7(e){let{id:t,value:n}=e;return k.createElement("div",{id:t,style:$7},n)}function W7(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return k.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function G7(){const[e,t]=k.useState("");return{announce:k.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const s2=k.createContext(null);function Z7(e){const t=k.useContext(s2);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Y7(){const[e]=k.useState(()=>new Set),t=k.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[k.useCallback(r=>{let{type:i,event:a}=r;e.forEach(u=>{var s;return(s=u[i])==null?void 0:s.call(u,a)})},[e]),t]}const X7={draggable:`
|
|
69
|
+
`+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Go(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:a}=n;r!==void 0&&Gu.assertOptions(r,{silentJSONParsing:_r.transitional(_r.boolean),forcedJSONParsing:_r.transitional(_r.boolean),clarifyTimeoutError:_r.transitional(_r.boolean)},!1),i!=null&&(Y.isFunction(i)?n.paramsSerializer={serialize:i}:Gu.assertOptions(i,{encode:_r.function,serialize:_r.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Gu.assertOptions(n,{baseUrl:_r.spelling("baseURL"),withXsrfToken:_r.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=a&&Y.merge(a.common,a[n.method]);a&&Y.forEach(["delete","get","head","post","put","patch","common"],b=>{delete a[b]}),n.headers=Bn.concat(u,a);const s=[];let c=!0;this.interceptors.request.forEach(function(C){typeof C.runWhen=="function"&&C.runWhen(n)===!1||(c=c&&C.synchronous,s.unshift(C.fulfilled,C.rejected))});const l=[];this.interceptors.response.forEach(function(C){l.push(C.fulfilled,C.rejected)});let f,h=0,g;if(!c){const b=[_1.bind(this),void 0];for(b.unshift.apply(b,s),b.push.apply(b,l),g=b.length,f=Promise.resolve(n);h<g;)f=f.then(b[h++],b[h++]);return f}g=s.length;let m=n;for(h=0;h<g;){const b=s[h++],C=s[h++];try{m=b(m)}catch(I){C.call(this,I);break}}try{f=_1.call(this,m)}catch(b){return Promise.reject(b)}for(h=0,g=l.length;h<g;)f=f.then(l[h++],l[h++]);return f}getUri(t){t=Go(this.defaults,t);const n=Wp(t.baseURL,t.url,t.allowAbsoluteUrls);return Up(n,t.params,t.paramsSerializer)}};Y.forEach(["delete","get","head","options"],function(t){zo.prototype[t]=function(n,r){return this.request(Go(r||{},{method:t,url:n,data:(r||{}).data}))}});Y.forEach(["post","put","patch"],function(t){function n(r){return function(a,u,s){return this.request(Go(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:u}))}}zo.prototype[t]=n(),zo.prototype[t+"Form"]=n(!0)});let fI=class Jp{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(i=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](i);r._listeners=null}),this.promise.then=i=>{let a;const u=new Promise(s=>{r.subscribe(s),a=s}).then(i);return u.cancel=function(){r.unsubscribe(a)},u},t(function(a,u,s){r.reason||(r.reason=new Di(a,u,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Jp(function(i){t=i}),cancel:t}}};function hI(e){return function(n){return e.apply(null,n)}}function pI(e){return Y.isObject(e)&&e.isAxiosError===!0}const vl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(vl).forEach(([e,t])=>{vl[t]=e});function Qp(e){const t=new zo(e),n=Lp(zo.prototype.request,t);return Y.extend(n,zo.prototype,t,{allOwnKeys:!0}),Y.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Qp(Go(e,i))},n}const ft=Qp(Ya);ft.Axios=zo;ft.CanceledError=Di;ft.CancelToken=fI;ft.isCancel=$p;ft.VERSION=Kp;ft.toFormData=Rs;ft.AxiosError=je;ft.Cancel=ft.CanceledError;ft.all=function(t){return Promise.all(t)};ft.spread=hI;ft.isAxiosError=pI;ft.mergeConfig=Go;ft.AxiosHeaders=Bn;ft.formToJSON=e=>zp(Y.isHTMLForm(e)?new FormData(e):e);ft.getAdapter=Xp.getAdapter;ft.HttpStatusCode=vl;ft.default=ft;const{Axios:p$,AxiosError:mI,CanceledError:m$,isCancel:g$,CancelToken:b$,VERSION:C$,all:I$,Cancel:y$,isAxiosError:E$,spread:S$,toFormData:x$,AxiosHeaders:_$,HttpStatusCode:T$,formToJSON:w$,getAdapter:A$,mergeConfig:k$}=ft,Iu="https://localhost:5043",st=async e=>{var g,m;const{url:t,withToken:n,method:r,body:i,contentType:a,typeToken:u="seller"}=e,s=n?localStorage.getItem("sellerAccessToken"):null,c=n?localStorage.getItem("token"):null,l=u==="seller"?s:c,f=localStorage.getItem("dv"),h={"Content-Type":a||"application/json"};n&&l&&(h.Authorization=`Bearer ${l}`);try{let b=null;switch(r){case"get":b=await ft.get(f?Iu:t,{headers:h});break;case"post":b=await ft.post(f?Iu:t,i,{headers:h});break;case"put":b=await ft.put(f?Iu:t,i,{headers:h});break;case"delete":b=await ft.delete(f?Iu:t,{headers:h});break}return{data:b==null?void 0:b.data,status:b==null?void 0:b.status,headers:b==null?void 0:b.headers}}catch(b){const C=b,I=(g=C.response)==null?void 0:g.data;let E="Something Went Wrong";I&&(E=I.errors[0]);const y=(m=C.response)==null?void 0:m.status;if(y===401){const{logoutCustomer:S}=await Promise.resolve().then(()=>HE);await S(),window.location.reload()}throw new mI(E,(y==null?void 0:y.toString())||"400")}},gI="https://g-api.billgang.com",bI="https://www.googleapis.com/webfonts/v1/webfonts",CI="https://stores-api.billgang.com",II="https://sl-api.billgang.com",yI="https://customers-api.billgang.com",EI="https://cashapp-api.billgang.com",SI={api:gI,googleFonts:bI,storeApi:CI,slApi:II,customersApi:yI,cashappApi:EI};var Vt=(e=>(e.Home="Home",e.Orders="Orders",e.Rewards="Rewards",e.Balance="Balance",e.Subscriptions="Subscriptions",e.Tickets="Tickets",e))(Vt||{}),la=(e=>(e.Home="Home",e.Orders="Orders",e.Rewards="Rewards",e.Balance="Balance",e.Tickets="Tickets",e))(la||{});const xI=[{caption:"Share link",description:"Send the link to your friends in all convenient ways"},{caption:"Purchase",description:"They buy a product from our store"},{caption:"Percentages",description:"You get rewards"}],Jn=ut(e=>({route:Vt.Home,setRoute:t=>e(()=>({route:t})),dashInfo:null,setDashInfo:t=>e(()=>({dashInfo:t})),balance:null,setBalance:t=>e(()=>({balance:t})),otpRequest:{requested:!1,email:""},setOtpRequest:t=>e(()=>({otpRequest:t})),balanceSettings:null,setBalanceSettings:t=>e(()=>({balanceSettings:t})),gatewaysDetail:null,setGatewaysDetail:t=>e(()=>({gatewaysDetail:t}))})),Ao=ut(e=>({token:localStorage.getItem("token")||null,setToken:t=>e(()=>({token:t})),shopDomain:"",setShopDomain:t=>e(()=>({shopDomain:t})),shopId:"",setShopId:t=>e(()=>({shopId:t})),shopLogo:null,setShopLogo:t=>e(()=>({shopLogo:t})),shopPassword:localStorage.getItem("shopPassword")||"",setShopPassword:t=>e(()=>({shopPassword:t})),shopGeneral:null,setShopGeneral:t=>e(()=>({shopGeneral:t})),shopTerms:null,setShopTerms:t=>e(()=>({shopTerms:t})),shopPrivacyPolicy:null,setShopPrivacyPolicy:t=>e(()=>({shopPrivacyPolicy:t})),shopRefundPolicy:null,setShopRefundPolicy:t=>e(()=>({shopRefundPolicy:t}))}));class da extends Error{}da.prototype.name="InvalidTokenError";function _I(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function TI(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return _I(t)}catch{return atob(t)}}function e2(e,t){if(typeof e!="string")throw new da("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,r=e.split(".")[n];if(typeof r!="string")throw new da(`Invalid token specified: missing part #${n+1}`);let i;try{i=TI(r)}catch(a){throw new da(`Invalid token specified: invalid base64 for part #${n+1} (${a.message})`)}try{return JSON.parse(i)}catch(a){throw new da(`Invalid token specified: invalid json for part #${n+1} (${a.message})`)}}const ir=(e,t="300")=>e==="not found"?"empty":`https://imagedelivery.net/${e}/w=${t}`,Dn=e=>{const t=new Intl.NumberFormat("en-US",{style:"currency",currency:e.currency||"USD"});let n=e.amount;return e.quantity&&(n=n*e.quantity),t.format(n)},wI=(e,t)=>{if(e===0)throw new Error("Old value cannot be zero, as it would result in division by zero.");return(t-e)/Math.abs(e)*100},AI=e=>{if(Math.abs(e-365)<=15){const a=Math.round(e/365);return a===1?"year":`${a} years`}else if(Math.abs(e-30)<=5){const a=Math.round(e/30);return a===1?"month":`${a} months`}else return`${e} days`},kI=e=>new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),Ra=e=>{const t=new Date(e),n={day:"2-digit",month:"2-digit",year:"numeric"},r={hour:"2-digit",minute:"2-digit"},i=t.toLocaleString("en-US",n),a=t.toLocaleString("en-US",r);return[i,a]},Ll=e=>{const t=window.localStorage.getItem(e);if(t===null)return null;try{return JSON.parse(t)}catch{return t}},w1=(e,t)=>{(t===null||typeof t!="object")&&window.localStorage.setItem(e,String(t));const n=JSON.stringify(t);window.localStorage.setItem(e,n)},yc="f10120ab-7ebb-4785-b240-7428edaa3c4e",Qi="https://t-api.billgang.com",ea="https://internal-t-api.antistock.io",fa="I",vI=10*1e3,LI=15*1e3,DI=15*60*1e3,xo=()=>{var t;const e=Ll(fa);return((t=e==null?void 0:e.s)==null?void 0:t.i)||null},NI=(e,t="production",n)=>{const{pathname:r}=Kr(),i=k.useRef(),a=k.useRef(document.visibilityState);k.useEffect(()=>{if(!e)return;const u=()=>Date.now(),s=async()=>(await st({url:`${n?ea:Qi}/${e}/t/p`,method:"post",withToken:!1})).data.data.id,c=async b=>(await st({url:`${n?ea:Qi}/${e}/t/p/${t==="development"?yc:b}/s`,method:"post",withToken:!1})).data.data.id,l=async(b,C,I,E)=>{const y=t==="development"?yc:b;try{return(await st({url:`${n?ea:Qi}/${e}/t/p/${y}/s/${C}/e`,method:"post",withToken:!1,body:{url:I,oldEventId:E},contentType:"application/json"})).data.data.id}catch{return C=await c(b),(await st({url:`${n?ea:Qi}/${e}/t/p/${y}/s/${C}/e`,method:"post",withToken:!1,body:{url:I},contentType:"application/json"})).data.data.id}},f=async(b,C,I)=>{await st({url:`${n?ea:Qi}/${e}/t/p/${t==="development"?yc:b}/s/${C}/e/${I}/h`,method:"post",withToken:!1});const y=Ll(fa);y&&(y.s.u=u().toString(),y.lu=u().toString(),w1(fa,y))},h=(b,C,I)=>{i.current&&clearInterval(i.current),i.current=setInterval(async()=>{if(document.visibilityState==="visible")try{await f(b,C,I)}catch{await g()}},vI)},g=async()=>{var E,y,S,T;const b=`${window.location.hostname}${r}`,C=Ll(fa),I=u();try{let _=C==null?void 0:C.p;_||(_=await s());let v=(E=C==null?void 0:C.s)==null?void 0:E.i;const x=Number(((y=C==null?void 0:C.s)==null?void 0:y.u)||((S=C==null?void 0:C.s)==null?void 0:S.c)),M=!v||I-x>DI;(!v||M)&&(v=await c(_));const H=Number((C==null?void 0:C.lu)||0),A=I-H>LI,j=await l(_,v,b,C!=null&&C.l&&!A?C.l:void 0),F={p:_,s:{i:v,c:((T=C==null?void 0:C.s)==null?void 0:T.c)??I.toString(),u:I.toString()},l:j,lu:I.toString()};w1(fa,F),h(_,v,j)}catch(_){console.error("[TrackingAnalytics] error",_)}};g();const m=()=>{document.visibilityState==="visible"&&a.current!=="visible"&&g(),a.current=document.visibilityState};return document.addEventListener("visibilitychange",m),()=>{i.current&&clearInterval(i.current),document.removeEventListener("visibilitychange",m)}},[r,e,t])},RI={customerEmail:"",recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null,tsId:xo()};let hi=null;const A1=localStorage.getItem("token");if(A1)try{hi=e2(JSON.parse(A1)||"")}catch{hi=null}const Gr=ut(e=>({cart:{...RI,customerEmail:hi?hi.email:""},products:[],coupon:null,pending:!1,applyCouponPending:!1,customerEmail:hi?hi.email:"",recaptcha:"",priceAdjustment:null,serviceFee:null,setCart:t=>e(n=>({cart:typeof t=="function"?t(n.cart):t})),setProducts:t=>e(n=>({products:typeof t=="function"?t(n.products):t})),setRecaptcha:t=>e({recaptcha:t}),setCoupon:t=>e({coupon:t}),setPending:t=>e({pending:t}),setApplyCouponPending:t=>e({applyCouponPending:t}),setCustomerEmail:t=>e({customerEmail:t}),setPriceAdjustment:t=>e({priceAdjustment:t}),setServiceFee:t=>e({serviceFee:t})})),Xo=ut(e=>({page:1,setPage:t=>e(()=>({page:t})),resetPage:()=>e(()=>({page:1}))})),t2=ut(e=>({discordInfo:null,setDiscordInfo:t=>e(()=>({discordInfo:t}))})),PI=ut(e=>({subscription:null,setSubscription:t=>e({subscription:t})})),Lt=ut(e=>({apiUrls:SI,setApiUrls:t=>e(()=>({apiUrls:t}))})),OI=async()=>{const e=localStorage.getItem("shopId")||void 0,n=`${Lt.getState().apiUrls.api}/v1/dash/shops/${e}/images`;return await st({url:n,withToken:!0,method:"get"})},MI=async e=>{const t=localStorage.getItem("shopId")||void 0,r=`${Lt.getState().apiUrls.api}/v1/dash/shops/${t}/images`;return await st({url:r,withToken:!0,method:"post",body:e,contentType:"mutlipart/form-data"})},FI="_customCheckbox_w9x8g_1",BI="_checkboxBox_w9x8g_7",HI="_checked_w9x8g_23",jI="_icon_w9x8g_31",yu={customCheckbox:FI,checkboxBox:BI,checked:HI,icon:jI},n2=e=>{const{value:t,onChange:n}=e,[r,i]=k.useState(t),a=()=>{i(!r),n(!r)};return k.useEffect(()=>{i(t)},[t]),d.jsxs("label",{className:yu.customCheckbox,onClick:u=>u.stopPropagation(),children:[d.jsx("input",{type:"checkbox",checked:r,onChange:a,style:{display:"none"}}),d.jsx("span",{className:ge(yu.checkboxBox,{[yu.checked]:r})}),r&&d.jsx("div",{className:yu.icon,children:d.jsx(ie,{name:"Check",width:14,height:14,fill:"#ff3f19"})})]})},UI="_button_1gxoe_1",VI="_primary_1gxoe_14",zI="_secondary_1gxoe_22",$I="_tertiary_1gxoe_30",qI="_content_1gxoe_38",WI="_withoutHover_1gxoe_45",ii={button:UI,primary:VI,secondary:zI,tertiary:$I,content:qI,withoutHover:WI},Ei=e=>{const{children:t,onClick:n,style:r,className:i,disabled:a=!1,size:u="m",type:s="Primary",withoutHover:c=!1}=e;return d.jsx("button",{className:ge(ii.button,i,{[ii.primary]:s==="Primary",[ii.secondary]:s==="Secondary",[ii.tertiary]:s==="Tertiary",[ii.withoutHover]:c}),onClick:n,style:{...r,fontSize:u==="m"?14:u==="s"?12:16},disabled:a,children:s==="Tertiary"?d.jsxs("div",{className:ii.content,children:[t,d.jsx(ie,{name:"ArrowRight",fill:"#757575",width:20,height:20})]}):d.jsx(d.Fragment,{children:t})})},GI="_tip_q9ixw_1",ZI="_text_q9ixw_12",YI="_warning_q9ixw_18",XI="_error_q9ixw_23",KI="_success_q9ixw_28",JI="_hide_q9ixw_33",ai={tip:GI,text:ZI,warning:YI,error:XI,success:KI,hide:JI},k1={warning:"#C1972A",error:"#FF3F19",success:"#338B13"},r2=e=>{const{type:t,message:n,style:r,padding:i,id:a}=e,[u,s]=k.useState(!1);return d.jsx("div",{style:{padding:i},children:d.jsxs("div",{className:ge(ai.tip,{[ai.warning]:t==="warning",[ai.error]:t==="error",[ai.success]:t==="success",[ai.hide]:u}),style:r,children:[d.jsx("div",{children:d.jsx(ie,{name:"Info",fill:k1[t],width:20,height:20})}),d.jsx("div",{className:ai.text,id:a,children:n}),d.jsx("div",{children:d.jsx(ie,{name:"X",fill:k1[t],width:20,height:20,hoverable:!0,onClick:()=>s(!0)})})]})})},Xa=e=>{const{label:t,onChange:n,activeImage:r,tip:i}=e,{setOpenModal:a,setOnChange:u,setTip:s}=Sd();return d.jsx(d.Fragment,{children:d.jsxs("div",{className:Et.wrapper,onClick:c=>c.stopPropagation(),children:[t&&d.jsx("h4",{className:Et.label,children:t}),d.jsxs("div",{onClick:()=>{u(n),a(!0),i&&s(i)},className:Et.content,children:[d.jsx("div",{className:Et.icon,children:r?d.jsx("img",{src:`https://imagedelivery.net/${r}/w=156,h=156`,alt:"image",style:{width:"20px",height:"20px",objectFit:"contain"}}):d.jsx(ie,{name:"Plus",width:20,height:20,fill:"#757575"})}),d.jsx("span",{className:Et.text,children:r?"Change Image":"Select Image"}),r&&d.jsx(ie,{name:"X",width:20,height:18,fill:"#ff3f19",hoverable:!0,onClick:c=>{c.stopPropagation(),n([])}})]})]})})},QI=()=>{const{setOpenModal:e,onChange:t,tip:n,setTip:r}=Sd(),{setIsOpen:i}=eo(),[a,u]=k.useState(!1),s=()=>{var y;(y=c.current)==null||y.click()},c=k.useRef(null),[l,f]=k.useState([]),[h,g]=k.useState(!1),m=async y=>{var x;const S=((x=y.target.files)==null?void 0:x[0])||null;if(!S)return;const T=new FormData;T.append("file",S),g(!0);const{data:_}=await MI(T),v=[...l];v.unshift({..._.data,cfId:_.data.path}),f([...v]),g(!1)},b=y=>{y.preventDefault(),u(!1);const S=y.dataTransfer.files;if(S&&S.length>0){const _={target:{files:[S[0]]}};m(_)}},C=()=>{i(!1),r(""),setTimeout(()=>{e(!1),i(!0)},300)},I=y=>{const S=l.map(T=>({...T,isSelected:T.id===y.id?!T.isSelected:!1}));f([...S])};function E(){const y=l.find(S=>S.isSelected);y&&(t==null||t([y.cfId]))}return k.useEffect(()=>{(async()=>{const{data:S}=await OI(),T=S.data.map(_=>({..._,isSelected:!1}));f(T)})()},[]),d.jsxs("div",{onClick:y=>y.stopPropagation(),className:Et.modal,children:[d.jsxs("div",{className:Et.top,children:[d.jsx("h4",{className:Et.title,children:"Select Image"}),d.jsx(ie,{name:"X",width:20,height:20,hoverable:!0,onClick:C})]}),n&&d.jsx(r2,{type:"warning",message:n,padding:5}),d.jsx("div",{className:Et.modalContent,children:d.jsxs("div",{className:Et.images,children:[d.jsxs("div",{className:Et.input,onDragOver:y=>y.preventDefault(),onDragEnter:()=>u(!0),onDragLeave:()=>u(!1),onDrop:b,children:[d.jsxs("div",{onClick:s,className:ge(Et.add,{[Et.dragging]:a}),children:[d.jsx("div",{className:Et.icon,children:d.jsx(ie,{name:"Plus",width:20,height:20,fill:"#757575"})}),d.jsxs("div",{className:Et.description,children:[d.jsx("span",{children:"Drag and drop images here, or "}),d.jsx("span",{className:Et.highlight,children:"click to browse"}),d.jsx("br",{}),d.jsx("span",{className:Et.accent,children:"up to 10MB."})]})]}),d.jsx("input",{type:"file",ref:c,style:{display:"none"},onChange:m,multiple:!1,accept:"image/*"})]}),h&&d.jsx(v1,{}),l.map(y=>d.jsx(e7,{image:y,updateImage:I},y.id)),l.length===0&&[...new Array(5)].map((y,S)=>d.jsx(v1,{},S))]})}),d.jsxs("div",{className:Et.bottom,children:[d.jsx(Ei,{className:Et.cancel,onClick:C,type:"Secondary",children:"Cancel"}),d.jsx(Ei,{onClick:()=>{e(!1),E()},children:"Select"})]})]})},e7=e=>{const{image:t,updateImage:n}=e;return d.jsxs("div",{className:ge(Et.image,{[Et.selected]:t.isSelected}),onClick:()=>{n({...t,isSelected:!t.isSelected})},children:[d.jsx("div",{className:Et.checkbox,children:d.jsx(n2,{value:t.isSelected,onChange:r=>{n({...t,isSelected:r})}})}),d.jsx("img",{src:`https://imagedelivery.net/${t.cfId}/w=156,h=156`,alt:"image",style:{objectFit:"contain",width:"156px",height:"100px"}})]},t.id)},v1=()=>d.jsx("div",{className:Et.loading,children:d.jsx("div",{className:Et.spinner})}),t7="_title_1uycf_1",n7="_subtitle_1uycf_5",r7="_text_1uycf_13",o7="_top_1uycf_20",i7="_itemsBlock_1uycf_29",a7="_textSettings_1uycf_35",ui={title:t7,subtitle:n7,text:r7,top:o7,itemsBlock:i7,textSettings:a7},u7="_typeTexts_1gfda_1",s7="_block_1gfda_8",c7="_active_1gfda_25",Ec={typeTexts:u7,block:s7,active:c7},l7=["bold","italic","underline","strike-through"],kd=e=>{const{typesText:t,setTypesText:n}=e;function r(i){switch(i){case"bold":return"TextB";case"italic":return"TextItalic";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return d.jsx("div",{className:Ec.typeTexts,children:l7.map(i=>d.jsx("div",{className:ge(Ec.block,{[Ec.active]:t.includes(i)}),onClick:()=>{const a=[...t];if(a.includes(i)){const u=a.filter(s=>s!==i);n(u)}else a.push(i),n(a)},children:d.jsx(ie,{name:r(i),fill:t.includes(i)?"#252525":"#757575",width:20,height:20})},String(i)))})},d7="_wrapper_34cvp_1",f7="_label_34cvp_10",h7="_textarea_34cvp_18",p7="_length_34cvp_46",m7="_full_34cvp_54",ta={wrapper:d7,label:f7,textarea:h7,length:p7,full:m7},vd=e=>{const{onChange:t,label:n,value:r,maxLength:i,placeholder:a="Type something..."}=e,[u,s]=k.useState(r.length);return d.jsxs("div",{className:ta.wrapper,children:[n&&d.jsx("label",{className:ta.label,htmlFor:n,children:n}),d.jsx("textarea",{id:n,value:r,onChange:c=>{s(c.target.value.length),t(c.target.value)},placeholder:a,className:ta.textarea,maxLength:i}),i&&d.jsxs("div",{className:ge(ta.length,{[ta.full]:u===i}),children:[u,"/",i]})]})},Ld=e=>{const{typeFont:t,setTypeFont:n}=e,[r,i]=k.useState([]),a=()=>{const u=document.documentElement,s=getComputedStyle(u),c=["h1","h2","h3","h4","h5","h6","h7"].map(f=>s.getPropertyValue(`--font-heading-${f}-size`).trim()),l=["lg","md","sm"].map(f=>s.getPropertyValue(`--font-body-${f}-size`).trim());return c.push(...l),c};return k.useEffect(()=>{const u=a();u.every(s=>s)&&i(u)},[]),d.jsx(So,{label:"Type Text",options:Object.values(gu),onChange:u=>n(Object.keys(gu).find(s=>gu[s]===u)),value:gu[t],postfixs:r})},g7="_alignTexts_xs0ug_1",b7="_block_xs0ug_10",C7="_active_xs0ug_28",Sc={alignTexts:g7,block:b7,active:C7},I7=["left","center","right"],o2=e=>{const{alignText:t,setAlignText:n}=e;function r(i){switch(i){case"left":return"TextAlignLeft";case"center":return"TextAlignCenter";case"right":return"TextAlignRight"}}return d.jsx("div",{className:Sc.alignTexts,children:I7.map(i=>d.jsx("div",{className:ge(Sc.block,{[Sc.active]:t===i}),onClick:()=>{n(i)},children:d.jsx(ie,{name:r(i),fill:t===i?"#252525":"#757575",width:20,height:20})},String(i)))})},Dd=e=>{const{typesText:t,isActiveText:n,setIsActiveText:r,text:i,setText:a,setTypesText:u,title:s,subtitle:c="Items",typeFont:l,setTypeFont:f,alignText:h,setAlignText:g}=e;return d.jsxs("div",{className:ui.text,children:[(s||n!==void 0)&&d.jsxs("div",{className:ui.top,children:[s&&d.jsx("h3",{className:ui.title,children:s}),n!==void 0&&r&&d.jsx(Or,{current:n,onChange:m=>r(m)})]}),(n===void 0||n)&&d.jsxs("div",{className:ui.itemsBlock,children:[d.jsx("h5",{className:ui.subtitle,children:c}),d.jsx(vd,{onChange:m=>a(m),value:i}),d.jsxs("div",{className:ui.textSettings,children:[d.jsx(kd,{typesText:t,setTypesText:u}),d.jsx(o2,{alignText:h,setAlignText:g})]}),d.jsx(Ld,{typeFont:l,setTypeFont:f})]})]})},y7="_title_msd5s_1",E7="_subtitle_msd5s_5",S7="_productsBlock_msd5s_14",x7="_top_msd5s_26",_7="_products_msd5s_14",T7="_product_msd5s_14",w7="_button_msd5s_80",A7="_disabled_msd5s_91",k7="_buttons_msd5s_118",v7="_modal_msd5s_125",L7="_link_msd5s_146",D7="_modalOptions_msd5s_152",N7="_addButton_msd5s_165",R7="_deleteButton_msd5s_180",P7="_closeIcon_msd5s_192",Mt={title:y7,subtitle:E7,productsBlock:S7,top:x7,products:_7,product:T7,button:w7,disabled:A7,buttons:k7,modal:v7,link:L7,modalOptions:D7,addButton:N7,deleteButton:R7,closeIcon:P7},O7=k.forwardRef((e,t)=>{const{activeItem:n,setActiveItem:r,popupPosition:i,modalOptions:a,setIsOpenModal:u}=e;vi(t,()=>{r(null),u(!1)});function s(c,l){return c.length>l?`${c.slice(0,l)}...`:c}return d.jsxs("div",{ref:t,className:Mt.modal,onClick:c=>{c.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[d.jsxs("div",{className:Mt.top,children:[d.jsx("h3",{className:Mt.title,children:s(n.name["en-US"],20)}),d.jsx("div",{className:Mt.closeIcon,children:d.jsx(ie,{name:"X",height:20,width:20,onClick:()=>{r(null),u(!1)}})})]}),d.jsx("div",{className:Mt.modalOptions,children:a.map(c=>{if(c.type==="image")return d.jsx(Xa,{label:"Put up an attractive image",activeImage:n[c.field],onChange:l=>{const f={...n,[c.field]:l};r(f)}},String(c.field));if(c.type==="text")return d.jsx(Dd,{isActiveText:!0,typesText:n[c.field.type],setTypesText:l=>{const f={...n,[c.field.type]:l};r(f)},alignText:n[c.field.alignText],setAlignText:l=>{const f={...n,[c.field.alignText]:l};r(f)},text:n[c.field.text]["en-US"]||"",setText:l=>{const f={...n,[c.field.text]:{"en-US":l}};r(f)},typeFont:n[c.field.typeFont],setTypeFont:l=>{const f={...n,[c.field.typeFont]:l};r(f)},subtitle:c.label});if(c.type==="input")return d.jsx(ur,{onChange:l=>{const f={...n,[c.field]:l};r(f)},value:n[c.field]||"",label:c.label,placeholder:c.placeholder});if(c.type==="inputSwitch")return d.jsxs("div",{className:Mt.link,children:[d.jsx(ur,{onChange:l=>{const f={...n,[c.field.text]:l};r(f)},value:n[c.field.text]||"",label:c.inputLabel,placeholder:c.placeholder}),d.jsx(Or,{current:!!n[c.field.switch]||!1,label:c.switchLabel,onChange:l=>{const f={...n,[c.field.switch]:l};r(f)}})]});if(c.type==="list")return d.jsx(R2,{items:n[c.field]||[],setItems:l=>{const f={...n,[c.field]:l};r(f)},itemsType:"select",draggable:c.draggable||!1,itemsOptions:c.itemsOptions,deletable:c.deletable||!1,editable:c.editable||!1,subtitle:c.label,addableOptions:c.addableOptions,modalOptions:c.modalOptions});if(c.type==="select")return d.jsx(So,{options:c.itemsOptions,onChange:l=>{const f={...n,[c.field]:l};r(f)},label:c.label,value:n[c.field]||"String",leftAddonOptions:c.leftAddonOptions,switcher:c.switcher?{value:!!n[c.switcher],onChange:l=>{if(c.switcher==="isActive"){const f={...n,[c.switcher]:l};r(f)}}}:void 0});if(c.type==="selectTypeFont")return d.jsx(Ld,{typeFont:n[c.field],setTypeFont:l=>{const f={...n,[c.field]:l};r(f)}});if(c.type==="selectInfiniteList")return d.jsx(_d,{options:c.itemsOptions,onChange:l=>{const f={...n,[c.field]:l};r(f)},label:c.label,value:n[c.field]||"String",leftAddonOptions:c.leftAddonOptions,switcher:c.switcher?{value:!!n[c.switcher],onChange:l=>{if(c.switcher==="isActive"){const f={...n,[c.switcher]:l};r(f)}}}:void 0})})})]})}),M7="_other_1a1tk_1",F7="_subtitle_1a1tk_7",B7="_items_1a1tk_14",xc={other:M7,subtitle:F7,items:B7},i2=e=>{const{items:t,otherTitle:n,tagsTitle:r}=e;return d.jsxs("div",{className:xc.other,children:[d.jsx("h5",{className:xc.subtitle,children:n||r}),d.jsx("div",{className:xc.items,children:t.map((i,a)=>d.jsx(Or,{current:i.isItem,onChange:u=>i.setIsItem(u),label:i.label,hasBackground:!0,paddingless:!1},a))})]})};function H7(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return k.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const Ms=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ni(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Nd(e){return"nodeType"in e}function jn(e){var t,n;return e?Ni(e)?e:Nd(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Rd(e){const{Document:t}=jn(e);return e instanceof t}function Ka(e){return Ni(e)?!1:e instanceof jn(e).HTMLElement}function a2(e){return e instanceof jn(e).SVGElement}function Ri(e){return e?Ni(e)?e.document:Nd(e)?Rd(e)?e:Ka(e)||a2(e)?e.ownerDocument:document:document:document}const Pr=Ms?k.useLayoutEffect:k.useEffect;function Pd(e){const t=k.useRef(e);return Pr(()=>{t.current=e}),k.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function j7(){const e=k.useRef(null),t=k.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Pa(e,t){t===void 0&&(t=[e]);const n=k.useRef(e);return Pr(()=>{n.current!==e&&(n.current=e)},t),n}function Ja(e,t){const n=k.useRef();return k.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ls(e){const t=Pd(e),n=k.useRef(null),r=k.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function Dl(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let _c={};function Qa(e,t){return k.useMemo(()=>{if(t)return t;const n=_c[e]==null?0:_c[e]+1;return _c[e]=n,e+"-"+n},[e,t])}function u2(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((a,u)=>{const s=Object.entries(u);for(const[c,l]of s){const f=a[c];f!=null&&(a[c]=f+e*l)}return a},{...t})}}const mi=u2(1),ds=u2(-1);function U7(e){return"clientX"in e&&"clientY"in e}function Od(e){if(!e)return!1;const{KeyboardEvent:t}=jn(e.target);return t&&e instanceof t}function V7(e){if(!e)return!1;const{TouchEvent:t}=jn(e.target);return t&&e instanceof t}function Nl(e){if(V7(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return U7(e)?{x:e.clientX,y:e.clientY}:null}const Si=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Si.Translate.toString(e),Si.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),L1="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function z7(e){return e.matches(L1)?e:e.querySelector(L1)}const $7={display:"none"};function q7(e){let{id:t,value:n}=e;return k.createElement("div",{id:t,style:$7},n)}function W7(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return k.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function G7(){const[e,t]=k.useState("");return{announce:k.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const s2=k.createContext(null);function Z7(e){const t=k.useContext(s2);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Y7(){const[e]=k.useState(()=>new Set),t=k.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[k.useCallback(r=>{let{type:i,event:a}=r;e.forEach(u=>{var s;return(s=u[i])==null?void 0:s.call(u,a)})},[e]),t]}const X7={draggable:`
|
|
70
70
|
To pick up a draggable item, press the space bar.
|
|
71
71
|
While dragging, use the arrow keys to move the item.
|
|
72
72
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./builder.cjs.js"),e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./builder.cjs.js"),e=require("./index-DvKlS7S2.cjs");exports.App=t.App;exports.Checkout=t.Checkout;exports.ColorVariables=t.ColorVariables;exports.hotReload=t.hotReload;exports.iconNames=t.iconNames;exports.removeNotification=t.removeNotification;exports.showNotification=t.showNotification;exports.useBalance=t.useBalance;exports.useBuilderPages=t.useBuilderPages;exports.useCreateTicket=t.useCreateTicket;exports.MarkdownText=e.MarkdownText;exports.ReCaptchaProvider=e.ReCaptchaProvider;exports.aspectRatioOptions=e.aspectRatioOptions;exports.formatPrice=e.formatPrice;exports.parseDraftJsText=e.parseDraftJsText;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useAdaptiveStyles=e.useAdaptiveStyles;exports.useCart=e.useCart;exports.useGeneralInfo=e.useGeneralInfo;exports.useMarkdownIt=e.useMarkdownIt;exports.useReCaptcha=e.useReCaptcha;
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { App as s, Checkout as t, ColorVariables as o, hotReload as r, iconNames as i, removeNotification as p, showNotification as c, useBalance as n, useBuilderPages as u, useCreateTicket as f } from "./builder.es.js";
|
|
2
|
-
import { M as d, R as C, a as h, f as m, p as x, s as R, d as k, b as T, c as v, e as w, u as I } from "./index-
|
|
2
|
+
import { M as d, R as C, a as h, f as m, p as x, s as R, d as k, b as T, c as v, e as w, u as I } from "./index-D5nvpvqe.js";
|
|
3
3
|
export {
|
|
4
4
|
s as App,
|
|
5
5
|
t as Checkout,
|
|
@@ -10,6 +10,11 @@ export interface GatewayDetail {
|
|
|
10
10
|
isDiscount: boolean;
|
|
11
11
|
percentage: number;
|
|
12
12
|
};
|
|
13
|
+
serviceFee?: {
|
|
14
|
+
fixedAmount: number;
|
|
15
|
+
isDiscount: boolean;
|
|
16
|
+
percentage: number;
|
|
17
|
+
};
|
|
13
18
|
}
|
|
14
19
|
export declare const getGatewaysDetail: (gateways: string[]) => Promise<GatewayDetail[]>;
|
|
15
20
|
interface BaseTopUpSettings {
|
|
@@ -16,7 +16,12 @@ interface Options {
|
|
|
16
16
|
applyCouponPending: boolean;
|
|
17
17
|
customerEmail: string | null;
|
|
18
18
|
recaptcha: string;
|
|
19
|
-
|
|
19
|
+
priceAdjustment: {
|
|
20
|
+
fixedAmount: number;
|
|
21
|
+
isDiscount: boolean;
|
|
22
|
+
percentage: number;
|
|
23
|
+
} | null;
|
|
24
|
+
serviceFee: {
|
|
20
25
|
fixedAmount: number;
|
|
21
26
|
isDiscount: boolean;
|
|
22
27
|
percentage: number;
|
|
@@ -33,6 +38,11 @@ interface Options {
|
|
|
33
38
|
isDiscount: boolean;
|
|
34
39
|
percentage: number;
|
|
35
40
|
} | null) => void;
|
|
41
|
+
setServiceFee: (value: {
|
|
42
|
+
fixedAmount: number;
|
|
43
|
+
isDiscount: boolean;
|
|
44
|
+
percentage: number;
|
|
45
|
+
} | null) => void;
|
|
36
46
|
}
|
|
37
47
|
export declare const useCartStore: import("zustand").UseBoundStore<import("zustand").StoreApi<Options>>;
|
|
38
48
|
export {};
|
package/dist/ui.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CGYkmUYN.cjs"),h=require("react");require("react-dom");const dt="_block_kh9z8_8",ut="_title_kh9z8_16",xt="_subtitle_kh9z8_23",mt="_alignmentContent_kh9z8_30",pt="_alignments_kh9z8_39",jt="_alignment_kh9z8_30",ht="_circle_kh9z8_64",gt="_paddings_kh9z8_71",ft="_padding_kh9z8_71",yt="_active_kh9z8_97",z={block:dt,title:ut,subtitle:xt,alignmentContent:mt,alignments:pt,alignment:jt,circle:ht,paddings:gt,padding:ft,active:yt},_t=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],Et=["left","top","right","bottom"],Rt=u=>{const{alignment:n,padding:r,setPadding:s,setAlignment:a,isAlignment:e=!0,isPadding:x=!0}=u;function d(l){switch(l){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function j(l){switch(l){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}const[f,k]=h.useState(null),[b,c]=h.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:z.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:z.title,children:"Layout (for Desktop version)"}),t.jsxRuntimeExports.jsxs("div",{className:z.alignmentContent,children:[e&&t.jsxRuntimeExports.jsxs("div",{className:z.block,children:[t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsx("div",{className:z.alignments,children:_t.map(l=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{a(l)},className:z.alignment,onMouseEnter:()=>{k(l)},onMouseLeave:()=>{k(null)},children:[l!==n&&f!==l&&t.jsxRuntimeExports.jsx("div",{className:z.circle}),l!==n&&f===l&&t.jsxRuntimeExports.jsx(t.Icon,{name:d(f),fill:"#c2c2c2",width:22,height:22}),l===n&&t.jsxRuntimeExports.jsx(t.Icon,{name:d(n),fill:"#FF3F19",width:22,height:22})]},l))})]}),x&&t.jsxRuntimeExports.jsxs("div",{className:z.block,children:[t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:"Paddings"}),t.jsxRuntimeExports.jsx("div",{className:z.paddings,children:Et.map(l=>t.jsxRuntimeExports.jsxs("label",{className:t.clx(z.padding,{[z.active]:b===l}),onFocus:()=>{c(l)},onBlur:()=>{c(null)},children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:j(l),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(r[l]),onChange:y=>s({...r,[l]:Math.min(Number(y),999)}),max:999,paddingless:!0,borderless:!0})]},l))})]})]})]})},bt="_title_82zux_1",vt="_subtitle_82zux_5",It="_productsBlock_82zux_14",St="_top_82zux_26",Nt="_products_82zux_14",Ct="_product_82zux_14",Pt="_button_82zux_80",kt="_disabled_82zux_91",Tt="_buttons_82zux_118",wt="_addButton_82zux_157",Bt="_deleteButton_82zux_179",F={title:bt,subtitle:vt,productsBlock:It,top:St,products:Nt,product:Ct,button:Pt,disabled:kt,buttons:Tt,addButton:wt,deleteButton:Bt};function Mt({id:u,children:n}){const{attributes:r,listeners:s,setNodeRef:a,transform:e,transition:x,isDragging:d}=t.useSortable({id:u}),j={transform:t.CSS.Transform.toString(e),transition:x};return t.jsxRuntimeExports.jsx("div",{ref:a,style:j,className:`${F.product} ${d?F.dragging:""}`,...r,...s,children:n})}const $t=u=>{const{isActiveItems:n,setIsActiveItems:r,items:s,setItems:a,other:e,tags:x,title:d,subtitle:j,draggable:f=!1,withImage:k=!1,addable:b=!0,itemsOptions:c,hasRangeSelector:l=!1,rangeSelectorOptions:y,limit:g,autoScrollInterval:m,deletable:o,aspectRatio:_,setAspectRatio:S}=u,M=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}})),A=i=>{const{active:E,over:N}=i;if(N&&E.id!==N.id){const $=s.findIndex(v=>v===E.id),w=s.findIndex(v=>v===N.id);if($!==-1&&w!==-1){const v=[...s],[Y]=v.splice($,1);v.splice(w,0,Y),a(v)}}};function V(i){if(k)return i?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const q=(i,E=!1)=>{const N=c.find(w=>w.id===i);if(!N)return;const $=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:w=>{const v=[...s],Y=c.find(p=>p.name===w);if(!Y)return;const R=Y.id,O=v.map(p=>p===i?R:p);a([...O])},value:N.name,options:c.filter(w=>!s.find(v=>v===w.id)).map(w=>w.name),leftAddonOptions:c.map(w=>({value:w.name,addon:V(w.images)}))}),E&&t.jsxRuntimeExports.jsx("div",{className:F.buttons,children:t.jsxRuntimeExports.jsx("div",{className:F.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(w=>w!==i))})})})]});return f?t.jsxRuntimeExports.jsx(Mt,{id:i,children:$},t.v4()):t.jsxRuntimeExports.jsx("div",{className:F.product,children:$},t.v4())};return t.jsxRuntimeExports.jsxs("div",{className:F.productsBlock,children:[(d||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:F.top,children:[d&&t.jsxRuntimeExports.jsx("h3",{className:F.title,children:d}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:i=>r==null?void 0:r(i)})]}),l&&y&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...y}),t.jsxRuntimeExports.jsxs("div",{className:F.products,children:[j&&t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:j}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:M,onDragEnd:A,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s,strategy:t.verticalListSortingStrategy,children:s.map(i=>q(i,o))})}):s.map(i=>q(i,o)),b&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",gap:5},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(F.button,{[F.disabled]:!!(g&&g<=s.length||s.length===c.length)}),size:"s",disabled:!!(g&&g<=s.length||s.length===c.length),onClick:()=>{const i=[...s];let E=null;if(c){for(let N=0;N<c.length;N++)if(!s.find($=>$===c[N].id)){E=c[N];break}}i.push((E==null?void 0:E.id)||c[0].id),a(i)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:F.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),_&&S&&t.jsxRuntimeExports.jsx(t.Select,{value:_,label:"Aspect Ratio",options:Object.keys(t.aspectRatio),onChange:i=>S(i),leftAddonOptions:t.aspectRatioOptions}),x!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{tagsTitle:"Tags",items:x}),e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e}),m!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(m.scrollInterval),onChange:i=>m.setScrollInterval(Number(i)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Ot="_title_roi3a_1",At="_subtitle_roi3a_5",qt="_productsBlock_roi3a_14",Dt="_top_roi3a_26",Lt="_products_roi3a_14",Ut="_product_roi3a_14",Ht="_button_roi3a_80",zt="_disabled_roi3a_91",Ft="_buttons_roi3a_118",Vt="_addButton_roi3a_164",Yt="_deleteButton_roi3a_179",H={title:Ot,subtitle:At,productsBlock:qt,top:Dt,products:Lt,product:Ut,button:Ht,disabled:zt,buttons:Ft,addButton:Vt,deleteButton:Yt};function Gt({product:u,children:n}){const{attributes:r,listeners:s,setNodeRef:a,transform:e,transition:x,isDragging:d}=t.useSortable({id:u.id}),j={transform:t.CSS.Transform.toString(e),transition:x};return t.jsxRuntimeExports.jsx("div",{ref:a,style:j,className:`${H.product} ${d?H.dragging:""}`,...r,...s,children:n})}const Wt=u=>{const{isActiveItems:n,setIsActiveItems:r,items:s,setItems:a,title:e,subtitle:x,editable:d=!0,draggable:j=!1,deletable:f=!0,addable:k=!0,itemsType:b,itemsOptions:c,addableOptions:l={},limit:y}=u,[g,m]=h.useState(null),[o,_]=h.useState(null),S=h.useRef(null),M=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{if(g){const i=[...s].map(E=>E.id===g.id?g:E);a(i)}},[g]),h.useEffect(()=>{S.current&&o&&(S.current.getBoundingClientRect().height,o.top)},[S.current,o]);const A=(i,E)=>{i.stopPropagation();const N=i.target.getBoundingClientRect();_({top:N.top+window.scrollY,left:N.left-30}),m(E)},V=i=>{const{active:E,over:N}=i;if(N&&E.id!==N.id){const $=s.findIndex(v=>v.id===E.id),w=s.findIndex(v=>v.id===N.id);if($!==-1&&w!==-1){const v=[...s],[Y]=v.splice($,1);v.splice(w,0,Y),a(v)}}},q=(i,E)=>{const N=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[j&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),b==="select"&&c&&t.jsxRuntimeExports.jsx(t.Select,{onChange:$=>{const w=[...s],v=c.find(R=>R.name===$);if(!v)return;const Y=w.map(R=>R.id===i.id?{...v,name:{"en-US":$}}:R);m({...i,name:{"en-US":$}}),a([...Y])},value:i.name,options:c.filter($=>!s.find(w=>w.name===$.name)).map($=>$.name)}),t.jsxRuntimeExports.jsxs("div",{className:H.buttons,children:[d&&t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:$=>A($,i)})}),f&&t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter($=>$.id!==i.id))})})]})]});return j?t.jsxRuntimeExports.jsx(Gt,{product:i,index:E,children:N},i.id):t.jsxRuntimeExports.jsx("div",{className:H.product,children:N},i.id)};return t.jsxRuntimeExports.jsxs("div",{className:H.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:H.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:i=>r==null?void 0:r(i)})]}),t.jsxRuntimeExports.jsxs("div",{className:H.products,children:[x&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:x}),j?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:M,onDragEnd:V,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(i=>i.id),strategy:t.verticalListSortingStrategy,children:s.map((i,E)=>q(i,E))})}):s.map((i,E)=>q(i,E)),k&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(H.button,{[H.disabled]:!!(y&&y<=s.length||s.length===(c==null?void 0:c.length))}),size:"s",disabled:!!(y&&y<=s.length||s.length===(c==null?void 0:c.length)),onClick:()=>{const i=[...s];let E=null;if(c){for(let N=0;N<c.length;N++)if(!s.find($=>$.id===c[N].id)){E=c[N];break}}b==="select"&&c&&i.push({name:E?E.name:c[0].name,id:(E==null?void 0:E.id)||c[0].id,...l}),a(i)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:H.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})]})};function Xt(u){const{product:n,children:r}=u,{attributes:s,listeners:a,setNodeRef:e,transform:x,transition:d,isDragging:j}=t.useSortable({id:n.id}),f={transform:t.CSS.Transform.toString(x),transition:d};return t.jsxRuntimeExports.jsx("div",{ref:e,style:f,className:`${t.styles.product} ${j?t.styles.dragging:""}`,...s,...a,children:r})}const Qt=u=>{const{isActiveItems:n,setIsActiveItems:r,items:s,setItems:a,other:e,title:x,subtitle:d,editable:j=!0,draggable:f=!1,deletable:k=!0,addable:b=!0,itemsType:c,itemsPlaceholder:l="",itemsOptions:y,hasRangeSelector:g=!1,rangeSelectorOptions:m,modalOptions:o,addableOptions:_={},limit:S}=u,[M,A]=h.useState(null),[V,q]=h.useState({top:0,left:0}),[i,E]=h.useState(null),N=h.useRef(null),[$,w]=h.useState(!1),v=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{const p=()=>{A(null),w(!1)};return document.body.addEventListener("click",p),A(null),w(!1),()=>{A(null),w(!1),document.body.removeEventListener("click",p)}},[]),h.useEffect(()=>{if(M){const p=[...s].map(I=>I.id===M.id?M:I);a(p)}},[M]),h.useEffect(()=>{if(N.current&&i){const p=N.current.getBoundingClientRect().height,I=window.innerHeight;let T=i.top;T+p>I+window.scrollY-200&&(T=I+window.scrollY-p-200),T<0&&(T=10),q({top:T,left:i.left})}},[N.current,i]);const Y=(p,I)=>{p.stopPropagation();const T=p.target.getBoundingClientRect();E({top:T.top+window.scrollY,left:T.left-30}),A(I),w(!0)},R=p=>{const{active:I,over:T}=p;if(T&&I.id!==T.id){const P=s.findIndex(L=>L.id===I.id),G=s.findIndex(L=>L.id===T.id);if(P!==-1&&G!==-1){const L=[...s],[U]=L.splice(P,1);L.splice(G,0,U),a(L)}}},O=p=>{var T;const I=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),c==="select"&&y&&t.jsxRuntimeExports.jsx(t.Select,{onChange:P=>{const L=[...s].map(U=>U.id===p.id?{...p,name:{"en-US":P}}:U);A({...p,name:{"en-US":P}}),a([...L])},value:p.name["en-US"],options:y.filter(P=>!s.find(G=>G.name["en-US"]===P))}),c==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:P=>{const L=[...s].map(U=>U.id===p.id?{...p,name:{"en-US":P}}:U);a([...L])},value:p.name["en-US"],placeholder:l}),c==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:P=>{const L=[...s].map(U=>U.id===p.id?{...p,images:P}:U);a([...L])},activeImage:(T=s.find(P=>P.id===p.id))==null?void 0:T.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.buttons,children:[j&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:P=>Y(P,p)})}),k&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(P=>P.id!==p.id))})})]})]});return f?t.jsxRuntimeExports.jsx(Xt,{product:p,children:I},p.id):t.jsxRuntimeExports.jsx("div",{className:t.styles.product,children:I},p.id)};return t.jsxRuntimeExports.jsxs("div",{className:t.styles.productsBlock,children:[(x||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles.top,children:[x&&t.jsxRuntimeExports.jsx("h3",{className:t.styles.title,children:x}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:p=>r==null?void 0:r(p)})]}),M&&j&&o&&$&&t.jsxRuntimeExports.jsx(t.ItemPopup,{ref:N,activeItem:M,setActiveItem:A,popupPosition:V,modalOptions:o,setIsOpenModal:w}),g&&m&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...m}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:t.styles.subtitle,children:d}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:v,onDragEnd:R,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(p=>p.id),strategy:t.verticalListSortingStrategy,children:s.map(p=>O(p))})}):s.map(p=>O(p)),b&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(t.styles.button,{[t.styles.disabled]:!!(S&&S<=s.length)}),size:"s",disabled:!!(S&&S<=s.length),onClick:()=>{const p=[...s];let I=null;if(y){for(let T=0;T<y.length;T++)if(!s.find(P=>P.name["en-US"]===y[T])){I=y[T];break}}c==="select"&&y?p.push({name:{"en-US":I||y[0]},id:t.v4(),..._,maxSymbols:100}):c==="input"?p.push({name:{"en-US":""},id:t.v4(),..._,maxSymbols:100}):p.push({name:{"en-US":`Image ${s.length+1}`},id:t.v4(),..._,maxSymbols:100}),a(p)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e})]})},Jt="_subtitle_jql1y_1",Kt="_products_jql1y_10",Zt="_product_jql1y_10",te="_button_jql1y_11",ee="_buttons_jql1y_11",se="_addButton_jql1y_150",ne="_deleteButton_jql1y_165",X={subtitle:Jt,products:Kt,product:Zt,button:te,buttons:ee,addButton:se,deleteButton:ne},nt=u=>{const{buttons:n,setButtons:r,deletable:s=!0,addable:a=!0,editableLink:e=!0}=u,{pages:x}=t.usePagesStore(),[d,j]=h.useState(null),[f,k]=h.useState({top:0,left:0}),[b,c]=h.useState(null),l=h.useRef(null);h.useEffect(()=>{if(d){const m=[...n].map(o=>o.id===d.id?d:o);r(m)}},[d]),h.useEffect(()=>{if(l.current&&b){const m=l.current.getBoundingClientRect().height,o=window.innerHeight;let _=b.top;_+m>o+window.scrollY-200&&(_=o+window.scrollY-m-200),_<0&&(_=10),k({top:_,left:b.left})}},[l.current,b]);const y=(m,o)=>{m.stopPropagation();const _=m.target.getBoundingClientRect();c({top:_.top+window.scrollY-70,left:_.left-(a?30:65)}),j(o)},g=(m,o)=>{const _=[...n],S={...m,id:Math.random().toString(36).substr(2,9)};_.splice(o+1,0,S),r(_)};return t.jsxRuntimeExports.jsxs("div",{className:X.products,children:[t.jsxRuntimeExports.jsx("h5",{className:X.subtitle,children:"Button Type"}),n.map((m,o)=>t.jsxRuntimeExports.jsxs("div",{className:X.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:_=>{const M=[...n].map(A=>A.id===m.id?{...m,type:_}:A);r(M)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:X.buttons,children:[t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy",hoverable:!0,width:20,height:20,onClick:()=>{g(m,o)}})}),t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:_=>{y(_,m)}})}),s&&t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const _=n.filter(S=>S.id!==m.id);r(_)},width:20,height:20,fill:"#C12A2A"})})]})]},m.id)),d&&t.jsxRuntimeExports.jsx(t.ButtonPopup,{ref:l,activeButton:d,setActiveButton:j,popupPosition:f,editableLink:e}),a&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:X.button,size:"s",onClick:()=>{const m=[...n];e?m.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Button Name"},destination:"Go to Page",page:x?Object.values(x)[0].path:"/",openInNewTab:!1}):m.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Create Ticket"},destination:"Go to Page",page:x?Object.values(x)[0].path:"/",openInNewTab:!1}),r(m)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:X.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})},ie=u=>{const{isActiveButtons:n,setIsActiveButtons:r,buttons:s,setButtons:a,editableLink:e=!0,addable:x=!0,deletable:d=!0}=u;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.top,children:[t.jsxRuntimeExports.jsx("h3",{className:t.styles$1.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:j=>r(j)})]}),n&&t.jsxRuntimeExports.jsx(nt,{buttons:s,setButtons:a,editableLink:e,addable:x,deletable:d})]})})};function oe(u){const{product:n,children:r}=u,{attributes:s,listeners:a,setNodeRef:e,transform:x,transition:d,isDragging:j}=t.useSortable({id:String(n.listingId)}),f={transform:t.CSS.Transform.toString(x),transition:d};return t.jsxRuntimeExports.jsx("div",{ref:e,style:f,className:`${t.styles$2.product} ${j?t.styles$2.dragging:""}`,...s,...a,children:r})}const re=u=>{const{isActiveItems:n,setIsActiveItems:r,items:s,setItems:a,other:e,title:x,subtitle:d,editable:j=!0,draggable:f=!1,withImage:k=!1,deletable:b=!0,addable:c=!0,itemsType:l,itemsOptions:y,limit:g,aspectRatio:m,setAspectRatio:o}=u,[_,S]=h.useState(null),[M,A]=h.useState({top:0,left:0}),[V,q]=h.useState(!1),i=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{const R=()=>{S(null),q(!1)};return document.body.addEventListener("click",R),S(null),q(!1),()=>{S(null),q(!1),document.body.removeEventListener("click",R)}},[]),h.useEffect(()=>{if(_){const R=[...s].map(O=>O.listingId===_.listingId?_:O);a(R)}},[_]);const E=(R,O)=>{R.stopPropagation();const p=R.target.getBoundingClientRect(),I=100,T=window.innerHeight;let P=p.top+window.scrollY;P+I>T&&(P=T-I-20),q(!0),A({top:P-80,left:p.left-30}),S(O)};function N(R){if(k)return R?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${R}/w=50`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const $=R=>{const{active:O,over:p}=R;if(p&&O.id!==p.id){const I=s.findIndex(P=>String(P.listingId)===O.id),T=s.findIndex(P=>String(P.listingId)===p.id);if(I!==-1&&T!==-1){const P=[...s],[G]=P.splice(I,1);P.splice(T,0,G),a(P)}}},w=()=>{q(!1),S(null)},v=R=>{const O=y.find(I=>R.listingId===I.id);if(!O)return null;const p=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),l==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:I=>{const T=[...s],P=y.find(U=>U.productData.name===I);if(!P)return;const G={listingId:P.id,image:P.productData.images.length>0?P.productData.images[0].cfId:""},L=T.map(U=>U.listingId===R.listingId?G:U);S(G),a([...L])},value:O.productData.name,options:[...y.filter(I=>!s.find(T=>T.listingId===I.id)).map(I=>I.productData.name)],leftAddonOptions:y.map(I=>{var T;return{value:I.productData.name,addon:N(((T=I.productData.images[0])==null?void 0:T.cfId)||"")}})}),t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.buttons,children:[j&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:I=>E(I,R)})}),b&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(I=>I!==R))})})]})]});return f?t.jsxRuntimeExports.jsx(oe,{product:R,children:p},R.listingId):t.jsxRuntimeExports.jsx("div",{className:t.styles$2.product,children:p},R.listingId)},Y=h.useRef(null);return t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.productsBlock,children:[(x||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.top,children:[x&&t.jsxRuntimeExports.jsx("h3",{className:t.styles$2.title,children:x}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:R=>r==null?void 0:r(R)})]}),V&&_&&t.jsxRuntimeExports.jsx(t.ListingPopup,{ref:Y,activeItem:_,setActiveItem:S,setIsOpenModal:q,popupPosition:M,itemsOptions:y}),n&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:t.styles$2.subtitle,children:d}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:i,onDragEnd:$,onDragStart:w,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(R=>String(R.listingId)),strategy:t.verticalListSortingStrategy,children:s.map(R=>v(R))})}):s.map(R=>v(R)),c&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.styles$2.button,size:"s",onClick:()=>{const R=[...s];for(let O=0;O<y.length;O++)if(!s.find(p=>p.listingId===y[O].id)){R.push({listingId:y[O].id,image:y[O].productData.images.length>0?y[O].productData.images[0].cfId:""});break}a(R)},disabled:s.length===(g||y.length),style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),m&&o&&t.jsxRuntimeExports.jsx(t.Select,{value:m,options:Object.keys(t.aspectRatio),onChange:R=>o(R),leftAddonOptions:t.aspectRatioOptions}),n&&e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e})]})},ae="_options_s4lx3_1",ce="_price_s4lx3_18",le="_oldPrice_s4lx3_25",de="_newPrice_s4lx3_34",ue="_animate_s4lx3_42",xe="_meta_s4lx3_60",me="_info_s4lx3_66",pe="_infoRight_s4lx3_75",je="_buttons_s4lx3_82",he="_variants_s4lx3_89",ge="_variant_s4lx3_89",fe="_stock_s4lx3_107",ye="_variantInfo_s4lx3_115",_e="_quantity_s4lx3_122",Ee="_button_s4lx3_82",Re="_activeVariant_s4lx3_168",be="_chargeTypes_s4lx3_172",ve="_charge_s4lx3_172",Ie="_chargeActive_s4lx3_197",Se="_title_s4lx3_205",B={options:ae,price:ce,oldPrice:le,newPrice:de,animate:ue,meta:xe,info:me,infoRight:pe,buttons:je,variants:he,variant:ge,stock:fe,variantInfo:ye,quantity:_e,button:Ee,activeVariant:Re,chargeTypes:be,charge:ve,chargeActive:Ie,title:Se};var Z=(u=>(u.ONE_TIME="One-Time",u.RECURRING="Subscribe & Save",u))(Z||{});const it=u=>{var V,q;const{product:n,setIsOpen:r,isCartEnabled:s=!0}=u,{variants:a}=n,[e,x]=h.useState(a[0]),[d,j]=h.useState(e.chargeTypes?e.chargeTypes[0]:"ONE_TIME"),{notifications:f,setNotifications:k}=t.useNotificationStore(),b=t.useNavigate(),[c,l]=h.useState(1),{cart:y,reset:g,addProductToCart:m}=t.useCart(),[o,_]=h.useState(!1);h.useEffect(()=>{_(!0);const i=setTimeout(()=>_(!1),600);return()=>clearTimeout(i)},[c]);async function S(){try{m({productId:n.id,productVariantId:e.id,chargeType:d,quantity:c}),k([...f,{id:t.v4(),message:"Product added to cart",status:"success"}])}catch(i){const E=i;k([...f,{id:t.v4(),message:`Product failed to add to cart: ${E.message}`,status:"error"}])}r==null||r(!1)}function M(){g(),S(),b("/checkout")}function A(i){if(i>=864e5){const v=Math.floor(i/864e5);return`${v} ${v===1?"day":"days"}`}else if(i>=36e5){const v=Math.floor(i/36e5);return`${v} ${v===1?"hour":"hours"}`}else if(i>=6e4){const v=Math.floor(i/6e4);return`${v} ${v===1?"minute":"minutes"}`}else{const v=Math.floor(i/1e3);return`${v} ${v===1?"second":"seconds"}`}}return h.useEffect(()=>{e.quantity&&e.quantity.available===0?l(0):l(1)},[e.quantity.available]),h.useEffect(()=>{e.chargeTypes&&j(e.chargeTypes.includes(d)?d:e.chargeTypes[0])},[e.chargeTypes]),t.jsxRuntimeExports.jsxs("div",{className:B.options,children:[e.chargeTypes&&e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:B.chargeTypes,children:e.chargeTypes.map(i=>t.jsxRuntimeExports.jsx("div",{className:t.clx(B.charge,{[B.chargeActive]:d===i}),onClick:()=>j(i),children:Z[i]},i))}),t.jsxRuntimeExports.jsx("div",{className:B.variants,children:a.filter(i=>{var E;return(E=i.chargeTypes)==null?void 0:E.includes(d)}).map(i=>{var E,N;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(B.variant,{[B.activeVariant]:e.id===i.id}),onClick:()=>{x(i),l(1)},children:[t.jsxRuntimeExports.jsxs("div",{className:B.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:B.title,id:"h4",dangerouslySetInnerHTML:{__html:t.splitTextIntoSpans(i.name)}}),t.jsxRuntimeExports.jsxs("span",{id:"md",children:[t.formatPrice({amount:d==="ONE_TIME"?i.price.amount:i.subscriptionSettings?i.subscriptionSettings.price.amount:0,currency:d==="ONE_TIME"?i.price.currency:i.subscriptionSettings?i.subscriptionSettings.price.currency:"USD"})," ",d==="RECURRING"&&i.subscriptionSettings&&` / ${t.normalizeInterval(i.subscriptionSettings.recurringIntervalDays||0)}`]})]}),t.jsxRuntimeExports.jsx("div",{id:"md",children:d==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:B.stock,id:"md",children:[(E=i.quantity.restrictions)!=null&&E.max||i.quantity.available!==void 0?((N=i.quantity.restrictions)==null?void 0:N.max)||i.quantity.available:"∞"," ","in stock"]})})]},i.id)})}),d==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:B.quantity,id:"md",children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{c>1?l(i=>i-1):l(1)},className:B.button,disabled:e.quantity.available&&e.quantity.restrictions&&c<=e.quantity.restrictions.min||e.quantity.available===0,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx(t.Input$1,{type:"number",value:String(c),onChange:i=>{e.quantity.available&&Number(i)>e.quantity.available?l(e.quantity.available):l(Number(i))},max:((V=e.quantity.restrictions)==null?void 0:V.max)||e.quantity.available||Number.POSITIVE_INFINITY,min:((q=e.quantity.restrictions)==null?void 0:q.min)||0,centered:!0,disabled:e.quantity&&e.quantity.available===0||Object.keys(e.quantity.restrictions||{}).length!==0&&c>=e.quantity.restrictions.max}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{l(i=>i+1)},className:B.button,disabled:!!(e.quantity.available&&e.quantity.restrictions&&c>=e.quantity.restrictions.max||e.quantity.available===0||e.quantity.available&&c>=e.quantity.available),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:B.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:B.info,children:[t.jsxRuntimeExports.jsx("span",{id:"md",children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:B.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"var(--text-action)",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{id:"md",children:!e.deliveryTime||e.deliveryTime===0?"Instant":A(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:B.info,children:[t.jsxRuntimeExports.jsx("span",{id:"md",children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:B.infoRight,children:d==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:B.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(B.newPrice,{[B.animate]:o}),children:t.formatPrice({amount:e.price.amount*c,currency:e.price.currency})}),t.jsxRuntimeExports.jsx("span",{className:B.oldPrice,id:"md",children:t.formatPrice({amount:e.compareAtPrice.amount*c,currency:e.compareAtPrice.currency})})]}):t.jsxRuntimeExports.jsx("span",{className:t.clx(B.newPrice,{[B.animate]:o}),id:"md",children:t.formatPrice({amount:e.price.amount*c,currency:e.price.currency})}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:B.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(B.newPrice,{[B.animate]:o}),id:"md",children:t.formatPrice({amount:e.subscriptionSettings.price.amount*c,currency:e.subscriptionSettings.price.currency})}),t.jsxRuntimeExports.jsx("span",{className:B.oldPrice,id:"md",children:t.formatPrice({amount:e.subscriptionSettings.compareAtPrice.amount*c,currency:e.subscriptionSettings.compareAtPrice.currency})})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsx("span",{className:t.clx(B.newPrice,{[B.animate]:o}),id:"md",children:t.formatPrice({amount:e.subscriptionSettings.price.amount*c,currency:e.subscriptionSettings.price.currency})})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:B.buttons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>M(),disabled:e.quantity&&e.quantity.available===0||c===0,children:d==="ONE_TIME"?"Buy Now":"Subscribe Now"}),d==="ONE_TIME"&&s&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>S(),disabled:e.quantity&&e.quantity.available===0||c===0,children:y.parts.some(i=>i.productId===n.id&&i.productVariantId===e.id)?"Add More":"Add to Cart"})]})]})},Ne="_buttons_1uy6y_23",Ce="_modal_1uy6y_32",Pe="_closing_1uy6y_65",ke="_info_1uy6y_114",Te="_top_1uy6y_121",we="_title_1uy6y_132",Be="_clear_1uy6y_139",Me="_activeClear_1uy6y_146",$e="_count_1uy6y_150",Oe="_cart_1uy6y_165",Ae="_empty_1uy6y_173",qe="_product_1uy6y_199",De="_products_1uy6y_208",Le="_image_1uy6y_216",Ue="_productInfo_1uy6y_233",He="_content_1uy6y_240",ze="_name_1uy6y_246",Fe="_price_1uy6y_252",Ve="_productButtons_1uy6y_258",Ye="_productButton_1uy6y_258",Ge="_productCount_1uy6y_275",We="_bottom_1uy6y_292",Xe="_subtotal_1uy6y_300",Qe="_block_1uy6y_308",Je="_shoppingCount_1uy6y_315",Ke="_total_1uy6y_335",Ze="_link_1uy6y_341",ts="_userInfo_1uy6y_348",es="_pagesMobileModal_1uy6y_360",ss="_pagesMobileModalContent_1uy6y_374",ns="_pagesMobileModalHeader_1uy6y_380",is="_pagesMobileModalFooter_1uy6y_390",os="_pageLink_1uy6y_397",rs="_rightButtons_1uy6y_406",C={buttons:Ne,modal:Ce,closing:Pe,info:ke,top:Te,title:we,clear:Be,activeClear:Me,count:$e,cart:Oe,empty:Ae,product:qe,products:De,image:Le,productInfo:Ue,content:He,name:ze,price:Fe,productButtons:Ve,productButton:Ye,productCount:Ge,bottom:We,subtotal:Xe,block:Qe,shoppingCount:Je,total:Ke,link:Ze,userInfo:ts,pagesMobileModal:es,pagesMobileModalContent:ss,pagesMobileModalHeader:ns,pagesMobileModalFooter:is,pageLink:os,rightButtons:rs,delete:"_delete_1uy6y_413"},as=u=>{const{shopping:n,signUp:r,isShowUserInfo:s=!0}=u;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:(n||s)&&t.jsxRuntimeExports.jsxs("div",{className:C.buttons,children:[n&&t.jsxRuntimeExports.jsx(ot,{}),s&&t.jsxRuntimeExports.jsx(tt,{signUp:r})]})})},ot=()=>{const[u,n]=h.useState(!1),[r,s]=h.useState([]),[a,e]=h.useState(!1),{cart:x,products:d}=t.useCart();h.useEffect(()=>{(async()=>{const c=x.parts.map(g=>String(g.productId)),l=d.filter(g=>c.includes(String(g.id)))||[],y=x.parts.map(g=>{const m=l.find(o=>o.id===g.productId);return m?{...m,activeVariantId:g.productVariantId,quantity:g.quantity,chargeType:g.chargeType}:null}).filter(Boolean);s(y)})()},[x.parts,d]);function j(b){return!b||!(b!=null&&b.variants)?!1:b.chargeType==="RECURRING"}const f=x.parts.length>0&&r.length>0&&!j(r[0]);function k(){e(!1),setTimeout(()=>{n(!1)},300)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",style:{padding:10,position:"relative"},onClick:b=>{b.stopPropagation(),window.location.pathname.includes("/admin/builder")||(n(!0),e(!0))},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"}),f&&t.jsxRuntimeExports.jsx("div",{className:C.shoppingCount,children:x.parts.length})]}),u&&t.jsxRuntimeExports.jsx(t.Modal,{close:k,withAnimation:!1,children:t.jsxRuntimeExports.jsx(rt,{activeProducts:r,isCartNotEmpty:f,isOpen:a,close:k})})]})},rt=u=>{var g,m;const{activeProducts:n,isCartNotEmpty:r,isOpen:s,close:a}=u,{cart:e,reset:x,getTotalAndDiscount:d,updateQuantityOfProduct:j,removeProduct:f}=t.useCart(),k=t.useNavigate();function b(o,_){k(o,{replace:_})}function c(o){o.quantity&&j({productId:o.id,productVariantId:o.activeVariantId,quantity:o.quantity+1,chargeType:o.chargeType})}function l(o){o.quantity&&j({productId:o.id,productVariantId:o.activeVariantId,quantity:o.quantity-1,chargeType:o.chargeType})}function y(o){f({productId:o.id,productVariantId:o.activeVariantId,quantity:o.quantity||1,chargeType:o.chargeType})}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(C.modal,{[C.closing]:!s}),onClick:o=>o.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:C.top,children:[t.jsxRuntimeExports.jsxs("div",{className:C.info,children:[t.jsxRuntimeExports.jsx("span",{className:C.title,id:"h4",children:"Cart"}),r&&t.jsxRuntimeExports.jsx("div",{className:C.count,id:"md",children:e.parts.length})]}),t.jsxRuntimeExports.jsxs("div",{className:C.rightButtons,children:[r&&t.jsxRuntimeExports.jsx("button",{className:t.clx(C.clear,{[C.activeClear]:r}),disabled:!r,onClick:x,id:"md",children:"Clear all"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",onClick:a,hoverable:!0,width:24,height:24,fill:"var(--text-primary)"})]})]}),r?t.jsxRuntimeExports.jsxs("div",{className:C.cart,children:[t.jsxRuntimeExports.jsx("div",{className:C.products,children:n.map(o=>{var _,S;return t.jsxRuntimeExports.jsxs("div",{className:C.product,children:[t.jsxRuntimeExports.jsxs("div",{className:C.productInfo,children:[o.images.length>0?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${o.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:C.image}):t.jsxRuntimeExports.jsx("div",{className:C.image,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsxs("div",{className:C.content,children:[t.jsxRuntimeExports.jsx("div",{className:C.name,dangerouslySetInnerHTML:{__html:t.splitTextIntoSpans(((_=o.variants.find(M=>M.id===o.activeVariantId))==null?void 0:_.name)||o.name)}}),t.jsxRuntimeExports.jsx("div",{className:C.price,children:t.formatPrice({amount:o.variants.find(M=>M.id===o.activeVariantId).price.amount*((o==null?void 0:o.quantity)||1),currency:o.variants.find(M=>M.id===o.activeVariantId).price.currency})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:C.productButtons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{o.quantity!==1&&l(o)},className:C.productButton,disabled:o.quantity===1,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("input",{className:C.productCount,type:"number",value:((S=o.quantity)==null?void 0:S.toString())||"",onChange:M=>{const A=Math.min(Number(M.target.value),o.variants.find(V=>V.id===o.activeVariantId).quantity.available||1/0);A<1||j({productId:o.id,productVariantId:o.activeVariantId,quantity:A,chargeType:o.chargeType})},min:1,max:o.variants.find(M=>M.id===o.activeVariantId).quantity.available||1/0}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>c(o),className:C.productButton,disabled:o.quantity===o.variants.find(M=>M.id===o.activeVariantId).quantity.available,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:C.delete,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",fill:"var(--text-action)",width:20,height:20,onClick:()=>y(o),hoverable:!0})})]})]},o.id)})}),t.jsxRuntimeExports.jsxs("div",{className:C.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:C.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:C.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsx("div",{className:C.total,children:t.formatPrice({amount:d().total,currency:e.parts.length>0&&((m=(g=n.find(o=>o.id===e.parts[0].productId))==null?void 0:g.variants.find(o=>o.id===e.parts[0].productVariantId))==null?void 0:m.price.currency)||"USD"})})]}),t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>b("/checkout",!1),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(at,{})]})},at=()=>t.jsxRuntimeExports.jsxs("div",{className:C.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsx("span",{id:"h5",children:"Empty Cart"}),t.jsxRuntimeExports.jsxs("span",{id:"md",children:["You don’t have any items in your shopping cart yet,"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:C.link,id:"md",children:"view products"})]})]}),tt=({signUp:u,close:n})=>{const{token:r}=t.useStorefrontStore(),s=t.useNavigate(),[a,e]=h.useState("test-email@gmail.com");h.useEffect(()=>{r&&(async()=>{if(!r)return;const j=t.jwtDecode(r);e(j.email)})()},[r]);function x(d){window.location.pathname.includes("/admin/builder")||s(d)}return r?t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",className:C.userInfo,onClick:()=>{x("/customer-dash"),n==null||n()},children:t.jsxRuntimeExports.jsx("div",{children:a||"test-email@gmail.com"})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{x("/customer-dash"),n==null||n()},type:"Secondary",style:{padding:10},children:"Login"}),u&&t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{x("/customer-dash"),n==null||n()},type:"Primary",style:{padding:10,whiteSpace:"nowrap"},children:"Sign Up"})]})},ct=({logo:u,setIsOpen:n,signUp:r,pages:s})=>{const{setIsOpen:a}=t.useModalStore(),e=()=>{a(!1),setTimeout(()=>{n(!1),a(!0)},300)};return t.jsxRuntimeExports.jsxs("div",{className:C.pagesMobileModal,onClick:x=>x.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:C.pagesMobileModalHeader,children:[t.jsxRuntimeExports.jsx("div",{children:u}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:e,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X"})})]}),t.jsxRuntimeExports.jsx("div",{className:C.pagesMobileModalContent,children:s.length>0&&s.map(x=>t.jsxRuntimeExports.jsx("div",{className:C.pageLink,onClick:e,children:t.jsxRuntimeExports.jsx(et,{path:x.path,children:x.name["en-US"]},x.id)}))}),t.jsxRuntimeExports.jsx("div",{className:C.pagesMobileModalFooter,children:t.jsxRuntimeExports.jsx(tt,{signUp:r,close:e})})]})},cs=({logo:u,signUp:n,pages:r})=>{const[s,a]=h.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(lt,{setIsOpenModal:a}),s&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>a(!1),hasPadding:!1,children:t.jsxRuntimeExports.jsx(ct,{logo:u,setIsOpen:a,signUp:n,pages:r})})]})},lt=u=>{const{setIsOpenModal:n}=u;return t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{padding:10},onClick:r=>{r.stopPropagation(),window.location.pathname.includes("/admin/builder")||n(!0)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"List"})})},ls="_share_onabp_1",ds="_modal_onabp_8",us="_header_onabp_20",xs="_title_onabp_46",ms="_copyWrapper_onabp_53",ps="_copyText_onabp_62",js="_copyTextMobile_onabp_75",hs="_copyTextMiniMobile_onabp_94",Q={share:ls,modal:ds,header:us,title:xs,copyWrapper:ms,copyText:ps,copyTextMobile:js,copyTextMiniMobile:hs},gs=({title:u="Copy Product Link"})=>{const{isOpenModal:n,setIsOpenModal:r}=t.useShareLinkStore();function s(){r(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{className:Q.share,onClick:a=>{a.stopPropagation(),s()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),n&&t.jsxRuntimeExports.jsx(t.Modal,{close:r,children:t.jsxRuntimeExports.jsx(fs,{title:u})})]})},fs=({title:u="Copy Product Link"})=>{const{setIsOpenModal:n}=t.useShareLinkStore(),{notifications:r,setNotifications:s}=t.useNotificationStore(),{setIsOpen:a}=t.useModalStore(),e=window.location.href;function x(){navigator.clipboard.writeText(e),s([...r,{id:t.v4(),message:"Link copied to clipboard",status:"success"}])}function d(){a(!1),setTimeout(()=>{n(!1),a(!0)},300)}function j(f,k){return f.length>k?f.slice(0,k)+"...":f}return t.jsxRuntimeExports.jsxs("div",{className:Q.modal,onClick:f=>f.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:Q.header,children:[t.jsxRuntimeExports.jsx("div",{className:Q.title,id:"h4",children:u}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:d,hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:Q.copyWrapper,children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",onClick:x,style:{flex:1},children:[t.jsxRuntimeExports.jsx("div",{className:Q.copyText,id:"md",children:j(e,100)}),t.jsxRuntimeExports.jsx("div",{className:Q.copyTextMobile,id:"md",children:j(e,40)}),t.jsxRuntimeExports.jsx("div",{className:Q.copyTextMiniMobile,id:"md",children:j(e,20)})]}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:x,children:r.find(f=>f.message==="Link copied to clipboard")?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},ys="_accordion_153d4_1",_s="_header_153d4_12",Es="_icon_153d4_21",Rs="_open_153d4_24",bs="_content_153d4_28",vs="_contentOpen_153d4_36",Is="_contentText_153d4_40",J={accordion:ys,header:_s,icon:Es,open:Rs,content:bs,contentOpen:vs,contentText:Is},Ss=({title:u,content:n,defaultOpen:r=!1})=>{const[s,a]=h.useState(r),[e,x]=h.useState(0),d=h.useRef(null),j=()=>{a(!s)};return h.useEffect(()=>{d.current&&x(s?d.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:J.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:J.header,onClick:j,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:u}),t.jsxRuntimeExports.jsx("div",{className:t.clx(J.icon,{[J.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{className:t.clx(J.content,{[J.contentOpen]:s}),children:t.jsxRuntimeExports.jsx("p",{id:"md",className:J.contentText,ref:d,style:{height:`${e}px`,marginTop:`${e>0?"20px":"0px"}`},children:n})})]})},et=({children:u,path:n,className:r,target:s="_self",id:a})=>{if(window.location.pathname.includes("/admin/builder"))return t.jsxRuntimeExports.jsx("div",{className:r,role:"link",style:{cursor:"pointer"},id:a,children:u});const e=t.useNavigate(),x=/^https?:\/\//.test(n),d=j=>{x||s==="_blank"?s==="_blank"?window.open(n,"_blank"):window.open(n,"_self"):(j.preventDefault(),e(n,{replace:!1}))};return t.jsxRuntimeExports.jsx("div",{onClick:d,className:r,role:"link",style:{cursor:"pointer"},id:a,children:u})},Ns="_buttonsBlock_1x6xf_1",Cs="_cartDisabled_1x6xf_25",st={buttonsBlock:Ns,cartDisabled:Cs},Ps=u=>{var k,b;const{setIsOpen:n,setModalType:r,productId:s,isCartEnabled:a=!0}=u,{cart:e}=t.useCart(),{pageContext:x}=t.usePagesStore(),d=(k=x==null?void 0:x.listings)==null?void 0:k.find(c=>c.id===s);if(!d)return null;const j=(b=x==null?void 0:x.products)==null?void 0:b.find(c=>c.uniquePath===d.productData.uniquePath);if(!j)return null;const f=e.parts.find(c=>c.productId===j.id);return t.jsxRuntimeExports.jsxs("div",{className:t.clx(st.buttonsBlock,{[st.cartDisabled]:!a}),onClick:c=>c.stopPropagation(),children:[a&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{width:"100%"},onClick:()=>{r("Add To Cart"),n(!0)},children:f?"Add More":"Add To Cart"}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>{r("Buy Now"),n(!0)},style:{width:"100%"},children:"Buy"})]})},ks="_wrapper_27wzz_1",Ts="_logo_27wzz_8",ws="_info_27wzz_12",K={wrapper:ks,logo:Ts,info:ws},Bs=({date:u})=>{const{general:n}=t.useGeneralStore();if(!n)return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{});function r(s){const a=new Date(s),e={month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1};return a.toLocaleDateString("en-US",e)}return t.jsxRuntimeExports.jsxs("div",{className:K.wrapper,children:[t.jsxRuntimeExports.jsx("div",{className:K.logo,children:n.info.logo?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${n.info.logo.cfId}/w=500,h=500`,alt:"image",style:{objectFit:"contain",width:"48px",height:"48px"}}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:48,height:48})}),t.jsxRuntimeExports.jsxs("div",{className:K.info,children:[t.jsxRuntimeExports.jsx("h3",{id:"h4",children:n.info.name}),t.jsxRuntimeExports.jsx("p",{id:"p",children:r(u)})]})]})},Ms="_variants_18tbu_82",$s="_variant_18tbu_82",Os="_stock_18tbu_100",As="_variantInfo_18tbu_108",qs="_title_18tbu_202",Ds="_modal_18tbu_208",Ls="_header_18tbu_228",Us="_productOptions_18tbu_236",Hs="_loading_18tbu_244",W={variants:Ms,variant:$s,stock:Os,variantInfo:As,title:qs,modal:Ds,header:Ls,productOptions:Us,loading:Hs},zs=u=>{var c;const{pageContext:n}=t.usePagesStore(),r=(c=n==null?void 0:n.listings)==null?void 0:c.find(l=>l.id===u.productId),[s,a]=h.useState(!0),[e,x]=h.useState(null),d=(e==null?void 0:e.variants[0])||null,[j,f]=h.useState("ONE_TIME"),{addProducts:k}=t.useCart(),{setIsOpen:b}=t.useModalStore();return h.useEffect(()=>{(async()=>{a(!0);const y=await t.getDynamicPage(encodeURIComponent(`/product/${r.productData.uniquePath}`));k(y==null?void 0:y.data.products),x(y==null?void 0:y.data.products[0]),a(!1)})()},[]),h.useEffect(()=>{b(!0)},[]),t.jsxRuntimeExports.jsx(t.Modal,{close:u.setIsOpen,children:t.jsxRuntimeExports.jsxs("div",{className:W.modal,onClick:l=>l.stopPropagation(),children:[s&&t.jsxRuntimeExports.jsx("div",{className:W.loading,children:t.jsxRuntimeExports.jsx(t.Loader,{})}),u.type==="Add To Cart"&&u.isCartEnabled&&e&&d&&!s&&t.jsxRuntimeExports.jsx(Fs,{variants:e.variants,activeVariant:d,activeChargeType:j,setActiveChargeType:f,productId:e.id,setIsOpen:u.setIsOpen}),u.type==="Buy Now"&&e&&!s&&t.jsxRuntimeExports.jsx(Vs,{product:e,setIsOpen:u.setIsOpen,isCartEnabled:u.isCartEnabled})]})})},Fs=u=>{const{variants:n,activeChargeType:r,productId:s,setIsOpen:a}=u,{cart:e,addProductToCart:x,addProducts:d,updateQuantityOfProduct:j}=t.useCart(),{notifications:f,setNotifications:k}=t.useNotificationStore(),{pageContext:b}=t.usePagesStore(),{setIsOpen:c}=t.useModalStore(),l=()=>{c(!1),setTimeout(()=>{a(!1)},300)};async function y(g){const m=n.find(S=>S.id===g),o=e.parts.find(S=>S.productId===u.productId&&S.productVariantId===g);if((m==null?void 0:m.quantity.available)&&(m==null?void 0:m.quantity.restrictions)&&((o==null?void 0:o.quantity)||0)+1>(m==null?void 0:m.quantity.restrictions.max)||(m==null?void 0:m.quantity.available)===0||(m==null?void 0:m.quantity.available)&&((o==null?void 0:o.quantity)||0)+1>(m==null?void 0:m.quantity.available)){k([...f,{id:t.v4(),message:"Product is out of stock",status:"error"}]);return}if(o)j({productId:s,productVariantId:g,quantity:o.quantity+1,chargeType:r});else{b!=null&&b.products&&d(b.products);try{x({productId:s,productVariantId:g,quantity:1,chargeType:r}),k([...f,{id:t.v4(),message:"Product added to cart",status:"success"}])}catch(S){const M=S;k([...f,{id:t.v4(),message:`Product failed to add to cart: ${M.message}`,status:"error"}])}}}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:W.header,children:[t.jsxRuntimeExports.jsx("div",{id:"h3",children:"Choose a Variant"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:l})]}),t.jsxRuntimeExports.jsx("div",{className:W.variants,children:n.filter(g=>{var m;return(m=g.chargeTypes)==null?void 0:m.includes(r)}).map(g=>{var m,o,_;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(W.variant),onClick:()=>{y(g.id),a(!1)},children:[t.jsxRuntimeExports.jsxs("div",{className:W.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:W.title,id:"h4",children:g.name}),t.jsxRuntimeExports.jsx("span",{id:"md",children:t.formatPrice({amount:r==="ONE_TIME"?g.price.amount:g.subscriptionSettings?g.subscriptionSettings.price.amount:0,currency:r==="ONE_TIME"?g.price.currency:((m=g.subscriptionSettings)==null?void 0:m.price.currency)||"USD"})})]}),t.jsxRuntimeExports.jsx("div",{id:"md",children:r==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:W.stock,id:"md",children:[(o=g.quantity.restrictions)!=null&&o.max||g.quantity.available!==void 0?((_=g.quantity.restrictions)==null?void 0:_.max)||g.quantity.available:"∞"," ","in stock"]})})]},g.id)})})]})},Vs=u=>{const{product:n,setIsOpen:r,isCartEnabled:s}=u,{setIsOpen:a}=t.useModalStore(),e=()=>{a(!1),setTimeout(()=>{r(!1)},300)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:W.header,children:[t.jsxRuntimeExports.jsx("div",{id:"h3",className:W.title,dangerouslySetInnerHTML:{__html:`Buy ${t.splitTextIntoSpans(n.name)}`}}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:e,style:{minWidth:24,minHeight:24}})]}),t.jsxRuntimeExports.jsx("div",{className:W.productOptions,children:t.jsxRuntimeExports.jsx(it,{product:n,setIsOpen:r,isCartEnabled:s})})]})},Ys="_contentModal_m2tf9_1",Gs="_modalTop_m2tf9_12",Ws="_loading_m2tf9_19",Xs="_modalCards_m2tf9_28",Qs="_modalImage_m2tf9_34",Js="_card_m2tf9_39",Ks="_cardInfo_m2tf9_51",Zs="_cardButtons_m2tf9_58",tn="_title_m2tf9_64",en="_blockImage_m2tf9_71",sn="_short_m2tf9_80",nn="_price_m2tf9_84",on="_oldPrice_m2tf9_91",rn="_newPrice_m2tf9_100",D={contentModal:Ys,modalTop:Gs,loading:Ws,modalCards:Xs,modalImage:Qs,card:Js,cardInfo:Ks,cardButtons:Zs,title:tn,blockImage:en,short:sn,price:nn,oldPrice:on,newPrice:rn},an=u=>{const{setIsOpen:n,pageContext:r,groupData:s,setProductId:a,setIsProductModalOpen:e,setShowDropdown:x}=u,[d,j]=h.useState(null),[f,k]=h.useState(!0),{setIsOpen:b}=t.useModalStore();h.useEffect(()=>{var y;k(!0);const l=(y=r.listings)==null?void 0:y.filter(g=>s.listingIdList.includes(g.id));l&&j([...l]),k(!1)},[r]),h.useEffect(()=>{b(!0)},[]);const c=()=>{b(!1),setTimeout(()=>{n(!1)},300)};return t.jsxRuntimeExports.jsx(t.Modal,{close:()=>n(!1),children:t.jsxRuntimeExports.jsxs("div",{className:D.contentModal,onClick:l=>l.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:D.modalTop,children:[t.jsxRuntimeExports.jsx("span",{className:D.title,id:"h4",dangerouslySetInnerHTML:{__html:t.splitTextIntoSpans(s.name)}}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",hoverable:!0,onClick:c,fill:"var(--text-primary)"})]}),!f&&d&&t.jsxRuntimeExports.jsx("div",{className:D.modalCards,children:d.map(l=>t.jsxRuntimeExports.jsxs("div",{className:D.card,children:[t.jsxRuntimeExports.jsx("div",{children:l.productData.images[0]?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${l.productData.images[0].cfId}/w=500`,alt:"",width:64,height:64,className:D.modalImage}):t.jsxRuntimeExports.jsx("div",{className:t.clx(D.blockImage,D.modalImage),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Image"})})}),t.jsxRuntimeExports.jsxs("div",{className:D.cardInfo,children:[t.jsxRuntimeExports.jsx("div",{id:"h5",children:l.productData.compareAtPrice&&(l.productData.compareAtPrice.amount||0)-(l.productData.minPrice.amount||0)>0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.splitTextIntoSpans(l.productData.name,!1),t.jsxRuntimeExports.jsxs("span",{className:D.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:D.newPrice,id:"md",children:t.formatPrice({amount:l.productData.minPrice.amount,currency:l.productData.minPrice.currency})}),t.jsxRuntimeExports.jsx("span",{className:D.oldPrice,id:"md",children:t.formatPrice({amount:l.productData.compareAtPrice.amount,currency:l.productData.compareAtPrice.currency})})]})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.splitTextIntoSpans(l.productData.name,!1),t.jsxRuntimeExports.jsx("span",{className:D.newPrice,id:"md",children:t.formatPrice({amount:l.productData.minPrice.amount,currency:l.productData.minPrice.currency})})]})}),l.productData.shortDescription&&t.jsxRuntimeExports.jsx("span",{className:D.short,id:"md",dangerouslySetInnerHTML:{__html:t.splitTextIntoSpans(l.productData.shortDescription)}})]}),t.jsxRuntimeExports.jsxs("div",{className:D.cardButtons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{a(l.id),n(!1),e(!0)},children:"Buy"}),t.jsxRuntimeExports.jsx(et,{path:`/product/${l.productData.uniquePath}`,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",style:{whiteSpace:"nowrap"},onClick:()=>{x(!1),c()},children:"View Details"})})]})]},l.id))}),f&&t.jsxRuntimeExports.jsx("div",{className:D.loading,children:t.jsxRuntimeExports.jsx(t.Loader,{})})]})})};exports.AlignText=t.AlignText;exports.Button=t.Button$1;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.InputUI=t.Input$1;exports.ItemsSettings=t.ItemsSettings;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.RadioUI=t.Radio;exports.RangeSelector=t.RangeSelector;exports.Select=t.Select;exports.SelectInfiniteList=t.SelectInfiniteList;exports.SelectTypeText=t.SelectTypeText;exports.SelectUI=t.Select$1;exports.Switch=t.Switch;exports.TextSettings=t.TextSettings;exports.TextareaSettings=t.Textarea;exports.TextareaUI=t.Textarea$1;exports.TypesText=t.TypesText;exports.Wrapper=t.Wrapper;exports.Accordion=Ss;exports.BurgerMenuButton=lt;exports.ButtonTypeSettings=nt;exports.ButtonsSettings=ie;exports.CategorySettings=$t;exports.ChargeTypes=Z;exports.EmptyCart=at;exports.FormSettings=Qt;exports.GroupCardModal=an;exports.HeaderButtons=as;exports.LayoutSettings=Rt;exports.Link=et;exports.ListingSelector=re;exports.MetaInfoPost=Bs;exports.PagesMobileMenu=cs;exports.PagesMobileModal=ct;exports.PagesSettings=Wt;exports.ProductCardButtons=Ps;exports.ProductCardModal=zs;exports.ProductOptions=it;exports.ShareLink=gs;exports.ShoppingButton=ot;exports.ShoppingModalCart=rt;exports.UserInfo=tt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-DvKlS7S2.cjs"),h=require("react");require("react-dom");const dt="_block_kh9z8_8",ut="_title_kh9z8_16",xt="_subtitle_kh9z8_23",mt="_alignmentContent_kh9z8_30",pt="_alignments_kh9z8_39",jt="_alignment_kh9z8_30",ht="_circle_kh9z8_64",gt="_paddings_kh9z8_71",ft="_padding_kh9z8_71",yt="_active_kh9z8_97",z={block:dt,title:ut,subtitle:xt,alignmentContent:mt,alignments:pt,alignment:jt,circle:ht,paddings:gt,padding:ft,active:yt},_t=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],Et=["left","top","right","bottom"],Rt=u=>{const{alignment:n,padding:r,setPadding:s,setAlignment:a,isAlignment:e=!0,isPadding:x=!0}=u;function d(l){switch(l){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function j(l){switch(l){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}const[f,k]=h.useState(null),[b,c]=h.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:z.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:z.title,children:"Layout (for Desktop version)"}),t.jsxRuntimeExports.jsxs("div",{className:z.alignmentContent,children:[e&&t.jsxRuntimeExports.jsxs("div",{className:z.block,children:[t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsx("div",{className:z.alignments,children:_t.map(l=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{a(l)},className:z.alignment,onMouseEnter:()=>{k(l)},onMouseLeave:()=>{k(null)},children:[l!==n&&f!==l&&t.jsxRuntimeExports.jsx("div",{className:z.circle}),l!==n&&f===l&&t.jsxRuntimeExports.jsx(t.Icon,{name:d(f),fill:"#c2c2c2",width:22,height:22}),l===n&&t.jsxRuntimeExports.jsx(t.Icon,{name:d(n),fill:"#FF3F19",width:22,height:22})]},l))})]}),x&&t.jsxRuntimeExports.jsxs("div",{className:z.block,children:[t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:"Paddings"}),t.jsxRuntimeExports.jsx("div",{className:z.paddings,children:Et.map(l=>t.jsxRuntimeExports.jsxs("label",{className:t.clx(z.padding,{[z.active]:b===l}),onFocus:()=>{c(l)},onBlur:()=>{c(null)},children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:j(l),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(r[l]),onChange:y=>s({...r,[l]:Math.min(Number(y),999)}),max:999,paddingless:!0,borderless:!0})]},l))})]})]})]})},bt="_title_82zux_1",vt="_subtitle_82zux_5",It="_productsBlock_82zux_14",St="_top_82zux_26",Nt="_products_82zux_14",Ct="_product_82zux_14",Pt="_button_82zux_80",kt="_disabled_82zux_91",Tt="_buttons_82zux_118",wt="_addButton_82zux_157",Bt="_deleteButton_82zux_179",F={title:bt,subtitle:vt,productsBlock:It,top:St,products:Nt,product:Ct,button:Pt,disabled:kt,buttons:Tt,addButton:wt,deleteButton:Bt};function Mt({id:u,children:n}){const{attributes:r,listeners:s,setNodeRef:a,transform:e,transition:x,isDragging:d}=t.useSortable({id:u}),j={transform:t.CSS.Transform.toString(e),transition:x};return t.jsxRuntimeExports.jsx("div",{ref:a,style:j,className:`${F.product} ${d?F.dragging:""}`,...r,...s,children:n})}const $t=u=>{const{isActiveItems:n,setIsActiveItems:r,items:s,setItems:a,other:e,tags:x,title:d,subtitle:j,draggable:f=!1,withImage:k=!1,addable:b=!0,itemsOptions:c,hasRangeSelector:l=!1,rangeSelectorOptions:y,limit:g,autoScrollInterval:m,deletable:o,aspectRatio:_,setAspectRatio:S}=u,M=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}})),A=i=>{const{active:E,over:N}=i;if(N&&E.id!==N.id){const $=s.findIndex(v=>v===E.id),w=s.findIndex(v=>v===N.id);if($!==-1&&w!==-1){const v=[...s],[Y]=v.splice($,1);v.splice(w,0,Y),a(v)}}};function V(i){if(k)return i?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const q=(i,E=!1)=>{const N=c.find(w=>w.id===i);if(!N)return;const $=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:w=>{const v=[...s],Y=c.find(p=>p.name===w);if(!Y)return;const R=Y.id,O=v.map(p=>p===i?R:p);a([...O])},value:N.name,options:c.filter(w=>!s.find(v=>v===w.id)).map(w=>w.name),leftAddonOptions:c.map(w=>({value:w.name,addon:V(w.images)}))}),E&&t.jsxRuntimeExports.jsx("div",{className:F.buttons,children:t.jsxRuntimeExports.jsx("div",{className:F.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(w=>w!==i))})})})]});return f?t.jsxRuntimeExports.jsx(Mt,{id:i,children:$},t.v4()):t.jsxRuntimeExports.jsx("div",{className:F.product,children:$},t.v4())};return t.jsxRuntimeExports.jsxs("div",{className:F.productsBlock,children:[(d||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:F.top,children:[d&&t.jsxRuntimeExports.jsx("h3",{className:F.title,children:d}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:i=>r==null?void 0:r(i)})]}),l&&y&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...y}),t.jsxRuntimeExports.jsxs("div",{className:F.products,children:[j&&t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:j}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:M,onDragEnd:A,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s,strategy:t.verticalListSortingStrategy,children:s.map(i=>q(i,o))})}):s.map(i=>q(i,o)),b&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",gap:5},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(F.button,{[F.disabled]:!!(g&&g<=s.length||s.length===c.length)}),size:"s",disabled:!!(g&&g<=s.length||s.length===c.length),onClick:()=>{const i=[...s];let E=null;if(c){for(let N=0;N<c.length;N++)if(!s.find($=>$===c[N].id)){E=c[N];break}}i.push((E==null?void 0:E.id)||c[0].id),a(i)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:F.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),_&&S&&t.jsxRuntimeExports.jsx(t.Select,{value:_,label:"Aspect Ratio",options:Object.keys(t.aspectRatio),onChange:i=>S(i),leftAddonOptions:t.aspectRatioOptions}),x!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{tagsTitle:"Tags",items:x}),e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e}),m!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(m.scrollInterval),onChange:i=>m.setScrollInterval(Number(i)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Ot="_title_roi3a_1",At="_subtitle_roi3a_5",qt="_productsBlock_roi3a_14",Dt="_top_roi3a_26",Lt="_products_roi3a_14",Ut="_product_roi3a_14",Ht="_button_roi3a_80",zt="_disabled_roi3a_91",Ft="_buttons_roi3a_118",Vt="_addButton_roi3a_164",Yt="_deleteButton_roi3a_179",H={title:Ot,subtitle:At,productsBlock:qt,top:Dt,products:Lt,product:Ut,button:Ht,disabled:zt,buttons:Ft,addButton:Vt,deleteButton:Yt};function Gt({product:u,children:n}){const{attributes:r,listeners:s,setNodeRef:a,transform:e,transition:x,isDragging:d}=t.useSortable({id:u.id}),j={transform:t.CSS.Transform.toString(e),transition:x};return t.jsxRuntimeExports.jsx("div",{ref:a,style:j,className:`${H.product} ${d?H.dragging:""}`,...r,...s,children:n})}const Wt=u=>{const{isActiveItems:n,setIsActiveItems:r,items:s,setItems:a,title:e,subtitle:x,editable:d=!0,draggable:j=!1,deletable:f=!0,addable:k=!0,itemsType:b,itemsOptions:c,addableOptions:l={},limit:y}=u,[g,m]=h.useState(null),[o,_]=h.useState(null),S=h.useRef(null),M=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{if(g){const i=[...s].map(E=>E.id===g.id?g:E);a(i)}},[g]),h.useEffect(()=>{S.current&&o&&(S.current.getBoundingClientRect().height,o.top)},[S.current,o]);const A=(i,E)=>{i.stopPropagation();const N=i.target.getBoundingClientRect();_({top:N.top+window.scrollY,left:N.left-30}),m(E)},V=i=>{const{active:E,over:N}=i;if(N&&E.id!==N.id){const $=s.findIndex(v=>v.id===E.id),w=s.findIndex(v=>v.id===N.id);if($!==-1&&w!==-1){const v=[...s],[Y]=v.splice($,1);v.splice(w,0,Y),a(v)}}},q=(i,E)=>{const N=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[j&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),b==="select"&&c&&t.jsxRuntimeExports.jsx(t.Select,{onChange:$=>{const w=[...s],v=c.find(R=>R.name===$);if(!v)return;const Y=w.map(R=>R.id===i.id?{...v,name:{"en-US":$}}:R);m({...i,name:{"en-US":$}}),a([...Y])},value:i.name,options:c.filter($=>!s.find(w=>w.name===$.name)).map($=>$.name)}),t.jsxRuntimeExports.jsxs("div",{className:H.buttons,children:[d&&t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:$=>A($,i)})}),f&&t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter($=>$.id!==i.id))})})]})]});return j?t.jsxRuntimeExports.jsx(Gt,{product:i,index:E,children:N},i.id):t.jsxRuntimeExports.jsx("div",{className:H.product,children:N},i.id)};return t.jsxRuntimeExports.jsxs("div",{className:H.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:H.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:i=>r==null?void 0:r(i)})]}),t.jsxRuntimeExports.jsxs("div",{className:H.products,children:[x&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:x}),j?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:M,onDragEnd:V,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(i=>i.id),strategy:t.verticalListSortingStrategy,children:s.map((i,E)=>q(i,E))})}):s.map((i,E)=>q(i,E)),k&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(H.button,{[H.disabled]:!!(y&&y<=s.length||s.length===(c==null?void 0:c.length))}),size:"s",disabled:!!(y&&y<=s.length||s.length===(c==null?void 0:c.length)),onClick:()=>{const i=[...s];let E=null;if(c){for(let N=0;N<c.length;N++)if(!s.find($=>$.id===c[N].id)){E=c[N];break}}b==="select"&&c&&i.push({name:E?E.name:c[0].name,id:(E==null?void 0:E.id)||c[0].id,...l}),a(i)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:H.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})]})};function Xt(u){const{product:n,children:r}=u,{attributes:s,listeners:a,setNodeRef:e,transform:x,transition:d,isDragging:j}=t.useSortable({id:n.id}),f={transform:t.CSS.Transform.toString(x),transition:d};return t.jsxRuntimeExports.jsx("div",{ref:e,style:f,className:`${t.styles.product} ${j?t.styles.dragging:""}`,...s,...a,children:r})}const Qt=u=>{const{isActiveItems:n,setIsActiveItems:r,items:s,setItems:a,other:e,title:x,subtitle:d,editable:j=!0,draggable:f=!1,deletable:k=!0,addable:b=!0,itemsType:c,itemsPlaceholder:l="",itemsOptions:y,hasRangeSelector:g=!1,rangeSelectorOptions:m,modalOptions:o,addableOptions:_={},limit:S}=u,[M,A]=h.useState(null),[V,q]=h.useState({top:0,left:0}),[i,E]=h.useState(null),N=h.useRef(null),[$,w]=h.useState(!1),v=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{const p=()=>{A(null),w(!1)};return document.body.addEventListener("click",p),A(null),w(!1),()=>{A(null),w(!1),document.body.removeEventListener("click",p)}},[]),h.useEffect(()=>{if(M){const p=[...s].map(I=>I.id===M.id?M:I);a(p)}},[M]),h.useEffect(()=>{if(N.current&&i){const p=N.current.getBoundingClientRect().height,I=window.innerHeight;let T=i.top;T+p>I+window.scrollY-200&&(T=I+window.scrollY-p-200),T<0&&(T=10),q({top:T,left:i.left})}},[N.current,i]);const Y=(p,I)=>{p.stopPropagation();const T=p.target.getBoundingClientRect();E({top:T.top+window.scrollY,left:T.left-30}),A(I),w(!0)},R=p=>{const{active:I,over:T}=p;if(T&&I.id!==T.id){const P=s.findIndex(L=>L.id===I.id),G=s.findIndex(L=>L.id===T.id);if(P!==-1&&G!==-1){const L=[...s],[U]=L.splice(P,1);L.splice(G,0,U),a(L)}}},O=p=>{var T;const I=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),c==="select"&&y&&t.jsxRuntimeExports.jsx(t.Select,{onChange:P=>{const L=[...s].map(U=>U.id===p.id?{...p,name:{"en-US":P}}:U);A({...p,name:{"en-US":P}}),a([...L])},value:p.name["en-US"],options:y.filter(P=>!s.find(G=>G.name["en-US"]===P))}),c==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:P=>{const L=[...s].map(U=>U.id===p.id?{...p,name:{"en-US":P}}:U);a([...L])},value:p.name["en-US"],placeholder:l}),c==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:P=>{const L=[...s].map(U=>U.id===p.id?{...p,images:P}:U);a([...L])},activeImage:(T=s.find(P=>P.id===p.id))==null?void 0:T.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.buttons,children:[j&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:P=>Y(P,p)})}),k&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(P=>P.id!==p.id))})})]})]});return f?t.jsxRuntimeExports.jsx(Xt,{product:p,children:I},p.id):t.jsxRuntimeExports.jsx("div",{className:t.styles.product,children:I},p.id)};return t.jsxRuntimeExports.jsxs("div",{className:t.styles.productsBlock,children:[(x||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles.top,children:[x&&t.jsxRuntimeExports.jsx("h3",{className:t.styles.title,children:x}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:p=>r==null?void 0:r(p)})]}),M&&j&&o&&$&&t.jsxRuntimeExports.jsx(t.ItemPopup,{ref:N,activeItem:M,setActiveItem:A,popupPosition:V,modalOptions:o,setIsOpenModal:w}),g&&m&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...m}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:t.styles.subtitle,children:d}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:v,onDragEnd:R,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(p=>p.id),strategy:t.verticalListSortingStrategy,children:s.map(p=>O(p))})}):s.map(p=>O(p)),b&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(t.styles.button,{[t.styles.disabled]:!!(S&&S<=s.length)}),size:"s",disabled:!!(S&&S<=s.length),onClick:()=>{const p=[...s];let I=null;if(y){for(let T=0;T<y.length;T++)if(!s.find(P=>P.name["en-US"]===y[T])){I=y[T];break}}c==="select"&&y?p.push({name:{"en-US":I||y[0]},id:t.v4(),..._,maxSymbols:100}):c==="input"?p.push({name:{"en-US":""},id:t.v4(),..._,maxSymbols:100}):p.push({name:{"en-US":`Image ${s.length+1}`},id:t.v4(),..._,maxSymbols:100}),a(p)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e})]})},Jt="_subtitle_jql1y_1",Kt="_products_jql1y_10",Zt="_product_jql1y_10",te="_button_jql1y_11",ee="_buttons_jql1y_11",se="_addButton_jql1y_150",ne="_deleteButton_jql1y_165",X={subtitle:Jt,products:Kt,product:Zt,button:te,buttons:ee,addButton:se,deleteButton:ne},nt=u=>{const{buttons:n,setButtons:r,deletable:s=!0,addable:a=!0,editableLink:e=!0}=u,{pages:x}=t.usePagesStore(),[d,j]=h.useState(null),[f,k]=h.useState({top:0,left:0}),[b,c]=h.useState(null),l=h.useRef(null);h.useEffect(()=>{if(d){const m=[...n].map(o=>o.id===d.id?d:o);r(m)}},[d]),h.useEffect(()=>{if(l.current&&b){const m=l.current.getBoundingClientRect().height,o=window.innerHeight;let _=b.top;_+m>o+window.scrollY-200&&(_=o+window.scrollY-m-200),_<0&&(_=10),k({top:_,left:b.left})}},[l.current,b]);const y=(m,o)=>{m.stopPropagation();const _=m.target.getBoundingClientRect();c({top:_.top+window.scrollY-70,left:_.left-(a?30:65)}),j(o)},g=(m,o)=>{const _=[...n],S={...m,id:Math.random().toString(36).substr(2,9)};_.splice(o+1,0,S),r(_)};return t.jsxRuntimeExports.jsxs("div",{className:X.products,children:[t.jsxRuntimeExports.jsx("h5",{className:X.subtitle,children:"Button Type"}),n.map((m,o)=>t.jsxRuntimeExports.jsxs("div",{className:X.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:_=>{const M=[...n].map(A=>A.id===m.id?{...m,type:_}:A);r(M)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:X.buttons,children:[t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy",hoverable:!0,width:20,height:20,onClick:()=>{g(m,o)}})}),t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:_=>{y(_,m)}})}),s&&t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const _=n.filter(S=>S.id!==m.id);r(_)},width:20,height:20,fill:"#C12A2A"})})]})]},m.id)),d&&t.jsxRuntimeExports.jsx(t.ButtonPopup,{ref:l,activeButton:d,setActiveButton:j,popupPosition:f,editableLink:e}),a&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:X.button,size:"s",onClick:()=>{const m=[...n];e?m.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Button Name"},destination:"Go to Page",page:x?Object.values(x)[0].path:"/",openInNewTab:!1}):m.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Create Ticket"},destination:"Go to Page",page:x?Object.values(x)[0].path:"/",openInNewTab:!1}),r(m)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:X.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})},ie=u=>{const{isActiveButtons:n,setIsActiveButtons:r,buttons:s,setButtons:a,editableLink:e=!0,addable:x=!0,deletable:d=!0}=u;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.top,children:[t.jsxRuntimeExports.jsx("h3",{className:t.styles$1.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:j=>r(j)})]}),n&&t.jsxRuntimeExports.jsx(nt,{buttons:s,setButtons:a,editableLink:e,addable:x,deletable:d})]})})};function oe(u){const{product:n,children:r}=u,{attributes:s,listeners:a,setNodeRef:e,transform:x,transition:d,isDragging:j}=t.useSortable({id:String(n.listingId)}),f={transform:t.CSS.Transform.toString(x),transition:d};return t.jsxRuntimeExports.jsx("div",{ref:e,style:f,className:`${t.styles$2.product} ${j?t.styles$2.dragging:""}`,...s,...a,children:r})}const re=u=>{const{isActiveItems:n,setIsActiveItems:r,items:s,setItems:a,other:e,title:x,subtitle:d,editable:j=!0,draggable:f=!1,withImage:k=!1,deletable:b=!0,addable:c=!0,itemsType:l,itemsOptions:y,limit:g,aspectRatio:m,setAspectRatio:o}=u,[_,S]=h.useState(null),[M,A]=h.useState({top:0,left:0}),[V,q]=h.useState(!1),i=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));h.useEffect(()=>{const R=()=>{S(null),q(!1)};return document.body.addEventListener("click",R),S(null),q(!1),()=>{S(null),q(!1),document.body.removeEventListener("click",R)}},[]),h.useEffect(()=>{if(_){const R=[...s].map(O=>O.listingId===_.listingId?_:O);a(R)}},[_]);const E=(R,O)=>{R.stopPropagation();const p=R.target.getBoundingClientRect(),I=100,T=window.innerHeight;let P=p.top+window.scrollY;P+I>T&&(P=T-I-20),q(!0),A({top:P-80,left:p.left-30}),S(O)};function N(R){if(k)return R?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${R}/w=50`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const $=R=>{const{active:O,over:p}=R;if(p&&O.id!==p.id){const I=s.findIndex(P=>String(P.listingId)===O.id),T=s.findIndex(P=>String(P.listingId)===p.id);if(I!==-1&&T!==-1){const P=[...s],[G]=P.splice(I,1);P.splice(T,0,G),a(P)}}},w=()=>{q(!1),S(null)},v=R=>{const O=y.find(I=>R.listingId===I.id);if(!O)return null;const p=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),l==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:I=>{const T=[...s],P=y.find(U=>U.productData.name===I);if(!P)return;const G={listingId:P.id,image:P.productData.images.length>0?P.productData.images[0].cfId:""},L=T.map(U=>U.listingId===R.listingId?G:U);S(G),a([...L])},value:O.productData.name,options:[...y.filter(I=>!s.find(T=>T.listingId===I.id)).map(I=>I.productData.name)],leftAddonOptions:y.map(I=>{var T;return{value:I.productData.name,addon:N(((T=I.productData.images[0])==null?void 0:T.cfId)||"")}})}),t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.buttons,children:[j&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:I=>E(I,R)})}),b&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(I=>I!==R))})})]})]});return f?t.jsxRuntimeExports.jsx(oe,{product:R,children:p},R.listingId):t.jsxRuntimeExports.jsx("div",{className:t.styles$2.product,children:p},R.listingId)},Y=h.useRef(null);return t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.productsBlock,children:[(x||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.top,children:[x&&t.jsxRuntimeExports.jsx("h3",{className:t.styles$2.title,children:x}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:R=>r==null?void 0:r(R)})]}),V&&_&&t.jsxRuntimeExports.jsx(t.ListingPopup,{ref:Y,activeItem:_,setActiveItem:S,setIsOpenModal:q,popupPosition:M,itemsOptions:y}),n&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:t.styles$2.subtitle,children:d}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:i,onDragEnd:$,onDragStart:w,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(R=>String(R.listingId)),strategy:t.verticalListSortingStrategy,children:s.map(R=>v(R))})}):s.map(R=>v(R)),c&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.styles$2.button,size:"s",onClick:()=>{const R=[...s];for(let O=0;O<y.length;O++)if(!s.find(p=>p.listingId===y[O].id)){R.push({listingId:y[O].id,image:y[O].productData.images.length>0?y[O].productData.images[0].cfId:""});break}a(R)},disabled:s.length===(g||y.length),style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),m&&o&&t.jsxRuntimeExports.jsx(t.Select,{value:m,options:Object.keys(t.aspectRatio),onChange:R=>o(R),leftAddonOptions:t.aspectRatioOptions}),n&&e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e})]})},ae="_options_s4lx3_1",ce="_price_s4lx3_18",le="_oldPrice_s4lx3_25",de="_newPrice_s4lx3_34",ue="_animate_s4lx3_42",xe="_meta_s4lx3_60",me="_info_s4lx3_66",pe="_infoRight_s4lx3_75",je="_buttons_s4lx3_82",he="_variants_s4lx3_89",ge="_variant_s4lx3_89",fe="_stock_s4lx3_107",ye="_variantInfo_s4lx3_115",_e="_quantity_s4lx3_122",Ee="_button_s4lx3_82",Re="_activeVariant_s4lx3_168",be="_chargeTypes_s4lx3_172",ve="_charge_s4lx3_172",Ie="_chargeActive_s4lx3_197",Se="_title_s4lx3_205",B={options:ae,price:ce,oldPrice:le,newPrice:de,animate:ue,meta:xe,info:me,infoRight:pe,buttons:je,variants:he,variant:ge,stock:fe,variantInfo:ye,quantity:_e,button:Ee,activeVariant:Re,chargeTypes:be,charge:ve,chargeActive:Ie,title:Se};var Z=(u=>(u.ONE_TIME="One-Time",u.RECURRING="Subscribe & Save",u))(Z||{});const it=u=>{var V,q;const{product:n,setIsOpen:r,isCartEnabled:s=!0}=u,{variants:a}=n,[e,x]=h.useState(a[0]),[d,j]=h.useState(e.chargeTypes?e.chargeTypes[0]:"ONE_TIME"),{notifications:f,setNotifications:k}=t.useNotificationStore(),b=t.useNavigate(),[c,l]=h.useState(1),{cart:y,reset:g,addProductToCart:m}=t.useCart(),[o,_]=h.useState(!1);h.useEffect(()=>{_(!0);const i=setTimeout(()=>_(!1),600);return()=>clearTimeout(i)},[c]);async function S(){try{m({productId:n.id,productVariantId:e.id,chargeType:d,quantity:c}),k([...f,{id:t.v4(),message:"Product added to cart",status:"success"}])}catch(i){const E=i;k([...f,{id:t.v4(),message:`Product failed to add to cart: ${E.message}`,status:"error"}])}r==null||r(!1)}function M(){g(),S(),b("/checkout")}function A(i){if(i>=864e5){const v=Math.floor(i/864e5);return`${v} ${v===1?"day":"days"}`}else if(i>=36e5){const v=Math.floor(i/36e5);return`${v} ${v===1?"hour":"hours"}`}else if(i>=6e4){const v=Math.floor(i/6e4);return`${v} ${v===1?"minute":"minutes"}`}else{const v=Math.floor(i/1e3);return`${v} ${v===1?"second":"seconds"}`}}return h.useEffect(()=>{e.quantity&&e.quantity.available===0?l(0):l(1)},[e.quantity.available]),h.useEffect(()=>{e.chargeTypes&&j(e.chargeTypes.includes(d)?d:e.chargeTypes[0])},[e.chargeTypes]),t.jsxRuntimeExports.jsxs("div",{className:B.options,children:[e.chargeTypes&&e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:B.chargeTypes,children:e.chargeTypes.map(i=>t.jsxRuntimeExports.jsx("div",{className:t.clx(B.charge,{[B.chargeActive]:d===i}),onClick:()=>j(i),children:Z[i]},i))}),t.jsxRuntimeExports.jsx("div",{className:B.variants,children:a.filter(i=>{var E;return(E=i.chargeTypes)==null?void 0:E.includes(d)}).map(i=>{var E,N;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(B.variant,{[B.activeVariant]:e.id===i.id}),onClick:()=>{x(i),l(1)},children:[t.jsxRuntimeExports.jsxs("div",{className:B.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:B.title,id:"h4",dangerouslySetInnerHTML:{__html:t.splitTextIntoSpans(i.name)}}),t.jsxRuntimeExports.jsxs("span",{id:"md",children:[t.formatPrice({amount:d==="ONE_TIME"?i.price.amount:i.subscriptionSettings?i.subscriptionSettings.price.amount:0,currency:d==="ONE_TIME"?i.price.currency:i.subscriptionSettings?i.subscriptionSettings.price.currency:"USD"})," ",d==="RECURRING"&&i.subscriptionSettings&&` / ${t.normalizeInterval(i.subscriptionSettings.recurringIntervalDays||0)}`]})]}),t.jsxRuntimeExports.jsx("div",{id:"md",children:d==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:B.stock,id:"md",children:[(E=i.quantity.restrictions)!=null&&E.max||i.quantity.available!==void 0?((N=i.quantity.restrictions)==null?void 0:N.max)||i.quantity.available:"∞"," ","in stock"]})})]},i.id)})}),d==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:B.quantity,id:"md",children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{c>1?l(i=>i-1):l(1)},className:B.button,disabled:e.quantity.available&&e.quantity.restrictions&&c<=e.quantity.restrictions.min||e.quantity.available===0,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx(t.Input$1,{type:"number",value:String(c),onChange:i=>{e.quantity.available&&Number(i)>e.quantity.available?l(e.quantity.available):l(Number(i))},max:((V=e.quantity.restrictions)==null?void 0:V.max)||e.quantity.available||Number.POSITIVE_INFINITY,min:((q=e.quantity.restrictions)==null?void 0:q.min)||0,centered:!0,disabled:e.quantity&&e.quantity.available===0||Object.keys(e.quantity.restrictions||{}).length!==0&&c>=e.quantity.restrictions.max}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{l(i=>i+1)},className:B.button,disabled:!!(e.quantity.available&&e.quantity.restrictions&&c>=e.quantity.restrictions.max||e.quantity.available===0||e.quantity.available&&c>=e.quantity.available),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:B.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:B.info,children:[t.jsxRuntimeExports.jsx("span",{id:"md",children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:B.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"var(--text-action)",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{id:"md",children:!e.deliveryTime||e.deliveryTime===0?"Instant":A(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:B.info,children:[t.jsxRuntimeExports.jsx("span",{id:"md",children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:B.infoRight,children:d==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:B.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(B.newPrice,{[B.animate]:o}),children:t.formatPrice({amount:e.price.amount*c,currency:e.price.currency})}),t.jsxRuntimeExports.jsx("span",{className:B.oldPrice,id:"md",children:t.formatPrice({amount:e.compareAtPrice.amount*c,currency:e.compareAtPrice.currency})})]}):t.jsxRuntimeExports.jsx("span",{className:t.clx(B.newPrice,{[B.animate]:o}),id:"md",children:t.formatPrice({amount:e.price.amount*c,currency:e.price.currency})}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:B.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(B.newPrice,{[B.animate]:o}),id:"md",children:t.formatPrice({amount:e.subscriptionSettings.price.amount*c,currency:e.subscriptionSettings.price.currency})}),t.jsxRuntimeExports.jsx("span",{className:B.oldPrice,id:"md",children:t.formatPrice({amount:e.subscriptionSettings.compareAtPrice.amount*c,currency:e.subscriptionSettings.compareAtPrice.currency})})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsx("span",{className:t.clx(B.newPrice,{[B.animate]:o}),id:"md",children:t.formatPrice({amount:e.subscriptionSettings.price.amount*c,currency:e.subscriptionSettings.price.currency})})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:B.buttons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>M(),disabled:e.quantity&&e.quantity.available===0||c===0,children:d==="ONE_TIME"?"Buy Now":"Subscribe Now"}),d==="ONE_TIME"&&s&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>S(),disabled:e.quantity&&e.quantity.available===0||c===0,children:y.parts.some(i=>i.productId===n.id&&i.productVariantId===e.id)?"Add More":"Add to Cart"})]})]})},Ne="_buttons_1uy6y_23",Ce="_modal_1uy6y_32",Pe="_closing_1uy6y_65",ke="_info_1uy6y_114",Te="_top_1uy6y_121",we="_title_1uy6y_132",Be="_clear_1uy6y_139",Me="_activeClear_1uy6y_146",$e="_count_1uy6y_150",Oe="_cart_1uy6y_165",Ae="_empty_1uy6y_173",qe="_product_1uy6y_199",De="_products_1uy6y_208",Le="_image_1uy6y_216",Ue="_productInfo_1uy6y_233",He="_content_1uy6y_240",ze="_name_1uy6y_246",Fe="_price_1uy6y_252",Ve="_productButtons_1uy6y_258",Ye="_productButton_1uy6y_258",Ge="_productCount_1uy6y_275",We="_bottom_1uy6y_292",Xe="_subtotal_1uy6y_300",Qe="_block_1uy6y_308",Je="_shoppingCount_1uy6y_315",Ke="_total_1uy6y_335",Ze="_link_1uy6y_341",ts="_userInfo_1uy6y_348",es="_pagesMobileModal_1uy6y_360",ss="_pagesMobileModalContent_1uy6y_374",ns="_pagesMobileModalHeader_1uy6y_380",is="_pagesMobileModalFooter_1uy6y_390",os="_pageLink_1uy6y_397",rs="_rightButtons_1uy6y_406",C={buttons:Ne,modal:Ce,closing:Pe,info:ke,top:Te,title:we,clear:Be,activeClear:Me,count:$e,cart:Oe,empty:Ae,product:qe,products:De,image:Le,productInfo:Ue,content:He,name:ze,price:Fe,productButtons:Ve,productButton:Ye,productCount:Ge,bottom:We,subtotal:Xe,block:Qe,shoppingCount:Je,total:Ke,link:Ze,userInfo:ts,pagesMobileModal:es,pagesMobileModalContent:ss,pagesMobileModalHeader:ns,pagesMobileModalFooter:is,pageLink:os,rightButtons:rs,delete:"_delete_1uy6y_413"},as=u=>{const{shopping:n,signUp:r,isShowUserInfo:s=!0}=u;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:(n||s)&&t.jsxRuntimeExports.jsxs("div",{className:C.buttons,children:[n&&t.jsxRuntimeExports.jsx(ot,{}),s&&t.jsxRuntimeExports.jsx(tt,{signUp:r})]})})},ot=()=>{const[u,n]=h.useState(!1),[r,s]=h.useState([]),[a,e]=h.useState(!1),{cart:x,products:d}=t.useCart();h.useEffect(()=>{(async()=>{const c=x.parts.map(g=>String(g.productId)),l=d.filter(g=>c.includes(String(g.id)))||[],y=x.parts.map(g=>{const m=l.find(o=>o.id===g.productId);return m?{...m,activeVariantId:g.productVariantId,quantity:g.quantity,chargeType:g.chargeType}:null}).filter(Boolean);s(y)})()},[x.parts,d]);function j(b){return!b||!(b!=null&&b.variants)?!1:b.chargeType==="RECURRING"}const f=x.parts.length>0&&r.length>0&&!j(r[0]);function k(){e(!1),setTimeout(()=>{n(!1)},300)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",style:{padding:10,position:"relative"},onClick:b=>{b.stopPropagation(),window.location.pathname.includes("/admin/builder")||(n(!0),e(!0))},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"}),f&&t.jsxRuntimeExports.jsx("div",{className:C.shoppingCount,children:x.parts.length})]}),u&&t.jsxRuntimeExports.jsx(t.Modal,{close:k,withAnimation:!1,children:t.jsxRuntimeExports.jsx(rt,{activeProducts:r,isCartNotEmpty:f,isOpen:a,close:k})})]})},rt=u=>{var g,m;const{activeProducts:n,isCartNotEmpty:r,isOpen:s,close:a}=u,{cart:e,reset:x,getTotalAndDiscount:d,updateQuantityOfProduct:j,removeProduct:f}=t.useCart(),k=t.useNavigate();function b(o,_){k(o,{replace:_})}function c(o){o.quantity&&j({productId:o.id,productVariantId:o.activeVariantId,quantity:o.quantity+1,chargeType:o.chargeType})}function l(o){o.quantity&&j({productId:o.id,productVariantId:o.activeVariantId,quantity:o.quantity-1,chargeType:o.chargeType})}function y(o){f({productId:o.id,productVariantId:o.activeVariantId,quantity:o.quantity||1,chargeType:o.chargeType})}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(C.modal,{[C.closing]:!s}),onClick:o=>o.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:C.top,children:[t.jsxRuntimeExports.jsxs("div",{className:C.info,children:[t.jsxRuntimeExports.jsx("span",{className:C.title,id:"h4",children:"Cart"}),r&&t.jsxRuntimeExports.jsx("div",{className:C.count,id:"md",children:e.parts.length})]}),t.jsxRuntimeExports.jsxs("div",{className:C.rightButtons,children:[r&&t.jsxRuntimeExports.jsx("button",{className:t.clx(C.clear,{[C.activeClear]:r}),disabled:!r,onClick:x,id:"md",children:"Clear all"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",onClick:a,hoverable:!0,width:24,height:24,fill:"var(--text-primary)"})]})]}),r?t.jsxRuntimeExports.jsxs("div",{className:C.cart,children:[t.jsxRuntimeExports.jsx("div",{className:C.products,children:n.map(o=>{var _,S;return t.jsxRuntimeExports.jsxs("div",{className:C.product,children:[t.jsxRuntimeExports.jsxs("div",{className:C.productInfo,children:[o.images.length>0?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${o.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:C.image}):t.jsxRuntimeExports.jsx("div",{className:C.image,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsxs("div",{className:C.content,children:[t.jsxRuntimeExports.jsx("div",{className:C.name,dangerouslySetInnerHTML:{__html:t.splitTextIntoSpans(((_=o.variants.find(M=>M.id===o.activeVariantId))==null?void 0:_.name)||o.name)}}),t.jsxRuntimeExports.jsx("div",{className:C.price,children:t.formatPrice({amount:o.variants.find(M=>M.id===o.activeVariantId).price.amount*((o==null?void 0:o.quantity)||1),currency:o.variants.find(M=>M.id===o.activeVariantId).price.currency})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:C.productButtons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{o.quantity!==1&&l(o)},className:C.productButton,disabled:o.quantity===1,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("input",{className:C.productCount,type:"number",value:((S=o.quantity)==null?void 0:S.toString())||"",onChange:M=>{const A=Math.min(Number(M.target.value),o.variants.find(V=>V.id===o.activeVariantId).quantity.available||1/0);A<1||j({productId:o.id,productVariantId:o.activeVariantId,quantity:A,chargeType:o.chargeType})},min:1,max:o.variants.find(M=>M.id===o.activeVariantId).quantity.available||1/0}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>c(o),className:C.productButton,disabled:o.quantity===o.variants.find(M=>M.id===o.activeVariantId).quantity.available,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:C.delete,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",fill:"var(--text-action)",width:20,height:20,onClick:()=>y(o),hoverable:!0})})]})]},o.id)})}),t.jsxRuntimeExports.jsxs("div",{className:C.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:C.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:C.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsx("div",{className:C.total,children:t.formatPrice({amount:d().total,currency:e.parts.length>0&&((m=(g=n.find(o=>o.id===e.parts[0].productId))==null?void 0:g.variants.find(o=>o.id===e.parts[0].productVariantId))==null?void 0:m.price.currency)||"USD"})})]}),t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>b("/checkout",!1),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(at,{})]})},at=()=>t.jsxRuntimeExports.jsxs("div",{className:C.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsx("span",{id:"h5",children:"Empty Cart"}),t.jsxRuntimeExports.jsxs("span",{id:"md",children:["You don’t have any items in your shopping cart yet,"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:C.link,id:"md",children:"view products"})]})]}),tt=({signUp:u,close:n})=>{const{token:r}=t.useStorefrontStore(),s=t.useNavigate(),[a,e]=h.useState("test-email@gmail.com");h.useEffect(()=>{r&&(async()=>{if(!r)return;const j=t.jwtDecode(r);e(j.email)})()},[r]);function x(d){window.location.pathname.includes("/admin/builder")||s(d)}return r?t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",className:C.userInfo,onClick:()=>{x("/customer-dash"),n==null||n()},children:t.jsxRuntimeExports.jsx("div",{children:a||"test-email@gmail.com"})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{x("/customer-dash"),n==null||n()},type:"Secondary",style:{padding:10},children:"Login"}),u&&t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{x("/customer-dash"),n==null||n()},type:"Primary",style:{padding:10,whiteSpace:"nowrap"},children:"Sign Up"})]})},ct=({logo:u,setIsOpen:n,signUp:r,pages:s})=>{const{setIsOpen:a}=t.useModalStore(),e=()=>{a(!1),setTimeout(()=>{n(!1),a(!0)},300)};return t.jsxRuntimeExports.jsxs("div",{className:C.pagesMobileModal,onClick:x=>x.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:C.pagesMobileModalHeader,children:[t.jsxRuntimeExports.jsx("div",{children:u}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:e,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X"})})]}),t.jsxRuntimeExports.jsx("div",{className:C.pagesMobileModalContent,children:s.length>0&&s.map(x=>t.jsxRuntimeExports.jsx("div",{className:C.pageLink,onClick:e,children:t.jsxRuntimeExports.jsx(et,{path:x.path,children:x.name["en-US"]},x.id)}))}),t.jsxRuntimeExports.jsx("div",{className:C.pagesMobileModalFooter,children:t.jsxRuntimeExports.jsx(tt,{signUp:r,close:e})})]})},cs=({logo:u,signUp:n,pages:r})=>{const[s,a]=h.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(lt,{setIsOpenModal:a}),s&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>a(!1),hasPadding:!1,children:t.jsxRuntimeExports.jsx(ct,{logo:u,setIsOpen:a,signUp:n,pages:r})})]})},lt=u=>{const{setIsOpenModal:n}=u;return t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{padding:10},onClick:r=>{r.stopPropagation(),window.location.pathname.includes("/admin/builder")||n(!0)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"List"})})},ls="_share_onabp_1",ds="_modal_onabp_8",us="_header_onabp_20",xs="_title_onabp_46",ms="_copyWrapper_onabp_53",ps="_copyText_onabp_62",js="_copyTextMobile_onabp_75",hs="_copyTextMiniMobile_onabp_94",Q={share:ls,modal:ds,header:us,title:xs,copyWrapper:ms,copyText:ps,copyTextMobile:js,copyTextMiniMobile:hs},gs=({title:u="Copy Product Link"})=>{const{isOpenModal:n,setIsOpenModal:r}=t.useShareLinkStore();function s(){r(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{className:Q.share,onClick:a=>{a.stopPropagation(),s()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),n&&t.jsxRuntimeExports.jsx(t.Modal,{close:r,children:t.jsxRuntimeExports.jsx(fs,{title:u})})]})},fs=({title:u="Copy Product Link"})=>{const{setIsOpenModal:n}=t.useShareLinkStore(),{notifications:r,setNotifications:s}=t.useNotificationStore(),{setIsOpen:a}=t.useModalStore(),e=window.location.href;function x(){navigator.clipboard.writeText(e),s([...r,{id:t.v4(),message:"Link copied to clipboard",status:"success"}])}function d(){a(!1),setTimeout(()=>{n(!1),a(!0)},300)}function j(f,k){return f.length>k?f.slice(0,k)+"...":f}return t.jsxRuntimeExports.jsxs("div",{className:Q.modal,onClick:f=>f.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:Q.header,children:[t.jsxRuntimeExports.jsx("div",{className:Q.title,id:"h4",children:u}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:d,hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:Q.copyWrapper,children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",onClick:x,style:{flex:1},children:[t.jsxRuntimeExports.jsx("div",{className:Q.copyText,id:"md",children:j(e,100)}),t.jsxRuntimeExports.jsx("div",{className:Q.copyTextMobile,id:"md",children:j(e,40)}),t.jsxRuntimeExports.jsx("div",{className:Q.copyTextMiniMobile,id:"md",children:j(e,20)})]}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:x,children:r.find(f=>f.message==="Link copied to clipboard")?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},ys="_accordion_153d4_1",_s="_header_153d4_12",Es="_icon_153d4_21",Rs="_open_153d4_24",bs="_content_153d4_28",vs="_contentOpen_153d4_36",Is="_contentText_153d4_40",J={accordion:ys,header:_s,icon:Es,open:Rs,content:bs,contentOpen:vs,contentText:Is},Ss=({title:u,content:n,defaultOpen:r=!1})=>{const[s,a]=h.useState(r),[e,x]=h.useState(0),d=h.useRef(null),j=()=>{a(!s)};return h.useEffect(()=>{d.current&&x(s?d.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:J.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:J.header,onClick:j,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:u}),t.jsxRuntimeExports.jsx("div",{className:t.clx(J.icon,{[J.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{className:t.clx(J.content,{[J.contentOpen]:s}),children:t.jsxRuntimeExports.jsx("p",{id:"md",className:J.contentText,ref:d,style:{height:`${e}px`,marginTop:`${e>0?"20px":"0px"}`},children:n})})]})},et=({children:u,path:n,className:r,target:s="_self",id:a})=>{if(window.location.pathname.includes("/admin/builder"))return t.jsxRuntimeExports.jsx("div",{className:r,role:"link",style:{cursor:"pointer"},id:a,children:u});const e=t.useNavigate(),x=/^https?:\/\//.test(n),d=j=>{x||s==="_blank"?s==="_blank"?window.open(n,"_blank"):window.open(n,"_self"):(j.preventDefault(),e(n,{replace:!1}))};return t.jsxRuntimeExports.jsx("div",{onClick:d,className:r,role:"link",style:{cursor:"pointer"},id:a,children:u})},Ns="_buttonsBlock_1x6xf_1",Cs="_cartDisabled_1x6xf_25",st={buttonsBlock:Ns,cartDisabled:Cs},Ps=u=>{var k,b;const{setIsOpen:n,setModalType:r,productId:s,isCartEnabled:a=!0}=u,{cart:e}=t.useCart(),{pageContext:x}=t.usePagesStore(),d=(k=x==null?void 0:x.listings)==null?void 0:k.find(c=>c.id===s);if(!d)return null;const j=(b=x==null?void 0:x.products)==null?void 0:b.find(c=>c.uniquePath===d.productData.uniquePath);if(!j)return null;const f=e.parts.find(c=>c.productId===j.id);return t.jsxRuntimeExports.jsxs("div",{className:t.clx(st.buttonsBlock,{[st.cartDisabled]:!a}),onClick:c=>c.stopPropagation(),children:[a&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{width:"100%"},onClick:()=>{r("Add To Cart"),n(!0)},children:f?"Add More":"Add To Cart"}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>{r("Buy Now"),n(!0)},style:{width:"100%"},children:"Buy"})]})},ks="_wrapper_27wzz_1",Ts="_logo_27wzz_8",ws="_info_27wzz_12",K={wrapper:ks,logo:Ts,info:ws},Bs=({date:u})=>{const{general:n}=t.useGeneralStore();if(!n)return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{});function r(s){const a=new Date(s),e={month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1};return a.toLocaleDateString("en-US",e)}return t.jsxRuntimeExports.jsxs("div",{className:K.wrapper,children:[t.jsxRuntimeExports.jsx("div",{className:K.logo,children:n.info.logo?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${n.info.logo.cfId}/w=500,h=500`,alt:"image",style:{objectFit:"contain",width:"48px",height:"48px"}}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:48,height:48})}),t.jsxRuntimeExports.jsxs("div",{className:K.info,children:[t.jsxRuntimeExports.jsx("h3",{id:"h4",children:n.info.name}),t.jsxRuntimeExports.jsx("p",{id:"p",children:r(u)})]})]})},Ms="_variants_18tbu_82",$s="_variant_18tbu_82",Os="_stock_18tbu_100",As="_variantInfo_18tbu_108",qs="_title_18tbu_202",Ds="_modal_18tbu_208",Ls="_header_18tbu_228",Us="_productOptions_18tbu_236",Hs="_loading_18tbu_244",W={variants:Ms,variant:$s,stock:Os,variantInfo:As,title:qs,modal:Ds,header:Ls,productOptions:Us,loading:Hs},zs=u=>{var c;const{pageContext:n}=t.usePagesStore(),r=(c=n==null?void 0:n.listings)==null?void 0:c.find(l=>l.id===u.productId),[s,a]=h.useState(!0),[e,x]=h.useState(null),d=(e==null?void 0:e.variants[0])||null,[j,f]=h.useState("ONE_TIME"),{addProducts:k}=t.useCart(),{setIsOpen:b}=t.useModalStore();return h.useEffect(()=>{(async()=>{a(!0);const y=await t.getDynamicPage(encodeURIComponent(`/product/${r.productData.uniquePath}`));k(y==null?void 0:y.data.products),x(y==null?void 0:y.data.products[0]),a(!1)})()},[]),h.useEffect(()=>{b(!0)},[]),t.jsxRuntimeExports.jsx(t.Modal,{close:u.setIsOpen,children:t.jsxRuntimeExports.jsxs("div",{className:W.modal,onClick:l=>l.stopPropagation(),children:[s&&t.jsxRuntimeExports.jsx("div",{className:W.loading,children:t.jsxRuntimeExports.jsx(t.Loader,{})}),u.type==="Add To Cart"&&u.isCartEnabled&&e&&d&&!s&&t.jsxRuntimeExports.jsx(Fs,{variants:e.variants,activeVariant:d,activeChargeType:j,setActiveChargeType:f,productId:e.id,setIsOpen:u.setIsOpen}),u.type==="Buy Now"&&e&&!s&&t.jsxRuntimeExports.jsx(Vs,{product:e,setIsOpen:u.setIsOpen,isCartEnabled:u.isCartEnabled})]})})},Fs=u=>{const{variants:n,activeChargeType:r,productId:s,setIsOpen:a}=u,{cart:e,addProductToCart:x,addProducts:d,updateQuantityOfProduct:j}=t.useCart(),{notifications:f,setNotifications:k}=t.useNotificationStore(),{pageContext:b}=t.usePagesStore(),{setIsOpen:c}=t.useModalStore(),l=()=>{c(!1),setTimeout(()=>{a(!1)},300)};async function y(g){const m=n.find(S=>S.id===g),o=e.parts.find(S=>S.productId===u.productId&&S.productVariantId===g);if((m==null?void 0:m.quantity.available)&&(m==null?void 0:m.quantity.restrictions)&&((o==null?void 0:o.quantity)||0)+1>(m==null?void 0:m.quantity.restrictions.max)||(m==null?void 0:m.quantity.available)===0||(m==null?void 0:m.quantity.available)&&((o==null?void 0:o.quantity)||0)+1>(m==null?void 0:m.quantity.available)){k([...f,{id:t.v4(),message:"Product is out of stock",status:"error"}]);return}if(o)j({productId:s,productVariantId:g,quantity:o.quantity+1,chargeType:r});else{b!=null&&b.products&&d(b.products);try{x({productId:s,productVariantId:g,quantity:1,chargeType:r}),k([...f,{id:t.v4(),message:"Product added to cart",status:"success"}])}catch(S){const M=S;k([...f,{id:t.v4(),message:`Product failed to add to cart: ${M.message}`,status:"error"}])}}}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:W.header,children:[t.jsxRuntimeExports.jsx("div",{id:"h3",children:"Choose a Variant"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:l})]}),t.jsxRuntimeExports.jsx("div",{className:W.variants,children:n.filter(g=>{var m;return(m=g.chargeTypes)==null?void 0:m.includes(r)}).map(g=>{var m,o,_;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(W.variant),onClick:()=>{y(g.id),a(!1)},children:[t.jsxRuntimeExports.jsxs("div",{className:W.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:W.title,id:"h4",children:g.name}),t.jsxRuntimeExports.jsx("span",{id:"md",children:t.formatPrice({amount:r==="ONE_TIME"?g.price.amount:g.subscriptionSettings?g.subscriptionSettings.price.amount:0,currency:r==="ONE_TIME"?g.price.currency:((m=g.subscriptionSettings)==null?void 0:m.price.currency)||"USD"})})]}),t.jsxRuntimeExports.jsx("div",{id:"md",children:r==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:W.stock,id:"md",children:[(o=g.quantity.restrictions)!=null&&o.max||g.quantity.available!==void 0?((_=g.quantity.restrictions)==null?void 0:_.max)||g.quantity.available:"∞"," ","in stock"]})})]},g.id)})})]})},Vs=u=>{const{product:n,setIsOpen:r,isCartEnabled:s}=u,{setIsOpen:a}=t.useModalStore(),e=()=>{a(!1),setTimeout(()=>{r(!1)},300)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:W.header,children:[t.jsxRuntimeExports.jsx("div",{id:"h3",className:W.title,dangerouslySetInnerHTML:{__html:`Buy ${t.splitTextIntoSpans(n.name)}`}}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:e,style:{minWidth:24,minHeight:24}})]}),t.jsxRuntimeExports.jsx("div",{className:W.productOptions,children:t.jsxRuntimeExports.jsx(it,{product:n,setIsOpen:r,isCartEnabled:s})})]})},Ys="_contentModal_m2tf9_1",Gs="_modalTop_m2tf9_12",Ws="_loading_m2tf9_19",Xs="_modalCards_m2tf9_28",Qs="_modalImage_m2tf9_34",Js="_card_m2tf9_39",Ks="_cardInfo_m2tf9_51",Zs="_cardButtons_m2tf9_58",tn="_title_m2tf9_64",en="_blockImage_m2tf9_71",sn="_short_m2tf9_80",nn="_price_m2tf9_84",on="_oldPrice_m2tf9_91",rn="_newPrice_m2tf9_100",D={contentModal:Ys,modalTop:Gs,loading:Ws,modalCards:Xs,modalImage:Qs,card:Js,cardInfo:Ks,cardButtons:Zs,title:tn,blockImage:en,short:sn,price:nn,oldPrice:on,newPrice:rn},an=u=>{const{setIsOpen:n,pageContext:r,groupData:s,setProductId:a,setIsProductModalOpen:e,setShowDropdown:x}=u,[d,j]=h.useState(null),[f,k]=h.useState(!0),{setIsOpen:b}=t.useModalStore();h.useEffect(()=>{var y;k(!0);const l=(y=r.listings)==null?void 0:y.filter(g=>s.listingIdList.includes(g.id));l&&j([...l]),k(!1)},[r]),h.useEffect(()=>{b(!0)},[]);const c=()=>{b(!1),setTimeout(()=>{n(!1)},300)};return t.jsxRuntimeExports.jsx(t.Modal,{close:()=>n(!1),children:t.jsxRuntimeExports.jsxs("div",{className:D.contentModal,onClick:l=>l.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:D.modalTop,children:[t.jsxRuntimeExports.jsx("span",{className:D.title,id:"h4",dangerouslySetInnerHTML:{__html:t.splitTextIntoSpans(s.name)}}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",hoverable:!0,onClick:c,fill:"var(--text-primary)"})]}),!f&&d&&t.jsxRuntimeExports.jsx("div",{className:D.modalCards,children:d.map(l=>t.jsxRuntimeExports.jsxs("div",{className:D.card,children:[t.jsxRuntimeExports.jsx("div",{children:l.productData.images[0]?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${l.productData.images[0].cfId}/w=500`,alt:"",width:64,height:64,className:D.modalImage}):t.jsxRuntimeExports.jsx("div",{className:t.clx(D.blockImage,D.modalImage),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Image"})})}),t.jsxRuntimeExports.jsxs("div",{className:D.cardInfo,children:[t.jsxRuntimeExports.jsx("div",{id:"h5",children:l.productData.compareAtPrice&&(l.productData.compareAtPrice.amount||0)-(l.productData.minPrice.amount||0)>0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.splitTextIntoSpans(l.productData.name,!1),t.jsxRuntimeExports.jsxs("span",{className:D.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:D.newPrice,id:"md",children:t.formatPrice({amount:l.productData.minPrice.amount,currency:l.productData.minPrice.currency})}),t.jsxRuntimeExports.jsx("span",{className:D.oldPrice,id:"md",children:t.formatPrice({amount:l.productData.compareAtPrice.amount,currency:l.productData.compareAtPrice.currency})})]})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.splitTextIntoSpans(l.productData.name,!1),t.jsxRuntimeExports.jsx("span",{className:D.newPrice,id:"md",children:t.formatPrice({amount:l.productData.minPrice.amount,currency:l.productData.minPrice.currency})})]})}),l.productData.shortDescription&&t.jsxRuntimeExports.jsx("span",{className:D.short,id:"md",dangerouslySetInnerHTML:{__html:t.splitTextIntoSpans(l.productData.shortDescription)}})]}),t.jsxRuntimeExports.jsxs("div",{className:D.cardButtons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{a(l.id),n(!1),e(!0)},children:"Buy"}),t.jsxRuntimeExports.jsx(et,{path:`/product/${l.productData.uniquePath}`,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",style:{whiteSpace:"nowrap"},onClick:()=>{x(!1),c()},children:"View Details"})})]})]},l.id))}),f&&t.jsxRuntimeExports.jsx("div",{className:D.loading,children:t.jsxRuntimeExports.jsx(t.Loader,{})})]})})};exports.AlignText=t.AlignText;exports.Button=t.Button$1;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.InputUI=t.Input$1;exports.ItemsSettings=t.ItemsSettings;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.RadioUI=t.Radio;exports.RangeSelector=t.RangeSelector;exports.Select=t.Select;exports.SelectInfiniteList=t.SelectInfiniteList;exports.SelectTypeText=t.SelectTypeText;exports.SelectUI=t.Select$1;exports.Switch=t.Switch;exports.TextSettings=t.TextSettings;exports.TextareaSettings=t.Textarea;exports.TextareaUI=t.Textarea$1;exports.TypesText=t.TypesText;exports.Wrapper=t.Wrapper;exports.Accordion=Ss;exports.BurgerMenuButton=lt;exports.ButtonTypeSettings=nt;exports.ButtonsSettings=ie;exports.CategorySettings=$t;exports.ChargeTypes=Z;exports.EmptyCart=at;exports.FormSettings=Qt;exports.GroupCardModal=an;exports.HeaderButtons=as;exports.LayoutSettings=Rt;exports.Link=et;exports.ListingSelector=re;exports.MetaInfoPost=Bs;exports.PagesMobileMenu=cs;exports.PagesMobileModal=ct;exports.PagesSettings=Wt;exports.ProductCardButtons=Ps;exports.ProductCardModal=zs;exports.ProductOptions=it;exports.ShareLink=gs;exports.ShoppingButton=ot;exports.ShoppingModalCart=rt;exports.UserInfo=tt;
|