HEX
Server: Apache
System: Linux p3plzcpnl476737.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: p8pyefaexf70 (9161224)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //proc/thread-self/cwd/wp-content/plugins/woocommerce-payments/dist/express-checkout.js
(()=>{var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var t;e.g.importScripts&&(t=e.g.location+"");var o=e.g.document;if(!t&&o&&(o.currentScript&&(t=o.currentScript.src),!t)){var r=o.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!t||!/^http(s?):/.test(t));)t=r[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=t})(),e.p=window.wcpayAssets.url,(()=>{"use strict";const t=window.wp.i18n,o=window.wp.hooks,r=e=>"undefined"!=typeof wcpayConfig&&void 0!==wcpayConfig[e]?wcpayConfig[e]:n(e),n=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},a=e=>"object"==typeof wcpayExpressCheckoutParams&&wcpayExpressCheckoutParams.hasOwnProperty(e)?wcpayExpressCheckoutParams[e]:null,i=(e,t,o="wcpay_")=>e.toString().replace("%%endpoint%%",o+t),s=["color","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"],c=["fontFamily","fontSize","lineHeight","letterSpacing","fontWeight","fontVariation","textDecoration","textShadow","textTransform","-webkit-font-smoothing","-moz-osx-font-smoothing","transition"],l=["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"],u={".Label":[...s,...c],".Text":[...s,...c],".Input":[...s,...c,...l],".Error":[...s,...c,...l],".Tab":[...s,...c,...l],".TabIcon":[...s],".TabLabel":[...s,...c],".Block":[...s.slice(1),...l.slice(1)],".Container":[...l],".Header":[...s,...l,...c],".Footer":[...s,...l,...c]},d={".Label":u[".Label"],".Label--floating":[...u[".Label"],"transform"],".Input":[...u[".Input"],"outlineColor","outlineWidth","outlineStyle"],".Error":u[".Error"],".Tab":["backgroundColor","color","fontFamily"],".Tab--selected":["outlineColor","outlineWidth","outlineStyle","backgroundColor","color",...l],".TabIcon":u[".TabIcon"],".TabIcon--selected":["color"],".TabLabel":u[".TabLabel"],".Block":u[".Block"],".Container":u[".Container"],".Header":u[".Header"],".Footer":u[".Footer"],".Footer--link":u[".Text"],".Text":u[".Text"],".Text--redirect":u[".Text"]};function p(e){return p="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},p(e)}var h=/^\s+/,m=/\s+$/;function f(e,t){if(t=t||{},(e=e||"")instanceof f)return e;if(!(this instanceof f))return new f(e,t);var o=function(e){var t,o,r,n={r:0,g:0,b:0},a=1,i=null,s=null,c=null,l=!1,u=!1;return"string"==typeof e&&(e=function(e){e=e.replace(h,"").replace(m,"").toLowerCase();var t,o=!1;if(R[e])e=R[e],o=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};return(t=U.rgb.exec(e))?{r:t[1],g:t[2],b:t[3]}:(t=U.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=U.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=U.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=U.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=U.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=U.hex8.exec(e))?{r:B(t[1]),g:B(t[2]),b:B(t[3]),a:O(t[4]),format:o?"name":"hex8"}:(t=U.hex6.exec(e))?{r:B(t[1]),g:B(t[2]),b:B(t[3]),format:o?"name":"hex"}:(t=U.hex4.exec(e))?{r:B(t[1]+""+t[1]),g:B(t[2]+""+t[2]),b:B(t[3]+""+t[3]),a:O(t[4]+""+t[4]),format:o?"name":"hex8"}:!!(t=U.hex3.exec(e))&&{r:B(t[1]+""+t[1]),g:B(t[2]+""+t[2]),b:B(t[3]+""+t[3]),format:o?"name":"hex"}}(e)),"object"==p(e)&&(D(e.r)&&D(e.g)&&D(e.b)?(t=e.r,o=e.g,r=e.b,n={r:255*j(t,255),g:255*j(o,255),b:255*j(r,255)},l=!0,u="%"===String(e.r).substr(-1)?"prgb":"rgb"):D(e.h)&&D(e.s)&&D(e.v)?(i=N(e.s),s=N(e.v),n=function(e,t,o){e=6*j(e,360),t=j(t,100),o=j(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,i,s),l=!0,u="hsv"):D(e.h)&&D(e.s)&&D(e.l)&&(i=N(e.s),c=N(e.l),n=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=j(e,360),t=j(t,100),o=j(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,i,c),l=!0,u="hsl"),e.hasOwnProperty("a")&&(a=e.a)),a=L(a),{ok:l,format:e.format||u,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a}}(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 b(e,t,o){e=j(e,255),t=j(t,255),o=j(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 g(e,t,o){e=j(e,255),t=j(t,255),o=j(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 y(e,t,o,r){var n=[H(Math.round(e).toString(16)),H(Math.round(t).toString(16)),H(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 _(e,t,o,r){return[H(z(r)),H(Math.round(e).toString(16)),H(Math.round(t).toString(16)),H(Math.round(o).toString(16))].join("")}function w(e,t){t=0===t?0:t||10;var o=f(e).toHsl();return o.s-=t/100,o.s=F(o.s),f(o)}function v(e,t){t=0===t?0:t||10;var o=f(e).toHsl();return o.s+=t/100,o.s=F(o.s),f(o)}function k(e){return f(e).desaturate(100)}function S(e,t){t=0===t?0:t||10;var o=f(e).toHsl();return o.l+=t/100,o.l=F(o.l),f(o)}function x(e,t){t=0===t?0:t||10;var o=f(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))),f(o)}function C(e,t){t=0===t?0:t||10;var o=f(e).toHsl();return o.l-=t/100,o.l=F(o.l),f(o)}function T(e,t){var o=f(e).toHsl(),r=(o.h+t)%360;return o.h=r<0?360+r:r,f(o)}function I(e){var t=f(e).toHsl();return t.h=(t.h+180)%360,f(t)}function A(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var o=f(e).toHsl(),r=[f(e)],n=360/t,a=1;a<t;a++)r.push(f({h:(o.h+a*n)%360,s:o.s,l:o.l}));return r}function P(e){var t=f(e).toHsl(),o=t.h;return[f(e),f({h:(o+72)%360,s:t.s,l:t.l}),f({h:(o+216)%360,s:t.s,l:t.l})]}function M(e,t,o){t=t||6,o=o||30;var r=f(e).toHsl(),n=360/o,a=[f(e)];for(r.h=(r.h-(n*t>>1)+720)%360;--t;)r.h=(r.h+n)%360,a.push(f(r));return a}function q(e,t){t=t||6;for(var o=f(e).toHsv(),r=o.h,n=o.s,a=o.v,i=[],s=1/t;t--;)i.push(f({h:r,s:n,v:a})),a=(a+s)%1;return i}f.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=L(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=g(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=g(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=b(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=b(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 y(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=[H(Math.round(e).toString(16)),H(Math.round(t).toString(16)),H(Math.round(o).toString(16)),H(z(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*j(this._r,255))+"%",g:Math.round(100*j(this._g,255))+"%",b:Math.round(100*j(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*j(this._r,255))+"%, "+Math.round(100*j(this._g,255))+"%, "+Math.round(100*j(this._b,255))+"%)":"rgba("+Math.round(100*j(this._r,255))+"%, "+Math.round(100*j(this._g,255))+"%, "+Math.round(100*j(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(E[y(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+_(this._r,this._g,this._b,this._a),o=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var n=f(e);o="#"+_(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 f(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(S,arguments)},brighten:function(){return this._applyModification(x,arguments)},darken:function(){return this._applyModification(C,arguments)},desaturate:function(){return this._applyModification(w,arguments)},saturate:function(){return this._applyModification(v,arguments)},greyscale:function(){return this._applyModification(k,arguments)},spin:function(){return this._applyModification(T,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(I,arguments)},monochromatic:function(){return this._applyCombination(q,arguments)},splitcomplement:function(){return this._applyCombination(P,arguments)},triad:function(){return this._applyCombination(A,[3])},tetrad:function(){return this._applyCombination(A,[4])}},f.fromRatio=function(e,t){if("object"==p(e)){var o={};for(var r in e)e.hasOwnProperty(r)&&(o[r]="a"===r?e[r]:N(e[r]));e=o}return f(e,t)},f.equals=function(e,t){return!(!e||!t)&&f(e).toRgbString()==f(t).toRgbString()},f.random=function(){return f.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},f.mix=function(e,t,o){o=0===o?0:o||50;var r=f(e).toRgb(),n=f(t).toRgb(),a=o/100;return f({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})},f.readability=function(e,t){var o=f(e),r=f(t);return(Math.max(o.getLuminance(),r.getLuminance())+.05)/(Math.min(o.getLuminance(),r.getLuminance())+.05)},f.isReadable=function(e,t,o){var r,n,a,i,s,c=f.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},f.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=f.readability(e,t[l]))>c&&(c=r,s=f(t[l]));return f.isReadable(e,s,{level:a,size:i})||!n?s:(o.includeFallbackColors=!1,f.mostReadable(e,["#fff","#000"],o))};var R=f.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"},E=f.hexNames=function(e){var t={};for(var o in e)e.hasOwnProperty(o)&&(t[e[o]]=o);return t}(R);function L(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function j(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 F(e){return Math.min(1,Math.max(0,e))}function B(e){return parseInt(e,16)}function H(e){return 1==e.length?"0"+e:""+e}function N(e){return e<=1&&(e=100*e+"%"),e}function z(e){return Math.round(255*parseFloat(e)).toString(16)}function O(e){return B(e)/255}var $,W,Q,U=(W="[\\s|\\(]+("+($="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+$+")[,|\\s]+("+$+")\\s*\\)?",Q="[\\s|\\(]+("+$+")[,|\\s]+("+$+")[,|\\s]+("+$+")[,|\\s]+("+$+")\\s*\\)?",{CSS_UNIT:new RegExp($),rgb:new RegExp("rgb"+W),rgba:new RegExp("rgba"+Q),hsl:new RegExp("hsl"+W),hsla:new RegExp("hsla"+Q),hsv:new RegExp("hsv"+W),hsva:new RegExp("hsva"+Q),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 D(e){return!!U.CSS_UNIT.exec(e)}const V={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"],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"],linkSelectors:["a"],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"],linkSelectors:["a"],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"],linkSelectors:["a"]},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"],linkSelectors:["a"],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"],linkSelectors:["a"],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"],backgroundSelectors:["#customer_details","#order_review","form.checkout","body"],headingSelectors:["h1","h2","h3","h4","h5","h6"],buttonSelectors:["#place_order"],linkSelectors:["a"],containerSelectors:[".woocommerce-checkout-review-order-table"],headerSelectors:[".site-header","header > div"],footerSelectors:[".site-footer","footer > div"],footerLink:[".site-footer a","footer a"]},updateSelectors:function(e,t){return e.hasOwnProperty("alternateSelectors")&&(Object.entries(e.alternateSelectors).forEach((o=>{const[r,n]=o;t.querySelector(e[r])||(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}return{...this.default,...this.updateSelectors(o,t)}}},X={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=V.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(V.default.hiddenContainer);t&&t.remove()}},G=(e,t,o=null,r)=>{const n=(Array.isArray(e)?e:[e]).map((e=>r.querySelector(e))).filter(Boolean);if(!n.length)return{};const a=r.defaultView||window,i=d[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},J=(e,t=!1,o=document)=>{const r=V.getSelectors(e,o);X.init(e,o);const n=G(r.hiddenInput,".Input",null,o),a=G(r.hiddenInvalidInput,".Input",null,o),i=G(r.upeThemeLabelSelector,".Label",null,o),s={fontSize:i.fontSize},c=G(r.upeThemeTextSelectors,".Text",null,o),l=G(r.upeThemeInputSelector,".Tab",null,o),u=G(r.hiddenInput,".Tab--selected",null,o),d=(e=>{const t=Object.assign({},e);if(!e.backgroundColor||!e.color)return e;const o=((e,t)=>{const o={backgroundColor:e,color:t},r=f(e),n=f(t);if(!r.isValid()||!n.isValid())return{backgroundColor:"",color:""};const a=r.getBrightness()>50?f(r).darken(7):f(r).lighten(7),i=f.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})(l),p={color:d.color},h={color:u.color},m=((e,t=document)=>{let o=null,r=0;for(;!o&&r<e.length;){const n=t.querySelector(e[r]);if(!n){r++;continue}const a=(t.defaultView||window).getComputedStyle(n).backgroundColor;a&&f(a).getAlpha()>0&&(o=a),r++}return o||"#ffffff"})(r.backgroundSelectors,o),b=G(r.headingSelectors,".Label",null,o),g=G(r.upeThemeLabelSelector,".Block",m,o),y=G(r.buttonSelectors,".Input",null,o),_=G(r.linkSelectors,".Label",null,o),w=G(r.containerSelectors,".Container",null,o),v=G(r.headerSelectors,".Header",null,o),k=G(r.footerSelectors,".Footer",null,o),S=G(r.footerLink,".Footer--link",null,o),x={colorBackground:m,colorText:c.color,fontFamily:c.fontFamily,fontSizeBase:c.fontSize};r.pmmeRelativeTextSizeSelector&&x.fontSizeBase&&(x.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`}(r.pmmeRelativeTextSizeSelector,c.fontSize,.875,o));const C="blocks_checkout"===e;let T={variables:x,theme:(I=m,f(I).getBrightness()>125?"stripe":"night"),labels:C?"floating":"above",rules:JSON.parse(JSON.stringify({".Input":n,".Input--invalid":a,".Label":i,".Label--resting":s,".Block":g,".Tab":l,".Tab:hover":d,".Tab--selected":u,".TabIcon:hover":p,".TabIcon--selected":h,".Text":c,".Text--redirect":c}))};var I;return C&&(T=((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})(T,G(r.hiddenValidActiveLabel,".Label--floating",null,o))),t&&(T.rules={...T.rules,".Heading":b,".Header":v,".Footer":k,".Footer-link":S,".Button":y,".Link":_,".Container":w}),X.cleanup(o),T};class K{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=n("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,t=!1){const o=e.match(/#wcpay-confirm-(pi|si):(.+):(.+):(.+)$/);if(!o)return!0;const n="si"===o[1];let i=o[2];const s=o[3],c=o[4],l=e.indexOf("order-pay"),u=l>-1&&e.substring(l).match(/\d+/);return u&&(i=u[0]),(async()=>{const{locale:e,publishableKey:t}=this.options,o=r("accountIdForIntentConfirmation"),a=await this.getStripe();return n?a.handleNextAction({clientSecret:s}):o?this.createStripe(t,e,o).confirmCardPayment(s):(await this.getStripe(!0)).handleNextAction({clientSecret:s})})().then((e=>{var o;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 s=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,l=null!==(o=a("ajax_url"))&&void 0!==o?o:r("ajaxUrl"),u=r("isChangingPayment");return[this.request(l,{action:"update_order_status",order_id:i,_ajax_nonce:c,intent_id:s,should_save_payment_method:t?"true":"false",is_changing_payment:u?"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 t=await this.request(r("ajaxUrl"),{action:"create_setup_intent","wcpay-payment-method":e,_ajax_nonce:r("createSetupIntentNonce")});if(!t.success)throw t.data.error;if("succeeded"===t.data.status)return t.data;const o=await this.getStripe(),n=await o.confirmCardSetup(t.data.client_secret),{setupIntent:a,error:i}=n;if(i)throw i;return a}saveUPEAppearance(e,t){return this.request(r("ajaxUrl"),{elements_location:t,appearance:JSON.stringify(e),action:"save_upe_appearance",_ajax_nonce:r("saveUPEAppearanceNonce")}).then((e=>e.data)).catch((e=>{throw e.message?e:new Error(e.statusText)}))}initWooPay(e,t){if(!this.isWooPayRequesting){this.isWooPayRequesting=!0;const o=r("wcAjaxUrl"),n=r("initWooPayNonce"),a=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;return this.request(i(o,"init_woopay"),{_wpnonce:n,appearance:r("isWooPayGlobalThemeSupportEnabled")?J(a,!0):null,email:e,user_session:t,order_id:r("order_id"),key:r("key"),billing_email:r("billing_email")}).finally((()=>{this.isWooPayRequesting=!1}))}}expressCheckoutAddToCart(e){const t=r("wcAjaxUrl"),o=r("addToCartNonce");return this.request(i(t,"add_to_cart"),{security:o,...e})}}jQuery((e=>{e("input[name=wc_deposit_option],input[name=wc_deposit_payment_plan]").on("change",(()=>{(0,o.doAction)("wcpay.express-checkout.update-button-data")}))})),(0,o.addFilter)("wcpay.express-checkout.cart-add-item","automattic/wcpay/express-checkout",(e=>{const t={};return jQuery("input[name=wc_deposit_option]").length&&(t.wc_deposit_option=jQuery("input[name=wc_deposit_option]:checked").val()),jQuery("input[name=wc_deposit_payment_plan]").length&&(t.wc_deposit_payment_plan=jQuery("input[name=wc_deposit_payment_plan]:checked").val()),{...e,...t}}));const Z="wcpay-express-checkout__order-attribution-inputs",Y=()=>{(()=>{if(document.getElementById(Z))return;const e=document.createElement("wc-order-attribution-inputs");e.id=Z,document.body.appendChild(e)})(),window?.wc_order_attribution?.setOrderTracking(window?.wc_order_attribution?.params?.allowTracking)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Y):Y(),(0,o.addFilter)("wcpay.express-checkout.cart-place-order-extension-data","automattic/wcpay/express-checkout",(e=>{const t=jQuery("#wcpay-express-checkout__order-attribution-inputs input");if(!t.length)return e;const o={};return t.each((function(){const e=jQuery(this).attr("name").replace("wc_order_attribution_",""),t=jQuery(this).val();e&&t&&(o[e]=t)})),{...e,"woocommerce/order-attribution":o}}));let ee=null,te=null;const oe=()=>jQuery(te),re={init:({elementId:e,$separator:t})=>{te=e,ee=t},getButtonSeparator:()=>ee,blockButton:()=>{oe().data("blockUI.isBlocked")||oe().block({message:null})},unblockButton:()=>{re.showContainer(),oe().unblock()},renderButton:e=>{oe()?.length&&e.mount(te)},hideContainer:()=>{oe().removeClass("is-ready").hide()},showContainer:()=>{oe().addClass("is-ready").show()}},ne=re,ae=(e,t,o=!1)=>{let r;return function(){const n=this,a=arguments,i=o&&!r;clearTimeout(r),r=setTimeout((()=>{r=null,o||t.apply(n,a)}),e),i&&t.apply(n,a)}},ie=e=>{var t,o,r,n;return void 0!==window.wcpayExpressCheckoutParams?null!==(t=window.wcpayExpressCheckoutParams[e])&&void 0!==t?t:null:void 0!==(null===(o=window.wc)||void 0===o?void 0:o.wcSettings)&&null!==(n=null===(r=window.wc.wcSettings.getSetting("ece_data"))||void 0===r?void 0:r[e])&&void 0!==n?n:null},se=e=>{if(!e)return"";const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstChild?t.firstChild.textContent:""},ce=e=>{var t,o;let r="undefined"==typeof wcpaySettings?4:parseInt(window?.wcpaySettings?.defaultExpressCheckoutBorderRadius||4,10);const n=ie("button");return r=null!==(t=null==n?void 0:n.radius)&&void 0!==t?t:r,void 0!==e&&(r=null!==(o=Number(null==e?void 0:e.borderRadius))&&void 0!==o?o:r),{variables:{borderRadius:`${r}px`,spacingUnit:"6px"}}},le=()=>{var e,t;const o=null!==(t=null===(e=ie("product"))||void 0===e?void 0:e.product_type)&&void 0!==t?t:"",r=["subscription","variable-subscription","subscription_variation"].includes(o);return ie("has_subscription")||r?{setupFutureUsage:"off_session"}:{}};jQuery((e=>{e(document.body).on("woocommerce_variation_has_changed",(async()=>{(0,o.doAction)("wcpay.express-checkout.update-button-data")}))})),jQuery((e=>{if("product"!==ie("button_context"))return;const t=e(".quantity");t.on("input",".qty",(()=>{ne.blockButton()})),t.on("input",".qty",ae(250,(async()=>{(0,o.doAction)("wcpay.express-checkout.update-button-data")})))})),(0,o.addFilter)("wcpay.express-checkout.cart-add-item","automattic/wcpay/express-checkout",(e=>{const t=document.querySelector(".single_variation_wrap");if(!t)return e;const o=t.querySelector('input[name="product_id"]').value;return{...e,id:parseInt(o,10)}})),(0,o.addFilter)("wcpay.express-checkout.cart-add-item","automattic/wcpay/express-checkout",(e=>{const t=document.querySelector(".variations_form");if(!t)return e;const o=[],r=t.querySelectorAll(".variations select");return Array.from(r).forEach((function(e){const t=e.dataset.attribute_name||e.dataset.name;o.push({attribute:Array.from(document.querySelector(`label[for="${t.replace("attribute_","")}"]`).childNodes)[0].textContent,value:e.value||""}),o.push({attribute:t,value:e.value||""})})),{...e,variation:[...e.variation,...o]}})),(0,o.addFilter)("wcpay.express-checkout.map-line-items","automattic/wcpay/express-checkout",(e=>({...e,items:e.items.filter((e=>!e.extensions?.bundles?.bundled_by))})));const ue=(e,t,o)=>{const r=document.querySelector(`${e} [name="${t}"]`);if(r)if("SELECT"===r.tagName&&/country|state/.test(t)){const e=Array.from(r.options).find((e=>e.value===o||e.textContent.trim().toLowerCase()===o.toLowerCase()));e&&(r.value=e.value,jQuery(r).trigger("change").trigger("close"))}else r.value=o,jQuery(r).trigger("change")},de=window.lodash;window.wp.domReady;const pe=(e,t={})=>{var o,n,i,s;if(!1===(null!==(o=r("isShopperTrackingEnabled"))&&void 0!==o?o:a("is_shopper_tracking_enabled")))return;const c=null!==(n=r("platformTrackerNonce"))&&void 0!==n?n:null===(i=a("nonce"))||void 0===i?void 0:i.platform_tracker,l=null!==(s=r("ajaxUrl"))&&void 0!==s?s:a("ajax_url"),u=new FormData;u.append("tracksNonce",c),u.append("action","platform_tracks"),u.append("tracksEventName",e),u.append("tracksEventProp",JSON.stringify(t)),fetch(l,{method:"post",body:u}).then((e=>e.json()))},he=(0,de.debounce)((({source:e})=>{pe("applepay_button_load",{source:e})}),1e3),me=(0,de.debounce)((({source:e})=>{pe("gpay_button_load",{source:e})}),1e3),fe=window.wp.apiFetch;var be=e.n(fe);const ge=window.wp.url;class ye{cartRequestHeaders={};async _request(e){const t=await be()({...e,parse:!1,path:(0,ge.addQueryArgs)(e.path,{currency:ie("checkout").currency_code.toUpperCase()}),headers:{Nonce:ie("nonce").store_api_nonce,"X-WooPayments-Tokenized-Cart-Nonce":ie("nonce").tokenized_cart_nonce||void 0,"X-WooPayments-Tokenized-Cart-Session-Nonce":"product"===ie("button_context")?ie("nonce").tokenized_cart_session_nonce:void 0,...this.cartRequestHeaders,...e.headers}});return this.cartRequestHeaders={Nonce:t.headers.get("Nonce"),"X-WooPayments-Tokenized-Cart-Session":t.headers.get("X-WooPayments-Tokenized-Cart-Session")},t.json()}async placeOrder(e){return await this._request({method:"POST",path:"/wc/store/v1/checkout",headers:{"X-WooPayments-Tokenized-Cart":!0,...this.cartRequestHeaders},data:e})}async getCart(){return await this._request({method:"GET",path:"/wc/store/v1/cart"})}useSeparateCart(){this.cartRequestHeaders={"X-WooPayments-Tokenized-Cart-Session":""}}deleteAfterRequest(){this.cartRequestHeaders={"X-WooPayments-Tokenized-Cart-Is-Ephemeral-Cart":"1"}}async updateCustomer(e){return await this._request({method:"POST",path:"/wc/store/v1/cart/update-customer",headers:{"X-WooPayments-Tokenized-Cart":!0,...this.cartRequestHeaders},data:e})}async selectShippingRate(e){return await this._request({method:"POST",path:"/wc/store/v1/cart/select-shipping-rate",data:e})}async addProductToCart(){const e={id:jQuery(".single_add_to_cart_button").val(),quantity:parseInt(jQuery(".quantity .qty").val(),10)||1,variation:[]};return await this._request({method:"POST",path:"/wc/store/v1/cart/add-item",data:(0,o.applyFilters)("wcpay.express-checkout.cart-add-item",e)})}async emptyCart(){try{let e=await this._request({method:"GET",path:"/wc/store/v1/cart"});for(;e.items.length>0;)e=await this._request({method:"POST",path:"/wc/store/v1/cart/remove-item",data:{key:e.items[0].key}})}catch(e){}}}const _e=(e,t)=>{var o,r,n,a,i,s,c,l,u;return{first_name:null!==(o=e?.split(" ")?.slice(0,1)?.join(" "))&&void 0!==o?o:"",last_name:null!==(r=e?.split(" ")?.slice(1)?.join(" "))&&void 0!==r?r:"",company:null!==(n=t.organization)&&void 0!==n?n:"",address_1:null!==(a=t.line1)&&void 0!==a?a:"",address_2:null!==(i=t.line2)&&void 0!==i?i:"",city:null!==(s=t.city)&&void 0!==s?s:"",state:null!==(c=t.state)&&void 0!==c?c:"",postcode:null!==(l=t.postal_code?.replace(" ",""))&&void 0!==l?l:"",country:null!==(u=t.country)&&void 0!==u?u:""}},we=(e,t,o=!0,r=[])=>{var n,a,i,s,c,l,u,d,p,h,m,f,b;const g=e.billingDetails?.name||"",y=null!==(n=e.billingDetails?.address)&&void 0!==n?n:{},_=null!==(a=null!==(i=e.billingDetails?.phone?.replace(/[() -]/g,""))&&void 0!==i?i:e.payerPhone?.replace(/[() -]/g,""))&&void 0!==a?a:"";return{customer_note:e.order_comments,billing_address:{first_name:null!==(s=g.split(" ")?.slice(0,1)?.join(" "))&&void 0!==s?s:"",last_name:g.split(" ")?.slice(1)?.join(" ")||"-",company:null!==(c=y.organization)&&void 0!==c?c:"",address_1:null!==(l=y.line1)&&void 0!==l?l:"",address_2:null!==(u=y.line2)&&void 0!==u?u:"",city:null!==(d=y.city)&&void 0!==d?d:"",state:null!==(p=y.state)&&void 0!==p?p:"",postcode:null!==(h=y.postal_code)&&void 0!==h?h:"",country:null!==(m=y.country)&&void 0!==m?m:"",email:null!==(f=e.billingDetails?.email)&&void 0!==f?f:"",phone:_},shipping_address:e.shippingAddress?{..._e(e.shippingAddress.name||"",e.shippingAddress.address),phone:_}:void 0,payment_method:"woocommerce_payments",payment_data:[{key:"payment_method",value:"card"},{key:"wcpay-fraud-prevention-token",value:null!==(b=window.wcpayFraudPreventionToken)&&void 0!==b?b:""},{key:o?"wcpay-confirmation-token":"wcpay-payment-method",value:t},{key:"express_payment_type",value:e.expressPaymentType},{key:"wcpay-express-payment-method-types",value:JSON.stringify(r)}]}},ve=window.wp.htmlEntities,ke=(e,t)=>{var o;return e*10**((null!==(o=ie("checkout")?.currency_decimals)&&void 0!==o?o:2)-t.currency_minor_unit)},Se=e=>{const r=ie("checkout").display_prices_with_tax,n=(0,o.applyFilters)("wcpay.express-checkout.map-line-items",e),a=n.items.map((e=>({amount:ke(r&&e.totals?parseInt(e.totals.line_subtotal,10)+parseInt(e.totals.line_subtotal_tax,10):parseInt(e.totals?.line_subtotal||e.prices.price,10),e.totals||e.prices),name:[e.name,e.quantity>1&&`(x${e.quantity})`,e.variation&&e.variation.length>0&&"-",e.variation&&e.variation.map((e=>`${e.attribute}: ${e.value}`)).join(", "),e.item_data&&e.item_data.length>0&&"-",e.item_data&&e.item_data.map((e=>`${e.name||e.key}: ${e.value}`)).join(", ")].filter(Boolean).map(ve.decodeEntities).join(" ")}))),i=parseInt(n.totals.total_shipping||"0",10);i&&a.push({amount:ke(r?i+parseInt(n.totals.total_shipping_tax||"0",10):i,n.totals),name:(0,t.__)("Shipping","woocommerce-payments")});const s=parseInt(n.totals.total_discount||"0",10);s&&a.push({amount:-ke(r?s+parseInt(n.totals.total_discount_tax||"0",10):s,n.totals),name:(0,t.__)("Discount","woocommerce-payments")});const c=parseInt(n.totals.total_fees||"0",10);c&&a.push({amount:ke(r?c+parseInt(n.totals.total_fees_tax||"0",10):c,n.totals),name:(0,t.__)("Fees","woocommerce-payments")});const l=parseInt(n.totals.total_tax||"0",10);l&&!r&&a.push({amount:ke(l,n.totals),name:(0,t.__)("Tax","woocommerce-payments")});const u=parseInt(n.totals.total_refund||"0",10);return u&&a.push({amount:-ke(u,n.totals),name:(0,t.__)("Refund","woocommerce-payments")}),ke(parseInt(n.totals.total_price,10)-parseInt(n.totals.total_refund||0,10),n.totals)<a.reduce(((e,{amount:t})=>e+t),0)?[]:a},xe=e=>{const t=ie("checkout").display_prices_with_tax;return e.shipping_rates?.[0]?.shipping_rates.sort(((e,t)=>e.selected===t.selected?0:e.selected?-1:1)).slice(0,9).map((e=>({id:e.rate_id,displayName:(0,ve.decodeEntities)(e.name),amount:ke(t?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10),e),deliveryEstimate:[e.meta_data.find((e=>"pickup_address"===e.key))?.value,e.meta_data.find((e=>"pickup_details"===e.key))?.value].filter(Boolean).map(ve.decodeEntities).join(" - ")})))};let Ce=null,Te=new ye;const Ie=()=>Te,Ae=()=>{jQuery.blockUI({message:null,overlayCSS:{background:"#fff",opacity:.6}})},Pe=()=>{jQuery.unblockUI()};class Me{orderId;key;billingEmail="";cachedCartData={};constructor({orderId:e,key:t,billingEmail:o=""}){this.orderId=e,this.key=t,this.billingEmail=o}async placeOrder(e){return await be()({method:"POST",path:`/wc/store/v1/checkout/${this.orderId}`,headers:{Nonce:ie("nonce").store_api_nonce},data:{...e,key:this.key,billing_email:this.billingEmail,billing_address:this.cachedCartData.billing_address,shipping_address:this.cachedCartData.shipping_address}})}async getCart(){return this.cachedCartData=await be()({method:"GET",path:(0,ge.addQueryArgs)(`/wc/store/v1/order/${this.orderId}`,{key:this.key,billing_email:this.billingEmail})})}}let qe=null;const Re=async()=>{if("product"!==ie("button_context"))return await Ie().getCart();const e=new ye;return e.useSeparateCart(),e.deleteAfterRequest(),await e.addProductToCart()},Ee=()=>qe?ke(parseInt(qe.totals.total_price,10)-parseInt(qe.totals.total_refund||0,10),qe.totals):"product"===ie("button_context")&&ie("product")?ie("product")?.total.amount:void 0;let Le;jQuery((e=>{if(ie("has_block")&&"pay_for_order"!==ie("button_context"))return;const n=ie("stripe").publishableKey;if(!n)return;const a=new K({publishableKey:n,accountId:ie("stripe").accountId,locale:ie("stripe").locale},((e,t)=>new Promise(((o,r)=>{jQuery.post(e,t).then(o).fail(r)}))));var i;"pay_for_order"===ie("button_context")&&(i=new Me({orderId:r("order_id"),key:r("key"),billingEmail:r("billing_email")}),Te=i),ne.init({elementId:"#wcpay-express-checkout-element",$separator:jQuery("#wcpay-express-checkout-button-separator")});const s={abortPayment:t=>{Pe(),e(".woocommerce-error").remove();const o=e(".woocommerce-notices-wrapper").first();o.length&&(o.append(e('<div class="woocommerce-error" />').text(t)),e("html, body").animate({scrollTop:o.find(".woocommerce-error").offset().top},600))},completePayment:e=>{Ae(),window.location=e},startExpressCheckoutElement:async r=>{var n,i,c;let l="",u=Promise.resolve();const d=await a.getStripe(),p=null===(n=ie("flags")?.isEceUsingConfirmationTokens)||void 0===n||n,h=null!==(i=ie("enabled_methods"))&&void 0!==i?i:[],m=[h.includes("payment_request")&&"card",h.includes("amazon_pay")&&"amazon_pay"].filter(Boolean);Le=d.elements({mode:"payment",amount:r.total,currency:r.currency,...p?{paymentMethodTypes:m,...le()}:{paymentMethodCreation:"manual"},appearance:ce(),locale:null!==(c=ie("stripe")?.locale)&&void 0!==c?c:"en"});const f=Le.create("expressCheckout",(()=>{var e,t,o,r,n,a;const i=ie("button"),s=null!==(e=ie("enabled_methods"))&&void 0!==e?e:[],c=(e,t)=>{switch(t){case"dark":default:return"black";case"light":return"white";case"light-outline":return"googlePay"===e?"white":"white-outline"}},l="default"===(null==i?void 0:i.type)?"plain":null!==(t=null==i?void 0:i.type)&&void 0!==t?t:"buy",u="default"===(null==i?void 0:i.type)?"plain":null!==(o=null==i?void 0:i.type)&&void 0!==o?o:"plain",d=s.includes("payment_request");return{paymentMethods:{applePay:d?"always":"never",googlePay:d?"always":"never",amazonPay:s.includes("amazon_pay")?"auto":"never",link:"never",paypal:"never",klarna:"never"},layout:{overflow:"never"},buttonTheme:{googlePay:c("googlePay",null!==(r=null==i?void 0:i.theme)&&void 0!==r?r:"black"),applePay:c("applePay",null!==(n=null==i?void 0:i.theme)&&void 0!==n?n:"black")},buttonType:{googlePay:l,applePay:u},buttonHeight:Math.min(Math.max(parseInt(null!==(a=null==i?void 0:i.height)&&void 0!==a?a:"48",10),40),55)}})());ne.renderButton(f),f.on("loaderror",(()=>{document.getElementById("wcpay-woopay-button")||ne.getButtonSeparator().hide()})),f.on("click",(function(o){if(l="",ie("login_confirmation"))return void(e=>{const t=ie("login_confirmation");if(!t)return;let o=t.message;o=o.replace(/\*\*.*?\*\*/,{apple_pay:"Apple Pay",google_pay:"Google Pay",amazon_pay:"Amazon Pay",paypal:"PayPal",link:"Link"}[e]),o=o.replace(/\*\*/g,""),confirm(o)&&(window.location.href=t.redirect_url)})(o.expressPaymentType);if("product"===ie("button_context")){const o=e(".single_add_to_cart_button");if(o.is(".disabled"))return void(o.is(".wc-variation-is-unavailable")?window.alert(window?.wc_add_to_cart_variation_params?.i18n_unavailable_text||(0,t.__)("Sorry, this product is unavailable. Please choose a different combination.","woocommerce-payments")):window.alert((0,t.__)("Please select your product options before proceeding.","woocommerce-payments")));Ie().useSeparateCart(),u=Ie().addProductToCart(),u.catch((()=>{l=(0,t.__)("There was an error processing the product with this payment method. Please add the product to the cart, instead.","woocommerce-payments"),Ie().emptyCart(),f.unmount(),Le=null,s.abortPayment(l),ne.hideContainer(),ne.getButtonSeparator().hide()})).finally((()=>{u=Promise.resolve()}))}const r=qe?{shippingAddressRequired:"pay_for_order"!==ie("button_context")&&qe.needs_shipping,shippingRates:xe(qe),phoneNumberRequired:null!==(n=ie("checkout")?.needs_payer_phone)&&void 0!==n&&n,lineItems:Se(qe)}:"product"===ie("button_context")&&ie("product")?{shippingAddressRequired:null!==(a=ie("product")?.needs_shipping)&&void 0!==a&&a,phoneNumberRequired:null!==(i=ie("checkout")?.needs_payer_phone)&&void 0!==i&&i,lineItems:(null!==(c=ie("product")?.displayItems)&&void 0!==c?c:[]).map((({label:e,amount:t})=>({name:e,amount:t})))}:void 0;var n,a,i,c;const d=r.shippingRates&&0!==r.shippingRates.length?r.shippingRates:[{id:"pending",displayName:(0,t.__)("Pending","woocommerce-payments"),amount:0}];(async function({expressPaymentType:e}){Ae(),((e,t)=>{const o={google_pay:"gpay_button_click",apple_pay:"applepay_button_click"}[e];o&&pe(o,{source:t})})(e,ie("button_context"))})(o),o.resolve({business:{name:ie("store_name")},emailRequired:!0,...r,shippingRates:r.shippingAddressRequired?d:void 0,allowedShippingCountries:ie("checkout").allowed_shipping_countries})})),f.on("shippingaddresschange",(async e=>(await u,l?e.resolve():(async(e,t)=>{Ce=e.address;try{const o=await Te.updateCustomer({shipping_address:_e(e.name,e.address)}),r=xe(o);if(0===r.length)return void e.reject();t.update({amount:ke(parseInt(o.totals.total_price,10)-parseInt(o.totals.total_refund||0,10),o.totals)}),e.resolve({shippingRates:r,lineItems:Se(o)})}catch(t){e.reject()}})(e,Le)))),f.on("shippingratechange",(async e=>(async(e,t)=>{try{const o=await Te.selectShippingRate({package_id:0,rate_id:e.shippingRate.id});t.update({amount:ke(parseInt(o.totals.total_price,10)-parseInt(o.totals.total_refund||0,10),o.totals)}),e.resolve({lineItems:Se(o)})}catch(t){e.reject()}})(e,Le))),f.on("confirm",(async e=>{if(!l)return(async(e,r,n,a,i,s,c=[])=>{var l;const{error:u}=await n.submit();if(u)return i(u.message);const d=null===(l=ie("flags")?.isEceUsingConfirmationTokens)||void 0===l||l;let p;if(d){const{confirmationToken:e,error:t}=await r.createConfirmationToken({elements:n});if(t)return i(t.message);p=e}else{const{paymentMethod:e,error:t}=await r.createPaymentMethod({elements:n});if(t)return i(t.message);p=e}try{const t=await Te.placeOrder({...we(s,p.id,d,c),extensions:(0,o.applyFilters)("wcpay.express-checkout.cart-place-order-extension-data",{})});var h,m;if("success"!==t.payment_result.payment_status)return i(se(null!==(h=null!==(m=t.message)&&void 0!==m?m:t.payment_result?.payment_details.find((e=>"errorMessage"===e.key))?.value)&&void 0!==h?h:""));let r=t.payment_result.redirect_url;if(!r){const e=t.payment_result.payment_details?.find((e=>"redirect"===e.key));r=e?.value||""}const n=e.confirmIntent(r);a(!0===n?r:await n)}catch(e){return e.json&&(e=await Promise.resolve(e.json())),i(se(e.message||e.payment_result?.payment_details.find((e=>"errorMessage"===e.key))?.value||(0,t.__)("There was a problem processing the order.","woocommerce-payments")))}})(a,d,Le,s.completePayment,s.abortPayment,e,m);s.abortPayment(l)})),f.on("cancel",(()=>{"product"===ie("button_context")&&u.finally((()=>{Ie().emptyCart()})),Ce&&(e=>{const t=ie("button_context"),o=ie("has_block");var r;["cart","checkout"].includes(t)&&(o?wc?.blocksCheckout?.extensionCartUpdate({namespace:"woopayments/express-checkout/refresh-ui",data:{}}):(r=e.country,["CA","GB"].includes(r)||(e=>{const t=ie("button_context"),o=(r=e,{first_name:null!==(n=r?.recipient?.split(" ")?.slice(0,1)?.join(" "))&&void 0!==n?n:"",last_name:null!==(a=r?.recipient?.split(" ")?.slice(1)?.join(" "))&&void 0!==a?a:"",company:"",address_1:null!==(i=r?.addressLine?.[0])&&void 0!==i?i:"",address_2:null!==(s=r?.addressLine?.[1])&&void 0!==s?s:"",city:null!==(c=r?.city)&&void 0!==c?c:"",state:null!==(l=r?.state)&&void 0!==l?l:"",country:null!==(u=r?.country)&&void 0!==u?u:"",postcode:null!==(d=r?.postal_code)&&void 0!==d?d:""});var r,n,a,i,s,c,l,u,d;const p=["country","state","city","postcode"];"cart"===t?(p.forEach((e=>{o[e]&&ue("form.woocommerce-shipping-calculator",`calc_shipping_${e}`,o[e])})),document.querySelector('form.woocommerce-shipping-calculator [name="calc_shipping"]')?.click()):"checkout"===t&&p.forEach((e=>{o[e]&&ue("form.woocommerce-checkout",`billing_${e}`,o[e])}))})(e)))})(Ce),Ce=null,Pe()})),f.on("ready",(e=>{(async function({availablePaymentMethods:e}){e&&(({paymentMethods:e,source:t})=>{const o={googlePay:me,applePay:he};for(const r of e){const e=o[r];e&&e({source:t})}})({paymentMethods:Object.entries(e).filter((([e,t])=>t)).map((([e,t])=>e)),source:ie("button_context")})})(e),e?.availablePaymentMethods&&Object.values(e.availablePaymentMethods).filter(Boolean).length&&(ne.showContainer(),ne.getButtonSeparator().show())}))},init:async()=>{if((0,o.removeAction)("wcpay.express-checkout.update-button-data","automattic/wcpay/express-checkout"),"product"===ie("button_context")&&"bundle"===ie("product")?.product_type&&(wcpayExpressCheckoutParams.product=void 0),!ie("product")&&!qe)try{qe=await Re()}catch(e){}qe&&(wcpayExpressCheckoutParams.product=void 0);const t=Ee();0===t?(ne.hideContainer(),ne.getButtonSeparator().hide()):qe?await s.startExpressCheckoutElement({total:t,currency:qe.totals.currency_code.toLowerCase()}):"product"===ie("button_context")&&ie("product")?await s.startExpressCheckoutElement({total:t,currency:ie("product")?.currency}):(ne.hideContainer(),ne.getButtonSeparator().hide()),(0,o.addAction)("wcpay.express-checkout.update-button-data","automattic/wcpay/express-checkout",(async()=>{if("product"===ie("button_context")&&e(".single_add_to_cart_button").is(".disabled"))ne.unblockButton();else{e(".woocommerce-error").remove();try{ne.blockButton();const e=Ee();qe=await Re(),wcpayExpressCheckoutParams.product=null,ne.unblockButton();const t=Ee();Le?t!==e&&t>0&&Le.update({amount:t}):s.init(),0===t?(ne.hideContainer(),ne.getButtonSeparator().hide()):(ne.showContainer(),ne.getButtonSeparator().show())}catch(e){ne.hideContainer()}}}))}};"checkout"===ie("button_context")&&"pay_for_order"!==ie("button_context")||s.init(),e(document.body).on("updated_cart_totals",(()=>{qe=null,s.init()})),e(document.body).on("updated_checkout",(()=>{qe=null,s.init()}))}))})()})();