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