(()=>{"use strict";var e={n:t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var c in i)e.o(i,c)&&!e.o(t,c)&&Object.defineProperty(t,c,{enumerable:!0,get:i[c]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.jQuery;var i=e.n(t);const c=class{constructor({id:e,prefix:t,data:c}){this.id=e,this.prefix=t,this.data=c,i()(document.body).on("change",'[name^="woocommerce_ppcp_"]',this.handleInputChange.bind(this)),i()(document.body).on("click",".wc-ppcp-clipboard",this.handleClipboard.bind(this)),this.maybeShowDependencies(),this.initializeSlider()}getFieldKey(e){return`${this.prefix}${e}`}getFieldValue(e){const t=i()(`#${this.getFieldKey(e)}`);return t.is(":checkbox")?t.is(":checked"):t.val()}setFieldValue(e,t,c=!1){const n=`#${this.getFieldKey(e)}`;i()(n).val(t),c&&i()(n).trigger("change")}handleInputChange(e){this.maybeShowDependencies(),"woocommerce_ppcp_use_place_order"===i()(e.currentTarget).attr("name")&&i()(e.currentTarget).is(":checked")&&i()("#woocommerce_ppcp_checkout_placement").val("place_order").trigger("change")}maybeShowDependencies(){const e=document.querySelectorAll("[data-show-if]"),t=[];for(const c of e){const e=c.getAttribute("data-show-if").match(/(([\w]+)=([\w]+))+/g);if(e&&!t.includes(c.id))for(const n of e){const[e,o]=n.split("="),a=document.getElementById(`${this.prefix}${e}`);try{if(i()(a).is(":checkbox")){if(a.checked.toString()!=o)throw"no match"}else if(a.value!=o)throw"no match";i()(c).closest("tr").show()}catch(e){t.push(c.id),i()(c).closest("tr").hide();break}}}}getSettings(){return wcPPCPSettings[this.id]}getLoaderHtml(){return'<div class="wc-ppcp-loader">\n            <div></div>\n            <div></div>\n            <div></div>\n        </div>'}showLoader(e){i()(e).append(this.getLoaderHtml())}hideLoader(e){i()(e).find(".wc-ppcp-loader").remove()}block(e=null,t={}){const c={css:{border:"none","background-color":"transparent","font-size":"16px"},overlayCSS:{background:"#fff",opacity:.7},...t};e?i()(e).block(c):i().blockUI(c)}unblock(e){e?i()(e).unblock():i().unblockUI()}handleClipboard(e){const t=i()(e.currentTarget).parent().data("clipboard"),c=document.createElement("input");c.value=t,c.type="text",i()(document.body).append(c),c.select(),document.execCommand("copy"),i()(c).remove()}getAjaxPath(e){const t=wcPPCPSettings?.adminAjaxUrl||"";return e=e.replace(/(^\/)/,""),t.replace("$path",e)}initializeSlider(){const e=i()(".wc-ppcp-slider");if(!e.length)return;const t={min:e.data("height-min"),max:e.data("height-max"),step:e.data("height-step"),value:this.getFieldValue("button_height")};e.slider(t),e.on("slidechange",(e,t)=>{this.onSlideChange(e,t)}).on("slide",(t,i)=>e.closest("td").find(".wc-ppcp-slider-val").text(`${i.value}px`))}onSlideChange(e,t){this.setFieldValue("button_height",t.value,!0),i()(e.currentTarget).closest("td").find(".wc-ppcp-slider-val").text(`${t.value}px`)}};var n;n="ppcp_googlepay",new class extends c{constructor(e){super(e),this.initialize()}initialize(){}}({id:n,prefix:`woocommerce_${n}_`,data:wcPPCPSettings?.[n]||{}}),(this.wcPPCP=this.wcPPCP||{})["googlepay-settings"]={}})();
//# sourceMappingURL=googlepay-settings.js.map