/* Copyright (c) 2024 thind.dev This code is licensed under the EULA License. Version - v2.1.0 */ var D=Object.defineProperty;var $=(r,t,e)=>t in r?D(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var d=(r,t,e)=>$(r,typeof t!="symbol"?t+"":t,e);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function e(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=e(i);fetch(i.href,o)}})();var P="https://js.stripe.com/v3",Y=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var M=function(){for(var t=document.querySelectorAll('script[src^="'.concat(P,'"]')),e=0;e element.");return i.appendChild(n),n},V=function(t,e){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"4.6.0",startTime:e})},y=null,x=null,E=null,G=function(t){return function(){t(new Error("Failed to load Stripe.js"))}},J=function(t,e){return function(){window.Stripe?t(window.Stripe):e(new Error("Stripe.js not available"))}},Z=function(t){return y!==null?y:(y=new Promise(function(e,n){if(typeof window>"u"||typeof document>"u"){e(null);return}if(window.Stripe){e(window.Stripe);return}try{var i=M();if(!(i&&t)){if(!i)i=v(t);else if(i&&E!==null&&x!==null){var o;i.removeEventListener("load",E),i.removeEventListener("error",x),(o=i.parentNode)===null||o===void 0||o.removeChild(i),i=v(t)}}E=J(e,n),x=G(n),i.addEventListener("load",E),i.addEventListener("error",x)}catch(a){n(a);return}}),y.catch(function(e){return y=null,Promise.reject(e)}))},X=function(t,e,n){if(t===null)return null;var i=t.apply(void 0,e);return V(i,n),i},S,L=!1,W=function(){return S||(S=Z(null).catch(function(t){return S=null,Promise.reject(t)}),S)};Promise.resolve().then(function(){return W()}).catch(function(r){L||console.warn(r)});var Q=function(){for(var t=arguments.length,e=new Array(t),n=0;ne("Label",a)));i.display="none";const o=Object.fromEntries(Object.entries(t).filter(([a])=>e("Input",a)));return{theme:n||"night",variables:{colorPrimary:"#006acc",colorBackground:"#000",colorText:"#fff",colorDanger:"#ff4d4f",fontFamily:"Inter, sans-serif"},rules:{".Label":i,".Input":o}}}const w=class w{constructor(){d(this,"stripe",null);d(this,"elements");d(this,"publicKey","");d(this,"connectId","")}static async initialize(t,e){return w.instance||(w.instance=new w,await w.instance.setup(t,e)),w.instance}async setup(t,e){const{publicKey:n,connectId:i}=await this.getConfig(t);if(!n){console.error("No public key found");return}if(this.stripe=await Q(n,{stripeAccount:i||void 0}),!this.stripe){console.error("Failed to initialize Stripe");return}const o=ie(e);this.elements=this.stripe.elements({locale:"en",appearance:o})}async getConfig(t){if(this.publicKey)return{publicKey:this.publicKey,connectId:this.connectId};const e=await K(t);return this.publicKey=e.publicKey,this.connectId=e.connect_id,{publicKey:this.publicKey,connectId:this.connectId}}createCardElement(t,e){var o;if(!this.elements)throw new Error("Stripe not initialized");e||(e={classes:{empty:"",base:"",complete:"",invalid:""},style:{base:{color:"black",fontFamily:"sans-serif",fontSize:"16px",fontStyle:"normal",fontVariant:"normal",fontWeight:"400",letterSpacing:"0px",lineHeight:"1.5",textAlign:"start",textTransform:"none",padding:"0px",textDecoration:"none",textShadow:"none"}}});const n=(o=this.elements)==null?void 0:o.getElement("card");n&&(console.log("Destroying existing card element"),n.unmount(),n.destroy());const i=this.elements.create("card",e);if(!i)throw new Error("Failed to create card element");return i.mount(t),i}createAddressElement(t,e){var o;if(!this.elements)throw new Error("Stripe not initialized");const n=(o=this.elements)==null?void 0:o.getElement("address");n&&(console.log("Destroying existing address element"),n.unmount(),n.destroy());const i=this.elements.create("address",e);if(!i)throw new Error("Failed to create address element");return i.mount(t),i}createExpressCheckoutElement(t,e){var o;if(!this.elements)throw new Error("Stripe not initialized");const n=(o=this.elements)==null?void 0:o.getElement("expressCheckout");n&&(console.log("Destroying existing express checkout element"),n.unmount(),n.destroy());const i=this.elements.create("expressCheckout",e);if(!i)throw new Error("Failed to create express checkout element");return i.mount(t),i}submit(){if(!this.elements)throw new Error("Stripe not initialized");return this.elements.submit()}};d(w,"instance");let I=w;function oe(r,t,e=document.body){return e.querySelector(`[${t}="${r}"]`)}function ae(r,t,e=document.body){return e?e.querySelectorAll(`[${t}="${r}"]`):null}function se(r){r.classList.remove("w-form");const t=r.parentElement;t&&t.classList.remove("w-form"),r.addEventListener("submit",function(e){e.preventDefault()})}function H(r){const t=new FormData(r),e={};return t.forEach((n,i)=>{e[i]=n}),e}function le(r,t){return H(r)[t]}function ce(r){const t=r.querySelectorAll("input, select, textarea");let e=!1;return t.forEach(n=>{n.required&&n.value&&(e=!0)}),e}function de(r,t){const e=t||"Form is not valid. Please check the fields and try again.",n=r.parentElement.querySelector(".w-form-done"),i=r.parentElement.querySelector(".w-form-fail");n&&(n.style.display="none"),i&&(i.style.display="block",i.innerHTML=e)}function ue(r){const t=r.parentElement.querySelector(".w-form-fail");t&&(t.style.display="none")}function fe(r,t,e=!0){if((t||"showMessage")==="redirect"){const a=r.getAttribute("data-redirect");a&&(window.location.href=a)}const i=r.parentElement.querySelector(".w-form-done"),o=r.parentElement.querySelector(".w-form-fail");console.log("successDiv",i),console.log("errorDiv",o),e==!0&&(r.style.display="none"),i&&(i.style.display="block"),o&&(o.style.display="none")}function me(r,t="Please wait...",e=!0){console.log("formSubmitLoader",r.parentElement);const n=r.querySelector('input[type="submit"]');n&&(n.disabled=e,n.value=t)}function pe(r,t=!1){t&&r.reset();const e=r.parentElement.querySelector(".w-form-fail");e&&(e.style.display="none");const n=r.parentElement.querySelector(".w-form-done");n&&(n.style.display="none"),r.style.display=""}function he(){return window.location.pathname.split("/").pop()||""}function we(){let r=new URLSearchParams(window.location.search),t={};return r.forEach((e,n)=>{t[n]=e}),t}function be(r){return new URLSearchParams(window.location.search).get(r)}function N(r,t="skeleton"){if(r.nextSibling&&r.nextSibling.classList&&r.nextSibling.classList.contains(t))return r.nextSibling;const e=document.createElement("div");e.setAttribute("data-skeleton-item",""),e.className=r.className;const n=window.getComputedStyle(r);return r.hasAttribute("data-skeleton")&&e.classList.add(t),e.style.width=n.width,e.style.height=n.height,e.textContent="",Array.from(r.children).forEach(i=>{e.appendChild(N(i,t))}),e}function ge(r,t=!0,e="skeleton"){if(t){const n=N(r,e);return r.style.display="none",r.parentNode.insertBefore(n,r.nextSibling),n}else r.style.display="",(r.nextSibling&&r.nextSibling.classList.contains("skeleton")||r.nextSibling.hasAttribute("data-skeleton-item"))&&r.parentNode.removeChild(r.nextSibling)}class R{constructor({attribute:t="data-my-el"}={}){this.uniqueAttribute=t}get element(){return{get:(t,e)=>oe(t,this.uniqueAttribute,e),getAll:(t,e)=>ae(t,this.uniqueAttribute,e)}}get skeleton(){return{toggle:(t,e=!0,n)=>{ge(t,e,n)}}}get form(){return{disable:t=>{se(t)},value:(t,e)=>le(t,e),values:t=>H(t),isValid:t=>ce(t),error:(t,e)=>{de(t,e)},errorHide:t=>{ue(t)},success:(t,e,n)=>{fe(t,e,n)},changeSubmitButton:(t,e,n)=>{me(t,e,n)},reset:(t,e)=>{pe(t,e)}}}get page(){return{name:he,parameters:we,parameter:be}}}function ye(r,t,e=!0){var a,s;if(t==="redirect"){const c=r.getAttribute("data-redirect");c&&(window.location.href=c)}const i=(a=r.parentElement)==null?void 0:a.querySelector(".w-form-done"),o=(s=r.parentElement)==null?void 0:s.querySelector(".w-form-fail");console.log("successDiv",i),console.log("errorDiv",o),e==!0&&(r.style.display="none"),i&&(i.style.display="block"),o&&(o.style.display="none")}function m(r,t){const n=r.parentElement.querySelector(".w-form-fail");n&&(n.style.display="block",n.innerHTML=t)}function Se(r){var e;const t=(e=r.parentElement)==null?void 0:e.querySelector(".w-form-fail");t&&(t.style.display="none")}var xe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ee(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var B={exports:{}};(function(r,t){(function(e,n,i){r.exports=i(),r.exports.default=i()})("slugify",xe,function(){var e=JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","Ա":"A","Բ":"B","Գ":"G","Դ":"D","Ե":"E","Զ":"Z","Է":"E'","Ը":"Y'","Թ":"T'","Ժ":"JH","Ի":"I","Լ":"L","Խ":"X","Ծ":"C'","Կ":"K","Հ":"H","Ձ":"D'","Ղ":"GH","Ճ":"TW","Մ":"M","Յ":"Y","Ն":"N","Շ":"SH","Չ":"CH","Պ":"P","Ջ":"J","Ռ":"R'","Ս":"S","Վ":"V","Տ":"T","Ր":"R","Ց":"C","Փ":"P'","Ք":"Q'","Օ":"O''","Ֆ":"F","և":"EV","ء":"a","آ":"aa","أ":"a","ؤ":"u","إ":"i","ئ":"e","ا":"a","ب":"b","ة":"h","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ى":"a","ي":"y","ً":"an","ٌ":"on","ٍ":"en","َ":"a","ُ":"u","ِ":"e","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","پ":"p","چ":"ch","ژ":"zh","ک":"k","گ":"g","ی":"y","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ṣ":"S","ṣ":"s","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","–":"-","‘":"'","’":"'","“":"\\"","”":"\\"","„":"\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial","ﻵ":"laa","ﻷ":"laa","ﻹ":"lai","ﻻ":"la"}`),n=JSON.parse('{"bg":{"Й":"Y","Ц":"Ts","Щ":"Sht","Ъ":"A","Ь":"Y","й":"y","ц":"ts","щ":"sht","ъ":"a","ь":"y"},"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue","ß":"ss","%":"prozent","&":"und","|":"oder","∑":"summe","∞":"unendlich","♥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","₣":"francos","∑":"suma","∞":"infinito","♥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","₣":"franc","∑":"somme","∞":"infini","♥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","∑":"soma","£":"libra","∞":"infinito","♥":"amor"},"uk":{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"},"vi":{"Đ":"D","đ":"d"},"da":{"Ø":"OE","ø":"oe","Å":"AA","å":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"større end"},"nb":{"&":"og","Å":"AA","Æ":"AE","Ø":"OE","å":"aa","æ":"ae","ø":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","Å":"AA","Ä":"AE","Ö":"OE","å":"aa","ä":"ae","ö":"oe"}}');function i(o,a){if(typeof o!="string")throw new Error("slugify: string argument expected");a=typeof a=="string"?{replacement:a}:a||{};var s=n[a.locale]||{},c=a.replacement===void 0?"-":a.replacement,p=a.trim===void 0?!0:a.trim,u=o.normalize().split("").reduce(function(h,l){var b=s[l];return b===void 0&&(b=e[l]),b===void 0&&(b=l),b===c&&(b=" "),h+b.replace(a.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")},"");return a.strict&&(u=u.replace(/[^A-Za-z0-9\s]/g,"")),p&&(u=u.trim()),u=u.replace(/\s+/g,c),a.lower&&(u=u.toLowerCase()),u}return i.extend=function(o){Object.assign(e,o)},i})})(B);var Ie=B.exports;const F=Ee(Ie);function j(r){const t=r.querySelectorAll("input");var e={};return t.forEach(o=>{let a=o.getAttribute("name");a&&(a=F(a));const s=o.value;a&&(e[a]=s)}),r.querySelectorAll("select").forEach(o=>{let a=o.getAttribute("name");a&&(a=F(a));const s=o.value;a&&(e[a]=s)}),r.querySelectorAll("textarea").forEach(o=>{let a=o.getAttribute("name");a&&(a=F(a));const s=o.value;a&&(e[a]=s)}),e}function Fe(r){const t=r.querySelectorAll("[data-stripe-billing_details]"),e={};return t.forEach(n=>{const i=n.getAttribute("data-stripe-billing_details");i&&(e[i]=n.value)}),e}function ve(r){const t=r.querySelectorAll("[data-stripe-shipping_details]"),e={};return t.forEach(n=>{const i=n.getAttribute("data-stripe-shipping_details");i&&(e[i]=n.value)}),e}function Ae(r){const t=r.querySelectorAll("[required]");for(const e of t)if(e instanceof HTMLInputElement&&!e.value)return!1;return!0}const f=new R;async function A(r){const t=document.querySelectorAll("[data-stripe-element='card']");if(t.length==0){console.log("no card elements found");const i=document.querySelector("[data-stripe-element]"),o=i==null?void 0:i.closest("form");T(o,null,r);return}for(const i of t){const o=i.closest("form");let a=document.querySelector("[data-stripe-style-source]");if(a==null){const l=document.querySelector("input");l&&(a=l)}if(a||(a=i),!a){console.error("style source input not found for card element",i);continue}o||console.error("form not found for card element",i);let s=a.classList.value||"input",c=a.getAttribute("data-complete-class")||"valid",p=a.getAttribute("data-error-class")||"error";var e=r.styles;let u={color:e.color,fontFamily:e.fontFamily,fontSize:e.fontSize,fontStyle:e.fontStyle,fontVariant:e.fontVariant,fontWeight:e.fontWeight,letterSpacing:e.letterSpacing,lineHeight:e.lineHeight,textAlign:e.textAlign,textTransform:e.textTransform,padding:e.padding,textDecoration:e.textDecoration,textShadow:e.textShadow};var n={classes:{empty:s,base:s,complete:`${s} ${c}`,invalid:`${s} ${p}`},style:{base:u}};const h=r.createCardElement(i,n);T(o,h,r)}}async function k(r){const t=document.querySelectorAll("[data-stripe-element='address']");for(const e of t){const n=e.attributes;let i={};for(const o of n)if(o.nodeName.startsWith("data-address-element-")){const a=o.nodeName.replace("data-address-element-","").replace("_",".");i[a]=o.nodeValue}Te(e,i,r)}}async function U(r){let t=document.querySelectorAll("[data-stripe-element='express-checkout']");t.length==0&&(t=document.querySelectorAll("[data-stripe-element='paymentRequestButton']"));for(const e of t){e.style.display!=="block"?(e.style.display="block",console.log("Upding v1 attributes to v2")):e.style.display="block";let n={};const i=e.attributes;for(const o of i)if(o.nodeName.startsWith("data-express-element-")){const a=o.nodeName.replace("data-express-element-","").replace("_",".");n[a]=o.nodeValue}Ce(e,n,r)}}async function T(r,t,e){e.webflowFormIntance={form:r,type:"card",priceType:"dynamic",SubmitButtoninitialText:"Submit",SubmitButtonWaitingText:"Processing...",SubmitButtonSuccessText:"Payment successful"};let n;e.platform==="framer"&&(n=r.querySelector("[data-stripe-element='config']")),f.form.disable(r);const i=r.querySelector('input[type="submit"]'),o=(i==null?void 0:i.value)||"Process Payment",a=(i==null?void 0:i.getAttribute("data-wait"))||"Processing...";i==null||i.setAttribute("data-default-value",o);const s=(i==null?void 0:i.getAttribute("data-success"))||"Payment successful";e.webflowFormIntance={form:r,type:"card",SubmitButtoninitialText:o,SubmitButtonWaitingText:a,SubmitButtonSuccessText:s},ke(e),t==null||t.on("change",p=>{p.error!==void 0&&m(r,p.error.message),p.error==null&&Se(r)});let c="";if(e.platform==="webflow"?c=r.getAttribute("data-price-id")||"":e.platform==="framer"&&(c=(n==null?void 0:n.getAttribute("data-price-id"))||""),!c||c==""){console.error("No stripe price id found");return}await e.getPrice(c),U(e),r.addEventListener("submit",async p=>{p.preventDefault();try{const l=await e.submit();if(l.error){console.error(l.error),m(r,l.error.message||"Error");return}}catch(l){console.error(l),m(r,l instanceof Error?l.message:String(l));return}f.form.changeSubmitButton(r,a,!0);const u=j(r)||{},h=await e.createPaymentIntent(u);if(h.error){console.error(h.error),m(r,h.error),f.form.changeSubmitButton(r,o,!1);return}if(h.id&&t){f.form.changeSubmitButton(r,a,!1),e.getAddress();try{await e.confirmCardPayment(h.client_secret,{payment_method:{card:t,billing_details:e.webflowFormIntance.billingAddress},shipping:e.webflowFormIntance.shippingAddress})}catch(l){console.error(l),m(r,"Error creating payment intent"),f.form.changeSubmitButton(r,o,!1);return}}})}function ke(r){if(!r.webflowFormIntance){console.error("No form found");return}const t=r.webflowFormIntance.form;if(!t){console.error("No form found");return}const e=r.webflowFormIntance.SubmitButtonSuccessText||"Success",n=r.webflowFormIntance.SubmitButtoninitialText||"Submit";r.on("paymentSuccess",()=>{ye(t,e,!0),f.form.changeSubmitButton(t,n,!1)}),r.on("paymentFailed",i=>{m(t,i.message||"Payment failed"),f.form.changeSubmitButton(t,n,!1)})}function Te(r,t,e){e.createAddressElement(r,t)}function Ce(r,t,e){var a;const n=e.webflowFormIntance.priceId,i=(a=e.elements)==null?void 0:a.getElement("expressCheckout");if(i&&i.destroy(),!n){console.error("No price id found");return}const o=e.createExpressCheckoutElement(r,t);ze(e,o)}function ze(r,t){t.on("click",function(e){if(!r.webflowFormIntance||!r.webflowFormIntance.form){console.error("No form found");return}const n=e.expressPaymentType;let i="Processing...";n=="apple_pay"&&(i="Processing Apple Pay Payment..."),n=="google_pay"&&(i="Processing Google Pay Payment..."),n=="paypal"&&(i="Processing PayPal Payment..."),n=="link"&&(i="Processing Link Payment..."),f.form.changeSubmitButton(r.webflowFormIntance.form,i,!0),e.resolve()}),t.on("confirm",async function(e){if(!r.stripe||!r.elements){console.error("No stripe found");return}if(!r.webflowFormIntance.form){console.error("No form found");return}if(!Ae(r.webflowFormIntance.form)){m(r.webflowFormIntance.form,"Please fill in all required fields"),e.paymentFailed({reason:"fail"});return}const n=j(r.webflowFormIntance.form),i=await r.createPaymentIntent(n);if(i.error){console.error(i.error),m(r.webflowFormIntance.form,i.error),f.form.changeSubmitButton(r.webflowFormIntance.form,r.webflowFormIntance.SubmitButtoninitialText||"Submit",!0);return}if(i.id){f.form.changeSubmitButton(r.webflowFormIntance.form,r.webflowFormIntance.SubmitButtonWaitingText||"Processing...",!0),r.getAddress();try{await r.confirmPayment(i.client_secret,{return_url:window.location.href})}catch(o){console.error(o),m(r.webflowFormIntance.form,"Error creating payment intent"),f.form.changeSubmitButton(r.webflowFormIntance.form,r.webflowFormIntance.SubmitButtoninitialText||"Submit",!1),e.paymentFailed({reason:"fail"});return}}}),t.on("cancel",function(){if(!r.webflowFormIntance||!r.webflowFormIntance.form){console.error("No form found");return}f.form.changeSubmitButton(r.webflowFormIntance.form,r.webflowFormIntance.SubmitButtoninitialText||"Submit",!1),m(r.webflowFormIntance.form,"Payment cancelled! Make sure you have completed the form.")})}const g=new R;class Pe{constructor(){d(this,"listeners",{})}on(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)}off(t,e){this.listeners[t]&&(this.listeners[t]=this.listeners[t].filter(n=>n!==e))}emit(t,e){this.listeners[t]&&this.listeners[t].forEach(n=>n(e))}}class Le{constructor(){d(this,"StripeSdk",null);d(this,"siteId",null);d(this,"stripe",null);d(this,"elements");d(this,"countryCode",null);d(this,"webflowFormIntance",{type:"card",priceType:"dynamic",SubmitButtoninitialText:"Submit",SubmitButtonWaitingText:"Submitting...",SubmitButtonSuccessText:"Success"});d(this,"eventEmitter");d(this,"styles");d(this,"platform","webflow");this.eventEmitter=new Pe}async initialize(t,e){try{let n=document.querySelector("[data-stripe-style-source]");n||(n=document.querySelector("input"),n||(n=document.querySelector("button"))),this.styles=window.getComputedStyle(n),this.platform=e,this.StripeSdk=await I.initialize(t,this.styles),this.siteId=t,this.stripe=this.StripeSdk.stripe,this.elements=this.StripeSdk.elements,this.countryCode=await C(),await z(this);const i=new URL(window.location.href),o=i.searchParams.get("payment_intent"),a=i.searchParams.get("payment_intent_client_secret");return o&&a&&this.confirmPaymentIntent(o),this}catch(n){throw console.error("Failed to initialize FormPaymentsSDK:",n),n}}async getPrice(t){if(!this.StripeSdk)throw new Error("FormPayments not initialized");if(!this.siteId)throw new Error("FormPayments not initialized");if(this.webflowFormIntance.priceId===t)return this.webflowFormIntance;const e=await ee(this.siteId,t);this.webflowFormIntance.priceNumber=e.unit_amount,this.webflowFormIntance.currency=e.currency,this.webflowFormIntance.paymentDescription=e.description,this.webflowFormIntance.priceType="dynamic",this.webflowFormIntance.priceId=t;const n=e.type;return n==="one_time"?this.webflowFormIntance.pricePaymentType="payment":n==="recurring"&&(this.webflowFormIntance.pricePaymentType="subscription"),this.updateStripeElement(this.webflowFormIntance.pricePaymentType,e.unit_amount,e.currency),e}async setPriceAmount(t,e,n){if(!this.webflowFormIntance)throw new Error("Webflow form not initialized");n&&(this.webflowFormIntance.paymentDescription=n),this.webflowFormIntance.priceNumber=t,this.webflowFormIntance.currency=e,this.webflowFormIntance.priceType="manual",this.updateStripeElement("payment",t,e)}async setStripePrice(t){if(!this.webflowFormIntance)throw new Error("Webflow form not initialized");const e=await this.getPrice(t);this.webflowFormIntance.priceId=t,this.webflowFormIntance.priceNumber=e.unit_amount,this.webflowFormIntance.currency=e.currency,this.webflowFormIntance.priceType="dynamic",this.updateStripeElement(this.webflowFormIntance.pricePaymentType,e.unit_amount,e.currency)}updateStripeElement(t,e,n){var i;if(!this.webflowFormIntance)throw new Error("Webflow form not initialized");(i=this.elements)==null||i.update({mode:t,amount:e,currency:n}),U(this)}async createPaymentIntent(t){if(!this.siteId)throw new Error("Site not initialized");if(!this.webflowFormIntance)throw new Error("Webflow form not initialized");if(!this.webflowFormIntance.priceNumber)throw this.webflowFormIntance.form&&g.form.error(this.webflowFormIntance.form,"Price not initialized"),new Error("Price not initialized");if(!this.webflowFormIntance.currency)throw this.webflowFormIntance.form&&g.form.error(this.webflowFormIntance.form,"Currency not initialized"),new Error("Currency not initialized");return await te(this.siteId,this.webflowFormIntance.priceNumber,this.webflowFormIntance.currency,this.webflowFormIntance.paymentDescription,t)}async getAddress(){var t;if(!this.StripeSdk)throw new Error("FormPayments not initialized");if(!this.webflowFormIntance.form||!this.webflowFormIntance.SubmitButtonWaitingText||!this.webflowFormIntance.SubmitButtoninitialText)throw new Error("Webflow form not initialized");try{const e=(t=this.elements)==null?void 0:t.getElement("address");if(e){const n=await e.getValue(),i=e._componentMode;if(n.complete&&i=="shipping")this.webflowFormIntance.shippingAddress=n.value;else if(n.complete&&i=="billing")this.webflowFormIntance.billingAddress=n.value;else{this.webflowFormIntance.shippingAddress=ve(this.webflowFormIntance.form)||null,this.webflowFormIntance.billingAddress=Fe(this.webflowFormIntance.form)||null,g.form.error(this.webflowFormIntance.form,"Please fill in the shipping address"),g.form.changeSubmitButton(this.webflowFormIntance.form,this.webflowFormIntance.SubmitButtonWaitingText,!1);return}}}catch(e){console.error(e),g.form.error(this.webflowFormIntance.form,"Error processing shipping address"),g.form.changeSubmitButton(this.webflowFormIntance.form,this.webflowFormIntance.SubmitButtoninitialText,!1);return}}async confirmCardPayment(t,e){var o;if(!((o=this.StripeSdk)!=null&&o.stripe))throw new Error("FormPayments not initialized");const{error:n,paymentIntent:i}=await this.StripeSdk.stripe.confirmCardPayment(t,e);if(n&&this.eventEmitter.emit("paymentFailed",n),i&&this.eventEmitter.emit("paymentSuccess",i),n)return{error:n};if(i)return{paymentIntent:i};throw new Error("Unexpected result: both error and paymentIntent are undefined")}async confirmPayment(t,e){var i;if(!((i=this.StripeSdk)!=null&&i.stripe))throw new Error("FormPayments not initialized");const n=await this.StripeSdk.stripe.confirmPayment({elements:this.StripeSdk.elements,clientSecret:t,confirmParams:e});return n.error?this.eventEmitter.emit("paymentFailed",n.error):this.eventEmitter.emit("paymentSuccess",n),n}async createPaymentMethod(t){if(!this.StripeSdk||!this.StripeSdk.stripe)throw new Error("FormPayments not initialized");return this.StripeSdk.stripe.createPaymentMethod({elements:this.StripeSdk.elements,params:{billing_details:t}})}createCardElement(t,e){if(!this.StripeSdk)throw new Error("FormPayments not initialized");return this.StripeSdk.createCardElement(t,e)}createAddressElement(t,e){if(!this.StripeSdk)throw new Error("FormPayments not initialized");return this.StripeSdk.createAddressElement(t,e)}createExpressCheckoutElement(t,e){if(!this.StripeSdk)throw new Error("FormPayments not initialized");return this.StripeSdk.createExpressCheckoutElement(t,e)}submit(){if(!this.StripeSdk)throw new Error("FormPayments not initialized");return this.StripeSdk.submit()}on(t,e){this.eventEmitter.on(t,e)}off(t,e){this.eventEmitter.off(t,e)}async confirmPaymentIntent(t){if(!this.siteId)throw new Error("Site not initialized");const e=await re(this.siteId,t);e.status==="succeeded"?this.eventEmitter.emit("paymentSuccess",e):this.eventEmitter.emit("paymentFailed",e);const n=new URL(window.location.href);return n.searchParams.delete("payment_intent"),n.searchParams.delete("payment_intent_client_secret"),window.history.replaceState({path:n.href},"",n.href),e}async destroy(){var e,n,i;const t=(e=this.StripeSdk)==null?void 0:e.elements;console.log(t),t&&((n=t.getElement("card"))==null||n.unmount(),(i=t.getElement("address"))==null||i.unmount()),this.siteId=null,this.stripe=null,this.elements=void 0,this.countryCode=null}async reload(){if(!this.siteId){console.log("Site not initialized for reload");return}this.StripeSdk=await I.initialize(this.siteId,this.platform),this.stripe=this.StripeSdk.stripe,this.elements=this.StripeSdk.elements,this.countryCode=await C(),await z(this)}}async function C(){return fetch("https://ipapi.co/json/").then(r=>r.json()).then(r=>r.country).catch(r=>{console.error("Error:",r)})}async function z(r){r.platform==="webflow"?(await A(r),await k(r)):r.platform==="framer"&&(await A(r),await k(r))}let _=new Le;document.addEventListener("DOMContentLoaded",async function(){await We()});async function We(){var n;let r=document.documentElement.getAttribute("data-wf-site"),t="webflow";if(!r&&(r=((n=document.querySelector("[data-fid]"))==null?void 0:n.getAttribute("data-fid"))||null,t="framer",!r)){console.error("No site id found");return}const e=await _.initialize(r,t);window.formPaymentsSDK=e,qe()}function qe(){window.addEventListener("objectLoaded",async r=>{console.log("objectLoaded"),await _.reload()})} //# sourceMappingURL=index.js.map