1function ownKeys(e,t){var a,s=Object.keys(e);return Object.getOwnPropertySymbols&&(a=Object.getOwnPropertySymbols(e),t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,a)),s}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(a),!0).forEach(function(t){_defineProperty(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function _defineProperty(t,e,a){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var a=0;a<e.length;a++){var s=e[a];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,_toPropertyKey(s.key),s)}}function _createClass(t,e,a){return e&&_defineProperties(t.prototype,e),a&&_defineProperties(t,a),Object.defineProperty(t,"prototype",{writable:!1}),t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0===a)return("string"===e?String:Number)(t);a=a.call(t,e||"default");if("object"!=_typeof(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}(C=>{function n(t){return"yes"===t||"1"===t||!0===t}window.fkwcsGetStripe=window.fkwcsGetStripe||function(t,e){return window.fkwcsStripeInstances=window.fkwcsStripeInstances||{},window.fkwcsStripeInstances[t]||(window.fkwcsStripeInstances[t]=Stripe(t,e)),window.fkwcsStripeInstances[t]};var r={applePay:{applePay:"always",googlePay:"never",link:"never",amazonPay:"never",paypal:"never",klarna:"never"},googlePay:{applePay:"never",googlePay:"always",link:"never",amazonPay:"never",paypal:"never",klarna:"never"},link:{applePay:"never",googlePay:"never",link:"auto",amazonPay:"never",paypal:"never",klarna:"never"},amazonPay:{applePay:"never",googlePay:"never",link:"never",amazonPay:"auto",paypal:"never",klarna:"never"},mixed:{applePay:"always",googlePay:"always",link:"auto",amazonPay:"auto",paypal:"never",klarna:"never"}},a={applePay:{selector:"#fkcart_fkwcs_smart_button_apple_pay .fkwcs_smart_buttons.fkwcs_smart_cart_button",parent:"#fkcart_fkwcs_smart_button_apple_pay"},googlePay:{selector:"#fkcart_fkwcs_smart_button_google_pay .fkwcs_smart_buttons.fkwcs_smart_cart_button",parent:"#fkcart_fkwcs_smart_button_google_pay"},link:{selector:"#fkcart_fkwcs_smart_button_link .fkwcs_smart_buttons.fkwcs_smart_cart_button",parent:"#fkcart_fkwcs_smart_button_link"},amazonPay:{selector:"#fkcart_fkwcs_smart_button_amazon_pay .fkwcs_smart_buttons.fkwcs_smart_cart_button",parent:"#fkcart_fkwcs_smart_button_amazon_pay"}},s={applePay:{selector:"#wfacp_smart_button_fkwcs_apple_pay .fkwcs_smart_buttons,.fkwcs_express_smart_button_wrapper.fkwcs_stripe_smart_button_wrapper.fkwcs_apple_pay_button .fkwcs_smart_buttons",parent:"#wfacp_smart_button_fkwcs_apple_pay,.fkwcs_express_smart_button_wrapper.fkwcs_stripe_smart_button_wrapper.fkwcs_apple_pay_button"},googlePay:{selector:"#wfacp_smart_button_fkwcs_stripe_google_pay .fkwcs_smart_buttons,.fkwcs_express_smart_button_wrapper.fkwcs_stripe_smart_button_wrapper.fkwcs_google_pay_button .fkwcs_smart_buttons",parent:"#wfacp_smart_button_fkwcs_stripe_google_pay,.fkwcs_express_smart_button_wrapper.fkwcs_stripe_smart_button_wrapper.fkwcs_google_pay_button"},link:{selector:"#wfacp_smart_button_fkwcs_link .fkwcs_smart_buttons,.fkwcs_express_smart_button_wrapper.fkwcs_stripe_smart_button_wrapper.fkwcs_link_pay_button .fkwcs_smart_buttons",parent:"#wfacp_smart_button_fkwcs_link,.fkwcs_express_smart_button_wrapper.fkwcs_stripe_smart_button_wrapper.fkwcs_link_pay_button"},amazonPay:{selector:"#wfacp_smart_button_fkwcs_amazon_pay .fkwcs_smart_buttons,.fkwcs_express_smart_button_wrapper.fkwcs_stripe_smart_button_wrapper.fkwcs_amazon_pay_button .fkwcs_smart_buttons",parent:"#wfacp_smart_button_fkwcs_amazon_pay,.fkwcs_express_smart_button_wrapper.fkwcs_stripe_smart_button_wrapper.fkwcs_amazon_pay_button"}},o={applePay:{selector:"div.fkwcs_stripe_smart_button_wrapper .fkwcs-product.fkwcs_apple_pay_button .fkwcs_smart_buttons",parent:"div.fkwcs_stripe_smart_button_wrapper .fkwcs-product.fkwcs_apple_pay_button"},googlePay:{selector:"div.fkwcs_stripe_smart_button_wrapper .fkwcs-product.fkwcs_google_pay_button .fkwcs_smart_buttons",parent:"div.fkwcs_stripe_smart_button_wrapper .fkwcs-product.fkwcs_google_pay_button"},link:{selector:"form.cart .fkwcs-product.fkwcs_link_pay_button .fkwcs_smart_buttons",parent:"form.cart .fkwcs-product.fkwcs_link_pay_button"},amazonPay:{selector:"div.fkwcs_stripe_smart_button_wrapper .fkwcs-product.fkwcs_amazon_pay_button .fkwcs_smart_buttons",parent:"div.fkwcs_stripe_smart_button_wrapper .fkwcs-product.fkwcs_amazon_pay_button"}};function c(w,g,b,v,P,t){var x=5<arguments.length&&void 0!==t?t:"",t=new Promise(function(n){try{var r=C(g),o=C(b);if(0===r.length)console.log("selector not found",g),n({result:"failed",message:"selector not found",button_type:P});else{var t,e,a,s,c,_,i,p,l=w.getRequestData(),u=l&&l.currency?String(l.currency).toLowerCase():"string"==typeof fkwcs_data.currency?fkwcs_data.currency.toLowerCase():"",d=l&&l.total&&null!=l.total.amount?Number(l.total.amount):NaN,f=!l||!l.total||!Number.isFinite(d)||d<=0,m=l&&!0===l.is_fkwcs_need_payment,y=!(Number.isFinite(d)&&0<d)&&m?100:d,k="amazonPay"===P&&f&&m;if(f&&!m){if(w.express_buttons[g]){try{w.express_buttons[g].unmount()}catch(t){}delete w.express_buttons[g]}w.express_element[g]&&delete w.express_element[g],w.express_buttons_shows&&w.express_buttons_shows[g]&&delete w.express_buttons_shows[g],o.find(".fkwcs_smart_button_trigger").addClass("hide"),o.hide(),r.hide(),n({result:"failed",message:"amount is zero",button_type:P,selector:r,selectorParent:o,availablePaymentMethods:!1})}else{if("amazonPay"===P&&w.express_buttons[g]&&!w._expressClickActive){var h=w.express_element_mode&&w.express_element_mode[g];if(h&&h!==(k?"setup":"payment")){try{w.express_buttons[g].unmount()}catch(t){}delete w.express_buttons[g],delete w.express_element[g],w.express_buttons_shows&&w.express_buttons_shows[g]&&delete w.express_buttons_shows[g]}}w.express_buttons[g]?(!k&&0<Number(y)?w.express_element[g].update({amount:y,currency:u}):w.express_element[g].update({currency:u}),"fkcart"!==x&&"cart"!==x||(0!==r.find("iframe").length||w._expressClickActive||(o.css("min-height","42px"),o.find(".fkwcs_smart_button_trigger").removeClass("hide").show(),w.express_buttons[g].unmount(),w.express_buttons[g].mount(g),"cart"===x&&o.find(".fkwcs_smart_button_trigger").addClass("hide")),r.addClass("fkwcs_smart_button_shown"),r.show()),o.find(".fkwcs_smart_button_trigger").show(),(!0===(t=w.express_buttons_shows[g]?w.express_buttons_shows[g].availablePaymentMethods:void 0)||"object"===_typeof(t)&&null!==t&&Object.values(t).some(function(t){return!0===t}))&&o.attr("data-fkwcs-available","yes"),n({result:"pass",already_exist:"yes",message:"button already exists",selector:r,selectorParent:o,button_type:P,availablePaymentMethods:t})):(e={mode:k?"setup":"payment",currency:u,appearance:{variables:{fontSizeBase:"13px"}},paymentMethodCreation:"manual"},k||(e.amount=y),"amazonPay"===P&&delete e.paymentMethodCreation,s=a="black","light-outline"===fkwcs_data.style.theme?(a="white-outline",s="white"):"light"===fkwcs_data.style.theme&&(s=a="white"),c={buttonHeight:42,layout:{maxColumns:3,maxRows:1},buttonTheme:{applePay:a,googlePay:s},buttonType:{applePay:fkwcs_data.style.apple_button_type||"plain",googlePay:fkwcs_data.style.google_pay_button_type||"plain"},paymentMethods:v},i=(_=w.stripe.elements(e)).create("expressCheckout",c),w.express_element[g]=_,w.express_element_mode=w.express_element_mode||{},w.express_element_mode[g]=k?"setup":"payment",p=function(t){var e;t&&t.total&&(e=t.currency?String(t.currency).toLowerCase():u,!k&&0<Number(t.total.amount)?w.express_element[g].update({amount:t.total.amount,currency:e}):w.express_element[g].update({currency:e}))},i.on("ready",function(t){var e=t.availablePaymentMethods||!1,a=(w.express_buttons_shows[g]={parent:b,availablePaymentMethods:e,button_type:P},"yes"===fkwcs_data.apple_pay_individual&&e&&"object"===_typeof(e)&&(e.googlePay=!1,e.link=!1,e.amazonPay=!1),!1);if("object"===_typeof(e)&&null!==e){for(var s in e)if(!0===e[s]){a=!0;break}}else!0===e&&(a=!0);a?(o.attr("data-fkwcs-available","yes"),"native"!=x&&"fkcart"!==x&&"product"!==x||(o.show().css("display","block"),r.show().css({display:"block",visibility:"visible"}),r.find("iframe").each(function(){this.style.setProperty("margin","0","important"),this.style.setProperty("width","100%","important")}),r.addClass("fkwcs_smart_button_shown"),"fkcart"===x&&(r.parents(".fkwcs_stripe_smart_button_wrapper").show(),o.find(".fkwcs_smart_button_trigger").addClass("hide").hide())),w.expressButtonReady(e,_),n({result:"pass",message:"button created",selector:r,selectorParent:o,availablePaymentMethods:e,button_type:P})):(o.find(".fkwcs_smart_button_trigger").append('<span class="wfacp_reject_button"></span>'),o.find(".fkwcs_smart_button_trigger").addClass("hide"),o.hide(),r.hide(),n({result:"pass",message:"no available payment methods",selector:r,selectorParent:o,availablePaymentMethods:e,noMethods:!0,button_type:P}))}),i.on("confirm",function(t){return w.onPaymentMethodFkcart(t,w.express_element[g],x)}),i.on("shippingaddresschange",function(t){return w.shippingAddressChange(t,p)}),i.on("shippingratechange",function(t){return w.shippingOptionChange(t,p)}),i.on("click",function(t){t.selectorContext=g,w.expressClick(t,x,p)}),i.on("cancel",function(t){return w.cancelPayment(t)}),i.on("loaderror",function(){o.find(".fkwcs_smart_button_trigger").addClass("hide"),o.hide(),r.hide(),n({result:"failed",message:"loaderror",selector:r,selectorParent:o,availablePaymentMethods:!1,noMethods:!0,button_type:P})}),i.mount(g),w.express_buttons[g]=i)}}}catch(t){n({result:"failed",message:t,button_type:P})}});return t._meta={button_type:P,selector:g,selectorParent:b,context:x},t}new((()=>_createClass(function t(){var e=this;if(_classCallCheck(this,t),this.express_buttons={},this.express_element={},this.express_buttons_shows={},this.current_processing_elements=null,this.fkCartElements=null,this.css_selector={},this.block_data={message:null,overlayCSS:{background:"#fff",opacity:.6}},this.context="",this.button_id="fkwcs_stripe_smart_button",this.payment_request=null,this.express_request_type=null,this.express_button_wrapper=null,this.is_product_page=!1,this.style_value=fkwcs_data.style,this.request_data={},this.single_product_add_to_cart_click=!1,this.cart_request_data={},this.add_to_cart_end_point="fkwcs_add_to_cart",this.checkout_button_promise=[],this.is_google_ready_to_pay=!1,this.smart_button_id="#wfacp_smart_buttons",this.loading_gif="wfacp-dynamic-checkout-loading",this.dataCommon={currency:fkwcs_data.currency,country:fkwcs_data.country_code,requestPayer
1Name:!0,requestPayerEmail:!0,requestPayerPhone:!0},""!==fkwcs_data.pub_key){try{this.stripe=window.fkwcsGetStripe(fkwcs_data.pub_key,{locale:fkwcs_data.locale}),this.init()}catch(t){"yes"===fkwcs_data.debug_log&&console.log("Stripe Error",t)}document.addEventListener("DOMContentLoaded",function(){window.jQuery&&window.jQuery!==C&&window.jQuery.fn&&"function"==typeof window.jQuery.fn.on&&"function"==typeof window.jQuery.fn.block&&(C=window.jQuery),e.setupExpressCheckoutButton("init"),e.wcEvents(),e.warmupExpressElements()})}},[{key:"init",value:function(){var t;"yes"===fkwcs_data.is_product?this.request_data=Object.assign(this.dataCommon,{total:fkwcs_data.single_product.total,requestShipping:"yes"===fkwcs_data.single_product.requestShipping,displayItems:fkwcs_data.single_product.displayItems||[]}):(n(fkwcs_data.is_cart)||"yes"===fkwcs_data.is_checkout)&&(this.request_data=Object.assign(this.dataCommon,{total:(null==(t=fkwcs_data)||null==(t=t.cart_data)||null==(t=t.order_data)?void 0:t.total)||0,requestShipping:"yes"===fkwcs_data.shipping_required,displayItems:(null==(t=fkwcs_data)||null==(t=t.cart_data)?void 0:t.displayItems)||[]}),fkwcs_data.cart_data&&fkwcs_data.cart_data.order_data&&fkwcs_data.cart_data.order_data.currency&&(t=String(fkwcs_data.cart_data.order_data.currency).toLowerCase(),this.request_data.currency=t,fkwcs_data.currency=t),this.request_data.is_fkwcs_need_payment=!(!fkwcs_data.cart_data||!fkwcs_data.cart_data.is_fkwcs_need_payment),fkwcs_data.cart_data)&&this.syncExpressCheckoutVisibility(fkwcs_data.cart_data),"yes"!==fkwcs_data.express_pay_enabled&&"yes"!==fkwcs_data.apple_pay_individual||this.setupPaymentRequest()}},{key:"warmupExpressElements",value:function(){var t;if("yes"!==fkwcs_data.is_checkout&&"yes"!==fkwcs_data.is_product&&!n(fkwcs_data.is_cart)&&0!==C("#fkcart-modal").length&&(this.applePayEnabled()||"yes"===(null==(t=fkwcs_data.enable_gateways)?void 0:t.fkwcs_stripe_google_pay)||this.linkEnabled()))try{var e=document.createElement("div");e.style.cssText="position:absolute;left:-9999px;top:-9999px;width:320px;height:60px;overflow:hidden;",document.body.appendChild(e);var a=this.stripe.elements({mode:"payment",amount:100,currency:"string"==typeof fkwcs_data.currency&&fkwcs_data.currency?fkwcs_data.currency.toLowerCase():"usd",paymentMethodCreation:"manual"}).create("expressCheckout",{paymentMethods:r.mixed}),s=function(){try{a.unmount()}catch(t){}e.remove()};a.on("ready",s),a.on("loaderror",s),a.mount(e),setTimeout(s,2e4)}catch(t){}}},{key:"ajaxEndpoint",value:function(t){var e="",a=fkwcs_data&&fkwcs_data.wc_endpoints;return e=a&&"object"===_typeof(a)&&Object.prototype.hasOwnProperty.call(a,t)?a[t]:e}},{key:"syncExpressCheckoutVisibility",value:function(t){t&&Object.prototype.hasOwnProperty.call(t,"is_fkwcs_need_payment")&&(t=!1===t.is_fkwcs_need_payment,C("#fkwcs_stripe_smart_button_wrapper").toggleClass("fkwcs_hide_button",t),C("#wfacp_smart_buttons").toggleClass("fkwcs_hide_button",t),C("#fkwcs-payment-request-separator")[t?"hide":"show"]())}},{key:"setRequestData",value:function(t,e){null!=t&&"object"===_typeof(t)&&Object.prototype.hasOwnProperty.call(t,"order_data")&&(this.request_data=Object.assign(this.dataCommon,{total:t.order_data.total,currency:t.order_data.currency,country:t.order_data.country_code,requestShipping:"yes"===t.shipping_required,displayItems:t.order_data.displayItems||[]}),this.request_data.is_fkwcs_need_payment=!0===t.is_fkwcs_need_payment,t.order_data.currency&&(fkwcs_data.currency=String(t.order_data.currency).toLowerCase()),this.syncExpressCheckoutVisibility(t),this.setupExpressCheckoutButton("",e),this.setupPaymentRequest())}},{key:"getRequestData",value:function(){return this.request_data}},{key:"generateExpressButton",value:function(){var t,e;"yes"!==fkwcs_data.is_checkout&&(t=[],this.applePayEnabled()&&(e=c(this,a.applePay.selector,"#fkcart_fkwcs_smart_button_apple_pay",r.applePay,"applePay","fkcart"),t.push(e)),"yes"===(null==(e=fkwcs_data.enable_gateways)?void 0:e.fkwcs_stripe_google_pay)&&(e=c(this,a.googlePay.selector,"#fkcart_fkwcs_smart_button_google_pay",r.googlePay,"googlePay","fkcart"),t.push(e)),this.linkEnabled()&&(e=c(this,a.link.selector,"#fkcart_fkwcs_smart_button_link",r.link,"link","fkcart"),t.push(e)),this.amazonPayEnabled()&&(e=c(this,a.amazonPay.selector,"#fkcart_fkwcs_smart_button_amazon_pay",r.amazonPay,"amazonPay","fkcart"),t.push(e)),this.handleButtonPromise(t))}},{key:"handleButtonPromise",value:function(t){var o,c,_,i,a,s,p,n;0===t.length?C(document.body).trigger("fkwcs_new_express_no_smart_buttons_generated"):(c=!(o={}),_=[],i=[],a=0,s=t.length,p=0<C("#fkwcs-expresscheckout-fieldset").length,n=function(){for(var t=p?0:300,e=0,a=i;e<a.length;e++){var s,n=a[e],r=C(n.selectorParent);"yes"===r.attr("data-fkwcs-available")&&(r.show().css("display","block"),(s=r.closest(".wfacp_smart_button_container")).length&&s.show(),"googlePay"===n.button_type&&C(document.body).trigger("fkwcs_express_google_need_to_show_button"),p||(r.find(".fkwcs_smart_button_trigger").append("<span></span>"),r.find(".fkwcs_smart_button_trigger").removeClass("hide").show()),_.push(r))}"yes"!==fkwcs_data.apple_pay_individual||c?setTimeout(function(){for(var s=0,n=i;s<n.length;s++)(()=>{var t=n[s],e=C(t.selectorParent);if("yes"!==e.attr("data-fkwcs-available"))return;var a=C(t.selector);a.show().css({display:"block",visibility:"visible"}),e.find(".fkwcs_smart_buttons").show().css("visibility","visible"),a.parents(".fkwcs_stripe_smart_button_wrapper").show(),a.find(".__PrivateStripeElement").each(function(){var t=a.hasClass("fkwcs_smart_checkout_button")?"0":"0 -4px";this.style.setProperty("margin",t,"important")}),a.find("iframe").each(function(){this.style.setProperty("margin","0","important"),this.style.setProperty("width","100%","important")}),a.addClass("fkwcs_smart_button_shown")})();C(document.body).trigger("fkwcs_new_express_smart_buttons_showed",[!0,o]),C(document.body).trigger("fkwcs_smart_buttons_showed",[!0,o]),p?C("#fkwcs-expresscheckout-fieldset .fkwcs_smart_button_trigger").addClass("hide").hide():setTimeout(function(){C(".fkwcs_smart_button_trigger").addClass("hide").hide()},500*_.length)},t):(C(".fkwcs_smart_button_trigger").addClass("hide").hide(),C(".fkwcs_smart_buttons").hide())},t.forEach(function(e){Promise.race([e,new Promise(function(t){return setTimeout(function(){t({result:"timeout",noMethods:!0,availablePaymentMethods:!1,button_type:e._meta?e._meta.button_type:"unknown",selector:e._meta?e._meta.selector:void 0,selectorParent:e._meta?e._meta.selectorParent:void 0,context:e._meta?e._meta.context:void 0})},8e3)})]).then(function(t){(t=>{if(null!==t){var e=C(t.selectorParent),a=C(t.selector);if(t.noMethods||!1===t.availablePaymentMethods)return"yes"!==e.attr("data-fkwcs-available")&&(e.hide(),a.hide());if(t.hasOwnProperty("availablePaymentMethods"))if("yes"===fkwcs_data.apple_pay_individual&&t.availablePaymentMethods&&"object"===_typeof(t.availablePaymentMethods)&&(t.availablePaymentMethods.googlePay=!1,t.availablePaymentMethods.link=!1,!(t.availablePaymentMethods.amazonPay=!1)===t.availablePaymentMethods.applePay)&&(c=!0),t.button_type&&"object"===_typeof(t.availablePaymentMethods)&&null!==t.availablePaymentMethods&&t.availablePaymentMethods.hasOwnProperty(t.button_type)&&!1===t.availablePaymentMethods[t.button_type])e.hide(),a.hide();else{var s=!1;if("object"===_typeof(t.availablePaymentMethods)&&null!==t.availablePaymentMethods)for(var n in t.availablePaymentMethods)!0===t.availablePaymentMethods[n]&&(s=o[n]=!0);else"yes"===t.already_exist&&(s=o[t.button_type]=!0);s?i.push(t):(e.hide(),a.hide())}}})(t),++a===s&&n()}).catch(function(t){"yes"===fkwcs_data.debug_log&&console.log("handleButtonPromise error",t),++a===s&&n()})}))}},{key:"setupExpressCheckoutAeroCheckout",value:function(){var a=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";if(!this._isGooglePayInstance)try{var e=function(){var t,e=[];a.applePayEnabled()&&(t=c(a,s.applePay.selector,s.applePay.parent,r.applePay,"applePay","aeroCheckout"),e.push(t)),"yes"===(null==(t=fkwcs_data.enable_gateways)?void 0:t.fkwcs_stripe_google_pay)&&(t=c(a,s.googlePay.selector,s.googlePay.parent,r.googlePay,"googlePay","aeroCheckout"),e.push(t)),a.linkEnabled()&&(t=c(a,s.link.selector,s.link.parent,r.link,"link","aeroCheckout"),e.push(t)),a.amazonPayEnabled()&&(t=c(a,s.amazonPay.selector,s.amazonPay.parent,r.amazonPay,"amazonPay","aeroCheckout"),e.push(t)),a.handleButtonPromise(e)};"init"!==t||"loading"!==document.readyState?e():window.addEventListener("DOMContentLoaded",e)}catch(t){console.log("info",t)}}},{key:"setupExpressCheckoutNativeCheckout",value:function(t){function e(){var t,e=[];a.applePayEnabled()&&(t=c(a,".fkwcs_stripe_smart_button_wrapper.checkout .fkwcs_apple_pay_button .fkwcs_smart_checkout_button",".fkwcs_stripe_smart_button_wrapper.checkout .fkwcs_apple_pay_button",r.applePay,"applePay",s),e.push(t)),"yes"===(null==(t=fkwcs_data.enable_gateways)?void 0:t.fkwcs_stripe_google_pay)&&(t=c(a,".fkwcs_stripe_smart_button_wrapper.checkout .fkwcs_google_pay_button .fkwcs_smart_checkout_button",".fkwcs_stripe_smart_button_wrapper.checkout .fkwcs_google_pay_button",r.googlePay,"googlePay",s),e.push(t)),a.linkEnabled()&&(t=c(a,".fkwcs_stripe_smart_button_wrapper.checkout .fkwcs_link_pay_button .fkwcs_smart_checkout_button",".fkwcs_stripe_smart_button_wrapper.checkout .fkwcs_link_pay_button",r.link,"link",s),e.push(t)),a.amazonPayEnabled()&&(t=c(a,".fkwcs_stripe_smart_button_wrapper.checkout .fkwcs_amazon_pay_button .fkwcs_smart_checkout_button",".fkwcs_stripe_smart_button_wrapper.checkout .fkwcs_amazon_pay_button",r.amazonPay,"amazonPay",s),e.push(t)),a.handleButtonPromise(e),a.dedupeExpressCheckoutHeading()}var a=this,s="native";"loading"!==document.readyState?e():window.addEventListener("DOMContentLoaded",e)}},{key:"dedupeExpressCheckoutHeading",value:function(){var t,e,a,s=C("#fkwcs-expresscheckout-fieldset");0!==s.length&&0!==(t=s.children("legend").first()).length&&""!==(e=C.trim(t.text()).toLowerCase())&&(a=!1,C("legend, h1, h2, h3, h4, h5, h6").each(function(){return this!==t[0]&&!C.contains(s[0],this)&&C.trim(C(this).text()).toLowerCase()===e?!(a=!0):void 0}),a)&&t.hide()}},{key:"setupExpressOnCart",value:function(){function t(){var t,e=[];a.applePayEnabled()&&(t=c(a,".fkwcs_apple_pay_button.cart .fkwcs_smart_buttons",".fkwcs_apple_pay_button.cart",r.applePay,"applePay","cart"),e.push(t)),"yes"===(null==(t=fkwcs_data.enable_gateways)?void 0:t.fkwcs_stripe_google_pay)&&(t=c(a,".fkwcs_google_pay_button.cart .fkwcs_smart_buttons",".fkwcs_google_pay_button.cart",r.googlePay,"googlePay","cart"),e.push(t)),a.linkEnabled()&&(t=c(a,".fkwcs_link_pay_button.cart .fkwcs_smart_buttons",".fkwcs_link_pay_button.cart",r.link,"link","cart"),e.push(t)),a.amazonPayEnabled()&&(t=c(a,".fkwcs_amazon_pay_button.cart .fkwcs_smart_buttons",".fkwcs_amazon_pay_button.cart",r.amazonPay,"amazonPay","cart"),e.push(t)),a.handleButtonPromise(e)}var a=this;"loading"!==document.readyState?t():window.addEventListener("DOMContentLoaded",t)}},{key:"setupExpressOnProduct",value:function(){function t(){var t,e=[];a.applePayEnabled()&&(t=c(a,o.applePay.selector,o.applePay.parent,r.applePay,"applePay","product"),e.push(t)),"yes"===(null==(t=fkwcs_data.enable_gateways)?void 0:t.fkwcs_stripe_google_pay)&&(t=c(a,o.googlePay.selector,o.googlePay.parent,r.googlePay,"googlePay","product"),e.push(t)),a.linkEnabled()&&(t=c(a,o.link.selector,o.link.parent,r.link,"link","product"),e.push(t)),a.amazonPayEnabled()&&(t=c(a,o.amazonPay.selector,o.amazonPay.parent,r.amazonPay,"amazonPay","product"),e.push(t)),a.handleButtonPromise(e)}var a=this;"loading"!==document.readyState?t():window.addEventListener("DOMContentLoaded",t)}},{key:"setupExpressCheckoutButton",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";"yes"===fkwcs_data.is_checkout?0<C("#wfacp_aero_checkout_id").length&&"object"==("undefined"==typeof wfacp_frontend?"undefined":_typeof(wfacp_frontend))&&("true"==wfacp_frontend.enable_smart_buttons||"1"==wfacp_frontend.enable_smart_buttons)?this.setupExpressCheckoutAeroCheckout(t,e):this.setupExpressCheckoutNativeCheckout(e):n(fkwcs_data.is_cart)?this.setupExpressOnCart():"yes"!==fkwcs_data.is_product_page&&"1"!==fkwcs_data.is_product_page||this.setupExpressOnProduct(),this.buttonOnProductPage(),this.buttonOnCartPage(),this.buttonOnCheckoutPage()}},{key:"setupPaymentRequest",value:function(){}},{key:"expressButtonReady",value:function(t,e){if(t){if("yes"===fkwcs_data.apple_pay_individual){var a=!1;if("object"===_typeof(t)?a=!0===t.applePay:!0===t&&(a=!0),!a)return void C(".fkwcs_smart_buttons").hide()}"yes"===fkwcs_data.is_product&&this.productEvents(e)}}},{key:"expressClick",value:function(t){var e=this,a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"",n=(this._expressClickActive=!0,clearTimeout(this._expressClickTimer),this._expressClickTimer=setTimeout(function(){e._expressClickActive=!1},3e4),C(".fkwcs_smart_product_button").trigger("click"),"yes"===(fkwcs_data&&fkwcs_data.shipping_required)),r={emailRequired:!0,phoneNumberRequired:!0,shippingAddressRequired:n="yes"===fkwcs_data.is_checkout&&("apple_pay"===t.expressPaymentType&&"yes"===fkwcs_data.apple_pay_disable_shipping&&(n=!1),"google_pay"===t.expressPaymentType)&&"yes"===fkwcs_data.google_pay_disable_shipping?!1:n};n&&(r.shippingRates=[{id:"pending",displayName:"Pending",amount:0}]),t.resolve(r),"yes"===fkwcs_data.is_product&&"product"===a&&this.addToCartProduct(s)}},{key:"isVariableProductWithoutSelection",value:function(){var t=C("form.variations_form.cart");return 0!==t.length&&!(0<parseInt(t.find('input.variation_id, input[name="variation_id"]').val(),10))}},{key:"productEvents",value:function(t){var e=this,s=C("div.fkwcs_smart_product_button");e.isVariableProductWithoutSelection()&&s.addClass("fkwcs_disabled_btn"),C(document.body).off("show_variation.fkwcsExpress").on("show_variation.fkwcsExpress",function(t,e,a){a?s.removeClass("fkwcs_disabled_btn"):s.addClass("fkwcs_disabled_btn")}),C(document.body).off("hide_variation.fkwcsExpress").on("hide_variation.fkwcsExpress",function(){s.addClass("fkwcs_disabled_btn")}),C(document.body).off("woocommerce_variation_has_changed").on("woocommerce_variation_has_changed",function(){e.updateSelectedProductsData(t)}),C("form.cart .quantity").off("input").on("input",".qty",function(){e.updateSelectedProductsData(t)}),C(document.body).on("click","div.single_add_to_cart_button",function(){e.single_product_add_to_cart_click=!0})}},{key:"updateSelectedProductsData",value:function(e){var a=this;C.when(this.prepareSelectedProductData()).then(function(t){t.error?a.showErrorMessage(t.error):C.when(e.update({total:t.total,displayItems:t.displayItems||[]})).then(function(){})})}},{key:"parseJSONFromResponse",value:function(t){t=t.match(/\{(?:[^{}]|(\{[^{}]*\}))*\}/);if(!t)return console.warn("No JSON object found in response."),null;try{return JSON.parse(t[0])}catch(t){return console.error("Failed to parse JSON:",t),null}}},{key:"onPaymentMethodFkcart",value:function(t,e){this.processPayment(t,e,2<arguments.length&&void 0!==arguments[2]?arguments[2]:"")}},{key:"onPaymentMethod",value:function(t){this.processPayment(t,this.elements)}},{key:"processPayment",value:function(a,t){var e,s,n=this,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"",o=(this.current_processing_elements=t,C("form.woocommerce-checkout"));o.addClass("processing"),o.block(this.block_data),a&&"amazon_pay"===a.expressPaymentType?this.processAmazonExpress(a,t,o,r):((s=(e=t.submit()).then(function(){return n.stripe.createPaymentMethod({elements:t})})).then(function(t){var t=_objectSpread(_objectSpread({},a),{},{paymentMethod:t.paymentMethod}),t=n.paymentMethodData(t,r),e=t["woocommerce-process-checkout-nonce"]||fkwcs_data.checkout_nonce||"";return e&&(t["woocommerce-process-checkout-nonce"]=e),C.when(C.ajax({type:"POST",data:t,dataType:"text",url:n.aja
1xEndpoint("wc_stripe_create_order")}))}).then(function(t){t=n.parseJSONFromResponse(t);t&&"success"===t.result?!1===n.confirmPaymentIntent(a,t.redirect)&&(o.addClass("processing"),o.block(n.block_data),window.location=t.redirect):(o.removeClass("processing"),o.unblock(),n.abortPayment(a,t?t.messages:"Error processing payment"),n.maybeSelectWalletGatewayFallback(a))}),s.catch(function(t){o.removeClass("processing"),o.unblock(),console.log(t),n.abortPayment(a,n.formatStripeError(t))}),e.catch(function(t){o.removeClass("processing"),o.unblock(),console.log(t),n.abortPayment(a,n.formatStripeError(t))}))}},{key:"processAmazonExpress",value:function(a,t,s){var n=this,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"";t.submit().then(function(){return n.stripe.createConfirmationToken({elements:t})}).then(function(t){var e;t.error?(s.removeClass("processing"),s.unblock(),n.abortPayment(a,n.formatStripeError(t))):((e=n.paymentMethodData(a,r)).payment_method="fkwcs_stripe_amazon_pay",e.fkwcs_confirmation_token=t.confirmationToken.id,delete e.fkwcs_source,(t=e["woocommerce-process-checkout-nonce"]||fkwcs_data.checkout_nonce||"")&&(e["woocommerce-process-checkout-nonce"]=t),C.ajax({type:"POST",data:e,dataType:"text",url:n.ajaxEndpoint("wc_stripe_create_order")}).done(function(t){t=n.parseJSONFromResponse(t);t&&"success"===t.result?window.location=t.redirect:(s.removeClass("processing"),s.unblock(),n.abortPayment(a,t?t.messages:"Error processing payment"))}).fail(function(){s.removeClass("processing"),s.unblock()}))}).catch(function(t){s.removeClass("processing"),s.unblock(),console.log(t)})}},{key:"refreshCheckoutNonceFromFragments",value:function(t){t&&(t=t.fkwcs_nonces||t.fkwcs_google_pay_data&&t.fkwcs_google_pay_data.nonces||null)&&t.checkout_nonce&&(fkwcs_data.checkout_nonce=t.checkout_nonce)}},{key:"addToCartProduct",value:function(){var s,e=this,a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=C(".single_add_to_cart_button").val(),n=C(".single_variation_wrap"),r=C("form.variations_form.cart");if(!(0<r.length&&0===parseInt(r.find(".variation_id").val(),10)))return n.length&&(t=n.find('input[name="product_id"]').val()),r=C(".quantity .qty").val(),s={fkwcs_nonce:fkwcs_data.fkwcs_nonce,action:"add_to_cart",product_id:t,qty:r,attributes:C(".variations_form").length?this.getVariationAttributes().attributes:[]},n=C("form.cart").serializeArray(),C.each(n,function(t,e){var a;/^addon-/.test(e.name)&&(/\[\]$/.test(e.name)?(a=e.name.substring(0,e.name.length-2),s[a]?s[a].push(e.value):s[a]=[e.value]):s[e.name]=e.value),"sublium-option-plan"===e.name&&(s[e.name]=e.value)}),C.ajax({type:"POST",data:s,url:this.ajaxEndpoint(this.add_to_cart_end_point),success:function(t){if(t&&t.fragments&&e.refreshCheckoutNonceFromFragments(t.fragments),"function"==typeof a&&a(t.fragments.fkwcs_cart_details.order_data),"undefined"!=typeof Storage&&t&&t.fragments)try{"undefined"!=typeof wc_cart_fragments_params&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(t.fragments)),localStorage.setItem(wc_cart_fragments_params.cart_hash_key,t.cart_hash),sessionStorage.setItem(wc_cart_fragments_params.cart_hash_key,t.cart_hash)),"undefined"!=typeof fkcart_app_data&&(sessionStorage.setItem(fkcart_app_data.fragment_name,JSON.stringify(t.fragments)),localStorage.setItem(fkcart_app_data.cart_hash_key,t.cart_hash),sessionStorage.setItem(fkcart_app_data.cart_hash_key,t.cart_hash))}catch(t){}try{C(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,C(".single_add_to_cart_button")])}catch(t){}}});console.log("variation_id is empty")}},{key:"prepareSelectedProductData",value:function(){var t=C(".single_variation_wrap"),e=C(".single_add_to_cart_button").val(),t=(0<t.length&&(e=C(".single_variation_wrap").find('input[name="product_id"]').val()),C("#product-addons-total")),a=0,t=(0<t.length&&(a=(t.data("price_data")||[]).reduce(function(t,e){return t+e.cost},0)),{fkwcs_nonce:fkwcs_data.fkwcs_nonce,product_id:e,qty:C(".quantity .qty").val(),addon_value:a,attributes:C(".variations_form").length?this.getVariationAttributes().attributes:[]});return C.ajax({type:"POST",data:t,url:this.ajaxEndpoint("fkwcs_selected_product_data")})}},{key:"logError",value:function(t){C.ajax({type:"POST",url:fkwcs_data.admin_ajax,data:{action:"fkwcs_js_errors",_security:fkwcs_data.js_nonce,failed:1<arguments.length&&void 0!==arguments[1]&&arguments[1],error:t}})}},{key:"getVariationAttributes",value:function(){var t=C(".variations_form").find(".variations select"),e={},a=0;return t.each(function(){var t=C(this).data("attribute_name")||C(this).attr("name");e[t]=C(this).val()||"",a++}),{count:a,chosenCount:0,attributes:e}}},{key:"paymentMethodData",value:function(t){var a,s,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=t.paymentMethod,r=t.billingDetails,o=r.email,c=r.phone,_=r.address,r=r.name,i=t&&t.shippingAddress,r=(this.express_request_type=t.expressPaymentType,{fkwcs_nonce:fkwcs_data.fkwcs_nonce,billing_first_name:null!==r?r.split(" ").slice(0,1).join(" "):"test",billing_last_name:null!==r?r.split(" ").slice(1).join(" "):"test",billing_company:"",billing_email:null!==o?o:"",billing_phone:null!==c?c:"",order_comments:"",payment_method:"fkwcs_stripe",terms:1,fkwcs_source:n?n.id:"",payment_request_type:t.expressPaymentType});return 0<C('input[name="billing_email"]').length&&""!==C('input[name="billing_email"]').val()&&(r.billing_email=C('input[name="billing_email"]').val()),"apple_pay"===this.express_request_type&&0<C("li.payment_method_fkwcs_stripe_apple_pay").length&&(r.payment_method="fkwcs_stripe_apple_pay"),"amazon_pay"===this.express_request_type&&(r.payment_method="fkwcs_stripe_amazon_pay"),r=this.prepareBillingAddress(r,_),r=this.prepareShippingAddress(r,i),"yes"===fkwcs_data.is_checkout?(c=(o=C('input[name="payment_method"]:checked').val())&&("fkwcs_stripe_apple_pay"===o||"fkwcs_stripe_google_pay"===o),t.shippingRate&&t.shippingRate.id&&C('input[name="shipping_method[0]"][value="'+t.shippingRate.id+'"]').prop("checked",!0),n=C("form[n
1ame=checkout]").serializeArray(),(r=c?(a={},C.each(n,function(t,e){a[e.name]=e.value}),o&&(a.payment_method=o),C.each(r,function(t,e){"fkwcs_source"!==t&&"payment_request_type"!==t&&"fkwcs_nonce"!==t&&a.hasOwnProperty(t)&&""!==a[t]&&null!==a[t]||(a[t]=e)}),a):(s={},C.each(n,function(t,e){s[e.name]=e.value}),C.each(r,function(t,e){"fkwcs_source"!==t&&"payment_request_type"!==t&&"fkwcs_nonce"!==t&&"payment_method"!==t&&s.hasOwnProperty(t)&&""!==s[t]&&null!==s[t]||(s[t]=e)}),s)).page_from="checkout"):"fkcart"===e?r.page_from="fkcart":"yes"===fkwcs_data.is_product?r.page_from="product":r.page_from="cart",!0===Object.prototype.hasOwnProperty.call(r,"wc-fkwcs_stripe-payment-token")&&delete r["wc-fkwcs_stripe-payment-token"],(r=JSON.parse(JSON.stringify(r))).payment_request_type=this.express_request_type,r}},{key:"prepareBillingAddress",value:function(t,e){return null!==e&&(t.billing_address_1=null!==e?e.line1:"",t.billing_address_2=null!==e?e.line2:"",t.billing_city=null!==e?e.city:"",t.billing_state=null!==e?e.state:"",t.billing_postcode=null!==e?e.postal_code:"",t.billing_country=null!==e?e.country:""),t}},{key:"prepareShippingAddress",value:function(a,t){var s;return t?(a.shipping_first_name=t.name.split(" ").slice(0,1).join(" "),a.shipping_last_name=t.name.split(" ").slice(1).join(" "),a.shipping_company=t&&t.organization,a.shipping_country=t.address.country,a.shipping_address_1=t.address.line1,a.shipping_address_2=t.address.line2,a.shipping_city=t.address.city,a.shipping_state=t.address.state,a.shipping_postcode=t.address.postal_code,a.ship_to_different_address=1,a.hasOwnProperty("billing_phone")&&a.billing_phone&&(a.shipping_phone=a.billing_phone)):"yes"===fkwcs_data.express_copy_billing_to_shipping&&(s={shipping_first_name:"billing_first_name",shipping_last_name:"billing_last_name",shipping_company:"billing_company",shipping_country:"billing_country",shipping_address_1:"billing_address_1",shipping_address_2:"billing_address_2",shipping_city:"billing_city",shipping_state:"billing_state",shipping_postcode:"billing_postcode",shipping_phone:"billing_phone"},Object.keys(s).forEach(function(t){var e=s[t];a.hasOwnProperty(e)&&a[e]&&(a[t]=a[e])})),a}},{key:"confirmPaymentIntent",value:function(t,e){var a=e.match(/^#?fkwcs-confirm-(pi|si)-([^:]+):(.+):(.+):(.+):(.+)$/);if(!a||a.length<5)return window.location.href=e,!1;var e=a[1],s=a[2],a=decodeURIComponent(a[3]);this.confirmPayment(t,s,a,e)}},{key:"confirmPayment",value:function(e,a,s,n){var r=this,o=4<arguments.length&&void 0!==arguments[4]&&arguments[4],t={elements:this.current_processing_elements,clientSecret:a,confirmParams:{return_url:fkwcs_data.get_home_url+s},redirect:"if_required"},c=null,c="si"===n?this.stripe.confirmSetup(t):this.stripe.confirmPayment(t),_=C("form.woocommerce-checkout");c.then(function(t){t.error?(r.logError(t.error),C(".woocommerce-error").remove(),_.unblock(),C(".woocommerce-notices-wrapper:first-child").html('<div class="woocommerce-error fkwcs-errors">'+t.error.message+"</div>").show()):(t=t["si"===n?"setupIntent":"paymentIntent"],!1!==o||"requires_action"!==t.status&&"requires_source_action"!==t.status?(_.addClass("processing"),_.block(r.block_data),window.location=s):r.confirmPayment(e,a,s,n,!0))})}},{key:"abortPayment",value:function(t,e){"function"==typeof t.paymentFailed?t.paymentFailed({reason:"fail"}):"function"==typeof t.resolve&&t.resolve({status:"fail"}),this.showErrorMessage(e)}},{key:"maybeSelectWalletGatewayFallback",value:function(t){var e;"yes"!==fkwcs_data.is_checkout||(e="","apple_pay"===(t=t&&t.expressPaymentType||this.express_request_type)?e="fkwcs_stripe_apple_pay":"google_pay"===t&&(e="fkwcs_stripe_google_pay"),""===e)||0===(t=C("li.payment_method_"+e)).length||t.hasClass("fkwcs_display_none")||!t.is(":visible")||0===(e=t.find('input[name="payment_method"]')).length||e.is(":checked")||e.prop("checked",!0).trigger("click").trigger("change")}},{key:"mapShipping",value:function(t){return t.map(function(t){var e={id:t.id,displayName:t.label||t.dis
1playName||"",amount:parseInt(t.amount,10)||0},t=t.detail||t.description||"";return t&&(e.deliveryEstimate=t),e})}},{key:"shippingAddressChange",value:function(e){var a=this,s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",t=e.address,n=t.postalCode,r=(t&&t.postal_code&&(n=t.postal_code),t&&t.state),r=(t&&t.region&&(r=t.region),{fkwcs_nonce:fkwcs_data.fkwcs_nonce,country:t.country,state:r,postcode:n,city:t.city,address:t&&t.addressLine&&t.addressLine[0]?t.addressLine[0]:"",address_2:t&&t.addressLine&&t.addressLine[1]?t.addressLine[1]:"",payment_request_type:e.express_request_type,is_product_page:this.is_product_page});"yes"===fkwcs_data.is_checkout&&(n=C("form[name=checkout]").serialize(),r.post_data=n),C.ajax({type:"POST",data:r,url:this.ajaxEndpoint("fkwcs_update_shipping_address"),success:function(t){t&&"success"===t.result?("function"==typeof s&&s(t),a.elements&&0<Number(t.total.amount)&&a.elements.update({amount:t.total.amount}),a.fkCartElements&&0<Number(t.total.amount)&&a.fkCartElements.update({amount:t.total.amount}),e.resolve({shippingRates:a.mapShipping(t.shipping_methods)})):e.reject({status:"fail"})},error:function(){e.reject({status:"fail"})}})}},{key:"shippingOptionChange",value:function(e){var t,a=this,s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=e.shippingRate,n={fkwcs_nonce:fkwcs_data.fkwcs_nonce,shipping_method:[n.id],payment_request_type:this.express_request_type,is_product_page:this.is_product_page};"yes"===fkwcs_data.is_checkout&&(t=C("form[name=checkout]").serialize(),n.post_data=t),C.ajax({type:"POST",data:n,url:this.ajaxEndpoint("fkwcs_update_shipping_option"),success:function(t){t&&"success"===t.result?(a.elements&&0<Number(t.total.amount)&&a.elements.update({amount:t.total.amount}),a.fkCartElements&&0<Number(t.total.amount)&&a.fkCartElements.update({amount:t.total.amount}),"function"==typeof s&&s(t),e.resolve()):e.reject({status:"fail"})},error:function(){e.reject({status:"fail"})}})}},{key:"makePaymentCatch",value:function(t){console.log("error",t)}},{key:"cancelPayment",value:function(){this._expressClickActive=!1,clearTimeout(this._expressClickTimer),C(document.body).trigger("fkwcs_express_cancel_payment",this)}},{key:"formatStripeError",value:function(t){var e="";return t&&t.error&&t.error.message?e=t.error.message:t&&t.message&&(e=t.message),e=e||"Error processing payment",'<ul class="woocommerce-error" role="alert"><li>'+(e=C("<div/>").text(e).html())+"</li></ul>"}},{key:"showErrorMessage",value:function(t){var e;C(".woocommerce-error").remove(),"no"!==fkwcs_data.is_product?C(".product").first().before(t):(e=(e=C("form.checkout").closest("form")).length?e:C("form.woocommerce-cart-form, .woocommerce-notices-wrapper, .fkwcs-express-checkout-wrapper").first()).length?e.before(t):C("body").prepend(t),window.scrollTo({top:100,behavior:"smooth"})}},{key:"getCartDetails",value:function(){var t={fkwcs_nonce:fkwcs_data.fkwcs_nonce},e=this;C.ajax({type:"POST",data:t,url:this.ajaxEndpoint("fkwcs_get_cart_details"),success:function(t){t.success&&(e.setRequestData(t.data),e.setupPaymentRequest())}})}},{key:"wcEvents",value:function(){var s=this,n=this;window.addEventListener("keydown",function(t){("F5"===t.key||t.ctrlKey&&"r"===t.key||t.metaKey&&"r"===t.key)&&"yes"===fkwcs_data.is_checkout&&C(".fkwcs_smart_button_trigger").removeClass("hide").show()}),C(document.body).on("updated_checkout",function(t,e){try{var a=e&&e.fragments&&e.fragments.fkwcs_cart_details;a&&a.order_data?n.setRequestData(a,"updated_checkout"):(C("#fkwcs_stripe_smart_button_wrapper").removeClass("fkwcs_hide_button"),C("#wfacp_smart_buttons").removeClass("fkwcs_hide_button"),C("#fkwcs-payment-request-separator").show(),n.getCartDetails())}catch(t){C("#fkwcs_stripe_smart_button_wrapper").removeClass("fkwcs_hide_button"),C("#wfacp_smart_buttons").removeClass("fkwcs_hide_button"),C("#fkwcs-payment-request-separator").show(),n.getCartDetails()}}),C(document.body).on("updated_cart_totals",function(){n.getCartDetails()}),C(document.body).on("wc_fragments_refreshed added_to_cart removed_from_cart wc_fragments_loaded",function(){setTimeout(function(){var t="wc_cart_fragments";if("undefined"!=typeof wc_cart_fragments_params&&(t=wc_cart_fragments_params.fragment_name),"undefined"!=typeof fkcart_app_data&&(t=fkcart_app_data.fragment_name),"undefined"!=typeof Storage){t=sessionStorage.getItem(t);try{t=JSON.parse(t)}catch(t){return}null!==t&&"object"===_typeof(t)&&!Array.isArray(t)&&Object.prototype.hasOwnProperty.call(t,"fkwcs_cart_details")&&(s.cart_request_data=t.fkwcs_cart_details,"yes"!==fkwcs_data.is_product&&"yes"!==fkwcs_data.is_checkout)&&(n.setRequestData(t.fkwcs_cart_details),n.setupPaymentRequest())}},300)}),C(document.body).on("fkcart_update_wc_fragments",function(t,e){var a="wc_cart_fragments",s=("undefined"!=typeof wc_cart_fragments_params&&(a=wc_cart_fragments_params.fragment_name),"undefined"!=typeof fkcart_app_data&&(a=fkcart_app_data.fragment_name),sessionStorage.getItem(a));if(s)try{s=JSON.parse(s)}catch(t){return}"object"===_typeof(s)&&null!==s&&0!==Object.keys(s).length&&(e&&Object.prototype.hasOwnProperty.call(e,"fkwcs_cart_details")&&(s.fkwcs_cart_details=e.fkwcs_cart_details),e&&Object.prototype.hasOwnProperty.call(e,"fkwcs_google_pay_data")&&(s.fkwcs_google_pay_data=e.fkwcs_google_pay_data),sessionStorage.setItem(a,JSON.stringify(s)))}),C(document.body).on("fkwcs_express_button_init",function(){var t=C("#fkcart-modal");("yes"!==fkwcs_data.is_product||t.hasClass("fkcart-show"))&&0<Object.keys(s.
1cart_request_data).length&&(s.setRequestData(s.cart_request_data,"fkcart"),s.generateExpressButton("fkcart"))}),C(document.body).on("added_to_cart",function(t,e){s.refreshCheckoutNonceFromFragments(e),"yes"!==fkwcs_data.is_checkout&&e&&Object.prototype.hasOwnProperty.call(e,"fkwcs_cart_details")&&("undefined"!=typeof fkcart_app_data&&"yes"===fkcart_app_data.should_open_cart||C("#fkcart-modal").hasClass("fkcart-show"))&&setTimeout(function(){0!==C("#fkcart-modal").find(".fkwcs_smart_cart_button").length&&(s.cart_request_data=e.fkwcs_cart_details,s.setRequestData(s.cart_request_data,"fkcart"),s.generateExpressButton("fkcart"))},0)}),C(document.body).on("fkwcs_express_button_update_cart_details",function(t,e){s.refreshCheckoutNonceFromFragments(e),null!=e&&Object.prototype.hasOwnProperty.call(e,"fkwcs_cart_details")&&(s.setRequestData(e.fkwcs_cart_details),s.generateExpressButton("fkcart"))}),C(document.body).on("fkcart_fragments_refreshed",function(t,e){s.refreshCheckoutNonceFromFragments(e);var a=C("#fkcart-modal");null!=e&&Object.prototype.hasOwnProperty.call(e,"fkwcs_cart_details")&&(s.cart_request_data=e.fkwcs_cart_details,a.hasClass("fkcart-show"))&&(s.setRequestData(s.cart_request_data),s.generateExpressButton("fkcart"))}),C(document.body).on("fkwcs_google_ready_pay",function(){n.is_google_ready_to_pay=!0}),C(document.body).on("fkcart_cart_closed",function(){var t;"yes"===fkwcs_data.is_product&&((t=C("form.cart").find(".qty")).length&&t.val(1),s.request_data=Object.assign(s.dataCommon,{total:fkwcs_data.single_product.total,requestShipping:"yes"===fkwcs_data.single_product.requestShipping,displayItems:fkwcs_data.single_product.displayItems||[]}),s.setRequestData())})}},{key:"setCss",value:function(t,e,a){this.css_selector.hasOwnProperty(t)||(this.css_selector[t]={}),this.css_selector[t][e]=a}},{key:"applyCss",value:function(){for(var t in this.css_selector)if(0!==Object.keys(this.css_selector[t]).length)for(var e in this.css_selector[t])C(t).css(e,this.css_selector[t][e])}},{key:"buttonOnProductPage",value:function(){}},{key:"buttonOnCartPage",value:function(){}},{key:"buttonOnCheckoutPage",value:function(){var t=C(".woocommerce-billing-fields");"yes"===fkwcs_data.is_checkout&&0!==t.length&&this.applyCss()}},{key:"expressBtnStyle",value:function(){}},{key:"makeButtonVisibleInline",value:function(){var t,e,a="",s=C("#fkwcs_stripe_smart_button_wrapper");0!==s.length&&(s.hasClass("inline")&&(t=(s=s.parent()).children(".single_add_to_cart_button"),e=s.children(".quantity"),a=s.outerWidth()-((s=t.outerWidth())+e.outerWidth()+10),this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","marginRight",e.css("marginRight")),s<a?(this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","margin",0),this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","marginRight",e.css("marginRight")),this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","clear","unset"),this.setCss("#fkwcs_stripe_smart_button_wrapper","margin","0px"),this.setCss("#fkwcs_stripe_smart_button_wrapper","display","inline-block")):(this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","margin","10px 0"),this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","flex","initial"),this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","clear","both"),this.setCss("#fkwcs_stripe_smart_button_wrapper .theme-flatsome .cart .quantity","width","100%"),this.setCss("#fkwcs_stripe_smart_button_wrapper .theme-flatsome .cart .quantity","clear","both"),this.setCss("#fkwcs_stripe_smart_button_wrapper","marginTop","10px"),this.setCss("#fkwcs_stripe_smart_button_wrapper","display","block")),60<(a=t.outerHeight())&&this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","height","60"),a<35&&this.setCss("#fkwcs_stripe_smart_button_wrapper .single_add_to_cart_button","height","35"),C("#fkwcs_stripe_smart_button_wrapper").width(s)),this.applyCss())}},{key:"linkEnabled",value:function(){var t="yes"===fkwcs_data.link_button_enabled||"1"===fkwcs_data.link_button_enabled,e="yes"===fkwcs_data.express_pay_enabled||"1"===fkwcs_data.express_pay_enabled;return t&&e}},{key:"amazonPayEnabled",value:function(){var t="yes"===fkwcs_data.amazon_pay_button_enabled||"1"===fkwcs_data.amazon_pay_button_enabled,e="yes"===fkwcs_data.express_pay_enabled||"1"===fkwcs_data.express_pay_enabled;return t&&e}},{key:"applePayEnabled",value:function(){var t;return"yes"===(null==(t=fkwcs_data.enable_gateways)?void 0:t.fkwcs_stripe_apple_pay)}}]))())})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.