/*
* Copyright (c) 2024 Apple Inc. All rights reserved.
* Apple Pay JS Software
*
* **IMPORTANT:** This Apple Pay JS Software (the "Apple Software") is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, reproduction, or installation of this Apple Software constitutes acceptance of these terms. If you do not agree with these terms, do not use, reproduce or install this Apple Software.
*
* This Apple Software is licensed to you solely for: (a) use with the Apple Pay button that you are authorized or legally permitted to embed or display on your website and (b) the purposes set forth above, and may not be used for other purposes or in other contexts without Apple's prior written permission. For the sake of clarity, you may not and agree not to or enable others to, modify or create derivative works of the Apple Software.
*
* You may only use the Apple Software if you are a member in good standing of the Apple Developer Program and have accepted the current version of the Apple Developer Program License Agreement. Your use of the Apple Software must conform with the Acceptable Use Guidelines for Apple Pay on the Web, located at https://developer.apple.com/apple-pay/acceptable-use-guidelines-for-websites/, which terms may be updated from time to time.
*
* Neither the name, trademarks, service marks or logos of Apple may be used to endorse or promote products or services without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein.
*
* Apple may provide access to services by or through the Apple Software for you to use. You agree that the services contain proprietary content, information and material that is owned by Apple and its licensors, and is protected by applicable intellectual property and other laws, and that you will not use such proprietary content, information or materials in any way whatsoever except for permitted use of the services or in any manner that is inconsistent with these terms or that infringes any intellectual property rights of a third party or Apple. Except to the extent expressly permitted in the applicable terms for the services, You agree not to reproduce, modify, rent, lease, lend, sell, distribute, or create derivative works based on the services, in any manner, and you shall not exploit the services in any unauthorized way whatsoever, including but not limited to, using the services to transmit any malware, or by trespass or burdening network capacity.
*
* In addition, services that may be accessed, linked to or displayed through the Apple Software may not be available in all languages or in all countries. Apple makes no representation that any such services would be appropriate or available for use in any particular location. Apple reserves the right to change, suspend, remove, or disable access to any services at any time. In no event will Apple be liable for the removal of or disabling of access to any such services or for any updates, maintenance, warranty, technical or other support for such services. Apple may also impose limits or other restrictions on the use of or access to the services, in any case without notice or liability. You acknowledge and agree that Apple reserves the right to revoke or remove your access to any services provided by or through the Apple Software at any time in its sole discretion.
*
* THE APPLE SOFTWARE AND SERVICES ARE PROVIDED BY APPLE ON AN "AS IS" AND "AS AVAILABLE" BASIS. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS, SYSTEMS, OR SERVICES. APPLE DOES NOT WARRANT THAT THE APPLE SOFTWARE AND SERVICES WILL MEET YOUR REQUIREMENTS, THAT THE OPERATION OF THE APPLE SOFTWARE AND SERVICES WILL BE UNINTERRUPTED OR ERROR-FREE, THAT DEFECTS IN THE APPLE SOFTWARE WILL BE CORRECTED, OR THAT THE APPLE SOFTWARE AND SERVICES WILL BE COMPATIBLE WITH FUTURE APPLE PRODUCTS, SOFTWARE OR SERVICES. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE OR AN APPLE AUTHORIZED REPRESENTATIVE WILL CREATE A WARRANTY.
*
* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) RELATING TO OR ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, OR INSTALLATION, OF THE APPLE SOFTWARE AND SERVICES BY YOU OR OTHERS, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY FOR PERSONAL INJURY, OR OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event shall Appleās total liability to you for all damages (other than as may be required by applicable law in cases involving personal injury) exceed the amount of fifty dollars ($50.00). The foregoing limitations will apply even if the above stated remedy fails of its essential purpose.
*
* **ACKNOWLEDGEMENTS:**
* https://applepay.cdn-apple.com/jsapi/v1.3.0/acknowledgements.txt
*
* 1.3.5
*/(()=>{var ue=!1;typeof window<"u"&&(oe={get passive(){ue=!0}},window.addEventListener("testPassive",null,oe),window.removeEventListener("testPassive",null,oe));var oe,ce=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),J=[],pe=!1;var ne=void 0,K=void 0,ie=void 0,Le=function(t){return J.some(function(o){return!!(o.options.allowTouchMove&&o.options.allowTouchMove(t))})},Te=function(t){var o=t||window.event;return Le(o.target)||o.touches.length>1?!0:(o.preventDefault&&o.preventDefault(),!1)};var Re=function(){ie!==void 0&&(document.body.style.paddingRight=ie,ie=void 0),ne!==void 0&&(document.body.style.overflow=ne,ne=void 0)};var Me=function(){if(K!==void 0){var t=-parseInt(document.body.style.top,10),o=-parseInt(document.body.style.left,10);document.body.style.position=K.position,document.body.style.top=K.top,document.body.style.left=K.left,window.scrollTo(o,t),K=void 0}};var he=function(t){if(!t){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}J=J.filter(function(o){return o.targetElement!==t}),ce&&(t.ontouchstart=null,t.ontouchmove=null,pe&&J.length===0&&(document.removeEventListener("touchmove",Te,ue?{passive:!1}:void 0),pe=!1)),ce?Me():Re()};var re=document.createElement("div"),He=window.ApplePaySDK?window.ApplePaySDK.publicPath:document.currentScript?.src.slice(0,document.currentScript.src.lastIndexOf("/"))||"";var me=e=>{re.dataset[e]="";let t=re.attributes[0];return re.removeAttribute(t.name),t.name.slice(5)};function W(e,t){if(!(!e||!t))for(let[o,a]of Object.entries(t))e.style.setProperty(o,a)}function y(e,t){if(!(!e||!t))for(let[o,a]of Object.entries(t))e.style[o]=a}var $={modal:{"--modal-overlay-background":"rgb(255, 255, 255)","--modal-overlay-padding-top":"76px","--modal-overlay-padding-bottom":"76px","--modal-overlay-padding-inline":"76px","--modal-close-button-offset-top":"16px","--modal-close-button-offset-inline-start":"16px","--modal-close-button-size":"44px","--modal-close-background":"rgb(232, 232, 237)","--modal-close-background-hover":"#ececf0","--modal-close-background-active":"#dfdfe4","--modal-close-color":"rgba(0, 0, 0, 0.56)","--modal-close-color-hover":"rgba(0, 0, 0, 0.72)","--modal-close-border-radius":"50%","--modal-close-button-position":"static","--modal-close-icon-size":"36px","--modal-close-icon-svg-size":"20px"},"modal-light":{"--modal-overlay-background":"rgb(255, 255, 255)","--modal-close-background":"rgb(232, 232, 237)","--modal-close-background-hover":"#ececf0","--modal-close-background-active":"#dfdfe4","--modal-close-color":"rgba(0, 0, 0, 0.56)","--modal-close-color-hover":"rgba(0, 0, 0, 0.72)"},"modal-page-overlay":{"--modal-scrim-background":"rgba(0, 0, 0, 0.48)","--modal-overlay-margin-top":"40px","--modal-overlay-margin-bottom":"var(--modal-overlay-margin-top)","--modal-overlay-border-radius-top":"18px","--modal-overlay-border-radius-bottom":"var(--modal-overlay-border-radius-top)","--modal-overlay-width":"816.6666666667px"},"modal-full-bleed":{"--modal-close-button-offset-inline-start":"max(16px, env(safe-area-inset-left))","--modal-scrim-background":"var(--modal-overlay-background)","--modal-overlay-padding-top":"96px","--modal-overlay-padding-bottom":"96px","--modal-close-button-offset-top":"max(16px, env(safe-area-inset-top))","--modal-overlay-margin-top":"none","--modal-overlay-margin-bottom":"none","--modal-overlay-border-radius-top":"none","--modal-overlay-border-radius-bottom":"none","--modal-overlay-width":"none"}},ge={modal:{"--modal-overlay-background":"rgb(29, 29, 31)","--modal-close-background":"rgb(51, 51, 54)","--modal-close-background-hover":"#37373a","--modal-close-background-active":"#2f2f32","--modal-close-color":"rgba(255, 255, 255, 0.8)","--modal-close-color-hover":"rgb(255, 255, 255)"}},C={modal:{background:"var(--modal-scrim-background, var(--modal-overlay-background))",position:"fixed",zIndex:"-1",left:"0",right:"0",top:"0",bottom:"0",display:"none",overflow:"auto"},"modal-crossfade":{display:"block",visibility:"hidden",opacity:0,transition:"opacity .4s ease,visibility 0s linear .4s,z-index 0s linear .4s"},"modal-crossfade_modal-open":{visibility:"visible",opacity:"1",transitionDelay:"0s"},"modal-open":{display:"block",zIndex:2147483647},"modal-overlay":{position:"relative",zIndex:1,display:"flex",flexDirection:"column",marginInlineStart:"auto",marginInlineEnd:"auto",boxSizing:"border-box",borderRadius:"var(--modal-overlay-border-radius-top) var(--modal-overlay-border-radius-top) var(--modal-overlay-border-radius-bottom) var(--modal-overlay-border-radius-bottom)",width:"var(--modal-overlay-width)",marginTop:"var(--modal-overlay-margin-top)",marginBottom:"var(--modal-overlay-margin-bottom)",flexGrow:"unset"},"modal-overlay-container":{boxSizing:"border-box",display:"flex",alignItems:"center",minHeight:"100%",flexDirection:"unset",height:"unset"},"modal-content-container":{background:"var(--modal-overlay-background)",order:2,boxSizing:"border-box",paddingInlineStart:"var(--modal-overlay-padding-inline)",paddingInlineEnd:"var(--modal-overlay-padding-inline)",paddingTop:"var(--modal-overlay-padding-top)",paddingBottom:"var(--modal-overlay-padding-bottom)",marginTop:"calc(-1*(44px + var(--modal-close-button-offset-top)))",borderRadius:"inherit","-webkit-mask-image":"radial-gradient(white, black)",maskImage:"radial-gradient(white, black)",flexGrow:"unset"},"modal-content_iframe":{width:"100%",height:"100%",border:"none",boxSizing:"border-box"},"modal-close-button":{cursor:"pointer",position:"var(--modal-close-button-position)",order:1,display:"flex",alignSelf:"flex-end",justifyContent:"center",alignItems:"center",zIndex:9999,height:"var(--modal-close-button-size)",width:"var(--modal-close-button-size)",margin:0,padding:0,border:0,marginInlineEnd:"var(--modal-close-button-offset-inline-start)",marginTop:"var(--modal-close-button-offset-top)",top:"var(--modal-close-button-offset-top)",background:"none",boxSizing:"content-box",color:"inherit",font:"inherit",lineHeight:"inherit",overflow:"visible",verticalAlign:"inherit"},"modal-close-icon":{background:"var(--modal-close-background)",borderRadius:"var(--modal-close-border-radius)",color:"var(--modal-close-color)",display:"flex",alignItems:"center",height:"var(--modal-close-icon-size)",width:"var(--modal-close-icon-size)",outline:"none",transition:"color 100ms linear,background 100ms linear",position:"relative",pointerEvents:"none"},"modal-close-icon_svg":{fill:"currentColor",position:"absolute",insetInlineStart:"50%",height:"var(--modal-close-icon-svg-size)",width:"var(--modal-close-icon-svg-size)",transform:"translateX(-50%)"},"modal-close-icon_hover":{background:"var(--modal-close-background-hover)",color:"var(--modal-close-color-hover)"},"modal-full-bleed":{width:"100%",borderTop:"1px solid #d2d2d7",borderBottom:"1px solid #d2d2d7",backgroundColor:"#fff",textAlign:"center"},"modal-full-bleed_modal-overlay-container":{flexDirection:"column",height:"100%"},"modal-full-bleed_modal-overlay":{flexGrow:1,width:"100%"},"modal-full-bleed_modal-content-container":{flexGrow:1,width:"100%"}};var ae=class extends HTMLElement{constructor(){super();let t=document.createElement("template");t.innerHTML='
',this._shadowRoot=this.attachShadow({mode:"closed"}),this._shadowRoot.appendChild(t.content.cloneNode(!0))}connectedCallback(){W(this._shadowRoot.querySelector(".progress-indicator"),{"--progress-indicator-size":"40px","--progress-indicator-color":"rgba(0, 0, 0, 0.56)"}),y(this._shadowRoot.querySelector(".progress-indicator"),{display:"flex"}),y(this._shadowRoot.querySelector(".progress-indicator.progress-indicator-visible"),{opacity:1}),y(this._shadowRoot.querySelector(".progress-indicator.progress-indicator-visible .progress-indicator-icon"),{opacity:1,transition:"opacity 400ms ease",willChange:"opacity"}),y(this._shadowRoot.querySelector(".progress-indicator-icon"),{width:"var(--progress-indicator-size)",height:"var(--progress-indicator-size)"}),W(this._shadowRoot.querySelector(".dark .spinner-container .progress-indicator"),{"--progress-indicator-color":"rgba(255, 255, 255, 0.8)"});let t=[{opacity:.9},{opacity:.7},{opacity:.6},{opacity:.4},{opacity:.3},{opacity:.2},{opacity:.13}],o={direction:"normal",easing:"cubic-bezier(1, 0.1, 0, 0.3)",duration:800,iterations:1/0};this._shadowRoot.querySelectorAll(".progress-indicator-icon .progress-indicator-spoke").forEach((a,p)=>{y(a,{fill:"var(--progress-indicator-color)",opacity:.2}),a.animate(t,{...o,delay:(p+1)*100})})}setTheme(t="light"){t==="dark"?W(this._shadowRoot.querySelector(".progress-indicator"),{"--progress-indicator-color":"rgba(255, 255, 255, 0.8)"}):W(this._shadowRoot.querySelector(".progress-indicator"),{"--progress-indicator-color":"rgba(0, 0, 0, 0.56)"})}},ye=ae;customElements.define("apple-spinner",ye);var X=class extends HTMLElement{constructor(){super();this.shadow=null;this.open=!1;this.ready=!1;this.url=Q.url;this.theme=Q.theme;this.locale=Q.locale;this.onModalClose=null;this.close=this.close.bind(this)}async connectedCallback(){this.shadow=this.attachShadow({mode:"open"}),this.update(),this.shadow.addEventListener("click",a=>{a.target.hasAttribute("data-modal-close")&&this.close()}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",a=>{this.applySystemThemeColor(a)}),this.shadow.addEventListener("keydown",a=>{(a.key==="Escape"||a.code==="Escape")&&this.close()})}applySystemThemeColor({matches:o}){let a=this.shadow.querySelector("#spinner-container apple-spinner");o?(W(this.shadow.querySelector(".modal"),ge.modal),a?.setTheme("dark")):(W(this.shadow.querySelector(".modal"),$["modal-light"]),a?.setTheme("light"))}show(o){this.shadow.querySelector(".modal").classList.add("modal-open");let a=()=>{o.cssVariableOverrides?.forEach(h=>{W(this.shadow.querySelector(h.selector),h.properties)}),o.cssStyleOverrides?.forEach(h=>{y(this.shadow.querySelector(h.selector),h.styles)})},p=this.shadow.querySelector(".modal-content-container"),g=p.querySelector("iframe");g&&p.removeChild(g);let A=document.createElement("iframe");A.src=this.shadow.host.getAttribute("url"),A.setAttribute("role","presentation"),A.onload=()=>{this.shadow.querySelector("#spinner-container").style.display="none",A.style.display="block"},y(A,C["modal-content_iframe"]),p.appendChild(A);let v=o.fullBleedMaxWidth||"640px",I=window.matchMedia(`(max-width: ${v})`),l=h=>{let c=this.shadow.querySelector(".modal");c.classList.contains("modal-open")&&(h.matches?(W(c,$["modal-full-bleed"]),y(c,C["modal-full-bleed"]),a(),y(c.querySelector(".modal-overlay-container"),C["modal-full-bleed_modal-overlay-container"]),y(c.querySelector(".modal-overlay"),C["modal-full-bleed_modal-overlay"]),y(c.querySelector(".modal-content-container"),C["modal-full-bleed_modal-content-container"])):(W(c,$.modal),W(c,$["modal-page-overlay"]),this.applySystemThemeColor(window.matchMedia("(prefers-color-scheme: dark)")),y(c.querySelector(".modal-overlay-container"),C["modal-overlay-container"]),y(c.querySelector(".modal-overlay"),C["modal-overlay"]),y(c.querySelector(".modal-content-container"),C["modal-content-container"]),a()),y(c,C.modal),y(c,C["modal-open"]),y(c,C["modal-crossfade_modal-open"]))};l(I),I.addEventListener("change",l),o.ariaOverrides?.forEach(h=>{this.shadow.querySelector(h.selector)?.setAttribute(h.attribute,h.value)}),this.shadow.querySelector("[role='dialog']").focus()}attributesReady(o,a){o.contentWindow.postMessage("showing",new URL(o.src).origin),Z.style.visibility="visible",o.style.visibility="visible",a?.remove(),this.open=!0}close(){this.onModalClose&&this.onModalClose(),he(this.ownerDocument.body||this.ownerDocument.documentElement),this.shadow.querySelector(".modal").classList.remove("modal-open"),y(this.shadow.querySelector(".modal"),C.modal),y(this.shadow.querySelector(".modal-crossfade"),C["modal-crossfade"]);let o=this.shadow.querySelector(".modal-content-container iframe");o?.setAttribute("src","about:blank"),o&&this.shadow.querySelector(".modal-content-container").removeChild(o)}update(){let o=document.createElement("div");o.setAttribute("data-modal-element-container",""),o.setAttribute("data-modal-close",""),o.classList.add("modal","modal-crossfade","modal-page-overlay");let a=document.createElement("div");a.setAttribute("data-modal-element-overlay-container",""),a.setAttribute("data-modal-close",""),a.classList.add("modal-overlay-container"),o.appendChild(a);let p=document.createElement("div");p.setAttribute("data-modal-element-overlay",""),p.setAttribute("data-modal-close-button-parent",""),p.setAttribute("aria-modal","true"),p.setAttribute("role","dialog"),p.setAttribute("tabindex","-1"),p.classList.add("modal-overlay"),a.appendChild(p);let g=document.createElement("div");g.classList.add("modal-content-container"),g.setAttribute("data-modal-element-content-container","");let A=document.createElement("div");A.id="spinner-container";let v=document.createElement("apple-spinner");A.style.height="100%",A.style.display="flex",A.style.alignItems="center",A.style.justifyContent="center",A.appendChild(v),g.appendChild(A);let I=document.createElement("button");I.classList.add("modal-close-button"),I.setAttribute("data-modal-element-close-button",""),I.setAttribute("data-modal-close",""),I.setAttribute("aria-label","Close");let l=document.createElement("span");l.classList.add("modal-close-icon"),l.setAttribute("data-modal-element-close-icon",""),l.setAttribute("data-modal-close",""),I.appendChild(l);let h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("data-modal-close",""),h.setAttribute("xmlns","http://www.w3.org/2000/svg"),h.setAttribute("viewBox","0 0 20 20"),l.appendChild(h);let c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttribute("data-modal-close",""),c.setAttribute("d","M12.12,10l4.07-4.06a1.5,1.5,0,1,0-2.11-2.12L10,7.88,5.94,3.81A1.5,1.5,0,1,0,3.82,5.93L7.88,10,3.81,14.06a1.5,1.5,0,0,0,0,2.12,1.51,1.51,0,0,0,2.13,0L10,12.12l4.06,4.07a1.45,1.45,0,0,0,1.06.44,1.5,1.5,0,0,0,1.06-2.56Z"),h.appendChild(c),p.appendChild(g),p.appendChild(I),this.shadow.appendChild(o);let T=this.shadow.querySelector(".modal-close-button");W(this.shadow.querySelector(".modal"),$.modal),W(this.shadow.querySelector(".modal-page-overlay"),$["modal-page-overlay"]),this.applySystemThemeColor(window.matchMedia("(prefers-color-scheme: dark)")),y(this.shadow.querySelector(".modal"),C.modal),y(this.shadow.querySelector(".modal-crossfade"),C["modal-crossfade"]),y(this.shadow.querySelector(".modal-page-overlay"),C["modal-page-overlay"]),y(this.shadow.querySelector(".modal-overlay-container"),C["modal-overlay-container"]),y(this.shadow.querySelector(".modal-overlay"),C["modal-overlay"]),y(this.shadow.querySelector(".modal-content-container"),C["modal-content-container"]),y(T,C["modal-close-button"]),y(this.shadow.querySelector(".modal-close-icon"),C["modal-close-icon"]),y(this.shadow.querySelector(".modal-close-icon svg"),C["modal-close-icon_svg"]),T.addEventListener("mouseover",()=>{y(T.querySelector(".modal-close-icon"),C["modal-close-icon_hover"])}),T.addEventListener("mouseout",()=>{y(this.shadow.querySelector(".modal-close-icon"),C["modal-close-icon"])})}static get observedAttributes(){return[ke,"open"]}},Q={theme:"auto",locale:"en-US",url:""},fe="apple-pay-modal",ke=Object.keys(Q).map(me);Object.assign(X.prototype,Q);customElements.define(fe,X);var Z=document.createElement(fe);Z.style.visibility="hidden";document.contains(Z)||(document.body||document.documentElement).appendChild(Z);var G=Z;var Y=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};var Oe=typeof Y=="object"&&Y&&Y.Object===Object&&Y,qe=Oe,Ue=qe,Ne=typeof self=="object"&&self&&self.Object===Object&&self,Be=Ue||Ne||Function("return this")(),_e=Be;var De=_e,Fe=De.Symbol,ve=Fe,we=ve,Se=Object.prototype,et=Se.hasOwnProperty,tt=Se.toString,ot=we?we.toStringTag:void 0;var We=Object.prototype,nt=We.toString;var be=ve;var it=be?be.toStringTag:void 0;var ee=class{constructor(){this.userAgent=window.navigator.userAgent,this.isAndroid=/android/i.test(this.userAgent),this.isEdgiOS=/edgios/i.test(this.userAgent),this.isEdgA=/edga/i.test(this.userAgent),this.isEdge=!this.isEdgiOS&&!this.isEdgA&&/edge/i.test(this.userAgent),this.isFirefoxiOS=!this.isEdge&&/fxios/i.test(this.userAgent),this.isChrome=!this.isEdge&&!this.isFirefoxiOS&&/chrome/i.test(this.userAgent),this.isCrios=!this.isEdge&&!this.isFirefoxiOS&&!this.isChrome&&/crios/i.test(this.userAgent),this.isSafari=!this.isAndroid&&!this.isEdgiOS&&!this.isEdge&&!this.isFirefoxiOS&&!this.isChrome&&!this.isCrios&&/safari/i.test(this.userAgent),this.isMobileSafari=!this.isAndroid&&!this.isEdge&&!this.isFirefoxiOS&&!this.isChrome&&!this.isCrios&&this.isBrowserMobileSafari(),this.isFirefoxAndroid=this.isAndroid&&!this.isFirefoxiOS&&!this.isEdge&&!this.isChrome&&!this.isSafari&&/firefox/i.test(this.userAgent),this.isFirefox=!this.isFirefoxAndroid&&!this.isFirefoxiOS&&!this.isEdge&&!this.isChrome&&!this.isSafari&&/firefox/i.test(this.userAgent),this.isIE=!this.isEdge&&!this.isChrome&&!this.isSafari&&!this.isFirefox&&/trident|msie/i.test(this.userAgent),this.isWindows=!!/windows/i.test(this.userAgent),this.isOpera=!!/opera/i.test(this.userAgent),this.isMobilesafariwebview=this.isMobileSafari&&/^((?!safari).)*$/i.test(this.userAgent),this.isFacebookMessengeriOSwebview=this.isDeviceIOS()&&/fban\/messengerforios;/i.test(this.userAgent),this.islinkedIniOSwebview=/applewebkit\/(\d+)[.*\d+]+ .*mobile\/(\d+[A-z]*\d+).*LinkedInApp/i.test(this.userAgent),this.isGoogleBot=/\sgooglebot\//i.test(this.userAgent),this.supportedBrowserConfig={chrome:{browserVersion:37},firefox:{browserVersion:68},opera:{browserVersion:24},safari:{browserVersion:10},edge:{browserVersion:16},crios:{browserVersion:37},linkedIniOSwebview:{iOSVersion:8},mobilesafariwebview:{iOSVersion:8},facebookMessengeriOSwebview:{iOSVersion:8},mobilesafari:{iOSVersion:8},googlebot:{browserVersion:1},fxios:{iOSVersion:8},firefoxA:{browserVersion:68},otherwise:!1}}isBrowserMobileSafari(){let t=this.isDeviceIOS();return/apple.*mobile/i.test(this.userAgent)&&t}isDeviceIOS(){let t=((this.userAgent.split(/\s*[;)(]\s*/)||[])[1]||"").toLowerCase();return t==="ipad"||t.indexOf("ipod")>=0||t==="iphone"}getBrowserFinders(){return{safari:{isBrowserMatches:this.isSafari,regexp:/version\/(\d+\.*\d+).*?safari/i},firefox:{isBrowserMatches:this.isFirefox,regexp:/firefox\/(\d+\.*\d+)/i},firefoxA:{isBrowserMatches:this.isFirefoxAndroid,regexp:/firefox\/(\d+\.*\d+)/i},chrome:{isBrowserMatches:this.isChrome,regexp:/chrome\/(\d+\.*\d+)/i},opera:{isBrowserMatches:this.isOpera,regexp:/version\/(\d+\.*\d+)/i},ie:{isBrowserMatches:this.isIE,regexp:/(msie |trident.*?rv:)(\d+\.*\d+)/i},edge:{isBrowserMatches:this.isEdge,regexp:/(edge|edg)\/(\d+\.*\d+)/i},crios:{isBrowserMatches:this.isCrios,regexp:/crios\/(\d+\.*\d+)/i},android:{isBrowserMatches:this.isAndroid,regexp:/android (\d+\.*\d*)/i},googlebot:{isBrowserMatches:this.isGoogleBot,regexp:/googlebot\/(\d+\.*\d+)/i},mobilesafari:{isBrowserMatches:this.isMobileSafari,regexp:null},mobilesafariwebview:{isBrowserMatches:this.isMobilesafariwebview,regexp:null},facebookMessengeriOSwebview:{isBrowserMatches:this.isFacebookMessengeriOSwebview,regexp:null},linkedIniOSwebview:{isBrowserMatches:this.islinkedIniOSwebview,regexp:null},fxios:{isBrowserMatches:this.isFirefoxiOS,regexp:/FxiOS\/(\d+\.*\d+)/i}}}getUserAgentVersion(t,o){let a=0,p,g="";if(g=o||t.regexp,g)try{p=this.userAgent.match(g),p&&(a=parseInt(p[p.length-1],10))}catch{}return a}getUserAgentVersionDetails(t){let o=/OS\s(\d+_*\d+)/i,a=/AppleWebKit\/(\d+\.*\d+)/i,p=/android (\d+\.*\d*)/i;return{browserVersion:this.getUserAgentVersion(t),appleWebKitVersion:this.getUserAgentVersion(t,a),iOSVersion:this.getUserAgentVersion(t,o),andriodVersion:this.getUserAgentVersion(t,p)}}isBrowserVersionAtLeast(t){let o,a,p,g=this.getBrowserFinders();for(o in t)if(o!=="otherwise"&&g[o].isBrowserMatches)return a=this.getUserAgentVersion(g[o]),p=t[o],p===-1?!1:a>=p;return!!t.otherwise}isBrowserVersionAtLeastV2(t){let o,a,p,g=this.getBrowserFinders(),A=!1;for(o in t)if(o!=="otherwise"&&g[o].isBrowserMatches)return a=this.getUserAgentVersionDetails(g[o]),p=t[o],Object.keys(p).forEach(v=>{let I=p[v];a[v]>=I&&(A=!0)}),A;return!!t.otherwise}isOnSupportedBrowserV2(){return this.isBrowserVersionAtLeastV2(this.supportedBrowserConfig)}isOnSupportedBrowser(){return this.isBrowserVersionAtLeast({chrome:37,firefox:34,opera:24,safari:10,edge:16,crios:37,android:2,linkedIniOSwebview:8,mobilesafariwebview:8,facebookMessengeriOSwebview:8,mobilesafari:8,googlebot:1,fxios:8,otherwise:!1})}};function te(){if(window.location.protocol!=="https:")throw"InvalidAccessError: Trying to start an Apple Pay session from an insecure document."}function Ae(e){if(typeof e=="number")return e.toString();if(typeof e=="string"&&!isNaN(parseFloat(e)))return e;throw new TypeError(`"${e}" is not a valid amount.`)}function _(e){"amount"in e&&(e.amount=Ae(e.amount)),"automaticReloadPaymentThresholdAmount"in e&&(e.automaticReloadPaymentThresholdAmount=Ae(e.automaticReloadPaymentThresholdAmount))}function Pe(e){if(e){if(!e.merchantCapabilities)throw new TypeError("Member ApplePayPaymentRequest.merchantCapabilities is required and must be an instance of sequence");if(!e.supportedNetworks)throw new TypeError("Member ApplePayPaymentRequest.supportedNetworks is required and must be an instance of sequence");if(!e.currencyCode)throw new TypeError("Member ApplePayPaymentRequest.currencyCode is required and must be an instance of DOMString");if(!e.countryCode)throw new TypeError("Member ApplePayPaymentRequest.countryCode is required and must be an instance of DOMString");if(!e.total)throw new TypeError("Member ApplePayPaymentRequest.total is required and must be an instance of ApplePayLineItem");_(e.total),e.lineItems&&e.lineItems.forEach(t=>_(t)),e.shippingMethods&&e.shippingMethods.forEach(t=>_(t)),e.multiTokenContexts&&e.multiTokenContexts.forEach(t=>_(t)),e.automaticReloadPaymentRequest&&_(e.automaticReloadPaymentRequest.automaticReloadBilling),e.recurringPaymentRequest&&(_(e.recurringPaymentRequest.regularBilling),e.recurringPaymentRequest.trialBilling&&_(e.recurringPaymentRequest.trialBilling)),e.deferredPaymentRequest&&_(e.deferredPaymentRequest.deferredBilling)}}function Ce(e){if(e){if(!e.newTotal)throw new TypeError("Member ApplePayPaymentMethodUpdate.newTotal is required and must be an instance of ApplePayLineItem");_(e.newTotal),e.newLineItems&&e.newLineItems.forEach(t=>_(t)),e.newShippingMethods&&e.newShippingMethods.forEach(t=>_(t)),e.newMultiTokenContexts&&e.newMultiTokenContexts.forEach(t=>_(t)),e.newAutomaticReloadPaymentRequest&&_(e.newAutomaticReloadPaymentRequest.automaticReloadBilling),e.newRecurringPaymentRequest&&(_(e.newRecurringPaymentRequest.regularBilling),e.newRecurringPaymentRequest.trialBilling&&_(e.newRecurringPaymentRequest.trialBilling)),e.newDeferredPaymentRequest&&_(e.newDeferredPaymentRequest.deferredBilling)}}function Ve(e){let t=new URL(e);return t.search="",t.toString()}function se(){let e=window.location.href;return window.self!==window.top&&(window.location.ancestorOrigins?window.location.ancestorOrigins.length&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]):e=document.referrer),Ve(e)}(function(){if(window.ApplePaySession)ApplePaySession.applePayCapabilities=async e=>{if(!ApplePaySession.canMakePayments())return Promise.resolve({paymentCredentialStatus:"applePayUnsupported"});let t=await ApplePaySession.canMakePaymentsWithActiveCard(e);return Promise.resolve({paymentCredentialStatus:t?"paymentCredentialsAvailable":"paymentCredentialsUnavailable"})};else{let e=document.currentScript&&document.currentScript.src?document.currentScript.src:"",t=e.slice(0,e.lastIndexOf("/"))||"",o=t?new URL(t).origin:"",a=new URL(t),p=`${o}${a.pathname}`,g={MODAL:"modal",WINDOW:"window"},A=null,v=!1,I="";window.onbeforeunload=()=>{l.closeApplePayCodeWindow()};let l={applePayCodeNewWin:null,applePayCloseCallback:null,getRenderMode:()=>g.MODAL,getMerchantUrlOverride:()=>"",focusApplePayCodeWindow:()=>{l.applePayCodeNewWin&&l.applePayCodeNewWin.focus()},closeApplePayCodeWindow:()=>{l.applePayCodeNewWin&&l.applePayCodeNewWin.close()}};window.ApplePaySession=class{constructor(h,c){te(),Pe(c);let T=null,M=null,R={},k=g.MODAL,V=!1,N=!1,H=!1,n={origin:window.location.origin},d=new URLSearchParams(window.location.search).get("websocket");d&&(n.ws=d);let u={};function f(r,s){let B=window.screenX+(window.outerWidth-640)/2,m=window.screenY+(window.outerHeight-617)/2,b=`left=${B},top=${m},width=640,height=617,toolbar=no,menubar=no`,P=new URLSearchParams(n).toString(),O=`${p}/applepaycode/index.html?newWin=true${P?"&"+P:""}`;M=window.open(O,"apple-pay-code",b);let z=0;if(M){l.applePayCodeNewWin=M;let F=Array.from(document.querySelectorAll('link[rel="apple-touch-icon"], link[rel="apple-touch-icon-precomposed"]')),j=F.length?F.map(xe=>new URL(xe.getAttribute("href"),window.location.href).href):[new URL("apple-touch-icon-80x80.png",window.location.origin).href,new URL("apple-touch-icon-80x80-precomposed.png",window.location.origin).href,new URL("apple-touch-icon.png",window.location.origin).href,new URL("apple-touch-icon-precomposed.png",window.location.origin).href],Ee={paymentRequest:r,originatingURL:se(),userAgent:navigator.userAgent,thumbnailURLs:j,requestType:s},Ie={merchantUrl:window.location.origin,merchantId:I,sdkUrl:e,applePayAPIType:s},le={},de=l.getMerchantUrlOverride();return de&&(le.merchantUrlOverride=de),T=setInterval(()=>{q("paymentRequestCreatedMsg",{paymentRequest:Ee,metadata:Ie,options:le}),z>60&&clearInterval(T),z++},500),!0}return!1}function D(r,s){let E=`${p}/applepaycode/index.html?${new URLSearchParams(n).toString()}`;G.setAttribute("url",E),G.show({url:E,cssVariableOverrides:[{selector:".modal",properties:{"--modal-overlay-padding-top":"0","--modal-overlay-padding-bottom":"0","--modal-overlay-padding-inline":"0","--modal-overlay-width":"576px","--modal-overlay-border-radius-top":"34px","--modal-close-button-offset-top":"12px","--modal-close-button-offset-inline-start":"12px"}},{selector:".modal-full-bleed",properties:{"--modal-close-button-offset-inline-start":"max(12px, env(safe-area-inset-left))","--modal-close-button-offset-top":"max(12px, env(safe-area-inset-top))"}}],cssStyleOverrides:[{selector:".modal-content-container",styles:{width:"576px",height:"576px"}}],ariaOverrides:[{selector:"[role='dialog']",attribute:"aria-label",value:"Pay with Apple Pay"}]});let w=window.matchMedia("(max-width: 640px)"),B=({matches:F})=>{q("isSmallViewPort",F)};w.addEventListener("change",B),G.shadowRoot.querySelector("iframe")&&(M=G.shadowRoot.querySelector("iframe").contentWindow),B(w);let m=0,b=Array.from(document.querySelectorAll('link[rel="apple-touch-icon"], link[rel="apple-touch-icon-precomposed"]')),P=b.length?b.map(F=>new URL(F.getAttribute("href"),window.location.href).href):[new URL("apple-touch-icon-80x80.png",window.location.origin).href,new URL("apple-touch-icon-80x80-precomposed.png",window.location.origin).href,new URL("apple-touch-icon.png",window.location.origin).href,new URL("apple-touch-icon-precomposed.png",window.location.origin).href],O={paymentRequest:r,originatingURL:se(),userAgent:navigator.userAgent,thumbnailURLs:P,requestType:s},z={merchantUrl:window.location.origin,merchantId:I,sdkUrl:e,applePayAPIType:s};return T=setInterval(()=>{q("paymentRequestCreatedMsg",{paymentRequest:O,metadata:z}),B(w),m>10&&clearInterval(T),m++},500),!0}function q(r,s={}){M&&M.postMessage({messageType:r,messageBody:s},o)}this.onvalidatemerchant=null,this.completeMerchantValidation=r=>{q("merchantSessionCreatedMsg",{messageId:R.readyForMerchantValidation,merchantSession:r})},this.onpaymentauthorized=null,this.completePayment=r=>{let s=r;if(!(typeof update=="object"&&"status"in update))switch(r){case ApplePaySession.STATUS_SUCCESS:s={status:ApplePaySession.STATUS_SUCCESS};break;case ApplePaySession.STATUS_INVALID_BILLING_POSTAL_ADDRESS:s={status:ApplePaySession.STATUS_FAILURE,errors:[new ApplePayError("billingContactInvalid","postalAddress","Postal Address Invalid")]};break;case ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS:s={status:ApplePaySession.STATUS_FAILURE,errors:[new ApplePayError("shippingContactInvalid","postalAddress","Postal Address Invalid")]};break;case ApplePaySession.STATUS_INVALID_SHIPPING_CONTACT:s={status:ApplePaySession.STATUS_FAILURE,errors:[new ApplePayError("shippingContactInvalid","phoneNumber","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","emailAddress","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","name","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","postalAddress","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","addressLines","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","locality","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","subLocality","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","postalCode","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","administrativeArea","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","subAdministrativeArea","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","country","Shipping Contact Invalid"),new ApplePayError("shippingContactInvalid","countryCode","Shipping Contact Invalid")]};break;case ApplePaySession.STATUS_PIN_INCORRECT:case ApplePaySession.STATUS_PIN_LOCKOUT:case ApplePaySession.STATUS_PIN_REQUIRED:case ApplePaySession.STATUS_FAILURE:s={status:ApplePaySession.STATUS_FAILURE,errors:[new ApplePayError("unknown")]};break}q("merchantPaymentCompleteMsg",{messageId:R.paymentAuthorizedMsg,result:s}),delete R.paymentAuthorizedMsg},this.onpaymentmethodselected=null,this.completePaymentMethodSelection=(...r)=>{let s=r[0];if(r.length>1||!L(s)){let[E,w]=r;s={newTotal:E},w&&w.length&&(s.newLineItems=w)}x("paymentMethodSelected",s)},this.onshippingcontactselected=null,this.completeShippingContactSelection=(...r)=>{let s=r[0];if(r.length>1||!L(s)){let[E,w,B,m]=r;s={newTotal:B},w&&w.length&&(s.newShippingMethods=w),m&&m.length&&(s.newLineItems=m),E===ApplePaySession.STATUS_FAILURE?s.errors=[new ApplePayError("unknown")]:E===ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS&&(s.errors=[new ApplePayError("shippingContactInvalid","postalCode","ZIP Code is invalid")])}x("shippingContactSelected",s)},this.onshippingmethodselected=null,this.completeShippingMethodSelection=(...r)=>{let s=r[0];if(r.length>1||!L(s)){s={};let[E,w,B]=r;E===ApplePaySession.STATUS_SUCCESS&&(s={newTotal:w},B&&B.length&&(s.newLineItems=B))}x("shippingMethodSelected",s)},this.oncouponcodechanged=null,this.completeCouponCodeChange=r=>{x("couponCodeChanged",r)},this.oncancel=null,this.abort=()=>{U()},this.begin=(r="applepaysession")=>{if(v)throw l.getRenderMode()===g.WINDOW&&l.focusApplePayCodeWindow(),"InvalidAccessError: Page already has an active payment session.";l.closeApplePayCodeWindow(),v=!0,r==="payreqapi"&&(I=c.merchantIdentifier),window.removeEventListener("message",A),clearInterval(T),window.addEventListener("message",S),k=l.getRenderMode(),A=S,k===g.WINDOW?f(c,r==="payreqapi"?"paymentRequestAPI":"applePayJSAPI"):D(c,r==="payreqapi"?"paymentRequestAPI":"applePayJSAPI")};let x=(r,s)=>{let E={messageId:R[r],updateType:r};s&&Object.keys(s).length&&(Ce(s),E.update=s),q("paymentRequestMerchantUpdatedMsg",E),delete R[r]},S=r=>{if(!(!r.isTrusted||r.origin!==o))switch(r.data.messageType){case"paymentRequestCreatedMsgResponse":clearInterval(T);break;case"paymentRequestUserUpdatedMsg":switch(R[r.data.messageBody.updateType]=r.data.messageHeaders.messageId,r.data.messageBody.updateType){case"readyForMerchantValidation":this.onvalidatemerchant&&this.onvalidatemerchant({target:this,srcElement:this,...r.data.messageBody.paymentRequest});break;case"paymentMethodSelected":this.onpaymentmethodselected?this.onpaymentmethodselected({target:this,srcElement:this,...r.data.messageBody.paymentRequest}):x(r.data.messageBody.updateType);break;case"shippingContactSelected":this.onshippingcontactselected?this.onshippingcontactselected({target:this,srcElement:this,...r.data.messageBody.paymentRequest}):x(r.data.messageBody.updateType);break;case"shippingMethodSelected":this.onshippingmethodselected?this.onshippingmethodselected({target:this,srcElement:this,...r.data.messageBody.paymentRequest}):x(r.data.messageBody.updateType);break;case"couponCodeChanged":this.oncouponcodechanged?this.oncouponcodechanged({target:this,srcElement:this,...r.data.messageBody.paymentRequest}):x(r.data.messageBody.updateType);break;default:console.warn("Unexpected:",r.data.messageBody.updateType)}break;case"paymentAuthorizedMsg":R.paymentAuthorizedMsg=r.data.messageHeaders.messageId,this.onpaymentauthorized&&this.onpaymentauthorized({target:this,srcElement:this,...r.data.messageBody});break;case"paymentSheetShownSuccess":V=!0;break;case"paymentSheetClosed":N=!0,U();break;case"close":U();break;case"successClose":H=!0,U();break;case"keydownEvent":(r.data.messageBody.key==="Escape"||r.data.messageBody.code==="Escape")&&U();break;case"windowclosing":if(!v)return;v=!1,k===g.WINDOW&&!N&&!H&&this.oncancel&&this.oncancel(),l.applePayCloseCallback&&l.applePayCloseCallback();break;default:console.warn("Unexpected message:",r.data.messageType)}};function L(r){return typeof r=="object"&&"newTotal"in r}let U=()=>{v=!1,k===g.WINDOW?(!H&&this.oncancel&&this.oncancel(),l.closeApplePayCodeWindow(),l.applePayCloseCallback&&l.applePayCloseCallback()):G.close()};G.onModalClose=()=>{v=!1,!H&&this.oncancel&&this.oncancel(),l.applePayCloseCallback&&l.applePayCloseCallback(),window.dispatchEvent(new Event("apple-pay-close"))}}static canMakePayments(){if(te(),navigator.userAgentData&&navigator.userAgentData.mobile)return!1;let h=new ee;return h.isBrowserVersionAtLeastV2({firefoxA:{browserVersion:63},otherwise:!1})?/Tablet/i.test(navigator.userAgent):h.isBrowserVersionAtLeastV2({chrome:{browserVersion:54},firefox:{browserVersion:63},opera:{browserVersion:40},safari:{browserVersion:10},edge:{browserVersion:79},otherwise:!1})}static canMakePaymentsWithActiveCard(h){try{I=h;let c=this.canMakePayments();return Promise.resolve(c)}catch(c){return Promise.reject(c)}}static supportsVersion(h){return te(),!0}static applePayCapabilities(h){return I=h,Promise.resolve({paymentCredentialStatus:this.canMakePayments()?"paymentCredentialStatusUnknown":"applePayUnsupported"})}static STATUS_SUCCESS=0;static STATUS_FAILURE=1;static STATUS_INVALID_BILLING_POSTAL_ADDRESS=2;static STATUS_INVALID_SHIPPING_POSTAL_ADDRESS=3;static STATUS_INVALID_SHIPPING_CONTACT=4;static STATUS_PIN_REQUIRED=5;static STATUS_PIN_INCORRECT=6;static STATUS_PIN_LOCKOUT=7;static isNotWebkit=!0},window.ApplePayWebOptions=function(){let h=[g.MODAL,g.WINDOW],c=g.MODAL,T=null,M="";l.getRenderMode=()=>c,l.getMerchantUrlOverride=()=>M;function R(k){if(!k)return;let V=[];if(k.renderApplePayCodeAs){let N=!1;typeof k.renderApplePayCodeAs!="string"&&(N=!0,V.push("TypeError: renderApplePayCodeAs must a string")),!N&&!h.includes(k.renderApplePayCodeAs)&&(N=!0,V.push("renderApplePayCodeAs must be one of:",'"'+h.join('", "')+'"')),N||(c=k.renderApplePayCodeAs)}if(k.onApplePayCodeClose){let N=!1;typeof k.onApplePayCodeClose!="function"&&(N=!0,V.push("TypeError: onApplePayCodeClose must a function")),N||(T=k.onApplePayCodeClose,l.applePayCloseCallback=T)}if(k.merchantUrl){let N=!1;typeof k.merchantUrl!="string"&&(N=!0,V.push("TypeError: merchantUrl must a string")),N||(M=k.merchantUrl)}V.length&&V.forEach(N=>{console.error(N)})}return{set:R,focusApplePayCodeWindow:l.focusApplePayCodeWindow,closeApplePayCodeWindow:l.closeApplePayCodeWindow}}()}window.ApplePayError||(window.ApplePayError=class{constructor(e,t=null,o="",a=null){this.code=e,this.contactField=t,this.message=o,this.domain=a}})})();(function(){if(window.PaymentRequest&&window.ApplePaySession.isNotWebkit){let I=function(n,i){if(n.currency!==i)throw new Error(`${n.currency} does not match the expected currency of ${i}`)},l=function(n,i){I(n.amount,i);let d={...n};return delete d.amount,delete d.pending,{amount:n.amount.value,type:n.pending?v.PENDING_LINE_ITEM:v.FINAL_LINE_ITEM,...d}},h=function(n){try{if(!n.shippingOptions||n.shippingOptions.length===0)return[];let i=[],d=n.total.amount.currency;return n.shippingOptions&&n.shippingOptions.forEach(u=>{typeof u=="object"&&(I(u.amount,d),i.push({amount:u.amount.value,label:u.label||"",detail:u.detail||"",identifier:u.id||""}))}),i}catch(i){console.error(i)}},c=function(n){let i={},d="";return n&&n.total&&n.total.amount&&(d=n.total.amount.currency),i.total=l(n.total,d),n.displayItems&&(i.lineItems=[],n.displayItems.forEach(u=>{i.lineItems.push(l(u,d))})),i},T=function(n,i,d){let u=null;if(n){u={};for(let f of n){if(f.supportedMethods!==v.methodName)continue;if(f.total&&(u.total=l(f.total,i)),f.additionalDisplayItems){let L=[];f.additionalDisplayItems.forEach(U=>{L.push(l(U,i))}),L.length&&(u.additionalLineItems=L)}if(!f.data||Object.keys(f.data).length===0)break;let D=f.data.paymentMethodType;if(D&&D!==d)continue;f.total=f.data.total||f.total;let q=f.data.additionalLineItems;q&&q.length&&(u.additionalLineItems?u.additionalLineItems=u.additionalLineItems.concat(q):u.additionalLineItems=q);let x=f.data.additionalShippingMethods;x&&x.length&&(u.additionalShippingMethods=x);let S=f.data.multiTokenContexts;S&&S.length&&(u.multiTokenContexts=S),f.data.automaticReloadPaymentRequest&&(u.automaticReloadPaymentRequest=f.data.automaticReloadPaymentRequest),f.data.recurringPaymentRequest&&(u.recurringPaymentRequest=f.data.recurringPaymentRequest),f.data.deferredPaymentRequest&&(u.deferredPaymentRequest=f.data.deferredPaymentRequest),f.data.disbursementRequest&&(u.disbursementRequest=f.data.disbursementRequest);break}}return u},M=function(n,i){let d={};return i&&(i.total&&(d.total=i.total),d.lineItems=[],i.lineItems&&(d.lineItems=n.lineItems.concat(i.lineItems)),i.additionalLineItems&&i.additionalLineItems.forEach(u=>{u.disbursementLineItemType==="disbursement"?d.total={...u,type:v.FINAL_LINE_ITEM}:d.lineItems.push(u)}),i.additionalShippingMethods&&(n.shippingMethods&&n.shippingMethods.length?d.shippingMethods=[...n.shippingMethods,...i.additionalShippingMethods]:d.shippingMethods=[...i.additionalShippingMethods]),i.recurringPaymentRequest&&(d.recurringPaymentRequest=i.recurringPaymentRequest),i.deferredPaymentRequest&&(d.deferredPaymentRequest=i.deferredPaymentRequest),i.automaticReloadPaymentRequest&&(d.automaticReloadPaymentRequest=i.automaticReloadPaymentRequest),i.multiTokenContexts&&(d.multiTokenContexts=i.multiTokenContexts),i.disbursementRequest&&(d.disbursementRequest=i.disbursementRequest)),d},V=function(n){let i=n.addressLines;return i.length===1&&!i[0]&&(i=[]),new k(n.locality,n.countryCode,n.subLocality,"",n.phoneNumber,n.postalCode,`${n.givenName} ${n.familyName}`,n.administrativeArea,"",i)};var e=I,t=l,o=h,a=c,p=T,g=M,A=V;let v={PENDING_LINE_ITEM:"pending",FINAL_LINE_ITEM:"final",COMPLETE_SUCCESS:"success",COMPLETE_FAIL:"fail",methodName:"https://apple.com/apple-pay"},R=function(n,i,d){let u="";n&&n.total&&n.total.amount&&(u=n.total.amount.currency);let f=d?d.type:null,D=c(n),q=h(n);q.length&&(D.shippingMethods=[...q]),D={...D,...M(D,T(n.modifiers,u,f))};let x={};if(Object.keys(i).length){let U=u;i&&i.total&&i.total.amount&&(U=i.total.amount.currency),x=c(i);let r=h(i);r.length&&(x.shippingMethods=[...r]),x={...x,...M(x,T(i.modifiers,U,f))}}let S={...D,...x},L={};return L.newTotal=S.total,S.lineItems&&(L.newLineItems=S.lineItems),S.recurringPaymentRequest&&(L.newRecurringPaymentRequest=S.recurringPaymentRequest),S.deferredPaymentRequest&&(L.newDeferredPaymentRequest=S.deferredPaymentRequest),S.automaticReloadPaymentRequest&&(L.newAutomaticReloadPaymentRequest=S.automaticReloadPaymentRequest),S.multiTokenContexts&&(L.newMultiTokenContexts=S.multiTokenContexts),S.disbursementRequest&&(L.newDisbursementRequest=S.disbursementRequest),S.shippingMethods&&(L.newShippingMethods=S.shippingMethods),L},k=function(n,i,d,u,f,D,q,x,S,L){return{get city(){return n||""},get country(){return i||""},get dependentLocality(){return d||""},get organization(){return u||""},get phone(){return f||""},get postalCode(){return D||""},get recipient(){return q||""},get region(){return x||""},get sortingCode(){return S||""},get addressLine(){return L||[]}}},N=(()=>{let n=null,i=null,d="shipping";return class extends EventTarget{constructor(f,D,q,x){super(),this.id=x,this.applepay={methodData:f[0],details:D,options:q},this.abort=null,this.canMakePayment=()=>new Promise((S,L)=>{S(ApplePaySession.canMakePayments())}),this.onshippingaddresschange=null,this.onshippingoptionchange=null,this.onpaymentmethodchange=null,this.show=()=>new Promise((S,L)=>{try{let U=c(this.applepay.details),r=h(this.applepay.details),s="";this.applepay.details&&this.applepay.details.total&&this.applepay.details.total.amount&&(s=this.applepay.details.total.amount.currency),r.length&&(U.shippingMethods=[...r]),U={...U,...M(U,T(this.applepay.details.modifiers,s))};let E={currencyCode:s,...this.applepay.methodData.data,...U};if(this.applepay.options&&Object.keys(this.applepay.options).length>0){let m=[],b=[];for(let P in this.applepay.options){if(P==="shippingType"){E.shippingType=this.applepay.options[P],d=E.shippingType;continue}if(this.applepay.options[P])switch(P){case"requestPayerName":b.push("name");break;case"requestBillingAddress":m.push("postalAddress"),m.push("name");break;case"requestPayerEmail":b.push("email");break;case"requestPayerPhone":b.push("phone");break;case"requestShipping":b.push("postalAddress");break}}E.requiredBillingContactFields=E.requiredBillingContactFields?[...E.requiredBillingContactFields,...m]:[...m],E.requiredShippingContactFields=E.requiredShippingContactFields?[...E.requiredShippingContactFields,...b]:[...b]}let w=new ApplePaySession(3,E);w.onvalidatemerchant=m=>{let b=async function(O){try{w.completeMerchantValidation(await O)}catch(z){console.error("onvalidatemerchant error:",z)}},P=new Event("merchantvalidation");P.methodName=v.methodName,P.validationURL=m.validationURL,P.complete=b,this.onmerchantvalidation?this.onmerchantvalidation(P):this.dispatchEvent(P)},this.onpaymentmethodchange&&(w.onpaymentmethodselected=m=>{let b=new PaymentRequestUpdateEvent("paymentmethodchange");b.methodName=v.methodName,b.methodDetails=m.paymentMethod,b.updateWith=P=>{w.completePaymentMethodSelection(R(this.applepay.details,P,m.paymentMethod))},this.onpaymentmethodchange(b)},w.oncouponcodechanged=m=>{let b=new PaymentRequestUpdateEvent("paymentmethodchange");b.methodName=v.methodName,b.methodDetails=m,b.updateWith=P=>{w.completeCouponCodeChange(R(this.applepay.details,P,m.paymentMethod))},this.onpaymentmethodchange(b)}),this.onshippingaddresschange&&(w.onshippingcontactselected=m=>{n=V(m.shippingContact);let b=new PaymentRequestUpdateEvent("shippingaddresschange");b.updateWith=P=>{w.completeShippingContactSelection(R(this.applepay.details,P,m.paymentMethod))},this.onshippingaddresschange(b)}),this.onshippingoptionchange&&(w.onshippingmethodselected=m=>{i=m.shippingMethod.identifier;let b=new PaymentRequestUpdateEvent("shippingoptionchange");b.updateWith=P=>{let O=R(this.applepay.details,P,m.paymentMethod);delete O.errors,w.completeShippingMethodSelection(O)},this.onshippingoptionchange(b)}),this.abort=w.abort;let B={isRetry:!1,promiseResolve:null};w.onpaymentauthorized=m=>{let b=this.id,P=this.shippingOption,O={get requestId(){return b},get methodName(){return v.methodName},get details(){return m.payment},get shippingOption(){return P},complete:function(z,F){let j={};switch(F&&F.data&&(j={...F.data}),z){case v.COMPLETE_SUCCESS:j.status=window.ApplePaySession.STATUS_SUCCESS;break;case v.COMPLETE_FAIL:default:j.status=window.ApplePaySession.STATUS_FAILURE}return Promise.resolve(w.completePayment(j))},retry:function(z){let F={};return F.status=window.ApplePaySession.STATUS_FAILURE,F.errors=z.paymentMethod||[],w.completePayment(F),B.isRetry=!0,new Promise(j=>{B.promiseResolve=j})}};this.applepay.options.requestShipping&&(O={...O,get shippingAddress(){return V(m.payment.shippingContact)}}),this.applepay.options.requestPayerName&&(O={...O,get payerName(){return`${m.payment.shippingContact.givenName} ${m.payment.shippingContact.familyName}`}}),this.applepay.options.requestPayerEmail&&(O={...O,get payerEmail(){return m.payment.shippingContact.emailAddress}}),this.applepay.options.requestPayerPhone&&(O={...O,get payerPhone(){return m.payment.shippingContact.phoneNumber}}),B.isRetry&&B.promiseResolve?B.promiseResolve(O):S(O)},w.oncancel=()=>{L(new Error("Cancelled"))},w.begin("payreqapi")}catch(U){L(U)}})}get shippingAddress(){return n}get shippingOption(){return i}get shippingType(){return d}}})(),H=PaymentRequest;PaymentRequest=function(n,i,d){if(new.target)if(n.length===1&&(n[0].supportedMethods===v.methodName||n[0].supportedMethods.indexOf(v.methodName)!==-1)){let u=new H(n,i,d);return new N(n,i,d,u.id)}else return new H(n,i,d);else return H(n,i,d)}}})();(function(){let e=document.currentScript,t=()=>{let o={"apple-pay-button":"apple-pay-button.js","apple-wallet-button":"apple-wallet-sdk.js"},a=Object.keys(o).join(","),p=e.getAttribute("data-initial-token")?.trim(),g=e.src.slice(0,e.src.lastIndexOf("/"))||"",A=g?new URL(g).origin:"",v=new URL(g),I=`${A}${v.pathname}`;window.ApplePaySDK={...window.ApplePaySDK,token:p,publicPath:I,origin:A};function l(c){c.filter(M=>M.nodeType===Node.ELEMENT_NODE).forEach(M=>{let R=M.tagName.toLocaleLowerCase();R in o&&import(`${window.ApplePaySDK.publicPath}/${o[R]}`)})}let h=new MutationObserver((c,T)=>{for(let M of c)if(M.type==="childList"){for(let R of M.addedNodes)if(R.nodeType===Node.ELEMENT_NODE){let k=[...R.querySelectorAll(a)];R.tagName.toLocaleLowerCase()in o&&k.push(R),l(k)}}});l(Array.from(document.body.querySelectorAll(a))),h.observe(document.body,{childList:!0,subtree:!0})};document.readyState!=="loading"?t():window.addEventListener("DOMContentLoaded",t)})();})();