import{ai as t,d as n,aj as i,ak as e,al as s,am as o,M as a,an as l,_ as r,B as h,ao as p,ap as c,aq as d,ar as m,as as u,at as y,P as f,au as C,av as b,y as v,z as g,e as _,g as w,r as x,H as k,N as M,G as $,J as P,ae as S,D as T,aw as L,ax as B,W as E,q,ay as N,az as z,k as I,s as F,ah as O}from"./chunk.common_d3f72b1d.esm.js";const A=(t,n)=>n.every((n=>n in t));function V(n,i){return null!=n&&("cart"===(null==n?void 0:n.type)?function(n,i){A(n,["min_price","max_price","price","eligible","number_of_payment_terms","available_loan_types"])||i(t.Cart,JSON.stringify(n))}(n,i):function(n,i){var e;const s=A(n,["variants","max_price","min_price","number_of_payment_terms"]),o=(null===(e=n.variants)||void 0===e?void 0:e.length)>0&&A(n.variants[0],["id","price","eligible","available_loan_types","available"]);s&&o||i(t.Product,JSON.stringify(n))}(n,i),A(n,["min_price","max_price"]))}function H(n,i){return null!=n&&("cart"===n.type?function(n,i){if(!A(n,["min_price","max_price","price_per_term","eligible","number_of_payment_terms","full_price","financing_plans"]))return null==i||i(t.Cart,JSON.stringify(n)),!1;return!0}(n,i):function(n,i){var e;const s=A(n,["variants","max_price","min_price","financing_plans"]),o=(null===(e=n.variants)||void 0===e?void 0:e.length)>0&&A(n.variants[0],["id","price_per_term","eligible","full_price","available"]);if(!s||!o)return null==i||i(t.Product,JSON.stringify(n)),!1;return!0}(n,i))}class Z extends HTMLElement{constructor(){super(),this.t=!1,this.i=document.createElement("div"),this.attachShadow({mode:"open"})}static get observedAttributes(){return["variant-id","shopify-meta"]}connectedCallback(){var t;const n=this.o();null===(t=this.shadowRoot)||void 0===t||t.appendChild(n),this.i=n,this.t=!0}attributeChangedCallback(){var t;if(this.t){const n=this.o();null===(t=this.shadowRoot)||void 0===t||t.replaceChild(n,this.i),this.i=n}}disconnectedCallback(){var t;null===(t=this.shadowRoot)||void 0===t||t.removeChild(this.i)}o(){const t=this.getAttribute("shopify-meta"),n=this.getAttribute("variant-id"),i=Boolean(t&&H(JSON.parse(t))),e=document.createElement(i?"shop-pay-installments-banner":"shop-pay-banner");return n&&e.setAttribute("variant-id",n),t&&e.setAttribute("shopify-meta",t),e}}const j='\n \n

\n \n \n

\n',R=(t,n)=>`\nPay in 4 interest-free installments of ${t} with \n`,D=(t,n)=>`\nPay in 4 interest-free installments for orders over ${t} with \n`,J="CA Residents: Loans by Affirm Loan Services, LLC are made or arranged pursuant to a California Finance Lender license.",U='Rates from 0-36% APR. Payment options through Affirm are subject to an eligibility check, may not be available in all states, and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required.',W={INTEREST_AND_SPLIT_PAY:`The estimated payment amount excludes taxes and shipping. ${U} ${J}`,INTEREST_ONLY:`${U} ${J}`,SPLIT_PAY_ONLY:`The estimated payment amount excludes taxes and shipping. Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states. ${J}`,INELIGIBLE:`Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states. ${J}`,DYNAMIC_PDP:'The estimated payment amount excludes taxes and shipping. Rates range from 0-36% APR. Payment options through Shop Pay Installments are subject to an eligibility check and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required. More options may be available upon approval. State notices to consumers: affirm.com/licenses.'},Y=t=>`Choose your payment schedule at checkout – starting at 4 interest-free payments of ${t} every 2 weeks.`,G=()=>"Choose your payment schedule at checkout to split your purchase into monthly installments.",Q=t=>`Select installments at checkout to split your purchase into 4 interest-free payments of ${t} every 2 weeks.`,K=t=>`For orders over ${t}, select installments at checkout to split your purchase into 4 interest-free payments.`,X=t=>`For orders over ${t}, select installments at checkout to split your purchase into monthly payments.`,tt=t=>`For orders up to ${t}, select installments at checkout to split your purchase into multiple payments.`,nt=(t,n)=>`Sample ${1===t?"plan":"plans"} for ${n} purchase`,it="\n#shopify-payment-terms-modal .visually-hidden {\n border: 0;\n clip: rect(0, 0, 0, 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n}\n\n#shopify-payment-terms-modal .modal-wrapper {\n max-width: 432px;\n}\n\n#shopify-payment-terms-modal p {\n font-size: 18px;\n line-height: 150%;\n}\n\n#shopify-payment-terms-modal section {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,\n Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n}\n\n#shopify-payment-terms-modal .price {\n color: rgb(90, 49, 244);\n font-weight: 600;\n display: inline-flex;\n flex-direction: column;\n line-height: 1;\n align-items: center;\n}\n\n#shopify-payment-terms-modal .price__icon {\n width: 43px;\n height: 10px;\n}\n\n#shopify-payment-terms-modal .list {\n list-style: none;\n padding: 0;\n margin: 0;\n}\n\n#shopify-payment-terms-modal .list-item__subheading {\n font-size: 14px;\n line-height: 140%;\n color: rgba(0, 0, 0, 0.7);\n}\n\n#shopify-payment-terms-modal .btn__close--icon {\n display: inline-flex;\n flex-shrink: 0;\n padding: 16px;\n border-radius: 6px;\n}\n\n#shopify-payment-terms-modal .btn__close--icon:hover,\n#shopify-payment-terms-modal .btn__close--icon:active,\n#shopify-payment-terms-modal .btn__close--icon:focus {\n background-color: rgb(244, 241, 254);\n color: rgb(63, 34, 171);\n}\n\n#shopify-payment-terms-modal .help_text {\n margin-bottom: 19px;\n margin-top: 16px;\n font-size: 11px;\n line-height: 14px;\n color: rgba(0, 0, 0, 0.6);\n}\n\n#shopify-payment-terms-modal .help_text small {\n color: inherit;\n letter-spacing: 0.04rem;\n font-weight: 300;\n font-size: 11px;\n}\n\n#shopify-payment-terms-modal .help_text__link {\n color: rgba(0, 0, 0, 0.6);\n text-decoration: underline;\n}\n\n#shopify-payment-terms-modal .help_text__link:hover,\n#shopify-payment-terms-modal .help_text__link:active,\n#shopify-payment-terms-modal .help_text__link:focus {\n color: rgb(63, 34, 171);\n}\n\n#shopify-payment-terms-modal .tagline__bold {\n font-weight: 700;\n}\n\n#shopify-payment-terms-modal footer, #shopify-payment-terms-cover footer {\n text-align: center;\n}\n\n#shopify-payment-terms-modal .shop-pay-logo-wrapper,\n#shopify-payment-terms-cover .shop-pay-logo-wrapper {\n margin-bottom: 12px;\n}\n\n#shopify-payment-terms-modal .close__icon {\n width: 13px;\n height: 13px;\n}\n\n#shopify-payment-terms-modal .affirm-logo,\n#shopify-payment-terms-cover .affirm-logo {\n width: 39px;\n height: 21px;\n padding-left: 4px;\n box-sizing: content-box;\n}\n\n#shopify-payment-terms-modal .affirm-text,\n#shopify-payment-terms-cover .affirm-text {\n display: flex;\n font-size: 12px;\n font-weight: 300;\n line-height: 150%;\n color: rgba(0, 0, 0, 0.6);\n justify-content: center;\n align-items: center;\n}\n";class et{constructor(t){this.l=t=>{this.h&&t.target!==this.p()&&!this.m(t)&&(t.preventDefault(),t.stopPropagation(),this.h.focus())},this.u=t=>{this.C&&t.target===this.v&&this.C.focus()},this.g=t}lock(){const t=this.g.querySelectorAll('a[href], button:not([disabled]):not([tabindex="-1"]');this.C=t[0],this.h=t[t.length-1],this.v=this._(),this.g.appendChild(this.v),this.g.addEventListener("focus",this.u,!0),document.addEventListener("focus",this.l,!0)}release(t={}){this.g.removeEventListener("focus",this.u,!0),document.removeEventListener("focus",this.l,!0),this.k(),t instanceof HTMLElement&&t.focus()}_(){const t=document.createElement("button");return t.setAttribute("aria-hidden","true"),t.className="visually-hidden",t}k(){this.v&&this.g.removeChild(this.v)}m(t){const n=t.composedPath().find((t=>t instanceof Element&&t.ariaModal));return Boolean(n)}p(){const t=this.g.getRootNode();return t instanceof ShadowRoot?t.host:null}}function st(t){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}).format(t)}function ot(){var t,n,i;switch(null===(i=null===(n=null===(t=window.Shopify)||void 0===t?void 0:t.theme)||void 0===n?void 0:n.name)||void 0===i?void 0:i.toLowerCase()){case"boundless":case"brooklyn":return".cart__subtotal";case"dawn":return".totals__subtotal-value, .sections.cart.new_subtotal";case"debut":return".cart-subtotal__price";case"express":return".cart__subtotal, .cart-drawer__subtotal-value";case"minimal":return".h5.cart__subtotal-price";case"narrative":return".cart-subtotal__price, .cart-drawer__subtotal-number";case"simple":return".cart__subtotal.h3";case"supply":return".h1.cart-subtotal--price";case"venture":return".CartSubtotal"}return null}function at(){document.querySelector("[data-cart-subtotal]")||console.warn("[Shop Pay Installments] Cart price updates may not be handled automatically for this theme. To ensure the price shown in the Shop Pay Installments banner is updated correctly, follow the instructions found here: https://shopify.dev/themes/pricing-payments/installments#updating-the-banner-with-cart-total-changes")}function lt(t){var n,i,e;const s="#FFF";if(!t)return s;const o=t.host.parentElement&&(null===(n=getComputedStyle(t.host.parentElement).getPropertyValue("--payment-terms-background-color"))||void 0===n?void 0:n.trim()),a=null===(i=getComputedStyle(document.documentElement).getPropertyValue("--payment-terms-background-color"))||void 0===i?void 0:i.trim(),l=null===(e=getComputedStyle(document.documentElement).getPropertyValue("--color-body"))||void 0===e?void 0:e.trim(),r=o||a||l;return r&&CSS.supports("color",r)?r:s}function rt(t){return parseFloat(t.replace(/[^0-9.]/g,""))}function ht(t){const n=t.querySelector('select[name^="id"]')||t.querySelector('[name^="id"]');return n?Number(n.value):function(){const t=new URL(document.location.href).searchParams.get("variant");return t?Number(t):void 0}()}function pt(t,n){return{subTitle:nt(t,n),legalCopy:W.DYNAMIC_PDP}}function ct(t,n){return t.map((({pricePerTerm:t,apr:i,numberOfPaymentTerms:e,loanType:s})=>{const o=rt(t)*e,a=rt(n);return{pricePerTerm:t,apr:i,numberOfPaymentTerms:e,interest:st(0===i?0:o-a),totalPriceWithInterest:st(0===i?a:o),loanType:s}}))}function dt(t,n,i){return`\n \n
\n
\n
\n

Processing your request

\n

This can take up to a minute...

\n
\n
\n
\n ${ut()}\n ${yt()}\n
\n
\n
\n
\n \n \n `}function mt(t,n,i,e,s){return`\n \n `}function ut(){return'\n
\n \n
\n
\n Installments in partnership with\n \n
'}function yt(){return''}class ft extends HTMLElement{constructor(t,n,i,o,a,l,r,h){super(),this.M=!0,this.handleClose=()=>{this.$.trackModalAction(this.P,s.Close);const t=new Event("shopify_modal_close");this.dispatchEvent(t)},this.handleEscKey=t=>{"Escape"!==t.key&&"Esc"!==t.key||this.handleClose()},this.handleContinueToCheckout=()=>{this.M&&this.$.trackModalAction(this.P,s.ContinueToCheckout)},this.S=o,this.T=n,this.P=a,this.$=l;const p=document.createElement("template"),c=function(t){if(t&&t.includes(e.Interest))return["No hidden fees, ever.","No impact on your credit score to apply."];return["No fees, ever.","No impact on your credit score."]}(o),{subTitle:d,legalCopy:m}=function(t,n,i,s,o,a){if(!t||!s)return Ct(i,a,o);return t.includes(e.Interest)&&t.includes(e.SplitPay)?{subTitle:Y(n),legalCopy:W.INTEREST_AND_SPLIT_PAY}:t.includes(e.SplitPay)?{subTitle:Q(n),legalCopy:W.SPLIT_PAY_ONLY}:t.includes(e.Interest)?{subTitle:G(),legalCopy:W.INTEREST_ONLY}:Ct(i,a,o)}(o,t,i,n,h,r);p.innerHTML=function(t,n,i){return`\n \n \n \n `}(d,m,c),this.appendChild(p.content.cloneNode(!0))}connectedCallback(){this.L=this.querySelectorAll(".btn__close"),this.L&&0!==this.L.length&&(this.L.forEach((t=>t.addEventListener("click",this.handleClose))),this.L[0].focus(),window.addEventListener("keydown",this.handleEscKey))}disconnectedCallback(){this.L&&(this.L.forEach((t=>t.removeEventListener("click",this.handleClose))),window.removeEventListener("keydown",this.handleEscKey))}get price(){return this.getAttribute("price")||""}set price(t){this.setAttribute("price",t)}getModalToken(){return this.P}getModalHeight(){var t;return(null===(t=this.S)||void 0===t?void 0:t.length)&&this.T?this.S.includes(e.Interest)&&this.S.includes(e.SplitPay)?"550px":this.S.includes(e.SplitPay)?"508px":this.S.includes(e.Interest)?"515px":"535px":"473px"}getModalType(){var t;return(null===(t=this.S)||void 0===t?void 0:t.length)&&this.T?this.S.includes(e.Interest)&&this.S.includes(e.SplitPay)?o.Adaptive:this.S.includes(e.SplitPay)?o.SplitPay:o.InterestOnly:o.Ineligible}}function Ct(t,n,e){const s=null==t?void 0:t.minPrice,o=null==t?void 0:t.maxPrice,a=s?rt(s):null,l=n?rt(n):null;return a&&o?!l||l{const i=999999,e=document.createElement("div"),s=document.createElement("div");if(e.setAttribute("id","shopify-payment-terms-cover"),Object.assign(e.style,{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:i,background:"rgba(0,0,0,.3)"}),Object.assign(s.style,{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:i,background:"white",height:n,width:"432px",maxWidth:"95%",maxHeight:"95%",margin:"auto",borderRadius:"7px",padding:"32px",boxSizing:"border-box",overflow:"auto"}),window.innerWidth<430&&Object.assign(s.style,{borderRadius:"0px",height:"auto",width:"auto",maxHeight:"100%",maxWidth:"100%"}),s.appendChild(t),"animate"in s){const t=[{opacity:0},{opacity:1}],n=[{transform:"translateY(-15%)",opacity:0},{transform:"translateY(0)",opacity:1}];s.animate(n,{fill:"forwards",duration:150}),e.animate(t,{fill:"forwards",duration:150})}e.appendChild(s),document.body.appendChild(e),document.body.dataset.paymentTermsInitialStyles=JSON.stringify({overflow:document.body.style.overflow}),document.body.style.overflow="hidden"},vt=()=>{const t=document.querySelector("#shopify-payment-terms-cover");if(t&&(document.body.removeChild(t),document.body.dataset.paymentTermsInitialStyles)){const t=JSON.parse(document.body.dataset.paymentTermsInitialStyles);document.body.style.overflow=t.overflow,document.body.style.position=t.position,delete document.body.dataset.initialStyles}};class gt extends HTMLElement{constructor(){super(),this.B="$50",this.q="$3000",this.N=!1,this.T=!1,this.I=4,this.F=!1,this.S=[],this.O=t.Product,this.A="",this.t=!1,this.getContent=t=>{if(!this.S.length)return this.getIneligibleContent();if(this.S.includes(e.SplitPay))return R(t||"",this.A);return this.S.includes(e.Interest)?`\nSplit your purchase into monthly installments with \n`:this.getIneligibleContent()},this.getIneligibleContent=()=>D(this.B,this.A),this.updateVariant=t=>{var n;const i=null===(n=this.V)||void 0===n?void 0:n.find((n=>Number(n.id)===t));return this.T=Boolean(null==i?void 0:i.eligible),this.S=(null==i?void 0:i.available_loan_types)||[],this.updateBannerPrice(null==i?void 0:i.price),(null==i?void 0:i.price)||""},this.calculatePricePerTerm=(t,n)=>{const i=n.apr/1200,e=n.installments_count;if(0===i)return st(t/e);return st(t*i*Math.pow(1+i,e)/(Math.pow(1+i,e)-1))},this.updateBannerPrice=t=>{var n;let i;i=this.T?this.getContent(t):this.getIneligibleContent();const e=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector("#shopify-installments-content");e&&(e.innerHTML=i)},this.$=new a({elementName:"shop-pay-banner"}),this.H=new a({elementName:"shopify-installments-modal"}),customElements.get("shopify-installments-modal")||customElements.define("shopify-installments-modal",ft),customElements.get("shop-pay-logo")||customElements.define("shop-pay-logo",l),this.attachShadow({mode:"open"}).innerHTML=j}static get observedAttributes(){return["variant-id","shopify-meta"]}attributeChangedCallback(){this.t&&this.updateBanner()}connectedCallback(){return r(this,void 0,void 0,(function*(){this.updateBanner(),this.t=!0}))}updateBanner(){try{const n=this.getAttribute("shopify-meta");if(n){const i=JSON.parse(n);this.A=lt(this.shadowRoot),V(i,this.$.trackInvalidInstallmentBannerMetadata.bind(this.$))&&(i.type===t.Cart?(this.$.trackElementImpression(t.Cart),this.O=t.Cart,this.handleCartMeta(i)):(this.$.trackElementImpression(t.Product),this.O=t.Product,this.handleProductMeta(i))),this.updateLearnMoreButtonAndModal()}}catch(t){t instanceof TypeError&&t.message.match("Failed to construct 'HTMLElement': This instance is already constructed")?console.error(t):h.notify(t,(t=>{t.addMetadata("component",this.Z())})),this.j()}}updateLearnMoreButtonAndModal(){var t;return r(this,void 0,void 0,(function*(){const n=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".shopify-installments__learn-more"),e=p();if(n){n.innerHTML="Learn more",this.$.trackInstallmentsBannerImpression(this.O,c.PayInFour,this.T,d.CustomizedByMerchant,!1,void 0,this.R);const t=()=>{if(this.D&&!this.N){this.N=!0,this.H.trackElementImpression(this.O);const t={minPrice:this.B,maxPrice:this.q},s=new ft(this.D,this.T,t,this.S,e,this.H,void 0,i.SplitPay),o=new et(s.querySelector("#shopify-payment-terms-modal"));s.addEventListener("shopify_modal_close",(()=>{this.N=!1,vt(),o.release(n)}));const a=s.getModalHeight();bt(s,a),this.J(s,this.O),o.lock()}};this.U&&n.removeEventListener("click",this.U),this.U=t,n.addEventListener("click",t)}}))}handleProductMeta(t){this.V=t.variants,this.B=t.min_price,this.W=rt(this.B),this.q=t.max_price,this.Y=rt(this.q),this.R=Number(this.getAttribute("variant-id")),this.D=this.updateVariant(this.R),this.I=t.number_of_payment_terms;const n=this.G();if(n){const t=(i=0)=>{if(i>4)return;const e=ht(n);e&&(this.R===e?setTimeout((()=>{t(i+1)}),100):(this.D=this.updateVariant(e),this.R=e,this.updateLearnMoreButtonAndModal()))};this.F||(this.F=!0,n.addEventListener("change",(()=>{t()})))}}handleCartMeta(t){const n=ot();this.B=t.min_price,this.W=rt(this.B),this.q=t.max_price,this.Y=rt(this.q),this.S=t.available_loan_types,this.T=t.eligible,this.D=t.price,this.I=t.number_of_payment_terms,this.updateBannerPrice(this.D),n||at();new MutationObserver((t=>{t.forEach((t=>{if(t.target.nodeType!==Node.ELEMENT_NODE)return;const i=t.target;if((i.matches("[data-cart-subtotal]")||n&&i.matches(n))&&i.textContent){const t=rt(i.textContent);if(t){this.T=this.K(t);const n=this.X(t);if(n){const t=st(n);this.D=t,this.updateBannerPrice(t)}}}}))})).observe(document,{attributes:!0,childList:!0,subtree:!0})}X(t){if(!isNaN(t))return Math.floor(t/this.I*100)/100}K(t){return null!=this.W&&null!=this.Y&&t>=this.W&&t<=this.Y}J(t,n){this.H.trackModalOpened(n,t.getModalToken(),t.getModalType(),JSON.stringify([]),this.R,void 0)}G(){var t,n,i;return null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentNode)||void 0===n?void 0:n.host)||void 0===i?void 0:i.closest("form")}j(){this.shadowRoot&&(this.shadowRoot.innerHTML="")}Z(){return{name:"shop-pay-banner",shopifyMeta:this.getAttribute("shopify-meta"),variantId:this.getAttribute("variant-id")}}}class _t extends HTMLElement{constructor(t,n,i,e,o,a){var l;super(),this.M=!0,this.handleClose=()=>{this.$.trackModalAction(this.P,s.Close,this.tt);const t=new Event("shopify_modal_close");this.dispatchEvent(t)},this.handleEscKey=t=>{"Escape"!==t.key&&"Esc"!==t.key||this.handleClose()},this.handleContinueToCheckout=()=>{this.M&&this.$.trackModalAction(this.P,s.ContinueToCheckout,this.tt)};const r=document.createElement("template");this.P=t,this.$=n,this.M=null===(l=null==o?void 0:o.available)||void 0===l||l,this.nt=ct(i,e);const{subTitle:h,legalCopy:p}=pt(this.nt.length,e);r.innerHTML=dt(h,p,this.nt),this.appendChild(r.content.cloneNode(!0));const c=this.getElementsByClassName("navigation-buttons")[0],d=function(t){return!1===(null==t?void 0:t.available)?"Unavailable":"Continue to checkout"}(o);c.innerHTML=mt(window.location.origin,this.P,d,o,a),this.it=c.querySelector("shop-pay-button"),this.tt=a?a.token:m({storeUrl:window.location.origin,variants:o?u(o.idQuantityMapping):[],paymentOption:y.ShopPayInstallments,source:"installments_modal",sourceToken:this.P})}connectedCallback(){this.L=this.querySelectorAll(".btn__close"),this.L&&0!==this.L.length&&(this.L.forEach((t=>t.addEventListener("click",this.handleClose))),this.L[0].focus(),this.it&&this.it.addEventListener("click",this.handleContinueToCheckout),window.addEventListener("keydown",this.handleEscKey))}disconnectedCallback(){this.L&&(this.L.forEach((t=>t.removeEventListener("click",this.handleClose))),this.it&&this.it.removeEventListener("click",this.handleContinueToCheckout),window.removeEventListener("keydown",this.handleEscKey))}getModalSamplePlans(){return this.nt}getPermalink(){return this.tt}getModalToken(){return this.P}getModalHeight(){return"717px"}getModalType(){if(this.nt.some((t=>0===t.apr&&t.loanType===e.Interest))){return this.nt.every((t=>0===t.apr))?o.ZeroInterestOnly:o.ZeroInterest}return this.nt.some((t=>t.loanType===e.SplitPay))&&this.nt.some((t=>t.loanType===e.Interest))?o.Adaptive:o.InterestOnly}}var wt,xt;class kt extends HTMLElement{constructor(t,n,i,e,o,a,l,r,h,p){super(),wt.add(this),this.et=!1,this.st=b.AuthorizeLoaded,this.handleClose=()=>{this.$.trackModalAction(this.P,s.Close,this.tt);const t=new Event("shopify_modal_close");this.dispatchEvent(t);const n=document.querySelector(".prequal");n&&document.body.removeChild(n),this.ot()},this.handleEscKey=t=>{"Escape"!==t.key&&"Esc"!==t.key||!this.et?"Escape"!==t.key&&"Esc"!==t.key||this.handleClose():this.lt()},this.handleOverlayClose=()=>{var t;null===(t=document.querySelector("installments-prequal-overlay-modal"))||void 0===t||t.remove()},this.handleBuyerOnboardingSuccess=()=>{this.handleOverlayClose(),this.rt()},this.handlePrequalFlowSideEffect=t=>{this.ht=!0;t.detail.shopPayInstallmentsOnboarded?this.st=b.ResultsPageLoaded:this.st=b.BuyerFormOverlayLoaded,this.ct&&(this.removeCheckIfYouQualifyButtonLoading(),this.handleLoginCompleted())},this.handleLoginCompleted=()=>{if(this.ct=!0,this.ht)switch(this.st){case b.ResultsPageLoaded:this.rt();break;case b.BuyerFormOverlayLoaded:this.dt()}else this.addCheckIfYouQualifyButtonLoading()},this.addCheckIfYouQualifyButtonLoading=()=>{const t=v.Branded;this.ut=g(t),this.ut.classList.add("shop-status-indicator-loading"),this.yt.querySelector("shop-pay-button").classList.add("prequal-hidden-state"),this.yt.appendChild(this.ut),this.ut.connectedCallback(),this.ut.setStatus({status:"loading",message:""})},this.removeCheckIfYouQualifyButtonLoading=()=>{this.ut&&(this.yt.querySelector("shop-pay-button").classList.remove("prequal-hidden-state"),this.yt.removeChild(this.ut))};const c=document.createElement("template");this.P=t,this.$=n,this.ft=p||this.getAttribute(_)||w(),this.Ct=r,this.bt=h,this.S=i,this.T=e,this.vt=rt(a),this.gt=l,this.nt=ct(o,a);const{subTitle:d,legalCopy:f}=pt(this.nt.length,a);c.innerHTML=dt(d,f,this.nt),this.appendChild(c.content.cloneNode(!0)),this._t=this.querySelector(".shop-modal-content-processing"),this.wt=this.querySelector(".modal-wrapper"),this.xt=this.querySelector(".shop-modal-feature-iframe-wrapper"),this.yt=this.getElementsByClassName("navigation-buttons")[0],this.kt=this.getElementsByClassName("continue-to-checkout-button")[0],this.tt=h?h.token:m({storeUrl:window.location.origin,variants:r?u(r.idQuantityMapping):[],paymentOption:y.ShopPayInstallments,source:"installments_modal",sourceToken:this.P})}destroyIframe(){var t;null===(t=this.Mt)||void 0===t||t.destroy()}connectedCallback(){x(this,wt,"m",xt).call(this),window.addEventListener("keydown",this.handleEscKey),this.addOverlayEventListeners()}addOverlayEventListeners(){window.addEventListener("overlayClose",this.handleOverlayClose),window.addEventListener("buyerOnboardingSuccess",this.handleBuyerOnboardingSuccess),window.addEventListener("closeOverlayAndModal",(()=>{this.handleOverlayClose(),this.handleClose()}))}disconnectedCallback(){this.lt(),this.L&&(this.L.forEach((t=>t.removeEventListener("click",this.handleClose))),window.removeEventListener("keydown",this.handleEscKey),this.destroyIframe())}handlePostMessage(t){var n;switch(t.type){case"prequal_ready":null===(n=this.$t)||void 0===n||n.postMessage({type:"createprequal",amount:this.vt,currency:"USD",sellerId:Number(this.gt)});break;case"prequal_success":case"prequal_error":this.Pt();break;case"prequal_missing_information":this.St(),this.dt();break;case"close":this.handleClose();break;case"continue_to_checkout":this.Tt();break;case"resize_iframe":this.Lt.style.height=t.height0===t.apr&&t.loanType===e.Interest))){return this.nt.every((t=>0===t.apr))?o.ZeroInterestOnly:o.ZeroInterest}return this.nt.some((t=>t.loanType===e.SplitPay))&&this.nt.some((t=>t.loanType===e.Interest))?o.Adaptive:o.InterestOnly}rt(){if(this.Lt)return;this.ut=g(v.Large);const t=this._t.querySelector(".shop-modal-content-processing-loading-container");null==t||t.insertBefore(this.ut,t.firstChild),this.ut.setStatus({status:"loading",message:""});const n=(t=>{const n=f.replace("https://","");return`${f}/pay/installments/prequalifications/authorize?shopify_domain=${window.location.hostname}&pay_domain=${n}&analytics_trace_id=${t}&redirect_source=${window.location.origin}`})(this.ft);this.Lt=document.createElement("iframe"),this.Lt.style.border="none",this.Lt.src=n,this.xt.appendChild(this.Lt),this.Bt(),this.Mt||(this.Mt=this.createListener(new k(this.Lt))),this.$t||(this.$t=new M(this.Lt))}createListener(t){var n;const i=(null===(n=this.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0;return new $(t,[f,P,window.location.origin],this.handlePostMessage.bind(this),i)}Et(){return this.gt?Number.parseInt(this.gt,10):void 0}Tt(){var t;const n=this.querySelector("shop-pay-button").shadowRoot,i=null==n?void 0:n.querySelector("shop-pay-button-base"),e=null===(t=null==i?void 0:i.shadowRoot)||void 0===t?void 0:t.querySelector("#shop-pay-button-link");null==e||e.dispatchEvent(new MouseEvent("click")),null==i||i.dispatchEvent(new Event("click")),this.$.trackInstallmentsPrequalPopupPageImpression(this.Et(),b.ContinueToCheckoutClicked)}dt(){if(document.querySelector(".prequal-buyer-form-overlay"))return;const t=document.createElement("installments-prequal-overlay-modal");t.classList.add("prequal-buyer-form-overlay"),document.body.appendChild(t),this.$.trackInstallmentsPrequalPopupPageImpression(this.Et(),b.BuyerFormOverlayLoaded)}ot(){const t=document.querySelector(".prequal-buyer-form-overlay");t&&document.body.removeChild(t)}qt(){const t=document.querySelector(".prequal");(null==t?void 0:t.requestShow)||h.notify(new Error(`shopLoginButton.requestShow is not defined: ${t}`)),null==t||t.requestShow(""),this.et=!0,this.$.trackInstallmentsPrequalPopupPageImpression(this.Et(),b.AuthorizeLoaded)}lt(){this.et=!1}Bt(){this.wt.classList.add("opaque-hidden"),this._t.classList.remove("prequal-hidden-state"),this.xt.classList.add("prequal-hidden-state"),this.$.trackInstallmentsPrequalPopupPageImpression(this.Et(),b.ResultsPageLoading)}Pt(){var t,n,i,e;this.wt.classList.add("prequal-hidden-state"),this._t.classList.add("prequal-hidden-state"),this.xt.classList.remove("prequal-hidden-state"),this.kt.innerHTML=(t=window.location.origin,n=this.P,i=this.Ct,e=this.bt,`\n \n`)}St(){this.wt.classList.remove("opaque-hidden"),this._t.classList.add("prequal-hidden-state"),this.xt.classList.add("prequal-hidden-state")}}wt=new WeakSet,xt=function(){const t=!1===(null==(n=this.Ct)?void 0:n.available)?"Unavailable":"Check if you qualify";var n;this.yt.innerHTML=mt("",this.P,t,this.Ct,this.bt);const i=this.yt.querySelector("shop-pay-button"),e=i.shadowRoot,s=null==e?void 0:e.querySelector("#shop-pay-button-link");null==s||s.setAttribute("href","#");const o=document.createElement("shop-login-button");o.setAttribute("action",S.Prequal),o.setAttribute("client-id",""),o.setAttribute("version","2"),o.setAttribute("analytics-context",T.Prequal),o.setAttribute("analytics-trace-id",this.ft),o.setAttribute("hide-button","true"),o.classList.add("prequal"),o.setAttribute("anchor-to","shop-pay-button"),document.body.appendChild(o),i.addEventListener("click",(()=>{switch(this.st){case b.AuthorizeLoaded:const t=document.querySelector(".prequal");(null==t?void 0:t.requestShow)||h.notify(new Error("checkIfYouQualifyButton clicked: shopLoginButton.requestShow is not defined")),this.qt();break;case b.BuyerFormOverlayLoaded:this.dt();break;case b.ResultsPageLoaded:this.rt()}})),o.addEventListener("prequal_flow_side_effect",this.handlePrequalFlowSideEffect),o.addEventListener("completed",this.handleLoginCompleted),this.L=this.querySelectorAll(".btn__close"),this.L&&0!==this.L.length&&(this.L.forEach((t=>t.addEventListener("click",this.handleClose))),this.L[0].focus())};class Mt extends HTMLElement{constructor(){super(),this.B="$50",this.q="$3000",this.N=!1,this.T=!1,this.Nt=4,this.F=!1,this.S=[],this.O=t.Product,this.A="",this.t=!1,this.zt=!0,this.getContent=t=>{if(!this.S.length)return this.getIneligibleContent(this.A);if(this.It&&this.Ft())return n=t,i=this.A,s=0===this.It.apr,`\nFrom ${n}/mo ${s?"at":"or"} 0% APR with \n`;var n,i,s;if(this.It&&this.isInAdaptiveRangeWithoutZeroInterest())return((t,n)=>`4 interest-free installments, or from ${t}/mo with \n`)(t,this.A);if(this.S.includes(e.SplitPay))return R(t||"",this.A);return this.S.includes(e.Interest)?((t,n)=>`\nFrom ${t}/mo with \n`)(t,this.A):this.getIneligibleContent(this.A)},this.getIneligibleContent=t=>{const n=this.Ot===i.Monthly?((t,n)=>`\nSplit your purchase into monthly installments for orders over ${t} with \n`)(this.B,this.A):D(this.B,this.A);if(!this.At)return n;return rt(this.At)>rt(this.q)?((t,n)=>`\nSplit your purchase into installments for orders up to ${t} with \n`)(this.q,t):n},this.updatePDPVariant=(t,n)=>{var i;const s=null===(i=this.V)||void 0===i?void 0:i.find((n=>Number(n.id)===t));if(!s||!s.full_price)return this.T=!1,this.S=[],this.updateBannerPrice(),"";this.T=s.eligible,this.S=this.Vt(s.full_price,n),this.zt=s.available;const o=rt(s.full_price),a=this.Ht(o,n);if(!a)return this.updateBannerPrice(s.price_per_term),s.price_per_term;if(this.It=this.Zt(a),this.It.loan_type===e.SplitPay)return this.updateBannerPrice(s.price_per_term),s.price_per_term;const l=this.calculatePricePerTerm(o,this.It);return this.updateBannerPrice(l),l},this.calculatePricePerTerm=(t,n)=>{const i=n.apr/1200,e=n.installments_count;if(0===i)return st(t/e);return st(t*i*Math.pow(1+i,e)/(Math.pow(1+i,e)-1))},this.updateBannerPrice=t=>{var n;let i;i=this.T&&t?this.getContent(t):this.getIneligibleContent(this.A);const e=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector("#shopify-installments-content");e&&(e.innerHTML=i)},this.ft=p(),this.$=new a({elementName:"shop-pay-installments-banner",analyticsTraceId:this.ft}),this.H=new a({elementName:"shopify-installments-modal",analyticsTraceId:this.ft}),customElements.get("shopify-installments-modal")||customElements.define("shopify-installments-modal",ft),customElements.get("shopify-installments-sample-plans-modal")||customElements.define("shopify-installments-sample-plans-modal",_t),customElements.get("shopify-installments-prequal-modal")||customElements.define("shopify-installments-prequal-modal",kt),customElements.get("shop-pay-logo")||customElements.define("shop-pay-logo",l),this.attachShadow({mode:"open"}).innerHTML=j}static get observedAttributes(){return["variant-id","shopify-meta"]}attributeChangedCallback(){this.t&&this.updateBanner()}connectedCallback(){return r(this,void 0,void 0,(function*(){this.updateBanner(),this.t=!0}))}isInAdaptiveRangeWithoutZeroInterest(){return this.T&&!this.Ft()&&2===this.S.length&&this.S.includes(e.SplitPay)&&this.S.includes(e.Interest)}updateBanner(){try{const s=this.getAttribute("shopify-meta");if(s){const o=JSON.parse(s);this.A=lt(this.shadowRoot);const a=this.jt(o.financing_plans);this.Ot=(n=a)&&(n.includes(e.Interest)&&!n.includes(e.SplitPay)||n.includes(e.ZeroPercent))?i.Monthly:i.SplitPay,H(o,this.$.trackInvalidInstallmentBannerMetadata.bind(this.$))&&(o.type===t.Cart?(this.$.trackElementImpression(t.Cart),this.O=t.Cart,this.handleCartMeta(o)):(this.$.trackElementImpression(t.Product),this.O=t.Product,this.handleProductMeta(o))),this.updateLearnMoreButtonAndModal()}}catch(t){t instanceof TypeError&&t.message.match("Failed to construct 'HTMLElement': This instance is already constructed")?console.error(t):h.notify(t,(t=>{t.addMetadata("component",this.Z())})),this.j()}var n}Et(){return this.gt?Number.parseInt(this.gt,10):void 0}updateLearnMoreButtonAndModal(){var n;return r(this,void 0,void 0,(function*(){const i=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector(".shopify-installments__learn-more"),s=p();if(i){const n=1===this.S.length&&this.S[0]===e.Interest,{At:o,Rt:a}=this,l=(null==a?void 0:a.length)&&o&&(this.Ft()||n||this.isInAdaptiveRangeWithoutZeroInterest()),r=Boolean(this.T&&this.Dt);r?i.innerHTML="Check your purchasing power":this.T&&l?i.innerHTML="View sample plans":i.innerHTML="Learn more",this.$.trackInstallmentsBannerImpression(this.O,this.Jt(Boolean(l)),this.T,d.Standard,r,this.At,this.R),this.O===t.Cart&&l&&(this.Ut=yield this.Wt());const h=()=>{if(!this.D)return;const n=this.G(),e=this.O===t.Product?function(t){if(!t)return 1;const n=t.elements.quantity;if(n)return Number(n.value);const i=t.getAttribute("id"),e=null==i?void 0:i.replace("product-form-installment-",""),s=document.getElementById(`Quantity-${e}`);return s?Number(s.value):1}(n):void 0;if(!this.N){this.N=!0,this.H.trackElementImpression(this.O);const t={minPrice:this.B,maxPrice:this.q},n=e?this.buildVariantInfo(e):void 0;let r;this.Dt&&this.T?(r=new kt(s,this.H,this.S,this.T,a||[],o||"",this.gt,n,this.Ut,this.ft),this.H.trackInstallmentsBannerPrequalInteraction(this.O,this.Jt(!1),this.T,o||"",!0)):r=l?new _t(s,this.H,a,o,n,this.Ut):new ft(this.D,this.T,t,this.S,s,this.H,this.At,this.Ot);const h=new et(r.querySelector("#shopify-payment-terms-modal"));r.addEventListener("shopify_modal_close",(()=>{this.N=!1,vt(),h.release(i)})),this.Dt&&this.H.trackInstallmentsPrequalPopupPageImpression(this.Et(),b.IntroPageLoaded);const p=r.getModalHeight();bt(r,p),this.J(r,this.O),h.lock()}};this.U&&i.removeEventListener("click",this.U),this.U=h,i.addEventListener("click",h)}}))}handleProductMeta(t){this.V=t.variants,this.B=t.min_price,this.W=rt(this.B),this.q=t.max_price,this.Y=rt(this.q),this.R=Number(this.getAttribute("variant-id")),this.At=this.Yt(this.R),this.D=this.updatePDPVariant(this.R,t.financing_plans),this.gt=t.seller_id,this.Dt=t.installments_buyer_prequalification_enabled,this.Gt(t.financing_plans,this.At);const n=this.G();if(n){const i=(e=0)=>{if(e>4)return;const s=ht(n);s&&(this.R===s?setTimeout((()=>{i(e+1)}),100):(this.D=this.updatePDPVariant(s,t.financing_plans),this.At=this.Yt(s),this.Gt(t.financing_plans,this.At),this.R=s,this.updateLearnMoreButtonAndModal()))};this.F||(this.F=!0,n.addEventListener("change",(()=>{i()})))}}handleCartMeta(t){const n=ot();this.B=t.min_price,this.W=rt(this.B),this.q=t.max_price,this.Y=rt(this.q),this.At=t.full_price,this.S=this.Vt(this.At,t.financing_plans),this.T=t.eligible,this.It=this.getFinancingTermForCart(this.At,t.financing_plans),this.gt=t.seller_id,this.Dt=t.installments_buyer_prequalification_enabled,this.D=this.It?this.getCartPricePerTerm(this.At,this.It):t.price_per_term,this.Nt=this.It?this.It.installments_count:t.number_of_payment_terms,this.updateBannerPrice(this.D),this.S.length&&this.Gt(t.financing_plans,t.full_price),n||at();new MutationObserver((t=>{t.forEach((t=>{if(t.target.nodeType!==Node.ELEMENT_NODE)return;const i=t.target;if((i.matches("[data-cart-subtotal]")||n&&i.matches(n))&&i.textContent){const t=rt(i.textContent);if(t){this.At=i.textContent,this.T=this.K(t);const n=this.X(t);if(n){const t=st(n);this.D=t,this.updateBannerPrice(t)}}}}))})).observe(document,{attributes:!0,childList:!0,subtree:!0})}buildVariantInfo(t){return{idQuantityMapping:`${this.R}:${t}`,available:this.zt}}getCartPricePerTerm(t,n){const i=rt(t);return this.calculatePricePerTerm(i,n)}getFinancingTermForCart(t,n){const i=rt(t),e=this.Ht(i,n);if(e)return this.Zt(e)}Yt(t){var n;const i=null===(n=this.V)||void 0===n?void 0:n.find((n=>Number(n.id)===t));return null==i?void 0:i.full_price}Wt(){return r(this,void 0,void 0,(function*(){const t=L(window.location.origin);if(t)return B(t)}))}jt(t){const n=t?t[0]:null;if(!n)return[];return n.terms.map((t=>t.loan_type===e.SplitPay?e.SplitPay:0===t.apr?e.ZeroPercent:e.Interest))}Ht(t,n){return n.find((n=>{const i=rt(n.min_price),e=rt(n.max_price);return t>=i&&t<=e}))}Zt(t){const n=t.terms.reduce(((t,n)=>n.installments_count>t.installments_count?n:t));if(this.Ft())return n;const i=t.terms.find((t=>t.loan_type===e.SplitPay));return i&&!this.isInAdaptiveRangeWithoutZeroInterest()?i:n}Gt(t,n){if(!n)return;const i=rt(n),e=this.Ht(i,t);e&&(this.Rt=this.Qt(e.terms).map((t=>({pricePerTerm:this.calculatePricePerTerm(i,t),apr:t.apr,numberOfPaymentTerms:t.installments_count,loanType:t.loan_type}))))}Qt(t){if(t.length<3)return t;if(this.isInAdaptiveRangeWithoutZeroInterest())return[t[0],t[t.length-1]];const n=t.filter((t=>t.loan_type!==e.SplitPay));return n.length<3?n:[n[0],n[n.length-1]]}X(t){if(!isNaN(t))return Math.floor(t/this.Nt*100)/100}K(t){return null!=this.W&&null!=this.Y&&t>=this.W&&t<=this.Y}J(t,n){t instanceof ft?this.H.trackModalOpened(n,t.getModalToken(),t.getModalType(),JSON.stringify([]),this.R,this.At):this.H.trackModalOpened(n,t.getModalToken(),t.getModalType(),JSON.stringify(t.getModalSamplePlans()),this.R,this.At,t.getPermalink())}Jt(t){return t?this.isInAdaptiveRangeWithoutZeroInterest()?c.PayInFourAsLowAs:c.AsLowAs:c.PayInFour}Ft(){return this.S.includes(e.ZeroPercent)}Vt(t,n){if(!n||0===n.length||!t)return[];const i=rt(t),s=this.Ht(i,n);if(!s)return[];const o=new Set;return s.terms.forEach((t=>{t.loan_type===e.SplitPay?o.add(e.SplitPay):0===t.apr?o.add(e.ZeroPercent):o.add(e.Interest)})),Array.from(o)}G(){var t,n,i;return null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentNode)||void 0===n?void 0:n.host)||void 0===i?void 0:i.closest("form")}j(){this.shadowRoot&&(this.shadowRoot.innerHTML="")}Z(){return{name:"shop-pay-installments-banner",shopifyMeta:this.getAttribute("shopify-meta"),variantId:this.getAttribute("variant-id")}}}var $t,Pt,St;class Tt extends E{constructor(){super(),$t.add(this),Pt.set(this,void 0),customElements.get("shop-pay-logo")||customElements.define("shop-pay-logo",l)}connectedCallback(){const t=document.createElement("template");t.innerHTML='\n\n
\n \n

We need a bit more information.
\n Click continue and a new tab will open so you can provide your information securely.

\n Continue\n
\n',this.attachShadow({mode:"open"}).append(t.content.cloneNode(!0)),x(this,$t,"m",St).call(this)}disconnectedCallback(){var t;null===(t=this.Kt)||void 0===t||t.destroy(),this.Kt=void 0}attributeChangedCallback(){}handlePostMessage(t){var n,i,e;"close"===t.type&&(null===(n=x(this,Pt,"f"))||void 0===n||n.close(),this.dispatchCustomEvent("overlayClose")),"prequal_buyer_upsert_successful"===t.type&&(null===(i=x(this,Pt,"f"))||void 0===i||i.close(),this.dispatchCustomEvent("buyerOnboardingSuccess")),"error"===t.type&&(null===(e=x(this,Pt,"f"))||void 0===e||e.close(),this.dispatchCustomEvent("closeOverlayAndModal"))}handleContinueButtonClick(){if(x(this,Pt,"f")&&!x(this,Pt,"f").closed)x(this,Pt,"f").focus(),this.addPostMessageEventListener();else{const t=`${C()}/shopify_pay/prequal_authorize?target_origin=${window.location.origin}`;q(this,Pt,N({url:t,width:500,height:750}),"f"),x(this,Pt,"f")&&(x(this,Pt,"f").focus(),this.addPostMessageEventListener())}}addPostMessageEventListener(){x(this,Pt,"f")&&(this.Kt=new $(new z(x(this,Pt,"f")),[f],this.handlePostMessage.bind(this)))}}Pt=new WeakMap,$t=new WeakSet,St=function(){var t;const n=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("#installments-prequal-overlay-continue");n&&(n.onclick=()=>{this.handleContinueButtonClick()})},I()&&(F({bundle:"paymentTerms",bundleLocale:"en"}),O(),n("shopify-payment-terms",Z),n("shop-pay-banner",gt),n("shop-pay-installments-banner",Mt),n("installments-prequal-overlay-modal",Tt)); //# sourceMappingURL=client.payment-terms_1709649a.en.esm.js.map