Files
2026-04-28 15:13:50 +02:00

2 lines
65 KiB
JavaScript

/*! For license information please see woopay-express-button.js.LICENSE.txt */
(()=>{var e={5338:(e,t,o)=>{"use strict";var r=o(5795);t.H=r.createRoot,r.hydrateRoot},1020:(e,t,o)=>{"use strict";var r=o(1609),n=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,o){var r,c={},l=null,u=null;for(r in void 0!==o&&(l=""+o),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!s.hasOwnProperty(r)&&(c[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===c[r]&&(c[r]=t[r]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:i.current}}t.jsx=c,t.jsxs=c},4848:(e,t,o)=>{"use strict";e.exports=o(1020)},1609:e=>{"use strict";e.exports=window.React},5795:e=>{"use strict";e.exports=window.ReactDOM}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,o),a.exports}o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),o.p=window.wcpayAssets.url,(()=>{"use strict";var e=o(5338);const t=e=>"undefined"!=typeof wcpayConfig&&void 0!==wcpayConfig[e]?wcpayConfig[e]:r(e),r=e=>{let t=null;if("undefined"!=typeof wcpay_upe_config)t=wcpay_upe_config;else{if("object"!=typeof wc||void 0===wc.wcSettings)return null;t=wc.wcSettings.getSetting("woocommerce_payments_data")||{}}return t[e]||null},n=window.wp.i18n;var a=o(1609);function i(e){var t,o,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(o=i(e[t]))&&(r&&(r+=" "),r+=o)}else for(o in e)e[o]&&(r&&(r+=" "),r+=o);return r}const s=function(){for(var e,t,o=0,r="",n=arguments.length;o<n;o++)(e=arguments[o])&&(t=i(e))&&(r&&(r+=" "),r+=t);return r};var c=o(4848);const l=e=>(0,c.jsx)("svg",{viewBox:"0 0 109 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M69.496 5.785v16.42h2.766v-6.179h4.37c1.104 0 2.059-.23 2.865-.689.807-.46 1.424-1.075 1.852-1.846.428-.788.642-1.65.642-2.585 0-.936-.214-1.79-.642-2.56a4.714 4.714 0 0 0-1.852-1.872c-.79-.46-1.745-.69-2.864-.69h-7.137Zm2.766 7.804h4c.56 0 1.054-.107 1.482-.32.445-.23.79-.55 1.037-.96.247-.41.37-.878.37-1.403 0-.526-.123-.993-.37-1.404a2.386 2.386 0 0 0-1.037-.935c-.428-.23-.922-.345-1.482-.345h-4v5.367Zm15.693 8.912c-1.02 0-1.934-.246-2.74-.739-.808-.508-1.441-1.23-1.902-2.166-.445-.936-.667-2.043-.667-3.323 0-1.264.222-2.364.667-3.3.46-.951 1.094-1.682 1.901-2.19.807-.51 1.72-.764 2.741-.764.823 0 1.597.206 2.321.616a4.761 4.761 0 0 1 1.556 1.352v-1.672h2.47v11.89h-2.47v-1.667a5.231 5.231 0 0 1-1.556 1.372 4.695 4.695 0 0 1-2.32.591Zm2.692-9.675c.53.311.924.673 1.185 1.084v4.757c-.26.423-.656.79-1.185 1.101-.642.361-1.3.542-1.976.542-1.053 0-1.893-.37-2.519-1.108-.609-.755-.913-1.731-.913-2.93 0-.787.132-1.485.395-2.092a3.327 3.327 0 0 1 1.21-1.428c.527-.345 1.136-.517 1.827-.517.675 0 1.334.197 1.976.59Zm6.422 11.817c.115.066.271.115.469.148.197.032.395.049.592.049.395 0 .725-.082.988-.246.264-.164.478-.435.642-.813l.625-1.442-4.897-12.024h2.642l3.556 9.035 3.556-9.035h2.667l-5.803 14.106c0 .017-.008.025-.024.025v.05c-.264.607-.585 1.099-.964 1.476a3.337 3.337 0 0 1-1.284.813c-.477.164-1.02.246-1.63.246a6.98 6.98 0 0 1-1.53-.172l.395-2.216ZM39.45 5.512c-4.856 0-8.575 3.614-8.575 8.502 0 4.888 3.743 8.478 8.575 8.478 4.832 0 8.527-3.614 8.551-8.478 0-4.888-3.719-8.502-8.551-8.502Zm0 11.76c-1.824 0-3.08-1.369-3.08-3.258 0-1.89 1.256-3.283 3.08-3.283s3.08 1.394 3.08 3.283-1.233 3.259-3.08 3.259Zm-30.463 5.22c1.919 0 3.458-.945 4.619-3.117l2.582-4.818v4.085c0 2.41 1.563 3.85 3.98 3.85 1.894 0 3.292-.827 4.642-3.117l5.946-10.013c1.302-2.196.378-3.85-2.488-3.85-1.54 0-2.534.496-3.434 2.173l-4.098 7.675V8.535c0-2.03-.971-3.022-2.772-3.022-1.42 0-2.558.614-3.434 2.314l-3.861 7.533V8.606c0-2.172-.9-3.093-3.08-3.093H3.136c-1.682 0-2.534.779-2.534 2.22 0 1.44.9 2.266 2.534 2.266H4.96v8.62c0 2.432 1.634 3.873 4.027 3.873Zm40.221-8.478c0-4.888 3.719-8.502 8.551-8.502 4.832 0 8.551 3.637 8.551 8.502 0 4.864-3.719 8.478-8.55 8.478-4.833 0-8.552-3.59-8.552-8.478Zm5.495 0c0 1.889 1.208 3.259 3.056 3.259 1.824 0 3.08-1.37 3.08-3.26 0-1.888-1.256-3.282-3.08-3.282s-3.056 1.394-3.056 3.283Z",fill:"#fff",...e})}),u=e=>(0,c.jsxs)("svg",{viewBox:"0 0 100 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M63.963 4.435v15.121h2.547v-5.69h4.025c1.016 0 1.895-.212 2.638-.635a4.384 4.384 0 0 0 1.705-1.7 4.906 4.906 0 0 0 .591-2.38c0-.862-.197-1.648-.59-2.358a4.341 4.341 0 0 0-1.706-1.723c-.728-.423-1.607-.635-2.638-.635h-6.572Zm2.547 7.187h3.684c.515 0 .97-.099 1.364-.295.41-.212.728-.506.955-.884.228-.378.341-.809.341-1.292 0-.484-.113-.915-.34-1.293a2.197 2.197 0 0 0-.956-.861c-.394-.212-.849-.318-1.364-.318H66.51v4.943Zm14.451 8.206c-.94 0-1.781-.226-2.524-.68-.743-.468-1.326-1.133-1.75-1.995-.41-.861-.615-1.881-.615-3.06 0-1.164.205-2.177.614-3.038.425-.877 1.008-1.55 1.751-2.018.743-.468 1.584-.703 2.524-.703.758 0 1.47.19 2.138.567a4.384 4.384 0 0 1 1.432 1.245v-1.54h2.274v10.95h-2.274V18.02c-.393.517-.87.938-1.432 1.264a4.323 4.323 0 0 1-2.138.544Zm2.479-8.91c.487.287.851.62 1.091 1v4.38c-.24.39-.604.727-1.091 1.014-.591.332-1.198.499-1.82.499-.97 0-1.743-.34-2.319-1.02-.56-.696-.841-1.595-.841-2.698 0-.726.121-1.368.364-1.927.257-.56.629-.998 1.114-1.315.485-.318 1.046-.476 1.683-.476.621 0 1.228.181 1.819.544Zm5.913 10.883c.107.06.25.106.433.136.181.03.363.045.545.045.364 0 .667-.075.91-.227.243-.15.44-.4.591-.748l.576-1.328-4.51-11.073h2.433l3.275 8.32 3.274-8.32h2.456l-5.344 12.99c0 .016-.007.023-.022.023v.046c-.243.559-.538 1.012-.887 1.36a3.079 3.079 0 0 1-1.183.748c-.44.151-.94.227-1.5.227a6.449 6.449 0 0 1-1.41-.159l.364-2.04Z",fill:"#000",...e}),(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.242 19.82c1.767 0 3.185-.87 4.254-2.871l2.377-4.436v3.762c0 2.218 1.44 3.545 3.665 3.545 1.745 0 3.032-.762 4.275-2.871l5.475-9.22c1.2-2.023.35-3.545-2.29-3.545-1.418 0-2.334.457-3.163 2l-3.774 7.068V6.968c0-1.87-.894-2.784-2.552-2.784-1.308 0-2.355.565-3.162 2.131L9.79 13.252v-6.22c0-2-.829-2.848-2.836-2.848h-4.1c-1.55 0-2.334.718-2.334 2.044 0 1.327.828 2.088 2.334 2.088h1.68v7.937c0 2.24 1.504 3.567 3.707 3.567ZM36.295 4.184c-4.472 0-7.897 3.327-7.897 7.829 0 4.501 3.447 7.807 7.897 7.807s7.852-3.328 7.874-7.807c0-4.502-3.425-7.829-7.874-7.829Zm0 10.83c-1.68 0-2.836-1.262-2.836-3.001 0-1.74 1.156-3.023 2.836-3.023s2.835 1.283 2.835 3.023c0 1.74-1.134 3-2.835 3Zm8.985-3.001c0-4.502 3.425-7.829 7.875-7.829s7.874 3.349 7.874 7.829c0 4.48-3.424 7.807-7.874 7.807-4.45 0-7.875-3.306-7.875-7.807Zm5.061 0c0 1.74 1.112 3 2.814 3 1.68 0 2.835-1.26 2.835-3S54.834 8.99 53.155 8.99c-1.68 0-2.814 1.283-2.814 3.023Z",fill:"#873EFF"})]});function d(e,t="",o){for(const r in e){const n=e[r],a=t?t+"["+r+"]":r;"string"==typeof n||"number"==typeof n?o.append(a,n):"object"==typeof n&&d(n,a,o)}return o}async function h(e,t,o){const r=d(t,"",new FormData),n=await fetch(e,{method:"POST",body:r,...o});return await n.json()}const p=(e,o)=>{"wcSettings"in window&&wcSettings.wcBlocksConfig&&"product"!==e?wp.data.dispatch("core/notices")?.createNotice("error",o,{context:`wc/${e}`}):fetch(t("ajaxUrl"),{method:"POST",body:new URLSearchParams({action:"woopay_express_checkout_button_show_error_notice",_ajax_nonce:t("woopayButtonNonce"),context:e,message:o})}).then((e=>e.json())).then((e=>{if(e.success){const t=document.querySelector(".woocommerce-notices-wrapper"),o=document.createElement("div");o.innerHTML=e.data.notice,t.insertBefore(o,null),t.scrollIntoView({behavior:"smooth",block:"center"})}}))},f=e=>"object"==typeof wcpayExpressCheckoutParams&&wcpayExpressCheckoutParams.hasOwnProperty(e)?wcpayExpressCheckoutParams[e]:null,m=(e,t,o="wcpay_")=>e.toString().replace("%%endpoint%%",o+t),b=e=>{const t=window.wcpayConfig.pay_for_order,o=window.wcpayConfig.order_id,r=window.wcpayConfig.key,n=window.wcpayConfig.billing_email;if(!t||!o||!r)return e;const a=new URL(e);return a.searchParams.append("pay_for_order",t),a.searchParams.append("order_id",o),a.searchParams.append("key",r),a.searchParams.append("billing_email",n),a.href},g=()=>{(()=>{const e=document.cookie.split(";").find((e=>e.includes("skip_woopay")));if(!e)return!1;const t=e?.split("=");return"skip_woopay"===t[0].trim()&&"1"===t[1].trim()})()&&(document.cookie="skip_woopay=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC;")},w=()=>!!t("isShortcodeCheckout"),y=(window.wp.domReady,(e,o={})=>{var r,n,a;if(!1===(null!==(r=t("isShopperTrackingEnabled"))&&void 0!==r?r:f("is_shopper_tracking_enabled")))return;const i=null!==(n=t("platformTrackerNonce"))&&void 0!==n?n:f("nonce")?.platform_tracker,s=null!==(a=t("ajaxUrl"))&&void 0!==a?a:f("ajax_url"),c=new FormData;c.append("tracksNonce",i),c.append("action","platform_tracks"),c.append("tracksEventName",e),c.append("tracksEventProp",JSON.stringify(o)),fetch(s,{method:"post",body:c}).then((e=>e.json()))}),_=async()=>{var e,o;let r=(()=>{const e=document.cookie.split(";");for(let t=0;t<e.length;t++){let o=e[t];for(;" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf("tk_ai="))return o.substring(6,o.length)}})();if(r){const e={_ut:"anon",_ui:r};return JSON.stringify(e)}const n=null!==(e=t("platformTrackerNonce"))&&void 0!==e?e:f("nonce")?.platform_tracker,a=null!==(o=t("ajaxUrl"))&&void 0!==o?o:f("ajax_url"),i=new FormData;i.append("tracksNonce",n),i.append("action","get_identity");try{const e=await fetch(a,{method:"post",body:i});if(!e.ok)return;const t=await e.json();return t.success&&t.data&&t.data._ui&&t.data._ut?JSON.stringify(t.data):void 0}catch(e){return}};function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}var k=/^\s+/,S=/\s+$/;function x(e,t){if(t=t||{},(e=e||"")instanceof x)return e;if(!(this instanceof x))return new x(e,t);var o=function(e){var t={r:0,g:0,b:0},o=1,r=null,n=null,a=null,i=!1,s=!1;return"string"==typeof e&&(e=function(e){e=e.replace(k,"").replace(S,"").toLowerCase();var t,o=!1;if($[e])e=$[e],o=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};return(t=ee.rgb.exec(e))?{r:t[1],g:t[2],b:t[3]}:(t=ee.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=ee.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=ee.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=ee.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=ee.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=ee.hex8.exec(e))?{r:Z(t[1]),g:Z(t[2]),b:Z(t[3]),a:G(t[4]),format:o?"name":"hex8"}:(t=ee.hex6.exec(e))?{r:Z(t[1]),g:Z(t[2]),b:Z(t[3]),format:o?"name":"hex"}:(t=ee.hex4.exec(e))?{r:Z(t[1]+""+t[1]),g:Z(t[2]+""+t[2]),b:Z(t[3]+""+t[3]),a:G(t[4]+""+t[4]),format:o?"name":"hex8"}:!!(t=ee.hex3.exec(e))&&{r:Z(t[1]+""+t[1]),g:Z(t[2]+""+t[2]),b:Z(t[3]+""+t[3]),format:o?"name":"hex"}}(e)),"object"==v(e)&&(te(e.r)&&te(e.g)&&te(e.b)?(t=function(e,t,o){return{r:255*O(e,255),g:255*O(t,255),b:255*O(o,255)}}(e.r,e.g,e.b),i=!0,s="%"===String(e.r).substr(-1)?"prgb":"rgb"):te(e.h)&&te(e.s)&&te(e.v)?(r=J(e.s),n=J(e.v),t=function(e,t,o){e=6*O(e,360),t=O(t,100),o=O(o,100);var r=Math.floor(e),n=e-r,a=o*(1-t),i=o*(1-n*t),s=o*(1-(1-n)*t),c=r%6;return{r:255*[o,i,a,a,s,o][c],g:255*[s,o,o,i,a,a][c],b:255*[a,a,s,o,o,i][c]}}(e.h,r,n),i=!0,s="hsv"):te(e.h)&&te(e.s)&&te(e.l)&&(r=J(e.s),a=J(e.l),t=function(e,t,o){var r,n,a;function i(e,t,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?e+6*(t-e)*o:o<.5?t:o<2/3?e+(t-e)*(2/3-o)*6:e}if(e=O(e,360),t=O(t,100),o=O(o,100),0===t)r=n=a=o;else{var s=o<.5?o*(1+t):o+t-o*t,c=2*o-s;r=i(c,s,e+1/3),n=i(c,s,e),a=i(c,s,e-1/3)}return{r:255*r,g:255*n,b:255*a}}(e.h,r,a),i=!0,s="hsl"),e.hasOwnProperty("a")&&(o=e.a)),o=z(o),{ok:i,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:o}}(e);this._originalInput=e,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||o.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}function C(e,t,o){e=O(e,255),t=O(t,255),o=O(o,255);var r,n,a=Math.max(e,t,o),i=Math.min(e,t,o),s=(a+i)/2;if(a==i)r=n=0;else{var c=a-i;switch(n=s>.5?c/(2-a-i):c/(a+i),a){case e:r=(t-o)/c+(t<o?6:0);break;case t:r=(o-e)/c+2;break;case o:r=(e-t)/c+4}r/=6}return{h:r,s:n,l:s}}function F(e,t,o){e=O(e,255),t=O(t,255),o=O(o,255);var r,n,a=Math.max(e,t,o),i=Math.min(e,t,o),s=a,c=a-i;if(n=0===a?0:c/a,a==i)r=0;else{switch(a){case e:r=(t-o)/c+(t<o?6:0);break;case t:r=(o-e)/c+2;break;case o:r=(e-t)/c+4}r/=6}return{h:r,s:n,v:s}}function T(e,t,o,r){var n=[V(Math.round(e).toString(16)),V(Math.round(t).toString(16)),V(Math.round(o).toString(16))];return r&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function P(e,t,o,r){return[V(K(r)),V(Math.round(e).toString(16)),V(Math.round(t).toString(16)),V(Math.round(o).toString(16))].join("")}function M(e,t){t=0===t?0:t||10;var o=x(e).toHsl();return o.s-=t/100,o.s=U(o.s),x(o)}function A(e,t){t=0===t?0:t||10;var o=x(e).toHsl();return o.s+=t/100,o.s=U(o.s),x(o)}function E(e){return x(e).desaturate(100)}function L(e,t){t=0===t?0:t||10;var o=x(e).toHsl();return o.l+=t/100,o.l=U(o.l),x(o)}function I(e,t){t=0===t?0:t||10;var o=x(e).toRgb();return o.r=Math.max(0,Math.min(255,o.r-Math.round(-t/100*255))),o.g=Math.max(0,Math.min(255,o.g-Math.round(-t/100*255))),o.b=Math.max(0,Math.min(255,o.b-Math.round(-t/100*255))),x(o)}function R(e,t){t=0===t?0:t||10;var o=x(e).toHsl();return o.l-=t/100,o.l=U(o.l),x(o)}function W(e,t){var o=x(e).toHsl(),r=(o.h+t)%360;return o.h=r<0?360+r:r,x(o)}function q(e){var t=x(e).toHsl();return t.h=(t.h+180)%360,x(t)}function D(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var o=x(e).toHsl(),r=[x(e)],n=360/t,a=1;a<t;a++)r.push(x({h:(o.h+a*n)%360,s:o.s,l:o.l}));return r}function j(e){var t=x(e).toHsl(),o=t.h;return[x(e),x({h:(o+72)%360,s:t.s,l:t.l}),x({h:(o+216)%360,s:t.s,l:t.l})]}function H(e,t,o){t=t||6,o=o||30;var r=x(e).toHsl(),n=360/o,a=[x(e)];for(r.h=(r.h-(n*t>>1)+720)%360;--t;)r.h=(r.h+n)%360,a.push(x(r));return a}function N(e,t){t=t||6;for(var o=x(e).toHsv(),r=o.h,n=o.s,a=o.v,i=[],s=1/t;t--;)i.push(x({h:r,s:n,v:a})),a=(a+s)%1;return i}x.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,o,r=this.toRgb();return e=r.r/255,t=r.g/255,o=r.b/255,.2126*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))},setAlpha:function(e){return this._a=z(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=F(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=F(this._r,this._g,this._b),t=Math.round(360*e.h),o=Math.round(100*e.s),r=Math.round(100*e.v);return 1==this._a?"hsv("+t+", "+o+"%, "+r+"%)":"hsva("+t+", "+o+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=C(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=C(this._r,this._g,this._b),t=Math.round(360*e.h),o=Math.round(100*e.s),r=Math.round(100*e.l);return 1==this._a?"hsl("+t+", "+o+"%, "+r+"%)":"hsla("+t+", "+o+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return T(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,o,r,n){var a=[V(Math.round(e).toString(16)),V(Math.round(t).toString(16)),V(Math.round(o).toString(16)),V(K(r))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*O(this._r,255))+"%",g:Math.round(100*O(this._g,255))+"%",b:Math.round(100*O(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*O(this._r,255))+"%, "+Math.round(100*O(this._g,255))+"%, "+Math.round(100*O(this._b,255))+"%)":"rgba("+Math.round(100*O(this._r,255))+"%, "+Math.round(100*O(this._g,255))+"%, "+Math.round(100*O(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(B[T(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+P(this._r,this._g,this._b,this._a),o=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var n=x(e);o="#"+P(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+o+")"},toString:function(e){var t=!!e;e=e||this._format;var o=!1,r=this._a<1&&this._a>=0;return t||!r||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(o=this.toRgbString()),"prgb"===e&&(o=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(o=this.toHexString()),"hex3"===e&&(o=this.toHexString(!0)),"hex4"===e&&(o=this.toHex8String(!0)),"hex8"===e&&(o=this.toHex8String()),"name"===e&&(o=this.toName()),"hsl"===e&&(o=this.toHslString()),"hsv"===e&&(o=this.toHsvString()),o||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return x(this.toString())},_applyModification:function(e,t){var o=e.apply(null,[this].concat([].slice.call(t)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(L,arguments)},brighten:function(){return this._applyModification(I,arguments)},darken:function(){return this._applyModification(R,arguments)},desaturate:function(){return this._applyModification(M,arguments)},saturate:function(){return this._applyModification(A,arguments)},greyscale:function(){return this._applyModification(E,arguments)},spin:function(){return this._applyModification(W,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(H,arguments)},complement:function(){return this._applyCombination(q,arguments)},monochromatic:function(){return this._applyCombination(N,arguments)},splitcomplement:function(){return this._applyCombination(j,arguments)},triad:function(){return this._applyCombination(D,[3])},tetrad:function(){return this._applyCombination(D,[4])}},x.fromRatio=function(e,t){if("object"==v(e)){var o={};for(var r in e)e.hasOwnProperty(r)&&(o[r]="a"===r?e[r]:J(e[r]));e=o}return x(e,t)},x.equals=function(e,t){return!(!e||!t)&&x(e).toRgbString()==x(t).toRgbString()},x.random=function(){return x.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},x.mix=function(e,t,o){o=0===o?0:o||50;var r=x(e).toRgb(),n=x(t).toRgb(),a=o/100;return x({r:(n.r-r.r)*a+r.r,g:(n.g-r.g)*a+r.g,b:(n.b-r.b)*a+r.b,a:(n.a-r.a)*a+r.a})},x.readability=function(e,t){var o=x(e),r=x(t);return(Math.max(o.getLuminance(),r.getLuminance())+.05)/(Math.min(o.getLuminance(),r.getLuminance())+.05)},x.isReadable=function(e,t,o){var r,n,a,i,s,c=x.readability(e,t);switch(n=!1,(a=o,"AA"!==(i=((a=a||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==i&&(i="AA"),"small"!==(s=(a.size||"small").toLowerCase())&&"large"!==s&&(s="small"),r={level:i,size:s}).level+r.size){case"AAsmall":case"AAAlarge":n=c>=4.5;break;case"AAlarge":n=c>=3;break;case"AAAsmall":n=c>=7}return n},x.mostReadable=function(e,t,o){var r,n,a,i,s=null,c=0;n=(o=o||{}).includeFallbackColors,a=o.level,i=o.size;for(var l=0;l<t.length;l++)(r=x.readability(e,t[l]))>c&&(c=r,s=x(t[l]));return x.isReadable(e,s,{level:a,size:i})||!n?s:(o.includeFallbackColors=!1,x.mostReadable(e,["#fff","#000"],o))};var $=x.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},B=x.hexNames=function(e){var t={};for(var o in e)e.hasOwnProperty(o)&&(t[e[o]]=o);return t}($);function z(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function O(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var o=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=Math.min(t,Math.max(0,parseFloat(e))),o&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function U(e){return Math.min(1,Math.max(0,e))}function Z(e){return parseInt(e,16)}function V(e){return 1==e.length?"0"+e:""+e}function J(e){return e<=1&&(e=100*e+"%"),e}function K(e){return Math.round(255*parseFloat(e)).toString(16)}function G(e){return Z(e)/255}var Q,X,Y,ee=(X="[\\s|\\(]+("+(Q="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")\\s*\\)?",Y="[\\s|\\(]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")[,|\\s]+("+Q+")\\s*\\)?",{CSS_UNIT:new RegExp(Q),rgb:new RegExp("rgb"+X),rgba:new RegExp("rgba"+Y),hsl:new RegExp("hsl"+X),hsla:new RegExp("hsla"+Y),hsv:new RegExp("hsv"+X),hsva:new RegExp("hsva"+Y),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function te(e){return!!ee.CSS_UNIT.exec(e)}const oe=["color","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"],re=["fontFamily","fontSize","lineHeight","letterSpacing","fontWeight","fontVariation","textDecoration","textShadow","textTransform","-webkit-font-smoothing","-moz-osx-font-smoothing","transition"],ne=["backgroundColor","border","borderTop","borderRight","borderBottom","borderLeft","borderRadius","borderWidth","borderColor","borderStyle","borderTopWidth","borderTopColor","borderTopStyle","borderRightWidth","borderRightColor","borderRightStyle","borderBottomWidth","borderBottomColor","borderBottomStyle","borderLeftWidth","borderLeftColor","borderLeftStyle","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","outline","outlineOffset","boxShadow"],ae={".Label":[...oe,...re],".Text":[...oe,...re],".Input":[...oe,...re,...ne],".Error":[...oe,...re,...ne],".Tab":[...oe,...re,...ne],".TabIcon":[...oe],".TabLabel":[...oe,...re],".Block":[...oe.slice(1),...ne.slice(1)],".Container":[...ne],".Header":[...oe,...ne,...re],".Footer":[...oe,...ne,...re]},ie={".Label":ae[".Label"],".Label--floating":[...ae[".Label"],"transform"],".Input":[...ae[".Input"],"outlineColor","outlineWidth","outlineStyle"],".Error":ae[".Error"],".Tab":["backgroundColor","color","fontFamily"],".Tab--selected":["outlineColor","outlineWidth","outlineStyle","backgroundColor","color",...ne],".TabIcon":ae[".TabIcon"],".TabIcon--selected":["color"],".TabLabel":ae[".TabLabel"],".Block":ae[".Block"],".Container":ae[".Container"],".Header":ae[".Header"],".Footer":ae[".Footer"],".Footer--link":ae[".Text"],".Text":ae[".Text"],".Text--redirect":ae[".Text"]},se=(e,t=document)=>{let o=null,r=0;for(;!o&&r<e.length;){let n;try{n=t.querySelector(e[r])}catch(e){r++;continue}if(!n){r++;continue}const a=(t.defaultView||window).getComputedStyle(n).backgroundColor;a&&x(a).getAlpha()>=.5&&(o=a),r++}return o||"#ffffff"},ce=e=>{const t=x(e),o=t.getAlpha();if(o<1){const e=t.toRgb();return x({r:Math.round(e.r*o+255*(1-o)),g:Math.round(e.g*o+255*(1-o)),b:Math.round(e.b*o+255*(1-o))}).getBrightness()>125}return t.getBrightness()>125},le={default:{hiddenContainer:"#wcpay-hidden-div",hiddenInput:"#wcpay-hidden-input",hiddenInvalidInput:"#wcpay-hidden-invalid-input",hiddenValidActiveLabel:"#wcpay-hidden-valid-active-label"},classicCheckout:{appendTarget:".woocommerce-billing-fields__field-wrapper",upeThemeInputSelector:"#billing_first_name",upeThemeLabelSelector:".woocommerce-checkout .form-row label",upeThemeTextSelectors:["#payment .payment_methods li .payment_box fieldset",".woocommerce-checkout .form-row"],rowElement:"p",validClasses:["form-row"],invalidClasses:["form-row","woocommerce-invalid","woocommerce-invalid-required-field"],alternateSelectors:{appendTarget:"form.checkout",upeThemeInputSelector:'form.checkout input[type="text"]',upeThemeLabelSelector:"form.checkout label",upeThemeTextSelectors:["form.checkout",".woocommerce"]},backgroundSelectors:["li.wc_payment_method .wc-payment-form","li.wc_payment_method .payment_box","#payment","#order_review","form.checkout","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:["#place_order"],pmmeRelativeTextSizeSelector:".wc_payment_method > label"},blocksCheckout:{appendTarget:".wc-block-checkout__contact-fields",upeThemeInputSelector:".wc-block-components-text-input #email",upeThemeLabelSelector:".wc-block-components-text-input label",upeThemeTextSelectors:[".wc-block-components-checkout-step__description",".wc-block-components-text-input",".wc-block-components-radio-control__label",".wc-block-checkout__terms"],rowElement:"div",validClasses:["wc-block-components-text-input","is-active"],invalidClasses:["wc-block-components-text-input","has-error"],alternateSelectors:{appendTarget:"#billing.wc-block-components-address-form",upeThemeInputSelector:"#billing-first_name",upeThemeLabelSelector:".wc-block-components-checkout-step__description"},backgroundSelectors:["#payment-method .wc-block-components-radio-control-accordion-option","#payment-method","form.wc-block-checkout__form",".wc-block-checkout","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:[".wc-block-components-checkout-place-order-button"],containerSelectors:[".wp-block-woocommerce-checkout-order-summary-block"],pmmeRelativeTextSizeSelector:".wc-block-components-radio-control__label-group"},bnplProductPage:{appendTarget:".product .cart .quantity",upeThemeInputSelector:".product .cart .quantity .qty",upeThemeLabelSelector:".product .cart .quantity label",upeThemeTextSelectors:[".product .cart .quantity"],rowElement:"div",validClasses:["input-text"],invalidClasses:["input-text","has-error"],backgroundSelectors:["#payment-method-message","#main > .product > div.summary.entry-summary","#main > .product","#main","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:[".single_add_to_cart_button"]},bnplClassicCart:{appendTarget:".cart .quantity",upeThemeInputSelector:".cart .quantity .qty",upeThemeLabelSelector:".cart .quantity label",upeThemeTextSelectors:[".cart .quantity"],rowElement:"div",validClasses:["input-text"],invalidClasses:["input-text","has-error"],backgroundSelectors:["#payment-method-message","#main .entry-content .cart_totals","#main .entry-content","#main","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:[".checkout-button"],containerSelectors:[".shop_table"]},bnplCartBlock:{appendTarget:".wc-block-cart .wc-block-components-quantity-selector",upeThemeInputSelector:".wc-block-cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__input",upeThemeLabelSelector:".wc-block-components-text-input",upeThemeTextSelectors:[".wc-block-components-text-input"],rowElement:"div",validClasses:["wc-block-components-text-input"],invalidClasses:["wc-block-components-text-input","has-error"],backgroundSelectors:[".wc-block-components-bnpl-wrapper",".wc-block-components-order-meta",".wc-block-components-totals-wrapper",".wp-block-woocommerce-cart-order-summary-block",".wp-block-woocommerce-cart-totals-block",".wp-block-woocommerce-cart .wc-block-cart",".wp-block-woocommerce-cart","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:[".wc-block-cart__submit-button"],containerSelectors:[".wp-block-woocommerce-cart-line-items-block"]},wooPayClassicCheckout:{appendTarget:".woocommerce-billing-fields__field-wrapper",upeThemeInputSelector:"#billing_first_name",upeThemeLabelSelector:".woocommerce-checkout .form-row label",upeThemeTextSelectors:[".woocommerce-checkout .form-row"],rowElement:"p",validClasses:["form-row"],invalidClasses:["form-row","woocommerce-invalid","woocommerce-invalid-required-field"],alternateSelectors:{appendTarget:"form.checkout",upeThemeInputSelector:'form.checkout input[type="text"]',upeThemeLabelSelector:"form.checkout label",upeThemeTextSelectors:["form.checkout",".woocommerce"]},backgroundSelectors:["#customer_details","#order_review","form.checkout","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:["#place_order"],linkSelectors:["form.checkout a",".woocommerce a","main a",".entry-content a",".site-content a","#content a","#primary a","a"],containerSelectors:[".woocommerce-checkout-review-order-table"],headerSelectors:["header > div:has(nav)","header > div:has(.site-logo)","header > div:has(.custom-logo)",".site-header","#masthead","header > div:last-of-type","header"],footerSelectors:[".site-footer","#colophon","footer > div","footer"],footerLink:[".site-footer a","footer a"]},wooPayBlocksCheckout:{appendTarget:".wc-block-checkout__contact-fields",upeThemeInputSelector:".wc-block-components-text-input #email",upeThemeLabelSelector:".wc-block-components-text-input label",upeThemeTextSelectors:[".wc-block-components-checkout-step__description",".wc-block-components-text-input",".wc-block-components-radio-control__label",".wc-block-checkout__terms"],rowElement:"div",validClasses:["wc-block-components-text-input","is-active"],invalidClasses:["wc-block-components-text-input","has-error"],alternateSelectors:{appendTarget:"#billing.wc-block-components-address-form",upeThemeInputSelector:"#billing-first_name",upeThemeLabelSelector:".wc-block-components-checkout-step__description"},backgroundSelectors:["#payment-method .wc-block-components-radio-control-accordion-option","#payment-method","form.wc-block-checkout__form",".wc-block-checkout","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:[".wc-block-components-checkout-place-order-button"],linkSelectors:[".wc-block-checkout a",".wc-block-components-main a","main a",".entry-content a",".site-content a","#content a","#primary a","a"],containerSelectors:[".wp-block-woocommerce-checkout-order-summary-block"],headerSelectors:["header > div:has(nav)","header > div:has(.site-logo)","header > div:has(.custom-logo)",".site-header","#masthead","header > div:last-of-type","header"],footerSelectors:[".site-footer","#colophon","footer > div","footer"],footerLink:[".site-footer a","footer a"]},updateSelectors:function(e,t){return e.hasOwnProperty("alternateSelectors")&&(Object.entries(e.alternateSelectors).forEach((o=>{const[r,n]=o,a=e[r];if(Array.isArray(a))a.some((e=>{try{return t.querySelector(e)}catch(e){return!1}}))||(e[r]=n);else try{t.querySelector(e[r])||(e[r]=n)}catch(t){e[r]=n}})),delete e.alternateSelectors),e},getSelectors:function(e,t){let o=this.blocksCheckout;switch(e){case"blocks_checkout":o=this.blocksCheckout;break;case"shortcode_checkout":o=this.classicCheckout;break;case"bnpl_product_page":o=this.bnplProductPage;break;case"bnpl_classic_cart":o=this.bnplClassicCart;break;case"bnpl_cart_block":o=this.bnplCartBlock;break;case"woopay_shortcode_checkout":o=this.wooPayClassicCheckout;break;case"woopay_blocks_checkout":o=this.wooPayBlocksCheckout}return{...this.default,...this.updateSelectors(o,t)}}},ue={getHiddenContainer:function(e,t){const o=t.createElement("div");return o.setAttribute("id",this.getIDFromSelector(e)),o.style.border=0,o.style.clip="rect(0 0 0 0)",o.style.height="1px",o.style.margin="-1px",o.style.overflow="hidden",o.style.padding="0",o.style.position="absolute",o.style.width="1px",o},createRow:function(e,t=[],o){const r=o.createElement(e);return t.length&&r.classList.add(...t),r},appendClone:function(e,t,o,r){const n=r.querySelector(t);if(n){const t=n.cloneNode(!0);t.id=this.getIDFromSelector(o),t.value="",e.appendChild(t)}},getIDFromSelector:function(e){return e.startsWith("#")||e.startsWith(".")?e.slice(1):e},init:function(e,t){const o=le.getSelectors(e),r=t.querySelector(o.appendTarget),n=t.querySelector(o.upeThemeInputSelector);if(!r||!n)return;t.querySelector(o.hiddenContainer)&&this.cleanup(t);const a=this.getHiddenContainer(o.hiddenContainer,t);r.appendChild(a);const i=this.createRow(o.rowElement,o.validClasses,t);a.appendChild(i);const s=this.createRow(o.rowElement,o.invalidClasses,t);a.appendChild(s),this.appendClone(i,o.upeThemeInputSelector,o.hiddenInput,t),this.appendClone(i,o.upeThemeLabelSelector,o.hiddenValidActiveLabel,t),this.appendClone(s,o.upeThemeInputSelector,o.hiddenInvalidInput,t),this.appendClone(s,o.upeThemeLabelSelector,o.hiddenInvalidInput,t),t.querySelector(o.hiddenInput).style.transition="none"},cleanup:function(e){const t=e.querySelector(le.default.hiddenContainer);t&&t.remove()}},de=(e,t,o=null,r)=>{const n=(Array.isArray(e)?e:[e]).map((e=>{try{return r.querySelector(e)}catch(e){return null}})).filter(Boolean);if(!n.length)return{};const a=r.defaultView||window,i=ie[t],s=n[0],c=a.getComputedStyle(s),l={};if(i.forEach((e=>{const t=e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`)),o=c.getPropertyValue(t);if(o)if("color"!==e)if("lineHeight"!==e||"0"!==o&&"0px"!==o)l[e]=o;else for(let t=1;t<n.length;t++){const o=a.getComputedStyle(n[t]).getPropertyValue("line-height");if("0"!==o&&"0px"!==o){l[e]=o;break}}else l[e]=(e=>{const t=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0?(\.\d+)?|1?(\.0+)?)\s*\)$/);if(t){const o=t[4]||1;e=`rgb(${t.slice(1,4).map((e=>Math.round(e*o+255*(1-o)))).join(", ")})`}return e})(o)})),".Input"===t||".Tab--selected"===t){const e=((e,t="solid",o)=>e&&o?[e,t,o].join(" "):"")(l.outlineWidth,l.outlineStyle,l.outlineColor);""!==e&&(l.outline=e),delete l.outlineWidth,delete l.outlineColor,delete l.outlineStyle}const u=c.getPropertyValue("text-indent");return"0px"!==u&&"0px"===l.paddingLeft&&"0px"===l.paddingRight&&(l.paddingLeft=u,l.paddingRight=u),".Block"===t&&(l.backgroundColor=o),l},he=(e=document)=>{const t=[],o=e.styleSheets,r=["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","fonts.bunny.net","fonts.wp.com"];for(let e=0;e<o.length;e++){if(!o[e].href)continue;const n=new URL(o[e].href);-1!==r.indexOf(n.hostname)&&t.push({cssSrc:o[e].href})}return t},pe={blocks_checkout:"woopay_blocks_checkout",shortcode_checkout:"woopay_shortcode_checkout"},fe=(e,t=!1,o=document)=>{var r;const n=t&&null!==(r=pe[e])&&void 0!==r?r:e,a=le.getSelectors(n,o);ue.init(n,o);const i=de(a.hiddenInput,".Input",null,o),s=de(a.hiddenInvalidInput,".Input",null,o),c=de(a.upeThemeLabelSelector,".Label",null,o),l={fontSize:c.fontSize},u=de(a.upeThemeTextSelectors,".Text",null,o),d=de(a.upeThemeInputSelector,".Tab",null,o),h=de(a.hiddenInput,".Tab--selected",null,o),p=(e=>{const t=Object.assign({},e);if(!e.backgroundColor||!e.color)return e;const o=((e,t)=>{const o={backgroundColor:e,color:t},r=x(e),n=x(t);if(!r.isValid()||!n.isValid())return{backgroundColor:"",color:""};const a=r.getBrightness()>50?x(r).darken(7):x(r).lighten(7),i=x.mostReadable(a,[n],{includeFallbackColors:!0});return o.backgroundColor=a.toRgbString(),o.color=i.toRgbString(),o})(e.backgroundColor,e.color);return t.backgroundColor=o.backgroundColor,t.color=o.color,t})(d),f={color:p.color},m={color:h.color},b=se(a.backgroundSelectors,o),g=de(a.upeThemeLabelSelector,".Block",b,o),w={colorBackground:b,colorText:u.color,fontFamily:u.fontFamily,fontSizeBase:u.fontSize};a.pmmeRelativeTextSizeSelector&&w.fontSizeBase&&(w.fontSizeBase=function(e,t,o=.875,r){const n=parseFloat(t);if(isNaN(n))return t;const a=r.querySelector(e);if(!a)return n*o+"px";const i=window.getComputedStyle(a).getPropertyValue("font-size"),s=parseFloat(i)*o;return isNaN(s)?t:n>s?`${s}px`:`${n}px`}(a.pmmeRelativeTextSizeSelector,u.fontSize,.875,o));const y="blocks_checkout"===e||"woopay_blocks_checkout"===n;let _={variables:w,theme:ce(b)?"stripe":"night",labels:y?"floating":"above",rules:JSON.parse(JSON.stringify({".Input":i,".Input--invalid":s,".Label":c,".Label--resting":l,".Block":g,".Tab":d,".Tab:hover":p,".Tab--selected":h,".TabIcon:hover":f,".TabIcon--selected":m,".Text":u,".Text--redirect":u}))};if(y&&(_=((e,t)=>{if(e.rules[".Label--floating"]=t,e.rules[".Label--floating"].transform&&"none"!==e.rules[".Label--floating"].transform){const t=e.rules[".Label--floating"].transform.match(/matrix\((.+)\)/);if(t&&t[1]){const o=t[1].split(", "),r=(parseFloat(o[0])+parseFloat(o[3]))/2,n=parseFloat(e.rules[".Label--floating"].lineHeight),a=Math.floor(n*r);e.rules[".Label--floating"].lineHeight=`${a}px`,e.rules[".Label--floating"].fontSize=`${a}px`}delete e.rules[".Label--floating"].transform}if(e.rules[".Input"].paddingTop&&(e.rules[".Input"].paddingTop=`calc(${e.rules[".Input"].paddingTop} - ${e.rules[".Label--floating"].lineHeight} - 4px - 1px)`),e.rules[".Input"].paddingBottom){var o;const t=parseFloat(e.rules[".Input"].paddingBottom);e.rules[".Input"].paddingBottom=t-1+"px";const r=null!==(o=e.rules[".Label"].marginTop)&&void 0!==o?o:"0";e.rules[".Label"].marginTop=`${Math.floor((t-1)/3)}px`,e.rules[".Label--floating"].marginTop=r}return e})(_,de(a.hiddenValidActiveLabel,".Label--floating",null,o))),t){const e=de(a.headerSelectors,".Header",null,o),t=de(a.footerSelectors,".Footer",null,o);var v,k;(!e.backgroundColor||x(e.backgroundColor).getAlpha()<.5)&&(e.backgroundColor=se([...null!==(v=a.headerSelectors)&&void 0!==v?v:[],"body"],o)),(!t.backgroundColor||x(t.backgroundColor).getAlpha()<.5)&&(t.backgroundColor=se([...null!==(k=a.footerSelectors)&&void 0!==k?k:[],"body"],o)),_.rules={..._.rules,".Heading":de(a.headingSelectors,".Label",null,o),".Header":e,".Footer":t,".Footer-link":de(a.footerLink,".Footer--link",null,o),".Button":de(a.buttonSelectors,".Input",null,o),".Link":de(a.linkSelectors,".Label",null,o),".Container":de(a.containerSelectors,".Container",null,o)}}return ue.cleanup(o),_},me=()=>document.querySelector(".wp-block-woocommerce-checkout")?"blocks_checkout":document.querySelector(".woocommerce-billing-fields")?"woopay_shortcode_checkout":document.querySelector(".wp-block-woocommerce-cart")?"bnpl_cart_block":document.querySelector(".woocommerce-cart-form")?"bnpl_classic_cart":document.querySelector(".single-product")?"bnpl_product_page":void 0,be=(e,t,o="appearance")=>{Object.entries(t).forEach((([t,r])=>{const n=`${o}[${t}]`;null!=r&&(r&&"object"==typeof r&&!Array.isArray(r)?be(e,r,n):e.append(n,r))}))};let ge=!1;function we(){const e=me();if(!(e=>["woopay_shortcode_checkout","woopay_blocks_checkout","blocks_checkout","bnpl_product_page","bnpl_classic_cart","bnpl_cart_block"].includes(e))(e)||!t("isWooPayGlobalThemeSupportEnabled"))return null;const o=t("woopayAppearance");if(o)return o;if(w()){const o=fe(e,!0);return(e=>{if(ge||!e)return;ge=!0;const o=t("wcAjaxUrl");if(!o)return;const r=m(o,"shopper_set_woopay_appearance"),n=he(),a=new FormData;a.append("_ajax_nonce",t("woopaySessionNonce")),be(a,e),a.append("font_rules",JSON.stringify(n)),fetch(r,{method:"POST",body:a,credentials:"same-origin"}).catch((()=>{}))})(o),o}return null}const ye=async(e,o,r)=>{const a=await _();let i="";const s=document.body,c=document.createElement("div");c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.classList.add("woopay-otp-iframe-wrapper");const l=document.createElement("iframe");l.title=(0,n.__)("WooPay SMS code verification","woocommerce-payments"),l.classList.add("woopay-otp-iframe"),l.classList.add("intrinsic-ignore");const u=768;let d=!0;const f=()=>{(u<=window.innerWidth&&d||u>window.innerWidth&&!d)&&(d=!d,l.contentWindow.postMessage({action:"setHeader",value:d},t("woopayHost"))),document.body.style.overflow="hidden"},g=()=>{if(!l)return;if(u>window.innerWidth)return l.style.left="0",l.style.right="",void(l.style.top="0");const e=l.getBoundingClientRect();l.style.top=Math.floor(window.innerHeight/2-e.height/2)+"px",l.style.left=Math.floor(window.innerWidth/2-e.width/2)+"px"};l.addEventListener("load",(()=>{d=!0;const e=we();t("isWoopayFirstPartyAuthEnabled")&&h(m(t("wcAjaxUrl"),"get_woopay_session"),{_ajax_nonce:t("woopaySessionNonce"),order_id:t("order_id"),key:t("key"),billing_email:t("billing_email"),appearance:e}).then((e=>{e?.data?.session&&l.contentWindow.postMessage({action:"setSessionData",value:e},t("woopayHost"))})),f(),window.addEventListener("resize",f),g(),window.addEventListener("resize",g),l.classList.add("open")})),c.insertBefore(l,null);const w=()=>{window.removeEventListener("resize",f),window.removeEventListener("resize",g),window.removeEventListener("pageshow",v),window.removeEventListener("message",y),document.removeEventListener("keyup",k),c.remove(),l.classList.remove("open"),document.body.style.overflow=""};function y(r){if(t("woopayHost").startsWith(r.origin))switch(r.data.action){case"otp_email_submitted":i=r.data.userEmail;break;case"redirect_to_woopay_skip_session_init":r.data.redirectUrl&&(window.location=b(r.data.redirectUrl));break;case"redirect_to_platform_checkout":case"redirect_to_woopay":e.initWooPay(i||r.data.userEmail,r.data.platformCheckoutUserSession).then((e=>{if(document.querySelector(".woopay-otp-iframe"))if("success"===e.result)window.location=b(e.url);else{const e=(0,n.__)("WooPay is unavailable at this time. Sorry for the inconvenience.","woocommerce-payments");p(o,e),w()}}));break;case"otp_validation_failed":break;case"close_modal":w();break;case"iframe_height":r.data.height>300&&(u<=window.innerWidth?(l.style.height=r.data.height+"px",l.style.top=Math.floor(window.innerHeight/2-r.data.height/2)+"px"):(l.style.height="",l.style.top=""))}}function v(e){e.persisted&&w()}function k(e){"Escape"===e.key&&w()&&e.stopPropagation()}c.addEventListener("click",w),((e="")=>{if(document.querySelector(".woopay-otp-iframe"))return;window.addEventListener("pageshow",v),window.addEventListener("message",y),document.addEventListener("keyup",k);const r=window.document.documentElement.clientWidth,n=window.document.documentElement.clientHeight,d=new URLSearchParams;var h;d.append("testMode",t("testMode")),d.append("needsHeader",u>window.innerWidth),d.append("wcpayVersion",t("wcpayVersionNumber")),e&&(h=e,new RegExp(/^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[0-9a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,}\.?$/i).test(h))&&(i=e,d.append("email",e)),d.append("is_blocks",!!window.wcSettings?.wcBlocksConfig),d.append("is_express","true"),d.append("express_context",o),d.append("source_url",window.location.href),d.append("viewport",`${r}x${n}`),a&&d.append("tracksUserIdentity",a),l.src=`${t("woopayHost")}/otp/?${d.toString()}`,s.insertBefore(c,null),g(),l.focus()})(await(async e=>{if("true"===window.wcpayConfig?.pay_for_order)return window.wcpayCustomerData?.email;const t=await(o=e,o?new Promise((e=>{if(document.querySelector(o))return e(document.querySelector(o));const t=document.querySelector('[data-block-name="woocommerce/checkout"]');if(!t)return e(null);new MutationObserver(((t,r)=>{document.querySelector(o)&&(e(document.querySelector(o)),r.disconnect())})).observe(t,{childList:!0,subtree:!0})})):null);var o;return t?.value})(r)||t("woopaySessionEmail"))},_e=()=>{const e=document.querySelector(".quantity .qty");return e&&parseInt(e.value,10)||1},ve=e=>e.length<=254&&/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/.test(e),ke=()=>document.querySelector("form.cart")||document.querySelector("form.wp-block-add-to-cart-with-options");function Se(e){return e.startsWith("{{/")?{type:"componentClose",value:e.replace(/\W/g,"")}:e.endsWith("/}}")?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.startsWith("{{")?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}function xe(e,t){let o,r,n=[];for(let a=0;a<e.length;a++){const i=e[a];if("string"!==i.type){if(void 0===t[i.value])throw new Error(`Invalid interpolation, missing component node: \`${i.value}\``);if("object"!=typeof t[i.value])throw new Error(`Invalid interpolation, component node must be a ReactElement or null: \`${i.value}\``);if("componentClose"===i.type)throw new Error(`Missing opening component token: \`${i.value}\``);if("componentOpen"===i.type){o=t[i.value],r=a;break}n.push(t[i.value])}else n.push(i.value)}if(o){const i=function(e,t){const o=t[e];let r=0;for(let n=e+1;n<t.length;n++){const e=t[n];if(e.value===o.value){if("componentOpen"===e.type){r++;continue}if("componentClose"===e.type){if(0===r)return n;r--}}}throw new Error("Missing closing component token `"+o.value+"`")}(r,e),s=xe(e.slice(r+1,i),t),c=(0,a.cloneElement)(o,{},s);if(n.push(c),i<e.length-1){const o=xe(e.slice(i+1),t);n=n.concat(o)}}return n=n.filter(Boolean),0===n.length?null:1===n.length?n[0]:(0,a.createElement)(a.Fragment,null,...n)}function Ce(e){const{mixedString:t,components:o,throwErrors:r}=e;if(!o)return t;if("object"!=typeof o){if(r)throw new Error(`Interpolation Error: unable to process \`${t}\` because components is not an object`);return t}const n=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(Se)}(t);try{return xe(n,o)}catch(e){if(r)throw new Error(`Interpolation Error: unable to process \`${t}\` because of error \`${e.message}\``);return t}}function Fe(e){window.WooPayConnect||(window.WooPayConnect={}),window.WooPayConnect.iframeInjectedState=e}function Te(){return window?.WooPayConnect?.postMessageTimeout||5e3}const Pe=()=>{const e=(0,a.useRef)(),[o,r]=(0,a.useState)("");return(0,a.useEffect)((()=>{(async()=>{const e=t("testMode"),o=t("woopayHost"),n=t("woopayMerchantId"),a=new URLSearchParams({testMode:e,source_url:window.location.href,blogId:n}),i=await _();i&&a.append("tracksUserIdentity",i),r(`${o}/connect/?${a.toString()}`)})()}),[]),(0,a.useEffect)((()=>{if(!e.current)return;const o=e.current;o.addEventListener("load",(()=>{Fe(2),window.dispatchEvent(new MessageEvent("message",{source:window,origin:t("woopayHost"),data:{action:"get_iframe_post_message_success",value:e=>o.contentWindow.postMessage(e,t("woopayHost"))}}))}))}),[o]),(0,c.jsx)("iframe",{ref:e,id:"woopay-connect-iframe",src:o,style:{height:0,width:0,border:"none",margin:0,padding:0,overflow:"hidden",display:"block",visibility:"hidden",position:"fixed",pointerEvents:"none",userSelect:"none"},title:(0,n.__)("WooPay Connect Direct Checkout","woocommerce-payments")})},Me=class{iframePostMessage=null;listeners={};constructor(){this.listeners={getIframePostMessageCallback:()=>{},getPostMessageTimeoutCallback:()=>{}},this.removeMessageListener=this.attachMessageListener(),this.injectWooPayConnectIframe()}attachMessageListener(){const e=e=>{t("woopayHost").startsWith(e.origin)&&this.callbackFn(e.data)};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}}detachMessageListener(){"function"==typeof this.removeMessageListener&&this.removeMessageListener()}injectWooPayConnectIframe(){const o=window?.WooPayConnect?.iframeInjectedState||0;if(2===o){const e=document.querySelector("#woopay-connect-iframe");return void(e&&(this.iframePostMessage=Promise.resolve((o=>{e.contentWindow.postMessage(o,t("woopayHost"))}))))}if(1===o)return void(this.iframePostMessage=new Promise((e=>{this.listeners.getIframePostMessageCallback=e})));Fe(1);const r=document.createElement("div");r.style.visibility="hidden",r.style.position="fixed",r.style.height="0",r.style.width="0",r.style.bottom="0",r.style.right="0",r.id="woopay-connect-iframe-container",document.body.appendChild(r);const n=this;this.iframePostMessage=new Promise((e=>{n.listeners.getIframePostMessageCallback=e})),(0,e.H)(r).render((0,c.jsx)(Pe,{}))}injectTemporaryWooPayConnectIframe(){let e;const o=new Promise((t=>{e=t})),r=document.createElement("iframe");return r.id="temp-woopay-connect-iframe",r.src=t("woopayHost")+"/connect/",r.height=0,r.width=0,r.border="none",r.margin=0,r.padding=0,r.overflow="hidden",r.display="block",r.visibility="hidden",r.position="fixed",r.pointerEvents="none",r.userSelect="none",r.addEventListener("load",(()=>{e((e=>r.contentWindow.postMessage(e,t("woopayHost"))))})),document.body.appendChild(r),{resolvePostMessagePromise:o,removeTemporaryIframe:()=>{document.body.removeChild(r)}}}async sendMessageAndListenWith(e,t){const o=new Promise(((e,o)=>{let r=!1;const n=setTimeout((()=>{r=!0,o(new Error("WooPayConnectIframe did not respond within the allotted time."))}),Te());this.listeners[t]=t=>{r||(n&&clearTimeout(n),e(t))}}));if("function"!=typeof this.iframePostMessage?.then)throw new Error("iframePostMessage is not set");return(await this.iframePostMessage)(e),await o}async getPostMessageTimeout(){try{return await this.sendMessageAndListenWith({action:"getPostMessageTimeout"},"getPostMessageTimeoutCallback")}catch(e){return null}}callbackFn(e){switch(e.action){case"get_iframe_post_message_success":this.listeners.getIframePostMessageCallback(e.value);break;case"get_post_message_timeout_success":this.listeners.getPostMessageTimeoutCallback(e.value)}}},Ae=class extends Me{constructor(){super(),this.listeners={...this.listeners,setRedirectSessionDataCallback:()=>{},setTempThirdPartyCookieCallback:()=>{},getIsWooPayReachableCallback:()=>{},getIsThirdPartyCookiesEnabledCallback:()=>{},setPreemptiveSessionDataCallback:()=>{}}}async isWooPayThirdPartyCookiesEnabled(){const{resolvePostMessagePromise:e,removeTemporaryIframe:t}=this.injectTemporaryWooPayConnectIframe(),o=new Promise(((e,t)=>{let o=!1;const r=setTimeout((()=>{o=!0,t(new Error("WooPayConnectIframe did not respond within the allotted time."))}),Te());this.listeners.setTempThirdPartyCookieCallback=t=>{o||(r&&clearTimeout(r),e(t))}}));if("function"!=typeof e?.then)return!1;const r=await e;r({action:"setTempThirdPartyCookie"});try{if(!await o)return t(),!1}catch(e){return t(),!1}const n=new Promise(((e,t)=>{let o=!1;const r=setTimeout((()=>{o=!0,t(new Error("WooPayConnectIframe did not respond within the allotted time."))}),Te());this.listeners.getIsThirdPartyCookiesEnabledCallback=t=>{o||(r&&clearTimeout(r),e(t))}}));r({action:"getIsThirdPartyCookiesEnabled"});try{return await n}catch(e){return!1}finally{t()}}async sendRedirectSessionDataToWooPay(e){try{return await super.sendMessageAndListenWith({action:"setRedirectSessionData",value:e},"setRedirectSessionDataCallback")}catch(e){return null}}async setPreemptiveSessionData(e){try{return await super.sendMessageAndListenWith({action:"setPreemptiveSessionData",value:e},"setPreemptiveSessionDataCallback")}catch(e){return null}}async isWooPayReachable(){try{return await this.sendMessageAndListenWith({action:"isWooPayReachable"},"getIsWooPayReachableCallback")}catch(e){return!1}}callbackFn(e){switch(super.callbackFn(e),e.action){case"set_redirect_session_data_success":this.listeners.setRedirectSessionDataCallback(e.value);break;case"set_redirect_session_data_error":this.listeners.setRedirectSessionDataCallback({is_error:!0});break;case"set_temp_third_party_cookie_success":this.listeners.setTempThirdPartyCookieCallback(e.value);break;case"get_is_third_party_cookies_enabled_success":this.listeners.getIsThirdPartyCookiesEnabledCallback(e.value);break;case"get_is_woopay_reachable_success":this.listeners.getIsWooPayReachableCallback(e.value);break;case"set_preemptive_session_data_success":this.listeners.setPreemptiveSessionDataCallback(e.value);break;case"set_preemptive_session_data_error":this.listeners.setPreemptiveSessionDataCallback({is_error:!0})}}},Ee=class{static sessionConnect;static init(){this.getSessionConnect()}static getSessionConnect(){return this.sessionConnect||(this.sessionConnect=new Ae),this.sessionConnect}static async sendPreemptiveSessionDataToWooPay(e){return this.getSessionConnect().setPreemptiveSessionData(e)}static async getWooPaySessionFromMerchant(e){return h(m(t("wcAjaxUrl"),"get_woopay_session"),e)}},Le={default:(0,n.__)("WooPay","woocommerce-payments"),buy:(0,n.__)("Buy with WooPay","woocommerce-payments"),donate:(0,n.__)("Donate with WooPay","woocommerce-payments"),book:(0,n.__)("Book with WooPay","woocommerce-payments")},Ie=({listenForCartChanges:e,isPreview:o=!1,buttonSettings:r,api:i,isProductPage:d=!1,emailSelector:h="#email",buttonAttributes:f})=>{var m;const w="narrow",_="wide",v=(0,a.useRef)(null),k=(0,a.useRef)(null),S=(0,a.useRef)(!1);let{height:x,type:C,theme:F,context:T,radius:P}=r;const[M,A]=(0,a.useState)(!1),[E,L]=(0,a.useState)(_),I=new Map;var R;I.set("40","small"),I.set("48","medium"),I.set("55","large"),void 0!==f&&(x=f.height||x,P=null!==(R=f.borderRadius)&&void 0!==R?R:P);const W=I.get(x?.toString())||"medium",q=null!==(m=Le[C||"default"])&&void 0!==m?m:Le.default,D="dark"===F?l:u,j=t("isWoopayFirstPartyAuthEnabled"),H=t("woopayHost")+"/woopay/",{addToCart:N,getProductData:$}=(e=>({addToCart:t=>e.expressCheckoutAddToCart(t),getProductData:()=>{const e=(()=>{const e=document.querySelector(".single_add_to_cart_button");if(e)return e.value;const t=document.querySelector('.wp-block-add-to-cart-with-options input[name="add-to-cart"]');return t?.value})();if(!e)return!1;const t=document.querySelector(".bundle_form"),o=document.querySelector(".single_variation_wrap");let r={product_id:e,quantity:_e()};if(o&&!t)r.product_id=o.querySelector('input[name="product_id"]').value,r.attributes=document.querySelector(".variations_form")?(()=>{const e=document.querySelector(".variations_form")?.querySelectorAll(".variations select"),t={};return e&&e.forEach((e=>{const o=e.name,r=e.value||"";t[o]=r})),t})():[];else{const e=ke();if(e){const t=new FormData(e);t.delete("add-to-cart");const o={};for(const e of t.entries())o[e[0]]=e[1];r={...r,...o}}}const a=ke();return!(a&&(new FormData(a).forEach(((e,t)=>{if(/^(addon-|wc_)/.test(t))if(/\[\]$/.test(t)){const o=t.substring(0,t.length-2);r[o]?r[o].push(e):r[o]=[e]}else r[t]=e})),!(e=>{const t=["wc_gc_giftcard_to","wc_gc_giftcard_from","wc_gc_giftcard_to_multiple"];for(const o of t)if(e.hasOwnProperty(o)&&!e[o])return alert((0,n.__)("Please fill out all required fields","woocommerce-payments")),!1;return e.hasOwnProperty("wc_gc_giftcard_to_multiple")&&!e.wc_gc_giftcard_to_multiple.split(",").every((e=>ve(e.trim())))?(alert((0,n.__)("Please type only valid emails","woocommerce-payments")),!1):!(e.hasOwnProperty("wc_gc_giftcard_to")&&!ve(e.wc_gc_giftcard_to)&&(alert((0,n.__)("Please type only valid emails","woocommerce-payments")),1))})(r)))&&r}}))(i),B=(0,a.useRef)($),z=(0,a.useRef)(N);(0,a.useEffect)((()=>{if(!k.current)return;const e=k.current.getBoundingClientRect().width;L(e>140?_:w)}),[w,_]),(0,a.useEffect)((()=>{o||y("woopay_button_load",{source:T})}),[o,T]);const O=(0,a.useCallback)((()=>{if(!d)return!0;const e=document.querySelector(".single_add_to_cart_button")||document.querySelector('.wp-block-add-to-cart-with-options button[type="submit"]');return!e||!e.disabled&&!e.classList.contains("disabled")||(e.classList.contains("wc-variation-is-unavailable")?window.alert(window?.wc_add_to_cart_variation_params?.i18n_unavailable_text||(0,n.__)("Sorry, this product is unavailable. Please choose a different combination.","woocommerce-payments")):window.alert((0,n.__)("Please select your product options before proceeding.","woocommerce-payments")),!1)}),[d]),U=(0,a.useCallback)((e=>{if(e?.preventDefault(),!o&&(y("woopay_button_click",{source:T}),g(),O()))if(d){const e=B.current();if(!e)return;z.current(e).then((e=>{e.error?e.submit&&ke()?.submit():ye(i,T,h)}))}else ye(i,T,h)}),[i,T,h,o,d,O]),Z=(0,a.useCallback)((r=>{if(r.preventDefault(),o||S.current)return;if(y("woopay_button_click",{source:T}),g(),!O())return;S.current=!0,A(!0);const a=we();if(d){const o=B.current();if(!o)return;"function"==typeof e?.stop&&e.stop(),z.current(o).then((()=>{"function"==typeof e?.start&&e.start(),Ee.getWooPaySessionFromMerchant({_ajax_nonce:t("woopaySessionNonce"),appearance:a}).then((async e=>{if(!e?.blog_id||!e?.data?.session)throw v.current=U,new Error(e?.data);{const t=await Ee.sendPreemptiveSessionDataToWooPay(e);if(t?.is_error)return U(null),v.current=U,S.current=!1,void A(!1);window.location.href=b(t.redirect_url)}})).catch((()=>{const e=(0,n.__)("Something went wrong. Please try again.","woocommerce-payments");p(T,e),S.current=!1,A(!1)}))}))}else Ee.getWooPaySessionFromMerchant({_ajax_nonce:t("woopaySessionNonce"),order_id:t("order_id"),key:t("key"),billing_email:t("billing_email"),appearance:a}).then((async e=>{if(!e?.blog_id||!e?.data?.session)throw v.current=U,new Error(e?.data);{const t=await Ee.sendPreemptiveSessionDataToWooPay(e);if(t?.is_error)return U(null),v.current=U,S.current=!1,void A(!1);window.location.href=b(t.redirect_url)}}))?.catch((()=>{const e=(0,n.__)("Something went wrong. Please try again.","woocommerce-payments");p(T,e),S.current=!1,A(!1)}))}),[O,T,o,d,e,U]);(0,a.useEffect)((()=>{t("isWoopayFirstPartyAuthEnabled")?(v.current=Z,Ee.init()):v.current=U}),[Z,U]),(0,a.useEffect)((()=>{const e=e=>{e?.persisted&&(S.current=!1,A(!1))};return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}}),[]);const V={ref:k,"aria-label":q,onClick:e=>v.current(e),className:s("woopay-express-button",{"is-loading":M}),"data-type":C,"data-size":W,"data-theme":F,"data-width-type":E,style:{height:`${x}px`,borderRadius:`${P}px`}},J=M?(0,c.jsx)("span",{className:"wc-block-components-spinner"}):(0,c.jsx)("div",{className:"button-content",children:Ce({mixedString:q.replace(Le.default,"{{wooPayLogo /}}"),components:{wooPayLogo:(0,c.jsx)(D,{})}})});return(0,c.jsx)("div",{id:"wcpay-woopay-button",children:j?(0,c.jsx)("a",{...V,href:M?void 0:H,"aria-disabled":M||void 0,tabIndex:M?-1:void 0,children:J},`${C}-${F}-${W}`):(0,c.jsx)("button",{...V,disabled:M,type:"button",children:J},`${C}-${F}-${W}`)})};class Re{constructor(e,t){this.options=e,this.stripe=null,this.stripePlatform=null,this.request=t,this.isWooPayRequesting=!1}createStripe(e,t,o="",r=[]){const n={locale:t};return o&&(n.stripeAccount=o),r&&(n.betas=r),new Stripe(e,n)}async getStripeForUPE(e){return this.options.forceNetworkSavedCards=r("paymentMethodsConfig")[e].forceNetworkSavedCards,this.getStripe()}async getStripe(e=!1){let t=0;for(;!window.Stripe;)if(await new Promise((e=>setTimeout(e,100))),t+=100,t>6e5)throw new Error("Stripe object not found");return this.__getStripe(e)}__getStripe(e=!1){const{publishableKey:t,accountId:o,forceNetworkSavedCards:r,locale:n,isStripeLinkEnabled:a}=this.options;if(r&&!e)return this.stripePlatform||(this.stripePlatform=this.createStripe(t,n)),this.stripePlatform;if(!this.stripe){let e=["card_country_event_beta_1"];a&&(e=e.concat(["link_autofill_modal_beta_1"])),this.stripe=this.createStripe(t,n,o,e)}return this.stripe}async loadStripeForExpressCheckout(){try{return this.getStripe(!0)}catch(e){return{error:e}}}confirmIntent(e,o=!1){const r=e.match(/#wcpay-confirm-(pi|si):([^:]+):([^:]+):([^:]+)(?::(.+))?$/);if(!r)return!0;const n="si"===r[1];let a=r[2];const i=r[3],s=r[4],c=r[5]||null,l=e.indexOf("order-pay"),u=l>-1&&e.substring(l).match(/\d+/);return u&&(a=u[0]),(async()=>{const{locale:e,publishableKey:o}=this.options,r=t("accountIdForIntentConfirmation");if(n){const e=await this.getStripe(!0);return c?e.confirmSetup({clientSecret:i,confirmParams:{confirmation_token:c},redirect:"if_required"}):e.handleNextAction({clientSecret:i})}return r?this.createStripe(o,e,r).confirmCardPayment(i):(await this.getStripe(!0)).handleNextAction({clientSecret:i})})().then((e=>{var r;let n=null;e.paymentIntent?.last_payment_error&&(n={message:e.paymentIntent.last_payment_error.message}),"requires_action"===e.paymentIntent?.status&&(n={message:"Payment requires additional action."});const i=e.paymentIntent&&e.paymentIntent.id||e.setupIntent&&e.setupIntent.id||e.error&&e.error.payment_intent&&e.error.payment_intent.id||e.error.setup_intent&&e.error.setup_intent.id,c=null!==(r=f("ajax_url"))&&void 0!==r?r:t("ajaxUrl"),l=t("isChangingPayment");return[this.request(c,{action:"update_order_status",order_id:a,_ajax_nonce:s,intent_id:i,should_save_payment_method:o?"true":"false",is_changing_payment:l?"true":"false"}),n,e.error]})).then((([e,t,o])=>{if(o)throw o;return e.then((e=>{const o="string"==typeof e?JSON.parse(e):e;if(o.error)throw o.error;if(t)throw t;return o.return_url}))}))}async setupIntent(e){const o=await this.request(t("ajaxUrl"),{action:"create_setup_intent","wcpay-payment-method":e,_ajax_nonce:t("createSetupIntentNonce")});if(!o.success)throw o.data.error;if("succeeded"===o.data.status)return o.data;const r=await this.getStripe(),n=await r.confirmCardSetup(o.data.client_secret),{setupIntent:a,error:i}=n;if(i)throw i;return a}initWooPay(e,o){if(!this.isWooPayRequesting){this.isWooPayRequesting=!0;const r=t("wcAjaxUrl"),n=t("initWooPayNonce");let a=null,i=null;if(t("isWooPayGlobalThemeSupportEnabled"))if(w()){const e=me();a=fe(e,!0),i=he()}else a=t("woopayAppearance"),i=t("woopayFontRules");return this.request(m(r,"init_woopay"),{_wpnonce:n,appearance:a,font_rules:i,email:e,user_session:o,order_id:t("order_id"),key:t("key"),billing_email:t("billing_email")}).finally((()=>{this.isWooPayRequesting=!1}))}}expressCheckoutAddToCart(e){const o=t("wcAjaxUrl"),r=t("addToCartNonce");return this.request(m(o,"add_to_cart"),{security:r,...e})}}let We=!1,qe=!1;const De=()=>{const e=t("adminAppearanceNonce");if(!e||null===new URLSearchParams(window.location.search).get("customize_messenger_channel")&&!t("isPreview"))return;const o=me(),r=fe(o,!0);if(!r)return;const n=t("ajaxUrl");if(!n)return;const a=he(),i=new FormData;i.append("action","wcpay_admin_set_woopay_appearance"),i.append("_ajax_nonce",e),be(i,r),i.append("font_rules",JSON.stringify(a)),fetch(n,{method:"POST",body:i,credentials:"same-origin"}).catch((()=>{}))},je=[];let He=null;const Ne=()=>{((o={})=>{const r=new Re({publishableKey:t("publishableKey"),accountId:t("accountId"),forceNetworkSavedCards:t("forceNetworkSavedCards"),locale:t("locale")},h),n=document.getElementById("wcpay-woopay-button");if(n){for(;je.length>0;)je.pop().unmount();const a=(0,e.H)(n);je.push(a),a.render((0,c.jsx)(Ie,{listenForCartChanges:o,buttonSettings:t("woopayButton"),api:r,isProductPage:!!n.getAttribute("data-product_page"),emailSelector:"#billing_email"}))}})(He)};jQuery((e=>{He={start:()=>{e(document.body).on("updated_cart_totals updated_checkout",Ne)},stop:()=>{e(document.body).off("updated_cart_totals updated_checkout",Ne)}},He.start()})),window.addEventListener("load",(()=>{Ne(),We||(We=!0,De(),!qe&&window.wp?.customize&&(qe=!0,window.wp.customize.bind("saved",(()=>{De()}))))}))})()})();