1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7599],{2443(t,e,n){n.r(e),n.d(e,{default:()=>u});var i=n(1827),o=n(4899),s=n(2715);const r="#turnstile-container";let a=class extends o.Vue{constructor(){super(...arguments),this.amount=null,this.apiUrl=`/${this.language}/api/generate-pay-by-link`,this.error=!1,this.inputHasFocus=!1,this.token=null}mounted(){this.createTurnstileScript()}createTurnstileScript(){const t=document.createElement("script");t.async=!0,t.defer=!0,t.src="https://challenges.cloudflare.com/turnstile/v0/api.js",document.head.appendChild(t)}async renderCaptcha(){await this.$nextTick(),window.turnstile&&window.turnstile.render(r,{sitekey:this.siteKey,theme:"dark",callback:t=>{this.token=t}})}setAmount(t){this.amount=t}async clickDonate(){if(!this.token)return;this.error=!1;const t=window.open("","_blank");try{const e=await(0,s.A)(fetch(this.apiUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({donateConfigurationItem:this.donationId,amountInCents:this.amount,captchaToken:this.token}),credentials:"same-origin"}));if(!e.success)return this.error=!0,void(t&&t.close());t&&(t.location.href=e.url)}catch{this.error=!0,t&&t.close()}this.token=null,window.turnstile.reset(r)}inputFocus(){this.inputHasFocus=!0}inputBlur(){this.inputHasFocus=!1}isValidAmount(t){const e=this.parseMoney(t);return!Number.isNaN(Number(e))&&!(t&&!t.match(/^[0-9]*([,.][0-9]{0,2})?$/))}parseMoney(t){const e=t.replace(/,/g,".");return parseFloat(e)}get formattedAmount(){if(null===this.amount||void 0===this.amount)return null;let t=this.inputHasFocus?(this.amount/100).toString():(this.amount/100).toFixed(2).toString();return t=t.replace(".",","),t}set formattedAmount(t){t?this.isValidAmount(t)&&(this.amount=100*this.parseMoney(t)):this.amount=null}async onIsOpenChange(t){t&&this.renderCaptcha()}};(0,i.Cg)([(0,o.Prop)({type:String,required:!0})],a.prototype,"donationId",void 0),(0,i.Cg)([(0,o.Prop)({type:String,required:!0})],a.prototype,"language",void 0),(0,i.Cg)([(0,o.Prop)({type:String,required:!0})],a.prototype,"siteKey",void 0),(0,i.Cg)([(0,o.Prop)({type:Boolean,required:!0})],a.prototype,"isOpen",void 0),(0,i.Cg)([(0,o.Watch)("isOpen")],a.prototype,"onIsOpenChange",null),a=(0,i.Cg)([o.Component],a);const u=a}}]);
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.