1import"./errorReporter-Bcsmabke.js";try{let n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},y=new n.Error().stack;y&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[y]="7c0e6a54-ec16-4a0e-9599-20e3d6f1a7be",n._sentryDebugIdIdentifier="sentry-dbid-7c0e6a54-ec16-4a0e-9599-20e3d6f1a7be")}catch{}function K(){const n=document.getElementById("invoice-payment-config");if(!n)return;const y=n.dataset.stripeKey,M=n.dataset.stripeAccount,L=n.dataset.clientSecret||null,U=n.dataset.brandColor||"#0aa89e",P=n.dataset.braintreeToken||null,p=n.dataset.successUrl,S=n.dataset.payUrl,_=(n.dataset.locale||"auto").slice(0,2),i=window.PelcroI18n||{},u=document.getElementById("pay_button"),a=document.getElementById("pay-spinner"),s=document.getElementById("pay-button-label"),z=s?s.textContent:"",f=document.getElementById("card-errors"),b=document.getElementById("form-id"),T=document.getElementById("response-error-container"),k=document.getElementById("response-error");if(!b||!u)return;const D=document.getElementById("summary-header");D&&D.addEventListener("click",function(){const e=document.getElementById("summary-body"),t=document.getElementById("summary-toggle-text"),o=e.classList.toggle("hidden");t.textContent=o?i.show_more_details||"Show more details":i.hide_details||"Hide details"});const A=document.getElementById("copy-invoice-id");A&&A.addEventListener("click",function(){const e=document.getElementById("copy-invoice-id-text").textContent.trim();navigator.clipboard.writeText(e).then(function(){const t=document.getElementById("copy-invoice-id-text"),o=t.textContent;t.textContent=i.copied||"Copied!",setTimeout(function(){t.textContent=o},1500)}).catch(function(){})});const m=window.Stripe(y,{stripeAccount:M});var d=null;const g=document.getElementById("stripe-card-section"),h=document.getElementById("paypal-divider");P&&window.braintree&&document.getElementById("paypal-container")&&window.braintree.dropin.create({authorization:P,container:"#paypal-container",card:!1,paypal:{flow:"vault"},paypalCredit:!1},function(e,t){if(e){console.error("BrainTree Drop-in error:",e);return}d=t,t.on("paymentMethodRequestable",function(o){o.type==="PayPalAccount"&&(g&&g.classList.add("hidden"),h&&h.classList.add("hidden"),s&&(s.textContent="Pay with PayPal"))}),t.on("noPaymentMethodRequestable",function(){g&&g.classList.remove("hidden"),h&&h.classList.remove("hidden"),s&&(s.textContent=z)})});function H(){d.requestPaymentMethod(function(e,t){if(e){l(e.message),c();return}q(S,{gateway_nonce:t.nonce}).then(function(){window.location.href=p}).catch(function(o){l(o.message||i.unexpected_error||"An unexpected error occurred."),c()})})}function q(e,t){var r;const o=(r=document.querySelector('meta[name="csrf-token"]'))==null?void 0:r.getAttribute("content");return fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":o||""},body:JSON.stringify(t)}).then(function(I){return I.json().then(function(B){if(!I.ok){const C=new Error(B.error||"Request failed");throw C.status=I.status,C.data=B,C}return B})})}function l(e){T&&T.classList.remove("hidden"),k&&(k.textContent=e)}function c(){u.disabled=!1,a&&a.classList.add("hidden")}if(L){const e=m.elements({clientSecret:L,locale:_,appearance:{theme:"flat",variables:{colorPrimary:U,colorPrimaryText:"#ffffff",fontFamily:"Inter, Helvetica Neue, Helvetica, sans-serif",borderRadius:"8px",colorBackground:"#ffffff",colorText:"#111827",colorDanger:"#dc2626"},rules:{".Input":{border:"1px solid #d1d5db",boxShadow:"none"},".Input:focus":{border:"1px solid var(--colorPrimary)",boxShadow:"none"},".Label":{fontSize:"11px",fontWeight:"500",textTransform:"uppercase",letterSpacing:"0.05em",color:"#4b5563"}}}});e.create("payment",{layout:{type:"tabs"}}).mount("#payment-element"),b.addEventListener("submit",function(o){if(o.preventDefault(),u.disabled=!0,a&&a.classList.remove("hidden"),d&&d.isPaymentMethodRequestable()){H();return}m.confirmPayment({elements:e,confirmParams:{return_url:p}}).then(function(r){r.error&&(l(r.error.message),c())}
1).catch(function(r){l(r.message||i.unexpected_error||"An unexpected error occurred."),c()})});return}const x=m.elements({locale:_}),E={base:{color:"#1f2937",lineHeight:"20px",fontFamily:'"Inter", "Helvetica Neue", Helvetica, sans-serif',fontSmoothing:"antialiased",fontSize:"15px","::placeholder":{color:"#9ca3af"}},invalid:{color:"#dc2626",iconColor:"#dc2626"}},v=x.create("cardNumber",{style:E});v.mount("#card-number");const R=x.create("cardExpiry",{style:E});R.mount("#card-expiry");const N=x.create("cardCvc",{style:E});N.mount("#card-cvc");function w(e){e.error?(f.textContent=e.error.message,f.classList.remove("hidden")):f.classList.add("hidden"),u.disabled=!1,a&&a.classList.add("hidden")}v.on("change",w),R.on("change",w),N.on("change",w),b.addEventListener("submit",function(e){if(e.preventDefault(),u.disabled=!0,a&&a.classList.remove("hidden"),d&&d.isPaymentMethodRequestable()){H();return}m.createSource(v,{type:"card"}).then(function(t){t.error?(f.textContent=t.error.message,f.classList.remove("hidden"),c()):q(S,{gateway_token:t.source.id}).then(function(){window.location.href=p}).catch(function(o){o.status===402?m.confirmCardPayment(o.data.payment_intent.client_secret).then(function(r){r.error?(l(r.error.message),c()):window.location.href=p}):(l(o.message||i.unexpected_error||"An unexpected error occurred."),c())})})})}export{K as init};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.